@epa-wg/custom-element-dist 0.0.29 → 0.0.32

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.
Files changed (175) hide show
  1. package/.idea/custom-element-dist.iml +11 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +25 -0
  3. package/.idea/misc.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/vcs.xml +6 -0
  6. package/.storybook/main.ts +21 -19
  7. package/.storybook/preview.ts +25 -25
  8. package/README.md +4 -4
  9. package/coverage/coverage-final.json +21 -21
  10. package/coverage/index.html +26 -26
  11. package/coverage/src/custom-element/coverage.svg +1 -1
  12. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  13. package/coverage/src/custom-element/custom-element.js.html +543 -441
  14. package/coverage/src/custom-element/http-request.js.html +12 -12
  15. package/coverage/src/custom-element/index.html +18 -18
  16. package/coverage/src/custom-element/local-storage.js.html +52 -52
  17. package/coverage/src/custom-element/location-element.js.html +4 -4
  18. package/coverage/src/custom-element/module-url.js.html +1 -1
  19. package/coverage/src/index.html +1 -1
  20. package/coverage/src/mocks/handlers.ts.html +1 -1
  21. package/coverage/src/mocks/index.html +1 -1
  22. package/coverage/src/stories/attributes.test.stories.ts/coverage.svg +1 -1
  23. package/coverage/src/stories/attributes.test.stories.ts.html +335 -35
  24. package/coverage/src/stories/coverage.svg +1 -1
  25. package/coverage/src/stories/css.test.stories.ts.html +1 -1
  26. package/coverage/src/stories/dom-merge.test.stories.ts.html +1 -1
  27. package/coverage/src/stories/external-template.test.stories.ts.html +2 -2
  28. package/coverage/src/stories/form.test.stories.ts.html +1 -1
  29. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  30. package/coverage/src/stories/index.html +22 -22
  31. package/coverage/src/stories/local-storage.test.stories.ts.html +17 -17
  32. package/coverage/src/stories/location-element.test.stories.ts.html +3 -6
  33. package/coverage/src/stories/module-url.test.stories.ts.html +1 -1
  34. package/coverage/src/stories/set-url.test.stories.ts.html +1 -1
  35. package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +1 -1
  36. package/coverage/src/stories/slice-events.test.stories.ts.html +284 -23
  37. package/coverage/src/stories/slots.test.stories.ts.html +1 -1
  38. package/coverage/src/stories/testStoryBook.ts.html +12 -12
  39. package/coverage/src/stories/version-select.test.stories.ts.html +3 -3
  40. package/coverage/src/sum.ts.html +1 -1
  41. package/dist/custom-element-D2wf_rqP.js +576 -0
  42. package/dist/custom-element-Dtzhbjkc.cjs +97 -0
  43. package/dist/custom-element-bundle.cjs +1 -1
  44. package/dist/custom-element-bundle.js +30 -28
  45. package/dist/demo/a.html +51 -38
  46. package/dist/demo/a.svg +26 -26
  47. package/dist/demo/data-slices.html +37 -0
  48. package/dist/demo/external-template.html +1 -0
  49. package/dist/demo/form.html +42 -0
  50. package/dist/demo/hex-grid-dce.html +1 -1
  51. package/dist/demo/hex-grid.html +1 -1
  52. package/dist/demo/parameters.html +20 -1
  53. package/dist/demo/s.xml +6 -12
  54. package/dist/demo/s.xslt +64 -15
  55. package/dist/demo/ss.html +4 -23
  56. package/package.json +13 -13
  57. package/public/demo/a.html +51 -38
  58. package/public/demo/a.svg +26 -26
  59. package/public/demo/data-slices.html +37 -0
  60. package/public/demo/external-template.html +1 -0
  61. package/public/demo/form.html +42 -0
  62. package/public/demo/hex-grid-dce.html +1 -1
  63. package/public/demo/hex-grid.html +1 -1
  64. package/public/demo/parameters.html +20 -1
  65. package/public/demo/s.xml +6 -12
  66. package/public/demo/s.xslt +64 -15
  67. package/public/demo/ss.html +4 -23
  68. package/src/custom-element/custom-element.js +76 -42
  69. package/src/custom-element/demo/a.html +51 -38
  70. package/src/custom-element/demo/a.svg +26 -26
  71. package/src/custom-element/demo/data-slices.html +37 -0
  72. package/src/custom-element/demo/external-template.html +1 -0
  73. package/src/custom-element/demo/form.html +42 -0
  74. package/src/custom-element/demo/hex-grid-dce.html +1 -1
  75. package/src/custom-element/demo/hex-grid.html +1 -1
  76. package/src/custom-element/demo/parameters.html +20 -1
  77. package/src/custom-element/demo/s.xml +6 -12
  78. package/src/custom-element/demo/s.xslt +64 -15
  79. package/src/custom-element/demo/ss.html +4 -23
  80. package/src/custom-element/ide/web-types-dce.json +1 -1
  81. package/src/custom-element/ide/web-types-xsl.json +1 -1
  82. package/src/material/angular.css +987 -987
  83. package/src/material/components/autocomplete.html +239 -240
  84. package/src/material/components/dropdown.html +110 -46
  85. package/src/material/components/icon-link.html +160 -160
  86. package/src/material/components/input.html +363 -0
  87. package/src/material/components/menu.html +234 -234
  88. package/src/material/components.html +121 -120
  89. package/src/material/demo.css +36 -31
  90. package/src/material/index.html +110 -110
  91. package/src/material/material.css +356 -356
  92. package/src/material/theme/README.md +17 -17
  93. package/src/material/theme/semantic.css +113 -112
  94. package/src/mocks/versions.mock.ts +8 -8
  95. package/src/stories/attributes.test.stories.ts +123 -23
  96. package/src/stories/external-template.test.stories.ts +1 -1
  97. package/src/stories/location-element.test.stories.ts +1 -2
  98. package/src/stories/slice-events.test.stories.ts +87 -0
  99. package/storybook-static/assets/Color-F6OSRLHC-BU3iy8jH.js +1 -0
  100. package/storybook-static/assets/{Configure-DOhzHFEs.js → Configure-DN6ifayP.js} +1 -1
  101. package/storybook-static/assets/{DocsRenderer-CFRXHY34-BSJkbsd6.js → DocsRenderer-CFRXHY34-BaVEufDj.js} +2 -2
  102. package/storybook-static/assets/attributes.test.stories-D1X6EBrd.js +278 -0
  103. package/storybook-static/assets/{css.test.stories-pgbBc17d.js → css.test.stories-Cp_g2hE1.js} +1 -1
  104. package/storybook-static/assets/custom-element-uuAtIYWS.js +97 -0
  105. package/storybook-static/assets/{dom-merge.test.stories-CXcYP_-J.js → dom-merge.test.stories-hbpdCka0.js} +1 -1
  106. package/storybook-static/assets/entry-preview-DHVXbf3x.js +26 -0
  107. package/storybook-static/assets/entry-preview-docs-BbcIMweR.js +2 -0
  108. package/storybook-static/assets/{external-template.test.stories-CpJ68Ghy.js → external-template.test.stories-BK89h6sk.js} +3 -3
  109. package/storybook-static/assets/{form.test.stories-D35lyqd8.js → form.test.stories-BfoLe_rw.js} +1 -1
  110. package/storybook-static/assets/{handlers-CW9pDZnt.js → handlers-yVPwH_Nz.js} +21 -21
  111. package/storybook-static/assets/{http-request.stories-CBbknCOO.js → http-request.stories-CBFJS2Ws.js} +1 -1
  112. package/storybook-static/assets/iframe-CJEL_4Nu.js +2 -0
  113. package/storybook-static/assets/index-BcZLpTeD.js +8 -0
  114. package/storybook-static/assets/{index-BSz1w4Gl.js → index-CxRwF5Or.js} +130 -130
  115. package/storybook-static/assets/index-D5fBh-7N.js +1 -0
  116. package/storybook-static/assets/{index-YxUFxnQR.js → index-DM-KBPdl.js} +1 -1
  117. package/storybook-static/assets/{index-B3QjF0Ed.js → index-RSFf30w1.js} +1 -1
  118. package/storybook-static/assets/index-SnjB5uV8.js +769 -0
  119. package/storybook-static/assets/{local-storage.test.stories-BY-PWhuk.js → local-storage.test.stories-C0Yzy6Am.js} +1 -1
  120. package/storybook-static/assets/{location-element.test.stories-3auBYEaU.js → location-element.test.stories-DNFrEu5A.js} +1 -1
  121. package/storybook-static/assets/{module-url.test.stories-B7L9cL60.js → module-url.test.stories-CXibF5Ta.js} +1 -1
  122. package/storybook-static/assets/{preview-CfWMRsRq.js → preview-Bnd0XhaF.js} +2 -2
  123. package/storybook-static/assets/{preview-BRPR-UXC.js → preview-CNKoaWES.js} +1 -1
  124. package/storybook-static/assets/preview-DAeyCMnM.js +1 -0
  125. package/storybook-static/assets/preview-DJMlNTk8.js +2 -0
  126. package/storybook-static/assets/{set-url.test.stories-CuSuDLIx.js → set-url.test.stories-BBfLxv2u.js} +1 -1
  127. package/storybook-static/assets/{slice-events.test.stories-BkRKsKem.js → slice-events.test.stories-HcXF8XQI.js} +138 -13
  128. package/storybook-static/assets/{slots.test.stories-BJCUWFkE.js → slots.test.stories-i6mnIFM2.js} +1 -1
  129. package/storybook-static/assets/tiny-invariant-CopsF_GD.js +1 -0
  130. package/storybook-static/assets/{version-select.test.stories-B3ybJn_Z.js → version-select.test.stories-BsUFH6Va.js} +1 -1
  131. package/storybook-static/demo/a.html +51 -38
  132. package/storybook-static/demo/a.svg +26 -26
  133. package/storybook-static/demo/data-slices.html +37 -0
  134. package/storybook-static/demo/external-template.html +1 -0
  135. package/storybook-static/demo/form.html +42 -0
  136. package/storybook-static/demo/hex-grid-dce.html +1 -1
  137. package/storybook-static/demo/hex-grid.html +1 -1
  138. package/storybook-static/demo/parameters.html +20 -1
  139. package/storybook-static/demo/s.xml +6 -12
  140. package/storybook-static/demo/s.xslt +64 -15
  141. package/storybook-static/demo/ss.html +4 -23
  142. package/storybook-static/iframe.html +2 -2
  143. package/storybook-static/index.html +4 -0
  144. package/storybook-static/index.json +1 -1
  145. package/storybook-static/project.json +1 -1
  146. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +333 -0
  147. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +40 -0
  148. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
  149. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +8 -8
  150. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +82 -85
  151. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
  152. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
  153. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  154. package/storybook-static/sb-addons/interactions-9/manager-bundle.js +66 -67
  155. package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +1 -1
  156. package/storybook-static/sb-manager/globals-module-info.js +25 -3
  157. package/storybook-static/sb-manager/globals-runtime.js +29585 -43124
  158. package/storybook-static/sb-manager/runtime.js +10647 -9399
  159. package/storybook-static/sb-preview/runtime.js +3536 -5860
  160. package/test-runner-jest.config.js +15 -0
  161. package/dist/custom-element-BOIPgtxz.js +0 -565
  162. package/dist/custom-element-CUsSENWc.cjs +0 -97
  163. package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
  164. package/storybook-static/assets/Color-ERTF36HU-CQkSD2nd.js +0 -1
  165. package/storybook-static/assets/attributes.test.stories-BJBuuXgZ.js +0 -150
  166. package/storybook-static/assets/custom-element-BDGsYgbP.js +0 -97
  167. package/storybook-static/assets/entry-preview-C313OLrj.js +0 -26
  168. package/storybook-static/assets/entry-preview-docs-B7ORr9w5.js +0 -2
  169. package/storybook-static/assets/iframe-DOi4N7qI.js +0 -2
  170. package/storybook-static/assets/index-BdcJ-iJ7.js +0 -8
  171. package/storybook-static/assets/index-CaL3Qp7t.js +0 -634
  172. package/storybook-static/assets/index-DgFM0Ce3.js +0 -1
  173. package/storybook-static/assets/preview-C992A1Y-.js +0 -2
  174. package/storybook-static/assets/preview-CcS4DQh8.js +0 -1
  175. package/storybook-static/assets/tiny-invariant-BxWVcicq.js +0 -1
@@ -1,20 +1,69 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dce="urn:schemas-epa-wg:dce" xmlns:exsl="http://exslt.org/common" version="1.0" exclude-result-prefixes="exsl">
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml"
3
+ xmlns:dce="urn:schemas-epa-wg:dce" xmlns:exsl="http://exslt.org/common" version="1.0"
4
+ exclude-result-prefixes="exsl">
3
5
  <xsl:template match="ignore">
4
6
  <xsl:choose>
5
- <xsl:when test="//attr"><xsl:value-of select="//attr"/></xsl:when>
6
- <xsl:otherwise><xsl:value-of select="def"/></xsl:otherwise>
7
- </xsl:choose><xsl:value-of select="."/></xsl:template>
8
- <xsl:template mode="payload" match="attributes"><xsl:param name="direction"><xsl:choose>
9
- <xsl:when test="//direction"><xsl:value-of select="//direction"/></xsl:when>
10
- <xsl:otherwise><xsl:value-of select="'row'"/></xsl:otherwise>
11
- </xsl:choose></xsl:param><dce-root xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" data-dce-id="1"><xsl:attribute name="direction"><xsl:choose>
12
- <xsl:when test="//direction"><xsl:value-of select="//direction"/></xsl:when>
13
- <xsl:otherwise><xsl:value-of select="'row'"/></xsl:otherwise>
14
- </xsl:choose></xsl:attribute><xsl:call-template name="slot">
15
- <xsl:with-param name="slotname" select="''"/>
16
- <xsl:with-param name="defaultvalue"/>
17
- </xsl:call-template></dce-root></xsl:template>
7
+ <xsl:when test="//attr">
8
+ <xsl:value-of select="//attr"/>
9
+ </xsl:when>
10
+ <xsl:otherwise>
11
+ <xsl:value-of select="def"/>
12
+ </xsl:otherwise>
13
+ </xsl:choose>
14
+ <xsl:value-of select="."/>
15
+ </xsl:template>
16
+ <xsl:template mode="payload" match="attributes">
17
+ <xsl:param name="p1" select="/datadom/attributes/p1">default_P1</xsl:param>
18
+ <xsl:param name="p2" select="'always_p2'"/>
19
+ <xsl:param name="p3">
20
+ <xsl:choose>
21
+ <xsl:when test="string-length(//p3)>0 ">RRRR
22
+ <xsl:value-of select="count(//p3)"/>
23
+ +<xsl:value-of select="//p3 "/>=
24
+ </xsl:when>
25
+ <xsl:otherwise>OOO
26
+ <xsl:value-of select=" 'def_P3' "/>
27
+ </xsl:otherwise>
28
+ </xsl:choose>
29
+ </xsl:param>
30
+ <dce-root xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" data-dce-id="1">
31
+ <xsl:attribute name="p1">default_P1</xsl:attribute>
32
+ <xsl:attribute name="p2">
33
+ <xsl:value-of select="'always_p2'"/>
34
+ </xsl:attribute>
35
+ <xsl:attribute name="p3">
36
+ <xsl:choose>
37
+ <xsl:when test="//p3 ">
38
+ <xsl:value-of select="//p3 "/>
39
+ </xsl:when>
40
+ <xsl:otherwise>
41
+ <xsl:value-of select=" 'def_P3' "/>
42
+ </xsl:otherwise>
43
+ </xsl:choose>
44
+ </xsl:attribute>
45
+ <dce-text xmlns="" data-dce-id="2">
46
+ p1:
47
+ </dce-text>
48
+ <code xmlns="" data-testid="p1" data-dce-id="3">
49
+ <xsl:value-of select="$p1"/>
50
+ </code>
51
+ <br xmlns="" data-dce-id="4"/>
52
+ <dce-text xmlns="" data-dce-id="5">
53
+ p2:
54
+ </dce-text>
55
+ <code xmlns="" data-testid="p2" data-dce-id="6">
56
+ <xsl:value-of select="$p2"/>
57
+ </code>
58
+ <br xmlns="" data-dce-id="7"/>
59
+ <dce-text xmlns="" data-dce-id="8">
60
+ p3:
61
+ </dce-text>
62
+ <code xmlns="" data-testid="p3" data-dce-id="9">
63
+ <xsl:value-of select="$p3"/>
64
+ </code>
65
+ </dce-root>
66
+ </xsl:template>
18
67
  <xsl:template match="/">
19
68
  <xsl:apply-templates mode="payload" select="/datadom/attributes"/>
20
69
  </xsl:template>
@@ -23,7 +72,7 @@
23
72
  <xsl:param name="defaultvalue"/>
24
73
  <xsl:choose>
25
74
  <xsl:when test="//payload/*[@slot=$slotname]">
26
- <xsl:copy-of select="//payload/*[@slot=$slotname]"/>
75
+ <xsl:copy-of select="//payload/*[@slot=$slotname]"/>
27
76
  </xsl:when>
28
77
  <xsl:otherwise>
29
78
  <xsl:copy-of select="$defaultvalue"/>
@@ -1,24 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <dce-root data-dce-id="1" label="Number" name="" placeholder="Enter the numeric value" type="text" value=""
3
- xmlns="http://www.w3.org/1999/xhtml" xmlns:dce="urn:schemas-epa-wg:dce"
4
- xmlns:xhtml="http://www.w3.org/1999/xhtml"><pre data-dce-id="2" xmlns=""> //focused
5
- //suggest
6
- //selected
7
- $selected-value </pre>
8
- <label data-dce-id="3">
9
- <dce-text data-dce-id="4">Number</dce-text>
10
- <input data-dce-id="5" name="" placeholder="Enter the numeric value" type="text" value="">
11
- <slice data-dce-id="6" name="focused" slice-event="focus" slice-value="1"/>
12
- <slice data-dce-id="7" name="selected" slice-event="input"/>
13
- </input></label>
14
- <fieldset data-dce-id="8" form="cem-autocomplete-form" xmlns=""><label data-dce-id="9" value="one"><input
15
- data-dce-id="10" name="cem-autocomplete" slice="suggest" slice-event="input" type="radio" value="one"/>
16
- <dce-text data-dce-id="11">One</dce-text>
17
- </label><label data-dce-id="9" value="two"><input data-dce-id="10" name="cem-autocomplete" slice="suggest" slice-event="input"
18
- type="radio" value="two"/>
19
- <dce-text data-dce-id="11">Two</dce-text>
20
- </label><label data-dce-id="9" value="three"><input data-dce-id="10" name="cem-autocomplete" slice="suggest"
21
- slice-event="input" type="radio" value="three"/>
22
- <dce-text data-dce-id="11">Three</dce-text>
23
- </label></fieldset>
24
- </dce-root>
2
+ <dce-root data-dce-id="1" value="123"
3
+ xmlns="http://www.w3.org/1999/xhtml" xmlns:dce="urn:schemas-epa-wg:dce" xmlns:xhtml="http://www.w3.org/1999/xhtml"><label data-dce-id="2">
4
+ <dce-text data-dce-id="3"/>
5
+ <input data-dce-id="4" slice="selected" slice-event="input" value="123"/></label></dce-root>
@@ -15,6 +15,7 @@ const attr = (el, attr)=> el.getAttribute?.(attr)
15
15
  , xslNs = x => ( x?.setAttribute('xmlns:xsl', XSL_NS_URL ), x )
16
16
  , xslHtmlNs = x => ( x?.setAttribute('xmlns:xhtml', HTML_NS_URL ), xslNs(x) )
17
17
  , isValidTagName = tag=> ( /^[_a-zA-Z][-_:a-zA-Z0-9]*$/ .test(tag) )
18
+ , mix = (o,kv) => { Object.keys(kv).map(k=> o[k] = kv[k] ) ; return o}
18
19
  , create = ( tag, t = '', d=document ) =>
19
20
  {
20
21
  const create = tag => ( e => ((t && e.append(createText(d.ownerDocument||d, t))),e) )((d.ownerDocument || d ).createElement( tag ))
@@ -29,11 +30,13 @@ const attr = (el, attr)=> el.getAttribute?.(attr)
29
30
  { const px = p.ownerDocument.createElementNS(p.namespaceURI,tag);
30
31
  for( let a of p.attributes)
31
32
  px.setAttribute(a.name, a.value);
32
- while( p.firstChild )
33
- px.append(p.firstChild);
33
+ for( let c of p.childNodes )
34
+ px.append(c.cloneNode(true));
34
35
  return px;
35
36
  };
36
37
 
38
+ export {cloneAs,mix};
39
+
37
40
  function
38
41
  ASSERT(x)
39
42
  {
@@ -149,8 +152,13 @@ tagUid( node )
149
152
  export function
150
153
  createXsltFromDom( templateNode, S = 'xsl:stylesheet' )
151
154
  {
155
+ const declaredAttributes = []
156
+ , hardcodedAttributes = {}
157
+ , exposedAttributes={};
158
+
152
159
  if( templateNode.tagName === S || templateNode.documentElement?.tagName === S )
153
- return tagUid(templateNode)
160
+ return tagUid(mix( templateNode, { declaredAttributes, hardcodedAttributes, exposedAttributes } ));
161
+
154
162
  const sanitizeXsl = xml2dom(`<xsl:stylesheet version="1.0" xmlns:xsl="${ XSL_NS_URL }" xmlns:xhtml="${ HTML_NS_URL }" xmlns:exsl="${EXSL_NS_URL}" exclude-result-prefixes="exsl" >
155
163
  <xsl:output method="xml"/>
156
164
  <xsl:template match="/"><dce-root xmlns="${ HTML_NS_URL }"><xsl:apply-templates select="*" /></dce-root></xsl:template>
@@ -198,9 +206,9 @@ createXsltFromDom( templateNode, S = 'xsl:stylesheet' )
198
206
  </xsl:template>
199
207
  <xsl:template mode="sanitize" match="xhtml:input">
200
208
  <xsl:element name="{local-name()}">
201
- <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
209
+ <xsl:apply-templates mode="sanitize" select="*[not(name()='slice')]|@*|text()"/>
202
210
  </xsl:element>
203
- <xsl:for-each select="*">
211
+ <xsl:for-each select="slice">
204
212
  <xsl:copy>
205
213
  <xsl:attribute name="for" >^</xsl:attribute>
206
214
  <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
@@ -285,35 +293,45 @@ createXsltFromDom( templateNode, S = 'xsl:stylesheet' )
285
293
  [...fr.childNodes].forEach(n=>r.append(n));
286
294
  fr.append(r)
287
295
  }
288
- const params = [];
296
+
289
297
  [...fr.querySelectorAll('dce-root>attribute')].forEach( a=>
290
298
  {
291
299
  keepAttributes(a,'namespace,name,select');
292
300
  const p = cloneAs(a,'xsl:param')
293
301
  , name = attr(a,'name');
302
+
303
+ declaredAttributes.push(name);
304
+ if( a.childNodes.length)
305
+ hardcodedAttributes[name] = a.textContent;
306
+
294
307
  payload.append(p);
295
- keepAttributes(p,'select,name');
296
- let select = attr(p,'select')?.split('??')
297
- if( !select)
298
- { select = ['//'+name, `'${p.textContent}'`];
299
- emptyNode(p);
300
- p.setAttribute('name',name);
301
- }
302
- let val;
303
- if( select?.length>1 )
304
- { p.removeAttribute('select');
305
- const c = $( xslDom, 'template[match="ignore"]>choose').cloneNode(true);
306
- emptyNode(c.firstElementChild).append( createText(c,'{'+select[0]+'}'));
307
- emptyNode(c.lastElementChild ).append( createText(c,'{'+select[1]+'}'));
308
- c.firstElementChild.setAttribute('test',select[0]);
309
- p.append(c);
310
- val = c.cloneNode(true);
308
+
309
+ if( a.hasAttribute('select') )
310
+ {
311
+ exposedAttributes[ name ] = attr( a, 'select' );
312
+ keepAttributes( p, 'select,name' );
313
+
314
+ let select = attr(a,'select').split('??');
315
+
316
+ let val;
317
+ if( select?.length>1 )
318
+ { p.removeAttribute('select');
319
+ const c = $( xslDom, 'template[match="ignore"]>choose').cloneNode(true);
320
+ // todo multiple ?? operators
321
+ emptyNode(c.firstElementChild).append( createText(c,'{'+select[0]+'}'));
322
+ emptyNode(c.lastElementChild ).append( createText(c,'{'+select[1]+'}'));
323
+ c.firstElementChild.setAttribute('test','string-length('+select[0]+')');
324
+ p.append(c);
325
+ val = c.cloneNode(true);
326
+ }else
327
+ val = cloneAs(a,'xsl:value-of');
328
+ val.removeAttribute('name');
329
+ a.append(val);
330
+ a.removeAttribute('select');
311
331
  }else
312
- val=cloneAs(a,'xsl:value-of');
313
- val.removeAttribute('name');
314
- a.append(val);
315
- a.removeAttribute('select');
316
- params.push(p)
332
+ { keepAttributes( p, 'name' );
333
+ p.setAttribute('select','/datadom/attributes/'+name)
334
+ }
317
335
  });
318
336
  [...fr.querySelectorAll('[value]')].filter(el=>el.getAttribute('value').match( /\{(.*)\?\?(.*)\}/g )).forEach(el=>
319
337
  { const v = attr(el,'value');
@@ -338,8 +356,8 @@ createXsltFromDom( templateNode, S = 'xsl:stylesheet' )
338
356
 
339
357
  forEach$( payload,'slot', s => s.parentNode.replaceChild( slot2xsl(s), s ) )
340
358
 
341
- const ret = tagUid(xslDom)
342
- ret.params = params;
359
+ const ret = tagUid(xslDom);
360
+ mix( ret, { declaredAttributes, hardcodedAttributes, exposedAttributes } );
343
361
  return ret;
344
362
  }
345
363
  export async function
@@ -423,12 +441,13 @@ event2slice( x, sliceNames, ev, dce )
423
441
  s.setAttribute('validation-message', el.validationMessage);
424
442
  ev.type==='init' && cleanSliceValue();
425
443
  s.append( obj2node( ev, 'event', d ) );
444
+ const notChecked = ( 'checkbox' === el.type || 'radio' === el.type ) && !el.checked ;
426
445
  if( sel.hasAttribute('slice-value') )
427
446
  { if( el.value === undefined)
428
447
  s.removeAttribute('value')
429
448
  else
430
449
  s.setAttribute('value', el.value );
431
- const v = xPath( attr( sel, 'slice-value'),s );
450
+ const v = notChecked? '' : xPath( attr( sel, 'slice-value'),s );
432
451
  cleanSliceValue();
433
452
  s.append( createText( d, v ) );
434
453
  }else
@@ -437,7 +456,8 @@ event2slice( x, sliceNames, ev, dce )
437
456
  s.append( obj2node(new FormData(el),'value', s.ownerDocument) )
438
457
  return s
439
458
  }
440
- const v = el.value ?? attr( el, 'value' ) ;
459
+
460
+ const v = notChecked? '' : el.value ?? attr( el, 'value' );
441
461
  cleanSliceValue();
442
462
  if( v === null || v === undefined )
443
463
  [...s.childNodes].filter(n=>n.localName!=='event').map(n=>n.remove());
@@ -492,10 +512,12 @@ const loadTemplateRoots = async ( src, dce )=>
492
512
  }
493
513
  export function mergeAttr( from, to )
494
514
  { for( let a of from.attributes)
495
- { a.namespaceURI? to.setAttributeNS( a.namespaceURI, a.name, a.value ) : to.setAttribute( a.name, a.value )
496
- if( a.name === 'value')
497
- to.value = a.value
498
- }
515
+ try
516
+ { a.namespaceURI? to.setAttributeNS( a.namespaceURI, a.name, a.value ) : to.setAttribute( a.name, a.value )
517
+ if( a.name === 'value')
518
+ to.value = a.value
519
+ }catch(e)
520
+ { console.warn('attribute assignment error',e?.message || e); }
499
521
  }
500
522
  export function assureUnique(n, id=0)
501
523
  {
@@ -528,7 +550,7 @@ export function appendByDceId(parent,e,k)
528
550
  }
529
551
  export function merge( parent, fromArr )
530
552
  {
531
- if( 'dce-root' === parent.firstElementChild?.localName && 'dce-root' !== fromArr[0].localName)
553
+ if( 'dce-root' === parent.firstElementChild?.localName && 'dce-root' !== fromArr[0]?.localName)
532
554
  return;
533
555
  if( !fromArr.length )
534
556
  return 'dce-root' !== parent.firstElementChild?.localName && removeChildren(parent);
@@ -656,12 +678,13 @@ CustomElement extends HTMLElement
656
678
  , sliceNames = sliceNodes.map(e=>attr(e,'slice'))
657
679
  .filter(n=>!n.includes('/'))
658
680
  .filter((v, i, a)=>a.indexOf(v) === i)
659
- .map(splitSliceNames).flat()
660
- , declaredAttributes = templateDocs.reduce( (ret,t) => { if( t.params ) ret.push( ...t.params ); return ret; }, [] );
681
+ .map(splitSliceNames).flat();
682
+
683
+ const { declaredAttributes, hardcodedAttributes, exposedAttributes } = templateDocs[0];
661
684
 
662
685
  class DceElement extends HTMLElement
663
686
  {
664
- static get observedAttributes(){ return declaredAttributes.map( a=>attr(a,'name')); }
687
+ static get observedAttributes(){ return declaredAttributes; }
665
688
  #inTransform = 0;
666
689
  connectedCallback()
667
690
  { let payload = sanitizeBlankText(this.childNodes);
@@ -694,7 +717,11 @@ CustomElement extends HTMLElement
694
717
  xslNs(payloadNode);
695
718
  xslHtmlNs(payloadNode);
696
719
  this.innerHTML='';
697
- const attrsRoot = injectData( x, 'attributes' , this.attributes, e => createXmlNode( e.nodeName, e.value ) );
720
+ const attrsRoot = injectData( x, 'attributes' , this.attributes, e => createXmlNode( e.nodeName, e.value ) )
721
+ , inAttrs = a=> this.hasAttribute(a) || [...attrsRoot.children].find(e=>e.localName === a);
722
+ Object.keys(hardcodedAttributes).map(a=> inAttrs(a) || attrsRoot.append(createXmlNode(a,hardcodedAttributes[a])) );
723
+ declaredAttributes.map(a=> inAttrs(a) || attrsRoot.append(createXmlNode(a)) );
724
+
698
725
  injectData( x, 'dataset', Object.keys( this.dataset ), k => createXmlNode( k, this.dataset[ k ] ) );
699
726
  const sliceRoot = injectData( x, 'slice', sliceNames, k => createXmlNode( k, '' ) )
700
727
  , sliceXPath = x => xPath(x, sliceRoot);
@@ -740,13 +767,20 @@ CustomElement extends HTMLElement
740
767
  merge( this, f.childNodes )
741
768
  })
742
769
 
743
- DceElement.observedAttributes.map( a =>
770
+ Object.entries(hardcodedAttributes).map(( [a,v] )=>
771
+ { if( !this.hasAttribute(a) && v !== attr(this,a) )
772
+ { this.setAttribute( a, v );
773
+ this.#applyAttribute( a, v );
774
+ }
775
+ });
776
+
777
+ Object.keys(exposedAttributes).map( a =>
744
778
  { let v = attr(this.firstElementChild,a);
745
779
  if( v !== attr(this,a) )
746
780
  { this.setAttribute( a, v );
747
781
  this.#applyAttribute( a, v );
748
782
  }
749
- })
783
+ });
750
784
 
751
785
  function getSliceTarget(el)
752
786
  { let r = el;
@@ -1,8 +1,8 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
2
+ <html lang="en">
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5
- <title>Data slices - Declarative Custom Element implementation demo</title>
5
+ <title>http-request Declarative Custom Element implementation demo</title>
6
6
  <link rel="icon" href="./wc-square.svg"/>
7
7
 
8
8
  <script type="module" src="../http-request.js"></script>
@@ -10,51 +10,64 @@
10
10
  <style>
11
11
  @import "./demo.css";
12
12
 
13
- label {
14
- display: flex;
13
+ button {
14
+ display: inline-flex;
15
+ flex-direction: column;
16
+ align-items: center;
17
+ flex: auto;
18
+ box-shadow: inset silver 0 0 1rem;
19
+ min-width: 12rem;
20
+ padding: 1rem;
21
+ color: coral;
22
+ text-shadow: 1px 1px silver;
23
+ font-weight: bolder;
15
24
  }
16
25
 
17
- label:has(input[type="text"],input[type="password"],input:not([type]) ) {
18
- flex-direction: column;
26
+ button img {
27
+ max-height: 10vw;
28
+ min-height: 4rem;
19
29
  }
20
30
 
21
- nav {
22
- max-width: 32em;
31
+ table {
32
+ min-width: 16rem;
33
+ }
34
+
35
+ td {
36
+ border-bottom: 1px solid silver;
37
+ }
38
+
39
+ tfoot td {
40
+ border-bottom: none;
41
+ }
42
+
43
+ td, th {
44
+ text-align: right;
23
45
  }
24
- </style>
25
- <!-- https://github.com/mdn/learning-area/blob/main/html/forms/form-validation/custom-error-message.html
26
- todo: apply setCustomValidity( warningStr )
27
- -->
28
46
 
47
+ caption {
48
+ padding: 1rem;
49
+ font-weight: bolder;
50
+ font-family: sans-serif;
51
+ }
52
+
53
+ code {
54
+ text-align: right;
55
+ min-width: 3rem;
56
+ }
57
+
58
+ svg {
59
+ max-height: 3rem;
60
+ }
61
+ </style>
29
62
  </head>
30
63
  <body>
31
64
 
32
- <fieldset>
33
- <legend><b style="color:green">green</b> in instance style can be overridden in payload as <i
34
- style="color:red">red</i> in 1st instance
35
- </legend>
36
- <custom-element tag="dce-3">
37
- <template>
38
- <u>
39
- <slot>is green</slot>
40
- </u>
41
- </template>
42
- <style>dce-3 {
43
- color: green
44
- }</style>
45
- </custom-element>
46
- <u>should be</u> <i style="color:red">red</i>:
47
- <dce-3 id="dce32">
48
- <template>
49
- <style> color:red; </style>
50
- <u>red</u>
51
- </template>
52
- </dce-3> <br/>
53
- should be GREEN:
54
- <dce-3 id="dce31">green</dce-3>
55
- </fieldset>
56
-
57
- <script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js"></script>
65
+
66
+
67
+ <custom-element src="./html-template.html#dwc-logo">
68
+ <template><i>loading SVG from templates file ...</i></template>
69
+ </custom-element>
70
+
58
71
 
59
72
  </body>
60
73
  </html>
@@ -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>
@@ -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 group"
237
+ description="The value propagated into slice from the last checked radiobutton.">
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>
@@ -57,6 +57,7 @@
57
57
 
58
58
  svg {
59
59
  max-height: 3rem;
60
+ min-height: 2rem;
60
61
  }
61
62
  </style>
62
63
  </head>
@@ -233,6 +233,48 @@
233
233
  </template>
234
234
  </html-demo-element>
235
235
 
236
+ <html-demo-element legend="5. using custom-element as form input"
237
+ description="bypass value to container form "
238
+ id="sample-5"
239
+ >
240
+ <ol>
241
+ <li> select radio in top group</li>
242
+ <li> observe the fruit selected on the left</li>
243
+ <li> observe the warning message bellow button</li>
244
+ <li> next button does not submit the form</li>
245
+ <li> select radio in bottom group</li>
246
+ <li> observe the fruit selected on the right</li>
247
+ <li> same fruit selection would eliminate the warning and
248
+ allow the form submission</li>
249
+ <li> after submit, observe the URL parameters 'inp-1=🍏&inp-2=🍏' </li>
250
+ </ol>
251
+ <template>
252
+ <custom-element tag="sample-input">
253
+ <template>
254
+ <attribute name="name" ></attribute>
255
+ <attribute name="value" select="//val"></attribute>
256
+ {$name}
257
+ <label><input type="radio" name="{$name}" slice="val" value="🍏">Apple</label>
258
+ <label><input type="radio" name="{$name}" slice="val" value="🍌">Banana</label>
259
+ </template>
260
+ </custom-element>
261
+ <custom-element>
262
+ <template>
263
+ <form slice="cart-form" action="#sample-5"
264
+ custom-validity="(//inp1 = //inp2) ?? 'pick same fruit'"
265
+ >
266
+ <sample-input slice="inp1" name="inp-1"></sample-input>
267
+ <sample-input slice="inp2" name="inp-2"></sample-input>
268
+ <button>Next</button>
269
+ Picked :{//inp1} and {//inp2}
270
+
271
+ <p>{//cart-form/@validation-message}</p>
272
+ </form>
273
+ </template>
274
+ </custom-element>
275
+ </template>
276
+ </html-demo-element>
277
+
236
278
  <script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js"></script>
237
279
 
238
280
  </body>