@storybook/addon-docs 6.5.0-alpha.2 → 6.5.0-alpha.20
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 -6
- package/dist/cjs/blocks/Stories.js +7 -0
- package/dist/cjs/frameworks/common/preset.js +151 -107
- package/dist/cjs/frameworks/vue/extractArgTypes.js +1 -1
- package/dist/esm/blocks/Stories.js +6 -0
- package/dist/esm/frameworks/common/preset.js +148 -106
- package/dist/esm/frameworks/vue/extractArgTypes.js +1 -1
- package/dist/modern/blocks/Stories.js +5 -0
- package/dist/modern/frameworks/common/preset.js +9 -9
- package/dist/modern/frameworks/vue/extractArgTypes.js +1 -1
- package/dist/ts3.4/frameworks/common/preset.d.ts +12 -1
- package/dist/ts3.9/frameworks/common/preset.d.ts +12 -1
- package/package.json +29 -29
package/angular/README.md
CHANGED
|
@@ -210,12 +210,6 @@ And for `MDX` you can modify it as an attribute on the `Story` element:
|
|
|
210
210
|
|
|
211
211
|
Storybook Docs renders all Angular stories inside IFrames by default. But it is possible to use an inline rendering:
|
|
212
212
|
|
|
213
|
-
To get this, you'll first need to install Angular elements:
|
|
214
|
-
|
|
215
|
-
```sh
|
|
216
|
-
yarn add -D @angular/elements @webcomponents/custom-elements
|
|
217
|
-
```
|
|
218
|
-
|
|
219
213
|
Then update `.storybook/preview.js`:
|
|
220
214
|
|
|
221
215
|
```js
|
|
@@ -27,6 +27,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
27
27
|
});
|
|
28
28
|
exports.Stories = void 0;
|
|
29
29
|
|
|
30
|
+
require("core-js/modules/es.array.filter.js");
|
|
31
|
+
|
|
30
32
|
require("core-js/modules/es.array.slice.js");
|
|
31
33
|
|
|
32
34
|
require("core-js/modules/es.array.map.js");
|
|
@@ -54,6 +56,11 @@ var Stories = function Stories(_ref) {
|
|
|
54
56
|
componentStories = _useContext.componentStories;
|
|
55
57
|
|
|
56
58
|
var stories = componentStories();
|
|
59
|
+
stories = stories.filter(function (story) {
|
|
60
|
+
var _story$parameters, _story$parameters$doc;
|
|
61
|
+
|
|
62
|
+
return !((_story$parameters = story.parameters) !== null && _story$parameters !== void 0 && (_story$parameters$doc = _story$parameters.docs) !== null && _story$parameters$doc !== void 0 && _story$parameters$doc.disable);
|
|
63
|
+
});
|
|
57
64
|
if (!includePrimary) stories = stories.slice(1);
|
|
58
65
|
|
|
59
66
|
if (!stories || stories.length === 0) {
|
|
@@ -18,15 +18,23 @@ require("core-js/modules/es.array.slice.js");
|
|
|
18
18
|
|
|
19
19
|
require("core-js/modules/es.function.name.js");
|
|
20
20
|
|
|
21
|
+
require("core-js/modules/es.promise.js");
|
|
22
|
+
|
|
21
23
|
Object.defineProperty(exports, "__esModule", {
|
|
22
24
|
value: true
|
|
23
25
|
});
|
|
24
26
|
exports.webpack = webpack;
|
|
25
27
|
|
|
28
|
+
require("regenerator-runtime/runtime.js");
|
|
29
|
+
|
|
26
30
|
require("core-js/modules/es.array.concat.js");
|
|
27
31
|
|
|
28
32
|
require("core-js/modules/es.object.assign.js");
|
|
29
33
|
|
|
34
|
+
require("core-js/modules/es.string.match.js");
|
|
35
|
+
|
|
36
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
37
|
+
|
|
30
38
|
require("core-js/modules/es.array.filter.js");
|
|
31
39
|
|
|
32
40
|
require("core-js/modules/es.object.to-string.js");
|
|
@@ -35,8 +43,6 @@ require("core-js/modules/es.regexp.to-string.js");
|
|
|
35
43
|
|
|
36
44
|
require("core-js/modules/es.regexp.constructor.js");
|
|
37
45
|
|
|
38
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
39
|
-
|
|
40
46
|
var _path = _interopRequireDefault(require("path"));
|
|
41
47
|
|
|
42
48
|
var _remarkSlug = _interopRequireDefault(require("remark-slug"));
|
|
@@ -47,6 +53,10 @@ var _mdx = require("@storybook/csf-tools/mdx");
|
|
|
47
53
|
|
|
48
54
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
49
55
|
|
|
56
|
+
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); } }
|
|
57
|
+
|
|
58
|
+
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); }); }; }
|
|
59
|
+
|
|
50
60
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
51
61
|
|
|
52
62
|
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."); }
|
|
@@ -59,14 +69,6 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
59
69
|
|
|
60
70
|
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; }
|
|
61
71
|
|
|
62
|
-
var resolvedBabelLoader = require.resolve('babel-loader', {
|
|
63
|
-
paths: [require.resolve('@storybook/builder-webpack4')] // FIXME!!!
|
|
64
|
-
|
|
65
|
-
}); // for frameworks that are not working with react, we need to configure
|
|
66
|
-
// the jsx to transpile mdx, for now there will be a flag for that
|
|
67
|
-
// for more complex solutions we can find alone that we need to add '@babel/plugin-transform-react-jsx'
|
|
68
|
-
|
|
69
|
-
|
|
70
72
|
function createBabelOptions(_ref) {
|
|
71
73
|
var babelOptions = _ref.babelOptions,
|
|
72
74
|
mdxBabelOptions = _ref.mdxBabelOptions,
|
|
@@ -87,101 +89,143 @@ function createBabelOptions(_ref) {
|
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
function webpack() {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
92
|
+
return _webpack.apply(this, arguments);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function _webpack() {
|
|
96
|
+
_webpack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
97
|
+
var webpackConfig,
|
|
98
|
+
options,
|
|
99
|
+
_yield$options$preset,
|
|
100
|
+
_yield$options$preset2,
|
|
101
|
+
builder,
|
|
102
|
+
resolvedBabelLoader,
|
|
103
|
+
_webpackConfig$module,
|
|
104
|
+
module,
|
|
105
|
+
babelOptions,
|
|
106
|
+
mdxBabelOptions,
|
|
107
|
+
_options$configureJSX,
|
|
108
|
+
configureJSX,
|
|
109
|
+
_options$sourceLoader,
|
|
110
|
+
sourceLoaderOptions,
|
|
111
|
+
_options$transcludeMa,
|
|
112
|
+
transcludeMarkdown,
|
|
113
|
+
mdxLoaderOptions,
|
|
114
|
+
sourceLoader,
|
|
115
|
+
rules,
|
|
116
|
+
result,
|
|
117
|
+
_args = arguments;
|
|
118
|
+
|
|
119
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
120
|
+
while (1) {
|
|
121
|
+
switch (_context.prev = _context.next) {
|
|
122
|
+
case 0:
|
|
123
|
+
webpackConfig = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
124
|
+
options = _args.length > 1 ? _args[1] : undefined;
|
|
125
|
+
_context.next = 4;
|
|
126
|
+
return options.presets.apply('core', {});
|
|
127
|
+
|
|
128
|
+
case 4:
|
|
129
|
+
_yield$options$preset = _context.sent;
|
|
130
|
+
_yield$options$preset2 = _yield$options$preset.builder;
|
|
131
|
+
builder = _yield$options$preset2 === void 0 ? 'webpack4' : _yield$options$preset2;
|
|
132
|
+
resolvedBabelLoader = require.resolve('babel-loader', {
|
|
133
|
+
paths: builder.match(/(webpack4|webpack5)/) ? [require.resolve("@storybook/builder-".concat(builder))] : [builder]
|
|
134
|
+
});
|
|
135
|
+
_webpackConfig$module = webpackConfig.module, module = _webpackConfig$module === void 0 ? {} : _webpackConfig$module; // it will reuse babel options that are already in use in storybook
|
|
136
|
+
// also, these babel options are chained with other presets.
|
|
137
|
+
|
|
138
|
+
babelOptions = options.babelOptions, mdxBabelOptions = options.mdxBabelOptions, _options$configureJSX = options.configureJSX, configureJSX = _options$configureJSX === void 0 ? true : _options$configureJSX, _options$sourceLoader = options.sourceLoaderOptions, sourceLoaderOptions = _options$sourceLoader === void 0 ? {
|
|
139
|
+
injectStoryParameters: true
|
|
140
|
+
} : _options$sourceLoader, _options$transcludeMa = options.transcludeMarkdown, transcludeMarkdown = _options$transcludeMa === void 0 ? false : _options$transcludeMa;
|
|
141
|
+
mdxLoaderOptions = {
|
|
142
|
+
remarkPlugins: [_remarkSlug.default, _remarkExternalLinks.default]
|
|
143
|
+
}; // set `sourceLoaderOptions` to `null` to disable for manual configuration
|
|
144
|
+
|
|
145
|
+
sourceLoader = sourceLoaderOptions ? [{
|
|
146
|
+
test: /\.(stories|story)\.[tj]sx?$/,
|
|
147
|
+
loader: require.resolve('@storybook/source-loader'),
|
|
148
|
+
options: Object.assign({}, sourceLoaderOptions, {
|
|
149
|
+
inspectLocalDependencies: true
|
|
150
|
+
}),
|
|
151
|
+
enforce: 'pre'
|
|
152
|
+
}] : [];
|
|
153
|
+
rules = module.rules || [];
|
|
154
|
+
|
|
155
|
+
if (transcludeMarkdown) {
|
|
156
|
+
rules = [].concat(_toConsumableArray(rules.filter(function (rule) {
|
|
157
|
+
var _rule$test;
|
|
158
|
+
|
|
159
|
+
return ((_rule$test = rule.test) === null || _rule$test === void 0 ? void 0 : _rule$test.toString()) !== '/\\.md$/';
|
|
160
|
+
})), [{
|
|
161
|
+
test: /\.md$/,
|
|
162
|
+
use: [{
|
|
163
|
+
loader: resolvedBabelLoader,
|
|
164
|
+
options: createBabelOptions({
|
|
165
|
+
babelOptions: babelOptions,
|
|
166
|
+
mdxBabelOptions: mdxBabelOptions,
|
|
167
|
+
configureJSX: configureJSX
|
|
168
|
+
})
|
|
169
|
+
}, {
|
|
170
|
+
loader: require.resolve('@mdx-js/loader'),
|
|
171
|
+
options: mdxLoaderOptions
|
|
172
|
+
}]
|
|
173
|
+
}]);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
result = Object.assign({}, webpackConfig, {
|
|
177
|
+
module: Object.assign({}, module, {
|
|
178
|
+
rules: [].concat(_toConsumableArray(rules), [{
|
|
179
|
+
test: /\.js$/,
|
|
180
|
+
include: new RegExp("node_modules\\".concat(_path.default.sep, "acorn-jsx")),
|
|
181
|
+
use: [{
|
|
182
|
+
loader: resolvedBabelLoader,
|
|
183
|
+
options: {
|
|
184
|
+
presets: [[require.resolve('@babel/preset-env'), {
|
|
185
|
+
modules: 'commonjs'
|
|
186
|
+
}]]
|
|
187
|
+
}
|
|
188
|
+
}]
|
|
189
|
+
}, {
|
|
190
|
+
test: /(stories|story)\.mdx$/,
|
|
191
|
+
use: [{
|
|
192
|
+
loader: resolvedBabelLoader,
|
|
193
|
+
options: createBabelOptions({
|
|
194
|
+
babelOptions: babelOptions,
|
|
195
|
+
mdxBabelOptions: mdxBabelOptions,
|
|
196
|
+
configureJSX: configureJSX
|
|
197
|
+
})
|
|
198
|
+
}, {
|
|
199
|
+
loader: require.resolve('@mdx-js/loader'),
|
|
200
|
+
options: Object.assign({
|
|
201
|
+
compilers: [(0, _mdx.createCompiler)(options)]
|
|
202
|
+
}, mdxLoaderOptions)
|
|
203
|
+
}]
|
|
204
|
+
}, {
|
|
205
|
+
test: /\.mdx$/,
|
|
206
|
+
exclude: /(stories|story)\.mdx$/,
|
|
207
|
+
use: [{
|
|
208
|
+
loader: resolvedBabelLoader,
|
|
209
|
+
options: createBabelOptions({
|
|
210
|
+
babelOptions: babelOptions,
|
|
211
|
+
mdxBabelOptions: mdxBabelOptions,
|
|
212
|
+
configureJSX: configureJSX
|
|
213
|
+
})
|
|
214
|
+
}, {
|
|
215
|
+
loader: require.resolve('@mdx-js/loader'),
|
|
216
|
+
options: mdxLoaderOptions
|
|
217
|
+
}]
|
|
218
|
+
}], sourceLoader)
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
return _context.abrupt("return", result);
|
|
222
|
+
|
|
223
|
+
case 16:
|
|
224
|
+
case "end":
|
|
225
|
+
return _context.stop();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}, _callee);
|
|
229
|
+
}));
|
|
230
|
+
return _webpack.apply(this, arguments);
|
|
187
231
|
}
|
|
@@ -49,7 +49,7 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
49
49
|
|
|
50
50
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
51
51
|
|
|
52
|
-
var SECTIONS = ['props', 'events', 'slots'];
|
|
52
|
+
var SECTIONS = ['props', 'events', 'slots', 'methods'];
|
|
53
53
|
/**
|
|
54
54
|
* Check if "@values" tag is defined within docgenInfo.
|
|
55
55
|
* If true, then propDef is mutated.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
+
import "core-js/modules/es.array.filter.js";
|
|
3
4
|
import "core-js/modules/es.array.slice.js";
|
|
4
5
|
import "core-js/modules/es.array.map.js";
|
|
5
6
|
import "core-js/modules/es.object.assign.js";
|
|
@@ -16,6 +17,11 @@ export var Stories = function Stories(_ref) {
|
|
|
16
17
|
componentStories = _useContext.componentStories;
|
|
17
18
|
|
|
18
19
|
var stories = componentStories();
|
|
20
|
+
stories = stories.filter(function (story) {
|
|
21
|
+
var _story$parameters, _story$parameters$doc;
|
|
22
|
+
|
|
23
|
+
return !((_story$parameters = story.parameters) !== null && _story$parameters !== void 0 && (_story$parameters$doc = _story$parameters.docs) !== null && _story$parameters$doc !== void 0 && _story$parameters$doc.disable);
|
|
24
|
+
});
|
|
19
25
|
if (!includePrimary) stories = stories.slice(1);
|
|
20
26
|
|
|
21
27
|
if (!stories || stories.length === 0) {
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import "regenerator-runtime/runtime.js";
|
|
2
|
+
|
|
3
|
+
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); } }
|
|
4
|
+
|
|
5
|
+
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); }); }; }
|
|
6
|
+
|
|
1
7
|
import "core-js/modules/es.array.concat.js";
|
|
2
8
|
import "core-js/modules/es.object.assign.js";
|
|
9
|
+
import "core-js/modules/es.string.match.js";
|
|
10
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
3
11
|
import "core-js/modules/es.array.filter.js";
|
|
4
12
|
import "core-js/modules/es.object.to-string.js";
|
|
5
13
|
import "core-js/modules/es.regexp.to-string.js";
|
|
6
14
|
import "core-js/modules/es.regexp.constructor.js";
|
|
7
|
-
import "core-js/modules/es.regexp.exec.js";
|
|
8
15
|
import "core-js/modules/es.symbol.js";
|
|
9
16
|
import "core-js/modules/es.symbol.description.js";
|
|
10
17
|
import "core-js/modules/es.symbol.iterator.js";
|
|
@@ -14,6 +21,7 @@ import "core-js/modules/web.dom-collections.iterator.js";
|
|
|
14
21
|
import "core-js/modules/es.array.from.js";
|
|
15
22
|
import "core-js/modules/es.array.slice.js";
|
|
16
23
|
import "core-js/modules/es.function.name.js";
|
|
24
|
+
import "core-js/modules/es.promise.js";
|
|
17
25
|
|
|
18
26
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
19
27
|
|
|
@@ -33,14 +41,6 @@ import remarkExternalLinks from 'remark-external-links'; // @ts-ignore
|
|
|
33
41
|
|
|
34
42
|
import { createCompiler } from '@storybook/csf-tools/mdx';
|
|
35
43
|
|
|
36
|
-
var resolvedBabelLoader = require.resolve('babel-loader', {
|
|
37
|
-
paths: [require.resolve('@storybook/builder-webpack4')] // FIXME!!!
|
|
38
|
-
|
|
39
|
-
}); // for frameworks that are not working with react, we need to configure
|
|
40
|
-
// the jsx to transpile mdx, for now there will be a flag for that
|
|
41
|
-
// for more complex solutions we can find alone that we need to add '@babel/plugin-transform-react-jsx'
|
|
42
|
-
|
|
43
|
-
|
|
44
44
|
function createBabelOptions(_ref) {
|
|
45
45
|
var babelOptions = _ref.babelOptions,
|
|
46
46
|
mdxBabelOptions = _ref.mdxBabelOptions,
|
|
@@ -61,101 +61,143 @@ function createBabelOptions(_ref) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export function webpack() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
64
|
+
return _webpack.apply(this, arguments);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function _webpack() {
|
|
68
|
+
_webpack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
69
|
+
var webpackConfig,
|
|
70
|
+
options,
|
|
71
|
+
_yield$options$preset,
|
|
72
|
+
_yield$options$preset2,
|
|
73
|
+
builder,
|
|
74
|
+
resolvedBabelLoader,
|
|
75
|
+
_webpackConfig$module,
|
|
76
|
+
module,
|
|
77
|
+
babelOptions,
|
|
78
|
+
mdxBabelOptions,
|
|
79
|
+
_options$configureJSX,
|
|
80
|
+
configureJSX,
|
|
81
|
+
_options$sourceLoader,
|
|
82
|
+
sourceLoaderOptions,
|
|
83
|
+
_options$transcludeMa,
|
|
84
|
+
transcludeMarkdown,
|
|
85
|
+
mdxLoaderOptions,
|
|
86
|
+
sourceLoader,
|
|
87
|
+
rules,
|
|
88
|
+
result,
|
|
89
|
+
_args = arguments;
|
|
90
|
+
|
|
91
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
92
|
+
while (1) {
|
|
93
|
+
switch (_context.prev = _context.next) {
|
|
94
|
+
case 0:
|
|
95
|
+
webpackConfig = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
96
|
+
options = _args.length > 1 ? _args[1] : undefined;
|
|
97
|
+
_context.next = 4;
|
|
98
|
+
return options.presets.apply('core', {});
|
|
99
|
+
|
|
100
|
+
case 4:
|
|
101
|
+
_yield$options$preset = _context.sent;
|
|
102
|
+
_yield$options$preset2 = _yield$options$preset.builder;
|
|
103
|
+
builder = _yield$options$preset2 === void 0 ? 'webpack4' : _yield$options$preset2;
|
|
104
|
+
resolvedBabelLoader = require.resolve('babel-loader', {
|
|
105
|
+
paths: builder.match(/(webpack4|webpack5)/) ? [require.resolve("@storybook/builder-".concat(builder))] : [builder]
|
|
106
|
+
});
|
|
107
|
+
_webpackConfig$module = webpackConfig.module, module = _webpackConfig$module === void 0 ? {} : _webpackConfig$module; // it will reuse babel options that are already in use in storybook
|
|
108
|
+
// also, these babel options are chained with other presets.
|
|
109
|
+
|
|
110
|
+
babelOptions = options.babelOptions, mdxBabelOptions = options.mdxBabelOptions, _options$configureJSX = options.configureJSX, configureJSX = _options$configureJSX === void 0 ? true : _options$configureJSX, _options$sourceLoader = options.sourceLoaderOptions, sourceLoaderOptions = _options$sourceLoader === void 0 ? {
|
|
111
|
+
injectStoryParameters: true
|
|
112
|
+
} : _options$sourceLoader, _options$transcludeMa = options.transcludeMarkdown, transcludeMarkdown = _options$transcludeMa === void 0 ? false : _options$transcludeMa;
|
|
113
|
+
mdxLoaderOptions = {
|
|
114
|
+
remarkPlugins: [remarkSlug, remarkExternalLinks]
|
|
115
|
+
}; // set `sourceLoaderOptions` to `null` to disable for manual configuration
|
|
116
|
+
|
|
117
|
+
sourceLoader = sourceLoaderOptions ? [{
|
|
118
|
+
test: /\.(stories|story)\.[tj]sx?$/,
|
|
119
|
+
loader: require.resolve('@storybook/source-loader'),
|
|
120
|
+
options: Object.assign({}, sourceLoaderOptions, {
|
|
121
|
+
inspectLocalDependencies: true
|
|
122
|
+
}),
|
|
123
|
+
enforce: 'pre'
|
|
124
|
+
}] : [];
|
|
125
|
+
rules = module.rules || [];
|
|
126
|
+
|
|
127
|
+
if (transcludeMarkdown) {
|
|
128
|
+
rules = [].concat(_toConsumableArray(rules.filter(function (rule) {
|
|
129
|
+
var _rule$test;
|
|
130
|
+
|
|
131
|
+
return ((_rule$test = rule.test) === null || _rule$test === void 0 ? void 0 : _rule$test.toString()) !== '/\\.md$/';
|
|
132
|
+
})), [{
|
|
133
|
+
test: /\.md$/,
|
|
134
|
+
use: [{
|
|
135
|
+
loader: resolvedBabelLoader,
|
|
136
|
+
options: createBabelOptions({
|
|
137
|
+
babelOptions: babelOptions,
|
|
138
|
+
mdxBabelOptions: mdxBabelOptions,
|
|
139
|
+
configureJSX: configureJSX
|
|
140
|
+
})
|
|
141
|
+
}, {
|
|
142
|
+
loader: require.resolve('@mdx-js/loader'),
|
|
143
|
+
options: mdxLoaderOptions
|
|
144
|
+
}]
|
|
145
|
+
}]);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
result = Object.assign({}, webpackConfig, {
|
|
149
|
+
module: Object.assign({}, module, {
|
|
150
|
+
rules: [].concat(_toConsumableArray(rules), [{
|
|
151
|
+
test: /\.js$/,
|
|
152
|
+
include: new RegExp("node_modules\\".concat(path.sep, "acorn-jsx")),
|
|
153
|
+
use: [{
|
|
154
|
+
loader: resolvedBabelLoader,
|
|
155
|
+
options: {
|
|
156
|
+
presets: [[require.resolve('@babel/preset-env'), {
|
|
157
|
+
modules: 'commonjs'
|
|
158
|
+
}]]
|
|
159
|
+
}
|
|
160
|
+
}]
|
|
161
|
+
}, {
|
|
162
|
+
test: /(stories|story)\.mdx$/,
|
|
163
|
+
use: [{
|
|
164
|
+
loader: resolvedBabelLoader,
|
|
165
|
+
options: createBabelOptions({
|
|
166
|
+
babelOptions: babelOptions,
|
|
167
|
+
mdxBabelOptions: mdxBabelOptions,
|
|
168
|
+
configureJSX: configureJSX
|
|
169
|
+
})
|
|
170
|
+
}, {
|
|
171
|
+
loader: require.resolve('@mdx-js/loader'),
|
|
172
|
+
options: Object.assign({
|
|
173
|
+
compilers: [createCompiler(options)]
|
|
174
|
+
}, mdxLoaderOptions)
|
|
175
|
+
}]
|
|
176
|
+
}, {
|
|
177
|
+
test: /\.mdx$/,
|
|
178
|
+
exclude: /(stories|story)\.mdx$/,
|
|
179
|
+
use: [{
|
|
180
|
+
loader: resolvedBabelLoader,
|
|
181
|
+
options: createBabelOptions({
|
|
182
|
+
babelOptions: babelOptions,
|
|
183
|
+
mdxBabelOptions: mdxBabelOptions,
|
|
184
|
+
configureJSX: configureJSX
|
|
185
|
+
})
|
|
186
|
+
}, {
|
|
187
|
+
loader: require.resolve('@mdx-js/loader'),
|
|
188
|
+
options: mdxLoaderOptions
|
|
189
|
+
}]
|
|
190
|
+
}], sourceLoader)
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
return _context.abrupt("return", result);
|
|
194
|
+
|
|
195
|
+
case 16:
|
|
196
|
+
case "end":
|
|
197
|
+
return _context.stop();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}, _callee);
|
|
201
|
+
}));
|
|
202
|
+
return _webpack.apply(this, arguments);
|
|
161
203
|
}
|
|
@@ -26,7 +26,7 @@ import "core-js/modules/es.array.slice.js";
|
|
|
26
26
|
import "core-js/modules/es.array.from.js";
|
|
27
27
|
import { hasDocgen, extractComponentProps } from '../../lib/docgen';
|
|
28
28
|
import { convert } from '../../lib/convert';
|
|
29
|
-
var SECTIONS = ['props', 'events', 'slots'];
|
|
29
|
+
var SECTIONS = ['props', 'events', 'slots', 'methods'];
|
|
30
30
|
/**
|
|
31
31
|
* Check if "@values" tag is defined within docgenInfo.
|
|
32
32
|
* If true, then propDef is mutated.
|
|
@@ -12,6 +12,11 @@ export const Stories = ({
|
|
|
12
12
|
componentStories
|
|
13
13
|
} = useContext(DocsContext);
|
|
14
14
|
let stories = componentStories();
|
|
15
|
+
stories = stories.filter(story => {
|
|
16
|
+
var _story$parameters, _story$parameters$doc;
|
|
17
|
+
|
|
18
|
+
return !((_story$parameters = story.parameters) !== null && _story$parameters !== void 0 && (_story$parameters$doc = _story$parameters.docs) !== null && _story$parameters$doc !== void 0 && _story$parameters$doc.disable);
|
|
19
|
+
});
|
|
15
20
|
if (!includePrimary) stories = stories.slice(1);
|
|
16
21
|
|
|
17
22
|
if (!stories || stories.length === 0) {
|
|
@@ -4,14 +4,6 @@ import remarkExternalLinks from 'remark-external-links'; // @ts-ignore
|
|
|
4
4
|
|
|
5
5
|
import { createCompiler } from '@storybook/csf-tools/mdx';
|
|
6
6
|
|
|
7
|
-
const resolvedBabelLoader = require.resolve('babel-loader', {
|
|
8
|
-
paths: [require.resolve('@storybook/builder-webpack4')] // FIXME!!!
|
|
9
|
-
|
|
10
|
-
}); // for frameworks that are not working with react, we need to configure
|
|
11
|
-
// the jsx to transpile mdx, for now there will be a flag for that
|
|
12
|
-
// for more complex solutions we can find alone that we need to add '@babel/plugin-transform-react-jsx'
|
|
13
|
-
|
|
14
|
-
|
|
15
7
|
function createBabelOptions({
|
|
16
8
|
babelOptions,
|
|
17
9
|
mdxBabelOptions,
|
|
@@ -32,7 +24,15 @@ function createBabelOptions({
|
|
|
32
24
|
});
|
|
33
25
|
}
|
|
34
26
|
|
|
35
|
-
export function webpack(webpackConfig = {}, options
|
|
27
|
+
export async function webpack(webpackConfig = {}, options) {
|
|
28
|
+
const {
|
|
29
|
+
builder = 'webpack4'
|
|
30
|
+
} = await options.presets.apply('core', {});
|
|
31
|
+
|
|
32
|
+
const resolvedBabelLoader = require.resolve('babel-loader', {
|
|
33
|
+
paths: builder.match(/(webpack4|webpack5)/) ? [require.resolve(`@storybook/builder-${builder}`)] : [builder]
|
|
34
|
+
});
|
|
35
|
+
|
|
36
36
|
const {
|
|
37
37
|
module = {}
|
|
38
38
|
} = webpackConfig; // it will reuse babel options that are already in use in storybook
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hasDocgen, extractComponentProps } from '../../lib/docgen';
|
|
2
2
|
import { convert } from '../../lib/convert';
|
|
3
|
-
const SECTIONS = ['props', 'events', 'slots'];
|
|
3
|
+
const SECTIONS = ['props', 'events', 'slots', 'methods'];
|
|
4
4
|
/**
|
|
5
5
|
* Check if "@values" tag is defined within docgenInfo.
|
|
6
6
|
* If true, then propDef is mutated.
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { createCompiler } from '@storybook/csf-tools/mdx';
|
|
2
|
+
import { Options } from '@storybook/core-common';
|
|
3
|
+
declare type BabelParams = {
|
|
4
|
+
babelOptions?: any;
|
|
5
|
+
mdxBabelOptions?: any;
|
|
6
|
+
configureJSX?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function webpack(webpackConfig: any, options: Options & BabelParams & {
|
|
9
|
+
sourceLoaderOptions: any;
|
|
10
|
+
transcludeMarkdown: boolean;
|
|
11
|
+
} & Parameters<typeof createCompiler>[0]): Promise<any>;
|
|
12
|
+
export {};
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { createCompiler } from '@storybook/csf-tools/mdx';
|
|
2
|
+
import type { Options } from '@storybook/core-common';
|
|
3
|
+
declare type BabelParams = {
|
|
4
|
+
babelOptions?: any;
|
|
5
|
+
mdxBabelOptions?: any;
|
|
6
|
+
configureJSX?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function webpack(webpackConfig: any, options: Options & BabelParams & {
|
|
9
|
+
sourceLoaderOptions: any;
|
|
10
|
+
transcludeMarkdown: boolean;
|
|
11
|
+
} & Parameters<typeof createCompiler>[0]): Promise<any>;
|
|
12
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-docs",
|
|
3
|
-
"version": "6.5.0-alpha.
|
|
3
|
+
"version": "6.5.0-alpha.20",
|
|
4
4
|
"description": "Document component usage and properties in Markdown",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"addon",
|
|
@@ -63,21 +63,21 @@
|
|
|
63
63
|
"@mdx-js/loader": "^1.6.22",
|
|
64
64
|
"@mdx-js/mdx": "^1.6.22",
|
|
65
65
|
"@mdx-js/react": "^1.6.22",
|
|
66
|
-
"@storybook/addons": "6.5.0-alpha.
|
|
67
|
-
"@storybook/api": "6.5.0-alpha.
|
|
68
|
-
"@storybook/builder-webpack4": "6.5.0-alpha.
|
|
69
|
-
"@storybook/client-logger": "6.5.0-alpha.
|
|
70
|
-
"@storybook/components": "6.5.0-alpha.
|
|
71
|
-
"@storybook/core": "6.5.0-alpha.
|
|
72
|
-
"@storybook/core-events": "6.5.0-alpha.
|
|
66
|
+
"@storybook/addons": "6.5.0-alpha.20",
|
|
67
|
+
"@storybook/api": "6.5.0-alpha.20",
|
|
68
|
+
"@storybook/builder-webpack4": "6.5.0-alpha.20",
|
|
69
|
+
"@storybook/client-logger": "6.5.0-alpha.20",
|
|
70
|
+
"@storybook/components": "6.5.0-alpha.20",
|
|
71
|
+
"@storybook/core": "6.5.0-alpha.20",
|
|
72
|
+
"@storybook/core-events": "6.5.0-alpha.20",
|
|
73
73
|
"@storybook/csf": "0.0.2--canary.87bc651.0",
|
|
74
|
-
"@storybook/csf-tools": "6.5.0-alpha.
|
|
75
|
-
"@storybook/node-logger": "6.5.0-alpha.
|
|
76
|
-
"@storybook/postinstall": "6.5.0-alpha.
|
|
77
|
-
"@storybook/preview-web": "6.5.0-alpha.
|
|
78
|
-
"@storybook/source-loader": "6.5.0-alpha.
|
|
79
|
-
"@storybook/store": "6.5.0-alpha.
|
|
80
|
-
"@storybook/theming": "6.5.0-alpha.
|
|
74
|
+
"@storybook/csf-tools": "6.5.0-alpha.20",
|
|
75
|
+
"@storybook/node-logger": "6.5.0-alpha.20",
|
|
76
|
+
"@storybook/postinstall": "6.5.0-alpha.20",
|
|
77
|
+
"@storybook/preview-web": "6.5.0-alpha.20",
|
|
78
|
+
"@storybook/source-loader": "6.5.0-alpha.20",
|
|
79
|
+
"@storybook/store": "6.5.0-alpha.20",
|
|
80
|
+
"@storybook/theming": "6.5.0-alpha.20",
|
|
81
81
|
"acorn": "^7.4.1",
|
|
82
82
|
"acorn-jsx": "^5.3.1",
|
|
83
83
|
"acorn-walk": "^7.2.0",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"lodash": "^4.17.21",
|
|
93
93
|
"nanoid": "^3.1.23",
|
|
94
94
|
"p-limit": "^3.1.0",
|
|
95
|
-
"prettier": "
|
|
95
|
+
"prettier": ">=2.2.1 <=2.3.0",
|
|
96
96
|
"prop-types": "^15.7.2",
|
|
97
97
|
"react-element-to-jsx-string": "^14.3.4",
|
|
98
98
|
"regenerator-runtime": "^0.13.7",
|
|
@@ -104,13 +104,13 @@
|
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@angular/core": "^11.2.14",
|
|
106
106
|
"@babel/core": "^7.12.10",
|
|
107
|
-
"@emotion/core": "^10.
|
|
107
|
+
"@emotion/core": "^10.3.1",
|
|
108
108
|
"@emotion/styled": "^10.0.27",
|
|
109
|
-
"@storybook/angular": "6.5.0-alpha.
|
|
110
|
-
"@storybook/html": "6.5.0-alpha.
|
|
111
|
-
"@storybook/react": "6.5.0-alpha.
|
|
112
|
-
"@storybook/vue": "6.5.0-alpha.
|
|
113
|
-
"@storybook/web-components": "6.5.0-alpha.
|
|
109
|
+
"@storybook/angular": "6.5.0-alpha.20",
|
|
110
|
+
"@storybook/html": "6.5.0-alpha.20",
|
|
111
|
+
"@storybook/react": "6.5.0-alpha.20",
|
|
112
|
+
"@storybook/vue": "6.5.0-alpha.20",
|
|
113
|
+
"@storybook/web-components": "6.5.0-alpha.20",
|
|
114
114
|
"@types/cross-spawn": "^6.0.2",
|
|
115
115
|
"@types/doctrine": "^0.0.3",
|
|
116
116
|
"@types/enzyme": "^3.10.8",
|
|
@@ -140,12 +140,12 @@
|
|
|
140
140
|
"zone.js": "^0.11.3"
|
|
141
141
|
},
|
|
142
142
|
"peerDependencies": {
|
|
143
|
-
"@storybook/angular": "6.5.0-alpha.
|
|
144
|
-
"@storybook/html": "6.5.0-alpha.
|
|
145
|
-
"@storybook/react": "6.5.0-alpha.
|
|
146
|
-
"@storybook/vue": "6.5.0-alpha.
|
|
147
|
-
"@storybook/vue3": "6.5.0-alpha.
|
|
148
|
-
"@storybook/web-components": "6.5.0-alpha.
|
|
143
|
+
"@storybook/angular": "6.5.0-alpha.20",
|
|
144
|
+
"@storybook/html": "6.5.0-alpha.20",
|
|
145
|
+
"@storybook/react": "6.5.0-alpha.20",
|
|
146
|
+
"@storybook/vue": "6.5.0-alpha.20",
|
|
147
|
+
"@storybook/vue3": "6.5.0-alpha.20",
|
|
148
|
+
"@storybook/web-components": "6.5.0-alpha.20",
|
|
149
149
|
"lit": "^2.0.0",
|
|
150
150
|
"lit-html": "^1.4.1 || ^2.0.0",
|
|
151
151
|
"react": "^16.8.0 || ^17.0.0",
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
"publishConfig": {
|
|
203
203
|
"access": "public"
|
|
204
204
|
},
|
|
205
|
-
"gitHead": "
|
|
205
|
+
"gitHead": "8b9f966f4378d540c767bdbeb1840f910ebc3375",
|
|
206
206
|
"sbmodern": "dist/modern/index.js",
|
|
207
207
|
"storybook": {
|
|
208
208
|
"displayName": "Docs",
|