@storybook/addon-docs 6.5.6 → 7.0.0-alpha.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/blocks.d.ts +1 -1
- package/dist/cjs/blocks/ArgsTable.js +1 -1
- package/dist/cjs/blocks/Primary.js +1 -1
- package/dist/cjs/blocks/Stories.js +1 -1
- package/dist/cjs/blocks/mdx.js +1 -1
- package/dist/cjs/blocks/useStory.js +18 -4
- package/dist/cjs/preset.js +137 -33
- package/dist/cjs/preview.js +22 -6
- package/dist/esm/blocks/Anchor.js +7 -10
- package/dist/esm/blocks/ArgsTable.js +133 -182
- package/dist/esm/blocks/Canvas.js +34 -46
- package/dist/esm/blocks/Description.js +39 -45
- package/dist/esm/blocks/DocsContainer.js +36 -44
- package/dist/esm/blocks/DocsContext.js +1 -1
- package/dist/esm/blocks/DocsPage.js +3 -5
- package/dist/esm/blocks/DocsStory.js +18 -27
- package/dist/esm/blocks/Heading.js +5 -7
- package/dist/esm/blocks/Meta.js +9 -13
- package/dist/esm/blocks/Preview.js +5 -10
- package/dist/esm/blocks/Primary.js +10 -16
- package/dist/esm/blocks/Props.js +5 -10
- package/dist/esm/blocks/Source.js +64 -70
- package/dist/esm/blocks/SourceContainer.js +17 -50
- package/dist/esm/blocks/Stories.js +15 -27
- package/dist/esm/blocks/Story.js +58 -99
- package/dist/esm/blocks/Subheading.js +5 -7
- package/dist/esm/blocks/Subtitle.js +12 -12
- package/dist/esm/blocks/Title.js +10 -11
- package/dist/esm/blocks/Wrapper.js +7 -8
- package/dist/esm/blocks/enhanceSource.js +32 -56
- package/dist/esm/blocks/mdx.js +85 -89
- package/dist/esm/blocks/types.js +2 -2
- package/dist/esm/blocks/useStory.js +16 -73
- package/dist/esm/blocks/utils.js +4 -18
- package/dist/esm/manager.js +9 -14
- package/dist/esm/preset.js +114 -179
- package/dist/esm/preview.js +3 -61
- package/dist/esm/shared.js +5 -5
- package/dist/{ts3.9 → types}/blocks/Anchor.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/ArgsTable.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Canvas.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Description.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/DocsContainer.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/DocsContext.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/DocsPage.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/DocsStory.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Heading.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Meta.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Preview.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Primary.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Props.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Source.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/SourceContainer.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Stories.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Story.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Subheading.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Subtitle.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Title.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/Wrapper.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/enhanceSource.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/index.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/mdx.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/types.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/useStory.d.ts +0 -0
- package/dist/{ts3.9 → types}/blocks/utils.d.ts +0 -0
- package/dist/{ts3.9 → types}/index.d.ts +0 -0
- package/dist/{ts3.9 → types}/manager.d.ts +0 -0
- package/dist/{ts3.9 → types}/preset.d.ts +2 -1
- package/dist/{ts3.9 → types}/preview.d.ts +0 -0
- package/dist/{ts3.9 → types}/shared.d.ts +0 -0
- package/package.json +16 -24
- package/dist/modern/blocks/Anchor.js +0 -8
- package/dist/modern/blocks/ArgsTable.js +0 -292
- package/dist/modern/blocks/Canvas.js +0 -83
- package/dist/modern/blocks/Description.js +0 -107
- package/dist/modern/blocks/DocsContainer.js +0 -98
- package/dist/modern/blocks/DocsContext.js +0 -16
- package/dist/modern/blocks/DocsPage.js +0 -11
- package/dist/modern/blocks/DocsStory.js +0 -48
- package/dist/modern/blocks/Heading.js +0 -17
- package/dist/modern/blocks/Meta.js +0 -31
- package/dist/modern/blocks/Preview.js +0 -9
- package/dist/modern/blocks/Primary.js +0 -23
- package/dist/modern/blocks/Props.js +0 -14
- package/dist/modern/blocks/Source.js +0 -154
- package/dist/modern/blocks/SourceContainer.js +0 -44
- package/dist/modern/blocks/Stories.js +0 -34
- package/dist/modern/blocks/Story.js +0 -168
- package/dist/modern/blocks/Subheading.js +0 -17
- package/dist/modern/blocks/Subtitle.js +0 -23
- package/dist/modern/blocks/Title.js +0 -24
- package/dist/modern/blocks/Wrapper.js +0 -8
- package/dist/modern/blocks/enhanceSource.js +0 -89
- package/dist/modern/blocks/index.js +0 -24
- package/dist/modern/blocks/mdx.js +0 -204
- package/dist/modern/blocks/types.js +0 -2
- package/dist/modern/blocks/useStory.js +0 -28
- package/dist/modern/blocks/utils.js +0 -29
- package/dist/modern/index.js +0 -1
- package/dist/modern/manager.js +0 -16
- package/dist/modern/preset.js +0 -130
- package/dist/modern/preview.js +0 -6
- package/dist/modern/shared.js +0 -11
- package/dist/ts3.4/blocks/Anchor.d.ts +0 -6
- package/dist/ts3.4/blocks/ArgsTable.d.ts +0 -33
- package/dist/ts3.4/blocks/Canvas.d.ts +0 -9
- package/dist/ts3.4/blocks/Description.d.ts +0 -20
- package/dist/ts3.4/blocks/DocsContainer.d.ts +0 -7
- package/dist/ts3.4/blocks/DocsContext.d.ts +0 -5
- package/dist/ts3.4/blocks/DocsPage.d.ts +0 -2
- package/dist/ts3.4/blocks/DocsStory.d.ts +0 -3
- package/dist/ts3.4/blocks/Heading.d.ts +0 -6
- package/dist/ts3.4/blocks/Meta.d.ts +0 -9
- package/dist/ts3.4/blocks/Preview.d.ts +0 -3
- package/dist/ts3.4/blocks/Primary.d.ts +0 -6
- package/dist/ts3.4/blocks/Props.d.ts +0 -3
- package/dist/ts3.4/blocks/Source.d.ts +0 -38
- package/dist/ts3.4/blocks/SourceContainer.d.ts +0 -14
- package/dist/ts3.4/blocks/Stories.d.ts +0 -7
- package/dist/ts3.4/blocks/Story.d.ts +0 -28
- package/dist/ts3.4/blocks/Subheading.d.ts +0 -3
- package/dist/ts3.4/blocks/Subtitle.d.ts +0 -6
- package/dist/ts3.4/blocks/Title.d.ts +0 -8
- package/dist/ts3.4/blocks/Wrapper.d.ts +0 -2
- package/dist/ts3.4/blocks/enhanceSource.d.ts +0 -3
- package/dist/ts3.4/blocks/index.d.ts +0 -24
- package/dist/ts3.4/blocks/mdx.d.ts +0 -20
- package/dist/ts3.4/blocks/types.d.ts +0 -13
- package/dist/ts3.4/blocks/useStory.d.ts +0 -5
- package/dist/ts3.4/blocks/utils.d.ts +0 -3
- package/dist/ts3.4/index.d.ts +0 -1
- package/dist/ts3.4/manager.d.ts +0 -1
- package/dist/ts3.4/preset.d.ts +0 -11
- package/dist/ts3.4/preview.d.ts +0 -6
- package/dist/ts3.4/shared.d.ts +0 -24
package/dist/esm/preset.js
CHANGED
|
@@ -1,197 +1,132 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
7
|
-
import "core-js/modules/es.array.concat.js";
|
|
8
|
-
import "core-js/modules/es.object.assign.js";
|
|
9
|
-
import "core-js/modules/es.array.filter.js";
|
|
10
|
-
import "core-js/modules/es.object.to-string.js";
|
|
11
|
-
import "core-js/modules/es.regexp.exec.js";
|
|
12
|
-
import "core-js/modules/es.regexp.to-string.js";
|
|
13
|
-
import "core-js/modules/es.regexp.constructor.js";
|
|
14
|
-
import "core-js/modules/es.symbol.js";
|
|
15
|
-
import "core-js/modules/es.symbol.description.js";
|
|
16
|
-
import "core-js/modules/es.symbol.iterator.js";
|
|
17
|
-
import "core-js/modules/es.array.iterator.js";
|
|
18
|
-
import "core-js/modules/es.string.iterator.js";
|
|
19
|
-
import "core-js/modules/web.dom-collections.iterator.js";
|
|
20
|
-
import "core-js/modules/es.array.from.js";
|
|
21
|
-
import "core-js/modules/es.array.slice.js";
|
|
22
|
-
import "core-js/modules/es.function.name.js";
|
|
23
|
-
import "core-js/modules/es.promise.js";
|
|
24
|
-
|
|
25
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
26
|
-
|
|
27
|
-
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."); }
|
|
28
|
-
|
|
29
|
-
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); }
|
|
30
|
-
|
|
31
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
32
|
-
|
|
33
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
34
|
-
|
|
35
|
-
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; }
|
|
36
|
-
|
|
37
|
-
import path from 'path';
|
|
1
|
+
import fs from 'fs-extra';
|
|
38
2
|
import remarkSlug from 'remark-slug';
|
|
39
3
|
import remarkExternalLinks from 'remark-external-links';
|
|
40
4
|
import global from 'global';
|
|
41
|
-
import { logger } from '@storybook/node-logger';
|
|
5
|
+
import { logger } from '@storybook/node-logger';
|
|
6
|
+
import { loadCsf } from '@storybook/csf-tools'; // for frameworks that are not working with react, we need to configure
|
|
42
7
|
// the jsx to transpile mdx, for now there will be a flag for that
|
|
43
8
|
// for more complex solutions we can find alone that we need to add '@babel/plugin-transform-react-jsx'
|
|
44
9
|
|
|
45
|
-
function createBabelOptions(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
10
|
+
function createBabelOptions({
|
|
11
|
+
babelOptions,
|
|
12
|
+
mdxBabelOptions,
|
|
13
|
+
configureJSX
|
|
14
|
+
}) {
|
|
15
|
+
const babelPlugins = mdxBabelOptions?.plugins || babelOptions?.plugins || [];
|
|
16
|
+
const jsxPlugin = [require.resolve('@babel/plugin-transform-react-jsx'), {
|
|
51
17
|
pragma: 'React.createElement',
|
|
52
18
|
pragmaFrag: 'React.Fragment'
|
|
53
19
|
}];
|
|
54
|
-
|
|
20
|
+
const plugins = configureJSX ? [...babelPlugins, jsxPlugin] : babelPlugins;
|
|
55
21
|
return Object.assign({
|
|
56
22
|
// don't use the root babelrc by default (users can override this in mdxBabelOptions)
|
|
57
23
|
babelrc: false,
|
|
58
24
|
configFile: false
|
|
59
25
|
}, babelOptions, mdxBabelOptions, {
|
|
60
|
-
plugins
|
|
26
|
+
plugins
|
|
61
27
|
});
|
|
62
28
|
}
|
|
63
29
|
|
|
64
|
-
export function webpack() {
|
|
65
|
-
|
|
30
|
+
export async function webpack(webpackConfig = {}, options) {
|
|
31
|
+
const resolvedBabelLoader = require.resolve('babel-loader');
|
|
32
|
+
|
|
33
|
+
const {
|
|
34
|
+
module = {}
|
|
35
|
+
} = webpackConfig; // it will reuse babel options that are already in use in storybook
|
|
36
|
+
// also, these babel options are chained with other presets.
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
babelOptions,
|
|
40
|
+
mdxBabelOptions,
|
|
41
|
+
configureJSX = true,
|
|
42
|
+
sourceLoaderOptions = {
|
|
43
|
+
injectStoryParameters: true
|
|
44
|
+
},
|
|
45
|
+
transcludeMarkdown = false
|
|
46
|
+
} = options;
|
|
47
|
+
const mdxLoaderOptions = {
|
|
48
|
+
skipCsf: true,
|
|
49
|
+
remarkPlugins: [remarkSlug, remarkExternalLinks]
|
|
50
|
+
};
|
|
51
|
+
const mdxVersion = global.FEATURES?.previewMdx2 ? 'MDX2' : 'MDX1';
|
|
52
|
+
logger.info(`Addon-docs: using ${mdxVersion}`);
|
|
53
|
+
const mdxLoader = global.FEATURES?.previewMdx2 ? require.resolve('@storybook/mdx2-csf/loader') : require.resolve('@storybook/mdx1-csf/loader'); // set `sourceLoaderOptions` to `null` to disable for manual configuration
|
|
54
|
+
|
|
55
|
+
const sourceLoader = sourceLoaderOptions ? [{
|
|
56
|
+
test: /\.(stories|story)\.[tj]sx?$/,
|
|
57
|
+
loader: require.resolve('@storybook/source-loader'),
|
|
58
|
+
options: Object.assign({}, sourceLoaderOptions, {
|
|
59
|
+
inspectLocalDependencies: true
|
|
60
|
+
}),
|
|
61
|
+
enforce: 'pre'
|
|
62
|
+
}] : [];
|
|
63
|
+
let rules = module.rules || [];
|
|
64
|
+
|
|
65
|
+
if (transcludeMarkdown) {
|
|
66
|
+
rules = [...rules.filter(rule => rule.test?.toString() !== '/\\.md$/'), {
|
|
67
|
+
test: /\.md$/,
|
|
68
|
+
use: [{
|
|
69
|
+
loader: resolvedBabelLoader,
|
|
70
|
+
options: createBabelOptions({
|
|
71
|
+
babelOptions,
|
|
72
|
+
mdxBabelOptions,
|
|
73
|
+
configureJSX
|
|
74
|
+
})
|
|
75
|
+
}, {
|
|
76
|
+
loader: mdxLoader,
|
|
77
|
+
options: mdxLoaderOptions
|
|
78
|
+
}]
|
|
79
|
+
}];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const result = Object.assign({}, webpackConfig, {
|
|
83
|
+
module: Object.assign({}, module, {
|
|
84
|
+
rules: [...rules, {
|
|
85
|
+
test: /(stories|story)\.mdx$/,
|
|
86
|
+
use: [{
|
|
87
|
+
loader: resolvedBabelLoader,
|
|
88
|
+
options: createBabelOptions({
|
|
89
|
+
babelOptions,
|
|
90
|
+
mdxBabelOptions,
|
|
91
|
+
configureJSX
|
|
92
|
+
})
|
|
93
|
+
}, {
|
|
94
|
+
loader: mdxLoader
|
|
95
|
+
}]
|
|
96
|
+
}, {
|
|
97
|
+
test: /\.mdx$/,
|
|
98
|
+
exclude: /(stories|story)\.mdx$/,
|
|
99
|
+
use: [{
|
|
100
|
+
loader: resolvedBabelLoader,
|
|
101
|
+
options: createBabelOptions({
|
|
102
|
+
babelOptions,
|
|
103
|
+
mdxBabelOptions,
|
|
104
|
+
configureJSX
|
|
105
|
+
})
|
|
106
|
+
}, {
|
|
107
|
+
loader: mdxLoader,
|
|
108
|
+
options: mdxLoaderOptions
|
|
109
|
+
}]
|
|
110
|
+
}, ...sourceLoader]
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
return result;
|
|
66
114
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
mdxLoaderOptions,
|
|
86
|
-
mdxVersion,
|
|
87
|
-
mdxLoader,
|
|
88
|
-
sourceLoader,
|
|
89
|
-
rules,
|
|
90
|
-
result,
|
|
91
|
-
_args = arguments;
|
|
92
|
-
|
|
93
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
94
|
-
while (1) {
|
|
95
|
-
switch (_context.prev = _context.next) {
|
|
96
|
-
case 0:
|
|
97
|
-
webpackConfig = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
98
|
-
options = _args.length > 1 ? _args[1] : undefined;
|
|
99
|
-
resolvedBabelLoader = require.resolve('babel-loader');
|
|
100
|
-
_webpackConfig$module = webpackConfig.module, module = _webpackConfig$module === void 0 ? {} : _webpackConfig$module; // it will reuse babel options that are already in use in storybook
|
|
101
|
-
// also, these babel options are chained with other presets.
|
|
102
|
-
|
|
103
|
-
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 ? {
|
|
104
|
-
injectStoryParameters: true
|
|
105
|
-
} : _options$sourceLoader, _options$transcludeMa = options.transcludeMarkdown, transcludeMarkdown = _options$transcludeMa === void 0 ? false : _options$transcludeMa;
|
|
106
|
-
mdxLoaderOptions = {
|
|
107
|
-
skipCsf: true,
|
|
108
|
-
remarkPlugins: [remarkSlug, remarkExternalLinks]
|
|
109
|
-
};
|
|
110
|
-
mdxVersion = (_global$FEATURES = global.FEATURES) !== null && _global$FEATURES !== void 0 && _global$FEATURES.previewMdx2 ? 'MDX2' : 'MDX1';
|
|
111
|
-
logger.info("Addon-docs: using ".concat(mdxVersion));
|
|
112
|
-
mdxLoader = (_global$FEATURES2 = global.FEATURES) !== null && _global$FEATURES2 !== void 0 && _global$FEATURES2.previewMdx2 ? require.resolve('@storybook/mdx2-csf/loader') : require.resolve('@storybook/mdx1-csf/loader'); // set `sourceLoaderOptions` to `null` to disable for manual configuration
|
|
113
|
-
|
|
114
|
-
sourceLoader = sourceLoaderOptions ? [{
|
|
115
|
-
test: /\.(stories|story)\.[tj]sx?$/,
|
|
116
|
-
loader: require.resolve('@storybook/source-loader'),
|
|
117
|
-
options: Object.assign({}, sourceLoaderOptions, {
|
|
118
|
-
inspectLocalDependencies: true
|
|
119
|
-
}),
|
|
120
|
-
enforce: 'pre'
|
|
121
|
-
}] : [];
|
|
122
|
-
rules = module.rules || [];
|
|
123
|
-
|
|
124
|
-
if (transcludeMarkdown) {
|
|
125
|
-
rules = [].concat(_toConsumableArray(rules.filter(function (rule) {
|
|
126
|
-
var _rule$test;
|
|
127
|
-
|
|
128
|
-
return ((_rule$test = rule.test) === null || _rule$test === void 0 ? void 0 : _rule$test.toString()) !== '/\\.md$/';
|
|
129
|
-
})), [{
|
|
130
|
-
test: /\.md$/,
|
|
131
|
-
use: [{
|
|
132
|
-
loader: resolvedBabelLoader,
|
|
133
|
-
options: createBabelOptions({
|
|
134
|
-
babelOptions: babelOptions,
|
|
135
|
-
mdxBabelOptions: mdxBabelOptions,
|
|
136
|
-
configureJSX: configureJSX
|
|
137
|
-
})
|
|
138
|
-
}, {
|
|
139
|
-
loader: mdxLoader,
|
|
140
|
-
options: mdxLoaderOptions
|
|
141
|
-
}]
|
|
142
|
-
}]);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
result = Object.assign({}, webpackConfig, {
|
|
146
|
-
module: Object.assign({}, module, {
|
|
147
|
-
rules: [].concat(_toConsumableArray(rules), [{
|
|
148
|
-
test: /\.js$/,
|
|
149
|
-
include: new RegExp("node_modules\\".concat(path.sep, "acorn-jsx")),
|
|
150
|
-
use: [{
|
|
151
|
-
loader: resolvedBabelLoader,
|
|
152
|
-
options: {
|
|
153
|
-
presets: [[require.resolve('@babel/preset-env'), {
|
|
154
|
-
modules: 'commonjs'
|
|
155
|
-
}]]
|
|
156
|
-
}
|
|
157
|
-
}]
|
|
158
|
-
}, {
|
|
159
|
-
test: /(stories|story)\.mdx$/,
|
|
160
|
-
use: [{
|
|
161
|
-
loader: resolvedBabelLoader,
|
|
162
|
-
options: createBabelOptions({
|
|
163
|
-
babelOptions: babelOptions,
|
|
164
|
-
mdxBabelOptions: mdxBabelOptions,
|
|
165
|
-
configureJSX: configureJSX
|
|
166
|
-
})
|
|
167
|
-
}, {
|
|
168
|
-
loader: mdxLoader
|
|
169
|
-
}]
|
|
170
|
-
}, {
|
|
171
|
-
test: /\.mdx$/,
|
|
172
|
-
exclude: /(stories|story)\.mdx$/,
|
|
173
|
-
use: [{
|
|
174
|
-
loader: resolvedBabelLoader,
|
|
175
|
-
options: createBabelOptions({
|
|
176
|
-
babelOptions: babelOptions,
|
|
177
|
-
mdxBabelOptions: mdxBabelOptions,
|
|
178
|
-
configureJSX: configureJSX
|
|
179
|
-
})
|
|
180
|
-
}, {
|
|
181
|
-
loader: mdxLoader,
|
|
182
|
-
options: mdxLoaderOptions
|
|
183
|
-
}]
|
|
184
|
-
}], sourceLoader)
|
|
185
|
-
})
|
|
186
|
-
});
|
|
187
|
-
return _context.abrupt("return", result);
|
|
188
|
-
|
|
189
|
-
case 14:
|
|
190
|
-
case "end":
|
|
191
|
-
return _context.stop();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}, _callee);
|
|
195
|
-
}));
|
|
196
|
-
return _webpack.apply(this, arguments);
|
|
197
|
-
}
|
|
115
|
+
export const storyIndexers = async indexers => {
|
|
116
|
+
const mdxIndexer = async (fileName, opts) => {
|
|
117
|
+
let code = (await fs.readFile(fileName, 'utf-8')).toString(); // @ts-ignore
|
|
118
|
+
|
|
119
|
+
const {
|
|
120
|
+
compile
|
|
121
|
+
} = global.FEATURES?.previewMdx2 ? await import('@storybook/mdx2-csf') : await import('@storybook/mdx1-csf');
|
|
122
|
+
code = await compile(code, {});
|
|
123
|
+
return loadCsf(code, Object.assign({}, opts, {
|
|
124
|
+
fileName
|
|
125
|
+
})).parse();
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return [{
|
|
129
|
+
test: /(stories|story)\.mdx$/,
|
|
130
|
+
indexer: mdxIndexer
|
|
131
|
+
}, ...(indexers || [])];
|
|
132
|
+
};
|
package/dist/esm/preview.js
CHANGED
|
@@ -1,64 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import "core-js/modules/es.object.to-string.js";
|
|
3
|
-
import "core-js/modules/es.promise.js";
|
|
4
|
-
|
|
5
|
-
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); } }
|
|
6
|
-
|
|
7
|
-
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); }); }; }
|
|
8
|
-
|
|
9
|
-
export var parameters = {
|
|
1
|
+
export const parameters = {
|
|
10
2
|
docs: {
|
|
11
|
-
getContainer:
|
|
12
|
-
|
|
13
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
14
|
-
while (1) {
|
|
15
|
-
switch (_context.prev = _context.next) {
|
|
16
|
-
case 0:
|
|
17
|
-
_context.next = 2;
|
|
18
|
-
return import('./blocks');
|
|
19
|
-
|
|
20
|
-
case 2:
|
|
21
|
-
return _context.abrupt("return", _context.sent.DocsContainer);
|
|
22
|
-
|
|
23
|
-
case 3:
|
|
24
|
-
case "end":
|
|
25
|
-
return _context.stop();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}, _callee);
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
function getContainer() {
|
|
32
|
-
return _getContainer.apply(this, arguments);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return getContainer;
|
|
36
|
-
}(),
|
|
37
|
-
getPage: function () {
|
|
38
|
-
var _getPage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
39
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
40
|
-
while (1) {
|
|
41
|
-
switch (_context2.prev = _context2.next) {
|
|
42
|
-
case 0:
|
|
43
|
-
_context2.next = 2;
|
|
44
|
-
return import('./blocks');
|
|
45
|
-
|
|
46
|
-
case 2:
|
|
47
|
-
return _context2.abrupt("return", _context2.sent.DocsPage);
|
|
48
|
-
|
|
49
|
-
case 3:
|
|
50
|
-
case "end":
|
|
51
|
-
return _context2.stop();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}, _callee2);
|
|
55
|
-
}));
|
|
56
|
-
|
|
57
|
-
function getPage() {
|
|
58
|
-
return _getPage.apply(this, arguments);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return getPage;
|
|
62
|
-
}()
|
|
3
|
+
getContainer: async () => (await import('./blocks')).DocsContainer,
|
|
4
|
+
getPage: async () => (await import('./blocks')).DocsPage
|
|
63
5
|
}
|
|
64
6
|
};
|
package/dist/esm/shared.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export const ADDON_ID = 'storybook/docs';
|
|
2
|
+
export const PANEL_ID = `${ADDON_ID}/panel`;
|
|
3
|
+
export const PARAM_KEY = `docs`;
|
|
4
|
+
export const SNIPPET_RENDERED = `${ADDON_ID}/snippet-rendered`;
|
|
5
|
+
export let SourceType;
|
|
6
6
|
|
|
7
7
|
(function (SourceType) {
|
|
8
8
|
SourceType["AUTO"] = "auto";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Options } from '@storybook/core-common';
|
|
1
|
+
import type { Options, StoryIndexer } from '@storybook/core-common';
|
|
2
2
|
declare type BabelParams = {
|
|
3
3
|
babelOptions?: any;
|
|
4
4
|
mdxBabelOptions?: any;
|
|
@@ -8,4 +8,5 @@ export declare function webpack(webpackConfig: any, options: Options & BabelPara
|
|
|
8
8
|
sourceLoaderOptions: any;
|
|
9
9
|
transcludeMarkdown: boolean;
|
|
10
10
|
}): Promise<any>;
|
|
11
|
+
export declare const storyIndexers: (indexers?: StoryIndexer[]) => Promise<StoryIndexer[]>;
|
|
11
12
|
export {};
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-docs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
4
|
"description": "Document component usage and properties in Markdown",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"addon",
|
|
@@ -26,14 +26,7 @@
|
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"main": "dist/cjs/index.js",
|
|
28
28
|
"module": "dist/esm/index.js",
|
|
29
|
-
"types": "dist/
|
|
30
|
-
"typesVersions": {
|
|
31
|
-
"<3.8": {
|
|
32
|
-
"dist/ts3.9/*": [
|
|
33
|
-
"dist/ts3.4/*"
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
},
|
|
29
|
+
"types": "dist/types/index.d.ts",
|
|
37
30
|
"files": [
|
|
38
31
|
"dist/**/*",
|
|
39
32
|
"angular/**/*",
|
|
@@ -59,21 +52,21 @@
|
|
|
59
52
|
"@babel/preset-env": "^7.12.11",
|
|
60
53
|
"@jest/transform": "^26.6.2",
|
|
61
54
|
"@mdx-js/react": "^1.6.22",
|
|
62
|
-
"@storybook/addons": "
|
|
63
|
-
"@storybook/api": "
|
|
64
|
-
"@storybook/components": "
|
|
65
|
-
"@storybook/core-common": "
|
|
66
|
-
"@storybook/core-events": "
|
|
55
|
+
"@storybook/addons": "7.0.0-alpha.0",
|
|
56
|
+
"@storybook/api": "7.0.0-alpha.0",
|
|
57
|
+
"@storybook/components": "7.0.0-alpha.0",
|
|
58
|
+
"@storybook/core-common": "7.0.0-alpha.0",
|
|
59
|
+
"@storybook/core-events": "7.0.0-alpha.0",
|
|
67
60
|
"@storybook/csf": "0.0.2--canary.4566f4d.1",
|
|
68
|
-
"@storybook/docs-tools": "
|
|
61
|
+
"@storybook/docs-tools": "7.0.0-alpha.0",
|
|
69
62
|
"@storybook/mdx1-csf": "^0.0.1",
|
|
70
|
-
"@storybook/node-logger": "
|
|
71
|
-
"@storybook/postinstall": "
|
|
72
|
-
"@storybook/preview-web": "
|
|
73
|
-
"@storybook/source-loader": "
|
|
74
|
-
"@storybook/store": "
|
|
75
|
-
"@storybook/theming": "
|
|
76
|
-
"babel-loader": "^8.
|
|
63
|
+
"@storybook/node-logger": "7.0.0-alpha.0",
|
|
64
|
+
"@storybook/postinstall": "7.0.0-alpha.0",
|
|
65
|
+
"@storybook/preview-web": "7.0.0-alpha.0",
|
|
66
|
+
"@storybook/source-loader": "7.0.0-alpha.0",
|
|
67
|
+
"@storybook/store": "7.0.0-alpha.0",
|
|
68
|
+
"@storybook/theming": "7.0.0-alpha.0",
|
|
69
|
+
"babel-loader": "^8.2.5",
|
|
77
70
|
"core-js": "^3.8.2",
|
|
78
71
|
"fast-deep-equal": "^3.1.3",
|
|
79
72
|
"global": "^4.4.0",
|
|
@@ -108,8 +101,7 @@
|
|
|
108
101
|
"publishConfig": {
|
|
109
102
|
"access": "public"
|
|
110
103
|
},
|
|
111
|
-
"gitHead": "
|
|
112
|
-
"sbmodern": "dist/modern/index.js",
|
|
104
|
+
"gitHead": "c82d897ea765da8cf4fbbcc2af1f28c808a93e23",
|
|
113
105
|
"storybook": {
|
|
114
106
|
"displayName": "Docs",
|
|
115
107
|
"icon": "https://user-images.githubusercontent.com/263385/101991672-48355c80-3c7c-11eb-82d9-95fa12438f64.png",
|