@epa-wg/custom-element-dist 0.0.21 → 0.0.23

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 (174) hide show
  1. package/.idea/.gitignore +8 -0
  2. package/README.md +4 -4
  3. package/coverage/coverage-final.json +13 -11
  4. package/coverage/index.html +30 -30
  5. package/coverage/src/custom-element/coverage.svg +1 -1
  6. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  7. package/coverage/src/custom-element/custom-element.js.html +603 -420
  8. package/coverage/src/custom-element/http-request.js.html +10 -10
  9. package/coverage/src/custom-element/index.html +18 -18
  10. package/coverage/src/custom-element/local-storage.js.html +2 -2
  11. package/coverage/src/custom-element/location-element.js.html +1 -1
  12. package/coverage/src/index.html +1 -1
  13. package/coverage/src/mocks/handlers.ts.html +1 -1
  14. package/coverage/src/mocks/index.html +1 -1
  15. package/coverage/src/stories/{css.stories.ts → attributes.test.stories.ts}/coverage.svg +1 -1
  16. package/coverage/src/stories/{attributes.stories.ts.html → attributes.test.stories.ts.html} +113 -83
  17. package/coverage/src/stories/coverage.svg +1 -1
  18. package/coverage/src/stories/css.test.stories.ts/coverage.svg +10 -0
  19. package/coverage/src/stories/{css.stories.ts.html → css.test.stories.ts.html} +122 -65
  20. package/coverage/src/stories/dom-merge.test.stories.ts/coverage.svg +10 -0
  21. package/coverage/src/stories/{dom-merge.stories.ts.html → dom-merge.test.stories.ts.html} +118 -70
  22. package/coverage/src/stories/external-template.test.stories.ts/coverage.svg +10 -0
  23. package/coverage/src/stories/{external-template.stories.ts.html → external-template.test.stories.ts.html} +180 -150
  24. package/coverage/src/stories/form.test.stories.ts/coverage.svg +10 -0
  25. package/coverage/src/stories/form.test.stories.ts.html +655 -0
  26. package/coverage/src/stories/http-request.stories.ts.html +7 -7
  27. package/coverage/src/stories/index.html +118 -88
  28. package/coverage/src/stories/{dom-merge.stories.ts → local-storage.test.stories.ts}/coverage.svg +1 -1
  29. package/coverage/src/stories/{local-storage.stories.ts.html → local-storage.test.stories.ts.html} +475 -439
  30. package/coverage/src/stories/{external-template.stories.ts → location-element.test.stories.ts}/coverage.svg +1 -1
  31. package/coverage/src/stories/{location-element.stories.ts.html → location-element.test.stories.ts.html} +134 -98
  32. package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +10 -0
  33. package/coverage/src/stories/slice-events.test.stories.ts.html +685 -0
  34. package/coverage/src/stories/slots.test.stories.ts/coverage.svg +10 -0
  35. package/coverage/src/stories/slots.test.stories.ts.html +736 -0
  36. package/coverage/src/stories/{renderPlay.ts.html → testStoryBook.ts.html} +44 -26
  37. package/coverage/src/sum.ts.html +1 -1
  38. package/dist/custom-element-BISbI4SU.js +463 -0
  39. package/dist/custom-element-N-sWiqGK.cjs +53 -0
  40. package/dist/custom-element-bundle.cjs +1 -1
  41. package/dist/custom-element-bundle.js +2 -2
  42. package/dist/mockServiceWorker.js +1 -1
  43. package/package.json +4 -4
  44. package/public/mockServiceWorker.js +1 -1
  45. package/src/custom-element/custom-element.d.ts +4 -0
  46. package/src/custom-element/custom-element.js +103 -42
  47. package/src/custom-element/demo/a.html +38 -41
  48. package/src/custom-element/demo/b.html +13 -0
  49. package/src/custom-element/demo/data-slices.html +32 -0
  50. package/src/custom-element/demo/form.html +240 -0
  51. package/src/custom-element/demo/s.xml +11 -14
  52. package/src/custom-element/demo/s.xslt +22 -38
  53. package/src/custom-element/demo/s1.xslt +60 -0
  54. package/src/custom-element/ide/customData-dce.json +14 -1
  55. package/src/custom-element/ide/web-types-dce.json +6 -1
  56. package/src/custom-element/ide/web-types-xsl.json +1 -1
  57. package/src/custom-element/index.html +1 -0
  58. package/src/custom-element.test.ts +24 -8
  59. package/src/stories/{attributes.stories.ts → attributes.test.stories.ts} +19 -9
  60. package/src/stories/{css.stories.ts → css.test.stories.ts} +28 -9
  61. package/src/stories/{dom-merge.stories.ts → dom-merge.test.stories.ts} +19 -3
  62. package/src/stories/{external-template.stories.ts → external-template.test.stories.ts} +13 -3
  63. package/src/stories/form.test.stories.ts +190 -0
  64. package/src/stories/http-request.stories.ts +6 -6
  65. package/src/stories/http-request.test.ts +0 -9
  66. package/src/stories/{local-storage.stories.ts → local-storage.test.stories.ts} +24 -12
  67. package/src/stories/{location-element.stories.ts → location-element.test.stories.ts} +21 -9
  68. package/src/stories/{slice-events.stories.ts → slice-events.test.stories.ts} +88 -5
  69. package/src/stories/slots.test.stories.ts +217 -0
  70. package/src/stories/testStoryBook.ts +28 -0
  71. package/storybook-static/assets/{Color-RQJUDNI5-C4yZhNbM.js → Color-PRSJMWNM-BD_Ds9NW.js} +1 -1
  72. package/storybook-static/assets/{Configure-C7d36rng.js → Configure-70I_VApa.js} +1 -1
  73. package/storybook-static/assets/DocsRenderer-K4EAMTCU-9dn0-HCP.js +2 -0
  74. package/storybook-static/assets/WithTooltip-KJL26V4Q-C6g5GOU9.js +1 -0
  75. package/storybook-static/assets/{attributes.stories-ZB0RTY1d.js → attributes.test.stories-BEOraI4E.js} +22 -21
  76. package/storybook-static/assets/css.test.stories-D9WaxrEv.js +96 -0
  77. package/storybook-static/assets/custom-element-BV8-hRQS.js +219 -0
  78. package/storybook-static/assets/{dom-merge.stories-CgHZUABU.js → dom-merge.test.stories-BhbNeum_.js} +5 -6
  79. package/storybook-static/assets/{entry-preview-CQqNFx4W.js → entry-preview-DrgzXgwT.js} +1 -1
  80. package/storybook-static/assets/{entry-preview-docs-CWgqLfd3.js → entry-preview-docs-Bxv0qQWs.js} +1 -1
  81. package/storybook-static/assets/{external-template.stories-DtSLMxvg.js → external-template.test.stories-Bpr_wxBo.js} +23 -24
  82. package/storybook-static/assets/form.test.stories-3tURbEdv.js +250 -0
  83. package/storybook-static/assets/{formatter-B5HCVTEV-tKeEfJA9.js → formatter-2WMMO6ZP-6IvBq34u.js} +5 -5
  84. package/storybook-static/assets/http-request.stories-8K_qSs8C.js +300 -0
  85. package/storybook-static/assets/iframe-zdt9kuj6.js +2 -0
  86. package/storybook-static/assets/index-B3oZkK3F.js +1 -0
  87. package/storybook-static/assets/index-C30JwJMK.js +548 -0
  88. package/storybook-static/assets/index-CVRyq5ci.js +27 -0
  89. package/storybook-static/assets/index-DXimoRZY.js +1 -0
  90. package/storybook-static/assets/{index-DnEJ_bKa.js → index-DhXZyjEd.js} +1 -1
  91. package/storybook-static/assets/index-DuIEV_9C.js +13 -0
  92. package/storybook-static/assets/{lit-element-B4_0akdT.js → lit-element-CenEXOuS.js} +2 -2
  93. package/storybook-static/assets/{local-storage.stories-BkO6djDz.js → local-storage.test.stories-CtisAQBB.js} +28 -24
  94. package/storybook-static/assets/{location-element.stories-DCIOUd0D.js → location-element.test.stories-5O_t_m4Y.js} +11 -11
  95. package/storybook-static/assets/preview-4Up_z4Em.js +7 -0
  96. package/storybook-static/assets/preview-BKCN0mOr.js +1 -0
  97. package/storybook-static/assets/{preview-CkgAD_DE.js → preview-D0eCfQft.js} +2 -2
  98. package/storybook-static/assets/preview-DRnyIGXK.js +48 -0
  99. package/storybook-static/assets/preview-FpHGYA1q.js +1 -0
  100. package/storybook-static/assets/{preview-PxUn-cIn.js → preview-TCN6m6T-.js} +1 -1
  101. package/storybook-static/assets/slice-events.test.stories-BSXCLIA5.js +231 -0
  102. package/storybook-static/assets/slots.test.stories-B1vqfHmN.js +214 -0
  103. package/storybook-static/assets/syntaxhighlighter-BP7B2CQK-DpPBKyTO.js +1 -0
  104. package/storybook-static/iframe.html +153 -10
  105. package/storybook-static/index.html +1 -1
  106. package/storybook-static/index.json +1 -1
  107. package/storybook-static/mockServiceWorker.js +1 -1
  108. package/storybook-static/project.json +1 -1
  109. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +35 -29
  110. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +1 -1
  111. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
  112. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +5 -5
  113. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +35 -35
  114. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
  115. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
  116. package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
  117. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  118. package/storybook-static/sb-addons/interactions-10/manager-bundle.js +18 -16
  119. package/storybook-static/sb-addons/links-1/manager-bundle.js +1 -1
  120. package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +1 -1
  121. package/storybook-static/sb-manager/WithTooltip-KJL26V4Q-5LS5AN27.js +1 -0
  122. package/storybook-static/sb-manager/{chunk-S4VOIVUE.js → chunk-B3YDJJJH.js} +9 -9
  123. package/storybook-static/sb-manager/{chunk-FEE35O7J.js → chunk-BLWCBWKL.js} +3 -3
  124. package/storybook-static/sb-manager/{chunk-XCO5HRLK.js → chunk-GUVK2GTO.js} +3 -3
  125. package/storybook-static/sb-manager/chunk-LFRML3ZV.js +186 -0
  126. package/storybook-static/sb-manager/chunk-MC7RAF2B.js +274 -0
  127. package/storybook-static/sb-manager/{chunk-XP3HGWTR.js → chunk-ZR5JZWHI.js} +1 -1
  128. package/storybook-static/sb-manager/{formatter-B5HCVTEV-7DCBOGO6.js → formatter-2WMMO6ZP-JI7RHVTW.js} +1 -1
  129. package/storybook-static/sb-manager/globals-module-info.js +1 -1
  130. package/storybook-static/sb-manager/globals-runtime.js +1 -1
  131. package/storybook-static/sb-manager/index.js +1 -1
  132. package/storybook-static/sb-manager/runtime.js +1 -1
  133. package/storybook-static/sb-manager/{syntaxhighlighter-JOJW2KGS-VF6EEVPI.js → syntaxhighlighter-BP7B2CQK-WOJYHKQR.js} +1 -1
  134. package/storybook-static/sb-preview/runtime.js +28 -11
  135. package/tsconfig.json +31 -21
  136. package/vite.config.js +5 -5
  137. package/yarn.lock +10242 -0
  138. package/.vscode/settings.json +0 -24
  139. package/coverage/src/stories/local-storage.stories.ts/coverage.svg +0 -10
  140. package/coverage/src/stories/location-element.stories.ts/coverage.svg +0 -10
  141. package/coverage/src/stories/renderPlay.ts/coverage.svg +0 -10
  142. package/coverage/src/stories/slice-events.stories.ts/coverage.svg +0 -10
  143. package/coverage/src/stories/slice-events.stories.ts.html +0 -436
  144. package/dist/custom-element-B4v-KaIh.cjs +0 -53
  145. package/dist/custom-element-_g0GTup2.js +0 -436
  146. package/src/stories/attributes.test.ts +0 -14
  147. package/src/stories/css.test.ts +0 -12
  148. package/src/stories/dom-merge.test.ts +0 -12
  149. package/src/stories/external-template.test.ts +0 -12
  150. package/src/stories/local-storage.test.ts +0 -12
  151. package/src/stories/location-element.test.ts +0 -14
  152. package/src/stories/renderPlay.ts +0 -22
  153. package/src/stories/slice-events.test.ts +0 -12
  154. package/storybook-static/assets/DocsRenderer-K4EAMTCU-BLMupvSb.js +0 -2
  155. package/storybook-static/assets/WithTooltip-Y7J54OF7-BAQSPSFk.js +0 -1
  156. package/storybook-static/assets/css.stories-CLSX-Xxd.js +0 -86
  157. package/storybook-static/assets/custom-element-BLZZ00dz.js +0 -53
  158. package/storybook-static/assets/http-request.stories-CUzlXO89.js +0 -300
  159. package/storybook-static/assets/iframe-gCvlWuoC.js +0 -2
  160. package/storybook-static/assets/index-CBQwM6ST.js +0 -508
  161. package/storybook-static/assets/index-CDavW7r9.js +0 -193
  162. package/storybook-static/assets/index-CQA5dlr6.js +0 -13
  163. package/storybook-static/assets/index-DgaNIR0t.js +0 -1
  164. package/storybook-static/assets/index-Dkj0J1ds.js +0 -1
  165. package/storybook-static/assets/preview-C6t8KBFr.js +0 -1
  166. package/storybook-static/assets/preview-CYD85dwb.js +0 -7
  167. package/storybook-static/assets/preview-D8LadFCz.js +0 -48
  168. package/storybook-static/assets/preview-DNpCpRPf.js +0 -1
  169. package/storybook-static/assets/slice-events.stories-DXKjXI37.js +0 -115
  170. package/storybook-static/assets/syntaxhighlighter-JOJW2KGS-C04pIVD3.js +0 -1
  171. package/storybook-static/sb-manager/WithTooltip-Y7J54OF7-CEHQ77YF.js +0 -1
  172. package/storybook-static/sb-manager/chunk-E3WK6ZOZ.js +0 -234
  173. package/storybook-static/sb-manager/chunk-E6ABNH5R.js +0 -183
  174. /package/coverage/src/stories/{attributes.stories.ts → testStoryBook.ts}/coverage.svg +0 -0
@@ -0,0 +1,300 @@
1
+ import{w as U,e as w}from"./custom-element-BV8-hRQS.js";import{i as ve,d as J,s as Q,R as ye,t as ge}from"./index-DuIEV_9C.js";import"./index-CVRyq5ci.js";const we=(t,e)=>t.getAttribute(e);class xe extends HTMLElement{static observedAttributes=["value","slice","url","method","header-accept"];get requestHeaders(){const e={};return[...this.attributes].filter(r=>r.name.startsWith("header-")).map(r=>e[r.name.substring(7)]=r.value),e}get requestProps(){const e={};return[...this.attributes].filter(r=>!r.name.startsWith("header-")).filter(r=>!r.name.startsWith("slice")).map(r=>e[r.name]=r.value),e}disconnectedCallback(){this.#e?.()}connectedCallback(){setTimeout(()=>this.fetch(),0)}#t="";#e=()=>{};async fetch(){if(!this.closest("body"))return;const e=we(this,"url")||"";if(!e)return this.#e?.(),this.value={};if(this.#t===e)return;this.#t=e;const r=new AbortController;this.#e=()=>{r.abort(this.localName+" disconnected"),this.#t=""};const n={...this.requestProps,headers:this.requestHeaders},a={request:n},l=()=>this.dispatchEvent(new Event("change"));this.value=a,l();const u=await fetch(e,{...this.requestProps,signal:r.signal,headers:this.requestHeaders}),d={headers:{}};if([...u.headers].map(([s,o])=>d.headers[s]=o),"ok,status,statusText,type,url,redirected".split(",").map(s=>d[s]=u[s]),a.response=d,l(),d.headers["content-type"]?.includes("json"))try{a.data=await u.json(),l()}catch{}}attributeChangedCallback(e,r,n){e==="url"&&r!==n&&(r&&this.#e?.(),n?setTimeout(()=>this.fetch(),10):(this.value={},setTimeout(()=>this.dispatchEvent(new Event("change")),10)))}}window.customElements.define("http-request",xe);function be(){ve(typeof URL<"u",J.formatMessage(`Global "URL" class is not defined. This likely means that you're running MSW in an environment that doesn't support all Node.js standard API (e.g. React Native). If that's the case, please use an appropriate polyfill for the "URL" class, like "react-native-url-polyfill".`))}function Te(t,e){return t.toLowerCase()===e.toLowerCase()}function Ee(t){return t<300?"#69AB32":t<400?"#F0BB4B":"#E95F5D"}function Ce(){const t=new Date;return[t.getHours(),t.getMinutes(),t.getSeconds()].map(String).map(e=>e.slice(0,2)).map(e=>e.padStart(2,"0")).join(":")}async function _e(t){const r=await t.clone().text();return{url:new URL(t.url),method:t.method,headers:Object.fromEntries(t.headers.entries()),body:r}}var Pe=Object.create,ae=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,se=Object.getOwnPropertyNames,ke=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty,oe=(t,e)=>function(){return e||(0,t[se(t)[0]])((e={exports:{}}).exports,e),e.exports},Oe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of se(e))!Re.call(t,a)&&a!==r&&ae(t,a,{get:()=>e[a],enumerable:!(n=qe(e,a))||n.enumerable});return t},Ae=(t,e,r)=>(r=t!=null?Pe(ke(t)):{},Oe(ae(r,"default",{value:t,enumerable:!0}),t)),Se=oe({"node_modules/statuses/codes.json"(t,e){e.exports={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}}}),Be=oe({"node_modules/statuses/index.js"(t,e){var r=Se();e.exports=d,d.message=r,d.code=n(r),d.codes=a(r),d.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},d.empty={204:!0,205:!0,304:!0},d.retry={502:!0,503:!0,504:!0};function n(s){var o={};return Object.keys(s).forEach(function(f){var c=s[f],h=Number(f);o[c.toLowerCase()]=h}),o}function a(s){return Object.keys(s).map(function(i){return Number(i)})}function l(s){var o=s.toLowerCase();if(!Object.prototype.hasOwnProperty.call(d.code,o))throw new Error('invalid status message: "'+s+'"');return d.code[o]}function u(s){if(!Object.prototype.hasOwnProperty.call(d.message,s))throw new Error("invalid status code: "+s);return d.message[s]}function d(s){if(typeof s=="number")return u(s);if(typeof s!="string")throw new TypeError("code must be a number or string");var o=parseInt(s,10);return isNaN(o)?l(s):u(o)}}}),$e=Ae(Be()),ie=$e.default;/*! Bundled license information:
2
+
3
+ statuses/index.js:
4
+ (*!
5
+ * statuses
6
+ * Copyright(c) 2014 Jonathan Ong
7
+ * Copyright(c) 2016 Douglas Christopher Wilson
8
+ * MIT Licensed
9
+ *)
10
+ */const{message:De}=ie;async function Ie(t){const e=t.clone(),r=await e.text(),n=e.status||200,a=e.statusText||De[n]||"OK";return{status:n,statusText:a,headers:Object.fromEntries(e.headers.entries()),body:r}}function je(t){for(var e=[],r=0;r<t.length;){var n=t[r];if(n==="*"||n==="+"||n==="?"){e.push({type:"MODIFIER",index:r,value:t[r++]});continue}if(n==="\\"){e.push({type:"ESCAPED_CHAR",index:r++,value:t[r++]});continue}if(n==="{"){e.push({type:"OPEN",index:r,value:t[r++]});continue}if(n==="}"){e.push({type:"CLOSE",index:r,value:t[r++]});continue}if(n===":"){for(var a="",l=r+1;l<t.length;){var u=t.charCodeAt(l);if(u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||u===95){a+=t[l++];continue}break}if(!a)throw new TypeError("Missing parameter name at ".concat(r));e.push({type:"NAME",index:r,value:a}),r=l;continue}if(n==="("){var d=1,s="",l=r+1;if(t[l]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(l));for(;l<t.length;){if(t[l]==="\\"){s+=t[l++]+t[l++];continue}if(t[l]===")"){if(d--,d===0){l++;break}}else if(t[l]==="("&&(d++,t[l+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(l));s+=t[l++]}if(d)throw new TypeError("Unbalanced pattern at ".concat(r));if(!s)throw new TypeError("Missing pattern at ".concat(r));e.push({type:"PATTERN",index:r,value:s}),r=l;continue}e.push({type:"CHAR",index:r,value:t[r++]})}return e.push({type:"END",index:r,value:""}),e}function Ne(t,e){e===void 0&&(e={});for(var r=je(t),n=e.prefixes,a=n===void 0?"./":n,l="[^".concat(A(e.delimiter||"/#?"),"]+?"),u=[],d=0,s=0,o="",i=function(b){if(s<r.length&&r[s].type===b)return r[s++].value},f=function(b){var q=i(b);if(q!==void 0)return q;var k=r[s],z=k.type,F=k.index;throw new TypeError("Unexpected ".concat(z," at ").concat(F,", expected ").concat(b))},c=function(){for(var b="",q;q=i("CHAR")||i("ESCAPED_CHAR");)b+=q;return b};s<r.length;){var h=i("CHAR"),m=i("NAME"),p=i("PATTERN");if(m||p){var v=h||"";a.indexOf(v)===-1&&(o+=v,v=""),o&&(u.push(o),o=""),u.push({name:m||d++,prefix:v,suffix:"",pattern:p||l,modifier:i("MODIFIER")||""});continue}var y=h||i("ESCAPED_CHAR");if(y){o+=y;continue}o&&(u.push(o),o="");var x=i("OPEN");if(x){var v=c(),T=i("NAME")||"",g=i("PATTERN")||"",P=c();f("CLOSE"),u.push({name:T||(g?d++:""),pattern:T&&!g?l:g,prefix:v,suffix:P,modifier:i("MODIFIER")||""});continue}f("END")}return u}function Le(t,e){var r=[],n=le(t,r,e);return Ue(n,r,e)}function Ue(t,e,r){r===void 0&&(r={});var n=r.decode,a=n===void 0?function(l){return l}:n;return function(l){var u=t.exec(l);if(!u)return!1;for(var d=u[0],s=u.index,o=Object.create(null),i=function(c){if(u[c]===void 0)return"continue";var h=e[c-1];h.modifier==="*"||h.modifier==="+"?o[h.name]=u[c].split(h.prefix+h.suffix).map(function(m){return a(m,h)}):o[h.name]=a(u[c],h)},f=1;f<u.length;f++)i(f);return{path:d,index:s,params:o}}}function A(t){return t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function ce(t){return t&&t.sensitive?"":"i"}function He(t,e){if(!e)return t;for(var r=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,a=r.exec(t.source);a;)e.push({name:a[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),a=r.exec(t.source);return t}function Me(t,e,r){var n=t.map(function(a){return le(a,e,r).source});return new RegExp("(?:".concat(n.join("|"),")"),ce(r))}function ze(t,e,r){return Fe(Ne(t,r),e,r)}function Fe(t,e,r){r===void 0&&(r={});for(var n=r.strict,a=n===void 0?!1:n,l=r.start,u=l===void 0?!0:l,d=r.end,s=d===void 0?!0:d,o=r.encode,i=o===void 0?function(F){return F}:o,f=r.delimiter,c=f===void 0?"/#?":f,h=r.endsWith,m=h===void 0?"":h,p="[".concat(A(m),"]|$"),v="[".concat(A(c),"]"),y=u?"^":"",x=0,T=t;x<T.length;x++){var g=T[x];if(typeof g=="string")y+=A(i(g));else{var P=A(i(g.prefix)),b=A(i(g.suffix));if(g.pattern)if(e&&e.push(g),P||b)if(g.modifier==="+"||g.modifier==="*"){var q=g.modifier==="*"?"?":"";y+="(?:".concat(P,"((?:").concat(g.pattern,")(?:").concat(b).concat(P,"(?:").concat(g.pattern,"))*)").concat(b,")").concat(q)}else y+="(?:".concat(P,"(").concat(g.pattern,")").concat(b,")").concat(g.modifier);else g.modifier==="+"||g.modifier==="*"?y+="((?:".concat(g.pattern,")").concat(g.modifier,")"):y+="(".concat(g.pattern,")").concat(g.modifier);else y+="(?:".concat(P).concat(b,")").concat(g.modifier)}}if(s)a||(y+="".concat(v,"?")),y+=r.endsWith?"(?=".concat(p,")"):"$";else{var k=t[t.length-1],z=typeof k=="string"?v.indexOf(k[k.length-1])>-1:k===void 0;a||(y+="(?:".concat(v,"(?=").concat(p,"))?")),z||(y+="(?=".concat(v,"|").concat(p,")"))}return new RegExp(y,ce(r))}function le(t,e,r){return t instanceof RegExp?He(t,e):Array.isArray(t)?Me(t,e,r):ze(t,e,r)}new TextEncoder;function Ve(){if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof process<"u"){const t=process.type;return t==="renderer"||t==="worker"?!1:!!(process.versions&&process.versions.node)}return!1}var We=Object.defineProperty,Ge=(t,e)=>{for(var r in e)We(t,r,{get:e[r],enumerable:!0})},Je={};Ge(Je,{blue:()=>Qe,gray:()=>Xe,green:()=>Ye,red:()=>Ze,yellow:()=>Ke});function Ke(t){return`\x1B[33m${t}\x1B[0m`}function Qe(t){return`\x1B[34m${t}\x1B[0m`}function Xe(t){return`\x1B[90m${t}\x1B[0m`}function Ze(t){return`\x1B[31m${t}\x1B[0m`}function Ye(t){return`\x1B[32m${t}\x1B[0m`}Ve();function et(t,e=!0){return[e&&t.origin,t.pathname].filter(Boolean).join("")}const tt=/[\?|#].*$/g;function rt(t){return new URL(`/${t}`,"http://localhost").searchParams}function ue(t){return t.endsWith("?")?t:t.replace(tt,"")}function nt(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}function at(t,e){if(nt(t)||t.startsWith("*"))return t;const r=e||typeof document<"u"&&document.baseURI;return r?decodeURI(new URL(encodeURI(t),r).href):t}function st(t,e){if(t instanceof RegExp)return t;const r=at(t,e);return ue(r)}function ot(t){return t.replace(/([:a-zA-Z_-]*)(\*{1,2})+/g,(e,r,n)=>{const a="(.*)";return r?r.startsWith(":")?`${r}${n}`:`${r}${a}`:a}).replace(/([^\/])(:)(?=\d+)/,"$1\\$2").replace(/^([^\/]+)(:)(?=\/\/)/,"$1\\$2")}function it(t,e,r){const n=st(e,r),a=typeof n=="string"?ot(n):n,l=et(t),u=Le(a,{decode:decodeURIComponent})(l),d=u&&u.params||{};return{matches:u!==!1,params:d}}var ct=Object.create,de=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,pe=Object.getOwnPropertyNames,ut=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty,pt=(t,e)=>function(){return e||(0,t[pe(t)[0]])((e={exports:{}}).exports,e),e.exports},ft=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of pe(e))!dt.call(t,a)&&a!==r&&de(t,a,{get:()=>e[a],enumerable:!(n=lt(e,a))||n.enumerable});return t},ht=(t,e,r)=>(r=t!=null?ct(ut(t)):{},ft(de(r,"default",{value:t,enumerable:!0}),t)),mt=pt({"node_modules/cookie/index.js"(t){t.parse=n,t.serialize=a;var e=Object.prototype.toString,r=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function n(o,i){if(typeof o!="string")throw new TypeError("argument str must be a string");for(var f={},c=i||{},h=c.decode||l,m=0;m<o.length;){var p=o.indexOf("=",m);if(p===-1)break;var v=o.indexOf(";",m);if(v===-1)v=o.length;else if(v<p){m=o.lastIndexOf(";",p-1)+1;continue}var y=o.slice(m,p).trim();if(f[y]===void 0){var x=o.slice(p+1,v).trim();x.charCodeAt(0)===34&&(x=x.slice(1,-1)),f[y]=s(x,h)}m=v+1}return f}function a(o,i,f){var c=f||{},h=c.encode||u;if(typeof h!="function")throw new TypeError("option encode is invalid");if(!r.test(o))throw new TypeError("argument name is invalid");var m=h(i);if(m&&!r.test(m))throw new TypeError("argument val is invalid");var p=o+"="+m;if(c.maxAge!=null){var v=c.maxAge-0;if(isNaN(v)||!isFinite(v))throw new TypeError("option maxAge is invalid");p+="; Max-Age="+Math.floor(v)}if(c.domain){if(!r.test(c.domain))throw new TypeError("option domain is invalid");p+="; Domain="+c.domain}if(c.path){if(!r.test(c.path))throw new TypeError("option path is invalid");p+="; Path="+c.path}if(c.expires){var y=c.expires;if(!d(y)||isNaN(y.valueOf()))throw new TypeError("option expires is invalid");p+="; Expires="+y.toUTCString()}if(c.httpOnly&&(p+="; HttpOnly"),c.secure&&(p+="; Secure"),c.priority){var x=typeof c.priority=="string"?c.priority.toLowerCase():c.priority;switch(x){case"low":p+="; Priority=Low";break;case"medium":p+="; Priority=Medium";break;case"high":p+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(c.sameSite){var T=typeof c.sameSite=="string"?c.sameSite.toLowerCase():c.sameSite;switch(T){case!0:p+="; SameSite=Strict";break;case"lax":p+="; SameSite=Lax";break;case"strict":p+="; SameSite=Strict";break;case"none":p+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return p}function l(o){return o.indexOf("%")!==-1?decodeURIComponent(o):o}function u(o){return encodeURIComponent(o)}function d(o){return e.call(o)==="[object Date]"||o instanceof Date}function s(o,i){try{return i(o)}catch{return o}}}}),vt=ht(mt()),K=vt.default;/*! Bundled license information:
11
+
12
+ cookie/index.js:
13
+ (*!
14
+ * cookie
15
+ * Copyright(c) 2012-2014 Roman Shtylman
16
+ * Copyright(c) 2015 Douglas Christopher Wilson
17
+ * MIT Licensed
18
+ *)
19
+ */function X(){return K.parse(document.cookie)}function yt(t){if(typeof document>"u"||typeof location>"u")return{};switch(t.credentials){case"same-origin":{const e=new URL(t.url);return location.origin===e.origin?X():{}}case"include":return X();default:return{}}}function gt(t){const e=t.headers.get("cookie"),r=e?K.parse(e):{};Q.hydrate();const n=Array.from(Q.get(t)?.entries()).reduce((u,[d,{value:s}])=>Object.assign(u,{[d.trim()]:s}),{}),l={...yt(t),...n};for(const[u,d]of Object.entries(l))t.headers.append("cookie",K.serialize(u,d));return{...l,...r}}var _=(t=>(t.HEAD="HEAD",t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH",t.OPTIONS="OPTIONS",t.DELETE="DELETE",t))(_||{});class wt extends ye{constructor(e,r,n,a){super({info:{header:`${e} ${r}`,path:r,method:e},resolver:n,options:a}),this.checkRedundantQueryParameters()}checkRedundantQueryParameters(){const{method:e,path:r}=this.info;if(r instanceof RegExp||ue(r)===r)return;rt(r).forEach((l,u)=>{}),J.warn(`Found a redundant usage of query parameters in the request handler URL for "${e} ${r}". Please match against a path instead and access query parameters using "new URL(request.url).searchParams" instead. Learn more: https://mswjs.io/docs/recipes/query-parameters`)}async parse(e){const r=new URL(e.request.url),n=it(r,this.info.path,e.resolutionContext?.baseUrl),a=gt(e.request);return{match:n,cookies:a}}predicate(e){const r=this.matchMethod(e.request.method),n=e.parsedResult.match.matches;return r&&n}matchMethod(e){return this.info.method instanceof RegExp?this.info.method.test(e):Te(this.info.method,e)}extendResolverArgs(e){return{params:e.parsedResult.match?.params||{},cookies:e.parsedResult.cookies}}async log(e){const r=ge(e.request.url),n=await _e(e.request),a=await Ie(e.response),l=Ee(a.status);console.groupCollapsed(J.formatMessage(`${Ce()} ${e.request.method} ${r} (%c${a.status} ${a.statusText}%c)`),`color:${l}`,"color:inherit"),console.log("Request",n),console.log("Handler:",this),console.log("Response",a),console.groupEnd()}}function C(t){return(e,r,n={})=>new wt(t,e,r,n)}const M={all:C(/.+/),head:C(_.HEAD),get:C(_.GET),post:C(_.POST),put:C(_.PUT),delete:C(_.DELETE),patch:C(_.PATCH),options:C(_.OPTIONS)};var xt=Object.create,fe=Object.defineProperty,bt=Object.getOwnPropertyDescriptor,he=Object.getOwnPropertyNames,Tt=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty,Ct=(t,e)=>function(){return e||(0,t[he(t)[0]])((e={exports:{}}).exports,e),e.exports},_t=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of he(e))!Et.call(t,a)&&a!==r&&fe(t,a,{get:()=>e[a],enumerable:!(n=bt(e,a))||n.enumerable});return t},Pt=(t,e,r)=>(r=t!=null?xt(Tt(t)):{},_t(!t||!t.__esModule?fe(r,"default",{value:t,enumerable:!0}):r,t)),qt=Ct({"node_modules/set-cookie-parser/lib/set-cookie.js"(t,e){var r={decodeValues:!0,map:!1,silent:!1};function n(s){return typeof s=="string"&&!!s.trim()}function a(s,o){var i=s.split(";").filter(n),f=i.shift(),c=l(f),h=c.name,m=c.value;o=o?Object.assign({},r,o):r;try{m=o.decodeValues?decodeURIComponent(m):m}catch(v){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+m+"'. Set options.decodeValues to false to disable this feature.",v)}var p={name:h,value:m};return i.forEach(function(v){var y=v.split("="),x=y.shift().trimLeft().toLowerCase(),T=y.join("=");x==="expires"?p.expires=new Date(T):x==="max-age"?p.maxAge=parseInt(T,10):x==="secure"?p.secure=!0:x==="httponly"?p.httpOnly=!0:x==="samesite"?p.sameSite=T:p[x]=T}),p}function l(s){var o="",i="",f=s.split("=");return f.length>1?(o=f.shift(),i=f.join("=")):i=s,{name:o,value:i}}function u(s,o){if(o=o?Object.assign({},r,o):r,!s)return o.map?{}:[];if(s.headers)if(typeof s.headers.getSetCookie=="function")s=s.headers.getSetCookie();else if(s.headers["set-cookie"])s=s.headers["set-cookie"];else{var i=s.headers[Object.keys(s.headers).find(function(c){return c.toLowerCase()==="set-cookie"})];!i&&s.headers.cookie&&!o.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),s=i}if(Array.isArray(s)||(s=[s]),o=o?Object.assign({},r,o):r,o.map){var f={};return s.filter(n).reduce(function(c,h){var m=a(h,o);return c[m.name]=m,c},f)}else return s.filter(n).map(function(c){return a(c,o)})}function d(s){if(Array.isArray(s))return s;if(typeof s!="string")return[];var o=[],i=0,f,c,h,m,p;function v(){for(;i<s.length&&/\s/.test(s.charAt(i));)i+=1;return i<s.length}function y(){return c=s.charAt(i),c!=="="&&c!==";"&&c!==","}for(;i<s.length;){for(f=i,p=!1;v();)if(c=s.charAt(i),c===","){for(h=i,i+=1,v(),m=i;i<s.length&&y();)i+=1;i<s.length&&s.charAt(i)==="="?(p=!0,i=m,o.push(s.substring(f,h)),f=i):i=h+1}else i+=1;(!p||i>=s.length)&&o.push(s.substring(f,s.length))}return o}e.exports=u,e.exports.parse=u,e.exports.parseString=a,e.exports.splitCookiesString=d}}),kt=Pt(qt()),Rt=/[^a-z0-9\-#$%&'*+.^_`|~]/i;function B(t){if(Rt.test(t)||t.trim()==="")throw new TypeError("Invalid character in header field name");return t.trim().toLowerCase()}var Z=[`
20
+ `,"\r"," "," "],Ot=new RegExp(`(^[${Z.join("")}]|$[${Z.join("")}])`,"g");function V(t){return t.replace(Ot,"")}function $(t){if(typeof t!="string"||t.length===0)return!1;for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r>127||!At(r))return!1}return!0}function At(t){return![127,32,"(",")","<",">","@",",",";",":","\\",'"',"/","[","]","?","=","{","}"].includes(t)}function Y(t){if(typeof t!="string"||t.trim()!==t)return!1;for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r===0||r===10||r===13)return!1}return!0}var R=Symbol("normalizedHeaders"),W=Symbol("rawHeaderNames"),ee=", ",te,re,ne,St=class me{constructor(e){this[te]={},this[re]=new Map,this[ne]="Headers",["Headers","HeadersPolyfill"].includes(e?.constructor.name)||e instanceof me||typeof globalThis.Headers<"u"&&e instanceof globalThis.Headers?e.forEach((n,a)=>{this.append(a,n)},this):Array.isArray(e)?e.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(ee):n)}):e&&Object.getOwnPropertyNames(e).forEach(r=>{const n=e[r];this.append(r,Array.isArray(n)?n.join(ee):n)})}[(te=R,re=W,ne=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(const[e]of this.entries())yield e}*values(){for(const[,e]of this.entries())yield e}*entries(){let e=Object.keys(this[R]).sort((r,n)=>r.localeCompare(n));for(const r of e)if(r==="set-cookie")for(const n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(e){if(!$(e))throw new TypeError(`Invalid header name "${e}"`);return this[R].hasOwnProperty(B(e))}get(e){if(!$(e))throw TypeError(`Invalid header name "${e}"`);return this[R][B(e)]??null}set(e,r){if(!$(e)||!Y(r))return;const n=B(e),a=V(r);this[R][n]=V(a),this[W].set(n,e)}append(e,r){if(!$(e)||!Y(r))return;const n=B(e),a=V(r);let l=this.has(n)?`${this.get(n)}, ${a}`:a;this.set(e,l)}delete(e){if(!$(e)||!this.has(e))return;const r=B(e);delete this[R][r],this[W].delete(r)}forEach(e,r){for(const[n,a]of this.entries())e.call(r,a,n,this)}getSetCookie(){const e=this.get("set-cookie");return e===null?[]:e===""?[""]:(0,kt.splitCookiesString)(e)}};const{message:Bt}=ie;function O(t={}){const e=t?.status||200,r=t?.statusText||Bt[e]||"",n=new Headers(t?.headers);return{...t,headers:n,status:e,statusText:r}}function $t(t,e){if(e.type&&Object.defineProperty(t,"type",{value:e.type,enumerable:!0,writable:!1}),typeof document<"u"){const r=St.prototype.getSetCookie.call(e.headers);for(const n of r)document.cookie=n}return t}class E extends Response{constructor(e,r){const n=O(r);super(e,n),$t(this,n)}static text(e,r){const n=O(r);return n.headers.has("Content-Type")||n.headers.set("Content-Type","text/plain"),n.headers.has("Content-Length")||n.headers.set("Content-Length",e?new Blob([e]).size.toString():"0"),new E(e,n)}static json(e,r){const n=O(r);n.headers.has("Content-Type")||n.headers.set("Content-Type","application/json");const a=JSON.stringify(e);return n.headers.has("Content-Length")||n.headers.set("Content-Length",a?new Blob([a]).size.toString():"0"),new E(a,n)}static xml(e,r){const n=O(r);return n.headers.has("Content-Type")||n.headers.set("Content-Type","text/xml"),new E(e,n)}static arrayBuffer(e,r){const n=O(r);return e&&n.headers.set("Content-Length",e.byteLength.toString()),new E(e,n)}static formData(e,r){return new E(e,O(r))}}async function Dt(t){let e;return e=t,new Promise(r=>setTimeout(r,e))}be();const G={count:1279,next:"https://pokeapi.co/api/v2/pokemon?offset=6&limit=6",previous:null,results:[{name:"bulbasaur",url:"https://pokeapi.co/api/v2/pokemon/1/"},{name:"ivysaur",url:"https://pokeapi.co/api/v2/pokemon/2/"},{name:"venusaur",url:"https://pokeapi.co/api/v2/pokemon/3/"},{name:"charmander",url:"https://pokeapi.co/api/v2/pokemon/4/"},{name:"charmeleon",url:"https://pokeapi.co/api/v2/pokemon/5/"},{name:"charizard",url:"https://pokeapi.co/api/v2/pokemon/6/"}]},H=[M.get("/pokemon",({request:t})=>{const r=new URL(t.url).searchParams.get("limit"),n=structuredClone(G);return r&&(n.results=n.results.slice(0,Number(r))),E.json(n)}),M.get("/noreturn",async()=>(await Dt(500),E.json(G))),M.get("/reflect",({request:t})=>{const e={};return[...t.headers.entries()].map(([r,n])=>e[r]="reflected-"+n),e["x-added"]="abc",E.json(G,{headers:e})}),M.get("/404",()=>new E(null,{status:404,statusText:"not found"}))],It={title:"",slice:"page",url:"/pokemon?limit=6"};function S(t){return new Promise(e=>setTimeout(e,t))}function jt({title:t,slice:e,url:r}){return`
21
+ <fieldset>
22
+ <legend>${t}</legend>
23
+ <custom-element>
24
+ <template><!-- wrapping into template to prevent images loading within DCE declaration -->
25
+ <http-request
26
+ url="{ //slice/url }"
27
+ slice="${e}"
28
+ ></http-request>
29
+ <input placeholder="URL for fetch" slice="url" value="{ //url ?? '${r}' }"/>
30
+ <button>set</button>
31
+ <button slice="url" slice-value="''" slice-event="click">set blank</button>
32
+ <button slice="url" slice-value="'/reflect'" slice-event="click">/reflect</button>
33
+ <button slice="url" slice-value="'/pokemon'" slice-event="click">/pokemon</button>
34
+ <button slice="url" slice-value="'/pokemon?limit=6'" slice-event="click">/pokemon?limit=6</button>
35
+ <button slice="url" slice-value="'/pokemon?limit=3'" slice-event="click">/pokemon?limit=3</button>
36
+
37
+ <p>Pokemon Count: {count(/datadom/slice/${e}//results)}</p>
38
+ <if test="count(/datadom/slice/${e}//results) &lt; 0">
39
+ <h3>loading...</h3>
40
+ </if>
41
+ <for-each select="/datadom/slice/${e}//results">
42
+ <variable name="pokeid"
43
+ select="substring-before( substring-after( @url, 'https://pokeapi.co/api/v2/pokemon/'),'/')"
44
+ ></variable>
45
+ <button>
46
+ <value-of select='@name'/>
47
+ </button>
48
+ </for-each>
49
+ <for-each select="//slice/${e}/value/*">
50
+ <ul>
51
+ <var data-testid="request-section"><value-of select='name(.)'/></var>
52
+ <for-each select="@*">
53
+ <div>
54
+ <var>@{local-name(.)}</var>
55
+ =
56
+ <code data-testid="attr-{local-name(.)}">{.}</code>
57
+ </div>
58
+ </for-each>
59
+ </ul>
60
+ </for-each>
61
+ </template>
62
+ </custom-element>
63
+ </fieldset>
64
+ `}const Nt={title:"http-request",render:t=>jt(t),renderPlay:async function(e){document.body.innerHTML=(e.render?e:Nt).render({...It,...e.args}),await new Promise(r=>setTimeout(async()=>{await e.play({canvasElement:document.body.firstElementChild}),r(0)},0))}},D={args:{title:"url and slice",url:"/pokemon?limit=4"},play:async({canvasElement:t})=>{const e=U(t);await e.findByText(D.args.title),w(await e.findByText("bulbasaur")).toBeInTheDocument(),w(await e.findByText("Pokemon Count: 4")).toBeInTheDocument(t)},parameters:{msw:H}},I={args:{title:"url change",url:""},play:async({canvasElement:t})=>{const e=U(t);await e.findByText(I.args.title);const r=l=>e.getByText(l),n=t.querySelector("http-request"),a=()=>n.getAttribute("url");w(r("Pokemon Count: 0")).toBeInTheDocument(),w(a()).toEqual(""),r("/pokemon").click(),await S(100),w(a()).toEqual("/pokemon"),w(r("Pokemon Count: 6")).toBeInTheDocument(),r("/pokemon?limit=6").click(),await S(100),w(a()).toEqual("/pokemon?limit=6"),w(r("Pokemon Count: 6")).toBeInTheDocument(),r("/pokemon?limit=3").click(),await S(100),w(a()).toEqual("/pokemon?limit=3"),w(r("Pokemon Count: 3")).toBeInTheDocument(),r("set blank").click(),await S(100),w(a()).toEqual(""),w(r("Pokemon Count: 0")).toBeInTheDocument()},parameters:{msw:H}},j={args:{title:"http-request with error",url:"/404"},play:async({canvasElement:t})=>{const e=U(t),r=async n=>(await e.findByTestId(n)).textContent;await e.findByText(j.args.title),await S(200),w(await r("attr-status")).to.include("404")},parameters:{msw:H}},N={args:{title:"http-request with delayed .5 seconds response",url:"/noreturn"},play:async({canvasElement:t})=>{const e=U(t);await e.findByText(N.args.title),w(await e.findByText("request")).toBeInTheDocument(),w(e.queryByText("response")).toBe(null),w(await e.findByText("response")).toBeInTheDocument(),w(await e.findByText("bulbasaur")).toBeInTheDocument(),w(await e.findByText("Pokemon Count: 6")).toBeInTheDocument()},parameters:{msw:H}},L={args:{title:"http-request headers and response status and headers",url:"/reflect"},play:async({canvasElement:t})=>{const e=U(t);await e.findByText(L.args.title),await S(200);const r=await e.findByTestId("section-request-attr-x-test");w(r).toBeInTheDocument(),w(r.textContent.trim()).toEqual("testing");const n=await e.findByTestId("section-response-attr-x-test");w(n).toBeInTheDocument(),w(n.textContent.trim()).toEqual("reflected-testing");const a=await e.findByTestId("section-response-attr-x-added");w(a).toBeInTheDocument(),w(a.textContent.trim()).toEqual("abc")},parameters:{msw:H},render:({url:t,title:e})=>`
65
+ <fieldset>
66
+ <legend>${e}</legend>
67
+ <p> <b>request</b> headers are populated into dedicated <b>slice/request/headers</b></p>
68
+
69
+ <custom-element tag="headers-demo" >
70
+ <template>
71
+ <http-request
72
+ url="${t}"
73
+ slice="request_slice"
74
+ type="text"
75
+ mode="cors"
76
+ header-x-test="testing"
77
+ ></http-request>
78
+ Content of <code>//slice/request_slice</code> is filled by <b>request</b> and <b>response</b>
79
+ from <code>${t}</code>
80
+
81
+ <h3>Samples</h3>
82
+ <table>
83
+ <tr><th>//slice/request_slice/value/request/headers/@mode</th>
84
+ <td><value-of select="//slice/request_slice/value/request/@mode"/></td></tr>
85
+ <tr><th>//slice/request_slice/value/response/headers/@content-type</th>
86
+ <td><value-of select="//slice/request_slice/value/response/headers/@content-type"/></td></tr>
87
+ <tr><th>//slice/request_slice/value/response/@status</th>
88
+ <td><value-of select="//slice/request_slice/value/response/@status"/></td></tr>
89
+ </table>
90
+ <for-each select="//slice/request_slice/value/*">
91
+ <xsl:variable name="section">{name(.)}</xsl:variable>
92
+ <ul date-testid="section-{$section}">
93
+ <b data-testid="request-section"><value-of select='name(.)'/></b>
94
+ <for-each select="@*">
95
+ <div>
96
+ <var >@{local-name(.)}</var>
97
+ =
98
+ <code data-testid="section-{$section}-prop-{local-name(.)}">{.}</code>
99
+ </div>
100
+ </for-each>
101
+ <for-each select="*">
102
+ <div>
103
+ <b data-testid="section-deep"><value-of select='local-name(.)'/></b>
104
+ <ul>
105
+ <for-each select="@*">
106
+ <li>
107
+ <var data-testid="section-attribute">@{local-name(.)}</var>
108
+ =
109
+ <code data-testid="section-{$section}-attr-{local-name(.)}">{.}</code>
110
+ </li>
111
+ </for-each>
112
+ <code><value-of select='.'/></code>
113
+ </ul>
114
+ </div>
115
+ </for-each>
116
+ </ul>
117
+ </for-each>
118
+ </template>
119
+ </custom-element>
120
+ <headers-demo></headers-demo>
121
+ </fieldset>
122
+ `};D.parameters={...D.parameters,docs:{...D.parameters?.docs,source:{originalSource:`{
123
+ args: {
124
+ title: 'url and slice',
125
+ url: '/pokemon?limit=4'
126
+ },
127
+ play: async ({
128
+ canvasElement
129
+ }) => {
130
+ const canvas = within(canvasElement);
131
+ await canvas.findByText((Demo.args!.title as string));
132
+ expect(await canvas.findByText('bulbasaur')).toBeInTheDocument();
133
+ expect(await canvas.findByText('Pokemon Count: 4')).toBeInTheDocument(canvasElement);
134
+ },
135
+ parameters: {
136
+ msw: handlers
137
+ }
138
+ }`,...D.parameters?.docs?.source}}};I.parameters={...I.parameters,docs:{...I.parameters?.docs,source:{originalSource:`{
139
+ args: {
140
+ title: 'url change',
141
+ url: ''
142
+ },
143
+ play: async ({
144
+ canvasElement
145
+ }) => {
146
+ const canvas = within(canvasElement);
147
+ await canvas.findByText((UrlChange.args!.title as string));
148
+ const byText = txt => canvas.getByText(txt);
149
+ const requestElement = canvasElement.querySelector('http-request'),
150
+ urlAttr = () => requestElement.getAttribute('url');
151
+ expect(byText('Pokemon Count: 0')).toBeInTheDocument();
152
+ expect(urlAttr()).toEqual('');
153
+ byText('/pokemon').click();
154
+ await sleep(100);
155
+ expect(urlAttr()).toEqual('/pokemon');
156
+ expect(byText('Pokemon Count: 6')).toBeInTheDocument();
157
+ byText('/pokemon?limit=6').click();
158
+ await sleep(100);
159
+ expect(urlAttr()).toEqual('/pokemon?limit=6');
160
+ expect(byText('Pokemon Count: 6')).toBeInTheDocument();
161
+ byText('/pokemon?limit=3').click();
162
+ await sleep(100);
163
+ expect(urlAttr()).toEqual('/pokemon?limit=3');
164
+ expect(byText('Pokemon Count: 3')).toBeInTheDocument();
165
+ byText('set blank').click();
166
+ await sleep(100);
167
+ expect(urlAttr()).toEqual('');
168
+ expect(byText('Pokemon Count: 0')).toBeInTheDocument();
169
+ },
170
+ parameters: {
171
+ msw: handlers
172
+ }
173
+ }`,...I.parameters?.docs?.source}}};j.parameters={...j.parameters,docs:{...j.parameters?.docs,source:{originalSource:`{
174
+ args: {
175
+ title: 'http-request with error',
176
+ url: '/404'
177
+ },
178
+ play: async ({
179
+ canvasElement
180
+ }) => {
181
+ const canvas = within(canvasElement),
182
+ $t = async testId => (await canvas.findByTestId(testId)).textContent;
183
+ await canvas.findByText((Http404.args!.title as string));
184
+ await sleep(200);
185
+ expect(await $t('attr-status')).to.include('404');
186
+ },
187
+ parameters: {
188
+ msw: handlers
189
+ }
190
+ }`,...j.parameters?.docs?.source}}};N.parameters={...N.parameters,docs:{...N.parameters?.docs,source:{originalSource:`{
191
+ args: {
192
+ title: 'http-request with delayed .5 seconds response',
193
+ url: '/noreturn'
194
+ },
195
+ play: async ({
196
+ canvasElement
197
+ }) => {
198
+ const canvas = within(canvasElement);
199
+ await canvas.findByText((LifecycleInitialized.args!.title as string));
200
+ expect(await canvas.findByText('request')).toBeInTheDocument(); // after DCE initiated
201
+ expect(canvas.queryByText('response')).toBe(null); // response is not available
202
+ // wait while response appears ~ 0.5 seconds
203
+ expect(await canvas.findByText('response')).toBeInTheDocument(); // only after delay is shown
204
+
205
+ expect(await canvas.findByText('bulbasaur')).toBeInTheDocument();
206
+ expect(await canvas.findByText('Pokemon Count: 6')).toBeInTheDocument();
207
+ },
208
+ parameters: {
209
+ msw: handlers
210
+ }
211
+ }`,...N.parameters?.docs?.source}}};L.parameters={...L.parameters,docs:{...L.parameters?.docs,source:{originalSource:`{
212
+ args: {
213
+ title: 'http-request headers and response status and headers',
214
+ url: '/reflect'
215
+ },
216
+ play: async ({
217
+ canvasElement
218
+ }) => {
219
+ const canvas = within(canvasElement);
220
+ await canvas.findByText((RequestResponseHeaders.args!.title as string));
221
+ await sleep(200);
222
+
223
+ // see response made by /reflect handler
224
+
225
+ const te = await canvas.findByTestId('section-request-attr-x-test');
226
+ expect(te).toBeInTheDocument();
227
+ expect(te.textContent.trim()).toEqual('testing');
228
+ const t1 = await canvas.findByTestId('section-response-attr-x-test');
229
+ expect(t1).toBeInTheDocument();
230
+ expect(t1.textContent.trim()).toEqual('reflected-testing');
231
+ const tAdded = await canvas.findByTestId('section-response-attr-x-added');
232
+ expect(tAdded).toBeInTheDocument();
233
+ expect(tAdded.textContent.trim()).toEqual('abc');
234
+ },
235
+ parameters: {
236
+ msw: handlers
237
+ },
238
+ render: ({
239
+ url,
240
+ title
241
+ }) => \`
242
+ <fieldset>
243
+ <legend>\${title}</legend>
244
+ <p> <b>request</b> headers are populated into dedicated <b>slice/request/headers</b></p>
245
+
246
+ <custom-element tag="headers-demo" >
247
+ <template>
248
+ <http-request
249
+ url="\${url}"
250
+ slice="request_slice"
251
+ type="text"
252
+ mode="cors"
253
+ header-x-test="testing"
254
+ ></http-request>
255
+ Content of <code>//slice/request_slice</code> is filled by <b>request</b> and <b>response</b>
256
+ from <code>\${url}</code>
257
+
258
+ <h3>Samples</h3>
259
+ <table>
260
+ <tr><th>//slice/request_slice/value/request/headers/@mode</th>
261
+ <td><value-of select="//slice/request_slice/value/request/@mode"/></td></tr>
262
+ <tr><th>//slice/request_slice/value/response/headers/@content-type</th>
263
+ <td><value-of select="//slice/request_slice/value/response/headers/@content-type"/></td></tr>
264
+ <tr><th>//slice/request_slice/value/response/@status</th>
265
+ <td><value-of select="//slice/request_slice/value/response/@status"/></td></tr>
266
+ </table>
267
+ <for-each select="//slice/request_slice/value/*">
268
+ <xsl:variable name="section">{name(.)}</xsl:variable>
269
+ <ul date-testid="section-{$section}">
270
+ <b data-testid="request-section"><value-of select='name(.)'/></b>
271
+ <for-each select="@*">
272
+ <div>
273
+ <var >@{local-name(.)}</var>
274
+ =
275
+ <code data-testid="section-{$section}-prop-{local-name(.)}">{.}</code>
276
+ </div>
277
+ </for-each>
278
+ <for-each select="*">
279
+ <div>
280
+ <b data-testid="section-deep"><value-of select='local-name(.)'/></b>
281
+ <ul>
282
+ <for-each select="@*">
283
+ <li>
284
+ <var data-testid="section-attribute">@{local-name(.)}</var>
285
+ =
286
+ <code data-testid="section-{$section}-attr-{local-name(.)}">{.}</code>
287
+ </li>
288
+ </for-each>
289
+ <code><value-of select='.'/></code>
290
+ </ul>
291
+ </div>
292
+ </for-each>
293
+ </ul>
294
+ </for-each>
295
+ </template>
296
+ </custom-element>
297
+ <headers-demo></headers-demo>
298
+ </fieldset>
299
+ \`
300
+ }`,...L.parameters?.docs?.source}}};const Mt=["Demo","UrlChange","Http404","LifecycleInitialized","RequestResponseHeaders"];export{D as Demo,j as Http404,N as LifecycleInitialized,L as RequestResponseHeaders,I as UrlChange,Mt as __namedExportsOrder,Nt as default};
@@ -0,0 +1,2 @@
1
+ const __vite__fileDeps=["./Configure-70I_VApa.js","./index-C30JwJMK.js","./index-Cc7K62zD.js","./index-DXimoRZY.js","./index-DrFu-skq.js","./index-DhXZyjEd.js","./attributes.test.stories-BEOraI4E.js","./custom-element-BV8-hRQS.js","./index-CVRyq5ci.js","./css.test.stories-D9WaxrEv.js","./dom-merge.test.stories-BhbNeum_.js","./external-template.test.stories-Bpr_wxBo.js","./form.test.stories-3tURbEdv.js","./http-request.stories-8K_qSs8C.js","./index-DuIEV_9C.js","./local-storage.test.stories-CtisAQBB.js","./location-element.test.stories-5O_t_m4Y.js","./slice-events.test.stories-BSXCLIA5.js","./slots.test.stories-B1vqfHmN.js","./entry-preview-DrgzXgwT.js","./lit-element-CenEXOuS.js","./entry-preview-docs-Bxv0qQWs.js","./tiny-invariant-BxWVcicq.js","./preview-TCN6m6T-.js","./preview-B63p-W8V.js","./preview-BDY5ThwJ.js","./preview-BAz7FMXc.js","./preview-BKCN0mOr.js","./preview-DRnyIGXK.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
2
+ import"../sb-preview/runtime.js";(function(){const _=document.createElement("link").relList;if(_&&_.supports&&_.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&a(s)}).observe(document,{childList:!0,subtree:!0});function c(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(r){if(r.ep)return;r.ep=!0;const o=c(r);fetch(r.href,o)}})();const f="modulepreload",R=function(e,_){return new URL(e,_).href},O={},t=function(_,c,a){let r=Promise.resolve();if(c&&c.length>0){const o=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),p=s?.nonce||s?.getAttribute("nonce");r=Promise.all(c.map(i=>{if(i=R(i,a),i in O)return;O[i]=!0;const m=i.endsWith(".css"),d=m?'[rel="stylesheet"]':"";if(!!a)for(let l=o.length-1;l>=0;l--){const u=o[l];if(u.href===i&&(!m||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${d}`))return;const n=document.createElement("link");if(n.rel=m?"stylesheet":f,m||(n.as="script",n.crossOrigin=""),n.href=i,p&&n.setAttribute("nonce",p),document.head.appendChild(n),m)return new Promise((l,u)=>{n.addEventListener("load",l),n.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${i}`)))})}))}return r.then(()=>_()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})},{createBrowserChannel:T}=__STORYBOOK_MODULE_CHANNELS__,{addons:L}=__STORYBOOK_MODULE_PREVIEW_API__,E=T({page:"preview"});L.setChannel(E);window.__STORYBOOK_ADDONS_CHANNEL__=E;window.CONFIG_TYPE==="DEVELOPMENT"&&(window.__STORYBOOK_SERVER_CHANNEL__=E);const P={"./src/stories/Configure.mdx":async()=>t(()=>import("./Configure-70I_VApa.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"./src/stories/attributes.test.stories.ts":async()=>t(()=>import("./attributes.test.stories-BEOraI4E.js"),__vite__mapDeps([6,7,8]),import.meta.url),"./src/stories/css.test.stories.ts":async()=>t(()=>import("./css.test.stories-D9WaxrEv.js"),__vite__mapDeps([9,7,8]),import.meta.url),"./src/stories/dom-merge.test.stories.ts":async()=>t(()=>import("./dom-merge.test.stories-BhbNeum_.js"),__vite__mapDeps([10,7,8]),import.meta.url),"./src/stories/external-template.test.stories.ts":async()=>t(()=>import("./external-template.test.stories-Bpr_wxBo.js"),__vite__mapDeps([11,7,8]),import.meta.url),"./src/stories/form.test.stories.ts":async()=>t(()=>import("./form.test.stories-3tURbEdv.js"),__vite__mapDeps([12,7,8]),import.meta.url),"./src/stories/http-request.stories.ts":async()=>t(()=>import("./http-request.stories-8K_qSs8C.js"),__vite__mapDeps([13,7,8,14]),import.meta.url),"./src/stories/local-storage.test.stories.ts":async()=>t(()=>import("./local-storage.test.stories-CtisAQBB.js"),__vite__mapDeps([15,7,8]),import.meta.url),"./src/stories/location-element.test.stories.ts":async()=>t(()=>import("./location-element.test.stories-5O_t_m4Y.js"),__vite__mapDeps([16,7,8]),import.meta.url),"./src/stories/slice-events.test.stories.ts":async()=>t(()=>import("./slice-events.test.stories-BSXCLIA5.js"),__vite__mapDeps([17,7,8]),import.meta.url),"./src/stories/slots.test.stories.ts":async()=>t(()=>import("./slots.test.stories-B1vqfHmN.js"),__vite__mapDeps([18,7,8]),import.meta.url)};async function y(e){return P[e]()}const{composeConfigs:I,PreviewWeb:V,ClientApi:A}=__STORYBOOK_MODULE_PREVIEW_API__,D=async(e=[])=>{const _=await Promise.all([e.at(0)??t(()=>import("./entry-preview-DrgzXgwT.js"),__vite__mapDeps([19,4,20]),import.meta.url),e.at(1)??t(()=>import("./entry-preview-docs-Bxv0qQWs.js"),__vite__mapDeps([21,2,22,20]),import.meta.url),e.at(2)??t(()=>import("./preview-TCN6m6T-.js"),__vite__mapDeps([23,3]),import.meta.url),e.at(3)??t(()=>import("./preview-D0eCfQft.js"),[],import.meta.url),e.at(4)??t(()=>import("./preview-FpHGYA1q.js"),[],import.meta.url),e.at(5)??t(()=>import("./preview-B63p-W8V.js"),__vite__mapDeps([24,4]),import.meta.url),e.at(6)??t(()=>import("./preview-B4GcaC1c.js"),[],import.meta.url),e.at(7)??t(()=>import("./preview-BDY5ThwJ.js"),__vite__mapDeps([25,22]),import.meta.url),e.at(8)??t(()=>import("./preview-BAz7FMXc.js"),__vite__mapDeps([26,4]),import.meta.url),e.at(9)??t(()=>import("./preview-4Up_z4Em.js"),[],import.meta.url),e.at(10)??t(()=>import("./preview-BKCN0mOr.js"),__vite__mapDeps([27,8]),import.meta.url),e.at(11)??t(()=>import("./preview-DRnyIGXK.js"),__vite__mapDeps([28,14]),import.meta.url)]);return I(_)};window.__STORYBOOK_PREVIEW__=window.__STORYBOOK_PREVIEW__||new V(y,D);window.__STORYBOOK_STORY_STORE__=window.__STORYBOOK_STORY_STORE__||window.__STORYBOOK_PREVIEW__.storyStore;export{t as _};
@@ -0,0 +1 @@
1
+ import{M,u as a}from"./index-DhXZyjEd.js";import"./index-C30JwJMK.js";import"./iframe-zdt9kuj6.js";import"../sb-preview/runtime.js";import"./index-Cc7K62zD.js";import"./index-DXimoRZY.js";import"./index-DrFu-skq.js";export{M as MDXProvider,a as useMDXComponents};