@epa-wg/custom-element 0.0.29 → 0.0.31
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/bin/xslDtd2Ide.mjs +1 -1
- package/custom-element.js +4 -2
- package/demo/data-slices.html +37 -0
- package/ide/web-types-dce.json +1 -1
- package/ide/web-types-xsl.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -341,16 +341,16 @@ within template
|
|
|
341
341
|
[css-demo-url]: https://unpkg.com/@epa-wg/custom-element@0.0/demo/scoped-css.html
|
|
342
342
|
[slice-demo-url]: https://unpkg.com/@epa-wg/custom-element@0.0/demo/data-slices.html
|
|
343
343
|
[hex-grid-url]: https://unpkg.com/@epa-wg/custom-element@0.0/demo/hex-grid.html
|
|
344
|
-
[hex-grid-image]: https://unpkg.com/@epa-wg/custom-element@0.0.
|
|
344
|
+
[hex-grid-image]: https://unpkg.com/@epa-wg/custom-element@0.0.31/demo/hex-grid-transform.png
|
|
345
345
|
[local-storage-demo]: https://unpkg.com/@epa-wg/custom-element@0.0/demo/local-storage.html
|
|
346
346
|
[http-request-demo]: https://unpkg.com/@epa-wg/custom-element@0.0/demo/http-request.html
|
|
347
347
|
[location-demo]: https://unpkg.com/@epa-wg/custom-element@0.0/demo/location.html
|
|
348
348
|
[github-image]: https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/mark-github.svg
|
|
349
349
|
[npm-image]: https://img.shields.io/npm/v/@epa-wg/custom-element.svg
|
|
350
350
|
[npm-url]: https://npmjs.org/package/@epa-wg/custom-element
|
|
351
|
-
[coverage-image]: https://unpkg.com/@epa-wg/custom-element-dist@0.0.
|
|
352
|
-
[coverage-url]: https://unpkg.com/@epa-wg/custom-element-dist@0.0.
|
|
353
|
-
[storybook-url]: https://unpkg.com/@epa-wg/custom-element-dist@0.0.
|
|
351
|
+
[coverage-image]: https://unpkg.com/@epa-wg/custom-element-dist@0.0.31/coverage/src/custom-element/coverage.svg
|
|
352
|
+
[coverage-url]: https://unpkg.com/@epa-wg/custom-element-dist@0.0.31/coverage/src/custom-element/index.html
|
|
353
|
+
[storybook-url]: https://unpkg.com/@epa-wg/custom-element-dist@0.0.31/storybook-static/index.html?path=/story/welcome--introduction
|
|
354
354
|
[sandbox-url]: https://stackblitz.com/github/EPA-WG/custom-element?file=index.html
|
|
355
355
|
[webcomponents-url]: https://www.webcomponents.org/element/@epa-wg/custom-element
|
|
356
356
|
[webcomponents-img]: https://img.shields.io/badge/webcomponents.org-published-blue.svg
|
package/bin/xslDtd2Ide.mjs
CHANGED
|
@@ -116,7 +116,7 @@ writeFileSync( '.././ide/customData-xsl.json', JSON.stringify( vsCode, undefined
|
|
|
116
116
|
const intelliJ = {
|
|
117
117
|
"$schema": "http://json.schemastore.org/web-types",
|
|
118
118
|
"name": "@epa-wg/custom-element",
|
|
119
|
-
"version": "0.0.
|
|
119
|
+
"version": "0.0.31",
|
|
120
120
|
"js-types-syntax": "typescript",
|
|
121
121
|
"description-markup": "markdown",
|
|
122
122
|
"contributions": {
|
package/custom-element.js
CHANGED
|
@@ -423,12 +423,13 @@ event2slice( x, sliceNames, ev, dce )
|
|
|
423
423
|
s.setAttribute('validation-message', el.validationMessage);
|
|
424
424
|
ev.type==='init' && cleanSliceValue();
|
|
425
425
|
s.append( obj2node( ev, 'event', d ) );
|
|
426
|
+
const notChecked = ( 'checkbox' === el.type || 'radio' === el.type ) && !el.checked ;
|
|
426
427
|
if( sel.hasAttribute('slice-value') )
|
|
427
428
|
{ if( el.value === undefined)
|
|
428
429
|
s.removeAttribute('value')
|
|
429
430
|
else
|
|
430
431
|
s.setAttribute('value', el.value );
|
|
431
|
-
const v = xPath( attr( sel, 'slice-value'),s );
|
|
432
|
+
const v = notChecked? '' : xPath( attr( sel, 'slice-value'),s );
|
|
432
433
|
cleanSliceValue();
|
|
433
434
|
s.append( createText( d, v ) );
|
|
434
435
|
}else
|
|
@@ -437,7 +438,8 @@ event2slice( x, sliceNames, ev, dce )
|
|
|
437
438
|
s.append( obj2node(new FormData(el),'value', s.ownerDocument) )
|
|
438
439
|
return s
|
|
439
440
|
}
|
|
440
|
-
|
|
441
|
+
|
|
442
|
+
const v = notChecked? '' : el.value ?? attr( el, 'value' );
|
|
441
443
|
cleanSliceValue();
|
|
442
444
|
if( v === null || v === undefined )
|
|
443
445
|
[...s.childNodes].filter(n=>n.localName!=='event').map(n=>n.remove());
|
package/demo/data-slices.html
CHANGED
|
@@ -210,6 +210,43 @@
|
|
|
210
210
|
</template>
|
|
211
211
|
</html-demo-element>
|
|
212
212
|
|
|
213
|
+
<html-demo-element legend="12. checkbox use"
|
|
214
|
+
description="The value is empty when unchecked. Otherwise taken either from slice-value or value attribute.">
|
|
215
|
+
<p>Check the box to see the value in slice</p>
|
|
216
|
+
<template>
|
|
217
|
+
<custom-element>
|
|
218
|
+
<template>
|
|
219
|
+
<input type="checkbox" slice="is-checked" value="V0" checked/>
|
|
220
|
+
slice: {/datadom/slice/is-checked} <br/>
|
|
221
|
+
<xsl:variable name="v1">V1</xsl:variable> <br/>
|
|
222
|
+
$v1={$v1}<br/>
|
|
223
|
+
|
|
224
|
+
<!-- slice-variable is XPath. $v1 is available only in template, embedding trick -->
|
|
225
|
+
<input type="checkbox" slice="s2" slice-value="'{$v1}'"/>
|
|
226
|
+
slice 2: {//s2} <br/>
|
|
227
|
+
|
|
228
|
+
<!-- variable is used in template scope -->
|
|
229
|
+
<input type="checkbox" slice="s3" value="{$v1}"/>
|
|
230
|
+
slice 3: {//s3}
|
|
231
|
+
</template>
|
|
232
|
+
</custom-element>
|
|
233
|
+
</template>
|
|
234
|
+
</html-demo-element>
|
|
235
|
+
|
|
236
|
+
<html-demo-element legend="13. Radio buttons use"
|
|
237
|
+
description="The value is empty when unchecked. Otherwise taken either from slice-value or value attribute.">
|
|
238
|
+
<p>Check the radiobutton to see the value in slice</p>
|
|
239
|
+
<template>
|
|
240
|
+
<custom-element>
|
|
241
|
+
<template>
|
|
242
|
+
V0: <input type="radio" slice="radio-group" value="V0" name="g1"/> <br/>
|
|
243
|
+
V1: <input type="radio" slice="radio-group" value="V1" name="g1" checked/> <br/>
|
|
244
|
+
slice: {//radio-group} <br/>
|
|
245
|
+
</template>
|
|
246
|
+
</custom-element>
|
|
247
|
+
</template>
|
|
248
|
+
</html-demo-element>
|
|
249
|
+
|
|
213
250
|
<script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js"></script>
|
|
214
251
|
|
|
215
252
|
</body>
|
package/ide/web-types-dce.json
CHANGED
package/ide/web-types-xsl.json
CHANGED
package/package.json
CHANGED