@storybook/react 7.0.0-alpha.3 → 7.0.0-alpha.6
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/docs/jsxDecorator.js +1 -1
- package/dist/cjs/docs/lib/defaultValues/createFromRawDefaultProp.js +2 -1
- package/dist/cjs/docs/lib/defaultValues/prettyIdentifier.js +2 -0
- package/dist/cjs/docs/propTypes/createType.js +7 -5
- package/dist/cjs/docs/propTypes/sortProps.js +1 -1
- package/dist/cjs/preview/render.js +1 -0
- package/dist/cjs/testing/index.js +1 -0
- package/dist/esm/docs/jsxDecorator.js +1 -1
- package/dist/esm/docs/lib/defaultValues/createFromRawDefaultProp.js +2 -1
- package/dist/esm/docs/lib/defaultValues/prettyIdentifier.js +2 -0
- package/dist/esm/docs/propTypes/createType.js +7 -5
- package/dist/esm/docs/propTypes/sortProps.js +1 -1
- package/dist/esm/preview/render.js +1 -0
- package/dist/esm/testing/index.js +1 -0
- package/dist/types/docs/extractProps.d.ts +6 -2
- package/dist/types/docs/jsxDecorator.d.ts +1 -1
- package/dist/types/docs/lib/defaultValues/createDefaultValue.d.ts +1 -1
- package/dist/types/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +2 -2
- package/dist/types/docs/propTypes/createType.d.ts +1 -1
- package/dist/types/preview/render.d.ts +1 -1
- package/package.json +7 -8
|
@@ -25,9 +25,11 @@ function getPrettyIdentifier(inferredType) {
|
|
|
25
25
|
|
|
26
26
|
switch (type) {
|
|
27
27
|
case _inspection.InspectionType.FUNCTION:
|
|
28
|
+
// @ts-ignore
|
|
28
29
|
return getPrettyFuncIdentifier(identifier, inferredType.hasParams);
|
|
29
30
|
|
|
30
31
|
case _inspection.InspectionType.ELEMENT:
|
|
32
|
+
// @ts-ignore
|
|
31
33
|
return getPrettyElementIdentifier(identifier);
|
|
32
34
|
|
|
33
35
|
default:
|
|
@@ -177,8 +177,10 @@ function generateFunc(extractedProp) {
|
|
|
177
177
|
if (jsDocTags.params != null || jsDocTags.returns != null) {
|
|
178
178
|
return createTypeDef({
|
|
179
179
|
name: PropTypesType.FUNC,
|
|
180
|
+
// @ts-ignore
|
|
180
181
|
short: (0, _generateFuncSignature.generateShortFuncSignature)(jsDocTags.params, jsDocTags.returns),
|
|
181
182
|
compact: null,
|
|
183
|
+
// @ts-ignore
|
|
182
184
|
full: (0, _generateFuncSignature.generateFuncSignature)(jsDocTags.params, jsDocTags.returns)
|
|
183
185
|
});
|
|
184
186
|
}
|
|
@@ -222,7 +224,7 @@ function generateObjectOf(type, extractedProp) {
|
|
|
222
224
|
name: PropTypesType.OBJECTOF,
|
|
223
225
|
short: objectOf(short),
|
|
224
226
|
compact: compact != null ? objectOf(compact) : null,
|
|
225
|
-
full: objectOf(full)
|
|
227
|
+
full: full ? objectOf(full) : full
|
|
226
228
|
});
|
|
227
229
|
}
|
|
228
230
|
|
|
@@ -314,7 +316,7 @@ function createArrayOfObjectTypeDef(short, compact, full) {
|
|
|
314
316
|
name: PropTypesType.ARRAYOF,
|
|
315
317
|
short: braceAfter(short),
|
|
316
318
|
compact: compact != null ? braceAround(compact) : null,
|
|
317
|
-
full: braceAround(full)
|
|
319
|
+
full: full ? braceAround(full) : full
|
|
318
320
|
});
|
|
319
321
|
}
|
|
320
322
|
|
|
@@ -423,7 +425,7 @@ function createType(extractedProp) {
|
|
|
423
425
|
}
|
|
424
426
|
}
|
|
425
427
|
|
|
426
|
-
return (0, _docsTools.createSummaryValue)(short, full);
|
|
428
|
+
return full ? (0, _docsTools.createSummaryValue)(short, full) : (0, _docsTools.createSummaryValue)(short);
|
|
427
429
|
}
|
|
428
430
|
|
|
429
431
|
case PropTypesType.FUNC:
|
|
@@ -435,9 +437,9 @@ function createType(extractedProp) {
|
|
|
435
437
|
let summary = short;
|
|
436
438
|
let detail;
|
|
437
439
|
|
|
438
|
-
if (full.length < MAX_FUNC_LENGTH) {
|
|
440
|
+
if (full && full.length < MAX_FUNC_LENGTH) {
|
|
439
441
|
summary = full;
|
|
440
|
-
} else {
|
|
442
|
+
} else if (full) {
|
|
441
443
|
detail = (0, _generateFuncSignature.toMultilineSignature)(full);
|
|
442
444
|
}
|
|
443
445
|
|
|
@@ -14,7 +14,7 @@ function keepOriginalDefinitionOrder(extractedProps, component) {
|
|
|
14
14
|
} = component;
|
|
15
15
|
|
|
16
16
|
if (propTypes != null) {
|
|
17
|
-
return Object.keys(propTypes).map(x => extractedProps.find(y => y.name === x)).filter(
|
|
17
|
+
return Object.keys(propTypes).map(x => extractedProps.find(y => y.name === x)).filter(Boolean);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
return extractedProps;
|
|
@@ -107,6 +107,7 @@ function composeStory(story, componentAnnotations, projectAnnotations, exportsNa
|
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
function composeStories(csfExports, projectAnnotations) {
|
|
110
|
+
// @ts-ignore
|
|
110
111
|
const composedStories = (0, _store.composeStories)(csfExports, projectAnnotations, composeStory);
|
|
111
112
|
return composedStories;
|
|
112
113
|
}
|
|
@@ -13,9 +13,11 @@ export function getPrettyIdentifier(inferredType) {
|
|
|
13
13
|
|
|
14
14
|
switch (type) {
|
|
15
15
|
case InspectionType.FUNCTION:
|
|
16
|
+
// @ts-ignore
|
|
16
17
|
return getPrettyFuncIdentifier(identifier, inferredType.hasParams);
|
|
17
18
|
|
|
18
19
|
case InspectionType.ELEMENT:
|
|
20
|
+
// @ts-ignore
|
|
19
21
|
return getPrettyElementIdentifier(identifier);
|
|
20
22
|
|
|
21
23
|
default:
|
|
@@ -166,8 +166,10 @@ function generateFunc(extractedProp) {
|
|
|
166
166
|
if (jsDocTags.params != null || jsDocTags.returns != null) {
|
|
167
167
|
return createTypeDef({
|
|
168
168
|
name: PropTypesType.FUNC,
|
|
169
|
+
// @ts-ignore
|
|
169
170
|
short: generateShortFuncSignature(jsDocTags.params, jsDocTags.returns),
|
|
170
171
|
compact: null,
|
|
172
|
+
// @ts-ignore
|
|
171
173
|
full: generateFuncSignature(jsDocTags.params, jsDocTags.returns)
|
|
172
174
|
});
|
|
173
175
|
}
|
|
@@ -211,7 +213,7 @@ function generateObjectOf(type, extractedProp) {
|
|
|
211
213
|
name: PropTypesType.OBJECTOF,
|
|
212
214
|
short: objectOf(short),
|
|
213
215
|
compact: compact != null ? objectOf(compact) : null,
|
|
214
|
-
full: objectOf(full)
|
|
216
|
+
full: full ? objectOf(full) : full
|
|
215
217
|
});
|
|
216
218
|
}
|
|
217
219
|
|
|
@@ -303,7 +305,7 @@ function createArrayOfObjectTypeDef(short, compact, full) {
|
|
|
303
305
|
name: PropTypesType.ARRAYOF,
|
|
304
306
|
short: braceAfter(short),
|
|
305
307
|
compact: compact != null ? braceAround(compact) : null,
|
|
306
|
-
full: braceAround(full)
|
|
308
|
+
full: full ? braceAround(full) : full
|
|
307
309
|
});
|
|
308
310
|
}
|
|
309
311
|
|
|
@@ -412,7 +414,7 @@ export function createType(extractedProp) {
|
|
|
412
414
|
}
|
|
413
415
|
}
|
|
414
416
|
|
|
415
|
-
return createSummaryValue(short, full);
|
|
417
|
+
return full ? createSummaryValue(short, full) : createSummaryValue(short);
|
|
416
418
|
}
|
|
417
419
|
|
|
418
420
|
case PropTypesType.FUNC:
|
|
@@ -424,9 +426,9 @@ export function createType(extractedProp) {
|
|
|
424
426
|
let summary = short;
|
|
425
427
|
let detail;
|
|
426
428
|
|
|
427
|
-
if (full.length < MAX_FUNC_LENGTH) {
|
|
429
|
+
if (full && full.length < MAX_FUNC_LENGTH) {
|
|
428
430
|
summary = full;
|
|
429
|
-
} else {
|
|
431
|
+
} else if (full) {
|
|
430
432
|
detail = toMultilineSignature(full);
|
|
431
433
|
}
|
|
432
434
|
|
|
@@ -7,7 +7,7 @@ export function keepOriginalDefinitionOrder(extractedProps, component) {
|
|
|
7
7
|
} = component;
|
|
8
8
|
|
|
9
9
|
if (propTypes != null) {
|
|
10
|
-
return Object.keys(propTypes).map(x => extractedProps.find(y => y.name === x)).filter(
|
|
10
|
+
return Object.keys(propTypes).map(x => extractedProps.find(y => y.name === x)).filter(Boolean);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
return extractedProps;
|
|
@@ -91,6 +91,7 @@ export function composeStory(story, componentAnnotations, projectAnnotations, ex
|
|
|
91
91
|
*/
|
|
92
92
|
|
|
93
93
|
export function composeStories(csfExports, projectAnnotations) {
|
|
94
|
+
// @ts-ignore
|
|
94
95
|
const composedStories = originalComposeStories(csfExports, projectAnnotations, composeStory);
|
|
95
96
|
return composedStories;
|
|
96
97
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { PropDef
|
|
1
|
+
import { PropDef } from '@storybook/docs-tools';
|
|
2
|
+
declare type Component = any;
|
|
2
3
|
export interface PropDefMap {
|
|
3
4
|
[p: string]: PropDef;
|
|
4
5
|
}
|
|
5
|
-
export declare const extractProps:
|
|
6
|
+
export declare const extractProps: (component: Component) => {
|
|
7
|
+
rows: PropDef[];
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -17,7 +17,7 @@ declare type JSXOptions = Options & {
|
|
|
17
17
|
transformSource?(dom: string, context?: StoryContext<ReactFramework>): string;
|
|
18
18
|
};
|
|
19
19
|
/** Apply the users parameters and render the jsx for a story */
|
|
20
|
-
export declare const renderJsx: (code: React.ReactElement, options: JSXOptions) => string;
|
|
20
|
+
export declare const renderJsx: (code: React.ReactElement, options: JSXOptions) => string | null;
|
|
21
21
|
export declare const skipJsxRender: (context: StoryContext<ReactFramework>) => any;
|
|
22
22
|
export declare const jsxDecorator: (storyFn: PartialStoryFn<ReactFramework>, context: StoryContext<ReactFramework>) => import("../preview/types").StoryFnReactReturnType;
|
|
23
23
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PropDefaultValue } from '@storybook/docs-tools';
|
|
2
|
-
export declare function createDefaultValue(defaultValue: string): PropDefaultValue;
|
|
2
|
+
export declare function createDefaultValue(defaultValue: string): PropDefaultValue | null;
|
|
@@ -6,6 +6,6 @@ export interface TypeResolvers {
|
|
|
6
6
|
function: TypeResolver;
|
|
7
7
|
default: TypeResolver;
|
|
8
8
|
}
|
|
9
|
-
export declare function extractFunctionName(func: Function, propName: string): string;
|
|
9
|
+
export declare function extractFunctionName(func: Function, propName: string): string | null;
|
|
10
10
|
export declare function createTypeResolvers(customResolvers?: Partial<TypeResolvers>): TypeResolvers;
|
|
11
|
-
export declare function createDefaultValueFromRawDefaultProp(rawDefaultProp: any, propDef: PropDef, typeResolvers?: TypeResolvers): PropDefaultValue;
|
|
11
|
+
export declare function createDefaultValueFromRawDefaultProp(rawDefaultProp: any, propDef: PropDef, typeResolvers?: TypeResolvers): PropDefaultValue | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ExtractedProp, PropType } from '@storybook/docs-tools';
|
|
2
|
-
export declare function createType(extractedProp: ExtractedProp): PropType;
|
|
2
|
+
export declare function createType(extractedProp: ExtractedProp): PropType | null;
|
|
@@ -2,4 +2,4 @@ import type { RenderContext } from '@storybook/store';
|
|
|
2
2
|
import { ArgsStoryFn } from '@storybook/csf';
|
|
3
3
|
import { ReactFramework } from './types-6-0';
|
|
4
4
|
export declare const render: ArgsStoryFn<ReactFramework>;
|
|
5
|
-
export declare function renderToDOM({ storyContext, unboundStoryFn, showMain, showException, forceRemount, }: RenderContext<ReactFramework>, domElement:
|
|
5
|
+
export declare function renderToDOM({ storyContext, unboundStoryFn, showMain, showException, forceRemount, }: RenderContext<ReactFramework>, domElement: Element): Promise<() => void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.6",
|
|
4
4
|
"description": "Storybook React renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"prepare": "node ../../scripts/prepare.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@storybook/addons": "7.0.0-alpha.
|
|
37
|
-
"@storybook/client-logger": "7.0.0-alpha.
|
|
38
|
-
"@storybook/core-client": "7.0.0-alpha.
|
|
36
|
+
"@storybook/addons": "7.0.0-alpha.6",
|
|
37
|
+
"@storybook/client-logger": "7.0.0-alpha.6",
|
|
38
|
+
"@storybook/core-client": "7.0.0-alpha.6",
|
|
39
39
|
"@storybook/csf": "0.0.2--canary.4566f4d.1",
|
|
40
|
-
"@storybook/docs-tools": "7.0.0-alpha.
|
|
41
|
-
"@storybook/store": "7.0.0-alpha.
|
|
40
|
+
"@storybook/docs-tools": "7.0.0-alpha.6",
|
|
41
|
+
"@storybook/store": "7.0.0-alpha.6",
|
|
42
42
|
"@types/estree": "^0.0.51",
|
|
43
43
|
"@types/node": "^14.14.20 || ^16.0.0",
|
|
44
44
|
"acorn": "^7.4.1",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"prop-types": "^15.7.2",
|
|
53
53
|
"react-element-to-jsx-string": "^14.3.4",
|
|
54
|
-
"regenerator-runtime": "^0.13.7",
|
|
55
54
|
"ts-dedent": "^2.0.0",
|
|
56
55
|
"util-deprecate": "^1.0.2"
|
|
57
56
|
},
|
|
@@ -76,5 +75,5 @@
|
|
|
76
75
|
"publishConfig": {
|
|
77
76
|
"access": "public"
|
|
78
77
|
},
|
|
79
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "a88dcca40ba169a373bad33dd76e9a4bd4f1f5ec"
|
|
80
79
|
}
|