@storybook/nextjs 7.0.0-alpha.48 → 7.0.0-alpha.50

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.
@@ -0,0 +1 @@
1
+ var d=(a=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(a,{get:(b,c)=>(typeof require!="undefined"?require:b)[c]}):a)(function(a){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+a+'" is not supported')});var e=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);export{d as a,e as b};
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{c as o}from"./chunk-D2N66TOG.mjs";o();export*from"@storybook/react";o();
1
+ export*from"@storybook/react";
@@ -1 +1 @@
1
- "use strict";var f=Object.create;var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var x=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of c(e))!u.call(t,o)&&o!==i&&a(t,o,{get:()=>e[o],enumerable:!(r=m(e,o))||r.enumerable});return t};var d=(t,e,i)=>(i=t!=null?f(h(t)):{},x(e||!t||!t.__esModule?a(i,"default",{value:t,enumerable:!0}):i,t));var n=require("loader-utils"),s=d(require("image-size")),p=function(t){let{filename:e}=this.getOptions(),i=(0,n.interpolateName)(this,e.replace("[ext]",".[ext]"),{context:this.rootContext,content:t});this.emitFile(i,t);let{width:r,height:o}=(0,s.default)(t);return`export default ${JSON.stringify({src:i,height:o,width:r,blurDataURL:i})};`};p.raw=!0;module.exports=p;
1
+ "use strict";var m=Object.create;var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var i in e)a(t,i,{get:e[i],enumerable:!0})},n=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of h(e))!d.call(t,o)&&o!==i&&a(t,o,{get:()=>e[o],enumerable:!(r=c(e,o))||r.enumerable});return t};var x=(t,e,i)=>(i=t!=null?m(u(t)):{},n(e||!t||!t.__esModule?a(i,"default",{value:t,enumerable:!0}):i,t)),g=t=>n(a({},"__esModule",{value:!0}),t);var w={};l(w,{default:()=>L});module.exports=g(w);var s=require("loader-utils"),f=x(require("image-size")),p=function(t){let{filename:e}=this.getOptions(),i=(0,s.interpolateName)(this,e.replace("[ext]",".[ext]"),{context:this.rootContext,content:t});this.emitFile(i,t);let{width:r,height:o}=(0,f.default)(this.resourcePath);return`export default ${JSON.stringify({src:i,height:o,width:r,blurDataURL:i})};`};p.raw=!0;var L=p;0&&(module.exports={});
@@ -1 +1 @@
1
- import{b as p,c as i}from"./chunk-D2N66TOG.mjs";import{interpolateName as f}from"loader-utils";import m from"image-size";var c=p((d,r)=>{i();var o=function(t){let{filename:a}=this.getOptions(),e=f(this,a.replace("[ext]",".[ext]"),{context:this.rootContext,content:t});this.emitFile(e,t);let{width:n,height:s}=m(t);return`export default ${JSON.stringify({src:e,height:s,width:n,blurDataURL:e})};`};o.raw=!0;r.exports=o});export default c();
1
+ import"./chunk-QY6LZ6WI.mjs";import{interpolateName as n}from"loader-utils";import s from"image-size";var i=function(e){let{filename:o}=this.getOptions(),t=n(this,o.replace("[ext]",".[ext]"),{context:this.rootContext,content:e});this.emitFile(t,e);let{width:r,height:a}=s(this.resourcePath);return`export default ${JSON.stringify({src:t,height:a,width:r,blurDataURL:t})};`};i.raw=!0;var m=i;export{m as default};
package/dist/preset.d.ts CHANGED
@@ -720,39 +720,9 @@ PackageJson$1.NonStandardEntryPoints &
720
720
  PackageJson$1.TypeScriptConfiguration &
721
721
  PackageJson$1.YarnConfiguration &
722
722
  PackageJson$1.JSPMConfiguration;
723
-
724
- declare type StoryId = string;
725
723
  declare type Tag = string;
726
- declare type Parameters$1 = {
724
+ interface Parameters {
727
725
  [name: string]: any;
728
- };
729
- declare type Addon_Comparator<T> = ((a: T, b: T) => boolean) | ((a: T, b: T) => number);
730
- declare type Addon_StorySortMethod = 'configure' | 'alphabetical';
731
- interface Addon_StorySortObjectParameter {
732
- method?: Addon_StorySortMethod;
733
- order?: any[];
734
- locales?: string;
735
- includeNames?: boolean;
736
- }
737
- declare type Addon_IndexEntryLegacy = [StoryId, any, Parameters, Parameters];
738
- declare type Addon_StorySortComparator = Addon_Comparator<Addon_IndexEntryLegacy>;
739
- declare type Addon_StorySortParameter = Addon_StorySortComparator | Addon_StorySortObjectParameter;
740
- interface Addon_OptionsParameter extends Object {
741
- storySort?: Addon_StorySortParameter;
742
- theme?: {
743
- base: string;
744
- brandTitle?: string;
745
- };
746
- [key: string]: any;
747
- }
748
- declare type Layout = 'centered' | 'fullscreen' | 'padded' | 'none';
749
- interface Parameters extends Parameters$1 {
750
- fileName?: string;
751
- options?: Addon_OptionsParameter;
752
- /** The layout property defines basic styles added to the preview body where the story is rendered. If you pass 'none', no styles are applied. */
753
- layout?: Layout;
754
- docsOnly?: boolean;
755
- [key: string]: any;
756
726
  }
757
727
 
758
728
  interface Options$1 {
package/dist/preset.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import{a as n,c as s}from"./chunk-D2N66TOG.mjs";s();import{dirname as m,join as l}from"path";s();import{PHASE_DEVELOPMENT_SERVER as E}from"next/constants";import T from"find-up";import{pathExists as W}from"fs-extra";import I from"ts-dedent";import{DefinePlugin as F}from"webpack";s();import u from"path";import{DefinePlugin as N}from"webpack";var d=o=>{o.plugins?.push(new N({"process.env.__NEXT_VERSION":JSON.stringify(c())}))},c=()=>n(f("next/package.json")).version,p=(o,e,t)=>{o.resolve??={},o.resolve.alias??={};let r=o.resolve.alias,i=f(`${t??e}`);Array.isArray(r)?r.push({name:e,alias:i}):r[e]=i},f=o=>{let e=n.resolve(o,{paths:[u.resolve()]}),r=e.lastIndexOf(o.replace(/\//g,u.sep))+o.length;return e.substring(0,r)};var y=async({baseConfig:o,nextConfigPath:e,configDir:t})=>{let r=await L({baseConfig:o,nextConfigPath:e,configDir:t});return p(o,"next/config"),D(o,r),r},A=async o=>["mjs","js"].reduce(async(t,r)=>(await t||(t=T(`next.config.${r}`,{cwd:o})),t),Promise.resolve(void 0)),L=async({baseConfig:o,nextConfigPath:e,configDir:t})=>{let r=e||await A(t);if(!r||await W(r)===!1)throw new Error(I`
1
+ import{a as i}from"./chunk-QY6LZ6WI.mjs";import{dirname as c,join as f}from"path";import{PHASE_DEVELOPMENT_SERVER as S}from"next/constants";import N from"find-up";import{pathExists as E}from"fs-extra";import T from"ts-dedent";import{DefinePlugin as W}from"webpack";import l from"path";import{DefinePlugin as O}from"webpack";var g=o=>{o.plugins?.push(new O({"process.env.__NEXT_VERSION":JSON.stringify(p())}))},p=()=>i(a("next/package.json")).version,n=(o,e,t)=>{o.resolve??={},o.resolve.alias??={};let r=o.resolve.alias,s=a(`${t??e}`);Array.isArray(r)?r.push({name:e,alias:s}):r[e]=s},a=o=>{let e=i.resolve(o,{paths:[l.resolve()]}),r=e.lastIndexOf(o.replace(/\//g,l.sep))+o.length;return e.substring(0,r)};var u=async({baseConfig:o,nextConfigPath:e,configDir:t})=>{let r=await F({baseConfig:o,nextConfigPath:e,configDir:t});return n(o,"next/config"),A(o,r),r},I=async o=>["mjs","js"].reduce(async(t,r)=>(await t||(t=N(`next.config.${r}`,{cwd:o})),t),Promise.resolve(void 0)),F=async({baseConfig:o,nextConfigPath:e,configDir:t})=>{let r=e||await I(t);if(!r||await E(r)===!1)throw new Error(T`
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
5
- `);let i=await import(r);return typeof i=="function"?i(E,{defaultConfig:o}):i},D=(o,e)=>{o.plugins?.push(new F({"process.env.__NEXT_RUNTIME_CONFIG":JSON.stringify({serverRuntimeConfig:{},publicRuntimeConfig:e.publicRuntimeConfig})}))};s();import{getCssModuleLocalIdent as x}from"next/dist/build/webpack/config/blocks/css/loaders/getCssModuleLocalIdent";import{cssFileResolve as w}from"next/dist/build/webpack/config/blocks/css/loaders/file-resolve";import V from"semver";var C=(o,e)=>{let t=o.module?.rules;t?.forEach((r,i)=>{typeof r!="string"&&r.test instanceof RegExp&&r.test.test("test.css")&&(t[i]={test:/\.css$/,use:["style-loader",{loader:"css-loader",options:{importLoaders:1,...k(e),modules:{auto:!0,getLocalIdent:x}}},"postcss-loader"]})}),t?.push({test:/\.(scss|sass)$/,use:["style-loader",{loader:"css-loader",options:{importLoaders:3,...k(e),modules:{auto:!0,getLocalIdent:x}}},"postcss-loader","resolve-url-loader",{loader:"sass-loader",options:{sourceMap:!0,sassOptions:e.sassOptions,additionalData:e.sassOptions?.prependData||e.sassOptions?.additionalData}}]})},k=o=>_()?{url:{filter:b(o)},import:{filter:v(o)}}:{url:b(o),import:v(o)},b=o=>(e,t)=>w(e,t,o.experimental?.urlImports),v=o=>(e,t,r)=>w(typeof e=="string"?e:e.url,r,o.experimental?.urlImports),_=()=>{try{let o=n(f("css-loader/package.json")).version;return V.gte(o,"6.0.0")}catch{return!1}};s();import q from"tsconfig-paths-webpack-plugin";import{loadConfig as $}from"tsconfig-paths";var j=o=>{let e=$();e.resultType==="failed"||!e.baseUrl||(o.resolve??={},o.resolve.plugins??=[],o.resolve.plugins.push(new q({configFile:e.configFileAbsolutePath,extensions:[".js",".jsx",".ts",".tsx"]})))};s();import M from"semver";var R=o=>{let e=J();p(o,e)},J=()=>{let o=c();return M.gte(o,"11.1.0")?"next/dist/shared/lib/router-context":"next/dist/next-server/lib/router-context"};s();import U from"semver";var h=o=>{let e=c();U.gte(e,"12.0.0")?p(o,"styled-jsx"):(p(o,"styled-jsx/babel"),p(o,"styled-jsx/css"),p(o,"styled-jsx/macro"),p(o,"styled-jsx/server"),p(o,"styled-jsx/style"),p(o,"styled-jsx/webpack"))};s();var P=async o=>{o.plugins||=[],o.plugins.includes("styled-jsx/babel")||o.plugins.push("styled-jsx/babel")};s();import X from"semver";var O=o=>{G(o),p(o,"next/image")},G=o=>{let e=c();if(X.lt(e,"11.0.0"))return;let t=o.module?.rules,r=t?.find(i=>typeof i!="string"&&i.test instanceof RegExp&&i.test.test("test.jpg"));!r||(r.test=/\.(apng|eot|otf|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/,t?.push({test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i,issuer:{not:/\.(css|scss|sass)$/},use:[{loader:n.resolve("@storybook/nextjs/next-image-loader-stub.js"),options:{filename:r.generator?.filename}}]}),t?.push({test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i,issuer:/\.(css|scss|sass)$/,type:"asset/resource",generator:{filename:r.generator?.filename}}))};s();import{loadConfig as H}from"tsconfig-paths";var S=async o=>{H().resultType==="success"&&(o.presets||=[],o.presets.includes("@babel/preset-typescript")||o.presets.push("@babel/preset-typescript"))};var Lo=[m(n.resolve(l("@storybook/preset-react-webpack","package.json"))),m(n.resolve(l("@storybook/builder-webpack5","package.json")))],g={},Do=async(o,e)=>{let t=await e.presets.apply("framework");return typeof t=="string"?{name:t,options:g}:typeof t>"u"?{name:n.resolve("@storybook/nextjs"),options:g}:{name:t.name,options:{...g,...t.options}}},Vo=async(o,e)=>{let t=await e.presets.apply("framework");return{...o,builder:{name:m(n.resolve(l("@storybook/builder-webpack5","package.json"))),options:typeof t=="string"?{}:t.options.builder||{}},renderer:m(n.resolve(l("@storybook/react","package.json")))}},_o=(o=[])=>[...o,n.resolve("@storybook/nextjs/preview.js")],qo=async o=>(S(o),P(o),o),$o=async(o,e)=>{let t=await e.presets.apply("frameworkOptions"),{options:{nextConfigPath:r}={}}=t,i=await y({baseConfig:o,nextConfigPath:r,configDir:e.configDir});return d(o),j(o),C(o,i),O(o),R(o),h(o),o};export{Lo as addons,qo as babel,_o as config,Vo as core,Do as frameworkOptions,$o as webpackFinal};
5
+ `);let s=await import(r);return typeof s=="function"?s(S,{defaultConfig:o}):s},A=(o,e)=>{o.plugins?.push(new W({"process.env.__NEXT_RUNTIME_CONFIG":JSON.stringify({serverRuntimeConfig:{},publicRuntimeConfig:e.publicRuntimeConfig})}))};import{getCssModuleLocalIdent as d}from"next/dist/build/webpack/config/blocks/css/loaders/getCssModuleLocalIdent";import{cssFileResolve as b}from"next/dist/build/webpack/config/blocks/css/loaders/file-resolve";import L from"semver";var v=(o,e)=>{let t=o.module?.rules;t?.forEach((r,s)=>{typeof r!="string"&&r.test instanceof RegExp&&r.test.test("test.css")&&(t[s]={test:/\.css$/,use:["style-loader",{loader:"css-loader",options:{importLoaders:1,...y(e),modules:{auto:!0,getLocalIdent:d}}},"postcss-loader"]})}),t?.push({test:/\.(scss|sass)$/,use:["style-loader",{loader:"css-loader",options:{importLoaders:3,...y(e),modules:{auto:!0,getLocalIdent:d}}},"postcss-loader","resolve-url-loader",{loader:"sass-loader",options:{sourceMap:!0,sassOptions:e.sassOptions,additionalData:e.sassOptions?.prependData||e.sassOptions?.additionalData}}]})},y=o=>D()?{url:{filter:x(o)},import:{filter:k(o)}}:{url:x(o),import:k(o)},x=o=>(e,t)=>b(e,t,o.experimental?.urlImports),k=o=>(e,t,r)=>b(typeof e=="string"?e:e.url,r,o.experimental?.urlImports),D=()=>{try{let o=i(a("css-loader/package.json")).version;return L.gte(o,"6.0.0")}catch{return!1}};import V from"tsconfig-paths-webpack-plugin";import{loadConfig as _}from"tsconfig-paths";var w=o=>{let e=_();e.resultType==="failed"||!e.baseUrl||(o.resolve??={},o.resolve.plugins??=[],o.resolve.plugins.push(new V({configFile:e.configFileAbsolutePath,extensions:[".js",".jsx",".ts",".tsx"]})))};import q from"semver";var C=o=>{let e=$();n(o,e)},$=()=>{let o=p();return q.gte(o,"11.1.0")?"next/dist/shared/lib/router-context":"next/dist/next-server/lib/router-context"};import M from"semver";var j=o=>{let e=p();M.gte(e,"12.0.0")?n(o,"styled-jsx"):(n(o,"styled-jsx/babel"),n(o,"styled-jsx/css"),n(o,"styled-jsx/macro"),n(o,"styled-jsx/server"),n(o,"styled-jsx/style"),n(o,"styled-jsx/webpack"))};var R=async o=>{o.plugins||=[],o.plugins.includes("styled-jsx/babel")||o.plugins.push("styled-jsx/babel")};import J from"semver";var h=o=>{U(o),n(o,"next/image")},U=o=>{let e=p();if(J.lt(e,"11.0.0"))return;let t=o.module?.rules,r=t?.find(s=>typeof s!="string"&&s.test instanceof RegExp&&s.test.test("test.jpg"));!r||(r.test=/\.(apng|eot|otf|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/,t?.push({test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i,issuer:{not:/\.(css|scss|sass)$/},use:[{loader:i.resolve("@storybook/nextjs/next-image-loader-stub.js"),options:{filename:r.generator?.filename}}]}),t?.push({test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i,issuer:/\.(css|scss|sass)$/,type:"asset/resource",generator:{filename:r.generator?.filename}}))};import{loadConfig as X}from"tsconfig-paths";var P=async o=>{X().resultType==="success"&&(o.presets||=[],o.presets.includes("@babel/preset-typescript")||o.presets.push("@babel/preset-typescript"))};var Fo=[c(i.resolve(f("@storybook/preset-react-webpack","package.json"))),c(i.resolve(f("@storybook/builder-webpack5","package.json")))],m={},Ao=async(o,e)=>{let t=await e.presets.apply("framework");return typeof t=="string"?{name:t,options:m}:typeof t>"u"?{name:i.resolve("@storybook/nextjs"),options:m}:{name:t.name,options:{...m,...t.options}}},Lo=async(o,e)=>{let t=await e.presets.apply("framework");return{...o,builder:{name:c(i.resolve(f("@storybook/builder-webpack5","package.json"))),options:typeof t=="string"?{}:t.options.builder||{}},renderer:c(i.resolve(f("@storybook/react","package.json")))}},Do=(o=[])=>[...o,i.resolve("@storybook/nextjs/preview.js")],Vo=async o=>(P(o),R(o),o),_o=async(o,e)=>{let t=await e.presets.apply("frameworkOptions"),{options:{nextConfigPath:r}={}}=t,s=await u({baseConfig:o,nextConfigPath:r,configDir:e.configDir});return g(o),w(o),v(o,s),h(o),C(o),j(o),o};export{Fo as addons,Vo as babel,Do as config,Lo as core,Ao as frameworkOptions,_o as webpackFinal};
package/dist/preview.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as lib_types_dist from 'lib/types/dist';
2
2
  import * as react from 'react';
3
3
 
4
- declare const decorators: ((Story: react.FC<{}>, { globals, parameters }: lib_types_dist.Addon_StoryContext<lib_types_dist.AnyFramework>) => react.ReactNode)[];
4
+ declare const decorators: ((Story: react.FC<{}>, { globals, parameters }: lib_types_dist.Addon_StoryContext<lib_types_dist.Renderer>) => react.ReactNode)[];
5
5
 
6
6
  export { decorators };
package/dist/preview.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import{a as g,b as j,c as a,d as l}from"./chunk-D2N66TOG.mjs";var q=j(_=>{a();var m=g("react");function H(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var v=H(m);function P(t,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function U(t,n,i){return n&&P(t.prototype,n),i&&P(t,i),t}var S=typeof process<"u"&&l&&!0,F=function(t){return Object.prototype.toString.call(t)==="[object String]"},$=function(){function t(i){var e=i===void 0?{}:i,r=e.name,o=r===void 0?"stylesheet":r,s=e.optimizeForSpeed,u=s===void 0?S:s;f(F(o),"`name` must be a string"),this._name=o,this._deletedRulePlaceholder="#"+o+"-deleted-rule____{}",f(typeof u=="boolean","`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=u,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var d=typeof window<"u"&&document.querySelector('meta[property="csp-nonce"]');this._nonce=d?d.getAttribute("content"):null}var n=t.prototype;return n.setOptimizeForSpeed=function(e){f(typeof e=="boolean","`setOptimizeForSpeed` accepts a boolean"),f(this._rulesCount===0,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},n.isOptimizeForSpeed=function(){return this._optimizeForSpeed},n.inject=function(){var e=this;if(f(!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||(S||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(r,o){return typeof o=="number"?e._serverSheet.cssRules[o]={cssText:r}:e._serverSheet.cssRules.push({cssText:r}),o},deleteRule:function(r){e._serverSheet.cssRules[r]=null}}},n.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var r=0;r<document.styleSheets.length;r++)if(document.styleSheets[r].ownerNode===e)return document.styleSheets[r]},n.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},n.insertRule=function(e,r){if(f(F(e),"`insertRule` accepts only strings"),typeof window>"u")return typeof r!="number"&&(r=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,r),this._rulesCount++;if(this._optimizeForSpeed){var o=this.getSheet();typeof r!="number"&&(r=o.cssRules.length);try{o.insertRule(e,r)}catch{return S||console.warn(`StyleSheet: illegal rule:
1
+ import{a as v,b as k}from"./chunk-QY6LZ6WI.mjs";var T=k(p=>{var h=v("react");function J(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var y=J(h);function N(t,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function M(t,n,i){return n&&N(t.prototype,n),i&&N(t,i),t}var _=typeof process<"u"&&process.env&&process.env.NODE_ENV==="production",g=function(t){return Object.prototype.toString.call(t)==="[object String]"},H=function(){function t(i){var e=i===void 0?{}:i,r=e.name,o=r===void 0?"stylesheet":r,s=e.optimizeForSpeed,u=s===void 0?_:s;l(g(o),"`name` must be a string"),this._name=o,this._deletedRulePlaceholder="#"+o+"-deleted-rule____{}",l(typeof u=="boolean","`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=u,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var c=typeof window<"u"&&document.querySelector('meta[property="csp-nonce"]');this._nonce=c?c.getAttribute("content"):null}var n=t.prototype;return n.setOptimizeForSpeed=function(e){l(typeof e=="boolean","`setOptimizeForSpeed` accepts a boolean"),l(this._rulesCount===0,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},n.isOptimizeForSpeed=function(){return this._optimizeForSpeed},n.inject=function(){var e=this;if(l(!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||(_||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(r,o){return typeof o=="number"?e._serverSheet.cssRules[o]={cssText:r}:e._serverSheet.cssRules.push({cssText:r}),o},deleteRule:function(r){e._serverSheet.cssRules[r]=null}}},n.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var r=0;r<document.styleSheets.length;r++)if(document.styleSheets[r].ownerNode===e)return document.styleSheets[r]},n.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},n.insertRule=function(e,r){if(l(g(e),"`insertRule` accepts only strings"),typeof window>"u")return typeof r!="number"&&(r=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,r),this._rulesCount++;if(this._optimizeForSpeed){var o=this.getSheet();typeof r!="number"&&(r=o.cssRules.length);try{o.insertRule(e,r)}catch{return _||console.warn(`StyleSheet: illegal rule:
2
2
 
3
3
  `+e+`
4
4
 
5
- See https://stackoverflow.com/q/20007992 for more info`),-1}}else{var s=this._tags[r];this._tags.push(this.makeStyleTag(this._name,e,s))}return this._rulesCount++},n.replaceRule=function(e,r){if(this._optimizeForSpeed||typeof window>"u"){var o=typeof window<"u"?this.getSheet():this._serverSheet;if(r.trim()||(r=this._deletedRulePlaceholder),!o.cssRules[e])return e;o.deleteRule(e);try{o.insertRule(r,e)}catch{S||console.warn(`StyleSheet: illegal rule:
5
+ See https://stackoverflow.com/q/20007992 for more info`),-1}}else{var s=this._tags[r];this._tags.push(this.makeStyleTag(this._name,e,s))}return this._rulesCount++},n.replaceRule=function(e,r){if(this._optimizeForSpeed||typeof window>"u"){var o=typeof window<"u"?this.getSheet():this._serverSheet;if(r.trim()||(r=this._deletedRulePlaceholder),!o.cssRules[e])return e;o.deleteRule(e);try{o.insertRule(r,e)}catch{_||console.warn(`StyleSheet: illegal rule:
6
6
 
7
7
  `+r+`
8
8
 
9
- See https://stackoverflow.com/q/20007992 for more info`),o.insertRule(this._deletedRulePlaceholder,e)}}else{var s=this._tags[e];f(s,"old rule at index `"+e+"` not found"),s.textContent=r}return e},n.deleteRule=function(e){if(typeof window>"u"){this._serverSheet.deleteRule(e);return}if(this._optimizeForSpeed)this.replaceRule(e,"");else{var r=this._tags[e];f(r,"rule at index `"+e+"` not found"),r.parentNode.removeChild(r),this._tags[e]=null}},n.flush=function(){this._injected=!1,this._rulesCount=0,typeof window<"u"?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},n.cssRules=function(){var e=this;return typeof window>"u"?this._serverSheet.cssRules:this._tags.reduce(function(r,o){return o?r=r.concat(Array.prototype.map.call(e.getSheetForTag(o).cssRules,function(s){return s.cssText===e._deletedRulePlaceholder?null:s})):r.push(null),r},[])},n.makeStyleTag=function(e,r,o){r&&f(F(r),"makeStyleTag accepts only strings as second parameter");var s=document.createElement("style");this._nonce&&s.setAttribute("nonce",this._nonce),s.type="text/css",s.setAttribute("data-"+e,""),r&&s.appendChild(document.createTextNode(r));var u=document.head||document.getElementsByTagName("head")[0];return o?u.insertBefore(s,o):u.appendChild(s),s},U(t,[{key:"length",get:function(){return this._rulesCount}}]),t}();function f(t,n){if(!t)throw new Error("StyleSheet: "+n+".")}function G(t){for(var n=5381,i=t.length;i;)n=n*33^t.charCodeAt(--i);return n>>>0}var K=G,Q=function(t){return t.replace(/\/style/gi,"\\/style")},p={};function b(t,n){if(!n)return"jsx-"+t;var i=String(n),e=t+i;return p[e]||(p[e]="jsx-"+K(t+"-"+i)),p[e]}function A(t,n){var i=/__jsx-style-dynamic-selector/g;typeof window>"u"&&(n=Q(n));var e=t+n;return p[e]||(p[e]=n.replace(i,t)),p[e]}function W(t,n){return n===void 0&&(n={}),t.map(function(i){var e=i[0],r=i[1];return v.default.createElement("style",{id:"__"+e,key:"__"+e,nonce:n.nonce?n.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})}var Y=function(){function t(i){var e=i===void 0?{}:i,r=e.styleSheet,o=r===void 0?null:r,s=e.optimizeForSpeed,u=s===void 0?!1:s;this._sheet=o||new $({name:"styled-jsx",optimizeForSpeed:u}),this._sheet.inject(),o&&typeof u=="boolean"&&(this._sheet.setOptimizeForSpeed(u),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var n=t.prototype;return n.add=function(e){var r=this;this._optimizeForSpeed===void 0&&(this._optimizeForSpeed=Array.isArray(e.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(h,V){return h[V]=0,h},{}));var o=this.getIdAndRules(e),s=o.styleId,u=o.rules;if(s in this._instancesCounts){this._instancesCounts[s]+=1;return}var d=u.map(function(h){return r._sheet.insertRule(h)}).filter(function(h){return h!==-1});this._indices[s]=d,this._instancesCounts[s]=1},n.remove=function(e){var r=this,o=this.getIdAndRules(e).styleId;if(Z(o in this._instancesCounts,"styleId: `"+o+"` not found"),this._instancesCounts[o]-=1,this._instancesCounts[o]<1){var s=this._fromServer&&this._fromServer[o];s?(s.parentNode.removeChild(s),delete this._fromServer[o]):(this._indices[o].forEach(function(u){return r._sheet.deleteRule(u)}),delete this._indices[o]),delete this._instancesCounts[o]}},n.update=function(e,r){this.add(r),this.remove(e)},n.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},n.cssRules=function(){var e=this,r=this._fromServer?Object.keys(this._fromServer).map(function(s){return[s,e._fromServer[s]]}):[],o=this._sheet.cssRules();return r.concat(Object.keys(this._indices).map(function(s){return[s,e._indices[s].map(function(u){return o[u].cssText}).join(e._optimizeForSpeed?"":`
10
- `)]}).filter(function(s){return Boolean(s[1])}))},n.styles=function(e){return W(this.cssRules(),e)},n.getIdAndRules=function(e){var r=e.children,o=e.dynamic,s=e.id;if(o){var u=b(s,o);return{styleId:u,rules:Array.isArray(r)?r.map(function(d){return A(u,d)}):[A(u,r)]}}return{styleId:b(s),rules:Array.isArray(r)?r:[r]}},n.selectFromServer=function(){var e=Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]'));return e.reduce(function(r,o){var s=o.id.slice(2);return r[s]=o,r},{})},t}();function Z(t,n){if(!t)throw new Error("StyleSheetRegistry: "+n+".")}var R=m.createContext(null);R.displayName="StyleSheetContext";function z(){return new Y}function ee(t){var n=t.registry,i=t.children,e=m.useContext(R),r=m.useState(function(){return e||n||z()}),o=r[0];return v.default.createElement(R.Provider,{value:o},i)}function T(){return m.useContext(R)}var te=v.default.useInsertionEffect||v.default.useLayoutEffect,E=typeof window<"u"?z():void 0;function I(t){var n=E||T();return n?typeof window>"u"?(n.add(t),null):(te(function(){return n.add(t),function(){n.remove(t)}},[t.id,String(t.dynamic)]),null):null}I.dynamic=function(t){return t.map(function(n){var i=n[0],e=n[1];return b(i,e)}).join(" ")};_.StyleRegistry=ee;_.createStyleRegistry=z;_.style=I;_.useStyleRegistry=T});var X=j((ue,D)=>{a();D.exports=q()});a();a();import{setConfig as B}from"next/config";B(l.__NEXT_RUNTIME_CONFIG);a();import*as w from"react";import{RouterContext as J}from"next/dist/shared/lib/router-context";import N from"next/router";var c;try{c=g("@storybook/addon-actions").action}catch{c=()=>()=>{}}var M={route:"/",pathname:"/",query:{},asPath:"/",push(...t){return c("nextRouter.push")(...t),Promise.resolve(!0)},replace(...t){return c("nextRouter.replace")(...t),Promise.resolve(!0)},reload(...t){c("nextRouter.reload")(...t)},back(...t){c("nextRouter.back")(...t)},prefetch(...t){return c("nextRouter.prefetch")(...t),Promise.resolve()},beforePopState(...t){c("nextRouter.beforePopState")(...t)},events:{on(...t){c("nextRouter.events.on")(...t)},off(...t){c("nextRouter.events.off")(...t)},emit(...t){c("nextRouter.events.emit")(...t)}},isFallback:!1},O=(t,{globals:n,parameters:i})=>{let e=i.nextRouter??{};return N.router={...M,locale:n?.locale,...e},w.createElement(J.Provider,{value:N.router},w.createElement(t,null))};a();import*as y from"react";var C;try{C=X().StyleRegistry}catch{C=y.Fragment}var L=t=>y.createElement(C,null,y.createElement(t,null));a();import*as x from"react";import k from"semver";if(k.gt(l.__NEXT_VERSION,"9.0.0")){let t=g("next/image"),n=t.default;Object.defineProperty(t,"default",{configurable:!0,value:i=>typeof i.src=="string"?x.createElement(n,{...i,unoptimized:!0,blurDataURL:i.src}):x.createElement(n,{...i,unoptimized:!0})}),k.gte(l.__NEXT_VERSION,"12.1.5")&&k.lt(l.__NEXT_VERSION,"12.2.0")&&Object.defineProperty(t,"__esModule",{configurable:!0,value:!0})}var pe=[L,O];export{pe as decorators};
9
+ See https://stackoverflow.com/q/20007992 for more info`),o.insertRule(this._deletedRulePlaceholder,e)}}else{var s=this._tags[e];l(s,"old rule at index `"+e+"` not found"),s.textContent=r}return e},n.deleteRule=function(e){if(typeof window>"u"){this._serverSheet.deleteRule(e);return}if(this._optimizeForSpeed)this.replaceRule(e,"");else{var r=this._tags[e];l(r,"rule at index `"+e+"` not found"),r.parentNode.removeChild(r),this._tags[e]=null}},n.flush=function(){this._injected=!1,this._rulesCount=0,typeof window<"u"?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},n.cssRules=function(){var e=this;return typeof window>"u"?this._serverSheet.cssRules:this._tags.reduce(function(r,o){return o?r=r.concat(Array.prototype.map.call(e.getSheetForTag(o).cssRules,function(s){return s.cssText===e._deletedRulePlaceholder?null:s})):r.push(null),r},[])},n.makeStyleTag=function(e,r,o){r&&l(g(r),"makeStyleTag accepts only strings as second parameter");var s=document.createElement("style");this._nonce&&s.setAttribute("nonce",this._nonce),s.type="text/css",s.setAttribute("data-"+e,""),r&&s.appendChild(document.createTextNode(r));var u=document.head||document.getElementsByTagName("head")[0];return o?u.insertBefore(s,o):u.appendChild(s),s},M(t,[{key:"length",get:function(){return this._rulesCount}}]),t}();function l(t,n){if(!t)throw new Error("StyleSheet: "+n+".")}function U(t){for(var n=5381,i=t.length;i;)n=n*33^t.charCodeAt(--i);return n>>>0}var $=U,G=function(t){return t.replace(/\/style/gi,"\\/style")},d={};function w(t,n){if(!n)return"jsx-"+t;var i=String(n),e=t+i;return d[e]||(d[e]="jsx-"+$(t+"-"+i)),d[e]}function O(t,n){var i=/__jsx-style-dynamic-selector/g;typeof window>"u"&&(n=G(n));var e=t+n;return d[e]||(d[e]=n.replace(i,t)),d[e]}function K(t,n){return n===void 0&&(n={}),t.map(function(i){var e=i[0],r=i[1];return y.default.createElement("style",{id:"__"+e,key:"__"+e,nonce:n.nonce?n.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})}var Q=function(){function t(i){var e=i===void 0?{}:i,r=e.styleSheet,o=r===void 0?null:r,s=e.optimizeForSpeed,u=s===void 0?!1:s;this._sheet=o||new H({name:"styled-jsx",optimizeForSpeed:u}),this._sheet.inject(),o&&typeof u=="boolean"&&(this._sheet.setOptimizeForSpeed(u),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var n=t.prototype;return n.add=function(e){var r=this;this._optimizeForSpeed===void 0&&(this._optimizeForSpeed=Array.isArray(e.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(f,X){return f[X]=0,f},{}));var o=this.getIdAndRules(e),s=o.styleId,u=o.rules;if(s in this._instancesCounts){this._instancesCounts[s]+=1;return}var c=u.map(function(f){return r._sheet.insertRule(f)}).filter(function(f){return f!==-1});this._indices[s]=c,this._instancesCounts[s]=1},n.remove=function(e){var r=this,o=this.getIdAndRules(e).styleId;if(W(o in this._instancesCounts,"styleId: `"+o+"` not found"),this._instancesCounts[o]-=1,this._instancesCounts[o]<1){var s=this._fromServer&&this._fromServer[o];s?(s.parentNode.removeChild(s),delete this._fromServer[o]):(this._indices[o].forEach(function(u){return r._sheet.deleteRule(u)}),delete this._indices[o]),delete this._instancesCounts[o]}},n.update=function(e,r){this.add(r),this.remove(e)},n.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},n.cssRules=function(){var e=this,r=this._fromServer?Object.keys(this._fromServer).map(function(s){return[s,e._fromServer[s]]}):[],o=this._sheet.cssRules();return r.concat(Object.keys(this._indices).map(function(s){return[s,e._indices[s].map(function(u){return o[u].cssText}).join(e._optimizeForSpeed?"":`
10
+ `)]}).filter(function(s){return Boolean(s[1])}))},n.styles=function(e){return K(this.cssRules(),e)},n.getIdAndRules=function(e){var r=e.children,o=e.dynamic,s=e.id;if(o){var u=w(s,o);return{styleId:u,rules:Array.isArray(r)?r.map(function(c){return O(u,c)}):[O(u,r)]}}return{styleId:w(s),rules:Array.isArray(r)?r:[r]}},n.selectFromServer=function(){var e=Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]'));return e.reduce(function(r,o){var s=o.id.slice(2);return r[s]=o,r},{})},t}();function W(t,n){if(!t)throw new Error("StyleSheetRegistry: "+n+".")}var S=h.createContext(null);S.displayName="StyleSheetContext";function F(){return new Q}function Y(t){var n=t.registry,i=t.children,e=h.useContext(S),r=h.useState(function(){return e||n||F()}),o=r[0];return y.default.createElement(S.Provider,{value:o},i)}function A(){return h.useContext(S)}var Z=y.default.useInsertionEffect||y.default.useLayoutEffect,P=typeof window<"u"?F():void 0;function E(t){var n=P||A();return n?typeof window>"u"?(n.add(t),null):(Z(function(){return n.add(t),function(){n.remove(t)}},[t.id,String(t.dynamic)]),null):null}E.dynamic=function(t){return t.map(function(n){var i=n[0],e=n[1];return w(i,e)}).join(" ")};p.StyleRegistry=Y;p.createStyleRegistry=F;p.style=E;p.useStyleRegistry=A});var q=k((oe,I)=>{I.exports=T()});import{setConfig as L}from"next/config";L(process.env.__NEXT_RUNTIME_CONFIG);import*as R from"react";import{RouterContext as V}from"next/dist/shared/lib/router-context";import x from"next/router";var a;try{a=v("@storybook/addon-actions").action}catch{a=()=>()=>{}}var B={route:"/",pathname:"/",query:{},asPath:"/",push(...t){return a("nextRouter.push")(...t),Promise.resolve(!0)},replace(...t){return a("nextRouter.replace")(...t),Promise.resolve(!0)},reload(...t){a("nextRouter.reload")(...t)},back(...t){a("nextRouter.back")(...t)},prefetch(...t){return a("nextRouter.prefetch")(...t),Promise.resolve()},beforePopState(...t){a("nextRouter.beforePopState")(...t)},events:{on(...t){a("nextRouter.events.on")(...t)},off(...t){a("nextRouter.events.off")(...t)},emit(...t){a("nextRouter.events.emit")(...t)}},isFallback:!1},j=(t,{globals:n,parameters:i})=>{let e=i.nextRouter??{};return x.router={...B,locale:n?.locale,...e},R.createElement(V.Provider,{value:x.router},R.createElement(t,null))};import*as m from"react";var b;try{b=q().StyleRegistry}catch{b=m.Fragment}var D=t=>m.createElement(b,null,m.createElement(t,null));import*as C from"react";import z from"semver";if(z.gt(process.env.__NEXT_VERSION,"9.0.0")){let t=v("next/image"),n=t.default;Object.defineProperty(t,"default",{configurable:!0,value:i=>typeof i.src=="string"?C.createElement(n,{...i,unoptimized:!0,blurDataURL:i.src}):C.createElement(n,{...i,unoptimized:!0})}),z.gte(process.env.__NEXT_VERSION,"12.1.5")&&z.lt(process.env.__NEXT_VERSION,"12.2.0")&&Object.defineProperty(t,"__esModule",{configurable:!0,value:!0})}var de=[D,j];export{de as decorators};
package/jest.config.js ADDED
@@ -0,0 +1,7 @@
1
+ const path = require('path');
2
+ const baseConfig = require('../../jest.config.node');
3
+
4
+ module.exports = {
5
+ ...baseConfig,
6
+ displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep),
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/nextjs",
3
- "version": "7.0.0-alpha.48",
3
+ "version": "7.0.0-alpha.50",
4
4
  "description": "Storybook for Next.js",
5
5
  "keywords": [
6
6
  "storybook",
@@ -60,12 +60,12 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@babel/preset-typescript": "^7.18.6",
63
- "@storybook/addons": "7.0.0-alpha.48",
64
- "@storybook/builder-webpack5": "7.0.0-alpha.48",
65
- "@storybook/core-common": "7.0.0-alpha.48",
66
- "@storybook/node-logger": "7.0.0-alpha.48",
67
- "@storybook/preset-react-webpack": "7.0.0-alpha.48",
68
- "@storybook/react": "7.0.0-alpha.48",
63
+ "@storybook/addons": "7.0.0-alpha.50",
64
+ "@storybook/builder-webpack5": "7.0.0-alpha.50",
65
+ "@storybook/core-common": "7.0.0-alpha.50",
66
+ "@storybook/node-logger": "7.0.0-alpha.50",
67
+ "@storybook/preset-react-webpack": "7.0.0-alpha.50",
68
+ "@storybook/react": "7.0.0-alpha.50",
69
69
  "@types/node": "^14.14.20 || ^16.0.0",
70
70
  "find-up": "^5.0.0",
71
71
  "fs-extra": "^9.0.1",
@@ -81,8 +81,7 @@
81
81
  "tsconfig-paths-webpack-plugin": "^3.5.2"
82
82
  },
83
83
  "devDependencies": {
84
- "@storybook/addon-actions": "7.0.0-alpha.48",
85
- "@types/loader-utils": "^2.0.3",
84
+ "@storybook/addon-actions": "7.0.0-alpha.50",
86
85
  "next": "^12.2.4",
87
86
  "typescript": "~4.6.3",
88
87
  "webpack": "^5.65.0"
@@ -121,5 +120,5 @@
121
120
  ],
122
121
  "platform": "node"
123
122
  },
124
- "gitHead": "b58a29b785462f8a8b711b6bb2d7223fd6dc17fd"
123
+ "gitHead": "77184d039091f4782dc4540df6d271a24fb3e242"
125
124
  }
@@ -1 +0,0 @@
1
- var g=(a=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(a,{get:(b,c)=>(typeof require!="undefined"?require:b)[c]}):a)(function(a){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+a+'" is not supported')});var d=(a,b)=>()=>(a&&(b=a(a=0)),b);var h=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var k,f=d(()=>{k={}});export{g as a,h as b,f as c,k as d};