@storybook/react 6.4.0-beta.23 → 6.4.0-beta.24

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 (100) hide show
  1. package/package.json +8 -8
  2. package/types-7-0.d.ts +1 -0
  3. package/dist/cjs/client/index.js +0 -87
  4. package/dist/cjs/client/preview/config.js +0 -25
  5. package/dist/cjs/client/preview/globals.js +0 -11
  6. package/dist/cjs/client/preview/index.js +0 -52
  7. package/dist/cjs/client/preview/render.js +0 -213
  8. package/dist/cjs/client/preview/types-6-0.js +0 -1
  9. package/dist/cjs/client/preview/types-6-3.js +0 -22
  10. package/dist/cjs/client/preview/types-7-0.js +0 -1
  11. package/dist/cjs/client/preview/types.js +0 -1
  12. package/dist/cjs/demo/Button.js +0 -37
  13. package/dist/cjs/demo/Welcome.js +0 -122
  14. package/dist/cjs/server/build.js +0 -9
  15. package/dist/cjs/server/cra-config.js +0 -69
  16. package/dist/cjs/server/framework-preset-cra.js +0 -35
  17. package/dist/cjs/server/framework-preset-react-docgen.js +0 -58
  18. package/dist/cjs/server/framework-preset-react.js +0 -98
  19. package/dist/cjs/server/index.js +0 -9
  20. package/dist/cjs/server/options.js +0 -17
  21. package/dist/cjs/server/preset.js +0 -16
  22. package/dist/cjs/typings.d.js +0 -1
  23. package/dist/esm/client/index.js +0 -6
  24. package/dist/esm/client/preview/config.js +0 -4
  25. package/dist/esm/client/preview/globals.js +0 -6
  26. package/dist/esm/client/preview/index.js +0 -29
  27. package/dist/esm/client/preview/render.js +0 -177
  28. package/dist/esm/client/preview/types-6-0.js +0 -0
  29. package/dist/esm/client/preview/types-6-3.js +0 -8
  30. package/dist/esm/client/preview/types-7-0.js +0 -0
  31. package/dist/esm/client/preview/types.js +0 -0
  32. package/dist/esm/demo/Button.js +0 -26
  33. package/dist/esm/demo/Welcome.js +0 -111
  34. package/dist/esm/server/build.js +0 -3
  35. package/dist/esm/server/cra-config.js +0 -49
  36. package/dist/esm/server/framework-preset-cra.js +0 -25
  37. package/dist/esm/server/framework-preset-react-docgen.js +0 -45
  38. package/dist/esm/server/framework-preset-react.js +0 -78
  39. package/dist/esm/server/index.js +0 -3
  40. package/dist/esm/server/options.js +0 -8
  41. package/dist/esm/server/preset.js +0 -5
  42. package/dist/esm/typings.d.js +0 -0
  43. package/dist/modern/client/index.js +0 -6
  44. package/dist/modern/client/preview/config.js +0 -4
  45. package/dist/modern/client/preview/globals.js +0 -8
  46. package/dist/modern/client/preview/index.js +0 -21
  47. package/dist/modern/client/preview/render.js +0 -94
  48. package/dist/modern/client/preview/types-6-0.js +0 -0
  49. package/dist/modern/client/preview/types-6-3.js +0 -8
  50. package/dist/modern/client/preview/types-7-0.js +0 -0
  51. package/dist/modern/client/preview/types.js +0 -0
  52. package/dist/modern/demo/Button.js +0 -25
  53. package/dist/modern/demo/Welcome.js +0 -104
  54. package/dist/modern/server/build.js +0 -3
  55. package/dist/modern/server/cra-config.js +0 -49
  56. package/dist/modern/server/framework-preset-cra.js +0 -25
  57. package/dist/modern/server/framework-preset-react-docgen.js +0 -45
  58. package/dist/modern/server/framework-preset-react.js +0 -78
  59. package/dist/modern/server/index.js +0 -3
  60. package/dist/modern/server/options.js +0 -8
  61. package/dist/modern/server/preset.js +0 -5
  62. package/dist/modern/typings.d.js +0 -0
  63. package/dist/ts3.4/client/index.d.ts +0 -3
  64. package/dist/ts3.4/client/preview/config.d.ts +0 -4
  65. package/dist/ts3.4/client/preview/globals.d.ts +0 -1
  66. package/dist/ts3.4/client/preview/index.d.ts +0 -25
  67. package/dist/ts3.4/client/preview/render.d.ts +0 -5
  68. package/dist/ts3.4/client/preview/types-6-0.d.ts +0 -35
  69. package/dist/ts3.4/client/preview/types-6-3.d.ts +0 -40
  70. package/dist/ts3.4/client/preview/types-7-0.d.ts +0 -21
  71. package/dist/ts3.4/client/preview/types.d.ts +0 -16
  72. package/dist/ts3.4/demo/Button.d.ts +0 -4
  73. package/dist/ts3.4/demo/Welcome.d.ts +0 -6
  74. package/dist/ts3.4/server/build.d.ts +0 -1
  75. package/dist/ts3.4/server/cra-config.d.ts +0 -4
  76. package/dist/ts3.4/server/framework-preset-cra.d.ts +0 -3
  77. package/dist/ts3.4/server/framework-preset-react-docgen.d.ts +0 -5
  78. package/dist/ts3.4/server/framework-preset-react.d.ts +0 -51
  79. package/dist/ts3.4/server/index.d.ts +0 -1
  80. package/dist/ts3.4/server/options.d.ts +0 -3
  81. package/dist/ts3.4/server/preset.d.ts +0 -3
  82. package/dist/ts3.9/client/index.d.ts +0 -3
  83. package/dist/ts3.9/client/preview/config.d.ts +0 -4
  84. package/dist/ts3.9/client/preview/globals.d.ts +0 -1
  85. package/dist/ts3.9/client/preview/index.d.ts +0 -25
  86. package/dist/ts3.9/client/preview/render.d.ts +0 -5
  87. package/dist/ts3.9/client/preview/types-6-0.d.ts +0 -35
  88. package/dist/ts3.9/client/preview/types-6-3.d.ts +0 -40
  89. package/dist/ts3.9/client/preview/types-7-0.d.ts +0 -21
  90. package/dist/ts3.9/client/preview/types.d.ts +0 -16
  91. package/dist/ts3.9/demo/Button.d.ts +0 -4
  92. package/dist/ts3.9/demo/Welcome.d.ts +0 -6
  93. package/dist/ts3.9/server/build.d.ts +0 -1
  94. package/dist/ts3.9/server/cra-config.d.ts +0 -4
  95. package/dist/ts3.9/server/framework-preset-cra.d.ts +0 -3
  96. package/dist/ts3.9/server/framework-preset-react-docgen.d.ts +0 -5
  97. package/dist/ts3.9/server/framework-preset-react.d.ts +0 -51
  98. package/dist/ts3.9/server/index.d.ts +0 -1
  99. package/dist/ts3.9/server/options.d.ts +0 -3
  100. package/dist/ts3.9/server/preset.d.ts +0 -3
@@ -1,49 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import semver from '@storybook/semver';
4
- import { logger } from '@storybook/node-logger';
5
- var appDirectory = fs.realpathSync(process.cwd());
6
- var reactScriptsPath;
7
- export function getReactScriptsPath({
8
- noCache: noCache
9
- } = {}) {
10
- if (reactScriptsPath && !noCache) return reactScriptsPath;
11
- var reactScriptsScriptPath = fs.realpathSync(path.join(appDirectory, '/node_modules/.bin/react-scripts'));
12
-
13
- try {
14
- // Note: Since there is no symlink for .bin/react-scripts on Windows
15
- // we'll parse react-scripts file to find actual package path.
16
- // This is important if you use fork of CRA.
17
- var pathIsNotResolved = /node_modules[\\/]\.bin[\\/]react-scripts/i.test(reactScriptsScriptPath);
18
-
19
- if (pathIsNotResolved) {
20
- var content = fs.readFileSync(reactScriptsScriptPath, 'utf8');
21
- var packagePathMatch = content.match(/"\$basedir[\\/]([^\s]+?[\\/]bin[\\/]react-scripts\.js")/i);
22
-
23
- if (packagePathMatch && packagePathMatch.length > 1) {
24
- reactScriptsScriptPath = path.join(appDirectory, '/node_modules/.bin/', packagePathMatch[1]);
25
- }
26
- }
27
- } catch (e) {
28
- logger.warn(`Error occurred during react-scripts package path resolving: ${e}`);
29
- }
30
-
31
- reactScriptsPath = path.join(reactScriptsScriptPath, '../..');
32
- var scriptsPkgJson = path.join(reactScriptsPath, 'package.json');
33
-
34
- if (!fs.existsSync(scriptsPkgJson)) {
35
- reactScriptsPath = 'react-scripts';
36
- }
37
-
38
- return reactScriptsPath;
39
- }
40
- export function isReactScriptsInstalled(requiredVersion = '2.0.0') {
41
- try {
42
- // eslint-disable-next-line import/no-dynamic-require,global-require
43
- var reactScriptsJson = require(path.join(getReactScriptsPath(), 'package.json'));
44
-
45
- return !semver.gtr(requiredVersion, reactScriptsJson.version);
46
- } catch (e) {
47
- return false;
48
- }
49
- }
@@ -1,25 +0,0 @@
1
- import { logger } from '@storybook/node-logger';
2
- import { isReactScriptsInstalled } from './cra-config';
3
-
4
- var checkForNewPreset = function (presetsList) {
5
- var hasNewPreset = presetsList.some(function (preset) {
6
- var presetName = typeof preset === 'string' ? preset : preset.name;
7
- return /@storybook(\/|\\)preset-create-react-app/.test(presetName);
8
- });
9
-
10
- if (!hasNewPreset) {
11
- logger.warn('Storybook support for Create React App is now a separate preset.');
12
- logger.warn('To use the new preset, install `@storybook/preset-create-react-app` and add it to the list of `addons` in your `.storybook/main.js` config file.');
13
- logger.warn('The built-in preset has been disabled in Storybook 6.0.');
14
- }
15
- };
16
-
17
- export function webpackFinal(config, {
18
- presetsList: presetsList
19
- }) {
20
- if (isReactScriptsInstalled()) {
21
- checkForNewPreset(presetsList);
22
- }
23
-
24
- return config;
25
- }
@@ -1,45 +0,0 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2
-
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
- import "core-js/modules/es.promise.js";
8
- import ReactDocgenTypescriptPlugin from '@storybook/react-docgen-typescript-plugin';
9
- export async function babel(config, {
10
- presets: presets
11
- }) {
12
- var typescriptOptions = await presets.apply('typescript', {});
13
- var reactDocgen = typescriptOptions.reactDocgen;
14
-
15
- if (typeof reactDocgen !== 'string') {
16
- return config;
17
- }
18
-
19
- return _objectSpread(_objectSpread({}, config), {}, {
20
- overrides: [{
21
- test: reactDocgen === 'react-docgen' ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/,
22
- plugins: [[require.resolve('babel-plugin-react-docgen'), {
23
- DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES'
24
- }]]
25
- }]
26
- });
27
- }
28
- export async function webpackFinal(config, {
29
- presets: presets
30
- }) {
31
- var typescriptOptions = await presets.apply('typescript', {});
32
- var reactDocgen = typescriptOptions.reactDocgen,
33
- reactDocgenTypescriptOptions = typescriptOptions.reactDocgenTypescriptOptions;
34
-
35
- if (reactDocgen !== 'react-docgen-typescript') {
36
- return config;
37
- }
38
-
39
- return _objectSpread(_objectSpread({}, config), {}, {
40
- plugins: [...config.plugins, new ReactDocgenTypescriptPlugin(_objectSpread(_objectSpread({}, reactDocgenTypescriptOptions), {}, {
41
- // We *need* this set so that RDT returns default values in the same format as react-docgen
42
- savePropValueAsString: true
43
- }))]
44
- });
45
- }
@@ -1,78 +0,0 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2
-
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
- import "core-js/modules/es.promise.js";
8
- import path from 'path';
9
- import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
10
- import { logger } from '@storybook/node-logger';
11
- export async function babel(config, options) {
12
- var isDevelopment = options.configType === 'DEVELOPMENT';
13
- var reactOptions = await options.presets.apply('reactOptions', {}, options);
14
- var fastRefreshEnabled = isDevelopment && (reactOptions.fastRefresh || process.env.FAST_REFRESH === 'true');
15
-
16
- if (!fastRefreshEnabled) {
17
- return config;
18
- }
19
-
20
- return _objectSpread(_objectSpread({}, config), {}, {
21
- plugins: [[require.resolve('react-refresh/babel'), {}, 'storybook-react-refresh'], ...(config.plugins || [])]
22
- });
23
- }
24
- var storybookReactDirName = path.dirname(require.resolve('@storybook/react/package.json')); // TODO: improve node_modules detection
25
-
26
- var context = storybookReactDirName.includes('node_modules') ? path.join(storybookReactDirName, '../../') // Real life case, already in node_modules
27
- : path.join(storybookReactDirName, '../../node_modules'); // SB Monorepo
28
-
29
- var hasJsxRuntime = function () {
30
- try {
31
- require.resolve('react/jsx-runtime', {
32
- paths: [context]
33
- });
34
-
35
- return true;
36
- } catch (e) {
37
- return false;
38
- }
39
- };
40
-
41
- export async function babelDefault(config) {
42
- var presetReactOptions = hasJsxRuntime() ? {
43
- runtime: 'automatic'
44
- } : {};
45
- return _objectSpread(_objectSpread({}, config), {}, {
46
- presets: [...((config === null || config === void 0 ? void 0 : config.presets) || []), [require.resolve('@babel/preset-react'), presetReactOptions], require.resolve('@babel/preset-flow')],
47
- plugins: [...((config === null || config === void 0 ? void 0 : config.plugins) || []), require.resolve('babel-plugin-add-react-displayname')]
48
- });
49
- }
50
- export async function webpackFinal(config, options) {
51
- var isDevelopment = options.configType === 'DEVELOPMENT';
52
- var reactOptions = await options.presets.apply('reactOptions', {}, options);
53
- var fastRefreshEnabled = isDevelopment && (reactOptions.fastRefresh || process.env.FAST_REFRESH === 'true');
54
-
55
- if (!fastRefreshEnabled) {
56
- return config;
57
- } // matches the name of the plugin in CRA.
58
-
59
-
60
- var hasReactRefresh = config.plugins.find(function (p) {
61
- return p.constructor.name === 'ReactRefreshPlugin';
62
- });
63
-
64
- if (hasReactRefresh) {
65
- logger.warn("=> React refresh is already set. You don't need to set the option");
66
- return config;
67
- }
68
-
69
- logger.info('=> Using React fast refresh');
70
- return _objectSpread(_objectSpread({}, config), {}, {
71
- plugins: [...config.plugins, // Storybook uses webpack-hot-middleware https://github.com/storybookjs/storybook/issues/14114
72
- new ReactRefreshWebpackPlugin({
73
- overlay: {
74
- sockIntegration: 'whm'
75
- }
76
- })]
77
- });
78
- }
@@ -1,3 +0,0 @@
1
- import { buildDev } from '@storybook/core/server';
2
- import options from './options';
3
- buildDev(options);
@@ -1,8 +0,0 @@
1
- import { sync } from 'read-pkg-up';
2
- export default {
3
- packageJson: sync({
4
- cwd: __dirname
5
- }).packageJson,
6
- framework: 'react',
7
- frameworkPresets: [require.resolve('./preset')]
8
- };
@@ -1,5 +0,0 @@
1
- import { findDistEsm } from '@storybook/core-common';
2
- export var config = function (entries = []) {
3
- return [...entries, findDistEsm(__dirname, 'client/preview/config')];
4
- };
5
- export var addons = [require.resolve('./framework-preset-react'), require.resolve('./framework-preset-cra'), require.resolve('./framework-preset-react-docgen')];
File without changes
@@ -1,3 +0,0 @@
1
- export { DecoratorFn } from './preview';
2
- export { storiesOf, setAddon, addDecorator, addParameters, configure, getStorybook, raw, forceReRender, } from './preview';
3
- export * from './preview/types-6-3';
@@ -1,4 +0,0 @@
1
- export { render, renderToDOM } from './render';
2
- export declare const parameters: {
3
- framework: string;
4
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,25 +0,0 @@
1
- /// <reference types="webpack-env" />
2
- /// <reference types="node" />
3
- import { ClientStoryApi, Loadable } from '@storybook/addons';
4
- import './globals';
5
- import { IStorybookSection } from './types';
6
- import { ReactFramework } from './types-6-0';
7
- interface ClientApi extends ClientStoryApi<ReactFramework['storyResult']> {
8
- setAddon(addon: any): void;
9
- configure(loader: Loadable, module: NodeModule): void;
10
- getStorybook(): IStorybookSection[];
11
- clearDecorators(): void;
12
- forceReRender(): void;
13
- raw: () => any;
14
- }
15
- export declare const storiesOf: ClientApi['storiesOf'];
16
- export declare const configure: ClientApi['configure'];
17
- export declare const addDecorator: ClientApi['addDecorator'];
18
- export declare type DecoratorFn = Parameters<typeof addDecorator>[0];
19
- export declare const addParameters: ClientApi['addParameters'];
20
- export declare const clearDecorators: ClientApi['clearDecorators'];
21
- export declare const setAddon: ClientApi['setAddon'];
22
- export declare const forceReRender: ClientApi['forceReRender'];
23
- export declare const getStorybook: ClientApi['getStorybook'];
24
- export declare const raw: ClientApi['raw'];
25
- export {};
@@ -1,5 +0,0 @@
1
- import { RenderContext } from '@storybook/store';
2
- import { ArgsStoryFn } from '@storybook/csf';
3
- import { ReactFramework } from './types-6-0';
4
- export declare const render: ArgsStoryFn<ReactFramework>;
5
- export declare function renderToDOM({ storyContext, unboundStoryFn, showMain, showException, forceRemount, }: RenderContext<ReactFramework>, domElement: HTMLElement): Promise<void>;
@@ -1,35 +0,0 @@
1
- import { ComponentType } from 'react';
2
- import { Args, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
3
- import { StoryFnReactReturnType } from './types';
4
- export { Args, ArgTypes, Parameters, StoryContext } from '@storybook/csf';
5
- export declare type ReactFramework = {
6
- component: ComponentType<any>;
7
- storyResult: StoryFnReactReturnType;
8
- };
9
- /**
10
- * Metadata to configure the stories for a component.
11
- *
12
- * @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
13
- */
14
- export declare type Meta<TArgs = Args> = ComponentAnnotations<ReactFramework, TArgs>;
15
- /**
16
- * Story function that represents a CSFv2 component example.
17
- *
18
- * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
19
- */
20
- export declare type StoryFn<TArgs = Args> = AnnotatedStoryFn<ReactFramework, TArgs>;
21
- /**
22
- * Story function that represents a CSFv3 component example.
23
- *
24
- * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
25
- */
26
- export declare type StoryObj<TArgs = Args> = StoryAnnotations<ReactFramework, TArgs>;
27
- /**
28
- * Story function that represents a CSFv2 component example.
29
- *
30
- * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
31
- *
32
- * NOTE that in Storybook 7.0, this type will be renamed to `StoryFn` and replaced by the current `StoryObj` type.
33
- *
34
- */
35
- export declare type Story<TArgs = Args> = StoryFn<TArgs>;
@@ -1,40 +0,0 @@
1
- import { ComponentProps, JSXElementConstructor } from 'react';
2
- import { StoryFn, StoryObj, Story, Meta } from './types-6-0';
3
- export * from './types-6-0';
4
- /**
5
- * For the common case where a component's stories are simple components that receives args as props:
6
- *
7
- * ```tsx
8
- * export default { ... } as ComponentMeta<typeof Button>;
9
- * ```
10
- */
11
- export declare type ComponentMeta<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Meta<ComponentProps<T>>;
12
- /**
13
- * For the common case where a (CSFv2) story is a simple component that receives args as props:
14
- *
15
- * ```tsx
16
- * const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
17
- * ```
18
- */
19
- export declare type ComponentStoryFn<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryFn<ComponentProps<T>>;
20
- /**
21
- * For the common case where a (CSFv3) story is a simple component that receives args as props:
22
- *
23
- * ```tsx
24
- * const MyStory: ComponentStory<typeof Button> = {
25
- * args: { buttonArg1: 'val' },
26
- * }
27
- * ```
28
- */
29
- export declare type ComponentStoryObj<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryObj<ComponentProps<T>>;
30
- /**
31
- * For the common case where a (CSFv2) story is a simple component that receives args as props:
32
- *
33
- * ```tsx
34
- * const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
35
- * ```
36
- *
37
- * NOTE: this is an alias for `ComponentStoryFn`.
38
- * In Storybook v7, `ComponentStory` will alias `ComponentStoryObj`
39
- */
40
- export declare type ComponentStory<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Story<ComponentProps<T>>;
@@ -1,21 +0,0 @@
1
- import { JSXElementConstructor } from 'react';
2
- import { Args } from '@storybook/csf';
3
- import { StoryObj } from './types-6-0';
4
- import { ComponentStoryObj } from './types-6-3';
5
- export { StoryFn, StoryObj, Meta } from './types-6-0';
6
- export { ComponentStoryFn, ComponentStoryObj, ComponentMeta } from './types-6-3';
7
- /**
8
- * Story function that represents a CSFv3 component example.
9
- *
10
- * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
11
- */
12
- export declare type Story<TArgs = Args> = StoryObj<TArgs>;
13
- /**
14
- * For the common case where a (CSFv3) story is a simple component that receives args as props:
15
- *
16
- * ```tsx
17
- * const MyStory: ComponentStory<typeof Button> = {
18
- * args: { buttonArg1: 'val' },
19
- * }
20
- * ```
21
- */ export declare type ComponentStory<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = ComponentStoryObj<T>;
@@ -1,16 +0,0 @@
1
- import { ReactElement } from 'react';
2
- export { RenderContext } from '@storybook/store';
3
- export { StoryContext } from '@storybook/csf';
4
- export interface ShowErrorArgs {
5
- title: string;
6
- description: string;
7
- }
8
- export declare type StoryFnReactReturnType = ReactElement<unknown>;
9
- export interface IStorybookStory {
10
- name: string;
11
- render: (context: any) => any;
12
- }
13
- export interface IStorybookSection {
14
- kind: string;
15
- stories: IStorybookStory[];
16
- }
@@ -1,4 +0,0 @@
1
- import { FunctionComponent, HTMLAttributes } from 'react';
2
- declare type Props = Pick<HTMLAttributes<HTMLButtonElement>, 'onClick'>;
3
- declare const Button: FunctionComponent<Props>;
4
- export default Button;
@@ -1,6 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- interface WelcomeProps {
3
- showApp: () => void;
4
- }
5
- declare const Welcome: FunctionComponent<WelcomeProps>;
6
- export { Welcome as default };
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- export declare function getReactScriptsPath({ noCache }?: {
2
- noCache?: boolean;
3
- }): string;
4
- export declare function isReactScriptsInstalled(requiredVersion?: string): boolean;
@@ -1,3 +0,0 @@
1
- import { Configuration } from 'webpack';
2
- import { Options } from '@storybook/core-common';
3
- export declare function webpackFinal(config: Configuration, { presetsList }: Options): Configuration;
@@ -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,51 +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, 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
- }>;
51
- export declare function webpackFinal(config: Configuration, options: Options): Promise<Configuration>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- import { LoadOptions } from '@storybook/core-common';
2
- declare const _default: LoadOptions;
3
- export default _default;
@@ -1,3 +0,0 @@
1
- import { StorybookConfig } from '@storybook/core-common';
2
- export declare const config: StorybookConfig['config'];
3
- export declare const addons: StorybookConfig['addons'];
@@ -1,3 +0,0 @@
1
- export type { DecoratorFn } from './preview';
2
- export { storiesOf, setAddon, addDecorator, addParameters, configure, getStorybook, raw, forceReRender, } from './preview';
3
- export * from './preview/types-6-3';
@@ -1,4 +0,0 @@
1
- export { render, renderToDOM } from './render';
2
- export declare const parameters: {
3
- framework: string;
4
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,25 +0,0 @@
1
- /// <reference types="webpack-env" />
2
- /// <reference types="node" />
3
- import { ClientStoryApi, Loadable } from '@storybook/addons';
4
- import './globals';
5
- import { IStorybookSection } from './types';
6
- import { ReactFramework } from './types-6-0';
7
- interface ClientApi extends ClientStoryApi<ReactFramework['storyResult']> {
8
- setAddon(addon: any): void;
9
- configure(loader: Loadable, module: NodeModule): void;
10
- getStorybook(): IStorybookSection[];
11
- clearDecorators(): void;
12
- forceReRender(): void;
13
- raw: () => any;
14
- }
15
- export declare const storiesOf: ClientApi['storiesOf'];
16
- export declare const configure: ClientApi['configure'];
17
- export declare const addDecorator: ClientApi['addDecorator'];
18
- export declare type DecoratorFn = Parameters<typeof addDecorator>[0];
19
- export declare const addParameters: ClientApi['addParameters'];
20
- export declare const clearDecorators: ClientApi['clearDecorators'];
21
- export declare const setAddon: ClientApi['setAddon'];
22
- export declare const forceReRender: ClientApi['forceReRender'];
23
- export declare const getStorybook: ClientApi['getStorybook'];
24
- export declare const raw: ClientApi['raw'];
25
- export {};
@@ -1,5 +0,0 @@
1
- import { RenderContext } from '@storybook/store';
2
- import { ArgsStoryFn } from '@storybook/csf';
3
- import { ReactFramework } from './types-6-0';
4
- export declare const render: ArgsStoryFn<ReactFramework>;
5
- export declare function renderToDOM({ storyContext, unboundStoryFn, showMain, showException, forceRemount, }: RenderContext<ReactFramework>, domElement: HTMLElement): Promise<void>;
@@ -1,35 +0,0 @@
1
- import { ComponentType } from 'react';
2
- import { Args, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
3
- import { StoryFnReactReturnType } from './types';
4
- export type { Args, ArgTypes, Parameters, StoryContext } from '@storybook/csf';
5
- export declare type ReactFramework = {
6
- component: ComponentType<any>;
7
- storyResult: StoryFnReactReturnType;
8
- };
9
- /**
10
- * Metadata to configure the stories for a component.
11
- *
12
- * @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
13
- */
14
- export declare type Meta<TArgs = Args> = ComponentAnnotations<ReactFramework, TArgs>;
15
- /**
16
- * Story function that represents a CSFv2 component example.
17
- *
18
- * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
19
- */
20
- export declare type StoryFn<TArgs = Args> = AnnotatedStoryFn<ReactFramework, TArgs>;
21
- /**
22
- * Story function that represents a CSFv3 component example.
23
- *
24
- * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
25
- */
26
- export declare type StoryObj<TArgs = Args> = StoryAnnotations<ReactFramework, TArgs>;
27
- /**
28
- * Story function that represents a CSFv2 component example.
29
- *
30
- * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
31
- *
32
- * NOTE that in Storybook 7.0, this type will be renamed to `StoryFn` and replaced by the current `StoryObj` type.
33
- *
34
- */
35
- export declare type Story<TArgs = Args> = StoryFn<TArgs>;
@@ -1,40 +0,0 @@
1
- import { ComponentProps, JSXElementConstructor } from 'react';
2
- import type { StoryFn, StoryObj, Story, Meta } from './types-6-0';
3
- export * from './types-6-0';
4
- /**
5
- * For the common case where a component's stories are simple components that receives args as props:
6
- *
7
- * ```tsx
8
- * export default { ... } as ComponentMeta<typeof Button>;
9
- * ```
10
- */
11
- export declare type ComponentMeta<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Meta<ComponentProps<T>>;
12
- /**
13
- * For the common case where a (CSFv2) story is a simple component that receives args as props:
14
- *
15
- * ```tsx
16
- * const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
17
- * ```
18
- */
19
- export declare type ComponentStoryFn<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryFn<ComponentProps<T>>;
20
- /**
21
- * For the common case where a (CSFv3) story is a simple component that receives args as props:
22
- *
23
- * ```tsx
24
- * const MyStory: ComponentStory<typeof Button> = {
25
- * args: { buttonArg1: 'val' },
26
- * }
27
- * ```
28
- */
29
- export declare type ComponentStoryObj<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryObj<ComponentProps<T>>;
30
- /**
31
- * For the common case where a (CSFv2) story is a simple component that receives args as props:
32
- *
33
- * ```tsx
34
- * const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
35
- * ```
36
- *
37
- * NOTE: this is an alias for `ComponentStoryFn`.
38
- * In Storybook v7, `ComponentStory` will alias `ComponentStoryObj`
39
- */
40
- export declare type ComponentStory<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Story<ComponentProps<T>>;
@@ -1,21 +0,0 @@
1
- import { JSXElementConstructor } from 'react';
2
- import { Args } from '@storybook/csf';
3
- import type { StoryObj } from './types-6-0';
4
- import type { ComponentStoryObj } from './types-6-3';
5
- export type { StoryFn, StoryObj, Meta } from './types-6-0';
6
- export type { ComponentStoryFn, ComponentStoryObj, ComponentMeta } from './types-6-3';
7
- /**
8
- * Story function that represents a CSFv3 component example.
9
- *
10
- * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
11
- */
12
- export declare type Story<TArgs = Args> = StoryObj<TArgs>;
13
- /**
14
- * For the common case where a (CSFv3) story is a simple component that receives args as props:
15
- *
16
- * ```tsx
17
- * const MyStory: ComponentStory<typeof Button> = {
18
- * args: { buttonArg1: 'val' },
19
- * }
20
- * ```
21
- */ export declare type ComponentStory<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = ComponentStoryObj<T>;