@storybook/preview-api
Advanced tools
Comparing version 0.0.0-pr-23435-sha-7496d4ba to 0.0.0-pr-23435-sha-bd98198e
export { C as ClientApi, a as addArgTypes, b as addArgTypesEnhancer, c as addArgs, d as addArgsEnhancer, e as addDecorator, f as addLoader, g as addParameters, h as addStepRunner, s as setGlobalRender } from './ClientApi-05c010e0.js'; | ||
export { S as StoryStore, c as prepareContext, a as prepareMeta, p as prepareStory, b as processCSFFile } from './StoryStore-9da974c1.js'; | ||
export { D as DEEPLY_EQUAL, P as PropDescriptor, U as UNTARGETED, c as combineArgs, a as combineParameters, b as composeStepRunners, d as composeStories, e as composeStory, f as decorateStory, o as deepDiff, g as defaultDecorateStory, h as filterArgTypes, p as groupArgsByTarget, j as inferControls, m as mapArgsToTypes, q as noTargetArgs, n as normalizeStory, s as sanitizeStoryContextUpdate, i as setProjectAnnotations, r as sortStoriesV6, l as sortStoriesV7, k as userOrAutoTitle, u as userOrAutoTitleFromSpecifier, v as validateOptions } from './sortStories-243da0ce.js'; | ||
export { D as DEEPLY_EQUAL, P as PropDescriptor, U as UNTARGETED, c as combineArgs, a as combineParameters, b as composeStepRunners, d as composeStories, e as composeStory, f as decorateStory, o as deepDiff, g as defaultDecorateStory, h as filterArgTypes, p as groupArgsByTarget, j as inferControls, m as mapArgsToTypes, q as noTargetArgs, n as normalizeStory, s as sanitizeStoryContextUpdate, i as setProjectAnnotations, r as sortStoriesV6, l as sortStoriesV7, k as userOrAutoTitle, u as userOrAutoTitleFromSpecifier, v as validateOptions } from './sortStories-7312444d.js'; | ||
export { getValuesFromArgTypes, normalizeComponentAnnotations, normalizeInputType, normalizeInputTypes, normalizeProjectAnnotations, useAddonState, useSharedState } from './store.js'; | ||
@@ -5,0 +5,0 @@ export { c as composeConfigs, a as getArrayField, g as getField, b as getObjectField, d as getSingletonField } from './composeConfigs-62a04721.js'; |
export { addons, makeDecorator, mockChannel } from './addons.js'; | ||
export { H as HooksContext, k as applyHooks, u as useArgs, a as useCallback, b as useChannel, c as useEffect, d as useGlobals, e as useMemo, f as useParameter, g as useReducer, h as useRef, i as useState, j as useStoryContext } from './hooks-655fa363.js'; | ||
export { S as StoryStore, a as prepareMeta, p as prepareStory } from './StoryStore-9da974c1.js'; | ||
export { P as PropDescriptor, c as combineArgs, a as combineParameters, b as composeStepRunners, d as composeStories, e as composeStory, f as decorateStory, g as defaultDecorateStory, h as filterArgTypes, j as inferControls, n as normalizeStory, s as sanitizeStoryContextUpdate, i as setProjectAnnotations, l as sortStoriesV7, k as userOrAutoTitle, u as userOrAutoTitleFromSpecifier } from './sortStories-243da0ce.js'; | ||
export { P as PropDescriptor, c as combineArgs, a as combineParameters, b as composeStepRunners, d as composeStories, e as composeStory, f as decorateStory, g as defaultDecorateStory, h as filterArgTypes, j as inferControls, n as normalizeStory, s as sanitizeStoryContextUpdate, i as setProjectAnnotations, l as sortStoriesV7, k as userOrAutoTitle, u as userOrAutoTitleFromSpecifier } from './sortStories-7312444d.js'; | ||
export { c as composeConfigs } from './composeConfigs-62a04721.js'; | ||
@@ -6,0 +6,0 @@ export { DocsContext, Preview, PreviewWeb, simulateDOMContentLoaded, simulatePageLoad } from './preview-web.js'; |
export { S as StoryStore, c as prepareContext, a as prepareMeta, p as prepareStory, b as processCSFFile } from './StoryStore-9da974c1.js'; | ||
export { D as DEEPLY_EQUAL, P as PropDescriptor, U as UNTARGETED, c as combineArgs, a as combineParameters, b as composeStepRunners, d as composeStories, e as composeStory, f as decorateStory, o as deepDiff, g as defaultDecorateStory, h as filterArgTypes, p as groupArgsByTarget, j as inferControls, m as mapArgsToTypes, q as noTargetArgs, n as normalizeStory, s as sanitizeStoryContextUpdate, i as setProjectAnnotations, r as sortStoriesV6, l as sortStoriesV7, k as userOrAutoTitle, u as userOrAutoTitleFromSpecifier, v as validateOptions } from './sortStories-243da0ce.js'; | ||
export { D as DEEPLY_EQUAL, P as PropDescriptor, U as UNTARGETED, c as combineArgs, a as combineParameters, b as composeStepRunners, d as composeStories, e as composeStory, f as decorateStory, o as deepDiff, g as defaultDecorateStory, h as filterArgTypes, p as groupArgsByTarget, j as inferControls, m as mapArgsToTypes, q as noTargetArgs, n as normalizeStory, s as sanitizeStoryContextUpdate, i as setProjectAnnotations, r as sortStoriesV6, l as sortStoriesV7, k as userOrAutoTitle, u as userOrAutoTitleFromSpecifier, v as validateOptions } from './sortStories-7312444d.js'; | ||
import * as _storybook_types from '@storybook/types'; | ||
@@ -4,0 +4,0 @@ import { InputType, StrictInputType, ArgTypes, GlobalTypes, StrictArgTypes, StrictGlobalTypes, Renderer, ModuleExports, NormalizedComponentAnnotations, ProjectAnnotations, NormalizedProjectAnnotations } from '@storybook/types'; |
@@ -29,3 +29,3 @@ "use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var store_exports={};__export(store_exports,{DEEPLY_EQUAL:()=>DEEPLY_EQUAL,HooksContext:()=>HooksContext,StoryStore:()=>StoryStore,UNTARGETED:()=>UNTARGETED,applyHooks:()=>applyHooks,combineArgs:()=>combineArgs,combineParameters:()=>combineParameters,composeConfigs:()=>composeConfigs,composeStepRunners:()=>composeStepRunners,composeStories:()=>composeStories,composeStory:()=>composeStory,decorateStory:()=>decorateStory,deepDiff:()=>deepDiff,defaultDecorateStory:()=>defaultDecorateStory,filterArgTypes:()=>filterArgTypes,getArrayField:()=>getArrayField,getField:()=>getField,getObjectField:()=>getObjectField,getSingletonField:()=>getSingletonField,getValuesFromArgTypes:()=>getValuesFromArgTypes,groupArgsByTarget:()=>groupArgsByTarget,inferControls:()=>inferControls,mapArgsToTypes:()=>mapArgsToTypes,noTargetArgs:()=>noTargetArgs,normalizeComponentAnnotations:()=>normalizeComponentAnnotations,normalizeInputType:()=>normalizeInputType,normalizeInputTypes:()=>normalizeInputTypes,normalizeProjectAnnotations:()=>normalizeProjectAnnotations,normalizeStory:()=>normalizeStory,prepareContext:()=>prepareContext,prepareMeta:()=>prepareMeta,prepareStory:()=>prepareStory,processCSFFile:()=>processCSFFile,sanitizeStoryContextUpdate:()=>sanitizeStoryContextUpdate,setProjectAnnotations:()=>setProjectAnnotations,sortStoriesV6:()=>sortStoriesV6,sortStoriesV7:()=>sortStoriesV7,useAddonState:()=>useAddonState,useArgs:()=>useArgs,useCallback:()=>useCallback,useChannel:()=>useChannel,useEffect:()=>useEffect,useGlobals:()=>useGlobals,useMemo:()=>useMemo,useParameter:()=>useParameter,useReducer:()=>useReducer,useRef:()=>useRef,useSharedState:()=>useSharedState,useState:()=>useState,useStoryContext:()=>useStoryContext,userOrAutoTitle:()=>userOrAutoTitle,userOrAutoTitleFromSpecifier:()=>userOrAutoTitleFromSpecifier,validateOptions:()=>validateOptions});module.exports=__toCommonJS(store_exports);var import_memoizerific2=__toESM(require("memoizerific")),import_mapValues4=__toESM(require("lodash/mapValues.js")),import_pick=__toESM(require("lodash/pick.js")),import_synchronous_promise=require("synchronous-promise");var import_global=require("@storybook/global");var import_channels=require("@storybook/channels");function mockChannel(){let transport={setHandler:()=>{},send:()=>{}};return new import_channels.Channel({transport})}var AddonStore=class{constructor(){this.getChannel=()=>{if(!this.channel){let channel=mockChannel();return this.setChannel(channel),channel}return this.channel};this.getServerChannel=()=>{if(!this.serverChannel)throw new Error("Accessing non-existent serverChannel");return this.serverChannel};this.ready=()=>this.promise;this.hasChannel=()=>!!this.channel;this.hasServerChannel=()=>!!this.serverChannel;this.setChannel=channel=>{this.channel=channel,this.resolve()};this.setServerChannel=channel=>{this.serverChannel=channel};this.promise=new Promise(res=>{this.resolve=()=>res(this.getChannel())})}},KEY="__STORYBOOK_ADDONS_PREVIEW";function getAddonsStore(){return import_global.global[KEY]||(import_global.global[KEY]=new AddonStore),import_global.global[KEY]}var addons=getAddonsStore();var import_global2=require("@storybook/global"),import_client_logger=require("@storybook/client-logger"),import_core_events=require("@storybook/core-events");var HooksContext=class{constructor(){this.hookListsMap=void 0;this.mountedDecorators=void 0;this.prevMountedDecorators=void 0;this.currentHooks=void 0;this.nextHookIndex=void 0;this.currentPhase=void 0;this.currentEffects=void 0;this.prevEffects=void 0;this.currentDecoratorName=void 0;this.hasUpdates=void 0;this.currentContext=void 0;this.renderListener=storyId=>{var _a;storyId===((_a=this.currentContext)==null?void 0:_a.id)&&(this.triggerEffects(),this.currentContext=null,this.removeRenderListeners())};this.init()}init(){this.hookListsMap=new WeakMap,this.mountedDecorators=new Set,this.prevMountedDecorators=new Set,this.currentHooks=[],this.nextHookIndex=0,this.currentPhase="NONE",this.currentEffects=[],this.prevEffects=[],this.currentDecoratorName=null,this.hasUpdates=!1,this.currentContext=null}clean(){this.prevEffects.forEach(effect=>{effect.destroy&&effect.destroy()}),this.init(),this.removeRenderListeners()}getNextHook(){let hook=this.currentHooks[this.nextHookIndex];return this.nextHookIndex+=1,hook}triggerEffects(){this.prevEffects.forEach(effect=>{!this.currentEffects.includes(effect)&&effect.destroy&&effect.destroy()}),this.currentEffects.forEach(effect=>{this.prevEffects.includes(effect)||(effect.destroy=effect.create())}),this.prevEffects=this.currentEffects,this.currentEffects=[]}addRenderListeners(){this.removeRenderListeners(),addons.getChannel().on(import_core_events.STORY_RENDERED,this.renderListener)}removeRenderListeners(){addons.getChannel().removeListener(import_core_events.STORY_RENDERED,this.renderListener)}};function hookify(fn){let hookified=(...args)=>{let{hooks}=typeof args[0]=="function"?args[1]:args[0],prevPhase=hooks.currentPhase,prevHooks=hooks.currentHooks,prevNextHookIndex=hooks.nextHookIndex,prevDecoratorName=hooks.currentDecoratorName;hooks.currentDecoratorName=fn.name,hooks.prevMountedDecorators.has(fn)?(hooks.currentPhase="UPDATE",hooks.currentHooks=hooks.hookListsMap.get(fn)||[]):(hooks.currentPhase="MOUNT",hooks.currentHooks=[],hooks.hookListsMap.set(fn,hooks.currentHooks),hooks.prevMountedDecorators.add(fn)),hooks.nextHookIndex=0;let prevContext=import_global2.global.STORYBOOK_HOOKS_CONTEXT;import_global2.global.STORYBOOK_HOOKS_CONTEXT=hooks;let result=fn(...args);if(import_global2.global.STORYBOOK_HOOKS_CONTEXT=prevContext,hooks.currentPhase==="UPDATE"&&hooks.getNextHook()!=null)throw new Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");return hooks.currentPhase=prevPhase,hooks.currentHooks=prevHooks,hooks.nextHookIndex=prevNextHookIndex,hooks.currentDecoratorName=prevDecoratorName,result};return hookified.originalFn=fn,hookified}var numberOfRenders=0,RENDER_LIMIT=25,applyHooks=applyDecorators=>(storyFn,decorators)=>{let decorated=applyDecorators(hookify(storyFn),decorators.map(decorator=>hookify(decorator)));return context=>{let{hooks}=context;hooks.prevMountedDecorators??=new Set,hooks.mountedDecorators=new Set([storyFn,...decorators]),hooks.currentContext=context,hooks.hasUpdates=!1;let result=decorated(context);for(numberOfRenders=1;hooks.hasUpdates;)if(hooks.hasUpdates=!1,hooks.currentEffects=[],result=decorated(context),numberOfRenders+=1,numberOfRenders>RENDER_LIMIT)throw new Error("Too many re-renders. Storybook limits the number of renders to prevent an infinite loop.");return hooks.addRenderListeners(),result}},areDepsEqual=(deps,nextDeps)=>deps.length===nextDeps.length&&deps.every((dep,i)=>dep===nextDeps[i]),invalidHooksError=()=>new Error("Storybook preview hooks can only be called inside decorators and story functions.");function getHooksContextOrNull(){return import_global2.global.STORYBOOK_HOOKS_CONTEXT||null}function getHooksContextOrThrow(){let hooks=getHooksContextOrNull();if(hooks==null)throw invalidHooksError();return hooks}function useHook(name,callback,deps){let hooks=getHooksContextOrThrow();if(hooks.currentPhase==="MOUNT"){deps!=null&&!Array.isArray(deps)&&import_client_logger.logger.warn(`${name} received a final argument that is not an array (instead, received ${deps}). When specified, the final argument must be an array.`);let hook={name,deps};return hooks.currentHooks.push(hook),callback(hook),hook}if(hooks.currentPhase==="UPDATE"){let hook=hooks.getNextHook();if(hook==null)throw new Error("Rendered more hooks than during the previous render.");return hook.name!==name&&import_client_logger.logger.warn(`Storybook has detected a change in the order of Hooks${hooks.currentDecoratorName?` called by ${hooks.currentDecoratorName}`:""}. This will lead to bugs and errors if not fixed.`),deps!=null&&hook.deps==null&&import_client_logger.logger.warn(`${name} received a final argument during this render, but not during the previous render. Even though the final argument is optional, its type cannot change between renders.`),deps!=null&&hook.deps!=null&&deps.length!==hook.deps.length&&import_client_logger.logger.warn(`The final argument passed to ${name} changed size between renders. The order and size of this array must remain constant. | ||
- Custom args: https://storybook.js.org/docs/react/essentials/controls#fully-custom-args | ||
`),{name:"other",value:"cyclic object"}):(visited.add(value),Array.isArray(value)?{name:"array",value:value.length>0?inferType(value[0],name,new Set(visited)):{name:"other",value:"unknown"}}:{name:"object",value:(0,import_mapValues2.default)(value,field=>inferType(field,name,new Set(visited)))}):{name:"object",value:{}}},inferArgTypes=context=>{let{id,argTypes:userArgTypes={},initialArgs={}}=context,argTypes=(0,import_mapValues2.default)(initialArgs,(arg,key)=>({name:key,type:inferType(arg,`${id}.${key}`,new Set)})),userArgTypesNames=(0,import_mapValues2.default)(userArgTypes,(argType,key)=>({name:key}));return combineParameters(argTypes,userArgTypesNames,userArgTypes)};inferArgTypes.secondPass=!0;var import_mapValues3=__toESM(require("lodash/mapValues.js")),import_client_logger7=require("@storybook/client-logger");var import_pickBy=__toESM(require("lodash/pickBy.js")),matches=(name,descriptor)=>Array.isArray(descriptor)?descriptor.includes(name):name.match(descriptor),filterArgTypes=(argTypes,include,exclude)=>!include&&!exclude?argTypes:argTypes&&(0,import_pickBy.default)(argTypes,(argType,key)=>{let name=argType.name||key;return(!include||matches(name,include))&&(!exclude||!matches(name,exclude))});var inferControl=(argType,name,matchers)=>{let{type,options}=argType;if(type){if(matchers.color&&matchers.color.test(name)){let controlType=type.name;if(controlType==="string")return{control:{type:"color"}};controlType!=="enum"&&import_client_logger7.logger.warn(`Addon controls: Control of type color only supports string, received "${controlType}" instead`)}if(matchers.date&&matchers.date.test(name))return{control:{type:"date"}};switch(type.name){case"array":return{control:{type:"object"}};case"boolean":return{control:{type:"boolean"}};case"string":return{control:{type:"text"}};case"number":return{control:{type:"number"}};case"enum":{let{value}=type;return{control:{type:(value==null?void 0:value.length)<=5?"radio":"select"},options:value}}case"function":case"symbol":return null;default:return{control:{type:options?"select":"object"}}}}},inferControls=context=>{let{argTypes,parameters:{__isArgsStory,controls:{include=null,exclude=null,matchers={}}={}}}=context;if(!__isArgsStory)return argTypes;let filteredArgTypes=filterArgTypes(argTypes,include,exclude),withControls=(0,import_mapValues3.default)(filteredArgTypes,(argType,name)=>(argType==null?void 0:argType.type)&&inferControl(argType,name,matchers));return combineParameters(withControls,filteredArgTypes)};inferControls.secondPass=!0;function normalizeProjectAnnotations({argTypes,globalTypes,argTypesEnhancers,...annotations}){return{...argTypes&&{argTypes:normalizeInputTypes(argTypes)},...globalTypes&&{globalTypes:normalizeInputTypes(globalTypes)},argTypesEnhancers:[...argTypesEnhancers||[],inferArgTypes,inferControls],...annotations}}var import_global4=require("@storybook/global");function composeStepRunners(stepRunners){return async(label,play,playContext)=>{await stepRunners.reduceRight((innerPlay,stepRunner)=>async()=>stepRunner(label,innerPlay,playContext),async()=>play(playContext))()}}function getField(moduleExportList,field){return moduleExportList.map(xs=>{var _a;return((_a=xs.default)==null?void 0:_a[field])??xs[field]}).filter(Boolean)}function getArrayField(moduleExportList,field,options={}){return getField(moduleExportList,field).reduce((a,b)=>options.reverseFileOrder?[...b,...a]:[...a,...b],[])}function getObjectField(moduleExportList,field){return Object.assign({},...getField(moduleExportList,field))}function getSingletonField(moduleExportList,field){return getField(moduleExportList,field).pop()}function composeConfigs(moduleExportList){var _a;let allArgTypeEnhancers=getArrayField(moduleExportList,"argTypesEnhancers"),stepRunners=getField(moduleExportList,"runStep");return{parameters:combineParameters(...getField(moduleExportList,"parameters")),decorators:getArrayField(moduleExportList,"decorators",{reverseFileOrder:!(((_a=import_global4.global.FEATURES)==null?void 0:_a.legacyDecoratorFileOrder)??!1)}),args:getObjectField(moduleExportList,"args"),argsEnhancers:getArrayField(moduleExportList,"argsEnhancers"),argTypes:getObjectField(moduleExportList,"argTypes"),argTypesEnhancers:[...allArgTypeEnhancers.filter(e=>!e.secondPass),...allArgTypeEnhancers.filter(e=>e.secondPass)],globals:getObjectField(moduleExportList,"globals"),globalTypes:getObjectField(moduleExportList,"globalTypes"),loaders:getArrayField(moduleExportList,"loaders"),render:getSingletonField(moduleExportList,"render"),renderToCanvas:getSingletonField(moduleExportList,"renderToCanvas"),renderToDOM:getSingletonField(moduleExportList,"renderToDOM"),applyDecorators:getSingletonField(moduleExportList,"applyDecorators"),runStep:composeStepRunners(stepRunners)}}var import_csf5=require("@storybook/csf");var GLOBAL_STORYBOOK_PROJECT_ANNOTATIONS=composeConfigs([]);function setProjectAnnotations(projectAnnotations){let annotations=Array.isArray(projectAnnotations)?projectAnnotations:[projectAnnotations];GLOBAL_STORYBOOK_PROJECT_ANNOTATIONS=composeConfigs(annotations)}function composeStory(storyAnnotations,componentAnnotations,projectAnnotations=GLOBAL_STORYBOOK_PROJECT_ANNOTATIONS,defaultConfig={},exportsName){var _a;if(storyAnnotations===void 0)throw new Error("Expected a story but received undefined.");componentAnnotations.title=componentAnnotations.title??"ComposedStory";let normalizedComponentAnnotations=normalizeComponentAnnotations(componentAnnotations),storyName=exportsName||storyAnnotations.storyName||((_a=storyAnnotations.story)==null?void 0:_a.name)||storyAnnotations.name||"unknown",normalizedStory=normalizeStory(storyName,storyAnnotations,normalizedComponentAnnotations),normalizedProjectAnnotations=normalizeProjectAnnotations({...projectAnnotations,...defaultConfig}),story=prepareStory(normalizedStory,normalizedComponentAnnotations,normalizedProjectAnnotations),defaultGlobals=getValuesFromArgTypes(projectAnnotations.globalTypes),composedStory=extraArgs=>{let context={...story,hooks:new HooksContext,globals:defaultGlobals,args:{...story.initialArgs,...extraArgs}};return story.unboundStoryFn(prepareContext(context))};return composedStory.storyName=storyName,composedStory.args=story.initialArgs,composedStory.play=story.playFunction,composedStory.parameters=story.parameters,composedStory.id=story.id,composedStory}function composeStories(storiesImport,globalConfig,composeStoryFn){let{default:meta,__esModule,__namedExportsOrder,...stories}=storiesImport;return Object.entries(stories).reduce((storiesMap,[exportsName,story])=>(0,import_csf5.isExportStory)(exportsName,meta)?Object.assign(storiesMap,{[exportsName]:composeStoryFn(story,meta,globalConfig,exportsName)}):storiesMap,{})}var CSF_CACHE_SIZE=1e3,STORY_CACHE_SIZE=1e4,EXTRACT_BATCH_SIZE=20,StoryStore=class{constructor(){this.getStoriesJsonData=()=>{let{storyIndex}=this;if(!storyIndex)throw new Error("getStoriesJsonData called before initialization");let value=this.getSetStoriesPayload(),allowedParameters=["fileName","docsOnly","framework","__id","__isArgsStory"];return{v:3,stories:(0,import_mapValues4.default)(value.stories,story=>{let{importPath}=storyIndex.entries[story.id];return{...(0,import_pick.default)(story,["id","name","title"]),importPath,kind:story.title,story:story.name,parameters:{...(0,import_pick.default)(story.parameters,allowedParameters),fileName:importPath}}})}};this.args=new ArgsStore,this.hooks={},this.processCSFFileWithCache=(0,import_memoizerific2.default)(CSF_CACHE_SIZE)(processCSFFile),this.prepareMetaWithCache=(0,import_memoizerific2.default)(CSF_CACHE_SIZE)(prepareMeta),this.prepareStoryWithCache=(0,import_memoizerific2.default)(STORY_CACHE_SIZE)(prepareStory),this.initializationPromise=new import_synchronous_promise.SynchronousPromise(resolve=>{this.resolveInitializationPromise=resolve})}setProjectAnnotations(projectAnnotations){this.projectAnnotations=normalizeProjectAnnotations(projectAnnotations);let{globals,globalTypes}=projectAnnotations;this.globals?this.globals.set({globals,globalTypes}):this.globals=new GlobalsStore({globals,globalTypes})}initialize({storyIndex,importFn,cache=!1}){return this.storyIndex=new StoryIndexStore(storyIndex),this.importFn=importFn,this.resolveInitializationPromise(),cache?this.cacheAllCSFFiles():import_synchronous_promise.SynchronousPromise.resolve()}async onStoriesChanged({importFn,storyIndex}){await this.initializationPromise,importFn&&(this.importFn=importFn),storyIndex&&(this.storyIndex.entries=storyIndex.entries),this.cachedCSFFiles&&await this.cacheAllCSFFiles()}async storyIdToEntry(storyId){return await this.initializationPromise,this.storyIndex.storyIdToEntry(storyId)}loadCSFFileByStoryId(storyId){if(!this.storyIndex||!this.importFn)throw new Error("loadCSFFileByStoryId called before initialization");let{importPath,title}=this.storyIndex.storyIdToEntry(storyId);return this.importFn(importPath).then(moduleExports=>this.processCSFFileWithCache(moduleExports,importPath,title))}loadAllCSFFiles({batchSize=EXTRACT_BATCH_SIZE}={}){if(!this.storyIndex)throw new Error("loadAllCSFFiles called before initialization");let importPaths=Object.entries(this.storyIndex.entries).map(([storyId,{importPath}])=>[importPath,storyId]),loadInBatches=remainingImportPaths=>{if(remainingImportPaths.length===0)return import_synchronous_promise.SynchronousPromise.resolve([]);let csfFilePromiseList=remainingImportPaths.slice(0,batchSize).map(([importPath,storyId])=>this.loadCSFFileByStoryId(storyId).then(csfFile=>({importPath,csfFile})));return import_synchronous_promise.SynchronousPromise.all(csfFilePromiseList).then(firstResults=>loadInBatches(remainingImportPaths.slice(batchSize)).then(restResults=>firstResults.concat(restResults)))};return loadInBatches(importPaths).then(list=>list.reduce((acc,{importPath,csfFile})=>(acc[importPath]=csfFile,acc),{}))}cacheAllCSFFiles(){return this.initializationPromise.then(()=>this.loadAllCSFFiles().then(csfFiles=>{this.cachedCSFFiles=csfFiles}))}preparedMetaFromCSFFile({csfFile}){if(!this.projectAnnotations)throw new Error("storyFromCSFFile called before initialization");let componentAnnotations=csfFile.meta;return this.prepareMetaWithCache(componentAnnotations,this.projectAnnotations,csfFile.moduleExports.default)}async loadStory({storyId}){await this.initializationPromise;let csfFile=await this.loadCSFFileByStoryId(storyId);return this.storyFromCSFFile({storyId,csfFile})}storyFromCSFFile({storyId,csfFile}){if(!this.projectAnnotations)throw new Error("storyFromCSFFile called before initialization");let storyAnnotations=csfFile.stories[storyId];if(!storyAnnotations)throw new Error(`Didn't find '${storyId}' in CSF file, this is unexpected`);let componentAnnotations=csfFile.meta,story=this.prepareStoryWithCache(storyAnnotations,componentAnnotations,this.projectAnnotations);return this.args.setInitial(story),this.hooks[story.id]=this.hooks[story.id]||new HooksContext,story}componentStoriesFromCSFFile({csfFile}){if(!this.storyIndex)throw new Error("componentStoriesFromCSFFile called before initialization");return Object.keys(this.storyIndex.entries).filter(storyId=>!!csfFile.stories[storyId]).map(storyId=>this.storyFromCSFFile({storyId,csfFile}))}async loadEntry(id){let entry=await this.storyIdToEntry(id),{importFn,storyIndex}=this;if(!storyIndex||!importFn)throw new Error("loadEntry called before initialization");let storyImports=entry.type==="docs"?entry.storiesImports:[],[entryExports,...csfFiles]=await Promise.all([importFn(entry.importPath),...storyImports.map(storyImportPath=>{let firstStoryEntry=storyIndex.importPathToEntry(storyImportPath);return this.loadCSFFileByStoryId(firstStoryEntry.id)})]);return{entryExports,csfFiles}}getStoryContext(story,{forceInitialArgs=!1}={}){if(!this.globals)throw new Error("getStoryContext called before initialization");return prepareContext({...story,args:forceInitialArgs?story.initialArgs:this.args.get(story.id),globals:this.globals.get(),hooks:this.hooks[story.id]})}cleanupStory(story){this.hooks[story.id].clean()}extract(options={includeDocsOnly:!1}){if(!this.storyIndex)throw new Error("extract called before initialization");let{cachedCSFFiles}=this;if(!cachedCSFFiles)throw new Error("Cannot call extract() unless you call cacheAllCSFFiles() first.");return Object.entries(this.storyIndex.entries).reduce((acc,[storyId,{type,importPath}])=>{if(type==="docs")return acc;let csfFile=cachedCSFFiles[importPath],story=this.storyFromCSFFile({storyId,csfFile});return!options.includeDocsOnly&&story.parameters.docsOnly||(acc[storyId]=Object.entries(story).reduce((storyAcc,[key,value])=>key==="moduleExport"||typeof value=="function"?storyAcc:Array.isArray(value)?Object.assign(storyAcc,{[key]:value.slice().sort()}):Object.assign(storyAcc,{[key]:value}),{args:story.initialArgs})),acc},{})}getSetStoriesPayload(){if(!this.globals)throw new Error("getSetStoriesPayload called before initialization");let stories=this.extract({includeDocsOnly:!0}),kindParameters=Object.values(stories).reduce((acc,{title})=>(acc[title]={},acc),{});return{v:2,globals:this.globals.get(),globalParameters:{},kindParameters,stories}}getSetIndexPayload(){if(!this.storyIndex)throw new Error("getSetIndexPayload called before initialization");if(!this.cachedCSFFiles)throw new Error("Cannot call getSetIndexPayload() unless you call cacheAllCSFFiles() first");let{cachedCSFFiles}=this,stories=this.extract({includeDocsOnly:!0});return{v:4,entries:Object.fromEntries(Object.entries(this.storyIndex.entries).map(([id,entry])=>[id,stories[id]?{...entry,args:stories[id].initialArgs,initialArgs:stories[id].initialArgs,argTypes:stories[id].argTypes,parameters:stories[id].parameters}:{...entry,parameters:this.preparedMetaFromCSFFile({csfFile:cachedCSFFiles[entry.importPath]}).parameters}]))}}raw(){return Object.values(this.extract()).map(({id})=>this.fromId(id)).filter(Boolean)}fromId(storyId){if(!this.storyIndex)throw new Error("fromId called before initialization");if(!this.cachedCSFFiles)throw new Error("Cannot call fromId/raw() unless you call cacheAllCSFFiles() first.");let importPath;try{({importPath}=this.storyIndex.storyIdToEntry(storyId))}catch{return null}let csfFile=this.cachedCSFFiles[importPath],story=this.storyFromCSFFile({storyId,csfFile});return{...story,storyFn:update=>{let context={...this.getStoryContext(story),viewMode:"story"};return story.unboundStoryFn({...context,...update})}}}};var import_core_events2=require("@storybook/core-events");function useSharedState(sharedId,defaultState){let channel=addons.getChannel(),[lastValue]=channel.last(`${import_core_events2.SHARED_STATE_CHANGED}-manager-${sharedId}`)||channel.last(`${import_core_events2.SHARED_STATE_SET}-manager-${sharedId}`)||[],[state,setState]=useState(lastValue||defaultState),allListeners=useMemo(()=>({[`${import_core_events2.SHARED_STATE_CHANGED}-manager-${sharedId}`]:s=>setState(s),[`${import_core_events2.SHARED_STATE_SET}-manager-${sharedId}`]:s=>setState(s)}),[sharedId]),emit=useChannel(allListeners,[sharedId]);return useEffect(()=>{defaultState!==void 0&&!lastValue&&emit(`${import_core_events2.SHARED_STATE_SET}-client-${sharedId}`,defaultState)},[sharedId]),[state,s=>{setState(s),emit(`${import_core_events2.SHARED_STATE_CHANGED}-client-${sharedId}`,s)}]}function useAddonState(addonId,defaultState){return useSharedState(addonId,defaultState)}function slash(path){return path.startsWith("\\\\?\\")?path:path.replace(/\\/g,"/")}var import_ts_dedent6=require("ts-dedent"),import_client_logger8=require("@storybook/client-logger"),stripExtension=path=>{let parts=[...path],last=parts[parts.length-1],dotIndex=last.indexOf("."),stripped=dotIndex>0?last.substr(0,dotIndex):last;parts[parts.length-1]=stripped;let[first,...rest]=parts;return first===""&&(parts=rest),parts},indexRe=/^index$/i,removeRedundantFilename=paths=>{let prevVal;return paths.filter((val,index)=>index===paths.length-1&&(val===prevVal||indexRe.test(val))?!1:(prevVal=val,!0))};function pathJoin(paths){let slashes=new RegExp("/{1,}","g");return paths.join("/").replace(slashes,"/")}var userOrAutoTitleFromSpecifier=(fileName,entry,userTitle)=>{let{directory,importPathMatcher,titlePrefix=""}=entry||{};typeof fileName=="number"&&import_client_logger8.once.warn(import_ts_dedent6.dedent` | ||
`),{name:"other",value:"cyclic object"}):(visited.add(value),Array.isArray(value)?{name:"array",value:value.length>0?inferType(value[0],name,new Set(visited)):{name:"other",value:"unknown"}}:{name:"object",value:(0,import_mapValues2.default)(value,field=>inferType(field,name,new Set(visited)))}):{name:"object",value:{}}},inferArgTypes=context=>{let{id,argTypes:userArgTypes={},initialArgs={}}=context,argTypes=(0,import_mapValues2.default)(initialArgs,(arg,key)=>({name:key,type:inferType(arg,`${id}.${key}`,new Set)})),userArgTypesNames=(0,import_mapValues2.default)(userArgTypes,(argType,key)=>({name:key}));return combineParameters(argTypes,userArgTypesNames,userArgTypes)};inferArgTypes.secondPass=!0;var import_mapValues3=__toESM(require("lodash/mapValues.js")),import_client_logger7=require("@storybook/client-logger");var import_pickBy=__toESM(require("lodash/pickBy.js")),matches=(name,descriptor)=>Array.isArray(descriptor)?descriptor.includes(name):name.match(descriptor),filterArgTypes=(argTypes,include,exclude)=>!include&&!exclude?argTypes:argTypes&&(0,import_pickBy.default)(argTypes,(argType,key)=>{let name=argType.name||key;return(!include||matches(name,include))&&(!exclude||!matches(name,exclude))});var inferControl=(argType,name,matchers)=>{let{type,options}=argType;if(type){if(matchers.color&&matchers.color.test(name)){let controlType=type.name;if(controlType==="string")return{control:{type:"color"}};controlType!=="enum"&&import_client_logger7.logger.warn(`Addon controls: Control of type color only supports string, received "${controlType}" instead`)}if(matchers.date&&matchers.date.test(name))return{control:{type:"date"}};switch(type.name){case"array":return{control:{type:"object"}};case"boolean":return{control:{type:"boolean"}};case"string":return{control:{type:"text"}};case"number":return{control:{type:"number"}};case"enum":{let{value}=type;return{control:{type:(value==null?void 0:value.length)<=5?"radio":"select"},options:value}}case"function":case"symbol":return null;default:return{control:{type:options?"select":"object"}}}}},inferControls=context=>{let{argTypes,parameters:{__isArgsStory,controls:{include=null,exclude=null,matchers={}}={}}}=context;if(!__isArgsStory)return argTypes;let filteredArgTypes=filterArgTypes(argTypes,include,exclude),withControls=(0,import_mapValues3.default)(filteredArgTypes,(argType,name)=>(argType==null?void 0:argType.type)&&inferControl(argType,name,matchers));return combineParameters(withControls,filteredArgTypes)};inferControls.secondPass=!0;function normalizeProjectAnnotations({argTypes,globalTypes,argTypesEnhancers,...annotations}){return{...argTypes&&{argTypes:normalizeInputTypes(argTypes)},...globalTypes&&{globalTypes:normalizeInputTypes(globalTypes)},argTypesEnhancers:[...argTypesEnhancers||[],inferArgTypes,inferControls],...annotations}}var import_global4=require("@storybook/global");function composeStepRunners(stepRunners){return async(label,play,playContext)=>{await stepRunners.reduceRight((innerPlay,stepRunner)=>async()=>stepRunner(label,innerPlay,playContext),async()=>play(playContext))()}}function getField(moduleExportList,field){return moduleExportList.map(xs=>{var _a;return((_a=xs.default)==null?void 0:_a[field])??xs[field]}).filter(Boolean)}function getArrayField(moduleExportList,field,options={}){return getField(moduleExportList,field).reduce((a,b)=>options.reverseFileOrder?[...b,...a]:[...a,...b],[])}function getObjectField(moduleExportList,field){return Object.assign({},...getField(moduleExportList,field))}function getSingletonField(moduleExportList,field){return getField(moduleExportList,field).pop()}function composeConfigs(moduleExportList){var _a;let allArgTypeEnhancers=getArrayField(moduleExportList,"argTypesEnhancers"),stepRunners=getField(moduleExportList,"runStep");return{parameters:combineParameters(...getField(moduleExportList,"parameters")),decorators:getArrayField(moduleExportList,"decorators",{reverseFileOrder:!(((_a=import_global4.global.FEATURES)==null?void 0:_a.legacyDecoratorFileOrder)??!1)}),args:getObjectField(moduleExportList,"args"),argsEnhancers:getArrayField(moduleExportList,"argsEnhancers"),argTypes:getObjectField(moduleExportList,"argTypes"),argTypesEnhancers:[...allArgTypeEnhancers.filter(e=>!e.secondPass),...allArgTypeEnhancers.filter(e=>e.secondPass)],globals:getObjectField(moduleExportList,"globals"),globalTypes:getObjectField(moduleExportList,"globalTypes"),loaders:getArrayField(moduleExportList,"loaders"),render:getSingletonField(moduleExportList,"render"),renderToCanvas:getSingletonField(moduleExportList,"renderToCanvas"),renderToDOM:getSingletonField(moduleExportList,"renderToDOM"),applyDecorators:getSingletonField(moduleExportList,"applyDecorators"),runStep:composeStepRunners(stepRunners)}}var import_csf5=require("@storybook/csf");var GLOBAL_STORYBOOK_PROJECT_ANNOTATIONS=composeConfigs([]);function setProjectAnnotations(projectAnnotations){let annotations=Array.isArray(projectAnnotations)?projectAnnotations:[projectAnnotations];GLOBAL_STORYBOOK_PROJECT_ANNOTATIONS=composeConfigs(annotations)}function composeStory(storyAnnotations,componentAnnotations,projectAnnotations=GLOBAL_STORYBOOK_PROJECT_ANNOTATIONS,defaultConfig={},exportsName){var _a;if(storyAnnotations===void 0)throw new Error("Expected a story but received undefined.");componentAnnotations.title=componentAnnotations.title??"ComposedStory";let normalizedComponentAnnotations=normalizeComponentAnnotations(componentAnnotations),storyName=exportsName||storyAnnotations.storyName||((_a=storyAnnotations.story)==null?void 0:_a.name)||storyAnnotations.name||"unknown",normalizedStory=normalizeStory(storyName,storyAnnotations,normalizedComponentAnnotations),normalizedProjectAnnotations=normalizeProjectAnnotations({...projectAnnotations,...defaultConfig}),story=prepareStory(normalizedStory,normalizedComponentAnnotations,normalizedProjectAnnotations),defaultGlobals=getValuesFromArgTypes(projectAnnotations.globalTypes);return Object.assign(extraArgs=>{let context={...story,hooks:new HooksContext,globals:defaultGlobals,args:{...story.initialArgs,...extraArgs}};return story.unboundStoryFn(prepareContext(context))},{storyName,args:story.initialArgs,play:story.playFunction,parameters:story.parameters,id:story.id})}function composeStories(storiesImport,globalConfig,composeStoryFn){let{default:meta,__esModule,__namedExportsOrder,...stories}=storiesImport;return Object.entries(stories).reduce((storiesMap,[exportsName,story])=>(0,import_csf5.isExportStory)(exportsName,meta)?Object.assign(storiesMap,{[exportsName]:composeStoryFn(story,meta,globalConfig,exportsName)}):storiesMap,{})}var CSF_CACHE_SIZE=1e3,STORY_CACHE_SIZE=1e4,EXTRACT_BATCH_SIZE=20,StoryStore=class{constructor(){this.getStoriesJsonData=()=>{let{storyIndex}=this;if(!storyIndex)throw new Error("getStoriesJsonData called before initialization");let value=this.getSetStoriesPayload(),allowedParameters=["fileName","docsOnly","framework","__id","__isArgsStory"];return{v:3,stories:(0,import_mapValues4.default)(value.stories,story=>{let{importPath}=storyIndex.entries[story.id];return{...(0,import_pick.default)(story,["id","name","title"]),importPath,kind:story.title,story:story.name,parameters:{...(0,import_pick.default)(story.parameters,allowedParameters),fileName:importPath}}})}};this.args=new ArgsStore,this.hooks={},this.processCSFFileWithCache=(0,import_memoizerific2.default)(CSF_CACHE_SIZE)(processCSFFile),this.prepareMetaWithCache=(0,import_memoizerific2.default)(CSF_CACHE_SIZE)(prepareMeta),this.prepareStoryWithCache=(0,import_memoizerific2.default)(STORY_CACHE_SIZE)(prepareStory),this.initializationPromise=new import_synchronous_promise.SynchronousPromise(resolve=>{this.resolveInitializationPromise=resolve})}setProjectAnnotations(projectAnnotations){this.projectAnnotations=normalizeProjectAnnotations(projectAnnotations);let{globals,globalTypes}=projectAnnotations;this.globals?this.globals.set({globals,globalTypes}):this.globals=new GlobalsStore({globals,globalTypes})}initialize({storyIndex,importFn,cache=!1}){return this.storyIndex=new StoryIndexStore(storyIndex),this.importFn=importFn,this.resolveInitializationPromise(),cache?this.cacheAllCSFFiles():import_synchronous_promise.SynchronousPromise.resolve()}async onStoriesChanged({importFn,storyIndex}){await this.initializationPromise,importFn&&(this.importFn=importFn),storyIndex&&(this.storyIndex.entries=storyIndex.entries),this.cachedCSFFiles&&await this.cacheAllCSFFiles()}async storyIdToEntry(storyId){return await this.initializationPromise,this.storyIndex.storyIdToEntry(storyId)}loadCSFFileByStoryId(storyId){if(!this.storyIndex||!this.importFn)throw new Error("loadCSFFileByStoryId called before initialization");let{importPath,title}=this.storyIndex.storyIdToEntry(storyId);return this.importFn(importPath).then(moduleExports=>this.processCSFFileWithCache(moduleExports,importPath,title))}loadAllCSFFiles({batchSize=EXTRACT_BATCH_SIZE}={}){if(!this.storyIndex)throw new Error("loadAllCSFFiles called before initialization");let importPaths=Object.entries(this.storyIndex.entries).map(([storyId,{importPath}])=>[importPath,storyId]),loadInBatches=remainingImportPaths=>{if(remainingImportPaths.length===0)return import_synchronous_promise.SynchronousPromise.resolve([]);let csfFilePromiseList=remainingImportPaths.slice(0,batchSize).map(([importPath,storyId])=>this.loadCSFFileByStoryId(storyId).then(csfFile=>({importPath,csfFile})));return import_synchronous_promise.SynchronousPromise.all(csfFilePromiseList).then(firstResults=>loadInBatches(remainingImportPaths.slice(batchSize)).then(restResults=>firstResults.concat(restResults)))};return loadInBatches(importPaths).then(list=>list.reduce((acc,{importPath,csfFile})=>(acc[importPath]=csfFile,acc),{}))}cacheAllCSFFiles(){return this.initializationPromise.then(()=>this.loadAllCSFFiles().then(csfFiles=>{this.cachedCSFFiles=csfFiles}))}preparedMetaFromCSFFile({csfFile}){if(!this.projectAnnotations)throw new Error("storyFromCSFFile called before initialization");let componentAnnotations=csfFile.meta;return this.prepareMetaWithCache(componentAnnotations,this.projectAnnotations,csfFile.moduleExports.default)}async loadStory({storyId}){await this.initializationPromise;let csfFile=await this.loadCSFFileByStoryId(storyId);return this.storyFromCSFFile({storyId,csfFile})}storyFromCSFFile({storyId,csfFile}){if(!this.projectAnnotations)throw new Error("storyFromCSFFile called before initialization");let storyAnnotations=csfFile.stories[storyId];if(!storyAnnotations)throw new Error(`Didn't find '${storyId}' in CSF file, this is unexpected`);let componentAnnotations=csfFile.meta,story=this.prepareStoryWithCache(storyAnnotations,componentAnnotations,this.projectAnnotations);return this.args.setInitial(story),this.hooks[story.id]=this.hooks[story.id]||new HooksContext,story}componentStoriesFromCSFFile({csfFile}){if(!this.storyIndex)throw new Error("componentStoriesFromCSFFile called before initialization");return Object.keys(this.storyIndex.entries).filter(storyId=>!!csfFile.stories[storyId]).map(storyId=>this.storyFromCSFFile({storyId,csfFile}))}async loadEntry(id){let entry=await this.storyIdToEntry(id),{importFn,storyIndex}=this;if(!storyIndex||!importFn)throw new Error("loadEntry called before initialization");let storyImports=entry.type==="docs"?entry.storiesImports:[],[entryExports,...csfFiles]=await Promise.all([importFn(entry.importPath),...storyImports.map(storyImportPath=>{let firstStoryEntry=storyIndex.importPathToEntry(storyImportPath);return this.loadCSFFileByStoryId(firstStoryEntry.id)})]);return{entryExports,csfFiles}}getStoryContext(story,{forceInitialArgs=!1}={}){if(!this.globals)throw new Error("getStoryContext called before initialization");return prepareContext({...story,args:forceInitialArgs?story.initialArgs:this.args.get(story.id),globals:this.globals.get(),hooks:this.hooks[story.id]})}cleanupStory(story){this.hooks[story.id].clean()}extract(options={includeDocsOnly:!1}){if(!this.storyIndex)throw new Error("extract called before initialization");let{cachedCSFFiles}=this;if(!cachedCSFFiles)throw new Error("Cannot call extract() unless you call cacheAllCSFFiles() first.");return Object.entries(this.storyIndex.entries).reduce((acc,[storyId,{type,importPath}])=>{if(type==="docs")return acc;let csfFile=cachedCSFFiles[importPath],story=this.storyFromCSFFile({storyId,csfFile});return!options.includeDocsOnly&&story.parameters.docsOnly||(acc[storyId]=Object.entries(story).reduce((storyAcc,[key,value])=>key==="moduleExport"||typeof value=="function"?storyAcc:Array.isArray(value)?Object.assign(storyAcc,{[key]:value.slice().sort()}):Object.assign(storyAcc,{[key]:value}),{args:story.initialArgs})),acc},{})}getSetStoriesPayload(){if(!this.globals)throw new Error("getSetStoriesPayload called before initialization");let stories=this.extract({includeDocsOnly:!0}),kindParameters=Object.values(stories).reduce((acc,{title})=>(acc[title]={},acc),{});return{v:2,globals:this.globals.get(),globalParameters:{},kindParameters,stories}}getSetIndexPayload(){if(!this.storyIndex)throw new Error("getSetIndexPayload called before initialization");if(!this.cachedCSFFiles)throw new Error("Cannot call getSetIndexPayload() unless you call cacheAllCSFFiles() first");let{cachedCSFFiles}=this,stories=this.extract({includeDocsOnly:!0});return{v:4,entries:Object.fromEntries(Object.entries(this.storyIndex.entries).map(([id,entry])=>[id,stories[id]?{...entry,args:stories[id].initialArgs,initialArgs:stories[id].initialArgs,argTypes:stories[id].argTypes,parameters:stories[id].parameters}:{...entry,parameters:this.preparedMetaFromCSFFile({csfFile:cachedCSFFiles[entry.importPath]}).parameters}]))}}raw(){return Object.values(this.extract()).map(({id})=>this.fromId(id)).filter(Boolean)}fromId(storyId){if(!this.storyIndex)throw new Error("fromId called before initialization");if(!this.cachedCSFFiles)throw new Error("Cannot call fromId/raw() unless you call cacheAllCSFFiles() first.");let importPath;try{({importPath}=this.storyIndex.storyIdToEntry(storyId))}catch{return null}let csfFile=this.cachedCSFFiles[importPath],story=this.storyFromCSFFile({storyId,csfFile});return{...story,storyFn:update=>{let context={...this.getStoryContext(story),viewMode:"story"};return story.unboundStoryFn({...context,...update})}}}};var import_core_events2=require("@storybook/core-events");function useSharedState(sharedId,defaultState){let channel=addons.getChannel(),[lastValue]=channel.last(`${import_core_events2.SHARED_STATE_CHANGED}-manager-${sharedId}`)||channel.last(`${import_core_events2.SHARED_STATE_SET}-manager-${sharedId}`)||[],[state,setState]=useState(lastValue||defaultState),allListeners=useMemo(()=>({[`${import_core_events2.SHARED_STATE_CHANGED}-manager-${sharedId}`]:s=>setState(s),[`${import_core_events2.SHARED_STATE_SET}-manager-${sharedId}`]:s=>setState(s)}),[sharedId]),emit=useChannel(allListeners,[sharedId]);return useEffect(()=>{defaultState!==void 0&&!lastValue&&emit(`${import_core_events2.SHARED_STATE_SET}-client-${sharedId}`,defaultState)},[sharedId]),[state,s=>{setState(s),emit(`${import_core_events2.SHARED_STATE_CHANGED}-client-${sharedId}`,s)}]}function useAddonState(addonId,defaultState){return useSharedState(addonId,defaultState)}function slash(path){return path.startsWith("\\\\?\\")?path:path.replace(/\\/g,"/")}var import_ts_dedent6=require("ts-dedent"),import_client_logger8=require("@storybook/client-logger"),stripExtension=path=>{let parts=[...path],last=parts[parts.length-1],dotIndex=last.indexOf("."),stripped=dotIndex>0?last.substr(0,dotIndex):last;parts[parts.length-1]=stripped;let[first,...rest]=parts;return first===""&&(parts=rest),parts},indexRe=/^index$/i,removeRedundantFilename=paths=>{let prevVal;return paths.filter((val,index)=>index===paths.length-1&&(val===prevVal||indexRe.test(val))?!1:(prevVal=val,!0))};function pathJoin(paths){let slashes=new RegExp("/{1,}","g");return paths.join("/").replace(slashes,"/")}var userOrAutoTitleFromSpecifier=(fileName,entry,userTitle)=>{let{directory,importPathMatcher,titlePrefix=""}=entry||{};typeof fileName=="number"&&import_client_logger8.once.warn(import_ts_dedent6.dedent` | ||
CSF Auto-title received a numeric fileName. This typically happens when | ||
@@ -32,0 +32,0 @@ webpack is mis-configured in production mode. To force webpack to produce |
{ | ||
"name": "@storybook/preview-api", | ||
"version": "0.0.0-pr-23435-sha-7496d4ba", | ||
"version": "0.0.0-pr-23435-sha-bd98198e", | ||
"description": "", | ||
@@ -70,8 +70,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@storybook/channels": "0.0.0-pr-23435-sha-7496d4ba", | ||
"@storybook/client-logger": "0.0.0-pr-23435-sha-7496d4ba", | ||
"@storybook/core-events": "0.0.0-pr-23435-sha-7496d4ba", | ||
"@storybook/channels": "0.0.0-pr-23435-sha-bd98198e", | ||
"@storybook/client-logger": "0.0.0-pr-23435-sha-bd98198e", | ||
"@storybook/core-events": "0.0.0-pr-23435-sha-bd98198e", | ||
"@storybook/csf": "^0.1.0", | ||
"@storybook/global": "^5.0.0", | ||
"@storybook/types": "0.0.0-pr-23435-sha-7496d4ba", | ||
"@storybook/types": "0.0.0-pr-23435-sha-bd98198e", | ||
"@types/qs": "^6.9.5", | ||
@@ -88,3 +88,3 @@ "dequal": "^2.0.2", | ||
"@jest/globals": "^29.5.0", | ||
"@storybook/core-common": "0.0.0-pr-23435-sha-7496d4ba", | ||
"@storybook/core-common": "0.0.0-pr-23435-sha-bd98198e", | ||
"ansi-to-html": "^0.6.11", | ||
@@ -91,0 +91,0 @@ "react": "^16.14.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12
790289
+ Added@storybook/channels@0.0.0-pr-23435-sha-bd98198e(transitive)
+ Added@storybook/client-logger@0.0.0-pr-23435-sha-bd98198e(transitive)
+ Added@storybook/core-events@0.0.0-pr-23435-sha-bd98198e(transitive)
+ Added@storybook/types@0.0.0-pr-23435-sha-bd98198e(transitive)
+ Added@types/node@22.9.1(transitive)
- Removed@storybook/channels@0.0.0-pr-23435-sha-7496d4ba(transitive)
- Removed@storybook/client-logger@0.0.0-pr-23435-sha-7496d4ba(transitive)
- Removed@storybook/core-events@0.0.0-pr-23435-sha-7496d4ba(transitive)
- Removed@storybook/types@0.0.0-pr-23435-sha-7496d4ba(transitive)
- Removed@types/node@22.9.0(transitive)