@storybook/react 6.5.9 → 7.0.0-alpha.2
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/README.md +1 -47
- package/dist/cjs/config.js +43 -0
- package/dist/cjs/{client/docs → docs}/config.js +3 -7
- package/dist/cjs/docs/extractArgTypes.js +47 -0
- package/dist/cjs/{client/docs → docs}/extractProps.js +9 -29
- package/dist/cjs/docs/jsxDecorator.js +210 -0
- package/dist/cjs/{client/docs → docs}/lib/captions.js +6 -6
- package/dist/cjs/docs/lib/componentTypes.js +14 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/createDefaultValue.js +16 -11
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/createFromRawDefaultProp.js +38 -58
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/generateArray.js +8 -6
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/generateObject.js +8 -6
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/index.js +2 -8
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/prettyIdentifier.js +12 -10
- package/dist/cjs/{client/docs → docs}/lib/generateCode.js +10 -25
- package/dist/cjs/{client/docs → docs}/lib/index.js +4 -10
- package/dist/cjs/{client/docs → docs}/lib/inspection/acornParser.js +34 -58
- package/dist/cjs/{client/docs → docs}/lib/inspection/index.js +2 -8
- package/dist/cjs/{client/docs → docs}/lib/inspection/inspectValue.js +1 -3
- package/dist/cjs/{client/docs → docs}/lib/inspection/types.js +1 -1
- package/dist/cjs/{client/docs → docs}/lib/isHtmlTag.js +0 -4
- package/dist/cjs/{client/docs → docs}/propTypes/createType.js +102 -115
- package/dist/cjs/{client/docs → docs}/propTypes/generateFuncSignature.js +13 -23
- package/dist/cjs/{client/docs → docs}/propTypes/handleProp.js +13 -15
- package/dist/cjs/{client/docs → docs}/propTypes/rawDefaultPropResolvers.js +10 -14
- package/dist/cjs/docs/propTypes/sortProps.js +21 -0
- package/dist/cjs/docs/react-argtypes.stories.js +67 -0
- package/dist/cjs/{client/docs → docs}/typeScript/handleProp.js +11 -11
- package/dist/cjs/{client/index.js → index.js} +14 -19
- package/dist/cjs/{client/preview → preview}/config.js +3 -9
- package/dist/cjs/{client/preview → preview}/globals.js +3 -1
- package/dist/cjs/preview/index.js +44 -0
- package/dist/cjs/preview/render.js +165 -0
- package/dist/cjs/{client/preview → preview}/types-6-0.js +0 -0
- package/dist/cjs/{client/preview → preview}/types-6-3.js +1 -7
- package/dist/cjs/{client/preview → preview}/types-7-0.js +0 -0
- package/dist/cjs/{client/preview → preview}/types.js +0 -0
- package/dist/cjs/{client/testing → testing}/index.js +3 -3
- package/dist/esm/config.js +6 -0
- package/dist/{modern/client → esm}/docs/config.js +0 -2
- package/dist/{modern/client → esm}/docs/extractArgTypes.js +0 -1
- package/dist/{modern/client → esm}/docs/extractProps.js +0 -0
- package/dist/{modern/client → esm}/docs/jsxDecorator.js +11 -18
- package/dist/{modern/client → esm}/docs/lib/captions.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/componentTypes.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/createDefaultValue.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/createFromRawDefaultProp.js +1 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/generateArray.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/generateObject.js +0 -0
- package/dist/esm/{client/docs → docs}/lib/defaultValues/index.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/prettyIdentifier.js +6 -6
- package/dist/{modern/client → esm}/docs/lib/generateCode.js +0 -0
- package/dist/esm/{client/docs → docs}/lib/index.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/inspection/acornParser.js +0 -0
- package/dist/esm/{client/docs → docs}/lib/inspection/index.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/inspection/inspectValue.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/inspection/types.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/isHtmlTag.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/createType.js +0 -1
- package/dist/{modern/client → esm}/docs/propTypes/generateFuncSignature.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/handleProp.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/rawDefaultPropResolvers.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/sortProps.js +0 -0
- package/dist/{modern/client → esm}/docs/react-argtypes.stories.js +0 -0
- package/dist/{modern/client → esm}/docs/typeScript/handleProp.js +0 -0
- package/dist/{modern/client → esm}/index.js +2 -4
- package/dist/esm/preview/config.js +1 -0
- package/dist/{modern/client → esm}/preview/globals.js +0 -0
- package/dist/{modern/client → esm}/preview/index.js +1 -1
- package/dist/{modern/client → esm}/preview/render.js +2 -2
- package/dist/esm/{client/preview → preview}/types-6-0.js +0 -0
- package/dist/esm/{client/preview → preview}/types-6-3.js +0 -0
- package/dist/esm/{client/preview → preview}/types-7-0.js +0 -0
- package/dist/esm/{client/preview → preview}/types.js +0 -0
- package/dist/{modern/client → esm}/testing/index.js +0 -0
- package/dist/types/config.d.ts +10 -0
- package/dist/types/docs/config.d.ts +10 -0
- package/dist/{ts3.9/client → types}/docs/extractArgTypes.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/extractProps.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/jsxDecorator.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/captions.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/componentTypes.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/createDefaultValue.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/generateArray.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/generateObject.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/prettyIdentifier.d.ts +1 -1
- package/dist/{ts3.9/client → types}/docs/lib/generateCode.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/acornParser.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/inspectValue.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/types.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/isHtmlTag.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/createType.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/generateFuncSignature.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/handleProp.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/rawDefaultPropResolvers.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/sortProps.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/react-argtypes.stories.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/typeScript/handleProp.d.ts +0 -0
- package/dist/{ts3.9/client → types}/index.d.ts +0 -0
- package/dist/types/preview/config.d.ts +1 -0
- package/dist/{ts3.9/client → types}/preview/globals.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/render.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types-6-0.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types-6-3.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types-7-0.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types.d.ts +0 -0
- package/dist/{ts3.9/client → types}/testing/index.d.ts +1 -1
- package/package.json +17 -61
- package/preview.js +1 -0
- package/bin/build.js +0 -4
- package/bin/index.js +0 -3
- package/demo.d.ts +0 -32
- package/demo.js +0 -5
- package/dist/cjs/client/docs/extractArgTypes.js +0 -54
- package/dist/cjs/client/docs/jsxDecorator.js +0 -277
- package/dist/cjs/client/docs/lib/componentTypes.js +0 -24
- package/dist/cjs/client/docs/propTypes/sortProps.js +0 -37
- package/dist/cjs/client/docs/react-argtypes.stories.js +0 -129
- package/dist/cjs/client/preview/index.js +0 -52
- package/dist/cjs/client/preview/render.js +0 -296
- package/dist/cjs/demo/Button.js +0 -37
- package/dist/cjs/demo/Welcome.js +0 -126
- package/dist/cjs/server/build.js +0 -9
- package/dist/cjs/server/cra-config.js +0 -69
- package/dist/cjs/server/framework-preset-cra.js +0 -35
- package/dist/cjs/server/framework-preset-react-docs.js +0 -68
- package/dist/cjs/server/framework-preset-react-dom-hack.js +0 -31
- package/dist/cjs/server/framework-preset-react.js +0 -98
- package/dist/cjs/server/index.js +0 -9
- package/dist/cjs/server/options.js +0 -17
- package/dist/cjs/server/preset.js +0 -16
- package/dist/esm/client/docs/config.js +0 -16
- package/dist/esm/client/docs/extractArgTypes.js +0 -39
- package/dist/esm/client/docs/extractProps.js +0 -54
- package/dist/esm/client/docs/jsxDecorator.js +0 -218
- package/dist/esm/client/docs/lib/captions.js +0 -6
- package/dist/esm/client/docs/lib/componentTypes.js +0 -9
- package/dist/esm/client/docs/lib/defaultValues/createDefaultValue.js +0 -67
- package/dist/esm/client/docs/lib/defaultValues/createFromRawDefaultProp.js +0 -191
- package/dist/esm/client/docs/lib/defaultValues/generateArray.js +0 -19
- package/dist/esm/client/docs/lib/defaultValues/generateObject.js +0 -19
- package/dist/esm/client/docs/lib/defaultValues/prettyIdentifier.js +0 -22
- package/dist/esm/client/docs/lib/generateCode.js +0 -68
- package/dist/esm/client/docs/lib/inspection/acornParser.js +0 -213
- package/dist/esm/client/docs/lib/inspection/inspectValue.js +0 -16
- package/dist/esm/client/docs/lib/inspection/types.js +0 -12
- package/dist/esm/client/docs/lib/isHtmlTag.js +0 -6
- package/dist/esm/client/docs/propTypes/createType.js +0 -449
- package/dist/esm/client/docs/propTypes/generateFuncSignature.js +0 -62
- package/dist/esm/client/docs/propTypes/handleProp.js +0 -39
- package/dist/esm/client/docs/propTypes/rawDefaultPropResolvers.js +0 -32
- package/dist/esm/client/docs/propTypes/sortProps.js +0 -24
- package/dist/esm/client/docs/react-argtypes.stories.js +0 -97
- package/dist/esm/client/docs/typeScript/handleProp.js +0 -27
- package/dist/esm/client/index.js +0 -7
- package/dist/esm/client/preview/config.js +0 -4
- package/dist/esm/client/preview/globals.js +0 -6
- package/dist/esm/client/preview/index.js +0 -29
- package/dist/esm/client/preview/render.js +0 -255
- package/dist/esm/client/testing/index.js +0 -96
- package/dist/esm/demo/Button.js +0 -26
- package/dist/esm/demo/Welcome.js +0 -114
- package/dist/esm/server/build.js +0 -3
- package/dist/esm/server/cra-config.js +0 -49
- package/dist/esm/server/framework-preset-cra.js +0 -25
- package/dist/esm/server/framework-preset-react-docs.js +0 -49
- package/dist/esm/server/framework-preset-react-dom-hack.js +0 -21
- package/dist/esm/server/framework-preset-react.js +0 -78
- package/dist/esm/server/index.js +0 -3
- package/dist/esm/server/options.js +0 -8
- package/dist/esm/server/preset.js +0 -5
- package/dist/modern/client/docs/lib/defaultValues/index.js +0 -2
- package/dist/modern/client/docs/lib/index.js +0 -4
- package/dist/modern/client/docs/lib/inspection/index.js +0 -2
- package/dist/modern/client/preview/config.js +0 -4
- package/dist/modern/client/preview/types-6-0.js +0 -1
- package/dist/modern/client/preview/types-6-3.js +0 -10
- package/dist/modern/client/preview/types-7-0.js +0 -1
- package/dist/modern/client/preview/types.js +0 -1
- package/dist/modern/demo/Button.js +0 -25
- package/dist/modern/demo/Welcome.js +0 -108
- package/dist/modern/server/build.js +0 -3
- package/dist/modern/server/cra-config.js +0 -49
- package/dist/modern/server/framework-preset-cra.js +0 -25
- package/dist/modern/server/framework-preset-react-docs.js +0 -49
- package/dist/modern/server/framework-preset-react-dom-hack.js +0 -21
- package/dist/modern/server/framework-preset-react.js +0 -78
- package/dist/modern/server/index.js +0 -3
- package/dist/modern/server/options.js +0 -8
- package/dist/modern/server/preset.js +0 -5
- package/dist/ts3.4/client/docs/config.d.ts +0 -13
- package/dist/ts3.4/client/docs/extractArgTypes.d.ts +0 -2
- package/dist/ts3.4/client/docs/extractProps.d.ts +0 -5
- package/dist/ts3.4/client/docs/jsxDecorator.d.ts +0 -23
- package/dist/ts3.4/client/docs/lib/captions.d.ts +0 -6
- package/dist/ts3.4/client/docs/lib/componentTypes.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/defaultValues/createDefaultValue.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +0 -11
- package/dist/ts3.4/client/docs/lib/defaultValues/generateArray.d.ts +0 -3
- package/dist/ts3.4/client/docs/lib/defaultValues/generateObject.d.ts +0 -3
- package/dist/ts3.4/client/docs/lib/defaultValues/index.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/defaultValues/prettyIdentifier.d.ts +0 -4
- package/dist/ts3.4/client/docs/lib/generateCode.d.ts +0 -3
- package/dist/ts3.4/client/docs/lib/index.d.ts +0 -4
- package/dist/ts3.4/client/docs/lib/inspection/acornParser.d.ts +0 -7
- package/dist/ts3.4/client/docs/lib/inspection/index.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/inspection/inspectValue.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/inspection/types.d.ts +0 -50
- package/dist/ts3.4/client/docs/lib/isHtmlTag.d.ts +0 -1
- package/dist/ts3.4/client/docs/propTypes/createType.d.ts +0 -2
- package/dist/ts3.4/client/docs/propTypes/generateFuncSignature.d.ts +0 -4
- package/dist/ts3.4/client/docs/propTypes/handleProp.d.ts +0 -5
- package/dist/ts3.4/client/docs/propTypes/rawDefaultPropResolvers.d.ts +0 -1
- package/dist/ts3.4/client/docs/propTypes/sortProps.d.ts +0 -4
- package/dist/ts3.4/client/docs/react-argtypes.stories.d.ts +0 -1
- package/dist/ts3.4/client/docs/typeScript/handleProp.d.ts +0 -3
- package/dist/ts3.4/client/index.d.ts +0 -4
- package/dist/ts3.4/client/preview/config.d.ts +0 -4
- package/dist/ts3.4/client/preview/globals.d.ts +0 -1
- package/dist/ts3.4/client/preview/index.d.ts +0 -25
- package/dist/ts3.4/client/preview/render.d.ts +0 -5
- package/dist/ts3.4/client/preview/types-6-0.d.ts +0 -35
- package/dist/ts3.4/client/preview/types-6-3.d.ts +0 -40
- package/dist/ts3.4/client/preview/types-7-0.d.ts +0 -21
- package/dist/ts3.4/client/preview/types.d.ts +0 -16
- package/dist/ts3.4/client/testing/index.d.ts +0 -84
- package/dist/ts3.4/demo/Button.d.ts +0 -4
- package/dist/ts3.4/demo/Welcome.d.ts +0 -6
- package/dist/ts3.4/server/build.d.ts +0 -1
- package/dist/ts3.4/server/cra-config.d.ts +0 -4
- package/dist/ts3.4/server/framework-preset-cra.d.ts +0 -3
- package/dist/ts3.4/server/framework-preset-react-docs.d.ts +0 -6
- package/dist/ts3.4/server/framework-preset-react-dom-hack.d.ts +0 -32
- package/dist/ts3.4/server/framework-preset-react.d.ts +0 -6
- package/dist/ts3.4/server/index.d.ts +0 -1
- package/dist/ts3.4/server/options.d.ts +0 -3
- package/dist/ts3.4/server/preset.d.ts +0 -3
- package/dist/ts3.9/client/docs/config.d.ts +0 -13
- package/dist/ts3.9/client/preview/config.d.ts +0 -4
- package/dist/ts3.9/demo/Button.d.ts +0 -4
- package/dist/ts3.9/demo/Welcome.d.ts +0 -6
- package/dist/ts3.9/server/build.d.ts +0 -1
- package/dist/ts3.9/server/cra-config.d.ts +0 -4
- package/dist/ts3.9/server/framework-preset-cra.d.ts +0 -3
- package/dist/ts3.9/server/framework-preset-react-docs.d.ts +0 -6
- package/dist/ts3.9/server/framework-preset-react-dom-hack.d.ts +0 -32
- package/dist/ts3.9/server/framework-preset-react.d.ts +0 -6
- package/dist/ts3.9/server/index.d.ts +0 -1
- package/dist/ts3.9/server/options.d.ts +0 -3
- package/dist/ts3.9/server/preset.d.ts +0 -3
- package/preset.js +0 -1
- package/standalone.js +0 -8
- package/types/index.ts +0 -19
- package/types-6-0.d.ts +0 -1
- package/types-7-0.d.ts +0 -1
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.to-string.js");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.object.keys.js");
|
|
8
|
-
|
|
9
3
|
Object.defineProperty(exports, "__esModule", {
|
|
10
4
|
value: true
|
|
11
5
|
});
|
|
@@ -17,7 +11,7 @@ Object.keys(_types).forEach(function (key) {
|
|
|
17
11
|
if (key in exports && exports[key] === _types[key]) return;
|
|
18
12
|
Object.defineProperty(exports, key, {
|
|
19
13
|
enumerable: true,
|
|
20
|
-
get: function
|
|
14
|
+
get: function () {
|
|
21
15
|
return _types[key];
|
|
22
16
|
}
|
|
23
17
|
});
|
|
@@ -30,7 +24,7 @@ Object.keys(_inspectValue).forEach(function (key) {
|
|
|
30
24
|
if (key in exports && exports[key] === _inspectValue[key]) return;
|
|
31
25
|
Object.defineProperty(exports, key, {
|
|
32
26
|
enumerable: true,
|
|
33
|
-
get: function
|
|
27
|
+
get: function () {
|
|
34
28
|
return _inspectValue[key];
|
|
35
29
|
}
|
|
36
30
|
});
|
|
@@ -5,15 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.inspectValue = inspectValue;
|
|
7
7
|
|
|
8
|
-
require("core-js/modules/es.object.assign.js");
|
|
9
|
-
|
|
10
8
|
var _acornParser = require("./acornParser");
|
|
11
9
|
|
|
12
10
|
var _types = require("./types");
|
|
13
11
|
|
|
14
12
|
function inspectValue(value) {
|
|
15
13
|
try {
|
|
16
|
-
|
|
14
|
+
const parsingResult = (0, _acornParser.parse)(value);
|
|
17
15
|
return Object.assign({}, parsingResult);
|
|
18
16
|
} catch (e) {// do nothing.
|
|
19
17
|
}
|
|
@@ -5,10 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.isHtmlTag = isHtmlTag;
|
|
7
7
|
|
|
8
|
-
require("core-js/modules/es.array.includes.js");
|
|
9
|
-
|
|
10
|
-
require("core-js/modules/es.string.includes.js");
|
|
11
|
-
|
|
12
8
|
var _htmlTags = _interopRequireDefault(require("html-tags"));
|
|
13
9
|
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -5,24 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createType = createType;
|
|
7
7
|
|
|
8
|
-
require("core-js/modules/es.function.name.js");
|
|
9
|
-
|
|
10
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
11
|
-
|
|
12
|
-
require("core-js/modules/es.string.replace.js");
|
|
13
|
-
|
|
14
|
-
require("core-js/modules/es.string.split.js");
|
|
15
|
-
|
|
16
|
-
require("core-js/modules/es.array.join.js");
|
|
17
|
-
|
|
18
|
-
require("core-js/modules/es.array.map.js");
|
|
19
|
-
|
|
20
|
-
require("core-js/modules/es.object.keys.js");
|
|
21
|
-
|
|
22
|
-
require("core-js/modules/es.array.concat.js");
|
|
23
|
-
|
|
24
|
-
require("core-js/modules/es.object.to-string.js");
|
|
25
|
-
|
|
26
8
|
var _docsTools = require("@storybook/docs-tools");
|
|
27
9
|
|
|
28
10
|
var _generateFuncSignature = require("./generateFuncSignature");
|
|
@@ -31,7 +13,7 @@ var _lib = require("../lib");
|
|
|
31
13
|
|
|
32
14
|
var _inspection = require("../lib/inspection");
|
|
33
15
|
|
|
34
|
-
|
|
16
|
+
const MAX_FUNC_LENGTH = 150;
|
|
35
17
|
var PropTypesType;
|
|
36
18
|
|
|
37
19
|
(function (PropTypesType) {
|
|
@@ -50,18 +32,19 @@ var PropTypesType;
|
|
|
50
32
|
PropTypesType["NODE"] = "node";
|
|
51
33
|
})(PropTypesType || (PropTypesType = {}));
|
|
52
34
|
|
|
53
|
-
function createTypeDef(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
function createTypeDef({
|
|
36
|
+
name,
|
|
37
|
+
short,
|
|
38
|
+
compact,
|
|
39
|
+
full,
|
|
40
|
+
inferredType
|
|
41
|
+
}) {
|
|
59
42
|
return {
|
|
60
|
-
name
|
|
61
|
-
short
|
|
62
|
-
compact
|
|
43
|
+
name,
|
|
44
|
+
short,
|
|
45
|
+
compact,
|
|
63
46
|
full: full != null ? full : short,
|
|
64
|
-
inferredType
|
|
47
|
+
inferredType
|
|
65
48
|
};
|
|
66
49
|
}
|
|
67
50
|
|
|
@@ -73,13 +56,11 @@ function splitIntoLines(value) {
|
|
|
73
56
|
return value.split(/\r?\n/);
|
|
74
57
|
}
|
|
75
58
|
|
|
76
|
-
function prettyObject(ast) {
|
|
77
|
-
var compact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
59
|
+
function prettyObject(ast, compact = false) {
|
|
78
60
|
return cleanPropTypes((0, _lib.generateObjectCode)(ast, compact));
|
|
79
61
|
}
|
|
80
62
|
|
|
81
|
-
function prettyArray(ast) {
|
|
82
|
-
var compact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
63
|
+
function prettyArray(ast, compact = false) {
|
|
83
64
|
return cleanPropTypes((0, _lib.generateCode)(ast, compact));
|
|
84
65
|
}
|
|
85
66
|
|
|
@@ -106,14 +87,16 @@ function getCaptionForInspectionType(type) {
|
|
|
106
87
|
}
|
|
107
88
|
|
|
108
89
|
function generateTypeFromString(value, originalTypeName) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
90
|
+
const {
|
|
91
|
+
inferredType,
|
|
92
|
+
ast
|
|
93
|
+
} = (0, _inspection.inspectValue)(value);
|
|
94
|
+
const {
|
|
95
|
+
type
|
|
96
|
+
} = inferredType;
|
|
97
|
+
let short;
|
|
98
|
+
let compact;
|
|
99
|
+
let full;
|
|
117
100
|
|
|
118
101
|
switch (type) {
|
|
119
102
|
case _inspection.InspectionType.IDENTIFIER:
|
|
@@ -124,8 +107,9 @@ function generateTypeFromString(value, originalTypeName) {
|
|
|
124
107
|
|
|
125
108
|
case _inspection.InspectionType.OBJECT:
|
|
126
109
|
{
|
|
127
|
-
|
|
128
|
-
|
|
110
|
+
const {
|
|
111
|
+
depth
|
|
112
|
+
} = inferredType;
|
|
129
113
|
short = _lib.OBJECT_CAPTION;
|
|
130
114
|
compact = depth === 1 ? prettyObject(ast, true) : null;
|
|
131
115
|
full = prettyObject(ast);
|
|
@@ -134,8 +118,9 @@ function generateTypeFromString(value, originalTypeName) {
|
|
|
134
118
|
|
|
135
119
|
case _inspection.InspectionType.ELEMENT:
|
|
136
120
|
{
|
|
137
|
-
|
|
138
|
-
|
|
121
|
+
const {
|
|
122
|
+
identifier
|
|
123
|
+
} = inferredType;
|
|
139
124
|
short = identifier != null && !(0, _lib.isHtmlTag)(identifier) ? identifier : _lib.ELEMENT_CAPTION;
|
|
140
125
|
compact = splitIntoLines(value).length === 1 ? value : null;
|
|
141
126
|
full = value;
|
|
@@ -144,10 +129,11 @@ function generateTypeFromString(value, originalTypeName) {
|
|
|
144
129
|
|
|
145
130
|
case _inspection.InspectionType.ARRAY:
|
|
146
131
|
{
|
|
147
|
-
|
|
148
|
-
|
|
132
|
+
const {
|
|
133
|
+
depth
|
|
134
|
+
} = inferredType;
|
|
149
135
|
short = _lib.ARRAY_CAPTION;
|
|
150
|
-
compact =
|
|
136
|
+
compact = depth <= 2 ? prettyArray(ast, true) : null;
|
|
151
137
|
full = prettyArray(ast);
|
|
152
138
|
break;
|
|
153
139
|
}
|
|
@@ -161,16 +147,16 @@ function generateTypeFromString(value, originalTypeName) {
|
|
|
161
147
|
|
|
162
148
|
return createTypeDef({
|
|
163
149
|
name: originalTypeName,
|
|
164
|
-
short
|
|
165
|
-
compact
|
|
166
|
-
full
|
|
150
|
+
short,
|
|
151
|
+
compact,
|
|
152
|
+
full,
|
|
167
153
|
inferredType: type
|
|
168
154
|
});
|
|
169
155
|
}
|
|
170
156
|
|
|
171
|
-
function generateCustom(
|
|
172
|
-
|
|
173
|
-
|
|
157
|
+
function generateCustom({
|
|
158
|
+
raw
|
|
159
|
+
}) {
|
|
174
160
|
if (raw != null) {
|
|
175
161
|
return generateTypeFromString(raw, PropTypesType.CUSTOM);
|
|
176
162
|
}
|
|
@@ -183,7 +169,9 @@ function generateCustom(_ref5) {
|
|
|
183
169
|
}
|
|
184
170
|
|
|
185
171
|
function generateFunc(extractedProp) {
|
|
186
|
-
|
|
172
|
+
const {
|
|
173
|
+
jsDocTags
|
|
174
|
+
} = extractedProp;
|
|
187
175
|
|
|
188
176
|
if (jsDocTags != null) {
|
|
189
177
|
if (jsDocTags.params != null || jsDocTags.returns != null) {
|
|
@@ -204,16 +192,14 @@ function generateFunc(extractedProp) {
|
|
|
204
192
|
}
|
|
205
193
|
|
|
206
194
|
function generateShape(type, extractedProp) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
var _ref6 = inferredType,
|
|
216
|
-
depth = _ref6.depth;
|
|
195
|
+
const fields = Object.keys(type.value).map(key => `${key}: ${generateType(type.value[key], extractedProp).full}`).join(', ');
|
|
196
|
+
const {
|
|
197
|
+
inferredType,
|
|
198
|
+
ast
|
|
199
|
+
} = (0, _inspection.inspectValue)(`{ ${fields} }`);
|
|
200
|
+
const {
|
|
201
|
+
depth
|
|
202
|
+
} = inferredType;
|
|
217
203
|
return createTypeDef({
|
|
218
204
|
name: PropTypesType.SHAPE,
|
|
219
205
|
short: _lib.OBJECT_CAPTION,
|
|
@@ -223,15 +209,15 @@ function generateShape(type, extractedProp) {
|
|
|
223
209
|
}
|
|
224
210
|
|
|
225
211
|
function objectOf(of) {
|
|
226
|
-
return
|
|
212
|
+
return `objectOf(${of})`;
|
|
227
213
|
}
|
|
228
214
|
|
|
229
215
|
function generateObjectOf(type, extractedProp) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
216
|
+
const {
|
|
217
|
+
short,
|
|
218
|
+
compact,
|
|
219
|
+
full
|
|
220
|
+
} = generateType(type.value, extractedProp);
|
|
235
221
|
return createTypeDef({
|
|
236
222
|
name: PropTypesType.OBJECTOF,
|
|
237
223
|
short: objectOf(short),
|
|
@@ -242,12 +228,12 @@ function generateObjectOf(type, extractedProp) {
|
|
|
242
228
|
|
|
243
229
|
function generateUnion(type, extractedProp) {
|
|
244
230
|
if (Array.isArray(type.value)) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
231
|
+
const values = type.value.reduce((acc, v) => {
|
|
232
|
+
const {
|
|
233
|
+
short,
|
|
234
|
+
compact,
|
|
235
|
+
full
|
|
236
|
+
} = generateType(v, extractedProp);
|
|
251
237
|
acc.short.push(short);
|
|
252
238
|
acc.compact.push(compact);
|
|
253
239
|
acc.full.push(full);
|
|
@@ -260,9 +246,7 @@ function generateUnion(type, extractedProp) {
|
|
|
260
246
|
return createTypeDef({
|
|
261
247
|
name: PropTypesType.UNION,
|
|
262
248
|
short: values.short.join(' | '),
|
|
263
|
-
compact: values.compact.every(
|
|
264
|
-
return x != null;
|
|
265
|
-
}) ? values.compact.join(' | ') : null,
|
|
249
|
+
compact: values.compact.every(x => x != null) ? values.compact.join(' | ') : null,
|
|
266
250
|
full: values.full.join(' | ')
|
|
267
251
|
});
|
|
268
252
|
}
|
|
@@ -274,9 +258,10 @@ function generateUnion(type, extractedProp) {
|
|
|
274
258
|
});
|
|
275
259
|
}
|
|
276
260
|
|
|
277
|
-
function generateEnumValue(
|
|
278
|
-
|
|
279
|
-
|
|
261
|
+
function generateEnumValue({
|
|
262
|
+
value,
|
|
263
|
+
computed
|
|
264
|
+
}) {
|
|
280
265
|
return computed ? generateTypeFromString(value, 'enumvalue') : createTypeDef({
|
|
281
266
|
name: 'enumvalue',
|
|
282
267
|
short: value,
|
|
@@ -286,12 +271,12 @@ function generateEnumValue(_ref7) {
|
|
|
286
271
|
|
|
287
272
|
function generateEnum(type) {
|
|
288
273
|
if (Array.isArray(type.value)) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
274
|
+
const values = type.value.reduce((acc, v) => {
|
|
275
|
+
const {
|
|
276
|
+
short,
|
|
277
|
+
compact,
|
|
278
|
+
full
|
|
279
|
+
} = generateEnumValue(v);
|
|
295
280
|
acc.short.push(short);
|
|
296
281
|
acc.compact.push(compact);
|
|
297
282
|
acc.full.push(full);
|
|
@@ -304,9 +289,7 @@ function generateEnum(type) {
|
|
|
304
289
|
return createTypeDef({
|
|
305
290
|
name: PropTypesType.ENUM,
|
|
306
291
|
short: values.short.join(' | '),
|
|
307
|
-
compact: values.compact.every(
|
|
308
|
-
return x != null;
|
|
309
|
-
}) ? values.compact.join(' | ') : null,
|
|
292
|
+
compact: values.compact.every(x => x != null) ? values.compact.join(' | ') : null,
|
|
310
293
|
full: values.full.join(' | ')
|
|
311
294
|
});
|
|
312
295
|
}
|
|
@@ -319,11 +302,11 @@ function generateEnum(type) {
|
|
|
319
302
|
}
|
|
320
303
|
|
|
321
304
|
function braceAfter(of) {
|
|
322
|
-
return
|
|
305
|
+
return `${of}[]`;
|
|
323
306
|
}
|
|
324
307
|
|
|
325
308
|
function braceAround(of) {
|
|
326
|
-
return
|
|
309
|
+
return `[${of}]`;
|
|
327
310
|
}
|
|
328
311
|
|
|
329
312
|
function createArrayOfObjectTypeDef(short, compact, full) {
|
|
@@ -336,12 +319,13 @@ function createArrayOfObjectTypeDef(short, compact, full) {
|
|
|
336
319
|
}
|
|
337
320
|
|
|
338
321
|
function generateArray(type, extractedProp) {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
322
|
+
const {
|
|
323
|
+
name,
|
|
324
|
+
short,
|
|
325
|
+
compact,
|
|
326
|
+
full,
|
|
327
|
+
inferredType
|
|
328
|
+
} = generateType(type.value, extractedProp);
|
|
345
329
|
|
|
346
330
|
if (name === PropTypesType.CUSTOM) {
|
|
347
331
|
if (inferredType === _inspection.InspectionType.OBJECT) {
|
|
@@ -409,7 +393,9 @@ function generateType(type, extractedProp) {
|
|
|
409
393
|
}
|
|
410
394
|
|
|
411
395
|
function createType(extractedProp) {
|
|
412
|
-
|
|
396
|
+
const {
|
|
397
|
+
type
|
|
398
|
+
} = extractedProp.docgenInfo; // A type could be null if a defaultProp has been provided without a type definition.
|
|
413
399
|
|
|
414
400
|
if (type == null) {
|
|
415
401
|
return null;
|
|
@@ -425,10 +411,11 @@ function createType(extractedProp) {
|
|
|
425
411
|
case PropTypesType.ENUM:
|
|
426
412
|
case PropTypesType.ARRAYOF:
|
|
427
413
|
{
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
414
|
+
const {
|
|
415
|
+
short,
|
|
416
|
+
compact,
|
|
417
|
+
full
|
|
418
|
+
} = generateType(type, extractedProp);
|
|
432
419
|
|
|
433
420
|
if (compact != null) {
|
|
434
421
|
if (!(0, _docsTools.isTooLongForTypeSummary)(compact)) {
|
|
@@ -441,17 +428,17 @@ function createType(extractedProp) {
|
|
|
441
428
|
|
|
442
429
|
case PropTypesType.FUNC:
|
|
443
430
|
{
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
if (
|
|
452
|
-
summary =
|
|
431
|
+
const {
|
|
432
|
+
short,
|
|
433
|
+
full
|
|
434
|
+
} = generateType(type, extractedProp);
|
|
435
|
+
let summary = short;
|
|
436
|
+
let detail;
|
|
437
|
+
|
|
438
|
+
if (full.length < MAX_FUNC_LENGTH) {
|
|
439
|
+
summary = full;
|
|
453
440
|
} else {
|
|
454
|
-
detail = (0, _generateFuncSignature.toMultilineSignature)(
|
|
441
|
+
detail = (0, _generateFuncSignature.toMultilineSignature)(full);
|
|
455
442
|
}
|
|
456
443
|
|
|
457
444
|
return (0, _docsTools.createSummaryValue)(summary, detail);
|
|
@@ -7,58 +7,48 @@ exports.generateFuncSignature = generateFuncSignature;
|
|
|
7
7
|
exports.generateShortFuncSignature = generateShortFuncSignature;
|
|
8
8
|
exports.toMultilineSignature = toMultilineSignature;
|
|
9
9
|
|
|
10
|
-
require("core-js/modules/es.array.map.js");
|
|
11
|
-
|
|
12
|
-
require("core-js/modules/es.array.concat.js");
|
|
13
|
-
|
|
14
|
-
require("core-js/modules/es.array.join.js");
|
|
15
|
-
|
|
16
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
17
|
-
|
|
18
|
-
require("core-js/modules/es.string.replace.js");
|
|
19
|
-
|
|
20
10
|
function generateFuncSignature(params, returns) {
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
const hasParams = params != null;
|
|
12
|
+
const hasReturns = returns != null;
|
|
23
13
|
|
|
24
14
|
if (!hasParams && !hasReturns) {
|
|
25
15
|
return '';
|
|
26
16
|
}
|
|
27
17
|
|
|
28
|
-
|
|
18
|
+
const funcParts = [];
|
|
29
19
|
|
|
30
20
|
if (hasParams) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
const funcParams = params.map(x => {
|
|
22
|
+
const prettyName = x.getPrettyName();
|
|
23
|
+
const typeName = x.getTypeName();
|
|
34
24
|
|
|
35
25
|
if (typeName != null) {
|
|
36
|
-
return
|
|
26
|
+
return `${prettyName}: ${typeName}`;
|
|
37
27
|
}
|
|
38
28
|
|
|
39
29
|
return prettyName;
|
|
40
30
|
});
|
|
41
|
-
funcParts.push(
|
|
31
|
+
funcParts.push(`(${funcParams.join(', ')})`);
|
|
42
32
|
} else {
|
|
43
33
|
funcParts.push('()');
|
|
44
34
|
}
|
|
45
35
|
|
|
46
36
|
if (hasReturns) {
|
|
47
|
-
funcParts.push(
|
|
37
|
+
funcParts.push(`=> ${returns.getTypeName()}`);
|
|
48
38
|
}
|
|
49
39
|
|
|
50
40
|
return funcParts.join(' ');
|
|
51
41
|
}
|
|
52
42
|
|
|
53
43
|
function generateShortFuncSignature(params, returns) {
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
const hasParams = params != null;
|
|
45
|
+
const hasReturns = returns != null;
|
|
56
46
|
|
|
57
47
|
if (!hasParams && !hasReturns) {
|
|
58
48
|
return '';
|
|
59
49
|
}
|
|
60
50
|
|
|
61
|
-
|
|
51
|
+
const funcParts = [];
|
|
62
52
|
|
|
63
53
|
if (hasParams) {
|
|
64
54
|
funcParts.push('( ... )');
|
|
@@ -67,7 +57,7 @@ function generateShortFuncSignature(params, returns) {
|
|
|
67
57
|
}
|
|
68
58
|
|
|
69
59
|
if (hasReturns) {
|
|
70
|
-
funcParts.push(
|
|
60
|
+
funcParts.push(`=> ${returns.getTypeName()}`);
|
|
71
61
|
}
|
|
72
62
|
|
|
73
63
|
return funcParts.join(' ');
|
|
@@ -6,10 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.enhancePropTypesProp = enhancePropTypesProp;
|
|
7
7
|
exports.enhancePropTypesProps = enhancePropTypesProps;
|
|
8
8
|
|
|
9
|
-
require("core-js/modules/es.array.map.js");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.function.name.js");
|
|
12
|
-
|
|
13
9
|
var _createType = require("./createType");
|
|
14
10
|
|
|
15
11
|
var _defaultValues = require("../lib/defaultValues");
|
|
@@ -19,26 +15,30 @@ var _sortProps = require("./sortProps");
|
|
|
19
15
|
var _rawDefaultPropResolvers = require("./rawDefaultPropResolvers");
|
|
20
16
|
|
|
21
17
|
function enhancePropTypesProp(extractedProp, rawDefaultProp) {
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const {
|
|
19
|
+
propDef
|
|
20
|
+
} = extractedProp;
|
|
21
|
+
const newtype = (0, _createType.createType)(extractedProp);
|
|
24
22
|
|
|
25
23
|
if (newtype != null) {
|
|
26
24
|
propDef.type = newtype;
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
const {
|
|
28
|
+
defaultValue
|
|
29
|
+
} = extractedProp.docgenInfo;
|
|
30
30
|
|
|
31
31
|
if (defaultValue != null && defaultValue.value != null) {
|
|
32
|
-
|
|
32
|
+
const newDefaultValue = (0, _defaultValues.createDefaultValue)(defaultValue.value);
|
|
33
33
|
|
|
34
34
|
if (newDefaultValue != null) {
|
|
35
35
|
propDef.defaultValue = newDefaultValue;
|
|
36
36
|
}
|
|
37
37
|
} else if (rawDefaultProp != null) {
|
|
38
|
-
|
|
38
|
+
const newDefaultValue = (0, _defaultValues.createDefaultValueFromRawDefaultProp)(rawDefaultProp, propDef, _rawDefaultPropResolvers.rawDefaultPropTypeResolvers);
|
|
39
39
|
|
|
40
|
-
if (
|
|
41
|
-
propDef.defaultValue =
|
|
40
|
+
if (newDefaultValue != null) {
|
|
41
|
+
propDef.defaultValue = newDefaultValue;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -46,9 +46,7 @@ function enhancePropTypesProp(extractedProp, rawDefaultProp) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
function enhancePropTypesProps(extractedProps, component) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return enhancePropTypesProp(x, rawDefaultProps[x.propDef.name]);
|
|
52
|
-
});
|
|
49
|
+
const rawDefaultProps = component.defaultProps != null ? component.defaultProps : {};
|
|
50
|
+
const enhancedProps = extractedProps.map(x => enhancePropTypesProp(x, rawDefaultProps[x.propDef.name]));
|
|
53
51
|
return (0, _sortProps.keepOriginalDefinitionOrder)(enhancedProps, component);
|
|
54
52
|
}
|
|
@@ -5,12 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.rawDefaultPropTypeResolvers = void 0;
|
|
7
7
|
|
|
8
|
-
require("core-js/modules/es.function.name.js");
|
|
9
|
-
|
|
10
|
-
require("core-js/modules/es.object.to-string.js");
|
|
11
|
-
|
|
12
|
-
require("core-js/modules/es.regexp.to-string.js");
|
|
13
|
-
|
|
14
8
|
var _docsTools = require("@storybook/docs-tools");
|
|
15
9
|
|
|
16
10
|
var _defaultValues = require("../lib/defaultValues");
|
|
@@ -21,11 +15,12 @@ var _prettyIdentifier = require("../lib/defaultValues/prettyIdentifier");
|
|
|
21
15
|
|
|
22
16
|
var _inspection = require("../lib/inspection");
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
const funcResolver = (rawDefaultProp, {
|
|
19
|
+
name,
|
|
20
|
+
type
|
|
21
|
+
}) => {
|
|
22
|
+
const isElement = type.summary === 'element' || type.summary === 'elementType';
|
|
23
|
+
const funcName = (0, _defaultValues.extractFunctionName)(rawDefaultProp, name);
|
|
29
24
|
|
|
30
25
|
if (funcName != null) {
|
|
31
26
|
// Try to display the name of the component. The body of the component is omitted since the code has been transpiled.
|
|
@@ -33,15 +28,16 @@ var funcResolver = function funcResolver(rawDefaultProp, _ref) {
|
|
|
33
28
|
return (0, _docsTools.createSummaryValue)((0, _prettyIdentifier.getPrettyElementIdentifier)(funcName));
|
|
34
29
|
}
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
const {
|
|
32
|
+
hasParams
|
|
33
|
+
} = (0, _inspection.inspectValue)(rawDefaultProp.toString()).inferredType;
|
|
38
34
|
return (0, _docsTools.createSummaryValue)((0, _prettyIdentifier.getPrettyFuncIdentifier)(funcName, hasParams));
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
return (0, _docsTools.createSummaryValue)(isElement ? _lib.ELEMENT_CAPTION : _lib.FUNCTION_CAPTION);
|
|
42
38
|
};
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
const rawDefaultPropTypeResolvers = (0, _defaultValues.createTypeResolvers)({
|
|
45
41
|
function: funcResolver
|
|
46
42
|
});
|
|
47
43
|
exports.rawDefaultPropTypeResolvers = rawDefaultPropTypeResolvers;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.keepOriginalDefinitionOrder = keepOriginalDefinitionOrder;
|
|
7
|
+
|
|
8
|
+
// react-docgen doesn't returned the props in the order they were defined in the "propTypes" object of the component.
|
|
9
|
+
// This function re-order them by their original definition order.
|
|
10
|
+
function keepOriginalDefinitionOrder(extractedProps, component) {
|
|
11
|
+
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
12
|
+
const {
|
|
13
|
+
propTypes
|
|
14
|
+
} = component;
|
|
15
|
+
|
|
16
|
+
if (propTypes != null) {
|
|
17
|
+
return Object.keys(propTypes).map(x => extractedProps.find(y => y.name === x)).filter(x => x);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return extractedProps;
|
|
21
|
+
}
|