Anvil/assets/preview-Co4YIjAr.js.map

1 line
7.7 KiB
Text
Raw Normal View History

2024-07-31 10:01:28 +02:00
{"version":3,"file":"preview-Co4YIjAr.js","sources":["../../node_modules/@storybook/addon-actions/dist/preview.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 ADDON_ID=\"storybook/actions\",EVENT_ID=`${ADDON_ID}/action-event`;var config={depth:10,clearOnStoryChange:!0,limit:50};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 isInInitialArgs=(name,initialArgs)=>typeof initialArgs[name]>\"u\"&&!(name in initialArgs),inferActionsFromArgTypesRegex=context=>{let{initialArgs,argTypes,id,parameters:{actions}}=context;if(!actions||actions.disable||!actions.argTypesRegex||!argTypes)return {};let argTypesRegex=new RegExp(actions.argTypesRegex);return Object.entries(argTypes).filter(([name])=>!!argTypesRegex.test(name)).reduce((acc,[name,argType])=>(isInInitialArgs(name,initialArgs)&&(acc[name]=action(name,{implicit:!0,id})),acc),{})},addActionsFromArgTypes=context=>{let{initialArgs,argTypes,parameters:{actions}}=context;return actions?.disable||!argTypes?{}:Object.entries(argTypes).filter(([name,argType])=>!!argType.action).reduce((acc,[name,argType])=>(isInInitialArgs(name,initialArgs)&&(acc[name]=action(typeof argType.action==\"string\"?argType.action:name)),acc),{})};var argsEnhancers=[addActionsFromArgTypes,inferActionsFromArgTypesRegex];var subscribed=!1,logActionsWhenMockCalled=context=>{let{parameters:{actions}}=context;if(!actions?.disable&&!subscribed&&\"__STORYBOOK_TEST_ON_MOCK_CALL__\"in global&&typeof global.__STORYBOOK_TEST_ON_MOCK_CALL__==\"function\"){let onMockCall=global.__STORYBOOK_TEST_ON_MOCK_CALL__;onMockCall((mock,args)=>{let name=mock.getMockName();name!==\"spy\"&&(!/^next\\/.*::/.test(name)||[\"next/router::useRouter()\",\"next/navigation::useRouter()\",\"next/navigation::redirect\",\"next/cache::\",\"next/headers::cookies().set\",\"next/headers::cookies().delete\",\"next/headers::headers().set\",\"next/headers::headers().delete\"].some(prefix=>name.startsWith(prefix)))&&action(name)(args);}),subscribed=!0;}},loaders=[logActionsWhenMockCalled];\n\nexport { argsEnhancers, loaders };\n"],"names":["addons","global","ImplicitActionsDuringRendering","ADDON_I