@storybook/addon-docs 6.0.25 → 6.0.26
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.
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.symbol.description");
|
|
6
|
+
|
|
3
7
|
require("core-js/modules/es.array.for-each");
|
|
4
8
|
|
|
5
9
|
require("core-js/modules/es.array.join");
|
|
@@ -88,12 +92,23 @@ var renderJsx = function renderJsx(code, options) {
|
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
var
|
|
95
|
+
var displayNameDefaults = typeof options.displayName === 'string' ? {
|
|
92
96
|
showFunctions: true,
|
|
93
97
|
displayName: function displayName() {
|
|
94
98
|
return options.displayName;
|
|
95
99
|
}
|
|
96
|
-
}
|
|
100
|
+
} : {
|
|
101
|
+
// To get exotic component names resolving properly
|
|
102
|
+
displayName: function displayName(el) {
|
|
103
|
+
return el.type.displayName || (el.type.name !== '_default' ? el.type.name : null) || (typeof el.type === 'function' ? 'No Display Name' : null) || (el.type.$$typeof === Symbol["for"]('react.forward_ref') ? el.type.render.name : null) || (el.type.$$typeof === Symbol["for"]('react.memo') ? el.type.type.name : null) || el.type;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var filterDefaults = {
|
|
107
|
+
filterProps: function filterProps(value, key) {
|
|
108
|
+
return value !== undefined;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var opts = Object.assign(Object.assign(Object.assign({}, displayNameDefaults), filterDefaults), options);
|
|
97
112
|
|
|
98
113
|
var result = _react["default"].Children.map(code, function (c) {
|
|
99
114
|
// @ts-ignore FIXME: workaround react-element-to-jsx-string
|
|
@@ -60,6 +60,20 @@ describe('renderJsx', function () {
|
|
|
60
60
|
"data-val": arr
|
|
61
61
|
}), {})).toMatchInlineSnapshot("\n <div\n data-val={[\n 'item 0',\n 'item 1',\n 'item 2',\n 'item 3',\n 'item 4',\n 'item 5',\n 'item 6',\n 'item 7',\n 'item 8',\n 'item 9',\n 'item 10',\n 'item 11',\n 'item 12',\n 'item 13',\n 'item 14',\n 'item 15',\n 'item 16',\n 'item 17',\n 'item 18',\n 'item 19'\n ]}\n />\n ");
|
|
62
62
|
});
|
|
63
|
+
it('forwardRef component', function () {
|
|
64
|
+
var MyExoticComponent = _react["default"].forwardRef(function MyExoticComponent(props, _ref) {
|
|
65
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, props.children);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
expect((0, _jsxDecorator.renderJsx)( /*#__PURE__*/_react["default"].createElement(MyExoticComponent, null, "I'm forwardRef!"), {})).toMatchInlineSnapshot("\n <MyExoticComponent>\n I'm forwardRef!\n </MyExoticComponent>\n ");
|
|
69
|
+
});
|
|
70
|
+
it('memo component', function () {
|
|
71
|
+
var MyMemoComponent = _react["default"].memo(function MyMemoComponent(props) {
|
|
72
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, props.children);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
expect((0, _jsxDecorator.renderJsx)( /*#__PURE__*/_react["default"].createElement(MyMemoComponent, null, "I'm memo!"), {})).toMatchInlineSnapshot("\n <MyMemoComponent>\n I'm memo!\n </MyMemoComponent>\n ");
|
|
76
|
+
});
|
|
63
77
|
}); // @ts-ignore
|
|
64
78
|
|
|
65
79
|
var makeContext = function makeContext(name, parameters, args) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-docs",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.26",
|
|
4
4
|
"description": "Superior documentation for your components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"addon",
|
|
@@ -47,18 +47,18 @@
|
|
|
47
47
|
"@mdx-js/loader": "^1.5.1",
|
|
48
48
|
"@mdx-js/mdx": "^1.5.1",
|
|
49
49
|
"@mdx-js/react": "^1.5.1",
|
|
50
|
-
"@storybook/addons": "6.0.
|
|
51
|
-
"@storybook/api": "6.0.
|
|
52
|
-
"@storybook/client-api": "6.0.
|
|
53
|
-
"@storybook/client-logger": "6.0.
|
|
54
|
-
"@storybook/components": "6.0.
|
|
55
|
-
"@storybook/core": "6.0.
|
|
56
|
-
"@storybook/core-events": "6.0.
|
|
50
|
+
"@storybook/addons": "6.0.26",
|
|
51
|
+
"@storybook/api": "6.0.26",
|
|
52
|
+
"@storybook/client-api": "6.0.26",
|
|
53
|
+
"@storybook/client-logger": "6.0.26",
|
|
54
|
+
"@storybook/components": "6.0.26",
|
|
55
|
+
"@storybook/core": "6.0.26",
|
|
56
|
+
"@storybook/core-events": "6.0.26",
|
|
57
57
|
"@storybook/csf": "0.0.1",
|
|
58
|
-
"@storybook/node-logger": "6.0.
|
|
59
|
-
"@storybook/postinstall": "6.0.
|
|
60
|
-
"@storybook/source-loader": "6.0.
|
|
61
|
-
"@storybook/theming": "6.0.
|
|
58
|
+
"@storybook/node-logger": "6.0.26",
|
|
59
|
+
"@storybook/postinstall": "6.0.26",
|
|
60
|
+
"@storybook/source-loader": "6.0.26",
|
|
61
|
+
"@storybook/theming": "6.0.26",
|
|
62
62
|
"acorn": "^7.1.0",
|
|
63
63
|
"acorn-jsx": "^5.1.0",
|
|
64
64
|
"acorn-walk": "^7.0.0",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"@babel/core": "^7.9.6",
|
|
84
84
|
"@emotion/core": "^10.0.20",
|
|
85
85
|
"@emotion/styled": "^10.0.17",
|
|
86
|
-
"@storybook/react": "6.0.
|
|
87
|
-
"@storybook/web-components": "6.0.
|
|
86
|
+
"@storybook/react": "6.0.26",
|
|
87
|
+
"@storybook/web-components": "6.0.26",
|
|
88
88
|
"@types/cross-spawn": "^6.0.1",
|
|
89
89
|
"@types/doctrine": "^0.0.3",
|
|
90
90
|
"@types/enzyme": "^3.10.3",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"publishConfig": {
|
|
145
145
|
"access": "public"
|
|
146
146
|
},
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "748710ce10a4f16d599f183f215455e450e25d32",
|
|
148
148
|
"typesVersions": {
|
|
149
149
|
"<=3.5": {
|
|
150
150
|
"*": [
|