@storybook/addon-docs 6.5.0-alpha.5 → 6.5.0-alpha.52
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 +13 -9
- 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 +17 -9
- package/dist/cjs/blocks/useStory.js +8 -6
- package/dist/cjs/blocks/utils.js +3 -3
- package/dist/cjs/frameworks/common/config.js +8 -12
- package/dist/cjs/frameworks/common/preset.js +167 -112
- package/dist/cjs/index.js +2 -0
- package/dist/esm/blocks/ArgsTable.js +5 -3
- 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 +15 -8
- package/dist/esm/blocks/useStory.js +15 -15
- package/dist/esm/blocks/utils.js +1 -1
- package/dist/esm/frameworks/common/config.js +2 -4
- package/dist/esm/frameworks/common/preset.js +161 -110
- 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 +12 -7
- package/dist/modern/frameworks/common/config.js +1 -3
- package/dist/modern/frameworks/common/preset.js +23 -17
- package/dist/ts3.4/blocks/Source.d.ts +5 -3
- package/dist/ts3.4/blocks/SourceContainer.d.ts +5 -1
- package/dist/ts3.4/frameworks/common/config.d.ts +0 -2
- package/dist/ts3.4/frameworks/common/preset.d.ts +11 -1
- 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/frameworks/common/config.d.ts +0 -2
- package/dist/ts3.9/frameworks/common/preset.d.ts +11 -1
- package/ember/index.js +6 -1
- package/jest-transform-mdx.js +2 -5
- package/mdx-compiler-plugin.js +1 -1
- package/package.json +23 -107
- package/preset.js +14 -14
- package/register.js +1 -0
- 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/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/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/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/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 -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/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 -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
|
@@ -31,7 +31,10 @@ const getStorySource = (storyId, sourceContext) => {
|
|
|
31
31
|
} = sourceContext; // source rendering is async so source is unavailable at the start of the render cycle,
|
|
32
32
|
// so we fail gracefully here without warning
|
|
33
33
|
|
|
34
|
-
return (sources === null || sources === void 0 ? void 0 : sources[storyId]) ||
|
|
34
|
+
return (sources === null || sources === void 0 ? void 0 : sources[storyId]) || {
|
|
35
|
+
code: '',
|
|
36
|
+
format: false
|
|
37
|
+
};
|
|
35
38
|
};
|
|
36
39
|
|
|
37
40
|
const getSnippet = (snippet, story) => {
|
|
@@ -86,6 +89,10 @@ export const getSourceProps = (props, docsContext, sourceContext) => {
|
|
|
86
89
|
const multiProps = props;
|
|
87
90
|
let source = codeProps.code; // prefer user-specified code
|
|
88
91
|
|
|
92
|
+
let {
|
|
93
|
+
format
|
|
94
|
+
} = codeProps; // prefer user-specified code
|
|
95
|
+
|
|
89
96
|
const targetIds = multiProps.ids || [singleProps.id || currentId];
|
|
90
97
|
const storyIds = targetIds.map(targetId => targetId === CURRENT_SELECTION ? currentId : targetId);
|
|
91
98
|
const stories = useStories(storyIds, docsContext);
|
|
@@ -98,8 +105,15 @@ export const getSourceProps = (props, docsContext, sourceContext) => {
|
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
if (!source) {
|
|
108
|
+
// just take the format from the first story, given how they're all concatinated together...
|
|
109
|
+
// TODO: we should consider sending an event with all the sources separately, instead of concatenating them here
|
|
110
|
+
({
|
|
111
|
+
format
|
|
112
|
+
} = getStorySource(storyIds[0], sourceContext));
|
|
101
113
|
source = storyIds.map((storyId, idx) => {
|
|
102
|
-
const
|
|
114
|
+
const {
|
|
115
|
+
code: storySource
|
|
116
|
+
} = getStorySource(storyId, sourceContext);
|
|
103
117
|
const storyObj = stories[idx];
|
|
104
118
|
return getSnippet(storySource, storyObj);
|
|
105
119
|
}).join('\n\n');
|
|
@@ -118,6 +132,7 @@ export const getSourceProps = (props, docsContext, sourceContext) => {
|
|
|
118
132
|
return source ? {
|
|
119
133
|
code: source,
|
|
120
134
|
state,
|
|
135
|
+
format,
|
|
121
136
|
language: props.language || docsLanguage || 'jsx',
|
|
122
137
|
dark: props.dark || false
|
|
123
138
|
} : {
|
|
@@ -11,25 +11,31 @@ export const SourceContainer = ({
|
|
|
11
11
|
const [sources, setSources] = useState({});
|
|
12
12
|
const channel = addons.getChannel();
|
|
13
13
|
useEffect(() => {
|
|
14
|
-
const handleSnippetRendered = (id,
|
|
15
|
-
if
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
14
|
+
const handleSnippetRendered = (id, newSource, format = false) => {
|
|
15
|
+
// optimization: if the source is the same, ignore the incoming event
|
|
16
|
+
if (sources[id] && sources[id].code === newSource) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
setSources(current => {
|
|
21
|
+
const newSources = Object.assign({}, current, {
|
|
22
|
+
[id]: {
|
|
23
|
+
code: newSource,
|
|
24
|
+
format
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
return current;
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
if (!deepEqual(current, newSources)) {
|
|
29
|
+
return newSources;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return current;
|
|
33
|
+
});
|
|
28
34
|
};
|
|
29
35
|
|
|
30
36
|
channel.on(SNIPPET_RENDERED, handleSnippetRendered);
|
|
31
37
|
return () => channel.off(SNIPPET_RENDERED, handleSnippetRendered);
|
|
32
|
-
});
|
|
38
|
+
}, []);
|
|
33
39
|
return /*#__PURE__*/React.createElement(SourceContext.Provider, {
|
|
34
40
|
value: {
|
|
35
41
|
sources
|
|
@@ -12,6 +12,11 @@ export const Stories = ({
|
|
|
12
12
|
componentStories
|
|
13
13
|
} = useContext(DocsContext);
|
|
14
14
|
let stories = componentStories();
|
|
15
|
+
stories = stories.filter(story => {
|
|
16
|
+
var _story$parameters, _story$parameters$doc;
|
|
17
|
+
|
|
18
|
+
return !((_story$parameters = story.parameters) !== null && _story$parameters !== void 0 && (_story$parameters$doc = _story$parameters.docs) !== null && _story$parameters$doc !== void 0 && _story$parameters$doc.disable);
|
|
19
|
+
});
|
|
15
20
|
if (!includePrimary) stories = stories.slice(1);
|
|
16
21
|
|
|
17
22
|
if (!stories || stories.length === 0) {
|
|
@@ -95,30 +95,8 @@ const Story = props => {
|
|
|
95
95
|
let cleanup;
|
|
96
96
|
|
|
97
97
|
if (story && storyRef.current) {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
id,
|
|
101
|
-
title,
|
|
102
|
-
name
|
|
103
|
-
} = story;
|
|
104
|
-
const renderContext = {
|
|
105
|
-
componentId,
|
|
106
|
-
title,
|
|
107
|
-
kind: title,
|
|
108
|
-
id,
|
|
109
|
-
name,
|
|
110
|
-
story: name,
|
|
111
|
-
// TODO what to do when these fail?
|
|
112
|
-
showMain: () => {},
|
|
113
|
-
showError: () => {},
|
|
114
|
-
showException: () => {}
|
|
115
|
-
};
|
|
116
|
-
cleanup = context.renderStoryToElement({
|
|
117
|
-
story,
|
|
118
|
-
renderContext,
|
|
119
|
-
element: storyRef.current,
|
|
120
|
-
viewMode: 'docs'
|
|
121
|
-
});
|
|
98
|
+
const element = storyRef.current;
|
|
99
|
+
cleanup = context.renderStoryToElement(story, element);
|
|
122
100
|
setShowLoader(false);
|
|
123
101
|
}
|
|
124
102
|
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
const _excluded = ["children"],
|
|
2
|
+
_excluded2 = ["className", "children"],
|
|
3
|
+
_excluded3 = ["href", "target", "children"],
|
|
4
|
+
_excluded4 = ["as", "id", "children"],
|
|
5
|
+
_excluded5 = ["as", "id", "children"];
|
|
1
6
|
import "core-js/modules/es.array.reduce.js";
|
|
2
7
|
|
|
3
8
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -27,19 +32,19 @@ export const AddContext = props => {
|
|
|
27
32
|
const {
|
|
28
33
|
children
|
|
29
34
|
} = props,
|
|
30
|
-
rest = _objectWithoutPropertiesLoose(props,
|
|
35
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
36
|
|
|
32
37
|
const parentContext = React.useContext(DocsContext);
|
|
33
38
|
return /*#__PURE__*/React.createElement(DocsContext.Provider, {
|
|
34
39
|
value: Object.assign({}, parentContext, rest)
|
|
35
40
|
}, children);
|
|
36
41
|
};
|
|
37
|
-
export const CodeOrSourceMdx =
|
|
42
|
+
export const CodeOrSourceMdx = _ref => {
|
|
38
43
|
let {
|
|
39
44
|
className,
|
|
40
45
|
children
|
|
41
46
|
} = _ref,
|
|
42
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
47
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
43
48
|
|
|
44
49
|
// markdown-to-jsx does not add className to inline code
|
|
45
50
|
if (typeof className !== 'string' && (typeof children !== 'string' || !children.match(/[\n\r]/g))) {
|
|
@@ -84,7 +89,7 @@ export const AnchorMdx = props => {
|
|
|
84
89
|
target,
|
|
85
90
|
children
|
|
86
91
|
} = props,
|
|
87
|
-
rest = _objectWithoutPropertiesLoose(props,
|
|
92
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded3);
|
|
88
93
|
|
|
89
94
|
if (href) {
|
|
90
95
|
// Enable scrolling for in-page anchors.
|
|
@@ -132,13 +137,13 @@ const OcticonAnchor = styled.a(() => ({
|
|
|
132
137
|
color: 'inherit'
|
|
133
138
|
}));
|
|
134
139
|
|
|
135
|
-
const HeaderWithOcticonAnchor =
|
|
140
|
+
const HeaderWithOcticonAnchor = _ref2 => {
|
|
136
141
|
let {
|
|
137
142
|
as,
|
|
138
143
|
id,
|
|
139
144
|
children
|
|
140
145
|
} = _ref2,
|
|
141
|
-
rest = _objectWithoutPropertiesLoose(_ref2,
|
|
146
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded4);
|
|
142
147
|
|
|
143
148
|
// @ts-ignore
|
|
144
149
|
const OcticonHeader = OcticonHeaders[as];
|
|
@@ -176,7 +181,7 @@ export const HeaderMdx = props => {
|
|
|
176
181
|
id,
|
|
177
182
|
children
|
|
178
183
|
} = props,
|
|
179
|
-
rest = _objectWithoutPropertiesLoose(props,
|
|
184
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded5); // An id should have been added on every header by the "remark-slug" plugin.
|
|
180
185
|
|
|
181
186
|
|
|
182
187
|
if (id) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { enhanceArgTypes } from './enhanceArgTypes';
|
|
2
1
|
export const parameters = {
|
|
3
2
|
docs: {
|
|
4
3
|
inlineStories: false,
|
|
@@ -6,5 +5,4 @@ export const parameters = {
|
|
|
6
5
|
getPage: async () => (await import('../../blocks')).DocsPage,
|
|
7
6
|
iframeHeight: 100
|
|
8
7
|
}
|
|
9
|
-
};
|
|
10
|
-
export const argTypesEnhancers = [enhanceArgTypes];
|
|
8
|
+
};
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import remarkSlug from 'remark-slug';
|
|
3
|
-
import remarkExternalLinks from 'remark-external-links';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const resolvedBabelLoader = require.resolve('babel-loader', {
|
|
8
|
-
paths: [require.resolve('@storybook/builder-webpack4')] // FIXME!!!
|
|
9
|
-
|
|
10
|
-
}); // for frameworks that are not working with react, we need to configure
|
|
3
|
+
import remarkExternalLinks from 'remark-external-links';
|
|
4
|
+
import global from 'global';
|
|
5
|
+
import { logger } from '@storybook/node-logger'; // for frameworks that are not working with react, we need to configure
|
|
11
6
|
// the jsx to transpile mdx, for now there will be a flag for that
|
|
12
7
|
// for more complex solutions we can find alone that we need to add '@babel/plugin-transform-react-jsx'
|
|
13
8
|
|
|
14
|
-
|
|
15
9
|
function createBabelOptions({
|
|
16
10
|
babelOptions,
|
|
17
11
|
mdxBabelOptions,
|
|
@@ -32,7 +26,18 @@ function createBabelOptions({
|
|
|
32
26
|
});
|
|
33
27
|
}
|
|
34
28
|
|
|
35
|
-
export function webpack(webpackConfig = {}, options
|
|
29
|
+
export async function webpack(webpackConfig = {}, options) {
|
|
30
|
+
var _global$FEATURES, _global$FEATURES2;
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
builder = 'webpack4'
|
|
34
|
+
} = await options.presets.apply('core', {});
|
|
35
|
+
const builderName = typeof builder === 'string' ? builder : builder.name;
|
|
36
|
+
|
|
37
|
+
const resolvedBabelLoader = require.resolve('babel-loader', {
|
|
38
|
+
paths: builderName.match(/^webpack(4|5)$/) ? [require.resolve(`@storybook/builder-${builderName}`)] : [builderName]
|
|
39
|
+
});
|
|
40
|
+
|
|
36
41
|
const {
|
|
37
42
|
module = {}
|
|
38
43
|
} = webpackConfig; // it will reuse babel options that are already in use in storybook
|
|
@@ -48,8 +53,12 @@ export function webpack(webpackConfig = {}, options = {}) {
|
|
|
48
53
|
transcludeMarkdown = false
|
|
49
54
|
} = options;
|
|
50
55
|
const mdxLoaderOptions = {
|
|
56
|
+
skipCsf: true,
|
|
51
57
|
remarkPlugins: [remarkSlug, remarkExternalLinks]
|
|
52
|
-
};
|
|
58
|
+
};
|
|
59
|
+
const mdxVersion = (_global$FEATURES = global.FEATURES) !== null && _global$FEATURES !== void 0 && _global$FEATURES.previewMdx2 ? 'MDX2' : 'MDX1';
|
|
60
|
+
logger.info(`Addon-docs: using ${mdxVersion}`);
|
|
61
|
+
const mdxLoader = (_global$FEATURES2 = global.FEATURES) !== null && _global$FEATURES2 !== void 0 && _global$FEATURES2.previewMdx2 ? require.resolve('@storybook/mdx2-csf/loader') : require.resolve('@storybook/mdx1-csf/loader'); // set `sourceLoaderOptions` to `null` to disable for manual configuration
|
|
53
62
|
|
|
54
63
|
const sourceLoader = sourceLoaderOptions ? [{
|
|
55
64
|
test: /\.(stories|story)\.[tj]sx?$/,
|
|
@@ -76,7 +85,7 @@ export function webpack(webpackConfig = {}, options = {}) {
|
|
|
76
85
|
configureJSX
|
|
77
86
|
})
|
|
78
87
|
}, {
|
|
79
|
-
loader:
|
|
88
|
+
loader: mdxLoader,
|
|
80
89
|
options: mdxLoaderOptions
|
|
81
90
|
}]
|
|
82
91
|
}];
|
|
@@ -105,10 +114,7 @@ export function webpack(webpackConfig = {}, options = {}) {
|
|
|
105
114
|
configureJSX
|
|
106
115
|
})
|
|
107
116
|
}, {
|
|
108
|
-
loader:
|
|
109
|
-
options: Object.assign({
|
|
110
|
-
compilers: [createCompiler(options)]
|
|
111
|
-
}, mdxLoaderOptions)
|
|
117
|
+
loader: mdxLoader
|
|
112
118
|
}]
|
|
113
119
|
}, {
|
|
114
120
|
test: /\.mdx$/,
|
|
@@ -121,7 +127,7 @@ export function webpack(webpackConfig = {}, options = {}) {
|
|
|
121
127
|
configureJSX
|
|
122
128
|
})
|
|
123
129
|
}, {
|
|
124
|
-
loader:
|
|
130
|
+
loader: mdxLoader,
|
|
125
131
|
options: mdxLoaderOptions
|
|
126
132
|
}]
|
|
127
133
|
}, ...sourceLoader]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentProps, FC } from 'react';
|
|
2
|
+
import { Source as PureSource } from '@storybook/components';
|
|
3
3
|
import { DocsContextProps } from './DocsContext';
|
|
4
4
|
import { SourceContextProps } from './SourceContainer';
|
|
5
5
|
export declare enum SourceState {
|
|
@@ -10,6 +10,7 @@ export declare enum SourceState {
|
|
|
10
10
|
interface CommonProps {
|
|
11
11
|
language?: string;
|
|
12
12
|
dark?: boolean;
|
|
13
|
+
format?: PureSourceProps['format'];
|
|
13
14
|
code?: string;
|
|
14
15
|
}
|
|
15
16
|
declare type SingleSourceProps = {
|
|
@@ -26,11 +27,12 @@ declare type SourceProps = SingleSourceProps | MultiSourceProps | CodeProps | No
|
|
|
26
27
|
declare type SourceStateProps = {
|
|
27
28
|
state: SourceState;
|
|
28
29
|
};
|
|
30
|
+
declare type PureSourceProps = ComponentProps<typeof PureSource>;
|
|
29
31
|
export declare const getSourceProps: (props: SourceProps, docsContext: DocsContextProps<any>, sourceContext: SourceContextProps) => PureSourceProps & SourceStateProps;
|
|
30
32
|
/**
|
|
31
33
|
* Story source doc block renders source code if provided,
|
|
32
34
|
* or the source for a story if `storyId` is provided, or
|
|
33
35
|
* the source for the current story if nothing is provided.
|
|
34
36
|
*/
|
|
35
|
-
export declare const Source: FC<
|
|
37
|
+
export declare const Source: FC<PureSourceProps>;
|
|
36
38
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { FC, Context } from 'react';
|
|
2
|
+
import { SyntaxHighlighterFormatTypes } from '@storybook/components';
|
|
2
3
|
import { StoryId } from '@storybook/api';
|
|
3
|
-
export
|
|
4
|
+
export interface SourceItem {
|
|
5
|
+
code: string;
|
|
6
|
+
format: SyntaxHighlighterFormatTypes;
|
|
7
|
+
}
|
|
4
8
|
export declare type StorySources = Record<StoryId, SourceItem>;
|
|
5
9
|
export interface SourceContextProps {
|
|
6
10
|
sources: StorySources;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const parameters: {
|
|
3
2
|
docs: {
|
|
4
3
|
inlineStories: boolean;
|
|
@@ -7,4 +6,3 @@ export declare const parameters: {
|
|
|
7
6
|
iframeHeight: number;
|
|
8
7
|
};
|
|
9
8
|
};
|
|
10
|
-
export declare const argTypesEnhancers: (<TFramework extends import("@storybook/csf").AnyFramework>(context: import("@storybook/csf").StoryContextForEnhancers<TFramework, import("@storybook/csf").Args>) => import("@storybook/csf").StrictArgTypes<import("@storybook/csf").Args> | import("@storybook/addons").Parameters)[];
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { Options } from '@storybook/core-common';
|
|
2
|
+
declare type BabelParams = {
|
|
3
|
+
babelOptions?: any;
|
|
4
|
+
mdxBabelOptions?: any;
|
|
5
|
+
configureJSX?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function webpack(webpackConfig: any, options: Options & BabelParams & {
|
|
8
|
+
sourceLoaderOptions: any;
|
|
9
|
+
transcludeMarkdown: boolean;
|
|
10
|
+
}): Promise<any>;
|
|
11
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from 'react';
|
|
2
|
-
import { DocsContextProps } from '@storybook/preview-web';
|
|
3
|
-
import { AnyFramework } from '@storybook/csf';
|
|
2
|
+
import type { DocsContextProps } from '@storybook/preview-web';
|
|
3
|
+
import type { AnyFramework } from '@storybook/csf';
|
|
4
4
|
export type { DocsContextProps };
|
|
5
5
|
export declare const DocsContext: Context<DocsContextProps<AnyFramework>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentProps, FC } from 'react';
|
|
2
|
+
import { Source as PureSource } from '@storybook/components';
|
|
3
3
|
import { DocsContextProps } from './DocsContext';
|
|
4
4
|
import { SourceContextProps } from './SourceContainer';
|
|
5
5
|
export declare enum SourceState {
|
|
@@ -10,6 +10,7 @@ export declare enum SourceState {
|
|
|
10
10
|
interface CommonProps {
|
|
11
11
|
language?: string;
|
|
12
12
|
dark?: boolean;
|
|
13
|
+
format?: PureSourceProps['format'];
|
|
13
14
|
code?: string;
|
|
14
15
|
}
|
|
15
16
|
declare type SingleSourceProps = {
|
|
@@ -26,11 +27,12 @@ declare type SourceProps = SingleSourceProps | MultiSourceProps | CodeProps | No
|
|
|
26
27
|
declare type SourceStateProps = {
|
|
27
28
|
state: SourceState;
|
|
28
29
|
};
|
|
30
|
+
declare type PureSourceProps = ComponentProps<typeof PureSource>;
|
|
29
31
|
export declare const getSourceProps: (props: SourceProps, docsContext: DocsContextProps<any>, sourceContext: SourceContextProps) => PureSourceProps & SourceStateProps;
|
|
30
32
|
/**
|
|
31
33
|
* Story source doc block renders source code if provided,
|
|
32
34
|
* or the source for a story if `storyId` is provided, or
|
|
33
35
|
* the source for the current story if nothing is provided.
|
|
34
36
|
*/
|
|
35
|
-
export declare const Source: FC<
|
|
37
|
+
export declare const Source: FC<PureSourceProps>;
|
|
36
38
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { FC, Context } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import type { SyntaxHighlighterFormatTypes } from '@storybook/components';
|
|
3
|
+
import type { StoryId } from '@storybook/api';
|
|
4
|
+
export interface SourceItem {
|
|
5
|
+
code: string;
|
|
6
|
+
format: SyntaxHighlighterFormatTypes;
|
|
7
|
+
}
|
|
4
8
|
export declare type StorySources = Record<StoryId, SourceItem>;
|
|
5
9
|
export interface SourceContextProps {
|
|
6
10
|
sources: StorySources;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Parameters } from '@storybook/addons';
|
|
2
|
-
import { Story } from '@storybook/store';
|
|
1
|
+
import type { Parameters } from '@storybook/addons';
|
|
2
|
+
import type { Story } from '@storybook/store';
|
|
3
3
|
export declare const enhanceSource: (story: Story<any>) => Parameters;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StoryId, AnyFramework } from '@storybook/csf';
|
|
2
|
-
import { Story } from '@storybook/store';
|
|
1
|
+
import type { StoryId, AnyFramework } from '@storybook/csf';
|
|
2
|
+
import type { Story } from '@storybook/store';
|
|
3
3
|
import { DocsContextProps } from './DocsContext';
|
|
4
4
|
export declare function useStory<TFramework extends AnyFramework = AnyFramework>(storyId: StoryId, context: DocsContextProps<TFramework>): Story<TFramework> | void;
|
|
5
5
|
export declare function useStories<TFramework extends AnyFramework = AnyFramework>(storyIds: StoryId[], context: DocsContextProps<TFramework>): (Story<TFramework> | void)[];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const parameters: {
|
|
3
2
|
docs: {
|
|
4
3
|
inlineStories: boolean;
|
|
@@ -7,4 +6,3 @@ export declare const parameters: {
|
|
|
7
6
|
iframeHeight: number;
|
|
8
7
|
};
|
|
9
8
|
};
|
|
10
|
-
export declare const argTypesEnhancers: (<TFramework extends import("@storybook/csf").AnyFramework>(context: import("@storybook/csf").StoryContextForEnhancers<TFramework, import("@storybook/csf").Args>) => import("@storybook/csf").StrictArgTypes<import("@storybook/csf").Args> | import("@storybook/addons").Parameters)[];
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Options } from '@storybook/core-common';
|
|
2
|
+
declare type BabelParams = {
|
|
3
|
+
babelOptions?: any;
|
|
4
|
+
mdxBabelOptions?: any;
|
|
5
|
+
configureJSX?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function webpack(webpackConfig: any, options: Options & BabelParams & {
|
|
8
|
+
sourceLoaderOptions: any;
|
|
9
|
+
transcludeMarkdown: boolean;
|
|
10
|
+
}): Promise<any>;
|
|
11
|
+
export {};
|
package/ember/index.js
CHANGED
package/jest-transform-mdx.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const mdx = require('@mdx-js/mdx');
|
|
3
2
|
const { ScriptTransformer } = require('@jest/transform');
|
|
4
3
|
const { dedent } = require('ts-dedent');
|
|
5
4
|
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
-
const compilers = [createCompiler({})];
|
|
5
|
+
const { compileSync } = require('@storybook/mdx1-csf');
|
|
9
6
|
|
|
10
7
|
module.exports = {
|
|
11
8
|
process(src, filename, config, { instrument }) {
|
|
@@ -13,7 +10,7 @@ module.exports = {
|
|
|
13
10
|
/* @jsx mdx */
|
|
14
11
|
import React from 'react'
|
|
15
12
|
import { mdx } from '@mdx-js/react'
|
|
16
|
-
${
|
|
13
|
+
${compileSync(src, { filepath: filename })}
|
|
17
14
|
`;
|
|
18
15
|
|
|
19
16
|
const extension = path.extname(filename);
|
package/mdx-compiler-plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('@storybook/csf
|
|
1
|
+
module.exports = require('@storybook/mdx1-csf').createCompiler;
|