@epa-wg/custom-element-dist 0.0.26 → 0.0.28

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 (216) hide show
  1. package/.storybook/main.ts +2 -2
  2. package/.storybook/preview.ts +1 -1
  3. package/README.md +4 -4
  4. package/bin/vitest/vitest-browser-importmaps.mjs +20 -20
  5. package/coverage/coverage-final.json +22 -22
  6. package/coverage/index.html +26 -26
  7. package/coverage/src/custom-element/coverage.svg +1 -1
  8. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  9. package/coverage/src/custom-element/custom-element.js.html +662 -380
  10. package/coverage/src/custom-element/demo/index.html +1 -1
  11. package/coverage/src/custom-element/demo/z.js.html +1 -1
  12. package/coverage/src/custom-element/http-request.js.html +12 -12
  13. package/coverage/src/custom-element/index.html +21 -21
  14. package/coverage/src/custom-element/local-storage.js.html +78 -63
  15. package/coverage/src/custom-element/location-element.js.html +4 -4
  16. package/coverage/src/custom-element/module-url.js/coverage.svg +1 -1
  17. package/coverage/src/custom-element/module-url.js.html +16 -10
  18. package/coverage/src/index.html +1 -1
  19. package/coverage/src/mocks/handlers.ts.html +1 -1
  20. package/coverage/src/mocks/index.html +1 -1
  21. package/coverage/src/stories/attributes.test.stories.ts.html +17 -11
  22. package/coverage/src/stories/coverage.svg +1 -1
  23. package/coverage/src/stories/css.test.stories.ts.html +8 -2
  24. package/coverage/src/stories/dom-merge.test.stories.ts.html +17 -11
  25. package/coverage/src/stories/external-template.test.stories.ts.html +13 -10
  26. package/coverage/src/stories/form.test.stories.ts.html +8 -2
  27. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  28. package/coverage/src/stories/index.html +26 -26
  29. package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +1 -1
  30. package/coverage/src/stories/local-storage.test.stories.ts.html +106 -76
  31. package/coverage/src/stories/location-element.test.stories.ts.html +8 -2
  32. package/coverage/src/stories/module-url.test.stories.ts.html +8 -2
  33. package/coverage/src/stories/set-url.test.stories.ts.html +8 -2
  34. package/coverage/src/stories/slice-events.test.stories.ts.html +8 -2
  35. package/coverage/src/stories/slots.test.stories.ts.html +8 -2
  36. package/coverage/src/stories/testStoryBook.ts.html +12 -12
  37. package/coverage/src/stories/version-select.test.stories.ts.html +8 -2
  38. package/coverage/src/sum.ts.html +1 -1
  39. package/dist/custom-element-BOIPgtxz.js +565 -0
  40. package/dist/custom-element-CUsSENWc.cjs +97 -0
  41. package/dist/custom-element-bundle.cjs +1 -1
  42. package/dist/custom-element-bundle.js +25 -21
  43. package/dist/demo/a.svg +27 -0
  44. package/dist/demo/demo.css +6 -7
  45. package/dist/demo/external-template.html +3 -3
  46. package/dist/demo/npm-versions-demo.html +21 -8
  47. package/dist/demo/npm-versions.html +54 -25
  48. package/dist/demo/s.xml +11 -21
  49. package/dist/demo/s.xslt +16 -74
  50. package/dist/demo/s1.xslt +59 -59
  51. package/dist/demo/ss.html +24 -57
  52. package/dist/demo/z.html +33 -62
  53. package/dist/demo/z.xml +59 -59
  54. package/dist/demo/z1.html +34 -0
  55. package/dist/local-storage-78EivJ_B.cjs +1 -0
  56. package/dist/local-storage-DzmNKzgN.js +66 -0
  57. package/dist/mockServiceWorker.js +1 -1
  58. package/package.json +27 -25
  59. package/public/demo/a.svg +27 -0
  60. package/public/demo/demo.css +6 -7
  61. package/public/demo/external-template.html +3 -3
  62. package/public/demo/npm-versions-demo.html +21 -8
  63. package/public/demo/npm-versions.html +54 -25
  64. package/public/demo/s.xml +11 -21
  65. package/public/demo/s.xslt +16 -74
  66. package/public/demo/s1.xslt +59 -59
  67. package/public/demo/ss.html +24 -57
  68. package/public/demo/z.html +33 -62
  69. package/public/demo/z.xml +59 -59
  70. package/public/demo/z1.html +34 -0
  71. package/public/mockServiceWorker.js +1 -1
  72. package/src/custom-element/custom-element.js +123 -29
  73. package/src/custom-element/demo/a.svg +27 -0
  74. package/src/custom-element/demo/demo.css +6 -7
  75. package/src/custom-element/demo/external-template.html +3 -3
  76. package/src/custom-element/demo/npm-versions-demo.html +21 -8
  77. package/src/custom-element/demo/npm-versions.html +54 -25
  78. package/src/custom-element/demo/s.xml +11 -21
  79. package/src/custom-element/demo/s.xslt +16 -74
  80. package/src/custom-element/demo/s1.xslt +59 -59
  81. package/src/custom-element/demo/ss.html +24 -57
  82. package/src/custom-element/demo/z.html +33 -62
  83. package/src/custom-element/demo/z.xml +59 -59
  84. package/src/custom-element/demo/z1.html +34 -0
  85. package/src/custom-element/ide/web-types-dce.json +1 -1
  86. package/src/custom-element/ide/web-types-xsl.json +1 -1
  87. package/src/custom-element/index.html +19 -2
  88. package/src/custom-element/local-storage.js +19 -14
  89. package/src/custom-element/module-url.js +3 -2
  90. package/src/dce-social-preview.png +0 -0
  91. package/src/material/angular.css +987 -0
  92. package/src/material/components/autocomplete.html +241 -0
  93. package/src/material/components/dropdown.html +115 -0
  94. package/src/material/components/menu.html +235 -0
  95. package/src/material/components.html +109 -0
  96. package/src/material/demo.css +31 -0
  97. package/src/material/index.html +169 -0
  98. package/src/material/material.css +357 -0
  99. package/src/material/theme/README.md +18 -0
  100. package/src/material/theme/semantic.css +112 -0
  101. package/src/mocks/versions.mock.ts +8 -8
  102. package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
  103. package/src/stories/attributes.test.stories.ts +6 -4
  104. package/src/stories/css.test.stories.ts +2 -0
  105. package/src/stories/dom-merge.test.stories.ts +11 -9
  106. package/src/stories/external-template.test.stories.ts +4 -3
  107. package/src/stories/form.test.stories.ts +2 -0
  108. package/src/stories/local-storage.test.stories.ts +63 -53
  109. package/src/stories/location-element.test.stories.ts +2 -0
  110. package/src/stories/module-url.test.stories.ts +2 -0
  111. package/src/stories/set-url.test.stories.ts +2 -0
  112. package/src/stories/slice-events.test.stories.ts +2 -0
  113. package/src/stories/slots.test.stories.ts +2 -0
  114. package/src/stories/version-select.test.stories.ts +2 -0
  115. package/src/sum.test.ts +5 -5
  116. package/src/sum.ts +3 -3
  117. package/storybook-static/assets/Color-ERTF36HU-ChyYtq0t.js +1 -0
  118. package/storybook-static/assets/Configure-CJVwFVjC.js +165 -0
  119. package/storybook-static/assets/DocsRenderer-CFRXHY34-Bz6q-OqD.js +2 -0
  120. package/storybook-static/assets/{attributes.test.stories-DIQXccHc.js → attributes.test.stories-BJBuuXgZ.js} +13 -14
  121. package/storybook-static/assets/{css.test.stories-BV2hi4CY.js → css.test.stories-pgbBc17d.js} +1 -1
  122. package/storybook-static/assets/custom-element-BDGsYgbP.js +97 -0
  123. package/storybook-static/assets/{dom-merge.test.stories-Dws0C2-g.js → dom-merge.test.stories-CXcYP_-J.js} +26 -24
  124. package/storybook-static/assets/entry-preview-C313OLrj.js +26 -0
  125. package/storybook-static/assets/{entry-preview-docs-BMKNVQXA.js → entry-preview-docs-B7ORr9w5.js} +2 -2
  126. package/storybook-static/assets/{external-template.test.stories-BHO48b0j.js → external-template.test.stories-CpJ68Ghy.js} +19 -20
  127. package/storybook-static/assets/{form.test.stories-dv9mwp24.js → form.test.stories-D35lyqd8.js} +2 -2
  128. package/storybook-static/assets/{handlers-CaCq2ZPF.js → handlers-B-OZtf2K.js} +13 -13
  129. package/storybook-static/assets/{http-request.stories-B2ke7LtS.js → http-request.stories-DccXgHyF.js} +6 -6
  130. package/storybook-static/assets/iframe-Ddc_axoC.js +2 -0
  131. package/storybook-static/assets/index-BSz1w4Gl.js +234 -0
  132. package/storybook-static/assets/index-BdcJ-iJ7.js +8 -0
  133. package/storybook-static/assets/index-CiCdFubk.js +634 -0
  134. package/storybook-static/assets/{index-Dz4OaB2k.js → index-f2MAjm2i.js} +1 -1
  135. package/storybook-static/assets/index-lY6s0fkU.js +1 -0
  136. package/storybook-static/assets/index-tfEkrhWr.js +1 -0
  137. package/storybook-static/assets/local-storage.test.stories-BY-PWhuk.js +420 -0
  138. package/storybook-static/assets/{location-element.test.stories-BiFvBop7.js → location-element.test.stories-3auBYEaU.js} +3 -3
  139. package/storybook-static/assets/{module-url.test.stories-BXoM34tX.js → module-url.test.stories-B7L9cL60.js} +6 -6
  140. package/storybook-static/assets/{preview-0Jj89qip.js → preview-BRPR-UXC.js} +1 -1
  141. package/storybook-static/assets/preview-BUQm51_C.js +52 -0
  142. package/storybook-static/assets/{preview-DB9FwMii.js → preview-BWzBA1C2.js} +1 -1
  143. package/storybook-static/assets/preview-BhhEZcNS.js +1 -0
  144. package/storybook-static/assets/preview-CcS4DQh8.js +1 -0
  145. package/storybook-static/assets/{preview-Cg7hXPRq.js → preview-CfH4_OzN.js} +2 -2
  146. package/storybook-static/assets/{preview-FpHGYA1q.js → preview-DHPc-V4N.js} +1 -1
  147. package/storybook-static/assets/preview-DYzi3Z2p.js +1 -0
  148. package/storybook-static/assets/{preview-4Up_z4Em.js → preview-caVMbCIR.js} +2 -2
  149. package/storybook-static/assets/preview-ncvtW_hb.js +34 -0
  150. package/storybook-static/assets/{set-url.test.stories-Cg5Z0r7x.js → set-url.test.stories-CuSuDLIx.js} +3 -3
  151. package/storybook-static/assets/{slice-events.test.stories-D_ttGp3g.js → slice-events.test.stories-BkRKsKem.js} +4 -4
  152. package/storybook-static/assets/{slots.test.stories-DBNXOm0T.js → slots.test.stories-BJCUWFkE.js} +8 -8
  153. package/storybook-static/assets/{version-select.test.stories-CgV3UCim.js → version-select.test.stories-B3ybJn_Z.js} +2 -2
  154. package/storybook-static/demo/a.svg +27 -0
  155. package/storybook-static/demo/demo.css +6 -7
  156. package/storybook-static/demo/external-template.html +3 -3
  157. package/storybook-static/demo/npm-versions-demo.html +21 -8
  158. package/storybook-static/demo/npm-versions.html +54 -25
  159. package/storybook-static/demo/s.xml +11 -21
  160. package/storybook-static/demo/s.xslt +16 -74
  161. package/storybook-static/demo/s1.xslt +59 -59
  162. package/storybook-static/demo/ss.html +24 -57
  163. package/storybook-static/demo/z.html +33 -62
  164. package/storybook-static/demo/z.xml +59 -59
  165. package/storybook-static/demo/z1.html +34 -0
  166. package/storybook-static/iframe.html +1 -1
  167. package/storybook-static/index.html +3 -7
  168. package/storybook-static/mockServiceWorker.js +1 -1
  169. package/storybook-static/project.json +1 -1
  170. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
  171. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +9 -9
  172. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +76 -94
  173. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
  174. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
  175. package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
  176. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  177. package/storybook-static/sb-addons/interactions-9/manager-bundle.js +211 -0
  178. package/storybook-static/sb-addons/interactions-9/manager-bundle.js.LEGAL.txt +0 -0
  179. package/storybook-static/sb-manager/globals-module-info.js +11 -0
  180. package/storybook-static/sb-manager/globals-runtime.js +27803 -26928
  181. package/storybook-static/sb-manager/runtime.js +10341 -10136
  182. package/storybook-static/sb-preview/runtime.js +3841 -3828
  183. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  184. package/.idea/compiler.xml +0 -6
  185. package/.idea/custom-element-dist.iml +0 -13
  186. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  187. package/.idea/misc.xml +0 -6
  188. package/.idea/modules.xml +0 -8
  189. package/.idea/vcs.xml +0 -6
  190. package/.vscode/settings.json +0 -24
  191. package/dist/custom-element-CckoVsvO.cjs +0 -53
  192. package/dist/custom-element-b7c_7Kz4.js +0 -485
  193. package/dist/local-storage-Boafngui.cjs +0 -1
  194. package/dist/local-storage-BqDEu2kF.js +0 -59
  195. package/storybook-static/assets/Color-KGDBMAHA-CH-YyWYq.js +0 -1
  196. package/storybook-static/assets/Configure-DFL_bm2M.js +0 -173
  197. package/storybook-static/assets/DocsRenderer-PKQXORMH-Bz-_1hmS.js +0 -2
  198. package/storybook-static/assets/custom-element-wn23PUwN.js +0 -231
  199. package/storybook-static/assets/entry-preview-BKQ8UCxI.js +0 -8
  200. package/storybook-static/assets/iframe-D4Sos1HO.js +0 -2
  201. package/storybook-static/assets/index-BnXBQqj9.js +0 -605
  202. package/storybook-static/assets/index-C8k3Z-3Y.js +0 -28
  203. package/storybook-static/assets/index-Cpxqn5iQ.js +0 -1
  204. package/storybook-static/assets/index-DGdNYaqV.js +0 -8
  205. package/storybook-static/assets/index-sm7QlJZE.js +0 -1
  206. package/storybook-static/assets/lit-element-DzhCn-8W.js +0 -19
  207. package/storybook-static/assets/local-storage.test.stories-BpogLNq-.js +0 -419
  208. package/storybook-static/assets/preview-BJPLiuSt.js +0 -1
  209. package/storybook-static/assets/preview-BMWqy4Bi.js +0 -1
  210. package/storybook-static/assets/preview-BnWGZYux.js +0 -1
  211. package/storybook-static/assets/preview-Djh1_Tal.js +0 -20
  212. package/storybook-static/assets/preview-oHxXRSIu.js +0 -48
  213. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +0 -333
  214. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +0 -40
  215. package/storybook-static/sb-addons/interactions-10/manager-bundle.js +0 -234
  216. /package/{storybook-static/sb-addons/interactions-10/manager-bundle.js.LEGAL.txt → src/material/guide/getting-started/index.html} +0 -0
@@ -1 +1 @@
1
- import{ae as e}from"./index-BnXBQqj9.js";const o={},c=e.createContext(o);function u(n){const t=e.useContext(c);return e.useMemo(function(){return typeof n=="function"?n(t):{...t,...n}},[t,n])}function s(n){let t;return n.disableParentContext?t=typeof n.components=="function"?n.components(o):n.components||o:t=u(n.components),e.createElement(c.Provider,{value:t},n.children)}export{s as M,u};
1
+ import{ae as e}from"./index-CiCdFubk.js";const o={},c=e.createContext(o);function u(n){const t=e.useContext(c);return e.useMemo(function(){return typeof n=="function"?n(t):{...t,...n}},[t,n])}function s(n){let t;return n.disableParentContext?t=typeof n.components=="function"?n.components(o):n.components||o:t=u(n.components),e.createElement(c.Provider,{value:t},n.children)}export{s as M,u};
@@ -0,0 +1 @@
1
+ import{f as p,n as i,F as l,$ as m,L as c,h as T,B as b,e as d,m as S,g as B,v as L,u as C,I as H,t as u,X as g,x as y,w as I,b as h,y as k,D as P,a as W,C as A,E as F,T as x,c as D,_ as R,S as f,R as v,O as E,d as M,G as N,i as q,A as w,j as O,P as U,k as Z,l as j,o as z,p as G,q as J,r as K,z as Q,H as V,s as X,J as Y,K as _,M as $,N as aa,Q as sa,U as oa,V as ta,W as ea,Y as ra,Z as na,a0 as pa,a1 as ia,a2 as la,a3 as ma,a4 as ca,a5 as Ta,a6 as ba,a7 as da,a8 as Sa,a9 as Ba,aa as La,ab as Ca,ac as Ha,ad as ua}from"./index-CiCdFubk.js";import"./iframe-Ddc_axoC.js";import"../sb-preview/runtime.js";import"./index-BdcJ-iJ7.js";import"./index-D-8MO0q_.js";import"./index-DrFu-skq.js";export{p as A,i as ActionBar,l as AddonPanel,m as Badge,c as Bar,T as Blockquote,b as Button,d as ClipboardCode,S as Code,B as DL,L as Div,C as DocumentWrapper,H as EmptyTabContent,u as ErrorFormatter,g as FlexBar,y as Form,I as H1,h as H2,k as H3,P as H4,W as H5,A as H6,F as HR,x as IconButton,D as IconButtonSkeleton,R as Icons,f as Img,v as LI,E as Link,M as ListItem,N as Loader,q as Modal,w as OL,O as P,U as Placeholder,Z as Pre,j as ResetWrapper,z as ScrollArea,G as Separator,J as Spaced,K as Span,Q as StorybookIcon,V as StorybookLogo,X as Symbols,Y as SyntaxHighlighter,_ as TT,$ as TabBar,aa as TabButton,sa as TabWrapper,oa as Table,ta as Tabs,ea as TabsState,ra as TooltipLinkList,na as TooltipMessage,pa as TooltipNote,ia as UL,la as WithTooltip,ma as WithTooltipPure,ca as Zoom,Ta as codeCommon,ba as components,da as createCopyToClipboardFunction,Sa as getStoryHref,Ba as icons,La as interleaveSeparators,Ca as nameSpaceClassNames,Ha as resetComponents,ua as withReset};
@@ -0,0 +1 @@
1
+ import{M,u as a}from"./index-f2MAjm2i.js";import"./index-CiCdFubk.js";import"./iframe-Ddc_axoC.js";import"../sb-preview/runtime.js";import"./index-BdcJ-iJ7.js";import"./index-D-8MO0q_.js";import"./index-DrFu-skq.js";export{M as MDXProvider,a as useMDXComponents};
@@ -0,0 +1,420 @@
1
+ import{w as x,u as y,e as c}from"./index-BSz1w4Gl.js";import"./custom-element-BDGsYgbP.js";import"./http-request-DNq59pnj.js";import"./location-element-hKpcXCdn.js";const g=(l,t)=>{if(l==="text")return t;if(l==="json")try{return JSON.parse(t)}catch{return null}const a=document.createElement("input");return a.setAttribute("type",l),l==="number"?(a.value=t,a.valueAsNumber):l==="date"?t?(a.valueAsDate=new Date(t),a.value):null:(a.value=t,a.value)};let b,S,w;function I(l,t){b.call(localStorage,l,t),window.dispatchEvent(new CustomEvent("local-storage",{detail:{key:l,value:t}}))}function B(l){S.call(localStorage,l),window.dispatchEvent(new CustomEvent("local-storage",{detail:{key:l}}))}function p(){w.call(localStorage),window.dispatchEvent(new CustomEvent("local-storage",{detail:{}}))}function T(){b||(b=localStorage.setItem,localStorage.setItem=I,S=localStorage.removeItem,localStorage.removeItem=B,w=localStorage.clear,localStorage.clear=p)}T();function V(l,t){I(l,t)}class K extends HTMLElement{static observedAttributes=["value","slice","key","type","live"];#e;get value(){return this.#e===null?void 0:this.#e}set value(t){return this.#e=t}async connectedCallback(){const t=i=>this.getAttribute(i),a=()=>{this.#e=g(t("type"),localStorage.getItem(t("key"))),this.dispatchEvent(new Event("change"))};if(this.#e=g(t("type"),localStorage.getItem(t("key"))),this.hasAttribute("value")?V(t("key"),this.#e=t("value")):a(),this.hasAttribute("live")){const i=e=>(e.detail.key===t("key")||!e.detail.key)&&a();window.addEventListener("local-storage",i),T(),this._destroy=()=>window.removeEventListener("local-storage",i)}}disconnectedCallback(){this._destroy?.()}}window.customElements.define("local-storage",K);const r={title:"",slice:"ls-slice",key:"sb-ls-key",value:"",live:"",body:""};function o(l){return new Promise(t=>setTimeout(t,l))}function f(l){const{title:t,slice:a,key:i,value:e,live:n,body:u}={...r,...l};return`
2
+ <fieldset>
3
+ <legend>${t}</legend>
4
+
5
+ <custom-element>
6
+ <template><!-- wrapping into template to prevent images loading within DCE declaration -->
7
+ <local-storage
8
+ key="${i}"
9
+ slice="${a}"
10
+ ${n?`live="${n}"`:""}
11
+ ${e?`value="${e}"`:""}
12
+ ></local-storage>
13
+
14
+ <br/>
15
+ <var>${i}</var>:<code data-testid="slice-value">{ //slice/${a} }</code>
16
+ <br/>
17
+ ${u}
18
+ </template>
19
+ </custom-element>
20
+ </fieldset>
21
+ `}const h={title:"local-storage",render:f};window.localStorageSetItem=V;window.localStorage_clear=p;window.localStorage_removeItem=B;const k={args:{title:"live value",live:"live",body:`
22
+ <input placeholder="value for localStorage" id="textinput"
23
+ slice="${r.slice}"
24
+ value="{ //${r.slice} ?? '${r.value}' }"/>
25
+ <button onclick="localStorageSetItem('${r.key}',textinput.value )">set</button>
26
+ <button onclick="localStorageSetItem('${r.key}','text value' )">text value</button>
27
+ <button onclick="localStorageSetItem('${r.key}','another text')">another text</button>
28
+ <button onclick="localStorage_removeItem('${r.key}' )">set blank</button>
29
+ `},play:async({canvasElement:l})=>{p();const t=x(l);await t.findByText(k.args.title);const a=()=>t.getByTestId("slice-value").textContent;await y.click(await t.findByText("set blank")),await c(localStorage.getItem(r.key)).toEqual(null,"from localStorage"),await c(a()).toEqual(""),await y.click(t.getByText("text value")),await o(10),await c(localStorage.getItem(r.key)).toEqual("text value","from localStorage"),await c(a()).toEqual("text value"),window.textinput.value="textinput.value",await y.click(t.getByText("set")),await o(10),c(a()).toEqual("textinput.value"),await y.click(t.getByText("another text")),await o(10),c(a()).toEqual("another text"),await y.click(t.getByText("set blank")),await o(10),c(a()).toEqual("")}},m={args:{title:"AlwaysOverride",live:"",value:"ABC",body:`
30
+ buttons are changing the localStorage value, but without 'live' attribute slice ^^ from <i>local-storage</i> is not updated<br/>
31
+ <button onclick="localStorageSetItem('${r.key}','text value')">text value</button>
32
+ <button onclick="localStorage_removeItem('${r.key}')">set blank</button>
33
+ `},play:async({canvasElement:l})=>{const t=x(l);await t.findByText(m.args.title);const a=()=>t.getByTestId("slice-value").textContent,i=async e=>await y.click(await t.findByText(e));await o(10),await c(localStorage.getItem(r.key)).toEqual("ABC"),await i("set blank"),await c(localStorage.getItem(r.key)).toEqual(null,"from localStorage"),await o(10),await c(a()).toEqual("ABC"),await i("text value"),await o(10),await c(localStorage.getItem(r.key)).toEqual("text value","from localStorage"),await c(a()).toEqual("ABC"),await i("set blank"),await o(10),await c(a()).toEqual("ABC")}},d={args:{title:"live value with defaults",live:"",value:"ABC",body:`
34
+
35
+ <local-storage key="attr2Key" slice="attr2-key" type="text" live="live" slice-value="@value ?? 'DEF2'"></local-storage>
36
+ <button onclick="localStorage_removeItem('attr2Key')">clear key</button>
37
+ <button onclick="localStorageSetItem('attr2Key','attr2Key value')">update attr2-key value</button>
38
+ //attr2-key: <code data-testid="key2-value">{//attr2-key}</code><br/>
39
+
40
+ <local-storage key="attr3Key" slice="attr3-key" type="text" live="live" slice-value="@value ?? 'DEF3'"></local-storage>
41
+ <button onclick="localStorage_removeItem('attr3Key')">clear attr3-key key</button>
42
+ <button onclick="localStorageSetItem('attr3Key','attr3Key value')">update attr3-key value</button>
43
+ //attr3-key: <code data-testid="key3-value">{//attr3-key}</code><br/>
44
+ <button onclick="localStorage_clear()">clear localStorage</button>
45
+ `},play:async({canvasElement:l})=>{const t=x(l);await t.findByText(d.args.title);const a=i=>t.getByText(i);c(localStorage.getItem(r.key)).toEqual("ABC","from localStorage"),a("clear localStorage").click(),c(t.getByTestId("slice-value").textContent).toEqual("ABC"),c(t.getByTestId("key2-value").textContent).toEqual("DEF2"),c(t.getByTestId("key3-value").textContent).toEqual("DEF3"),a("update attr2-key value").click(),c(localStorage.getItem("attr2Key")).toEqual("attr2Key value","from localStorage"),await o(10),c(t.getByTestId("slice-value").textContent).toEqual("ABC"),c(t.getByTestId("key2-value").textContent).toEqual("attr2Key value"),c(t.getByTestId("key3-value").textContent).toEqual("DEF3"),a("update attr3-key value").click(),c(localStorage.getItem("attr3Key")).toEqual("attr3Key value","from localStorage"),await o(10),c(t.getByTestId("slice-value").textContent).toEqual("ABC"),c(t.getByTestId("key2-value").textContent).toEqual("attr2Key value"),c(t.getByTestId("key3-value").textContent).toEqual("attr3Key value")}},v={args:{title:"local-storage type attribute variations",body:`
46
+
47
+ <local-storage key="textKey" slice="text-key" type="text" live="live"></local-storage>
48
+ <local-storage key="dateKey" slice="date-key" type="date" live="live"></local-storage>
49
+ <local-storage key="timeKey" slice="time-key" type="time" live="live"></local-storage>
50
+ <local-storage key="localDateTimeKey" slice="local-date-time" type="datetime-local" live="live"></local-storage>
51
+ <local-storage key="numberKey" slice="number-key" type="number" live="live"></local-storage>
52
+ <local-storage key="jsonKey" slice="json-key" type="json" live="live"></local-storage>
53
+ <input id="typesinput" placeholder="set value"><button onclick="
54
+ 'textKey,dateKey,timeKey,localDateTimeKey,numberKey,jsonKey'.split(',')
55
+ .map( k=> localStorageSetItem(k, typesinput.value) )
56
+ "> set to all</button><br>
57
+ <hr>
58
+ text-key:
59
+ <button onclick="localStorageSetItem('textKey', 'ABC' )">ABC</button>
60
+ <code data-testid="text-key">{//text-key }</code><br>
61
+ date-key:
62
+ <button onclick="localStorageSetItem('dateKey', '2024-04-20T03:58:42.131Z')">2024-04-21T03:58:42.131Z </button>
63
+ <button onclick="localStorageSetItem('dateKey', new Date(Date.now()).toISOString())">now </button>
64
+ <button onclick="localStorageSetItem('dateKey', 'ABC' )">date ABC - invalid </button>
65
+ <code data-testid="date-key">{//date-key }</code><br>
66
+ time-key:
67
+ <button onclick="localStorageSetItem('timeKey', '13:30')">13:30 </button>
68
+ <code data-testid="time-key">{//time-key }</code><br>
69
+ local-date-time:
70
+ <button onclick="localStorageSetItem('localDateTimeKey', '1977-04-01T14:00:30')">1977-04-01T14:00:30 - local </button>
71
+ <code data-testid="local-date-time">{//local-date-time}</code><br>
72
+ number-key:
73
+ <button onclick="localStorageSetItem('numberKey', '2024' )">2024 - number </button>
74
+ <button onclick="localStorageSetItem('numberKey', '24' )">24 - number </button>
75
+ <button onclick="localStorageSetItem('numberKey', '1.23456e+5' )">1.23456e+5 </button>
76
+ <button onclick="localStorageSetItem('numberKey', '0001' )">0001 </button>
77
+ <button onclick="localStorageSetItem('numberKey', '000' )">000 </button>
78
+ <button onclick="localStorageSetItem('numberKey', '0' )">0 </button>
79
+ <button onclick="localStorageSetItem('numberKey', 'ABC' )">ABC - invalid, NaN </button>
80
+ <code data-testid="number-key">{//number-key }</code> <br>
81
+ <fieldset>
82
+ <legend>json-key: </legend>
83
+
84
+ <button onclick="localStorageSetItem('jsonKey', JSON.stringify('ABC'))">'ABC' - string </button>
85
+ <button onclick="localStorageSetItem('jsonKey', JSON.stringify(12.345))">12.345 - number </button>
86
+ <button onclick="localStorageSetItem('jsonKey', JSON.stringify(window.JsonSample) )">a:1,b:'B' -json </button>
87
+ <button onclick="localStorageSetItem('jsonKey', 'ABC' )">ABC - invalid </button><br>
88
+ json-key:<code data-testid="json-key"><xsl:apply-templates select="//json-key/value/@*|//json-key/text()|//json-key/value/text()" mode="json"></xsl:apply-templates></code>
89
+ </fieldset>
90
+ <xsl:template mode="json" match="*|@*">
91
+ <div>{name()} : {.}</div>
92
+ </xsl:template>
93
+ `},play:async({canvasElement:l})=>{window.JsonSample={a:1,b:"B"};const t=x(l);await t.findByText(v.args.title);const a=s=>t.getByText(s),i=s=>t.getByTestId(s).textContent,e=(s,E)=>{c(i(s).trim()).toEqual(E,s)};p(),await o(10),e("text-key",""),e("date-key",""),e("time-key",""),e("local-date-time",""),e("number-key","NaN"),e("json-key","");const n=l.querySelector("input");n.value="ABC",a("set to all").click(),await o(10),e("text-key","ABC"),e("date-key",""),e("time-key",""),e("local-date-time",""),e("number-key","NaN"),e("json-key",""),n.value="22",a("set to all").click(),await o(10),e("text-key","22"),e("date-key",""),e("time-key",""),e("local-date-time",""),e("number-key","22"),e("json-key","22"),n.value="2024",a("set to all").click(),await o(10),e("text-key","2024"),e("date-key","2024-01-01"),e("time-key",""),e("local-date-time",""),e("number-key","2024"),e("json-key","2024"),n.value="2024-04-20T03:58:42.131Z",a("set to all").click(),await o(10),e("text-key","2024-04-20T03:58:42.131Z"),e("date-key","2024-04-20"),e("time-key",""),e("local-date-time",""),e("number-key","NaN"),e("json-key","");const u=new Date(Date.now()).toISOString();n.value=u,a("set to all").click(),await o(10),e("text-key",u),e("date-key",u.substring(0,10)),e("time-key",""),e("local-date-time",""),e("number-key","NaN"),e("json-key",""),n.value="23:25",a("set to all").click(),await o(10),e("text-key","23:25"),e("date-key",""),e("time-key","23:25"),e("local-date-time",""),e("number-key","NaN"),e("json-key",""),n.value="1977-04-01T14:00:30",a("set to all").click(),await o(10),e("text-key","1977-04-01T14:00:30"),e("date-key","1977-04-01"),e("time-key",""),e("local-date-time","1977-04-01T14:00:30"),e("number-key","NaN"),e("json-key",""),n.value="1.23456e+5",a("set to all").click(),await o(10),e("text-key","1.23456e+5"),e("date-key",""),e("time-key",""),e("local-date-time",""),e("number-key","123456"),e("json-key","123456"),n.value="0001",a("set to all").click(),await o(10),e("text-key","0001"),e("date-key","0001-01-01"),e("time-key",""),e("local-date-time",""),e("number-key","1"),e("json-key",""),n.value="001",a("set to all").click(),await o(10),e("text-key","001"),e("date-key","2001-01-01"),e("time-key",""),e("local-date-time",""),e("number-key","1"),e("json-key",""),n.value="000",a("set to all").click(),await o(10),e("text-key","000"),e("date-key","2000-01-01"),e("time-key",""),e("local-date-time",""),e("number-key","0"),e("json-key",""),n.value="0",a("set to all").click(),await o(10),e("text-key","0"),e("date-key","2000-01-01"),e("time-key",""),e("local-date-time",""),e("number-key","0"),e("json-key","0"),n.value='"abc"',a("set to all").click(),await o(10),e("text-key",'"abc"'),e("date-key",""),e("time-key",""),e("local-date-time",""),e("number-key","NaN"),e("json-key","abc"),n.value="12.345",a("set to all").click(),await o(10),e("text-key","12.345"),e("date-key",""),e("time-key",""),e("local-date-time",""),e("number-key","12.345"),e("json-key","12.345"),n.value='{"a":1,"b":"B"}',a("set to all").click(),await o(10),e("text-key",'{"a":1,"b":"B"}'),e("date-key",""),e("time-key",""),e("local-date-time",""),e("number-key","NaN"),e("json-key","a : 1b : B")}};k.parameters={...k.parameters,docs:{...k.parameters?.docs,source:{originalSource:`{
94
+ args: {
95
+ title: 'live value',
96
+ live: 'live',
97
+ body: \`
98
+ <input placeholder="value for localStorage" id="textinput"
99
+ slice="\${defs.slice}"
100
+ value="{ //\${defs.slice} ?? '\${defs.value}' }"/>
101
+ <button onclick="localStorageSetItem('\${defs.key}',textinput.value )">set</button>
102
+ <button onclick="localStorageSetItem('\${defs.key}','text value' )">text value</button>
103
+ <button onclick="localStorageSetItem('\${defs.key}','another text')">another text</button>
104
+ <button onclick="localStorage_removeItem('\${defs.key}' )">set blank</button>
105
+ \`
106
+ },
107
+ play: async ({
108
+ canvasElement
109
+ }) => {
110
+ localStorage_clear();
111
+ const canvas = within(canvasElement);
112
+ await canvas.findByText(Demo.args!.title as string);
113
+ const val = () => canvas.getByTestId('slice-value').textContent;
114
+ await userEvent.click(await canvas.findByText('set blank'));
115
+ await expect(localStorage.getItem(defs.key)).toEqual(null, 'from localStorage');
116
+ await expect(val()).toEqual('');
117
+ await userEvent.click(canvas.getByText('text value'));
118
+ await sleep(10);
119
+ await expect(localStorage.getItem(defs.key)).toEqual('text value', 'from localStorage');
120
+ await expect(val()).toEqual('text value');
121
+ window['textinput'].value = 'textinput.value';
122
+ await userEvent.click(canvas.getByText('set'));
123
+ await sleep(10);
124
+ expect(val()).toEqual('textinput.value');
125
+ await userEvent.click(canvas.getByText('another text'));
126
+ await sleep(10);
127
+ expect(val()).toEqual('another text');
128
+ await userEvent.click(canvas.getByText('set blank'));
129
+ await sleep(10);
130
+ expect(val()).toEqual('');
131
+ }
132
+ }`,...k.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
133
+ args: {
134
+ title: 'AlwaysOverride',
135
+ live: '',
136
+ value: 'ABC',
137
+ body: \`
138
+ buttons are changing the localStorage value, but without 'live' attribute slice ^^ from <i>local-storage</i> is not updated<br/>
139
+ <button onclick="localStorageSetItem('\${defs.key}','text value')">text value</button>
140
+ <button onclick="localStorage_removeItem('\${defs.key}')">set blank</button>
141
+ \`
142
+ },
143
+ play: async ({
144
+ canvasElement
145
+ }) => {
146
+ const canvas = within(canvasElement);
147
+ await canvas.findByText(AlwaysOverride.args!.title as string);
148
+ const val = () => canvas.getByTestId('slice-value').textContent;
149
+ const click = async text => await userEvent.click(await canvas.findByText(text));
150
+ await sleep(10);
151
+ await expect(localStorage.getItem(defs.key)).toEqual('ABC');
152
+ await click('set blank');
153
+ await expect(localStorage.getItem(defs.key)).toEqual(null, 'from localStorage');
154
+ await sleep(10);
155
+ await expect(val()).toEqual('ABC');
156
+ await click('text value');
157
+ await sleep(10);
158
+ await expect(localStorage.getItem(defs.key)).toEqual('text value', 'from localStorage');
159
+ await expect(val()).toEqual('ABC');
160
+ await click('set blank');
161
+ await sleep(10);
162
+ await expect(val()).toEqual('ABC');
163
+ }
164
+ }`,...m.parameters?.docs?.source}}};d.parameters={...d.parameters,docs:{...d.parameters?.docs,source:{originalSource:`{
165
+ args: {
166
+ title: 'live value with defaults',
167
+ live: '',
168
+ value: 'ABC',
169
+ body: \`
170
+
171
+ <local-storage key="attr2Key" slice="attr2-key" type="text" live="live" slice-value="@value ?? 'DEF2'"></local-storage>
172
+ <button onclick="localStorage_removeItem('attr2Key')">clear key</button>
173
+ <button onclick="localStorageSetItem('attr2Key','attr2Key value')">update attr2-key value</button>
174
+ //attr2-key: <code data-testid="key2-value">{//attr2-key}</code><br/>
175
+
176
+ <local-storage key="attr3Key" slice="attr3-key" type="text" live="live" slice-value="@value ?? 'DEF3'"></local-storage>
177
+ <button onclick="localStorage_removeItem('attr3Key')">clear attr3-key key</button>
178
+ <button onclick="localStorageSetItem('attr3Key','attr3Key value')">update attr3-key value</button>
179
+ //attr3-key: <code data-testid="key3-value">{//attr3-key}</code><br/>
180
+ <button onclick="localStorage_clear()">clear localStorage</button>
181
+ \`
182
+ },
183
+ play: async ({
184
+ canvasElement
185
+ }) => {
186
+ const canvas = within(canvasElement);
187
+ await canvas.findByText(FromStorageWithDefault.args!.title as string);
188
+ const byText = txt => canvas.getByText(txt);
189
+ expect(localStorage.getItem(defs.key)).toEqual('ABC', 'from localStorage');
190
+ byText('clear localStorage').click();
191
+ expect(canvas.getByTestId('slice-value').textContent).toEqual('ABC');
192
+ expect(canvas.getByTestId('key2-value').textContent).toEqual('DEF2');
193
+ expect(canvas.getByTestId('key3-value').textContent).toEqual('DEF3');
194
+ byText('update attr2-key value').click();
195
+ expect(localStorage.getItem('attr2Key')).toEqual('attr2Key value', 'from localStorage');
196
+ await sleep(10);
197
+ expect(canvas.getByTestId('slice-value').textContent).toEqual('ABC');
198
+ expect(canvas.getByTestId('key2-value').textContent).toEqual('attr2Key value');
199
+ expect(canvas.getByTestId('key3-value').textContent).toEqual('DEF3');
200
+ byText('update attr3-key value').click();
201
+ expect(localStorage.getItem('attr3Key')).toEqual('attr3Key value', 'from localStorage');
202
+ await sleep(10);
203
+ expect(canvas.getByTestId('slice-value').textContent).toEqual('ABC');
204
+ expect(canvas.getByTestId('key2-value').textContent).toEqual('attr2Key value');
205
+ expect(canvas.getByTestId('key3-value').textContent).toEqual('attr3Key value');
206
+ }
207
+ }`,...d.parameters?.docs?.source}}};v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
208
+ args: {
209
+ title: 'local-storage type attribute variations',
210
+ body: \`
211
+
212
+ <local-storage key="textKey" slice="text-key" type="text" live="live"></local-storage>
213
+ <local-storage key="dateKey" slice="date-key" type="date" live="live"></local-storage>
214
+ <local-storage key="timeKey" slice="time-key" type="time" live="live"></local-storage>
215
+ <local-storage key="localDateTimeKey" slice="local-date-time" type="datetime-local" live="live"></local-storage>
216
+ <local-storage key="numberKey" slice="number-key" type="number" live="live"></local-storage>
217
+ <local-storage key="jsonKey" slice="json-key" type="json" live="live"></local-storage>
218
+ <input id="typesinput" placeholder="set value"><button onclick="
219
+ 'textKey,dateKey,timeKey,localDateTimeKey,numberKey,jsonKey'.split(',')
220
+ .map( k=> localStorageSetItem(k, typesinput.value) )
221
+ "> set to all</button><br>
222
+ <hr>
223
+ text-key:
224
+ <button onclick="localStorageSetItem('textKey', 'ABC' )">ABC</button>
225
+ <code data-testid="text-key">{//text-key }</code><br>
226
+ date-key:
227
+ <button onclick="localStorageSetItem('dateKey', '2024-04-20T03:58:42.131Z')">2024-04-21T03:58:42.131Z </button>
228
+ <button onclick="localStorageSetItem('dateKey', new Date(Date.now()).toISOString())">now </button>
229
+ <button onclick="localStorageSetItem('dateKey', 'ABC' )">date ABC - invalid </button>
230
+ <code data-testid="date-key">{//date-key }</code><br>
231
+ time-key:
232
+ <button onclick="localStorageSetItem('timeKey', '13:30')">13:30 </button>
233
+ <code data-testid="time-key">{//time-key }</code><br>
234
+ local-date-time:
235
+ <button onclick="localStorageSetItem('localDateTimeKey', '1977-04-01T14:00:30')">1977-04-01T14:00:30 - local </button>
236
+ <code data-testid="local-date-time">{//local-date-time}</code><br>
237
+ number-key:
238
+ <button onclick="localStorageSetItem('numberKey', '2024' )">2024 - number </button>
239
+ <button onclick="localStorageSetItem('numberKey', '24' )">24 - number </button>
240
+ <button onclick="localStorageSetItem('numberKey', '1.23456e+5' )">1.23456e+5 </button>
241
+ <button onclick="localStorageSetItem('numberKey', '0001' )">0001 </button>
242
+ <button onclick="localStorageSetItem('numberKey', '000' )">000 </button>
243
+ <button onclick="localStorageSetItem('numberKey', '0' )">0 </button>
244
+ <button onclick="localStorageSetItem('numberKey', 'ABC' )">ABC - invalid, NaN </button>
245
+ <code data-testid="number-key">{//number-key }</code> <br>
246
+ <fieldset>
247
+ <legend>json-key: </legend>
248
+
249
+ <button onclick="localStorageSetItem('jsonKey', JSON.stringify('ABC'))">'ABC' - string </button>
250
+ <button onclick="localStorageSetItem('jsonKey', JSON.stringify(12.345))">12.345 - number </button>
251
+ <button onclick="localStorageSetItem('jsonKey', JSON.stringify(window.JsonSample) )">a:1,b:'B' -json </button>
252
+ <button onclick="localStorageSetItem('jsonKey', 'ABC' )">ABC - invalid </button><br>
253
+ json-key:<code data-testid="json-key"><xsl:apply-templates select="//json-key/value/@*|//json-key/text()|//json-key/value/text()" mode="json"></xsl:apply-templates></code>
254
+ </fieldset>
255
+ <xsl:template mode="json" match="*|@*">
256
+ <div>{name()} : {.}</div>
257
+ </xsl:template>
258
+ \`
259
+ },
260
+ play: async ({
261
+ canvasElement
262
+ }) => {
263
+ window['JsonSample'] = {
264
+ a: 1,
265
+ b: 'B'
266
+ };
267
+ const canvas = within(canvasElement);
268
+ await canvas.findByText(TypeAttribute.args!.title as string);
269
+ const byText = txt => canvas.getByText(txt),
270
+ val = testId => canvas.getByTestId(testId).textContent,
271
+ expectVal = (key, value) => {
272
+ expect(val(key).trim()).toEqual(value, key);
273
+ };
274
+ localStorage_clear(); // cleanup before test
275
+ await sleep(10);
276
+ expectVal('text-key', '');
277
+ expectVal('date-key', '');
278
+ expectVal('time-key', '');
279
+ expectVal('local-date-time', '');
280
+ expectVal('number-key', 'NaN');
281
+ expectVal('json-key', '');
282
+ const input = canvasElement.querySelector('input');
283
+ input.value = 'ABC';
284
+ byText('set to all').click();
285
+ await sleep(10);
286
+ expectVal('text-key', 'ABC');
287
+ expectVal('date-key', '');
288
+ expectVal('time-key', '');
289
+ expectVal('local-date-time', '');
290
+ expectVal('number-key', 'NaN');
291
+ expectVal('json-key', '');
292
+ input.value = '22';
293
+ byText('set to all').click();
294
+ await sleep(10);
295
+ expectVal('text-key', '22');
296
+ expectVal('date-key', '');
297
+ expectVal('time-key', '');
298
+ expectVal('local-date-time', '');
299
+ expectVal('number-key', '22');
300
+ expectVal('json-key', '22');
301
+ input.value = '2024';
302
+ byText('set to all').click();
303
+ await sleep(10);
304
+ expectVal('text-key', '2024');
305
+ expectVal('date-key', '2024-01-01');
306
+ expectVal('time-key', '');
307
+ expectVal('local-date-time', '');
308
+ expectVal('number-key', '2024');
309
+ expectVal('json-key', '2024');
310
+ input.value = '2024-04-20T03:58:42.131Z';
311
+ byText('set to all').click();
312
+ await sleep(10);
313
+ expectVal('text-key', '2024-04-20T03:58:42.131Z');
314
+ expectVal('date-key', '2024-04-20');
315
+ expectVal('time-key', '');
316
+ expectVal('local-date-time', '');
317
+ expectVal('number-key', 'NaN');
318
+ expectVal('json-key', '');
319
+ const nowStr = new Date(Date.now()).toISOString();
320
+ input.value = nowStr;
321
+ byText('set to all').click();
322
+ await sleep(10);
323
+ expectVal('text-key', nowStr);
324
+ expectVal('date-key', nowStr.substring(0, 10));
325
+ expectVal('time-key', '');
326
+ expectVal('local-date-time', '');
327
+ expectVal('number-key', 'NaN');
328
+ expectVal('json-key', '');
329
+ input.value = '23:25';
330
+ byText('set to all').click();
331
+ await sleep(10);
332
+ expectVal('text-key', '23:25');
333
+ expectVal('date-key', '');
334
+ expectVal('time-key', '23:25');
335
+ expectVal('local-date-time', '');
336
+ expectVal('number-key', 'NaN');
337
+ expectVal('json-key', '');
338
+ input.value = '1977-04-01T14:00:30';
339
+ byText('set to all').click();
340
+ await sleep(10);
341
+ expectVal('text-key', '1977-04-01T14:00:30');
342
+ expectVal('date-key', '1977-04-01');
343
+ expectVal('time-key', '');
344
+ expectVal('local-date-time', '1977-04-01T14:00:30');
345
+ expectVal('number-key', 'NaN');
346
+ expectVal('json-key', '');
347
+ input.value = '1.23456e+5';
348
+ byText('set to all').click();
349
+ await sleep(10);
350
+ expectVal('text-key', '1.23456e+5');
351
+ expectVal('date-key', '');
352
+ expectVal('time-key', '');
353
+ expectVal('local-date-time', '');
354
+ expectVal('number-key', '123456');
355
+ expectVal('json-key', '123456');
356
+ input.value = '0001'; // as YYYY for year
357
+ byText('set to all').click();
358
+ await sleep(10);
359
+ expectVal('text-key', '0001');
360
+ expectVal('date-key', '0001-01-01');
361
+ expectVal('time-key', '');
362
+ expectVal('local-date-time', '');
363
+ expectVal('number-key', '1');
364
+ expectVal('json-key', '');
365
+ input.value = '001'; // as 2001 year
366
+ byText('set to all').click();
367
+ await sleep(10);
368
+ expectVal('text-key', '001');
369
+ expectVal('date-key', '2001-01-01');
370
+ expectVal('time-key', '');
371
+ expectVal('local-date-time', '');
372
+ expectVal('number-key', '1');
373
+ expectVal('json-key', '');
374
+ input.value = '000'; // as 2001 year
375
+ byText('set to all').click();
376
+ await sleep(10);
377
+ expectVal('text-key', '000');
378
+ expectVal('date-key', '2000-01-01');
379
+ expectVal('time-key', '');
380
+ expectVal('local-date-time', '');
381
+ expectVal('number-key', '0');
382
+ expectVal('json-key', '');
383
+ input.value = '0'; // as 2000 year
384
+ byText('set to all').click();
385
+ await sleep(10);
386
+ expectVal('text-key', '0');
387
+ expectVal('date-key', '2000-01-01');
388
+ expectVal('time-key', '');
389
+ expectVal('local-date-time', '');
390
+ expectVal('number-key', '0');
391
+ expectVal('json-key', '0');
392
+ input.value = '"abc"';
393
+ byText('set to all').click();
394
+ await sleep(10);
395
+ expectVal('text-key', '"abc"');
396
+ expectVal('date-key', '');
397
+ expectVal('time-key', '');
398
+ expectVal('local-date-time', '');
399
+ expectVal('number-key', 'NaN');
400
+ expectVal('json-key', 'abc');
401
+ input.value = '12.345';
402
+ byText('set to all').click();
403
+ await sleep(10);
404
+ expectVal('text-key', '12.345');
405
+ expectVal('date-key', '');
406
+ expectVal('time-key', '');
407
+ expectVal('local-date-time', '');
408
+ expectVal('number-key', '12.345');
409
+ expectVal('json-key', '12.345');
410
+ input.value = '{"a":1,"b":"B"}';
411
+ byText('set to all').click();
412
+ await sleep(10);
413
+ expectVal('text-key', '{"a":1,"b":"B"}');
414
+ expectVal('date-key', '');
415
+ expectVal('time-key', '');
416
+ expectVal('local-date-time', '');
417
+ expectVal('number-key', 'NaN');
418
+ expectVal('json-key', 'a : 1b : B');
419
+ }
420
+ }`,...v.parameters?.docs?.source}}};const N=["Demo","AlwaysOverride","FromStorageWithDefault","TypeAttribute"];export{m as AlwaysOverride,k as Demo,d as FromStorageWithDefault,v as TypeAttribute,N as __namedExportsOrder,h as default};
@@ -1,4 +1,4 @@
1
- import{w as m,e}from"./custom-element-wn23PUwN.js";import"./location-element-hKpcXCdn.js";import"./index-C8k3Z-3Y.js";const u={title:"",slice:"url-slice",href:"",live:"",body:""};function h(c){return new Promise(o=>setTimeout(o,c))}function x(c){const{title:o,slice:t,href:l,live:r,body:i}={...u,...c};return`
1
+ import{w as m,e}from"./index-BSz1w4Gl.js";import"./custom-element-BDGsYgbP.js";import"./location-element-hKpcXCdn.js";const u={title:"",slice:"url-slice",href:"",live:"",body:""};function h(c){return new Promise(o=>setTimeout(o,c))}function x(c){const{title:o,slice:t,href:l,live:r,body:i}={...u,...c};return`
2
2
  <fieldset>
3
3
  <legend>${o}</legend>
4
4
 
@@ -53,7 +53,7 @@ import{w as m,e}from"./custom-element-wn23PUwN.js";import"./location-element-hKp
53
53
  canvasElement
54
54
  }) => {
55
55
  const canvas = within(canvasElement);
56
- await canvas.findByText((Demo.args!.title as string));
56
+ await canvas.findByText(Demo.args!.title as string);
57
57
  const val = prop => canvas.getByTestId('param-' + prop).textContent.trim(),
58
58
  byText = txt => canvas.getByText(txt),
59
59
  expectMatch = (l, prop) => expect(val(prop)).toEqual(l[prop], prop),
@@ -84,7 +84,7 @@ import{w as m,e}from"./custom-element-wn23PUwN.js";import"./location-element-hKp
84
84
  canvasElement
85
85
  }) => {
86
86
  const canvas = within(canvasElement);
87
- await canvas.findByText((SrcAttribute.args!.title as string));
87
+ await canvas.findByText(SrcAttribute.args!.title as string);
88
88
  const val = prop => canvas.getByTestId('param-' + prop).textContent.trim(),
89
89
  byText = txt => canvas.getByText(txt),
90
90
  expectMatch = (l, prop) => expect(val(prop)).toEqual(l[prop], prop),
@@ -1,4 +1,4 @@
1
- import{w as s,e as a}from"./custom-element-wn23PUwN.js";import"./index-C8k3Z-3Y.js";const c=(t,e)=>t.getAttribute(e);class b extends HTMLElement{static observedAttributes=["slice","src"];sliceInit(){let e=c(this,"src");try{const l=e.charAt(0)==="."?new URL(e,this.closest("[base]")?.getAttribute("base")).href:import.meta.resolve(e);this.setAttribute("value",this.value=l)}catch(l){this.setAttribute("error",l.message),this.setAttribute("value",e),console.error(l.message??l,e)}this.dispatchEvent(new Event("change"))}attributeChangedCallback(e,l,u){e==="src"&&this.sliceInit()}}window.customElements.define("module-url",b);function d(t){const{title:e,body:l}=t;return`
1
+ import{w as s,e as a}from"./index-BSz1w4Gl.js";import"./custom-element-BDGsYgbP.js";const c=(t,e)=>t.getAttribute(e);class b extends HTMLElement{static observedAttributes=["slice","src"];sliceInit(){let e=c(this,"src");try{const l=e.charAt(0)==="."?new URL(e,this.closest("[base]")?.getAttribute("base")||location.href).href:import.meta.resolve(e);this.setAttribute("value",this.value=l)}catch(l){this.setAttribute("error",l.message),this.setAttribute("value",e),console.error(l.message??l,e)}this.dispatchEvent(new Event("change"))}attributeChangedCallback(e,l,u){e==="src"&&this.sliceInit()}}window.customElements.define("module-url",b);function d(t){const{title:e,body:l}=t;return`
2
2
  <fieldset>
3
3
  <legend>${e}</legend>
4
4
  ${l}
@@ -84,7 +84,7 @@ import{w as s,e as a}from"./custom-element-wn23PUwN.js";import"./index-C8k3Z-3Y.
84
84
  canvasElement
85
85
  }) => {
86
86
  const canvas = within(canvasElement);
87
- await canvas.findByText((RelativeToPagePath.args!.title as string));
87
+ await canvas.findByText(RelativeToPagePath.args!.title as string);
88
88
  await expect(await canvas.findByText('🖖')).toBeInTheDocument();
89
89
  await expect(await canvas.findByText('embed-1.html')).toBeInTheDocument();
90
90
  }
@@ -113,7 +113,7 @@ import{w as s,e as a}from"./custom-element-wn23PUwN.js";import"./index-C8k3Z-3Y.
113
113
  }) => {
114
114
  const p = import.meta.resolve('embed-lib');
115
115
  const canvas = within(canvasElement);
116
- await canvas.findByText((ModuleBySymbolicName.args!.title as string));
116
+ await canvas.findByText(ModuleBySymbolicName.args!.title as string);
117
117
  await expect(await canvas.findByText('check the link:')).toBeInTheDocument();
118
118
  await expect(await canvas.findByText('👋 from embed-lib-component')).toBeInTheDocument();
119
119
  }
@@ -141,7 +141,7 @@ import{w as s,e as a}from"./custom-element-wn23PUwN.js";import"./index-C8k3Z-3Y.
141
141
  canvasElement
142
142
  }) => {
143
143
  const canvas = within(canvasElement);
144
- await canvas.findByText((MissingImportmapEntry.args!.title as string));
144
+ await canvas.findByText(MissingImportmapEntry.args!.title as string);
145
145
  await expect(await canvas.findByText('error:')).toBeInTheDocument();
146
146
  await expect(await canvas.findByText('failed to load')).toBeInTheDocument();
147
147
  }
@@ -170,7 +170,7 @@ import{w as s,e as a}from"./custom-element-wn23PUwN.js";import"./index-C8k3Z-3Y.
170
170
  canvasElement
171
171
  }) => {
172
172
  const canvas = within(canvasElement);
173
- await canvas.findByText((ModuleByName.args!.title as string));
173
+ await canvas.findByText(ModuleByName.args!.title as string);
174
174
  await expect(await canvas.findByText('👌 from embed-relative-hash invoking')).toBeInTheDocument();
175
175
  await expect(await canvas.findByText('lib-root/embed-lib.html#embed-relative-hash')).toBeInTheDocument();
176
176
  await expect(await canvas.findByText('#embed-lib-component')).toBeInTheDocument();
@@ -198,7 +198,7 @@ import{w as s,e as a}from"./custom-element-wn23PUwN.js";import"./index-C8k3Z-3Y.
198
198
  canvasElement
199
199
  }) => {
200
200
  const canvas = within(canvasElement);
201
- await canvas.findByText((HashWithinLib.args!.title as string));
201
+ await canvas.findByText(HashWithinLib.args!.title as string);
202
202
  await expect(await canvas.findByText('lib-root/embed-lib.html#embed-relative-file')).toBeInTheDocument();
203
203
  await expect(await canvas.findByText('👍 from embed-relative-file invoking')).toBeInTheDocument();
204
204
  await expect(await canvas.findByText('../embed-1.html')).toBeInTheDocument();
@@ -1 +1 @@
1
- import{i as r}from"./index-C8k3Z-3Y.js";var{step:a}=r({step:(p,t,e)=>t(e)},{intercept:!0}),i={throwPlayFunctionExceptions:!1};export{i as parameters,a as runStep};
1
+ import{i as r}from"./index-BSz1w4Gl.js";var{step:a}=r({step:(p,t,e)=>t(e)},{intercept:!0}),i={throwPlayFunctionExceptions:!1};export{i as parameters,a as runStep};