@storybook/react 6.4.0-beta.24 → 6.4.0-beta.25
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/cjs/client/index.js +87 -0
- package/dist/cjs/client/preview/config.js +25 -0
- package/dist/cjs/client/preview/globals.js +11 -0
- package/dist/cjs/client/preview/index.js +52 -0
- package/dist/cjs/client/preview/render.js +213 -0
- package/dist/cjs/client/preview/types-6-0.js +1 -0
- package/dist/cjs/client/preview/types-6-3.js +22 -0
- package/dist/cjs/client/preview/types-7-0.js +1 -0
- package/dist/cjs/client/preview/types.js +1 -0
- package/dist/cjs/demo/Button.js +37 -0
- package/dist/cjs/demo/Welcome.js +122 -0
- package/dist/cjs/server/build.js +9 -0
- package/dist/cjs/server/cra-config.js +69 -0
- package/dist/cjs/server/framework-preset-cra.js +35 -0
- package/dist/cjs/server/framework-preset-react-docgen.js +58 -0
- package/dist/cjs/server/framework-preset-react.js +98 -0
- package/dist/cjs/server/index.js +9 -0
- package/dist/cjs/server/options.js +17 -0
- package/dist/cjs/server/preset.js +16 -0
- package/dist/cjs/typings.d.js +1 -0
- package/dist/esm/client/index.js +6 -0
- package/dist/esm/client/preview/config.js +4 -0
- package/dist/esm/client/preview/globals.js +6 -0
- package/dist/esm/client/preview/index.js +29 -0
- package/dist/esm/client/preview/render.js +177 -0
- package/dist/esm/client/preview/types-6-0.js +0 -0
- package/dist/esm/client/preview/types-6-3.js +8 -0
- package/dist/esm/client/preview/types-7-0.js +0 -0
- package/dist/esm/client/preview/types.js +0 -0
- package/dist/esm/demo/Button.js +26 -0
- package/dist/esm/demo/Welcome.js +111 -0
- package/dist/esm/server/build.js +3 -0
- package/dist/esm/server/cra-config.js +49 -0
- package/dist/esm/server/framework-preset-cra.js +25 -0
- package/dist/esm/server/framework-preset-react-docgen.js +45 -0
- package/dist/esm/server/framework-preset-react.js +78 -0
- package/dist/esm/server/index.js +3 -0
- package/dist/esm/server/options.js +8 -0
- package/dist/esm/server/preset.js +5 -0
- package/dist/esm/typings.d.js +0 -0
- package/dist/modern/client/index.js +6 -0
- package/dist/modern/client/preview/config.js +4 -0
- package/dist/modern/client/preview/globals.js +8 -0
- package/dist/modern/client/preview/index.js +21 -0
- package/dist/modern/client/preview/render.js +94 -0
- package/dist/modern/client/preview/types-6-0.js +0 -0
- package/dist/modern/client/preview/types-6-3.js +8 -0
- package/dist/modern/client/preview/types-7-0.js +0 -0
- package/dist/modern/client/preview/types.js +0 -0
- package/dist/modern/demo/Button.js +25 -0
- package/dist/modern/demo/Welcome.js +104 -0
- package/dist/modern/server/build.js +3 -0
- package/dist/modern/server/cra-config.js +49 -0
- package/dist/modern/server/framework-preset-cra.js +25 -0
- package/dist/modern/server/framework-preset-react-docgen.js +45 -0
- package/dist/modern/server/framework-preset-react.js +78 -0
- package/dist/modern/server/index.js +3 -0
- package/dist/modern/server/options.js +8 -0
- package/dist/modern/server/preset.js +5 -0
- package/dist/modern/typings.d.js +0 -0
- package/dist/ts3.4/client/index.d.ts +3 -0
- package/dist/ts3.4/client/preview/config.d.ts +4 -0
- package/dist/ts3.4/client/preview/globals.d.ts +1 -0
- package/dist/ts3.4/client/preview/index.d.ts +25 -0
- package/dist/ts3.4/client/preview/render.d.ts +5 -0
- package/dist/ts3.4/client/preview/types-6-0.d.ts +35 -0
- package/dist/ts3.4/client/preview/types-6-3.d.ts +40 -0
- package/dist/ts3.4/client/preview/types-7-0.d.ts +21 -0
- package/dist/ts3.4/client/preview/types.d.ts +16 -0
- package/dist/ts3.4/demo/Button.d.ts +4 -0
- package/dist/ts3.4/demo/Welcome.d.ts +6 -0
- package/dist/ts3.4/server/build.d.ts +1 -0
- package/dist/ts3.4/server/cra-config.d.ts +4 -0
- package/dist/ts3.4/server/framework-preset-cra.d.ts +3 -0
- package/dist/ts3.4/server/framework-preset-react-docgen.d.ts +5 -0
- package/dist/ts3.4/server/framework-preset-react.d.ts +51 -0
- package/dist/ts3.4/server/index.d.ts +1 -0
- package/dist/ts3.4/server/options.d.ts +3 -0
- package/dist/ts3.4/server/preset.d.ts +3 -0
- package/dist/ts3.9/client/index.d.ts +3 -0
- package/dist/ts3.9/client/preview/config.d.ts +4 -0
- package/dist/ts3.9/client/preview/globals.d.ts +1 -0
- package/dist/ts3.9/client/preview/index.d.ts +25 -0
- package/dist/ts3.9/client/preview/render.d.ts +5 -0
- package/dist/ts3.9/client/preview/types-6-0.d.ts +35 -0
- package/dist/ts3.9/client/preview/types-6-3.d.ts +40 -0
- package/dist/ts3.9/client/preview/types-7-0.d.ts +21 -0
- package/dist/ts3.9/client/preview/types.d.ts +16 -0
- package/dist/ts3.9/demo/Button.d.ts +4 -0
- package/dist/ts3.9/demo/Welcome.d.ts +6 -0
- package/dist/ts3.9/server/build.d.ts +1 -0
- package/dist/ts3.9/server/cra-config.d.ts +4 -0
- package/dist/ts3.9/server/framework-preset-cra.d.ts +3 -0
- package/dist/ts3.9/server/framework-preset-react-docgen.d.ts +5 -0
- package/dist/ts3.9/server/framework-preset-react.d.ts +51 -0
- package/dist/ts3.9/server/index.d.ts +1 -0
- package/dist/ts3.9/server/options.d.ts +3 -0
- package/dist/ts3.9/server/preset.d.ts +3 -0
- package/package.json +8 -8
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,5 @@
|
|
|
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>;
|
|
@@ -0,0 +1,35 @@
|
|
|
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>;
|
|
@@ -0,0 +1,40 @@
|
|
|
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>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
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>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
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>;
|
|
@@ -0,0 +1,51 @@
|
|
|
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>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,5 @@
|
|
|
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>;
|
|
@@ -0,0 +1,35 @@
|
|
|
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>;
|
|
@@ -0,0 +1,40 @@
|
|
|
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>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
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>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export type { RenderContext } from '@storybook/store';
|
|
3
|
+
export type { 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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
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>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { 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, 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>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|