@storybook/addon-docs 6.5.0-alpha.46 → 6.5.0-alpha.49
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/angular/index.d.ts +1 -1
- package/angular/index.js +7 -1
- package/dist/cjs/blocks/Description.js +4 -4
- package/dist/cjs/blocks/Story.js +2 -22
- package/dist/cjs/frameworks/common/config.js +2 -6
- package/dist/cjs/frameworks/common/preset.js +5 -6
- package/dist/esm/blocks/Description.js +1 -1
- package/dist/esm/blocks/Story.js +2 -22
- package/dist/esm/frameworks/common/config.js +1 -3
- package/dist/esm/frameworks/common/preset.js +2 -3
- package/dist/modern/blocks/Description.js +1 -1
- package/dist/modern/blocks/Story.js +2 -24
- package/dist/modern/frameworks/common/config.js +1 -3
- package/dist/modern/frameworks/common/preset.js +2 -4
- package/dist/ts3.4/frameworks/common/config.d.ts +0 -1
- package/dist/ts3.9/blocks/DocsContext.d.ts +2 -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/frameworks/common/config.d.ts +0 -1
- package/ember/index.js +6 -1
- package/package.json +15 -110
- package/preset.js +14 -14
- 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 -24
- 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/ember/config.js +0 -17
- package/dist/cjs/frameworks/ember/index.js +0 -13
- package/dist/cjs/frameworks/ember/jsondoc.js +0 -89
- 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 -54
- package/dist/cjs/frameworks/react/extractProps.js +0 -77
- package/dist/cjs/frameworks/react/jsxDecorator.js +0 -279
- 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 -37
- 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 -63
- package/dist/cjs/frameworks/react/lib/inspection/acornParser.js +0 -254
- package/dist/cjs/frameworks/react/lib/inspection/index.js +0 -37
- 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 -469
- 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 -37
- package/dist/cjs/frameworks/react/react-argtypes.stories.js +0 -155
- 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 -162
- package/dist/cjs/frameworks/svelte/extractComponentDescription.js +0 -21
- package/dist/cjs/frameworks/svelte/prepareForInline.js +0 -34
- package/dist/cjs/frameworks/svelte/preset.js +0 -54
- package/dist/cjs/frameworks/svelte/sourceDecorator.js +0 -264
- 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 -155
- package/dist/cjs/frameworks/vue/prepareForInline.js +0 -56
- package/dist/cjs/frameworks/vue/preset.js +0 -45
- 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 -64
- package/dist/cjs/frameworks/vue3/prepareForInline.js +0 -61
- package/dist/cjs/frameworks/vue3/preset.js +0 -45
- package/dist/cjs/frameworks/web-components/config.js +0 -30
- package/dist/cjs/frameworks/web-components/custom-elements.js +0 -165
- 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 -114
- package/dist/cjs/lib/convert/flow/index.js +0 -37
- 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 -140
- package/dist/cjs/lib/convert/proptypes/index.js +0 -37
- package/dist/cjs/lib/convert/proptypes/types.js +0 -1
- package/dist/cjs/lib/convert/typescript/convert.js +0 -84
- package/dist/cjs/lib/convert/typescript/index.js +0 -37
- package/dist/cjs/lib/convert/typescript/types.js +0 -1
- package/dist/cjs/lib/convert/utils.js +0 -24
- package/dist/cjs/lib/docgen/PropDef.js +0 -1
- package/dist/cjs/lib/docgen/createPropDef.js +0 -173
- package/dist/cjs/lib/docgen/extractDocgenProps.js +0 -115
- 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 -50
- 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 -16
- package/dist/cjs/lib/docgen/utils/docgenInfo.js +0 -34
- package/dist/cjs/lib/docgen/utils/index.js +0 -50
- package/dist/cjs/lib/docgen/utils/string.js +0 -20
- package/dist/cjs/lib/index.js +0 -24
- package/dist/cjs/lib/jsdocParser.js +0 -229
- package/dist/cjs/lib/utils.js +0 -46
- 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/ember/config.js +0 -8
- package/dist/esm/frameworks/ember/index.js +0 -1
- package/dist/esm/frameworks/ember/jsondoc.js +0 -67
- 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 -39
- package/dist/esm/frameworks/react/extractProps.js +0 -53
- package/dist/esm/frameworks/react/jsxDecorator.js +0 -219
- 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 -449
- 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 -24
- package/dist/esm/frameworks/react/react-argtypes.stories.js +0 -123
- package/dist/esm/frameworks/react/typeScript/handleProp.js +0 -27
- package/dist/esm/frameworks/svelte/config.js +0 -13
- package/dist/esm/frameworks/svelte/extractArgTypes.js +0 -140
- package/dist/esm/frameworks/svelte/extractComponentDescription.js +0 -12
- package/dist/esm/frameworks/svelte/prepareForInline.js +0 -19
- package/dist/esm/frameworks/svelte/preset.js +0 -42
- package/dist/esm/frameworks/svelte/sourceDecorator.js +0 -233
- 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 -129
- package/dist/esm/frameworks/vue/prepareForInline.js +0 -39
- package/dist/esm/frameworks/vue/preset.js +0 -32
- 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 -46
- package/dist/esm/frameworks/vue3/prepareForInline.js +0 -22
- package/dist/esm/frameworks/vue3/preset.js +0 -32
- package/dist/esm/frameworks/web-components/config.js +0 -17
- package/dist/esm/frameworks/web-components/custom-elements.js +0 -140
- 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 -99
- 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 -119
- 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 -71
- 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 -9
- package/dist/esm/lib/docgen/PropDef.js +0 -0
- package/dist/esm/lib/docgen/createPropDef.js +0 -142
- package/dist/esm/lib/docgen/extractDocgenProps.js +0 -88
- 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 -7
- 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/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/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 -178
- 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 -211
- 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/config.js +0 -13
- package/dist/modern/frameworks/svelte/extractArgTypes.js +0 -119
- package/dist/modern/frameworks/svelte/extractComponentDescription.js +0 -10
- package/dist/modern/frameworks/svelte/prepareForInline.js +0 -17
- package/dist/modern/frameworks/svelte/preset.js +0 -11
- 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 -105
- 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 -3
- 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/ts3.4/frameworks/angular/compodoc.d.ts +0 -18
- package/dist/ts3.4/frameworks/angular/config.d.ts +0 -14
- 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/enhanceArgTypes.d.ts +0 -2
- 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 -10
- 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 -10
- 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 -9
- 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 -17
- 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 -2
- 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 -14
- 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/enhanceArgTypes.d.ts +0 -2
- 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 -10
- 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 -10
- 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 -9
- 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 -17
- 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 -2
- 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,195 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/es.array.reduce.js";
|
|
2
|
-
|
|
3
|
-
/* eslint no-underscore-dangle: ["error", { "allow": ["_vnode"] }] */
|
|
4
|
-
import { addons } from '@storybook/addons';
|
|
5
|
-
import { logger } from '@storybook/client-logger';
|
|
6
|
-
import { SourceType, SNIPPET_RENDERED } from '../../shared';
|
|
7
|
-
export const skipSourceRender = context => {
|
|
8
|
-
var _context$parameters$d;
|
|
9
|
-
|
|
10
|
-
const sourceParams = context === null || context === void 0 ? void 0 : (_context$parameters$d = context.parameters.docs) === null || _context$parameters$d === void 0 ? void 0 : _context$parameters$d.source;
|
|
11
|
-
const isArgsStory = context === null || context === void 0 ? void 0 : context.parameters.__isArgsStory; // always render if the user forces it
|
|
12
|
-
|
|
13
|
-
if ((sourceParams === null || sourceParams === void 0 ? void 0 : sourceParams.type) === SourceType.DYNAMIC) {
|
|
14
|
-
return false;
|
|
15
|
-
} // never render if the user is forcing the block to render code, or
|
|
16
|
-
// if the user provides code, or if it's not an args story.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return !isArgsStory || (sourceParams === null || sourceParams === void 0 ? void 0 : sourceParams.code) || (sourceParams === null || sourceParams === void 0 ? void 0 : sourceParams.type) === SourceType.CODE;
|
|
20
|
-
};
|
|
21
|
-
export const sourceDecorator = (storyFn, context) => {
|
|
22
|
-
const story = storyFn(); // See ../react/jsxDecorator.tsx
|
|
23
|
-
|
|
24
|
-
if (skipSourceRender(context)) {
|
|
25
|
-
return story;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const channel = addons.getChannel();
|
|
29
|
-
const storyComponent = getStoryComponent(story.options.STORYBOOK_WRAPS);
|
|
30
|
-
return {
|
|
31
|
-
components: {
|
|
32
|
-
Story: story
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
// We need to wait until the wrapper component to be mounted so Vue runtime
|
|
36
|
-
// struct VNode tree. We get `this._vnode == null` if switch to `created`
|
|
37
|
-
// lifecycle hook.
|
|
38
|
-
mounted() {
|
|
39
|
-
// Theoretically this does not happens but we need to check it.
|
|
40
|
-
if (!this._vnode) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const storyNode = lookupStoryInstance(this, storyComponent);
|
|
46
|
-
const code = vnodeToString(storyNode._vnode);
|
|
47
|
-
|
|
48
|
-
const emitFormattedTemplate = async () => {
|
|
49
|
-
const prettier = await import('prettier/standalone');
|
|
50
|
-
const prettierHtml = await import('prettier/parser-html');
|
|
51
|
-
channel.emit(SNIPPET_RENDERED, (context || {}).id, prettier.format(`<template>${code}</template>`, {
|
|
52
|
-
parser: 'vue',
|
|
53
|
-
plugins: [prettierHtml],
|
|
54
|
-
// Because the parsed vnode missing spaces right before/after the surround tag,
|
|
55
|
-
// we always get weird wrapped code without this option.
|
|
56
|
-
htmlWhitespaceSensitivity: 'ignore'
|
|
57
|
-
}));
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
emitFormattedTemplate();
|
|
61
|
-
} catch (e) {
|
|
62
|
-
logger.warn(`Failed to generate dynamic story source: ${e}`);
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
template: '<story />'
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
export function vnodeToString(vnode) {
|
|
70
|
-
var _vnode$data, _vnode$componentOptio, _vnode$data2;
|
|
71
|
-
|
|
72
|
-
const attrString = [...((_vnode$data = vnode.data) !== null && _vnode$data !== void 0 && _vnode$data.slot ? [['slot', vnode.data.slot]] : []), ['class', stringifyClassAttribute(vnode)], ...((_vnode$componentOptio = vnode.componentOptions) !== null && _vnode$componentOptio !== void 0 && _vnode$componentOptio.propsData ? Object.entries(vnode.componentOptions.propsData) : []), ...((_vnode$data2 = vnode.data) !== null && _vnode$data2 !== void 0 && _vnode$data2.attrs ? Object.entries(vnode.data.attrs) : [])].filter(([name], index, list) => list.findIndex(item => item[0] === name) === index).map(([name, value]) => stringifyAttr(name, value)).filter(Boolean).join(' ');
|
|
73
|
-
|
|
74
|
-
if (!vnode.componentOptions) {
|
|
75
|
-
// Non-component elements (div, span, etc...)
|
|
76
|
-
if (vnode.tag) {
|
|
77
|
-
if (!vnode.children) {
|
|
78
|
-
return `<${vnode.tag} ${attrString}/>`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return `<${vnode.tag} ${attrString}>${vnode.children.map(vnodeToString).join('')}</${vnode.tag}>`;
|
|
82
|
-
} // TextNode
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (vnode.text) {
|
|
86
|
-
if (/[<>"&]/.test(vnode.text)) {
|
|
87
|
-
return `{{\`${vnode.text.replace(/`/g, '\\`')}\`}}`;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return vnode.text;
|
|
91
|
-
} // Unknown
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return '';
|
|
95
|
-
} // Probably users never see the "unknown-component". It seems that vnode.tag
|
|
96
|
-
// is always set.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const tag = vnode.componentOptions.tag || vnode.tag || 'unknown-component';
|
|
100
|
-
|
|
101
|
-
if (!vnode.componentOptions.children) {
|
|
102
|
-
return `<${tag} ${attrString}/>`;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return `<${tag} ${attrString}>${vnode.componentOptions.children.map(vnodeToString).join('')}</${tag}>`;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function stringifyClassAttribute(vnode) {
|
|
109
|
-
var _vnode$data$staticCla, _vnode$data$staticCla2;
|
|
110
|
-
|
|
111
|
-
if (!vnode.data || !vnode.data.staticClass && !vnode.data.class) {
|
|
112
|
-
return undefined;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return [...((_vnode$data$staticCla = (_vnode$data$staticCla2 = vnode.data.staticClass) === null || _vnode$data$staticCla2 === void 0 ? void 0 : _vnode$data$staticCla2.split(' ')) !== null && _vnode$data$staticCla !== void 0 ? _vnode$data$staticCla : []), ...normalizeClassBinding(vnode.data.class)].filter(Boolean).join(' ') || undefined;
|
|
116
|
-
} // https://vuejs.org/v2/guide/class-and-style.html#Binding-HTML-Classes
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
function normalizeClassBinding(binding) {
|
|
120
|
-
if (!binding) {
|
|
121
|
-
return [];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (typeof binding === 'string') {
|
|
125
|
-
return [binding];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (binding instanceof Array) {
|
|
129
|
-
// To handle an object-in-array binding smartly, we use recursion
|
|
130
|
-
return binding.map(normalizeClassBinding).reduce((a, b) => [...a, ...b], []);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (typeof binding === 'object') {
|
|
134
|
-
return Object.entries(binding).filter(([, active]) => !!active).map(([className]) => className);
|
|
135
|
-
} // Unknown class binding
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return [];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function stringifyAttr(attrName, value) {
|
|
142
|
-
if (typeof value === 'undefined' || typeof value === 'function') {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (value === true) {
|
|
147
|
-
return attrName;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (typeof value === 'string') {
|
|
151
|
-
return `${attrName}=${quote(value)}`;
|
|
152
|
-
} // TODO: Better serialization (unquoted object key, Symbol/Classes, etc...)
|
|
153
|
-
// Seems like Prettier don't format JSON-look object (= when keys are quoted)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return `:${attrName}=${quote(JSON.stringify(value))}`;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function quote(value) {
|
|
160
|
-
return value.includes(`"`) && !value.includes(`'`) ? `'${value}'` : `"${value.replace(/"/g, '"')}"`;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Skip decorators and grab a story component itself.
|
|
164
|
-
* https://github.com/pocka/storybook-addon-vue-info/pull/113
|
|
165
|
-
*/
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
function getStoryComponent(w) {
|
|
169
|
-
let matched = w;
|
|
170
|
-
|
|
171
|
-
while (matched && matched.options && matched.options.components && matched.options.components.story && matched.options.components.story.options && matched.options.components.story.options.STORYBOOK_WRAPS) {
|
|
172
|
-
matched = matched.options.components.story.options.STORYBOOK_WRAPS;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return matched;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Find the story's instance from VNode tree.
|
|
180
|
-
*/
|
|
181
|
-
function lookupStoryInstance(instance, storyComponent) {
|
|
182
|
-
if (instance.$vnode && instance.$vnode.componentOptions && instance.$vnode.componentOptions.Ctor === storyComponent) {
|
|
183
|
-
return instance;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
for (let i = 0, l = instance.$children.length; i < l; i += 1) {
|
|
187
|
-
const found = lookupStoryInstance(instance.$children[i], storyComponent);
|
|
188
|
-
|
|
189
|
-
if (found) {
|
|
190
|
-
return found;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { extractArgTypes } from './extractArgTypes';
|
|
2
|
-
import { extractComponentDescription } from '../../lib/docgen';
|
|
3
|
-
import { prepareForInline } from './prepareForInline';
|
|
4
|
-
export const parameters = {
|
|
5
|
-
docs: {
|
|
6
|
-
inlineStories: true,
|
|
7
|
-
prepareForInline,
|
|
8
|
-
extractArgTypes,
|
|
9
|
-
extractComponentDescription
|
|
10
|
-
}
|
|
11
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { hasDocgen, extractComponentProps } from '../../lib/docgen';
|
|
2
|
-
import { convert } from '../../lib/convert';
|
|
3
|
-
const SECTIONS = ['props', 'events', 'slots'];
|
|
4
|
-
export const extractArgTypes = component => {
|
|
5
|
-
if (!hasDocgen(component)) {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const results = {};
|
|
10
|
-
SECTIONS.forEach(section => {
|
|
11
|
-
const props = extractComponentProps(component, section);
|
|
12
|
-
props.forEach(({
|
|
13
|
-
propDef,
|
|
14
|
-
docgenInfo,
|
|
15
|
-
jsDocTags
|
|
16
|
-
}) => {
|
|
17
|
-
const {
|
|
18
|
-
name,
|
|
19
|
-
type,
|
|
20
|
-
description,
|
|
21
|
-
defaultValue: defaultSummary,
|
|
22
|
-
required
|
|
23
|
-
} = propDef;
|
|
24
|
-
const sbType = section === 'props' ? convert(docgenInfo) : {
|
|
25
|
-
name: 'void'
|
|
26
|
-
};
|
|
27
|
-
results[name] = {
|
|
28
|
-
name,
|
|
29
|
-
description,
|
|
30
|
-
type: Object.assign({
|
|
31
|
-
required
|
|
32
|
-
}, sbType),
|
|
33
|
-
table: {
|
|
34
|
-
type,
|
|
35
|
-
jsDocTags,
|
|
36
|
-
defaultValue: defaultSummary,
|
|
37
|
-
category: section
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
return results;
|
|
43
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import * as Vue from 'vue';
|
|
3
|
-
import { app } from '@storybook/vue3'; // This is cast as `any` to workaround type errors caused by Vue 2 types
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
render,
|
|
7
|
-
h
|
|
8
|
-
} = Vue;
|
|
9
|
-
export const prepareForInline = (storyFn, {
|
|
10
|
-
args
|
|
11
|
-
}) => {
|
|
12
|
-
const component = storyFn();
|
|
13
|
-
const vnode = h(component, args); // By attaching the app context from `@storybook/vue3` to the vnode
|
|
14
|
-
// like this, these stoeis are able to access any app config stuff
|
|
15
|
-
// the end-user set inside `.storybook/preview.js`
|
|
16
|
-
|
|
17
|
-
vnode.appContext = app._context; // eslint-disable-line no-underscore-dangle
|
|
18
|
-
|
|
19
|
-
return /*#__PURE__*/React.createElement('div', {
|
|
20
|
-
ref: node => node ? render(vnode, node) : null
|
|
21
|
-
});
|
|
22
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function webpackFinal(webpackConfig = {}, options) {
|
|
2
|
-
var _options$presetsList;
|
|
3
|
-
|
|
4
|
-
let vueDocgenOptions = {};
|
|
5
|
-
(_options$presetsList = options.presetsList) === null || _options$presetsList === void 0 ? void 0 : _options$presetsList.forEach(preset => {
|
|
6
|
-
if (preset.name.includes('addon-docs') && preset.options.vueDocgenOptions) {
|
|
7
|
-
const appendableOptions = preset.options.vueDocgenOptions;
|
|
8
|
-
vueDocgenOptions = Object.assign({}, vueDocgenOptions, appendableOptions);
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
webpackConfig.module.rules.push({
|
|
12
|
-
test: /\.vue$/,
|
|
13
|
-
loader: require.resolve('vue-docgen-loader', {
|
|
14
|
-
paths: [require.resolve('@storybook/vue3')]
|
|
15
|
-
}),
|
|
16
|
-
enforce: 'post',
|
|
17
|
-
options: {
|
|
18
|
-
docgenOptions: Object.assign({
|
|
19
|
-
alias: webpackConfig.resolve.alias
|
|
20
|
-
}, vueDocgenOptions)
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return webpackConfig;
|
|
24
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { extractArgTypes, extractComponentDescription } from './custom-elements';
|
|
2
|
-
import { sourceDecorator } from './sourceDecorator';
|
|
3
|
-
import { prepareForInline } from './prepareForInline';
|
|
4
|
-
import { SourceType } from '../../shared';
|
|
5
|
-
export const decorators = [sourceDecorator];
|
|
6
|
-
export const parameters = {
|
|
7
|
-
docs: {
|
|
8
|
-
extractArgTypes,
|
|
9
|
-
extractComponentDescription,
|
|
10
|
-
inlineStories: true,
|
|
11
|
-
prepareForInline,
|
|
12
|
-
source: {
|
|
13
|
-
type: SourceType.DYNAMIC,
|
|
14
|
-
language: 'html'
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/es.array.reduce.js";
|
|
2
|
-
import { getCustomElements, isValidComponent, isValidMetaData } from '@storybook/web-components';
|
|
3
|
-
import { logger } from '@storybook/client-logger';
|
|
4
|
-
|
|
5
|
-
function mapData(data, category) {
|
|
6
|
-
return data && data.filter(item => item && item.name).reduce((acc, item) => {
|
|
7
|
-
if (item.kind === 'method') return acc;
|
|
8
|
-
|
|
9
|
-
switch (category) {
|
|
10
|
-
case 'events':
|
|
11
|
-
mapEvent(item).forEach(argType => {
|
|
12
|
-
acc[argType.name] = argType;
|
|
13
|
-
});
|
|
14
|
-
break;
|
|
15
|
-
|
|
16
|
-
default:
|
|
17
|
-
acc[item.name] = mapItem(item, category);
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return acc;
|
|
22
|
-
}, {});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function mapItem(item, category) {
|
|
26
|
-
var _item$type, _item$type2;
|
|
27
|
-
|
|
28
|
-
const type = category === 'properties' ? {
|
|
29
|
-
name: ((_item$type = item.type) === null || _item$type === void 0 ? void 0 : _item$type.text) || item.type
|
|
30
|
-
} : {
|
|
31
|
-
name: 'void'
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
34
|
-
name: item.name,
|
|
35
|
-
required: false,
|
|
36
|
-
description: item.description,
|
|
37
|
-
type,
|
|
38
|
-
table: {
|
|
39
|
-
category,
|
|
40
|
-
type: {
|
|
41
|
-
summary: ((_item$type2 = item.type) === null || _item$type2 === void 0 ? void 0 : _item$type2.text) || item.type
|
|
42
|
-
},
|
|
43
|
-
defaultValue: {
|
|
44
|
-
summary: item.default !== undefined ? item.default : item.defaultValue
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function mapEvent(item) {
|
|
51
|
-
let name = item.name.replace(/(-|_|:|\.|\s)+(.)?/g, (_match, _separator, chr) => {
|
|
52
|
-
return chr ? chr.toUpperCase() : '';
|
|
53
|
-
}).replace(/^([A-Z])/, match => match.toLowerCase());
|
|
54
|
-
name = `on${name.charAt(0).toUpperCase() + name.substr(1)}`;
|
|
55
|
-
return [{
|
|
56
|
-
name,
|
|
57
|
-
action: {
|
|
58
|
-
name: item.name
|
|
59
|
-
},
|
|
60
|
-
table: {
|
|
61
|
-
disable: true
|
|
62
|
-
}
|
|
63
|
-
}, mapItem(item, 'events')];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const getMetaDataExperimental = (tagName, customElements) => {
|
|
67
|
-
if (!isValidComponent(tagName) || !isValidMetaData(customElements)) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const metaData = customElements.tags.find(tag => tag.name.toUpperCase() === tagName.toUpperCase());
|
|
72
|
-
|
|
73
|
-
if (!metaData) {
|
|
74
|
-
logger.warn(`Component not found in custom-elements.json: ${tagName}`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return metaData;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const getMetaDataV1 = (tagName, customElements) => {
|
|
81
|
-
var _customElements$modul;
|
|
82
|
-
|
|
83
|
-
if (!isValidComponent(tagName) || !isValidMetaData(customElements)) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
let metadata;
|
|
88
|
-
customElements === null || customElements === void 0 ? void 0 : (_customElements$modul = customElements.modules) === null || _customElements$modul === void 0 ? void 0 : _customElements$modul.forEach(_module => {
|
|
89
|
-
var _module$declarations;
|
|
90
|
-
|
|
91
|
-
_module === null || _module === void 0 ? void 0 : (_module$declarations = _module.declarations) === null || _module$declarations === void 0 ? void 0 : _module$declarations.forEach(declaration => {
|
|
92
|
-
if (declaration.tagName === tagName) {
|
|
93
|
-
metadata = declaration;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
if (!metadata) {
|
|
99
|
-
logger.warn(`Component not found in custom-elements.json: ${tagName}`);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return metadata;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const extractArgTypesFromElements = (tagName, customElements) => {
|
|
106
|
-
const metaData = getMetaData(tagName, customElements);
|
|
107
|
-
return metaData && Object.assign({}, mapData(metaData.attributes, 'attributes'), mapData(metaData.members, 'properties'), mapData(metaData.properties, 'properties'), mapData(metaData.events, 'events'), mapData(metaData.slots, 'slots'), mapData(metaData.cssProperties, 'css custom properties'), mapData(metaData.cssParts, 'css shadow parts'));
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const getMetaData = (tagName, manifest) => {
|
|
111
|
-
if ((manifest === null || manifest === void 0 ? void 0 : manifest.version) === 'experimental') {
|
|
112
|
-
return getMetaDataExperimental(tagName, manifest);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return getMetaDataV1(tagName, manifest);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export const extractArgTypes = tagName => {
|
|
119
|
-
const cem = getCustomElements();
|
|
120
|
-
return extractArgTypesFromElements(tagName, cem);
|
|
121
|
-
};
|
|
122
|
-
export const extractComponentDescription = tagName => {
|
|
123
|
-
const metaData = getMetaData(tagName, getCustomElements());
|
|
124
|
-
return metaData && metaData.description;
|
|
125
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from 'lit-html';
|
|
3
|
-
export const prepareForInline = storyFn => {
|
|
4
|
-
class Story extends React.Component {
|
|
5
|
-
constructor(...args) {
|
|
6
|
-
super(...args);
|
|
7
|
-
this.wrapperRef = /*#__PURE__*/React.createRef();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
componentDidMount() {
|
|
11
|
-
render(storyFn(), this.wrapperRef.current);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
render() {
|
|
15
|
-
return /*#__PURE__*/React.createElement('div', {
|
|
16
|
-
ref: this.wrapperRef
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return /*#__PURE__*/React.createElement(Story);
|
|
23
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/* global window */
|
|
2
|
-
import { render } from 'lit-html';
|
|
3
|
-
import { addons, useEffect } from '@storybook/addons';
|
|
4
|
-
import { SNIPPET_RENDERED, SourceType } from '../../shared';
|
|
5
|
-
|
|
6
|
-
function skipSourceRender(context) {
|
|
7
|
-
var _context$parameters$d;
|
|
8
|
-
|
|
9
|
-
const sourceParams = context === null || context === void 0 ? void 0 : (_context$parameters$d = context.parameters.docs) === null || _context$parameters$d === void 0 ? void 0 : _context$parameters$d.source;
|
|
10
|
-
const isArgsStory = context === null || context === void 0 ? void 0 : context.parameters.__isArgsStory; // always render if the user forces it
|
|
11
|
-
|
|
12
|
-
if ((sourceParams === null || sourceParams === void 0 ? void 0 : sourceParams.type) === SourceType.DYNAMIC) {
|
|
13
|
-
return false;
|
|
14
|
-
} // never render if the user is forcing the block to render code, or
|
|
15
|
-
// if the user provides code, or if it's not an args story.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return !isArgsStory || (sourceParams === null || sourceParams === void 0 ? void 0 : sourceParams.code) || (sourceParams === null || sourceParams === void 0 ? void 0 : sourceParams.type) === SourceType.CODE;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function applyTransformSource(source, context) {
|
|
22
|
-
var _context$parameters$d2;
|
|
23
|
-
|
|
24
|
-
const {
|
|
25
|
-
transformSource
|
|
26
|
-
} = (_context$parameters$d2 = context.parameters.docs) !== null && _context$parameters$d2 !== void 0 ? _context$parameters$d2 : {};
|
|
27
|
-
if (typeof transformSource !== 'function') return source;
|
|
28
|
-
return transformSource(source, context);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function sourceDecorator(storyFn, context) {
|
|
32
|
-
var _context$parameters$d3, _context$parameters$d4;
|
|
33
|
-
|
|
34
|
-
const story = context !== null && context !== void 0 && (_context$parameters$d3 = context.parameters.docs) !== null && _context$parameters$d3 !== void 0 && (_context$parameters$d4 = _context$parameters$d3.source) !== null && _context$parameters$d4 !== void 0 && _context$parameters$d4.excludeDecorators ? context.originalStoryFn(context.args, context) : storyFn();
|
|
35
|
-
let source;
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (source) addons.getChannel().emit(SNIPPET_RENDERED, context.id, source);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
if (!skipSourceRender(context)) {
|
|
41
|
-
const container = window.document.createElement('div');
|
|
42
|
-
render(story, container);
|
|
43
|
-
source = applyTransformSource(container.innerHTML.replace(/<!---->/g, ''), context);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return story;
|
|
47
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-case-declarations */
|
|
2
|
-
const isLiteral = type => type.name === 'literal';
|
|
3
|
-
|
|
4
|
-
const toEnumOption = element => element.value.replace(/['|"]/g, '');
|
|
5
|
-
|
|
6
|
-
const convertSig = type => {
|
|
7
|
-
switch (type.type) {
|
|
8
|
-
case 'function':
|
|
9
|
-
return {
|
|
10
|
-
name: 'function'
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
case 'object':
|
|
14
|
-
const values = {};
|
|
15
|
-
type.signature.properties.forEach(prop => {
|
|
16
|
-
values[prop.key] = convert(prop.value);
|
|
17
|
-
});
|
|
18
|
-
return {
|
|
19
|
-
name: 'object',
|
|
20
|
-
value: values
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
default:
|
|
24
|
-
throw new Error(`Unknown: ${type}`);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const convert = type => {
|
|
29
|
-
const {
|
|
30
|
-
name,
|
|
31
|
-
raw
|
|
32
|
-
} = type;
|
|
33
|
-
const base = {};
|
|
34
|
-
if (typeof raw !== 'undefined') base.raw = raw;
|
|
35
|
-
|
|
36
|
-
switch (type.name) {
|
|
37
|
-
case 'literal':
|
|
38
|
-
return Object.assign({}, base, {
|
|
39
|
-
name: 'other',
|
|
40
|
-
value: type.value
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
case 'string':
|
|
44
|
-
case 'number':
|
|
45
|
-
case 'symbol':
|
|
46
|
-
case 'boolean':
|
|
47
|
-
{
|
|
48
|
-
return Object.assign({}, base, {
|
|
49
|
-
name
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
case 'Array':
|
|
54
|
-
{
|
|
55
|
-
return Object.assign({}, base, {
|
|
56
|
-
name: 'array',
|
|
57
|
-
value: type.elements.map(convert)
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
case 'signature':
|
|
62
|
-
return Object.assign({}, base, convertSig(type));
|
|
63
|
-
|
|
64
|
-
case 'union':
|
|
65
|
-
if (type.elements.every(isLiteral)) {
|
|
66
|
-
return Object.assign({}, base, {
|
|
67
|
-
name: 'enum',
|
|
68
|
-
value: type.elements.map(toEnumOption)
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return Object.assign({}, base, {
|
|
73
|
-
name,
|
|
74
|
-
value: type.elements.map(convert)
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
case 'intersection':
|
|
78
|
-
return Object.assign({}, base, {
|
|
79
|
-
name,
|
|
80
|
-
value: type.elements.map(convert)
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
default:
|
|
84
|
-
return Object.assign({}, base, {
|
|
85
|
-
name: 'other',
|
|
86
|
-
value: name
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
};
|
|
File without changes
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { convert as tsConvert } from './typescript';
|
|
2
|
-
import { convert as flowConvert } from './flow';
|
|
3
|
-
import { convert as propTypesConvert } from './proptypes';
|
|
4
|
-
export const convert = docgenInfo => {
|
|
5
|
-
const {
|
|
6
|
-
type,
|
|
7
|
-
tsType,
|
|
8
|
-
flowType
|
|
9
|
-
} = docgenInfo;
|
|
10
|
-
if (type != null) return propTypesConvert(type);
|
|
11
|
-
if (tsType != null) return tsConvert(tsType);
|
|
12
|
-
if (flowType != null) return flowConvert(flowType);
|
|
13
|
-
return null;
|
|
14
|
-
};
|