1 line
1.5 KiB
JavaScript
1 line
1.5 KiB
JavaScript
import{P as L,b as p}from"./chunk-WFFRPTHA-ed72344b.js";import"./index-11d98b33.js";const{global:v}=__STORYBOOK_MODULE_GLOBAL__,{makeDecorator:f,useEffect:u}=__STORYBOOK_MODULE_PREVIEW_API__;var{document:c,Element:i}=v,S=/^(\S+)\s*(.*)$/,k=i!=null&&!i.prototype.matches,A=k?"msMatchesSelector":"matches",E=(e,n)=>{if(e[A](n))return!0;let t=e.parentElement;return t?E(t,n):!1},R=(e,...n)=>{let t=e(...n);return Object.entries(t).map(([a,r])=>{let[o,h,_]=a.match(S)||[];return{eventName:h,handler:l=>{(!_||E(l.target,_))&&r(l)}}})},M=(e,...n)=>{let t=c&&c.getElementById("storybook-root");u(()=>{if(t!=null){let a=R(e,...n);return a.forEach(({eventName:r,handler:o})=>t.addEventListener(r,o)),()=>a.forEach(({eventName:r,handler:o})=>t.removeEventListener(r,o))}},[t,e,n])},N=f({name:"withActions",parameterName:L,skipIfNoParametersOrOptions:!0,wrapper:(e,n,{parameters:t})=>(t!=null&&t.handles&&M(p,...t.handles),e(n))});const{global:g}=__STORYBOOK_MODULE_GLOBAL__,{makeDecorator:D,addons:O}=__STORYBOOK_MODULE_PREVIEW_API__,{STORY_CHANGED:T,SELECT_STORY:b}=__STORYBOOK_MODULE_CORE_EVENTS__;var Y="links",{document:m,HTMLElement:B}=g,I=e=>O.getChannel().emit(b,e),d=e=>{let{target:n}=e;if(!(n instanceof B))return;let t=n,{sbKind:a,sbStory:r}=t.dataset;(a||r)&&(e.preventDefault(),I({kind:a,story:r}))},s=!1,K=()=>{s||(s=!0,m.addEventListener("click",d))},P=()=>{s&&(s=!1,m.removeEventListener("click",d))},C=D({name:"withLinks",parameterName:Y,wrapper:(e,n)=>(K(),O.getChannel().once(T,P),e(n))});export{C as a,N as w};
|