@storybook/addon-interactions 6.5.0-alpha.61 → 6.5.0-alpha.64
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/dist/cjs/components/MatcherResult.js +6 -1
- package/dist/cjs/components/MethodCall.js +19 -4
- package/dist/cjs/components/MethodCall.stories.js +52 -1
- package/dist/esm/components/MatcherResult.js +6 -1
- package/dist/esm/components/MethodCall.js +18 -4
- package/dist/esm/components/MethodCall.stories.js +51 -1
- package/dist/modern/components/MatcherResult.js +6 -1
- package/dist/modern/components/MethodCall.js +17 -3
- package/dist/modern/components/MethodCall.stories.js +19 -1
- package/dist/ts3.4/Tool.d.ts +1 -0
- package/dist/ts3.4/components/Interaction/Interaction.d.ts +1 -0
- package/dist/ts3.4/components/MatcherResult.d.ts +1 -0
- package/dist/ts3.4/components/MethodCall.d.ts +9 -2
- package/dist/ts3.9/Tool.d.ts +1 -0
- package/dist/ts3.9/components/Interaction/Interaction.d.ts +1 -0
- package/dist/ts3.9/components/MatcherResult.d.ts +1 -0
- package/dist/ts3.9/components/MethodCall.d.ts +9 -2
- package/package.json +11 -10
|
@@ -96,6 +96,7 @@ var Received = function Received(_ref3) {
|
|
|
96
96
|
var value = _ref3.value,
|
|
97
97
|
parsed = _ref3.parsed;
|
|
98
98
|
return parsed ? /*#__PURE__*/_react.default.createElement(_MethodCall.Node, {
|
|
99
|
+
showObjectInspector: true,
|
|
99
100
|
value: value,
|
|
100
101
|
style: {
|
|
101
102
|
color: '#D43900'
|
|
@@ -110,8 +111,12 @@ var Expected = function Expected(_ref4) {
|
|
|
110
111
|
parsed = _ref4.parsed;
|
|
111
112
|
|
|
112
113
|
if (parsed) {
|
|
113
|
-
if (typeof value === 'string' && value.startsWith('called with'))
|
|
114
|
+
if (typeof value === 'string' && value.startsWith('called with')) {
|
|
115
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, value);
|
|
116
|
+
}
|
|
117
|
+
|
|
114
118
|
return /*#__PURE__*/_react.default.createElement(_MethodCall.Node, {
|
|
119
|
+
showObjectInspector: true,
|
|
115
120
|
value: value,
|
|
116
121
|
style: {
|
|
117
122
|
color: '#16B242'
|
|
@@ -55,11 +55,13 @@ require("core-js/modules/es.symbol.js");
|
|
|
55
55
|
|
|
56
56
|
require("core-js/modules/es.symbol.description.js");
|
|
57
57
|
|
|
58
|
+
var _objectInspector = require("@devtools-ds/object-inspector");
|
|
59
|
+
|
|
58
60
|
var _theming = require("@storybook/theming");
|
|
59
61
|
|
|
60
62
|
var _react = _interopRequireWildcard(require("react"));
|
|
61
63
|
|
|
62
|
-
var _excluded = ["value", "nested", "callsById"],
|
|
64
|
+
var _excluded = ["value", "nested", "showObjectInspector", "callsById"],
|
|
63
65
|
_excluded2 = ["value"],
|
|
64
66
|
_excluded3 = ["value"],
|
|
65
67
|
_excluded4 = ["value"];
|
|
@@ -184,6 +186,7 @@ var Node = function Node(_ref) {
|
|
|
184
186
|
|
|
185
187
|
var value = _ref.value,
|
|
186
188
|
nested = _ref.nested,
|
|
189
|
+
showObjectInspector = _ref.showObjectInspector,
|
|
187
190
|
callsById = _ref.callsById,
|
|
188
191
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
189
192
|
|
|
@@ -254,7 +257,8 @@ var Node = function Node(_ref) {
|
|
|
254
257
|
|
|
255
258
|
case Object.prototype.toString.call(value) === '[object Object]':
|
|
256
259
|
return /*#__PURE__*/_react.default.createElement(ObjectNode, _extends({
|
|
257
|
-
value: value
|
|
260
|
+
value: value,
|
|
261
|
+
showInspector: showObjectInspector
|
|
258
262
|
}, props));
|
|
259
263
|
|
|
260
264
|
default:
|
|
@@ -371,11 +375,22 @@ var ArrayNode = function ArrayNode(_ref5) {
|
|
|
371
375
|
exports.ArrayNode = ArrayNode;
|
|
372
376
|
|
|
373
377
|
var ObjectNode = function ObjectNode(_ref6) {
|
|
374
|
-
var
|
|
378
|
+
var showInspector = _ref6.showInspector,
|
|
379
|
+
value = _ref6.value,
|
|
375
380
|
_ref6$nested = _ref6.nested,
|
|
376
381
|
nested = _ref6$nested === void 0 ? false : _ref6$nested;
|
|
382
|
+
var isDarkMode = (0, _theming.useTheme)().base === 'dark';
|
|
377
383
|
var colors = useThemeColors();
|
|
378
384
|
|
|
385
|
+
if (showInspector) {
|
|
386
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_objectInspector.ObjectInspector, {
|
|
387
|
+
id: "interactions-object-inspector",
|
|
388
|
+
data: value,
|
|
389
|
+
includePrototypes: false,
|
|
390
|
+
colorScheme: isDarkMode ? 'dark' : 'light'
|
|
391
|
+
}));
|
|
392
|
+
}
|
|
393
|
+
|
|
379
394
|
if (nested) {
|
|
380
395
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
381
396
|
style: {
|
|
@@ -384,7 +399,7 @@ var ObjectNode = function ObjectNode(_ref6) {
|
|
|
384
399
|
}, '{…}');
|
|
385
400
|
}
|
|
386
401
|
|
|
387
|
-
var nodelist = interleave(Object.entries(value).slice(0,
|
|
402
|
+
var nodelist = interleave(Object.entries(value).slice(0, 2).map(function (_ref7) {
|
|
388
403
|
var _ref8 = _slicedToArray(_ref7, 2),
|
|
389
404
|
k = _ref8[0],
|
|
390
405
|
v = _ref8[1];
|
|
@@ -8,11 +8,15 @@ require("core-js/modules/es.array.slice.js");
|
|
|
8
8
|
|
|
9
9
|
require("core-js/modules/es.function.name.js");
|
|
10
10
|
|
|
11
|
+
require("core-js/modules/es.promise.js");
|
|
12
|
+
|
|
11
13
|
Object.defineProperty(exports, "__esModule", {
|
|
12
14
|
value: true
|
|
13
15
|
});
|
|
14
16
|
exports.default = exports.Simple = exports.Nested = exports.Complex = exports.Chained = exports.Args = void 0;
|
|
15
17
|
|
|
18
|
+
require("regenerator-runtime/runtime.js");
|
|
19
|
+
|
|
16
20
|
require("core-js/modules/es.array.map.js");
|
|
17
21
|
|
|
18
22
|
require("core-js/modules/es.regexp.constructor.js");
|
|
@@ -43,6 +47,10 @@ var _MethodCall = require("./MethodCall");
|
|
|
43
47
|
|
|
44
48
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
49
|
|
|
50
|
+
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); } }
|
|
51
|
+
|
|
52
|
+
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); }); }; }
|
|
53
|
+
|
|
46
54
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
47
55
|
|
|
48
56
|
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."); }
|
|
@@ -128,8 +136,51 @@ var Args = function Args() {
|
|
|
128
136
|
value: {
|
|
129
137
|
hello: 'world',
|
|
130
138
|
arr: [1, 2, 3],
|
|
131
|
-
more:
|
|
139
|
+
more: true
|
|
132
140
|
}
|
|
141
|
+
}), /*#__PURE__*/_react.default.createElement(_MethodCall.Node, {
|
|
142
|
+
value: {
|
|
143
|
+
hello: 'world',
|
|
144
|
+
arr: [1, 2, 3],
|
|
145
|
+
more: true
|
|
146
|
+
},
|
|
147
|
+
showObjectInspector: true
|
|
148
|
+
}), /*#__PURE__*/_react.default.createElement(_MethodCall.Node, {
|
|
149
|
+
value: {
|
|
150
|
+
hello: 'world',
|
|
151
|
+
arr: [1, 2, 3],
|
|
152
|
+
more: true,
|
|
153
|
+
regex: /regex/,
|
|
154
|
+
class: /*#__PURE__*/_createClass(function DummyClass() {
|
|
155
|
+
_classCallCheck(this, DummyClass);
|
|
156
|
+
}),
|
|
157
|
+
fn: function fn() {
|
|
158
|
+
return 123;
|
|
159
|
+
},
|
|
160
|
+
asyncFn: function () {
|
|
161
|
+
var _asyncFn = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
162
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
163
|
+
while (1) {
|
|
164
|
+
switch (_context.prev = _context.next) {
|
|
165
|
+
case 0:
|
|
166
|
+
return _context.abrupt("return", 'hello');
|
|
167
|
+
|
|
168
|
+
case 1:
|
|
169
|
+
case "end":
|
|
170
|
+
return _context.stop();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}, _callee);
|
|
174
|
+
}));
|
|
175
|
+
|
|
176
|
+
function asyncFn() {
|
|
177
|
+
return _asyncFn.apply(this, arguments);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return asyncFn;
|
|
181
|
+
}()
|
|
182
|
+
},
|
|
183
|
+
showObjectInspector: true
|
|
133
184
|
}), /*#__PURE__*/_react.default.createElement(_MethodCall.Node, {
|
|
134
185
|
value: new FooBar()
|
|
135
186
|
}), /*#__PURE__*/_react.default.createElement(_MethodCall.Node, {
|
|
@@ -66,6 +66,7 @@ export var Received = function Received(_ref3) {
|
|
|
66
66
|
var value = _ref3.value,
|
|
67
67
|
parsed = _ref3.parsed;
|
|
68
68
|
return parsed ? /*#__PURE__*/React.createElement(Node, {
|
|
69
|
+
showObjectInspector: true,
|
|
69
70
|
value: value,
|
|
70
71
|
style: {
|
|
71
72
|
color: '#D43900'
|
|
@@ -77,8 +78,12 @@ export var Expected = function Expected(_ref4) {
|
|
|
77
78
|
parsed = _ref4.parsed;
|
|
78
79
|
|
|
79
80
|
if (parsed) {
|
|
80
|
-
if (typeof value === 'string' && value.startsWith('called with'))
|
|
81
|
+
if (typeof value === 'string' && value.startsWith('called with')) {
|
|
82
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, value);
|
|
83
|
+
}
|
|
84
|
+
|
|
81
85
|
return /*#__PURE__*/React.createElement(Node, {
|
|
86
|
+
showObjectInspector: true,
|
|
82
87
|
value: value,
|
|
83
88
|
style: {
|
|
84
89
|
color: '#16B242'
|
|
@@ -4,7 +4,7 @@ import "core-js/modules/es.array.iterator.js";
|
|
|
4
4
|
import "core-js/modules/es.string.iterator.js";
|
|
5
5
|
import "core-js/modules/web.dom-collections.iterator.js";
|
|
6
6
|
import "core-js/modules/es.array.from.js";
|
|
7
|
-
var _excluded = ["value", "nested", "callsById"],
|
|
7
|
+
var _excluded = ["value", "nested", "showObjectInspector", "callsById"],
|
|
8
8
|
_excluded2 = ["value"],
|
|
9
9
|
_excluded3 = ["value"],
|
|
10
10
|
_excluded4 = ["value"];
|
|
@@ -46,6 +46,7 @@ import "core-js/modules/es.string.split.js";
|
|
|
46
46
|
import "core-js/modules/es.regexp.flags.js";
|
|
47
47
|
import "core-js/modules/es.symbol.js";
|
|
48
48
|
import "core-js/modules/es.symbol.description.js";
|
|
49
|
+
import { ObjectInspector } from '@devtools-ds/object-inspector';
|
|
49
50
|
import { useTheme } from '@storybook/theming';
|
|
50
51
|
import React, { Fragment } from 'react';
|
|
51
52
|
var colorsLight = {
|
|
@@ -144,6 +145,7 @@ export var Node = function Node(_ref) {
|
|
|
144
145
|
|
|
145
146
|
var value = _ref.value,
|
|
146
147
|
nested = _ref.nested,
|
|
148
|
+
showObjectInspector = _ref.showObjectInspector,
|
|
147
149
|
callsById = _ref.callsById,
|
|
148
150
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
149
151
|
|
|
@@ -214,7 +216,8 @@ export var Node = function Node(_ref) {
|
|
|
214
216
|
|
|
215
217
|
case Object.prototype.toString.call(value) === '[object Object]':
|
|
216
218
|
return /*#__PURE__*/React.createElement(ObjectNode, _extends({
|
|
217
|
-
value: value
|
|
219
|
+
value: value,
|
|
220
|
+
showInspector: showObjectInspector
|
|
218
221
|
}, props));
|
|
219
222
|
|
|
220
223
|
default:
|
|
@@ -310,11 +313,22 @@ export var ArrayNode = function ArrayNode(_ref5) {
|
|
|
310
313
|
}, "(", value.length, ") [", nodelist, ", \u2026]");
|
|
311
314
|
};
|
|
312
315
|
export var ObjectNode = function ObjectNode(_ref6) {
|
|
313
|
-
var
|
|
316
|
+
var showInspector = _ref6.showInspector,
|
|
317
|
+
value = _ref6.value,
|
|
314
318
|
_ref6$nested = _ref6.nested,
|
|
315
319
|
nested = _ref6$nested === void 0 ? false : _ref6$nested;
|
|
320
|
+
var isDarkMode = useTheme().base === 'dark';
|
|
316
321
|
var colors = useThemeColors();
|
|
317
322
|
|
|
323
|
+
if (showInspector) {
|
|
324
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ObjectInspector, {
|
|
325
|
+
id: "interactions-object-inspector",
|
|
326
|
+
data: value,
|
|
327
|
+
includePrototypes: false,
|
|
328
|
+
colorScheme: isDarkMode ? 'dark' : 'light'
|
|
329
|
+
}));
|
|
330
|
+
}
|
|
331
|
+
|
|
318
332
|
if (nested) {
|
|
319
333
|
return /*#__PURE__*/React.createElement("span", {
|
|
320
334
|
style: {
|
|
@@ -323,7 +337,7 @@ export var ObjectNode = function ObjectNode(_ref6) {
|
|
|
323
337
|
}, '{…}');
|
|
324
338
|
}
|
|
325
339
|
|
|
326
|
-
var nodelist = interleave(Object.entries(value).slice(0,
|
|
340
|
+
var nodelist = interleave(Object.entries(value).slice(0, 2).map(function (_ref7) {
|
|
327
341
|
var _ref8 = _slicedToArray(_ref7, 2),
|
|
328
342
|
k = _ref8[0],
|
|
329
343
|
v = _ref8[1];
|
|
@@ -1,3 +1,9 @@
|
|
|
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
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
8
|
|
|
3
9
|
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."); }
|
|
@@ -25,6 +31,7 @@ import "core-js/modules/es.symbol.iterator.js";
|
|
|
25
31
|
import "core-js/modules/es.array.from.js";
|
|
26
32
|
import "core-js/modules/es.array.slice.js";
|
|
27
33
|
import "core-js/modules/es.function.name.js";
|
|
34
|
+
import "core-js/modules/es.promise.js";
|
|
28
35
|
|
|
29
36
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
30
37
|
|
|
@@ -100,8 +107,51 @@ export var Args = function Args() {
|
|
|
100
107
|
value: {
|
|
101
108
|
hello: 'world',
|
|
102
109
|
arr: [1, 2, 3],
|
|
103
|
-
more:
|
|
110
|
+
more: true
|
|
104
111
|
}
|
|
112
|
+
}), /*#__PURE__*/React.createElement(Node, {
|
|
113
|
+
value: {
|
|
114
|
+
hello: 'world',
|
|
115
|
+
arr: [1, 2, 3],
|
|
116
|
+
more: true
|
|
117
|
+
},
|
|
118
|
+
showObjectInspector: true
|
|
119
|
+
}), /*#__PURE__*/React.createElement(Node, {
|
|
120
|
+
value: {
|
|
121
|
+
hello: 'world',
|
|
122
|
+
arr: [1, 2, 3],
|
|
123
|
+
more: true,
|
|
124
|
+
regex: /regex/,
|
|
125
|
+
class: /*#__PURE__*/_createClass(function DummyClass() {
|
|
126
|
+
_classCallCheck(this, DummyClass);
|
|
127
|
+
}),
|
|
128
|
+
fn: function fn() {
|
|
129
|
+
return 123;
|
|
130
|
+
},
|
|
131
|
+
asyncFn: function () {
|
|
132
|
+
var _asyncFn = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
133
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
134
|
+
while (1) {
|
|
135
|
+
switch (_context.prev = _context.next) {
|
|
136
|
+
case 0:
|
|
137
|
+
return _context.abrupt("return", 'hello');
|
|
138
|
+
|
|
139
|
+
case 1:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context.stop();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}, _callee);
|
|
145
|
+
}));
|
|
146
|
+
|
|
147
|
+
function asyncFn() {
|
|
148
|
+
return _asyncFn.apply(this, arguments);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return asyncFn;
|
|
152
|
+
}()
|
|
153
|
+
},
|
|
154
|
+
showObjectInspector: true
|
|
105
155
|
}), /*#__PURE__*/React.createElement(Node, {
|
|
106
156
|
value: new FooBar()
|
|
107
157
|
}), /*#__PURE__*/React.createElement(Node, {
|
|
@@ -33,6 +33,7 @@ export const Received = ({
|
|
|
33
33
|
value,
|
|
34
34
|
parsed
|
|
35
35
|
}) => parsed ? /*#__PURE__*/React.createElement(Node, {
|
|
36
|
+
showObjectInspector: true,
|
|
36
37
|
value: value,
|
|
37
38
|
style: {
|
|
38
39
|
color: '#D43900'
|
|
@@ -43,8 +44,12 @@ export const Expected = ({
|
|
|
43
44
|
parsed
|
|
44
45
|
}) => {
|
|
45
46
|
if (parsed) {
|
|
46
|
-
if (typeof value === 'string' && value.startsWith('called with'))
|
|
47
|
+
if (typeof value === 'string' && value.startsWith('called with')) {
|
|
48
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, value);
|
|
49
|
+
}
|
|
50
|
+
|
|
47
51
|
return /*#__PURE__*/React.createElement(Node, {
|
|
52
|
+
showObjectInspector: true,
|
|
48
53
|
value: value,
|
|
49
54
|
style: {
|
|
50
55
|
color: '#16B242'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["value", "nested", "callsById"],
|
|
1
|
+
const _excluded = ["value", "nested", "showObjectInspector", "callsById"],
|
|
2
2
|
_excluded2 = ["value"],
|
|
3
3
|
_excluded3 = ["value"],
|
|
4
4
|
_excluded4 = ["value"];
|
|
@@ -8,6 +8,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
8
8
|
|
|
9
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
10
|
|
|
11
|
+
import { ObjectInspector } from '@devtools-ds/object-inspector';
|
|
11
12
|
import { useTheme } from '@storybook/theming';
|
|
12
13
|
import React, { Fragment } from 'react';
|
|
13
14
|
const colorsLight = {
|
|
@@ -102,6 +103,7 @@ export const Node = _ref => {
|
|
|
102
103
|
|
|
103
104
|
let {
|
|
104
105
|
value,
|
|
106
|
+
showObjectInspector,
|
|
105
107
|
callsById
|
|
106
108
|
} = _ref,
|
|
107
109
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
@@ -173,7 +175,8 @@ export const Node = _ref => {
|
|
|
173
175
|
|
|
174
176
|
case Object.prototype.toString.call(value) === '[object Object]':
|
|
175
177
|
return /*#__PURE__*/React.createElement(ObjectNode, _extends({
|
|
176
|
-
value: value
|
|
178
|
+
value: value,
|
|
179
|
+
showInspector: showObjectInspector
|
|
177
180
|
}, props));
|
|
178
181
|
|
|
179
182
|
default:
|
|
@@ -273,11 +276,22 @@ export const ArrayNode = ({
|
|
|
273
276
|
}, "(", value.length, ") [", nodelist, ", \u2026]");
|
|
274
277
|
};
|
|
275
278
|
export const ObjectNode = ({
|
|
279
|
+
showInspector,
|
|
276
280
|
value,
|
|
277
281
|
nested = false
|
|
278
282
|
}) => {
|
|
283
|
+
const isDarkMode = useTheme().base === 'dark';
|
|
279
284
|
const colors = useThemeColors();
|
|
280
285
|
|
|
286
|
+
if (showInspector) {
|
|
287
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ObjectInspector, {
|
|
288
|
+
id: "interactions-object-inspector",
|
|
289
|
+
data: value,
|
|
290
|
+
includePrototypes: false,
|
|
291
|
+
colorScheme: isDarkMode ? 'dark' : 'light'
|
|
292
|
+
}));
|
|
293
|
+
}
|
|
294
|
+
|
|
281
295
|
if (nested) {
|
|
282
296
|
return /*#__PURE__*/React.createElement("span", {
|
|
283
297
|
style: {
|
|
@@ -286,7 +300,7 @@ export const ObjectNode = ({
|
|
|
286
300
|
}, '{…}');
|
|
287
301
|
}
|
|
288
302
|
|
|
289
|
-
const nodelist = interleave(Object.entries(value).slice(0,
|
|
303
|
+
const nodelist = interleave(Object.entries(value).slice(0, 2).map(([k, v]) => /*#__PURE__*/React.createElement(Fragment, {
|
|
290
304
|
key: k
|
|
291
305
|
}, /*#__PURE__*/React.createElement("span", {
|
|
292
306
|
style: {
|
|
@@ -59,8 +59,26 @@ export const Args = () => /*#__PURE__*/React.createElement("div", {
|
|
|
59
59
|
value: {
|
|
60
60
|
hello: 'world',
|
|
61
61
|
arr: [1, 2, 3],
|
|
62
|
-
more:
|
|
62
|
+
more: true
|
|
63
63
|
}
|
|
64
|
+
}), /*#__PURE__*/React.createElement(Node, {
|
|
65
|
+
value: {
|
|
66
|
+
hello: 'world',
|
|
67
|
+
arr: [1, 2, 3],
|
|
68
|
+
more: true
|
|
69
|
+
},
|
|
70
|
+
showObjectInspector: true
|
|
71
|
+
}), /*#__PURE__*/React.createElement(Node, {
|
|
72
|
+
value: {
|
|
73
|
+
hello: 'world',
|
|
74
|
+
arr: [1, 2, 3],
|
|
75
|
+
more: true,
|
|
76
|
+
regex: /regex/,
|
|
77
|
+
class: class DummyClass {},
|
|
78
|
+
fn: () => 123,
|
|
79
|
+
asyncFn: async () => 'hello'
|
|
80
|
+
},
|
|
81
|
+
showObjectInspector: true
|
|
64
82
|
}), /*#__PURE__*/React.createElement(Node, {
|
|
65
83
|
value: new FooBar()
|
|
66
84
|
}), /*#__PURE__*/React.createElement(Node, {
|
package/dist/ts3.4/Tool.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Call, ElementRef } from '@storybook/instrumenter';
|
|
2
|
-
export declare const Node: ({ value, nested, callsById, ...props }: {
|
|
3
|
+
export declare const Node: ({ value, nested, showObjectInspector, callsById, ...props }: {
|
|
3
4
|
[props: string]: any;
|
|
4
5
|
value: any;
|
|
5
6
|
nested?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Shows an object inspector instead of just printing the object.
|
|
9
|
+
* Only available for Objects
|
|
10
|
+
*/
|
|
11
|
+
showObjectInspector?: boolean;
|
|
6
12
|
callsById?: Map<Call['id'], Call>;
|
|
7
13
|
}) => JSX.Element;
|
|
8
14
|
export declare const NullNode: (props: object) => JSX.Element;
|
|
@@ -20,7 +26,8 @@ export declare const ArrayNode: ({ value, nested }: {
|
|
|
20
26
|
value: any[];
|
|
21
27
|
nested?: boolean;
|
|
22
28
|
}) => JSX.Element;
|
|
23
|
-
export declare const ObjectNode: ({ value, nested }: {
|
|
29
|
+
export declare const ObjectNode: ({ showInspector, value, nested, }: {
|
|
30
|
+
showInspector?: boolean;
|
|
24
31
|
value: object;
|
|
25
32
|
nested?: boolean;
|
|
26
33
|
}) => JSX.Element;
|
package/dist/ts3.9/Tool.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Call, ElementRef } from '@storybook/instrumenter';
|
|
2
|
-
export declare const Node: ({ value, nested, callsById, ...props }: {
|
|
3
|
+
export declare const Node: ({ value, nested, showObjectInspector, callsById, ...props }: {
|
|
3
4
|
[props: string]: any;
|
|
4
5
|
value: any;
|
|
5
6
|
nested?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Shows an object inspector instead of just printing the object.
|
|
9
|
+
* Only available for Objects
|
|
10
|
+
*/
|
|
11
|
+
showObjectInspector?: boolean;
|
|
6
12
|
callsById?: Map<Call['id'], Call>;
|
|
7
13
|
}) => JSX.Element;
|
|
8
14
|
export declare const NullNode: (props: object) => JSX.Element;
|
|
@@ -20,7 +26,8 @@ export declare const ArrayNode: ({ value, nested }: {
|
|
|
20
26
|
value: any[];
|
|
21
27
|
nested?: boolean;
|
|
22
28
|
}) => JSX.Element;
|
|
23
|
-
export declare const ObjectNode: ({ value, nested }: {
|
|
29
|
+
export declare const ObjectNode: ({ showInspector, value, nested, }: {
|
|
30
|
+
showInspector?: boolean;
|
|
24
31
|
value: object;
|
|
25
32
|
nested?: boolean;
|
|
26
33
|
}) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-interactions",
|
|
3
|
-
"version": "6.5.0-alpha.
|
|
3
|
+
"version": "6.5.0-alpha.64",
|
|
4
4
|
"description": "Automate, test and debug user interactions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook-addons",
|
|
@@ -41,15 +41,16 @@
|
|
|
41
41
|
"prepare": "node ../../scripts/prepare.js"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"@storybook/
|
|
46
|
-
"@storybook/
|
|
47
|
-
"@storybook/
|
|
48
|
-
"@storybook/
|
|
49
|
-
"@storybook/core-
|
|
44
|
+
"@devtools-ds/object-inspector": "^1.1.2",
|
|
45
|
+
"@storybook/addons": "6.5.0-alpha.64",
|
|
46
|
+
"@storybook/api": "6.5.0-alpha.64",
|
|
47
|
+
"@storybook/client-logger": "6.5.0-alpha.64",
|
|
48
|
+
"@storybook/components": "6.5.0-alpha.64",
|
|
49
|
+
"@storybook/core-common": "6.5.0-alpha.64",
|
|
50
|
+
"@storybook/core-events": "6.5.0-alpha.64",
|
|
50
51
|
"@storybook/csf": "0.0.2--canary.7c6c115.0",
|
|
51
|
-
"@storybook/instrumenter": "6.5.0-alpha.
|
|
52
|
-
"@storybook/theming": "6.5.0-alpha.
|
|
52
|
+
"@storybook/instrumenter": "6.5.0-alpha.64",
|
|
53
|
+
"@storybook/theming": "6.5.0-alpha.64",
|
|
53
54
|
"core-js": "^3.8.2",
|
|
54
55
|
"global": "^4.4.0",
|
|
55
56
|
"jest-mock": "^27.0.6",
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
"publishConfig": {
|
|
77
78
|
"access": "public"
|
|
78
79
|
},
|
|
79
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "7417a230d67b54d65caedcfb584f924b879ac9f5",
|
|
80
81
|
"sbmodern": "dist/modern/index.js",
|
|
81
82
|
"storybook": {
|
|
82
83
|
"displayName": "Interactions",
|