@storybook/react 6.5.0-alpha.45 → 6.5.0-alpha.48
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/docs/config.js +29 -0
- package/dist/cjs/client/docs/extractArgTypes.js +54 -0
- package/dist/cjs/client/docs/extractProps.js +77 -0
- package/dist/cjs/client/docs/jsxDecorator.js +277 -0
- package/dist/cjs/client/docs/lib/captions.js +18 -0
- package/dist/cjs/client/docs/lib/componentTypes.js +24 -0
- package/dist/cjs/client/docs/lib/defaultValues/createDefaultValue.js +81 -0
- package/dist/cjs/client/docs/lib/defaultValues/createFromRawDefaultProp.js +225 -0
- package/dist/cjs/client/docs/lib/defaultValues/generateArray.js +29 -0
- package/dist/cjs/client/docs/lib/defaultValues/generateObject.js +29 -0
- package/dist/cjs/client/docs/lib/defaultValues/index.js +37 -0
- package/dist/cjs/client/docs/lib/defaultValues/prettyIdentifier.js +34 -0
- package/dist/cjs/client/docs/lib/generateCode.js +89 -0
- package/dist/cjs/client/docs/lib/index.js +63 -0
- package/dist/cjs/client/docs/lib/inspection/acornParser.js +254 -0
- package/dist/cjs/client/docs/lib/inspection/index.js +37 -0
- package/dist/cjs/client/docs/lib/inspection/inspectValue.js +26 -0
- package/dist/cjs/client/docs/lib/inspection/types.js +19 -0
- package/dist/cjs/client/docs/lib/isHtmlTag.js +18 -0
- package/dist/cjs/client/docs/propTypes/createType.js +469 -0
- package/dist/cjs/client/docs/propTypes/generateFuncSignature.js +78 -0
- package/dist/cjs/client/docs/propTypes/handleProp.js +54 -0
- package/dist/cjs/client/docs/propTypes/rawDefaultPropResolvers.js +47 -0
- package/dist/cjs/client/docs/propTypes/sortProps.js +37 -0
- package/dist/cjs/client/docs/react-argtypes.stories.js +129 -0
- package/dist/cjs/client/docs/typeScript/handleProp.js +38 -0
- package/dist/cjs/server/{framework-preset-react-docgen.js → framework-preset-react-docs.js} +19 -9
- package/dist/cjs/server/preset.js +1 -1
- package/dist/esm/client/docs/config.js +16 -0
- package/dist/esm/client/docs/extractArgTypes.js +39 -0
- package/dist/esm/client/docs/extractProps.js +54 -0
- package/dist/esm/client/docs/jsxDecorator.js +218 -0
- package/dist/esm/client/docs/lib/captions.js +6 -0
- package/dist/esm/client/docs/lib/componentTypes.js +9 -0
- package/dist/esm/client/docs/lib/defaultValues/createDefaultValue.js +67 -0
- package/dist/esm/client/docs/lib/defaultValues/createFromRawDefaultProp.js +191 -0
- package/dist/esm/client/docs/lib/defaultValues/generateArray.js +19 -0
- package/dist/esm/client/docs/lib/defaultValues/generateObject.js +19 -0
- package/dist/esm/client/docs/lib/defaultValues/index.js +2 -0
- package/dist/esm/client/docs/lib/defaultValues/prettyIdentifier.js +22 -0
- package/dist/esm/client/docs/lib/generateCode.js +68 -0
- package/dist/esm/client/docs/lib/index.js +4 -0
- package/dist/esm/client/docs/lib/inspection/acornParser.js +213 -0
- package/dist/esm/client/docs/lib/inspection/index.js +2 -0
- package/dist/esm/client/docs/lib/inspection/inspectValue.js +16 -0
- package/dist/esm/client/docs/lib/inspection/types.js +12 -0
- package/dist/esm/client/docs/lib/isHtmlTag.js +6 -0
- package/dist/esm/client/docs/propTypes/createType.js +449 -0
- package/dist/esm/client/docs/propTypes/generateFuncSignature.js +62 -0
- package/dist/esm/client/docs/propTypes/handleProp.js +39 -0
- package/dist/esm/client/docs/propTypes/rawDefaultPropResolvers.js +32 -0
- package/dist/esm/client/docs/propTypes/sortProps.js +24 -0
- package/dist/esm/client/docs/react-argtypes.stories.js +97 -0
- package/dist/esm/client/docs/typeScript/handleProp.js +27 -0
- package/dist/esm/server/{framework-preset-react-docgen.js → framework-preset-react-docs.js} +13 -9
- package/dist/esm/server/preset.js +1 -1
- package/dist/modern/client/docs/config.js +14 -0
- package/dist/modern/client/docs/extractArgTypes.js +38 -0
- package/dist/modern/client/docs/extractProps.js +42 -0
- package/dist/modern/client/docs/jsxDecorator.js +177 -0
- package/dist/modern/client/docs/lib/captions.js +6 -0
- package/dist/modern/client/docs/lib/componentTypes.js +2 -0
- package/dist/modern/client/docs/lib/defaultValues/createDefaultValue.js +72 -0
- package/dist/modern/client/docs/lib/defaultValues/createFromRawDefaultProp.js +181 -0
- package/dist/modern/client/docs/lib/defaultValues/generateArray.js +21 -0
- package/dist/modern/client/docs/lib/defaultValues/generateObject.js +21 -0
- package/dist/modern/client/docs/lib/defaultValues/index.js +2 -0
- package/dist/modern/client/docs/lib/defaultValues/prettyIdentifier.js +24 -0
- package/dist/modern/client/docs/lib/generateCode.js +59 -0
- package/dist/modern/client/docs/lib/index.js +4 -0
- package/dist/modern/client/docs/lib/inspection/acornParser.js +211 -0
- package/dist/modern/client/docs/lib/inspection/index.js +2 -0
- package/dist/modern/client/docs/lib/inspection/inspectValue.js +15 -0
- package/dist/modern/client/docs/lib/inspection/types.js +12 -0
- package/dist/modern/client/docs/lib/isHtmlTag.js +4 -0
- package/dist/modern/client/docs/propTypes/createType.js +446 -0
- package/dist/modern/client/docs/propTypes/generateFuncSignature.js +57 -0
- package/dist/modern/client/docs/propTypes/handleProp.js +39 -0
- package/dist/modern/client/docs/propTypes/rawDefaultPropResolvers.js +31 -0
- package/dist/modern/client/docs/propTypes/sortProps.js +14 -0
- package/dist/modern/client/docs/react-argtypes.stories.js +54 -0
- package/dist/modern/client/docs/typeScript/handleProp.js +28 -0
- package/dist/modern/server/{framework-preset-react-docgen.js → framework-preset-react-docs.js} +13 -9
- package/dist/modern/server/preset.js +1 -1
- package/dist/ts3.4/client/docs/config.d.ts +13 -0
- package/dist/ts3.4/client/docs/extractArgTypes.d.ts +2 -0
- package/dist/ts3.4/client/docs/extractProps.d.ts +5 -0
- package/dist/ts3.4/client/docs/jsxDecorator.d.ts +23 -0
- package/dist/ts3.4/client/docs/lib/captions.d.ts +6 -0
- package/dist/ts3.4/client/docs/lib/componentTypes.d.ts +2 -0
- package/dist/ts3.4/client/docs/lib/defaultValues/createDefaultValue.d.ts +2 -0
- package/dist/ts3.4/client/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +11 -0
- package/dist/ts3.4/client/docs/lib/defaultValues/generateArray.d.ts +3 -0
- package/dist/ts3.4/client/docs/lib/defaultValues/generateObject.d.ts +3 -0
- package/dist/ts3.4/client/docs/lib/defaultValues/index.d.ts +2 -0
- package/dist/ts3.4/client/docs/lib/defaultValues/prettyIdentifier.d.ts +4 -0
- package/dist/ts3.4/client/docs/lib/generateCode.d.ts +3 -0
- package/dist/ts3.4/client/docs/lib/index.d.ts +4 -0
- package/dist/ts3.4/client/docs/lib/inspection/acornParser.d.ts +7 -0
- package/dist/ts3.4/client/docs/lib/inspection/index.d.ts +2 -0
- package/dist/ts3.4/client/docs/lib/inspection/inspectValue.d.ts +2 -0
- package/dist/ts3.4/client/docs/lib/inspection/types.d.ts +50 -0
- package/dist/ts3.4/client/docs/lib/isHtmlTag.d.ts +1 -0
- package/dist/ts3.4/client/docs/propTypes/createType.d.ts +2 -0
- package/dist/ts3.4/client/docs/propTypes/generateFuncSignature.d.ts +4 -0
- package/dist/ts3.4/client/docs/propTypes/handleProp.d.ts +5 -0
- package/dist/ts3.4/client/docs/propTypes/rawDefaultPropResolvers.d.ts +1 -0
- package/dist/ts3.4/client/docs/propTypes/sortProps.d.ts +4 -0
- package/dist/ts3.4/client/docs/react-argtypes.stories.d.ts +1 -0
- package/dist/ts3.4/client/docs/typeScript/handleProp.d.ts +3 -0
- package/dist/ts3.4/server/framework-preset-react-docs.d.ts +6 -0
- package/dist/ts3.9/client/docs/config.d.ts +13 -0
- package/dist/ts3.9/client/docs/extractArgTypes.d.ts +2 -0
- package/dist/ts3.9/client/docs/extractProps.d.ts +5 -0
- package/dist/ts3.9/client/docs/jsxDecorator.d.ts +23 -0
- package/dist/ts3.9/client/docs/lib/captions.d.ts +6 -0
- package/dist/ts3.9/client/docs/lib/componentTypes.d.ts +2 -0
- package/dist/ts3.9/client/docs/lib/defaultValues/createDefaultValue.d.ts +2 -0
- package/dist/ts3.9/client/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +11 -0
- package/dist/ts3.9/client/docs/lib/defaultValues/generateArray.d.ts +3 -0
- package/dist/ts3.9/client/docs/lib/defaultValues/generateObject.d.ts +3 -0
- package/dist/ts3.9/client/docs/lib/defaultValues/index.d.ts +2 -0
- package/dist/ts3.9/client/docs/lib/defaultValues/prettyIdentifier.d.ts +4 -0
- package/dist/ts3.9/client/docs/lib/generateCode.d.ts +3 -0
- package/dist/ts3.9/client/docs/lib/index.d.ts +4 -0
- package/dist/ts3.9/client/docs/lib/inspection/acornParser.d.ts +7 -0
- package/dist/ts3.9/client/docs/lib/inspection/index.d.ts +2 -0
- package/dist/ts3.9/client/docs/lib/inspection/inspectValue.d.ts +2 -0
- package/dist/ts3.9/client/docs/lib/inspection/types.d.ts +50 -0
- package/dist/ts3.9/client/docs/lib/isHtmlTag.d.ts +1 -0
- package/dist/ts3.9/client/docs/propTypes/createType.d.ts +2 -0
- package/dist/ts3.9/client/docs/propTypes/generateFuncSignature.d.ts +4 -0
- package/dist/ts3.9/client/docs/propTypes/handleProp.d.ts +5 -0
- package/dist/ts3.9/client/docs/propTypes/rawDefaultPropResolvers.d.ts +1 -0
- package/dist/ts3.9/client/docs/propTypes/sortProps.d.ts +4 -0
- package/dist/ts3.9/client/docs/react-argtypes.stories.d.ts +1 -0
- package/dist/ts3.9/client/docs/typeScript/handleProp.d.ts +3 -0
- package/dist/ts3.9/client/preview/types-6-0.d.ts +3 -3
- package/dist/ts3.9/client/preview/types-7-0.d.ts +2 -2
- package/dist/ts3.9/server/framework-preset-react-docs.d.ts +6 -0
- package/dist/ts3.9/server/options.d.ts +1 -1
- package/dist/ts3.9/server/preset.d.ts +1 -1
- package/package.json +21 -11
- package/types/index.ts +1 -1
- package/dist/ts3.4/server/framework-preset-react-docgen.d.ts +0 -5
- package/dist/ts3.9/server/framework-preset-react-docgen.d.ts +0 -5
package/dist/modern/server/{framework-preset-react-docgen.js → framework-preset-react-docs.js}
RENAMED
|
@@ -5,11 +5,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
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
6
|
|
|
7
7
|
import "core-js/modules/es.promise.js";
|
|
8
|
+
import { findDistEsm } from '@storybook/core-common';
|
|
8
9
|
import ReactDocgenTypescriptPlugin from '@storybook/react-docgen-typescript-plugin';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var typescriptOptions = await presets.apply('typescript', {});
|
|
10
|
+
import { hasDocsOrControls } from '@storybook/docs-tools';
|
|
11
|
+
export async function babel(config, options) {
|
|
12
|
+
if (!hasDocsOrControls(options)) return config;
|
|
13
|
+
var typescriptOptions = await options.presets.apply('typescript', {});
|
|
13
14
|
var reactDocgen = typescriptOptions.reactDocgen;
|
|
14
15
|
|
|
15
16
|
if (typeof reactDocgen !== 'string') {
|
|
@@ -25,10 +26,9 @@ export async function babel(config, {
|
|
|
25
26
|
}]
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
export async function webpackFinal(config, {
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
var typescriptOptions = await presets.apply('typescript', {});
|
|
29
|
+
export async function webpackFinal(config, options) {
|
|
30
|
+
if (!hasDocsOrControls(options)) return config;
|
|
31
|
+
var typescriptOptions = await options.presets.apply('typescript', {});
|
|
32
32
|
var reactDocgen = typescriptOptions.reactDocgen,
|
|
33
33
|
reactDocgenTypescriptOptions = typescriptOptions.reactDocgenTypescriptOptions;
|
|
34
34
|
|
|
@@ -42,4 +42,8 @@ export async function webpackFinal(config, {
|
|
|
42
42
|
savePropValueAsString: true
|
|
43
43
|
}))]
|
|
44
44
|
});
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
|
+
export var config = function (entry = [], options) {
|
|
47
|
+
if (!hasDocsOrControls(options)) return entry;
|
|
48
|
+
return [...entry, findDistEsm(__dirname, 'client/docs/config')];
|
|
49
|
+
};
|
|
@@ -2,4 +2,4 @@ import { findDistEsm } from '@storybook/core-common';
|
|
|
2
2
|
export var config = function (entries = []) {
|
|
3
3
|
return [...entries, findDistEsm(__dirname, 'client/preview/config')];
|
|
4
4
|
};
|
|
5
|
-
export var addons = [require.resolve('./framework-preset-react'), require.resolve('./framework-preset-cra'), require.resolve('./framework-preset-react-
|
|
5
|
+
export var addons = [require.resolve('./framework-preset-react'), require.resolve('./framework-preset-cra'), require.resolve('./framework-preset-react-docs')];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PartialStoryFn } from '@storybook/csf';
|
|
2
|
+
import { extractComponentDescription } from '@storybook/docs-tools';
|
|
3
|
+
import { ReactFramework } from '..';
|
|
4
|
+
export declare const parameters: {
|
|
5
|
+
docs: {
|
|
6
|
+
inlineStories: boolean;
|
|
7
|
+
prepareForInline: (storyFn: PartialStoryFn<ReactFramework>) => import("../preview/types").StoryFnReactReturnType;
|
|
8
|
+
extractArgTypes: import("@storybook/docs-tools").ArgTypesExtractor;
|
|
9
|
+
extractComponentDescription: typeof extractComponentDescription;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const decorators: ((storyFn: PartialStoryFn<ReactFramework, import("@storybook/csf").Args>, context: import("@storybook/csf").StoryContext<ReactFramework, import("@storybook/csf").Args>) => import("../preview/types").StoryFnReactReturnType)[];
|
|
13
|
+
export declare const argTypesEnhancers: (<TFramework extends import("@storybook/csf").AnyFramework>(context: import("@storybook/csf").StoryContextForEnhancers<TFramework, import("@storybook/csf").Args>) => import("@storybook/addons").Parameters | import("@storybook/csf").StrictArgTypes<import("@storybook/csf").Args>)[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { Options } from 'react-element-to-jsx-string';
|
|
3
|
+
import { StoryContext, PartialStoryFn } from '@storybook/csf';
|
|
4
|
+
import { ReactFramework } from '..';
|
|
5
|
+
declare type JSXOptions = Options & {
|
|
6
|
+
/** How many wrappers to skip when rendering the jsx */
|
|
7
|
+
skip?: number;
|
|
8
|
+
/** Whether to show the function in the jsx tab */
|
|
9
|
+
showFunctions?: boolean;
|
|
10
|
+
/** Whether to format HTML or Vue markup */
|
|
11
|
+
enableBeautify?: boolean;
|
|
12
|
+
/** Override the display name used for a component */
|
|
13
|
+
displayName?: string | Options['displayName'];
|
|
14
|
+
/** Deprecated: A function ran after the story is rendered */
|
|
15
|
+
onBeforeRender?(dom: string): string;
|
|
16
|
+
/** A function ran after a story is rendered (prefer this over `onBeforeRender`) */
|
|
17
|
+
transformSource?(dom: string, context?: StoryContext<ReactFramework>): string;
|
|
18
|
+
};
|
|
19
|
+
/** Apply the users parameters and render the jsx for a story */
|
|
20
|
+
export declare const renderJsx: (code: React.ReactElement, options: JSXOptions) => string;
|
|
21
|
+
export declare const skipJsxRender: (context: StoryContext<ReactFramework>) => any;
|
|
22
|
+
export declare const jsxDecorator: (storyFn: PartialStoryFn<ReactFramework>, context: StoryContext<ReactFramework>) => import("../preview/types").StoryFnReactReturnType;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CUSTOM_CAPTION = "custom";
|
|
2
|
+
export declare const OBJECT_CAPTION = "object";
|
|
3
|
+
export declare const ARRAY_CAPTION = "array";
|
|
4
|
+
export declare const CLASS_CAPTION = "class";
|
|
5
|
+
export declare const FUNCTION_CAPTION = "func";
|
|
6
|
+
export declare const ELEMENT_CAPTION = "element";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PropDef, PropDefaultValue } from '@storybook/docs-tools';
|
|
2
|
+
export declare type TypeResolver = (rawDefaultProp: any, propDef: PropDef) => PropDefaultValue;
|
|
3
|
+
export interface TypeResolvers {
|
|
4
|
+
string: TypeResolver;
|
|
5
|
+
object: TypeResolver;
|
|
6
|
+
function: TypeResolver;
|
|
7
|
+
default: TypeResolver;
|
|
8
|
+
}
|
|
9
|
+
export declare function extractFunctionName(func: Function, propName: string): string;
|
|
10
|
+
export declare function createTypeResolvers(customResolvers?: Partial<TypeResolvers>): TypeResolvers;
|
|
11
|
+
export declare function createDefaultValueFromRawDefaultProp(rawDefaultProp: any, propDef: PropDef, typeResolvers?: TypeResolvers): PropDefaultValue;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InspectionIdentifiableInferedType } from '../inspection';
|
|
2
|
+
export declare function getPrettyIdentifier(inferredType: InspectionIdentifiableInferedType): string;
|
|
3
|
+
export declare function getPrettyFuncIdentifier(identifier: string, hasArguments: boolean): string;
|
|
4
|
+
export declare function getPrettyElementIdentifier(identifier: string): string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare enum InspectionType {
|
|
2
|
+
IDENTIFIER = "Identifier",
|
|
3
|
+
LITERAL = "Literal",
|
|
4
|
+
OBJECT = "Object",
|
|
5
|
+
ARRAY = "Array",
|
|
6
|
+
FUNCTION = "Function",
|
|
7
|
+
CLASS = "Class",
|
|
8
|
+
ELEMENT = "Element",
|
|
9
|
+
UNKNOWN = "Unknown"
|
|
10
|
+
}
|
|
11
|
+
export interface InspectionInferedType {
|
|
12
|
+
type: InspectionType;
|
|
13
|
+
}
|
|
14
|
+
export interface InspectionIdentifier extends InspectionInferedType {
|
|
15
|
+
type: InspectionType.IDENTIFIER;
|
|
16
|
+
identifier: string;
|
|
17
|
+
}
|
|
18
|
+
export interface InspectionLiteral extends InspectionInferedType {
|
|
19
|
+
type: InspectionType.LITERAL;
|
|
20
|
+
}
|
|
21
|
+
export interface InspectionObject extends InspectionInferedType {
|
|
22
|
+
type: InspectionType.OBJECT;
|
|
23
|
+
depth: number;
|
|
24
|
+
}
|
|
25
|
+
export interface InspectionArray extends InspectionInferedType {
|
|
26
|
+
type: InspectionType.ARRAY;
|
|
27
|
+
depth: number;
|
|
28
|
+
}
|
|
29
|
+
export interface InspectionClass extends InspectionInferedType {
|
|
30
|
+
type: InspectionType.CLASS;
|
|
31
|
+
identifier: string;
|
|
32
|
+
}
|
|
33
|
+
export interface InspectionFunction extends InspectionInferedType {
|
|
34
|
+
type: InspectionType.FUNCTION;
|
|
35
|
+
identifier?: string;
|
|
36
|
+
params: any[];
|
|
37
|
+
hasParams: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface InspectionElement extends InspectionInferedType {
|
|
40
|
+
type: InspectionType.ELEMENT;
|
|
41
|
+
identifier?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface InspectionUnknown extends InspectionInferedType {
|
|
44
|
+
type: InspectionType.UNKNOWN;
|
|
45
|
+
}
|
|
46
|
+
export declare type InspectionIdentifiableInferedType = InspectionIdentifier | InspectionClass | InspectionFunction | InspectionElement;
|
|
47
|
+
export interface InspectionResult {
|
|
48
|
+
inferredType: InspectionInferedType;
|
|
49
|
+
ast?: any;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isHtmlTag(tagName: string): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExtractedJsDocParam, ExtractedJsDocReturns } from '@storybook/docs-tools';
|
|
2
|
+
export declare function generateFuncSignature(params: ExtractedJsDocParam[], returns: ExtractedJsDocReturns): string;
|
|
3
|
+
export declare function generateShortFuncSignature(params: ExtractedJsDocParam[], returns: ExtractedJsDocReturns): string;
|
|
4
|
+
export declare function toMultilineSignature(signature: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PropDef, ExtractedProp } from '@storybook/docs-tools';
|
|
2
|
+
declare type Component = any;
|
|
3
|
+
export declare function enhancePropTypesProp(extractedProp: ExtractedProp, rawDefaultProp?: any): PropDef;
|
|
4
|
+
export declare function enhancePropTypesProps(extractedProps: ExtractedProp[], component: Component): PropDef[];
|
|
5
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const rawDefaultPropTypeResolvers: import("../lib/defaultValues").TypeResolvers;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StorybookConfig, Options } from '@storybook/core-common';
|
|
2
|
+
import { TransformOptions } from '@babel/core';
|
|
3
|
+
import { 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 config: StorybookConfig['config'];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PartialStoryFn } from '@storybook/csf';
|
|
2
|
+
import { extractComponentDescription } from '@storybook/docs-tools';
|
|
3
|
+
import { ReactFramework } from '..';
|
|
4
|
+
export declare const parameters: {
|
|
5
|
+
docs: {
|
|
6
|
+
inlineStories: boolean;
|
|
7
|
+
prepareForInline: (storyFn: PartialStoryFn<ReactFramework>) => import("../preview/types").StoryFnReactReturnType;
|
|
8
|
+
extractArgTypes: import("@storybook/docs-tools").ArgTypesExtractor;
|
|
9
|
+
extractComponentDescription: typeof extractComponentDescription;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const decorators: ((storyFn: PartialStoryFn<ReactFramework, import("@storybook/csf").Args>, context: import("@storybook/csf").StoryContext<ReactFramework, import("@storybook/csf").Args>) => import("../preview/types").StoryFnReactReturnType)[];
|
|
13
|
+
export declare const argTypesEnhancers: (<TFramework extends import("@storybook/csf").AnyFramework>(context: import("@storybook/csf").StoryContextForEnhancers<TFramework, import("@storybook/csf").Args>) => import("@storybook/addons").Parameters | import("@storybook/csf").StrictArgTypes<import("@storybook/csf").Args>)[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { Options } from 'react-element-to-jsx-string';
|
|
3
|
+
import { StoryContext, PartialStoryFn } from '@storybook/csf';
|
|
4
|
+
import { ReactFramework } from '..';
|
|
5
|
+
declare type JSXOptions = Options & {
|
|
6
|
+
/** How many wrappers to skip when rendering the jsx */
|
|
7
|
+
skip?: number;
|
|
8
|
+
/** Whether to show the function in the jsx tab */
|
|
9
|
+
showFunctions?: boolean;
|
|
10
|
+
/** Whether to format HTML or Vue markup */
|
|
11
|
+
enableBeautify?: boolean;
|
|
12
|
+
/** Override the display name used for a component */
|
|
13
|
+
displayName?: string | Options['displayName'];
|
|
14
|
+
/** Deprecated: A function ran after the story is rendered */
|
|
15
|
+
onBeforeRender?(dom: string): string;
|
|
16
|
+
/** A function ran after a story is rendered (prefer this over `onBeforeRender`) */
|
|
17
|
+
transformSource?(dom: string, context?: StoryContext<ReactFramework>): string;
|
|
18
|
+
};
|
|
19
|
+
/** Apply the users parameters and render the jsx for a story */
|
|
20
|
+
export declare const renderJsx: (code: React.ReactElement, options: JSXOptions) => string;
|
|
21
|
+
export declare const skipJsxRender: (context: StoryContext<ReactFramework>) => any;
|
|
22
|
+
export declare const jsxDecorator: (storyFn: PartialStoryFn<ReactFramework>, context: StoryContext<ReactFramework>) => import("../preview/types").StoryFnReactReturnType;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CUSTOM_CAPTION = "custom";
|
|
2
|
+
export declare const OBJECT_CAPTION = "object";
|
|
3
|
+
export declare const ARRAY_CAPTION = "array";
|
|
4
|
+
export declare const CLASS_CAPTION = "class";
|
|
5
|
+
export declare const FUNCTION_CAPTION = "func";
|
|
6
|
+
export declare const ELEMENT_CAPTION = "element";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PropDef, PropDefaultValue } from '@storybook/docs-tools';
|
|
2
|
+
export declare type TypeResolver = (rawDefaultProp: any, propDef: PropDef) => PropDefaultValue;
|
|
3
|
+
export interface TypeResolvers {
|
|
4
|
+
string: TypeResolver;
|
|
5
|
+
object: TypeResolver;
|
|
6
|
+
function: TypeResolver;
|
|
7
|
+
default: TypeResolver;
|
|
8
|
+
}
|
|
9
|
+
export declare function extractFunctionName(func: Function, propName: string): string;
|
|
10
|
+
export declare function createTypeResolvers(customResolvers?: Partial<TypeResolvers>): TypeResolvers;
|
|
11
|
+
export declare function createDefaultValueFromRawDefaultProp(rawDefaultProp: any, propDef: PropDef, typeResolvers?: TypeResolvers): PropDefaultValue;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InspectionIdentifiableInferedType } from '../inspection';
|
|
2
|
+
export declare function getPrettyIdentifier(inferredType: InspectionIdentifiableInferedType): string;
|
|
3
|
+
export declare function getPrettyFuncIdentifier(identifier: string, hasArguments: boolean): string;
|
|
4
|
+
export declare function getPrettyElementIdentifier(identifier: string): string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare enum InspectionType {
|
|
2
|
+
IDENTIFIER = "Identifier",
|
|
3
|
+
LITERAL = "Literal",
|
|
4
|
+
OBJECT = "Object",
|
|
5
|
+
ARRAY = "Array",
|
|
6
|
+
FUNCTION = "Function",
|
|
7
|
+
CLASS = "Class",
|
|
8
|
+
ELEMENT = "Element",
|
|
9
|
+
UNKNOWN = "Unknown"
|
|
10
|
+
}
|
|
11
|
+
export interface InspectionInferedType {
|
|
12
|
+
type: InspectionType;
|
|
13
|
+
}
|
|
14
|
+
export interface InspectionIdentifier extends InspectionInferedType {
|
|
15
|
+
type: InspectionType.IDENTIFIER;
|
|
16
|
+
identifier: string;
|
|
17
|
+
}
|
|
18
|
+
export interface InspectionLiteral extends InspectionInferedType {
|
|
19
|
+
type: InspectionType.LITERAL;
|
|
20
|
+
}
|
|
21
|
+
export interface InspectionObject extends InspectionInferedType {
|
|
22
|
+
type: InspectionType.OBJECT;
|
|
23
|
+
depth: number;
|
|
24
|
+
}
|
|
25
|
+
export interface InspectionArray extends InspectionInferedType {
|
|
26
|
+
type: InspectionType.ARRAY;
|
|
27
|
+
depth: number;
|
|
28
|
+
}
|
|
29
|
+
export interface InspectionClass extends InspectionInferedType {
|
|
30
|
+
type: InspectionType.CLASS;
|
|
31
|
+
identifier: string;
|
|
32
|
+
}
|
|
33
|
+
export interface InspectionFunction extends InspectionInferedType {
|
|
34
|
+
type: InspectionType.FUNCTION;
|
|
35
|
+
identifier?: string;
|
|
36
|
+
params: any[];
|
|
37
|
+
hasParams: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface InspectionElement extends InspectionInferedType {
|
|
40
|
+
type: InspectionType.ELEMENT;
|
|
41
|
+
identifier?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface InspectionUnknown extends InspectionInferedType {
|
|
44
|
+
type: InspectionType.UNKNOWN;
|
|
45
|
+
}
|
|
46
|
+
export declare type InspectionIdentifiableInferedType = InspectionIdentifier | InspectionClass | InspectionFunction | InspectionElement;
|
|
47
|
+
export interface InspectionResult {
|
|
48
|
+
inferredType: InspectionInferedType;
|
|
49
|
+
ast?: any;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isHtmlTag(tagName: string): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExtractedJsDocParam, ExtractedJsDocReturns } from '@storybook/docs-tools';
|
|
2
|
+
export declare function generateFuncSignature(params: ExtractedJsDocParam[], returns: ExtractedJsDocReturns): string;
|
|
3
|
+
export declare function generateShortFuncSignature(params: ExtractedJsDocParam[], returns: ExtractedJsDocReturns): string;
|
|
4
|
+
export declare function toMultilineSignature(signature: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PropDef, ExtractedProp } from '@storybook/docs-tools';
|
|
2
|
+
declare type Component = any;
|
|
3
|
+
export declare function enhancePropTypesProp(extractedProp: ExtractedProp, rawDefaultProp?: any): PropDef;
|
|
4
|
+
export declare function enhancePropTypesProps(extractedProps: ExtractedProp[], component: Component): PropDef[];
|
|
5
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const rawDefaultPropTypeResolvers: import("../lib/defaultValues").TypeResolvers;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
|
-
import { Args, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
|
|
3
|
-
import { StoryFnReactReturnType } from './types';
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { Args, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
|
|
3
|
+
import type { StoryFnReactReturnType } from './types';
|
|
4
4
|
export type { Args, ArgTypes, Parameters, StoryContext } from '@storybook/csf';
|
|
5
5
|
export declare type ReactFramework = {
|
|
6
6
|
component: ComponentType<any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JSXElementConstructor } from 'react';
|
|
2
|
-
import { Args } from '@storybook/csf';
|
|
1
|
+
import type { JSXElementConstructor } from 'react';
|
|
2
|
+
import type { Args } from '@storybook/csf';
|
|
3
3
|
import type { StoryObj } from './types-6-0';
|
|
4
4
|
import type { ComponentStoryObj } from './types-6-3';
|
|
5
5
|
export type { StoryFn, StoryObj, Meta } from './types-6-0';
|
|
@@ -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 config: StorybookConfig['config'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "6.5.0-alpha.
|
|
3
|
+
"version": "6.5.0-alpha.48",
|
|
4
4
|
"description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -49,38 +49,48 @@
|
|
|
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.
|
|
53
|
-
"@storybook/
|
|
54
|
-
"@storybook/core
|
|
52
|
+
"@storybook/addons": "6.5.0-alpha.48",
|
|
53
|
+
"@storybook/client-logger": "6.5.0-alpha.48",
|
|
54
|
+
"@storybook/core": "6.5.0-alpha.48",
|
|
55
|
+
"@storybook/core-common": "6.5.0-alpha.48",
|
|
55
56
|
"@storybook/csf": "0.0.2--canary.87bc651.0",
|
|
56
|
-
"@storybook/
|
|
57
|
+
"@storybook/docs-tools": "6.5.0-alpha.48",
|
|
58
|
+
"@storybook/node-logger": "6.5.0-alpha.48",
|
|
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.
|
|
61
|
+
"@storybook/store": "6.5.0-alpha.48",
|
|
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",
|
|
66
72
|
"global": "^4.4.0",
|
|
73
|
+
"html-tags": "^3.1.0",
|
|
67
74
|
"lodash": "^4.17.21",
|
|
68
75
|
"prop-types": "^15.7.2",
|
|
76
|
+
"react-element-to-jsx-string": "^14.3.4",
|
|
69
77
|
"react-refresh": "^0.11.0",
|
|
70
78
|
"read-pkg-up": "^7.0.1",
|
|
71
79
|
"regenerator-runtime": "^0.13.7",
|
|
72
80
|
"ts-dedent": "^2.0.0",
|
|
81
|
+
"util-deprecate": "^1.0.2",
|
|
73
82
|
"webpack": ">=4.43.0 <6.0.0"
|
|
74
83
|
},
|
|
75
84
|
"devDependencies": {
|
|
76
|
-
"@
|
|
77
|
-
"@types/prompts": "^2.0.9",
|
|
85
|
+
"@types/util-deprecate": "^1.0.0",
|
|
78
86
|
"webpack": "4"
|
|
79
87
|
},
|
|
80
88
|
"peerDependencies": {
|
|
81
89
|
"@babel/core": "^7.11.5",
|
|
90
|
+
"jest-specific-snapshot": "^4.0.0",
|
|
82
91
|
"react": "^16.8.0 || ^17.0.0",
|
|
83
|
-
"react-dom": "^16.8.0 || ^17.0.0"
|
|
92
|
+
"react-dom": "^16.8.0 || ^17.0.0",
|
|
93
|
+
"require-from-string": "^2.0.2"
|
|
84
94
|
},
|
|
85
95
|
"peerDependenciesMeta": {
|
|
86
96
|
"@babel/core": {
|
|
@@ -108,6 +118,6 @@
|
|
|
108
118
|
"publishConfig": {
|
|
109
119
|
"access": "public"
|
|
110
120
|
},
|
|
111
|
-
"gitHead": "
|
|
121
|
+
"gitHead": "5f3afb8cf4389c16be11a6e5099e902d16a82762",
|
|
112
122
|
"sbmodern": "dist/modern/client/index.js"
|
|
113
123
|
}
|
package/types/index.ts
CHANGED