@epa-wg/custom-element-dist 0.0.1
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/.editorconfig +11 -0
- package/.gitignore +26 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/compiler.xml +6 -0
- package/.idea/custom-element-dist.iml +13 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.storybook/main.ts +21 -0
- package/.storybook/preview.ts +17 -0
- package/.vscode/settings.json +24 -0
- package/LICENSE +201 -0
- package/README.md +32 -0
- package/bin/build.sh +8 -0
- package/bin/clean.sh +5 -0
- package/bin/postinstall.sh +17 -0
- package/bin/start.sh +2 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/coverage-final.json +16 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +161 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/src/coverage.svg +10 -0
- package/coverage/src/custom-element/coverage.svg +10 -0
- package/coverage/src/custom-element/custom-element.js/coverage.svg +10 -0
- package/coverage/src/custom-element/custom-element.js.html +2149 -0
- package/coverage/src/custom-element/http-request.js/coverage.svg +10 -0
- package/coverage/src/custom-element/http-request.js.html +352 -0
- package/coverage/src/custom-element/index.html +161 -0
- package/coverage/src/custom-element/local-storage.js/coverage.svg +10 -0
- package/coverage/src/custom-element/local-storage.js.html +346 -0
- package/coverage/src/custom-element/location-element.js/coverage.svg +10 -0
- package/coverage/src/custom-element/location-element.js.html +343 -0
- package/coverage/src/index.html +116 -0
- package/coverage/src/mocks/coverage.svg +10 -0
- package/coverage/src/mocks/handlers.ts/coverage.svg +10 -0
- package/coverage/src/mocks/handlers.ts.html +172 -0
- package/coverage/src/mocks/index.html +116 -0
- package/coverage/src/stories/attributes.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/attributes.stories.ts.html +481 -0
- package/coverage/src/stories/coverage.svg +10 -0
- package/coverage/src/stories/css.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/css.stories.ts.html +397 -0
- package/coverage/src/stories/dom-merge.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/dom-merge.stories.ts.html +424 -0
- package/coverage/src/stories/external-template.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/external-template.stories.ts.html +820 -0
- package/coverage/src/stories/http-request.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/http-request.stories.ts.html +817 -0
- package/coverage/src/stories/index.html +236 -0
- package/coverage/src/stories/local-storage.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/local-storage.stories.ts.html +1249 -0
- package/coverage/src/stories/location-element.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/location-element.stories.ts.html +484 -0
- package/coverage/src/stories/renderPlay.ts/coverage.svg +10 -0
- package/coverage/src/stories/renderPlay.ts.html +151 -0
- package/coverage/src/stories/slice-events.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/slice-events.stories.ts.html +436 -0
- package/coverage/src/sum.ts/coverage.svg +10 -0
- package/coverage/src/sum.ts.html +94 -0
- package/dist/confused.svg +37 -0
- package/dist/custom-element-B4v-KaIh.cjs +53 -0
- package/dist/custom-element-_g0GTup2.js +436 -0
- package/dist/custom-element-bundle.cjs +1 -0
- package/dist/custom-element-bundle.js +31 -0
- package/dist/embed-1.html +3 -0
- package/dist/html-template.html +126 -0
- package/dist/html-template.xhtml +45 -0
- package/dist/html-template.xml +45 -0
- package/dist/http-request-BOvP4KTl.js +56 -0
- package/dist/http-request-DPrY7mGh.cjs +1 -0
- package/dist/local-storage-Boafngui.cjs +1 -0
- package/dist/local-storage-BqDEu2kF.js +59 -0
- package/dist/location-element-2m0gWq_d.cjs +1 -0
- package/dist/location-element-nA_wsqBt.js +49 -0
- package/dist/mockServiceWorker.js +284 -0
- package/dist/tree.xsl +33 -0
- package/dist/vite.svg +1 -0
- package/index.html +17 -0
- package/package.json +97 -0
- package/public/confused.svg +37 -0
- package/public/embed-1.html +3 -0
- package/public/html-template.html +126 -0
- package/public/html-template.xhtml +45 -0
- package/public/html-template.xml +45 -0
- package/public/mockServiceWorker.js +284 -0
- package/public/tree.xsl +33 -0
- package/public/vite.svg +1 -0
- package/src/assets/lit.svg +1 -0
- package/src/custom-element/custom-element.d.ts +36 -0
- package/src/custom-element/custom-element.js +688 -0
- package/src/custom-element/demo/a.html +63 -0
- package/src/custom-element/demo/confused.svg +37 -0
- package/src/custom-element/demo/data-slices.html +184 -0
- package/src/custom-element/demo/dce-social-preview.png +0 -0
- package/src/custom-element/demo/demo.css +22 -0
- package/src/custom-element/demo/dom-merge.html +123 -0
- package/src/custom-element/demo/embed-1.html +3 -0
- package/src/custom-element/demo/external-template.html +179 -0
- package/src/custom-element/demo/hex-grid-dce.html +183 -0
- package/src/custom-element/demo/hex-grid-transform.png +0 -0
- package/src/custom-element/demo/hex-grid.html +66 -0
- package/src/custom-element/demo/html-template.html +126 -0
- package/src/custom-element/demo/html-template.xhtml +45 -0
- package/src/custom-element/demo/html-template.xml +45 -0
- package/src/custom-element/demo/http-request.html +143 -0
- package/src/custom-element/demo/local-storage.html +218 -0
- package/src/custom-element/demo/location-element.html +155 -0
- package/src/custom-element/demo/logo.png +0 -0
- package/src/custom-element/demo/parameters.html +70 -0
- package/src/custom-element/demo/s.xml +14 -0
- package/src/custom-element/demo/s.xslt +76 -0
- package/src/custom-element/demo/scoped-css.html +169 -0
- package/src/custom-element/demo/ss.html +57 -0
- package/src/custom-element/demo/table.xml +25 -0
- package/src/custom-element/demo/table.xsl +293 -0
- package/src/custom-element/demo/template.xsl +46 -0
- package/src/custom-element/demo/tree.xml +25 -0
- package/src/custom-element/demo/tree.xsl +33 -0
- package/src/custom-element/demo/wc-square.svg +1 -0
- package/src/custom-element/demo/xhtml-template.xhtml +45 -0
- package/src/custom-element/demo/z.html +62 -0
- package/src/custom-element/demo/z.xml +60 -0
- package/src/custom-element/http-request.js +89 -0
- package/src/custom-element/ide/IDE.md +31 -0
- package/src/custom-element/ide/customData-dce.json +112 -0
- package/src/custom-element/ide/customData-xsl.json +1018 -0
- package/src/custom-element/ide/web-types-dce.json +111 -0
- package/src/custom-element/ide/web-types-xsl.json +867 -0
- package/src/custom-element/index.html +168 -0
- package/src/custom-element/index.js +7 -0
- package/src/custom-element/local-storage.js +87 -0
- package/src/custom-element/location-element.js +87 -0
- package/src/custom-element.test.ts +10 -0
- package/src/index.css +38 -0
- package/src/mocks/handlers.ts +29 -0
- package/src/mocks/pokemons.mock.ts +13 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +5 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +15 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +3 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +12 -0
- package/src/stories/assets/youtube.svg +4 -0
- package/src/stories/attributes.stories.ts +132 -0
- package/src/stories/attributes.test.ts +14 -0
- package/src/stories/css.stories.ts +104 -0
- package/src/stories/css.test.ts +12 -0
- package/src/stories/dom-merge.stories.ts +113 -0
- package/src/stories/dom-merge.test.ts +12 -0
- package/src/stories/external-template.stories.ts +245 -0
- package/src/stories/external-template.test.ts +12 -0
- package/src/stories/http-request.stories.ts +244 -0
- package/src/stories/http-request.test.ts +29 -0
- package/src/stories/local-storage.stories.ts +388 -0
- package/src/stories/local-storage.test.ts +12 -0
- package/src/stories/location-element.stories.ts +133 -0
- package/src/stories/location-element.test.ts +14 -0
- package/src/stories/renderPlay.ts +22 -0
- package/src/stories/slice-events.stories.ts +117 -0
- package/src/stories/slice-events.test.ts +12 -0
- package/src/sum.test.ts +6 -0
- package/src/sum.ts +4 -0
- package/src/vite-env.d.ts +1 -0
- package/storybook-static/assets/Color-RQJUDNI5-C4yZhNbM.js +1 -0
- package/storybook-static/assets/Configure-C7d36rng.js +173 -0
- package/storybook-static/assets/DocsRenderer-K4EAMTCU-BLMupvSb.js +2 -0
- package/storybook-static/assets/WithTooltip-Y7J54OF7-BAQSPSFk.js +1 -0
- package/storybook-static/assets/accessibility-W_h2acOZ.png +0 -0
- package/storybook-static/assets/addon-library-BWUCAmyN.png +0 -0
- package/storybook-static/assets/attributes.stories-ZB0RTY1d.js +151 -0
- package/storybook-static/assets/context-C0qIqeS4.png +0 -0
- package/storybook-static/assets/css.stories-CLSX-Xxd.js +86 -0
- package/storybook-static/assets/custom-element-BLZZ00dz.js +53 -0
- package/storybook-static/assets/docs---vsFbMi.png +0 -0
- package/storybook-static/assets/dom-merge.stories-CgHZUABU.js +138 -0
- package/storybook-static/assets/entry-preview-CQqNFx4W.js +8 -0
- package/storybook-static/assets/entry-preview-docs-CWgqLfd3.js +2 -0
- package/storybook-static/assets/external-template.stories-DtSLMxvg.js +316 -0
- package/storybook-static/assets/figma-plugin-CH2hELiO.png +0 -0
- package/storybook-static/assets/formatter-B5HCVTEV-tKeEfJA9.js +58 -0
- package/storybook-static/assets/http-request.stories-CUzlXO89.js +300 -0
- package/storybook-static/assets/iframe-gCvlWuoC.js +2 -0
- package/storybook-static/assets/index-CBQwM6ST.js +508 -0
- package/storybook-static/assets/index-CDavW7r9.js +193 -0
- package/storybook-static/assets/index-CQA5dlr6.js +13 -0
- package/storybook-static/assets/index-Cc7K62zD.js +3 -0
- package/storybook-static/assets/index-DgaNIR0t.js +1 -0
- package/storybook-static/assets/index-Dkj0J1ds.js +1 -0
- package/storybook-static/assets/index-DnEJ_bKa.js +1 -0
- package/storybook-static/assets/index-DrFu-skq.js +6 -0
- package/storybook-static/assets/lit-element-B4_0akdT.js +19 -0
- package/storybook-static/assets/local-storage.stories-BkO6djDz.js +415 -0
- package/storybook-static/assets/location-element.stories-DCIOUd0D.js +108 -0
- package/storybook-static/assets/preview-B4GcaC1c.js +1 -0
- package/storybook-static/assets/preview-B63p-W8V.js +20 -0
- package/storybook-static/assets/preview-BAz7FMXc.js +396 -0
- package/storybook-static/assets/preview-BDY5ThwJ.js +1 -0
- package/storybook-static/assets/preview-C6t8KBFr.js +1 -0
- package/storybook-static/assets/preview-CYD85dwb.js +7 -0
- package/storybook-static/assets/preview-CkgAD_DE.js +2 -0
- package/storybook-static/assets/preview-D8LadFCz.js +48 -0
- package/storybook-static/assets/preview-DNpCpRPf.js +1 -0
- package/storybook-static/assets/preview-PxUn-cIn.js +1 -0
- package/storybook-static/assets/share-DGA-UcQf.png +0 -0
- package/storybook-static/assets/slice-events.stories-DXKjXI37.js +115 -0
- package/storybook-static/assets/styling-Bk6zjRzU.png +0 -0
- package/storybook-static/assets/syntaxhighlighter-JOJW2KGS-C04pIVD3.js +1 -0
- package/storybook-static/assets/testing-cbzR9l9r.png +0 -0
- package/storybook-static/assets/theming-D6WJLNoW.png +0 -0
- package/storybook-static/assets/tiny-invariant-BxWVcicq.js +1 -0
- package/storybook-static/confused.svg +37 -0
- package/storybook-static/embed-1.html +3 -0
- package/storybook-static/favicon.svg +7 -0
- package/storybook-static/html-template.html +126 -0
- package/storybook-static/html-template.xhtml +45 -0
- package/storybook-static/html-template.xml +45 -0
- package/storybook-static/iframe.html +492 -0
- package/storybook-static/index.html +163 -0
- package/storybook-static/index.json +1 -0
- package/storybook-static/mockServiceWorker.js +284 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +327 -0
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +40 -0
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +12 -0
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +60 -0
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +18 -0
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/interactions-10/manager-bundle.js +33 -0
- package/storybook-static/sb-addons/interactions-10/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/links-1/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/links-1/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +3 -0
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-common-assets/fonts.css +31 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/WithTooltip-Y7J54OF7-CEHQ77YF.js +1 -0
- package/storybook-static/sb-manager/chunk-E3WK6ZOZ.js +234 -0
- package/storybook-static/sb-manager/chunk-E6ABNH5R.js +183 -0
- package/storybook-static/sb-manager/chunk-FEE35O7J.js +9 -0
- package/storybook-static/sb-manager/chunk-S4VOIVUE.js +347 -0
- package/storybook-static/sb-manager/chunk-XCO5HRLK.js +6 -0
- package/storybook-static/sb-manager/chunk-XP3HGWTR.js +1 -0
- package/storybook-static/sb-manager/formatter-B5HCVTEV-7DCBOGO6.js +58 -0
- package/storybook-static/sb-manager/globals-module-info.js +1 -0
- package/storybook-static/sb-manager/globals-runtime.js +1 -0
- package/storybook-static/sb-manager/globals.js +1 -0
- package/storybook-static/sb-manager/index.js +1 -0
- package/storybook-static/sb-manager/runtime.js +1 -0
- package/storybook-static/sb-manager/syntaxhighlighter-JOJW2KGS-VF6EEVPI.js +1 -0
- package/storybook-static/sb-preview/globals.js +1 -0
- package/storybook-static/sb-preview/runtime.js +139 -0
- package/storybook-static/tree.xsl +33 -0
- package/storybook-static/vite.svg +1 -0
- package/tsconfig.json +25 -0
- package/vite.config.js +55 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import{w as l,e as n}from"./index-CDavW7r9.js";import"./custom-element-BLZZ00dz.js";function T(t){return new Promise(e=>setTimeout(e,t))}function v(t){const{title:e,body:a}=t;return`
|
|
2
|
+
<fieldset>
|
|
3
|
+
<legend>${e}</legend>
|
|
4
|
+
${a}
|
|
5
|
+
</fieldset>
|
|
6
|
+
`}const D={title:"external-templates",render:v},s={args:{title:"Template in page DOM",body:`
|
|
7
|
+
<template id="template1">
|
|
8
|
+
<slot>Hello</slot> World!
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<custom-element tag="dce-internal" src="#template1"></custom-element>
|
|
12
|
+
<!-- no need for loading fallback as the template exists -->
|
|
13
|
+
|
|
14
|
+
<dce-internal data-testid="slot-override">👋</dce-internal>
|
|
15
|
+
<dce-internal data-testid="slot-default"></dce-internal>
|
|
16
|
+
`},play:async({canvasElement:t})=>{const e=l(t);await e.findByText(s.args.title);const a=f=>e.getByTestId(f).textContent.trim();n(a("slot-override")).toEqual("👋 World!"),n(a("slot-default")).toEqual("Hello World!")}},i={args:{title:"no tag, template in same DOM",body:`
|
|
17
|
+
<template id="template2">
|
|
18
|
+
🏗️ construction
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<custom-element src="#template2"></custom-element>
|
|
22
|
+
<custom-element src="#template2"></custom-element>`},play:async({canvasElement:t})=>{await l(t).findByText(i.args.title),n(t.querySelectorAll("custom-element")[0].textContent.trim()).toEqual("🏗️ construction"),n(t.querySelectorAll("custom-element")[1].textContent.trim()).toEqual("🏗️ construction")}},m={args:{title:"External SVG as template",body:`
|
|
23
|
+
<custom-element tag="dce-external" src="/confused.svg">
|
|
24
|
+
<template><i>loading from SVG ...</i></template>
|
|
25
|
+
</custom-element>
|
|
26
|
+
<dce-external></dce-external>
|
|
27
|
+
<custom-element src="confused.svg">
|
|
28
|
+
<i>inline DCE loading from SVG ...</i>
|
|
29
|
+
</custom-element>
|
|
30
|
+
<custom-element src="no.svg">
|
|
31
|
+
<i>fallback for missing image</i>
|
|
32
|
+
</custom-element>
|
|
33
|
+
`},play:async({canvasElement:t})=>{await l(t).findByText(m.args.title),n(t.querySelector('[src="confused.svg"]').innerHTML).to.include("loading from SVG ..."),await T(100),n(t.querySelector("dce-external").innerHTML).to.include("<svg"),n(t.querySelector('[src="no.svg"]').innerHTML).to.include("Vitest Browser Tester")}},o={args:{title:"External XSLT file",body:`
|
|
34
|
+
<custom-element tag="dce-external-4" src="/tree.xsl">
|
|
35
|
+
<template><i>loading from XSLT ...</i></template>
|
|
36
|
+
</custom-element>
|
|
37
|
+
<dce-external-4 title="DCE with external XSLT template" data-fruit="🍌">Hi</dce-external-4>
|
|
38
|
+
<hr/>
|
|
39
|
+
<custom-element src="/tree.xsl" data-smile="👼" data-basket="🍒">
|
|
40
|
+
<i>inline DCE loading from XSLT ...</i>
|
|
41
|
+
</custom-element>
|
|
42
|
+
`},play:async({canvasElement:t})=>{const e=l(t);await e.findByText(o.args.title),n(t.querySelector("dce-external-4").innerHTML).to.include("Hi"),n(t.querySelector('[data-smile="👼"]').innerHTML).to.include("loading from XSLT ..."),await T(100),n(e.getByTestId("data-fruit").innerHTML).to.include("🍌"),n(e.getByTestId("data-smile").innerHTML).to.include("👼")}},c={args:{title:"external HTML template",body:`
|
|
43
|
+
<custom-element tag="dce-external-5" src="/html-template.html">
|
|
44
|
+
<template><i>loading from HTML file ...</i></template>
|
|
45
|
+
</custom-element>
|
|
46
|
+
<dce-external-5 title="DCE with external XSLT template" data-fruit="🍌">Hi</dce-external-5>
|
|
47
|
+
`},play:async({canvasElement:t})=>{const e=l(t);await e.findByText(c.args.title),await e.findByText("👋");const a=t.querySelector("dce-external-5").innerHTML;n(a).to.include("👋"),n(a).to.include("👌"),n(a).to.include("<svg"),n(a).to.include("<math")}},r={args:{title:"external HTML template",body:`
|
|
48
|
+
<custom-element src="/html-template.html" data-smile="👼" data-basket="🍒">
|
|
49
|
+
<i>inline DCE loading from HTML file ...</i>
|
|
50
|
+
</custom-element>
|
|
51
|
+
`},play:async({canvasElement:t})=>{const e=l(t);await e.findByText(r.args.title),await e.findByText("👋");const a=t.innerHTML;n(a).to.include("👋"),n(a).to.include("👌"),n(a).to.include("<svg"),n(a).to.include("<math")}},d={args:{title:"external HTML template - html by id",body:`
|
|
52
|
+
<custom-element src="/html-template.html#wave">
|
|
53
|
+
<template><i>loading HTML from templates file ...</i></template>
|
|
54
|
+
</custom-element>
|
|
55
|
+
`},play:async({canvasElement:t})=>{const e=l(t);await e.findByText(d.args.title),n(await e.findByText("👋")).toBeInTheDocument()}},u={args:{title:"external HTML template - SVG by id",body:`
|
|
56
|
+
<custom-element src="/html-template.html#dwc-logo">
|
|
57
|
+
<template><i>loading SVG from templates file ...</i></template>
|
|
58
|
+
</custom-element>
|
|
59
|
+
`},play:async({canvasElement:t})=>{const e=l(t);await e.findByText(u.args.title),n(await e.findByTestId("svg-test")).toBeInTheDocument()}},p={args:{title:"external HTML template - MathML by id",body:`
|
|
60
|
+
<custom-element src="/html-template.html#sophomores-dream">
|
|
61
|
+
<template><i>loading MathML from HTML file ...</i></template>
|
|
62
|
+
</custom-element>
|
|
63
|
+
`},play:async({canvasElement:t})=>{const e=l(t);await e.findByText(p.args.title);const a=await e.findByTestId("ml-test");debugger;n(a.firstElementChild.localName).toEqual("mrow")}},g={args:{title:"external XHTML template - xsl by id",body:`
|
|
64
|
+
<custom-element src="/html-template.xhtml#embedded-xsl">
|
|
65
|
+
<template>whole XSLT is embedded into HTML body</template>
|
|
66
|
+
</custom-element>
|
|
67
|
+
`},play:async({canvasElement:t})=>{const e=l(t);await e.findByText(g.args.title);const a=await e.findByTestId("src");n(a.textContent).to.include("/html-template.xhtml#embedded-xsl")}},y={args:{title:"external HTML template - missing id",body:`
|
|
68
|
+
<custom-element src="/html-template.html#none">
|
|
69
|
+
<template><i data-testid="no-id">element with id=none is missing in template</i></template>
|
|
70
|
+
</custom-element>
|
|
71
|
+
`},play:async({canvasElement:t})=>{const e=l(t);await e.findByText(y.args.title),await T(100);const a=await e.findByTestId("no-id");n(a.textContent).to.include("element with id=none is missing in template")}},x={args:{title:"external file with embedding of another external DCE",body:`
|
|
72
|
+
<custom-element src="/embed-1.html">
|
|
73
|
+
loading from embed-1.html ...
|
|
74
|
+
</custom-element>
|
|
75
|
+
`},play:async({canvasElement:t})=>{const e=l(t);await e.findByText(x.args.title),await T(100),n(await e.findByTestId("wave")).toBeInTheDocument(),n(e.getByTestId("wave").innerHTML).toEqual("🖖")}};s.parameters={...s.parameters,docs:{...s.parameters?.docs,source:{originalSource:`{
|
|
76
|
+
args: {
|
|
77
|
+
title: 'Template in page DOM',
|
|
78
|
+
body: \`
|
|
79
|
+
<template id="template1">
|
|
80
|
+
<slot>Hello</slot> World!
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<custom-element tag="dce-internal" src="#template1"></custom-element>
|
|
84
|
+
<!-- no need for loading fallback as the template exists -->
|
|
85
|
+
|
|
86
|
+
<dce-internal data-testid="slot-override">👋</dce-internal>
|
|
87
|
+
<dce-internal data-testid="slot-default"></dce-internal>
|
|
88
|
+
\`
|
|
89
|
+
},
|
|
90
|
+
play: async ({
|
|
91
|
+
canvasElement
|
|
92
|
+
}) => {
|
|
93
|
+
const canvas = within(canvasElement);
|
|
94
|
+
await canvas.findByText((TemplateInPage.args!.title as string));
|
|
95
|
+
const val = prop => canvas.getByTestId(prop).textContent.trim();
|
|
96
|
+
expect(val('slot-override')).toEqual('👋 World!');
|
|
97
|
+
expect(val('slot-default')).toEqual('Hello World!');
|
|
98
|
+
}
|
|
99
|
+
}`,...s.parameters?.docs?.source}}};i.parameters={...i.parameters,docs:{...i.parameters?.docs,source:{originalSource:`{
|
|
100
|
+
args: {
|
|
101
|
+
title: 'no tag, template in same DOM',
|
|
102
|
+
body: \`
|
|
103
|
+
<template id="template2">
|
|
104
|
+
🏗️ construction
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<custom-element src="#template2"></custom-element>
|
|
108
|
+
<custom-element src="#template2"></custom-element>\`
|
|
109
|
+
},
|
|
110
|
+
play: async ({
|
|
111
|
+
canvasElement
|
|
112
|
+
}) => {
|
|
113
|
+
const canvas = within(canvasElement);
|
|
114
|
+
await canvas.findByText((NoTag.args!.title as string));
|
|
115
|
+
expect(canvasElement.querySelectorAll('custom-element')[0].textContent.trim()).toEqual('🏗️ construction');
|
|
116
|
+
expect(canvasElement.querySelectorAll('custom-element')[1].textContent.trim()).toEqual('🏗️ construction');
|
|
117
|
+
}
|
|
118
|
+
}`,...i.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
|
|
119
|
+
args: {
|
|
120
|
+
title: 'External SVG as template',
|
|
121
|
+
body: \`
|
|
122
|
+
<custom-element tag="dce-external" src="/confused.svg">
|
|
123
|
+
<template><i>loading from SVG ...</i></template>
|
|
124
|
+
</custom-element>
|
|
125
|
+
<dce-external></dce-external>
|
|
126
|
+
<custom-element src="confused.svg">
|
|
127
|
+
<i>inline DCE loading from SVG ...</i>
|
|
128
|
+
</custom-element>
|
|
129
|
+
<custom-element src="no.svg">
|
|
130
|
+
<i>fallback for missing image</i>
|
|
131
|
+
</custom-element>
|
|
132
|
+
\`
|
|
133
|
+
},
|
|
134
|
+
play: async ({
|
|
135
|
+
canvasElement
|
|
136
|
+
}) => {
|
|
137
|
+
const canvas = within(canvasElement);
|
|
138
|
+
await canvas.findByText((ExternalSvg.args!.title as string));
|
|
139
|
+
expect(canvasElement.querySelector('[src="confused.svg"]').innerHTML).to.include('loading from SVG ...');
|
|
140
|
+
await sleep(100);
|
|
141
|
+
expect(canvasElement.querySelector('dce-external').innerHTML).to.include('<svg');
|
|
142
|
+
expect(canvasElement.querySelector('[src="no.svg"]').innerHTML).to.include('Vitest Browser Tester');
|
|
143
|
+
// "fallback for missing image" is not shown in test as test does not return 404, see test on 404 instead
|
|
144
|
+
}
|
|
145
|
+
}`,...m.parameters?.docs?.source}}};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
146
|
+
args: {
|
|
147
|
+
title: 'External XSLT file',
|
|
148
|
+
body: \`
|
|
149
|
+
<custom-element tag="dce-external-4" src="/tree.xsl">
|
|
150
|
+
<template><i>loading from XSLT ...</i></template>
|
|
151
|
+
</custom-element>
|
|
152
|
+
<dce-external-4 title="DCE with external XSLT template" data-fruit="🍌">Hi</dce-external-4>
|
|
153
|
+
<hr/>
|
|
154
|
+
<custom-element src="/tree.xsl" data-smile="👼" data-basket="🍒">
|
|
155
|
+
<i>inline DCE loading from XSLT ...</i>
|
|
156
|
+
</custom-element>
|
|
157
|
+
\`
|
|
158
|
+
},
|
|
159
|
+
play: async ({
|
|
160
|
+
canvasElement
|
|
161
|
+
}) => {
|
|
162
|
+
const canvas = within(canvasElement);
|
|
163
|
+
await canvas.findByText((ExternalXsltFile.args!.title as string));
|
|
164
|
+
expect(canvasElement.querySelector('dce-external-4').innerHTML).to.include('Hi');
|
|
165
|
+
expect(canvasElement.querySelector('[data-smile="👼"]').innerHTML).to.include('loading from XSLT ...');
|
|
166
|
+
await sleep(100);
|
|
167
|
+
expect(canvas.getByTestId('data-fruit').innerHTML).to.include('🍌');
|
|
168
|
+
expect(canvas.getByTestId('data-smile').innerHTML).to.include('👼');
|
|
169
|
+
}
|
|
170
|
+
}`,...o.parameters?.docs?.source}}};c.parameters={...c.parameters,docs:{...c.parameters?.docs,source:{originalSource:`{
|
|
171
|
+
args: {
|
|
172
|
+
title: 'external HTML template',
|
|
173
|
+
body: \`
|
|
174
|
+
<custom-element tag="dce-external-5" src="/html-template.html">
|
|
175
|
+
<template><i>loading from HTML file ...</i></template>
|
|
176
|
+
</custom-element>
|
|
177
|
+
<dce-external-5 title="DCE with external XSLT template" data-fruit="🍌">Hi</dce-external-5>
|
|
178
|
+
\`
|
|
179
|
+
},
|
|
180
|
+
play: async ({
|
|
181
|
+
canvasElement
|
|
182
|
+
}) => {
|
|
183
|
+
const canvas = within(canvasElement);
|
|
184
|
+
await canvas.findByText((ExternalHtmlFile.args!.title as string));
|
|
185
|
+
await canvas.findByText('👋');
|
|
186
|
+
const t5 = canvasElement.querySelector('dce-external-5').innerHTML;
|
|
187
|
+
expect(t5).to.include('👋');
|
|
188
|
+
expect(t5).to.include('👌');
|
|
189
|
+
expect(t5).to.include('<svg');
|
|
190
|
+
expect(t5).to.include('<math');
|
|
191
|
+
}
|
|
192
|
+
}`,...c.parameters?.docs?.source}}};r.parameters={...r.parameters,docs:{...r.parameters?.docs,source:{originalSource:`{
|
|
193
|
+
args: {
|
|
194
|
+
title: 'external HTML template',
|
|
195
|
+
body: \`
|
|
196
|
+
<custom-element src="/html-template.html" data-smile="👼" data-basket="🍒">
|
|
197
|
+
<i>inline DCE loading from HTML file ...</i>
|
|
198
|
+
</custom-element>
|
|
199
|
+
\`
|
|
200
|
+
},
|
|
201
|
+
play: async ({
|
|
202
|
+
canvasElement
|
|
203
|
+
}) => {
|
|
204
|
+
const canvas = within(canvasElement);
|
|
205
|
+
await canvas.findByText((ExternalHtmlFileInline.args!.title as string));
|
|
206
|
+
await canvas.findByText('👋');
|
|
207
|
+
const t5 = canvasElement.innerHTML;
|
|
208
|
+
expect(t5).to.include('👋');
|
|
209
|
+
expect(t5).to.include('👌');
|
|
210
|
+
expect(t5).to.include('<svg');
|
|
211
|
+
expect(t5).to.include('<math');
|
|
212
|
+
}
|
|
213
|
+
}`,...r.parameters?.docs?.source}}};d.parameters={...d.parameters,docs:{...d.parameters?.docs,source:{originalSource:`{
|
|
214
|
+
args: {
|
|
215
|
+
title: 'external HTML template - html by id',
|
|
216
|
+
body: \`
|
|
217
|
+
<custom-element src="/html-template.html#wave">
|
|
218
|
+
<template><i>loading HTML from templates file ...</i></template>
|
|
219
|
+
</custom-element>
|
|
220
|
+
\`
|
|
221
|
+
},
|
|
222
|
+
play: async ({
|
|
223
|
+
canvasElement
|
|
224
|
+
}) => {
|
|
225
|
+
const canvas = within(canvasElement);
|
|
226
|
+
await canvas.findByText((HtmlWithinHtmlFile.args!.title as string));
|
|
227
|
+
expect(await canvas.findByText('👋')).toBeInTheDocument();
|
|
228
|
+
}
|
|
229
|
+
}`,...d.parameters?.docs?.source}}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
|
|
230
|
+
args: {
|
|
231
|
+
title: 'external HTML template - SVG by id',
|
|
232
|
+
body: \`
|
|
233
|
+
<custom-element src="/html-template.html#dwc-logo">
|
|
234
|
+
<template><i>loading SVG from templates file ...</i></template>
|
|
235
|
+
</custom-element>
|
|
236
|
+
\`
|
|
237
|
+
},
|
|
238
|
+
play: async ({
|
|
239
|
+
canvasElement
|
|
240
|
+
}) => {
|
|
241
|
+
const canvas = within(canvasElement);
|
|
242
|
+
await canvas.findByText((SvgWithinHtmlFile.args!.title as string));
|
|
243
|
+
expect(await canvas.findByTestId('svg-test')).toBeInTheDocument();
|
|
244
|
+
}
|
|
245
|
+
}`,...u.parameters?.docs?.source}}};p.parameters={...p.parameters,docs:{...p.parameters?.docs,source:{originalSource:`{
|
|
246
|
+
args: {
|
|
247
|
+
title: 'external HTML template - MathML by id',
|
|
248
|
+
body: \`
|
|
249
|
+
<custom-element src="/html-template.html#sophomores-dream">
|
|
250
|
+
<template><i>loading MathML from HTML file ...</i></template>
|
|
251
|
+
</custom-element>
|
|
252
|
+
\`
|
|
253
|
+
},
|
|
254
|
+
play: async ({
|
|
255
|
+
canvasElement
|
|
256
|
+
}) => {
|
|
257
|
+
const canvas = within(canvasElement);
|
|
258
|
+
await canvas.findByText((MathMLWithinHtmlFile.args!.title as string));
|
|
259
|
+
const ml = await canvas.findByTestId('ml-test');
|
|
260
|
+
debugger;
|
|
261
|
+
expect(ml.firstElementChild.localName).toEqual('mrow');
|
|
262
|
+
}
|
|
263
|
+
}`,...p.parameters?.docs?.source}}};g.parameters={...g.parameters,docs:{...g.parameters?.docs,source:{originalSource:`{
|
|
264
|
+
args: {
|
|
265
|
+
title: 'external XHTML template - xsl by id',
|
|
266
|
+
body: \`
|
|
267
|
+
<custom-element src="/html-template.xhtml#embedded-xsl">
|
|
268
|
+
<template>whole XSLT is embedded into HTML body</template>
|
|
269
|
+
</custom-element>
|
|
270
|
+
\`
|
|
271
|
+
},
|
|
272
|
+
play: async ({
|
|
273
|
+
canvasElement
|
|
274
|
+
}) => {
|
|
275
|
+
const canvas = within(canvasElement);
|
|
276
|
+
await canvas.findByText((ByIdWithinXsltFile.args!.title as string));
|
|
277
|
+
const ml = await canvas.findByTestId('src');
|
|
278
|
+
expect(ml.textContent).to.include('/html-template.xhtml#embedded-xsl');
|
|
279
|
+
}
|
|
280
|
+
}`,...g.parameters?.docs?.source}}};y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{
|
|
281
|
+
args: {
|
|
282
|
+
title: 'external HTML template - missing id',
|
|
283
|
+
body: \`
|
|
284
|
+
<custom-element src="/html-template.html#none">
|
|
285
|
+
<template><i data-testid="no-id">element with id=none is missing in template</i></template>
|
|
286
|
+
</custom-element>
|
|
287
|
+
\`
|
|
288
|
+
},
|
|
289
|
+
play: async ({
|
|
290
|
+
canvasElement
|
|
291
|
+
}) => {
|
|
292
|
+
const canvas = within(canvasElement);
|
|
293
|
+
await canvas.findByText((MissingIdWithinXsltFile.args!.title as string));
|
|
294
|
+
await sleep(100);
|
|
295
|
+
const ml = await canvas.findByTestId('no-id');
|
|
296
|
+
expect(ml.textContent).to.include('element with id=none is missing in template');
|
|
297
|
+
}
|
|
298
|
+
}`,...y.parameters?.docs?.source}}};x.parameters={...x.parameters,docs:{...x.parameters?.docs,source:{originalSource:`{
|
|
299
|
+
args: {
|
|
300
|
+
title: 'external file with embedding of another external DCE',
|
|
301
|
+
body: \`
|
|
302
|
+
<custom-element src="/embed-1.html">
|
|
303
|
+
loading from embed-1.html ...
|
|
304
|
+
</custom-element>
|
|
305
|
+
\`
|
|
306
|
+
},
|
|
307
|
+
play: async ({
|
|
308
|
+
canvasElement
|
|
309
|
+
}) => {
|
|
310
|
+
const canvas = within(canvasElement);
|
|
311
|
+
await canvas.findByText((EmbeddingInAnotherFile.args!.title as string));
|
|
312
|
+
await sleep(100);
|
|
313
|
+
expect(await canvas.findByTestId('wave')).toBeInTheDocument();
|
|
314
|
+
expect(canvas.getByTestId('wave').innerHTML).toEqual('🖖');
|
|
315
|
+
}
|
|
316
|
+
}`,...x.parameters?.docs?.source}}};const E=["TemplateInPage","NoTag","ExternalSvg","ExternalXsltFile","ExternalHtmlFile","ExternalHtmlFileInline","HtmlWithinHtmlFile","SvgWithinHtmlFile","MathMLWithinHtmlFile","ByIdWithinXsltFile","MissingIdWithinXsltFile","EmbeddingInAnotherFile"];export{g as ByIdWithinXsltFile,x as EmbeddingInAnotherFile,c as ExternalHtmlFile,r as ExternalHtmlFileInline,m as ExternalSvg,o as ExternalXsltFile,d as HtmlWithinHtmlFile,p as MathMLWithinHtmlFile,y as MissingIdWithinXsltFile,i as NoTag,u as SvgWithinHtmlFile,s as TemplateInPage,E as __namedExportsOrder,D as default};
|
|
Binary file
|