@epa-wg/custom-element-dist 0.0.21 → 0.0.22
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/README.md +4 -4
- package/coverage/coverage-final.json +15 -11
- package/coverage/index.html +25 -25
- 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 +604 -421
- package/coverage/src/custom-element/custom-element1-1.js/coverage.svg +10 -0
- package/coverage/src/custom-element/custom-element1-1.js.html +2374 -0
- package/coverage/src/custom-element/custom-element1.js/coverage.svg +10 -0
- package/coverage/src/custom-element/custom-element1.js.html +2374 -0
- package/coverage/src/custom-element/http-request.js.html +10 -10
- package/coverage/src/custom-element/index.html +49 -19
- package/coverage/src/custom-element/local-storage.js.html +6 -6
- package/coverage/src/custom-element/location-element.js.html +1 -1
- 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/{attributes.stories.ts.html → attributes.test.stories.ts.html} +51 -15
- package/coverage/src/stories/{css.stories.ts.html → css.test.stories.ts.html} +77 -17
- package/coverage/src/stories/{dom-merge.stories.ts.html → dom-merge.test.stories.ts.html} +60 -12
- package/coverage/src/stories/{external-template.stories.ts.html → external-template.test.stories.ts.html} +42 -12
- package/coverage/src/stories/form.test.stories.ts.html +658 -0
- package/coverage/src/stories/http-request.stories.ts.html +7 -7
- package/coverage/src/stories/index.html +71 -41
- package/coverage/src/stories/{local-storage.stories.ts.html → local-storage.test.stories.ts.html} +56 -20
- package/coverage/src/stories/{location-element.stories.ts.html → location-element.test.stories.ts.html} +53 -17
- package/coverage/src/stories/renderPlay.ts.html +12 -15
- package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/{slice-events.stories.ts.html → slice-events.test.stories.ts.html} +264 -15
- package/coverage/src/stories/slots.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/slots.test.stories.ts.html +739 -0
- package/coverage/src/sum.ts.html +1 -1
- package/dist/custom-element-BISbI4SU.js +463 -0
- package/dist/custom-element-N-sWiqGK.cjs +53 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +2 -2
- package/dist/mockServiceWorker.js +1 -1
- package/package.json +4 -4
- package/public/mockServiceWorker.js +1 -1
- package/src/custom-element/custom-element.d.ts +4 -0
- package/src/custom-element/custom-element.js +103 -42
- package/src/custom-element/custom-element1-1.js +763 -0
- package/src/custom-element/custom-element1.js +763 -0
- package/src/custom-element/custom-element1.js0 +750 -0
- package/src/custom-element/custom-element2.js0 +759 -0
- package/src/custom-element/custom-element3.js0 +763 -0
- package/src/custom-element/demo/a.html +38 -41
- package/src/custom-element/demo/b.html +13 -0
- package/src/custom-element/demo/data-slices.html +32 -0
- package/src/custom-element/demo/form.html +193 -0
- package/src/custom-element/demo/s.xml +19 -14
- package/src/custom-element/demo/s.xslt +22 -38
- package/src/custom-element/demo/s1.xslt +60 -0
- package/src/custom-element/ide/customData-dce.json +14 -1
- package/src/custom-element/ide/web-types-dce.json +6 -1
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +1 -0
- package/src/custom-element.test.ts +24 -8
- package/src/stories/{attributes.stories.ts → attributes.test.stories.ts} +19 -7
- package/src/stories/{css.stories.ts → css.test.stories.ts} +29 -9
- package/src/stories/{dom-merge.stories.ts → dom-merge.test.stories.ts} +19 -3
- package/src/stories/{external-template.stories.ts → external-template.test.stories.ts} +13 -3
- package/src/stories/form.test.stories.ts +191 -0
- package/src/stories/http-request.stories.ts +6 -6
- package/src/stories/http-request.test.ts +0 -9
- package/src/stories/{local-storage.stories.ts → local-storage.test.stories.ts} +24 -12
- package/src/stories/{location-element.stories.ts → location-element.test.stories.ts} +21 -9
- package/src/stories/renderPlay.ts +1 -2
- package/src/stories/{slice-events.stories.ts → slice-events.test.stories.ts} +88 -5
- package/src/stories/slots.test.stories.ts +218 -0
- package/storybook-static/assets/{Color-RQJUDNI5-C4yZhNbM.js → Color-PRSJMWNM-e4s261EJ.js} +1 -1
- package/storybook-static/assets/{Configure-C7d36rng.js → Configure-DWut7txe.js} +1 -1
- package/storybook-static/assets/DocsRenderer-K4EAMTCU-CaXVGjCl.js +2 -0
- package/storybook-static/assets/WithTooltip-KJL26V4Q--B8vdnMi.js +1 -0
- package/storybook-static/assets/{attributes.stories-ZB0RTY1d.js → attributes.test.stories-IuwazrdL.js} +21 -21
- package/storybook-static/assets/css.test.stories-D9WaxrEv.js +96 -0
- package/storybook-static/assets/custom-element-BV8-hRQS.js +219 -0
- package/storybook-static/assets/{dom-merge.stories-CgHZUABU.js → dom-merge.test.stories-BhbNeum_.js} +5 -6
- package/storybook-static/assets/{entry-preview-CQqNFx4W.js → entry-preview-DrgzXgwT.js} +1 -1
- package/storybook-static/assets/{entry-preview-docs-CWgqLfd3.js → entry-preview-docs-Bxv0qQWs.js} +1 -1
- package/storybook-static/assets/{external-template.stories-DtSLMxvg.js → external-template.test.stories-Bpr_wxBo.js} +23 -24
- package/storybook-static/assets/form.test.stories-3tURbEdv.js +250 -0
- package/storybook-static/assets/{formatter-B5HCVTEV-tKeEfJA9.js → formatter-2WMMO6ZP-SJtgH3vM.js} +5 -5
- package/storybook-static/assets/http-request.stories-8K_qSs8C.js +300 -0
- package/storybook-static/assets/iframe-CM82WlGY.js +2 -0
- package/storybook-static/assets/index-CEZitmnt.js +548 -0
- package/storybook-static/assets/index-CVRyq5ci.js +27 -0
- package/storybook-static/assets/{index-DnEJ_bKa.js → index-D1MP-Zis.js} +1 -1
- package/storybook-static/assets/index-DNL-IEpS.js +1 -0
- package/storybook-static/assets/index-DXimoRZY.js +1 -0
- package/storybook-static/assets/index-DuIEV_9C.js +13 -0
- package/storybook-static/assets/{lit-element-B4_0akdT.js → lit-element-CenEXOuS.js} +2 -2
- package/storybook-static/assets/{local-storage.stories-BkO6djDz.js → local-storage.test.stories-CtisAQBB.js} +28 -24
- package/storybook-static/assets/{location-element.stories-DCIOUd0D.js → location-element.test.stories-5O_t_m4Y.js} +11 -11
- package/storybook-static/assets/preview-4Up_z4Em.js +7 -0
- package/storybook-static/assets/{preview-CkgAD_DE.js → preview-5Y0XiZgz.js} +2 -2
- package/storybook-static/assets/preview-BKCN0mOr.js +1 -0
- package/storybook-static/assets/preview-DRnyIGXK.js +48 -0
- package/storybook-static/assets/preview-FpHGYA1q.js +1 -0
- package/storybook-static/assets/{preview-PxUn-cIn.js → preview-TCN6m6T-.js} +1 -1
- package/storybook-static/assets/slice-events.test.stories-BSXCLIA5.js +231 -0
- package/storybook-static/assets/slots.test.stories-B1vqfHmN.js +214 -0
- package/storybook-static/assets/syntaxhighlighter-BP7B2CQK-BWFH_0wQ.js +1 -0
- package/storybook-static/iframe.html +153 -10
- package/storybook-static/index.html +1 -1
- package/storybook-static/index.json +1 -1
- package/storybook-static/mockServiceWorker.js +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +35 -29
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +1 -1
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +5 -5
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +35 -35
- 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-10/manager-bundle.js +18 -16
- package/storybook-static/sb-addons/links-1/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +1 -1
- package/storybook-static/sb-manager/WithTooltip-KJL26V4Q-5LS5AN27.js +1 -0
- package/storybook-static/sb-manager/{chunk-S4VOIVUE.js → chunk-B3YDJJJH.js} +9 -9
- package/storybook-static/sb-manager/{chunk-FEE35O7J.js → chunk-BLWCBWKL.js} +3 -3
- package/storybook-static/sb-manager/{chunk-XCO5HRLK.js → chunk-GUVK2GTO.js} +3 -3
- package/storybook-static/sb-manager/chunk-LFRML3ZV.js +186 -0
- package/storybook-static/sb-manager/chunk-MC7RAF2B.js +274 -0
- package/storybook-static/sb-manager/{chunk-XP3HGWTR.js → chunk-ZR5JZWHI.js} +1 -1
- package/storybook-static/sb-manager/{formatter-B5HCVTEV-7DCBOGO6.js → formatter-2WMMO6ZP-JI7RHVTW.js} +1 -1
- package/storybook-static/sb-manager/globals-module-info.js +1 -1
- package/storybook-static/sb-manager/globals-runtime.js +1 -1
- package/storybook-static/sb-manager/index.js +1 -1
- package/storybook-static/sb-manager/runtime.js +1 -1
- package/storybook-static/sb-manager/{syntaxhighlighter-JOJW2KGS-VF6EEVPI.js → syntaxhighlighter-BP7B2CQK-WOJYHKQR.js} +1 -1
- package/storybook-static/sb-preview/runtime.js +28 -11
- package/vite.config.js +5 -5
- package/dist/custom-element-B4v-KaIh.cjs +0 -53
- package/dist/custom-element-_g0GTup2.js +0 -436
- package/src/stories/attributes.test.ts +0 -14
- package/src/stories/css.test.ts +0 -12
- package/src/stories/dom-merge.test.ts +0 -12
- package/src/stories/external-template.test.ts +0 -12
- package/src/stories/local-storage.test.ts +0 -12
- package/src/stories/location-element.test.ts +0 -14
- package/src/stories/slice-events.test.ts +0 -12
- package/storybook-static/assets/DocsRenderer-K4EAMTCU-BLMupvSb.js +0 -2
- package/storybook-static/assets/WithTooltip-Y7J54OF7-BAQSPSFk.js +0 -1
- package/storybook-static/assets/css.stories-CLSX-Xxd.js +0 -86
- package/storybook-static/assets/custom-element-BLZZ00dz.js +0 -53
- package/storybook-static/assets/http-request.stories-CUzlXO89.js +0 -300
- package/storybook-static/assets/iframe-gCvlWuoC.js +0 -2
- package/storybook-static/assets/index-CBQwM6ST.js +0 -508
- package/storybook-static/assets/index-CDavW7r9.js +0 -193
- package/storybook-static/assets/index-CQA5dlr6.js +0 -13
- package/storybook-static/assets/index-DgaNIR0t.js +0 -1
- package/storybook-static/assets/index-Dkj0J1ds.js +0 -1
- package/storybook-static/assets/preview-C6t8KBFr.js +0 -1
- package/storybook-static/assets/preview-CYD85dwb.js +0 -7
- package/storybook-static/assets/preview-D8LadFCz.js +0 -48
- package/storybook-static/assets/preview-DNpCpRPf.js +0 -1
- package/storybook-static/assets/slice-events.stories-DXKjXI37.js +0 -115
- package/storybook-static/assets/syntaxhighlighter-JOJW2KGS-C04pIVD3.js +0 -1
- package/storybook-static/sb-manager/WithTooltip-Y7J54OF7-CEHQ77YF.js +0 -1
- package/storybook-static/sb-manager/chunk-E3WK6ZOZ.js +0 -234
- package/storybook-static/sb-manager/chunk-E6ABNH5R.js +0 -183
- /package/coverage/src/stories/{attributes.stories.ts → attributes.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{css.stories.ts → css.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{dom-merge.stories.ts → dom-merge.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{external-template.stories.ts → external-template.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{local-storage.stories.ts → form.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{location-element.stories.ts → local-storage.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{slice-events.stories.ts → location-element.test.stories.ts}/coverage.svg +0 -0
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import{w as o,e}from"./
|
|
1
|
+
import{w as o,e}from"./custom-element-BV8-hRQS.js";import"./index-CVRyq5ci.js";function s(a){return new Promise(i=>setTimeout(i,a))}function r(a){const{title:i,body:t}=a;return`
|
|
2
2
|
<fieldset>
|
|
3
|
-
<legend>${
|
|
3
|
+
<legend>${i}</legend>
|
|
4
4
|
${t}
|
|
5
5
|
</fieldset>
|
|
6
|
-
`}const b={title:"attributes",render:r},
|
|
6
|
+
`}const b={title:"attributes",render:r},d={args:{title:"Attributes definition",body:`
|
|
7
7
|
<p>Params needed to declare DCE attributes and track the attributes changes. It also is used by IDE and validation.</p>
|
|
8
8
|
<custom-element tag="dce-link" >
|
|
9
9
|
<template>
|
|
10
10
|
<attribute name="p1">default_P1 </attribute>
|
|
11
11
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
12
12
|
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
13
|
-
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
14
|
-
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
13
|
+
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
14
|
+
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
15
15
|
p3: <code data-testid="p3">{$p3}</code>
|
|
16
16
|
</template>
|
|
17
17
|
</custom-element>
|
|
18
18
|
<dce-link id="dce1"></dce-link>
|
|
19
|
-
`},play:async({canvasElement:a})=>{
|
|
19
|
+
`},play:async({canvasElement:a})=>{d.args.title;const i=o(a),t=async c=>(await i.findByTestId(c)).textContent.trim();await s(20),e(await t("p1")).toEqual("default_P1"),e(await t("p2")).toEqual("always_p2"),e(await t("p3")).toEqual("def_P3")}},n={args:{title:"Attributes runtime change",body:`
|
|
20
20
|
<p>Params needed to declare DCE attributes and track the attributes changes. It also be used by IDE and validation.</p>
|
|
21
21
|
<custom-element tag="dce-link2" >
|
|
22
22
|
<template>
|
|
23
23
|
<attribute name="p1">default_P1 </attribute>
|
|
24
24
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
25
25
|
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
26
|
-
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
27
|
-
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
26
|
+
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
27
|
+
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
28
28
|
p3: <code data-testid="p3">{$p3}</code>
|
|
29
29
|
</template>
|
|
30
30
|
</custom-element>
|
|
@@ -34,20 +34,20 @@ import{w as o,e}from"./index-CDavW7r9.js";import"./custom-element-BLZZ00dz.js";f
|
|
|
34
34
|
<div><input id="i2" value="p2"> <button onclick="dce2.setAttribute('p2',i2.value)"> set p2</button> </div>
|
|
35
35
|
<div><input id="i3" value="p3"> <button onclick="dce2.setAttribute('p3',i3.value)"> set p3</button> </div>
|
|
36
36
|
</section>
|
|
37
|
-
`},play:async({canvasElement:a})=>{
|
|
37
|
+
`},play:async({canvasElement:a})=>{d.args.title;const i=o(a),t=async c=>(await i.findByTestId(c)).textContent.trim();await s(20),e(await t("p1")).toEqual("123"),e(await t("p2")).toEqual("always_p2","no overrides due to value is hardcoded"),e(await t("p3")).toEqual("def_P3"),dce2.setAttribute("p1",i1.value),await s(10),e(await t("p1")).toEqual("p1","set p1 in runtime"),dce2.setAttribute("p2",i2.value),await s(10),e(await t("p2")).toEqual("always_p2","can not set p2 in runtime"),dce2.setAttribute("p3",i3.value),await s(10),e(await t("p3")).toEqual("p3","set p3 in runtime")}},p={args:{title:"Instance Attributes",body:`
|
|
38
38
|
<p>Params needed to declare DCE attributes and track the attributes changes. It also is used by IDE and validation.</p>
|
|
39
39
|
<custom-element tag="dce-link3" >
|
|
40
40
|
<template>
|
|
41
41
|
<attribute name="p1">default_P1 </attribute>
|
|
42
42
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
43
43
|
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
44
|
-
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
45
|
-
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
44
|
+
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
45
|
+
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
46
46
|
p3: <code data-testid="p3">{$p3}</code>
|
|
47
47
|
</template>
|
|
48
48
|
</custom-element>
|
|
49
49
|
<dce-link3 id="dce3" p1="123" p3="qwe"></dce-link3> |
|
|
50
|
-
`},play:async({canvasElement:a})=>{
|
|
50
|
+
`},play:async({canvasElement:a})=>{d.args.title;const i=o(a),t=async c=>(await i.findByTestId(c)).textContent.trim();await s(20),e(await t("p1")).toEqual("123"),e(await t("p2")).toEqual("always_p2"),e(await t("p3")).toEqual("qwe")}};d.parameters={...d.parameters,docs:{...d.parameters?.docs,source:{originalSource:`{
|
|
51
51
|
args: {
|
|
52
52
|
title: 'Attributes definition',
|
|
53
53
|
body: \`
|
|
@@ -57,8 +57,8 @@ import{w as o,e}from"./index-CDavW7r9.js";import"./custom-element-BLZZ00dz.js";f
|
|
|
57
57
|
<attribute name="p1">default_P1 </attribute>
|
|
58
58
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
59
59
|
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
60
|
-
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
61
|
-
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
60
|
+
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
61
|
+
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
62
62
|
p3: <code data-testid="p3">{$p3}</code>
|
|
63
63
|
</template>
|
|
64
64
|
</custom-element>
|
|
@@ -76,7 +76,7 @@ import{w as o,e}from"./index-CDavW7r9.js";import"./custom-element-BLZZ00dz.js";f
|
|
|
76
76
|
expect(await code('p2')).toEqual('always_p2');
|
|
77
77
|
expect(await code('p3')).toEqual('def_P3');
|
|
78
78
|
}
|
|
79
|
-
}`,...
|
|
79
|
+
}`,...d.parameters?.docs?.source}}};n.parameters={...n.parameters,docs:{...n.parameters?.docs,source:{originalSource:`{
|
|
80
80
|
args: {
|
|
81
81
|
title: 'Attributes runtime change',
|
|
82
82
|
body: \`
|
|
@@ -86,8 +86,8 @@ import{w as o,e}from"./index-CDavW7r9.js";import"./custom-element-BLZZ00dz.js";f
|
|
|
86
86
|
<attribute name="p1">default_P1 </attribute>
|
|
87
87
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
88
88
|
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
89
|
-
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
90
|
-
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
89
|
+
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
90
|
+
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
91
91
|
p3: <code data-testid="p3">{$p3}</code>
|
|
92
92
|
</template>
|
|
93
93
|
</custom-element>
|
|
@@ -119,7 +119,7 @@ import{w as o,e}from"./index-CDavW7r9.js";import"./custom-element-BLZZ00dz.js";f
|
|
|
119
119
|
await sleep(10);
|
|
120
120
|
expect(await code('p3')).toEqual('p3', 'set p3 in runtime');
|
|
121
121
|
}
|
|
122
|
-
}`,...
|
|
122
|
+
}`,...n.parameters?.docs?.source}}};p.parameters={...p.parameters,docs:{...p.parameters?.docs,source:{originalSource:`{
|
|
123
123
|
args: {
|
|
124
124
|
title: 'Instance Attributes',
|
|
125
125
|
body: \`
|
|
@@ -129,8 +129,8 @@ import{w as o,e}from"./index-CDavW7r9.js";import"./custom-element-BLZZ00dz.js";f
|
|
|
129
129
|
<attribute name="p1">default_P1 </attribute>
|
|
130
130
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
131
131
|
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
132
|
-
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
133
|
-
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
132
|
+
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
133
|
+
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
134
134
|
p3: <code data-testid="p3">{$p3}</code>
|
|
135
135
|
</template>
|
|
136
136
|
</custom-element>
|
|
@@ -148,4 +148,4 @@ import{w as o,e}from"./index-CDavW7r9.js";import"./custom-element-BLZZ00dz.js";f
|
|
|
148
148
|
expect(await code('p2')).toEqual('always_p2');
|
|
149
149
|
expect(await code('p3')).toEqual('qwe');
|
|
150
150
|
}
|
|
151
|
-
}`,...p.parameters?.docs?.source}}};const m=["AttributeDefaults","AttributesRuntimeChange","InstanceAttributes"];export{
|
|
151
|
+
}`,...p.parameters?.docs?.source}}};const m=["AttributeDefaults","AttributesRuntimeChange","InstanceAttributes"];export{d as AttributeDefaults,n as AttributesRuntimeChange,p as InstanceAttributes,m as __namedExportsOrder,b as default};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import{w as i,e as t}from"./custom-element-BV8-hRQS.js";import"./index-CVRyq5ci.js";const g={title:"",tag:"",style:"",slot:"",payload:""};function p(n){const{title:e,tag:o,style:s,slot:a,payload:l}={...g,...n};return`
|
|
2
|
+
<fieldset>
|
|
3
|
+
<legend>${e}</legend>
|
|
4
|
+
<custom-element ${o?`tag="${o}"`:""} >
|
|
5
|
+
<template>
|
|
6
|
+
<style>
|
|
7
|
+
${s}
|
|
8
|
+
</style>
|
|
9
|
+
<u><slot>${a}</slot></u>
|
|
10
|
+
</template>
|
|
11
|
+
</custom-element>
|
|
12
|
+
${l}
|
|
13
|
+
</fieldset>
|
|
14
|
+
`}const b={title:"Css",render:p},u='<b style="color:green">green</b>',y='<i style="color:red">red</i>',c={args:{title:`The default color should stay on this label, the message inside should be ${u}`,style:"color:green",slot:"text has to be green",payload:"<u>no tags</u>"},play:async({canvasElement:n})=>{const o=await i(n).findByText("text has to be green"),a=getComputedStyle(o).getPropertyValue("color");t(a).to.equal("rgb(0, 128, 0)"),await t(o.closest("custom-element")).toBeInTheDocument();const l=o.closest("custom-element");await t(l.xsltString).toContain("<xsl:stylesheet"),await t(l.dce.localName).toEqual("custom-element"),await t(l.dce.xsltString).toEqual(l.xsltString),await t(l.dce.xslt.documentElement.tagName).toEqual("xsl:stylesheet")}},r={args:{title:`The default color should apply ${u} in all instances`,style:"color:green",slot:"text has to be green",tag:"dce-2",payload:'<u>2 instances:</u> <dce-2 id="dce21"></dce-2> * <dce-2 id="dce22"></dce-2>'},play:async({canvasElement:n})=>{await i(n).findByText("2 instances:");const e=o=>{const s=n.querySelector(o);return getComputedStyle(s).getPropertyValue("color")};t(e("legend")).to.not.equal(e("b")),t(e("legend")).to.not.equal(e("b")),t(e("#dce21 u")).to.equal(e("b")),t(e("#dce22 u")).to.equal(e("b"))}},d={args:{title:`${u} in instance style can be overridden in payload as ${y} in 1st instance`,style:"color:green",slot:"is green",tag:"dce-3",payload:`<u>should be</u> ${y}:
|
|
15
|
+
<dce-3 id="dce32">
|
|
16
|
+
<template>
|
|
17
|
+
<style> color:red; </style>
|
|
18
|
+
<u>red</u>
|
|
19
|
+
</template>
|
|
20
|
+
</dce-3> <br/>
|
|
21
|
+
should be ${u}:
|
|
22
|
+
<dce-3 id="dce31">green</dce-3> `},play:async({canvasElement:n})=>{await i(n).findByText("should be");const e=o=>{const s=n.querySelector(o);return getComputedStyle(s).getPropertyValue("color")};t(e("legend")).to.not.equal(e("b")),t(e("#dce31 u")).to.equal(e("b")),t(e("#dce32 u")).to.equal(e("i"))}};c.parameters={...c.parameters,docs:{...c.parameters?.docs,source:{originalSource:`{
|
|
23
|
+
args: {
|
|
24
|
+
title: \`The default color should stay on this label, the message inside should be \${GREEN}\`,
|
|
25
|
+
style: \`color:green\`,
|
|
26
|
+
slot: 'text has to be green',
|
|
27
|
+
payload: '<u>no tags</u>'
|
|
28
|
+
},
|
|
29
|
+
play: async ({
|
|
30
|
+
canvasElement
|
|
31
|
+
}) => {
|
|
32
|
+
const canvas = within(canvasElement);
|
|
33
|
+
const el = await canvas.findByText('text has to be green');
|
|
34
|
+
const st = getComputedStyle(el);
|
|
35
|
+
const color = st.getPropertyValue('color');
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
expect(color).to.equal('rgb(0, 128, 0)');
|
|
38
|
+
await expect(el.closest('custom-element')).toBeInTheDocument();
|
|
39
|
+
const dce = el.closest('custom-element');
|
|
40
|
+
await expect(dce.xsltString).toContain('<xsl:stylesheet');
|
|
41
|
+
await expect(dce.dce.localName).toEqual('custom-element');
|
|
42
|
+
await expect(dce.dce.xsltString).toEqual(dce.xsltString);
|
|
43
|
+
await expect(dce.dce.xslt.documentElement.tagName).toEqual('xsl:stylesheet');
|
|
44
|
+
}
|
|
45
|
+
}`,...c.parameters?.docs?.source}}};r.parameters={...r.parameters,docs:{...r.parameters?.docs,source:{originalSource:`{
|
|
46
|
+
args: {
|
|
47
|
+
title: \`The default color should apply \${GREEN} in all instances\`,
|
|
48
|
+
style: \`color:green\`,
|
|
49
|
+
slot: 'text has to be green',
|
|
50
|
+
tag: 'dce-2',
|
|
51
|
+
payload: \`<u>2 instances:</u> <dce-2 id="dce21"></dce-2> * <dce-2 id="dce22"></dce-2>\`
|
|
52
|
+
},
|
|
53
|
+
play: async ({
|
|
54
|
+
canvasElement
|
|
55
|
+
}) => {
|
|
56
|
+
await within(canvasElement).findByText('2 instances:');
|
|
57
|
+
const color = (css: string) => {
|
|
58
|
+
const el = canvasElement.querySelector(css);
|
|
59
|
+
const st = getComputedStyle(el!);
|
|
60
|
+
return st.getPropertyValue('color');
|
|
61
|
+
};
|
|
62
|
+
expect(color('legend')).to.not.equal(color('b'));
|
|
63
|
+
expect(color('legend')).to.not.equal(color('b'));
|
|
64
|
+
expect(color('#dce21 u')).to.equal(color('b'));
|
|
65
|
+
expect(color('#dce22 u')).to.equal(color('b'));
|
|
66
|
+
}
|
|
67
|
+
}`,...r.parameters?.docs?.source}}};d.parameters={...d.parameters,docs:{...d.parameters?.docs,source:{originalSource:`{
|
|
68
|
+
args: {
|
|
69
|
+
title: \`\${GREEN} in instance style can be overridden in payload as \${RED} in 1st instance\`,
|
|
70
|
+
style: \`color:green\`,
|
|
71
|
+
slot: 'is green',
|
|
72
|
+
tag: 'dce-3',
|
|
73
|
+
payload: \`<u>should be</u> \${RED}:
|
|
74
|
+
<dce-3 id="dce32">
|
|
75
|
+
<template>
|
|
76
|
+
<style> color:red; </style>
|
|
77
|
+
<u>red</u>
|
|
78
|
+
</template>
|
|
79
|
+
</dce-3> <br/>
|
|
80
|
+
should be \${GREEN}:
|
|
81
|
+
<dce-3 id="dce31">green</dce-3> \`
|
|
82
|
+
},
|
|
83
|
+
play: async ({
|
|
84
|
+
canvasElement
|
|
85
|
+
}) => {
|
|
86
|
+
await within(canvasElement).findByText('should be');
|
|
87
|
+
const color = (css: string) => {
|
|
88
|
+
const el = canvasElement.querySelector(css);
|
|
89
|
+
const st = getComputedStyle(el!);
|
|
90
|
+
return st.getPropertyValue('color');
|
|
91
|
+
};
|
|
92
|
+
expect(color('legend')).to.not.equal(color('b'));
|
|
93
|
+
expect(color('#dce31 u')).to.equal(color('b'));
|
|
94
|
+
expect(color('#dce32 u')).to.equal(color('i'));
|
|
95
|
+
}
|
|
96
|
+
}`,...d.parameters?.docs?.source}}};const h=["StyleDoesNotLeak","StyleIn2Instances","OverrideInPayload"];export{d as OverrideInPayload,c as StyleDoesNotLeak,r as StyleIn2Instances,h as __namedExportsOrder,b as default};
|