@storybook/react 6.5.0-alpha.7 → 6.5.0-beta.1

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.
Files changed (195) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/client/docs/config.js +29 -0
  3. package/dist/cjs/client/docs/extractArgTypes.js +54 -0
  4. package/dist/cjs/client/docs/extractProps.js +77 -0
  5. package/dist/cjs/client/docs/jsxDecorator.js +277 -0
  6. package/dist/cjs/client/docs/lib/captions.js +18 -0
  7. package/dist/cjs/client/docs/lib/componentTypes.js +24 -0
  8. package/dist/cjs/client/docs/lib/defaultValues/createDefaultValue.js +81 -0
  9. package/dist/cjs/client/docs/lib/defaultValues/createFromRawDefaultProp.js +225 -0
  10. package/dist/cjs/client/docs/lib/defaultValues/generateArray.js +29 -0
  11. package/dist/cjs/client/docs/lib/defaultValues/generateObject.js +29 -0
  12. package/dist/cjs/client/docs/lib/defaultValues/index.js +37 -0
  13. package/dist/cjs/client/docs/lib/defaultValues/prettyIdentifier.js +34 -0
  14. package/dist/cjs/client/docs/lib/generateCode.js +89 -0
  15. package/dist/cjs/client/docs/lib/index.js +63 -0
  16. package/dist/cjs/client/docs/lib/inspection/acornParser.js +254 -0
  17. package/dist/cjs/client/docs/lib/inspection/index.js +37 -0
  18. package/dist/cjs/client/docs/lib/inspection/inspectValue.js +26 -0
  19. package/dist/cjs/client/docs/lib/inspection/types.js +19 -0
  20. package/dist/cjs/client/docs/lib/isHtmlTag.js +18 -0
  21. package/dist/cjs/client/docs/propTypes/createType.js +469 -0
  22. package/dist/cjs/client/docs/propTypes/generateFuncSignature.js +78 -0
  23. package/dist/cjs/client/docs/propTypes/handleProp.js +54 -0
  24. package/dist/cjs/client/docs/propTypes/rawDefaultPropResolvers.js +47 -0
  25. package/dist/cjs/client/docs/propTypes/sortProps.js +37 -0
  26. package/dist/cjs/client/docs/react-argtypes.stories.js +129 -0
  27. package/dist/cjs/client/docs/typeScript/handleProp.js +38 -0
  28. package/dist/cjs/client/index.js +30 -14
  29. package/dist/cjs/client/preview/config.js +1 -1
  30. package/dist/cjs/client/preview/index.js +3 -3
  31. package/dist/cjs/client/preview/render.js +117 -34
  32. package/dist/cjs/client/preview/types-6-0.js +5 -1
  33. package/dist/cjs/client/preview/types-6-3.js +2 -0
  34. package/dist/cjs/client/preview/types-7-0.js +5 -1
  35. package/dist/cjs/client/preview/types.js +5 -1
  36. package/dist/cjs/client/testing/index.js +112 -0
  37. package/dist/cjs/demo/Welcome.js +7 -3
  38. package/dist/cjs/server/{framework-preset-react-docgen.js → framework-preset-react-docs.js} +21 -11
  39. package/dist/cjs/server/framework-preset-react-dom-hack.js +31 -0
  40. package/dist/cjs/server/framework-preset-react.js +2 -2
  41. package/dist/cjs/server/preset.js +4 -4
  42. package/dist/esm/client/docs/config.js +16 -0
  43. package/dist/esm/client/docs/extractArgTypes.js +39 -0
  44. package/dist/esm/client/docs/extractProps.js +54 -0
  45. package/dist/esm/client/docs/jsxDecorator.js +218 -0
  46. package/dist/esm/client/docs/lib/captions.js +6 -0
  47. package/dist/esm/client/docs/lib/componentTypes.js +9 -0
  48. package/dist/esm/client/docs/lib/defaultValues/createDefaultValue.js +67 -0
  49. package/dist/esm/client/docs/lib/defaultValues/createFromRawDefaultProp.js +191 -0
  50. package/dist/esm/client/docs/lib/defaultValues/generateArray.js +19 -0
  51. package/dist/esm/client/docs/lib/defaultValues/generateObject.js +19 -0
  52. package/dist/esm/client/docs/lib/defaultValues/index.js +2 -0
  53. package/dist/esm/client/docs/lib/defaultValues/prettyIdentifier.js +22 -0
  54. package/dist/esm/client/docs/lib/generateCode.js +68 -0
  55. package/dist/esm/client/docs/lib/index.js +4 -0
  56. package/dist/esm/client/docs/lib/inspection/acornParser.js +213 -0
  57. package/dist/esm/client/docs/lib/inspection/index.js +2 -0
  58. package/dist/esm/client/docs/lib/inspection/inspectValue.js +16 -0
  59. package/dist/esm/client/docs/lib/inspection/types.js +12 -0
  60. package/dist/esm/client/docs/lib/isHtmlTag.js +6 -0
  61. package/dist/esm/client/docs/propTypes/createType.js +449 -0
  62. package/dist/esm/client/docs/propTypes/generateFuncSignature.js +62 -0
  63. package/dist/esm/client/docs/propTypes/handleProp.js +39 -0
  64. package/dist/esm/client/docs/propTypes/rawDefaultPropResolvers.js +32 -0
  65. package/dist/esm/client/docs/propTypes/sortProps.js +24 -0
  66. package/dist/esm/client/docs/react-argtypes.stories.js +97 -0
  67. package/dist/esm/client/docs/typeScript/handleProp.js +27 -0
  68. package/dist/esm/client/index.js +1 -0
  69. package/dist/esm/client/preview/index.js +1 -1
  70. package/dist/esm/client/preview/render.js +106 -28
  71. package/dist/esm/client/preview/types-6-0.js +1 -0
  72. package/dist/esm/client/preview/types-6-3.js +3 -1
  73. package/dist/esm/client/preview/types-7-0.js +1 -0
  74. package/dist/esm/client/preview/types.js +1 -0
  75. package/dist/esm/client/testing/index.js +96 -0
  76. package/dist/esm/demo/Welcome.js +7 -4
  77. package/dist/{modern/server/framework-preset-react-docgen.js → esm/server/framework-preset-react-docs.js} +15 -11
  78. package/dist/esm/server/framework-preset-react-dom-hack.js +21 -0
  79. package/dist/esm/server/framework-preset-react.js +2 -2
  80. package/dist/esm/server/preset.js +2 -2
  81. package/dist/modern/client/docs/config.js +14 -0
  82. package/dist/modern/client/docs/extractArgTypes.js +38 -0
  83. package/dist/modern/client/docs/extractProps.js +42 -0
  84. package/dist/modern/client/docs/jsxDecorator.js +177 -0
  85. package/dist/modern/client/docs/lib/captions.js +6 -0
  86. package/dist/modern/client/docs/lib/componentTypes.js +2 -0
  87. package/dist/modern/client/docs/lib/defaultValues/createDefaultValue.js +72 -0
  88. package/dist/modern/client/docs/lib/defaultValues/createFromRawDefaultProp.js +181 -0
  89. package/dist/modern/client/docs/lib/defaultValues/generateArray.js +21 -0
  90. package/dist/modern/client/docs/lib/defaultValues/generateObject.js +21 -0
  91. package/dist/modern/client/docs/lib/defaultValues/index.js +2 -0
  92. package/dist/modern/client/docs/lib/defaultValues/prettyIdentifier.js +24 -0
  93. package/dist/modern/client/docs/lib/generateCode.js +59 -0
  94. package/dist/modern/client/docs/lib/index.js +4 -0
  95. package/dist/modern/client/docs/lib/inspection/acornParser.js +211 -0
  96. package/dist/modern/client/docs/lib/inspection/index.js +2 -0
  97. package/dist/modern/client/docs/lib/inspection/inspectValue.js +15 -0
  98. package/dist/modern/client/docs/lib/inspection/types.js +12 -0
  99. package/dist/modern/client/docs/lib/isHtmlTag.js +4 -0
  100. package/dist/modern/client/docs/propTypes/createType.js +446 -0
  101. package/dist/modern/client/docs/propTypes/generateFuncSignature.js +57 -0
  102. package/dist/modern/client/docs/propTypes/handleProp.js +39 -0
  103. package/dist/modern/client/docs/propTypes/rawDefaultPropResolvers.js +31 -0
  104. package/dist/modern/client/docs/propTypes/sortProps.js +14 -0
  105. package/dist/modern/client/docs/react-argtypes.stories.js +54 -0
  106. package/dist/modern/client/docs/typeScript/handleProp.js +28 -0
  107. package/dist/modern/client/index.js +1 -0
  108. package/dist/modern/client/preview/index.js +1 -1
  109. package/dist/modern/client/preview/render.js +51 -6
  110. package/dist/modern/client/preview/types-6-0.js +1 -0
  111. package/dist/modern/client/preview/types-6-3.js +3 -1
  112. package/dist/modern/client/preview/types-7-0.js +1 -0
  113. package/dist/modern/client/preview/types.js +1 -0
  114. package/dist/modern/client/testing/index.js +96 -0
  115. package/dist/modern/demo/Welcome.js +10 -6
  116. package/dist/{esm/server/framework-preset-react-docgen.js → modern/server/framework-preset-react-docs.js} +15 -11
  117. package/dist/modern/server/framework-preset-react-dom-hack.js +21 -0
  118. package/dist/modern/server/framework-preset-react.js +2 -2
  119. package/dist/modern/server/preset.js +2 -2
  120. package/dist/ts3.4/client/docs/config.d.ts +13 -0
  121. package/dist/ts3.4/client/docs/extractArgTypes.d.ts +2 -0
  122. package/dist/ts3.4/client/docs/extractProps.d.ts +5 -0
  123. package/dist/ts3.4/client/docs/jsxDecorator.d.ts +23 -0
  124. package/dist/ts3.4/client/docs/lib/captions.d.ts +6 -0
  125. package/dist/ts3.4/client/docs/lib/componentTypes.d.ts +2 -0
  126. package/dist/ts3.4/client/docs/lib/defaultValues/createDefaultValue.d.ts +2 -0
  127. package/dist/ts3.4/client/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +11 -0
  128. package/dist/ts3.4/client/docs/lib/defaultValues/generateArray.d.ts +3 -0
  129. package/dist/ts3.4/client/docs/lib/defaultValues/generateObject.d.ts +3 -0
  130. package/dist/ts3.4/client/docs/lib/defaultValues/index.d.ts +2 -0
  131. package/dist/ts3.4/client/docs/lib/defaultValues/prettyIdentifier.d.ts +4 -0
  132. package/dist/ts3.4/client/docs/lib/generateCode.d.ts +3 -0
  133. package/dist/ts3.4/client/docs/lib/index.d.ts +4 -0
  134. package/dist/ts3.4/client/docs/lib/inspection/acornParser.d.ts +7 -0
  135. package/dist/ts3.4/client/docs/lib/inspection/index.d.ts +2 -0
  136. package/dist/ts3.4/client/docs/lib/inspection/inspectValue.d.ts +2 -0
  137. package/dist/ts3.4/client/docs/lib/inspection/types.d.ts +50 -0
  138. package/dist/ts3.4/client/docs/lib/isHtmlTag.d.ts +1 -0
  139. package/dist/ts3.4/client/docs/propTypes/createType.d.ts +2 -0
  140. package/dist/ts3.4/client/docs/propTypes/generateFuncSignature.d.ts +4 -0
  141. package/dist/ts3.4/client/docs/propTypes/handleProp.d.ts +5 -0
  142. package/dist/ts3.4/client/docs/propTypes/rawDefaultPropResolvers.d.ts +1 -0
  143. package/dist/ts3.4/client/docs/propTypes/sortProps.d.ts +4 -0
  144. package/dist/ts3.4/client/docs/react-argtypes.stories.d.ts +1 -0
  145. package/dist/ts3.4/client/docs/typeScript/handleProp.d.ts +3 -0
  146. package/dist/ts3.4/client/index.d.ts +1 -0
  147. package/dist/ts3.4/client/testing/index.d.ts +84 -0
  148. package/dist/ts3.4/server/framework-preset-react-docs.d.ts +6 -0
  149. package/dist/ts3.4/server/framework-preset-react-dom-hack.d.ts +32 -0
  150. package/dist/ts3.4/server/framework-preset-react.d.ts +1 -46
  151. package/dist/ts3.4/server/preset.d.ts +1 -1
  152. package/dist/ts3.9/client/docs/config.d.ts +13 -0
  153. package/dist/ts3.9/client/docs/extractArgTypes.d.ts +2 -0
  154. package/dist/ts3.9/client/docs/extractProps.d.ts +5 -0
  155. package/dist/ts3.9/client/docs/jsxDecorator.d.ts +23 -0
  156. package/dist/ts3.9/client/docs/lib/captions.d.ts +6 -0
  157. package/dist/ts3.9/client/docs/lib/componentTypes.d.ts +2 -0
  158. package/dist/ts3.9/client/docs/lib/defaultValues/createDefaultValue.d.ts +2 -0
  159. package/dist/ts3.9/client/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +11 -0
  160. package/dist/ts3.9/client/docs/lib/defaultValues/generateArray.d.ts +3 -0
  161. package/dist/ts3.9/client/docs/lib/defaultValues/generateObject.d.ts +3 -0
  162. package/dist/ts3.9/client/docs/lib/defaultValues/index.d.ts +2 -0
  163. package/dist/ts3.9/client/docs/lib/defaultValues/prettyIdentifier.d.ts +4 -0
  164. package/dist/ts3.9/client/docs/lib/generateCode.d.ts +3 -0
  165. package/dist/ts3.9/client/docs/lib/index.d.ts +4 -0
  166. package/dist/ts3.9/client/docs/lib/inspection/acornParser.d.ts +7 -0
  167. package/dist/ts3.9/client/docs/lib/inspection/index.d.ts +2 -0
  168. package/dist/ts3.9/client/docs/lib/inspection/inspectValue.d.ts +2 -0
  169. package/dist/ts3.9/client/docs/lib/inspection/types.d.ts +50 -0
  170. package/dist/ts3.9/client/docs/lib/isHtmlTag.d.ts +1 -0
  171. package/dist/ts3.9/client/docs/propTypes/createType.d.ts +2 -0
  172. package/dist/ts3.9/client/docs/propTypes/generateFuncSignature.d.ts +4 -0
  173. package/dist/ts3.9/client/docs/propTypes/handleProp.d.ts +5 -0
  174. package/dist/ts3.9/client/docs/propTypes/rawDefaultPropResolvers.d.ts +1 -0
  175. package/dist/ts3.9/client/docs/propTypes/sortProps.d.ts +4 -0
  176. package/dist/ts3.9/client/docs/react-argtypes.stories.d.ts +1 -0
  177. package/dist/ts3.9/client/docs/typeScript/handleProp.d.ts +3 -0
  178. package/dist/ts3.9/client/index.d.ts +1 -0
  179. package/dist/ts3.9/client/preview/render.d.ts +1 -1
  180. package/dist/ts3.9/client/preview/types-6-0.d.ts +3 -3
  181. package/dist/ts3.9/client/preview/types-7-0.d.ts +2 -2
  182. package/dist/ts3.9/client/testing/index.d.ts +84 -0
  183. package/dist/ts3.9/server/framework-preset-cra.d.ts +1 -1
  184. package/dist/ts3.9/server/framework-preset-react-docs.d.ts +6 -0
  185. package/dist/ts3.9/server/framework-preset-react-dom-hack.d.ts +32 -0
  186. package/dist/ts3.9/server/framework-preset-react.d.ts +1 -46
  187. package/dist/ts3.9/server/options.d.ts +1 -1
  188. package/dist/ts3.9/server/preset.d.ts +2 -2
  189. package/package.json +38 -14
  190. package/types/index.ts +9 -1
  191. package/dist/cjs/typings.d.js +0 -1
  192. package/dist/esm/typings.d.js +0 -0
  193. package/dist/modern/typings.d.js +0 -0
  194. package/dist/ts3.4/server/framework-preset-react-docgen.d.ts +0 -5
  195. package/dist/ts3.9/server/framework-preset-react-docgen.d.ts +0 -5
@@ -0,0 +1,84 @@
1
+ import { CSFExports, ComposedStory, StoriesWithPartialProps } from '@storybook/store';
2
+ import { ProjectAnnotations, Args } from '@storybook/csf';
3
+ import type { Meta, ReactFramework } from '../preview/types-6-0';
4
+ /** Function that sets the globalConfig of your storybook. The global config is the preview module of your .storybook folder.
5
+ *
6
+ * It should be run a single time, so that your global config (e.g. decorators) is applied to your stories when using `composeStories` or `composeStory`.
7
+ *
8
+ * Example:
9
+ *```jsx
10
+ * // setup.js (for jest)
11
+ * import { setProjectAnnotations } from '@storybook/react';
12
+ * import * as projectAnnotations from './.storybook/preview';
13
+ *
14
+ * setProjectAnnotations(projectAnnotations);
15
+ *```
16
+ *
17
+ * @param projectAnnotations - e.g. (import * as projectAnnotations from '../.storybook/preview')
18
+ */
19
+ export declare function setProjectAnnotations(projectAnnotations: ProjectAnnotations<ReactFramework> | ProjectAnnotations<ReactFramework>[]): void;
20
+ /** Preserved for users migrating from `@storybook/testing-react`.
21
+ *
22
+ * @deprecated Use setProjectAnnotations instead
23
+ */
24
+ export declare function setGlobalConfig(projectAnnotations: ProjectAnnotations<ReactFramework> | ProjectAnnotations<ReactFramework>[]): void;
25
+ /**
26
+ * Function that will receive a story along with meta (e.g. a default export from a .stories file)
27
+ * and optionally projectAnnotations e.g. (import * from '../.storybook/preview)
28
+ * and will return a composed component that has all args/parameters/decorators/etc combined and applied to it.
29
+ *
30
+ *
31
+ * It's very useful for reusing a story in scenarios outside of Storybook like unit testing.
32
+ *
33
+ * Example:
34
+ *```jsx
35
+ * import { render } from '@testing-library/react';
36
+ * import { composeStory } from '@storybook/react';
37
+ * import Meta, { Primary as PrimaryStory } from './Button.stories';
38
+ *
39
+ * const Primary = composeStory(PrimaryStory, Meta);
40
+ *
41
+ * test('renders primary button with Hello World', () => {
42
+ * const { getByText } = render(<Primary>Hello world</Primary>);
43
+ * expect(getByText(/Hello world/i)).not.toBeNull();
44
+ * });
45
+ *```
46
+ *
47
+ * @param story
48
+ * @param componentAnnotations - e.g. (import Meta from './Button.stories')
49
+ * @param [projectAnnotations] - e.g. (import * as projectAnnotations from '../.storybook/preview') this can be applied automatically if you use `setProjectAnnotations` in your setup files.
50
+ * @param [exportsName] - in case your story does not contain a name and you want it to have a name.
51
+ */
52
+ export declare function composeStory<TArgs = Args>(story: ComposedStory<ReactFramework, TArgs>, componentAnnotations: Meta<TArgs | any>, projectAnnotations?: ProjectAnnotations<ReactFramework>, exportsName?: string): {
53
+ (extraArgs: Partial<TArgs>): import("../preview/types").StoryFnReactReturnType;
54
+ storyName: string;
55
+ args: Args;
56
+ play: import("@storybook/store").ComposedStoryPlayFn;
57
+ parameters: import("@storybook/store").Parameters;
58
+ };
59
+ /**
60
+ * Function that will receive a stories import (e.g. `import * as stories from './Button.stories'`)
61
+ * and optionally projectAnnotations (e.g. `import * from '../.storybook/preview`)
62
+ * and will return an object containing all the stories passed, but now as a composed component that has all args/parameters/decorators/etc combined and applied to it.
63
+ *
64
+ *
65
+ * It's very useful for reusing stories in scenarios outside of Storybook like unit testing.
66
+ *
67
+ * Example:
68
+ *```jsx
69
+ * import { render } from '@testing-library/react';
70
+ * import { composeStories } from '@storybook/react';
71
+ * import * as stories from './Button.stories';
72
+ *
73
+ * const { Primary, Secondary } = composeStories(stories);
74
+ *
75
+ * test('renders primary button with Hello World', () => {
76
+ * const { getByText } = render(<Primary>Hello world</Primary>);
77
+ * expect(getByText(/Hello world/i)).not.toBeNull();
78
+ * });
79
+ *```
80
+ *
81
+ * @param csfExports - e.g. (import * as stories from './Button.stories')
82
+ * @param [projectAnnotations] - e.g. (import * as projectAnnotations from '../.storybook/preview') this can be applied automatically if you use `setProjectAnnotations` in your setup files.
83
+ */
84
+ export declare function composeStories<TModule extends CSFExports<ReactFramework>>(csfExports: TModule, projectAnnotations?: ProjectAnnotations<ReactFramework>): Pick<StoriesWithPartialProps<ReactFramework, TModule>, Exclude<keyof TModule, "default" | "__esModule" | "__namedExportsOrder">>;
@@ -1,3 +1,3 @@
1
- import { Configuration } from 'webpack';
1
+ import type { Configuration } from 'webpack';
2
2
  import type { Options } from '@storybook/core-common';
3
3
  export declare function webpackFinal(config: Configuration, { presetsList }: Options): Configuration;
@@ -0,0 +1,6 @@
1
+ import type { StorybookConfig, Options } from '@storybook/core-common';
2
+ import type { TransformOptions } from '@babel/core';
3
+ import type { Configuration } from 'webpack';
4
+ export declare function babel(config: TransformOptions, options: Options): Promise<TransformOptions>;
5
+ export declare function webpackFinal(config: Configuration, options: Options): Promise<Configuration>;
6
+ export declare const previewAnnotations: StorybookConfig['previewAnnotations'];
@@ -0,0 +1,32 @@
1
+ import { Configuration } from 'webpack';
2
+ export declare function webpackFinal(config: Configuration): Promise<{
3
+ plugins: import("webpack").Plugin[];
4
+ mode?: "none" | "production" | "development";
5
+ name?: string;
6
+ context?: string;
7
+ entry?: string | string[] | import("webpack").Entry | import("webpack").EntryFunc;
8
+ devtool?: string | boolean;
9
+ output?: import("webpack").Output;
10
+ module?: import("webpack").Module;
11
+ resolve?: import("webpack").Resolve;
12
+ resolveLoader?: import("webpack").ResolveLoader;
13
+ externals?: string | RegExp | import("webpack").ExternalsObjectElement | import("webpack").ExternalsFunctionElement | import("webpack").ExternalsElement[];
14
+ target?: "node" | "web" | "webworker" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-preload" | "electron-main" | ((compiler?: any) => void);
15
+ bail?: boolean;
16
+ profile?: boolean;
17
+ cache?: boolean | object;
18
+ watch?: boolean;
19
+ watchOptions?: import("webpack").ICompiler.WatchOptions;
20
+ node?: false | import("webpack").Node;
21
+ amd?: {
22
+ [moduleName: string]: boolean;
23
+ };
24
+ recordsPath?: string;
25
+ recordsInputPath?: string;
26
+ recordsOutputPath?: string;
27
+ stats?: import("webpack").Stats.ToStringOptions;
28
+ performance?: false | import("webpack").Options.Performance;
29
+ parallelism?: number;
30
+ optimization?: import("webpack").Options.Optimization;
31
+ infrastructureLogging?: import("webpack").Options.InfrastructureLogging;
32
+ }>;
@@ -2,50 +2,5 @@ import { TransformOptions } from '@babel/core';
2
2
  import type { Configuration } from 'webpack';
3
3
  import type { Options } from '@storybook/core-common';
4
4
  export declare function babel(config: TransformOptions, options: Options): Promise<TransformOptions>;
5
- export declare function babelDefault(config: TransformOptions): Promise<{
6
- presets: (string | object)[];
7
- plugins: (string | object)[];
8
- ast?: boolean;
9
- auxiliaryCommentAfter?: string;
10
- auxiliaryCommentBefore?: string;
11
- root?: string;
12
- rootMode?: "root" | "upward" | "upward-optional";
13
- configFile?: string | boolean;
14
- babelrc?: boolean;
15
- babelrcRoots?: string | boolean | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
16
- envName?: string;
17
- exclude?: string | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
18
- code?: boolean;
19
- comments?: boolean;
20
- compact?: boolean | "auto";
21
- cwd?: string;
22
- caller?: import("@babel/core").TransformCaller;
23
- env?: {
24
- [index: string]: TransformOptions;
25
- };
26
- extends?: string;
27
- filename?: string;
28
- filenameRelative?: string;
29
- generatorOpts?: import("@babel/generator").GeneratorOptions;
30
- getModuleId?: (moduleName: string) => string;
31
- highlightCode?: boolean;
32
- ignore?: import("@babel/core").MatchPattern[];
33
- include?: string | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
34
- inputSourceMap?: object;
35
- minified?: boolean;
36
- moduleId?: string;
37
- moduleIds?: boolean;
38
- moduleRoot?: string;
39
- only?: import("@babel/core").MatchPattern[];
40
- overrides?: TransformOptions[];
41
- parserOpts?: import("@babel/parser").ParserOptions;
42
- retainLines?: boolean;
43
- shouldPrintComment?: (commentContents: string) => boolean;
44
- sourceFileName?: string;
45
- sourceMaps?: boolean | "inline" | "both";
46
- sourceRoot?: string;
47
- sourceType?: "script" | "module" | "unambiguous";
48
- test?: string | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
49
- wrapPluginVisitorMethod?: (pluginAlias: string, visitorType: "enter" | "exit", callback: (path: import("@babel/traverse").NodePath<import("@babel/types").Node>, state: any) => void) => (path: import("@babel/traverse").NodePath<import("@babel/types").Node>, state: any) => void;
50
- }>;
5
+ export declare function babelDefault(config: TransformOptions): Promise<TransformOptions>;
51
6
  export declare function webpackFinal(config: Configuration, options: Options): Promise<Configuration>;
@@ -1,3 +1,3 @@
1
- import { LoadOptions } from '@storybook/core-common';
1
+ import type { LoadOptions } from '@storybook/core-common';
2
2
  declare const _default: LoadOptions;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import { StorybookConfig } from '@storybook/core-common';
2
- export declare const config: StorybookConfig['config'];
1
+ import type { StorybookConfig } from '@storybook/core-common';
2
+ export declare const previewAnnotations: StorybookConfig['previewAnnotations'];
3
3
  export declare const addons: StorybookConfig['addons'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react",
3
- "version": "6.5.0-alpha.7",
3
+ "version": "6.5.0-beta.1",
4
4
  "description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -49,42 +49,66 @@
49
49
  "@babel/preset-flow": "^7.12.1",
50
50
  "@babel/preset-react": "^7.12.10",
51
51
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
52
- "@storybook/addons": "6.5.0-alpha.7",
53
- "@storybook/core": "6.5.0-alpha.7",
54
- "@storybook/core-common": "6.5.0-alpha.7",
55
- "@storybook/csf": "0.0.2--canary.87bc651.0",
56
- "@storybook/node-logger": "6.5.0-alpha.7",
52
+ "@storybook/addons": "6.5.0-beta.1",
53
+ "@storybook/client-logger": "6.5.0-beta.1",
54
+ "@storybook/core": "6.5.0-beta.1",
55
+ "@storybook/core-common": "6.5.0-beta.1",
56
+ "@storybook/csf": "0.0.2--canary.4566f4d.1",
57
+ "@storybook/docs-tools": "6.5.0-beta.1",
58
+ "@storybook/node-logger": "6.5.0-beta.1",
57
59
  "@storybook/react-docgen-typescript-plugin": "1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0",
58
60
  "@storybook/semver": "^7.3.2",
59
- "@storybook/store": "6.5.0-alpha.7",
61
+ "@storybook/store": "6.5.0-beta.1",
62
+ "@types/estree": "^0.0.51",
60
63
  "@types/node": "^14.14.20 || ^16.0.0",
61
64
  "@types/webpack-env": "^1.16.0",
65
+ "acorn": "^7.4.1",
66
+ "acorn-jsx": "^5.3.1",
67
+ "acorn-walk": "^7.2.0",
62
68
  "babel-plugin-add-react-displayname": "^0.0.5",
63
- "babel-plugin-named-asset-import": "^0.3.1",
64
69
  "babel-plugin-react-docgen": "^4.2.1",
65
70
  "core-js": "^3.8.2",
71
+ "escodegen": "^2.0.0",
72
+ "fs-extra": "^9.0.1",
66
73
  "global": "^4.4.0",
74
+ "html-tags": "^3.1.0",
67
75
  "lodash": "^4.17.21",
68
76
  "prop-types": "^15.7.2",
77
+ "react-element-to-jsx-string": "^14.3.4",
69
78
  "react-refresh": "^0.11.0",
70
79
  "read-pkg-up": "^7.0.1",
71
80
  "regenerator-runtime": "^0.13.7",
72
81
  "ts-dedent": "^2.0.0",
73
- "webpack": "4"
82
+ "util-deprecate": "^1.0.2",
83
+ "webpack": ">=4.43.0 <6.0.0"
74
84
  },
75
85
  "devDependencies": {
76
- "@storybook/client-api": "6.5.0-alpha.7",
77
- "@types/prompts": "^2.0.9"
86
+ "@types/util-deprecate": "^1.0.0",
87
+ "webpack": "4"
78
88
  },
79
89
  "peerDependencies": {
80
90
  "@babel/core": "^7.11.5",
81
- "react": "^16.8.0 || ^17.0.0",
82
- "react-dom": "^16.8.0 || ^17.0.0"
91
+ "jest-specific-snapshot": "^4.0.0",
92
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
93
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
94
+ "require-from-string": "^2.0.2"
83
95
  },
84
96
  "peerDependenciesMeta": {
85
97
  "@babel/core": {
86
98
  "optional": true
87
99
  },
100
+ "@storybook/builder-webpack4": {
101
+ "optional": true
102
+ },
103
+ "@storybook/builder-webpack5": {
104
+ "optional": true
105
+ },
106
+ "@storybook/manager-webpack4": {
107
+ "optional": true
108
+ },
109
+ "@storybook/manager-webpack5": {
110
+ "optional": true
111
+ },
88
112
  "typescript": {
89
113
  "optional": true
90
114
  }
@@ -95,6 +119,6 @@
95
119
  "publishConfig": {
96
120
  "access": "public"
97
121
  },
98
- "gitHead": "eb1ec353f7fbdf90d67576d93b9a23809d6cc0e6",
122
+ "gitHead": "85bcae3041a0664d7c0ee4756241e29ad1063a9a",
99
123
  "sbmodern": "dist/modern/client/index.js"
100
124
  }
package/types/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StorybookConfig as BaseConfig } from '@storybook/core-common';
1
+ import type { StorybookConfig as BaseConfig } from '@storybook/core-common';
2
2
 
3
3
  /**
4
4
  * The interface for Storybook configuration in `main.ts` files.
@@ -7,5 +7,13 @@ export interface StorybookConfig extends BaseConfig {
7
7
  reactOptions?: {
8
8
  fastRefresh?: boolean;
9
9
  strictMode?: boolean;
10
+ /**
11
+ * Use React's legacy root API to mount components
12
+ * @description
13
+ * React has introduced a new root API with React 18.x to enable a whole set of new features (e.g. concurrent features)
14
+ * If this flag is true, the legacy Root API is used to mount components to make it easier to migrate step by step to React 18.
15
+ * @default false
16
+ */
17
+ legacyRootApi?: boolean;
10
18
  };
11
19
  }
@@ -1 +0,0 @@
1
- "use strict";
File without changes
File without changes
@@ -1,5 +0,0 @@
1
- import { TransformOptions } from '@babel/core';
2
- import { Configuration } from 'webpack';
3
- import { Options } from '@storybook/core-common';
4
- export declare function babel(config: TransformOptions, { presets }: Options): Promise<TransformOptions>;
5
- export declare function webpackFinal(config: Configuration, { presets }: Options): Promise<Configuration>;
@@ -1,5 +0,0 @@
1
- import type { TransformOptions } from '@babel/core';
2
- import type { Configuration } from 'webpack';
3
- import type { Options } from '@storybook/core-common';
4
- export declare function babel(config: TransformOptions, { presets }: Options): Promise<TransformOptions>;
5
- export declare function webpackFinal(config: Configuration, { presets }: Options): Promise<Configuration>;