@storybook/addon-docs 6.2.0-rc.6 → 6.2.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/angular/README.md +0 -2
- package/dist/cjs/blocks/mdx.js +4 -2
- package/dist/cjs/frameworks/angular/config.js +1 -1
- package/dist/cjs/frameworks/angular/prepareForInline.js +27 -5
- package/dist/cjs/frameworks/angular/preset.js +53 -0
- package/dist/cjs/frameworks/svelte/sourceDecorator.js +4 -0
- package/dist/cjs/lib/docgen/createPropDef.js +31 -5
- package/dist/cjs/lib/docgen/types.js +2 -9
- package/dist/cjs/public_api.js +9 -1
- package/dist/esm/blocks/mdx.js +4 -2
- package/dist/esm/frameworks/angular/config.js +1 -1
- package/dist/esm/frameworks/angular/prepareForInline.js +17 -4
- package/dist/esm/frameworks/angular/preset.js +43 -0
- package/dist/esm/frameworks/svelte/sourceDecorator.js +4 -0
- package/dist/esm/lib/docgen/createPropDef.js +30 -5
- package/dist/esm/lib/docgen/types.js +3 -4
- package/dist/esm/public_api.js +2 -0
- package/dist/ts3.4/frameworks/angular/preset.d.ts +2 -0
- package/dist/ts3.4/lib/docgen/types.d.ts +1 -0
- package/dist/ts3.4/public_api.d.ts +2 -0
- package/dist/ts3.9/frameworks/angular/preset.d.ts +2 -0
- package/dist/ts3.9/lib/docgen/types.d.ts +2 -1
- package/dist/ts3.9/public_api.d.ts +2 -0
- package/package.json +21 -21
package/angular/README.md
CHANGED
|
@@ -220,12 +220,10 @@ Then update `.storybook/preview.js`:
|
|
|
220
220
|
|
|
221
221
|
```js
|
|
222
222
|
import { addParameters } from '@storybook/angular';
|
|
223
|
-
import { prepareForInline } from '@storybook/addon-docs/angular/inline';
|
|
224
223
|
|
|
225
224
|
addParameters({
|
|
226
225
|
docs: {
|
|
227
226
|
inlineStories: true,
|
|
228
|
-
prepareForInline,
|
|
229
227
|
},
|
|
230
228
|
});
|
|
231
229
|
```
|
package/dist/cjs/blocks/mdx.js
CHANGED
|
@@ -135,8 +135,10 @@ var AnchorMdx = function AnchorMdx(props) {
|
|
|
135
135
|
return /*#__PURE__*/_react.default.createElement(A, _extends({
|
|
136
136
|
href: href,
|
|
137
137
|
onClick: function onClick(event) {
|
|
138
|
-
event.preventDefault();
|
|
139
|
-
|
|
138
|
+
event.preventDefault(); // use the A element's href, which has been modified for
|
|
139
|
+
// local paths without a `?path=` query param prefix
|
|
140
|
+
|
|
141
|
+
navigate(event.currentTarget.getAttribute('href'));
|
|
140
142
|
},
|
|
141
143
|
target: target
|
|
142
144
|
}, rest), children);
|
|
@@ -16,7 +16,7 @@ var _prepareForInline = require("./prepareForInline");
|
|
|
16
16
|
var parameters = {
|
|
17
17
|
docs: {
|
|
18
18
|
// probably set this to true by default once it's battle-tested
|
|
19
|
-
inlineStories:
|
|
19
|
+
inlineStories: true,
|
|
20
20
|
prepareForInline: _prepareForInline.prepareForInline,
|
|
21
21
|
extractArgTypes: _compodoc.extractArgTypes,
|
|
22
22
|
extractComponentDescription: _compodoc.extractComponentDescription,
|
|
@@ -6,6 +6,10 @@ require("core-js/modules/es.array.concat.js");
|
|
|
6
6
|
|
|
7
7
|
require("core-js/modules/es.object.get-prototype-of.js");
|
|
8
8
|
|
|
9
|
+
require("core-js/modules/es.object.to-string.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.promise.js");
|
|
12
|
+
|
|
9
13
|
Object.defineProperty(exports, "__esModule", {
|
|
10
14
|
value: true
|
|
11
15
|
});
|
|
@@ -15,10 +19,14 @@ require("regenerator-runtime/runtime.js");
|
|
|
15
19
|
|
|
16
20
|
var _react = _interopRequireDefault(require("react"));
|
|
17
21
|
|
|
18
|
-
var
|
|
22
|
+
var _clientLogger = require("@storybook/client-logger");
|
|
19
23
|
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
25
|
|
|
26
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
22
30
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
23
31
|
|
|
24
32
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -78,24 +86,38 @@ var prepareForInline = function prepareForInline(storyFn, _ref) {
|
|
|
78
86
|
key: "componentDidMount",
|
|
79
87
|
value: function () {
|
|
80
88
|
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
89
|
+
var _yield$import$catch, ElementRendererService;
|
|
90
|
+
|
|
81
91
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
82
92
|
while (1) {
|
|
83
93
|
switch (_context.prev = _context.next) {
|
|
84
94
|
case 0:
|
|
95
|
+
_context.next = 2;
|
|
96
|
+
return Promise.resolve().then(function () {
|
|
97
|
+
return _interopRequireWildcard(require('@storybook/angular/element-renderer'));
|
|
98
|
+
}).catch(function (error) {
|
|
99
|
+
_clientLogger.logger.error('Check the documentation to activate `inlineStories`. The `@angular/elements` & `@webcomponents/custom-elements` dependencies are required.');
|
|
100
|
+
|
|
101
|
+
throw error;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
case 2:
|
|
105
|
+
_yield$import$catch = _context.sent;
|
|
106
|
+
ElementRendererService = _yield$import$catch.ElementRendererService;
|
|
85
107
|
_context.t0 = customElements;
|
|
86
108
|
_context.t1 = customElementsName;
|
|
87
|
-
_context.next =
|
|
88
|
-
return new
|
|
109
|
+
_context.next = 8;
|
|
110
|
+
return new ElementRendererService().renderAngularElement({
|
|
89
111
|
storyFnAngular: storyFn(),
|
|
90
112
|
parameters: parameters
|
|
91
113
|
});
|
|
92
114
|
|
|
93
|
-
case
|
|
115
|
+
case 8:
|
|
94
116
|
_context.t2 = _context.sent;
|
|
95
117
|
|
|
96
118
|
_context.t0.define.call(_context.t0, _context.t1, _context.t2);
|
|
97
119
|
|
|
98
|
-
case
|
|
120
|
+
case 10:
|
|
99
121
|
case "end":
|
|
100
122
|
return _context.stop();
|
|
101
123
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.array.concat.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.object.assign.js");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.webpackFinal = webpackFinal;
|
|
11
|
+
|
|
12
|
+
var _webpack = require("webpack");
|
|
13
|
+
|
|
14
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
+
|
|
16
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
|
|
18
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
|
+
|
|
20
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
21
|
+
|
|
22
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
23
|
+
|
|
24
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
+
|
|
26
|
+
function webpackFinal() {
|
|
27
|
+
var webpackConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
28
|
+
return Object.assign({}, webpackConfig, {
|
|
29
|
+
plugins: [].concat(_toConsumableArray(webpackConfig.plugins), _toConsumableArray(makeAngularElementRendererOptional()))
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Ignore `@storybook/angular/element-renderer` import if `@angular/elements` is not available
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
function makeAngularElementRendererOptional() {
|
|
38
|
+
if (moduleIsAvailable('@angular/elements') && moduleIsAvailable('@webcomponents/custom-elements')) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return [new _webpack.IgnorePlugin(/@storybook(\\|\/)angular(\\|\/)element-renderer/)];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function moduleIsAvailable(moduleName) {
|
|
46
|
+
try {
|
|
47
|
+
require.resolve(moduleName);
|
|
48
|
+
|
|
49
|
+
return true;
|
|
50
|
+
} catch (e) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -96,6 +96,10 @@ function toSvelteProperty(key, value, argTypes) {
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
function getComponentName(component) {
|
|
99
|
+
if (component == null) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
99
103
|
var _component$__docgen = component.__docgen,
|
|
100
104
|
__docgen = _component$__docgen === void 0 ? {} : _component$__docgen;
|
|
101
105
|
|
|
@@ -4,6 +4,8 @@ require("core-js/modules/es.symbol.js");
|
|
|
4
4
|
|
|
5
5
|
require("core-js/modules/es.symbol.description.js");
|
|
6
6
|
|
|
7
|
+
require("core-js/modules/es.array.every.js");
|
|
8
|
+
|
|
7
9
|
require("core-js/modules/es.array.map.js");
|
|
8
10
|
|
|
9
11
|
require("core-js/modules/es.function.name.js");
|
|
@@ -28,18 +30,42 @@ var _convert = require("../convert");
|
|
|
28
30
|
function createType(type) {
|
|
29
31
|
// A type could be null if a defaultProp has been provided without a type definition.
|
|
30
32
|
return type != null ? (0, _utils.createSummaryValue)(type.name) : null;
|
|
33
|
+
} // A heuristic to tell if a defaultValue comes from RDT
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
function isReactDocgenTypescript(defaultValue) {
|
|
37
|
+
var computed = defaultValue.computed,
|
|
38
|
+
func = defaultValue.func;
|
|
39
|
+
return typeof computed === 'undefined' && typeof func === 'undefined';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function isStringValued(type) {
|
|
43
|
+
if (!type) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (type.name === 'string') {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (type.name === 'enum') {
|
|
52
|
+
return Array.isArray(type.value) && type.value.every(function (_ref) {
|
|
53
|
+
var tv = _ref.value;
|
|
54
|
+
return typeof tv === 'string' && tv[0] === '"' && tv[tv.length - 1] === '"';
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return false;
|
|
31
59
|
}
|
|
32
60
|
|
|
33
61
|
function createDefaultValue(defaultValue, type) {
|
|
34
62
|
if (defaultValue != null) {
|
|
35
|
-
var value = defaultValue.value
|
|
36
|
-
computed = defaultValue.computed,
|
|
37
|
-
func = defaultValue.func;
|
|
63
|
+
var value = defaultValue.value;
|
|
38
64
|
|
|
39
65
|
if (!(0, _defaultValue.isDefaultValueBlacklisted)(value)) {
|
|
40
66
|
// Work around a bug in `react-docgen-typescript-loader`, which returns 'string' for a string
|
|
41
|
-
// default, instead of "'string'" -- which is incorrect
|
|
42
|
-
if (
|
|
67
|
+
// default, instead of "'string'" -- which is incorrect
|
|
68
|
+
if (isReactDocgenTypescript(defaultValue) && isStringValued(type)) {
|
|
43
69
|
return (0, _utils.createSummaryValue)(JSON.stringify(value));
|
|
44
70
|
}
|
|
45
71
|
|
|
@@ -3,16 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "PropDef", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _PropDef.PropDef;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
6
|
exports.TypeSystem = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
8
|
+
// export type DocgenType = DocgenPropType | DocgenFlowType | DocgenTypeScriptType;
|
|
16
9
|
var TypeSystem;
|
|
17
10
|
exports.TypeSystem = TypeSystem;
|
|
18
11
|
|
package/dist/cjs/public_api.js
CHANGED
package/dist/esm/blocks/mdx.js
CHANGED
|
@@ -102,8 +102,10 @@ export var AnchorMdx = function AnchorMdx(props) {
|
|
|
102
102
|
return /*#__PURE__*/React.createElement(A, _extends({
|
|
103
103
|
href: href,
|
|
104
104
|
onClick: function onClick(event) {
|
|
105
|
-
event.preventDefault();
|
|
106
|
-
|
|
105
|
+
event.preventDefault(); // use the A element's href, which has been modified for
|
|
106
|
+
// local paths without a `?path=` query param prefix
|
|
107
|
+
|
|
108
|
+
navigate(event.currentTarget.getAttribute('href'));
|
|
107
109
|
},
|
|
108
110
|
target: target
|
|
109
111
|
}, rest), children);
|
|
@@ -5,7 +5,7 @@ import { prepareForInline } from './prepareForInline';
|
|
|
5
5
|
export var parameters = {
|
|
6
6
|
docs: {
|
|
7
7
|
// probably set this to true by default once it's battle-tested
|
|
8
|
-
inlineStories:
|
|
8
|
+
inlineStories: true,
|
|
9
9
|
prepareForInline: prepareForInline,
|
|
10
10
|
extractArgTypes: extractArgTypes,
|
|
11
11
|
extractComponentDescription: extractComponentDescription,
|
|
@@ -2,6 +2,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
2
2
|
|
|
3
3
|
import "core-js/modules/es.array.concat.js";
|
|
4
4
|
import "core-js/modules/es.object.get-prototype-of.js";
|
|
5
|
+
import "core-js/modules/es.object.to-string.js";
|
|
6
|
+
import "core-js/modules/es.promise.js";
|
|
5
7
|
import "regenerator-runtime/runtime.js";
|
|
6
8
|
|
|
7
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
@@ -29,7 +31,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
29
31
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
30
32
|
|
|
31
33
|
import React from 'react';
|
|
32
|
-
import {
|
|
34
|
+
import { logger } from '@storybook/client-logger';
|
|
33
35
|
var customElementsVersions = {};
|
|
34
36
|
/**
|
|
35
37
|
* Uses angular element to generate on-the-fly web components and reference it with `customElements`
|
|
@@ -65,24 +67,35 @@ export var prepareForInline = function prepareForInline(storyFn, _ref) {
|
|
|
65
67
|
key: "componentDidMount",
|
|
66
68
|
value: function () {
|
|
67
69
|
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
70
|
+
var _yield$import$catch, ElementRendererService;
|
|
71
|
+
|
|
68
72
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
69
73
|
while (1) {
|
|
70
74
|
switch (_context.prev = _context.next) {
|
|
71
75
|
case 0:
|
|
76
|
+
_context.next = 2;
|
|
77
|
+
return import('@storybook/angular/element-renderer').catch(function (error) {
|
|
78
|
+
logger.error('Check the documentation to activate `inlineStories`. The `@angular/elements` & `@webcomponents/custom-elements` dependencies are required.');
|
|
79
|
+
throw error;
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
case 2:
|
|
83
|
+
_yield$import$catch = _context.sent;
|
|
84
|
+
ElementRendererService = _yield$import$catch.ElementRendererService;
|
|
72
85
|
_context.t0 = customElements;
|
|
73
86
|
_context.t1 = customElementsName;
|
|
74
|
-
_context.next =
|
|
87
|
+
_context.next = 8;
|
|
75
88
|
return new ElementRendererService().renderAngularElement({
|
|
76
89
|
storyFnAngular: storyFn(),
|
|
77
90
|
parameters: parameters
|
|
78
91
|
});
|
|
79
92
|
|
|
80
|
-
case
|
|
93
|
+
case 8:
|
|
81
94
|
_context.t2 = _context.sent;
|
|
82
95
|
|
|
83
96
|
_context.t0.define.call(_context.t0, _context.t1, _context.t2);
|
|
84
97
|
|
|
85
|
-
case
|
|
98
|
+
case 10:
|
|
86
99
|
case "end":
|
|
87
100
|
return _context.stop();
|
|
88
101
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import "core-js/modules/es.array.concat.js";
|
|
2
|
+
import "core-js/modules/es.object.assign.js";
|
|
3
|
+
|
|
4
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
|
+
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
|
|
10
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
11
|
+
|
|
12
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
+
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
15
|
+
|
|
16
|
+
import { IgnorePlugin } from 'webpack';
|
|
17
|
+
export function webpackFinal() {
|
|
18
|
+
var webpackConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
19
|
+
return Object.assign({}, webpackConfig, {
|
|
20
|
+
plugins: [].concat(_toConsumableArray(webpackConfig.plugins), _toConsumableArray(makeAngularElementRendererOptional()))
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Ignore `@storybook/angular/element-renderer` import if `@angular/elements` is not available
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
function makeAngularElementRendererOptional() {
|
|
28
|
+
if (moduleIsAvailable('@angular/elements') && moduleIsAvailable('@webcomponents/custom-elements')) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return [new IgnorePlugin(/@storybook(\\|\/)angular(\\|\/)element-renderer/)];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function moduleIsAvailable(moduleName) {
|
|
36
|
+
try {
|
|
37
|
+
require.resolve(moduleName);
|
|
38
|
+
|
|
39
|
+
return true;
|
|
40
|
+
} catch (e) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -80,6 +80,10 @@ function toSvelteProperty(key, value, argTypes) {
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
function getComponentName(component) {
|
|
83
|
+
if (component == null) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
83
87
|
var _component$__docgen = component.__docgen,
|
|
84
88
|
__docgen = _component$__docgen === void 0 ? {} : _component$__docgen;
|
|
85
89
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "core-js/modules/es.symbol.js";
|
|
2
2
|
import "core-js/modules/es.symbol.description.js";
|
|
3
|
+
import "core-js/modules/es.array.every.js";
|
|
3
4
|
import "core-js/modules/es.array.map.js";
|
|
4
5
|
import "core-js/modules/es.function.name.js";
|
|
5
6
|
import { TypeSystem } from './types';
|
|
@@ -12,18 +13,42 @@ import { convert } from '../convert';
|
|
|
12
13
|
function createType(type) {
|
|
13
14
|
// A type could be null if a defaultProp has been provided without a type definition.
|
|
14
15
|
return type != null ? createSummaryValue(type.name) : null;
|
|
16
|
+
} // A heuristic to tell if a defaultValue comes from RDT
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
function isReactDocgenTypescript(defaultValue) {
|
|
20
|
+
var computed = defaultValue.computed,
|
|
21
|
+
func = defaultValue.func;
|
|
22
|
+
return typeof computed === 'undefined' && typeof func === 'undefined';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function isStringValued(type) {
|
|
26
|
+
if (!type) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (type.name === 'string') {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (type.name === 'enum') {
|
|
35
|
+
return Array.isArray(type.value) && type.value.every(function (_ref) {
|
|
36
|
+
var tv = _ref.value;
|
|
37
|
+
return typeof tv === 'string' && tv[0] === '"' && tv[tv.length - 1] === '"';
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return false;
|
|
15
42
|
}
|
|
16
43
|
|
|
17
44
|
function createDefaultValue(defaultValue, type) {
|
|
18
45
|
if (defaultValue != null) {
|
|
19
|
-
var value = defaultValue.value
|
|
20
|
-
computed = defaultValue.computed,
|
|
21
|
-
func = defaultValue.func;
|
|
46
|
+
var value = defaultValue.value;
|
|
22
47
|
|
|
23
48
|
if (!isDefaultValueBlacklisted(value)) {
|
|
24
49
|
// Work around a bug in `react-docgen-typescript-loader`, which returns 'string' for a string
|
|
25
|
-
// default, instead of "'string'" -- which is incorrect
|
|
26
|
-
if (
|
|
50
|
+
// default, instead of "'string'" -- which is incorrect
|
|
51
|
+
if (isReactDocgenTypescript(defaultValue) && isStringValued(type)) {
|
|
27
52
|
return createSummaryValue(JSON.stringify(value));
|
|
28
53
|
}
|
|
29
54
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
2
|
+
// export type DocgenType = DocgenPropType | DocgenFlowType | DocgenTypeScriptType;
|
|
2
3
|
export var TypeSystem;
|
|
3
4
|
|
|
4
5
|
(function (TypeSystem) {
|
|
@@ -6,6 +7,4 @@ export var TypeSystem;
|
|
|
6
7
|
TypeSystem["FLOW"] = "Flow";
|
|
7
8
|
TypeSystem["TYPESCRIPT"] = "TypeScript";
|
|
8
9
|
TypeSystem["UNKNOWN"] = "Unknown";
|
|
9
|
-
})(TypeSystem || (TypeSystem = {}));
|
|
10
|
-
|
|
11
|
-
export { PropDef };
|
|
10
|
+
})(TypeSystem || (TypeSystem = {}));
|
package/dist/esm/public_api.js
CHANGED
|
@@ -9,6 +9,7 @@ export interface DocgenType {
|
|
|
9
9
|
name: string;
|
|
10
10
|
description?: string;
|
|
11
11
|
required?: boolean;
|
|
12
|
+
value?: any;
|
|
12
13
|
}
|
|
13
14
|
export interface DocgenPropType extends DocgenType {
|
|
14
15
|
value?: any;
|
|
@@ -42,4 +43,4 @@ export declare enum TypeSystem {
|
|
|
42
43
|
TYPESCRIPT = "TypeScript",
|
|
43
44
|
UNKNOWN = "Unknown"
|
|
44
45
|
}
|
|
45
|
-
export { PropDef };
|
|
46
|
+
export type { PropDef };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-docs",
|
|
3
|
-
"version": "6.2.0
|
|
3
|
+
"version": "6.2.0",
|
|
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.0
|
|
62
|
-
"@storybook/api": "6.2.0
|
|
63
|
-
"@storybook/builder-webpack4": "6.2.0
|
|
64
|
-
"@storybook/client-api": "6.2.0
|
|
65
|
-
"@storybook/client-logger": "6.2.0
|
|
66
|
-
"@storybook/components": "6.2.0
|
|
67
|
-
"@storybook/core": "6.2.0
|
|
68
|
-
"@storybook/core-events": "6.2.0
|
|
61
|
+
"@storybook/addons": "6.2.0",
|
|
62
|
+
"@storybook/api": "6.2.0",
|
|
63
|
+
"@storybook/builder-webpack4": "6.2.0",
|
|
64
|
+
"@storybook/client-api": "6.2.0",
|
|
65
|
+
"@storybook/client-logger": "6.2.0",
|
|
66
|
+
"@storybook/components": "6.2.0",
|
|
67
|
+
"@storybook/core": "6.2.0",
|
|
68
|
+
"@storybook/core-events": "6.2.0",
|
|
69
69
|
"@storybook/csf": "0.0.1",
|
|
70
|
-
"@storybook/node-logger": "6.2.0
|
|
71
|
-
"@storybook/postinstall": "6.2.0
|
|
72
|
-
"@storybook/source-loader": "6.2.0
|
|
73
|
-
"@storybook/theming": "6.2.0
|
|
70
|
+
"@storybook/node-logger": "6.2.0",
|
|
71
|
+
"@storybook/postinstall": "6.2.0",
|
|
72
|
+
"@storybook/source-loader": "6.2.0",
|
|
73
|
+
"@storybook/theming": "6.2.0",
|
|
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.0
|
|
101
|
-
"@storybook/react": "6.2.0
|
|
102
|
-
"@storybook/vue": "6.2.0
|
|
103
|
-
"@storybook/web-components": "6.2.0
|
|
100
|
+
"@storybook/angular": "6.2.0",
|
|
101
|
+
"@storybook/react": "6.2.0",
|
|
102
|
+
"@storybook/vue": "6.2.0",
|
|
103
|
+
"@storybook/web-components": "6.2.0",
|
|
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.0
|
|
135
|
-
"@storybook/vue": "6.2.0
|
|
136
|
-
"@storybook/vue3": "6.2.0
|
|
134
|
+
"@storybook/angular": "6.2.0",
|
|
135
|
+
"@storybook/vue": "6.2.0",
|
|
136
|
+
"@storybook/vue3": "6.2.0",
|
|
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": "829c72e4374888ca74ed4e68e0c1de940ac18163",
|
|
178
178
|
"storybook": {
|
|
179
179
|
"displayName": "Docs",
|
|
180
180
|
"icon": "https://user-images.githubusercontent.com/263385/101991672-48355c80-3c7c-11eb-82d9-95fa12438f64.png",
|