@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,448 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/es.function.name.js";
|
|
2
|
-
import "core-js/modules/es.string.replace.js";
|
|
3
|
-
import "core-js/modules/es.regexp.exec.js";
|
|
4
|
-
import "core-js/modules/es.string.split.js";
|
|
5
|
-
import "core-js/modules/es.array.join.js";
|
|
6
|
-
import "core-js/modules/es.array.map.js";
|
|
7
|
-
import "core-js/modules/es.object.keys.js";
|
|
8
|
-
import "core-js/modules/es.array.concat.js";
|
|
9
|
-
import { createSummaryValue, isTooLongForTypeSummary } from '../../../lib';
|
|
10
|
-
import { generateFuncSignature, generateShortFuncSignature, toMultilineSignature } from './generateFuncSignature';
|
|
11
|
-
import { OBJECT_CAPTION, ARRAY_CAPTION, CLASS_CAPTION, FUNCTION_CAPTION, ELEMENT_CAPTION, CUSTOM_CAPTION, isHtmlTag, generateObjectCode, generateCode } from '../lib';
|
|
12
|
-
import { InspectionType, inspectValue } from '../lib/inspection';
|
|
13
|
-
var MAX_FUNC_LENGTH = 150;
|
|
14
|
-
var PropTypesType;
|
|
15
|
-
|
|
16
|
-
(function (PropTypesType) {
|
|
17
|
-
PropTypesType["CUSTOM"] = "custom";
|
|
18
|
-
PropTypesType["ANY"] = "any";
|
|
19
|
-
PropTypesType["FUNC"] = "func";
|
|
20
|
-
PropTypesType["SHAPE"] = "shape";
|
|
21
|
-
PropTypesType["OBJECT"] = "object";
|
|
22
|
-
PropTypesType["INSTANCEOF"] = "instanceOf";
|
|
23
|
-
PropTypesType["OBJECTOF"] = "objectOf";
|
|
24
|
-
PropTypesType["UNION"] = "union";
|
|
25
|
-
PropTypesType["ENUM"] = "enum";
|
|
26
|
-
PropTypesType["ARRAYOF"] = "arrayOf";
|
|
27
|
-
PropTypesType["ELEMENT"] = "element";
|
|
28
|
-
PropTypesType["ELEMENTTYPE"] = "elementType";
|
|
29
|
-
PropTypesType["NODE"] = "node";
|
|
30
|
-
})(PropTypesType || (PropTypesType = {}));
|
|
31
|
-
|
|
32
|
-
function createTypeDef(_ref) {
|
|
33
|
-
var name = _ref.name,
|
|
34
|
-
short = _ref.short,
|
|
35
|
-
compact = _ref.compact,
|
|
36
|
-
full = _ref.full,
|
|
37
|
-
inferredType = _ref.inferredType;
|
|
38
|
-
return {
|
|
39
|
-
name: name,
|
|
40
|
-
short: short,
|
|
41
|
-
compact: compact,
|
|
42
|
-
full: full != null ? full : short,
|
|
43
|
-
inferredType: inferredType
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function cleanPropTypes(value) {
|
|
48
|
-
return value.replace(/PropTypes./g, '').replace(/.isRequired/g, '');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function splitIntoLines(value) {
|
|
52
|
-
return value.split(/\r?\n/);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function prettyObject(ast) {
|
|
56
|
-
var compact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
57
|
-
return cleanPropTypes(generateObjectCode(ast, compact));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function prettyArray(ast) {
|
|
61
|
-
var compact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
62
|
-
return cleanPropTypes(generateCode(ast, compact));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function getCaptionForInspectionType(type) {
|
|
66
|
-
switch (type) {
|
|
67
|
-
case InspectionType.OBJECT:
|
|
68
|
-
return OBJECT_CAPTION;
|
|
69
|
-
|
|
70
|
-
case InspectionType.ARRAY:
|
|
71
|
-
return ARRAY_CAPTION;
|
|
72
|
-
|
|
73
|
-
case InspectionType.CLASS:
|
|
74
|
-
return CLASS_CAPTION;
|
|
75
|
-
|
|
76
|
-
case InspectionType.FUNCTION:
|
|
77
|
-
return FUNCTION_CAPTION;
|
|
78
|
-
|
|
79
|
-
case InspectionType.ELEMENT:
|
|
80
|
-
return ELEMENT_CAPTION;
|
|
81
|
-
|
|
82
|
-
default:
|
|
83
|
-
return CUSTOM_CAPTION;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function generateTypeFromString(value, originalTypeName) {
|
|
88
|
-
var _inspectValue = inspectValue(value),
|
|
89
|
-
inferredType = _inspectValue.inferredType,
|
|
90
|
-
ast = _inspectValue.ast;
|
|
91
|
-
|
|
92
|
-
var type = inferredType.type;
|
|
93
|
-
var short;
|
|
94
|
-
var compact;
|
|
95
|
-
var full;
|
|
96
|
-
|
|
97
|
-
switch (type) {
|
|
98
|
-
case InspectionType.IDENTIFIER:
|
|
99
|
-
case InspectionType.LITERAL:
|
|
100
|
-
short = value;
|
|
101
|
-
compact = value;
|
|
102
|
-
break;
|
|
103
|
-
|
|
104
|
-
case InspectionType.OBJECT:
|
|
105
|
-
{
|
|
106
|
-
var _ref2 = inferredType,
|
|
107
|
-
depth = _ref2.depth;
|
|
108
|
-
short = OBJECT_CAPTION;
|
|
109
|
-
compact = depth === 1 ? prettyObject(ast, true) : null;
|
|
110
|
-
full = prettyObject(ast);
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
case InspectionType.ELEMENT:
|
|
115
|
-
{
|
|
116
|
-
var _ref3 = inferredType,
|
|
117
|
-
identifier = _ref3.identifier;
|
|
118
|
-
short = identifier != null && !isHtmlTag(identifier) ? identifier : ELEMENT_CAPTION;
|
|
119
|
-
compact = splitIntoLines(value).length === 1 ? value : null;
|
|
120
|
-
full = value;
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
case InspectionType.ARRAY:
|
|
125
|
-
{
|
|
126
|
-
var _ref4 = inferredType,
|
|
127
|
-
_depth = _ref4.depth;
|
|
128
|
-
short = ARRAY_CAPTION;
|
|
129
|
-
compact = _depth <= 2 ? prettyArray(ast, true) : null;
|
|
130
|
-
full = prettyArray(ast);
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
default:
|
|
135
|
-
short = getCaptionForInspectionType(type);
|
|
136
|
-
compact = splitIntoLines(value).length === 1 ? value : null;
|
|
137
|
-
full = value;
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return createTypeDef({
|
|
142
|
-
name: originalTypeName,
|
|
143
|
-
short: short,
|
|
144
|
-
compact: compact,
|
|
145
|
-
full: full,
|
|
146
|
-
inferredType: type
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function generateCustom(_ref5) {
|
|
151
|
-
var raw = _ref5.raw;
|
|
152
|
-
|
|
153
|
-
if (raw != null) {
|
|
154
|
-
return generateTypeFromString(raw, PropTypesType.CUSTOM);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return createTypeDef({
|
|
158
|
-
name: PropTypesType.CUSTOM,
|
|
159
|
-
short: CUSTOM_CAPTION,
|
|
160
|
-
compact: CUSTOM_CAPTION
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function generateFunc(extractedProp) {
|
|
165
|
-
var jsDocTags = extractedProp.jsDocTags;
|
|
166
|
-
|
|
167
|
-
if (jsDocTags != null) {
|
|
168
|
-
if (jsDocTags.params != null || jsDocTags.returns != null) {
|
|
169
|
-
return createTypeDef({
|
|
170
|
-
name: PropTypesType.FUNC,
|
|
171
|
-
short: generateShortFuncSignature(jsDocTags.params, jsDocTags.returns),
|
|
172
|
-
compact: null,
|
|
173
|
-
full: generateFuncSignature(jsDocTags.params, jsDocTags.returns)
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return createTypeDef({
|
|
179
|
-
name: PropTypesType.FUNC,
|
|
180
|
-
short: FUNCTION_CAPTION,
|
|
181
|
-
compact: FUNCTION_CAPTION
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function generateShape(type, extractedProp) {
|
|
186
|
-
var fields = Object.keys(type.value).map(function (key) {
|
|
187
|
-
return "".concat(key, ": ").concat(generateType(type.value[key], extractedProp).full);
|
|
188
|
-
}).join(', ');
|
|
189
|
-
|
|
190
|
-
var _inspectValue2 = inspectValue("{ ".concat(fields, " }")),
|
|
191
|
-
inferredType = _inspectValue2.inferredType,
|
|
192
|
-
ast = _inspectValue2.ast;
|
|
193
|
-
|
|
194
|
-
var _ref6 = inferredType,
|
|
195
|
-
depth = _ref6.depth;
|
|
196
|
-
return createTypeDef({
|
|
197
|
-
name: PropTypesType.SHAPE,
|
|
198
|
-
short: OBJECT_CAPTION,
|
|
199
|
-
compact: depth === 1 && ast ? prettyObject(ast, true) : null,
|
|
200
|
-
full: ast ? prettyObject(ast) : null
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function objectOf(of) {
|
|
205
|
-
return "objectOf(".concat(of, ")");
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function generateObjectOf(type, extractedProp) {
|
|
209
|
-
var _generateType = generateType(type.value, extractedProp),
|
|
210
|
-
short = _generateType.short,
|
|
211
|
-
compact = _generateType.compact,
|
|
212
|
-
full = _generateType.full;
|
|
213
|
-
|
|
214
|
-
return createTypeDef({
|
|
215
|
-
name: PropTypesType.OBJECTOF,
|
|
216
|
-
short: objectOf(short),
|
|
217
|
-
compact: compact != null ? objectOf(compact) : null,
|
|
218
|
-
full: objectOf(full)
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function generateUnion(type, extractedProp) {
|
|
223
|
-
if (Array.isArray(type.value)) {
|
|
224
|
-
var values = type.value.reduce(function (acc, v) {
|
|
225
|
-
var _generateType2 = generateType(v, extractedProp),
|
|
226
|
-
short = _generateType2.short,
|
|
227
|
-
compact = _generateType2.compact,
|
|
228
|
-
full = _generateType2.full;
|
|
229
|
-
|
|
230
|
-
acc.short.push(short);
|
|
231
|
-
acc.compact.push(compact);
|
|
232
|
-
acc.full.push(full);
|
|
233
|
-
return acc;
|
|
234
|
-
}, {
|
|
235
|
-
short: [],
|
|
236
|
-
compact: [],
|
|
237
|
-
full: []
|
|
238
|
-
});
|
|
239
|
-
return createTypeDef({
|
|
240
|
-
name: PropTypesType.UNION,
|
|
241
|
-
short: values.short.join(' | '),
|
|
242
|
-
compact: values.compact.every(function (x) {
|
|
243
|
-
return x != null;
|
|
244
|
-
}) ? values.compact.join(' | ') : null,
|
|
245
|
-
full: values.full.join(' | ')
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return createTypeDef({
|
|
250
|
-
name: PropTypesType.UNION,
|
|
251
|
-
short: type.value,
|
|
252
|
-
compact: null
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function generateEnumValue(_ref7) {
|
|
257
|
-
var value = _ref7.value,
|
|
258
|
-
computed = _ref7.computed;
|
|
259
|
-
return computed ? generateTypeFromString(value, 'enumvalue') : createTypeDef({
|
|
260
|
-
name: 'enumvalue',
|
|
261
|
-
short: value,
|
|
262
|
-
compact: value
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
function generateEnum(type) {
|
|
267
|
-
if (Array.isArray(type.value)) {
|
|
268
|
-
var values = type.value.reduce(function (acc, v) {
|
|
269
|
-
var _generateEnumValue = generateEnumValue(v),
|
|
270
|
-
short = _generateEnumValue.short,
|
|
271
|
-
compact = _generateEnumValue.compact,
|
|
272
|
-
full = _generateEnumValue.full;
|
|
273
|
-
|
|
274
|
-
acc.short.push(short);
|
|
275
|
-
acc.compact.push(compact);
|
|
276
|
-
acc.full.push(full);
|
|
277
|
-
return acc;
|
|
278
|
-
}, {
|
|
279
|
-
short: [],
|
|
280
|
-
compact: [],
|
|
281
|
-
full: []
|
|
282
|
-
});
|
|
283
|
-
return createTypeDef({
|
|
284
|
-
name: PropTypesType.ENUM,
|
|
285
|
-
short: values.short.join(' | '),
|
|
286
|
-
compact: values.compact.every(function (x) {
|
|
287
|
-
return x != null;
|
|
288
|
-
}) ? values.compact.join(' | ') : null,
|
|
289
|
-
full: values.full.join(' | ')
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return createTypeDef({
|
|
294
|
-
name: PropTypesType.ENUM,
|
|
295
|
-
short: type.value,
|
|
296
|
-
compact: type.value
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function braceAfter(of) {
|
|
301
|
-
return "".concat(of, "[]");
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function braceAround(of) {
|
|
305
|
-
return "[".concat(of, "]");
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
function createArrayOfObjectTypeDef(short, compact, full) {
|
|
309
|
-
return createTypeDef({
|
|
310
|
-
name: PropTypesType.ARRAYOF,
|
|
311
|
-
short: braceAfter(short),
|
|
312
|
-
compact: compact != null ? braceAround(compact) : null,
|
|
313
|
-
full: braceAround(full)
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function generateArray(type, extractedProp) {
|
|
318
|
-
var _generateType3 = generateType(type.value, extractedProp),
|
|
319
|
-
name = _generateType3.name,
|
|
320
|
-
short = _generateType3.short,
|
|
321
|
-
compact = _generateType3.compact,
|
|
322
|
-
full = _generateType3.full,
|
|
323
|
-
inferredType = _generateType3.inferredType;
|
|
324
|
-
|
|
325
|
-
if (name === PropTypesType.CUSTOM) {
|
|
326
|
-
if (inferredType === InspectionType.OBJECT) {
|
|
327
|
-
return createArrayOfObjectTypeDef(short, compact, full);
|
|
328
|
-
}
|
|
329
|
-
} else if (name === PropTypesType.SHAPE) {
|
|
330
|
-
return createArrayOfObjectTypeDef(short, compact, full);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
return createTypeDef({
|
|
334
|
-
name: PropTypesType.ARRAYOF,
|
|
335
|
-
short: braceAfter(short),
|
|
336
|
-
compact: braceAfter(short)
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function generateType(type, extractedProp) {
|
|
341
|
-
try {
|
|
342
|
-
switch (type.name) {
|
|
343
|
-
case PropTypesType.CUSTOM:
|
|
344
|
-
return generateCustom(type);
|
|
345
|
-
|
|
346
|
-
case PropTypesType.FUNC:
|
|
347
|
-
return generateFunc(extractedProp);
|
|
348
|
-
|
|
349
|
-
case PropTypesType.SHAPE:
|
|
350
|
-
return generateShape(type, extractedProp);
|
|
351
|
-
|
|
352
|
-
case PropTypesType.INSTANCEOF:
|
|
353
|
-
return createTypeDef({
|
|
354
|
-
name: PropTypesType.INSTANCEOF,
|
|
355
|
-
short: type.value,
|
|
356
|
-
compact: type.value
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
case PropTypesType.OBJECTOF:
|
|
360
|
-
return generateObjectOf(type, extractedProp);
|
|
361
|
-
|
|
362
|
-
case PropTypesType.UNION:
|
|
363
|
-
return generateUnion(type, extractedProp);
|
|
364
|
-
|
|
365
|
-
case PropTypesType.ENUM:
|
|
366
|
-
return generateEnum(type);
|
|
367
|
-
|
|
368
|
-
case PropTypesType.ARRAYOF:
|
|
369
|
-
return generateArray(type, extractedProp);
|
|
370
|
-
|
|
371
|
-
default:
|
|
372
|
-
return createTypeDef({
|
|
373
|
-
name: type.name,
|
|
374
|
-
short: type.name,
|
|
375
|
-
compact: type.name
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
} catch (e) {
|
|
379
|
-
// eslint-disable-next-line no-console
|
|
380
|
-
console.error(e);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
return createTypeDef({
|
|
384
|
-
name: 'unknown',
|
|
385
|
-
short: 'unknown',
|
|
386
|
-
compact: 'unknown'
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
export function createType(extractedProp) {
|
|
391
|
-
var type = extractedProp.docgenInfo.type; // A type could be null if a defaultProp has been provided without a type definition.
|
|
392
|
-
|
|
393
|
-
if (type == null) {
|
|
394
|
-
return null;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
try {
|
|
398
|
-
switch (type.name) {
|
|
399
|
-
case PropTypesType.CUSTOM:
|
|
400
|
-
case PropTypesType.SHAPE:
|
|
401
|
-
case PropTypesType.INSTANCEOF:
|
|
402
|
-
case PropTypesType.OBJECTOF:
|
|
403
|
-
case PropTypesType.UNION:
|
|
404
|
-
case PropTypesType.ENUM:
|
|
405
|
-
case PropTypesType.ARRAYOF:
|
|
406
|
-
{
|
|
407
|
-
var _generateType4 = generateType(type, extractedProp),
|
|
408
|
-
short = _generateType4.short,
|
|
409
|
-
compact = _generateType4.compact,
|
|
410
|
-
full = _generateType4.full;
|
|
411
|
-
|
|
412
|
-
if (compact != null) {
|
|
413
|
-
if (!isTooLongForTypeSummary(compact)) {
|
|
414
|
-
return createSummaryValue(compact);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
return createSummaryValue(short, full);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
case PropTypesType.FUNC:
|
|
422
|
-
{
|
|
423
|
-
var _generateType5 = generateType(type, extractedProp),
|
|
424
|
-
_short = _generateType5.short,
|
|
425
|
-
_full = _generateType5.full;
|
|
426
|
-
|
|
427
|
-
var summary = _short;
|
|
428
|
-
var detail;
|
|
429
|
-
|
|
430
|
-
if (_full.length < MAX_FUNC_LENGTH) {
|
|
431
|
-
summary = _full;
|
|
432
|
-
} else {
|
|
433
|
-
detail = toMultilineSignature(_full);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
return createSummaryValue(summary, detail);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
default:
|
|
440
|
-
return null;
|
|
441
|
-
}
|
|
442
|
-
} catch (e) {
|
|
443
|
-
// eslint-disable-next-line no-console
|
|
444
|
-
console.error(e);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
return null;
|
|
448
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/es.array.map.js";
|
|
2
|
-
import "core-js/modules/es.array.concat.js";
|
|
3
|
-
import "core-js/modules/es.array.join.js";
|
|
4
|
-
import "core-js/modules/es.string.replace.js";
|
|
5
|
-
import "core-js/modules/es.regexp.exec.js";
|
|
6
|
-
export function generateFuncSignature(params, returns) {
|
|
7
|
-
var hasParams = params != null;
|
|
8
|
-
var hasReturns = returns != null;
|
|
9
|
-
|
|
10
|
-
if (!hasParams && !hasReturns) {
|
|
11
|
-
return '';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
var funcParts = [];
|
|
15
|
-
|
|
16
|
-
if (hasParams) {
|
|
17
|
-
var funcParams = params.map(function (x) {
|
|
18
|
-
var prettyName = x.getPrettyName();
|
|
19
|
-
var typeName = x.getTypeName();
|
|
20
|
-
|
|
21
|
-
if (typeName != null) {
|
|
22
|
-
return "".concat(prettyName, ": ").concat(typeName);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return prettyName;
|
|
26
|
-
});
|
|
27
|
-
funcParts.push("(".concat(funcParams.join(', '), ")"));
|
|
28
|
-
} else {
|
|
29
|
-
funcParts.push('()');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (hasReturns) {
|
|
33
|
-
funcParts.push("=> ".concat(returns.getTypeName()));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return funcParts.join(' ');
|
|
37
|
-
}
|
|
38
|
-
export function generateShortFuncSignature(params, returns) {
|
|
39
|
-
var hasParams = params != null;
|
|
40
|
-
var hasReturns = returns != null;
|
|
41
|
-
|
|
42
|
-
if (!hasParams && !hasReturns) {
|
|
43
|
-
return '';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
var funcParts = [];
|
|
47
|
-
|
|
48
|
-
if (hasParams) {
|
|
49
|
-
funcParts.push('( ... )');
|
|
50
|
-
} else {
|
|
51
|
-
funcParts.push('()');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (hasReturns) {
|
|
55
|
-
funcParts.push("=> ".concat(returns.getTypeName()));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return funcParts.join(' ');
|
|
59
|
-
}
|
|
60
|
-
export function toMultilineSignature(signature) {
|
|
61
|
-
return signature.replace(/,/g, ',\r\n');
|
|
62
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/es.array.map.js";
|
|
2
|
-
import "core-js/modules/es.function.name.js";
|
|
3
|
-
import { createType } from './createType';
|
|
4
|
-
import { createDefaultValue, createDefaultValueFromRawDefaultProp } from '../lib/defaultValues';
|
|
5
|
-
import { keepOriginalDefinitionOrder } from './sortProps';
|
|
6
|
-
import { rawDefaultPropTypeResolvers } from './rawDefaultPropResolvers';
|
|
7
|
-
export function enhancePropTypesProp(extractedProp, rawDefaultProp) {
|
|
8
|
-
var propDef = extractedProp.propDef;
|
|
9
|
-
var newtype = createType(extractedProp);
|
|
10
|
-
|
|
11
|
-
if (newtype != null) {
|
|
12
|
-
propDef.type = newtype;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
var defaultValue = extractedProp.docgenInfo.defaultValue;
|
|
16
|
-
|
|
17
|
-
if (defaultValue != null && defaultValue.value != null) {
|
|
18
|
-
var newDefaultValue = createDefaultValue(defaultValue.value);
|
|
19
|
-
|
|
20
|
-
if (newDefaultValue != null) {
|
|
21
|
-
propDef.defaultValue = newDefaultValue;
|
|
22
|
-
}
|
|
23
|
-
} else if (rawDefaultProp != null) {
|
|
24
|
-
var _newDefaultValue = createDefaultValueFromRawDefaultProp(rawDefaultProp, propDef, rawDefaultPropTypeResolvers);
|
|
25
|
-
|
|
26
|
-
if (_newDefaultValue != null) {
|
|
27
|
-
propDef.defaultValue = _newDefaultValue;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return propDef;
|
|
32
|
-
}
|
|
33
|
-
export function enhancePropTypesProps(extractedProps, component) {
|
|
34
|
-
var rawDefaultProps = component.defaultProps != null ? component.defaultProps : {};
|
|
35
|
-
var enhancedProps = extractedProps.map(function (x) {
|
|
36
|
-
return enhancePropTypesProp(x, rawDefaultProps[x.propDef.name]);
|
|
37
|
-
});
|
|
38
|
-
return keepOriginalDefinitionOrder(enhancedProps, component);
|
|
39
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/es.function.name.js";
|
|
2
|
-
import "core-js/modules/es.object.to-string.js";
|
|
3
|
-
import "core-js/modules/es.regexp.to-string.js";
|
|
4
|
-
import { extractFunctionName, createTypeResolvers } from '../lib/defaultValues';
|
|
5
|
-
import { createSummaryValue } from '../../../lib';
|
|
6
|
-
import { FUNCTION_CAPTION, ELEMENT_CAPTION } from '../lib';
|
|
7
|
-
import { getPrettyElementIdentifier, getPrettyFuncIdentifier } from '../lib/defaultValues/prettyIdentifier';
|
|
8
|
-
import { inspectValue } from '../lib/inspection';
|
|
9
|
-
|
|
10
|
-
var funcResolver = function funcResolver(rawDefaultProp, _ref) {
|
|
11
|
-
var name = _ref.name,
|
|
12
|
-
type = _ref.type;
|
|
13
|
-
var isElement = type.summary === 'element' || type.summary === 'elementType';
|
|
14
|
-
var funcName = extractFunctionName(rawDefaultProp, name);
|
|
15
|
-
|
|
16
|
-
if (funcName != null) {
|
|
17
|
-
// Try to display the name of the component. The body of the component is omitted since the code has been transpiled.
|
|
18
|
-
if (isElement) {
|
|
19
|
-
return createSummaryValue(getPrettyElementIdentifier(funcName));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var _ref2 = inspectValue(rawDefaultProp.toString()).inferredType,
|
|
23
|
-
hasParams = _ref2.hasParams;
|
|
24
|
-
return createSummaryValue(getPrettyFuncIdentifier(funcName, hasParams));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return createSummaryValue(isElement ? ELEMENT_CAPTION : FUNCTION_CAPTION);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export var rawDefaultPropTypeResolvers = createTypeResolvers({
|
|
31
|
-
function: funcResolver
|
|
32
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/es.array.filter.js";
|
|
2
|
-
import "core-js/modules/es.array.map.js";
|
|
3
|
-
import "core-js/modules/es.object.keys.js";
|
|
4
|
-
import "core-js/modules/es.array.find.js";
|
|
5
|
-
import "core-js/modules/es.function.name.js";
|
|
6
|
-
// react-docgen doesn't returned the props in the order they were defined in the "propTypes" object of the component.
|
|
7
|
-
// This function re-order them by their original definition order.
|
|
8
|
-
export function keepOriginalDefinitionOrder(extractedProps, component) {
|
|
9
|
-
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
10
|
-
var propTypes = component.propTypes;
|
|
11
|
-
|
|
12
|
-
if (propTypes != null) {
|
|
13
|
-
return Object.keys(propTypes).map(function (x) {
|
|
14
|
-
return extractedProps.find(function (y) {
|
|
15
|
-
return y.name === x;
|
|
16
|
-
});
|
|
17
|
-
}).filter(function (x) {
|
|
18
|
-
return x;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return extractedProps;
|
|
23
|
-
}
|