UNPKG

@stories-js/core

Version:

Stories web components to build stories

5 lines 1.39 kB
/*! * (C) StoriesJS https://storiesjs.org - GPL-2.0 License */ import{m as t}from"./p-e9f23957.js";const n="ACTION_EVENT";const e={clearOnStoryChange:true,limit:50};const o=(t,n)=>{const e=Object.getPrototypeOf(t);if(!e||n(e))return e;return o(e,n)};const c=t=>Boolean(typeof t==="object"&&t&&o(t,(t=>/^Synthetic(?:Base)?Event$/.test(t.constructor.name)))&&typeof t.persist==="function");const s=t=>{if(c(t)){const n=Object.create(t.constructor.prototype,Object.getOwnPropertyDescriptors(t));n.persist();const e=Object.getOwnPropertyDescriptor(n,"view");const o=e===null||e===void 0?void 0:e.value;if(typeof o==="object"&&(o===null||o===void 0?void 0:o.constructor.name)==="Window"){Object.defineProperty(n,"view",Object.assign(Object.assign({},e),{value:Object.create(o.constructor.prototype)}))}return n}return t};function i(o,c={}){const i=Object.assign(Object.assign({},e),c);const r=(...e)=>{const c=(new Date).getTime().toString();const r=1;const a=e.map(s);const l=e.length>1?a:a[0];const u={id:c,count:0,data:{name:o,args:l},options:Object.assign(Object.assign({},i),{maxDepth:r,allowFunction:i.allowFunction||false})};let j=[];const O=JSON.stringify(u,((t,n)=>{if(typeof n==="object"&&n!==null){if(j.indexOf(n)!==-1){return}j.push(n)}return n}));j=null;const b=JSON.parse(O);console.log(n,b);t.emit(n,b)};return r}export{n as A,e as D,i as a}; //# sourceMappingURL=p-80cd706a.js.map