@storybook/react 7.0.0-alpha.34 → 7.0.0-alpha.37
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/dist/config.d.ts +3 -3
- package/dist/index.d.ts +29 -9
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{types-9f8d440a.d.ts → types-cd314162.d.ts} +4 -3
- package/package.json +11 -8
package/dist/config.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as lib_docs_tools_dist_types from 'lib/docs-tools/dist/types';
|
|
2
|
-
import * as
|
|
2
|
+
import * as lib_addons_dist from 'lib/addons/dist';
|
|
3
3
|
import * as _storybook_csf from '@storybook/csf';
|
|
4
4
|
import { ArgsStoryFn } from '@storybook/csf';
|
|
5
|
-
import { R as ReactFramework, S as StoryFnReactReturnType } from './types-
|
|
5
|
+
import { R as ReactFramework, S as StoryFnReactReturnType } from './types-cd314162.js';
|
|
6
6
|
import { RenderContext } from '@storybook/store';
|
|
7
7
|
import 'react';
|
|
8
8
|
|
|
9
9
|
declare const decorators: ((storyFn: _storybook_csf.PartialStoryFn<ReactFramework, _storybook_csf.Args>, context: _storybook_csf.StoryContext<ReactFramework, _storybook_csf.Args>) => StoryFnReactReturnType)[];
|
|
10
|
-
declare const argTypesEnhancers: (<TFramework extends _storybook_csf.AnyFramework>(context: _storybook_csf.StoryContextForEnhancers<TFramework, _storybook_csf.Args>) => _storybook_csf.StrictArgTypes<_storybook_csf.Args> |
|
|
10
|
+
declare const argTypesEnhancers: (<TFramework extends _storybook_csf.AnyFramework>(context: _storybook_csf.StoryContextForEnhancers<TFramework, _storybook_csf.Args>) => _storybook_csf.StrictArgTypes<_storybook_csf.Args> | lib_addons_dist.Parameters)[];
|
|
11
11
|
|
|
12
12
|
declare const render: ArgsStoryFn<ReactFramework>;
|
|
13
13
|
declare function renderToDOM({ storyContext, unboundStoryFn, showMain, showException, forceRemount, }: RenderContext<ReactFramework>, domElement: Element): Promise<() => void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ClientStoryApi, Loadable } from '@storybook/addons';
|
|
2
|
-
import { R as ReactFramework, I as IStorybookSection, S as StoryFnReactReturnType } from './types-9f8d440a.js';
|
|
3
2
|
import * as _storybook_csf from '@storybook/csf';
|
|
4
|
-
import { Args, ComponentAnnotations, AnnotatedStoryFn, StoryAnnotations, ProjectAnnotations } from '@storybook/csf';
|
|
5
|
-
import {
|
|
3
|
+
import { Args, DecoratorFunction, ComponentAnnotations, AnnotatedStoryFn, ArgsStoryFn, StoryAnnotations, LoaderFunction, ProjectAnnotations } from '@storybook/csf';
|
|
4
|
+
import { R as ReactFramework, I as IStorybookSection, S as StoryFnReactReturnType } from './types-cd314162.js';
|
|
5
|
+
import { Simplify, SetOptional, UnionToIntersection } from 'type-fest';
|
|
6
|
+
import { ComponentType, ComponentProps, JSXElementConstructor } from 'react';
|
|
6
7
|
import * as _storybook_store from '@storybook/store';
|
|
7
8
|
import { ComposedStory, CSFExports, StoriesWithPartialProps } from '@storybook/store';
|
|
8
9
|
|
|
@@ -17,7 +18,7 @@ interface ClientApi extends ClientStoryApi<ReactFramework['storyResult']> {
|
|
|
17
18
|
declare const storiesOf: ClientApi['storiesOf'];
|
|
18
19
|
declare const configure: ClientApi['configure'];
|
|
19
20
|
declare const addDecorator: ClientApi['addDecorator'];
|
|
20
|
-
declare type DecoratorFn =
|
|
21
|
+
declare type DecoratorFn<TArgs = Args> = DecoratorFunction<ReactFramework, TArgs>;
|
|
21
22
|
declare const addParameters: ClientApi['addParameters'];
|
|
22
23
|
declare const clearDecorators: ClientApi['clearDecorators'];
|
|
23
24
|
declare const setAddon: ClientApi['setAddon'];
|
|
@@ -31,7 +32,7 @@ declare type JSXElement = keyof JSX.IntrinsicElements | JSXElementConstructor<an
|
|
|
31
32
|
*
|
|
32
33
|
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
33
34
|
*/
|
|
34
|
-
declare type Meta<
|
|
35
|
+
declare type Meta<CmpOrArgs = Args> = CmpOrArgs extends ComponentType<infer CmpArgs> ? ComponentAnnotations<ReactFramework, CmpArgs> : ComponentAnnotations<ReactFramework, CmpOrArgs>;
|
|
35
36
|
/**
|
|
36
37
|
* Story function that represents a CSFv2 component example.
|
|
37
38
|
*
|
|
@@ -43,8 +44,20 @@ declare type StoryFn<TArgs = Args> = AnnotatedStoryFn<ReactFramework, TArgs>;
|
|
|
43
44
|
*
|
|
44
45
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
45
46
|
*/
|
|
46
|
-
declare type StoryObj<
|
|
47
|
+
declare type StoryObj<MetaOrArgs = Args> = MetaOrArgs extends {
|
|
48
|
+
render?: ArgsStoryFn<ReactFramework, infer RArgs>;
|
|
49
|
+
component?: ComponentType<infer CmpArgs>;
|
|
50
|
+
loaders?: (infer Loaders)[];
|
|
51
|
+
args?: infer DefaultArgs;
|
|
52
|
+
decorators?: (infer Decorators)[];
|
|
53
|
+
} ? Simplify<CmpArgs & RArgs & DecoratorsArgs<Decorators> & LoaderArgs<Loaders>> extends infer TArgs ? StoryAnnotations<ReactFramework, TArgs, SetOptional<TArgs, Extract<keyof TArgs, keyof (DefaultArgs & ActionArgs<TArgs>)>>> : never : StoryAnnotations<ReactFramework, MetaOrArgs>;
|
|
54
|
+
declare type DecoratorsArgs<Decorators> = UnionToIntersection<Decorators extends DecoratorFn<infer Args> ? Args : unknown>;
|
|
55
|
+
declare type LoaderArgs<Loaders> = UnionToIntersection<Loaders extends LoaderFunction<ReactFramework, infer Args> ? Args : unknown>;
|
|
56
|
+
declare type ActionArgs<Args> = {
|
|
57
|
+
[P in keyof Args as ((...args: any[]) => void) extends Args[P] ? P : never]: Args[P];
|
|
58
|
+
};
|
|
47
59
|
/**
|
|
60
|
+
* @deprecated Use `Meta` instead.
|
|
48
61
|
* For the common case where a component's stories are simple components that receives args as props:
|
|
49
62
|
*
|
|
50
63
|
* ```tsx
|
|
@@ -61,6 +74,8 @@ declare type ComponentMeta<T extends JSXElement> = Meta<ComponentProps<T>>;
|
|
|
61
74
|
*/
|
|
62
75
|
declare type ComponentStoryFn<T extends JSXElement> = StoryFn<ComponentProps<T>>;
|
|
63
76
|
/**
|
|
77
|
+
* @deprecated Use `StoryObj` instead.
|
|
78
|
+
*
|
|
64
79
|
* For the common case where a (CSFv3) story is a simple component that receives args as props:
|
|
65
80
|
*
|
|
66
81
|
* ```tsx
|
|
@@ -72,13 +87,17 @@ declare type ComponentStoryFn<T extends JSXElement> = StoryFn<ComponentProps<T>>
|
|
|
72
87
|
declare type ComponentStoryObj<T extends JSXElement> = StoryObj<ComponentProps<T>>;
|
|
73
88
|
/**
|
|
74
89
|
|
|
75
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated Use `StoryObj` instead.
|
|
92
|
+
*
|
|
76
93
|
* Story function that represents a CSFv3 component example.
|
|
77
94
|
*
|
|
78
95
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
79
96
|
*/
|
|
80
|
-
declare type Story<TArgs = Args> =
|
|
97
|
+
declare type Story<TArgs = Args> = StoryFn<TArgs>;
|
|
81
98
|
/**
|
|
99
|
+
* @deprecated Use StoryObj instead.
|
|
100
|
+
*
|
|
82
101
|
* For the common case where a (CSFv3) story is a simple component that receives args as props:
|
|
83
102
|
*
|
|
84
103
|
* ```tsx
|
|
@@ -86,7 +105,8 @@ declare type Story<TArgs = Args> = StoryObj<TArgs>;
|
|
|
86
105
|
* args: { buttonArg1: 'val' },
|
|
87
106
|
* }
|
|
88
107
|
* ```
|
|
89
|
-
*/
|
|
108
|
+
*/
|
|
109
|
+
declare type ComponentStory<T extends JSXElement> = ComponentStoryObj<T>;
|
|
90
110
|
|
|
91
111
|
/** Function that sets the globalConfig of your storybook. The global config is the preview module of your .storybook folder.
|
|
92
112
|
*
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var T=Object.create;var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var N=(o,t)=>{for(var e in t)d(o,e,{get:t[e],enumerable:!0})},R=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of W(t))!L.call(o,a)&&a!==e&&d(o,a,{get:()=>t[a],enumerable:!(r=v(t,a))||r.enumerable});return o};var m=(o,t,e)=>(e=o!=null?T(U(o)):{},R(t||!o||!o.__esModule?d(e,"default",{value:o,enumerable:!0}):e,o)),O=o=>R(d({},"__esModule",{value:!0}),o);var eo={};N(eo,{addDecorator:()=>H,addParameters:()=>J,clearDecorators:()=>Q,composeStories:()=>to,composeStory:()=>D,configure:()=>z,forceReRender:()=>Z,getStorybook:()=>I,raw:()=>K,setAddon:()=>X,setGlobalConfig:()=>_,setProjectAnnotations:()=>b,storiesOf:()=>q});module.exports=O(eo);var C=m(require("global")),{window:w}=C.default;w&&(w.STORYBOOK_ENV="react");var h=require("@storybook/core-client");var x=m(require("global")),n=m(require("react")),i=m(require("react-dom")),{FRAMEWORK_OPTIONS:c}=x.default,l=new Map,f=(o,t)=>{let{id:e,component:r}=t;if(!r)throw new Error(`Unable to render story ${e} as the component annotation is missing from the default export`);return n.default.createElement(r,{...o})},G=({callback:o,children:t})=>{let e=(0,n.useRef)();return(0,n.useLayoutEffect)(()=>{e.current!==o&&(e.current=o,o())},[o]),t},V=async(o,t)=>{let e=await $(t);return new Promise(r=>{e?e.render(n.default.createElement(G,{callback:()=>r(null)},o)):i.default.render(o,t,()=>r(null))})},B=i.version&&(i.version.startsWith("18")||i.version.startsWith("0.0.0")),Y=(c==null?void 0:c.legacyRootApi)!==!0,S=Y&&B,g=o=>{let t=l.get(o);t&&S?(t.unmount(),l.delete(o)):i.default.unmountComponentAtNode(o)},$=async o=>{if(!S)return null;let t=l.get(o);return t||(t=(await import("react-dom/client")).default.createRoot(o),l.set(o,t)),t},A=class extends n.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){let{hasError:e}=this.state,{showMain:r}=this.props;e||r()}componentDidCatch(e){let{showException:r}=this.props;r(e)}render(){let{hasError:e}=this.state,{children:r}=this.props;return e?null:r}},k=c!=null&&c.strictMode?n.StrictMode:n.Fragment;async function F({storyContext:o,unboundStoryFn:t,showMain:e,showException:r,forceRemount:a},u){let y=n.default.createElement(A,{showMain:e,showException:r},n.default.createElement(t,{...o})),j=k?n.default.createElement(k,null,y):y;return a&&g(u),await V(j,u),()=>g(u)}var E="react",s=(0,h.start)(F,{render:f}),q=(o,t)=>s.clientApi.storiesOf(o,t).addParameters({framework:E}),z=(...o)=>s.configure(E,...o),H=s.clientApi.addDecorator,J=s.clientApi.addParameters,Q=s.clientApi.clearDecorators,X=s.clientApi.setAddon,Z=s.forceReRender,I=s.clientApi.getStorybook,K=s.clientApi.raw;var p=require("@storybook/store"),P=require("@storybook/client-logger");function b(o){(0,p.setProjectAnnotations)(o)}function _(o){P.once.warn("setGlobalConfig is deprecated. Use setProjectAnnotations instead."),b(o)}var oo={render:f};function D(o,t,e,r){return(0,p.composeStory)(o,t,e,oo,r)}function to(o,t){return(0,p.composeStories)(o,t,D)}var M;(M=module==null?void 0:module.hot)==null||M.decline();0&&(module.exports={addDecorator,addParameters,clearDecorators,composeStories,composeStory,configure,forceReRender,getStorybook,raw,setAddon,setGlobalConfig,setProjectAnnotations,storiesOf});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as t,b as a}from"./chunk-WO7CMEGS.mjs";import m from"global";var{window:i}=m;i&&(i.STORYBOOK_ENV="react");import{start as A}from"@storybook/core-client";var p="react",r=A(a,{render:t}),R=(o,e)=>r.clientApi.storiesOf(o,e).addParameters({framework:p}),w=(...o)=>r.configure(p,...o),T=r.clientApi.addDecorator,u=r.clientApi.addParameters,P=r.clientApi.clearDecorators,D=r.clientApi.setAddon,O=r.forceReRender,b=r.clientApi.getStorybook,j=r.clientApi.raw;import{composeStory as d,composeStories as y,setProjectAnnotations as g}from"@storybook/store";import{once as l}from"@storybook/client-logger";function f(o){g(o)}function X(o){l.warn("setGlobalConfig is deprecated. Use setProjectAnnotations instead."),f(o)}var S={render:t};function C(o,e,s,c){return d(o,e,s,S,c)}function v(o,e){return y(o,e,C)}module?.hot?.decline();export{T as addDecorator,u as addParameters,P as clearDecorators,v as composeStories,C as composeStory,w as configure,O as forceReRender,b as getStorybook,j as raw,D as setAddon,X as setGlobalConfig,f as setProjectAnnotations,R as storiesOf};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ComponentType, ReactElement } from 'react';
|
|
2
|
+
import { AnyFramework } from '@storybook/csf';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
component: ComponentType<
|
|
4
|
+
interface ReactFramework extends AnyFramework {
|
|
5
|
+
component: ComponentType<this['T']>;
|
|
5
6
|
storyResult: StoryFnReactReturnType;
|
|
6
|
-
}
|
|
7
|
+
}
|
|
7
8
|
declare type StoryFnReactReturnType = ReactElement<unknown>;
|
|
8
9
|
interface IStorybookStory {
|
|
9
10
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.37",
|
|
4
4
|
"description": "Storybook React renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"prep": "../../../scripts/prepare/bundle.ts"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@storybook/addons": "7.0.0-alpha.
|
|
55
|
-
"@storybook/client-logger": "7.0.0-alpha.
|
|
56
|
-
"@storybook/core-client": "7.0.0-alpha.
|
|
57
|
-
"@storybook/csf": "0.0.2--canary.
|
|
58
|
-
"@storybook/docs-tools": "7.0.0-alpha.
|
|
59
|
-
"@storybook/store": "7.0.0-alpha.
|
|
54
|
+
"@storybook/addons": "7.0.0-alpha.37",
|
|
55
|
+
"@storybook/client-logger": "7.0.0-alpha.37",
|
|
56
|
+
"@storybook/core-client": "7.0.0-alpha.37",
|
|
57
|
+
"@storybook/csf": "0.0.2--canary.49.258942b.0",
|
|
58
|
+
"@storybook/docs-tools": "7.0.0-alpha.37",
|
|
59
|
+
"@storybook/store": "7.0.0-alpha.37",
|
|
60
60
|
"@types/estree": "^0.0.51",
|
|
61
61
|
"@types/node": "^14.14.20 || ^16.0.0",
|
|
62
62
|
"acorn": "^7.4.1",
|
|
@@ -69,11 +69,14 @@
|
|
|
69
69
|
"prop-types": "^15.7.2",
|
|
70
70
|
"react-element-to-jsx-string": "^15.0.0",
|
|
71
71
|
"ts-dedent": "^2.0.0",
|
|
72
|
+
"type-fest": "^2.19.0",
|
|
72
73
|
"util-deprecate": "^1.0.2"
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
75
76
|
"@babel/core": "^7.11.5",
|
|
77
|
+
"@jest/globals": "^26.6.2",
|
|
76
78
|
"@types/util-deprecate": "^1.0.0",
|
|
79
|
+
"expect-type": "^0.14.2",
|
|
77
80
|
"jest-specific-snapshot": "^4.0.0",
|
|
78
81
|
"require-from-string": "^2.0.2",
|
|
79
82
|
"typescript": "~4.6.3"
|
|
@@ -100,5 +103,5 @@
|
|
|
100
103
|
],
|
|
101
104
|
"platform": "browser"
|
|
102
105
|
},
|
|
103
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "82667a655108283aafc828427f00bb3590a334e5"
|
|
104
107
|
}
|