@storybook/addon-docs 7.0.0-beta.29 → 7.0.0-beta.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/angular/README.md CHANGED
@@ -13,6 +13,8 @@ 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)
18
20
  - [Inline Stories](#inline-stories)
@@ -42,35 +44,63 @@ When you [install docs](#installation) you should get basic [DocsPage](../docs/d
42
44
 
43
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.
44
46
 
45
- To get this, you'll first need to install Compodoc:
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:
46
63
 
47
64
  ```sh
48
65
  yarn add -D @compodoc/compodoc
49
66
  ```
50
67
 
51
- Then you'll need to configure Compodoc to generate a `documentation.json` file. Adding the following snippet to your `package.json` creates a metadata file `./documentation.json` each time you run storybook:
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:
52
69
 
53
- ```json
70
+ ```jsonc
71
+ // angular.json
54
72
  {
55
- ...
56
- "scripts": {
57
- "docs:json": "compodoc -p ./tsconfig.json -e json -d .",
58
- "storybook": "npm run docs:json && start-storybook -p 6006 -s src/assets",
59
- ...
60
- },
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
+ }
61
99
  }
62
100
  ```
63
101
 
64
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.
65
103
 
66
- Next, add the following to `.storybook/preview.ts` to load the Compodoc-generated file:
67
-
68
- ```js
69
- import { setCompodocJson } from '@storybook/addon-docs/angular';
70
- import docJson from '../documentation.json';
71
- setCompodocJson(docJson);
72
- ```
73
-
74
104
  Finally, be sure to fill in the `component` field in your story metadata:
75
105
 
76
106
  ```ts
@@ -187,7 +217,7 @@ Storybook Docs renders all Angular stories inside IFrames, with a default height
187
217
  To update the global default, modify `.storybook/preview.ts`:
188
218
 
189
219
  ```ts
190
- export const parameters = { docs: { iframeHeight: 400 } };
220
+ export const parameters = { docs: { story: { iframeHeight: '400px' } } };
191
221
  ```
192
222
 
193
223
  For `DocsPage`, you need to update the parameter locally in a story:
@@ -195,7 +225,7 @@ For `DocsPage`, you need to update the parameter locally in a story:
195
225
  ```ts
196
226
  export const basic = () => ...
197
227
  basic.parameters = {
198
- docs: { iframeHeight: 400 }
228
+ docs: { story: { iframeHeight: '400px' } },
199
229
  }
200
230
  ```
201
231
 
@@ -209,12 +239,12 @@ And for `MDX` you can modify it as an attribute on the `Story` element:
209
239
 
210
240
  Storybook Docs renders all Angular stories inline by default.
211
241
 
212
- However, you can render stories in an iframe, with a default height of `60px` (configurable using the `docs.iframeHeight` story parameter), by using the `docs.inlineStories` parameter.
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.
213
243
 
214
244
  To do so for all stories, update `.storybook/preview.js`:
215
245
 
216
246
  ```js
217
- export const parameters = { docs: { inlineStories: false } };
247
+ export const parameters = { docs: { story: { inline: false } } };
218
248
  ```
219
249
 
220
250
  ## More resources
package/common/README.md CHANGED
@@ -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
- import { addParameters } from '@storybook/ember';
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: 400 }
82
+ docs: { story: { iframeHeight: '400px' } }
85
83
  }
86
84
  ```
87
85
 
package/ember/README.md CHANGED
@@ -125,7 +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
- export const parameters = { docs: { iframeHeight: 400 } };
128
+ export const parameters = { docs: { story: { iframeHeight: '400px' } } };
129
129
  ```
130
130
 
131
131
  For `DocsPage`, you need to update the parameter locally in a story:
@@ -133,7 +133,7 @@ For `DocsPage`, you need to update the parameter locally in a story:
133
133
  ```ts
134
134
  export const basic = () => ...
135
135
  basic.parameters = {
136
- docs: { iframeHeight: 400 }
136
+ docs: { story: { iframeHeight: '400px' } }
137
137
  }
138
138
  ```
139
139
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-docs",
3
- "version": "7.0.0-beta.29",
3
+ "version": "7.0.0-beta.30",
4
4
  "description": "Document component usage and properties in Markdown",
5
5
  "keywords": [
6
6
  "addon",
@@ -103,18 +103,18 @@
103
103
  "@babel/plugin-transform-react-jsx": "^7.19.0",
104
104
  "@jest/transform": "^29.3.1",
105
105
  "@mdx-js/react": "^2.1.5",
106
- "@storybook/blocks": "7.0.0-beta.29",
107
- "@storybook/client-logger": "7.0.0-beta.29",
108
- "@storybook/components": "7.0.0-beta.29",
109
- "@storybook/csf-plugin": "7.0.0-beta.29",
110
- "@storybook/csf-tools": "7.0.0-beta.29",
106
+ "@storybook/blocks": "7.0.0-beta.30",
107
+ "@storybook/client-logger": "7.0.0-beta.30",
108
+ "@storybook/components": "7.0.0-beta.30",
109
+ "@storybook/csf-plugin": "7.0.0-beta.30",
110
+ "@storybook/csf-tools": "7.0.0-beta.30",
111
111
  "@storybook/global": "^5.0.0",
112
112
  "@storybook/mdx2-csf": "next",
113
- "@storybook/node-logger": "7.0.0-beta.29",
114
- "@storybook/postinstall": "7.0.0-beta.29",
115
- "@storybook/preview-api": "7.0.0-beta.29",
116
- "@storybook/theming": "7.0.0-beta.29",
117
- "@storybook/types": "7.0.0-beta.29",
113
+ "@storybook/node-logger": "7.0.0-beta.30",
114
+ "@storybook/postinstall": "7.0.0-beta.30",
115
+ "@storybook/preview-api": "7.0.0-beta.30",
116
+ "@storybook/theming": "7.0.0-beta.30",
117
+ "@storybook/types": "7.0.0-beta.30",
118
118
  "fs-extra": "^9.0.1",
119
119
  "remark-external-links": "^8.0.0",
120
120
  "remark-slug": "^6.0.0",
@@ -141,7 +141,7 @@
141
141
  "./src/shims/mdx-react-shim.ts"
142
142
  ]
143
143
  },
144
- "gitHead": "c6b2e1a65b1a0f65c52819929344602708212a59",
144
+ "gitHead": "633f95bec79fb65524a7bcae867448b351920831",
145
145
  "storybook": {
146
146
  "displayName": "Docs",
147
147
  "icon": "https://user-images.githubusercontent.com/263385/101991672-48355c80-3c7c-11eb-82d9-95fa12438f64.png",
package/react/README.md CHANGED
@@ -100,12 +100,12 @@ Some **markdown** description, or whatever you want.
100
100
 
101
101
  Storybook Docs renders all React stories inline by default.
102
102
 
103
- However, you can render stories in an iframe, with a default height of `60px` (configurable using the `docs.iframeHeight` story parameter), by using the `docs.inlineStories` parameter.
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
104
 
105
105
  To do so for all stories, update `.storybook/preview.js`:
106
106
 
107
107
  ```js
108
- export const parameters = { docs: { inlineStories: false } };
108
+ export const parameters = { docs: { story: { inline: false } } };
109
109
  ```
110
110
 
111
111
  ## TypeScript props with `react-docgen`
package/vue/README.md CHANGED
@@ -135,12 +135,12 @@ Yes, it's redundant to declare `component` twice. [Coming soon](https://github.c
135
135
 
136
136
  Storybook Docs renders all Vue stories inline by default.
137
137
 
138
- However, you can render stories in an iframe, with a default height of `60px` (configurable using the `docs.iframeHeight` story parameter), by using the `docs.inlineStories` parameter.
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
140
  To do so for all stories, update `.storybook/preview.js`:
141
141
 
142
142
  ```js
143
- export const parameters = { docs: { inlineStories: false } };
143
+ export const parameters = { docs: { story: { inline: false } } };
144
144
  ```
145
145
 
146
146
  ## More resources
@@ -114,12 +114,12 @@ For a full example see the [web-components-kitchen-sink/custom-elements.json](..
114
114
 
115
115
  Storybook Docs renders all web components stories inline by default.
116
116
 
117
- However, you can render stories in an iframe, with a default height of `60px` (configurable using the `docs.iframeHeight` story parameter), by using the `docs.inlineStories` parameter.
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.
118
118
 
119
119
  To do so for all stories, update `.storybook/preview.js`:
120
120
 
121
121
  ```js
122
- export const parameters = { docs: { inlineStories: false } };
122
+ export const parameters = { docs: { story: { inline: false } } };
123
123
  ```
124
124
 
125
125
  ## More resources