Anvil/assets/chunk-NQQ3TO7D-D125W6ms.js.map

1 line
6 KiB
Text
Raw Normal View History

2024-07-31 10:01:28 +02:00
{"version":3,"file":"chunk-NQQ3TO7D-D125W6ms.js","sources":["../../node_modules/@storybook/addon-actions/dist/decorator.mjs","../../node_modules/@storybook/addon-links/dist/chunk-NQQ3TO7D.mjs"],"sourcesContent":["import { PARAM_KEY, actions } from './chunk-454WOBUV.mjs';\nimport { global } from '@storybook/global';\nimport { makeDecorator, useEffect } from 'storybook/internal/preview-api';\n\nvar {document,Element}=global,delegateEventSplitter=/^(\\S+)\\s*(.*)$/,isIE=Element!=null&&!Element.prototype.matches,matchesMethod=isIE?\"msMatchesSelector\":\"matches\",hasMatchInAncestry=(element,selector)=>{if(element[matchesMethod](selector))return !0;let parent=element.parentElement;return parent?hasMatchInAncestry(parent,selector):!1},createHandlers=(actionsFn,...handles)=>{let actionsObject=actionsFn(...handles);return Object.entries(actionsObject).map(([key,action])=>{let[_,eventName,selector]=key.match(delegateEventSplitter)||[];return {eventName,handler:e=>{(!selector||hasMatchInAncestry(e.target,selector))&&action(e);}}})},applyEventHandlers=(actionsFn,...handles)=>{let root=document&&document.getElementById(\"storybook-root\");useEffect(()=>{if(root!=null){let handlers=createHandlers(actionsFn,...handles);return handlers.forEach(({eventName,handler})=>root.addEventListener(eventName,handler)),()=>handlers.forEach(({eventName,handler})=>root.removeEventListener(eventName,handler))}},[root,actionsFn,handles]);},withActions=makeDecorator({name:\"withActions\",parameterName:PARAM_KEY,skipIfNoParametersOrOptions:!0,wrapper:(getStory,context,{parameters})=>(parameters?.handles&&applyEventHandlers(actions,...parameters.handles),getStory(context))});\n\nexport { withActions };\n","import { global } from '@storybook/global';\nimport { makeDecorator, addons } from 'storybook/internal/preview-api';\nimport { STORY_CHANGED, SELECT_STORY } from 'storybook/internal/core-events';\nimport { toId } from '@storybook/csf';\n\nvar PARAM_KEY=\"links\";var{document,HTMLElement}=global;function parseQuery(queryString){let query={},pairs=(queryString[0]===\"?\"?queryString.substring(1):queryString).split(\"&\").filter(Boolean);for(let i=0;i<pairs.length;i++){let pair=pairs[i].split(\"=\");query[decodeURIComponent(pair[0])]=decodeURIComponent(pair[1]||\"\");}return query}var navigate=params=>addons.getChannel().emit(SELECT_STORY,params),hrefTo=(title,name)=>new Promise(resolve=>{let{location}=document,existingId=parseQuery(location.search).id,titleToLink=title||existingId.split(\"--\",2)[0],path=`/story/${toId(titleToLink,name)}`,sbPath=location.pathname.replace(/iframe\\.html$/,\"\"),url=`${location.origin+sbPath}?${Object.entries({path}).map(item=>`${item[0]}=${item[1]}`).join(\"&\")}`;resolve(url);}),valueOrCall=args=>value=>typeof value==\"function\"?value(...args):value,linkTo=(idOrTitle,nameInput)=>(...args)=>{let resolver=valueOrCall(args),title=resolver(idOrTitle),name=nameInput?resolver(nameInput):!1;title?.match(/--/)&&!name?navigate({storyId:title}):name&&title?navigate({kind:title,story:name}):title?navigate({kind:title}):name&&navigate({story:name});},linksListener=e=>{let{target}=e;if(!(target instanceof HTMLElement))return;let element=target,{sbKind:kind,sbStory:story}=element.dataset;(kind||story)&&(e.preventDefault(),navigate({kind,story}));},hasListener=!1,on=()=>{hasListener||(hasListener=!0,document.addEventListener(\"click\",linksListener));},off=()=>{hasListener&&(hasListener=!1,document.removeEventListener(\"click\",linksListener));},withLinks=makeDecorator({name:\"withLinks\",parameterName:PARAM_KEY,wrapper:(getStory,context)=>(on(),addons.getChannel().once(STORY_CHANGED,off),getStory(context))});\n\nexport { hrefTo, linkTo, navigate, withLinks };\n"],"names":["global","makeDecorator","useEffect","document","Element","delegateEventSplitter","isIE","matchesMethod","hasMatchInAncestry","element","selector","parent","createHandlers","actionsFn","handles","actionsObject","key","action","_","eventName","e","applyEventHandlers","root","handlers","handler","withActions","PARAM_KEY","getStory","context","parameters","actions","