@epa-wg/custom-element-dist 0.0.32 → 0.0.34
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/.claude/settings.local.json +18 -0
- package/.github/workflows/deploy.yml +59 -0
- package/.idea/copilot.data.migration.agent.xml +6 -0
- package/.idea/copilot.data.migration.ask.xml +6 -0
- package/.idea/copilot.data.migration.edit.xml +6 -0
- package/.idea/custom-element-dist.iml +2 -0
- package/.storybook/main.ts +20 -21
- package/.storybook/preview.ts +23 -25
- package/README.md +6 -4
- package/coverage/block-navigation.js +1 -1
- package/coverage/coverage-final.json +8 -18
- package/coverage/index.html +45 -30
- package/coverage/sorter.js +21 -7
- 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 +687 -480
- package/coverage/src/custom-element/http-request.js/coverage.svg +1 -1
- package/coverage/src/custom-element/http-request.js.html +39 -18
- package/coverage/src/custom-element/index.html +35 -35
- 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/{stories/local-storage.test.stories.ts → material/theme/colors.js}/coverage.svg +1 -1
- package/coverage/src/material/theme/colors.js.html +217 -0
- package/coverage/src/{stories/location-element.test.stories.ts → material/theme}/coverage.svg +1 -1
- package/coverage/src/material/theme/index.html +116 -0
- 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/{external-template.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 +12 -12
- package/coverage/src/sum.ts.html +1 -1
- package/dist/custom-element-BoYMoUtP.js +619 -0
- package/dist/custom-element-BqtjrCRF.cjs +97 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +3 -3
- package/dist/demo/a.html +10 -3
- package/dist/demo/a.svg +26 -26
- package/dist/demo/attributes.html +153 -0
- package/dist/demo/external-templates-sb-6.html +42 -0
- package/dist/demo/external-templates-sb-7.html +42 -0
- package/dist/demo/html-template.html +5 -4
- 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/s.xml +3859 -7
- package/dist/demo/s.xslt +13 -48
- package/dist/demo/s1.xml +3706 -0
- package/dist/demo/ss.html +13 -4
- package/dist/http-request-DSaowcG1.cjs +1 -0
- package/dist/{http-request-BOvP4KTl.js → http-request-DTCzZ1gc.js} +15 -9
- package/dist/mockServiceWorker.js +31 -8
- package/package.json +25 -26
- package/public/demo/a.html +10 -3
- package/public/demo/a.svg +26 -26
- package/public/demo/attributes.html +153 -0
- package/public/demo/external-templates-sb-6.html +42 -0
- package/public/demo/external-templates-sb-7.html +42 -0
- package/public/demo/html-template.html +5 -4
- 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/s.xml +3859 -7
- package/public/demo/s.xslt +13 -48
- package/public/demo/s1.xml +3706 -0
- package/public/demo/ss.html +13 -4
- package/public/mockServiceWorker.js +31 -8
- package/src/custom-element/custom-element.d.ts +4 -0
- package/src/custom-element/custom-element.js +119 -50
- package/src/custom-element/demo/a.html +10 -3
- package/src/custom-element/demo/a.svg +26 -26
- package/src/custom-element/demo/attributes.html +153 -0
- package/src/custom-element/demo/html-template.html +5 -4
- package/src/custom-element/demo/s.xml +3859 -7
- package/src/custom-element/demo/s.xslt +13 -48
- package/src/custom-element/demo/s1.xml +3706 -0
- package/src/custom-element/demo/ss.html +13 -4
- package/src/custom-element/http-request.js +7 -0
- 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/angular.css +987 -987
- package/src/material/components/action.html +262 -0
- package/src/material/components/autocomplete.html +167 -239
- package/src/material/components/badge.html +239 -0
- package/src/material/components/dropdown.html +7 -13
- package/src/material/components/icon-link.html +160 -160
- package/src/material/components/icon.html +252 -0
- package/src/material/components/input.html +569 -362
- package/src/material/components/menu.html +235 -234
- package/src/material/components.html +157 -121
- package/src/material/demo.css +36 -36
- package/src/material/index.html +109 -110
- package/src/material/material.css +356 -356
- package/src/material/theme/Base-Principles.md +339 -0
- package/src/material/theme/README.md +298 -18
- package/src/material/theme/UI Domain Model in web applications.svg +1 -0
- package/src/material/theme/User Semantic Theme tokens.svg +1 -0
- package/src/material/theme/action-pending-poc.html +62 -0
- package/src/material/theme/actions-color.html +141 -0
- package/src/material/theme/colors-light.html +631 -0
- package/src/material/theme/colors-native.html +51 -0
- package/src/material/theme/colors-poc.html +66 -0
- package/src/material/theme/colors.html +297 -0
- package/src/material/theme/colors.js +44 -0
- package/src/material/theme/consumer-theme.css +745 -0
- package/src/material/theme/semantic.css +132 -113
- package/src/material/theme/style-bug.html +123 -0
- package/src/material/theme/theme-data.css +43 -0
- package/src/material/theme/theme-data.xhtml +2926 -0
- package/src/material/theme/todo.md +274 -0
- package/src/material/theme/tokens/action-colors.png +0 -0
- package/src/material/theme/tokens/cem-article-illustration-4x1-letterbox-2000x500.png +0 -0
- package/src/material/theme/tokens/cem-breakpoints.md +519 -0
- package/src/material/theme/tokens/cem-colors.md +715 -0
- package/src/material/theme/tokens/cem-consumerflow-typography-matrix.svg +198 -0
- package/src/material/theme/tokens/cem-coupling.md +372 -0
- package/src/material/theme/tokens/cem-data-vs-reading-numerals.svg +164 -0
- package/src/material/theme/tokens/cem-dimension.md +625 -0
- package/src/material/theme/tokens/cem-layering.md +562 -0
- package/src/material/theme/tokens/cem-m3-parity.md +343 -0
- package/src/material/theme/tokens/cem-responsive.md +238 -0
- package/src/material/theme/tokens/cem-shape.md +691 -0
- package/src/material/theme/tokens/cem-stroke-density-illustration-4to1-v3.svg +102 -0
- package/src/material/theme/tokens/cem-stroke.md +480 -0
- package/src/material/theme/tokens/cem-timing.md +198 -0
- package/src/material/theme/tokens/cem-typography-model-stack.svg +64 -0
- package/src/material/theme/tokens/cem-voice-fonts-typography.md +718 -0
- package/src/material/theme/tokens/cem-voice-ladder.svg +91 -0
- package/src/material/theme/tokens/chips.png +0 -0
- package/src/material/theme/tokens/columns-page.png +0 -0
- package/src/material/theme/tokens/initials.png +0 -0
- package/src/material/theme/tokens/nav-buttons.png +0 -0
- package/src/material/theme/tokens/script.png +0 -0
- package/src/material/theme/tokens/sufler.png +0 -0
- package/src/material/theme/tokens/typography-icons.png +0 -0
- package/src/mocks/versions.mock.ts +1 -1
- package/src/stories/__screenshots__/attributes.test.stories.ts +1 -0
- package/src/stories/__screenshots__/dom-merge.test.stories.ts/dom-merge-dom-merge-OrderPreservingOn2ndTransform-1.png +0 -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/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-MultipleIfOrderingWorkaround-1.png +0 -0
- package/src/stories/attributes.test.stories.ts +83 -17
- package/src/stories/dom-merge.test.stories.ts +25 -1
- package/src/stories/external-template.test.stories.ts +16 -14
- package/src/stories/frame.canvas.ts +31 -0
- package/src/stories/module-url.test.stories.ts +29 -61
- package/src/stories/xslt-conditionals.test.stories.ts +492 -0
- package/src/stories/xslt-if.test.stories.ts +89 -0
- package/storybook-static/assets/Color-F6OSRLHC-CzTOSlqB.js +1 -0
- package/storybook-static/assets/Configure-7GqRsAoJ.js +165 -0
- package/storybook-static/assets/DocsRenderer-CFRXHY34-Duc5rSIm.js +2 -0
- package/storybook-static/assets/{attributes.test.stories-D1X6EBrd.js → attributes.test.stories-DYuxF8h1.js} +109 -38
- package/storybook-static/assets/{css.test.stories-Cp_g2hE1.js → css.test.stories-LOmvINyb.js} +1 -1
- package/storybook-static/assets/custom-element-Bwx7otrT.js +97 -0
- package/storybook-static/assets/{dom-merge.test.stories-hbpdCka0.js → dom-merge.test.stories-CEKhWjaS.js} +47 -6
- package/storybook-static/assets/entry-preview-BNCt9WBs.js +26 -0
- package/storybook-static/assets/entry-preview-docs-CbF8-81D.js +2 -0
- package/storybook-static/assets/{external-template.test.stories-BK89h6sk.js → external-template.test.stories-jHu0wsJ-.js} +38 -40
- package/storybook-static/assets/{form.test.stories-BfoLe_rw.js → form.test.stories-CUyUnmwP.js} +1 -1
- package/storybook-static/assets/frame.canvas-E5n9h6j1.js +1 -0
- package/storybook-static/assets/{handlers-yVPwH_Nz.js → handlers-F7GUfMqr.js} +17 -14
- package/storybook-static/assets/http-request-BWeEEBkP.js +1 -0
- package/storybook-static/assets/{http-request.stories-CBFJS2Ws.js → http-request.stories-wyX5-QOv.js} +1 -1
- package/storybook-static/assets/iframe-BS_DPWl0.js +199 -0
- package/storybook-static/assets/index-CGuyH0k-.js +240 -0
- package/storybook-static/assets/index-DB7LLObI.js +1 -0
- package/storybook-static/assets/index-DO1nmyvI.js +11 -0
- package/storybook-static/assets/index-V1EGs-wm.js +621 -0
- package/storybook-static/assets/{local-storage.test.stories-C0Yzy6Am.js → local-storage.test.stories-BxOhsf1k.js} +1 -1
- package/storybook-static/assets/{location-element.test.stories-DNFrEu5A.js → location-element.test.stories-DqhvvUoa.js} +1 -1
- package/storybook-static/assets/module-url.test.stories-C1gG9G7Y.js +142 -0
- package/storybook-static/assets/preview-1xJJ3sKE.js +1 -0
- package/storybook-static/assets/preview-Bn8igYMp.js +1 -0
- package/storybook-static/assets/preview-CTOeX_lO.js +1 -0
- package/storybook-static/assets/preview-Cwy1XFu2.js +2 -0
- package/storybook-static/assets/preview-D6sehqkw.js +50 -0
- package/storybook-static/assets/preview-DfTudP20.js +1 -0
- package/storybook-static/assets/{set-url.test.stories-BBfLxv2u.js → set-url.test.stories-BKQNdknJ.js} +1 -1
- package/storybook-static/assets/{slice-events.test.stories-HcXF8XQI.js → slice-events.test.stories-ChqULCeA.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-i6mnIFM2.js → slots.test.stories-BlyLoCRe.js} +1 -1
- package/storybook-static/assets/{version-select.test.stories-BsUFH6Va.js → version-select.test.stories-CPGSh1tR.js} +1 -1
- package/storybook-static/assets/xslt-conditionals.test.stories-YC6QPqWZ.js +633 -0
- package/storybook-static/assets/xslt-if.test.stories-BRSWy2-x.js +71 -0
- package/storybook-static/demo/a.html +10 -3
- package/storybook-static/demo/a.svg +26 -26
- package/storybook-static/demo/attributes.html +153 -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/html-template.html +5 -4
- 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/s.xml +3859 -7
- package/storybook-static/demo/s.xslt +13 -48
- package/storybook-static/demo/s1.xml +3706 -0
- package/storybook-static/demo/ss.html +13 -4
- package/storybook-static/iframe.html +2 -2
- 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 +394 -0
- package/storybook-static/sb-addons/essentials-docs-3/manager-bundle.js +233 -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/coverage.svg +0 -10
- package/coverage/src/stories/attributes.test.stories.ts.html +0 -814
- 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.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.html +0 -1315
- 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-D2wf_rqP.js +0 -576
- package/dist/custom-element-Dtzhbjkc.cjs +0 -97
- package/dist/http-request-DPrY7mGh.cjs +0 -1
- package/storybook-static/assets/Color-F6OSRLHC-BU3iy8jH.js +0 -1
- package/storybook-static/assets/Configure-DN6ifayP.js +0 -165
- package/storybook-static/assets/DocsRenderer-CFRXHY34-BaVEufDj.js +0 -2
- package/storybook-static/assets/custom-element-uuAtIYWS.js +0 -97
- package/storybook-static/assets/entry-preview-DHVXbf3x.js +0 -26
- package/storybook-static/assets/entry-preview-docs-BbcIMweR.js +0 -2
- package/storybook-static/assets/http-request-DNq59pnj.js +0 -1
- package/storybook-static/assets/iframe-CJEL_4Nu.js +0 -2
- package/storybook-static/assets/index-BcZLpTeD.js +0 -8
- package/storybook-static/assets/index-CxRwF5Or.js +0 -234
- package/storybook-static/assets/index-D-8MO0q_.js +0 -1
- package/storybook-static/assets/index-D5fBh-7N.js +0 -1
- package/storybook-static/assets/index-DM-KBPdl.js +0 -1
- package/storybook-static/assets/index-RSFf30w1.js +0 -1
- package/storybook-static/assets/index-SnjB5uV8.js +0 -769
- package/storybook-static/assets/module-url.test.stories-CXibF5Ta.js +0 -208
- package/storybook-static/assets/preview-BhhEZcNS.js +0 -1
- package/storybook-static/assets/preview-Bnd0XhaF.js +0 -52
- package/storybook-static/assets/preview-CNKoaWES.js +0 -1
- package/storybook-static/assets/preview-DAeyCMnM.js +0 -1
- package/storybook-static/assets/preview-DHPc-V4N.js +0 -1
- package/storybook-static/assets/preview-DJMlNTk8.js +0 -2
- package/storybook-static/assets/preview-DYzi3Z2p.js +0 -1
- 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/dist/demo/ss.html
CHANGED
|
@@ -1,5 +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
|
-
|
|
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>
|
|
14
|
+
</dce-root>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const u=(l,e)=>l.getAttribute(e);class o extends HTMLElement{static observedAttributes=["value","slice","url","method","header-accept"];get requestHeaders(){const e={};return[...this.attributes].filter(t=>t.name.startsWith("header-")).map(t=>e[t.name.substring(7)]=t.value),e}get requestProps(){const e={};return[...this.attributes].filter(t=>!t.name.startsWith("header-")).filter(t=>!t.name.startsWith("slice")).map(t=>e[t.name]=t.value),e}disconnectedCallback(){this.#t?.()}connectedCallback(){setTimeout(()=>this.fetch(),0)}#e="";#t=()=>{};async fetch(){if(!this.closest("body"))return;const e=u(this,"url")||"";if(!e)return this.#t?.(),this.value={};if(this.#e===e)return;this.#e=e;const t=new AbortController;this.#t=()=>{t.abort(this.localName+" disconnected"),this.#e=""};const a={...this.requestProps,headers:this.requestHeaders},i={request:a},n=()=>this.dispatchEvent(new Event("change"));this.value=i,n();const c=await fetch(e,{...this.requestProps,signal:t.signal,headers:this.requestHeaders}),r={headers:{}};if([...c.headers].map(([s,h])=>r.headers[s]=h),"ok,status,statusText,type,url,redirected".split(",").map(s=>r[s]=c[s]),i.response=r,n(),r.headers["content-type"]?.includes("json"))try{i.data=await c.json(),n()}catch{}if(r.headers["content-type"]?.includes("xml"))try{const s=await c.text(),h=new DOMParser;i.data=h.parseFromString(s,"application/xml")?.documentElement,n()}catch{}}attributeChangedCallback(e,t,a){e==="url"&&t!==a&&(t&&this.#t?.(),a?setTimeout(()=>this.fetch(),10):(this.value={},setTimeout(()=>this.dispatchEvent(new Event("change")),10)))}}window.customElements.define("http-request",o);exports.HttpRequestElement=o;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l = (o, e) => o.getAttribute(e);
|
|
2
2
|
class u extends HTMLElement {
|
|
3
3
|
static observedAttributes = [
|
|
4
4
|
"value",
|
|
@@ -27,7 +27,7 @@ class u extends HTMLElement {
|
|
|
27
27
|
async fetch() {
|
|
28
28
|
if (!this.closest("body"))
|
|
29
29
|
return;
|
|
30
|
-
const e =
|
|
30
|
+
const e = l(this, "url") || "";
|
|
31
31
|
if (!e)
|
|
32
32
|
return this.#t?.(), this.value = {};
|
|
33
33
|
if (this.#e === e)
|
|
@@ -37,17 +37,23 @@ class u extends HTMLElement {
|
|
|
37
37
|
this.#t = () => {
|
|
38
38
|
t.abort(this.localName + " disconnected"), this.#e = "";
|
|
39
39
|
};
|
|
40
|
-
const
|
|
41
|
-
this.value =
|
|
42
|
-
const
|
|
43
|
-
if ([...
|
|
40
|
+
const a = { ...this.requestProps, headers: this.requestHeaders }, i = { request: a }, n = () => this.dispatchEvent(new Event("change"));
|
|
41
|
+
this.value = i, n();
|
|
42
|
+
const c = await fetch(e, { ...this.requestProps, signal: t.signal, headers: this.requestHeaders }), r = { headers: {} };
|
|
43
|
+
if ([...c.headers].map(([s, h]) => r.headers[s] = h), "ok,status,statusText,type,url,redirected".split(",").map((s) => r[s] = c[s]), i.response = r, n(), r.headers["content-type"]?.includes("json"))
|
|
44
44
|
try {
|
|
45
|
-
|
|
45
|
+
i.data = await c.json(), n();
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
if (r.headers["content-type"]?.includes("xml"))
|
|
49
|
+
try {
|
|
50
|
+
const s = await c.text(), h = new DOMParser();
|
|
51
|
+
i.data = h.parseFromString(s, "application/xml")?.documentElement, n();
|
|
46
52
|
} catch {
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
|
-
attributeChangedCallback(e, t,
|
|
50
|
-
e === "url" && t !==
|
|
55
|
+
attributeChangedCallback(e, t, a) {
|
|
56
|
+
e === "url" && t !== a && (t && this.#t?.(), a ? setTimeout(() => this.fetch(), 10) : (this.value = {}, setTimeout(() => this.dispatchEvent(new Event("change")), 10)));
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
window.customElements.define("http-request", u);
|
|
@@ -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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epa-wg/custom-element-dist",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -10,40 +10,39 @@
|
|
|
10
10
|
"preview": "vite preview",
|
|
11
11
|
"storybook": "storybook dev -p 6006",
|
|
12
12
|
"build-storybook": "storybook build",
|
|
13
|
-
"test": "node bin/vitest/vitest-browser-importmaps.mjs && vitest --coverage.enabled --coverage.all --no-file-parallelism --watch=false",
|
|
13
|
+
"test": "node bin/vitest/vitest-browser-importmaps.mjs && vitest --coverage.enabled --coverage.all --no-file-parallelism --watch=false ",
|
|
14
14
|
"test:ff": "yarn test --browser.name=firefox",
|
|
15
15
|
"test:watch": "vitest --inspect-brk --no-file-parallelism --browser.headless=false --test-timeout=0",
|
|
16
16
|
"test:storybook": "test-storybook",
|
|
17
17
|
"sb": "yarn storybook",
|
|
18
18
|
"t": "node ./node_modules/vitest/vitest.mjs --no-file-parallelism --watch --browser.headless=false src/stories/module-url.test.stories.ts",
|
|
19
|
-
"
|
|
19
|
+
"tt": "vitest --coverage.enabled --coverage.all --no-file-parallelism --watch --browser.headless=false src/stories/external-template.test.stories.ts "
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@epa-wg/custom-element": "0.0.
|
|
22
|
+
"@epa-wg/custom-element": "0.0.34"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"@storybook/addon-
|
|
27
|
-
"@storybook/addon-
|
|
28
|
-
"@storybook/addon-
|
|
29
|
-
"@storybook/
|
|
30
|
-
"@storybook/
|
|
31
|
-
"@storybook/test": "
|
|
32
|
-
"@storybook/
|
|
33
|
-
"@storybook/web-components": "
|
|
34
|
-
"@
|
|
35
|
-
"@vitest/
|
|
36
|
-
"@vitest/coverage-istanbul": "2.0.5",
|
|
25
|
+
"@storybook/addon-essentials": "8.5.3",
|
|
26
|
+
"@storybook/addon-interactions": "8.5.3",
|
|
27
|
+
"@storybook/addon-links": "8.5.3",
|
|
28
|
+
"@storybook/addon-mdx-gfm": "8.5.3",
|
|
29
|
+
"@storybook/blocks": "8.5.3",
|
|
30
|
+
"@storybook/test": "8.5.3",
|
|
31
|
+
"@storybook/test-runner": "0.21.0",
|
|
32
|
+
"@storybook/web-components": "8.5.3",
|
|
33
|
+
"@storybook/web-components-vite": "8.5.3",
|
|
34
|
+
"@vitest/browser": "3.0.5",
|
|
35
|
+
"@vitest/coverage-istanbul": "3.0.5",
|
|
37
36
|
"coverage-svg": "0.0.3",
|
|
38
|
-
"lit": "3.2.
|
|
39
|
-
"msw": "2.
|
|
40
|
-
"msw-storybook-addon": "
|
|
41
|
-
"playwright": "1.
|
|
42
|
-
"storybook": "
|
|
43
|
-
"typescript": "5.
|
|
44
|
-
"vite": "
|
|
45
|
-
"vitest": "
|
|
46
|
-
"webdriverio": "9.0
|
|
37
|
+
"lit": "3.2.1",
|
|
38
|
+
"msw": "2.7.0",
|
|
39
|
+
"msw-storybook-addon": "2.0.4",
|
|
40
|
+
"playwright": "1.50.1",
|
|
41
|
+
"storybook": "8.5.3",
|
|
42
|
+
"typescript": "5.7.3",
|
|
43
|
+
"vite": "6.1.0",
|
|
44
|
+
"vitest": "3.0.5",
|
|
45
|
+
"webdriverio": "9.9.0"
|
|
47
46
|
},
|
|
48
47
|
"msw": {
|
|
49
48
|
"workerDirectory": [
|
|
@@ -96,4 +95,4 @@
|
|
|
96
95
|
"./src/custom-element/ide/web-types-dce.json",
|
|
97
96
|
"./src/custom-element/ide/web-types-xsl.json"
|
|
98
97
|
]
|
|
99
|
-
}
|
|
98
|
+
}
|
package/public/demo/a.html
CHANGED
|
@@ -63,11 +63,18 @@
|
|
|
63
63
|
<body>
|
|
64
64
|
|
|
65
65
|
|
|
66
|
+
<custom-element tag="dce-link2" >
|
|
67
|
+
<template>
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
<template><i>loading SVG from templates file ...</i></template>
|
|
69
|
-
</custom-element>
|
|
69
|
+
<attribute name="p3" select="//attributes/p3 ?? 'def_P3' "></attribute>
|
|
70
70
|
|
|
71
|
+
p3: <code data-testid="t3">{$p3}</code>
|
|
72
|
+
</template>
|
|
73
|
+
</custom-element>
|
|
74
|
+
<section>
|
|
75
|
+
<dce-link2 id="dce2" p1="123" p2="override ignored as select is defined"></dce-link2>
|
|
76
|
+
|
|
77
|
+
</section>
|
|
71
78
|
|
|
72
79
|
</body>
|
|
73
80
|
</html>
|
package/public/demo/a.svg
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
<svg id="dwc-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 216 209.18" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
2
|
-
<defs>
|
|
3
|
-
|
|
4
|
-
</defs>
|
|
5
|
-
<polygon class="cls-3" points="0 82.47 0 126.71 34.84 146.83 34.84 187.06 73.16 209.18 108 189.07 142.84 209.18 181.16 187.06 181.16 146.83 216 126.71 216 82.47 181.16 62.35 181.16 22.12 142.84 0 108 20.12 73.16 0 34.84 22.12 34.84 62.35 0 82.47"/>
|
|
6
|
-
<path class="cls-2" d="m114.33,56.69l20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0Z"/>
|
|
7
|
-
<path class="cls-2" d="m98.19,62.71h0s-20.64-11.92-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84s0,0,0,0c0,5.13,1.89,8.4,6.33,10.97l20.65,11.92c.47.27.92,0,.92-.54v-23.84c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
8
|
-
<path class="cls-1" d="m48.12,66.01l20.65,11.92c.47.27.92,0,.92-.54v-23.84c0-5.13-1.89-8.4-6.33-10.97h0s-20.64-11.92-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84s0,0,0,0c0,5.13,1.89,8.4,6.33,10.97Z"/>
|
|
9
|
-
<path class="cls-2" d="m46.18,24.66l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0s20.64-11.92,20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06Z"/>
|
|
10
|
-
<path class="cls-2" d="m115.87,24.66l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0s20.64-11.92,20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06Z"/>
|
|
11
|
-
<path class="cls-2" d="m152.65,42.59c-4.44,2.56-6.33,5.84-6.33,10.97v23.84c0,.54.45.8.92.54l20.65-11.92c4.44-2.57,6.33-5.84,6.33-10.97h0v-23.84c0-.54-.45-.8-.92-.53l-20.64,11.92h0Z"/>
|
|
12
|
-
<path class="cls-2" d="m77.55,158.4l20.65-11.92h0c4.44-2.57,6.33-5.84,6.33-10.97v-23.84c0-.54-.45-.8-.92-.53l-20.64,11.92c-4.44,2.57-6.33,5.84-6.33,10.97h0s0,23.84,0,23.84c0,.54.45.8.92.54Z"/>
|
|
13
|
-
<path class="cls-4" d="m146.31,134.03v23.84c0,.54.45.8.92.54l20.65-11.92c4.44-2.57,6.33-5.84,6.33-10.97h0s0-23.84,0-23.84c0-.54-.45-.8-.92-.53l-20.64,11.92h0c-4.44,2.57-6.33,5.84-6.33,10.97Z"/>
|
|
14
|
-
<path class="cls-4" d="m63.35,123.06h0s-20.64-11.92-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84s0,0,0,0c0,5.13,1.89,8.4,6.33,10.97l20.65,11.92c.47.27.92,0,.92-.54v-23.84c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
15
|
-
<path class="cls-4" d="m103.61,151.37l-20.64,11.92c-4.44,2.57-6.33,5.84-6.33,10.97h0s0,23.84,0,23.84c0,.54.45.8.92.54l20.65-11.92h0c4.44-2.57,6.33-5.84,6.33-10.97v-23.84c0-.54-.45-.8-.92-.53Z"/>
|
|
16
|
-
<path class="cls-4" d="m63.35,163.29h0s-20.64-11.92-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84s0,0,0,0c0,5.13,1.89,8.4,6.33,10.97l20.65,11.92c.47.27.92,0,.92-.54v-23.84c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
17
|
-
<path class="cls-4" d="m28.51,102.94h0s-20.64-11.92-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84s0,0,0,0c0,5.13,1.89,8.4,6.33,10.97l20.65,11.92c.47.27.92,0,.92-.54v-23.84c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
18
|
-
<path class="cls-4" d="m133.04,163.29l-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84c0,5.13,1.89,8.4,6.33,10.97h0s20.65,11.92,20.65,11.92c.47.27.92,0,.92-.54v-23.84s0,0,0,0c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
19
|
-
<path class="cls-4" d="m173.29,151.37l-20.64,11.92h0c-4.44,2.57-6.33,5.84-6.33,10.97v23.84c0,.54.45.8.92.54l20.65-11.92c4.44-2.57,6.33-5.84,6.33-10.97h0s0-23.84,0-23.84c0-.54-.45-.8-.92-.53Z"/>
|
|
20
|
-
<path class="cls-4" d="m209.06,91.55c0-.54-.45-.8-.92-.53l-20.64,11.92h0c-4.44,2.57-6.33,5.84-6.33,10.97v23.84c0,.54.45.8.92.54l20.65-11.92c4.44-2.57,6.33-5.84,6.33-10.97h0v-23.84Z"/>
|
|
21
|
-
<path class="cls-2" d="m149.18,117.04l20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0Z"/>
|
|
22
|
-
<path class="cls-1" d="m112.39,98.05l20.65-11.92c4.44-2.57,6.33-5.84,6.33-10.97h0v-23.84c0-.54-.45-.8-.92-.53l-20.64,11.92h0c-4.44,2.57-6.33,5.84-6.33,10.97v23.84c0,.54.45.8.92.54Z"/>
|
|
23
|
-
<path class="cls-1" d="m100.13,105.12c.47-.27.47-.79,0-1.06l-20.65-11.92c-4.44-2.57-8.22-2.57-12.67,0h0s-20.65,11.92-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92h0c4.44,2.57,8.22,2.57,12.67,0l20.64-11.92Z"/>
|
|
24
|
-
<path class="cls-2" d="m65.29,85.01c.47-.27.47-.79,0-1.06l-20.65-11.92c-4.44-2.57-8.22-2.57-12.67,0h0s-20.65,11.92-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92h0c4.44,2.57,8.22,2.57,12.67,0l20.64-11.92Z"/>
|
|
25
|
-
<path class="cls-1" d="m133.04,123.06l-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84c0,5.13,1.89,8.4,6.33,10.97h0s20.65,11.92,20.65,11.92c.47.27.92,0,.92-.54v-23.84s0,0,0,0c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
26
|
-
<path class="cls-1" d="m184.02,96.93l20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0Z"/>
|
|
1
|
+
<svg id="dwc-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 216 209.18" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
2
|
+
<defs>
|
|
3
|
+
|
|
4
|
+
</defs>
|
|
5
|
+
<polygon class="cls-3" points="0 82.47 0 126.71 34.84 146.83 34.84 187.06 73.16 209.18 108 189.07 142.84 209.18 181.16 187.06 181.16 146.83 216 126.71 216 82.47 181.16 62.35 181.16 22.12 142.84 0 108 20.12 73.16 0 34.84 22.12 34.84 62.35 0 82.47"/>
|
|
6
|
+
<path class="cls-2" d="m114.33,56.69l20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0Z"/>
|
|
7
|
+
<path class="cls-2" d="m98.19,62.71h0s-20.64-11.92-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84s0,0,0,0c0,5.13,1.89,8.4,6.33,10.97l20.65,11.92c.47.27.92,0,.92-.54v-23.84c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
8
|
+
<path class="cls-1" d="m48.12,66.01l20.65,11.92c.47.27.92,0,.92-.54v-23.84c0-5.13-1.89-8.4-6.33-10.97h0s-20.64-11.92-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84s0,0,0,0c0,5.13,1.89,8.4,6.33,10.97Z"/>
|
|
9
|
+
<path class="cls-2" d="m46.18,24.66l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0s20.64-11.92,20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06Z"/>
|
|
10
|
+
<path class="cls-2" d="m115.87,24.66l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0s20.64-11.92,20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06Z"/>
|
|
11
|
+
<path class="cls-2" d="m152.65,42.59c-4.44,2.56-6.33,5.84-6.33,10.97v23.84c0,.54.45.8.92.54l20.65-11.92c4.44-2.57,6.33-5.84,6.33-10.97h0v-23.84c0-.54-.45-.8-.92-.53l-20.64,11.92h0Z"/>
|
|
12
|
+
<path class="cls-2" d="m77.55,158.4l20.65-11.92h0c4.44-2.57,6.33-5.84,6.33-10.97v-23.84c0-.54-.45-.8-.92-.53l-20.64,11.92c-4.44,2.57-6.33,5.84-6.33,10.97h0s0,23.84,0,23.84c0,.54.45.8.92.54Z"/>
|
|
13
|
+
<path class="cls-4" d="m146.31,134.03v23.84c0,.54.45.8.92.54l20.65-11.92c4.44-2.57,6.33-5.84,6.33-10.97h0s0-23.84,0-23.84c0-.54-.45-.8-.92-.53l-20.64,11.92h0c-4.44,2.57-6.33,5.84-6.33,10.97Z"/>
|
|
14
|
+
<path class="cls-4" d="m63.35,123.06h0s-20.64-11.92-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84s0,0,0,0c0,5.13,1.89,8.4,6.33,10.97l20.65,11.92c.47.27.92,0,.92-.54v-23.84c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
15
|
+
<path class="cls-4" d="m103.61,151.37l-20.64,11.92c-4.44,2.57-6.33,5.84-6.33,10.97h0s0,23.84,0,23.84c0,.54.45.8.92.54l20.65-11.92h0c4.44-2.57,6.33-5.84,6.33-10.97v-23.84c0-.54-.45-.8-.92-.53Z"/>
|
|
16
|
+
<path class="cls-4" d="m63.35,163.29h0s-20.64-11.92-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84s0,0,0,0c0,5.13,1.89,8.4,6.33,10.97l20.65,11.92c.47.27.92,0,.92-.54v-23.84c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
17
|
+
<path class="cls-4" d="m28.51,102.94h0s-20.64-11.92-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84s0,0,0,0c0,5.13,1.89,8.4,6.33,10.97l20.65,11.92c.47.27.92,0,.92-.54v-23.84c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
18
|
+
<path class="cls-4" d="m133.04,163.29l-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84c0,5.13,1.89,8.4,6.33,10.97h0s20.65,11.92,20.65,11.92c.47.27.92,0,.92-.54v-23.84s0,0,0,0c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
19
|
+
<path class="cls-4" d="m173.29,151.37l-20.64,11.92h0c-4.44,2.57-6.33,5.84-6.33,10.97v23.84c0,.54.45.8.92.54l20.65-11.92c4.44-2.57,6.33-5.84,6.33-10.97h0s0-23.84,0-23.84c0-.54-.45-.8-.92-.53Z"/>
|
|
20
|
+
<path class="cls-4" d="m209.06,91.55c0-.54-.45-.8-.92-.53l-20.64,11.92h0c-4.44,2.57-6.33,5.84-6.33,10.97v23.84c0,.54.45.8.92.54l20.65-11.92c4.44-2.57,6.33-5.84,6.33-10.97h0v-23.84Z"/>
|
|
21
|
+
<path class="cls-2" d="m149.18,117.04l20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0Z"/>
|
|
22
|
+
<path class="cls-1" d="m112.39,98.05l20.65-11.92c4.44-2.57,6.33-5.84,6.33-10.97h0v-23.84c0-.54-.45-.8-.92-.53l-20.64,11.92h0c-4.44,2.57-6.33,5.84-6.33,10.97v23.84c0,.54.45.8.92.54Z"/>
|
|
23
|
+
<path class="cls-1" d="m100.13,105.12c.47-.27.47-.79,0-1.06l-20.65-11.92c-4.44-2.57-8.22-2.57-12.67,0h0s-20.65,11.92-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92h0c4.44,2.57,8.22,2.57,12.67,0l20.64-11.92Z"/>
|
|
24
|
+
<path class="cls-2" d="m65.29,85.01c.47-.27.47-.79,0-1.06l-20.65-11.92c-4.44-2.57-8.22-2.57-12.67,0h0s-20.65,11.92-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92h0c4.44,2.57,8.22,2.57,12.67,0l20.64-11.92Z"/>
|
|
25
|
+
<path class="cls-1" d="m133.04,123.06l-20.64-11.92c-.47-.27-.92-.01-.92.53v23.84c0,5.13,1.89,8.4,6.33,10.97h0s20.65,11.92,20.65,11.92c.47.27.92,0,.92-.54v-23.84s0,0,0,0c0-5.13-1.89-8.4-6.33-10.97Z"/>
|
|
26
|
+
<path class="cls-1" d="m184.02,96.93l20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0Z"/>
|
|
27
27
|
</svg>
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
3
|
+
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
6
|
+
<title>parameters - custom-element Declarative Custom Element implementation demo</title>
|
|
7
|
+
<link rel="icon" href="./wc-square.svg" />
|
|
8
|
+
<script type="module" src="../location-element.js"></script>
|
|
9
|
+
<script type="module" src="../custom-element.js"></script>
|
|
10
|
+
<style>
|
|
11
|
+
@import "./demo.css";
|
|
12
|
+
|
|
13
|
+
button{ background: forestgreen; }
|
|
14
|
+
table{ min-width: 16rem; }
|
|
15
|
+
td{ border-bottom: 1px solid silver; }
|
|
16
|
+
tfoot td{ border-bottom: none; }
|
|
17
|
+
td,th{text-align: right; }
|
|
18
|
+
caption{ padding: 1rem; font-weight: bolder; font-family: sans-serif; }
|
|
19
|
+
</style>
|
|
20
|
+
</head>
|
|
21
|
+
<body>
|
|
22
|
+
<nav>
|
|
23
|
+
<a href="../index.html"><h3><code>custom-element</code> demo</h3></a>
|
|
24
|
+
</nav>
|
|
25
|
+
<main>
|
|
26
|
+
<p><code>attribute</code> is used for DCE attributes declaration and track the attributes changes. It also be used by IDE and validation.</p>
|
|
27
|
+
<p>The attribute can be changed by component itself and used as output to the container.
|
|
28
|
+
Usual case is when <code>value</code> attribute is updated from inside.</p>
|
|
29
|
+
<p>Initial value of attribute is available on the <code>attributes</code> node attribute as in <code>/datadom/attributes/@attr1</code></p>
|
|
30
|
+
<p>The current, i.e. including the changes by component itself, attribute value is a child node of <code>attributes</code> as in <code>/datadom/attributes/attr1</code>.</p>
|
|
31
|
+
<p>To define the attribute which is modified from within, the 3 parts are usually used as in <code>//s[//s/event] ?? //attributes/@v ?? 'def' </code>
|
|
32
|
+
<ol>
|
|
33
|
+
<li><code>//s[//s/event]</code> the slice <code>s</code> with event gives the slice value which was modified by user event like input</li>
|
|
34
|
+
<li><code>//attributes/@v</code> the attribute passed by container</li>
|
|
35
|
+
<li><code>'def' </code> the default value which used when no user input or attribute set by container</li>
|
|
36
|
+
</ol>
|
|
37
|
+
</p>
|
|
38
|
+
</main>
|
|
39
|
+
<html-demo-element legend="attributes definition" >
|
|
40
|
+
<p slot="description">
|
|
41
|
+
<code>attribute</code> is used for DCE attributes declaration and track the attributes changes. It also be used by IDE and validation.
|
|
42
|
+
|
|
43
|
+
</p>
|
|
44
|
+
<template>
|
|
45
|
+
<custom-element tag="dce-link" hidden>
|
|
46
|
+
<attribute name="p1" >default_P1 </attribute>
|
|
47
|
+
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
48
|
+
<attribute name="p3" select="//attributes/@p3 ?? 'def_P3' " ></attribute>
|
|
49
|
+
p1:{$p1} <br/> p2: {$p2} <br/> p3: {$p3}
|
|
50
|
+
</custom-element>
|
|
51
|
+
<dce-link id="dce1" ></dce-link>
|
|
52
|
+
<section>
|
|
53
|
+
<dce-link id="dce2" p1="123" p2="override ignored as select is defined"></dce-link> <br/>
|
|
54
|
+
<div><input id="i1" value="p1" /> <button onclick="dce2.setAttribute('p1',i1.value)"> set p1</button> </div>
|
|
55
|
+
<div><input id="i2" value="p2" /> <button onclick="dce2.setAttribute('p2',i2.value)"> set p2</button> </div>
|
|
56
|
+
<div><input id="i3" value="p3" /> <button onclick="dce2.setAttribute('p3',i3.value)"> set p3</button> </div>
|
|
57
|
+
</section>
|
|
58
|
+
<dce-link id="dce3" p1="123" p3="qwe"></dce-link> |
|
|
59
|
+
|
|
60
|
+
</template>
|
|
61
|
+
</html-demo-element>
|
|
62
|
+
|
|
63
|
+
<html-demo-element legend="attribute from slice">
|
|
64
|
+
<p slot="description">
|
|
65
|
+
When slice value points to attribute, it would be populated on slice change.<br/>
|
|
66
|
+
Type in the input field to see the variable $title change. <br/>
|
|
67
|
+
Hover the mouse to see the title attribute text popup.<br/>
|
|
68
|
+
Inspect DCE node in dev tools to see `title` attribute updated while typing.
|
|
69
|
+
|
|
70
|
+
</p>
|
|
71
|
+
|
|
72
|
+
<template>
|
|
73
|
+
<custom-element>
|
|
74
|
+
<template>
|
|
75
|
+
<attribute name="title" select="//title ?? '😃'" ></attribute>
|
|
76
|
+
<input slice="/datadom/attributes/title" slice-event="keyup"/>
|
|
77
|
+
title attribute: {$title}
|
|
78
|
+
</template>
|
|
79
|
+
</custom-element>
|
|
80
|
+
</template>
|
|
81
|
+
</html-demo-element>
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
<html-demo-element legend="V attribute matches input value" description="
|
|
85
|
+
Type in the input field and observe in DevTools the V attribute changed.
|
|
86
|
+
">
|
|
87
|
+
<template>
|
|
88
|
+
<custom-element tag="x-input" >
|
|
89
|
+
<template>
|
|
90
|
+
<attribute name="is-changed" select="count(//s/event) > 0"></attribute>
|
|
91
|
+
<attribute name="v" select="//s[//s/event] ?? //attributes/@v ?? 'def' "></attribute>
|
|
92
|
+
/datadom/attributes/v='{/datadom/attributes/v}'<br/>
|
|
93
|
+
same as v='{v}'<br/>
|
|
94
|
+
same as $v='{$v}'<br/>
|
|
95
|
+
//attributes/@v='{//attributes/@v}'<br/>
|
|
96
|
+
//s='{//s}'<br/>
|
|
97
|
+
is-changed ={ is-changed }<br/>
|
|
98
|
+
<input slice="s" slice-event="input" value="{//attributes/v}"/>
|
|
99
|
+
</template>
|
|
100
|
+
</custom-element>
|
|
101
|
+
<x-input></x-input>
|
|
102
|
+
<x-input v="V1"></x-input>
|
|
103
|
+
</template>
|
|
104
|
+
</html-demo-element>
|
|
105
|
+
|
|
106
|
+
<html-demo-element legend="attribute defaults, from container, and from slice" description="
|
|
107
|
+
Type in the input field and observe in DevTools the V attribute changed.
|
|
108
|
+
">
|
|
109
|
+
<template>
|
|
110
|
+
<custom-element tag="attr-demo">
|
|
111
|
+
<template>
|
|
112
|
+
<variable name="has-input" select="count(//s/*) > 0"></variable>
|
|
113
|
+
<attribute name="v" select="//s[//s/event] ?? //attributes/@v ?? 'def' "></attribute>
|
|
114
|
+
//attributes/v='{//attributes/v}'<br/>
|
|
115
|
+
//attributes/@v='{//attributes/@v}'<br/>
|
|
116
|
+
$v='{$v}'<br/>
|
|
117
|
+
//s='{//s}'<br/>
|
|
118
|
+
A='{//s[//s/event] | //attributes/v[not(//s/event)]}'<br/>
|
|
119
|
+
has-input ={ $has-input }<br/>
|
|
120
|
+
<input slice="s" slice-event="input" />
|
|
121
|
+
</template>
|
|
122
|
+
</custom-element>
|
|
123
|
+
|
|
124
|
+
<attr-demo></attr-demo>
|
|
125
|
+
<attr-demo v="From Container"></attr-demo>
|
|
126
|
+
</template>
|
|
127
|
+
</html-demo-element>
|
|
128
|
+
|
|
129
|
+
<details>
|
|
130
|
+
<summary>Attributes processing</summary>
|
|
131
|
+
To be available in template, <code>custom-element</code> attributes should be
|
|
132
|
+
defined by <code>attribute</code> markup as shown above.
|
|
133
|
+
The value is taken from attribute text content or from <code>select</code> XPath expression<br/>
|
|
134
|
+
|
|
135
|
+
Declared in such way, attributes are exposed via <code><a
|
|
136
|
+
href="https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes"
|
|
137
|
+
>observedAttributes</a></code>. <br/>
|
|
138
|
+
The template exposes those attributes as <code>xsl:param</code> which makes the attribute value available as
|
|
139
|
+
xsl variable (as attribute name prefixed with $). <br/>
|
|
140
|
+
After transformation the attributes values are read from CE root and copied into DCE component. <br/>
|
|
141
|
+
The DCE attribute change from outside invokes <code>attributeChangedCallback</code> which triggers DCE re-render.
|
|
142
|
+
<p>
|
|
143
|
+
The <code>value</code> attribute is usual case to be propagated from within of <code>custom-element</code>.
|
|
144
|
+
See the <a href="./form.html#sample-5">using custom-element as form input</a> example.
|
|
145
|
+
</p>
|
|
146
|
+
• <a href="https://github.com/EPA-WG/custom-element/blob/main/docs/attributes.md">Design docs</a>
|
|
147
|
+
</details>
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
<script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js"></script>
|
|
151
|
+
|
|
152
|
+
</body>
|
|
153
|
+
</html>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
3
|
+
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
4
|
+
<head>
|
|
5
|
+
<!--
|
|
6
|
+
|
|
7
|
+
This page is part of src/stories/module-url.test.stories.ts, test #2
|
|
8
|
+
|
|
9
|
+
-->
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
14
|
+
<title>importmap custom-element Declarative Custom Element implementation demo</title>
|
|
15
|
+
<link rel="icon" href="./wc-square.svg"/>
|
|
16
|
+
<style>
|
|
17
|
+
dce-root {
|
|
18
|
+
box-shadow: 0 0 0.5rem lime;
|
|
19
|
+
padding: 1rem;
|
|
20
|
+
display: inline-block;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
<script type="importmap">
|
|
24
|
+
{
|
|
25
|
+
"imports": {
|
|
26
|
+
"lib-root/": "./lib-dir/",
|
|
27
|
+
"embed-lib": "./lib-dir/embed-lib.html"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
<script type="module" src="../src/custom-element/location-element.js"></script>
|
|
32
|
+
<script type="module" src="../src/custom-element/module-url.js"></script>
|
|
33
|
+
<script type="module" src="../src/custom-element/custom-element.js"></script>
|
|
34
|
+
</head>
|
|
35
|
+
<body>
|
|
36
|
+
<p>Should render formula</p>
|
|
37
|
+
<custom-element src="./html-template.html#sophomores-dream">
|
|
38
|
+
<template><i>loading MathML from HTML file ...</i></template>
|
|
39
|
+
</custom-element>
|
|
40
|
+
|
|
41
|
+
</body>
|
|
42
|
+
</html>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
3
|
+
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
4
|
+
<head>
|
|
5
|
+
<!--
|
|
6
|
+
|
|
7
|
+
This page is part of src/stories/module-url.test.stories.ts, test #2
|
|
8
|
+
|
|
9
|
+
-->
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
14
|
+
<title>importmap custom-element Declarative Custom Element implementation demo</title>
|
|
15
|
+
<link rel="icon" href="./wc-square.svg"/>
|
|
16
|
+
<style>
|
|
17
|
+
dce-root {
|
|
18
|
+
box-shadow: 0 0 0.5rem lime;
|
|
19
|
+
padding: 1rem;
|
|
20
|
+
display: inline-block;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
<script type="importmap">
|
|
24
|
+
{
|
|
25
|
+
"imports": {
|
|
26
|
+
"lib-root/": "./lib-dir/",
|
|
27
|
+
"embed-lib": "./lib-dir/embed-lib.html"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
<script type="module" src="../src/custom-element/location-element.js"></script>
|
|
32
|
+
<script type="module" src="../src/custom-element/module-url.js"></script>
|
|
33
|
+
<script type="module" src="../src/custom-element/custom-element.js"></script>
|
|
34
|
+
</head>
|
|
35
|
+
<body>
|
|
36
|
+
<p>Should render tree</p>
|
|
37
|
+
<custom-element src="./html-template.xhtml#embedded-xsl">
|
|
38
|
+
<template>whole XSLT is embedded into HTML body</template>
|
|
39
|
+
</custom-element>
|
|
40
|
+
|
|
41
|
+
</body>
|
|
42
|
+
</html>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
3
3
|
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
4
5
|
<title>template based on HTML file</title>
|
|
5
6
|
<style>svg {
|
|
6
7
|
width: 4rem;
|
|
@@ -8,9 +9,9 @@
|
|
|
8
9
|
</head>
|
|
9
10
|
<body>
|
|
10
11
|
<script>console.error('Stranger danger!')</script>
|
|
11
|
-
<b id="wave">👋</b>
|
|
12
|
-
<b id="ok">👌</b>
|
|
13
|
-
<svg id="dwc-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 216 209.18">
|
|
12
|
+
<b id="wave" data-testid="wave" >👋</b>
|
|
13
|
+
<b id="ok" data-testid="ok" >👌</b>
|
|
14
|
+
<svg id="dwc-logo" data-testid="dwc-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 216 209.18">
|
|
14
15
|
<defs>
|
|
15
16
|
<style>.cls-1 {
|
|
16
17
|
fill: #c2e6f1;
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
<path class="cls-1"
|
|
74
75
|
d="m184.02,96.93l20.64-11.92c.47-.27.47-.79,0-1.06l-20.65-11.92h0c-4.44-2.57-8.22-2.57-12.67,0l-20.65,11.92c-.47.27-.47.79,0,1.06l20.64,11.92c4.44,2.57,8.22,2.57,12.67,0h0Z"/>
|
|
75
76
|
</svg>
|
|
76
|
-
<math id="sophomores-dream" display="block">
|
|
77
|
+
<math id="sophomores-dream" data-testid="ml-test" display="block">
|
|
77
78
|
<mrow>
|
|
78
79
|
<msubsup>
|
|
79
80
|
<mo>∫</mo>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
3
|
+
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
4
|
+
<head>
|
|
5
|
+
<!--
|
|
6
|
+
|
|
7
|
+
This page is part of src/stories/module-url.test.stories.ts, test #2
|
|
8
|
+
|
|
9
|
+
-->
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
14
|
+
<title>importmap custom-element Declarative Custom Element implementation demo</title>
|
|
15
|
+
<link rel="icon" href="./wc-square.svg"/>
|
|
16
|
+
<script type="importmap">
|
|
17
|
+
{
|
|
18
|
+
"imports": {
|
|
19
|
+
"lib-root/": "./lib-dir/",
|
|
20
|
+
"embed-lib": "./lib-dir/embed-lib.html"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
<script type="module" src="../src/custom-element/location-element.js"></script>
|
|
25
|
+
<script type="module" src="../src/custom-element/module-url.js"></script>
|
|
26
|
+
<script type="module" src="../src/custom-element/custom-element.js"></script>
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<p><code>embed-lib</code> resolved to <code>./lib-dir/embed-lib.html</code> by page <i>importmap</i></p>
|
|
30
|
+
<custom-element>
|
|
31
|
+
<template>
|
|
32
|
+
<module-url slice="lib-url" src="embed-lib"></module-url>
|
|
33
|
+
<if test="//lib-url/@error">
|
|
34
|
+
<p>error: <b>{//lib-url/@error}</b></p>
|
|
35
|
+
</if>
|
|
36
|
+
<span data-testid="check">check the link:</span>
|
|
37
|
+
<a href="{//lib-url}">
|
|
38
|
+
<custom-element src="embed-lib#embed-lib-component">
|
|
39
|
+
failed to load
|
|
40
|
+
</custom-element>
|
|
41
|
+
</a>
|
|
42
|
+
</template>
|
|
43
|
+
</custom-element>
|
|
44
|
+
|
|
45
|
+
</body>
|
|
46
|
+
</html>
|