@epa-wg/custom-element-dist 0.0.31 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/inspectionProfiles/Project_Default.xml +2 -1
- package/.storybook/main.ts +3 -7
- package/.storybook/preview.ts +4 -6
- package/README.md +4 -4
- package/coverage/coverage-final.json +7 -18
- package/coverage/index.html +30 -30
- 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 +719 -473
- package/coverage/src/custom-element/http-request.js/coverage.svg +1 -1
- package/coverage/src/custom-element/http-request.js.html +6 -6
- package/coverage/src/custom-element/index.html +29 -29
- package/coverage/src/custom-element/local-storage.js.html +1 -1
- package/coverage/src/custom-element/location-element.js.html +31 -31
- package/coverage/src/custom-element/module-url.js/coverage.svg +1 -1
- package/coverage/src/custom-element/module-url.js.html +20 -20
- package/coverage/src/index.html +1 -1
- package/coverage/src/mocks/handlers.ts.html +1 -1
- package/coverage/src/mocks/index.html +1 -1
- package/coverage/src/stories/coverage.svg +1 -1
- package/coverage/src/stories/{attributes.test.stories.ts → frame.canvas.ts}/coverage.svg +1 -1
- package/coverage/src/stories/frame.canvas.ts.html +175 -0
- package/coverage/src/stories/http-request.stories.ts.html +1 -1
- package/coverage/src/stories/index.html +14 -179
- package/coverage/src/stories/testStoryBook.ts.html +8 -8
- package/coverage/src/sum.ts.html +1 -1
- package/dist/custom-element-6slVaFEs.cjs +97 -0
- package/dist/custom-element-WnOqmEOe.js +609 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +30 -28
- package/dist/demo/a.html +51 -38
- package/dist/demo/attributes.html +153 -0
- package/dist/demo/data-slices.html +2 -2
- package/dist/demo/external-template.html +1 -0
- package/dist/demo/external-templates-sb-6.html +42 -0
- package/dist/demo/external-templates-sb-7.html +42 -0
- package/dist/demo/form.html +42 -0
- package/dist/demo/hex-grid-dce.html +1 -1
- package/dist/demo/hex-grid.html +1 -1
- package/dist/demo/html-template.html +1 -1
- package/dist/demo/module-url-sb-2.html +46 -0
- package/dist/demo/module-url-sb-4.html +48 -0
- package/dist/demo/module-url-sb-5.html +53 -0
- package/dist/demo/parameters.html +20 -1
- package/dist/demo/s.xml +66 -9
- package/dist/demo/s.xslt +89 -16
- package/dist/demo/ss.html +12 -22
- package/dist/mockServiceWorker.js +31 -8
- package/package.json +25 -26
- package/public/demo/a.html +51 -38
- package/public/demo/attributes.html +153 -0
- package/public/demo/data-slices.html +2 -2
- package/public/demo/external-template.html +1 -0
- package/public/demo/external-templates-sb-6.html +42 -0
- package/public/demo/external-templates-sb-7.html +42 -0
- package/public/demo/form.html +42 -0
- package/public/demo/hex-grid-dce.html +1 -1
- package/public/demo/hex-grid.html +1 -1
- package/public/demo/html-template.html +1 -1
- package/public/demo/module-url-sb-2.html +46 -0
- package/public/demo/module-url-sb-4.html +48 -0
- package/public/demo/module-url-sb-5.html +53 -0
- package/public/demo/parameters.html +20 -1
- package/public/demo/s.xml +66 -9
- package/public/demo/s.xslt +89 -16
- package/public/demo/ss.html +12 -22
- package/public/mockServiceWorker.js +31 -8
- package/src/custom-element/custom-element.d.ts +4 -0
- package/src/custom-element/custom-element.js +148 -66
- package/src/custom-element/demo/a.html +51 -38
- package/src/custom-element/demo/attributes.html +153 -0
- package/src/custom-element/demo/data-slices.html +2 -2
- package/src/custom-element/demo/external-template.html +1 -0
- package/src/custom-element/demo/form.html +42 -0
- package/src/custom-element/demo/hex-grid-dce.html +1 -1
- package/src/custom-element/demo/hex-grid.html +1 -1
- package/src/custom-element/demo/html-template.html +1 -1
- package/src/custom-element/demo/parameters.html +20 -1
- package/src/custom-element/demo/s.xml +66 -9
- package/src/custom-element/demo/s.xslt +89 -16
- package/src/custom-element/demo/ss.html +12 -22
- package/src/custom-element/ide/web-types-dce.json +1 -1
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +1 -1
- package/src/material/components/badge.html +240 -0
- package/src/material/components/dropdown.html +26 -14
- package/src/material/components/icon-link.html +1 -0
- package/src/material/components/icon.html +253 -0
- package/src/material/components/input.html +571 -0
- package/src/material/components/menu.html +7 -5
- package/src/material/components.html +48 -11
- package/src/material/theme/semantic.css +20 -1
- package/src/mocks/versions.mock.ts +1 -1
- package/src/stories/__screenshots__/attributes.test.stories.ts +1 -0
- package/src/stories/__screenshots__/external-template.test.stories.ts +1 -0
- package/src/stories/__screenshots__/module-url.test.stories.ts +1 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-definition-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-runtime-change-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Instance-Attributes-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Instance-Attributes-2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-cloneAs-el-newTag--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---3.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mix-to-from--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-definition-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-runtime-change-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Instance-Attributes-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Instance-Attributes-2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-cloneAs-el-newTag--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-headers-and-response-status-and-headers-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-delayed--5-seconds-response-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-error-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---3.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mix-to-from--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-url-and-slice-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-url-change-1.png +0 -0
- package/src/stories/attributes.test.stories.ts +177 -11
- package/src/stories/external-template.test.stories.ts +17 -15
- package/src/stories/frame.canvas.ts +31 -0
- package/src/stories/module-url.test.stories.ts +29 -61
- package/storybook-static/assets/Color-F6OSRLHC-Cbp293x2.js +1 -0
- package/storybook-static/assets/Configure-BrFr4SLE.js +165 -0
- package/storybook-static/assets/DocsRenderer-CFRXHY34-DhHzJiIO.js +2 -0
- package/storybook-static/assets/attributes.test.stories-CzWkKw0e.js +1 -0
- package/storybook-static/assets/attributes.test.stories-Gg9LQTEK.js +349 -0
- package/storybook-static/assets/{css.test.stories-Cgn6ICr0.js → css.test.stories-B_3ltOrx.js} +1 -1
- package/storybook-static/assets/custom-element-CPnvJnn8.js +97 -0
- package/storybook-static/assets/{dom-merge.test.stories-CBObfPWg.js → dom-merge.test.stories-nQxcgLoM.js} +1 -1
- package/storybook-static/assets/entry-preview-docs-Dwczwtsc.js +2 -0
- package/storybook-static/assets/external-template.test.stories-BivZqBTp.js +1 -0
- package/storybook-static/assets/{external-template.test.stories-VfKUQ8eu.js → external-template.test.stories-DZ-rjnfd.js} +39 -41
- package/storybook-static/assets/{form.test.stories-CnuGN7Zw.js → form.test.stories-DQhPYtMj.js} +1 -1
- package/storybook-static/assets/frame.canvas-ClTqYyMN.js +1 -0
- package/storybook-static/assets/{handlers-V_T7WjNK.js → handlers-CLkps6Nz.js} +17 -14
- package/storybook-static/assets/{http-request.stories-8NN1Coqm.js → http-request.stories-jo0f73nw.js} +1 -1
- package/storybook-static/assets/iframe-CZwRpnn9.js +199 -0
- package/storybook-static/assets/index-B68YUdzy.js +621 -0
- package/storybook-static/assets/index-BwkS7JH_.js +8 -0
- package/storybook-static/assets/index-CJQtnF9V.js +1 -0
- package/storybook-static/assets/index-Dr4PwNfd.js +240 -0
- package/storybook-static/assets/{local-storage.test.stories-Dk5Yqc7m.js → local-storage.test.stories-uA5EKRPf.js} +1 -1
- package/storybook-static/assets/{location-element.test.stories-56um6s5L.js → location-element.test.stories-Cu-6Elcg.js} +1 -1
- package/storybook-static/assets/module-url.test.stories-CD_wusXQ.js +142 -0
- package/storybook-static/assets/module-url.test.stories-CTjUAk3J.js +1 -0
- package/storybook-static/assets/preview-1xJJ3sKE.js +1 -0
- package/storybook-static/assets/preview-BFlNN3Wj.js +1 -0
- package/storybook-static/assets/preview-CTOeX_lO.js +1 -0
- package/storybook-static/assets/preview-Cm4PPhHS.js +50 -0
- package/storybook-static/assets/preview-CuCH40jj.js +2 -0
- package/storybook-static/assets/preview-DfTudP20.js +1 -0
- package/storybook-static/assets/{set-url.test.stories-B4E6hIe-.js → set-url.test.stories-CY7B9BVZ.js} +1 -1
- package/storybook-static/assets/{slice-events.test.stories-BR0F-B6I.js → slice-events.test.stories-BVnPXm6e.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-CgfJIyCr.js → slots.test.stories-Dxsa9KdA.js} +1 -1
- package/storybook-static/assets/{version-select.test.stories-nmxATIwv.js → version-select.test.stories-Buga1PAa.js} +1 -1
- package/storybook-static/demo/a.html +51 -38
- package/storybook-static/demo/attributes.html +153 -0
- package/storybook-static/demo/data-slices.html +2 -2
- package/storybook-static/demo/external-template.html +1 -0
- package/storybook-static/demo/external-templates-sb-6.html +42 -0
- package/storybook-static/demo/external-templates-sb-7.html +42 -0
- package/storybook-static/demo/form.html +42 -0
- package/storybook-static/demo/hex-grid-dce.html +1 -1
- package/storybook-static/demo/hex-grid.html +1 -1
- package/storybook-static/demo/html-template.html +1 -1
- package/storybook-static/demo/module-url-sb-2.html +46 -0
- package/storybook-static/demo/module-url-sb-4.html +48 -0
- package/storybook-static/demo/module-url-sb-5.html +53 -0
- package/storybook-static/demo/parameters.html +20 -1
- package/storybook-static/demo/s.xml +66 -9
- package/storybook-static/demo/s.xslt +89 -16
- package/storybook-static/demo/ss.html +12 -22
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +6 -10
- package/storybook-static/index.json +1 -1
- package/storybook-static/mockServiceWorker.js +31 -8
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +8 -8
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +391 -0
- package/storybook-static/sb-addons/essentials-docs-3/manager-bundle.js +230 -0
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/interactions-9/manager-bundle.js +58 -58
- package/storybook-static/sb-manager/globals-module-info.js +9 -0
- package/storybook-static/sb-manager/globals-runtime.js +10719 -10473
- package/storybook-static/sb-manager/runtime.js +4944 -6321
- package/coverage/src/stories/attributes.test.stories.ts.html +0 -514
- package/coverage/src/stories/css.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/css.test.stories.ts.html +0 -460
- package/coverage/src/stories/dom-merge.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/dom-merge.test.stories.ts.html +0 -706
- package/coverage/src/stories/external-template.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/external-template.test.stories.ts.html +0 -865
- package/coverage/src/stories/form.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/form.test.stories.ts.html +0 -661
- package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/local-storage.test.stories.ts.html +0 -1315
- package/coverage/src/stories/location-element.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/location-element.test.stories.ts.html +0 -523
- package/coverage/src/stories/module-url.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/module-url.test.stories.ts.html +0 -640
- package/coverage/src/stories/set-url.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/set-url.test.stories.ts.html +0 -433
- package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/slice-events.test.stories.ts.html +0 -952
- package/coverage/src/stories/slots.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/slots.test.stories.ts.html +0 -742
- package/coverage/src/stories/version-select.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/version-select.test.stories.ts.html +0 -397
- package/dist/custom-element-BbJMY20-.cjs +0 -97
- package/dist/custom-element-CoRNKeEP.js +0 -567
- package/storybook-static/assets/Color-F6OSRLHC-CFyd3TND.js +0 -1
- package/storybook-static/assets/Configure-UGTbPRKK.js +0 -165
- package/storybook-static/assets/DocsRenderer-CFRXHY34-Dpr5iB0o.js +0 -2
- package/storybook-static/assets/attributes.test.stories-DSOLHHOW.js +0 -152
- package/storybook-static/assets/custom-element-D59Fok1f.js +0 -97
- package/storybook-static/assets/entry-preview-docs-BbcIMweR.js +0 -2
- package/storybook-static/assets/iframe-DnhkgdtG.js +0 -2
- package/storybook-static/assets/index-3Sfy-t3H.js +0 -769
- package/storybook-static/assets/index-BcZLpTeD.js +0 -8
- package/storybook-static/assets/index-CIBI7sCB.js +0 -1
- package/storybook-static/assets/index-CxRwF5Or.js +0 -234
- package/storybook-static/assets/index-D-8MO0q_.js +0 -1
- package/storybook-static/assets/index-DN1RoK17.js +0 -1
- package/storybook-static/assets/index-DjJD7gkO.js +0 -1
- package/storybook-static/assets/module-url.test.stories-DEponQ7l.js +0 -208
- package/storybook-static/assets/preview-BhhEZcNS.js +0 -1
- package/storybook-static/assets/preview-CNKoaWES.js +0 -1
- package/storybook-static/assets/preview-Czc-sw5H.js +0 -2
- package/storybook-static/assets/preview-DAeyCMnM.js +0 -1
- package/storybook-static/assets/preview-DHPc-V4N.js +0 -1
- package/storybook-static/assets/preview-DYzi3Z2p.js +0 -1
- package/storybook-static/assets/preview-vbpHsp94.js +0 -52
- package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +0 -333
- package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +0 -40
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +0 -391
- package/storybook-static/sb-addons/links-1/manager-bundle.js +0 -3
- package/storybook-static/sb-preview/globals.js +0 -33
- package/storybook-static/sb-preview/runtime.js +0 -7174
- package/test-runner-jest.config.js +0 -15
- /package/storybook-static/sb-addons/{essentials-actions-3 → essentials-actions-2}/manager-bundle.js.LEGAL.txt +0 -0
- /package/storybook-static/sb-addons/{essentials-controls-2 → essentials-controls-1}/manager-bundle.js.LEGAL.txt +0 -0
- /package/storybook-static/sb-addons/{links-1 → essentials-docs-3}/manager-bundle.js.LEGAL.txt +0 -0
package/public/demo/s.xslt
CHANGED
|
@@ -1,20 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
|
2
|
+
xmlns:dce="urn:schemas-epa-wg:dce" xmlns:exsl="http://exslt.org/common" version="1.0"
|
|
3
|
+
exclude-result-prefixes="exsl">
|
|
3
4
|
<xsl:template match="ignore">
|
|
4
5
|
<xsl:choose>
|
|
5
|
-
<xsl:when test="//attr"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
</xsl:choose
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<xsl:
|
|
17
|
-
|
|
6
|
+
<xsl:when test="//attr">
|
|
7
|
+
<xsl:value-of select="//attr"/>
|
|
8
|
+
</xsl:when>
|
|
9
|
+
<xsl:otherwise>
|
|
10
|
+
<xsl:value-of select="def"/>
|
|
11
|
+
</xsl:otherwise>
|
|
12
|
+
</xsl:choose>
|
|
13
|
+
<xsl:value-of select="."/>
|
|
14
|
+
</xsl:template>
|
|
15
|
+
<xsl:template mode="payload" match="attributes">
|
|
16
|
+
<xsl:param name="v">
|
|
17
|
+
<xsl:choose>
|
|
18
|
+
<xsl:when test="//s[//s/event] ">
|
|
19
|
+
<xsl:value-of select="//s[//s/event] "/>
|
|
20
|
+
</xsl:when>
|
|
21
|
+
<xsl:when test=" //attributes/@v ">
|
|
22
|
+
<xsl:value-of select=" //attributes/@v "/>
|
|
23
|
+
</xsl:when>
|
|
24
|
+
<xsl:otherwise>
|
|
25
|
+
<xsl:value-of select=" 'def' "/>
|
|
26
|
+
</xsl:otherwise>
|
|
27
|
+
</xsl:choose>
|
|
28
|
+
</xsl:param>
|
|
29
|
+
<dce-root xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" data-dce-id="1">
|
|
30
|
+
<xsl:variable xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="has-input"
|
|
31
|
+
select="count(//s/*) > 0"/>
|
|
32
|
+
<xsl:attribute name="v">
|
|
33
|
+
<xsl:choose>
|
|
34
|
+
<xsl:when test="//s[//s/event] ">
|
|
35
|
+
<xsl:value-of select="//s[//s/event] "/>
|
|
36
|
+
</xsl:when>
|
|
37
|
+
<xsl:when test=" //attributes/@v ">
|
|
38
|
+
<xsl:value-of select=" //attributes/@v "/>
|
|
39
|
+
</xsl:when>
|
|
40
|
+
<xsl:otherwise>
|
|
41
|
+
<xsl:value-of select=" 'def' "/>
|
|
42
|
+
</xsl:otherwise>
|
|
43
|
+
</xsl:choose>
|
|
44
|
+
</xsl:attribute>
|
|
45
|
+
<dce-text xmlns="" data-dce-id="2">
|
|
46
|
+
|
|
47
|
+
//attributes/v='<xsl:value-of select="//attributes/v"/>'
|
|
48
|
+
</dce-text>
|
|
49
|
+
<br xmlns="" data-dce-id="3"/>
|
|
50
|
+
<dce-text xmlns="" data-dce-id="4">
|
|
51
|
+
//attributes/@v='<xsl:value-of select="//attributes/@v"/>'
|
|
52
|
+
</dce-text>
|
|
53
|
+
<br xmlns="" data-dce-id="5"/>
|
|
54
|
+
<dce-text xmlns="" data-dce-id="6">
|
|
55
|
+
$v='<xsl:value-of select="$v"/>'
|
|
56
|
+
</dce-text>
|
|
57
|
+
<br xmlns="" data-dce-id="7"/>
|
|
58
|
+
<dce-text xmlns="" data-dce-id="8">
|
|
59
|
+
//s='<xsl:value-of select="//s"/>'
|
|
60
|
+
</dce-text>
|
|
61
|
+
<br xmlns="" data-dce-id="9"/>
|
|
62
|
+
<dce-text xmlns="" data-dce-id="10">
|
|
63
|
+
A='<xsl:value-of select="//s[//s/event] | //attributes/v[not(//s/event)]"/>'
|
|
64
|
+
</dce-text>
|
|
65
|
+
<br xmlns="" data-dce-id="11"/>
|
|
66
|
+
<dce-text xmlns="" data-dce-id="12">
|
|
67
|
+
has-input =<xsl:value-of select=" $has-input "/>
|
|
68
|
+
</dce-text>
|
|
69
|
+
<br xmlns="" data-dce-id="13"/>
|
|
70
|
+
<xsl:variable xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="in-value">
|
|
71
|
+
<xsl:choose>
|
|
72
|
+
<xsl:when test="//s/event">
|
|
73
|
+
<xsl:value-of select="//s">
|
|
74
|
+
</xsl:value-of>
|
|
75
|
+
</xsl:when>
|
|
76
|
+
<xsl:when test="//attributes/@v">
|
|
77
|
+
<xsl:value-of select="//attributes/@v">
|
|
78
|
+
</xsl:value-of>
|
|
79
|
+
</xsl:when>
|
|
80
|
+
<xsl:otherwise>def</xsl:otherwise>
|
|
81
|
+
</xsl:choose>
|
|
82
|
+
</xsl:variable>
|
|
83
|
+
<xsl:variable xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="xx"
|
|
84
|
+
select="//s[//s/event] ?? //attributes/@v ?? 'def' "/>
|
|
85
|
+
<input xmlns="" slice="s" slice-event="input" value="{$in-value}" data-dce-id="14"/>
|
|
86
|
+
<dce-text xmlns="" data-dce-id="15">$in-value:<xsl:value-of select="$in-value"/> | $xx:<xsl:value-of
|
|
87
|
+
select="$xx"/>
|
|
88
|
+
</dce-text>
|
|
89
|
+
</dce-root>
|
|
90
|
+
</xsl:template>
|
|
18
91
|
<xsl:template match="/">
|
|
19
92
|
<xsl:apply-templates mode="payload" select="/datadom/attributes"/>
|
|
20
93
|
</xsl:template>
|
|
@@ -23,7 +96,7 @@
|
|
|
23
96
|
<xsl:param name="defaultvalue"/>
|
|
24
97
|
<xsl:choose>
|
|
25
98
|
<xsl:when test="//payload/*[@slot=$slotname]">
|
|
26
|
-
|
|
99
|
+
<xsl:copy-of select="//payload/*[@slot=$slotname]"/>
|
|
27
100
|
</xsl:when>
|
|
28
101
|
<xsl:otherwise>
|
|
29
102
|
<xsl:copy-of select="$defaultvalue"/>
|
package/public/demo/ss.html
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<dce-root data-dce-id="1"
|
|
3
|
-
xmlns="http://www.w3.org/1999/xhtml"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</
|
|
14
|
-
<fieldset data-dce-id="8" form="cem-autocomplete-form" xmlns=""><label data-dce-id="9" value="one"><input
|
|
15
|
-
data-dce-id="10" name="cem-autocomplete" slice="suggest" slice-event="input" type="radio" value="one"/>
|
|
16
|
-
<dce-text data-dce-id="11">One</dce-text>
|
|
17
|
-
</label><label data-dce-id="9" value="two"><input data-dce-id="10" name="cem-autocomplete" slice="suggest" slice-event="input"
|
|
18
|
-
type="radio" value="two"/>
|
|
19
|
-
<dce-text data-dce-id="11">Two</dce-text>
|
|
20
|
-
</label><label data-dce-id="9" value="three"><input data-dce-id="10" name="cem-autocomplete" slice="suggest"
|
|
21
|
-
slice-event="input" type="radio" value="three"/>
|
|
22
|
-
<dce-text data-dce-id="11">Three</dce-text>
|
|
23
|
-
</label></fieldset>
|
|
2
|
+
<dce-root data-dce-id="1" xmlns="http://www.w3.org/1999/xhtml" xmlns:dce="urn:schemas-epa-wg:dce"
|
|
3
|
+
xmlns:xhtml="http://www.w3.org/1999/xhtml"><label data-dce-id="2" xmlns=""><input data-dce-id="3"
|
|
4
|
+
slice="disabled-slice"
|
|
5
|
+
type="checkbox"
|
|
6
|
+
value="disabled"/>
|
|
7
|
+
<dce-text data-dce-id="4">disabled</dce-text>
|
|
8
|
+
</label>
|
|
9
|
+
<cem-input data-dce-id="6" value="123"/>
|
|
10
|
+
<button data-dce-id="7">Next</button>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
</p></form>
|
|
24
14
|
</dce-root>
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const PACKAGE_VERSION = '2.
|
|
12
|
-
const INTEGRITY_CHECKSUM = '
|
|
11
|
+
const PACKAGE_VERSION = '2.7.0'
|
|
12
|
+
const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
|
|
13
13
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
14
14
|
const activeClientIds = new Set()
|
|
15
15
|
|
|
@@ -62,7 +62,12 @@ self.addEventListener('message', async function (event) {
|
|
|
62
62
|
|
|
63
63
|
sendToClient(client, {
|
|
64
64
|
type: 'MOCKING_ENABLED',
|
|
65
|
-
payload:
|
|
65
|
+
payload: {
|
|
66
|
+
client: {
|
|
67
|
+
id: client.id,
|
|
68
|
+
frameType: client.frameType,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
66
71
|
})
|
|
67
72
|
break
|
|
68
73
|
}
|
|
@@ -155,6 +160,10 @@ async function handleRequest(event, requestId) {
|
|
|
155
160
|
async function resolveMainClient(event) {
|
|
156
161
|
const client = await self.clients.get(event.clientId)
|
|
157
162
|
|
|
163
|
+
if (activeClientIds.has(event.clientId)) {
|
|
164
|
+
return client
|
|
165
|
+
}
|
|
166
|
+
|
|
158
167
|
if (client?.frameType === 'top-level') {
|
|
159
168
|
return client
|
|
160
169
|
}
|
|
@@ -183,12 +192,26 @@ async function getResponse(event, client, requestId) {
|
|
|
183
192
|
const requestClone = request.clone()
|
|
184
193
|
|
|
185
194
|
function passthrough() {
|
|
186
|
-
|
|
195
|
+
// Cast the request headers to a new Headers instance
|
|
196
|
+
// so the headers can be manipulated with.
|
|
197
|
+
const headers = new Headers(requestClone.headers)
|
|
198
|
+
|
|
199
|
+
// Remove the "accept" header value that marked this request as passthrough.
|
|
200
|
+
// This prevents request alteration and also keeps it compliant with the
|
|
201
|
+
// user-defined CORS policies.
|
|
202
|
+
const acceptHeader = headers.get('accept')
|
|
203
|
+
if (acceptHeader) {
|
|
204
|
+
const values = acceptHeader.split(',').map((value) => value.trim())
|
|
205
|
+
const filteredValues = values.filter(
|
|
206
|
+
(value) => value !== 'msw/passthrough',
|
|
207
|
+
)
|
|
187
208
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
209
|
+
if (filteredValues.length > 0) {
|
|
210
|
+
headers.set('accept', filteredValues.join(', '))
|
|
211
|
+
} else {
|
|
212
|
+
headers.delete('accept')
|
|
213
|
+
}
|
|
214
|
+
}
|
|
192
215
|
|
|
193
216
|
return fetch(requestClone, { headers })
|
|
194
217
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export function log(x: any): void;
|
|
2
2
|
export function deepEqual(a: any, b:any): boolean|0;
|
|
3
|
+
export function cloneAs(sourceNode: HTMLElement, tag:string): HTMLElement;
|
|
4
|
+
export function mix(objTo: any, objFrom:any): any;
|
|
5
|
+
export function mergeAttr(fromEl: HTMLElement, toEL:HTMLElement): void;
|
|
6
|
+
|
|
3
7
|
export function xml2dom(xmlString:string): Document;
|
|
4
8
|
export function xmlString(doc:Node|Document): string;
|
|
5
9
|
export function obj2node(o:any, tag:string, doc:Document): HTMLElement;
|
|
@@ -5,7 +5,7 @@ const XSL_NS_URL = 'http://www.w3.org/1999/XSL/Transform'
|
|
|
5
5
|
|
|
6
6
|
// const log = x => console.debug( new XMLSerializer().serializeToString( x ) );
|
|
7
7
|
|
|
8
|
-
const attr = (el, attr)=> el
|
|
8
|
+
const attr = (el, attr)=> el?.getAttribute?.(attr)
|
|
9
9
|
, isText = e => e.nodeType === 3
|
|
10
10
|
, isString = s => typeof s === 'string'
|
|
11
11
|
, isNode = e => e && typeof e.nodeType === 'number'
|
|
@@ -15,6 +15,7 @@ const attr = (el, attr)=> el.getAttribute?.(attr)
|
|
|
15
15
|
, xslNs = x => ( x?.setAttribute('xmlns:xsl', XSL_NS_URL ), x )
|
|
16
16
|
, xslHtmlNs = x => ( x?.setAttribute('xmlns:xhtml', HTML_NS_URL ), xslNs(x) )
|
|
17
17
|
, isValidTagName = tag=> ( /^[_a-zA-Z][-_:a-zA-Z0-9]*$/ .test(tag) )
|
|
18
|
+
, mix = (o,kv) => { Object.keys(kv).map(k=> o[k] = kv[k] ) ; return o}
|
|
18
19
|
, create = ( tag, t = '', d=document ) =>
|
|
19
20
|
{
|
|
20
21
|
const create = tag => ( e => ((t && e.append(createText(d.ownerDocument||d, t))),e) )((d.ownerDocument || d ).createElement( tag ))
|
|
@@ -29,11 +30,13 @@ const attr = (el, attr)=> el.getAttribute?.(attr)
|
|
|
29
30
|
{ const px = p.ownerDocument.createElementNS(p.namespaceURI,tag);
|
|
30
31
|
for( let a of p.attributes)
|
|
31
32
|
px.setAttribute(a.name, a.value);
|
|
32
|
-
|
|
33
|
-
px.append(
|
|
33
|
+
for( let c of p.childNodes )
|
|
34
|
+
px.append(c.cloneNode(true));
|
|
34
35
|
return px;
|
|
35
36
|
};
|
|
36
37
|
|
|
38
|
+
export {cloneAs,mix};
|
|
39
|
+
|
|
37
40
|
function
|
|
38
41
|
ASSERT(x)
|
|
39
42
|
{
|
|
@@ -149,8 +152,13 @@ tagUid( node )
|
|
|
149
152
|
export function
|
|
150
153
|
createXsltFromDom( templateNode, S = 'xsl:stylesheet' )
|
|
151
154
|
{
|
|
155
|
+
const declaredAttributes = []
|
|
156
|
+
, hardcodedAttributes = {}
|
|
157
|
+
, exposedAttributes={};
|
|
158
|
+
|
|
152
159
|
if( templateNode.tagName === S || templateNode.documentElement?.tagName === S )
|
|
153
|
-
return tagUid(templateNode)
|
|
160
|
+
return tagUid(mix( templateNode, { declaredAttributes, hardcodedAttributes, exposedAttributes } ));
|
|
161
|
+
|
|
154
162
|
const sanitizeXsl = xml2dom(`<xsl:stylesheet version="1.0" xmlns:xsl="${ XSL_NS_URL }" xmlns:xhtml="${ HTML_NS_URL }" xmlns:exsl="${EXSL_NS_URL}" exclude-result-prefixes="exsl" >
|
|
155
163
|
<xsl:output method="xml"/>
|
|
156
164
|
<xsl:template match="/"><dce-root xmlns="${ HTML_NS_URL }"><xsl:apply-templates select="*" /></dce-root></xsl:template>
|
|
@@ -198,9 +206,9 @@ createXsltFromDom( templateNode, S = 'xsl:stylesheet' )
|
|
|
198
206
|
</xsl:template>
|
|
199
207
|
<xsl:template mode="sanitize" match="xhtml:input">
|
|
200
208
|
<xsl:element name="{local-name()}">
|
|
201
|
-
<xsl:apply-templates mode="sanitize" select="
|
|
209
|
+
<xsl:apply-templates mode="sanitize" select="*[not(name()='slice')]|@*|text()"/>
|
|
202
210
|
</xsl:element>
|
|
203
|
-
<xsl:for-each select="
|
|
211
|
+
<xsl:for-each select="slice">
|
|
204
212
|
<xsl:copy>
|
|
205
213
|
<xsl:attribute name="for" >^</xsl:attribute>
|
|
206
214
|
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
@@ -226,6 +234,8 @@ createXsltFromDom( templateNode, S = 'xsl:stylesheet' )
|
|
|
226
234
|
const d = xml2dom( '<xhtml/>' )
|
|
227
235
|
, n = d.importNode(r, true);
|
|
228
236
|
d.replaceChild(n,d.documentElement);
|
|
237
|
+
if( n.namespaceURI === HTML_NS_URL && !attr(n,'xmlns'))
|
|
238
|
+
n.setAttribute('xmlns',HTML_NS_URL);
|
|
229
239
|
return xslHtmlNs(n);
|
|
230
240
|
};
|
|
231
241
|
if( e )
|
|
@@ -285,35 +295,64 @@ createXsltFromDom( templateNode, S = 'xsl:stylesheet' )
|
|
|
285
295
|
[...fr.childNodes].forEach(n=>r.append(n));
|
|
286
296
|
fr.append(r)
|
|
287
297
|
}
|
|
288
|
-
|
|
298
|
+
|
|
299
|
+
[...fr.querySelectorAll('[test]')].forEach( n=>{
|
|
300
|
+
const t = attr(n,'test')
|
|
301
|
+
, r = t.replace(/hasBoolAttribute\((.*?)\)/g,
|
|
302
|
+
(match, p1, p2,p3,p4)=>
|
|
303
|
+
{ const a = p1.substring(1);
|
|
304
|
+
return `(not($${a} = \'false\') and ($${a} = '' or $${a} = '${a}' or $${a} = 'true' ))`
|
|
305
|
+
});
|
|
306
|
+
t!== r && n.setAttribute('test',r);
|
|
307
|
+
});
|
|
308
|
+
|
|
289
309
|
[...fr.querySelectorAll('dce-root>attribute')].forEach( a=>
|
|
290
310
|
{
|
|
291
311
|
keepAttributes(a,'namespace,name,select');
|
|
292
312
|
const p = cloneAs(a,'xsl:param')
|
|
293
313
|
, name = attr(a,'name');
|
|
314
|
+
|
|
315
|
+
declaredAttributes.push(name);
|
|
316
|
+
if( a.childNodes.length)
|
|
317
|
+
hardcodedAttributes[name] = a.textContent;
|
|
318
|
+
|
|
294
319
|
payload.append(p);
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
320
|
+
|
|
321
|
+
if( a.hasAttribute('select') )
|
|
322
|
+
{
|
|
323
|
+
exposedAttributes[ name ] = attr( a, 'select' );
|
|
324
|
+
keepAttributes( p, 'select,name' );
|
|
325
|
+
|
|
326
|
+
let select = attr(a,'select').split('??');
|
|
327
|
+
|
|
328
|
+
let val;
|
|
329
|
+
if( select?.length>1 )
|
|
330
|
+
{ p.removeAttribute('select');
|
|
331
|
+
const c = $( xslDom, 'template[match="ignore"]>choose').cloneNode(true);
|
|
332
|
+
emptyNode(c.firstElementChild).append( createText(c,'{'+select[0]+'}'));
|
|
333
|
+
c.firstElementChild.setAttribute('test',select[0]);
|
|
334
|
+
for( let i=1; i<select.length-1; i++)
|
|
335
|
+
{ const when = c.firstElementChild.cloneNode(true);
|
|
336
|
+
emptyNode(when).append( createText(c,'{'+select[i]+'}'));
|
|
337
|
+
when.setAttribute('test',select[i]);
|
|
338
|
+
c.insertBefore(when, c.lastElementChild);
|
|
339
|
+
}
|
|
340
|
+
emptyNode(c.lastElementChild ).append( createText(c,'{'+select[select.length-1]+'}'));
|
|
341
|
+
p.append(c);
|
|
342
|
+
val = c.cloneNode(true);
|
|
343
|
+
}else
|
|
344
|
+
val = cloneAs(a,'xsl:value-of');
|
|
345
|
+
val.removeAttribute('name');
|
|
346
|
+
a.append(val);
|
|
347
|
+
a.removeAttribute('select');
|
|
311
348
|
}else
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
349
|
+
{
|
|
350
|
+
keepAttributes( p, 'name' );
|
|
351
|
+
p.setAttribute('select','/datadom/attributes/'+name)
|
|
352
|
+
|
|
353
|
+
if( !hardcodedAttributes[name] )
|
|
354
|
+
a.remove();
|
|
355
|
+
}
|
|
317
356
|
});
|
|
318
357
|
[...fr.querySelectorAll('[value]')].filter(el=>el.getAttribute('value').match( /\{(.*)\?\?(.*)\}/g )).forEach(el=>
|
|
319
358
|
{ const v = attr(el,'value');
|
|
@@ -338,8 +377,8 @@ createXsltFromDom( templateNode, S = 'xsl:stylesheet' )
|
|
|
338
377
|
|
|
339
378
|
forEach$( payload,'slot', s => s.parentNode.replaceChild( slot2xsl(s), s ) )
|
|
340
379
|
|
|
341
|
-
const ret = tagUid(xslDom)
|
|
342
|
-
ret
|
|
380
|
+
const ret = tagUid(xslDom);
|
|
381
|
+
mix( ret, { declaredAttributes, hardcodedAttributes, exposedAttributes } );
|
|
343
382
|
return ret;
|
|
344
383
|
}
|
|
345
384
|
export async function
|
|
@@ -442,12 +481,15 @@ event2slice( x, sliceNames, ev, dce )
|
|
|
442
481
|
const v = notChecked? '' : el.value ?? attr( el, 'value' );
|
|
443
482
|
cleanSliceValue();
|
|
444
483
|
if( v === null || v === undefined )
|
|
484
|
+
{
|
|
445
485
|
[...s.childNodes].filter(n=>n.localName!=='event').map(n=>n.remove());
|
|
486
|
+
s.removeAttribute('value');
|
|
487
|
+
}
|
|
446
488
|
else
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
489
|
+
{ const ve = isString(v) ? createText( d, v) : obj2node(v,'value',s.ownerDocument);
|
|
490
|
+
s.append( ve );
|
|
491
|
+
s.setAttribute('value',v);
|
|
492
|
+
}
|
|
451
493
|
}
|
|
452
494
|
return s
|
|
453
495
|
})
|
|
@@ -494,10 +536,25 @@ const loadTemplateRoots = async ( src, dce )=>
|
|
|
494
536
|
}
|
|
495
537
|
export function mergeAttr( from, to )
|
|
496
538
|
{ for( let a of from.attributes)
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
539
|
+
try
|
|
540
|
+
{ const name = a.name;
|
|
541
|
+
if( a.namespaceURI )
|
|
542
|
+
{ if( !to.hasAttributeNS(a.namespaceURI, name) || to.getAttributeNS(a.namespaceURI, name) !== a.value )
|
|
543
|
+
to.setAttributeNS( a.namespaceURI, name, a.value )
|
|
544
|
+
}else
|
|
545
|
+
{ if( !to.hasAttribute(name) || to.getAttribute(name) !== a.value )
|
|
546
|
+
to.setAttribute( a.name, a.value )
|
|
547
|
+
}
|
|
548
|
+
if( a.name === 'value')
|
|
549
|
+
to.value = a.value
|
|
550
|
+
}catch(e)
|
|
551
|
+
{ console.warn('attribute assignment error',e?.message || e); }
|
|
552
|
+
const ea = to.dceExportedAttributes
|
|
553
|
+
, aa = to.getAttribute('dce-exported-attributes')
|
|
554
|
+
, em = aa ? new Set( aa.split(' ') ) : null;
|
|
555
|
+
for( let a of to.getAttributeNames() )
|
|
556
|
+
if( !from.hasAttribute(a) && !ea?.has(a) && !em?.has(a) )
|
|
557
|
+
to.removeAttribute(a)
|
|
501
558
|
}
|
|
502
559
|
export function assureUnique(n, id=0)
|
|
503
560
|
{
|
|
@@ -530,7 +587,7 @@ export function appendByDceId(parent,e,k)
|
|
|
530
587
|
}
|
|
531
588
|
export function merge( parent, fromArr )
|
|
532
589
|
{
|
|
533
|
-
if( 'dce-root' === parent.firstElementChild?.localName && 'dce-root' !== fromArr[0]
|
|
590
|
+
if( 'dce-root' === parent.firstElementChild?.localName && 'dce-root' !== fromArr[0]?.localName)
|
|
534
591
|
return;
|
|
535
592
|
if( !fromArr.length )
|
|
536
593
|
return 'dce-root' !== parent.firstElementChild?.localName && removeChildren(parent);
|
|
@@ -630,7 +687,7 @@ CustomElement extends HTMLElement
|
|
|
630
687
|
async connectedCallback()
|
|
631
688
|
{
|
|
632
689
|
if(this.firstElementChild && this.firstElementChild.localName !== 'template')
|
|
633
|
-
console.
|
|
690
|
+
console.log('custom-element used without template wrapping content\n', this.outerHTML);
|
|
634
691
|
const templateRoots = await loadTemplateRoots( attr( this, 'src' ), this )
|
|
635
692
|
, tag = attr( this, 'tag' )
|
|
636
693
|
, tagName = tag ? tag : 'dce-'+crypto.randomUUID();
|
|
@@ -658,13 +715,16 @@ CustomElement extends HTMLElement
|
|
|
658
715
|
, sliceNames = sliceNodes.map(e=>attr(e,'slice'))
|
|
659
716
|
.filter(n=>!n.includes('/'))
|
|
660
717
|
.filter((v, i, a)=>a.indexOf(v) === i)
|
|
661
|
-
.map(splitSliceNames).flat()
|
|
662
|
-
|
|
718
|
+
.map(splitSliceNames).flat();
|
|
719
|
+
|
|
720
|
+
const { declaredAttributes, hardcodedAttributes, exposedAttributes } = templateDocs[0];
|
|
721
|
+
const dceExportedAttributes = new Set([...Object.keys(hardcodedAttributes), ...Object.keys(exposedAttributes)]);
|
|
663
722
|
|
|
664
723
|
class DceElement extends HTMLElement
|
|
665
724
|
{
|
|
666
|
-
static get observedAttributes(){ return declaredAttributes
|
|
725
|
+
static get observedAttributes(){ return declaredAttributes; }
|
|
667
726
|
#inTransform = 0;
|
|
727
|
+
get dceExportedAttributes(){ return dceExportedAttributes; }
|
|
668
728
|
connectedCallback()
|
|
669
729
|
{ let payload = sanitizeBlankText(this.childNodes);
|
|
670
730
|
if( this.firstElementChild?.tagName === 'TEMPLATE' )
|
|
@@ -696,7 +756,12 @@ CustomElement extends HTMLElement
|
|
|
696
756
|
xslNs(payloadNode);
|
|
697
757
|
xslHtmlNs(payloadNode);
|
|
698
758
|
this.innerHTML='';
|
|
699
|
-
const attrsRoot = injectData( x, 'attributes' , this.attributes, e => createXmlNode( e.nodeName, e.value ) )
|
|
759
|
+
const attrsRoot = injectData( x, 'attributes' , this.attributes, e => createXmlNode( e.nodeName, e.value ) )
|
|
760
|
+
, inAttrs = a=> this.hasAttribute(a) || [...attrsRoot.children].find(e=>e.localName === a);
|
|
761
|
+
mergeAttr( this, attrsRoot );
|
|
762
|
+
Object.keys(hardcodedAttributes).map(a=> inAttrs(a) || attrsRoot.append(createXmlNode(a,hardcodedAttributes[a])) );
|
|
763
|
+
Object.keys(exposedAttributes).map(a=> inAttrs(a) || attrsRoot.append(createXmlNode(a)) );
|
|
764
|
+
|
|
700
765
|
injectData( x, 'dataset', Object.keys( this.dataset ), k => createXmlNode( k, this.dataset[ k ] ) );
|
|
701
766
|
const sliceRoot = injectData( x, 'slice', sliceNames, k => createXmlNode( k, '' ) )
|
|
702
767
|
, sliceXPath = x => xPath(x, sliceRoot);
|
|
@@ -728,27 +793,42 @@ CustomElement extends HTMLElement
|
|
|
728
793
|
const transform = this.transform = ()=>
|
|
729
794
|
{ if(this.#inTransform){ debugger }
|
|
730
795
|
this.#inTransform = 1;
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
if( v !== attr(this,a) )
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
796
|
+
const renderModel = ()=>
|
|
797
|
+
{
|
|
798
|
+
const ff = xp.map( (p,i) =>
|
|
799
|
+
{ const f = p.transformToFragment(x.ownerDocument, document)
|
|
800
|
+
if( !f )
|
|
801
|
+
console.error( "XSLT transformation error. xsl:\n", xmlString(templateDocs[i]), '\nxml:\n', xmlString(x) );
|
|
802
|
+
return f
|
|
803
|
+
});
|
|
804
|
+
ff.map( f =>
|
|
805
|
+
{ if( !f )
|
|
806
|
+
return;
|
|
807
|
+
assureUnique(f);
|
|
808
|
+
merge( this, f.childNodes )
|
|
809
|
+
})
|
|
810
|
+
let attrChangedCount = 0;
|
|
811
|
+
Object.entries(hardcodedAttributes).map(( [a,v] )=>
|
|
812
|
+
{ if( !this.hasAttribute(a) && v !== attr(this,a) )
|
|
813
|
+
{ this.setAttribute( a, v );
|
|
814
|
+
this.#applyAttribute( a, v );
|
|
815
|
+
attrChangedCount++;
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
Object.keys(exposedAttributes).map( a =>
|
|
820
|
+
{ let v = attr(this.firstElementChild,a);
|
|
821
|
+
if( v !== attr(this,a) )
|
|
822
|
+
{ this.setAttribute( a, v );
|
|
823
|
+
this.#applyAttribute( a, v );
|
|
824
|
+
attrChangedCount++;
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
return attrChangedCount;
|
|
828
|
+
};
|
|
829
|
+
if( renderModel() )
|
|
830
|
+
if( renderModel() )
|
|
831
|
+
console.warn("model update should not be the result of transform more than once");
|
|
752
832
|
|
|
753
833
|
function getSliceTarget(el)
|
|
754
834
|
{ let r = el;
|
|
@@ -836,13 +916,15 @@ CustomElement extends HTMLElement
|
|
|
836
916
|
#applyAttribute(name, newValue)
|
|
837
917
|
{ if( 'value' === name )
|
|
838
918
|
this.value = newValue;
|
|
919
|
+
const attrs = this.xml.querySelector('attributes');
|
|
839
920
|
let a = this.xml.querySelector(`attributes>${name}`);
|
|
840
921
|
if( a )
|
|
841
922
|
emptyNode(a).append( createText(a,newValue) );
|
|
842
923
|
else
|
|
843
924
|
{ a = create( name, newValue, this.xml );
|
|
844
|
-
|
|
925
|
+
attrs.append( a );
|
|
845
926
|
}
|
|
927
|
+
this.#inTransform || attrs.setAttribute(name,newValue);
|
|
846
928
|
|
|
847
929
|
this.dispatchEvent(new CustomEvent('change', { bubbles: true,detail: { [name]: newValue }}))
|
|
848
930
|
}
|