@storybook/addon-docs 7.0.0-beta.6 → 7.0.0-beta.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -24
- package/angular/README.md +59 -34
- package/angular/index.js +2 -2
- package/common/README.md +4 -6
- package/dist/{DocsRenderer-QMFTTPNP.mjs → DocsRenderer-ED6OA6OB.mjs} +1 -1
- package/dist/blocks.d.ts +1 -0
- package/dist/blocks.js +1 -0
- package/dist/blocks.mjs +1 -0
- package/dist/chunk-G4YQS2SV.mjs +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/preset.d.ts +4 -1
- package/dist/preset.js +35 -2
- package/dist/preset.mjs +35 -2
- package/dist/preview.js +1 -1
- package/dist/preview.mjs +1 -1
- package/dist/shims/mdx-react-shim.js +1 -1
- package/ember/README.md +4 -6
- package/ember/index.js +2 -2
- package/package.json +29 -16
- package/postinstall/presets.js +1 -3
- package/react/README.md +9 -9
- package/vue/README.md +9 -13
- package/web-components/README.md +4 -14
- package/dist/chunk-MA2MUXQN.mjs +0 -1
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<center>
|
|
2
|
-
<img src="https://raw.githubusercontent.com/storybookjs/storybook/
|
|
2
|
+
<img src="https://raw.githubusercontent.com/storybookjs/storybook/next/code/addons/docs/docs/media/hero.png" width="100%" />
|
|
3
3
|
</center>
|
|
4
4
|
|
|
5
5
|
# Storybook Docs
|
|
6
6
|
|
|
7
|
-
> migration guide: This page documents the method to configure
|
|
7
|
+
> migration guide: This page documents the method to configure Storybook introduced recently in 7.0.0, consult the [migration guide](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md) if you want to migrate to this format of configuring Storybook.
|
|
8
8
|
|
|
9
9
|
Storybook Docs transforms your Storybook stories into world-class component documentation.
|
|
10
10
|
|
|
11
11
|
**DocsPage.** Out of the box, all your stories get a `DocsPage`. `DocsPage` is a zero-config aggregation of your component stories, text descriptions, docgen comments, props tables, and code examples into clean, readable pages.
|
|
12
12
|
|
|
13
|
-
**MDX.** If you want more control, `MDX` allows you to write long-form markdown documentation and stories in one file. You can also use it to write pure documentation pages and embed them inside your Storybook alongside your stories.
|
|
13
|
+
**MDX.** If you want more control, `MDX` allows you to write long-form markdown documentation and include stories in one file. You can also use it to write pure documentation pages and embed them inside your Storybook alongside your stories.
|
|
14
14
|
|
|
15
15
|
Just like Storybook, Docs supports every major view layer including React, Vue, Angular, HTML, Web components, Svelte, and many more.
|
|
16
16
|
|
|
@@ -33,43 +33,41 @@ When you [install Docs](#installation), every story gets a `DocsPage`. `DocsPage
|
|
|
33
33
|
Click on the `Docs` tab to see it:
|
|
34
34
|
|
|
35
35
|
<center>
|
|
36
|
-
<img src="https://raw.githubusercontent.com/storybookjs/storybook/
|
|
36
|
+
<img src="https://raw.githubusercontent.com/storybookjs/storybook/next/code/addons/docs/docs/media/docs-tab.png" width="100%" />
|
|
37
37
|
</center>
|
|
38
38
|
|
|
39
39
|
For more information on how it works, see the [`DocsPage` reference](https://github.com/storybookjs/storybook/blob/next/code/addons/docs/docs/docspage.md).
|
|
40
40
|
|
|
41
41
|
## MDX
|
|
42
42
|
|
|
43
|
-
`MDX` is a syntax for writing long-form documentation
|
|
43
|
+
`MDX` is a syntax for writing long-form documentation with stories side-by-side in the same file. In contrast to `DocsPage`, which provides smart documentation out of the box, `MDX` gives you full control over your component documentation.
|
|
44
44
|
|
|
45
45
|
Here's an example file:
|
|
46
46
|
|
|
47
|
+
<!-- prettier-ignore-start -->
|
|
48
|
+
|
|
47
49
|
```md
|
|
48
|
-
import { Meta, Story, Canvas } from '@storybook/
|
|
49
|
-
import
|
|
50
|
+
import { Meta, Story, Canvas } from '@storybook/blocks';
|
|
51
|
+
import * as CheckboxStories from './Checkbox.stories';
|
|
50
52
|
|
|
51
|
-
<Meta title="MDX/Checkbox"
|
|
53
|
+
<Meta title="MDX/Checkbox" of={CheckboxStories} />
|
|
52
54
|
|
|
53
55
|
# Checkbox
|
|
54
56
|
|
|
55
|
-
With `MDX` we can
|
|
57
|
+
With `MDX` we can include a story for `Checkbox` right in the middle of our
|
|
56
58
|
markdown documentation.
|
|
57
59
|
|
|
58
60
|
<Canvas>
|
|
59
|
-
<Story
|
|
60
|
-
<form>
|
|
61
|
-
<Checkbox id="Unchecked" label="Unchecked" />
|
|
62
|
-
<Checkbox id="Checked" label="Checked" checked />
|
|
63
|
-
<Checkbox appearance="secondary" id="second" label="Secondary" checked />
|
|
64
|
-
</form>
|
|
65
|
-
</Story>
|
|
61
|
+
<Story of={CheckboxStories.Unchecked} />
|
|
66
62
|
</Canvas>
|
|
67
63
|
```
|
|
68
64
|
|
|
65
|
+
<!-- prettier-ignore-end -->
|
|
66
|
+
|
|
69
67
|
And here's how that's rendered in Storybook:
|
|
70
68
|
|
|
71
69
|
<center>
|
|
72
|
-
<img src="https://raw.githubusercontent.com/storybookjs/storybook/
|
|
70
|
+
<img src="https://raw.githubusercontent.com/storybookjs/storybook/next/code/addons/docs/docs/media/mdx-simple.png" width="100%" />
|
|
73
71
|
</center>
|
|
74
72
|
|
|
75
73
|
For more information on `MDX`, see the [`MDX` reference](https://github.com/storybookjs/storybook/blob/next/code/addons/docs/docs/mdx.md).
|
|
@@ -101,9 +99,14 @@ yarn add -D react
|
|
|
101
99
|
Then add the following to your `.storybook/main.js`:
|
|
102
100
|
|
|
103
101
|
```js
|
|
104
|
-
|
|
105
|
-
stories: [
|
|
106
|
-
|
|
102
|
+
export default {
|
|
103
|
+
stories: [
|
|
104
|
+
'../src/**/*.mdx', // 👈 Add this, to match your project's structure
|
|
105
|
+
'../src/**/*.stories.@(js|jsx|ts|tsx)',
|
|
106
|
+
],
|
|
107
|
+
addons: [
|
|
108
|
+
'@storybook/addon-docs', // 👈 Also add this
|
|
109
|
+
],
|
|
107
110
|
};
|
|
108
111
|
```
|
|
109
112
|
|
|
@@ -135,14 +138,14 @@ Add the following to your Jest configuration:
|
|
|
135
138
|
The `addon-docs` preset has a few configuration options that can be used to configure its babel/webpack loading behavior. Here's an example of how to use the preset with options:
|
|
136
139
|
|
|
137
140
|
```js
|
|
138
|
-
|
|
141
|
+
export default {
|
|
139
142
|
addons: [
|
|
140
143
|
{
|
|
141
144
|
name: '@storybook/addon-docs',
|
|
142
145
|
options: {
|
|
143
|
-
|
|
144
|
-
babelOptions: {},
|
|
146
|
+
jsxOptions: {},
|
|
145
147
|
csfPluginOptions: null,
|
|
148
|
+
mdxPluginOptions: {},
|
|
146
149
|
transcludeMarkdown: true,
|
|
147
150
|
},
|
|
148
151
|
},
|
|
@@ -150,7 +153,7 @@ module.exports = {
|
|
|
150
153
|
};
|
|
151
154
|
```
|
|
152
155
|
|
|
153
|
-
|
|
156
|
+
`jsxOptions` are options that will be passed to `@babel/preset-react` for `.md` and `.mdx` files.
|
|
154
157
|
|
|
155
158
|
`csfPluginOptions` is an object for configuring `@storybook/csf-plugin`. When set to `null` it tells docs not to run the `csf-plugin` at all, which can be used as an optimization, or if you're already using `csf-plugin` in your `main.js`.
|
|
156
159
|
|
package/angular/README.md
CHANGED
|
@@ -13,8 +13,11 @@ To learn more about Storybook Docs, read the [general documentation](../README.m
|
|
|
13
13
|
- [Installation](#installation)
|
|
14
14
|
- [DocsPage](#docspage)
|
|
15
15
|
- [Props tables](#props-tables)
|
|
16
|
+
- [Automatic Compodoc setup](#automatic-compodoc-setup)
|
|
17
|
+
- [Manual Compodoc setup](#manual-compodoc-setup)
|
|
16
18
|
- [MDX](#mdx)
|
|
17
19
|
- [IFrame height](#iframe-height)
|
|
20
|
+
- [Inline Stories](#inline-stories)
|
|
18
21
|
- [More resources](#more-resources)
|
|
19
22
|
|
|
20
23
|
## Installation
|
|
@@ -28,7 +31,7 @@ yarn add -D @storybook/addon-docs@next
|
|
|
28
31
|
Then add the following to your `.storybook/main.js` exports:
|
|
29
32
|
|
|
30
33
|
```js
|
|
31
|
-
|
|
34
|
+
export default {
|
|
32
35
|
addons: ['@storybook/addon-docs'],
|
|
33
36
|
};
|
|
34
37
|
```
|
|
@@ -41,35 +44,63 @@ When you [install docs](#installation) you should get basic [DocsPage](../docs/d
|
|
|
41
44
|
|
|
42
45
|
Getting [Props tables](../docs/props-tables.md) for your components requires a few more steps. Docs for Angular relies on [Compodoc](https://compodoc.app/), the excellent API documentation tool. It supports `inputs`, `outputs`, `properties`, `methods`, `view/content child/children` as first class prop types.
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
### Automatic Compodoc setup
|
|
48
|
+
|
|
49
|
+
During `sb init`, you will be asked, whether you want to setup Compodoc for your project. Just answer the question with Yes. Compodoc is then ready to use!
|
|
50
|
+
|
|
51
|
+
## Manual Compodoc setup
|
|
52
|
+
|
|
53
|
+
You'll need to register Compodoc's `documentation.json` file in `.storybook/preview.ts`:
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import { setCompodocJson } from '@storybook/addon-docs/angular';
|
|
57
|
+
import docJson from '../documentation.json';
|
|
58
|
+
|
|
59
|
+
setCompodocJson(docJson);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Finally, to set up compodoc, you'll first need to install Compodoc:
|
|
45
63
|
|
|
46
64
|
```sh
|
|
47
65
|
yarn add -D @compodoc/compodoc
|
|
48
66
|
```
|
|
49
67
|
|
|
50
|
-
Then you'll need to configure Compodoc to generate a `documentation.json` file. Adding the following snippet to your `
|
|
68
|
+
Then you'll need to configure Compodoc to generate a `documentation.json` file. Adding the following snippet to your `projects.<project>.architect.<storybook|build-storybook>` in the `angular.json` creates a metadata file `./documentation.json` each time you run storybook:
|
|
51
69
|
|
|
52
|
-
```
|
|
70
|
+
```jsonc
|
|
71
|
+
// angular.json
|
|
53
72
|
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
"projects": {
|
|
74
|
+
"your-project": {
|
|
75
|
+
"architect": {
|
|
76
|
+
"storybook": {
|
|
77
|
+
...,
|
|
78
|
+
"compodoc": true,
|
|
79
|
+
"compodocArgs": [
|
|
80
|
+
"-e",
|
|
81
|
+
"json",
|
|
82
|
+
"-d",
|
|
83
|
+
"." // the root folder of your project
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
"build-storybook": {
|
|
87
|
+
...,
|
|
88
|
+
"compodoc": true,
|
|
89
|
+
"compodocArgs": [
|
|
90
|
+
"-e",
|
|
91
|
+
"json",
|
|
92
|
+
"-d",
|
|
93
|
+
"." // the root folder of your project
|
|
94
|
+
],
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
60
99
|
}
|
|
61
100
|
```
|
|
62
101
|
|
|
63
102
|
Unfortunately, it's not currently possible to update this dynamically as you edit your components, but [there's an open issue](https://github.com/storybookjs/storybook/issues/8672) to support this with improvements to Compodoc.
|
|
64
103
|
|
|
65
|
-
Next, add the following to `.storybook/preview.ts` to load the Compodoc-generated file:
|
|
66
|
-
|
|
67
|
-
```js
|
|
68
|
-
import { setCompodocJson } from '@storybook/addon-docs/angular';
|
|
69
|
-
import docJson from '../documentation.json';
|
|
70
|
-
setCompodocJson(docJson);
|
|
71
|
-
```
|
|
72
|
-
|
|
73
104
|
Finally, be sure to fill in the `component` field in your story metadata:
|
|
74
105
|
|
|
75
106
|
```ts
|
|
@@ -104,9 +135,9 @@ yarn add -D react
|
|
|
104
135
|
|
|
105
136
|
Then update your `.storybook/main.js` to make sure you load MDX files:
|
|
106
137
|
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
stories: ['../src
|
|
138
|
+
```js
|
|
139
|
+
export default {
|
|
140
|
+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
|
110
141
|
};
|
|
111
142
|
```
|
|
112
143
|
|
|
@@ -186,9 +217,7 @@ Storybook Docs renders all Angular stories inside IFrames, with a default height
|
|
|
186
217
|
To update the global default, modify `.storybook/preview.ts`:
|
|
187
218
|
|
|
188
219
|
```ts
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
addParameters({ docs: { iframeHeight: 400 } });
|
|
220
|
+
export const parameters = { docs: { story: { iframeHeight: '400px' } } };
|
|
192
221
|
```
|
|
193
222
|
|
|
194
223
|
For `DocsPage`, you need to update the parameter locally in a story:
|
|
@@ -196,7 +225,7 @@ For `DocsPage`, you need to update the parameter locally in a story:
|
|
|
196
225
|
```ts
|
|
197
226
|
export const basic = () => ...
|
|
198
227
|
basic.parameters = {
|
|
199
|
-
docs: { iframeHeight:
|
|
228
|
+
docs: { story: { iframeHeight: '400px' } },
|
|
200
229
|
}
|
|
201
230
|
```
|
|
202
231
|
|
|
@@ -208,18 +237,14 @@ And for `MDX` you can modify it as an attribute on the `Story` element:
|
|
|
208
237
|
|
|
209
238
|
## Inline Stories
|
|
210
239
|
|
|
211
|
-
Storybook Docs renders all Angular stories
|
|
240
|
+
Storybook Docs renders all Angular stories inline by default.
|
|
212
241
|
|
|
213
|
-
|
|
242
|
+
However, you can render stories in an iframe, with a default height of `100px` (configurable using the `docs.story.iframeHeight` story parameter), by using the `docs.story.inline` parameter.
|
|
214
243
|
|
|
215
|
-
|
|
216
|
-
import { addParameters } from '@storybook/angular';
|
|
244
|
+
To do so for all stories, update `.storybook/preview.js`:
|
|
217
245
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
inlineStories: true,
|
|
221
|
-
},
|
|
222
|
-
});
|
|
246
|
+
```js
|
|
247
|
+
export const parameters = { docs: { story: { inline: false } } };
|
|
223
248
|
```
|
|
224
249
|
|
|
225
250
|
## More resources
|
package/angular/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
|
-
|
|
2
|
+
import { global } from '@storybook/global';
|
|
3
3
|
|
|
4
4
|
export const setCompodocJson = (compodocJson) => {
|
|
5
5
|
// @ts-expect-error (Converted from ts-ignore)
|
|
6
|
-
|
|
6
|
+
global.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
|
|
7
7
|
};
|
package/common/README.md
CHANGED
|
@@ -21,7 +21,7 @@ yarn add -D @storybook/addon-docs@next
|
|
|
21
21
|
Then add the following to your `.storybook/main.js` addons:
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
|
-
|
|
24
|
+
export default {
|
|
25
25
|
addons: ['@storybook/addon-docs'],
|
|
26
26
|
};
|
|
27
27
|
```
|
|
@@ -43,7 +43,7 @@ yarn add -D react
|
|
|
43
43
|
Then update your `.storybook/main.js` to make sure you load MDX files:
|
|
44
44
|
|
|
45
45
|
```js
|
|
46
|
-
|
|
46
|
+
export default {
|
|
47
47
|
stories: ['../src/stories/**/*.stories.@(js|mdx)'],
|
|
48
48
|
};
|
|
49
49
|
```
|
|
@@ -71,9 +71,7 @@ In the "common" setup, Storybook Docs renders stories inside `iframe`s, with a d
|
|
|
71
71
|
To update the global default, modify `.storybook/preview.js`:
|
|
72
72
|
|
|
73
73
|
```ts
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
addParameters({ docs: { iframeHeight: 400 } });
|
|
74
|
+
export const parameters = { docs: { story: { iframeHeight: '400px' } } };
|
|
77
75
|
```
|
|
78
76
|
|
|
79
77
|
For `DocsPage`, you need to update the parameter locally in a story:
|
|
@@ -81,7 +79,7 @@ For `DocsPage`, you need to update the parameter locally in a story:
|
|
|
81
79
|
```ts
|
|
82
80
|
export const basic = () => ...
|
|
83
81
|
basic.parameters = {
|
|
84
|
-
docs: { iframeHeight:
|
|
82
|
+
docs: { story: { iframeHeight: '400px' } }
|
|
85
83
|
}
|
|
86
84
|
```
|
|
87
85
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DocsRenderer,defaultComponents}from"./chunk-
|
|
1
|
+
import{DocsRenderer,defaultComponents}from"./chunk-G4YQS2SV.mjs";import"./chunk-R4NKYYJA.mjs";export{DocsRenderer,defaultComponents};
|
package/dist/blocks.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@storybook/blocks';
|
package/dist/blocks.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__reExport=(target,mod,secondTarget)=>(__copyProps(target,mod,"default"),secondTarget&&__copyProps(secondTarget,mod,"default"));var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var blocks_exports={};module.exports=__toCommonJS(blocks_exports);var import_client_logger=require("@storybook/client-logger");__reExport(blocks_exports,require("@storybook/blocks"),module.exports);(0,import_client_logger.deprecate)("Import from '@storybook/addon-docs/blocks' is deprecated. Please import from '@storybook/blocks' instead.");
|
package/dist/blocks.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{deprecate}from"@storybook/client-logger";export*from"@storybook/blocks";deprecate("Import from '@storybook/addon-docs/blocks' is deprecated. Please import from '@storybook/blocks' instead.");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import React from"react";import{renderElement,unmountElement}from"@storybook/react-dom-shim";import{Docs,CodeOrSourceMdx,AnchorMdx,HeadersMdx}from"@storybook/blocks";var defaultComponents={code:CodeOrSourceMdx,a:AnchorMdx,...HeadersMdx},DocsRenderer=class{constructor(){this.render=(context,docsParameter,element,callback)=>{let components={...defaultComponents,...docsParameter?.components};import("@mdx-js/react").then(({MDXProvider})=>renderElement(React.createElement(MDXProvider,{components},React.createElement(Docs,{context,docsParameter})),element)).then(callback)},this.unmount=element=>{unmountElement(element)}}};export{defaultComponents,DocsRenderer};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__reExport=(target,mod,secondTarget)=>(__copyProps(target,mod,"default"),secondTarget&&__copyProps(secondTarget,mod,"default")),__toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{DocsRenderer:()=>DocsRenderer});module.exports=__toCommonJS(src_exports);__reExport(src_exports,require("@storybook/blocks"),module.exports);var import_react=__toESM(require("react")),import_react_dom_shim=require("@storybook/react-dom-shim"),import_blocks=require("@storybook/blocks"),defaultComponents={code:import_blocks.CodeOrSourceMdx,a:import_blocks.AnchorMdx,...import_blocks.HeadersMdx},DocsRenderer=class{constructor(){this.render=(context,docsParameter,element,callback)=>{let components={...defaultComponents,...docsParameter==null?void 0:docsParameter.components};import("@mdx-js/react").then(({MDXProvider})=>(0,import_react_dom_shim.renderElement)(import_react.default.createElement(MDXProvider,{components},import_react.default.createElement(import_blocks.Docs,{context,docsParameter})),element)).then(callback)},this.unmount=element=>{(0,import_react_dom_shim.unmountElement)(element)}}};0&&(module.exports={DocsRenderer});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DocsRenderer}from"./chunk-
|
|
1
|
+
import{DocsRenderer}from"./chunk-G4YQS2SV.mjs";import"./chunk-R4NKYYJA.mjs";export*from"@storybook/blocks";export{DocsRenderer};
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { StorybookConfig } from '@storybook/types';
|
|
2
|
+
|
|
3
|
+
declare const addons: StorybookConfig['addons'];
|
|
1
4
|
declare const webpackX: any;
|
|
2
5
|
declare const storyIndexersX: any;
|
|
3
6
|
declare const docsX: any;
|
|
4
7
|
|
|
5
|
-
export { docsX as docs, storyIndexersX as storyIndexers, webpackX as webpack };
|
|
8
|
+
export { addons, docsX as docs, storyIndexersX as storyIndexers, webpackX as webpack };
|
package/dist/preset.js
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var preset_exports={};__export(preset_exports,{addons:()=>addons,docs:()=>docsX,storyIndexers:()=>storyIndexersX,webpack:()=>webpackX});module.exports=__toCommonJS(preset_exports);var import_fs_extra=__toESM(require("fs-extra")),import_remark_slug=__toESM(require("remark-slug")),import_remark_external_links=__toESM(require("remark-external-links")),import_ts_dedent2=require("ts-dedent"),import_global=require("@storybook/global"),import_csf_tools=require("@storybook/csf-tools"),import_node_logger2=require("@storybook/node-logger");var import_node_logger=require("@storybook/node-logger"),import_ts_dedent=__toESM(require("ts-dedent"));function ensureReactPeerDeps(){try{require.resolve("react"),require.resolve("react-dom")}catch{import_node_logger.logger.error(import_ts_dedent.default`
|
|
2
|
+
Starting in 7.0, react and react-dom are now required peer dependencies of Storybook.
|
|
3
|
+
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-peer-dependencies-required
|
|
4
|
+
|
|
5
|
+
It seems that you haven't run Storybook's CLI to upgrade to the latest version.
|
|
6
|
+
The upgrade command will install the required peer dependencies for you and will take
|
|
7
|
+
care of other important auto migrations as well.
|
|
8
|
+
|
|
9
|
+
If you want to upgrade to the latest prerelease version, please run:
|
|
10
|
+
|
|
11
|
+
$ npx storybook@next upgrade --prerelease
|
|
12
|
+
|
|
13
|
+
Otherwise, please run:
|
|
14
|
+
|
|
15
|
+
$ npx storybook upgrade
|
|
16
|
+
|
|
17
|
+
If you do not want to use the upgrade commands,
|
|
18
|
+
please install react and react-dom in your project manually.
|
|
19
|
+
|
|
20
|
+
npm:
|
|
21
|
+
$ npm add react react-dom --dev
|
|
22
|
+
|
|
23
|
+
yarn:
|
|
24
|
+
$ yarn add react react-dom --dev
|
|
25
|
+
|
|
26
|
+
pnpm:
|
|
27
|
+
$ pnpm add react react-dom --dev
|
|
28
|
+
`),process.exit(1)}}async function webpack(webpackConfig={},options){var _a,_b,_c;let{module:module2={}}=webpackConfig,{csfPluginOptions={},jsxOptions={},sourceLoaderOptions=null,configureJsx,mdxBabelOptions,mdxPluginOptions={}}=options,mdxLoaderOptions=await options.presets.apply("mdxLoaderOptions",{skipCsf:!0,...mdxPluginOptions,mdxCompileOptions:{providerImportSource:"@storybook/addon-docs/mdx-react-shim",...mdxPluginOptions.mdxCompileOptions,remarkPlugins:[import_remark_slug.default,import_remark_external_links.default].concat(((_a=mdxPluginOptions==null?void 0:mdxPluginOptions.mdxCompileOptions)==null?void 0:_a.remarkPlugins)??[])},jsxOptions});if(sourceLoaderOptions)throw new Error(import_ts_dedent2.dedent`
|
|
2
29
|
Addon-docs no longer uses source-loader in 7.0.
|
|
3
30
|
|
|
4
31
|
To update your configuration, please see migration instructions here:
|
|
5
32
|
|
|
6
33
|
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#dropped-source-loader--storiesof-static-snippets
|
|
7
|
-
`);
|
|
34
|
+
`);if(mdxBabelOptions||configureJsx)throw new Error(import_ts_dedent2.dedent`
|
|
35
|
+
Addon-docs no longer uses configureJsx or mdxBabelOptions in 7.0.
|
|
36
|
+
|
|
37
|
+
To update your configuration, please see migration instructions here:
|
|
38
|
+
|
|
39
|
+
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#dropped-addon-docs-manual-babel-configuration
|
|
40
|
+
`);let mdxVersion=(_b=import_global.global.FEATURES)!=null&&_b.legacyMdx1?"MDX1":"MDX2";import_node_logger2.logger.info(`Addon-docs: using ${mdxVersion}`);let mdxLoader=(_c=import_global.global.FEATURES)!=null&&_c.legacyMdx1?require.resolve("@storybook/mdx1-csf/loader"):require.resolve("@storybook/mdx2-csf/loader");return{...webpackConfig,plugins:[...webpackConfig.plugins||[],...csfPluginOptions?[require("@storybook/csf-plugin").webpack(csfPluginOptions)]:[]],module:{...module2,rules:[...module2.rules,{test:/(stories|story)\.mdx$/,use:[{loader:mdxLoader,options:{...mdxLoaderOptions,skipCsf:!1}}]},{test:/\.mdx$/,exclude:/(stories|story)\.mdx$/,use:[{loader:mdxLoader,options:mdxLoaderOptions}]}]}}}var storyIndexers=indexers=>[{test:/(stories|story)\.mdx$/,indexer:async(fileName,opts)=>{var _a;let code=(await import_fs_extra.default.readFile(fileName,"utf-8")).toString(),{compile}=(_a=import_global.global.FEATURES)!=null&&_a.legacyMdx1?await import("@storybook/mdx1-csf"):await import("@storybook/mdx2-csf");return code=await compile(code,{}),(0,import_csf_tools.loadCsf)(code,{...opts,fileName}).parse()}},...indexers||[]],docs=docsOptions=>({...docsOptions,defaultName:"Docs",autodocs:"tag"}),addons=[require.resolve("@storybook/react-dom-shim/dist/preset")],webpackX=webpack,storyIndexersX=storyIndexers,docsX=docs;ensureReactPeerDeps();0&&(module.exports={addons,docs,storyIndexers,webpack});
|
package/dist/preset.mjs
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
import{__require}from"./chunk-R4NKYYJA.mjs";import fs from"fs-extra";import remarkSlug from"remark-slug";import remarkExternalLinks from"remark-external-links";import{dedent}from"ts-dedent";import{loadCsf}from"@storybook/csf-tools";
|
|
1
|
+
import{__require}from"./chunk-R4NKYYJA.mjs";import fs from"fs-extra";import remarkSlug from"remark-slug";import remarkExternalLinks from"remark-external-links";import{dedent as dedent2}from"ts-dedent";import{global}from"@storybook/global";import{loadCsf}from"@storybook/csf-tools";import{logger as logger2}from"@storybook/node-logger";import{logger}from"@storybook/node-logger";import dedent from"ts-dedent";function ensureReactPeerDeps(){try{__require.resolve("react"),__require.resolve("react-dom")}catch{logger.error(dedent`
|
|
2
|
+
Starting in 7.0, react and react-dom are now required peer dependencies of Storybook.
|
|
3
|
+
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-peer-dependencies-required
|
|
4
|
+
|
|
5
|
+
It seems that you haven't run Storybook's CLI to upgrade to the latest version.
|
|
6
|
+
The upgrade command will install the required peer dependencies for you and will take
|
|
7
|
+
care of other important auto migrations as well.
|
|
8
|
+
|
|
9
|
+
If you want to upgrade to the latest prerelease version, please run:
|
|
10
|
+
|
|
11
|
+
$ npx storybook@next upgrade --prerelease
|
|
12
|
+
|
|
13
|
+
Otherwise, please run:
|
|
14
|
+
|
|
15
|
+
$ npx storybook upgrade
|
|
16
|
+
|
|
17
|
+
If you do not want to use the upgrade commands,
|
|
18
|
+
please install react and react-dom in your project manually.
|
|
19
|
+
|
|
20
|
+
npm:
|
|
21
|
+
$ npm add react react-dom --dev
|
|
22
|
+
|
|
23
|
+
yarn:
|
|
24
|
+
$ yarn add react react-dom --dev
|
|
25
|
+
|
|
26
|
+
pnpm:
|
|
27
|
+
$ pnpm add react react-dom --dev
|
|
28
|
+
`),process.exit(1)}}async function webpack(webpackConfig={},options){let{module={}}=webpackConfig,{csfPluginOptions={},jsxOptions={},sourceLoaderOptions=null,configureJsx,mdxBabelOptions,mdxPluginOptions={}}=options,mdxLoaderOptions=await options.presets.apply("mdxLoaderOptions",{skipCsf:!0,...mdxPluginOptions,mdxCompileOptions:{providerImportSource:"@storybook/addon-docs/mdx-react-shim",...mdxPluginOptions.mdxCompileOptions,remarkPlugins:[remarkSlug,remarkExternalLinks].concat(mdxPluginOptions?.mdxCompileOptions?.remarkPlugins??[])},jsxOptions});if(sourceLoaderOptions)throw new Error(dedent2`
|
|
2
29
|
Addon-docs no longer uses source-loader in 7.0.
|
|
3
30
|
|
|
4
31
|
To update your configuration, please see migration instructions here:
|
|
5
32
|
|
|
6
33
|
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#dropped-source-loader--storiesof-static-snippets
|
|
7
|
-
`);
|
|
34
|
+
`);if(mdxBabelOptions||configureJsx)throw new Error(dedent2`
|
|
35
|
+
Addon-docs no longer uses configureJsx or mdxBabelOptions in 7.0.
|
|
36
|
+
|
|
37
|
+
To update your configuration, please see migration instructions here:
|
|
38
|
+
|
|
39
|
+
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#dropped-addon-docs-manual-babel-configuration
|
|
40
|
+
`);let mdxVersion=global.FEATURES?.legacyMdx1?"MDX1":"MDX2";logger2.info(`Addon-docs: using ${mdxVersion}`);let mdxLoader=global.FEATURES?.legacyMdx1?__require.resolve("@storybook/mdx1-csf/loader"):__require.resolve("@storybook/mdx2-csf/loader");return{...webpackConfig,plugins:[...webpackConfig.plugins||[],...csfPluginOptions?[__require("@storybook/csf-plugin").webpack(csfPluginOptions)]:[]],module:{...module,rules:[...module.rules,{test:/(stories|story)\.mdx$/,use:[{loader:mdxLoader,options:{...mdxLoaderOptions,skipCsf:!1}}]},{test:/\.mdx$/,exclude:/(stories|story)\.mdx$/,use:[{loader:mdxLoader,options:mdxLoaderOptions}]}]}}}var storyIndexers=indexers=>[{test:/(stories|story)\.mdx$/,indexer:async(fileName,opts)=>{let code=(await fs.readFile(fileName,"utf-8")).toString(),{compile}=global.FEATURES?.legacyMdx1?await import("@storybook/mdx1-csf"):await import("@storybook/mdx2-csf");return code=await compile(code,{}),loadCsf(code,{...opts,fileName}).parse()}},...indexers||[]],docs=docsOptions=>({...docsOptions,defaultName:"Docs",autodocs:"tag"}),addons=[__require.resolve("@storybook/react-dom-shim/dist/preset")],webpackX=webpack,storyIndexersX=storyIndexers,docsX=docs;ensureReactPeerDeps();export{addons,docsX as docs,storyIndexersX as storyIndexers,webpackX as webpack};
|
package/dist/preview.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __esm=(fn,res)=>function(){return fn&&(res=(0,fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var DocsRenderer_exports={};__export(DocsRenderer_exports,{DocsRenderer:()=>DocsRenderer,defaultComponents:()=>defaultComponents});var import_react,import_react_dom_shim,import_blocks,defaultComponents,DocsRenderer,init_DocsRenderer=__esm({"src/DocsRenderer.tsx"(){import_react=__toESM(require("react")),import_react_dom_shim=require("@storybook/react-dom-shim"),import_blocks=require("@storybook/blocks"),defaultComponents={code:import_blocks.CodeOrSourceMdx,a:import_blocks.AnchorMdx,...import_blocks.HeadersMdx},DocsRenderer=class{constructor(){this.render=(context,docsParameter,element,callback)=>{let components={...defaultComponents,...docsParameter==null?void 0:docsParameter.components};import("@mdx-js/react").then(({MDXProvider})=>(0,import_react_dom_shim.renderElement)(import_react.default.createElement(MDXProvider,{components},import_react.default.createElement(import_blocks.Docs,{context,docsParameter})),element)).then(callback)},this.unmount=element=>{(0,import_react_dom_shim.unmountElement)(element)}}}}});var preview_exports={};__export(preview_exports,{parameters:()=>parameters});module.exports=__toCommonJS(preview_exports);var parameters={docs:{renderer:async()=>{let{DocsRenderer:DocsRenderer2}=await Promise.resolve().then(()=>(init_DocsRenderer(),DocsRenderer_exports));return new DocsRenderer2}}};0&&(module.exports={parameters});
|
package/dist/preview.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-R4NKYYJA.mjs";var parameters={docs:{renderer:async()=>{let{DocsRenderer}=await import("./DocsRenderer-
|
|
1
|
+
import"./chunk-R4NKYYJA.mjs";var parameters={docs:{renderer:async()=>{let{DocsRenderer}=await import("./DocsRenderer-ED6OA6OB.mjs");return new DocsRenderer}}};export{parameters};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__reExport=(target,mod,secondTarget)=>(__copyProps(target,mod,"default"),secondTarget&&__copyProps(secondTarget,mod,"default"));var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var mdx_react_shim_exports={};module.exports=__toCommonJS(mdx_react_shim_exports);__reExport(mdx_react_shim_exports,require("@mdx-js/react"),module.exports);
|
package/ember/README.md
CHANGED
|
@@ -24,7 +24,7 @@ yarn add -D @storybook/addon-docs@next
|
|
|
24
24
|
Then add the following to your `.storybook/main.js` addons:
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
|
-
|
|
27
|
+
export default {
|
|
28
28
|
addons: ['@storybook/addon-docs'],
|
|
29
29
|
};
|
|
30
30
|
```
|
|
@@ -87,7 +87,7 @@ yarn add -D react
|
|
|
87
87
|
Then update your `.storybook/main.js` to make sure you load MDX files:
|
|
88
88
|
|
|
89
89
|
```js
|
|
90
|
-
|
|
90
|
+
export default {
|
|
91
91
|
stories: ['../src/stories/**/*.stories.@(js|mdx)'],
|
|
92
92
|
};
|
|
93
93
|
```
|
|
@@ -125,9 +125,7 @@ Storybook Docs renders all Ember stories inside `iframe`s, with a default height
|
|
|
125
125
|
To update the global default, modify `.storybook/preview.js`:
|
|
126
126
|
|
|
127
127
|
```ts
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
addParameters({ docs: { iframeHeight: 400 } });
|
|
128
|
+
export const parameters = { docs: { story: { iframeHeight: '400px' } } };
|
|
131
129
|
```
|
|
132
130
|
|
|
133
131
|
For `DocsPage`, you need to update the parameter locally in a story:
|
|
@@ -135,7 +133,7 @@ For `DocsPage`, you need to update the parameter locally in a story:
|
|
|
135
133
|
```ts
|
|
136
134
|
export const basic = () => ...
|
|
137
135
|
basic.parameters = {
|
|
138
|
-
docs: { iframeHeight:
|
|
136
|
+
docs: { story: { iframeHeight: '400px' } }
|
|
139
137
|
}
|
|
140
138
|
```
|
|
141
139
|
|
package/ember/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-docs",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.60",
|
|
4
4
|
"description": "Document component usage and properties in Markdown",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"addon",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"essentials",
|
|
11
11
|
"organize"
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://github.com/storybookjs/storybook/tree/
|
|
13
|
+
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/addons/docs",
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/storybookjs/storybook/issues"
|
|
16
16
|
},
|
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
"import": "./dist/preset.mjs",
|
|
42
42
|
"types": "./dist/preset.d.ts"
|
|
43
43
|
},
|
|
44
|
+
"./blocks": {
|
|
45
|
+
"require": "./dist/blocks.js",
|
|
46
|
+
"import": "./dist/blocks.mjs",
|
|
47
|
+
"types": "./dist/blocks.d.ts"
|
|
48
|
+
},
|
|
44
49
|
"./dist/preview": {
|
|
45
50
|
"require": "./dist/preview.js",
|
|
46
51
|
"import": "./dist/preview.mjs",
|
|
@@ -87,8 +92,7 @@
|
|
|
87
92
|
"lit/**/*",
|
|
88
93
|
"README.md",
|
|
89
94
|
"*.js",
|
|
90
|
-
"*.d.ts"
|
|
91
|
-
"!__testfixtures__"
|
|
95
|
+
"*.d.ts"
|
|
92
96
|
],
|
|
93
97
|
"scripts": {
|
|
94
98
|
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
|
|
@@ -99,18 +103,20 @@
|
|
|
99
103
|
"@babel/plugin-transform-react-jsx": "^7.19.0",
|
|
100
104
|
"@jest/transform": "^29.3.1",
|
|
101
105
|
"@mdx-js/react": "^2.1.5",
|
|
102
|
-
"@storybook/blocks": "7.0.0-beta.
|
|
103
|
-
"@storybook/
|
|
104
|
-
"@storybook/
|
|
105
|
-
"@storybook/csf-
|
|
106
|
+
"@storybook/blocks": "7.0.0-beta.60",
|
|
107
|
+
"@storybook/client-logger": "7.0.0-beta.60",
|
|
108
|
+
"@storybook/components": "7.0.0-beta.60",
|
|
109
|
+
"@storybook/csf-plugin": "7.0.0-beta.60",
|
|
110
|
+
"@storybook/csf-tools": "7.0.0-beta.60",
|
|
111
|
+
"@storybook/global": "^5.0.0",
|
|
106
112
|
"@storybook/mdx2-csf": "next",
|
|
107
|
-
"@storybook/node-logger": "7.0.0-beta.
|
|
108
|
-
"@storybook/postinstall": "7.0.0-beta.
|
|
109
|
-
"@storybook/preview-api": "7.0.0-beta.
|
|
110
|
-
"@storybook/
|
|
111
|
-
"@storybook/
|
|
112
|
-
"
|
|
113
|
-
"
|
|
113
|
+
"@storybook/node-logger": "7.0.0-beta.60",
|
|
114
|
+
"@storybook/postinstall": "7.0.0-beta.60",
|
|
115
|
+
"@storybook/preview-api": "7.0.0-beta.60",
|
|
116
|
+
"@storybook/react-dom-shim": "7.0.0-beta.60",
|
|
117
|
+
"@storybook/theming": "7.0.0-beta.60",
|
|
118
|
+
"@storybook/types": "7.0.0-beta.60",
|
|
119
|
+
"fs-extra": "^11.1.0",
|
|
114
120
|
"remark-external-links": "^8.0.0",
|
|
115
121
|
"remark-slug": "^6.0.0",
|
|
116
122
|
"ts-dedent": "^2.0.0"
|
|
@@ -121,9 +127,15 @@
|
|
|
121
127
|
"typescript": "~4.9.3"
|
|
122
128
|
},
|
|
123
129
|
"peerDependencies": {
|
|
130
|
+
"@storybook/mdx1-csf": ">=1.0.0-0",
|
|
124
131
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
125
132
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
126
133
|
},
|
|
134
|
+
"peerDependenciesMeta": {
|
|
135
|
+
"@storybook/mdx1-csf": {
|
|
136
|
+
"optional": true
|
|
137
|
+
}
|
|
138
|
+
},
|
|
127
139
|
"publishConfig": {
|
|
128
140
|
"access": "public"
|
|
129
141
|
},
|
|
@@ -132,10 +144,11 @@
|
|
|
132
144
|
"./src/index.ts",
|
|
133
145
|
"./src/preset.ts",
|
|
134
146
|
"./src/preview.ts",
|
|
147
|
+
"./src/blocks.ts",
|
|
135
148
|
"./src/shims/mdx-react-shim.ts"
|
|
136
149
|
]
|
|
137
150
|
},
|
|
138
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
|
139
152
|
"storybook": {
|
|
140
153
|
"displayName": "Docs",
|
|
141
154
|
"icon": "https://user-images.githubusercontent.com/263385/101991672-48355c80-3c7c-11eb-82d9-95fa12438f64.png",
|
package/postinstall/presets.js
CHANGED
|
@@ -24,9 +24,7 @@ export default function transformer(file, api) {
|
|
|
24
24
|
((dependencies && dependencies['react-scripts']) ||
|
|
25
25
|
(devDependencies && devDependencies['react-scripts']))
|
|
26
26
|
) {
|
|
27
|
-
presetOptions = {
|
|
28
|
-
configureJSX: true,
|
|
29
|
-
};
|
|
27
|
+
presetOptions = {};
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
const j = api.jscodeshift;
|
package/react/README.md
CHANGED
|
@@ -29,7 +29,7 @@ yarn add -D @storybook/addon-docs@next
|
|
|
29
29
|
Then add the following to your `.storybook/main.js` list of `addons`:
|
|
30
30
|
|
|
31
31
|
```js
|
|
32
|
-
|
|
32
|
+
export default {
|
|
33
33
|
// other settings
|
|
34
34
|
addons: ['@storybook/addon-docs'];
|
|
35
35
|
}
|
|
@@ -70,7 +70,7 @@ storiesOf('InfoButton', module)
|
|
|
70
70
|
Then update your `.storybook/main.js` to make sure you load MDX files:
|
|
71
71
|
|
|
72
72
|
```js
|
|
73
|
-
|
|
73
|
+
export default {
|
|
74
74
|
stories: ['../src/stories/**/*.stories.@(js|mdx)'],
|
|
75
75
|
};
|
|
76
76
|
```
|
|
@@ -98,14 +98,14 @@ Some **markdown** description, or whatever you want.
|
|
|
98
98
|
|
|
99
99
|
## Inline stories
|
|
100
100
|
|
|
101
|
-
Storybook Docs renders all React stories inline
|
|
101
|
+
Storybook Docs renders all React stories inline by default.
|
|
102
|
+
|
|
103
|
+
However, you can render stories in an iframe, with a default height of `60px` (configurable using the `docs.story.iframeHeight` story parameter), by using the `docs.stories.inline` parameter.
|
|
104
|
+
|
|
105
|
+
To do so for all stories, update `.storybook/preview.js`:
|
|
102
106
|
|
|
103
107
|
```js
|
|
104
|
-
export const parameters = {
|
|
105
|
-
docs: {
|
|
106
|
-
inlineStories: false,
|
|
107
|
-
},
|
|
108
|
-
};
|
|
108
|
+
export const parameters = { docs: { story: { inline: false } } };
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
## TypeScript props with `react-docgen`
|
|
@@ -115,7 +115,7 @@ If you're using TypeScript, there are two different options for generating props
|
|
|
115
115
|
You can add the following lines to your `.storybook/main.js` to switch between the two (or disable docgen):
|
|
116
116
|
|
|
117
117
|
```js
|
|
118
|
-
|
|
118
|
+
export default {
|
|
119
119
|
typescript: {
|
|
120
120
|
// also valid 'react-docgen-typescript' | false
|
|
121
121
|
reactDocgen: 'react-docgen',
|
package/vue/README.md
CHANGED
|
@@ -29,7 +29,7 @@ yarn add -D @storybook/addon-docs@next
|
|
|
29
29
|
Then add the following to your `.storybook/main.js` addons:
|
|
30
30
|
|
|
31
31
|
```js
|
|
32
|
-
|
|
32
|
+
export default {
|
|
33
33
|
addons: ['@storybook/addon-docs'],
|
|
34
34
|
};
|
|
35
35
|
```
|
|
@@ -39,9 +39,9 @@ module.exports = {
|
|
|
39
39
|
The `addon-docs` preset for Vue has a configuration option that can be used to configure [`vue-docgen-api`](https://github.com/vue-styleguidist/vue-styleguidist/tree/dev/packages/vue-docgen-api), a tool which extracts information from Vue components. Here's an example of how to use the preset with options for Vue app:
|
|
40
40
|
|
|
41
41
|
```js
|
|
42
|
-
|
|
42
|
+
import * as path from 'path';
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
export default {
|
|
45
45
|
addons: [
|
|
46
46
|
{
|
|
47
47
|
name: '@storybook/addon-docs',
|
|
@@ -102,7 +102,7 @@ yarn add -D react
|
|
|
102
102
|
Then update your `.storybook/main.js` to make sure you load MDX files:
|
|
103
103
|
|
|
104
104
|
```js
|
|
105
|
-
|
|
105
|
+
export default {
|
|
106
106
|
stories: ['../src/stories/**/*.stories.@(js|mdx)'],
|
|
107
107
|
};
|
|
108
108
|
```
|
|
@@ -133,18 +133,14 @@ Yes, it's redundant to declare `component` twice. [Coming soon](https://github.c
|
|
|
133
133
|
|
|
134
134
|
## Inline Stories
|
|
135
135
|
|
|
136
|
-
Storybook Docs renders all Vue stories
|
|
136
|
+
Storybook Docs renders all Vue stories inline by default.
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
However, you can render stories in an iframe, with a default height of `60px` (configurable using the `docs.story.iframeHeight` story parameter), by using the `docs.stories.inline` parameter.
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
import { addParameters } from '@storybook/vue';
|
|
140
|
+
To do so for all stories, update `.storybook/preview.js`:
|
|
142
141
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
inlineStories: true,
|
|
146
|
-
},
|
|
147
|
-
});
|
|
142
|
+
```js
|
|
143
|
+
export const parameters = { docs: { story: { inline: false } } };
|
|
148
144
|
```
|
|
149
145
|
|
|
150
146
|
## More resources
|
package/web-components/README.md
CHANGED
|
@@ -112,24 +112,14 @@ For a full example see the [web-components-kitchen-sink/custom-elements.json](..
|
|
|
112
112
|
|
|
113
113
|
## Stories not inline
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
For web components that is usually fine as they are style encapsulated via shadow dom.
|
|
117
|
-
However when you have a style tag in you template it might be best to show them in an iframe.
|
|
115
|
+
Storybook Docs renders all web components stories inline by default.
|
|
118
116
|
|
|
119
|
-
|
|
117
|
+
However, you can render stories in an iframe, with a default height of `60px` (configurable using the `docs.story.iframeHeight` story parameter), by using the `docs.stories.inline` parameter.
|
|
120
118
|
|
|
121
|
-
|
|
122
|
-
addParameters({
|
|
123
|
-
docs: {
|
|
124
|
-
inlineStories: false,
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
or add it to individual stories.
|
|
119
|
+
To do so for all stories, update `.storybook/preview.js`:
|
|
130
120
|
|
|
131
121
|
```js
|
|
132
|
-
|
|
122
|
+
export const parameters = { docs: { story: { inline: false } } };
|
|
133
123
|
```
|
|
134
124
|
|
|
135
125
|
## More resources
|
package/dist/chunk-MA2MUXQN.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from"react";import ReactDOM from"react-dom";import{Docs,CodeOrSourceMdx,AnchorMdx,HeadersMdx}from"@storybook/blocks";var defaultComponents={code:CodeOrSourceMdx,a:AnchorMdx,...HeadersMdx},DocsRenderer=class{constructor(){this.render=(context,docsParameter,element,callback)=>{let components={...defaultComponents,...docsParameter?.components};import("@mdx-js/react").then(({MDXProvider})=>{ReactDOM.render(React.createElement(MDXProvider,{components},React.createElement(Docs,{key:Math.random(),context,docsParameter})),element,callback)})},this.unmount=element=>{ReactDOM.unmountComponentAtNode(element)}}};export{defaultComponents,DocsRenderer};
|