@storybook/addon-docs 6.2.5 → 6.2.9
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.
|
@@ -245,10 +245,12 @@ var ComponentsTable = function ComponentsTable(props) {
|
|
|
245
245
|
var context = (0, _react.useContext)(_DocsContext.DocsContext);
|
|
246
246
|
var components = props.components,
|
|
247
247
|
include = props.include,
|
|
248
|
-
exclude = props.exclude
|
|
248
|
+
exclude = props.exclude,
|
|
249
|
+
sort = props.sort;
|
|
249
250
|
var tabs = addComponentTabs({}, components, context, include, exclude);
|
|
250
251
|
return /*#__PURE__*/_react.default.createElement(_components.TabbedArgsTable, {
|
|
251
|
-
tabs: tabs
|
|
252
|
+
tabs: tabs,
|
|
253
|
+
sort: sort
|
|
252
254
|
});
|
|
253
255
|
};
|
|
254
256
|
|
|
@@ -291,7 +293,9 @@ var ArgsTable = function ArgsTable(props) {
|
|
|
291
293
|
};
|
|
292
294
|
}
|
|
293
295
|
|
|
294
|
-
return /*#__PURE__*/_react.default.createElement(_components.ArgsTable, mainProps
|
|
296
|
+
return /*#__PURE__*/_react.default.createElement(_components.ArgsTable, _extends({}, mainProps, {
|
|
297
|
+
sort: sort
|
|
298
|
+
}));
|
|
295
299
|
}
|
|
296
300
|
|
|
297
301
|
if (components) {
|
|
@@ -212,10 +212,12 @@ export var ComponentsTable = function ComponentsTable(props) {
|
|
|
212
212
|
var context = useContext(DocsContext);
|
|
213
213
|
var components = props.components,
|
|
214
214
|
include = props.include,
|
|
215
|
-
exclude = props.exclude
|
|
215
|
+
exclude = props.exclude,
|
|
216
|
+
sort = props.sort;
|
|
216
217
|
var tabs = addComponentTabs({}, components, context, include, exclude);
|
|
217
218
|
return /*#__PURE__*/React.createElement(TabbedArgsTable, {
|
|
218
|
-
tabs: tabs
|
|
219
|
+
tabs: tabs,
|
|
220
|
+
sort: sort
|
|
219
221
|
});
|
|
220
222
|
};
|
|
221
223
|
export var ArgsTable = function ArgsTable(props) {
|
|
@@ -255,7 +257,9 @@ export var ArgsTable = function ArgsTable(props) {
|
|
|
255
257
|
};
|
|
256
258
|
}
|
|
257
259
|
|
|
258
|
-
return /*#__PURE__*/React.createElement(PureArgsTable, mainProps
|
|
260
|
+
return /*#__PURE__*/React.createElement(PureArgsTable, _extends({}, mainProps, {
|
|
261
|
+
sort: sort
|
|
262
|
+
}));
|
|
259
263
|
}
|
|
260
264
|
|
|
261
265
|
if (components) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-docs",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.9",
|
|
4
4
|
"description": "Document component usage and properties in Markdown",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"addon",
|
|
@@ -58,19 +58,19 @@
|
|
|
58
58
|
"@mdx-js/loader": "^1.6.22",
|
|
59
59
|
"@mdx-js/mdx": "^1.6.22",
|
|
60
60
|
"@mdx-js/react": "^1.6.22",
|
|
61
|
-
"@storybook/addons": "6.2.
|
|
62
|
-
"@storybook/api": "6.2.
|
|
63
|
-
"@storybook/builder-webpack4": "6.2.
|
|
64
|
-
"@storybook/client-api": "6.2.
|
|
65
|
-
"@storybook/client-logger": "6.2.
|
|
66
|
-
"@storybook/components": "6.2.
|
|
67
|
-
"@storybook/core": "6.2.
|
|
68
|
-
"@storybook/core-events": "6.2.
|
|
61
|
+
"@storybook/addons": "6.2.9",
|
|
62
|
+
"@storybook/api": "6.2.9",
|
|
63
|
+
"@storybook/builder-webpack4": "6.2.9",
|
|
64
|
+
"@storybook/client-api": "6.2.9",
|
|
65
|
+
"@storybook/client-logger": "6.2.9",
|
|
66
|
+
"@storybook/components": "6.2.9",
|
|
67
|
+
"@storybook/core": "6.2.9",
|
|
68
|
+
"@storybook/core-events": "6.2.9",
|
|
69
69
|
"@storybook/csf": "0.0.1",
|
|
70
|
-
"@storybook/node-logger": "6.2.
|
|
71
|
-
"@storybook/postinstall": "6.2.
|
|
72
|
-
"@storybook/source-loader": "6.2.
|
|
73
|
-
"@storybook/theming": "6.2.
|
|
70
|
+
"@storybook/node-logger": "6.2.9",
|
|
71
|
+
"@storybook/postinstall": "6.2.9",
|
|
72
|
+
"@storybook/source-loader": "6.2.9",
|
|
73
|
+
"@storybook/theming": "6.2.9",
|
|
74
74
|
"acorn": "^7.4.1",
|
|
75
75
|
"acorn-jsx": "^5.3.1",
|
|
76
76
|
"acorn-walk": "^7.2.0",
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
"@babel/core": "^7.12.10",
|
|
98
98
|
"@emotion/core": "^10.1.1",
|
|
99
99
|
"@emotion/styled": "^10.0.27",
|
|
100
|
-
"@storybook/angular": "6.2.
|
|
101
|
-
"@storybook/react": "6.2.
|
|
102
|
-
"@storybook/vue": "6.2.
|
|
103
|
-
"@storybook/web-components": "6.2.
|
|
100
|
+
"@storybook/angular": "6.2.9",
|
|
101
|
+
"@storybook/react": "6.2.9",
|
|
102
|
+
"@storybook/vue": "6.2.9",
|
|
103
|
+
"@storybook/web-components": "6.2.9",
|
|
104
104
|
"@types/cross-spawn": "^6.0.2",
|
|
105
105
|
"@types/doctrine": "^0.0.3",
|
|
106
106
|
"@types/enzyme": "^3.10.8",
|
|
@@ -131,9 +131,9 @@
|
|
|
131
131
|
},
|
|
132
132
|
"peerDependencies": {
|
|
133
133
|
"@babel/core": "^7.11.5",
|
|
134
|
-
"@storybook/angular": "6.2.
|
|
135
|
-
"@storybook/vue": "6.2.
|
|
136
|
-
"@storybook/vue3": "6.2.
|
|
134
|
+
"@storybook/angular": "6.2.9",
|
|
135
|
+
"@storybook/vue": "6.2.9",
|
|
136
|
+
"@storybook/vue3": "6.2.9",
|
|
137
137
|
"babel-loader": "^8.0.0",
|
|
138
138
|
"react": "^16.8.0 || ^17.0.0",
|
|
139
139
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
"publishConfig": {
|
|
175
175
|
"access": "public"
|
|
176
176
|
},
|
|
177
|
-
"gitHead": "
|
|
177
|
+
"gitHead": "588d1330b80596a41cc6bae7aecc00201a6c0679",
|
|
178
178
|
"storybook": {
|
|
179
179
|
"displayName": "Docs",
|
|
180
180
|
"icon": "https://user-images.githubusercontent.com/263385/101991672-48355c80-3c7c-11eb-82d9-95fa12438f64.png",
|
|
@@ -0,0 +1,107 @@
|
|
|
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 { setCustomElements } from '@storybook/web-components';
|
|
16
|
+
import customElements from '../custom-elements.json';
|
|
17
|
+
|
|
18
|
+
setCustomElements(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 milage may vary.
|
|
35
|
+
|
|
36
|
+
Known analyzers that output `custom-elements.json`:
|
|
37
|
+
|
|
38
|
+
- [web-component-analyzer](https://github.com/runem/web-component-analyzer)
|
|
39
|
+
- Supports LitElement, Polymer, Vanilla, (Stencil)
|
|
40
|
+
- [stenciljs](https://stenciljs.com/)
|
|
41
|
+
- Supports Stencil (but does not have all metadata)
|
|
42
|
+
|
|
43
|
+
To generate this file with Stencil, add `docs-vscode` to outputTargets in `stencil.config.ts`:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
{
|
|
47
|
+
type: 'docs-vscode',
|
|
48
|
+
file: 'custom-elements.json'
|
|
49
|
+
},
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The file looks something like this:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"version": 2,
|
|
57
|
+
"tags": [
|
|
58
|
+
{
|
|
59
|
+
"name": "demo-wc-card",
|
|
60
|
+
"properties": [
|
|
61
|
+
{
|
|
62
|
+
"name": "header",
|
|
63
|
+
"type": "String",
|
|
64
|
+
"attribute": "header",
|
|
65
|
+
"description": "Shown at the top of the card",
|
|
66
|
+
"default": "Your Message"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"events": [],
|
|
70
|
+
"slots": [],
|
|
71
|
+
"cssProperties": []
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
For a full example see the [web-components-kitchen-sink/custom-elements.json](../../../examples/web-components-kitchen-sink/custom-elements.json).
|
|
78
|
+
|
|
79
|
+
## Stories not inline
|
|
80
|
+
|
|
81
|
+
By default stories are rendered inline.
|
|
82
|
+
For web components that is usually fine as they are style encapsulated via shadow dom.
|
|
83
|
+
However when you have a style tag in you template it might be best to show them in an iframe.
|
|
84
|
+
|
|
85
|
+
To always use iframes you can set
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
addParameters({
|
|
89
|
+
docs: {
|
|
90
|
+
inlineStories: false,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
or add it to individual stories.
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
<Story inline={false} />
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## More resources
|
|
102
|
+
|
|
103
|
+
Want to learn more? Here are some more articles on Storybook Docs:
|
|
104
|
+
|
|
105
|
+
- 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)
|
|
106
|
+
- 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)
|
|
107
|
+
- Example: [Storybook Design System](https://github.com/storybookjs/design-system)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/frameworks/common/index');
|