@storybook/nextjs 7.0.0-beta.3 → 7.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/{app-router-provider-5WPYJFG6.mjs → app-router-provider-ZH4HRNON.mjs} +1 -1
- package/dist/chunk-4MG4OZFL.mjs +1 -0
- package/dist/next-image-loader-stub.mjs +1 -1
- package/dist/preset.mjs +1 -1
- package/dist/preview.mjs +2 -2
- package/package.json +9 -9
- package/dist/chunk-LAHENP5R.mjs +0 -1
package/README.md
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
- [Next.js's Image Component](#nextjss-image-component)
|
|
13
13
|
- [Local Images](#local-images)
|
|
14
14
|
- [Remote Images](#remote-images)
|
|
15
|
-
- [Optimization](#optimization)
|
|
16
15
|
- [AVIF](#avif)
|
|
17
16
|
- [Next.js Routing](#nextjs-routing)
|
|
18
17
|
- [Overriding defaults](#overriding-defaults)
|
|
@@ -20,6 +19,11 @@
|
|
|
20
19
|
- [Default Router](#default-router)
|
|
21
20
|
- [Actions Integration Caveats](#actions-integration-caveats)
|
|
22
21
|
- [Next.js Navigation](#nextjs-navigation)
|
|
22
|
+
- [Set `nextjs.appDirectory` to `true`](#set-nextjsappdirectory-to-true)
|
|
23
|
+
- [Overriding defaults](#overriding-defaults-1)
|
|
24
|
+
- [Global Defaults](#global-defaults-1)
|
|
25
|
+
- [Default Navigation Context](#default-navigation-context)
|
|
26
|
+
- [Actions Integration Caveats](#actions-integration-caveats-1)
|
|
23
27
|
- [Sass/Scss](#sassscss)
|
|
24
28
|
- [Css/Sass/Scss Modules](#csssassscss-modules)
|
|
25
29
|
- [Styled JSX](#styled-jsx)
|
|
@@ -30,9 +34,9 @@
|
|
|
30
34
|
- [Typescript](#typescript)
|
|
31
35
|
- [Notes for Yarn v2 and v3 users](#notes-for-yarn-v2-and-v3-users)
|
|
32
36
|
- [FAQ](#faq)
|
|
33
|
-
- [Stories for pages](#stories-for-
|
|
37
|
+
- [Stories for pages/components which fetch data](#stories-for-pagescomponents-which-fetch-data)
|
|
34
38
|
- [Statically imported images won't load](#statically-imported-images-wont-load)
|
|
35
|
-
- [Module not found: Error: Can't resolve [package name]](#module-not-found-error-cant-resolve-package-name)
|
|
39
|
+
- [Module not found: Error: Can't resolve \[package name\]](#module-not-found-error-cant-resolve-package-name)
|
|
36
40
|
- [Acknowledgements](#acknowledgements)
|
|
37
41
|
|
|
38
42
|
## Supported Features
|
|
@@ -87,7 +91,7 @@ npx storybook@next upgrade --prerelease
|
|
|
87
91
|
Install the framework:
|
|
88
92
|
|
|
89
93
|
```bash
|
|
90
|
-
yarn
|
|
94
|
+
yarn add --dev @storybook/nextjs@next
|
|
91
95
|
```
|
|
92
96
|
|
|
93
97
|
Update your `main.js` to change the framework property:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-4MG4OZFL.mjs";import React from"react";import{AppRouterContext}from"next/dist/shared/lib/app-router-context";import{PathnameContext,SearchParamsContext}from"next/dist/shared/lib/hooks-client-context";var AppRouterProvider=({children,action,routeParams})=>{let{pathname,query,...restRouteParams}=routeParams;return React.createElement(AppRouterContext.Provider,{value:{push(...args){action("nextNavigation.push")(...args)},replace(...args){action("nextNavigation.replace")(...args)},forward(...args){action("nextNavigation.forward")(...args)},back(...args){action("nextNavigation.back")(...args)},prefetch(...args){action("nextNavigation.prefetch")(...args)},refresh:()=>{action("nextNavigation.refresh")()},...restRouteParams}},React.createElement(SearchParamsContext.Provider,{value:new URLSearchParams(query)},React.createElement(PathnameContext.Provider,{value:pathname},children)))},app_router_provider_default=AppRouterProvider;export{app_router_provider_default as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __getOwnPropNames=Object.getOwnPropertyNames;var __require=(x=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(a,b)=>(typeof require<"u"?require:a)[b]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+x+'" is not supported')});var __commonJS=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};export{__require,__commonJS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-4MG4OZFL.mjs";import{interpolateName}from"loader-utils";import imageSizeOf from"image-size";var nextImageLoaderStub=function(content){let{filename}=this.getOptions(),outputPath=interpolateName(this,filename.replace("[ext]",".[ext]"),{context:this.rootContext,content});this.emitFile(outputPath,content);let{width,height}=imageSizeOf(this.resourcePath);return`export default ${JSON.stringify({src:outputPath,height,width,blurDataURL:outputPath})};`};nextImageLoaderStub.raw=!0;var next_image_loader_stub_default=nextImageLoaderStub;export{next_image_loader_stub_default as default};
|
package/dist/preset.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__require}from"./chunk-
|
|
1
|
+
import{__require}from"./chunk-4MG4OZFL.mjs";import{dirname,join}from"path";import{loadPartialConfig}from"@babel/core";import{getProjectRoot}from"@storybook/core-common";import semver from"semver";import{DefinePlugin as DefinePlugin2}from"webpack";import path from"path";import{DefinePlugin}from"webpack";import{PHASE_DEVELOPMENT_SERVER}from"next/constants";import findUp from"find-up";import{pathExists}from"fs-extra";import dedent from"ts-dedent";import{pathToFileURL}from"url";var configureRuntimeNextjsVersionResolution=baseConfig=>{baseConfig.plugins?.push(new DefinePlugin({"process.env.__NEXT_VERSION":JSON.stringify(getNextjsVersion())}))},getNextjsVersion=()=>__require(scopedResolve("next/package.json")).version,findNextConfigFile=async configDir=>["mjs","js"].reduce(async(acc,ext)=>(await acc||(acc=findUp(`next.config.${ext}`,{cwd:configDir})),acc),Promise.resolve(void 0)),resolveNextConfig=async({baseConfig={},nextConfigPath,configDir})=>{let nextConfigFile=nextConfigPath||await findNextConfigFile(configDir);if(!nextConfigFile||await pathExists(nextConfigFile)===!1)throw new Error(dedent`
|
|
2
2
|
Could not find or resolve your Next config file. Please provide the next config file path as a framework option.
|
|
3
3
|
|
|
4
4
|
More info: https://github.com/storybookjs/storybook/blob/next/code/frameworks/nextjs/README.md#options
|
package/dist/preview.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__commonJS,__require}from"./chunk-
|
|
1
|
+
import{__commonJS,__require}from"./chunk-4MG4OZFL.mjs";var require_client_only=__commonJS({"../../node_modules/client-only/index.js"(){}});var require_index=__commonJS({"../../node_modules/styled-jsx/dist/index/index.js"(exports){require_client_only();var React5=__require("react");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React5);function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}var isProd=typeof process<"u"&&process.env&&process.env.NODE_ENV==="production",isString=function(o){return Object.prototype.toString.call(o)==="[object String]"},StyleSheet=function(){function StyleSheet2(param){var ref=param===void 0?{}:param,_name=ref.name,name=_name===void 0?"stylesheet":_name,_optimizeForSpeed=ref.optimizeForSpeed,optimizeForSpeed=_optimizeForSpeed===void 0?isProd:_optimizeForSpeed;invariant$1(isString(name),"`name` must be a string"),this._name=name,this._deletedRulePlaceholder="#"+name+"-deleted-rule____{}",invariant$1(typeof optimizeForSpeed=="boolean","`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=optimizeForSpeed,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var node=typeof window<"u"&&document.querySelector('meta[property="csp-nonce"]');this._nonce=node?node.getAttribute("content"):null}var _proto=StyleSheet2.prototype;return _proto.setOptimizeForSpeed=function(bool){invariant$1(typeof bool=="boolean","`setOptimizeForSpeed` accepts a boolean"),invariant$1(this._rulesCount===0,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=bool,this.inject()},_proto.isOptimizeForSpeed=function(){return this._optimizeForSpeed},_proto.inject=function(){var _this=this;if(invariant$1(!this._injected,"sheet already injected"),this._injected=!0,typeof window<"u"&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(isProd||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(rule,index){return typeof index=="number"?_this._serverSheet.cssRules[index]={cssText:rule}:_this._serverSheet.cssRules.push({cssText:rule}),index},deleteRule:function(index){_this._serverSheet.cssRules[index]=null}}},_proto.getSheetForTag=function(tag){if(tag.sheet)return tag.sheet;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].ownerNode===tag)return document.styleSheets[i]},_proto.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},_proto.insertRule=function(rule,index){if(invariant$1(isString(rule),"`insertRule` accepts only strings"),typeof window>"u")return typeof index!="number"&&(index=this._serverSheet.cssRules.length),this._serverSheet.insertRule(rule,index),this._rulesCount++;if(this._optimizeForSpeed){var sheet=this.getSheet();typeof index!="number"&&(index=sheet.cssRules.length);try{sheet.insertRule(rule,index)}catch{return isProd||console.warn(`StyleSheet: illegal rule:
|
|
2
2
|
|
|
3
3
|
`+rule+`
|
|
4
4
|
|
|
@@ -7,4 +7,4 @@ See https://stackoverflow.com/q/20007992 for more info`),-1}}else{var insertionP
|
|
|
7
7
|
`+rule+`
|
|
8
8
|
|
|
9
9
|
See https://stackoverflow.com/q/20007992 for more info`),sheet.insertRule(this._deletedRulePlaceholder,index)}}else{var tag=this._tags[index];invariant$1(tag,"old rule at index `"+index+"` not found"),tag.textContent=rule}return index},_proto.deleteRule=function(index){if(typeof window>"u"){this._serverSheet.deleteRule(index);return}if(this._optimizeForSpeed)this.replaceRule(index,"");else{var tag=this._tags[index];invariant$1(tag,"rule at index `"+index+"` not found"),tag.parentNode.removeChild(tag),this._tags[index]=null}},_proto.flush=function(){this._injected=!1,this._rulesCount=0,typeof window<"u"?(this._tags.forEach(function(tag){return tag&&tag.parentNode.removeChild(tag)}),this._tags=[]):this._serverSheet.cssRules=[]},_proto.cssRules=function(){var _this=this;return typeof window>"u"?this._serverSheet.cssRules:this._tags.reduce(function(rules,tag){return tag?rules=rules.concat(Array.prototype.map.call(_this.getSheetForTag(tag).cssRules,function(rule){return rule.cssText===_this._deletedRulePlaceholder?null:rule})):rules.push(null),rules},[])},_proto.makeStyleTag=function(name,cssString,relativeToTag){cssString&&invariant$1(isString(cssString),"makeStyleTag accepts only strings as second parameter");var tag=document.createElement("style");this._nonce&&tag.setAttribute("nonce",this._nonce),tag.type="text/css",tag.setAttribute("data-"+name,""),cssString&&tag.appendChild(document.createTextNode(cssString));var head=document.head||document.getElementsByTagName("head")[0];return relativeToTag?head.insertBefore(tag,relativeToTag):head.appendChild(tag),tag},_createClass(StyleSheet2,[{key:"length",get:function(){return this._rulesCount}}]),StyleSheet2}();function invariant$1(condition,message){if(!condition)throw new Error("StyleSheet: "+message+".")}function hash(str){for(var _$hash=5381,i=str.length;i;)_$hash=_$hash*33^str.charCodeAt(--i);return _$hash>>>0}var stringHash=hash,sanitize=function(rule){return rule.replace(/\/style/gi,"\\/style")},cache={};function computeId(baseId,props){if(!props)return"jsx-"+baseId;var propsToString=String(props),key=baseId+propsToString;return cache[key]||(cache[key]="jsx-"+stringHash(baseId+"-"+propsToString)),cache[key]}function computeSelector(id,css){var selectoPlaceholderRegexp=/__jsx-style-dynamic-selector/g;typeof window>"u"&&(css=sanitize(css));var idcss=id+css;return cache[idcss]||(cache[idcss]=css.replace(selectoPlaceholderRegexp,id)),cache[idcss]}function mapRulesToStyle(cssRules,options){return options===void 0&&(options={}),cssRules.map(function(args){var id=args[0],css=args[1];return React__default.default.createElement("style",{id:"__"+id,key:"__"+id,nonce:options.nonce?options.nonce:void 0,dangerouslySetInnerHTML:{__html:css}})})}var StyleSheetRegistry=function(){function StyleSheetRegistry2(param){var ref=param===void 0?{}:param,_styleSheet=ref.styleSheet,styleSheet=_styleSheet===void 0?null:_styleSheet,_optimizeForSpeed=ref.optimizeForSpeed,optimizeForSpeed=_optimizeForSpeed===void 0?!1:_optimizeForSpeed;this._sheet=styleSheet||new StyleSheet({name:"styled-jsx",optimizeForSpeed}),this._sheet.inject(),styleSheet&&typeof optimizeForSpeed=="boolean"&&(this._sheet.setOptimizeForSpeed(optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var _proto=StyleSheetRegistry2.prototype;return _proto.add=function(props){var _this=this;this._optimizeForSpeed===void 0&&(this._optimizeForSpeed=Array.isArray(props.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),typeof window<"u"&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(acc,tagName){return acc[tagName]=0,acc},{}));var ref=this.getIdAndRules(props),styleId=ref.styleId,rules=ref.rules;if(styleId in this._instancesCounts){this._instancesCounts[styleId]+=1;return}var indices=rules.map(function(rule){return _this._sheet.insertRule(rule)}).filter(function(index){return index!==-1});this._indices[styleId]=indices,this._instancesCounts[styleId]=1},_proto.remove=function(props){var _this=this,styleId=this.getIdAndRules(props).styleId;if(invariant(styleId in this._instancesCounts,"styleId: `"+styleId+"` not found"),this._instancesCounts[styleId]-=1,this._instancesCounts[styleId]<1){var tagFromServer=this._fromServer&&this._fromServer[styleId];tagFromServer?(tagFromServer.parentNode.removeChild(tagFromServer),delete this._fromServer[styleId]):(this._indices[styleId].forEach(function(index){return _this._sheet.deleteRule(index)}),delete this._indices[styleId]),delete this._instancesCounts[styleId]}},_proto.update=function(props,nextProps){this.add(nextProps),this.remove(props)},_proto.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},_proto.cssRules=function(){var _this=this,fromServer=this._fromServer?Object.keys(this._fromServer).map(function(styleId){return[styleId,_this._fromServer[styleId]]}):[],cssRules2=this._sheet.cssRules();return fromServer.concat(Object.keys(this._indices).map(function(styleId){return[styleId,_this._indices[styleId].map(function(index){return cssRules2[index].cssText}).join(_this._optimizeForSpeed?"":`
|
|
10
|
-
`)]}).filter(function(rule){return Boolean(rule[1])}))},_proto.styles=function(options){return mapRulesToStyle(this.cssRules(),options)},_proto.getIdAndRules=function(props){var css=props.children,dynamic=props.dynamic,id=props.id;if(dynamic){var styleId=computeId(id,dynamic);return{styleId,rules:Array.isArray(css)?css.map(function(rule){return computeSelector(styleId,rule)}):[computeSelector(styleId,css)]}}return{styleId:computeId(id),rules:Array.isArray(css)?css:[css]}},_proto.selectFromServer=function(){var elements=Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]'));return elements.reduce(function(acc,element){var id=element.id.slice(2);return acc[id]=element,acc},{})},StyleSheetRegistry2}();function invariant(condition,message){if(!condition)throw new Error("StyleSheetRegistry: "+message+".")}var StyleSheetContext=React5.createContext(null);StyleSheetContext.displayName="StyleSheetContext";function createStyleRegistry(){return new StyleSheetRegistry}function StyleRegistry2(param){var configuredRegistry=param.registry,children=param.children,rootRegistry=React5.useContext(StyleSheetContext),ref=React5.useState(function(){return rootRegistry||configuredRegistry||createStyleRegistry()}),registry=ref[0];return React__default.default.createElement(StyleSheetContext.Provider,{value:registry},children)}function useStyleRegistry(){return React5.useContext(StyleSheetContext)}var useInsertionEffect=React__default.default.useInsertionEffect||React__default.default.useLayoutEffect,defaultRegistry=typeof window<"u"?createStyleRegistry():void 0;function JSXStyle(props){var registry=defaultRegistry||useStyleRegistry();return registry?typeof window>"u"?(registry.add(props),null):(useInsertionEffect(function(){return registry.add(props),function(){registry.remove(props)}},[props.id,String(props.dynamic)]),null):null}JSXStyle.dynamic=function(info){return info.map(function(tagInfo){var baseId=tagInfo[0],props=tagInfo[1];return computeId(baseId,props)}).join(" ")};exports.StyleRegistry=StyleRegistry2;exports.createStyleRegistry=createStyleRegistry;exports.style=JSXStyle;exports.useStyleRegistry=useStyleRegistry}});var require_styled_jsx=__commonJS({"../../node_modules/styled-jsx/index.js"(exports,module){module.exports=require_index()}});import{setConfig}from"next/config";setConfig(process.env.__NEXT_RUNTIME_CONFIG);import*as React2 from"react";import{RouterContext}from"next/dist/shared/lib/router-context";import React from"react";var PageRouterProvider=({children,action:action2,routeParams,globals})=>React.createElement(RouterContext.Provider,{value:{push(...args){return action2("nextRouter.push")(...args),Promise.resolve(!0)},replace(...args){return action2("nextRouter.replace")(...args),Promise.resolve(!0)},reload(...args){action2("nextRouter.reload")(...args)},back(...args){action2("nextRouter.back")(...args)},forward(){action2("nextRouter.forward")()},prefetch(...args){return action2("nextRouter.prefetch")(...args),Promise.resolve()},beforePopState(...args){action2("nextRouter.beforePopState")(...args)},events:{on(...args){action2("nextRouter.events.on")(...args)},off(...args){action2("nextRouter.events.off")(...args)},emit(...args){action2("nextRouter.events.emit")(...args)}},locale:globals?.locale,route:"/",asPath:"/",basePath:"/",isFallback:!1,isLocaleDomain:!1,isReady:!0,isPreview:!1,...routeParams}},children),page_router_provider_default=PageRouterProvider;var AppRouterProvider=React2.lazy(()=>import("./app-router-provider-
|
|
10
|
+
`)]}).filter(function(rule){return Boolean(rule[1])}))},_proto.styles=function(options){return mapRulesToStyle(this.cssRules(),options)},_proto.getIdAndRules=function(props){var css=props.children,dynamic=props.dynamic,id=props.id;if(dynamic){var styleId=computeId(id,dynamic);return{styleId,rules:Array.isArray(css)?css.map(function(rule){return computeSelector(styleId,rule)}):[computeSelector(styleId,css)]}}return{styleId:computeId(id),rules:Array.isArray(css)?css:[css]}},_proto.selectFromServer=function(){var elements=Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]'));return elements.reduce(function(acc,element){var id=element.id.slice(2);return acc[id]=element,acc},{})},StyleSheetRegistry2}();function invariant(condition,message){if(!condition)throw new Error("StyleSheetRegistry: "+message+".")}var StyleSheetContext=React5.createContext(null);StyleSheetContext.displayName="StyleSheetContext";function createStyleRegistry(){return new StyleSheetRegistry}function StyleRegistry2(param){var configuredRegistry=param.registry,children=param.children,rootRegistry=React5.useContext(StyleSheetContext),ref=React5.useState(function(){return rootRegistry||configuredRegistry||createStyleRegistry()}),registry=ref[0];return React__default.default.createElement(StyleSheetContext.Provider,{value:registry},children)}function useStyleRegistry(){return React5.useContext(StyleSheetContext)}var useInsertionEffect=React__default.default.useInsertionEffect||React__default.default.useLayoutEffect,defaultRegistry=typeof window<"u"?createStyleRegistry():void 0;function JSXStyle(props){var registry=defaultRegistry||useStyleRegistry();return registry?typeof window>"u"?(registry.add(props),null):(useInsertionEffect(function(){return registry.add(props),function(){registry.remove(props)}},[props.id,String(props.dynamic)]),null):null}JSXStyle.dynamic=function(info){return info.map(function(tagInfo){var baseId=tagInfo[0],props=tagInfo[1];return computeId(baseId,props)}).join(" ")};exports.StyleRegistry=StyleRegistry2;exports.createStyleRegistry=createStyleRegistry;exports.style=JSXStyle;exports.useStyleRegistry=useStyleRegistry}});var require_styled_jsx=__commonJS({"../../node_modules/styled-jsx/index.js"(exports,module){module.exports=require_index()}});import{setConfig}from"next/config";setConfig(process.env.__NEXT_RUNTIME_CONFIG);import*as React2 from"react";import{RouterContext}from"next/dist/shared/lib/router-context";import React from"react";var PageRouterProvider=({children,action:action2,routeParams,globals})=>React.createElement(RouterContext.Provider,{value:{push(...args){return action2("nextRouter.push")(...args),Promise.resolve(!0)},replace(...args){return action2("nextRouter.replace")(...args),Promise.resolve(!0)},reload(...args){action2("nextRouter.reload")(...args)},back(...args){action2("nextRouter.back")(...args)},forward(){action2("nextRouter.forward")()},prefetch(...args){return action2("nextRouter.prefetch")(...args),Promise.resolve()},beforePopState(...args){action2("nextRouter.beforePopState")(...args)},events:{on(...args){action2("nextRouter.events.on")(...args)},off(...args){action2("nextRouter.events.off")(...args)},emit(...args){action2("nextRouter.events.emit")(...args)}},locale:globals?.locale,route:"/",asPath:"/",basePath:"/",isFallback:!1,isLocaleDomain:!1,isReady:!0,isPreview:!1,...routeParams}},children),page_router_provider_default=PageRouterProvider;var AppRouterProvider=React2.lazy(()=>import("./app-router-provider-ZH4HRNON.mjs")),action;try{action=__require("@storybook/addon-actions").action}catch{action=()=>()=>{}}var defaultRouterParams={pathname:"/",query:{}},RouterDecorator=(Story,{globals,parameters})=>parameters.nextjs?.appDirectory??!1?React2.createElement(AppRouterProvider,{action,routeParams:{...defaultRouterParams,...parameters.nextjs?.navigation}},React2.createElement(Story,null)):React2.createElement(page_router_provider_default,{action,globals,routeParams:{...defaultRouterParams,...parameters.nextjs?.router}},React2.createElement(Story,null));import*as React3 from"react";var StyleRegistry;try{StyleRegistry=require_styled_jsx().StyleRegistry}catch{StyleRegistry=React3.Fragment}var StyledJsxDecorator=Story=>React3.createElement(StyleRegistry,null,React3.createElement(Story,null));import*as React4 from"react";import semver from"semver";var defaultLoader=({src,width,quality})=>{let missingValues=[];if(src||missingValues.push("src"),width||missingValues.push("width"),missingValues.length>0)throw new Error(`Next Image Optimization requires ${missingValues.join(", ")} to be provided. Make sure you pass them as props to the \`next/image\` component. Received: ${JSON.stringify({src,width,quality})}`);return`${src}?w=${width}&q=${quality??75}`},NextImage=__require("next/image"),OriginalNextImage=NextImage.default;Object.defineProperty(NextImage,"default",{configurable:!0,value:props=>React4.createElement(OriginalNextImage,{...props,loader:props.loader??defaultLoader})});if(semver.satisfies(process.env.__NEXT_VERSION,"^13.0.0")){let OriginalNextLegacyImage=__require("next/legacy/image").default;Object.defineProperty(OriginalNextLegacyImage,"default",{configurable:!0,value:props=>React4.createElement(OriginalNextLegacyImage,{...props,loader:props.loader??defaultLoader})})}if(semver.satisfies(process.env.__NEXT_VERSION,"^12.2.0")){let OriginalNextFutureImage=__require("next/future/image").default;Object.defineProperty(OriginalNextFutureImage,"default",{configurable:!0,value:props=>React4.createElement(OriginalNextFutureImage,{...props,loader:props.loader??defaultLoader})})}var decorators=[StyledJsxDecorator,RouterDecorator];export{decorators};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/nextjs",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.5",
|
|
4
4
|
"description": "Storybook for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -59,12 +59,12 @@
|
|
|
59
59
|
"prep": "../../../scripts/prepare/bundle.ts"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@storybook/builder-webpack5": "7.0.0-beta.
|
|
63
|
-
"@storybook/core-common": "7.0.0-beta.
|
|
64
|
-
"@storybook/node-logger": "7.0.0-beta.
|
|
65
|
-
"@storybook/preset-react-webpack": "7.0.0-beta.
|
|
66
|
-
"@storybook/preview-api": "7.0.0-beta.
|
|
67
|
-
"@storybook/react": "7.0.0-beta.
|
|
62
|
+
"@storybook/builder-webpack5": "7.0.0-beta.5",
|
|
63
|
+
"@storybook/core-common": "7.0.0-beta.5",
|
|
64
|
+
"@storybook/node-logger": "7.0.0-beta.5",
|
|
65
|
+
"@storybook/preset-react-webpack": "7.0.0-beta.5",
|
|
66
|
+
"@storybook/preview-api": "7.0.0-beta.5",
|
|
67
|
+
"@storybook/react": "7.0.0-beta.5",
|
|
68
68
|
"@types/node": "^16.0.0",
|
|
69
69
|
"find-up": "^5.0.0",
|
|
70
70
|
"fs-extra": "^9.0.1",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"tsconfig-paths-webpack-plugin": "^3.5.2"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@storybook/addon-actions": "7.0.0-beta.
|
|
83
|
+
"@storybook/addon-actions": "7.0.0-beta.5",
|
|
84
84
|
"next": "^13.0.5",
|
|
85
85
|
"typescript": "^4.9.3",
|
|
86
86
|
"webpack": "^5.65.0"
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
],
|
|
120
120
|
"platform": "node"
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "8a44bd60808941735aac4a5e9505e8f658131b3e"
|
|
123
123
|
}
|
package/dist/chunk-LAHENP5R.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __getOwnPropNames=Object.getOwnPropertyNames;var __require=(x=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(x,{get:(a,b)=>(typeof require!="undefined"?require:a)[b]}):x)(function(x){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+x+'" is not supported')});var __commonJS=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};export{__require,__commonJS};
|