@storybook/addon-docs 6.5.0-alpha.6 → 6.5.0-alpha.60
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 +4 -13
- package/angular/README.md +0 -6
- package/angular/index.d.ts +1 -1
- package/angular/index.js +7 -1
- package/dist/cjs/blocks/Anchor.js +1 -1
- package/dist/cjs/blocks/ArgsTable.js +49 -13
- package/dist/cjs/blocks/Canvas.js +13 -11
- package/dist/cjs/blocks/Description.js +10 -10
- package/dist/cjs/blocks/DocsContainer.js +8 -6
- package/dist/cjs/blocks/DocsContext.js +2 -2
- package/dist/cjs/blocks/Heading.js +2 -2
- package/dist/cjs/blocks/Meta.js +8 -6
- package/dist/cjs/blocks/Primary.js +7 -7
- package/dist/cjs/blocks/Source.js +23 -10
- package/dist/cjs/blocks/SourceContainer.js +28 -18
- package/dist/cjs/blocks/Stories.js +14 -7
- package/dist/cjs/blocks/Story.js +12 -30
- package/dist/cjs/blocks/Subheading.js +2 -2
- package/dist/cjs/blocks/Subtitle.js +5 -5
- package/dist/cjs/blocks/Title.js +8 -8
- package/dist/cjs/blocks/enhanceSource.js +5 -5
- package/dist/cjs/blocks/index.js +6 -4
- package/dist/cjs/blocks/mdx.js +18 -10
- package/dist/cjs/blocks/useStory.js +8 -6
- package/dist/cjs/blocks/utils.js +3 -3
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/{register.js → manager.js} +0 -0
- package/dist/cjs/preset.js +226 -0
- package/dist/cjs/{frameworks/common/config.js → preview.js} +11 -17
- package/dist/esm/blocks/ArgsTable.js +39 -6
- package/dist/esm/blocks/Canvas.js +5 -3
- package/dist/esm/blocks/Description.js +1 -1
- package/dist/esm/blocks/DocsContainer.js +3 -2
- package/dist/esm/blocks/DocsContext.js +2 -2
- package/dist/esm/blocks/Heading.js +1 -1
- package/dist/esm/blocks/Meta.js +3 -2
- package/dist/esm/blocks/Primary.js +1 -0
- package/dist/esm/blocks/Source.js +16 -2
- package/dist/esm/blocks/SourceContainer.js +22 -13
- package/dist/esm/blocks/Stories.js +7 -0
- package/dist/esm/blocks/Story.js +6 -25
- package/dist/esm/blocks/Subheading.js +1 -1
- package/dist/esm/blocks/Title.js +1 -1
- package/dist/esm/blocks/enhanceSource.js +3 -3
- package/dist/esm/blocks/mdx.js +16 -9
- package/dist/esm/blocks/useStory.js +15 -15
- package/dist/esm/blocks/utils.js +1 -1
- package/dist/esm/{register.js → manager.js} +0 -0
- package/dist/esm/preset.js +197 -0
- package/dist/esm/{frameworks/common/config.js → preview.js} +5 -9
- package/dist/modern/blocks/ArgsTable.js +24 -3
- package/dist/modern/blocks/Canvas.js +3 -1
- package/dist/modern/blocks/Description.js +1 -1
- package/dist/modern/blocks/DocsContext.js +2 -2
- package/dist/modern/blocks/Source.js +17 -2
- package/dist/modern/blocks/SourceContainer.js +18 -12
- package/dist/modern/blocks/Stories.js +5 -0
- package/dist/modern/blocks/Story.js +2 -24
- package/dist/modern/blocks/mdx.js +13 -8
- package/dist/modern/{register.js → manager.js} +0 -0
- package/dist/modern/{frameworks/common/preset.js → preset.js} +16 -17
- package/dist/modern/preview.js +6 -0
- package/dist/ts3.4/blocks/Source.d.ts +5 -3
- package/dist/ts3.4/blocks/SourceContainer.d.ts +5 -1
- package/dist/ts3.4/{register.d.ts → manager.d.ts} +0 -0
- package/dist/ts3.4/preset.d.ts +11 -0
- package/dist/ts3.4/preview.d.ts +6 -0
- package/dist/ts3.9/blocks/DocsContext.d.ts +2 -2
- package/dist/ts3.9/blocks/Source.d.ts +5 -3
- package/dist/ts3.9/blocks/SourceContainer.d.ts +6 -2
- package/dist/ts3.9/blocks/enhanceSource.d.ts +2 -2
- package/dist/ts3.9/blocks/useStory.d.ts +2 -2
- package/dist/ts3.9/{register.d.ts → manager.d.ts} +0 -0
- package/dist/ts3.9/preset.d.ts +11 -0
- package/dist/ts3.9/preview.d.ts +6 -0
- package/ember/index.js +6 -1
- package/jest-transform-mdx.js +2 -5
- package/manager.js +1 -0
- package/mdx-compiler-plugin.js +1 -1
- package/package.json +24 -118
- package/preset.js +1 -16
- package/preview.js +1 -0
- package/register.js +6 -1
- package/{dist/cjs/frameworks/svelte → svelte}/HOC.svelte +0 -0
- package/common-preset.js +0 -19
- package/dist/cjs/frameworks/angular/compodoc.js +0 -397
- package/dist/cjs/frameworks/angular/config.js +0 -31
- package/dist/cjs/frameworks/angular/index.js +0 -22
- package/dist/cjs/frameworks/angular/prepareForInline.js +0 -96
- package/dist/cjs/frameworks/angular/sourceDecorator.js +0 -159
- package/dist/cjs/frameworks/angular/types.js +0 -1
- package/dist/cjs/frameworks/common/enhanceArgTypes.js +0 -21
- package/dist/cjs/frameworks/common/preset.js +0 -187
- package/dist/cjs/frameworks/ember/config.js +0 -17
- package/dist/cjs/frameworks/ember/index.js +0 -13
- package/dist/cjs/frameworks/ember/jsondoc.js +0 -87
- package/dist/cjs/frameworks/html/config.js +0 -26
- package/dist/cjs/frameworks/html/prepareForInline.js +0 -29
- package/dist/cjs/frameworks/html/sourceDecorator.js +0 -67
- package/dist/cjs/frameworks/react/config.js +0 -27
- package/dist/cjs/frameworks/react/extractArgTypes.js +0 -52
- package/dist/cjs/frameworks/react/extractProps.js +0 -77
- package/dist/cjs/frameworks/react/jsxDecorator.js +0 -277
- package/dist/cjs/frameworks/react/lib/captions.js +0 -18
- package/dist/cjs/frameworks/react/lib/componentTypes.js +0 -24
- package/dist/cjs/frameworks/react/lib/defaultValues/createDefaultValue.js +0 -81
- package/dist/cjs/frameworks/react/lib/defaultValues/createFromRawDefaultProp.js +0 -225
- package/dist/cjs/frameworks/react/lib/defaultValues/generateArray.js +0 -29
- package/dist/cjs/frameworks/react/lib/defaultValues/generateObject.js +0 -29
- package/dist/cjs/frameworks/react/lib/defaultValues/index.js +0 -35
- package/dist/cjs/frameworks/react/lib/defaultValues/prettyIdentifier.js +0 -34
- package/dist/cjs/frameworks/react/lib/generateCode.js +0 -89
- package/dist/cjs/frameworks/react/lib/index.js +0 -61
- package/dist/cjs/frameworks/react/lib/inspection/acornParser.js +0 -254
- package/dist/cjs/frameworks/react/lib/inspection/index.js +0 -35
- package/dist/cjs/frameworks/react/lib/inspection/inspectValue.js +0 -26
- package/dist/cjs/frameworks/react/lib/inspection/types.js +0 -19
- package/dist/cjs/frameworks/react/lib/isHtmlTag.js +0 -18
- package/dist/cjs/frameworks/react/propTypes/createType.js +0 -467
- package/dist/cjs/frameworks/react/propTypes/generateFuncSignature.js +0 -78
- package/dist/cjs/frameworks/react/propTypes/handleProp.js +0 -54
- package/dist/cjs/frameworks/react/propTypes/rawDefaultPropResolvers.js +0 -47
- package/dist/cjs/frameworks/react/propTypes/sortProps.js +0 -35
- package/dist/cjs/frameworks/react/react-argtypes.stories.js +0 -153
- package/dist/cjs/frameworks/react/typeScript/handleProp.js +0 -38
- package/dist/cjs/frameworks/svelte/config.js +0 -26
- package/dist/cjs/frameworks/svelte/extractArgTypes.js +0 -159
- package/dist/cjs/frameworks/svelte/extractComponentDescription.js +0 -21
- package/dist/cjs/frameworks/svelte/prepareForInline.js +0 -35
- package/dist/cjs/frameworks/svelte/preset.js +0 -54
- package/dist/cjs/frameworks/svelte/sample/MockButton.svelte +0 -45
- package/dist/cjs/frameworks/svelte/sourceDecorator.js +0 -262
- package/dist/cjs/frameworks/svelte/svelte-docgen-loader.js +0 -191
- package/dist/cjs/frameworks/vue/config.js +0 -26
- package/dist/cjs/frameworks/vue/extractArgTypes.js +0 -153
- package/dist/cjs/frameworks/vue/prepareForInline.js +0 -56
- package/dist/cjs/frameworks/vue/preset.js +0 -43
- package/dist/cjs/frameworks/vue/sourceDecorator.js +0 -343
- package/dist/cjs/frameworks/vue3/config.js +0 -22
- package/dist/cjs/frameworks/vue3/extractArgTypes.js +0 -62
- package/dist/cjs/frameworks/vue3/prepareForInline.js +0 -61
- package/dist/cjs/frameworks/vue3/preset.js +0 -43
- package/dist/cjs/frameworks/web-components/config.js +0 -30
- package/dist/cjs/frameworks/web-components/custom-elements.js +0 -163
- package/dist/cjs/frameworks/web-components/prepareForInline.js +0 -96
- package/dist/cjs/frameworks/web-components/sourceDecorator.js +0 -60
- package/dist/cjs/lib/convert/flow/convert.js +0 -112
- package/dist/cjs/lib/convert/flow/index.js +0 -35
- package/dist/cjs/lib/convert/flow/types.js +0 -1
- package/dist/cjs/lib/convert/index.js +0 -24
- package/dist/cjs/lib/convert/proptypes/convert.js +0 -135
- package/dist/cjs/lib/convert/proptypes/index.js +0 -35
- package/dist/cjs/lib/convert/proptypes/types.js +0 -1
- package/dist/cjs/lib/convert/typescript/convert.js +0 -82
- package/dist/cjs/lib/convert/typescript/index.js +0 -35
- package/dist/cjs/lib/convert/typescript/types.js +0 -1
- package/dist/cjs/lib/convert/utils.js +0 -18
- package/dist/cjs/lib/docgen/PropDef.js +0 -1
- package/dist/cjs/lib/docgen/createPropDef.js +0 -171
- package/dist/cjs/lib/docgen/extractDocgenProps.js +0 -113
- package/dist/cjs/lib/docgen/flow/createDefaultValue.js +0 -24
- package/dist/cjs/lib/docgen/flow/createPropDef.js +0 -30
- package/dist/cjs/lib/docgen/flow/createType.js +0 -119
- package/dist/cjs/lib/docgen/index.js +0 -48
- package/dist/cjs/lib/docgen/typeScript/createDefaultValue.js +0 -24
- package/dist/cjs/lib/docgen/typeScript/createPropDef.js +0 -28
- package/dist/cjs/lib/docgen/typeScript/createType.js +0 -30
- package/dist/cjs/lib/docgen/types.js +0 -17
- package/dist/cjs/lib/docgen/utils/defaultValue.js +0 -13
- package/dist/cjs/lib/docgen/utils/docgenInfo.js +0 -34
- package/dist/cjs/lib/docgen/utils/index.js +0 -48
- package/dist/cjs/lib/docgen/utils/string.js +0 -20
- package/dist/cjs/lib/index.js +0 -22
- package/dist/cjs/lib/jsdocParser.js +0 -229
- package/dist/cjs/lib/utils.js +0 -45
- package/dist/cjs/typings.d.js +0 -1
- package/dist/esm/frameworks/angular/compodoc.js +0 -347
- package/dist/esm/frameworks/angular/config.js +0 -18
- package/dist/esm/frameworks/angular/index.js +0 -1
- package/dist/esm/frameworks/angular/prepareForInline.js +0 -75
- package/dist/esm/frameworks/angular/sourceDecorator.js +0 -116
- package/dist/esm/frameworks/angular/types.js +0 -0
- package/dist/esm/frameworks/common/enhanceArgTypes.js +0 -11
- package/dist/esm/frameworks/common/preset.js +0 -161
- package/dist/esm/frameworks/ember/config.js +0 -8
- package/dist/esm/frameworks/ember/index.js +0 -1
- package/dist/esm/frameworks/ember/jsondoc.js +0 -66
- package/dist/esm/frameworks/html/config.js +0 -14
- package/dist/esm/frameworks/html/prepareForInline.js +0 -19
- package/dist/esm/frameworks/html/sourceDecorator.js +0 -56
- package/dist/esm/frameworks/react/config.js +0 -15
- package/dist/esm/frameworks/react/extractArgTypes.js +0 -38
- package/dist/esm/frameworks/react/extractProps.js +0 -53
- package/dist/esm/frameworks/react/jsxDecorator.js +0 -218
- package/dist/esm/frameworks/react/lib/captions.js +0 -6
- package/dist/esm/frameworks/react/lib/componentTypes.js +0 -9
- package/dist/esm/frameworks/react/lib/defaultValues/createDefaultValue.js +0 -67
- package/dist/esm/frameworks/react/lib/defaultValues/createFromRawDefaultProp.js +0 -191
- package/dist/esm/frameworks/react/lib/defaultValues/generateArray.js +0 -19
- package/dist/esm/frameworks/react/lib/defaultValues/generateObject.js +0 -19
- package/dist/esm/frameworks/react/lib/defaultValues/index.js +0 -2
- package/dist/esm/frameworks/react/lib/defaultValues/prettyIdentifier.js +0 -22
- package/dist/esm/frameworks/react/lib/generateCode.js +0 -68
- package/dist/esm/frameworks/react/lib/index.js +0 -4
- package/dist/esm/frameworks/react/lib/inspection/acornParser.js +0 -213
- package/dist/esm/frameworks/react/lib/inspection/index.js +0 -2
- package/dist/esm/frameworks/react/lib/inspection/inspectValue.js +0 -16
- package/dist/esm/frameworks/react/lib/inspection/types.js +0 -12
- package/dist/esm/frameworks/react/lib/isHtmlTag.js +0 -6
- package/dist/esm/frameworks/react/propTypes/createType.js +0 -448
- package/dist/esm/frameworks/react/propTypes/generateFuncSignature.js +0 -62
- package/dist/esm/frameworks/react/propTypes/handleProp.js +0 -39
- package/dist/esm/frameworks/react/propTypes/rawDefaultPropResolvers.js +0 -32
- package/dist/esm/frameworks/react/propTypes/sortProps.js +0 -23
- package/dist/esm/frameworks/react/react-argtypes.stories.js +0 -122
- package/dist/esm/frameworks/react/typeScript/handleProp.js +0 -27
- package/dist/esm/frameworks/svelte/HOC.svelte +0 -7
- package/dist/esm/frameworks/svelte/config.js +0 -13
- package/dist/esm/frameworks/svelte/extractArgTypes.js +0 -138
- package/dist/esm/frameworks/svelte/extractComponentDescription.js +0 -12
- package/dist/esm/frameworks/svelte/prepareForInline.js +0 -20
- package/dist/esm/frameworks/svelte/preset.js +0 -42
- package/dist/esm/frameworks/svelte/sample/MockButton.svelte +0 -45
- package/dist/esm/frameworks/svelte/sourceDecorator.js +0 -232
- package/dist/esm/frameworks/svelte/svelte-docgen-loader.js +0 -142
- package/dist/esm/frameworks/vue/config.js +0 -13
- package/dist/esm/frameworks/vue/extractArgTypes.js +0 -128
- package/dist/esm/frameworks/vue/prepareForInline.js +0 -39
- package/dist/esm/frameworks/vue/preset.js +0 -31
- package/dist/esm/frameworks/vue/sourceDecorator.js +0 -292
- package/dist/esm/frameworks/vue3/config.js +0 -11
- package/dist/esm/frameworks/vue3/extractArgTypes.js +0 -45
- package/dist/esm/frameworks/vue3/prepareForInline.js +0 -22
- package/dist/esm/frameworks/vue3/preset.js +0 -31
- package/dist/esm/frameworks/web-components/config.js +0 -17
- package/dist/esm/frameworks/web-components/custom-elements.js +0 -139
- package/dist/esm/frameworks/web-components/prepareForInline.js +0 -74
- package/dist/esm/frameworks/web-components/sourceDecorator.js +0 -50
- package/dist/esm/lib/convert/flow/convert.js +0 -98
- package/dist/esm/lib/convert/flow/index.js +0 -2
- package/dist/esm/lib/convert/flow/types.js +0 -0
- package/dist/esm/lib/convert/index.js +0 -12
- package/dist/esm/lib/convert/proptypes/convert.js +0 -116
- package/dist/esm/lib/convert/proptypes/index.js +0 -2
- package/dist/esm/lib/convert/proptypes/types.js +0 -0
- package/dist/esm/lib/convert/typescript/convert.js +0 -70
- package/dist/esm/lib/convert/typescript/index.js +0 -2
- package/dist/esm/lib/convert/typescript/types.js +0 -0
- package/dist/esm/lib/convert/utils.js +0 -6
- package/dist/esm/lib/docgen/PropDef.js +0 -0
- package/dist/esm/lib/docgen/createPropDef.js +0 -141
- package/dist/esm/lib/docgen/extractDocgenProps.js +0 -87
- package/dist/esm/lib/docgen/flow/createDefaultValue.js +0 -14
- package/dist/esm/lib/docgen/flow/createPropDef.js +0 -17
- package/dist/esm/lib/docgen/flow/createType.js +0 -106
- package/dist/esm/lib/docgen/index.js +0 -3
- package/dist/esm/lib/docgen/typeScript/createDefaultValue.js +0 -15
- package/dist/esm/lib/docgen/typeScript/createPropDef.js +0 -15
- package/dist/esm/lib/docgen/typeScript/createType.js +0 -19
- package/dist/esm/lib/docgen/types.js +0 -10
- package/dist/esm/lib/docgen/utils/defaultValue.js +0 -6
- package/dist/esm/lib/docgen/utils/docgenInfo.js +0 -18
- package/dist/esm/lib/docgen/utils/index.js +0 -3
- package/dist/esm/lib/docgen/utils/string.js +0 -11
- package/dist/esm/lib/index.js +0 -1
- package/dist/esm/lib/jsdocParser.js +0 -207
- package/dist/esm/lib/utils.js +0 -25
- package/dist/esm/typings.d.js +0 -0
- package/dist/modern/frameworks/angular/compodoc.js +0 -296
- package/dist/modern/frameworks/angular/config.js +0 -18
- package/dist/modern/frameworks/angular/index.js +0 -1
- package/dist/modern/frameworks/angular/prepareForInline.js +0 -36
- package/dist/modern/frameworks/angular/sourceDecorator.js +0 -81
- package/dist/modern/frameworks/angular/types.js +0 -0
- package/dist/modern/frameworks/common/config.js +0 -10
- package/dist/modern/frameworks/common/enhanceArgTypes.js +0 -16
- package/dist/modern/frameworks/ember/config.js +0 -8
- package/dist/modern/frameworks/ember/index.js +0 -1
- package/dist/modern/frameworks/ember/jsondoc.js +0 -57
- package/dist/modern/frameworks/html/config.js +0 -14
- package/dist/modern/frameworks/html/prepareForInline.js +0 -17
- package/dist/modern/frameworks/html/sourceDecorator.js +0 -56
- package/dist/modern/frameworks/react/config.js +0 -13
- package/dist/modern/frameworks/react/extractArgTypes.js +0 -38
- package/dist/modern/frameworks/react/extractProps.js +0 -41
- package/dist/modern/frameworks/react/jsxDecorator.js +0 -176
- package/dist/modern/frameworks/react/lib/captions.js +0 -6
- package/dist/modern/frameworks/react/lib/componentTypes.js +0 -2
- package/dist/modern/frameworks/react/lib/defaultValues/createDefaultValue.js +0 -72
- package/dist/modern/frameworks/react/lib/defaultValues/createFromRawDefaultProp.js +0 -181
- package/dist/modern/frameworks/react/lib/defaultValues/generateArray.js +0 -21
- package/dist/modern/frameworks/react/lib/defaultValues/generateObject.js +0 -21
- package/dist/modern/frameworks/react/lib/defaultValues/index.js +0 -2
- package/dist/modern/frameworks/react/lib/defaultValues/prettyIdentifier.js +0 -24
- package/dist/modern/frameworks/react/lib/generateCode.js +0 -59
- package/dist/modern/frameworks/react/lib/index.js +0 -4
- package/dist/modern/frameworks/react/lib/inspection/acornParser.js +0 -212
- package/dist/modern/frameworks/react/lib/inspection/index.js +0 -2
- package/dist/modern/frameworks/react/lib/inspection/inspectValue.js +0 -15
- package/dist/modern/frameworks/react/lib/inspection/types.js +0 -12
- package/dist/modern/frameworks/react/lib/isHtmlTag.js +0 -4
- package/dist/modern/frameworks/react/propTypes/createType.js +0 -446
- package/dist/modern/frameworks/react/propTypes/generateFuncSignature.js +0 -57
- package/dist/modern/frameworks/react/propTypes/handleProp.js +0 -39
- package/dist/modern/frameworks/react/propTypes/rawDefaultPropResolvers.js +0 -31
- package/dist/modern/frameworks/react/propTypes/sortProps.js +0 -14
- package/dist/modern/frameworks/react/react-argtypes.stories.js +0 -78
- package/dist/modern/frameworks/react/typeScript/handleProp.js +0 -28
- package/dist/modern/frameworks/svelte/HOC.svelte +0 -7
- package/dist/modern/frameworks/svelte/config.js +0 -13
- package/dist/modern/frameworks/svelte/extractArgTypes.js +0 -118
- package/dist/modern/frameworks/svelte/extractComponentDescription.js +0 -10
- package/dist/modern/frameworks/svelte/prepareForInline.js +0 -18
- package/dist/modern/frameworks/svelte/preset.js +0 -11
- package/dist/modern/frameworks/svelte/sample/MockButton.svelte +0 -45
- package/dist/modern/frameworks/svelte/sourceDecorator.js +0 -187
- package/dist/modern/frameworks/svelte/svelte-docgen-loader.js +0 -89
- package/dist/modern/frameworks/vue/config.js +0 -13
- package/dist/modern/frameworks/vue/extractArgTypes.js +0 -103
- package/dist/modern/frameworks/vue/prepareForInline.js +0 -40
- package/dist/modern/frameworks/vue/preset.js +0 -24
- package/dist/modern/frameworks/vue/sourceDecorator.js +0 -195
- package/dist/modern/frameworks/vue3/config.js +0 -11
- package/dist/modern/frameworks/vue3/extractArgTypes.js +0 -43
- package/dist/modern/frameworks/vue3/prepareForInline.js +0 -22
- package/dist/modern/frameworks/vue3/preset.js +0 -24
- package/dist/modern/frameworks/web-components/config.js +0 -17
- package/dist/modern/frameworks/web-components/custom-elements.js +0 -125
- package/dist/modern/frameworks/web-components/prepareForInline.js +0 -23
- package/dist/modern/frameworks/web-components/sourceDecorator.js +0 -47
- package/dist/modern/lib/convert/flow/convert.js +0 -89
- package/dist/modern/lib/convert/flow/index.js +0 -2
- package/dist/modern/lib/convert/flow/types.js +0 -0
- package/dist/modern/lib/convert/index.js +0 -14
- package/dist/modern/lib/convert/proptypes/convert.js +0 -102
- package/dist/modern/lib/convert/proptypes/index.js +0 -2
- package/dist/modern/lib/convert/proptypes/types.js +0 -0
- package/dist/modern/lib/convert/typescript/convert.js +0 -67
- package/dist/modern/lib/convert/typescript/index.js +0 -2
- package/dist/modern/lib/convert/typescript/types.js +0 -0
- package/dist/modern/lib/convert/utils.js +0 -2
- package/dist/modern/lib/docgen/PropDef.js +0 -0
- package/dist/modern/lib/docgen/createPropDef.js +0 -142
- package/dist/modern/lib/docgen/extractDocgenProps.js +0 -80
- package/dist/modern/lib/docgen/flow/createDefaultValue.js +0 -15
- package/dist/modern/lib/docgen/flow/createPropDef.js +0 -17
- package/dist/modern/lib/docgen/flow/createType.js +0 -103
- package/dist/modern/lib/docgen/index.js +0 -3
- package/dist/modern/lib/docgen/typeScript/createDefaultValue.js +0 -17
- package/dist/modern/lib/docgen/typeScript/createPropDef.js +0 -15
- package/dist/modern/lib/docgen/typeScript/createType.js +0 -16
- package/dist/modern/lib/docgen/types.js +0 -10
- package/dist/modern/lib/docgen/utils/defaultValue.js +0 -4
- package/dist/modern/lib/docgen/utils/docgenInfo.js +0 -14
- package/dist/modern/lib/docgen/utils/index.js +0 -3
- package/dist/modern/lib/docgen/utils/string.js +0 -11
- package/dist/modern/lib/index.js +0 -1
- package/dist/modern/lib/jsdocParser.js +0 -195
- package/dist/modern/lib/utils.js +0 -21
- package/dist/modern/typings.d.js +0 -0
- package/dist/ts3.4/frameworks/angular/compodoc.d.ts +0 -18
- package/dist/ts3.4/frameworks/angular/config.d.ts +0 -15
- package/dist/ts3.4/frameworks/angular/index.d.ts +0 -1
- package/dist/ts3.4/frameworks/angular/prepareForInline.d.ts +0 -7
- package/dist/ts3.4/frameworks/angular/sourceDecorator.d.ts +0 -9
- package/dist/ts3.4/frameworks/angular/types.d.ts +0 -102
- package/dist/ts3.4/frameworks/common/config.d.ts +0 -10
- package/dist/ts3.4/frameworks/common/enhanceArgTypes.d.ts +0 -2
- package/dist/ts3.4/frameworks/common/preset.d.ts +0 -1
- package/dist/ts3.4/frameworks/html/config.d.ts +0 -14
- package/dist/ts3.4/frameworks/html/prepareForInline.d.ts +0 -2
- package/dist/ts3.4/frameworks/html/sourceDecorator.d.ts +0 -3
- package/dist/ts3.4/frameworks/react/config.d.ts +0 -12
- package/dist/ts3.4/frameworks/react/extractArgTypes.d.ts +0 -2
- package/dist/ts3.4/frameworks/react/extractProps.d.ts +0 -5
- package/dist/ts3.4/frameworks/react/jsxDecorator.d.ts +0 -23
- package/dist/ts3.4/frameworks/react/lib/captions.d.ts +0 -6
- package/dist/ts3.4/frameworks/react/lib/componentTypes.d.ts +0 -2
- package/dist/ts3.4/frameworks/react/lib/defaultValues/createDefaultValue.d.ts +0 -2
- package/dist/ts3.4/frameworks/react/lib/defaultValues/createFromRawDefaultProp.d.ts +0 -12
- package/dist/ts3.4/frameworks/react/lib/defaultValues/generateArray.d.ts +0 -3
- package/dist/ts3.4/frameworks/react/lib/defaultValues/generateObject.d.ts +0 -3
- package/dist/ts3.4/frameworks/react/lib/defaultValues/index.d.ts +0 -2
- package/dist/ts3.4/frameworks/react/lib/defaultValues/prettyIdentifier.d.ts +0 -4
- package/dist/ts3.4/frameworks/react/lib/generateCode.d.ts +0 -3
- package/dist/ts3.4/frameworks/react/lib/index.d.ts +0 -4
- package/dist/ts3.4/frameworks/react/lib/inspection/acornParser.d.ts +0 -7
- package/dist/ts3.4/frameworks/react/lib/inspection/index.d.ts +0 -2
- package/dist/ts3.4/frameworks/react/lib/inspection/inspectValue.d.ts +0 -2
- package/dist/ts3.4/frameworks/react/lib/inspection/types.d.ts +0 -50
- package/dist/ts3.4/frameworks/react/lib/isHtmlTag.d.ts +0 -1
- package/dist/ts3.4/frameworks/react/propTypes/createType.d.ts +0 -3
- package/dist/ts3.4/frameworks/react/propTypes/generateFuncSignature.d.ts +0 -4
- package/dist/ts3.4/frameworks/react/propTypes/handleProp.d.ts +0 -4
- package/dist/ts3.4/frameworks/react/propTypes/rawDefaultPropResolvers.d.ts +0 -1
- package/dist/ts3.4/frameworks/react/propTypes/sortProps.d.ts +0 -3
- package/dist/ts3.4/frameworks/react/typeScript/handleProp.d.ts +0 -3
- package/dist/ts3.4/frameworks/svelte/config.d.ts +0 -11
- package/dist/ts3.4/frameworks/svelte/extractArgTypes.d.ts +0 -5
- package/dist/ts3.4/frameworks/svelte/extractComponentDescription.d.ts +0 -2
- package/dist/ts3.4/frameworks/svelte/prepareForInline.d.ts +0 -3
- package/dist/ts3.4/frameworks/svelte/preset.d.ts +0 -3
- package/dist/ts3.4/frameworks/svelte/sourceDecorator.d.ts +0 -16
- package/dist/ts3.4/frameworks/svelte/svelte-docgen-loader.d.ts +0 -5
- package/dist/ts3.4/frameworks/vue/config.d.ts +0 -11
- package/dist/ts3.4/frameworks/vue/extractArgTypes.d.ts +0 -2
- package/dist/ts3.4/frameworks/vue/prepareForInline.d.ts +0 -4
- package/dist/ts3.4/frameworks/vue/preset.d.ts +0 -2
- package/dist/ts3.4/frameworks/vue/sourceDecorator.d.ts +0 -5
- package/dist/ts3.4/frameworks/vue3/config.d.ts +0 -10
- package/dist/ts3.4/frameworks/vue3/extractArgTypes.d.ts +0 -2
- package/dist/ts3.4/frameworks/vue3/prepareForInline.d.ts +0 -4
- package/dist/ts3.4/frameworks/vue3/preset.d.ts +0 -2
- package/dist/ts3.4/frameworks/web-components/config.d.ts +0 -18
- package/dist/ts3.4/frameworks/web-components/custom-elements.d.ts +0 -36
- package/dist/ts3.4/frameworks/web-components/prepareForInline.d.ts +0 -4
- package/dist/ts3.4/frameworks/web-components/sourceDecorator.d.ts +0 -3
- package/dist/ts3.4/lib/convert/flow/convert.d.ts +0 -3
- package/dist/ts3.4/lib/convert/flow/index.d.ts +0 -2
- package/dist/ts3.4/lib/convert/flow/types.d.ts +0 -43
- package/dist/ts3.4/lib/convert/index.d.ts +0 -2
- package/dist/ts3.4/lib/convert/proptypes/convert.d.ts +0 -3
- package/dist/ts3.4/lib/convert/proptypes/index.d.ts +0 -2
- package/dist/ts3.4/lib/convert/proptypes/types.d.ts +0 -11
- package/dist/ts3.4/lib/convert/typescript/convert.d.ts +0 -3
- package/dist/ts3.4/lib/convert/typescript/index.d.ts +0 -2
- package/dist/ts3.4/lib/convert/typescript/types.d.ts +0 -39
- package/dist/ts3.4/lib/convert/utils.d.ts +0 -1
- package/dist/ts3.4/lib/docgen/PropDef.d.ts +0 -26
- package/dist/ts3.4/lib/docgen/createPropDef.d.ts +0 -8
- package/dist/ts3.4/lib/docgen/extractDocgenProps.d.ts +0 -14
- package/dist/ts3.4/lib/docgen/flow/createDefaultValue.d.ts +0 -3
- package/dist/ts3.4/lib/docgen/flow/createPropDef.d.ts +0 -2
- package/dist/ts3.4/lib/docgen/flow/createType.d.ts +0 -3
- package/dist/ts3.4/lib/docgen/index.d.ts +0 -3
- package/dist/ts3.4/lib/docgen/typeScript/createDefaultValue.d.ts +0 -3
- package/dist/ts3.4/lib/docgen/typeScript/createPropDef.d.ts +0 -2
- package/dist/ts3.4/lib/docgen/typeScript/createType.d.ts +0 -3
- package/dist/ts3.4/lib/docgen/types.d.ts +0 -46
- package/dist/ts3.4/lib/docgen/utils/defaultValue.d.ts +0 -1
- package/dist/ts3.4/lib/docgen/utils/docgenInfo.d.ts +0 -5
- package/dist/ts3.4/lib/docgen/utils/index.d.ts +0 -3
- package/dist/ts3.4/lib/docgen/utils/string.d.ts +0 -1
- package/dist/ts3.4/lib/index.d.ts +0 -1
- package/dist/ts3.4/lib/jsdocParser.d.ts +0 -28
- package/dist/ts3.4/lib/utils.d.ts +0 -7
- package/dist/ts3.9/frameworks/angular/compodoc.d.ts +0 -18
- package/dist/ts3.9/frameworks/angular/config.d.ts +0 -15
- package/dist/ts3.9/frameworks/angular/index.d.ts +0 -1
- package/dist/ts3.9/frameworks/angular/prepareForInline.d.ts +0 -7
- package/dist/ts3.9/frameworks/angular/sourceDecorator.d.ts +0 -9
- package/dist/ts3.9/frameworks/angular/types.d.ts +0 -102
- package/dist/ts3.9/frameworks/common/config.d.ts +0 -10
- package/dist/ts3.9/frameworks/common/enhanceArgTypes.d.ts +0 -2
- package/dist/ts3.9/frameworks/common/preset.d.ts +0 -1
- package/dist/ts3.9/frameworks/html/config.d.ts +0 -14
- package/dist/ts3.9/frameworks/html/prepareForInline.d.ts +0 -2
- package/dist/ts3.9/frameworks/html/sourceDecorator.d.ts +0 -3
- package/dist/ts3.9/frameworks/react/config.d.ts +0 -12
- package/dist/ts3.9/frameworks/react/extractArgTypes.d.ts +0 -2
- package/dist/ts3.9/frameworks/react/extractProps.d.ts +0 -5
- package/dist/ts3.9/frameworks/react/jsxDecorator.d.ts +0 -23
- package/dist/ts3.9/frameworks/react/lib/captions.d.ts +0 -6
- package/dist/ts3.9/frameworks/react/lib/componentTypes.d.ts +0 -2
- package/dist/ts3.9/frameworks/react/lib/defaultValues/createDefaultValue.d.ts +0 -2
- package/dist/ts3.9/frameworks/react/lib/defaultValues/createFromRawDefaultProp.d.ts +0 -12
- package/dist/ts3.9/frameworks/react/lib/defaultValues/generateArray.d.ts +0 -3
- package/dist/ts3.9/frameworks/react/lib/defaultValues/generateObject.d.ts +0 -3
- package/dist/ts3.9/frameworks/react/lib/defaultValues/index.d.ts +0 -2
- package/dist/ts3.9/frameworks/react/lib/defaultValues/prettyIdentifier.d.ts +0 -4
- package/dist/ts3.9/frameworks/react/lib/generateCode.d.ts +0 -3
- package/dist/ts3.9/frameworks/react/lib/index.d.ts +0 -4
- package/dist/ts3.9/frameworks/react/lib/inspection/acornParser.d.ts +0 -7
- package/dist/ts3.9/frameworks/react/lib/inspection/index.d.ts +0 -2
- package/dist/ts3.9/frameworks/react/lib/inspection/inspectValue.d.ts +0 -2
- package/dist/ts3.9/frameworks/react/lib/inspection/types.d.ts +0 -50
- package/dist/ts3.9/frameworks/react/lib/isHtmlTag.d.ts +0 -1
- package/dist/ts3.9/frameworks/react/propTypes/createType.d.ts +0 -3
- package/dist/ts3.9/frameworks/react/propTypes/generateFuncSignature.d.ts +0 -4
- package/dist/ts3.9/frameworks/react/propTypes/handleProp.d.ts +0 -4
- package/dist/ts3.9/frameworks/react/propTypes/rawDefaultPropResolvers.d.ts +0 -1
- package/dist/ts3.9/frameworks/react/propTypes/sortProps.d.ts +0 -3
- package/dist/ts3.9/frameworks/react/typeScript/handleProp.d.ts +0 -3
- package/dist/ts3.9/frameworks/svelte/config.d.ts +0 -11
- package/dist/ts3.9/frameworks/svelte/extractArgTypes.d.ts +0 -5
- package/dist/ts3.9/frameworks/svelte/extractComponentDescription.d.ts +0 -2
- package/dist/ts3.9/frameworks/svelte/prepareForInline.d.ts +0 -3
- package/dist/ts3.9/frameworks/svelte/preset.d.ts +0 -3
- package/dist/ts3.9/frameworks/svelte/sourceDecorator.d.ts +0 -16
- package/dist/ts3.9/frameworks/svelte/svelte-docgen-loader.d.ts +0 -5
- package/dist/ts3.9/frameworks/vue/config.d.ts +0 -11
- package/dist/ts3.9/frameworks/vue/extractArgTypes.d.ts +0 -2
- package/dist/ts3.9/frameworks/vue/prepareForInline.d.ts +0 -4
- package/dist/ts3.9/frameworks/vue/preset.d.ts +0 -2
- package/dist/ts3.9/frameworks/vue/sourceDecorator.d.ts +0 -5
- package/dist/ts3.9/frameworks/vue3/config.d.ts +0 -10
- package/dist/ts3.9/frameworks/vue3/extractArgTypes.d.ts +0 -2
- package/dist/ts3.9/frameworks/vue3/prepareForInline.d.ts +0 -4
- package/dist/ts3.9/frameworks/vue3/preset.d.ts +0 -2
- package/dist/ts3.9/frameworks/web-components/config.d.ts +0 -18
- package/dist/ts3.9/frameworks/web-components/custom-elements.d.ts +0 -35
- package/dist/ts3.9/frameworks/web-components/prepareForInline.d.ts +0 -4
- package/dist/ts3.9/frameworks/web-components/sourceDecorator.d.ts +0 -3
- package/dist/ts3.9/lib/convert/flow/convert.d.ts +0 -3
- package/dist/ts3.9/lib/convert/flow/index.d.ts +0 -2
- package/dist/ts3.9/lib/convert/flow/types.d.ts +0 -43
- package/dist/ts3.9/lib/convert/index.d.ts +0 -2
- package/dist/ts3.9/lib/convert/proptypes/convert.d.ts +0 -3
- package/dist/ts3.9/lib/convert/proptypes/index.d.ts +0 -2
- package/dist/ts3.9/lib/convert/proptypes/types.d.ts +0 -11
- package/dist/ts3.9/lib/convert/typescript/convert.d.ts +0 -3
- package/dist/ts3.9/lib/convert/typescript/index.d.ts +0 -2
- package/dist/ts3.9/lib/convert/typescript/types.d.ts +0 -39
- package/dist/ts3.9/lib/convert/utils.d.ts +0 -1
- package/dist/ts3.9/lib/docgen/PropDef.d.ts +0 -26
- package/dist/ts3.9/lib/docgen/createPropDef.d.ts +0 -8
- package/dist/ts3.9/lib/docgen/extractDocgenProps.d.ts +0 -14
- package/dist/ts3.9/lib/docgen/flow/createDefaultValue.d.ts +0 -3
- package/dist/ts3.9/lib/docgen/flow/createPropDef.d.ts +0 -2
- package/dist/ts3.9/lib/docgen/flow/createType.d.ts +0 -3
- package/dist/ts3.9/lib/docgen/index.d.ts +0 -3
- package/dist/ts3.9/lib/docgen/typeScript/createDefaultValue.d.ts +0 -3
- package/dist/ts3.9/lib/docgen/typeScript/createPropDef.d.ts +0 -2
- package/dist/ts3.9/lib/docgen/typeScript/createType.d.ts +0 -3
- package/dist/ts3.9/lib/docgen/types.d.ts +0 -46
- package/dist/ts3.9/lib/docgen/utils/defaultValue.d.ts +0 -1
- package/dist/ts3.9/lib/docgen/utils/docgenInfo.d.ts +0 -5
- package/dist/ts3.9/lib/docgen/utils/index.d.ts +0 -3
- package/dist/ts3.9/lib/docgen/utils/string.d.ts +0 -1
- package/dist/ts3.9/lib/index.d.ts +0 -1
- package/dist/ts3.9/lib/jsdocParser.d.ts +0 -28
- package/dist/ts3.9/lib/utils.d.ts +0 -7
|
@@ -1,446 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/es.array.reduce.js";
|
|
2
|
-
import { createSummaryValue, isTooLongForTypeSummary } from '../../../lib';
|
|
3
|
-
import { generateFuncSignature, generateShortFuncSignature, toMultilineSignature } from './generateFuncSignature';
|
|
4
|
-
import { OBJECT_CAPTION, ARRAY_CAPTION, CLASS_CAPTION, FUNCTION_CAPTION, ELEMENT_CAPTION, CUSTOM_CAPTION, isHtmlTag, generateObjectCode, generateCode } from '../lib';
|
|
5
|
-
import { InspectionType, inspectValue } from '../lib/inspection';
|
|
6
|
-
const MAX_FUNC_LENGTH = 150;
|
|
7
|
-
var PropTypesType;
|
|
8
|
-
|
|
9
|
-
(function (PropTypesType) {
|
|
10
|
-
PropTypesType["CUSTOM"] = "custom";
|
|
11
|
-
PropTypesType["ANY"] = "any";
|
|
12
|
-
PropTypesType["FUNC"] = "func";
|
|
13
|
-
PropTypesType["SHAPE"] = "shape";
|
|
14
|
-
PropTypesType["OBJECT"] = "object";
|
|
15
|
-
PropTypesType["INSTANCEOF"] = "instanceOf";
|
|
16
|
-
PropTypesType["OBJECTOF"] = "objectOf";
|
|
17
|
-
PropTypesType["UNION"] = "union";
|
|
18
|
-
PropTypesType["ENUM"] = "enum";
|
|
19
|
-
PropTypesType["ARRAYOF"] = "arrayOf";
|
|
20
|
-
PropTypesType["ELEMENT"] = "element";
|
|
21
|
-
PropTypesType["ELEMENTTYPE"] = "elementType";
|
|
22
|
-
PropTypesType["NODE"] = "node";
|
|
23
|
-
})(PropTypesType || (PropTypesType = {}));
|
|
24
|
-
|
|
25
|
-
function createTypeDef({
|
|
26
|
-
name,
|
|
27
|
-
short,
|
|
28
|
-
compact,
|
|
29
|
-
full,
|
|
30
|
-
inferredType
|
|
31
|
-
}) {
|
|
32
|
-
return {
|
|
33
|
-
name,
|
|
34
|
-
short,
|
|
35
|
-
compact,
|
|
36
|
-
full: full != null ? full : short,
|
|
37
|
-
inferredType
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function cleanPropTypes(value) {
|
|
42
|
-
return value.replace(/PropTypes./g, '').replace(/.isRequired/g, '');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function splitIntoLines(value) {
|
|
46
|
-
return value.split(/\r?\n/);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function prettyObject(ast, compact = false) {
|
|
50
|
-
return cleanPropTypes(generateObjectCode(ast, compact));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function prettyArray(ast, compact = false) {
|
|
54
|
-
return cleanPropTypes(generateCode(ast, compact));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function getCaptionForInspectionType(type) {
|
|
58
|
-
switch (type) {
|
|
59
|
-
case InspectionType.OBJECT:
|
|
60
|
-
return OBJECT_CAPTION;
|
|
61
|
-
|
|
62
|
-
case InspectionType.ARRAY:
|
|
63
|
-
return ARRAY_CAPTION;
|
|
64
|
-
|
|
65
|
-
case InspectionType.CLASS:
|
|
66
|
-
return CLASS_CAPTION;
|
|
67
|
-
|
|
68
|
-
case InspectionType.FUNCTION:
|
|
69
|
-
return FUNCTION_CAPTION;
|
|
70
|
-
|
|
71
|
-
case InspectionType.ELEMENT:
|
|
72
|
-
return ELEMENT_CAPTION;
|
|
73
|
-
|
|
74
|
-
default:
|
|
75
|
-
return CUSTOM_CAPTION;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function generateTypeFromString(value, originalTypeName) {
|
|
80
|
-
const {
|
|
81
|
-
inferredType,
|
|
82
|
-
ast
|
|
83
|
-
} = inspectValue(value);
|
|
84
|
-
const {
|
|
85
|
-
type
|
|
86
|
-
} = inferredType;
|
|
87
|
-
let short;
|
|
88
|
-
let compact;
|
|
89
|
-
let full;
|
|
90
|
-
|
|
91
|
-
switch (type) {
|
|
92
|
-
case InspectionType.IDENTIFIER:
|
|
93
|
-
case InspectionType.LITERAL:
|
|
94
|
-
short = value;
|
|
95
|
-
compact = value;
|
|
96
|
-
break;
|
|
97
|
-
|
|
98
|
-
case InspectionType.OBJECT:
|
|
99
|
-
{
|
|
100
|
-
const {
|
|
101
|
-
depth
|
|
102
|
-
} = inferredType;
|
|
103
|
-
short = OBJECT_CAPTION;
|
|
104
|
-
compact = depth === 1 ? prettyObject(ast, true) : null;
|
|
105
|
-
full = prettyObject(ast);
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
case InspectionType.ELEMENT:
|
|
110
|
-
{
|
|
111
|
-
const {
|
|
112
|
-
identifier
|
|
113
|
-
} = inferredType;
|
|
114
|
-
short = identifier != null && !isHtmlTag(identifier) ? identifier : ELEMENT_CAPTION;
|
|
115
|
-
compact = splitIntoLines(value).length === 1 ? value : null;
|
|
116
|
-
full = value;
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
case InspectionType.ARRAY:
|
|
121
|
-
{
|
|
122
|
-
const {
|
|
123
|
-
depth
|
|
124
|
-
} = inferredType;
|
|
125
|
-
short = ARRAY_CAPTION;
|
|
126
|
-
compact = depth <= 2 ? prettyArray(ast, true) : null;
|
|
127
|
-
full = prettyArray(ast);
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
default:
|
|
132
|
-
short = getCaptionForInspectionType(type);
|
|
133
|
-
compact = splitIntoLines(value).length === 1 ? value : null;
|
|
134
|
-
full = value;
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return createTypeDef({
|
|
139
|
-
name: originalTypeName,
|
|
140
|
-
short,
|
|
141
|
-
compact,
|
|
142
|
-
full,
|
|
143
|
-
inferredType: type
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function generateCustom({
|
|
148
|
-
raw
|
|
149
|
-
}) {
|
|
150
|
-
if (raw != null) {
|
|
151
|
-
return generateTypeFromString(raw, PropTypesType.CUSTOM);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return createTypeDef({
|
|
155
|
-
name: PropTypesType.CUSTOM,
|
|
156
|
-
short: CUSTOM_CAPTION,
|
|
157
|
-
compact: CUSTOM_CAPTION
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function generateFunc(extractedProp) {
|
|
162
|
-
const {
|
|
163
|
-
jsDocTags
|
|
164
|
-
} = extractedProp;
|
|
165
|
-
|
|
166
|
-
if (jsDocTags != null) {
|
|
167
|
-
if (jsDocTags.params != null || jsDocTags.returns != null) {
|
|
168
|
-
return createTypeDef({
|
|
169
|
-
name: PropTypesType.FUNC,
|
|
170
|
-
short: generateShortFuncSignature(jsDocTags.params, jsDocTags.returns),
|
|
171
|
-
compact: null,
|
|
172
|
-
full: generateFuncSignature(jsDocTags.params, jsDocTags.returns)
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return createTypeDef({
|
|
178
|
-
name: PropTypesType.FUNC,
|
|
179
|
-
short: FUNCTION_CAPTION,
|
|
180
|
-
compact: FUNCTION_CAPTION
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function generateShape(type, extractedProp) {
|
|
185
|
-
const fields = Object.keys(type.value).map(key => `${key}: ${generateType(type.value[key], extractedProp).full}`).join(', ');
|
|
186
|
-
const {
|
|
187
|
-
inferredType,
|
|
188
|
-
ast
|
|
189
|
-
} = inspectValue(`{ ${fields} }`);
|
|
190
|
-
const {
|
|
191
|
-
depth
|
|
192
|
-
} = inferredType;
|
|
193
|
-
return createTypeDef({
|
|
194
|
-
name: PropTypesType.SHAPE,
|
|
195
|
-
short: OBJECT_CAPTION,
|
|
196
|
-
compact: depth === 1 && ast ? prettyObject(ast, true) : null,
|
|
197
|
-
full: ast ? prettyObject(ast) : null
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function objectOf(of) {
|
|
202
|
-
return `objectOf(${of})`;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function generateObjectOf(type, extractedProp) {
|
|
206
|
-
const {
|
|
207
|
-
short,
|
|
208
|
-
compact,
|
|
209
|
-
full
|
|
210
|
-
} = generateType(type.value, extractedProp);
|
|
211
|
-
return createTypeDef({
|
|
212
|
-
name: PropTypesType.OBJECTOF,
|
|
213
|
-
short: objectOf(short),
|
|
214
|
-
compact: compact != null ? objectOf(compact) : null,
|
|
215
|
-
full: objectOf(full)
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function generateUnion(type, extractedProp) {
|
|
220
|
-
if (Array.isArray(type.value)) {
|
|
221
|
-
const values = type.value.reduce((acc, v) => {
|
|
222
|
-
const {
|
|
223
|
-
short,
|
|
224
|
-
compact,
|
|
225
|
-
full
|
|
226
|
-
} = generateType(v, extractedProp);
|
|
227
|
-
acc.short.push(short);
|
|
228
|
-
acc.compact.push(compact);
|
|
229
|
-
acc.full.push(full);
|
|
230
|
-
return acc;
|
|
231
|
-
}, {
|
|
232
|
-
short: [],
|
|
233
|
-
compact: [],
|
|
234
|
-
full: []
|
|
235
|
-
});
|
|
236
|
-
return createTypeDef({
|
|
237
|
-
name: PropTypesType.UNION,
|
|
238
|
-
short: values.short.join(' | '),
|
|
239
|
-
compact: values.compact.every(x => x != null) ? values.compact.join(' | ') : null,
|
|
240
|
-
full: values.full.join(' | ')
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
return createTypeDef({
|
|
245
|
-
name: PropTypesType.UNION,
|
|
246
|
-
short: type.value,
|
|
247
|
-
compact: null
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
function generateEnumValue({
|
|
252
|
-
value,
|
|
253
|
-
computed
|
|
254
|
-
}) {
|
|
255
|
-
return computed ? generateTypeFromString(value, 'enumvalue') : createTypeDef({
|
|
256
|
-
name: 'enumvalue',
|
|
257
|
-
short: value,
|
|
258
|
-
compact: value
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function generateEnum(type) {
|
|
263
|
-
if (Array.isArray(type.value)) {
|
|
264
|
-
const values = type.value.reduce((acc, v) => {
|
|
265
|
-
const {
|
|
266
|
-
short,
|
|
267
|
-
compact,
|
|
268
|
-
full
|
|
269
|
-
} = generateEnumValue(v);
|
|
270
|
-
acc.short.push(short);
|
|
271
|
-
acc.compact.push(compact);
|
|
272
|
-
acc.full.push(full);
|
|
273
|
-
return acc;
|
|
274
|
-
}, {
|
|
275
|
-
short: [],
|
|
276
|
-
compact: [],
|
|
277
|
-
full: []
|
|
278
|
-
});
|
|
279
|
-
return createTypeDef({
|
|
280
|
-
name: PropTypesType.ENUM,
|
|
281
|
-
short: values.short.join(' | '),
|
|
282
|
-
compact: values.compact.every(x => x != null) ? values.compact.join(' | ') : null,
|
|
283
|
-
full: values.full.join(' | ')
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return createTypeDef({
|
|
288
|
-
name: PropTypesType.ENUM,
|
|
289
|
-
short: type.value,
|
|
290
|
-
compact: type.value
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
function braceAfter(of) {
|
|
295
|
-
return `${of}[]`;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function braceAround(of) {
|
|
299
|
-
return `[${of}]`;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function createArrayOfObjectTypeDef(short, compact, full) {
|
|
303
|
-
return createTypeDef({
|
|
304
|
-
name: PropTypesType.ARRAYOF,
|
|
305
|
-
short: braceAfter(short),
|
|
306
|
-
compact: compact != null ? braceAround(compact) : null,
|
|
307
|
-
full: braceAround(full)
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
function generateArray(type, extractedProp) {
|
|
312
|
-
const {
|
|
313
|
-
name,
|
|
314
|
-
short,
|
|
315
|
-
compact,
|
|
316
|
-
full,
|
|
317
|
-
inferredType
|
|
318
|
-
} = generateType(type.value, extractedProp);
|
|
319
|
-
|
|
320
|
-
if (name === PropTypesType.CUSTOM) {
|
|
321
|
-
if (inferredType === InspectionType.OBJECT) {
|
|
322
|
-
return createArrayOfObjectTypeDef(short, compact, full);
|
|
323
|
-
}
|
|
324
|
-
} else if (name === PropTypesType.SHAPE) {
|
|
325
|
-
return createArrayOfObjectTypeDef(short, compact, full);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return createTypeDef({
|
|
329
|
-
name: PropTypesType.ARRAYOF,
|
|
330
|
-
short: braceAfter(short),
|
|
331
|
-
compact: braceAfter(short)
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
function generateType(type, extractedProp) {
|
|
336
|
-
try {
|
|
337
|
-
switch (type.name) {
|
|
338
|
-
case PropTypesType.CUSTOM:
|
|
339
|
-
return generateCustom(type);
|
|
340
|
-
|
|
341
|
-
case PropTypesType.FUNC:
|
|
342
|
-
return generateFunc(extractedProp);
|
|
343
|
-
|
|
344
|
-
case PropTypesType.SHAPE:
|
|
345
|
-
return generateShape(type, extractedProp);
|
|
346
|
-
|
|
347
|
-
case PropTypesType.INSTANCEOF:
|
|
348
|
-
return createTypeDef({
|
|
349
|
-
name: PropTypesType.INSTANCEOF,
|
|
350
|
-
short: type.value,
|
|
351
|
-
compact: type.value
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
case PropTypesType.OBJECTOF:
|
|
355
|
-
return generateObjectOf(type, extractedProp);
|
|
356
|
-
|
|
357
|
-
case PropTypesType.UNION:
|
|
358
|
-
return generateUnion(type, extractedProp);
|
|
359
|
-
|
|
360
|
-
case PropTypesType.ENUM:
|
|
361
|
-
return generateEnum(type);
|
|
362
|
-
|
|
363
|
-
case PropTypesType.ARRAYOF:
|
|
364
|
-
return generateArray(type, extractedProp);
|
|
365
|
-
|
|
366
|
-
default:
|
|
367
|
-
return createTypeDef({
|
|
368
|
-
name: type.name,
|
|
369
|
-
short: type.name,
|
|
370
|
-
compact: type.name
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
} catch (e) {
|
|
374
|
-
// eslint-disable-next-line no-console
|
|
375
|
-
console.error(e);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return createTypeDef({
|
|
379
|
-
name: 'unknown',
|
|
380
|
-
short: 'unknown',
|
|
381
|
-
compact: 'unknown'
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
export function createType(extractedProp) {
|
|
386
|
-
const {
|
|
387
|
-
type
|
|
388
|
-
} = extractedProp.docgenInfo; // A type could be null if a defaultProp has been provided without a type definition.
|
|
389
|
-
|
|
390
|
-
if (type == null) {
|
|
391
|
-
return null;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
try {
|
|
395
|
-
switch (type.name) {
|
|
396
|
-
case PropTypesType.CUSTOM:
|
|
397
|
-
case PropTypesType.SHAPE:
|
|
398
|
-
case PropTypesType.INSTANCEOF:
|
|
399
|
-
case PropTypesType.OBJECTOF:
|
|
400
|
-
case PropTypesType.UNION:
|
|
401
|
-
case PropTypesType.ENUM:
|
|
402
|
-
case PropTypesType.ARRAYOF:
|
|
403
|
-
{
|
|
404
|
-
const {
|
|
405
|
-
short,
|
|
406
|
-
compact,
|
|
407
|
-
full
|
|
408
|
-
} = generateType(type, extractedProp);
|
|
409
|
-
|
|
410
|
-
if (compact != null) {
|
|
411
|
-
if (!isTooLongForTypeSummary(compact)) {
|
|
412
|
-
return createSummaryValue(compact);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
return createSummaryValue(short, full);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
case PropTypesType.FUNC:
|
|
420
|
-
{
|
|
421
|
-
const {
|
|
422
|
-
short,
|
|
423
|
-
full
|
|
424
|
-
} = generateType(type, extractedProp);
|
|
425
|
-
let summary = short;
|
|
426
|
-
let detail;
|
|
427
|
-
|
|
428
|
-
if (full.length < MAX_FUNC_LENGTH) {
|
|
429
|
-
summary = full;
|
|
430
|
-
} else {
|
|
431
|
-
detail = toMultilineSignature(full);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
return createSummaryValue(summary, detail);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
default:
|
|
438
|
-
return null;
|
|
439
|
-
}
|
|
440
|
-
} catch (e) {
|
|
441
|
-
// eslint-disable-next-line no-console
|
|
442
|
-
console.error(e);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
return null;
|
|
446
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
export function generateFuncSignature(params, returns) {
|
|
2
|
-
const hasParams = params != null;
|
|
3
|
-
const hasReturns = returns != null;
|
|
4
|
-
|
|
5
|
-
if (!hasParams && !hasReturns) {
|
|
6
|
-
return '';
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const funcParts = [];
|
|
10
|
-
|
|
11
|
-
if (hasParams) {
|
|
12
|
-
const funcParams = params.map(x => {
|
|
13
|
-
const prettyName = x.getPrettyName();
|
|
14
|
-
const typeName = x.getTypeName();
|
|
15
|
-
|
|
16
|
-
if (typeName != null) {
|
|
17
|
-
return `${prettyName}: ${typeName}`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return prettyName;
|
|
21
|
-
});
|
|
22
|
-
funcParts.push(`(${funcParams.join(', ')})`);
|
|
23
|
-
} else {
|
|
24
|
-
funcParts.push('()');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (hasReturns) {
|
|
28
|
-
funcParts.push(`=> ${returns.getTypeName()}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return funcParts.join(' ');
|
|
32
|
-
}
|
|
33
|
-
export function generateShortFuncSignature(params, returns) {
|
|
34
|
-
const hasParams = params != null;
|
|
35
|
-
const hasReturns = returns != null;
|
|
36
|
-
|
|
37
|
-
if (!hasParams && !hasReturns) {
|
|
38
|
-
return '';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const funcParts = [];
|
|
42
|
-
|
|
43
|
-
if (hasParams) {
|
|
44
|
-
funcParts.push('( ... )');
|
|
45
|
-
} else {
|
|
46
|
-
funcParts.push('()');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (hasReturns) {
|
|
50
|
-
funcParts.push(`=> ${returns.getTypeName()}`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return funcParts.join(' ');
|
|
54
|
-
}
|
|
55
|
-
export function toMultilineSignature(signature) {
|
|
56
|
-
return signature.replace(/,/g, ',\r\n');
|
|
57
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { createType } from './createType';
|
|
2
|
-
import { createDefaultValue, createDefaultValueFromRawDefaultProp } from '../lib/defaultValues';
|
|
3
|
-
import { keepOriginalDefinitionOrder } from './sortProps';
|
|
4
|
-
import { rawDefaultPropTypeResolvers } from './rawDefaultPropResolvers';
|
|
5
|
-
export function enhancePropTypesProp(extractedProp, rawDefaultProp) {
|
|
6
|
-
const {
|
|
7
|
-
propDef
|
|
8
|
-
} = extractedProp;
|
|
9
|
-
const newtype = createType(extractedProp);
|
|
10
|
-
|
|
11
|
-
if (newtype != null) {
|
|
12
|
-
propDef.type = newtype;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const {
|
|
16
|
-
defaultValue
|
|
17
|
-
} = extractedProp.docgenInfo;
|
|
18
|
-
|
|
19
|
-
if (defaultValue != null && defaultValue.value != null) {
|
|
20
|
-
const newDefaultValue = createDefaultValue(defaultValue.value);
|
|
21
|
-
|
|
22
|
-
if (newDefaultValue != null) {
|
|
23
|
-
propDef.defaultValue = newDefaultValue;
|
|
24
|
-
}
|
|
25
|
-
} else if (rawDefaultProp != null) {
|
|
26
|
-
const newDefaultValue = createDefaultValueFromRawDefaultProp(rawDefaultProp, propDef, rawDefaultPropTypeResolvers);
|
|
27
|
-
|
|
28
|
-
if (newDefaultValue != null) {
|
|
29
|
-
propDef.defaultValue = newDefaultValue;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return propDef;
|
|
34
|
-
}
|
|
35
|
-
export function enhancePropTypesProps(extractedProps, component) {
|
|
36
|
-
const rawDefaultProps = component.defaultProps != null ? component.defaultProps : {};
|
|
37
|
-
const enhancedProps = extractedProps.map(x => enhancePropTypesProp(x, rawDefaultProps[x.propDef.name]));
|
|
38
|
-
return keepOriginalDefinitionOrder(enhancedProps, component);
|
|
39
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { extractFunctionName, createTypeResolvers } from '../lib/defaultValues';
|
|
2
|
-
import { createSummaryValue } from '../../../lib';
|
|
3
|
-
import { FUNCTION_CAPTION, ELEMENT_CAPTION } from '../lib';
|
|
4
|
-
import { getPrettyElementIdentifier, getPrettyFuncIdentifier } from '../lib/defaultValues/prettyIdentifier';
|
|
5
|
-
import { inspectValue } from '../lib/inspection';
|
|
6
|
-
|
|
7
|
-
const funcResolver = (rawDefaultProp, {
|
|
8
|
-
name,
|
|
9
|
-
type
|
|
10
|
-
}) => {
|
|
11
|
-
const isElement = type.summary === 'element' || type.summary === 'elementType';
|
|
12
|
-
const funcName = extractFunctionName(rawDefaultProp, name);
|
|
13
|
-
|
|
14
|
-
if (funcName != null) {
|
|
15
|
-
// Try to display the name of the component. The body of the component is omitted since the code has been transpiled.
|
|
16
|
-
if (isElement) {
|
|
17
|
-
return createSummaryValue(getPrettyElementIdentifier(funcName));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
hasParams
|
|
22
|
-
} = inspectValue(rawDefaultProp.toString()).inferredType;
|
|
23
|
-
return createSummaryValue(getPrettyFuncIdentifier(funcName, hasParams));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return createSummaryValue(isElement ? ELEMENT_CAPTION : FUNCTION_CAPTION);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const rawDefaultPropTypeResolvers = createTypeResolvers({
|
|
30
|
-
function: funcResolver
|
|
31
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// react-docgen doesn't returned the props in the order they were defined in the "propTypes" object of the component.
|
|
2
|
-
// This function re-order them by their original definition order.
|
|
3
|
-
export function keepOriginalDefinitionOrder(extractedProps, component) {
|
|
4
|
-
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
5
|
-
const {
|
|
6
|
-
propTypes
|
|
7
|
-
} = component;
|
|
8
|
-
|
|
9
|
-
if (propTypes != null) {
|
|
10
|
-
return Object.keys(propTypes).map(x => extractedProps.find(y => y.name === x)).filter(x => x);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return extractedProps;
|
|
14
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import mapValues from 'lodash/mapValues';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
|
-
import { ArgsTable } from '@storybook/components';
|
|
5
|
-
import { inferControls } from '@storybook/store';
|
|
6
|
-
import { extractArgTypes } from './extractArgTypes';
|
|
7
|
-
|
|
8
|
-
const argsTableProps = component => {
|
|
9
|
-
const argTypes = extractArgTypes(component);
|
|
10
|
-
const parameters = {
|
|
11
|
-
__isArgsStory: true
|
|
12
|
-
};
|
|
13
|
-
const rows = inferControls({
|
|
14
|
-
argTypes,
|
|
15
|
-
parameters
|
|
16
|
-
});
|
|
17
|
-
return {
|
|
18
|
-
rows
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const ArgsStory = ({
|
|
23
|
-
component
|
|
24
|
-
}) => {
|
|
25
|
-
const {
|
|
26
|
-
rows
|
|
27
|
-
} = argsTableProps(component);
|
|
28
|
-
const initialArgs = mapValues(rows, argType => argType.defaultValue);
|
|
29
|
-
const [args, setArgs] = useState(initialArgs);
|
|
30
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "NOTE:"), " these stories are to help visualise the snapshot tests in", ' ', /*#__PURE__*/React.createElement("code", null, "./react-properties.test.js"), "."), /*#__PURE__*/React.createElement(ArgsTable, {
|
|
31
|
-
rows: rows,
|
|
32
|
-
args: args,
|
|
33
|
-
updateArgs: val => setArgs(Object.assign({}, args, val))
|
|
34
|
-
}), /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, "arg name"), /*#__PURE__*/React.createElement("th", null, "argType"))), /*#__PURE__*/React.createElement("tbody", null, Object.entries(args).map(([key, val]) => /*#__PURE__*/React.createElement("tr", {
|
|
35
|
-
key: key
|
|
36
|
-
}, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("code", null, key)), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("pre", null, JSON.stringify(rows[key]))))))));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const typescriptFixtures = ['aliases', 'arrays', 'enums', 'functions', 'interfaces', 'intersections', 'records', 'scalars', 'tuples', 'unions', 'optionals'];
|
|
40
|
-
const typescriptStories = storiesOf('ArgTypes/TypeScript', module);
|
|
41
|
-
typescriptFixtures.forEach(fixture => {
|
|
42
|
-
// eslint-disable-next-line import/no-dynamic-require, global-require, no-shadow
|
|
43
|
-
const {
|
|
44
|
-
Component
|
|
45
|
-
} = require(`../../lib/convert/__testfixtures__/typescript/${fixture}`);
|
|
46
|
-
|
|
47
|
-
typescriptStories.add(fixture, () => /*#__PURE__*/React.createElement(ArgsStory, {
|
|
48
|
-
component: Component
|
|
49
|
-
}));
|
|
50
|
-
});
|
|
51
|
-
const proptypesFixtures = ['arrays', 'enums', 'misc', 'objects', 'react', 'scalars'];
|
|
52
|
-
const proptypesStories = storiesOf('ArgTypes/PropTypes', module);
|
|
53
|
-
proptypesFixtures.forEach(fixture => {
|
|
54
|
-
// eslint-disable-next-line import/no-dynamic-require, global-require, no-shadow
|
|
55
|
-
const {
|
|
56
|
-
Component
|
|
57
|
-
} = require(`../../lib/convert/__testfixtures__/proptypes/${fixture}`);
|
|
58
|
-
|
|
59
|
-
proptypesStories.add(fixture, () => /*#__PURE__*/React.createElement(ArgsStory, {
|
|
60
|
-
component: Component
|
|
61
|
-
}));
|
|
62
|
-
});
|
|
63
|
-
const issuesFixtures = ['js-class-component', 'js-function-component', 'js-function-component-inline-defaults', 'js-function-component-inline-defaults-no-propTypes', 'ts-function-component', 'ts-function-component-inline-defaults', '9399-js-proptypes-shape', '8663-js-styled-components', '9626-js-default-values', '9668-js-proptypes-no-jsdoc', '8143-ts-react-fc-generics', '8143-ts-imported-types', '8279-js-styled-docgen', '8140-js-prop-types-oneof', '9023-js-hoc', '8740-ts-multi-props', '9556-ts-react-default-exports', '9592-ts-styled-props', '9591-ts-import-types', '9721-ts-deprecated-jsdoc', '9827-ts-default-values', '9586-js-react-memo', '9575-ts-camel-case', '9493-ts-display-name', '8894-9511-ts-forward-ref', '9465-ts-type-props', '8428-js-static-prop-types', '9764-ts-extend-props', '9922-ts-component-props'];
|
|
64
|
-
const issuesStories = storiesOf('ArgTypes/Issues', module);
|
|
65
|
-
issuesFixtures.forEach(fixture => {
|
|
66
|
-
// eslint-disable-next-line import/no-dynamic-require, global-require
|
|
67
|
-
const {
|
|
68
|
-
component
|
|
69
|
-
} = require(`./__testfixtures__/${fixture}/input`);
|
|
70
|
-
|
|
71
|
-
issuesStories.add(fixture, () => /*#__PURE__*/React.createElement(ArgsStory, {
|
|
72
|
-
component: component
|
|
73
|
-
}), {
|
|
74
|
-
chromatic: {
|
|
75
|
-
disable: true
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createDefaultValue, createDefaultValueFromRawDefaultProp } from '../lib/defaultValues';
|
|
2
|
-
export function enhanceTypeScriptProp(extractedProp, rawDefaultProp) {
|
|
3
|
-
const {
|
|
4
|
-
propDef
|
|
5
|
-
} = extractedProp;
|
|
6
|
-
const {
|
|
7
|
-
defaultValue
|
|
8
|
-
} = extractedProp.docgenInfo;
|
|
9
|
-
|
|
10
|
-
if (defaultValue != null && defaultValue.value != null) {
|
|
11
|
-
const newDefaultValue = createDefaultValue(defaultValue.value);
|
|
12
|
-
|
|
13
|
-
if (newDefaultValue != null) {
|
|
14
|
-
propDef.defaultValue = newDefaultValue;
|
|
15
|
-
}
|
|
16
|
-
} else if (rawDefaultProp != null) {
|
|
17
|
-
const newDefaultValue = createDefaultValueFromRawDefaultProp(rawDefaultProp, propDef);
|
|
18
|
-
|
|
19
|
-
if (newDefaultValue != null) {
|
|
20
|
-
propDef.defaultValue = newDefaultValue;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return propDef;
|
|
25
|
-
}
|
|
26
|
-
export function enhanceTypeScriptProps(extractedProps) {
|
|
27
|
-
return extractedProps.map(prop => enhanceTypeScriptProp(prop));
|
|
28
|
-
}
|