2024-06-16 17:30:30 +02:00
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 _ _require = ( x2 => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy ( x2 , { get : ( a , b ) => ( typeof require < "u" ? require : a ) [ b ] } ) : x2 ) ( function ( x2 ) { if ( typeof require < "u" ) return require . apply ( this , arguments ) ; throw Error ( 'Dynamic require of "' + x2 + '" is not supported' ) } ) ; var _ _commonJS = ( cb , mod ) => function ( ) { return mod || ( 0 , cb [ _ _getOwnPropNames ( cb ) [ 0 ] ] ) ( ( mod = { exports : { } } ) . exports , mod ) , mod . exports } ; var _ _export = ( target , all ) => { for ( var name2 in all ) _ _defProp ( target , name2 , { get : all [ name2 ] , enumerable : ! 0 } ) } , _ _copyProps = ( to , from , except , desc ) => { if ( from && typeof from == "object" || typeof from == "function" ) for ( let key2 of _ _getOwnPropNames ( from ) ) ! _ _hasOwnProp . call ( to , key2 ) && key2 !== except && _ _defProp ( to , key2 , { get : ( ) => from [ key2 ] , enumerable : ! ( desc = _ _getOwnPropDesc ( from , key2 ) ) || 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 ) ) ; var require _memoizerific = _ _commonJS ( { "../../node_modules/memoizerific/memoizerific.js" ( exports , module ) { "use strict" ; ( function ( f3 ) { if ( typeof exports == "object" && typeof module < "u" ) module . exports = f3 ( ) ; else if ( typeof define == "function" && define . amd ) define ( [ ] , f3 ) ; else { var g ; typeof window < "u" ? g = window : typeof global < "u" ? g = global : typeof self < "u" ? g = self : g = this , g . memoizerific = f3 ( ) } } ) ( function ( ) { var define2 , module2 , exports2 ; return function e ( t , n , r ) { function s ( o2 , u2 ) { if ( ! n [ o2 ] ) { if ( ! t [ o2 ] ) { var a = typeof _ _require == "function" && _ _require ; if ( ! u2 && a ) return a ( o2 , ! 0 ) ; if ( i ) return i ( o2 , ! 0 ) ; var f3 = new Error ( "Cannot find module '" + o2 + "'" ) ; throw f3 . code = "MODULE_NOT_FOUND" , f3 } var l = n [ o2 ] = { exports : { } } ; t [ o2 ] [ 0 ] . call ( l . exports , function ( e2 ) { var n2 = t [ o2 ] [ 1 ] [ e2 ] ; return s ( n2 || e2 ) } , l , l . exports , e , t , n , r ) } return n [ o2 ] . exports } for ( var i = typeof _ _require == "function" && _ _require , o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ( { 1 : [ function ( _dereq _ , module3 , exports3 ) { module3 . exports = function ( forceSimilar ) { if ( typeof Map != "function" || forceSimilar ) { var Similar = _dereq _ ( "./similar" ) ; return new Similar } else return new Map } } , { "./similar" : 2 } ] , 2 : [ function ( _dereq _ , module3 , exports3 ) { function Similar ( ) { return this . list = [ ] , this . lastItem = void 0 , this . size = 0 , this } Similar . prototype . get = function ( key2 ) { var index ; if ( this . lastItem && this . isEqual ( this . lastItem . key , key2 ) ) return this . lastItem . val ; if ( index = this . indexOf ( key2 ) , index >= 0 ) return this . lastItem = this . list [ index ] , this . list [ index ] . val } , Similar . prototype . set = function ( key2 , val ) { var index ; return this . lastItem && this . isEqual ( this . lastItem . key , key2 ) ? ( this . lastItem . val = val , this ) : ( index = this . indexOf ( key2 ) , index >= 0 ? ( this . lastItem = this . list [ index ] , this . list [ index ] . val = val , this ) : ( this . lastItem = { key : key2 , val } , this . list . push ( this . lastItem ) , this . size ++ , this ) ) } , Similar . prototype . delete = function ( key2 ) { var index ; if ( this . lastItem && this . isEqual ( this . lastItem . key , key2 ) && ( this . lastItem = void 0 ) , index = this . indexOf ( key2 ) , index >= 0 ) return this . size -- , this . list . splice ( index , 1 ) [ 0 ] } , Similar . prototype . has = function ( key2 ) { var index ; return this . lastItem && this . isEqual ( this . lastItem . key , key2 ) ? ! 0 : ( index = this . indexOf ( key2 ) , index >= 0 ? ( this . lastItem = this . list [ index ] , ! 0 ) : ! 1 ) } , Similar . prototype . forEach = function ( callback , thisArg ) { var i ; for ( i = 0 ; i < this . size ; i ++ ) callback . call ( thisArg || this , this . list [ i ] . val , this . list [ i ] . key , this ) } , Similar . prototype . indexOf = function ( key2 ) { var i ; for ( i = 0 ; i < this . size ; i ++ ) if ( this . isEqual ( this . list [ i ] . key , key2 ) ) return i ; return - 1 } , Similar . prototype . isEqual = function ( val1 , val2 ) { return val1 === val2 || val1 !== val1 && val2 !== val2 } , module3 . exports = Similar } , { } ] , 3 : [ function ( _dereq _ , module3 , exports3 ) { var MapOrSimilar = _dereq _ ( "map-or-similar" ) ; module3 . exports = function ( limit ) { var cache = new MapOrSimilar ( ! 1 ) , lru = [ ] ; return function ( fn ) { var memoizerific = function ( ) { var currentCache = cache , newMap , fnResult , argsLengthMinusOne = arguments . length - 1 , lruPath = Array ( argsLengthMinusOne + 1 ) ,
2024-02-08 10:52:22 +01:00
` )>=0)return!1;return!0}function getIndent(opts,depth){var baseIndent;if(opts.indent===" ")baseIndent=" ";else if(typeof opts.indent=="number"&&opts.indent>0)baseIndent= $ join.call(Array(opts.indent+1)," ");else return null;return{base:baseIndent,prev: $ join.call(Array(depth+1),baseIndent)}}function indentedJoin(xs,indent){if(xs.length===0)return"";var lineJoiner= `
` +indent.prev+indent.base;return lineJoiner+ $ join.call(xs,","+lineJoiner)+ `
2024-06-16 17:30:30 +02:00
` +indent.prev}function arrObjKeys(obj,inspect){var isArr=isArray2(obj),xs=[];if(isArr){xs.length=obj.length;for(var i=0;i<obj.length;i++)xs[i]=has2(obj,i)?inspect(obj[i],obj):""}var syms=typeof gOPS=="function"?gOPS(obj):[],symMap;if(hasShammedSymbols){symMap={};for(var k2=0;k2<syms.length;k2++)symMap[" $ "+syms[k2]]=syms[k2]}for(var key2 in obj)has2(obj,key2)&&(isArr&&String(Number(key2))===key2&&key2<obj.length||hasShammedSymbols&&symMap[" $ "+key2]instanceof Symbol||( $ test.call(/[^ \w $ ]/,key2)?xs.push(inspect(key2,obj)+": "+inspect(obj[key2],obj)):xs.push(key2+": "+inspect(obj[key2],obj))));if(typeof gOPS=="function")for(var j=0;j<syms.length;j++)isEnumerable.call(obj,syms[j])&&xs.push("["+inspect(syms[j])+"]: "+inspect(obj[syms[j]],obj));return xs}}});var require_side_channel=__commonJS({"../../node_modules/side-channel/index.js"(exports,module){"use strict";var GetIntrinsic=require_get_intrinsic2(),callBound=require_callBound2(),inspect=require_object_inspect(), $ TypeError=GetIntrinsic("%TypeError%"), $ WeakMap=GetIntrinsic("%WeakMap%",!0), $ Map=GetIntrinsic("%Map%",!0), $ weakMapGet=callBound("WeakMap.prototype.get",!0), $ weakMapSet=callBound("WeakMap.prototype.set",!0), $ weakMapHas=callBound("WeakMap.prototype.has",!0), $ mapGet=callBound("Map.prototype.get",!0), $ mapSet=callBound("Map.prototype.set",!0), $ mapHas=callBound("Map.prototype.has",!0),listGetNode=function(list,key2){for(var prev=list,curr;(curr=prev.next)!==null;prev=curr)if(curr.key===key2)return prev.next=curr.next,curr.next=list.next,list.next=curr,curr},listGet=function(objects,key2){var node=listGetNode(objects,key2);return node&&node.value},listSet=function(objects,key2,value2){var node=listGetNode(objects,key2);node?node.value=value2:objects.next={key:key2,next:objects.next,value:value2}},listHas=function(objects,key2){return!!listGetNode(objects,key2)};module.exports=function(){var $ wm, $ m, $ o,channel={assert:function(key2){if(!channel.has(key2))throw new $ TypeError("Side channel does not contain "+inspect(key2))},get:function(key2){if( $ WeakMap&&key2&&(typeof key2=="object"||typeof key2=="function")){if( $ wm)return $ weakMapGet( $ wm,key2)}else if( $ Map){if( $ m)return $ mapGet( $ m,key2)}else if( $ o)return listGet( $ o,key2)},has:function(key2){if( $ WeakMap&&key2&&(typeof key2=="object"||typeof key2=="function")){if( $ wm)return $ weakMapHas( $ wm,key2)}else if( $ Map){if( $ m)return $ mapHas( $ m,key2)}else if( $ o)return listHas( $ o,key2);return!1},set:function(key2,value2){ $ WeakMap&&key2&&(typeof key2=="object"||typeof key2=="function")?( $ wm||( $ wm=new $ WeakMap), $ weakMapSet( $ wm,key2,value2)): $ Map?( $ m||( $ m=new $ Map), $ mapSet( $ m,key2,value2)):( $ o||( $ o={key:{},next:null}),listSet( $ o,key2,value2))}};return channel}}});var require_formats=__commonJS({"../../node_modules/qs/lib/formats.js"(exports,module){"use strict";var replace=String.prototype.replace,percentTwenties=/%20/g,Format={RFC1738:"RFC1738",RFC3986:"RFC3986"};module.exports={default:Format.RFC3986,formatters:{RFC1738:function(value2){return replace.call(value2,percentTwenties,"+")},RFC3986:function(value2){return String(value2)}},RFC1738:Format.RFC1738,RFC3986:Format.RFC3986}}});var require_utils=__commonJS({"../../node_modules/qs/lib/utils.js"(exports,module){"use strict";var formats=require_formats(),has2=Object.prototype.hasOwnProperty,isArray2=Array.isArray,hexTable=function(){for(var array=[],i=0;i<256;++i)array.push("%"+((i<16?"0":"")+i.toString(16)).toUpperCase());return array}(),compactQueue=function(queue){for(;queue.length>1;){var item=queue.pop(),obj=item.obj[item.prop];if(isArray2(obj)){for(var compacted=[],j=0;j<obj.length;++j)typeof obj[j]<"u"&&compacted.push(obj[j]);item.obj[item.prop]=compacted}}},arrayToObject=function(source2,options2){for(var obj=options2&&options2.plainObjects?Object.create(null):{},i=0;i<source2.length;++i)typeof source2[i]<"u"&&(obj[i]=source2[i]);return obj},merge=function merge2(target,source2,options2){if(!source2)return target;if(typeof source2!="object"){if(isArray2(target))target.push(source2);else if(target&&typeof target=="object")(options2&&(options2.plainObjects||options2.allowPrototy
2024-02-08 10:52:22 +01:00
` &&inQuoteChar!==" ` ")&&(inQuoteChar=null),inRegexLiteral&&(code[i]===" / "&&code[i-1]!==" \ \ " || code [ i ] === `
` )&&(inRegexLiteral=!1),inBlockComment&&code[i-1]==="/"&&code[i-2]==="*"&&(inBlockComment=!1),inLineComment&&code[i]=== `
2024-06-16 17:30:30 +02:00
` &&(inLineComment=!1)),!inBlockComment&&!inLineComment&&(newCode+=code[i]);else newCode=code;return newCode},cleanCode=(0,import_memoizerific.default)(1e4)(code=>removeCodeComments(code).replace(/ \n \s */g,"").trim()),convertShorthandMethods=function(key2,stringified){let fnHead=stringified.slice(0,stringified.indexOf("{")),fnBody=stringified.slice(stringified.indexOf("{"));if(fnHead.includes("=>")||fnHead.includes("function"))return stringified;let modifiedHead=fnHead;return modifiedHead=modifiedHead.replace(key2,"function"),modifiedHead+fnBody},dateFormat=/^ \d {4}- \d {2}- \d {2}T \d {2}: \d {2}: \d {2}( \. \d {3})?Z $ /,isJSON=input=>input.match(/^[ \[ \{ \" \} ].*[ \] \} \" ] $ /);function convertUnconventionalData(data){if(!isObject3(data))return data;let result2=data,wasMutated=!1;return typeof Event<"u"&&data instanceof Event&&(result2=extractEventHiddenProperties(result2),wasMutated=!0),result2=Object.keys(result2).reduce((acc,key2)=>{try{result2[key2]&&result2[key2].toJSON,acc[key2]=result2[key2]}catch{wasMutated=!0}return acc},{}),wasMutated?result2:data}var replacer=function(options2){let objects,map2,stack,keys;return function(key2,value2){try{if(key2==="")return keys=[],objects=new Map([[value2,"[]"]]),map2=new Map,stack=[],value2;let origin=map2.get(this)||this;for(;stack.length&&origin!==stack[0];)stack.shift(),keys.pop();if(typeof value2=="boolean")return value2;if(value2===void 0)return options2.allowUndefined?"_undefined_":void 0;if(value2===null)return null;if(typeof value2=="number")return value2===-1/0?"_-Infinity_":value2===1/0?"_Infinity_":Number.isNaN(value2)?"_NaN_":value2;if(typeof value2=="bigint")return ` _bigint _$ { value2 . toString ( ) } ` ;if(typeof value2=="string")return dateFormat.test(value2)?options2.allowDate? ` _date _$ { value2 } ` :void 0:value2;if((0,import_is_regex.default)(value2))return options2.allowRegExp? ` _regexp _$ { value2 . flags } | $ { value2 . source } ` :void 0;if((0,import_is_function.default)(value2)){if(!options2.allowFunction)return;let{name:name2}=value2,stringified=value2.toString();return stringified.match(/( \[ native code \] |WEBPACK_IMPORTED_MODULE|__webpack_exports__|__webpack_require__)/)? ` _function _$ { name2 } | $ { ( ( ) => { } ) . toString ( ) } ` : ` _function _$ { name2 } | $ { cleanCode ( convertShorthandMethods ( key2 , stringified ) ) } ` }if((0,import_is_symbol.default)(value2)){if(!options2.allowSymbol)return;let globalRegistryKey=Symbol.keyFor(value2);return globalRegistryKey!==void 0? ` _gsymbol _$ { globalRegistryKey } ` : ` _symbol _$ { value2 . toString ( ) . slice ( 7 , - 1 ) } ` }if(stack.length>=options2.maxDepth)return Array.isArray(value2)? ` [ Array ( $ { value2 . length } ) ] ` :"[Object]";if(value2===this)return ` _duplicate _$ { JSON . stringify ( keys ) } ` ;if(value2 instanceof Error&&options2.allowError)return{__isConvertedError__:!0,errorProperties:{...value2.cause?{cause:value2.cause}:{},...value2,name:value2.name,message:value2.message,stack:value2.stack,"_constructor-name_":value2.constructor.name}};if(value2.constructor&&value2.constructor.name&&value2.constructor.name!=="Object"&&!Array.isArray(value2)&&!options2.allowClass)return;let found=objects.get(value2);if(!found){let converted=Array.isArray(value2)?value2:convertUnconventionalData(value2);if(value2.constructor&&value2.constructor.name&&value2.constructor.name!=="Object"&&!Array.isArray(value2)&&options2.allowClass)try{Object.assign(converted,{"_constructor-name_":value2.constructor.name})}catch{}return keys.push(key2),stack.unshift(converted),objects.set(value2,JSON.stringify(keys)),value2!==converted&&map2.set(value2,converted),converted}return ` _duplicate _$ { found } ` }catch{return}}},reviver2=function reviver(options){let refs=[],root;return function revive(key,value){if(key===""&&(root=value,refs.forEach(({target,container,replacement})=>{let replacementArr=isJSON(replacement)?JSON.parse(replacement):replacement.split(".");replacementArr.length===0?container[target]=root:container[target]=get_default(root,replacementArr)})),key==="_constructor-name_")return value;if(isObject3(value)&&value.__isConvertedError__){let{message,...properties}=value.errorProperties,error=new Error(message);return Object.assign(error,properties),er
2024-02-08 10:52:22 +01:00
$ { this . documentation . map ( doc => ` - ${ doc } ` ) . join ( `
` )} ` ) , ` ${ this . template ( ) } ${ page != null ? `
More info : $ { page }
` :""} ` } } ; function dedent ( templ ) { for ( var values = [ ] , _i = 1 ; _i < arguments . length ; _i ++ ) values [ _i - 1 ] = arguments [ _i ] ; var strings = Array . from ( typeof templ == "string" ? [ templ ] : templ ) ; strings [ strings . length - 1 ] = strings [ strings . length - 1 ] . replace ( /\r?\n([\t ]*)$/ , "" ) ; var indentLengths = strings . reduce ( function ( arr , str ) { var matches2 = str . match ( /\n([\t ]+|(?!\s).)/g ) ; return matches2 ? arr . concat ( matches2 . map ( function ( match ) { var _a , _b ; return ( _b = ( _a = match . match ( /[\t ]/g ) ) === null || _a === void 0 ? void 0 : _a . length ) !== null && _b !== void 0 ? _b : 0 } ) ) : arr } , [ ] ) ; if ( indentLengths . length ) { var pattern _1 = new RegExp ( `
[ ] { ` +Math.min.apply(Math,indentLengths)+"}","g");strings=strings.map(function(str){return str.replace(pattern_1, `
` )})}strings[0]=strings[0].replace(/^ \r ? \n /,"");var string=strings[0];return values.forEach(function(value2,i){var endentations=string.match(/(?:^| \n )( *) $ /),endentation=endentations?endentations[1]:"",indentedValue=value2;typeof value2=="string"&&value2.includes( `
` )&&(indentedValue=String(value2).split( `
` ).map(function(str,i2){return i2===0?str:""+endentation+str}).join( `
2024-06-16 17:30:30 +02:00
` )),string+=indentedValue+strings[i+1]}),string}var esm_default=dedent;var Category=(Category2=>(Category2.DOCS_TOOLS="DOCS-TOOLS",Category2.PREVIEW_CLIENT_LOGGER="PREVIEW_CLIENT-LOGGER",Category2.PREVIEW_CHANNELS="PREVIEW_CHANNELS",Category2.PREVIEW_CORE_EVENTS="PREVIEW_CORE-EVENTS",Category2.PREVIEW_INSTRUMENTER="PREVIEW_INSTRUMENTER",Category2.PREVIEW_API="PREVIEW_API",Category2.PREVIEW_REACT_DOM_SHIM="PREVIEW_REACT-DOM-SHIM",Category2.PREVIEW_ROUTER="PREVIEW_ROUTER",Category2.PREVIEW_THEMING="PREVIEW_THEMING",Category2.RENDERER_HTML="RENDERER_HTML",Category2.RENDERER_PREACT="RENDERER_PREACT",Category2.RENDERER_REACT="RENDERER_REACT",Category2.RENDERER_SERVER="RENDERER_SERVER",Category2.RENDERER_SVELTE="RENDERER_SVELTE",Category2.RENDERER_VUE="RENDERER_VUE",Category2.RENDERER_VUE3="RENDERER_VUE3",Category2.RENDERER_WEB_COMPONENTS="RENDERER_WEB-COMPONENTS",Category2.FRAMEWORK_NEXTJS="FRAMEWORK_NEXTJS",Category2))(Category||{}),MissingStoryAfterHmrError=class extends StorybookError{constructor(data){super(),this.data=data,this.category="PREVIEW_API",this.code=1}template(){return esm_default `
2024-02-08 10:52:22 +01:00
Couldn 't find story matching id ' $ { this . data . storyId } ' after HMR .
- Did you just rename a story ?
- Did you remove it from your CSF file ?
- Are you sure a story with the id '${this.data.storyId}' exists ?
- Please check the values in the stories field of your main . js config and see if they would match your CSF File .
2024-06-16 17:30:30 +02:00
- Also check the browser console and terminal for potential error messages . ` }},ImplicitActionsDuringRendering=class extends StorybookError{constructor(data){super(),this.data=data,this.category="PREVIEW_API",this.code=2,this.documentation="https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#using-implicit-actions-during-rendering-is-deprecated-for-example-in-the-play-function"}template(){return esm_default `
We detected that you use an implicit action arg while $ { this . data . phase } of your story .
$ { this . data . deprecated ? `
This is deprecated and won ' t work in Storybook 8 anymore .
` :""}
Please provide an explicit spy to your args like this :
import { fn } from '@storybook/test' ;
...
args : {
$ { this . data . name } : fn ( )
}
` }},CalledExtractOnStoreError=class extends StorybookError{constructor(){super(...arguments),this.category="PREVIEW_API",this.code=3}template(){return esm_default `
Cannot call \ ` storyStore.extract() \` without calling \` storyStore.cacheAllCsfFiles() \` first.
You probably meant to call \ ` await preview.extract() \` which does the above for you. ` } } , MissingRenderToCanvasError = class extends StorybookError { constructor ( ) { super ( ... arguments ) , this . category = "PREVIEW_API" , this . code = 4 , this . documentation = "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#mainjs-framework-field" } template ( ) { return esm _default `
Expected your framework ' s preset to export a \ ` renderToCanvas \` field.
Perhaps it needs to be upgraded for Storybook 6.4 ? ` }},CalledPreviewMethodBeforeInitializationError=class extends StorybookError{constructor(data){super(),this.data=data,this.category="PREVIEW_API",this.code=5}template(){return esm_default `
Called \ ` Preview. ${ this . data . methodName } () \` before initialization.
The preview needs to load the story index before most methods can be called . If you want
to call \ ` ${ this . data . methodName } \` , try \` await preview.initializationPromise; \` first.
If you didn ' t call the above code , then likely it was called by an addon that needs to
do the above . ` }},StoryIndexFetchError=class extends StorybookError{constructor(data){super(),this.data=data,this.category="PREVIEW_API",this.code=6}template(){return esm_default `
Error fetching \ ` /index.json \` :
$ { this . data . text }
If you are in development , this likely indicates a problem with your Storybook process ,
check the terminal for errors .
If you are in a deployed Storybook , there may have been an issue deploying the full Storybook
build . ` }},MdxFileWithNoCsfReferencesError=class extends StorybookError{constructor(data){super(),this.data=data,this.category="PREVIEW_API",this.code=7}template(){return esm_default `
Tried to render docs entry $ { this . data . storyId } but it is a MDX file that has no CSF
references , or autodocs for a CSF file that some doesn ' t refer to itself .
This likely is an internal error in Storybook 's indexing, or you' ve attached the
\ ` attached-mdx \` tag to an MDX file that is not attached. ` } } , EmptyIndexError = class extends StorybookError { constructor ( ) { super ( ... arguments ) , this . category = "PREVIEW_API" , this . code = 8 } template ( ) { return esm _default `
Couldn ' t find any stories in your Storybook .
- Please check your stories field of your main . js config : does it match correctly ?
- Also check the browser console and terminal for error messages . ` }},NoStoryMatchError=class extends StorybookError{constructor(data){super(),this.data=data,this.category="PREVIEW_API",this.code=9}template(){return esm_default `
Couldn 't find story matching ' $ { this . data . storySpecifier } ' .
- Are you sure a story with that id exists ?
- Please check your stories field of your main . js config .
- Also check the browser console and terminal for error messages . ` }},MissingStoryFromCsfFileError=class extends StorybookError{constructor(data){super(),this.data=data,this.category="PREVIEW_API",this.code=10}template(){return esm_default `
Couldn 't find story matching id ' $ { this . data . storyId } ' after importing a CSF file .
The file was indexed as if the story was there , but then after importing the file in the browser
we didn ' t find the story . Possible reasons :
- You are using a custom story indexer that is misbehaving .
- You have a custom file loader that is removing or renaming exports .
Please check your browser console and terminal for errors that may explain the issue . ` }},StoryStoreAccessedBeforeInitializationError=class extends StorybookError{constructor(){super(...arguments),this.category="PREVIEW_API",this.code=11}template(){return esm_default `
Cannot access the Story Store until the index is ready .
It is not recommended to use methods directly on the Story Store anyway , in Storybook 9 we will
remove access to the store entirely ` }},NextJsSharpError=class extends StorybookError{constructor(){super(...arguments),this.category="FRAMEWORK_NEXTJS",this.code=1,this.documentation="https://storybook.js.org/docs/get-started/nextjs#faq"}template(){return esm_default `
You are importing avif images , but you don ' t have sharp installed .
You have to install sharp in order to use image optimization features in Next . js .
` }},NextjsRouterMocksNotAvailable=class extends StorybookError{constructor(data){super(),this.data=data,this.category="FRAMEWORK_NEXTJS",this.code=2}template(){return esm_default `
Tried to access router mocks from "${this.data.importType}" but they were not created yet . You might be running code in an unsupported environment .
` }},UnknownArgTypesError=class extends StorybookError{constructor(data){super(),this.data=data,this.category="DOCS-TOOLS",this.code=1,this.documentation="https://github.com/storybookjs/storybook/issues/26606"}template(){return esm_default ` There was a failure when generating detailed ArgTypes in $ { this . data . language } for :
$ { JSON . stringify ( this . data . type , null , 2 ) }
Storybook will fall back to use a generic type description instead .
This type is either not supported or it is a bug in the docgen generation in Storybook .
If you think this is a bug , please detail it as much as possible in the Github issue . ` }};var dist_exports5={};__export(dist_exports5,{DocsContext:()=>DocsContext,HooksContext:()=>HooksContext,Preview:()=>Preview,PreviewWeb:()=>PreviewWeb,PreviewWithSelection:()=>PreviewWithSelection,StoryStore:()=>StoryStore,UrlStore:()=>UrlStore,WebView:()=>WebView,addons:()=>addons,applyHooks:()=>applyHooks,combineArgs:()=>combineArgs,combineParameters:()=>combineParameters,composeConfigs:()=>composeConfigs,composeStepRunners:()=>composeStepRunners,composeStories:()=>composeStories,composeStory:()=>composeStory,createPlaywrightTest:()=>createPlaywrightTest,decorateStory:()=>decorateStory,defaultDecorateStory:()=>defaultDecorateStory,filterArgTypes:()=>filterArgTypes,inferControls:()=>inferControls,makeDecorator:()=>makeDecorator,mockChannel:()=>mockChannel,normalizeStory:()=>normalizeStory,prepareMeta:()=>prepareMeta,prepareStory:()=>prepareStory,sanitizeStoryContextUpdate:()=>sanitizeStoryContextUpdate,setProjectAnnotations:()=>setProjectAnnotations,simulateDOMContentLoaded:()=>simulateDOMContentLoaded,simulatePageLoad:()=>simulatePageLoad,sortStoriesV7:()=>sortStoriesV7,useArgs:()=>useArgs,useCallback:()=>useCallback,useChannel:()=>useChannel,useEffect:()=>useEffect,useGlobals:()=>useGlobals,useMemo:()=>useMemo,useParameter:()=>useParameter,useReducer:()=>useReducer,useRef:()=>useRef,useState:()=>useState,useStoryContext:()=>useStoryContext,userOrAutoTitle:()=>userOrAutoTitle,userOrAutoTitleFromSpecifier:()=>userOrAutoTitleFromSpecifier});var import_memoizerific2=__toESM(require_memoizerific(),1),import_mapValues=__toESM(require_mapValues(),1),import_pick=__toESM(require_pick(),1);var has=Object.prototype.hasOwnProperty;function find(iter,tar,key2){for(key2 of iter.keys())if(dequal(key2,tar))return key2}function dequal(foo,bar){var ctor,len,tmp;if(foo===bar)return!0;if(foo&&bar&&(ctor=foo.constructor)===bar.constructor){if(ctor===Date)return foo.getTime()===bar.getTime();if(ctor===RegExp)return foo.toString()===bar.toString();if(ctor===Array){if((len=foo.length)===bar.length)for(;len--&&dequal(foo[len],bar[len]););return len===-1}if(ctor===Set){if(foo.size!==bar.size)return!1;for(len of foo)if(tmp=len,tmp&&typeof tmp=="object"&&(tmp=find(bar,tmp),!tmp)||!bar.has(tmp))return!1;return!0}if(ctor===Map){if(foo.size!==bar.size)return!1;for(len of foo)if(tmp=len[0],tmp&&typeof tmp=="object"&&(tmp=find(bar,tmp),!tmp)||!dequal(len[1],bar.get(tmp)))return!1;return!0}if(ctor===ArrayBuffer)foo=new Uint8Array(foo),bar=new Uint8Array(bar);else if(ctor===DataView){if((len=foo.byteLength)===bar.byteLength)for(;len--&&foo.getInt8(len)===bar.getInt8(len););return len===-1}if(ArrayBuffer.isView(foo)){if((len=foo.byteLength)===bar.byteLength)for(;len--&&foo[len]===bar[len];);return len===-1}if(!ctor||typeof foo=="object"){len=0;for(ctor in foo)if(has.call(foo,ctor)&&++len&&!has.call(bar,ctor)||!(ctor in bar)||!dequal(foo[ctor],bar[ctor]))return!1;return Object.keys(bar).length===len}}return foo!==foo&&bar!==bar}var import_isPlainObject=__toESM(require_isPlainObject(),1);var B=Object.create,u=Object.defineProperty,C=Object.getOwnPropertyDescriptor,F=Object.getOwnPropertyNames,h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,E=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),I=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of F(e))!w.call(r,a)&&a!==n&&u(r,a,{get:()=>e[a],enumerable:!(t=C(e,a))||t.enumerable});return r},k=(r,e,n)=>(n=r!=null?B(h(r)):{},I(e||!r||!r.__esModule?u(n,"default",{value:r,enumerable:!0}):n,r)),x=E(T=>{Object.defineProperty(T,"__esModule",{value:!0}),T.isEqual=function(){var r=Object.prototype.toString,e=Object.getPrototypeOf,n=Object.getOwnPropertySymbols?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:Object.keys;return function(t,a){return function i(o,s,d){var y,g,p,l=r.call(o),b=r.call(s);if(o===s)return!0;if(o==null||s==null)return!1;if(d.indexOf(o)>-1&&d.indexOf(s)>-1)return!0;if(d.push(o,s),l!=b||(y=n(o),g=n(s),y.length!=g.length||y.some(function(A){retu
` ,nexist:" \u 2204",nexists:" \u 2204",Nfr:" \u {1D511}",nfr:" \u {1D52B}",ngE:" \u 2267 \u 0338",nge:" \u 2271",ngeq:" \u 2271",ngeqq:" \u 2267 \u 0338",ngeqslant:" \u 2A7E \u 0338",nges:" \u 2A7E \u 0338",nGg:" \u 22D9 \u 0338",ngsim:" \u 2275",nGt:" \u 226B \u 20D2",ngt:" \u 226F",ngtr:" \u 226F",nGtv:" \u 226B \u 0338",nharr:" \u 21AE",nhArr:" \u 21CE",nhpar:" \u 2AF2",ni:" \u 220B",nis:" \u 22FC",nisd:" \u 22FA",niv:" \u 220B",NJcy:" \u 040A",njcy:" \u 045A",nlarr:" \u 219A",nlArr:" \u 21CD",nldr:" \u 2025",nlE:" \u 2266 \u 0338",nle:" \u 2270",nleftarrow:" \u 219A",nLeftarrow:" \u 21CD",nleftrightarrow:" \u 21AE",nLeftrightarrow:" \u 21CE",nleq:" \u 2270",nleqq:" \u 2266 \u 0338",nleqslant:" \u 2A7D \u 0338",nles:" \u 2A7D \u 0338",nless:" \u 226E",nLl:" \u 22D8 \u 0338",nlsim:" \u 2274",nLt:" \u 226A \u 20D2",nlt:" \u 226E",nltri:" \u 22EA",nltrie:" \u 22EC",nLtv:" \u 226A \u 0338",nmid:" \u 2224",NoBreak:" \u 2060",NonBreakingSpace:" \x A0",nopf:" \u {1D55F}",Nopf:" \u 2115",Not:" \u 2AEC",not:" \x AC",NotCongruent:" \u 2262",NotCupCap:" \u 226D",NotDoubleVerticalBar:" \u 2226",NotElement:" \u 2209",NotEqual:" \u 2260",NotEqualTilde:" \u 2242 \u 0338",NotExists:" \u 2204",NotGreater:" \u 226F",NotGreaterEqual:" \u 2271",NotGreaterFullEqual:" \u 2267 \u 0338",NotGreaterGreater:" \u 226B \u 0338",NotGreaterLess:" \u 2279",NotGreaterSlantEqual:" \u 2A7E \u 0338",NotGreaterTilde:" \u 2275",NotHumpDownHump:" \u 224E \u 0338",NotHumpEqual:" \u 224F \u 0338",notin:" \u 2209",notindot:" \u 22F5 \u 0338",notinE:" \u 22F9 \u 0338",notinva:" \u 2209",notinvb:" \u 22F7",notinvc:" \u 22F6",NotLeftTriangleBar:" \u 29CF \u 0338",NotLeftTriangle:" \u 22EA",NotLeftTriangleEqual:" \u 22EC",NotLess:" \u 226E",NotLessEqual:" \u 2270",NotLessGreater:" \u 2278",NotLessLess:" \u 226A \u 0338",NotLessSlantEqual:" \u 2A7D \u 0338",NotLessTilde:" \u 2274",NotNestedGreaterGreater:" \u 2AA2 \u 0338",NotNestedLessLess:" \u 2AA1 \u 0338",notni:" \u 220C",notniva:" \u 220C",notnivb:" \u 22FE",notnivc:" \u 22FD",NotPrecedes:" \u 2280",NotPrecedesEqual:" \u 2AAF \u 0338",NotPrecedesSlantEqual:" \u 22E0",NotReverseElement:" \u 220C",NotRightTriangleBar:" \u 29D0 \u 0338",NotRightTriangle:" \u 22EB",NotRightTriangleEqual:" \u 22ED",NotSquareSubset:" \u 228F \u 0338",NotSquareSubsetEqual:" \u 22E2",NotSquareSuperset:" \u 2290 \u 0338",NotSquareSupersetEqual:" \u 22E3",NotSubset:" \u 2282 \u 20D2",NotSubsetEqual:" \u 2288",NotSucceeds:" \u 2281",NotSucceedsEqual:" \u 2AB0 \u 0338",NotSucceedsSlantEqual:" \u 22E1",NotSucceedsTilde:" \u 227F \u 0338",NotSuperset:" \u 2283 \u 20D2",NotSupersetEqual:" \u 2289",NotTilde:" \u 2241",NotTildeEqual:" \u 2244",NotTildeFullEqual:" \u 2247",NotTildeTilde:" \u 2249",NotVerticalBar:" \u 2224",nparallel:" \u 2226",npar:" \u 2226",nparsl:" \u 2AFD \u 20E5",npart:" \u 2202 \u 0338",npolint:" \u 2A14",npr:" \u 2280",nprcue:" \u 22E0",nprec:" \u 2280",npreceq:" \u 2AAF \u 0338",npre:" \u 2AAF \u 0338",nrarrc:" \u 2933 \u 0338",nrarr:" \u 219B",nrArr:" \u 21CF",nrarrw:" \u 219D \u 0338",nrightarrow:" \u 219B",nRightarrow:" \u 21CF",nrtri:" \u 22EB",nrtrie:" \u 22ED",nsc:" \u 2281",nsccue:" \u 22E1",nsce:" \u 2AB0 \u 0338",Nscr:" \u {1D4A9}",nscr:" \u {1D4C3}",nshortmid:" \u 2224",nshortparallel:" \u 2226",nsim:" \u 2241",nsime:" \u 2244",nsimeq:" \u 2244",nsmid:" \u 2224",nspar:" \u 2226",nsqsube:" \u 22E2",nsqsupe:" \u 22E3",nsub:" \u 2284",nsubE:" \u 2AC5 \u 0338",nsube:" \u 2288",nsubset:" \u 2282 \u 20D2",nsubseteq:" \u 2288",nsubseteqq:" \u 2AC5 \u 0338",nsucc:" \u 2281",nsucceq:" \u 2AB0 \u 0338",nsup:" \u 2285",nsupE:" \u 2AC6 \u 0338",nsupe:" \u 2289",nsupset:" \u 2283 \u 20D2",nsupseteq:" \u 2289",nsupseteqq:" \u 2AC6 \u 0338",ntgl:" \u 2279",Ntilde:" \x D1",ntilde:" \x F1",ntlg:" \u 2278",ntriangleleft:" \u 22EA",ntrianglelefteq:" \u 22EC",ntriangleright:" \u 22EB",ntrianglerighteq:" \u 22ED",Nu:" \u 039D",nu:" \u 03BD",num:"#",numero:" \u 2116",numsp:" \u 2007",nvap:" \u 224D \u 20D2",nvdash:" \u 22AC",nvDash:" \u 22AD",nVdash:" \u 22AE",nVDash:" \u 22AF",nvge:" \u 2265 \u 20D2",nvgt:"> \u 20D2",nvHarr:" \u 2904",nvinfin:" \u 29DE",nvlArr:" \u 2902",nvle:" \u 2264 \u 20D2",nvlt:"< \u 20D2",nvltrie:" \u 22B4 \u 20D2",nvrArr:" \u 2903",nvrtrie:" \u 22B5 \u 20D2",nvsim:" \u 223C \u 20D2",nwarhk:" \u 2923",nwarr:" \u 2196",nwArr:" \u 21D6",nwarrow:" \u 2196",nwnear:" \u 2927",Oacute:" \x D3",oacute:" \x F3",oast:" \u 229B",Ocirc:" \x D4",ocirc:" \x F4",ocir:" \u 229A",Ocy:" \u 041E",ocy:" \u 043E",odash:" \u 229D",Odblac:" \u 0150",odblac:" \u 0151",odiv:" \u 2A38",odot:" \u 2299",odsold:" \u 29BC",OElig:" \u 0152",oelig:" \u 01
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}var it,normalCompletion=!0,didErr=!1,err;return{s:function(){it=o[Symbol.iterator]()},n:function(){var step=it.next();return normalCompletion=step.done,step},e:function(_e2){didErr=!0,err=_e2},f:function(){try{!normalCompletion&&it.return!=null&&it.return()}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(o){if(typeof o=="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor&&(n=o.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array $ /.test(n))return _arrayLikeToArray(o,minLen)}}function _arrayLikeToArray(arr,len){(len==null||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}var entities=require_lib2(),defaults={fg:"#FFF",bg:"#000",newline:!1,escapeXML:!1,stream:!1,colors:getDefaultColors()};function getDefaultColors(){var colors={0:"#000",1:"#A00",2:"#0A0",3:"#A50",4:"#00A",5:"#A0A",6:"#0AA",7:"#AAA",8:"#555",9:"#F55",10:"#5F5",11:"#FF5",12:"#55F",13:"#F5F",14:"#5FF",15:"#FFF"};return range(0,5).forEach(function(red){range(0,5).forEach(function(green){range(0,5).forEach(function(blue){return setStyleColor(red,green,blue,colors)})})}),range(0,23).forEach(function(gray){var c2=gray+232,l=toHexString(gray*10+8);colors[c2]="#"+l+l+l}),colors}function setStyleColor(red,green,blue,colors){var c2=16+red*36+green*6+blue,r=red>0?red*40+55:0,g=green>0?green*40+55:0,b=blue>0?blue*40+55:0;colors[c2]=toColorHexString([r,g,b])}function toHexString(num){for(var str=num.toString(16);str.length<2;)str="0"+str;return str}function toColorHexString(ref){var results=[],_iterator=_createForOfIteratorHelper(ref),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var r=_step.value;results.push(toHexString(r))}}catch(err){_iterator.e(err)}finally{_iterator.f()}return"#"+results.join("")}function generateOutput(stack,token,data,options2){var result2;return token==="text"?result2=pushText(data,options2):token==="display"?result2=handleDisplay(stack,data,options2):token==="xterm256"?result2=pushForegroundColor(stack,options2.colors[data]):token==="rgb"&&(result2=handleRgb(stack,data)),result2}function handleRgb(stack,data){data=data.substring(2).slice(0,-1);var operation=+data.substr(0,2),color=data.substring(5).split(";"),rgb=color.map(function(value2){return("0"+Number(value2).toString(16)).substr(-2)}).join("");return pushStyle(stack,(operation===38?"color:#":"background-color:#")+rgb)}function handleDisplay(stack,code,options2){code=parseInt(code,10);var codeMap={"-1":function(){return"<br/>"},0:function(){return stack.length&&resetStyles(stack)},1:function(){return pushTag(stack,"b")},3:function(){return pushTag(stack,"i")},4:function(){return pushTag(stack,"u")},8:function(){return pushStyle(stack,"display:none")},9:function(){return pushTag(stack,"strike")},22:function(){return pushStyle(stack,"font-weight:normal;text-decoration:none;font-style:normal")},23:function(){return closeTag(stack,"i")},24:function(){return closeTag(stack,"u")},39:function(){return pushForegroundColor(stack,options2.fg)},49:function(){return pushBackgroundColor(stack,options2.bg)},53:function(){return pushStyle(stack,"text-decoration:overline")}},result2;return codeMap[code]?result2=codeMap[code]():4<code&&code<7?result2=pushTag(stack,"blink"):29<code&&code<38?result2=pushForegroundColor(stack,options2.colors[code-30]):39<code&&code<48?result2=pushBackgroundColor(stack,options2.colors[code-40]):89<code&&code<98?result2=pushForegroundColor(stack,options2.colors[8+(code-90)]):99<code&&code<108&&(result2=pushBackgroundColor(stack,options2.colors[8+(code-100)])),result2}function resetStyles(stack){var stackClone=stack.slice(0);return stack.length=0,stackClone.reverse().map(function(tag){return"</"+tag+">"}).join("")}function range(low,high){for(var results=[],j=low;j<=high;j++)results.push(j);return results}function notCategory(category){return function(e){r
Previous : $ { hook . deps }
Incoming : $ { deps } ` ),(deps==null||hook.deps==null||!areDepsEqual(deps,hook.deps))&&(callback(hook),hook.deps=deps),hook}throw invalidHooksError()}function useMemoLike(name2,nextCreate,deps){let{memoizedState}=useHook(name2,hook=>{hook.memoizedState=nextCreate()},deps);return memoizedState}function useMemo(nextCreate,deps){return useMemoLike("useMemo",nextCreate,deps)}function useCallback(callback,deps){return useMemoLike("useCallback",()=>callback,deps)}function useRefLike(name2,initialValue){return useMemoLike(name2,()=>({current:initialValue}),[])}function useRef(initialValue){return useRefLike("useRef",initialValue)}function triggerUpdate(){let hooks=getHooksContextOrNull();if(hooks!=null&&hooks.currentPhase!=="NONE")hooks.hasUpdates=!0;else try{addons.getChannel().emit(FORCE_RE_RENDER)}catch{logger.warn("State updates of Storybook preview hooks work only in browser")}}function useStateLike(name2,initialState){let stateRef=useRefLike(name2,typeof initialState=="function"?initialState():initialState),setState=update=>{stateRef.current=typeof update=="function"?update(stateRef.current):update,triggerUpdate()};return[stateRef.current,setState]}function useState(initialState){return useStateLike("useState",initialState)}function useReducer(reducer,initialArg,init){let initialState=init!=null?()=>init(initialArg):initialArg,[state,setState]=useStateLike("useReducer",initialState);return[state,action=>setState(prevState=>reducer(prevState,action))]}function useEffect(create,deps){let hooks=getHooksContextOrThrow(),effect=useMemoLike("useEffect",()=>({create}),deps);hooks.currentEffects.includes(effect)||hooks.currentEffects.push(effect)}function useChannel(eventMap,deps=[]){let channel=addons.getChannel();return useEffect(()=>(Object.entries(eventMap).forEach(([type,listener])=>channel.on(type,listener)),()=>{Object.entries(eventMap).forEach(([type,listener])=>channel.removeListener(type,listener))}),[...Object.keys(eventMap),...deps]),useCallback(channel.emit.bind(channel),[channel])}function useStoryContext(){let{currentContext}=getHooksContextOrThrow();if(currentContext==null)throw invalidHooksError();return currentContext}function useParameter(parameterKey,defaultValue){let{parameters}=useStoryContext();if(parameterKey)return parameters[parameterKey]??defaultValue}function useArgs(){let channel=addons.getChannel(),{id:storyId,args:args2}=useStoryContext(),updateArgs=useCallback(updatedArgs=>channel.emit(UPDATE_STORY_ARGS,{storyId,updatedArgs}),[channel,storyId]),resetArgs=useCallback(argNames=>channel.emit(RESET_STORY_ARGS,{storyId,argNames}),[channel,storyId]);return[args2,updateArgs,resetArgs]}function useGlobals(){let channel=addons.getChannel(),{globals}=useStoryContext(),updateGlobals=useCallback(newGlobals=>channel.emit(UPDATE_GLOBALS,{globals:newGlobals}),[channel]);return[globals,updateGlobals]}var makeDecorator=({name:name2,parameterName,wrapper,skipIfNoParametersOrOptions=!1})=>{let decorator=options2=>(storyFn,context)=>{let parameters=context.parameters&&context.parameters[parameterName];return parameters&¶meters.disable||skipIfNoParametersOrOptions&&!options2&&!parameters?storyFn(context):wrapper(storyFn,context,{options:options2,parameters})};return(...args2)=>typeof args2[0]=="function"?decorator()(...args2):(...innerArgs)=>{if(innerArgs.length>1)return args2.length>1?decorator(args2)(...innerArgs):decorator(...args2)(...innerArgs);throw new Error( ` Passing stories directly into $ { name2 } ( ) is not allowed ,
instead use addDecorator ( $ { name2 } ) and pass options with the '${parameterName}' parameter ` )}},getImportPathMap=(0,import_memoizerific2.default)(1)(entries=>Object.values(entries).reduce((acc,entry)=>(acc[entry.importPath]=acc[entry.importPath]||entry,acc),{})),StoryIndexStore=class{constructor({entries}={v:5,entries:{}}){this.entries=entries}entryFromSpecifier(specifier){let entries=Object.values(this.entries);if(specifier==="*")return entries[0];if(typeof specifier=="string")return this.entries[specifier]?this.entries[specifier]:entries.find(entry=>entry.id.startsWith(specifier));let{name:name2,title}=specifier;return entries.find(entry=>entry.name===name2&&entry.title===title)}storyIdToEntry(storyId){let storyEntry=this.entries[storyId];if(!storyEntry)throw new MissingStoryAfterHmrError({storyId});return storyEntry}importPathToEntry(importPath){return getImportPathMap(this.entries)[importPath]}},INCOMPATIBLE=Symbol("incompatible"),map=(arg,argType)=>{let type=argType.type;if(arg==null||!type||argType.mapping)return arg;switch(type.name){case"string":return String(arg);case"enum":return arg;case"number":return Number(arg);case"boolean":return String(arg)==="true";case"array":return!type.value||!Array.isArray(arg)?INCOMPATIBLE:arg.reduce((acc,item,index)=>{let mapped=map(item,{type:type.value});return mapped!==INCOMPATIBLE&&(acc[index]=mapped),acc},new Array(arg.length));case"object":return typeof arg=="string"||typeof arg=="number"?arg:!type.value||typeof arg!="object"?INCOMPATIBLE:Object.entries(arg).reduce((acc,[key2,val])=>{let mapped=map(val,{type:type.value[key2]});return mapped===INCOMPATIBLE?acc:Object.assign(acc,{[key2]:mapped})},{});default:return INCOMPATIBLE}},mapArgsToTypes=(args2,argTypes)=>Object.entries(args2).reduce((acc,[key2,value2])=>{if(!argTypes[key2])return acc;let mapped=map(value2,argTypes[key2]);return mapped===INCOMPATIBLE?acc:Object.assign(acc,{[key2]:mapped})},{}),combineArgs=(value2,update)=>Array.isArray(value2)&&Array.isArray(update)?update.reduce((acc,upd,index)=>(acc[index]=combineArgs(value2[index],update[index]),acc),[...value2]).filter(v2=>v2!==void 0):!(0,import_isPlainObject.default)(value2)||!(0,import_isPlainObject.default)(update)?update:Object.keys({...value2,...update}).reduce((acc,key2)=>{if(key2 in update){let combined=combineArgs(value2[key2],update[key2]);combined!==void 0&&(acc[key2]=combined)}else acc[key2]=value2[key2];return acc},{}),validateOptions=(args2,argTypes)=>Object.entries(argTypes).reduce((acc,[key2,{options:options2}])=>{function allowArg(){return key2 in args2&&(acc[key2]=args2[key2]),acc}if(!options2)return allowArg();if(!Array.isArray(options2))return once.error(dedent `
2024-02-08 10:52:22 +01:00
Invalid argType : '${key2}.options' should be an array .
More info : https : //storybook.js.org/docs/react/api/argtypes
` ),allowArg();if(options2.some(opt=>opt&&["object","function"].includes(typeof opt)))return once.error(dedent `
Invalid argType : '${key2}.options' should only contain primitives . Use a 'mapping' for complex values .
More info : https : //storybook.js.org/docs/react/writing-stories/args#mapping-to-complex-arg-values
2024-06-16 17:30:30 +02:00
` ),allowArg();let isArray2=Array.isArray(args2[key2]),invalidIndex=isArray2&&args2[key2].findIndex(val=>!options2.includes(val)),isValidArray=isArray2&&invalidIndex===-1;if(args2[key2]===void 0||options2.includes(args2[key2])||isValidArray)return allowArg();let field=isArray2? ` $ { key2 } [ $ { invalidIndex } ] ` :key2,supportedOptions=options2.map(opt=>typeof opt=="string"? ` '${opt}' ` :String(opt)).join(", ");return once.warn( ` Received illegal value for '${field}' . Supported options : $ { supportedOptions } ` ),acc},{}),DEEPLY_EQUAL=Symbol("Deeply equal"),deepDiff=(value2,update)=>{if(typeof value2!=typeof update)return update;if(dequal(value2,update))return DEEPLY_EQUAL;if(Array.isArray(value2)&&Array.isArray(update)){let res=update.reduce((acc,upd,index)=>{let diff=deepDiff(value2[index],upd);return diff!==DEEPLY_EQUAL&&(acc[index]=diff),acc},new Array(update.length));return update.length>=value2.length?res:res.concat(new Array(value2.length-update.length).fill(void 0))}return(0,import_isPlainObject.default)(value2)&&(0,import_isPlainObject.default)(update)?Object.keys({...value2,...update}).reduce((acc,key2)=>{let diff=deepDiff(value2?.[key2],update?.[key2]);return diff===DEEPLY_EQUAL?acc:Object.assign(acc,{[key2]:diff})},{}):update},UNTARGETED="UNTARGETED";function groupArgsByTarget({args:args2,argTypes}){let groupedArgs={};return Object.entries(args2).forEach(([name2,value2])=>{let{target=UNTARGETED}=argTypes[name2]||{};groupedArgs[target]=groupedArgs[target]||{},groupedArgs[target][name2]=value2}),groupedArgs}function deleteUndefined(obj){return Object.keys(obj).forEach(key2=>obj[key2]===void 0&&delete obj[key2]),obj}var ArgsStore=class{constructor(){this.initialArgsByStoryId={},this.argsByStoryId={}}get(storyId){if(!(storyId in this.argsByStoryId))throw new Error( ` No args known for $ { storyId } -- has it been rendered yet ? ` );return this.argsByStoryId[storyId]}setInitial(story){if(!this.initialArgsByStoryId[story.id])this.initialArgsByStoryId[story.id]=story.initialArgs,this.argsByStoryId[story.id]=story.initialArgs;else if(this.initialArgsByStoryId[story.id]!==story.initialArgs){let delta=deepDiff(this.initialArgsByStoryId[story.id],this.argsByStoryId[story.id]);this.initialArgsByStoryId[story.id]=story.initialArgs,this.argsByStoryId[story.id]=story.initialArgs,delta!==DEEPLY_EQUAL&&this.updateFromDelta(story,delta)}}updateFromDelta(story,delta){let validatedDelta=validateOptions(delta,story.argTypes);this.argsByStoryId[story.id]=combineArgs(this.argsByStoryId[story.id],validatedDelta)}updateFromPersisted(story,persisted){let mappedPersisted=mapArgsToTypes(persisted,story.argTypes);return this.updateFromDelta(story,mappedPersisted)}update(storyId,argsUpdate){if(!(storyId in this.argsByStoryId))throw new Error( ` No args known for $ { storyId } -- has it been rendered yet ? ` );this.argsByStoryId[storyId]=deleteUndefined({...this.argsByStoryId[storyId],...argsUpdate})}},getValuesFromArgTypes=(argTypes={})=>Object.entries(argTypes).reduce((acc,[arg,{defaultValue}])=>(typeof defaultValue<"u"&&(acc[arg]=defaultValue),acc),{}),GlobalsStore=class{constructor({globals={},globalTypes={}}){this.set({globals,globalTypes})}set({globals={},globalTypes={}}){let delta=this.initialGlobals&&deepDiff(this.initialGlobals,this.globals);this.allowedGlobalNames=new Set([...Object.keys(globals),...Object.keys(globalTypes)]);let defaultGlobals=getValuesFromArgTypes(globalTypes);this.initialGlobals={...defaultGlobals,...globals},this.globals=this.initialGlobals,delta&&delta!==DEEPLY_EQUAL&&this.updateFromPersisted(delta)}filterAllowedGlobals(globals){return Object.entries(globals).reduce((acc,[key2,value2])=>(this.allowedGlobalNames.has(key2)?acc[key2]=value2:logger.warn( ` Attempted to set a global ( $ { key2 } ) that is not defined in initial globals or globalTypes ` ),acc),{})}updateFromPersisted(persisted){let allowedUrlGlobals=this.filterAllowedGlobals(persisted);this.globals={...this.globals,...allowedUrlGlobals}}get(){return this.globals}update(newGlobals){this.globals={...this.globals,...this.filterAllowedGlobals(newGlobals)}}},normalizeType=type=>typeof type=
2024-02-08 10:52:22 +01:00
CSF . story annotations deprecated ; annotate story functions directly :
- StoryFn . story . name => StoryFn . storyName
- StoryFn . story . ( parameters | decorators ) => StoryFn . ( parameters | decorators )
See https : //github.com/storybookjs/storybook/blob/next/MIGRATION.md#hoisted-csf-annotations for details and codemod.
2024-06-16 17:30:30 +02:00
` ,deprecatedStoryAnnotationWarning=(0,import_util_deprecate.default)(()=>{},deprecatedStoryAnnotation);function normalizeStory(key2,storyAnnotations,meta){let storyObject=storyAnnotations,userStoryFn=typeof storyAnnotations=="function"?storyAnnotations:null,{story}=storyObject;story&&(logger.debug("deprecated story",story),deprecatedStoryAnnotationWarning());let exportName=M(key2),name2=typeof storyObject!="function"&&storyObject.name||storyObject.storyName||story?.name||exportName,decorators=[...normalizeArrays(storyObject.decorators),...normalizeArrays(story?.decorators)],parameters={...story?.parameters,...storyObject.parameters},args2={...story?.args,...storyObject.args},argTypes={...story?.argTypes,...storyObject.argTypes},loaders=[...normalizeArrays(storyObject.loaders),...normalizeArrays(story?.loaders)],beforeEach=[...normalizeArrays(storyObject.beforeEach),...normalizeArrays(story?.beforeEach)],{render,play,tags=[]}=storyObject,id=parameters.__id||N(meta.id,exportName);return{moduleExport:storyAnnotations,id,name:name2,tags,decorators,parameters,args:args2,argTypes:normalizeInputTypes(argTypes),loaders,beforeEach,...render&&{render},...userStoryFn&&{userStoryFn},...play&&{play}}}function normalizeComponentAnnotations(defaultExport,title=defaultExport.title,importPath){let{id,argTypes}=defaultExport;return{id:O(id||title),...defaultExport,title,...argTypes&&{argTypes:normalizeInputTypes(argTypes)},parameters:{fileName:importPath,...defaultExport.parameters}}}var checkGlobals=parameters=>{let{globals,globalTypes}=parameters;(globals||globalTypes)&&logger.error("Global args/argTypes can only be set globally",JSON.stringify({globals,globalTypes}))},checkStorySort=parameters=>{let{options:options2}=parameters;options2?.storySort&&logger.error("The storySort option parameter can only be set globally")},checkDisallowedParameters=parameters=>{parameters&&(checkGlobals(parameters),checkStorySort(parameters))};function processCSFFile(moduleExports,importPath,title){let{default:defaultExport,__namedExportsOrder,...namedExports}=moduleExports,meta=normalizeComponentAnnotations(defaultExport,title,importPath);checkDisallowedParameters(meta.parameters);let csfFile={meta,stories:{},moduleExports};return Object.keys(namedExports).forEach(key2=>{if(G(key2,meta)){let storyMeta=normalizeStory(key2,namedExports[key2],meta);checkDisallowedParameters(storyMeta.parameters),csfFile.stories[storyMeta.id]=storyMeta}}),csfFile}var combineParameters=(...parameterSets)=>{let mergeKeys={},definedParametersSets=parameterSets.filter(Boolean),combined=definedParametersSets.reduce((acc,parameters)=>(Object.entries(parameters).forEach(([key2,value2])=>{let existing=acc[key2];Array.isArray(value2)||typeof existing>"u"?acc[key2]=value2:(0,import_isPlainObject.default)(value2)&&(0,import_isPlainObject.default)(existing)?mergeKeys[key2]=!0:typeof value2<"u"&&(acc[key2]=value2)}),acc),{});return Object.keys(mergeKeys).forEach(key2=>{let mergeValues=definedParametersSets.filter(Boolean).map(p=>p[key2]).filter(value2=>typeof value2<"u");mergeValues.every(value2=>(0,import_isPlainObject.default)(value2))?combined[key2]=combineParameters(...mergeValues):combined[key2]=mergeValues[mergeValues.length-1]}),combined};function decorateStory(storyFn,decorator,bindWithContext){let boundStoryFunction=bindWithContext(storyFn);return context=>decorator(boundStoryFunction,context)}function sanitizeStoryContextUpdate({componentId,title,kind,id,name:name2,story,parameters,initialArgs,argTypes,...update}={}){return update}function defaultDecorateStory(storyFn,decorators){let contextStore={},bindWithContext=decoratedStoryFn=>update=>{if(!contextStore.value)throw new Error("Decorated function called without init");return contextStore.value={...contextStore.value,...sanitizeStoryContextUpdate(update)},decoratedStoryFn(contextStore.value)},decoratedWithContextStore=decorators.reduce((story,decorator)=>decorateStory(story,decorator,bindWithContext),storyFn);return context=>(contextStore.value=context,decoratedWithContextStore(context))}function prepareStory(storyAnnotation
2024-02-08 10:52:22 +01:00
We 've detected a cycle in arg ' $ { name2 } ' . Args should be JSON - serializable .
Consider using the mapping feature or fully custom args :
- Mapping : https : //storybook.js.org/docs/react/writing-stories/args#mapping-to-complex-arg-values
- Custom args : https : //storybook.js.org/docs/react/essentials/controls#fully-custom-args
2024-06-16 17:30:30 +02:00
` ),{name:"other",value:"cyclic object"}):(visited.add(value2),Array.isArray(value2)?{name:"array",value:value2.length>0?inferType(value2[0],name2,new Set(visited)):{name:"other",value:"unknown"}}:{name:"object",value:(0,import_mapValues.default)(value2,field=>inferType(field,name2,new Set(visited)))}):{name:"object",value:{}}},inferArgTypes=context=>{let{id,argTypes:userArgTypes={},initialArgs={}}=context,argTypes=(0,import_mapValues.default)(initialArgs,(arg,key2)=>({name:key2,type:inferType(arg, ` $ { id } . $ { key2 } ` ,new Set)})),userArgTypesNames=(0,import_mapValues.default)(userArgTypes,(argType,key2)=>({name:key2}));return combineParameters(argTypes,userArgTypesNames,userArgTypes)};inferArgTypes.secondPass=!0;var matches=(name2,descriptor)=>Array.isArray(descriptor)?descriptor.includes(name2):name2.match(descriptor),filterArgTypes=(argTypes,include,exclude)=>!include&&!exclude?argTypes:argTypes&&(0,import_pickBy.default)(argTypes,(argType,key2)=>{let name2=argType.name||key2;return(!include||matches(name2,include))&&(!exclude||!matches(name2,exclude))}),inferControl=(argType,name2,matchers)=>{let{type,options:options2}=argType;if(type){if(matchers.color&&matchers.color.test(name2)){let controlType=type.name;if(controlType==="string")return{control:{type:"color"}};controlType!=="enum"&&logger.warn( ` Addon controls : Control of type color only supports string , received "${controlType}" instead ` )}if(matchers.date&&matchers.date.test(name2))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:value2}=type;return{control:{type:value2?.length<=5?"radio":"select"},options:value2}}case"function":case"symbol":return null;default:return{control:{type:options2?"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_mapValues.default)(filteredArgTypes,(argType,name2)=>argType?.type&&inferControl(argType,name2,matchers));return combineParameters(withControls,filteredArgTypes)};inferControls.secondPass=!0;function normalizeProjectAnnotations({argTypes,globalTypes,argTypesEnhancers,decorators,loaders,beforeEach,...annotations}){return{...argTypes&&{argTypes:normalizeInputTypes(argTypes)},...globalTypes&&{globalTypes:normalizeInputTypes(globalTypes)},decorators:normalizeArrays(decorators),loaders:normalizeArrays(loaders),beforeEach:normalizeArrays(beforeEach),argTypesEnhancers:[...argTypesEnhancers||[],inferArgTypes,inferControls],...annotations}}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=>xs.default?.[field]??xs[field]).filter(Boolean)}function getArrayField(moduleExportList,field,options2={}){return getField(moduleExportList,field).reduce((prev,cur)=>{let normalized=normalizeArrays(cur);return options2.reverseFileOrder?[...normalized,...prev]:[...prev,...normalized]},[])}function getObjectField(moduleExportList,field){return Object.assign({},...getField(moduleExportList,field))}function getSingletonField(moduleExportList,field){return getField(moduleExportList,field).pop()}function composeConfigs(moduleExportList){let allArgTypeEnhancers=getArrayField(moduleExportList,"argTypesEnhancers"),stepRunners=getField(moduleExportList,"runStep");return{parameters:combineParameters(...getField(moduleExportList,"parameters")),decorators:getArrayField(moduleExportList,"decorators",{reverseFileOrder:!(scope.FEATURES?.legacyDecoratorFileOrder??!1)}),args:getObjectField(moduleExportList,"args"),argsEnhancers:getArrayField(moduleExportList,"argsEnhancers"),argTypes:getObjectField(moduleExportList,"argTypes"),a
You should load the story with \ ` await Story.load() \` before rendering it. ` ) } return story . unboundStoryFn ( prepareContext ( context ) ) } , { id : story . id , storyName , load : async ( ) => { for ( let { callback } of [ ... cleanups ] . reverse ( ) ) await callback ( ) ; cleanups . length = 0 , previousCleanupsDone = ! 0 ; let loadedContext = await story . applyLoaders ( context ) ; context . loaded = loadedContext . loaded , cleanups . push ( ... ( await story . applyBeforeEach ( context ) ) . filter ( Boolean ) . map ( callback => ( { storyName , callback } ) ) ) } , args : story . initialArgs , parameters : story . parameters , argTypes : story . argTypes , play : playFunction , tags : story . tags } ) } function composeStories ( storiesImport , globalConfig , composeStoryFn ) { let { default : meta , _ _esModule , _ _namedExportsOrder , ... stories } = storiesImport ; return Object . entries ( stories ) . reduce ( ( storiesMap , [ exportsName , story ] ) => G ( exportsName , meta ) ? Object . assign ( storiesMap , { [ exportsName ] : composeStoryFn ( story , meta , globalConfig , exportsName ) } ) : storiesMap , { } ) } function createPlaywrightTest ( baseTest ) { return baseTest . extend ( { mount : async ( { mount , page } , use ) => { await use ( async ( storyRef , ... restArgs ) => { if ( ! ( "__pw_type" in storyRef ) || "__pw_type" in storyRef && storyRef . _ _pw _type !== "jsx" ) throw new Error ( esm _default `
Portable stories in Playwright CT only work when referencing JSX elements .
Please use JSX format for your components such as :
instead of :
await mount ( MyComponent , { props : { foo : 'bar' } } )
do :
await mount ( < MyComponent foo = "bar" / > )
More info : https : //storybook.js.org/docs/api/portable-stories-playwright
` );await page.evaluate(async wrappedStoryRef=>{let unwrappedStoryRef=await globalThis.__pwUnwrapObject?.(wrappedStoryRef);return("__pw_type"in unwrappedStoryRef?unwrappedStoryRef.type:unwrappedStoryRef)?.load?.()},storyRef);let mountResult=await mount(storyRef,...restArgs);return await page.evaluate(async wrappedStoryRef=>{let unwrappedStoryRef=await globalThis.__pwUnwrapObject?.(wrappedStoryRef),story="__pw_type"in unwrappedStoryRef?unwrappedStoryRef.type:unwrappedStoryRef,canvasElement=document.querySelector("#root");return story?.play?.({canvasElement})},storyRef),mountResult})}})}var CSF_CACHE_SIZE=1e3,STORY_CACHE_SIZE=1e4,StoryStore=class{constructor(storyIndex,importFn,projectAnnotations){this.importFn=importFn,this.getStoriesJsonData=()=>{let value2=this.getSetStoriesPayload(),allowedParameters=["fileName","docsOnly","framework","__id","__isArgsStory"];return{v:3,stories:(0,import_mapValues.default)(value2.stories,story=>{let{importPath}=this.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.storyIndex=new StoryIndexStore(storyIndex),this.projectAnnotations=normalizeProjectAnnotations(projectAnnotations);let{globals,globalTypes}=projectAnnotations;this.args=new ArgsStore,this.globals=new GlobalsStore({globals,globalTypes}),this.hooks={},this.cleanupCallbacks={},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)}setProjectAnnotations(projectAnnotations){this.projectAnnotations=normalizeProjectAnnotations(projectAnnotations);let{globals,globalTypes}=projectAnnotations;this.globals.set({globals,globalTypes})}async onStoriesChanged({importFn,storyIndex}){importFn&&(this.importFn=importFn),storyIndex&&(this.storyIndex.entries=storyIndex.entries),this.cachedCSFFiles&&await this.cacheAllCSFFiles()}async storyIdToEntry(storyId){return this.storyIndex.storyIdToEntry(storyId)}async loadCSFFileByStoryId(storyId){let{importPath,title}=this.storyIndex.storyIdToEntry(storyId),moduleExports=await this.importFn(importPath);return this.processCSFFileWithCache(moduleExports,importPath,title)}async loadAllCSFFiles(){let importPaths={};return Object.entries(this.storyIndex.entries).forEach(([storyId,{importPath}])=>{importPaths[importPath]=storyId}),(await Promise.all(Object.entries(importPaths).map(async([importPath,storyId])=>({importPath,csfFile:await this.loadCSFFileByStoryId(storyId)})))).reduce((acc,{importPath,csfFile})=>(acc[importPath]=csfFile,acc),{})}async cacheAllCSFFiles(){this.cachedCSFFiles=await this.loadAllCSFFiles()}preparedMetaFromCSFFile({csfFile}){let componentAnnotations=csfFile.meta;return this.prepareMetaWithCache(componentAnnotations,this.projectAnnotations,csfFile.moduleExports.default)}async loadStory({storyId}){let csfFile=await this.loadCSFFileByStoryId(storyId);return this.storyFromCSFFile({storyId,csfFile})}storyFromCSFFile({storyId,csfFile}){let storyAnnotations=csfFile.stories[storyId];if(!storyAnnotations)throw new MissingStoryFromCsfFileError({storyId});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}){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),storyImports=entry.type==="docs"?entry.storiesImports:[],[entryExports,...csfFiles]=await Promise.all([this.importFn(entry.importPath),...storyImports.map(storyImportPath=>{let firstStoryEntry=this.storyIndex.importPathToEntry(storyImportPath);return this.loadCS
2024-02-08 10:52:22 +01:00
CSF Auto - title received a numeric fileName . This typically happens when
webpack is mis - configured in production mode . To force webpack to produce
filenames , set optimization . moduleIds = "named" in your webpack config .
2024-06-16 17:30:30 +02:00
` );let normalizedFileName=slash(String(fileName));if(importPathMatcher.exec(normalizedFileName)){if(!userTitle){let suffix=normalizedFileName.replace(directory,""),parts=pathJoin([titlePrefix,suffix]).split("/");return parts=sanitize2(parts),parts.join("/")}return titlePrefix?pathJoin([titlePrefix,userTitle]):userTitle}},userOrAutoTitle=(fileName,storiesEntries,userTitle)=>{for(let i=0;i<storiesEntries.length;i+=1){let title=userOrAutoTitleFromSpecifier(fileName,storiesEntries[i],userTitle);if(title)return title}return userTitle||void 0},STORY_KIND_PATH_SEPARATOR=/ \s * \/ \s */,storySort=(options2={})=>(a,b)=>{if(a.title===b.title&&!options2.includeNames)return 0;let method=options2.method||"configure",order=options2.order||[],storyTitleA=a.title.trim().split(STORY_KIND_PATH_SEPARATOR),storyTitleB=b.title.trim().split(STORY_KIND_PATH_SEPARATOR);options2.includeNames&&(storyTitleA.push(a.name),storyTitleB.push(b.name));let depth=0;for(;storyTitleA[depth]||storyTitleB[depth];){if(!storyTitleA[depth])return-1;if(!storyTitleB[depth])return 1;let nameA=storyTitleA[depth],nameB=storyTitleB[depth];if(nameA!==nameB){let indexA=order.indexOf(nameA),indexB=order.indexOf(nameB),indexWildcard=order.indexOf("*");return indexA!==-1||indexB!==-1?(indexA===-1&&(indexWildcard!==-1?indexA=indexWildcard:indexA=order.length),indexB===-1&&(indexWildcard!==-1?indexB=indexWildcard:indexB=order.length),indexA-indexB):method==="configure"?0:nameA.localeCompare(nameB,options2.locales?options2.locales:void 0,{numeric:!0,sensitivity:"accent"})}let index=order.indexOf(nameA);index===-1&&(index=order.indexOf("*")),order=index!==-1&&Array.isArray(order[index+1])?order[index+1]:[],depth+=1}return 0},sortStoriesCommon=(stories,storySortParameter,fileNameOrder)=>{if(storySortParameter){let sortFn;typeof storySortParameter=="function"?sortFn=storySortParameter:sortFn=storySort(storySortParameter),stories.sort(sortFn)}else stories.sort((s1,s2)=>fileNameOrder.indexOf(s1.importPath)-fileNameOrder.indexOf(s2.importPath));return stories},sortStoriesV7=(stories,storySortParameter,fileNameOrder)=>{try{return sortStoriesCommon(stories,storySortParameter,fileNameOrder)}catch(err){throw new Error(dedent `
2024-02-08 10:52:22 +01:00
Error sorting stories with sort parameter $ { storySortParameter } :
> $ { err . message }
Are you using a V6 - style sort function in V7 mode ?
More info : https : //github.com/storybookjs/storybook/blob/next/MIGRATION.md#v7-style-story-sort
2024-06-16 17:30:30 +02:00
` )}},PREPARE_ABORTED=new Error("prepareAborted"),{AbortController}=globalThis;function serializeError(error){try{let{name:name2="Error",message=String(error),stack}=error;return{name:name2,message,stack}}catch{return{name:"Error",message:String(error)}}}var StoryRender=class{constructor(channel,store,renderToScreen,callbacks,id,viewMode,renderOptions={autoplay:!0,forceInitialArgs:!1},story){this.channel=channel,this.store=store,this.renderToScreen=renderToScreen,this.callbacks=callbacks,this.id=id,this.viewMode=viewMode,this.renderOptions=renderOptions,this.type="story",this.notYetRendered=!0,this.rerenderEnqueued=!1,this.disableKeyListeners=!1,this.teardownRender=()=>{},this.torndown=!1,this.abortController=new AbortController,story&&(this.story=story,this.phase="preparing")}async runPhase(signal,phase,phaseFn){this.phase=phase,this.channel.emit(STORY_RENDER_PHASE_CHANGED,{newPhase:this.phase,storyId:this.id}),phaseFn&&await phaseFn(),signal.aborted&&(this.phase="aborted",this.channel.emit(STORY_RENDER_PHASE_CHANGED,{newPhase:this.phase,storyId:this.id}))}async prepare(){if(await this.runPhase(this.abortController.signal,"preparing",async()=>{this.story=await this.store.loadStory({storyId:this.id})}),this.abortController.signal.aborted)throw await this.store.cleanupStory(this.story),PREPARE_ABORTED}isEqual(other){return!!(this.id===other.id&&this.story&&this.story===other.story)}isPreparing(){return["preparing"].includes(this.phase)}isPending(){return["loading","beforeEach","rendering","playing"].includes(this.phase)}async renderToElement(canvasElement){return this.canvasElement=canvasElement,this.render({initial:!0,forceRemount:!0})}storyContext(){if(!this.story)throw new Error("Cannot call storyContext before preparing");let{forceInitialArgs}=this.renderOptions;return this.store.getStoryContext(this.story,{forceInitialArgs})}async render({initial=!1,forceRemount=!1}={}){let{canvasElement}=this;if(!this.story)throw new Error("cannot render when not prepared");let story=this.story;if(!canvasElement)throw new Error("cannot render when canvasElement is unset");let{id,componentId,title,name:name2,tags,applyLoaders,applyBeforeEach,unboundStoryFn,playFunction}=story;forceRemount&&!initial&&(this.cancelRender(),this.abortController=new AbortController);let abortSignal=this.abortController.signal;try{let loadedContext;if(await this.runPhase(abortSignal,"loading",async()=>{loadedContext=await applyLoaders({...this.storyContext(),viewMode:this.viewMode,canvasElement})}),abortSignal.aborted)return;let renderStoryContext={...loadedContext,...this.storyContext(),abortSignal,canvasElement};if(await this.runPhase(abortSignal,"beforeEach",async()=>{let cleanupCallbacks=await applyBeforeEach(renderStoryContext);this.store.addCleanupCallbacks(story,cleanupCallbacks)}),abortSignal.aborted)return;let renderContext={componentId,title,kind:title,id,name:name2,story:name2,tags,...this.callbacks,showError:error=>(this.phase="errored",this.callbacks.showError(error)),showException:error=>(this.phase="errored",this.callbacks.showException(error)),forceRemount:forceRemount||this.notYetRendered,storyContext:renderStoryContext,storyFn:()=>unboundStoryFn(renderStoryContext),unboundStoryFn};if(await this.runPhase(abortSignal,"rendering",async()=>{let teardown=await this.renderToScreen(renderContext,canvasElement);this.teardownRender=teardown||(()=>{})}),this.notYetRendered=!1,abortSignal.aborted)return;let ignoreUnhandledErrors=this.story.parameters?.test?.dangerouslyIgnoreUnhandledErrors===!0,unhandledErrors=new Set,onError=event=>unhandledErrors.add("error"in event?event.error:event.reason);if(this.renderOptions.autoplay&&forceRemount&&playFunction&&this.phase!=="errored"){window.addEventListener("error",onError),window.addEventListener("unhandledrejection",onError),this.disableKeyListeners=!0;try{await this.runPhase(abortSignal,"playing",async()=>{await playFunction(renderContext.storyContext)}),!ignoreUnhandledErrors&&unhandledErrors.size>0?await this.runPhase(abortSignal,"errored"):await this.runPhase(abortSignal,"played")}catch(error){if(aw
2024-02-08 10:52:22 +01:00
- Did you pass a component to the 'of' prop when the block only supports a story or a meta ?
- ... or vice versa ?
2024-06-16 17:30:30 +02:00
- Did you pass a story , CSF file or meta to the 'of' prop that is not indexed , ie . is not targeted by the 'stories' globs in the main configuration ? ` )}switch(resolved.type){case"component":return{...resolved,projectAnnotations:this.projectAnnotations};case"meta":return{...resolved,preparedMeta:this.store.preparedMetaFromCSFFile({csfFile:resolved.csfFile})};case"story":default:return resolved}}},CsfDocsRender=class{constructor(channel,store,entry,callbacks){this.channel=channel,this.store=store,this.entry=entry,this.callbacks=callbacks,this.type="docs",this.subtype="csf",this.torndown=!1,this.disableKeyListeners=!1,this.preparing=!1,this.id=entry.id}isPreparing(){return this.preparing}async prepare(){this.preparing=!0;let{entryExports,csfFiles=[]}=await this.store.loadEntry(this.id);if(this.torndown)throw PREPARE_ABORTED;let{importPath,title}=this.entry,primaryCsfFile=this.store.processCSFFileWithCache(entryExports,importPath,title),primaryStoryId=Object.keys(primaryCsfFile.stories)[0];this.story=this.store.storyFromCSFFile({storyId:primaryStoryId,csfFile:primaryCsfFile}),this.csfFiles=[primaryCsfFile,...csfFiles],this.preparing=!1}isEqual(other){return!!(this.id===other.id&&this.story&&this.story===other.story)}docsContext(renderStoryToElement){if(!this.csfFiles)throw new Error("Cannot render docs before preparing");let docsContext=new DocsContext(this.channel,this.store,renderStoryToElement,this.csfFiles);return this.csfFiles.forEach(csfFile=>docsContext.attachCSFFile(csfFile)),docsContext}async renderToElement(canvasElement,renderStoryToElement){if(!this.story||!this.csfFiles)throw new Error("Cannot render docs before preparing");let docsContext=this.docsContext(renderStoryToElement),{docs:docsParameter}=this.story.parameters||{};if(!docsParameter)throw new Error("Cannot render a story in viewMode=docs if ` @ storybook / addon - docs ` is not installed");let renderer=await docsParameter.renderer(),{render}=renderer,renderDocs=async()=>{try{await render(docsContext,docsParameter,canvasElement),this.channel.emit(DOCS_RENDERED,this.id)}catch(err){this.callbacks.showException(err)}};return this.rerender=async()=>renderDocs(),this.teardownRender=async({viewModeChanged})=>{!viewModeChanged||!canvasElement||renderer.unmount(canvasElement)},renderDocs()}async teardown({viewModeChanged}={}){this.teardownRender?.({viewModeChanged}),this.torndown=!0}},MdxDocsRender=class{constructor(channel,store,entry,callbacks){this.channel=channel,this.store=store,this.entry=entry,this.callbacks=callbacks,this.type="docs",this.subtype="mdx",this.torndown=!1,this.disableKeyListeners=!1,this.preparing=!1,this.id=entry.id}isPreparing(){return this.preparing}async prepare(){this.preparing=!0;let{entryExports,csfFiles=[]}=await this.store.loadEntry(this.id);if(this.torndown)throw PREPARE_ABORTED;this.csfFiles=csfFiles,this.exports=entryExports,this.preparing=!1}isEqual(other){return!!(this.id===other.id&&this.exports&&this.exports===other.exports)}docsContext(renderStoryToElement){if(!this.csfFiles)throw new Error("Cannot render docs before preparing");return new DocsContext(this.channel,this.store,renderStoryToElement,this.csfFiles)}async renderToElement(canvasElement,renderStoryToElement){if(!this.exports||!this.csfFiles||!this.store.projectAnnotations)throw new Error("Cannot render docs before preparing");let docsContext=this.docsContext(renderStoryToElement),{docs}=this.store.projectAnnotations.parameters||{};if(!docs)throw new Error("Cannot render a story in viewMode=docs if ` @ storybook / addon - docs ` is not installed");let docsParameter={...docs,page:this.exports.default},renderer=await docs.renderer(),{render}=renderer,renderDocs=async()=>{try{await render(docsContext,docsParameter,canvasElement),this.channel.emit(DOCS_RENDERED,this.id)}catch(err){this.callbacks.showException(err)}};return this.rerender=async()=>renderDocs(),this.teardownRender=async({viewModeChanged}={})=>{!viewModeChanged||!canvasElement||(renderer.unmount(canvasElement),this.torndown=!0)},renderDocs()}async teardown({viewModeChanged}={}){this.teardownRender?.({viewModeChan
2024-02-08 10:52:22 +01:00
Omitted potentially unsafe URL args .
More info : https : //storybook.js.org/docs/react/writing-stories/args#setting-args-through-the-url
2024-06-16 17:30:30 +02:00
` ),acc),{})},{history,document:document22}=scope;function pathToId(path){let match=(path||"").match(/^ \/ story \/ (.+)/);if(!match)throw new Error( ` Invalid path '${path}' , must start with '/story/' ` );return match[1]}var getQueryString=({selection,extraParams})=>{let search=typeof document22<"u"?document22.location.search:"",{path,selectedKind,selectedStory,...rest}=import_qs.default.parse(search,{ignoreQueryPrefix:!0});return import_qs.default.stringify({...rest,...extraParams,...selection&&{id:selection.storyId,viewMode:selection.viewMode}},{encode:!1,addQueryPrefix:!0})},setPath=selection=>{if(!selection)return;let query=getQueryString({selection}),{hash=""}=document22.location;document22.title=selection.storyId,history.replaceState({},"", ` $ { document22 . location . pathname } $ { query } $ { hash } ` )},isObject4=val=>val!=null&&typeof val=="object"&&Array.isArray(val)===!1,getFirstString=v2=>{if(v2!==void 0){if(typeof v2=="string")return v2;if(Array.isArray(v2))return getFirstString(v2[0]);if(isObject4(v2))return getFirstString(Object.values(v2).filter(Boolean))}},getSelectionSpecifierFromPath=()=>{if(typeof document22<"u"){let query=import_qs.default.parse(document22.location.search,{ignoreQueryPrefix:!0}),args2=typeof query.args=="string"?parseArgsParam(query.args):void 0,globals=typeof query.globals=="string"?parseArgsParam(query.globals):void 0,viewMode=getFirstString(query.viewMode);(typeof viewMode!="string"||!viewMode.match(/docs|story/))&&(viewMode="story");let path=getFirstString(query.path),storyId=path?pathToId(path):getFirstString(query.id);if(storyId)return{storySpecifier:storyId,args:args2,globals,viewMode}}return null},UrlStore=class{constructor(){this.selectionSpecifier=getSelectionSpecifierFromPath()}setSelection(selection){this.selection=selection,setPath(this.selection)}setQueryParams(queryParams){let query=getQueryString({extraParams:queryParams}),{hash=""}=document22.location;history.replaceState({},"", ` $ { document22 . location . pathname } $ { query } $ { hash } ` )}},import_ansi_to_html=__toESM3(require_ansi_to_html()),{document:document3}=scope,PREPARING_DELAY=100,Mode=(Mode2=>(Mode2.MAIN="MAIN",Mode2.NOPREVIEW="NOPREVIEW",Mode2.PREPARING_STORY="PREPARING_STORY",Mode2.PREPARING_DOCS="PREPARING_DOCS",Mode2.ERROR="ERROR",Mode2))(Mode||{}),classes={PREPARING_STORY:"sb-show-preparing-story",PREPARING_DOCS:"sb-show-preparing-docs",MAIN:"sb-show-main",NOPREVIEW:"sb-show-nopreview",ERROR:"sb-show-errordisplay"},layoutClassMap={centered:"sb-main-centered",fullscreen:"sb-main-fullscreen",padded:"sb-main-padded"},ansiConverter=new import_ansi_to_html.default({escapeXML:!0}),WebView=class{constructor(){if(this.testing=!1,typeof document3<"u"){let{__SPECIAL_TEST_PARAMETER__}=import_qs.default.parse(document3.location.search,{ignoreQueryPrefix:!0});switch(__SPECIAL_TEST_PARAMETER__){case"preparing-story":{this.showPreparingStory(),this.testing=!0;break}case"preparing-docs":{this.showPreparingDocs(),this.testing=!0;break}}}}prepareForStory(story){return this.showStory(),this.applyLayout(story.parameters.layout),document3.documentElement.scrollTop=0,document3.documentElement.scrollLeft=0,this.storyRoot()}storyRoot(){return document3.getElementById("storybook-root")}prepareForDocs(){return this.showMain(),this.showDocs(),this.applyLayout("fullscreen"),document3.documentElement.scrollTop=0,document3.documentElement.scrollLeft=0,this.docsRoot()}docsRoot(){return document3.getElementById("storybook-docs")}applyLayout(layout="padded"){if(layout==="none"){document3.body.classList.remove(this.currentLayoutClass),this.currentLayoutClass=null;return}this.checkIfLayoutExists(layout);let layoutClass=layoutClassMap[layout];document3.body.classList.remove(this.currentLayoutClass),document3.body.classList.add(layoutClass),this.currentLayoutClass=layoutClass}checkIfLayoutExists(layout){layoutClassMap[layout]||logger.warn(dedent `
The desired layout : $ { layout } is not a valid option .
The possible options are : $ { Object . keys ( layoutClassMap ) . join ( ", " ) } , none .
` )}showMode(mode){clearTimeout(this.preparingTimeout),Object.keys(Mode).forEach(otherMode=>{otherMode===mode?document3.body.classList.add(classes[otherMode]):document3.body.classList.remove(classes[otherMode])})}showErrorDisplay({message="",stack=""}){let header=message,detail=stack,parts=message.split( `
2024-02-08 10:52:22 +01:00
` );parts.length>1&&([header]=parts,detail=parts.slice(1).join( `
2024-06-16 17:30:30 +02:00
` ).replace(/^ \n /,"")),document3.getElementById("error-message").innerHTML=ansiConverter.toHtml(header),document3.getElementById("error-stack").innerHTML=ansiConverter.toHtml(detail),this.showMode("ERROR")}showNoPreview(){this.testing||(this.showMode("NOPREVIEW"),this.storyRoot()?.setAttribute("hidden","true"),this.docsRoot()?.setAttribute("hidden","true"))}showPreparingStory({immediate=!1}={}){clearTimeout(this.preparingTimeout),immediate?this.showMode("PREPARING_STORY"):this.preparingTimeout=setTimeout(()=>this.showMode("PREPARING_STORY"),PREPARING_DELAY)}showPreparingDocs({immediate=!1}={}){clearTimeout(this.preparingTimeout),immediate?this.showMode("PREPARING_DOCS"):this.preparingTimeout=setTimeout(()=>this.showMode("PREPARING_DOCS"),PREPARING_DELAY)}showMain(){this.showMode("MAIN")}showDocs(){this.storyRoot().setAttribute("hidden","true"),this.docsRoot().removeAttribute("hidden")}showStory(){this.docsRoot().setAttribute("hidden","true"),this.storyRoot().removeAttribute("hidden")}showStoryDuringRender(){document3.body.classList.add(classes.MAIN)}},PreviewWeb=class extends PreviewWithSelection{constructor(importFn,getProjectAnnotations){super(importFn,getProjectAnnotations,new UrlStore,new WebView),this.importFn=importFn,this.getProjectAnnotations=getProjectAnnotations,scope.__STORYBOOK_PREVIEW__=this}},{document:document4}=scope,runScriptTypes=["application/javascript","application/ecmascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript","module"],SCRIPT="script",SCRIPTS_ROOT_ID="scripts-root";function simulateDOMContentLoaded(){let DOMContentLoadedEvent=document4.createEvent("Event");DOMContentLoadedEvent.initEvent("DOMContentLoaded",!0,!0),document4.dispatchEvent(DOMContentLoadedEvent)}function insertScript( $ script,callback, $ scriptRoot){let scriptEl=document4.createElement("script");scriptEl.type= $ script.type==="module"?"module":"text/javascript", $ script.src?(scriptEl.onload=callback,scriptEl.onerror=callback,scriptEl.src= $ script.src):scriptEl.textContent= $ script.innerText, $ scriptRoot? $ scriptRoot.appendChild(scriptEl):document4.head.appendChild(scriptEl), $ script.parentNode.removeChild( $ script), $ script.src||callback()}function insertScriptsSequentially(scriptsToExecute,callback,index=0){scriptsToExecute[index](()=>{index++,index===scriptsToExecute.length?callback():insertScriptsSequentially(scriptsToExecute,callback,index)})}function simulatePageLoad( $ container){let $ scriptsRoot=document4.getElementById(SCRIPTS_ROOT_ID); $ scriptsRoot? $ scriptsRoot.innerHTML="":( $ scriptsRoot=document4.createElement("div"), $ scriptsRoot.id=SCRIPTS_ROOT_ID,document4.body.appendChild( $ scriptsRoot));let $ scripts=Array.from( $ container.querySelectorAll(SCRIPT));if( $ scripts.length){let scriptsToExecute=[]; $ scripts.forEach( $ script=>{let typeAttr= $ script.getAttribute("type");(!typeAttr||runScriptTypes.includes(typeAttr))&&scriptsToExecute.push(callback=>insertScript( $ script,callback, $ scriptsRoot))}),scriptsToExecute.length&&insertScriptsSequentially(scriptsToExecute,simulateDOMContentLoaded,void 0)}else simulateDOMContentLoaded()}var dist_exports6={};__export(dist_exports6,{Addon_TypesEnum:()=>Addon_TypesEnum});var Addon_TypesEnum=(Addon_TypesEnum2=>(Addon_TypesEnum2.TAB="tab",Addon_TypesEnum2.PANEL="panel",Addon_TypesEnum2.TOOL="tool",Addon_TypesEnum2.TOOLEXTRA="toolextra",Addon_TypesEnum2.PREVIEW="preview",Addon_TypesEnum2.experimental_PAGE="page",Addon_TypesEnum2.experimental_SIDEBAR_BOTTOM="sidebar-bottom",Addon_TypesEnum2.experimental_SIDEBAR_TOP="sidebar-top",Addon_TypesEnum2))(Addon_TypesEnum||{});var globalsNameValueMap={"@storybook/channels":dist_exports4,"@storybook/client-logger":dist_exports3,"@storybook/core-events":dist_exports,"@storybook/core-events/preview-errors":preview_errors_exports,"@storybook/preview-api":dist_exports5,"@storybook/global":dist_exports2,"@storybook/types":dist_exports