react-test-renderer 16.3.0-alpha.1 → 16.3.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/README.md
CHANGED
|
@@ -4,6 +4,10 @@ This package provides an experimental React renderer that can be used to render
|
|
|
4
4
|
|
|
5
5
|
Essentially, this package makes it easy to grab a snapshot of the "DOM tree" rendered by a React DOM or React Native component without using a browser or jsdom.
|
|
6
6
|
|
|
7
|
+
Documentation:
|
|
8
|
+
|
|
9
|
+
[https://reactjs.org/docs/test-renderer.html](https://reactjs.org/docs/test-renderer.html)
|
|
10
|
+
|
|
7
11
|
Usage:
|
|
8
12
|
|
|
9
13
|
```jsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.3.0
|
|
1
|
+
/** @license React v16.3.0
|
|
2
2
|
* react-test-renderer-shallow.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -17,11 +17,11 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
17
17
|
|
|
18
18
|
var _assign = require('object-assign');
|
|
19
19
|
var React = require('react');
|
|
20
|
-
var
|
|
20
|
+
var reactIs = require('react-is');
|
|
21
21
|
var emptyObject = require('fbjs/lib/emptyObject');
|
|
22
|
+
var invariant = require('fbjs/lib/invariant');
|
|
22
23
|
var shallowEqual = require('fbjs/lib/shallowEqual');
|
|
23
24
|
var checkPropTypes = require('prop-types/checkPropTypes');
|
|
24
|
-
var warning = require('fbjs/lib/warning');
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* WARNING: DO NOT manually require this module.
|
|
@@ -30,30 +30,6 @@ var warning = require('fbjs/lib/warning');
|
|
|
30
30
|
* It always throws.
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
// Exports ReactDOM.createRoot
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// Mutating mode (React DOM, React ART, React Native):
|
|
38
|
-
|
|
39
|
-
// Experimental noop mode (currently unused):
|
|
40
|
-
|
|
41
|
-
// Experimental persistent mode (Fabric):
|
|
42
|
-
|
|
43
|
-
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// In some cases, StrictMode should also double-render lifecycles.
|
|
47
|
-
// This can be confusing for tests though,
|
|
48
|
-
// And it can be bad for performance in production.
|
|
49
|
-
// This feature flag can be used to control the behavior:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
53
|
-
var warnAboutDeprecatedLifecycles = false;
|
|
54
|
-
|
|
55
|
-
// Only used in www builds.
|
|
56
|
-
|
|
57
33
|
var describeComponentFrame = function (name, source, ownerName) {
|
|
58
34
|
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
59
35
|
};
|
|
@@ -90,79 +66,8 @@ function getComponentName(fiber) {
|
|
|
90
66
|
return null;
|
|
91
67
|
}
|
|
92
68
|
|
|
93
|
-
/**
|
|
94
|
-
* Forked from fbjs/warning:
|
|
95
|
-
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
96
|
-
*
|
|
97
|
-
* Only change is we use console.warn instead of console.error,
|
|
98
|
-
* and do nothing when 'console' is not supported.
|
|
99
|
-
* This really simplifies the code.
|
|
100
|
-
* ---
|
|
101
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
102
|
-
* This can be used to log issues in development environments in critical
|
|
103
|
-
* paths. Removing the logging code for production environments will keep the
|
|
104
|
-
* same logic and follow the same code paths.
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
|
-
var lowPriorityWarning = function () {};
|
|
108
|
-
|
|
109
|
-
{
|
|
110
|
-
var printWarning = function (format) {
|
|
111
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
112
|
-
args[_key - 1] = arguments[_key];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
var argIndex = 0;
|
|
116
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
117
|
-
return args[argIndex++];
|
|
118
|
-
});
|
|
119
|
-
if (typeof console !== 'undefined') {
|
|
120
|
-
console.warn(message);
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
// --- Welcome to debugging React ---
|
|
124
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
125
|
-
// to find the callsite that caused this warning to fire.
|
|
126
|
-
throw new Error(message);
|
|
127
|
-
} catch (x) {}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
lowPriorityWarning = function (condition, format) {
|
|
131
|
-
if (format === undefined) {
|
|
132
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
133
|
-
}
|
|
134
|
-
if (!condition) {
|
|
135
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
136
|
-
args[_key2 - 2] = arguments[_key2];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
printWarning.apply(undefined, [format].concat(args));
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
145
|
-
|
|
146
69
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
147
70
|
|
|
148
|
-
var didWarnAboutLegacyWillMount = void 0;
|
|
149
|
-
var didWarnAboutLegacyWillReceiveProps = void 0;
|
|
150
|
-
var didWarnAboutLegacyWillUpdate = void 0;
|
|
151
|
-
var didWarnAboutUndefinedDerivedState = void 0;
|
|
152
|
-
var didWarnAboutUninitializedState = void 0;
|
|
153
|
-
var didWarnAboutWillReceivePropsAndDerivedState = void 0;
|
|
154
|
-
|
|
155
|
-
{
|
|
156
|
-
if (warnAboutDeprecatedLifecycles) {
|
|
157
|
-
didWarnAboutLegacyWillMount = {};
|
|
158
|
-
didWarnAboutLegacyWillReceiveProps = {};
|
|
159
|
-
didWarnAboutLegacyWillUpdate = {};
|
|
160
|
-
}
|
|
161
|
-
didWarnAboutUndefinedDerivedState = {};
|
|
162
|
-
didWarnAboutUninitializedState = {};
|
|
163
|
-
didWarnAboutWillReceivePropsAndDerivedState = {};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
71
|
var ReactShallowRenderer = function () {
|
|
167
72
|
function ReactShallowRenderer() {
|
|
168
73
|
_classCallCheck(this, ReactShallowRenderer);
|
|
@@ -191,7 +96,7 @@ var ReactShallowRenderer = function () {
|
|
|
191
96
|
!React.isValidElement(element) ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : void 0;
|
|
192
97
|
// Show a special message for host elements since it's a common case.
|
|
193
98
|
!(typeof element.type !== 'string') ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (%s). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead.', element.type) : void 0;
|
|
194
|
-
!(typeof element.type === 'function') ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `%s`.', Array.isArray(element.type) ? 'array' : element.type === null ? 'null' : typeof element.type) : void 0;
|
|
99
|
+
!(reactIs.isForwardRef(element) || typeof element.type === 'function') ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `%s`.', Array.isArray(element.type) ? 'array' : element.type === null ? 'null' : typeof element.type) : void 0;
|
|
195
100
|
|
|
196
101
|
if (this._rendering) {
|
|
197
102
|
return;
|
|
@@ -204,21 +109,11 @@ var ReactShallowRenderer = function () {
|
|
|
204
109
|
if (this._instance) {
|
|
205
110
|
this._updateClassComponent(element, this._context);
|
|
206
111
|
} else {
|
|
207
|
-
if (
|
|
112
|
+
if (reactIs.isForwardRef(element)) {
|
|
113
|
+
this._rendered = element.type.render(element.props, element.ref);
|
|
114
|
+
} else if (shouldConstruct(element.type)) {
|
|
208
115
|
this._instance = new element.type(element.props, this._context, this._updater);
|
|
209
116
|
|
|
210
|
-
{
|
|
211
|
-
if (typeof element.type.getDerivedStateFromProps === 'function') {
|
|
212
|
-
if (this._instance.state === null || this._instance.state === undefined) {
|
|
213
|
-
var componentName = getName(element.type, this._instance) || 'Unknown';
|
|
214
|
-
if (!didWarnAboutUninitializedState[componentName]) {
|
|
215
|
-
warning(false, '%s: Did not properly initialize state during construction. ' + 'Expected state to be an object, but it was %s.', componentName, this._instance.state === null ? 'null' : 'undefined');
|
|
216
|
-
didWarnAboutUninitializedState[componentName] = true;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
117
|
this._updateStateFromStaticLifecycle(element.props);
|
|
223
118
|
|
|
224
119
|
if (element.type.hasOwnProperty('contextTypes')) {
|
|
@@ -264,28 +159,15 @@ var ReactShallowRenderer = function () {
|
|
|
264
159
|
if (typeof this._instance.UNSAFE_componentWillMount === 'function' || typeof this._instance.componentWillMount === 'function') {
|
|
265
160
|
var beforeState = this._newState;
|
|
266
161
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
var componentName = getName(element.type, this._instance);
|
|
272
|
-
if (!didWarnAboutLegacyWillMount[componentName]) {
|
|
273
|
-
lowPriorityWarning$1(false, '%s: componentWillMount() is deprecated and will be ' + 'removed in the next major version. Read about the motivations ' + 'behind this change: ' + 'https://fb.me/react-async-component-lifecycle-hooks' + '\n\n' + 'As a temporary workaround, you can rename to ' + 'UNSAFE_componentWillMount instead.', componentName);
|
|
274
|
-
didWarnAboutLegacyWillMount[componentName] = true;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// In order to support react-lifecycles-compat polyfilled components,
|
|
280
|
-
// Unsafe lifecycles should not be invoked for any component with the new gDSFP.
|
|
281
|
-
if (typeof element.type.getDerivedStateFromProps !== 'function') {
|
|
162
|
+
// In order to support react-lifecycles-compat polyfilled components,
|
|
163
|
+
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
164
|
+
if (typeof element.type.getDerivedStateFromProps !== 'function' && typeof this._instance.getSnapshotBeforeUpdate !== 'function') {
|
|
165
|
+
if (typeof this._instance.componentWillMount === 'function') {
|
|
282
166
|
this._instance.componentWillMount();
|
|
283
167
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
// Unsafe lifecycles should not be invoked for any component with the new gDSFP.
|
|
288
|
-
this._instance.UNSAFE_componentWillMount();
|
|
168
|
+
if (typeof this._instance.UNSAFE_componentWillMount === 'function') {
|
|
169
|
+
this._instance.UNSAFE_componentWillMount();
|
|
170
|
+
}
|
|
289
171
|
}
|
|
290
172
|
|
|
291
173
|
// setState may have been called during cWM
|
|
@@ -308,26 +190,15 @@ var ReactShallowRenderer = function () {
|
|
|
308
190
|
var oldProps = this._instance.props;
|
|
309
191
|
|
|
310
192
|
if (oldProps !== props) {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (!didWarnAboutLegacyWillReceiveProps[componentName]) {
|
|
316
|
-
lowPriorityWarning$1(false, '%s: componentWillReceiveProps() is deprecated and ' + 'will be removed in the next major version. Use ' + 'static getDerivedStateFromProps() instead. Read about the ' + 'motivations behind this change: ' + 'https://fb.me/react-async-component-lifecycle-hooks' + '\n\n' + 'As a temporary workaround, you can rename to ' + 'UNSAFE_componentWillReceiveProps instead.', componentName);
|
|
317
|
-
didWarnAboutLegacyWillReceiveProps[componentName] = true;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
// In order to support react-lifecycles-compat polyfilled components,
|
|
322
|
-
// Unsafe lifecycles should not be invoked for any component with the new gDSFP.
|
|
323
|
-
if (typeof element.type.getDerivedStateFromProps !== 'function') {
|
|
193
|
+
// In order to support react-lifecycles-compat polyfilled components,
|
|
194
|
+
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
195
|
+
if (typeof element.type.getDerivedStateFromProps !== 'function' && typeof this._instance.getSnapshotBeforeUpdate !== 'function') {
|
|
196
|
+
if (typeof this._instance.componentWillReceiveProps === 'function') {
|
|
324
197
|
this._instance.componentWillReceiveProps(props, context);
|
|
325
198
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
// Unsafe lifecycles should not be invoked for any component with the new gDSFP.
|
|
330
|
-
this._instance.UNSAFE_componentWillReceiveProps(props, context);
|
|
199
|
+
if (typeof this._instance.UNSAFE_componentWillReceiveProps === 'function') {
|
|
200
|
+
this._instance.UNSAFE_componentWillReceiveProps(props, context);
|
|
201
|
+
}
|
|
331
202
|
}
|
|
332
203
|
|
|
333
204
|
this._updateStateFromStaticLifecycle(props);
|
|
@@ -347,27 +218,15 @@ var ReactShallowRenderer = function () {
|
|
|
347
218
|
}
|
|
348
219
|
|
|
349
220
|
if (shouldUpdate) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if (!didWarnAboutLegacyWillUpdate[_componentName]) {
|
|
355
|
-
lowPriorityWarning$1(false, '%s: componentWillUpdate() is deprecated and will be ' + 'removed in the next major version. Read about the motivations ' + 'behind this change: ' + 'https://fb.me/react-async-component-lifecycle-hooks' + '\n\n' + 'As a temporary workaround, you can rename to ' + 'UNSAFE_componentWillUpdate instead.', _componentName);
|
|
356
|
-
didWarnAboutLegacyWillUpdate[_componentName] = true;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// In order to support react-lifecycles-compat polyfilled components,
|
|
362
|
-
// Unsafe lifecycles should not be invoked for any component with the new gDSFP.
|
|
363
|
-
if (typeof type.getDerivedStateFromProps !== 'function') {
|
|
221
|
+
// In order to support react-lifecycles-compat polyfilled components,
|
|
222
|
+
// Unsafe lifecycles should not be invoked for components using the new APIs.
|
|
223
|
+
if (typeof element.type.getDerivedStateFromProps !== 'function' && typeof this._instance.getSnapshotBeforeUpdate !== 'function') {
|
|
224
|
+
if (typeof this._instance.componentWillUpdate === 'function') {
|
|
364
225
|
this._instance.componentWillUpdate(props, state, context);
|
|
365
226
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
// Unsafe lifecycles should not be invoked for any component with the new gDSFP.
|
|
370
|
-
this._instance.UNSAFE_componentWillUpdate(props, state, context);
|
|
227
|
+
if (typeof this._instance.UNSAFE_componentWillUpdate === 'function') {
|
|
228
|
+
this._instance.UNSAFE_componentWillUpdate(props, state, context);
|
|
229
|
+
}
|
|
371
230
|
}
|
|
372
231
|
}
|
|
373
232
|
|
|
@@ -387,29 +246,8 @@ var ReactShallowRenderer = function () {
|
|
|
387
246
|
|
|
388
247
|
|
|
389
248
|
if (typeof type.getDerivedStateFromProps === 'function') {
|
|
390
|
-
{
|
|
391
|
-
// Don't warn about react-lifecycles-compat polyfilled components
|
|
392
|
-
if (typeof this._instance.componentWillReceiveProps === 'function' && this._instance.componentWillReceiveProps.__suppressDeprecationWarning !== true || typeof this._instance.UNSAFE_componentWillReceiveProps === 'function') {
|
|
393
|
-
var componentName = getName(type, this._instance);
|
|
394
|
-
if (!didWarnAboutWillReceivePropsAndDerivedState[componentName]) {
|
|
395
|
-
warning(false, '%s: Defines both componentWillReceiveProps() and static ' + 'getDerivedStateFromProps() methods. We recommend using ' + 'only getDerivedStateFromProps().', componentName);
|
|
396
|
-
didWarnAboutWillReceivePropsAndDerivedState[componentName] = true;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
249
|
var partialState = type.getDerivedStateFromProps.call(null, props, this._instance.state);
|
|
402
250
|
|
|
403
|
-
{
|
|
404
|
-
if (partialState === undefined) {
|
|
405
|
-
var _componentName2 = getName(type, this._instance);
|
|
406
|
-
if (!didWarnAboutUndefinedDerivedState[_componentName2]) {
|
|
407
|
-
warning(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName2);
|
|
408
|
-
didWarnAboutUndefinedDerivedState[_componentName2] = _componentName2;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
251
|
if (partialState != null) {
|
|
414
252
|
var oldState = this._newState || this._instance.state;
|
|
415
253
|
var newState = _assign({}, oldState, partialState);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.3.0
|
|
1
|
+
/** @license React v16.3.0
|
|
2
2
|
* react-test-renderer-shallow.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -7,18 +7,18 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
'use strict';var e=require("object-assign"),
|
|
11
|
-
function
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
var
|
|
15
|
-
"");"string"===typeof a.type?
|
|
16
|
-
a.type.hasOwnProperty("contextTypes")&&(
|
|
17
|
-
this._instance=this._rendered=this._newState=this._element=this._context=null};b.prototype._mountClassComponent=function(a,c){this._instance.context=c;this._instance.props=a.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)c=this._newState,"function"
|
|
18
|
-
this._instance.
|
|
19
|
-
this._instance.
|
|
20
|
-
|
|
21
|
-
"function"===typeof b.getDerivedStateFromProps&&(a=b.getDerivedStateFromProps.call(null,a,this._instance.state),null!=a&&(a=e({},this._newState||this._instance.state,a),this._instance.state=this._newState=a))};return b}();
|
|
22
|
-
var
|
|
10
|
+
'use strict';var e=require("object-assign"),l=require("react"),m=require("react-is"),n=require("fbjs/lib/emptyObject"),p=require("fbjs/lib/shallowEqual"),q=require("prop-types/checkPropTypes");
|
|
11
|
+
function r(b){for(var a=arguments.length-1,c="Minified React error #"+b+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+b,d=0;d<a;d++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[d+1]);a=Error(c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");a.name="Invariant Violation";a.framesToPop=1;throw a;}
|
|
12
|
+
var t="function"===typeof Symbol&&Symbol["for"],u=t?Symbol["for"]("react.call"):60104,v=t?Symbol["for"]("react.return"):60105,x=t?Symbol["for"]("react.portal"):60106,y=t?Symbol["for"]("react.fragment"):60107;function z(b){b=b.type;if("function"===typeof b)return b.displayName||b.name;if("string"===typeof b)return b;switch(b){case y:return"ReactFragment";case x:return"ReactPortal";case u:return"ReactCall";case v:return"ReactReturn"}return null}
|
|
13
|
+
function A(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}
|
|
14
|
+
var E=function(){function b(){A(this,b);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new B(this)}b.prototype.getMountedInstance=function(){return this._instance};b.prototype.getRenderOutput=function(){return this._rendered};b.prototype.render=function(a){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;l.isValidElement(a)?void 0:r("12","function"===typeof a?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":
|
|
15
|
+
"");"string"===typeof a.type?r("13",a.type):void 0;m.isForwardRef(a)||"function"===typeof a.type?void 0:r("249",Array.isArray(a.type)?"array":null===a.type?"null":typeof a.type);if(!this._rendering){this._rendering=!0;this._element=a;var b=a.type.contextTypes;if(b){var g={},f;for(f in b)g[f]=c[f];c=g}else c=n;this._context=c;this._instance?this._updateClassComponent(a,this._context):m.isForwardRef(a)?this._rendered=a.type.render(a.props,a.ref):(c=a.type,c.prototype&&c.prototype.isReactComponent?(this._instance=
|
|
16
|
+
new a.type(a.props,this._context,this._updater),this._updateStateFromStaticLifecycle(a.props),a.type.hasOwnProperty("contextTypes")&&(C=a,c=a.type,b=(b=this._instance)&&b.constructor,q(a.type.contextTypes,this._context,"context",c.displayName||b&&b.displayName||c.name||b&&b.name||null,D),C=null),this._mountClassComponent(a,this._context)):this._rendered=a.type(a.props,this._context));this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};b.prototype.unmount=function(){this._instance&&
|
|
17
|
+
"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=null};b.prototype._mountClassComponent=function(a,c){this._instance.context=c;this._instance.props=a.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)c=this._newState,"function"!==
|
|
18
|
+
typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),c!==this._newState&&(this._instance.state=this._newState||n);this._rendered=this._instance.render()};b.prototype._updateClassComponent=function(a,c){var b=a.props,g=a.type,f=this._instance.state||n,w=this._instance.props;
|
|
19
|
+
w!==b&&("function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(b,c),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,c)),this._updateStateFromStaticLifecycle(b));var h=this._newState||f,k=!0;this._forcedUpdate?(k=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?
|
|
20
|
+
k=!!this._instance.shouldComponentUpdate(b,h,c):g.prototype&&g.prototype.isPureReactComponent&&(k=!p(w,b)||!p(f,h));k&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,h,c),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(b,h,c));this._instance.context=c;this._instance.props=b;this._instance.state=
|
|
21
|
+
h;k&&(this._rendered=this._instance.render())};b.prototype._updateStateFromStaticLifecycle=function(a){var b=this._element.type;"function"===typeof b.getDerivedStateFromProps&&(a=b.getDerivedStateFromProps.call(null,a,this._instance.state),null!=a&&(a=e({},this._newState||this._instance.state,a),this._instance.state=this._newState=a))};return b}();E.createRenderer=function(){return new E};
|
|
22
|
+
var B=function(){function b(a){A(this,b);this._renderer=a;this._callbacks=[]}b.prototype._enqueueCallback=function(a,b){"function"===typeof a&&b&&this._callbacks.push({callback:a,publicInstance:b})};b.prototype._invokeCallbacks=function(){var a=this._callbacks;this._callbacks=[];a.forEach(function(a){a.callback.call(a.publicInstance)})};b.prototype.isMounted=function(){return!!this._renderer._element};b.prototype.enqueueForceUpdate=function(a,b){this._enqueueCallback(b,a);this._renderer._forcedUpdate=
|
|
23
23
|
!0;this._renderer.render(this._renderer._element,this._renderer._context)};b.prototype.enqueueReplaceState=function(a,b,d){this._enqueueCallback(d,a);this._renderer._newState=b;this._renderer.render(this._renderer._element,this._renderer._context)};b.prototype.enqueueSetState=function(a,b,d){this._enqueueCallback(d,a);d=this._renderer._newState||a.state;"function"===typeof b&&(b=b(d,a.props));this._renderer._newState=e({},d,b);this._renderer.render(this._renderer._element,this._renderer._context)};
|
|
24
|
-
return b}(),
|
|
24
|
+
return b}(),C=null;function D(){var b="";if(C){var a=null==C?"#empty":"string"===typeof C||"number"===typeof C?"#text":"string"===typeof C.type?C.type:C.type.displayName||C.type.name||"Unknown",c=C._owner,d=C._source;c=c&&z(c);a="\n in "+(a||"Unknown")+(d?" (at "+d.fileName.replace(/^.*[\\\/]/,"")+":"+d.lineNumber+")":c?" (created by "+c+")":"");b+=a}return b}var F=Object.freeze({default:E}),G=F&&E||F;module.exports=G["default"]?G["default"]:G;
|