1 line
5.7 KiB
Text
1 line
5.7 KiB
Text
|
{"version":3,"file":"chunk-454WOBUV-5rTpxkNE.js","sources":["../../node_modules/@storybook/addon-actions/dist/chunk-454WOBUV.mjs"],"sourcesContent":["import { v4 } from 'uuid';\nimport { addons } from 'storybook/internal/preview-api';\nimport { global } from '@storybook/global';\nimport { ImplicitActionsDuringRendering } from 'storybook/internal/preview-errors';\n\nvar PARAM_KEY=\"actions\",ADDON_ID=\"storybook/actions\",PANEL_ID=`${ADDON_ID}/panel`,EVENT_ID=`${ADDON_ID}/action-event`,CLEAR_ID=`${ADDON_ID}/action-clear`,CYCLIC_KEY=\"$___storybook.isCyclic\";var config={depth:10,clearOnStoryChange:!0,limit:50},configureActions=(options={})=>{Object.assign(config,options);};var findProto=(obj,callback)=>{let proto=Object.getPrototypeOf(obj);return !proto||callback(proto)?proto:findProto(proto,callback)},isReactSyntheticEvent=e=>!!(typeof e==\"object\"&&e&&findProto(e,proto=>/^Synthetic(?:Base)?Event$/.test(proto.constructor.name))&&typeof e.persist==\"function\"),serializeArg=a=>{if(isReactSyntheticEvent(a)){let e=Object.create(a.constructor.prototype,Object.getOwnPropertyDescriptors(a));e.persist();let viewDescriptor=Object.getOwnPropertyDescriptor(e,\"view\"),view=viewDescriptor?.value;return typeof view==\"object\"&&view?.constructor.name===\"Window\"&&Object.defineProperty(e,\"view\",{...viewDescriptor,value:Object.create(view.constructor.prototype)}),e}return a},generateId=()=>typeof crypto==\"object\"&&typeof crypto.getRandomValues==\"function\"?v4():Date.now().toString(36)+Math.random().toString(36).substring(2);function action(name,options={}){let actionOptions={...config,...options},handler=function(...args){if(options.implicit){let storyRenderer=(\"__STORYBOOK_PREVIEW__\"in global?global.__STORYBOOK_PREVIEW__:void 0)?.storyRenders.find(render=>render.phase===\"playing\"||render.phase===\"rendering\");if(storyRenderer){let deprecated=!window?.FEATURES?.disallowImplicitActionsInRenderV8,error=new ImplicitActionsDuringRendering({phase:storyRenderer.phase,name,deprecated});if(deprecated)console.warn(error);else throw error}}let channel=addons.getChannel(),id=generateId(),minDepth=5,serializedArgs=args.map(serializeArg),normalizedArgs=args.length>1?serializedArgs:serializedArgs[0],actionDisplayToEmit={id,count:0,data:{name,args:normalizedArgs},options:{...actionOptions,maxDepth:minDepth+(actionOptions.depth||3),allowFunction:actionOptions.allowFunction||!1}};channel.emit(EVENT_ID,actionDisplayToEmit);};return handler.isAction=!0,handler.implicit=options.implicit,handler}var actions=(...args)=>{let options=config,names=args;names.length===1&&Array.isArray(names[0])&&([names]=names),names.length!==1&&typeof names[names.length-1]!=\"string\"&&(options={...config,...names.pop()});let namesObject=names[0];(names.length!==1||typeof namesObject==\"string\")&&(namesObject={},names.forEach(name=>{namesObject[name]=name;}));let actionsObject={};return Object.keys(namesObject).forEach(name=>{actionsObject[name]=action(namesObject[name],options);}),actionsObject};\n\nexport { ADDON_ID, CLEAR_ID, CYCLIC_KEY, EVENT_ID, PANEL_ID, PARAM_KEY, action, actions, config, configureActions };\n"],"names":["addons","global","ImplicitActionsDuringRendering","PARAM_KEY","ADDON_ID","EVENT_ID","config","findProto","obj","callback","proto","isReactSyntheticEvent","serializeArg","a","e","viewDescriptor","view","generateId","v4","action","name","options","actionOptions","handler","args","storyRenderer","_a","render","deprecated","_b","error","channel","id","minDepth","serializedArgs","normalizedArgs","actionDisplayToEmit","actions","names","namesObject","actionsObject"],"mappings":"qCACA,KAAA,CAAA,OAAAA,CAAA,EAAA,iCACA,CAAA,OAAAC,CAAA,EAAA,4BACA,CAAA,+BAAAC,CAAA,EAAA,gDAEG,IAACC,EAAU,UAAUC,EAAS,oBAAiDC,EAAS,GAAGD,CAAQ,gBAA4FE,EAAO,CAAC,MAAM,GAAG,mBAAmB,GAAG,MAAM,EAAE,EAAsEC,EAAU,CAACC,EAAIC,IAAW,CAAC,IAAIC,EAAM,OAAO,eAAeF,CAAG,EAAE,MAAO,CAACE,GAAOD,EAASC,CAAK,EAAEA,EAAMH,EAAUG,EAAMD,CAAQ,CAAC,EAAEE,EAAsB,GAAG,CAAC,EAAE,OAAO,GAAG,UAAU,GAAGJ,EAAU,EAAEG,GAAO,4BAA4B,KAAKA,EAAM,YAAY,IAAI,CAAC,GAAG,OAAO,EAAE,SAAS,YAAYE,EAAaC,GAAG,CAAC,GAAGF,EAAsBE,CAAC,
|