@epa-wg/custom-element-dist 0.0.22 → 0.0.24
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 +13 -15
- package/coverage/index.html +30 -30
- package/coverage/src/custom-element/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js.html +336 -312
- package/coverage/src/custom-element/http-request.js.html +10 -10
- package/coverage/src/custom-element/index.html +19 -49
- package/coverage/src/custom-element/local-storage.js.html +5 -5
- 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.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/attributes.test.stories.ts.html +85 -91
- package/coverage/src/stories/coverage.svg +1 -1
- package/coverage/src/stories/css.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/css.test.stories.ts.html +75 -78
- package/coverage/src/stories/dom-merge.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/dom-merge.test.stories.ts.html +302 -74
- package/coverage/src/stories/external-template.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/external-template.test.stories.ts.html +154 -154
- package/coverage/src/stories/form.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/form.test.stories.ts.html +83 -86
- package/coverage/src/stories/http-request.stories.ts.html +1 -1
- package/coverage/src/stories/index.html +104 -104
- package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/local-storage.test.stories.ts.html +444 -444
- package/coverage/src/stories/location-element.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/location-element.test.stories.ts.html +96 -96
- package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/slice-events.test.stories.ts.html +141 -141
- package/coverage/src/stories/slots.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/slots.test.stories.ts.html +120 -123
- package/coverage/src/stories/{renderPlay.ts.html → testStoryBook.ts.html} +45 -24
- package/coverage/src/sum.ts.html +1 -1
- package/dist/{custom-element-N-sWiqGK.cjs → custom-element-BDK7dcJN.cjs} +8 -8
- package/dist/{custom-element-BISbI4SU.js → custom-element-DqtzLkTG.js} +74 -66
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +23 -22
- package/package.json +3 -3
- package/src/custom-element/custom-element.js +9 -1
- package/src/custom-element/demo/form.html +92 -46
- package/src/custom-element/demo/s.xml +9 -17
- package/src/custom-element/ide/web-types-dce.json +1 -1
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/stories/attributes.test.stories.ts +9 -11
- package/src/stories/css.test.stories.ts +6 -7
- package/src/stories/dom-merge.test.stories.ts +81 -5
- package/src/stories/external-template.test.stories.ts +6 -6
- package/src/stories/form.test.stories.ts +6 -7
- package/src/stories/local-storage.test.stories.ts +7 -7
- package/src/stories/location-element.test.stories.ts +6 -6
- package/src/stories/slice-events.test.stories.ts +6 -6
- package/src/stories/slots.test.stories.ts +6 -7
- package/src/stories/testStoryBook.ts +28 -0
- package/storybook-static/assets/{Color-PRSJMWNM-e4s261EJ.js → Color-PRSJMWNM-y4ZsI1hY.js} +1 -1
- package/storybook-static/assets/{Configure-DWut7txe.js → Configure-CyLVkwlf.js} +1 -1
- package/storybook-static/assets/{DocsRenderer-K4EAMTCU-CaXVGjCl.js → DocsRenderer-K4EAMTCU-VRGUwRrq.js} +2 -2
- package/storybook-static/assets/{WithTooltip-KJL26V4Q--B8vdnMi.js → WithTooltip-KJL26V4Q-xdXH9Ztt.js} +1 -1
- package/storybook-static/assets/{attributes.test.stories-IuwazrdL.js → attributes.test.stories-BckCcyrF.js} +3 -2
- package/storybook-static/assets/{css.test.stories-D9WaxrEv.js → css.test.stories-B-QcObCF.js} +1 -1
- package/storybook-static/assets/{custom-element-BV8-hRQS.js → custom-element-BIxkVg7K.js} +5 -5
- package/storybook-static/assets/dom-merge.test.stories-CjXhjTQY.js +258 -0
- package/storybook-static/assets/{external-template.test.stories-Bpr_wxBo.js → external-template.test.stories-BBqyi0az.js} +1 -1
- package/storybook-static/assets/{form.test.stories-3tURbEdv.js → form.test.stories-DsIo1B4n.js} +1 -1
- package/storybook-static/assets/{formatter-2WMMO6ZP-SJtgH3vM.js → formatter-2WMMO6ZP-CThVcQxM.js} +1 -1
- package/storybook-static/assets/{http-request.stories-8K_qSs8C.js → http-request.stories-sXA_Y-VM.js} +1 -1
- package/storybook-static/assets/{iframe-CM82WlGY.js → iframe-DcDTQOmA.js} +2 -2
- package/storybook-static/assets/{index-DNL-IEpS.js → index-CUFHd5VD.js} +1 -1
- package/storybook-static/assets/{index-CEZitmnt.js → index-DPPi9iZu.js} +5 -5
- package/storybook-static/assets/{index-D1MP-Zis.js → index-VWixWKZ7.js} +1 -1
- package/storybook-static/assets/{local-storage.test.stories-CtisAQBB.js → local-storage.test.stories-Cs2v3QTS.js} +1 -1
- package/storybook-static/assets/{location-element.test.stories-5O_t_m4Y.js → location-element.test.stories-WkrQDzJJ.js} +1 -1
- package/storybook-static/assets/{preview-5Y0XiZgz.js → preview-p-Bwze-K.js} +2 -2
- package/storybook-static/assets/{slice-events.test.stories-BSXCLIA5.js → slice-events.test.stories-BRBBc0JT.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-B1vqfHmN.js → slots.test.stories-r-i91k3y.js} +1 -1
- package/storybook-static/assets/{syntaxhighlighter-BP7B2CQK-BWFH_0wQ.js → syntaxhighlighter-BP7B2CQK-OnioRcs9.js} +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.json +1 -1
- package/storybook-static/project.json +1 -1
- package/tsconfig.json +31 -21
- package/coverage/src/custom-element/custom-element1-1.js/coverage.svg +0 -10
- package/coverage/src/custom-element/custom-element1-1.js.html +0 -2374
- package/coverage/src/custom-element/custom-element1.js/coverage.svg +0 -10
- package/coverage/src/custom-element/custom-element1.js.html +0 -2374
- package/src/custom-element/custom-element1-1.js +0 -763
- package/src/custom-element/custom-element1.js +0 -763
- package/src/custom-element/custom-element1.js0 +0 -750
- package/src/custom-element/custom-element2.js0 +0 -759
- package/src/custom-element/custom-element3.js0 +0 -763
- package/src/stories/renderPlay.ts +0 -21
- package/storybook-static/assets/dom-merge.test.stories-BhbNeum_.js +0 -137
- /package/coverage/src/stories/{renderPlay.ts → testStoryBook.ts}/coverage.svg +0 -0
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type {StoryObj} from '@storybook/web-components';
|
|
2
|
-
import {it} from 'vitest';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export async function renderPlay<TProps>(story: StoryObj, meta:{render: (args: TProps)=>string })
|
|
6
|
-
{
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
document.body.innerHTML = meta.render(story.args);
|
|
9
|
-
await new Promise(resolve => setTimeout(async () =>
|
|
10
|
-
{
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
await story.play({canvasElement: document.body.firstElementChild as HTMLElement});
|
|
13
|
-
resolve(0);
|
|
14
|
-
}, 0));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function playStories<TProps>( Stories: any, meta:{ render: (args: TProps)=>string } )
|
|
18
|
-
{
|
|
19
|
-
for ( let story of Object.values(Stories) as StoryObj[] )
|
|
20
|
-
it( story.args!.title, async () => renderPlay(story, meta) );
|
|
21
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import{w as l,e as n,u as c}from"./custom-element-BV8-hRQS.js";import"./index-CVRyq5ci.js";function r(s){return new Promise(t=>setTimeout(t,s))}function d(s){const{title:t,body:e}=s;return`
|
|
2
|
-
<fieldset>
|
|
3
|
-
<legend>${t}</legend>
|
|
4
|
-
${e}
|
|
5
|
-
</fieldset>
|
|
6
|
-
`}const h={title:"dom-merge",render:d},o={args:{title:"Chars count in textarea",body:`
|
|
7
|
-
<p>Counter update happens on change event(focus change). The update should not interfere with the input</p>
|
|
8
|
-
<custom-element>
|
|
9
|
-
<form>
|
|
10
|
-
<label>
|
|
11
|
-
<textarea slice="text-container" data-testid="textarea-id">Hello world!</textarea>
|
|
12
|
-
<span> Chars count:
|
|
13
|
-
<code data-testid="counter-id">{string-length(//slice/text-container/text())}</code>
|
|
14
|
-
</span>
|
|
15
|
-
</label>
|
|
16
|
-
<br/><input placeholder="after textarea input, click here " data-testid="refocus-id" />
|
|
17
|
-
</form>
|
|
18
|
-
</custom-element>
|
|
19
|
-
`},play:async({canvasElement:s})=>{const t=o.args.title,e=l(s);await e.findByText(t),await r(100),n(await e.findByTestId("textarea-id")).toBeInTheDocument();const a=e.getByTestId("textarea-id");a.value="",a.focus(),await c.keyboard(t),n(a.value).toEqual(t),n(a.value.length).toEqual(t.length),e.getByTestId("refocus-id").focus(),await r(10),n(e.getByTestId("counter-id").textContent).toEqual(""+t?.length,"counter of symbols")}},i={args:{title:"Word count in HTML input field",body:`
|
|
20
|
-
<p>Counter update happens on keyup event. The update should not interfere with the input</p>
|
|
21
|
-
<custom-element>
|
|
22
|
-
<form>
|
|
23
|
-
<label>
|
|
24
|
-
<input type="text" value="{//txt ?? 'Type time update'}" slice="txt" slice-event="init input" data-testid="input-id">
|
|
25
|
-
|
|
26
|
-
<span> Character count:
|
|
27
|
-
<code data-testid="chars-id"
|
|
28
|
-
>{
|
|
29
|
-
string-length(//slice/txt)
|
|
30
|
-
}</code>
|
|
31
|
-
</span>
|
|
32
|
-
<span> Word count:
|
|
33
|
-
<code data-testid="words-id"
|
|
34
|
-
>{
|
|
35
|
-
string-length(normalize-space(//slice/txt)) -
|
|
36
|
-
string-length(translate(normalize-space(//slice/txt), ' ', '')) + 1
|
|
37
|
-
}</code>
|
|
38
|
-
<!-- The expression first normalizes the string by removing leading and trailing whitespace and
|
|
39
|
-
collapsing internal whitespace into a single space. It then subtracts the length of the string
|
|
40
|
-
with all spaces removed from the length of the original string,
|
|
41
|
-
and adds 1 to account for the last word.
|
|
42
|
-
-->
|
|
43
|
-
</span>
|
|
44
|
-
|
|
45
|
-
</label>
|
|
46
|
-
<p><b>txt</b> slice:</p> <blockquote> {//slice/txt} </blockquote>
|
|
47
|
-
</form>
|
|
48
|
-
</custom-element>
|
|
49
|
-
`},play:async({canvasElement:s})=>{const t=i.args.title,e=l(s);await e.findByText(t);const a=await e.findByTestId("input-id");a.value="",a.focus(),n(a).toBeInTheDocument(),await c.keyboard(t),await r(10),n(a.value).toEqual(t),n(e.getByTestId("chars-id").textContent.trim()).toEqual(""+t.length,"counter of symbols"),n(t.split(" ").length).toEqual(6,"counter of words in text sample"),n(e.getByTestId("words-id").textContent.trim()).toEqual("6","counter of words in render")}};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
50
|
-
args: {
|
|
51
|
-
title: 'Chars count in textarea',
|
|
52
|
-
body: \`
|
|
53
|
-
<p>Counter update happens on change event(focus change). The update should not interfere with the input</p>
|
|
54
|
-
<custom-element>
|
|
55
|
-
<form>
|
|
56
|
-
<label>
|
|
57
|
-
<textarea slice="text-container" data-testid="textarea-id">Hello world!</textarea>
|
|
58
|
-
<span> Chars count:
|
|
59
|
-
<code data-testid="counter-id">{string-length(//slice/text-container/text())}</code>
|
|
60
|
-
</span>
|
|
61
|
-
</label>
|
|
62
|
-
<br/><input placeholder="after textarea input, click here " data-testid="refocus-id" />
|
|
63
|
-
</form>
|
|
64
|
-
</custom-element>
|
|
65
|
-
\`
|
|
66
|
-
},
|
|
67
|
-
play: async ({
|
|
68
|
-
canvasElement
|
|
69
|
-
}) => {
|
|
70
|
-
const titleText = (CharsCountInTextarea.args!.title as string);
|
|
71
|
-
const canvas = within(canvasElement);
|
|
72
|
-
await canvas.findByText(titleText);
|
|
73
|
-
await sleep(100);
|
|
74
|
-
expect(await canvas.findByTestId('textarea-id')).toBeInTheDocument();
|
|
75
|
-
const textarea = canvas.getByTestId('textarea-id');
|
|
76
|
-
textarea.value = '';
|
|
77
|
-
textarea.focus();
|
|
78
|
-
await userEvent.keyboard(titleText);
|
|
79
|
-
expect(textarea.value).toEqual(titleText);
|
|
80
|
-
expect(textarea.value.length).toEqual(titleText.length);
|
|
81
|
-
canvas.getByTestId('refocus-id').focus();
|
|
82
|
-
await sleep(10);
|
|
83
|
-
expect(canvas.getByTestId('counter-id').textContent).toEqual('' + titleText?.length, 'counter of symbols');
|
|
84
|
-
}
|
|
85
|
-
}`,...o.parameters?.docs?.source}}};i.parameters={...i.parameters,docs:{...i.parameters?.docs,source:{originalSource:`{
|
|
86
|
-
args: {
|
|
87
|
-
title: 'Word count in HTML input field',
|
|
88
|
-
body: \`
|
|
89
|
-
<p>Counter update happens on keyup event. The update should not interfere with the input</p>
|
|
90
|
-
<custom-element>
|
|
91
|
-
<form>
|
|
92
|
-
<label>
|
|
93
|
-
<input type="text" value="{//txt ?? 'Type time update'}" slice="txt" slice-event="init input" data-testid="input-id">
|
|
94
|
-
|
|
95
|
-
<span> Character count:
|
|
96
|
-
<code data-testid="chars-id"
|
|
97
|
-
>{
|
|
98
|
-
string-length(//slice/txt)
|
|
99
|
-
}</code>
|
|
100
|
-
</span>
|
|
101
|
-
<span> Word count:
|
|
102
|
-
<code data-testid="words-id"
|
|
103
|
-
>{
|
|
104
|
-
string-length(normalize-space(//slice/txt)) -
|
|
105
|
-
string-length(translate(normalize-space(//slice/txt), ' ', '')) + 1
|
|
106
|
-
}</code>
|
|
107
|
-
<!-- The expression first normalizes the string by removing leading and trailing whitespace and
|
|
108
|
-
collapsing internal whitespace into a single space. It then subtracts the length of the string
|
|
109
|
-
with all spaces removed from the length of the original string,
|
|
110
|
-
and adds 1 to account for the last word.
|
|
111
|
-
-->
|
|
112
|
-
</span>
|
|
113
|
-
|
|
114
|
-
</label>
|
|
115
|
-
<p><b>txt</b> slice:</p> <blockquote> {//slice/txt} </blockquote>
|
|
116
|
-
</form>
|
|
117
|
-
</custom-element>
|
|
118
|
-
\`
|
|
119
|
-
},
|
|
120
|
-
play: async ({
|
|
121
|
-
canvasElement
|
|
122
|
-
}) => {
|
|
123
|
-
const titleText = (WordCountOnType.args!.title as string);
|
|
124
|
-
const canvas = within(canvasElement);
|
|
125
|
-
await canvas.findByText(titleText);
|
|
126
|
-
const input = await canvas.findByTestId('input-id');
|
|
127
|
-
input.value = '';
|
|
128
|
-
input.focus();
|
|
129
|
-
expect(input).toBeInTheDocument();
|
|
130
|
-
await userEvent.keyboard(titleText);
|
|
131
|
-
await sleep(10);
|
|
132
|
-
expect(input.value).toEqual(titleText);
|
|
133
|
-
expect(canvas.getByTestId('chars-id').textContent.trim()).toEqual('' + titleText.length, 'counter of symbols');
|
|
134
|
-
expect(titleText.split(' ').length).toEqual(6, 'counter of words in text sample');
|
|
135
|
-
expect(canvas.getByTestId('words-id').textContent.trim()).toEqual('6', 'counter of words in render');
|
|
136
|
-
}
|
|
137
|
-
}`,...i.parameters?.docs?.source}}};const x=["CharsCountInTextarea","WordCountOnType"];export{o as CharsCountInTextarea,i as WordCountOnType,x as __namedExportsOrder,h as default};
|
|
File without changes
|