@storybook/addon-docs 9.2.0-alpha.3 → 10.0.0-beta.0
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 +5 -3
- package/dist/_browser-chunks/Color-LWAWP22K.js +1566 -0
- package/dist/_browser-chunks/DocsRenderer-HT7GNKAR.js +9 -0
- package/dist/_browser-chunks/chunk-67KILNXL.js +6831 -0
- package/dist/_browser-chunks/chunk-74ZUTOZN.js +65 -0
- package/dist/_browser-chunks/chunk-MM7DTO55.js +44 -0
- package/dist/_browser-chunks/chunk-RX6225WF.js +46 -0
- package/dist/_browser-chunks/chunk-TQ5Q4DDG.js +846 -0
- package/dist/_browser-chunks/chunk-UZFOWTVP.js +974 -0
- package/dist/_node-chunks/chunk-32BBSODQ.js +231 -0
- package/dist/_node-chunks/chunk-SFE23BYR.js +48 -0
- package/dist/_node-chunks/chunk-W3NRVQR7.js +35424 -0
- package/dist/_node-chunks/chunk-WX5VRRPF.js +248 -0
- package/dist/_node-chunks/mdx-plugin-2RC5UF6O.js +1653 -0
- package/dist/_node-chunks/rehype-external-links-WVBYEZ7J.js +168 -0
- package/dist/_node-chunks/rehype-slug-JGTPG4A3.js +127 -0
- package/dist/angular/index.d.ts +3 -0
- package/dist/angular/index.js +11 -0
- package/dist/blocks.d.ts +86 -42
- package/dist/blocks.js +8123 -201
- package/dist/ember/index.d.ts +3 -0
- package/dist/ember/index.js +11 -0
- package/dist/index.d.ts +42 -5
- package/dist/index.js +17 -15
- package/dist/manager.js +85 -154
- package/dist/mdx-loader.js +38 -71
- package/dist/mdx-react-shim.js +2 -0
- package/dist/preset.js +310 -72
- package/dist/preview.js +8 -13
- package/dist/web-components/index.d.ts +2 -0
- package/dist/web-components/index.js +0 -0
- package/manager.js +1 -1
- package/package.json +45 -89
- package/preset.js +1 -1
- package/preview.js +1 -1
- package/angular/README.md +0 -256
- package/angular/index.d.ts +0 -1
- package/angular/index.js +0 -4
- package/common/README.md +0 -98
- package/dist/Color-AVL7NMMY.mjs +0 -10
- package/dist/DocsContainer-fccc2203.d.ts +0 -51
- package/dist/DocsRenderer-3PZUHFFL.mjs +0 -2
- package/dist/DocsRenderer-ULRJ3H2C.mjs +0 -8
- package/dist/blocks.mjs +0 -213
- package/dist/chunk-2UFMRE4V.mjs +0 -5
- package/dist/chunk-CEH6MNVV.mjs +0 -3
- package/dist/chunk-GWJYCGSQ.mjs +0 -7
- package/dist/chunk-QUZPS4B6.mjs +0 -3
- package/dist/chunk-SPFYY5GD.mjs +0 -3
- package/dist/index.mjs +0 -8
- package/dist/preview.mjs +0 -5
- package/dist/shims/mdx-react-shim.js +0 -12
- package/dist/shims/mdx-react-shim.mjs +0 -1
- package/ember/README.md +0 -153
- package/ember/index.d.ts +0 -1
- package/ember/index.js +0 -3
- package/react/README.md +0 -149
- package/svelte/HOC.svelte +0 -7
- package/vue/README.md +0 -152
- package/vue3/README.md +0 -152
- package/web-components/README.md +0 -131
- package/web-components/index.js +0 -1
- /package/dist/{shims/mdx-react-shim.d.ts → mdx-react-shim.d.ts} +0 -0
package/vue3/README.md
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
<center>
|
|
2
|
-
<img src="../docs/media/vue-hero.png" width="100%" />
|
|
3
|
-
</center>
|
|
4
|
-
|
|
5
|
-
<h1>Storybook Docs for Vue 3</h1>
|
|
6
|
-
|
|
7
|
-
> migration guide: This page documents the method to configure storybook introduced recently in 5.3.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
|
-
|
|
9
|
-
Storybook Docs transforms your Storybook stories into world-class component documentation. Storybook Docs for Vue 3 supports [DocsPage](../docs/docspage.md) for auto-generated docs, and [MDX](../docs/mdx.md) for rich long-form docs.
|
|
10
|
-
|
|
11
|
-
To learn more about Storybook Docs, read the [general documentation](../README.md). To learn the Vue 3 specifics, read on!
|
|
12
|
-
|
|
13
|
-
- [Installation](#installation)
|
|
14
|
-
- [Preset options](#preset-options)
|
|
15
|
-
- [DocsPage](#docspage)
|
|
16
|
-
- [Props tables](#props-tables)
|
|
17
|
-
- [MDX](#mdx)
|
|
18
|
-
- [Inline Stories](#inline-stories)
|
|
19
|
-
- [More resources](#more-resources)
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
22
|
-
|
|
23
|
-
First add the package. Make sure that the versions for your `@storybook/*` packages match:
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
yarn add -D @storybook/addon-docs
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Then add the following to your `.storybook/main.js` addons:
|
|
30
|
-
|
|
31
|
-
```js
|
|
32
|
-
export default {
|
|
33
|
-
addons: ['@storybook/addon-docs'],
|
|
34
|
-
};
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Preset options
|
|
38
|
-
|
|
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
|
-
|
|
41
|
-
```js
|
|
42
|
-
import * as path from 'path';
|
|
43
|
-
|
|
44
|
-
export default {
|
|
45
|
-
addons: [
|
|
46
|
-
{
|
|
47
|
-
name: '@storybook/addon-docs',
|
|
48
|
-
options: {
|
|
49
|
-
vueDocgenOptions: {
|
|
50
|
-
alias: {
|
|
51
|
-
'@': path.resolve(__dirname, '../'),
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
};
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
The `vueDocgenOptions` is an object for configuring `vue-docgen-api`. See [`vue-docgen-api`'s docs](https://github.com/vue-styleguidist/vue-styleguidist/tree/dev/packages/vue-docgen-api#options-docgenoptions) for available configuration options.
|
|
61
|
-
|
|
62
|
-
## DocsPage
|
|
63
|
-
|
|
64
|
-
When you [install docs](#installation) you should get basic [DocsPage](../docs/docspage.md) documentation automagically for all your stories, available in the `Docs` tab of the Storybook UI.
|
|
65
|
-
|
|
66
|
-
## Props tables
|
|
67
|
-
|
|
68
|
-
Getting [Props tables](../docs/props-tables.md) for your components requires a few more steps. Docs for Vue relies on [`vue-docgen-loader`](https://github.com/pocka/vue-docgen-loader). It supports `props`, `events`, and `slots` as first class prop types.
|
|
69
|
-
|
|
70
|
-
Finally, be sure to fill in the `component` field in your story metadata:
|
|
71
|
-
|
|
72
|
-
```ts
|
|
73
|
-
import { InfoButton } from './InfoButton.vue';
|
|
74
|
-
|
|
75
|
-
export default {
|
|
76
|
-
title: 'InfoButton',
|
|
77
|
-
component: InfoButton,
|
|
78
|
-
};
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
If you haven't upgraded from `storiesOf`, you can use a parameter to do the same thing:
|
|
82
|
-
|
|
83
|
-
```ts
|
|
84
|
-
import { storiesOf } from '@storybook/vue';
|
|
85
|
-
import { InfoButton } from './InfoButton.vue';
|
|
86
|
-
|
|
87
|
-
storiesOf('InfoButton', module)
|
|
88
|
-
.addParameters({ component: InfoButton })
|
|
89
|
-
.add( ... );
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## MDX
|
|
93
|
-
|
|
94
|
-
[MDX](../docs/mdx.md) is a convenient way to document your components in Markdown and embed documentation components, such as stories and props tables, inline.
|
|
95
|
-
|
|
96
|
-
Docs has peer dependencies on `react`. If you want to write stories in MDX, you may need to add this dependency as well:
|
|
97
|
-
|
|
98
|
-
```sh
|
|
99
|
-
yarn add -D react
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Then update your `.storybook/main.js` to make sure you load MDX files:
|
|
103
|
-
|
|
104
|
-
```js
|
|
105
|
-
export default {
|
|
106
|
-
stories: ['../src/stories/**/*.stories.@(js|mdx)'],
|
|
107
|
-
};
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Finally, you can create MDX files like this:
|
|
111
|
-
|
|
112
|
-
```md
|
|
113
|
-
import { Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
|
114
|
-
import { InfoButton } from './InfoButton.vue';
|
|
115
|
-
|
|
116
|
-
<Meta title='InfoButton' component={InfoButton} />
|
|
117
|
-
|
|
118
|
-
# InfoButton
|
|
119
|
-
|
|
120
|
-
Some **markdown** description, or whatever you want.
|
|
121
|
-
|
|
122
|
-
<Story name='basic' height='400px'>{{
|
|
123
|
-
components: { InfoButton },
|
|
124
|
-
template: '<info-button label="I\'m a button!"/>',
|
|
125
|
-
}}</Story>
|
|
126
|
-
|
|
127
|
-
## ArgsTable
|
|
128
|
-
|
|
129
|
-
<ArgsTable of={InfoButton} />
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Yes, it's redundant to declare `component` twice. [Coming soon](https://github.com/storybookjs/storybook/issues/8685).
|
|
133
|
-
|
|
134
|
-
## Inline Stories
|
|
135
|
-
|
|
136
|
-
Storybook Docs renders all Vue stories inline by default.
|
|
137
|
-
|
|
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
|
-
|
|
140
|
-
To do so for all stories, update `.storybook/preview.js`:
|
|
141
|
-
|
|
142
|
-
```js
|
|
143
|
-
export const parameters = { docs: { story: { inline: false } } };
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## More resources
|
|
147
|
-
|
|
148
|
-
Want to learn more? Here are some more articles on Storybook Docs:
|
|
149
|
-
|
|
150
|
-
- References: [DocsPage](../docs/docspage.md) / [MDX](../docs/mdx.md) / [FAQ](../docs/faq.md) / [Recipes](../docs/recipes.md) / [Theming](../docs/theming.md) / [Props](../docs/props-tables.md)
|
|
151
|
-
- Announcements: [Vision](https://medium.com/storybookjs/storybook-docs-sneak-peak-5be78445094a) / [DocsPage](https://medium.com/storybookjs/storybook-docspage-e185bc3622bf) / [MDX](https://medium.com/storybookjs/rich-docs-with-storybook-mdx-61bc145ae7bc) / [Framework support](https://medium.com/storybookjs/storybook-docs-for-new-frameworks-b1f6090ee0ea)
|
|
152
|
-
- Example: [Storybook Design System](https://github.com/storybookjs/design-system)
|
package/web-components/README.md
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
<h1>Storybook Docs for Web Components</h1>
|
|
2
|
-
|
|
3
|
-
- [Installation](#installation)
|
|
4
|
-
- [Props tables](#props-tables)
|
|
5
|
-
- [Stories not inline](#stories-not-inline)
|
|
6
|
-
- [More resources](#more-resources)
|
|
7
|
-
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
- Be sure to check the [installation section of the general addon-docs page](../README.md) before proceeding.
|
|
11
|
-
- Be sure to have a [custom-elements.json](./#custom-elementsjson) file.
|
|
12
|
-
- Add to your `.storybook/preview.js`
|
|
13
|
-
|
|
14
|
-
```js
|
|
15
|
-
import { setCustomElementsManifest } from '@storybook/web-components';
|
|
16
|
-
import customElements from '../custom-elements.json';
|
|
17
|
-
|
|
18
|
-
setCustomElementsManifest(customElements);
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
- Add to your story files
|
|
22
|
-
|
|
23
|
-
```js
|
|
24
|
-
export default {
|
|
25
|
-
title: 'Demo Card',
|
|
26
|
-
component: 'your-component-name', // which is also found in the `custom-elements.json`
|
|
27
|
-
};
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Props tables
|
|
31
|
-
|
|
32
|
-
In order to get [Props tables](..docs/../../docs/props-tables.md) documentation for web-components you will need to have a [custom-elements.json](https://github.com/webcomponents/custom-elements-json) file.
|
|
33
|
-
|
|
34
|
-
You can hand write it or better generate it. Depending on the web components sugar you are choosing your mileage may vary.
|
|
35
|
-
|
|
36
|
-
Known analyzers that output `custom-elements.json` v1.0.0:
|
|
37
|
-
|
|
38
|
-
- [@custom-elements-manifest/analyzer](https://github.com/open-wc/custom-elements-manifest)
|
|
39
|
-
- Supports Vanilla, LitElement, FASTElement, Stencil, Catalyst, Atomico
|
|
40
|
-
|
|
41
|
-
Known analyzers that output older versions of `custom-elements.json`:
|
|
42
|
-
|
|
43
|
-
- [web-component-analyzer](https://github.com/runem/web-component-analyzer)
|
|
44
|
-
- Supports LitElement, Polymer, Vanilla, (Stencil)
|
|
45
|
-
- [stenciljs](https://stenciljs.com/)
|
|
46
|
-
- Supports Stencil (but does not have all metadata)
|
|
47
|
-
|
|
48
|
-
To generate this file with Stencil, add `docs-vscode` to outputTargets in `stencil.config.ts`:
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
{
|
|
52
|
-
type: 'docs-vscode',
|
|
53
|
-
file: 'custom-elements.json'
|
|
54
|
-
},
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
The file looks something like this:
|
|
58
|
-
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"schemaVersion": "1.0.0",
|
|
62
|
-
"readme": "",
|
|
63
|
-
"modules": [
|
|
64
|
-
{
|
|
65
|
-
"kind": "javascript-module",
|
|
66
|
-
"path": "src/my-element.js",
|
|
67
|
-
"declarations": [
|
|
68
|
-
{
|
|
69
|
-
"kind": "class",
|
|
70
|
-
"description": "",
|
|
71
|
-
"name": "MyElement",
|
|
72
|
-
"members": [
|
|
73
|
-
{
|
|
74
|
-
"kind": "field",
|
|
75
|
-
"name": "disabled"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"kind": "method",
|
|
79
|
-
"name": "fire"
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
"events": [
|
|
83
|
-
{
|
|
84
|
-
"name": "disabled-changed",
|
|
85
|
-
"type": {
|
|
86
|
-
"text": "Event"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
"superclass": {
|
|
91
|
-
"name": "HTMLElement"
|
|
92
|
-
},
|
|
93
|
-
"tagName": "my-element"
|
|
94
|
-
}
|
|
95
|
-
],
|
|
96
|
-
"exports": [
|
|
97
|
-
{
|
|
98
|
-
"kind": "custom-element-definition",
|
|
99
|
-
"name": "my-element",
|
|
100
|
-
"declaration": {
|
|
101
|
-
"name": "MyElement",
|
|
102
|
-
"module": "src/my-element.js"
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
For a full example see the [web-components-kitchen-sink/custom-elements.json](../../../examples/web-components-kitchen-sink/custom-elements.json).
|
|
112
|
-
|
|
113
|
-
## Stories not inline
|
|
114
|
-
|
|
115
|
-
Storybook Docs renders all web components stories inline by default.
|
|
116
|
-
|
|
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
|
-
|
|
119
|
-
To do so for all stories, update `.storybook/preview.js`:
|
|
120
|
-
|
|
121
|
-
```js
|
|
122
|
-
export const parameters = { docs: { story: { inline: false } } };
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## More resources
|
|
126
|
-
|
|
127
|
-
Want to learn more? Here are some more articles on Storybook Docs:
|
|
128
|
-
|
|
129
|
-
- References: [DocsPage](../docs/docspage.md) / [MDX](../docs/mdx.md) / [FAQ](../docs/faq.md) / [Recipes](../docs/recipes.md) / [Theming](../docs/theming.md) / [Props](../docs/props-tables.md)
|
|
130
|
-
- Announcements: [Vision](https://medium.com/storybookjs/storybook-docs-sneak-peak-5be78445094a) / [DocsPage](https://medium.com/storybookjs/storybook-docspage-e185bc3622bf) / [MDX](https://medium.com/storybookjs/rich-docs-with-storybook-mdx-61bc145ae7bc) / [Framework support](https://medium.com/storybookjs/storybook-docs-for-new-frameworks-b1f6090ee0ea)
|
|
131
|
-
- Example: [Storybook Design System](https://github.com/storybookjs/design-system)
|
package/web-components/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('../dist/frameworks/common/index');
|
|
File without changes
|