react 16.0.0-alpha.9 → 16.0.0-alpha.13
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/cjs/react.development.js +825 -1109
- package/cjs/react.production.min.js +1 -1
- package/package.json +1 -2
- package/umd/react.development.js +1039 -2461
- package/umd/react.production.min.js +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){for(var t=arguments.length-1,
|
|
1
|
+
"use strict";function e(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);n+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var o=new Error(n);throw o.name="Invariant Violation",o.framesToPop=1,o}function t(e,t){}function n(e,t,n){this.props=e,this.context=t,this.refs=A,this.updater=n||x}function r(e,t,n){this.props=e,this.context=t,this.refs=A,this.updater=n||x}function o(){}function l(e){return void 0!==e.ref}function u(e){return void 0!==e.key}function i(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}function c(e,t){return"object"==typeof e&&null!==e&&null!=e.key?i(e.key):t.toString(36)}function a(e,t,n,r){var o=typeof e;if("undefined"!==o&&"boolean"!==o||(e=null),null===e||"string"===o||"number"===o||"object"===o&&e.$$typeof===H)return n(r,e,""===t?J+c(e,0):t,X),1;var l,u,i=0,f=""===t?J:t+Q;if(Array.isArray(e))for(var s=0;s<e.length;s++)l=e[s],u=f+c(l,s),i+=a(l,u,n,r);else{var p=Y&&e[Y]||e[G];if("function"==typeof p)for(var y,h=p.call(e),d=0;!(y=h.next()).done;)l=y.value,u=f+c(l,d++),i+=a(l,u,n,r);else if("object"===o){var v=""+e;k("31","[object Object]"===v?"object with keys {"+Object.keys(e).join(", ")+"}":v,"")}}return i}function f(e,t,n){return null==e?0:a(e,"",t,n)}function s(e){return(""+e).replace(ne,"$&/")}function p(e,t){this.func=e,this.context=t,this.count=0}function y(e,t,n){var r=e.func,o=e.context;r.call(o,t,e.count++)}function h(e,t,n){if(null==e)return e;var r=p.getPooled(t,n);Z(e,y,r),p.release(r)}function d(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function v(e,t,n){var r=e.result,o=e.keyPrefix,l=e.func,u=e.context,i=l.call(u,t,e.count++);Array.isArray(i)?m(i,r,n,w.thatReturnsArgument):null!=i&&(B.isValidElement(i)&&(i=B.cloneAndReplaceKey(i,o+(!i.key||t&&t.key===i.key?"":s(i.key)+"/")+n)),r.push(i))}function m(e,t,n,r,o){var l="";null!=n&&(l=s(n)+"/");var u=d.getPooled(t,l,r,o);Z(e,v,u),d.release(u)}function P(e,t,n){if(null==e)return e;var r=[];return m(e,r,null,t,n),r}function b(e,t,n){return null}function g(e,t){return Z(e,b,null)}function _(e){var t=[];return m(e,t,null,w.thatReturnsArgument),t}function S(e){return B.isValidElement(e)||k("143"),e}var E=require("object-assign");require("fbjs/lib/warning");var A=require("fbjs/lib/emptyObject");require("fbjs/lib/invariant");var w=require("fbjs/lib/emptyFunction"),k=e,j={isMounted:function(e){return!1},enqueueForceUpdate:function(e,n,r){t(e,"forceUpdate")},enqueueReplaceState:function(e,n,r,o){t(e,"replaceState")},enqueueSetState:function(e,n,r,o){t(e,"setState")}},x=j;n.prototype.isReactComponent={},n.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&k("85"),this.updater.enqueueSetState(this,e,t,"setState")},n.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r,E(r.prototype,n.prototype),r.prototype.isPureReactComponent=!0;var R={Component:n,PureComponent:r},C=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},O=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},q=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},U=function(e,t,n,r){var o=this;if(o.instancePool.length){var l=o.instancePool.pop();return o.call(l,e,t,n,r),l}return new o(e,t,n,r)},$=function(e){var t=this;e instanceof t||k("25"),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},F=10,I=C,T=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||I,n.poolSize||(n.poolSize=F),n.release=$,n},V={addPoolingTo:T,oneArgumentPooler:C,twoArgumentPooler:O,threeArgumentPooler:q,fourArgumentPooler:U},z=V,K={current:null},L=K,N=Object.prototype.hasOwnProperty,D="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,M={key:!0,ref:!0,__self:!0,__source:!0},W=function(e,t,n,r,o,l,u){return{$$typeof:D,type:e,key:t,ref:n,props:u,_owner:l}};W.createElement=function(e,t,n){var r,o={},i=null,c=null,a=null,f=null;if(null!=t){l(t)&&(c=t.ref),u(t)&&(i=""+t.key),a=void 0===t.__self?null:t.__self,f=void 0===t.__source?null:t.__source;for(r in t)N.call(t,r)&&!M.hasOwnProperty(r)&&(o[r]=t[r])}var s=arguments.length-2;if(1===s)o.children=n;else if(s>1){for(var p=Array(s),y=0;y<s;y++)p[y]=arguments[y+2];o.children=p}if(e&&e.defaultProps){var h=e.defaultProps;for(r in h)void 0===o[r]&&(o[r]=h[r])}return W(e,i,c,a,f,L.current,o)},W.createFactory=function(e){var t=W.createElement.bind(null,e);return t.type=e,t},W.cloneAndReplaceKey=function(e,t){return W(e.type,t,e.ref,e._self,e._source,e._owner,e.props)},W.cloneElement=function(e,t,n){var r,o=E({},e.props),i=e.key,c=e.ref,a=e._self,f=e._source,s=e._owner;if(null!=t){l(t)&&(c=t.ref,s=L.current),u(t)&&(i=""+t.key);var p;e.type&&e.type.defaultProps&&(p=e.type.defaultProps);for(r in t)N.call(t,r)&&!M.hasOwnProperty(r)&&(void 0===t[r]&&void 0!==p?o[r]=p[r]:o[r]=t[r])}var y=arguments.length-2;if(1===y)o.children=n;else if(y>1){for(var h=Array(y),d=0;d<y;d++)h[d]=arguments[d+2];o.children=h}return W(e.type,i,c,a,f,s,o)},W.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===D};var B=W,Y="function"==typeof Symbol&&Symbol.iterator,G="@@iterator",H="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,J=".",Q=":",X=w,Z=f,ee=z.twoArgumentPooler,te=z.fourArgumentPooler,ne=/\/+/g;p.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},z.addPoolingTo(p,ee),d.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},z.addPoolingTo(d,te);var re={forEach:h,map:P,mapIntoWithKeyPrefixInternal:m,count:g,toArray:_},oe=re,le="16.0.0-alpha.13",ue=S,ie=B.createElement,ce=B.createFactory,ae=B.cloneElement,fe={Children:{map:oe.map,forEach:oe.forEach,count:oe.count,toArray:oe.toArray,only:ue},Component:R.Component,PureComponent:R.PureComponent,createElement:ie,cloneElement:ae,isValidElement:B.isValidElement,createFactory:ce,version:le,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:L}},se=fe;module.exports=se;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react",
|
|
3
3
|
"description": "React is a JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "16.0.0-alpha.
|
|
4
|
+
"version": "16.0.0-alpha.13",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react"
|
|
7
7
|
],
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"node": ">=0.10.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"create-react-class": "^15.5.2",
|
|
26
25
|
"fbjs": "^0.8.9",
|
|
27
26
|
"loose-envify": "^1.1.0",
|
|
28
27
|
"object-assign": "^4.1.0",
|
package/umd/react.development.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react.development.js v16.0.0-alpha.
|
|
2
|
+
* react.development.js v16.0.0-alpha.13
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
(function (global, factory) {
|
|
@@ -154,7 +154,7 @@ var emptyFunction_1 = emptyFunction;
|
|
|
154
154
|
* same logic and follow the same code paths.
|
|
155
155
|
*/
|
|
156
156
|
|
|
157
|
-
var warning
|
|
157
|
+
var warning = emptyFunction_1;
|
|
158
158
|
|
|
159
159
|
{
|
|
160
160
|
(function () {
|
|
@@ -178,7 +178,7 @@ var warning$1 = emptyFunction_1;
|
|
|
178
178
|
} catch (x) {}
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
warning
|
|
181
|
+
warning = function warning(condition, format) {
|
|
182
182
|
if (format === undefined) {
|
|
183
183
|
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
184
184
|
}
|
|
@@ -198,7 +198,7 @@ var warning$1 = emptyFunction_1;
|
|
|
198
198
|
})();
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
var warning_1 = warning
|
|
201
|
+
var warning_1 = warning;
|
|
202
202
|
|
|
203
203
|
function warnNoop(publicInstance, callerName) {
|
|
204
204
|
{
|
|
@@ -277,31 +277,6 @@ var ReactNoopUpdateQueue = {
|
|
|
277
277
|
|
|
278
278
|
var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue;
|
|
279
279
|
|
|
280
|
-
/**
|
|
281
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
282
|
-
* All rights reserved.
|
|
283
|
-
*
|
|
284
|
-
* This source code is licensed under the BSD-style license found in the
|
|
285
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
286
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
* @providesModule canDefineProperty
|
|
290
|
-
*/
|
|
291
|
-
|
|
292
|
-
var canDefineProperty$1 = false;
|
|
293
|
-
{
|
|
294
|
-
try {
|
|
295
|
-
// $FlowFixMe https://github.com/facebook/flow/issues/285
|
|
296
|
-
Object.defineProperty({}, 'x', { get: function () {} });
|
|
297
|
-
canDefineProperty$1 = true;
|
|
298
|
-
} catch (x) {
|
|
299
|
-
// IE will fail on defineProperty
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
var canDefineProperty_1 = canDefineProperty$1;
|
|
304
|
-
|
|
305
280
|
/**
|
|
306
281
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
307
282
|
* All rights reserved.
|
|
@@ -374,6 +349,70 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
374
349
|
|
|
375
350
|
var invariant_1 = invariant;
|
|
376
351
|
|
|
352
|
+
/**
|
|
353
|
+
* Copyright 2014-2015, Facebook, Inc.
|
|
354
|
+
* All rights reserved.
|
|
355
|
+
*
|
|
356
|
+
* This source code is licensed under the BSD-style license found in the
|
|
357
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
358
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
359
|
+
*
|
|
360
|
+
* @providesModule lowPriorityWarning
|
|
361
|
+
*/
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Forked from fbjs/warning:
|
|
365
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
366
|
+
*
|
|
367
|
+
* Only change is we use console.warn instead of console.error,
|
|
368
|
+
* and do nothing when 'console' is not supported.
|
|
369
|
+
* This really simplifies the code.
|
|
370
|
+
* ---
|
|
371
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
372
|
+
* This can be used to log issues in development environments in critical
|
|
373
|
+
* paths. Removing the logging code for production environments will keep the
|
|
374
|
+
* same logic and follow the same code paths.
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
var lowPriorityWarning = function () {};
|
|
378
|
+
|
|
379
|
+
{
|
|
380
|
+
var printWarning = function (format) {
|
|
381
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
382
|
+
args[_key - 1] = arguments[_key];
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
var argIndex = 0;
|
|
386
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
387
|
+
return args[argIndex++];
|
|
388
|
+
});
|
|
389
|
+
if (typeof console !== 'undefined') {
|
|
390
|
+
console.warn(message);
|
|
391
|
+
}
|
|
392
|
+
try {
|
|
393
|
+
// --- Welcome to debugging React ---
|
|
394
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
395
|
+
// to find the callsite that caused this warning to fire.
|
|
396
|
+
throw new Error(message);
|
|
397
|
+
} catch (x) {}
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
lowPriorityWarning = function (condition, format) {
|
|
401
|
+
if (format === undefined) {
|
|
402
|
+
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
403
|
+
}
|
|
404
|
+
if (!condition) {
|
|
405
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
406
|
+
args[_key2 - 2] = arguments[_key2];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
printWarning.apply(undefined, [format].concat(args));
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
var lowPriorityWarning_1 = lowPriorityWarning;
|
|
415
|
+
|
|
377
416
|
/**
|
|
378
417
|
* Base class helpers for the updating state of a component.
|
|
379
418
|
*/
|
|
@@ -447,14 +486,12 @@ ReactComponent.prototype.forceUpdate = function (callback) {
|
|
|
447
486
|
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
448
487
|
};
|
|
449
488
|
var defineDeprecationWarning = function (methodName, info) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
});
|
|
457
|
-
}
|
|
489
|
+
Object.defineProperty(ReactComponent.prototype, methodName, {
|
|
490
|
+
get: function () {
|
|
491
|
+
lowPriorityWarning_1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
492
|
+
return undefined;
|
|
493
|
+
}
|
|
494
|
+
});
|
|
458
495
|
};
|
|
459
496
|
for (var fnName in deprecatedAPIs) {
|
|
460
497
|
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
@@ -612,29 +649,12 @@ var ReactCurrentOwner = {
|
|
|
612
649
|
|
|
613
650
|
var ReactCurrentOwner_1 = ReactCurrentOwner;
|
|
614
651
|
|
|
615
|
-
|
|
616
|
-
* Copyright 2014-present, Facebook, Inc.
|
|
617
|
-
* All rights reserved.
|
|
618
|
-
*
|
|
619
|
-
* This source code is licensed under the BSD-style license found in the
|
|
620
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
621
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
622
|
-
*
|
|
623
|
-
* @providesModule ReactElementSymbol
|
|
624
|
-
*
|
|
625
|
-
*/
|
|
652
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
626
653
|
|
|
627
654
|
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
628
655
|
// nor polyfill, then a plain number is used for performance.
|
|
629
|
-
|
|
630
656
|
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
631
657
|
|
|
632
|
-
var ReactElementSymbol = REACT_ELEMENT_TYPE;
|
|
633
|
-
|
|
634
|
-
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
658
|
var RESERVED_PROPS = {
|
|
639
659
|
key: true,
|
|
640
660
|
ref: true,
|
|
@@ -720,7 +740,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
720
740
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
721
741
|
var element = {
|
|
722
742
|
// This tag allow us to uniquely identify this as a React Element
|
|
723
|
-
$$typeof:
|
|
743
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
724
744
|
|
|
725
745
|
// Built-in properties that belong on the element
|
|
726
746
|
type: type,
|
|
@@ -743,33 +763,27 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
743
763
|
// the validation flag non-enumerable (where possible, which should
|
|
744
764
|
// include every environment we run tests in), so the test framework
|
|
745
765
|
// ignores it.
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
});
|
|
768
|
-
} else {
|
|
769
|
-
element._store.validated = false;
|
|
770
|
-
element._self = self;
|
|
771
|
-
element._source = source;
|
|
772
|
-
}
|
|
766
|
+
Object.defineProperty(element._store, 'validated', {
|
|
767
|
+
configurable: false,
|
|
768
|
+
enumerable: false,
|
|
769
|
+
writable: true,
|
|
770
|
+
value: false
|
|
771
|
+
});
|
|
772
|
+
// self and source are DEV only properties.
|
|
773
|
+
Object.defineProperty(element, '_self', {
|
|
774
|
+
configurable: false,
|
|
775
|
+
enumerable: false,
|
|
776
|
+
writable: false,
|
|
777
|
+
value: self
|
|
778
|
+
});
|
|
779
|
+
// Two elements created in two different places should be considered
|
|
780
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
781
|
+
Object.defineProperty(element, '_source', {
|
|
782
|
+
configurable: false,
|
|
783
|
+
enumerable: false,
|
|
784
|
+
writable: false,
|
|
785
|
+
value: source
|
|
786
|
+
});
|
|
773
787
|
if (Object.freeze) {
|
|
774
788
|
Object.freeze(element.props);
|
|
775
789
|
Object.freeze(element);
|
|
@@ -841,7 +855,7 @@ ReactElement.createElement = function (type, config, children) {
|
|
|
841
855
|
}
|
|
842
856
|
{
|
|
843
857
|
if (key || ref) {
|
|
844
|
-
if (typeof props.$$typeof === 'undefined' || props.$$typeof !==
|
|
858
|
+
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
|
|
845
859
|
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
846
860
|
if (key) {
|
|
847
861
|
defineKeyPropWarningGetter(props, displayName);
|
|
@@ -950,7 +964,7 @@ ReactElement.cloneElement = function (element, config, children) {
|
|
|
950
964
|
* @final
|
|
951
965
|
*/
|
|
952
966
|
ReactElement.isValidElement = function (object) {
|
|
953
|
-
return typeof object === 'object' && object !== null && object.$$typeof ===
|
|
967
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
954
968
|
};
|
|
955
969
|
|
|
956
970
|
var ReactElement_1 = ReactElement;
|
|
@@ -963,37 +977,23 @@ var ReactElement_1 = ReactElement;
|
|
|
963
977
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
964
978
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
965
979
|
*
|
|
966
|
-
* @providesModule
|
|
980
|
+
* @providesModule ReactTypeOfWork
|
|
967
981
|
*
|
|
968
982
|
*/
|
|
969
983
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
* ...
|
|
984
|
-
* }
|
|
985
|
-
*
|
|
986
|
-
* @param {?object} maybeIterable
|
|
987
|
-
* @return {?function}
|
|
988
|
-
*/
|
|
989
|
-
function getIteratorFn(maybeIterable) {
|
|
990
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
991
|
-
if (typeof iteratorFn === 'function') {
|
|
992
|
-
return iteratorFn;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
var getIteratorFn_1 = getIteratorFn;
|
|
984
|
+
var ReactTypeOfWork = {
|
|
985
|
+
IndeterminateComponent: 0, // Before we know whether it is functional or class
|
|
986
|
+
FunctionalComponent: 1,
|
|
987
|
+
ClassComponent: 2,
|
|
988
|
+
HostRoot: 3, // Root of a host tree. Could be nested inside another node.
|
|
989
|
+
HostPortal: 4, // A subtree. Could be an entry point to a different renderer.
|
|
990
|
+
HostComponent: 5,
|
|
991
|
+
HostText: 6,
|
|
992
|
+
CoroutineComponent: 7,
|
|
993
|
+
CoroutineHandlerPhase: 8,
|
|
994
|
+
YieldComponent: 9,
|
|
995
|
+
Fragment: 10
|
|
996
|
+
};
|
|
997
997
|
|
|
998
998
|
/**
|
|
999
999
|
* Copyright 2013-present, Facebook, Inc.
|
|
@@ -1003,1762 +1003,754 @@ var getIteratorFn_1 = getIteratorFn;
|
|
|
1003
1003
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1004
1004
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1005
1005
|
*
|
|
1006
|
-
* @providesModule
|
|
1006
|
+
* @providesModule getComponentName
|
|
1007
1007
|
*
|
|
1008
1008
|
*/
|
|
1009
1009
|
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1010
|
+
function getComponentName(instanceOrFiber) {
|
|
1011
|
+
if (typeof instanceOrFiber.getName === 'function') {
|
|
1012
|
+
// Stack reconciler
|
|
1013
|
+
var instance = instanceOrFiber;
|
|
1014
|
+
return instance.getName();
|
|
1015
|
+
}
|
|
1016
|
+
if (typeof instanceOrFiber.tag === 'number') {
|
|
1017
|
+
// Fiber reconciler
|
|
1018
|
+
var fiber = instanceOrFiber;
|
|
1019
|
+
var type = fiber.type;
|
|
1016
1020
|
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
'
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1021
|
+
if (typeof type === 'string') {
|
|
1022
|
+
return type;
|
|
1023
|
+
}
|
|
1024
|
+
if (typeof type === 'function') {
|
|
1025
|
+
return type.displayName || type.name;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
return null;
|
|
1029
|
+
}
|
|
1026
1030
|
|
|
1027
|
-
|
|
1031
|
+
var getComponentName_1 = getComponentName;
|
|
1032
|
+
|
|
1033
|
+
var IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent;
|
|
1034
|
+
var FunctionalComponent = ReactTypeOfWork.FunctionalComponent;
|
|
1035
|
+
var ClassComponent = ReactTypeOfWork.ClassComponent;
|
|
1036
|
+
var HostComponent = ReactTypeOfWork.HostComponent;
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
function describeComponentFrame$1(name, source, ownerName) {
|
|
1041
|
+
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
1028
1042
|
}
|
|
1029
1043
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1044
|
+
function describeFiber(fiber) {
|
|
1045
|
+
switch (fiber.tag) {
|
|
1046
|
+
case IndeterminateComponent:
|
|
1047
|
+
case FunctionalComponent:
|
|
1048
|
+
case ClassComponent:
|
|
1049
|
+
case HostComponent:
|
|
1050
|
+
var owner = fiber._debugOwner;
|
|
1051
|
+
var source = fiber._debugSource;
|
|
1052
|
+
var name = getComponentName_1(fiber);
|
|
1053
|
+
var ownerName = null;
|
|
1054
|
+
if (owner) {
|
|
1055
|
+
ownerName = getComponentName_1(owner);
|
|
1056
|
+
}
|
|
1057
|
+
return describeComponentFrame$1(name, source, ownerName);
|
|
1058
|
+
default:
|
|
1059
|
+
return '';
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1043
1062
|
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1063
|
+
// This function can only be called with a work-in-progress fiber and
|
|
1064
|
+
// only during begin or complete phase. Do not call it under any other
|
|
1065
|
+
// circumstances.
|
|
1066
|
+
function getStackAddendumByWorkInProgressFiber$1(workInProgress) {
|
|
1067
|
+
var info = '';
|
|
1068
|
+
var node = workInProgress;
|
|
1069
|
+
do {
|
|
1070
|
+
info += describeFiber(node);
|
|
1071
|
+
// Otherwise this return pointer might point to the wrong tree:
|
|
1072
|
+
node = node['return'];
|
|
1073
|
+
} while (node);
|
|
1074
|
+
return info;
|
|
1047
1075
|
}
|
|
1048
1076
|
|
|
1049
|
-
var
|
|
1050
|
-
|
|
1051
|
-
|
|
1077
|
+
var ReactFiberComponentTreeHook = {
|
|
1078
|
+
getStackAddendumByWorkInProgressFiber: getStackAddendumByWorkInProgressFiber$1,
|
|
1079
|
+
describeComponentFrame: describeComponentFrame$1
|
|
1052
1080
|
};
|
|
1053
1081
|
|
|
1054
|
-
var
|
|
1082
|
+
var getStackAddendumByWorkInProgressFiber = ReactFiberComponentTreeHook.getStackAddendumByWorkInProgressFiber;
|
|
1083
|
+
var describeComponentFrame = ReactFiberComponentTreeHook.describeComponentFrame;
|
|
1055
1084
|
|
|
1056
|
-
var SEPARATOR = '.';
|
|
1057
|
-
var SUBSEPARATOR = ':';
|
|
1058
1085
|
|
|
1059
|
-
/**
|
|
1060
|
-
* This is inlined from ReactElement since this file is shared between
|
|
1061
|
-
* isomorphic and renderers. We could extract this to a
|
|
1062
|
-
*
|
|
1063
|
-
*/
|
|
1064
1086
|
|
|
1065
|
-
/**
|
|
1066
|
-
* TODO: Test that a single child and an array with one item have the same key
|
|
1067
|
-
* pattern.
|
|
1068
|
-
*/
|
|
1069
1087
|
|
|
1070
|
-
var didWarnAboutMaps = false;
|
|
1071
1088
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
//
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
return
|
|
1089
|
+
function isNative(fn) {
|
|
1090
|
+
// Based on isNative() from Lodash
|
|
1091
|
+
var funcToString = Function.prototype.toString;
|
|
1092
|
+
var reIsNative = RegExp('^' + funcToString
|
|
1093
|
+
// Take an example native function source for comparison
|
|
1094
|
+
.call(Object.prototype.hasOwnProperty)
|
|
1095
|
+
// Strip regex characters so we can use it for regex
|
|
1096
|
+
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
|
1097
|
+
// Remove hasOwnProperty from the template to make it generic
|
|
1098
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
1099
|
+
try {
|
|
1100
|
+
var source = funcToString.call(fn);
|
|
1101
|
+
return reIsNative.test(source);
|
|
1102
|
+
} catch (err) {
|
|
1103
|
+
return false;
|
|
1085
1104
|
}
|
|
1086
|
-
// Implicit key determined by the index in the set
|
|
1087
|
-
return index.toString(36);
|
|
1088
1105
|
}
|
|
1089
1106
|
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1107
|
+
var canUseCollections =
|
|
1108
|
+
// Array.from
|
|
1109
|
+
typeof Array.from === 'function' &&
|
|
1110
|
+
// Map
|
|
1111
|
+
typeof Map === 'function' && isNative(Map) &&
|
|
1112
|
+
// Map.prototype.keys
|
|
1113
|
+
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
|
|
1114
|
+
// Set
|
|
1115
|
+
typeof Set === 'function' && isNative(Set) &&
|
|
1116
|
+
// Set.prototype.keys
|
|
1117
|
+
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
|
|
1100
1118
|
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
// some checks. React Fiber also inlines this logic for similar purposes.
|
|
1109
|
-
type === 'object' && children.$$typeof === ReactElementSymbol) {
|
|
1110
|
-
callback(traverseContext, children,
|
|
1111
|
-
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1112
|
-
// so that it's consistent if the number of children grows.
|
|
1113
|
-
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
1114
|
-
return 1;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
var child;
|
|
1118
|
-
var nextName;
|
|
1119
|
-
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1120
|
-
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1121
|
-
|
|
1122
|
-
if (Array.isArray(children)) {
|
|
1123
|
-
for (var i = 0; i < children.length; i++) {
|
|
1124
|
-
child = children[i];
|
|
1125
|
-
nextName = nextNamePrefix + getComponentKey(child, i);
|
|
1126
|
-
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1127
|
-
}
|
|
1128
|
-
} else {
|
|
1129
|
-
var iteratorFn = getIteratorFn_1(children);
|
|
1130
|
-
if (iteratorFn) {
|
|
1131
|
-
{
|
|
1132
|
-
// Warn about using Maps as children
|
|
1133
|
-
if (iteratorFn === children.entries) {
|
|
1134
|
-
var mapsAsChildrenAddendum = '';
|
|
1135
|
-
if (ReactCurrentOwner_1.current) {
|
|
1136
|
-
var mapsAsChildrenOwnerName = ReactCurrentOwner_1.current.getName();
|
|
1137
|
-
if (mapsAsChildrenOwnerName) {
|
|
1138
|
-
mapsAsChildrenAddendum = '\n\nCheck the render method of `' + mapsAsChildrenOwnerName + '`.';
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
warning_1(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', mapsAsChildrenAddendum);
|
|
1142
|
-
didWarnAboutMaps = true;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
var iterator = iteratorFn.call(children);
|
|
1147
|
-
var step;
|
|
1148
|
-
var ii = 0;
|
|
1149
|
-
while (!(step = iterator.next()).done) {
|
|
1150
|
-
child = step.value;
|
|
1151
|
-
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
1152
|
-
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1153
|
-
}
|
|
1154
|
-
} else if (type === 'object') {
|
|
1155
|
-
var addendum = '';
|
|
1156
|
-
{
|
|
1157
|
-
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.';
|
|
1158
|
-
if (ReactCurrentOwner_1.current) {
|
|
1159
|
-
var name = ReactCurrentOwner_1.current.getName();
|
|
1160
|
-
if (name) {
|
|
1161
|
-
addendum += '\n\nCheck the render method of `' + name + '`.';
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
var childrenString = '' + children;
|
|
1166
|
-
invariant_1(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
return subtreeCount;
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
/**
|
|
1174
|
-
* Traverses children that are typically specified as `props.children`, but
|
|
1175
|
-
* might also be specified through attributes:
|
|
1176
|
-
*
|
|
1177
|
-
* - `traverseAllChildren(this.props.children, ...)`
|
|
1178
|
-
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
1179
|
-
*
|
|
1180
|
-
* The `traverseContext` is an optional argument that is passed through the
|
|
1181
|
-
* entire traversal. It can be used to store accumulations or anything else that
|
|
1182
|
-
* the callback might find relevant.
|
|
1183
|
-
*
|
|
1184
|
-
* @param {?*} children Children tree object.
|
|
1185
|
-
* @param {!function} callback To invoke upon traversing each child.
|
|
1186
|
-
* @param {?*} traverseContext Context for traversal.
|
|
1187
|
-
* @return {!number} The number of children in this subtree.
|
|
1188
|
-
*/
|
|
1189
|
-
function traverseAllChildren(children, callback, traverseContext) {
|
|
1190
|
-
if (children == null) {
|
|
1191
|
-
return 0;
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
var traverseAllChildren_1 = traverseAllChildren;
|
|
1198
|
-
|
|
1199
|
-
var twoArgumentPooler = PooledClass_1.twoArgumentPooler;
|
|
1200
|
-
var fourArgumentPooler = PooledClass_1.fourArgumentPooler;
|
|
1201
|
-
|
|
1202
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1203
|
-
function escapeUserProvidedKey(text) {
|
|
1204
|
-
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
/**
|
|
1208
|
-
* PooledClass representing the bookkeeping associated with performing a child
|
|
1209
|
-
* traversal. Allows avoiding binding callbacks.
|
|
1210
|
-
*
|
|
1211
|
-
* @constructor ForEachBookKeeping
|
|
1212
|
-
* @param {!function} forEachFunction Function to perform traversal with.
|
|
1213
|
-
* @param {?*} forEachContext Context to perform context with.
|
|
1214
|
-
*/
|
|
1215
|
-
function ForEachBookKeeping(forEachFunction, forEachContext) {
|
|
1216
|
-
this.func = forEachFunction;
|
|
1217
|
-
this.context = forEachContext;
|
|
1218
|
-
this.count = 0;
|
|
1219
|
-
}
|
|
1220
|
-
ForEachBookKeeping.prototype.destructor = function () {
|
|
1221
|
-
this.func = null;
|
|
1222
|
-
this.context = null;
|
|
1223
|
-
this.count = 0;
|
|
1224
|
-
};
|
|
1225
|
-
PooledClass_1.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
|
|
1226
|
-
|
|
1227
|
-
function forEachSingleChild(bookKeeping, child, name) {
|
|
1228
|
-
var func = bookKeeping.func,
|
|
1229
|
-
context = bookKeeping.context;
|
|
1230
|
-
|
|
1231
|
-
func.call(context, child, bookKeeping.count++);
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
/**
|
|
1235
|
-
* Iterates through children that are typically specified as `props.children`.
|
|
1236
|
-
*
|
|
1237
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
|
|
1238
|
-
*
|
|
1239
|
-
* The provided forEachFunc(child, index) will be called for each
|
|
1240
|
-
* leaf child.
|
|
1241
|
-
*
|
|
1242
|
-
* @param {?*} children Children tree container.
|
|
1243
|
-
* @param {function(*, int)} forEachFunc
|
|
1244
|
-
* @param {*} forEachContext Context for forEachContext.
|
|
1245
|
-
*/
|
|
1246
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1247
|
-
if (children == null) {
|
|
1248
|
-
return children;
|
|
1249
|
-
}
|
|
1250
|
-
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
|
|
1251
|
-
traverseAllChildren_1(children, forEachSingleChild, traverseContext);
|
|
1252
|
-
ForEachBookKeeping.release(traverseContext);
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
/**
|
|
1256
|
-
* PooledClass representing the bookkeeping associated with performing a child
|
|
1257
|
-
* mapping. Allows avoiding binding callbacks.
|
|
1258
|
-
*
|
|
1259
|
-
* @constructor MapBookKeeping
|
|
1260
|
-
* @param {!*} mapResult Object containing the ordered map of results.
|
|
1261
|
-
* @param {!function} mapFunction Function to perform mapping with.
|
|
1262
|
-
* @param {?*} mapContext Context to perform mapping with.
|
|
1263
|
-
*/
|
|
1264
|
-
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
1265
|
-
this.result = mapResult;
|
|
1266
|
-
this.keyPrefix = keyPrefix;
|
|
1267
|
-
this.func = mapFunction;
|
|
1268
|
-
this.context = mapContext;
|
|
1269
|
-
this.count = 0;
|
|
1270
|
-
}
|
|
1271
|
-
MapBookKeeping.prototype.destructor = function () {
|
|
1272
|
-
this.result = null;
|
|
1273
|
-
this.keyPrefix = null;
|
|
1274
|
-
this.func = null;
|
|
1275
|
-
this.context = null;
|
|
1276
|
-
this.count = 0;
|
|
1277
|
-
};
|
|
1278
|
-
PooledClass_1.addPoolingTo(MapBookKeeping, fourArgumentPooler);
|
|
1279
|
-
|
|
1280
|
-
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1281
|
-
var result = bookKeeping.result,
|
|
1282
|
-
keyPrefix = bookKeeping.keyPrefix,
|
|
1283
|
-
func = bookKeeping.func,
|
|
1284
|
-
context = bookKeeping.context;
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1288
|
-
if (Array.isArray(mappedChild)) {
|
|
1289
|
-
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction_1.thatReturnsArgument);
|
|
1290
|
-
} else if (mappedChild != null) {
|
|
1291
|
-
if (ReactElement_1.isValidElement(mappedChild)) {
|
|
1292
|
-
mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
|
|
1293
|
-
// Keep both the (mapped) and old keys if they differ, just as
|
|
1294
|
-
// traverseAllChildren used to do for objects as children
|
|
1295
|
-
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1296
|
-
}
|
|
1297
|
-
result.push(mappedChild);
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1302
|
-
var escapedPrefix = '';
|
|
1303
|
-
if (prefix != null) {
|
|
1304
|
-
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1305
|
-
}
|
|
1306
|
-
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
|
|
1307
|
-
traverseAllChildren_1(children, mapSingleChildIntoContext, traverseContext);
|
|
1308
|
-
MapBookKeeping.release(traverseContext);
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
/**
|
|
1312
|
-
* Maps children that are typically specified as `props.children`.
|
|
1313
|
-
*
|
|
1314
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.map
|
|
1315
|
-
*
|
|
1316
|
-
* The provided mapFunction(child, key, index) will be called for each
|
|
1317
|
-
* leaf child.
|
|
1318
|
-
*
|
|
1319
|
-
* @param {?*} children Children tree container.
|
|
1320
|
-
* @param {function(*, int)} func The map function.
|
|
1321
|
-
* @param {*} context Context for mapFunction.
|
|
1322
|
-
* @return {object} Object containing the ordered map of results.
|
|
1323
|
-
*/
|
|
1324
|
-
function mapChildren(children, func, context) {
|
|
1325
|
-
if (children == null) {
|
|
1326
|
-
return children;
|
|
1327
|
-
}
|
|
1328
|
-
var result = [];
|
|
1329
|
-
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1330
|
-
return result;
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
function forEachSingleChildDummy(traverseContext, child, name) {
|
|
1334
|
-
return null;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
/**
|
|
1338
|
-
* Count the number of children that are typically specified as
|
|
1339
|
-
* `props.children`.
|
|
1340
|
-
*
|
|
1341
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.count
|
|
1342
|
-
*
|
|
1343
|
-
* @param {?*} children Children tree container.
|
|
1344
|
-
* @return {number} The number of children.
|
|
1345
|
-
*/
|
|
1346
|
-
function countChildren(children, context) {
|
|
1347
|
-
return traverseAllChildren_1(children, forEachSingleChildDummy, null);
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
/**
|
|
1351
|
-
* Flatten a children object (typically specified as `props.children`) and
|
|
1352
|
-
* return an array with appropriately re-keyed children.
|
|
1353
|
-
*
|
|
1354
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
|
|
1355
|
-
*/
|
|
1356
|
-
function toArray(children) {
|
|
1357
|
-
var result = [];
|
|
1358
|
-
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction_1.thatReturnsArgument);
|
|
1359
|
-
return result;
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
var ReactChildren = {
|
|
1363
|
-
forEach: forEachChildren,
|
|
1364
|
-
map: mapChildren,
|
|
1365
|
-
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
|
1366
|
-
count: countChildren,
|
|
1367
|
-
toArray: toArray
|
|
1368
|
-
};
|
|
1369
|
-
|
|
1370
|
-
var ReactChildren_1 = ReactChildren;
|
|
1371
|
-
|
|
1372
|
-
/**
|
|
1373
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1374
|
-
* All rights reserved.
|
|
1375
|
-
*
|
|
1376
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1377
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1378
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1379
|
-
*
|
|
1380
|
-
* @providesModule getComponentName
|
|
1381
|
-
*
|
|
1382
|
-
*/
|
|
1383
|
-
|
|
1384
|
-
function getComponentName(instanceOrFiber) {
|
|
1385
|
-
if (typeof instanceOrFiber.getName === 'function') {
|
|
1386
|
-
// Stack reconciler
|
|
1387
|
-
var instance = instanceOrFiber;
|
|
1388
|
-
return instance.getName();
|
|
1389
|
-
}
|
|
1390
|
-
if (typeof instanceOrFiber.tag === 'number') {
|
|
1391
|
-
// Fiber reconciler
|
|
1392
|
-
var fiber = instanceOrFiber;
|
|
1393
|
-
var type = fiber.type;
|
|
1394
|
-
|
|
1395
|
-
if (typeof type === 'string') {
|
|
1396
|
-
return type;
|
|
1397
|
-
}
|
|
1398
|
-
if (typeof type === 'function') {
|
|
1399
|
-
return type.displayName || type.name;
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
return null;
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
var getComponentName_1 = getComponentName;
|
|
1406
|
-
|
|
1407
|
-
/**
|
|
1408
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1409
|
-
* All rights reserved.
|
|
1410
|
-
*
|
|
1411
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1412
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1413
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1414
|
-
*/
|
|
1415
|
-
|
|
1416
|
-
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1417
|
-
|
|
1418
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
1419
|
-
|
|
1420
|
-
var loggedTypeFailures = {};
|
|
1421
|
-
|
|
1422
|
-
/**
|
|
1423
|
-
* Assert that the values match with the type specs.
|
|
1424
|
-
* Error messages are memorized and will only be shown once.
|
|
1425
|
-
*
|
|
1426
|
-
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
1427
|
-
* @param {object} values Runtime values that need to be type-checked
|
|
1428
|
-
* @param {string} location e.g. "prop", "context", "child context"
|
|
1429
|
-
* @param {string} componentName Name of the component for error messages.
|
|
1430
|
-
* @param {?Function} getStack Returns the component stack.
|
|
1431
|
-
* @private
|
|
1432
|
-
*/
|
|
1433
|
-
function checkPropTypes$3(typeSpecs, values, location, componentName, getStack) {
|
|
1434
|
-
{
|
|
1435
|
-
for (var typeSpecName in typeSpecs) {
|
|
1436
|
-
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
|
1437
|
-
var error;
|
|
1438
|
-
// Prop type validation may throw. In case they do, we don't want to
|
|
1439
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
1440
|
-
// After these have been cleaned up, we'll let them throw.
|
|
1441
|
-
try {
|
|
1442
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
1443
|
-
// behavior as without this statement except with a better message.
|
|
1444
|
-
invariant_1(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
|
|
1445
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret_1);
|
|
1446
|
-
} catch (ex) {
|
|
1447
|
-
error = ex;
|
|
1448
|
-
}
|
|
1449
|
-
warning_1(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
|
|
1450
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1451
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
1452
|
-
// same error.
|
|
1453
|
-
loggedTypeFailures[error.message] = true;
|
|
1454
|
-
|
|
1455
|
-
var stack = getStack ? getStack() : '';
|
|
1456
|
-
|
|
1457
|
-
warning_1(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
var checkPropTypes_1 = checkPropTypes$3;
|
|
1465
|
-
|
|
1466
|
-
var checkPropTypes$1 = checkPropTypes_1;
|
|
1467
|
-
|
|
1468
|
-
/**
|
|
1469
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1470
|
-
* All rights reserved.
|
|
1471
|
-
*
|
|
1472
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1473
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1474
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1475
|
-
*
|
|
1476
|
-
* @providesModule ReactTypeOfWork
|
|
1477
|
-
*
|
|
1478
|
-
*/
|
|
1479
|
-
|
|
1480
|
-
var ReactTypeOfWork = {
|
|
1481
|
-
IndeterminateComponent: 0, // Before we know whether it is functional or class
|
|
1482
|
-
FunctionalComponent: 1,
|
|
1483
|
-
ClassComponent: 2,
|
|
1484
|
-
HostRoot: 3, // Root of a host tree. Could be nested inside another node.
|
|
1485
|
-
HostPortal: 4, // A subtree. Could be an entry point to a different renderer.
|
|
1486
|
-
HostComponent: 5,
|
|
1487
|
-
HostText: 6,
|
|
1488
|
-
CoroutineComponent: 7,
|
|
1489
|
-
CoroutineHandlerPhase: 8,
|
|
1490
|
-
YieldComponent: 9,
|
|
1491
|
-
Fragment: 10
|
|
1492
|
-
};
|
|
1493
|
-
|
|
1494
|
-
var IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent;
|
|
1495
|
-
var FunctionalComponent = ReactTypeOfWork.FunctionalComponent;
|
|
1496
|
-
var ClassComponent = ReactTypeOfWork.ClassComponent;
|
|
1497
|
-
var HostComponent = ReactTypeOfWork.HostComponent;
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
function describeComponentFrame$1(name, source, ownerName) {
|
|
1502
|
-
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
function describeFiber(fiber) {
|
|
1506
|
-
switch (fiber.tag) {
|
|
1507
|
-
case IndeterminateComponent:
|
|
1508
|
-
case FunctionalComponent:
|
|
1509
|
-
case ClassComponent:
|
|
1510
|
-
case HostComponent:
|
|
1511
|
-
var owner = fiber._debugOwner;
|
|
1512
|
-
var source = fiber._debugSource;
|
|
1513
|
-
var name = getComponentName_1(fiber);
|
|
1514
|
-
var ownerName = null;
|
|
1515
|
-
if (owner) {
|
|
1516
|
-
ownerName = getComponentName_1(owner);
|
|
1517
|
-
}
|
|
1518
|
-
return describeComponentFrame$1(name, source, ownerName);
|
|
1519
|
-
default:
|
|
1520
|
-
return '';
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
// This function can only be called with a work-in-progress fiber and
|
|
1525
|
-
// only during begin or complete phase. Do not call it under any other
|
|
1526
|
-
// circumstances.
|
|
1527
|
-
function getStackAddendumByWorkInProgressFiber$2(workInProgress) {
|
|
1528
|
-
var info = '';
|
|
1529
|
-
var node = workInProgress;
|
|
1530
|
-
do {
|
|
1531
|
-
info += describeFiber(node);
|
|
1532
|
-
// Otherwise this return pointer might point to the wrong tree:
|
|
1533
|
-
node = node['return'];
|
|
1534
|
-
} while (node);
|
|
1535
|
-
return info;
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
var ReactFiberComponentTreeHook = {
|
|
1539
|
-
getStackAddendumByWorkInProgressFiber: getStackAddendumByWorkInProgressFiber$2,
|
|
1540
|
-
describeComponentFrame: describeComponentFrame$1
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1543
|
-
var getStackAddendumByWorkInProgressFiber$1 = ReactFiberComponentTreeHook.getStackAddendumByWorkInProgressFiber;
|
|
1544
|
-
var describeComponentFrame = ReactFiberComponentTreeHook.describeComponentFrame;
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
function isNative(fn) {
|
|
1551
|
-
// Based on isNative() from Lodash
|
|
1552
|
-
var funcToString = Function.prototype.toString;
|
|
1553
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1554
|
-
var reIsNative = RegExp('^' + funcToString
|
|
1555
|
-
// Take an example native function source for comparison
|
|
1556
|
-
.call(hasOwnProperty)
|
|
1557
|
-
// Strip regex characters so we can use it for regex
|
|
1558
|
-
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
|
1559
|
-
// Remove hasOwnProperty from the template to make it generic
|
|
1560
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
1561
|
-
try {
|
|
1562
|
-
var source = funcToString.call(fn);
|
|
1563
|
-
return reIsNative.test(source);
|
|
1564
|
-
} catch (err) {
|
|
1565
|
-
return false;
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
var canUseCollections =
|
|
1570
|
-
// Array.from
|
|
1571
|
-
typeof Array.from === 'function' &&
|
|
1572
|
-
// Map
|
|
1573
|
-
typeof Map === 'function' && isNative(Map) &&
|
|
1574
|
-
// Map.prototype.keys
|
|
1575
|
-
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
|
|
1576
|
-
// Set
|
|
1577
|
-
typeof Set === 'function' && isNative(Set) &&
|
|
1578
|
-
// Set.prototype.keys
|
|
1579
|
-
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
|
|
1580
|
-
|
|
1581
|
-
var setItem;
|
|
1582
|
-
var getItem;
|
|
1583
|
-
var removeItem;
|
|
1584
|
-
var getItemIDs;
|
|
1585
|
-
var addRoot;
|
|
1586
|
-
var removeRoot;
|
|
1587
|
-
var getRootIDs;
|
|
1588
|
-
|
|
1589
|
-
if (canUseCollections) {
|
|
1590
|
-
var itemMap = new Map();
|
|
1591
|
-
var rootIDSet = new Set();
|
|
1592
|
-
|
|
1593
|
-
setItem = function (id, item) {
|
|
1594
|
-
itemMap.set(id, item);
|
|
1595
|
-
};
|
|
1596
|
-
getItem = function (id) {
|
|
1597
|
-
return itemMap.get(id);
|
|
1598
|
-
};
|
|
1599
|
-
removeItem = function (id) {
|
|
1600
|
-
itemMap['delete'](id);
|
|
1601
|
-
};
|
|
1602
|
-
getItemIDs = function () {
|
|
1603
|
-
return Array.from(itemMap.keys());
|
|
1604
|
-
};
|
|
1605
|
-
|
|
1606
|
-
addRoot = function (id) {
|
|
1607
|
-
rootIDSet.add(id);
|
|
1608
|
-
};
|
|
1609
|
-
removeRoot = function (id) {
|
|
1610
|
-
rootIDSet['delete'](id);
|
|
1611
|
-
};
|
|
1612
|
-
getRootIDs = function () {
|
|
1613
|
-
return Array.from(rootIDSet.keys());
|
|
1614
|
-
};
|
|
1615
|
-
} else {
|
|
1616
|
-
var itemByKey = {};
|
|
1617
|
-
var rootByKey = {};
|
|
1618
|
-
|
|
1619
|
-
// Use non-numeric keys to prevent V8 performance issues:
|
|
1620
|
-
// https://github.com/facebook/react/pull/7232
|
|
1621
|
-
var getKeyFromID = function (id) {
|
|
1622
|
-
return '.' + id;
|
|
1623
|
-
};
|
|
1624
|
-
var getIDFromKey = function (key) {
|
|
1625
|
-
return parseInt(key.substr(1), 10);
|
|
1626
|
-
};
|
|
1627
|
-
|
|
1628
|
-
setItem = function (id, item) {
|
|
1629
|
-
var key = getKeyFromID(id);
|
|
1630
|
-
itemByKey[key] = item;
|
|
1631
|
-
};
|
|
1632
|
-
getItem = function (id) {
|
|
1633
|
-
var key = getKeyFromID(id);
|
|
1634
|
-
return itemByKey[key];
|
|
1635
|
-
};
|
|
1636
|
-
removeItem = function (id) {
|
|
1637
|
-
var key = getKeyFromID(id);
|
|
1638
|
-
delete itemByKey[key];
|
|
1639
|
-
};
|
|
1640
|
-
getItemIDs = function () {
|
|
1641
|
-
return Object.keys(itemByKey).map(getIDFromKey);
|
|
1642
|
-
};
|
|
1643
|
-
|
|
1644
|
-
addRoot = function (id) {
|
|
1645
|
-
var key = getKeyFromID(id);
|
|
1646
|
-
rootByKey[key] = true;
|
|
1647
|
-
};
|
|
1648
|
-
removeRoot = function (id) {
|
|
1649
|
-
var key = getKeyFromID(id);
|
|
1650
|
-
delete rootByKey[key];
|
|
1651
|
-
};
|
|
1652
|
-
getRootIDs = function () {
|
|
1653
|
-
return Object.keys(rootByKey).map(getIDFromKey);
|
|
1654
|
-
};
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
var unmountedIDs = [];
|
|
1658
|
-
|
|
1659
|
-
function purgeDeep(id) {
|
|
1660
|
-
var item = getItem(id);
|
|
1661
|
-
if (item) {
|
|
1662
|
-
var childIDs = item.childIDs;
|
|
1663
|
-
|
|
1664
|
-
removeItem(id);
|
|
1665
|
-
childIDs.forEach(purgeDeep);
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
function getDisplayName(element) {
|
|
1670
|
-
if (element == null) {
|
|
1671
|
-
return '#empty';
|
|
1672
|
-
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1673
|
-
return '#text';
|
|
1674
|
-
} else if (typeof element.type === 'string') {
|
|
1675
|
-
return element.type;
|
|
1676
|
-
} else {
|
|
1677
|
-
return element.type.displayName || element.type.name || 'Unknown';
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
function describeID(id) {
|
|
1682
|
-
var name = ReactComponentTreeHook.getDisplayName(id);
|
|
1683
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1684
|
-
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
|
1685
|
-
var ownerName = void 0;
|
|
1686
|
-
|
|
1687
|
-
if (ownerID) {
|
|
1688
|
-
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
|
|
1689
|
-
}
|
|
1690
|
-
warning_1(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
|
|
1691
|
-
return describeComponentFrame(name || '', element && element._source, ownerName || '');
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
var ReactComponentTreeHook = {
|
|
1695
|
-
onSetChildren: function (id, nextChildIDs) {
|
|
1696
|
-
var item = getItem(id);
|
|
1697
|
-
invariant_1(item, 'Item must have been set');
|
|
1698
|
-
item.childIDs = nextChildIDs;
|
|
1699
|
-
|
|
1700
|
-
for (var i = 0; i < nextChildIDs.length; i++) {
|
|
1701
|
-
var nextChildID = nextChildIDs[i];
|
|
1702
|
-
var nextChild = getItem(nextChildID);
|
|
1703
|
-
!nextChild ? invariant_1(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1704
|
-
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? invariant_1(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : void 0;
|
|
1705
|
-
!nextChild.isMounted ? invariant_1(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1706
|
-
if (nextChild.parentID == null) {
|
|
1707
|
-
nextChild.parentID = id;
|
|
1708
|
-
// TODO: This shouldn't be necessary but mounting a new root during in
|
|
1709
|
-
// componentWillMount currently causes not-yet-mounted components to
|
|
1710
|
-
// be purged from our tree data so their parent id is missing.
|
|
1711
|
-
}
|
|
1712
|
-
!(nextChild.parentID === id) ? invariant_1(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : void 0;
|
|
1713
|
-
}
|
|
1714
|
-
},
|
|
1715
|
-
onBeforeMountComponent: function (id, element, parentID) {
|
|
1716
|
-
var item = {
|
|
1717
|
-
element: element,
|
|
1718
|
-
parentID: parentID,
|
|
1719
|
-
text: null,
|
|
1720
|
-
childIDs: [],
|
|
1721
|
-
isMounted: false,
|
|
1722
|
-
updateCount: 0
|
|
1723
|
-
};
|
|
1724
|
-
setItem(id, item);
|
|
1725
|
-
},
|
|
1726
|
-
onBeforeUpdateComponent: function (id, element) {
|
|
1727
|
-
var item = getItem(id);
|
|
1728
|
-
if (!item || !item.isMounted) {
|
|
1729
|
-
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1730
|
-
// In this case, ignore the element.
|
|
1731
|
-
return;
|
|
1732
|
-
}
|
|
1733
|
-
item.element = element;
|
|
1734
|
-
},
|
|
1735
|
-
onMountComponent: function (id) {
|
|
1736
|
-
var item = getItem(id);
|
|
1737
|
-
invariant_1(item, 'Item must have been set');
|
|
1738
|
-
item.isMounted = true;
|
|
1739
|
-
var isRoot = item.parentID === 0;
|
|
1740
|
-
if (isRoot) {
|
|
1741
|
-
addRoot(id);
|
|
1742
|
-
}
|
|
1743
|
-
},
|
|
1744
|
-
onUpdateComponent: function (id) {
|
|
1745
|
-
var item = getItem(id);
|
|
1746
|
-
if (!item || !item.isMounted) {
|
|
1747
|
-
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1748
|
-
// In this case, ignore the element.
|
|
1749
|
-
return;
|
|
1750
|
-
}
|
|
1751
|
-
item.updateCount++;
|
|
1752
|
-
},
|
|
1753
|
-
onUnmountComponent: function (id) {
|
|
1754
|
-
var item = getItem(id);
|
|
1755
|
-
if (item) {
|
|
1756
|
-
// We need to check if it exists.
|
|
1757
|
-
// `item` might not exist if it is inside an error boundary, and a sibling
|
|
1758
|
-
// error boundary child threw while mounting. Then this instance never
|
|
1759
|
-
// got a chance to mount, but it still gets an unmounting event during
|
|
1760
|
-
// the error boundary cleanup.
|
|
1761
|
-
item.isMounted = false;
|
|
1762
|
-
var isRoot = item.parentID === 0;
|
|
1763
|
-
if (isRoot) {
|
|
1764
|
-
removeRoot(id);
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
unmountedIDs.push(id);
|
|
1768
|
-
},
|
|
1769
|
-
purgeUnmountedComponents: function () {
|
|
1770
|
-
if (ReactComponentTreeHook._preventPurging) {
|
|
1771
|
-
// Should only be used for testing.
|
|
1772
|
-
return;
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
for (var i = 0; i < unmountedIDs.length; i++) {
|
|
1776
|
-
var id = unmountedIDs[i];
|
|
1777
|
-
purgeDeep(id);
|
|
1778
|
-
}
|
|
1779
|
-
unmountedIDs.length = 0;
|
|
1780
|
-
},
|
|
1781
|
-
isMounted: function (id) {
|
|
1782
|
-
var item = getItem(id);
|
|
1783
|
-
return item ? item.isMounted : false;
|
|
1784
|
-
},
|
|
1785
|
-
getCurrentStackAddendum: function (topElement) {
|
|
1786
|
-
var info = '';
|
|
1787
|
-
if (topElement) {
|
|
1788
|
-
var name = getDisplayName(topElement);
|
|
1789
|
-
var owner = topElement._owner;
|
|
1790
|
-
info += describeComponentFrame(name, topElement._source, owner && getComponentName_1(owner));
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
var currentOwner = ReactCurrentOwner_1.current;
|
|
1794
|
-
if (currentOwner) {
|
|
1795
|
-
if (typeof currentOwner.tag === 'number') {
|
|
1796
|
-
var workInProgress = currentOwner;
|
|
1797
|
-
// Safe because if current owner exists, we are reconciling,
|
|
1798
|
-
// and it is guaranteed to be the work-in-progress version.
|
|
1799
|
-
info += getStackAddendumByWorkInProgressFiber$1(workInProgress);
|
|
1800
|
-
} else if (typeof currentOwner._debugID === 'number') {
|
|
1801
|
-
info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
return info;
|
|
1805
|
-
},
|
|
1806
|
-
getStackAddendumByID: function (id) {
|
|
1807
|
-
var info = '';
|
|
1808
|
-
while (id) {
|
|
1809
|
-
info += describeID(id);
|
|
1810
|
-
id = ReactComponentTreeHook.getParentID(id);
|
|
1811
|
-
}
|
|
1812
|
-
return info;
|
|
1813
|
-
},
|
|
1814
|
-
getChildIDs: function (id) {
|
|
1815
|
-
var item = getItem(id);
|
|
1816
|
-
return item ? item.childIDs : [];
|
|
1817
|
-
},
|
|
1818
|
-
getDisplayName: function (id) {
|
|
1819
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1820
|
-
if (!element) {
|
|
1821
|
-
return null;
|
|
1822
|
-
}
|
|
1823
|
-
return getDisplayName(element);
|
|
1824
|
-
},
|
|
1825
|
-
getElement: function (id) {
|
|
1826
|
-
var item = getItem(id);
|
|
1827
|
-
return item ? item.element : null;
|
|
1828
|
-
},
|
|
1829
|
-
getOwnerID: function (id) {
|
|
1830
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1831
|
-
if (!element || !element._owner) {
|
|
1832
|
-
return null;
|
|
1833
|
-
}
|
|
1834
|
-
return element._owner._debugID;
|
|
1835
|
-
},
|
|
1836
|
-
getParentID: function (id) {
|
|
1837
|
-
var item = getItem(id);
|
|
1838
|
-
return item ? item.parentID : null;
|
|
1839
|
-
},
|
|
1840
|
-
getSource: function (id) {
|
|
1841
|
-
var item = getItem(id);
|
|
1842
|
-
var element = item ? item.element : null;
|
|
1843
|
-
var source = element != null ? element._source : null;
|
|
1844
|
-
return source;
|
|
1845
|
-
},
|
|
1846
|
-
getText: function (id) {
|
|
1847
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1848
|
-
if (typeof element === 'string') {
|
|
1849
|
-
return element;
|
|
1850
|
-
} else if (typeof element === 'number') {
|
|
1851
|
-
return '' + element;
|
|
1852
|
-
} else {
|
|
1853
|
-
return null;
|
|
1854
|
-
}
|
|
1855
|
-
},
|
|
1856
|
-
getUpdateCount: function (id) {
|
|
1857
|
-
var item = getItem(id);
|
|
1858
|
-
return item ? item.updateCount : 0;
|
|
1859
|
-
},
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
getRootIDs: getRootIDs,
|
|
1863
|
-
getRegisteredIDs: getItemIDs
|
|
1864
|
-
};
|
|
1865
|
-
|
|
1866
|
-
var ReactComponentTreeHook_1 = ReactComponentTreeHook;
|
|
1867
|
-
|
|
1868
|
-
var ReactDebugCurrentFrame$1 = {};
|
|
1869
|
-
|
|
1870
|
-
{
|
|
1871
|
-
var _require$1 = ReactComponentTreeHook_1,
|
|
1872
|
-
getStackAddendumByID = _require$1.getStackAddendumByID,
|
|
1873
|
-
getCurrentStackAddendum$1 = _require$1.getCurrentStackAddendum;
|
|
1874
|
-
|
|
1875
|
-
var _require2$1 = ReactFiberComponentTreeHook,
|
|
1876
|
-
getStackAddendumByWorkInProgressFiber = _require2$1.getStackAddendumByWorkInProgressFiber;
|
|
1877
|
-
|
|
1878
|
-
// Component that is being worked on
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
ReactDebugCurrentFrame$1.current = null;
|
|
1119
|
+
var setItem;
|
|
1120
|
+
var getItem;
|
|
1121
|
+
var removeItem;
|
|
1122
|
+
var getItemIDs;
|
|
1123
|
+
var addRoot;
|
|
1124
|
+
var removeRoot;
|
|
1125
|
+
var getRootIDs;
|
|
1882
1126
|
|
|
1883
|
-
|
|
1884
|
-
|
|
1127
|
+
if (canUseCollections) {
|
|
1128
|
+
var itemMap = new Map();
|
|
1129
|
+
var rootIDSet = new Set();
|
|
1885
1130
|
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
// The stack will only be correct if this is a work in progress
|
|
1898
|
-
// version and we're calling it during reconciliation.
|
|
1899
|
-
var workInProgress = current;
|
|
1900
|
-
stack = getStackAddendumByWorkInProgressFiber(workInProgress);
|
|
1901
|
-
}
|
|
1902
|
-
} else if (element !== null) {
|
|
1903
|
-
stack = getCurrentStackAddendum$1(element);
|
|
1904
|
-
}
|
|
1905
|
-
return stack;
|
|
1131
|
+
setItem = function (id, item) {
|
|
1132
|
+
itemMap.set(id, item);
|
|
1133
|
+
};
|
|
1134
|
+
getItem = function (id) {
|
|
1135
|
+
return itemMap.get(id);
|
|
1136
|
+
};
|
|
1137
|
+
removeItem = function (id) {
|
|
1138
|
+
itemMap['delete'](id);
|
|
1139
|
+
};
|
|
1140
|
+
getItemIDs = function () {
|
|
1141
|
+
return Array.from(itemMap.keys());
|
|
1906
1142
|
};
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame$1;
|
|
1910
|
-
|
|
1911
|
-
{
|
|
1912
|
-
var checkPropTypes = checkPropTypes$1;
|
|
1913
|
-
var warning$2 = warning_1;
|
|
1914
|
-
var ReactDebugCurrentFrame = ReactDebugCurrentFrame_1;
|
|
1915
|
-
|
|
1916
|
-
var _require = ReactComponentTreeHook_1,
|
|
1917
|
-
getCurrentStackAddendum = _require.getCurrentStackAddendum;
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
function getDeclarationErrorAddendum() {
|
|
1921
|
-
if (ReactCurrentOwner_1.current) {
|
|
1922
|
-
var name = getComponentName_1(ReactCurrentOwner_1.current);
|
|
1923
|
-
if (name) {
|
|
1924
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
return '';
|
|
1928
|
-
}
|
|
1929
1143
|
|
|
1930
|
-
function
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
}
|
|
1144
|
+
addRoot = function (id) {
|
|
1145
|
+
rootIDSet.add(id);
|
|
1146
|
+
};
|
|
1147
|
+
removeRoot = function (id) {
|
|
1148
|
+
rootIDSet['delete'](id);
|
|
1149
|
+
};
|
|
1150
|
+
getRootIDs = function () {
|
|
1151
|
+
return Array.from(rootIDSet.keys());
|
|
1152
|
+
};
|
|
1153
|
+
} else {
|
|
1154
|
+
var itemByKey = {};
|
|
1155
|
+
var rootByKey = {};
|
|
1939
1156
|
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
var
|
|
1157
|
+
// Use non-numeric keys to prevent V8 performance issues:
|
|
1158
|
+
// https://github.com/facebook/react/pull/7232
|
|
1159
|
+
var getKeyFromID = function (id) {
|
|
1160
|
+
return '.' + id;
|
|
1161
|
+
};
|
|
1162
|
+
var getIDFromKey = function (key) {
|
|
1163
|
+
return parseInt(key.substr(1), 10);
|
|
1164
|
+
};
|
|
1946
1165
|
|
|
1947
|
-
function
|
|
1948
|
-
|
|
1166
|
+
setItem = function (id, item) {
|
|
1167
|
+
var key = getKeyFromID(id);
|
|
1168
|
+
itemByKey[key] = item;
|
|
1169
|
+
};
|
|
1170
|
+
getItem = function (id) {
|
|
1171
|
+
var key = getKeyFromID(id);
|
|
1172
|
+
return itemByKey[key];
|
|
1173
|
+
};
|
|
1174
|
+
removeItem = function (id) {
|
|
1175
|
+
var key = getKeyFromID(id);
|
|
1176
|
+
delete itemByKey[key];
|
|
1177
|
+
};
|
|
1178
|
+
getItemIDs = function () {
|
|
1179
|
+
return Object.keys(itemByKey).map(getIDFromKey);
|
|
1180
|
+
};
|
|
1949
1181
|
|
|
1950
|
-
|
|
1951
|
-
var
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1182
|
+
addRoot = function (id) {
|
|
1183
|
+
var key = getKeyFromID(id);
|
|
1184
|
+
rootByKey[key] = true;
|
|
1185
|
+
};
|
|
1186
|
+
removeRoot = function (id) {
|
|
1187
|
+
var key = getKeyFromID(id);
|
|
1188
|
+
delete rootByKey[key];
|
|
1189
|
+
};
|
|
1190
|
+
getRootIDs = function () {
|
|
1191
|
+
return Object.keys(rootByKey).map(getIDFromKey);
|
|
1192
|
+
};
|
|
1957
1193
|
}
|
|
1958
1194
|
|
|
1959
|
-
|
|
1960
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1961
|
-
* This element is in an array. The array could grow and shrink or be
|
|
1962
|
-
* reordered. All children that haven't already been validated are required to
|
|
1963
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1964
|
-
* will only be shown once.
|
|
1965
|
-
*
|
|
1966
|
-
* @internal
|
|
1967
|
-
* @param {ReactElement} element Element that requires a key.
|
|
1968
|
-
* @param {*} parentType element's parent's type.
|
|
1969
|
-
*/
|
|
1970
|
-
function validateExplicitKey(element, parentType) {
|
|
1971
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
1972
|
-
return;
|
|
1973
|
-
}
|
|
1974
|
-
element._store.validated = true;
|
|
1975
|
-
|
|
1976
|
-
var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {});
|
|
1977
|
-
|
|
1978
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1979
|
-
if (memoizer[currentComponentErrorInfo]) {
|
|
1980
|
-
return;
|
|
1981
|
-
}
|
|
1982
|
-
memoizer[currentComponentErrorInfo] = true;
|
|
1983
|
-
|
|
1984
|
-
// Usually the current owner is the offender, but if it accepts children as a
|
|
1985
|
-
// property, it may be the creator of the child that's responsible for
|
|
1986
|
-
// assigning it a key.
|
|
1987
|
-
var childOwner = '';
|
|
1988
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner_1.current) {
|
|
1989
|
-
// Give the component that originally created this child.
|
|
1990
|
-
childOwner = ' It was passed a child from ' + getComponentName_1(element._owner) + '.';
|
|
1991
|
-
}
|
|
1195
|
+
var unmountedIDs = [];
|
|
1992
1196
|
|
|
1993
|
-
|
|
1994
|
-
|
|
1197
|
+
function purgeDeep(id) {
|
|
1198
|
+
var item = getItem(id);
|
|
1199
|
+
if (item) {
|
|
1200
|
+
var childIDs = item.childIDs;
|
|
1995
1201
|
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
* array with an explicit keys property defined, or in an object literal
|
|
1999
|
-
* with valid key property.
|
|
2000
|
-
*
|
|
2001
|
-
* @internal
|
|
2002
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
2003
|
-
* @param {*} parentType node's parent's type.
|
|
2004
|
-
*/
|
|
2005
|
-
function validateChildKeys(node, parentType) {
|
|
2006
|
-
if (typeof node !== 'object') {
|
|
2007
|
-
return;
|
|
2008
|
-
}
|
|
2009
|
-
if (Array.isArray(node)) {
|
|
2010
|
-
for (var i = 0; i < node.length; i++) {
|
|
2011
|
-
var child = node[i];
|
|
2012
|
-
if (ReactElement_1.isValidElement(child)) {
|
|
2013
|
-
validateExplicitKey(child, parentType);
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
} else if (ReactElement_1.isValidElement(node)) {
|
|
2017
|
-
// This element was passed in a valid location.
|
|
2018
|
-
if (node._store) {
|
|
2019
|
-
node._store.validated = true;
|
|
2020
|
-
}
|
|
2021
|
-
} else if (node) {
|
|
2022
|
-
var iteratorFn = getIteratorFn_1(node);
|
|
2023
|
-
// Entry iterators provide implicit keys.
|
|
2024
|
-
if (iteratorFn) {
|
|
2025
|
-
if (iteratorFn !== node.entries) {
|
|
2026
|
-
var iterator = iteratorFn.call(node);
|
|
2027
|
-
var step;
|
|
2028
|
-
while (!(step = iterator.next()).done) {
|
|
2029
|
-
if (ReactElement_1.isValidElement(step.value)) {
|
|
2030
|
-
validateExplicitKey(step.value, parentType);
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
1202
|
+
removeItem(id);
|
|
1203
|
+
childIDs.forEach(purgeDeep);
|
|
2035
1204
|
}
|
|
2036
1205
|
}
|
|
2037
1206
|
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
return;
|
|
1207
|
+
function getDisplayName(element) {
|
|
1208
|
+
if (element == null) {
|
|
1209
|
+
return '#empty';
|
|
1210
|
+
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1211
|
+
return '#text';
|
|
1212
|
+
} else if (typeof element.type === 'string') {
|
|
1213
|
+
return element.type;
|
|
1214
|
+
} else {
|
|
1215
|
+
return element.type.displayName || element.type.name || 'Unknown';
|
|
2048
1216
|
}
|
|
2049
|
-
|
|
1217
|
+
}
|
|
2050
1218
|
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
var propTypes = typeof componentClass.__propTypesSecretDontUseThesePlease === 'object' ? componentClass.__propTypesSecretDontUseThesePlease : componentClass.propTypes;
|
|
1219
|
+
function describeID(id) {
|
|
1220
|
+
var name = ReactComponentTreeHook.getDisplayName(id);
|
|
1221
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1222
|
+
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
|
1223
|
+
var ownerName = void 0;
|
|
2057
1224
|
|
|
2058
|
-
if (
|
|
2059
|
-
|
|
2060
|
-
}
|
|
2061
|
-
if (typeof componentClass.getDefaultProps === 'function') {
|
|
2062
|
-
warning$2(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1225
|
+
if (ownerID) {
|
|
1226
|
+
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
|
|
2063
1227
|
}
|
|
1228
|
+
warning_1(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
|
|
1229
|
+
return describeComponentFrame(name || '', element && element._source, ownerName || '');
|
|
2064
1230
|
}
|
|
2065
1231
|
|
|
2066
|
-
var
|
|
2067
|
-
|
|
2068
|
-
var
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
if (!validType) {
|
|
2072
|
-
var info = '';
|
|
2073
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2074
|
-
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
|
|
2075
|
-
}
|
|
1232
|
+
var ReactComponentTreeHook = {
|
|
1233
|
+
onSetChildren: function (id, nextChildIDs) {
|
|
1234
|
+
var item = getItem(id);
|
|
1235
|
+
invariant_1(item, 'Item must have been set');
|
|
1236
|
+
item.childIDs = nextChildIDs;
|
|
2076
1237
|
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
1238
|
+
for (var i = 0; i < nextChildIDs.length; i++) {
|
|
1239
|
+
var nextChildID = nextChildIDs[i];
|
|
1240
|
+
var nextChild = getItem(nextChildID);
|
|
1241
|
+
!nextChild ? invariant_1(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1242
|
+
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? invariant_1(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : void 0;
|
|
1243
|
+
!nextChild.isMounted ? invariant_1(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1244
|
+
if (nextChild.parentID == null) {
|
|
1245
|
+
nextChild.parentID = id;
|
|
1246
|
+
// TODO: This shouldn't be necessary but mounting a new root during in
|
|
1247
|
+
// componentWillMount currently causes not-yet-mounted components to
|
|
1248
|
+
// be purged from our tree data so their parent id is missing.
|
|
2082
1249
|
}
|
|
2083
|
-
|
|
2084
|
-
info += getCurrentStackAddendum();
|
|
2085
|
-
|
|
2086
|
-
warning$2(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info);
|
|
1250
|
+
!(nextChild.parentID === id) ? invariant_1(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : void 0;
|
|
2087
1251
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
1252
|
+
},
|
|
1253
|
+
onBeforeMountComponent: function (id, element, parentID) {
|
|
1254
|
+
var item = {
|
|
1255
|
+
element: element,
|
|
1256
|
+
parentID: parentID,
|
|
1257
|
+
text: null,
|
|
1258
|
+
childIDs: [],
|
|
1259
|
+
isMounted: false,
|
|
1260
|
+
updateCount: 0
|
|
1261
|
+
};
|
|
1262
|
+
setItem(id, item);
|
|
1263
|
+
},
|
|
1264
|
+
onBeforeUpdateComponent: function (id, element) {
|
|
1265
|
+
var item = getItem(id);
|
|
1266
|
+
if (!item || !item.isMounted) {
|
|
1267
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1268
|
+
// In this case, ignore the element.
|
|
1269
|
+
return;
|
|
2095
1270
|
}
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
1271
|
+
item.element = element;
|
|
1272
|
+
},
|
|
1273
|
+
onMountComponent: function (id) {
|
|
1274
|
+
var item = getItem(id);
|
|
1275
|
+
invariant_1(item, 'Item must have been set');
|
|
1276
|
+
item.isMounted = true;
|
|
1277
|
+
var isRoot = item.parentID === 0;
|
|
1278
|
+
if (isRoot) {
|
|
1279
|
+
addRoot(id);
|
|
2099
1280
|
}
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
1281
|
+
},
|
|
1282
|
+
onUpdateComponent: function (id) {
|
|
1283
|
+
var item = getItem(id);
|
|
1284
|
+
if (!item || !item.isMounted) {
|
|
1285
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1286
|
+
// In this case, ignore the element.
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
item.updateCount++;
|
|
1290
|
+
},
|
|
1291
|
+
onUnmountComponent: function (id) {
|
|
1292
|
+
var item = getItem(id);
|
|
1293
|
+
if (item) {
|
|
1294
|
+
// We need to check if it exists.
|
|
1295
|
+
// `item` might not exist if it is inside an error boundary, and a sibling
|
|
1296
|
+
// error boundary child threw while mounting. Then this instance never
|
|
1297
|
+
// got a chance to mount, but it still gets an unmounting event during
|
|
1298
|
+
// the error boundary cleanup.
|
|
1299
|
+
item.isMounted = false;
|
|
1300
|
+
var isRoot = item.parentID === 0;
|
|
1301
|
+
if (isRoot) {
|
|
1302
|
+
removeRoot(id);
|
|
2109
1303
|
}
|
|
2110
1304
|
}
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
{
|
|
2115
|
-
|
|
1305
|
+
unmountedIDs.push(id);
|
|
1306
|
+
},
|
|
1307
|
+
purgeUnmountedComponents: function () {
|
|
1308
|
+
if (ReactComponentTreeHook._preventPurging) {
|
|
1309
|
+
// Should only be used for testing.
|
|
1310
|
+
return;
|
|
2116
1311
|
}
|
|
2117
1312
|
|
|
2118
|
-
|
|
1313
|
+
for (var i = 0; i < unmountedIDs.length; i++) {
|
|
1314
|
+
var id = unmountedIDs[i];
|
|
1315
|
+
purgeDeep(id);
|
|
1316
|
+
}
|
|
1317
|
+
unmountedIDs.length = 0;
|
|
2119
1318
|
},
|
|
1319
|
+
isMounted: function (id) {
|
|
1320
|
+
var item = getItem(id);
|
|
1321
|
+
return item ? item.isMounted : false;
|
|
1322
|
+
},
|
|
1323
|
+
getCurrentStackAddendum: function (topElement) {
|
|
1324
|
+
var info = '';
|
|
1325
|
+
if (topElement) {
|
|
1326
|
+
var name = getDisplayName(topElement);
|
|
1327
|
+
var owner = topElement._owner;
|
|
1328
|
+
info += describeComponentFrame(name, topElement._source, owner && getComponentName_1(owner));
|
|
1329
|
+
}
|
|
2120
1330
|
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
get: function () {
|
|
2131
|
-
warning$2(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2132
|
-
Object.defineProperty(this, 'type', {
|
|
2133
|
-
value: type
|
|
2134
|
-
});
|
|
2135
|
-
return type;
|
|
2136
|
-
}
|
|
2137
|
-
});
|
|
1331
|
+
var currentOwner = ReactCurrentOwner_1.current;
|
|
1332
|
+
if (currentOwner) {
|
|
1333
|
+
if (typeof currentOwner.tag === 'number') {
|
|
1334
|
+
var workInProgress = currentOwner;
|
|
1335
|
+
// Safe because if current owner exists, we are reconciling,
|
|
1336
|
+
// and it is guaranteed to be the work-in-progress version.
|
|
1337
|
+
info += getStackAddendumByWorkInProgressFiber(workInProgress);
|
|
1338
|
+
} else if (typeof currentOwner._debugID === 'number') {
|
|
1339
|
+
info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
|
|
2138
1340
|
}
|
|
2139
1341
|
}
|
|
2140
|
-
|
|
2141
|
-
return validatedFactory;
|
|
1342
|
+
return info;
|
|
2142
1343
|
},
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
1344
|
+
getStackAddendumByID: function (id) {
|
|
1345
|
+
var info = '';
|
|
1346
|
+
while (id) {
|
|
1347
|
+
info += describeID(id);
|
|
1348
|
+
id = ReactComponentTreeHook.getParentID(id);
|
|
2148
1349
|
}
|
|
2149
|
-
|
|
2150
|
-
|
|
1350
|
+
return info;
|
|
1351
|
+
},
|
|
1352
|
+
getChildIDs: function (id) {
|
|
1353
|
+
var item = getItem(id);
|
|
1354
|
+
return item ? item.childIDs : [];
|
|
1355
|
+
},
|
|
1356
|
+
getDisplayName: function (id) {
|
|
1357
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1358
|
+
if (!element) {
|
|
1359
|
+
return null;
|
|
2151
1360
|
}
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
1361
|
+
return getDisplayName(element);
|
|
1362
|
+
},
|
|
1363
|
+
getElement: function (id) {
|
|
1364
|
+
var item = getItem(id);
|
|
1365
|
+
return item ? item.element : null;
|
|
1366
|
+
},
|
|
1367
|
+
getOwnerID: function (id) {
|
|
1368
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1369
|
+
if (!element || !element._owner) {
|
|
1370
|
+
return null;
|
|
2155
1371
|
}
|
|
2156
|
-
return
|
|
2157
|
-
}
|
|
1372
|
+
return element._owner._debugID;
|
|
1373
|
+
},
|
|
1374
|
+
getParentID: function (id) {
|
|
1375
|
+
var item = getItem(id);
|
|
1376
|
+
return item ? item.parentID : null;
|
|
1377
|
+
},
|
|
1378
|
+
getSource: function (id) {
|
|
1379
|
+
var item = getItem(id);
|
|
1380
|
+
var element = item ? item.element : null;
|
|
1381
|
+
var source = element != null ? element._source : null;
|
|
1382
|
+
return source;
|
|
1383
|
+
},
|
|
1384
|
+
getText: function (id) {
|
|
1385
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1386
|
+
if (typeof element === 'string') {
|
|
1387
|
+
return element;
|
|
1388
|
+
} else if (typeof element === 'number') {
|
|
1389
|
+
return '' + element;
|
|
1390
|
+
} else {
|
|
1391
|
+
return null;
|
|
1392
|
+
}
|
|
1393
|
+
},
|
|
1394
|
+
getUpdateCount: function (id) {
|
|
1395
|
+
var item = getItem(id);
|
|
1396
|
+
return item ? item.updateCount : 0;
|
|
1397
|
+
},
|
|
1398
|
+
|
|
1399
|
+
|
|
1400
|
+
getRootIDs: getRootIDs,
|
|
1401
|
+
getRegisteredIDs: getItemIDs
|
|
2158
1402
|
};
|
|
2159
1403
|
|
|
2160
|
-
var
|
|
1404
|
+
var ReactComponentTreeHook_1 = ReactComponentTreeHook;
|
|
1405
|
+
|
|
1406
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
1407
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
1408
|
+
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
1409
|
+
// nor polyfill, then a plain number is used for performance.
|
|
1410
|
+
var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
2161
1411
|
|
|
2162
|
-
/**
|
|
2163
|
-
* Create a factory that creates HTML tag elements.
|
|
2164
|
-
*
|
|
2165
|
-
* @private
|
|
2166
|
-
*/
|
|
2167
|
-
var createDOMFactory = ReactElement_1.createFactory;
|
|
2168
1412
|
{
|
|
2169
|
-
var
|
|
2170
|
-
|
|
1413
|
+
var _require = ReactComponentTreeHook_1,
|
|
1414
|
+
getCurrentStackAddendum = _require.getCurrentStackAddendum;
|
|
2171
1415
|
}
|
|
2172
1416
|
|
|
1417
|
+
var SEPARATOR = '.';
|
|
1418
|
+
var SUBSEPARATOR = ':';
|
|
1419
|
+
|
|
2173
1420
|
/**
|
|
2174
|
-
*
|
|
2175
|
-
* This is also accessible via `React.DOM`.
|
|
1421
|
+
* Escape and wrap key so it is safe to use as a reactid
|
|
2176
1422
|
*
|
|
2177
|
-
* @
|
|
1423
|
+
* @param {string} key to be escaped.
|
|
1424
|
+
* @return {string} the escaped key.
|
|
2178
1425
|
*/
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
base: createDOMFactory('base'),
|
|
2189
|
-
bdi: createDOMFactory('bdi'),
|
|
2190
|
-
bdo: createDOMFactory('bdo'),
|
|
2191
|
-
big: createDOMFactory('big'),
|
|
2192
|
-
blockquote: createDOMFactory('blockquote'),
|
|
2193
|
-
body: createDOMFactory('body'),
|
|
2194
|
-
br: createDOMFactory('br'),
|
|
2195
|
-
button: createDOMFactory('button'),
|
|
2196
|
-
canvas: createDOMFactory('canvas'),
|
|
2197
|
-
caption: createDOMFactory('caption'),
|
|
2198
|
-
cite: createDOMFactory('cite'),
|
|
2199
|
-
code: createDOMFactory('code'),
|
|
2200
|
-
col: createDOMFactory('col'),
|
|
2201
|
-
colgroup: createDOMFactory('colgroup'),
|
|
2202
|
-
data: createDOMFactory('data'),
|
|
2203
|
-
datalist: createDOMFactory('datalist'),
|
|
2204
|
-
dd: createDOMFactory('dd'),
|
|
2205
|
-
del: createDOMFactory('del'),
|
|
2206
|
-
details: createDOMFactory('details'),
|
|
2207
|
-
dfn: createDOMFactory('dfn'),
|
|
2208
|
-
dialog: createDOMFactory('dialog'),
|
|
2209
|
-
div: createDOMFactory('div'),
|
|
2210
|
-
dl: createDOMFactory('dl'),
|
|
2211
|
-
dt: createDOMFactory('dt'),
|
|
2212
|
-
em: createDOMFactory('em'),
|
|
2213
|
-
embed: createDOMFactory('embed'),
|
|
2214
|
-
fieldset: createDOMFactory('fieldset'),
|
|
2215
|
-
figcaption: createDOMFactory('figcaption'),
|
|
2216
|
-
figure: createDOMFactory('figure'),
|
|
2217
|
-
footer: createDOMFactory('footer'),
|
|
2218
|
-
form: createDOMFactory('form'),
|
|
2219
|
-
h1: createDOMFactory('h1'),
|
|
2220
|
-
h2: createDOMFactory('h2'),
|
|
2221
|
-
h3: createDOMFactory('h3'),
|
|
2222
|
-
h4: createDOMFactory('h4'),
|
|
2223
|
-
h5: createDOMFactory('h5'),
|
|
2224
|
-
h6: createDOMFactory('h6'),
|
|
2225
|
-
head: createDOMFactory('head'),
|
|
2226
|
-
header: createDOMFactory('header'),
|
|
2227
|
-
hgroup: createDOMFactory('hgroup'),
|
|
2228
|
-
hr: createDOMFactory('hr'),
|
|
2229
|
-
html: createDOMFactory('html'),
|
|
2230
|
-
i: createDOMFactory('i'),
|
|
2231
|
-
iframe: createDOMFactory('iframe'),
|
|
2232
|
-
img: createDOMFactory('img'),
|
|
2233
|
-
input: createDOMFactory('input'),
|
|
2234
|
-
ins: createDOMFactory('ins'),
|
|
2235
|
-
kbd: createDOMFactory('kbd'),
|
|
2236
|
-
keygen: createDOMFactory('keygen'),
|
|
2237
|
-
label: createDOMFactory('label'),
|
|
2238
|
-
legend: createDOMFactory('legend'),
|
|
2239
|
-
li: createDOMFactory('li'),
|
|
2240
|
-
link: createDOMFactory('link'),
|
|
2241
|
-
main: createDOMFactory('main'),
|
|
2242
|
-
map: createDOMFactory('map'),
|
|
2243
|
-
mark: createDOMFactory('mark'),
|
|
2244
|
-
menu: createDOMFactory('menu'),
|
|
2245
|
-
menuitem: createDOMFactory('menuitem'),
|
|
2246
|
-
meta: createDOMFactory('meta'),
|
|
2247
|
-
meter: createDOMFactory('meter'),
|
|
2248
|
-
nav: createDOMFactory('nav'),
|
|
2249
|
-
noscript: createDOMFactory('noscript'),
|
|
2250
|
-
object: createDOMFactory('object'),
|
|
2251
|
-
ol: createDOMFactory('ol'),
|
|
2252
|
-
optgroup: createDOMFactory('optgroup'),
|
|
2253
|
-
option: createDOMFactory('option'),
|
|
2254
|
-
output: createDOMFactory('output'),
|
|
2255
|
-
p: createDOMFactory('p'),
|
|
2256
|
-
param: createDOMFactory('param'),
|
|
2257
|
-
picture: createDOMFactory('picture'),
|
|
2258
|
-
pre: createDOMFactory('pre'),
|
|
2259
|
-
progress: createDOMFactory('progress'),
|
|
2260
|
-
q: createDOMFactory('q'),
|
|
2261
|
-
rp: createDOMFactory('rp'),
|
|
2262
|
-
rt: createDOMFactory('rt'),
|
|
2263
|
-
ruby: createDOMFactory('ruby'),
|
|
2264
|
-
s: createDOMFactory('s'),
|
|
2265
|
-
samp: createDOMFactory('samp'),
|
|
2266
|
-
script: createDOMFactory('script'),
|
|
2267
|
-
section: createDOMFactory('section'),
|
|
2268
|
-
select: createDOMFactory('select'),
|
|
2269
|
-
small: createDOMFactory('small'),
|
|
2270
|
-
source: createDOMFactory('source'),
|
|
2271
|
-
span: createDOMFactory('span'),
|
|
2272
|
-
strong: createDOMFactory('strong'),
|
|
2273
|
-
style: createDOMFactory('style'),
|
|
2274
|
-
sub: createDOMFactory('sub'),
|
|
2275
|
-
summary: createDOMFactory('summary'),
|
|
2276
|
-
sup: createDOMFactory('sup'),
|
|
2277
|
-
table: createDOMFactory('table'),
|
|
2278
|
-
tbody: createDOMFactory('tbody'),
|
|
2279
|
-
td: createDOMFactory('td'),
|
|
2280
|
-
textarea: createDOMFactory('textarea'),
|
|
2281
|
-
tfoot: createDOMFactory('tfoot'),
|
|
2282
|
-
th: createDOMFactory('th'),
|
|
2283
|
-
thead: createDOMFactory('thead'),
|
|
2284
|
-
time: createDOMFactory('time'),
|
|
2285
|
-
title: createDOMFactory('title'),
|
|
2286
|
-
tr: createDOMFactory('tr'),
|
|
2287
|
-
track: createDOMFactory('track'),
|
|
2288
|
-
u: createDOMFactory('u'),
|
|
2289
|
-
ul: createDOMFactory('ul'),
|
|
2290
|
-
'var': createDOMFactory('var'),
|
|
2291
|
-
video: createDOMFactory('video'),
|
|
2292
|
-
wbr: createDOMFactory('wbr'),
|
|
2293
|
-
|
|
2294
|
-
// SVG
|
|
2295
|
-
circle: createDOMFactory('circle'),
|
|
2296
|
-
clipPath: createDOMFactory('clipPath'),
|
|
2297
|
-
defs: createDOMFactory('defs'),
|
|
2298
|
-
ellipse: createDOMFactory('ellipse'),
|
|
2299
|
-
g: createDOMFactory('g'),
|
|
2300
|
-
image: createDOMFactory('image'),
|
|
2301
|
-
line: createDOMFactory('line'),
|
|
2302
|
-
linearGradient: createDOMFactory('linearGradient'),
|
|
2303
|
-
mask: createDOMFactory('mask'),
|
|
2304
|
-
path: createDOMFactory('path'),
|
|
2305
|
-
pattern: createDOMFactory('pattern'),
|
|
2306
|
-
polygon: createDOMFactory('polygon'),
|
|
2307
|
-
polyline: createDOMFactory('polyline'),
|
|
2308
|
-
radialGradient: createDOMFactory('radialGradient'),
|
|
2309
|
-
rect: createDOMFactory('rect'),
|
|
2310
|
-
stop: createDOMFactory('stop'),
|
|
2311
|
-
svg: createDOMFactory('svg'),
|
|
2312
|
-
text: createDOMFactory('text'),
|
|
2313
|
-
tspan: createDOMFactory('tspan')
|
|
2314
|
-
};
|
|
2315
|
-
|
|
2316
|
-
var ReactDOMFactories_1 = ReactDOMFactories;
|
|
2317
|
-
|
|
2318
|
-
var factory = function (isValidElement) {
|
|
2319
|
-
/* global Symbol */
|
|
2320
|
-
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
2321
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
1426
|
+
function escape(key) {
|
|
1427
|
+
var escapeRegex = /[=:]/g;
|
|
1428
|
+
var escaperLookup = {
|
|
1429
|
+
'=': '=0',
|
|
1430
|
+
':': '=2'
|
|
1431
|
+
};
|
|
1432
|
+
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
|
1433
|
+
return escaperLookup[match];
|
|
1434
|
+
});
|
|
2322
1435
|
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
*
|
|
2326
|
-
* Be sure to invoke the function with the iterable as context:
|
|
2327
|
-
*
|
|
2328
|
-
* var iteratorFn = getIteratorFn(myIterable);
|
|
2329
|
-
* if (iteratorFn) {
|
|
2330
|
-
* var iterator = iteratorFn.call(myIterable);
|
|
2331
|
-
* ...
|
|
2332
|
-
* }
|
|
2333
|
-
*
|
|
2334
|
-
* @param {?object} maybeIterable
|
|
2335
|
-
* @return {?function}
|
|
2336
|
-
*/
|
|
2337
|
-
function getIteratorFn(maybeIterable) {
|
|
2338
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
2339
|
-
if (typeof iteratorFn === 'function') {
|
|
2340
|
-
return iteratorFn;
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
1436
|
+
return '$' + escapedString;
|
|
1437
|
+
}
|
|
2343
1438
|
|
|
1439
|
+
var unescapeInDev = emptyFunction_1;
|
|
1440
|
+
{
|
|
2344
1441
|
/**
|
|
2345
|
-
*
|
|
2346
|
-
* supplied to React components. Example usage:
|
|
1442
|
+
* Unescape and unwrap key for human-readable display
|
|
2347
1443
|
*
|
|
2348
|
-
*
|
|
2349
|
-
*
|
|
2350
|
-
* propTypes: {
|
|
2351
|
-
* // An optional string prop named "description".
|
|
2352
|
-
* description: Props.string,
|
|
2353
|
-
*
|
|
2354
|
-
* // A required enum prop named "category".
|
|
2355
|
-
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
2356
|
-
*
|
|
2357
|
-
* // A prop named "dialog" that requires an instance of Dialog.
|
|
2358
|
-
* dialog: Props.instanceOf(Dialog).isRequired
|
|
2359
|
-
* },
|
|
2360
|
-
* render: function() { ... }
|
|
2361
|
-
* });
|
|
2362
|
-
*
|
|
2363
|
-
* A more formal specification of how these methods are used:
|
|
2364
|
-
*
|
|
2365
|
-
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
2366
|
-
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
2367
|
-
*
|
|
2368
|
-
* Each and every declaration produces a function with the same signature. This
|
|
2369
|
-
* allows the creation of custom validation functions. For example:
|
|
2370
|
-
*
|
|
2371
|
-
* var MyLink = React.createClass({
|
|
2372
|
-
* propTypes: {
|
|
2373
|
-
* // An optional string or URI prop named "href".
|
|
2374
|
-
* href: function(props, propName, componentName) {
|
|
2375
|
-
* var propValue = props[propName];
|
|
2376
|
-
* if (propValue != null && typeof propValue !== 'string' &&
|
|
2377
|
-
* !(propValue instanceof URI)) {
|
|
2378
|
-
* return new Error(
|
|
2379
|
-
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
2380
|
-
* componentName
|
|
2381
|
-
* );
|
|
2382
|
-
* }
|
|
2383
|
-
* }
|
|
2384
|
-
* },
|
|
2385
|
-
* render: function() {...}
|
|
2386
|
-
* });
|
|
2387
|
-
*
|
|
2388
|
-
* @internal
|
|
1444
|
+
* @param {string} key to unescape.
|
|
1445
|
+
* @return {string} the unescaped key.
|
|
2389
1446
|
*/
|
|
1447
|
+
unescapeInDev = function (key) {
|
|
1448
|
+
var unescapeRegex = /(=0|=2)/g;
|
|
1449
|
+
var unescaperLookup = {
|
|
1450
|
+
'=0': '=',
|
|
1451
|
+
'=2': ':'
|
|
1452
|
+
};
|
|
1453
|
+
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
|
|
2390
1454
|
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
1455
|
+
return ('' + keySubstring).replace(unescapeRegex, function (match) {
|
|
1456
|
+
return unescaperLookup[match];
|
|
1457
|
+
});
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
2394
1460
|
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
bool: createPrimitiveTypeChecker('boolean'),
|
|
2400
|
-
func: createPrimitiveTypeChecker('function'),
|
|
2401
|
-
number: createPrimitiveTypeChecker('number'),
|
|
2402
|
-
object: createPrimitiveTypeChecker('object'),
|
|
2403
|
-
string: createPrimitiveTypeChecker('string'),
|
|
2404
|
-
symbol: createPrimitiveTypeChecker('symbol'),
|
|
2405
|
-
|
|
2406
|
-
any: createAnyTypeChecker(),
|
|
2407
|
-
arrayOf: createArrayOfTypeChecker,
|
|
2408
|
-
element: createElementTypeChecker(),
|
|
2409
|
-
instanceOf: createInstanceTypeChecker,
|
|
2410
|
-
node: createNodeChecker(),
|
|
2411
|
-
objectOf: createObjectOfTypeChecker,
|
|
2412
|
-
oneOf: createEnumTypeChecker,
|
|
2413
|
-
oneOfType: createUnionTypeChecker,
|
|
2414
|
-
shape: createShapeTypeChecker
|
|
2415
|
-
};
|
|
2416
|
-
}
|
|
1461
|
+
/**
|
|
1462
|
+
* TODO: Test that a single child and an array with one item have the same key
|
|
1463
|
+
* pattern.
|
|
1464
|
+
*/
|
|
2417
1465
|
|
|
2418
|
-
|
|
2419
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
2420
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
2421
|
-
*/
|
|
2422
|
-
/*eslint-disable no-self-compare*/
|
|
2423
|
-
function is(x, y) {
|
|
2424
|
-
// SameValue algorithm
|
|
2425
|
-
if (x === y) {
|
|
2426
|
-
// Steps 1-5, 7-10
|
|
2427
|
-
// Steps 6.b-6.e: +0 != -0
|
|
2428
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
2429
|
-
} else {
|
|
2430
|
-
// Step 6.a: NaN == NaN
|
|
2431
|
-
return x !== x && y !== y;
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
/*eslint-enable no-self-compare*/
|
|
1466
|
+
var didWarnAboutMaps = false;
|
|
2435
1467
|
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
1468
|
+
/**
|
|
1469
|
+
* Generate a key string that identifies a component within a set.
|
|
1470
|
+
*
|
|
1471
|
+
* @param {*} component A component that could contain a manual key.
|
|
1472
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
1473
|
+
* @return {string}
|
|
1474
|
+
*/
|
|
1475
|
+
function getComponentKey(component, index) {
|
|
1476
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1477
|
+
// that we don't block potential future ES APIs.
|
|
1478
|
+
if (typeof component === 'object' && component !== null && component.key != null) {
|
|
1479
|
+
// Explicit key
|
|
1480
|
+
return escape(component.key);
|
|
2446
1481
|
}
|
|
2447
|
-
//
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
function createChainableTypeChecker(validate) {
|
|
2451
|
-
{
|
|
2452
|
-
var manualPropTypeCallCache = {};
|
|
2453
|
-
}
|
|
2454
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
2455
|
-
componentName = componentName || ANONYMOUS;
|
|
2456
|
-
propFullName = propFullName || propName;
|
|
2457
|
-
{
|
|
2458
|
-
if (secret !== ReactPropTypesSecret_1 && typeof console !== 'undefined') {
|
|
2459
|
-
var cacheKey = componentName + ':' + propName;
|
|
2460
|
-
if (!manualPropTypeCallCache[cacheKey]) {
|
|
2461
|
-
warning_1(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName);
|
|
2462
|
-
manualPropTypeCallCache[cacheKey] = true;
|
|
2463
|
-
}
|
|
2464
|
-
}
|
|
2465
|
-
}
|
|
2466
|
-
if (props[propName] == null) {
|
|
2467
|
-
if (isRequired) {
|
|
2468
|
-
if (props[propName] === null) {
|
|
2469
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
2470
|
-
}
|
|
2471
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
2472
|
-
}
|
|
2473
|
-
return null;
|
|
2474
|
-
} else {
|
|
2475
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
2476
|
-
}
|
|
2477
|
-
}
|
|
1482
|
+
// Implicit key determined by the index in the set
|
|
1483
|
+
return index.toString(36);
|
|
1484
|
+
}
|
|
2478
1485
|
|
|
2479
|
-
|
|
2480
|
-
|
|
1486
|
+
/**
|
|
1487
|
+
* @param {?*} children Children tree container.
|
|
1488
|
+
* @param {!string} nameSoFar Name of the key path so far.
|
|
1489
|
+
* @param {!function} callback Callback to invoke with each child found.
|
|
1490
|
+
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
1491
|
+
* process.
|
|
1492
|
+
* @return {!number} The number of children in this subtree.
|
|
1493
|
+
*/
|
|
1494
|
+
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
1495
|
+
var type = typeof children;
|
|
2481
1496
|
|
|
2482
|
-
|
|
1497
|
+
if (type === 'undefined' || type === 'boolean') {
|
|
1498
|
+
// All of the above are perceived as null.
|
|
1499
|
+
children = null;
|
|
2483
1500
|
}
|
|
2484
1501
|
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
|
2496
|
-
}
|
|
2497
|
-
return null;
|
|
2498
|
-
}
|
|
2499
|
-
return createChainableTypeChecker(validate);
|
|
1502
|
+
if (children === null || type === 'string' || type === 'number' ||
|
|
1503
|
+
// The following is inlined from ReactElement. This means we can optimize
|
|
1504
|
+
// some checks. React Fiber also inlines this logic for similar purposes.
|
|
1505
|
+
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE$1) {
|
|
1506
|
+
callback(traverseContext, children,
|
|
1507
|
+
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1508
|
+
// so that it's consistent if the number of children grows.
|
|
1509
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar, unescapeInDev);
|
|
1510
|
+
return 1;
|
|
2500
1511
|
}
|
|
2501
1512
|
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
1513
|
+
var child;
|
|
1514
|
+
var nextName;
|
|
1515
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1516
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
2505
1517
|
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
1518
|
+
if (Array.isArray(children)) {
|
|
1519
|
+
for (var i = 0; i < children.length; i++) {
|
|
1520
|
+
child = children[i];
|
|
1521
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
|
1522
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1523
|
+
}
|
|
1524
|
+
} else {
|
|
1525
|
+
var iteratorFn = ITERATOR_SYMBOL && children[ITERATOR_SYMBOL] || children[FAUX_ITERATOR_SYMBOL];
|
|
1526
|
+
if (typeof iteratorFn === 'function') {
|
|
1527
|
+
{
|
|
1528
|
+
// Warn about using Maps as children
|
|
1529
|
+
if (iteratorFn === children.entries) {
|
|
1530
|
+
warning_1(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getCurrentStackAddendum());
|
|
1531
|
+
didWarnAboutMaps = true;
|
|
2520
1532
|
}
|
|
2521
1533
|
}
|
|
2522
|
-
return null;
|
|
2523
|
-
}
|
|
2524
|
-
return createChainableTypeChecker(validate);
|
|
2525
|
-
}
|
|
2526
1534
|
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
var
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
1535
|
+
var iterator = iteratorFn.call(children);
|
|
1536
|
+
var step;
|
|
1537
|
+
var ii = 0;
|
|
1538
|
+
while (!(step = iterator.next()).done) {
|
|
1539
|
+
child = step.value;
|
|
1540
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
1541
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
2533
1542
|
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
2540
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2541
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
2542
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
2543
|
-
var actualClassName = getClassName(props[propName]);
|
|
2544
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
1543
|
+
} else if (type === 'object') {
|
|
1544
|
+
var addendum = '';
|
|
1545
|
+
{
|
|
1546
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentStackAddendum();
|
|
2545
1547
|
}
|
|
2546
|
-
|
|
1548
|
+
var childrenString = '' + children;
|
|
1549
|
+
invariant_1(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
|
2547
1550
|
}
|
|
2548
|
-
return createChainableTypeChecker(validate);
|
|
2549
1551
|
}
|
|
2550
1552
|
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
warning_1(false, 'Invalid argument supplied to oneOf, expected an instance of array.');
|
|
2554
|
-
return emptyFunction_1.thatReturnsNull;
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2558
|
-
var propValue = props[propName];
|
|
2559
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
2560
|
-
if (is(propValue, expectedValues[i])) {
|
|
2561
|
-
return null;
|
|
2562
|
-
}
|
|
2563
|
-
}
|
|
2564
|
-
|
|
2565
|
-
var valuesString = JSON.stringify(expectedValues);
|
|
2566
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
2567
|
-
}
|
|
2568
|
-
return createChainableTypeChecker(validate);
|
|
2569
|
-
}
|
|
1553
|
+
return subtreeCount;
|
|
1554
|
+
}
|
|
2570
1555
|
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
}
|
|
2591
|
-
return createChainableTypeChecker(validate);
|
|
1556
|
+
/**
|
|
1557
|
+
* Traverses children that are typically specified as `props.children`, but
|
|
1558
|
+
* might also be specified through attributes:
|
|
1559
|
+
*
|
|
1560
|
+
* - `traverseAllChildren(this.props.children, ...)`
|
|
1561
|
+
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
1562
|
+
*
|
|
1563
|
+
* The `traverseContext` is an optional argument that is passed through the
|
|
1564
|
+
* entire traversal. It can be used to store accumulations or anything else that
|
|
1565
|
+
* the callback might find relevant.
|
|
1566
|
+
*
|
|
1567
|
+
* @param {?*} children Children tree object.
|
|
1568
|
+
* @param {!function} callback To invoke upon traversing each child.
|
|
1569
|
+
* @param {?*} traverseContext Context for traversal.
|
|
1570
|
+
* @return {!number} The number of children in this subtree.
|
|
1571
|
+
*/
|
|
1572
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
|
1573
|
+
if (children == null) {
|
|
1574
|
+
return 0;
|
|
2592
1575
|
}
|
|
2593
1576
|
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
warning_1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.');
|
|
2597
|
-
return emptyFunction_1.thatReturnsNull;
|
|
2598
|
-
}
|
|
1577
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1578
|
+
}
|
|
2599
1579
|
|
|
2600
|
-
|
|
2601
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
2602
|
-
var checker = arrayOfTypeCheckers[i];
|
|
2603
|
-
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
|
|
2604
|
-
return null;
|
|
2605
|
-
}
|
|
2606
|
-
}
|
|
1580
|
+
var traverseAllChildren_1 = traverseAllChildren;
|
|
2607
1581
|
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
return createChainableTypeChecker(validate);
|
|
2611
|
-
}
|
|
1582
|
+
var twoArgumentPooler = PooledClass_1.twoArgumentPooler;
|
|
1583
|
+
var fourArgumentPooler = PooledClass_1.fourArgumentPooler;
|
|
2612
1584
|
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
}
|
|
2618
|
-
return null;
|
|
2619
|
-
}
|
|
2620
|
-
return createChainableTypeChecker(validate);
|
|
2621
|
-
}
|
|
1585
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1586
|
+
function escapeUserProvidedKey(text) {
|
|
1587
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1588
|
+
}
|
|
2622
1589
|
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
return createChainableTypeChecker(validate);
|
|
2643
|
-
}
|
|
1590
|
+
/**
|
|
1591
|
+
* PooledClass representing the bookkeeping associated with performing a child
|
|
1592
|
+
* traversal. Allows avoiding binding callbacks.
|
|
1593
|
+
*
|
|
1594
|
+
* @constructor ForEachBookKeeping
|
|
1595
|
+
* @param {!function} forEachFunction Function to perform traversal with.
|
|
1596
|
+
* @param {?*} forEachContext Context to perform context with.
|
|
1597
|
+
*/
|
|
1598
|
+
function ForEachBookKeeping(forEachFunction, forEachContext) {
|
|
1599
|
+
this.func = forEachFunction;
|
|
1600
|
+
this.context = forEachContext;
|
|
1601
|
+
this.count = 0;
|
|
1602
|
+
}
|
|
1603
|
+
ForEachBookKeeping.prototype.destructor = function () {
|
|
1604
|
+
this.func = null;
|
|
1605
|
+
this.context = null;
|
|
1606
|
+
this.count = 0;
|
|
1607
|
+
};
|
|
1608
|
+
PooledClass_1.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
|
|
2644
1609
|
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
case 'string':
|
|
2649
|
-
case 'undefined':
|
|
2650
|
-
return true;
|
|
2651
|
-
case 'boolean':
|
|
2652
|
-
return !propValue;
|
|
2653
|
-
case 'object':
|
|
2654
|
-
if (Array.isArray(propValue)) {
|
|
2655
|
-
return propValue.every(isNode);
|
|
2656
|
-
}
|
|
2657
|
-
if (propValue === null || isValidElement(propValue)) {
|
|
2658
|
-
return true;
|
|
2659
|
-
}
|
|
1610
|
+
function forEachSingleChild(bookKeeping, child, name) {
|
|
1611
|
+
var func = bookKeeping.func,
|
|
1612
|
+
context = bookKeeping.context;
|
|
2660
1613
|
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
var iterator = iteratorFn.call(propValue);
|
|
2664
|
-
var step;
|
|
2665
|
-
if (iteratorFn !== propValue.entries) {
|
|
2666
|
-
while (!(step = iterator.next()).done) {
|
|
2667
|
-
if (!isNode(step.value)) {
|
|
2668
|
-
return false;
|
|
2669
|
-
}
|
|
2670
|
-
}
|
|
2671
|
-
} else {
|
|
2672
|
-
// Iterator will provide entry [k,v] tuples rather than values.
|
|
2673
|
-
while (!(step = iterator.next()).done) {
|
|
2674
|
-
var entry = step.value;
|
|
2675
|
-
if (entry) {
|
|
2676
|
-
if (!isNode(entry[1])) {
|
|
2677
|
-
return false;
|
|
2678
|
-
}
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
} else {
|
|
2683
|
-
return false;
|
|
2684
|
-
}
|
|
1614
|
+
func.call(context, child, bookKeeping.count++);
|
|
1615
|
+
}
|
|
2685
1616
|
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
1617
|
+
/**
|
|
1618
|
+
* Iterates through children that are typically specified as `props.children`.
|
|
1619
|
+
*
|
|
1620
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
|
|
1621
|
+
*
|
|
1622
|
+
* The provided forEachFunc(child, index) will be called for each
|
|
1623
|
+
* leaf child.
|
|
1624
|
+
*
|
|
1625
|
+
* @param {?*} children Children tree container.
|
|
1626
|
+
* @param {function(*, int)} forEachFunc
|
|
1627
|
+
* @param {*} forEachContext Context for forEachContext.
|
|
1628
|
+
*/
|
|
1629
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1630
|
+
if (children == null) {
|
|
1631
|
+
return children;
|
|
2690
1632
|
}
|
|
1633
|
+
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
|
|
1634
|
+
traverseAllChildren_1(children, forEachSingleChild, traverseContext);
|
|
1635
|
+
ForEachBookKeeping.release(traverseContext);
|
|
1636
|
+
}
|
|
2691
1637
|
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
1638
|
+
/**
|
|
1639
|
+
* PooledClass representing the bookkeeping associated with performing a child
|
|
1640
|
+
* mapping. Allows avoiding binding callbacks.
|
|
1641
|
+
*
|
|
1642
|
+
* @constructor MapBookKeeping
|
|
1643
|
+
* @param {!*} mapResult Object containing the ordered map of results.
|
|
1644
|
+
* @param {!function} mapFunction Function to perform mapping with.
|
|
1645
|
+
* @param {?*} mapContext Context to perform mapping with.
|
|
1646
|
+
*/
|
|
1647
|
+
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
1648
|
+
this.result = mapResult;
|
|
1649
|
+
this.keyPrefix = keyPrefix;
|
|
1650
|
+
this.func = mapFunction;
|
|
1651
|
+
this.context = mapContext;
|
|
1652
|
+
this.count = 0;
|
|
1653
|
+
}
|
|
1654
|
+
MapBookKeeping.prototype.destructor = function () {
|
|
1655
|
+
this.result = null;
|
|
1656
|
+
this.keyPrefix = null;
|
|
1657
|
+
this.func = null;
|
|
1658
|
+
this.context = null;
|
|
1659
|
+
this.count = 0;
|
|
1660
|
+
};
|
|
1661
|
+
PooledClass_1.addPoolingTo(MapBookKeeping, fourArgumentPooler);
|
|
2702
1662
|
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
1663
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1664
|
+
var result = bookKeeping.result,
|
|
1665
|
+
keyPrefix = bookKeeping.keyPrefix,
|
|
1666
|
+
func = bookKeeping.func,
|
|
1667
|
+
context = bookKeeping.context;
|
|
2707
1668
|
|
|
2708
|
-
return false;
|
|
2709
|
-
}
|
|
2710
1669
|
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
//
|
|
2719
|
-
|
|
2720
|
-
// passes PropTypes.object.
|
|
2721
|
-
return 'object';
|
|
2722
|
-
}
|
|
2723
|
-
if (isSymbol(propType, propValue)) {
|
|
2724
|
-
return 'symbol';
|
|
1670
|
+
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1671
|
+
if (Array.isArray(mappedChild)) {
|
|
1672
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction_1.thatReturnsArgument);
|
|
1673
|
+
} else if (mappedChild != null) {
|
|
1674
|
+
if (ReactElement_1.isValidElement(mappedChild)) {
|
|
1675
|
+
mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
|
|
1676
|
+
// Keep both the (mapped) and old keys if they differ, just as
|
|
1677
|
+
// traverseAllChildren used to do for objects as children
|
|
1678
|
+
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
2725
1679
|
}
|
|
2726
|
-
|
|
1680
|
+
result.push(mappedChild);
|
|
2727
1681
|
}
|
|
1682
|
+
}
|
|
2728
1683
|
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
if (propType === 'object') {
|
|
2734
|
-
if (propValue instanceof Date) {
|
|
2735
|
-
return 'date';
|
|
2736
|
-
} else if (propValue instanceof RegExp) {
|
|
2737
|
-
return 'regexp';
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
|
-
return propType;
|
|
1684
|
+
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1685
|
+
var escapedPrefix = '';
|
|
1686
|
+
if (prefix != null) {
|
|
1687
|
+
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
2741
1688
|
}
|
|
1689
|
+
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
|
|
1690
|
+
traverseAllChildren_1(children, mapSingleChildIntoContext, traverseContext);
|
|
1691
|
+
MapBookKeeping.release(traverseContext);
|
|
1692
|
+
}
|
|
2742
1693
|
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
1694
|
+
/**
|
|
1695
|
+
* Maps children that are typically specified as `props.children`.
|
|
1696
|
+
*
|
|
1697
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.map
|
|
1698
|
+
*
|
|
1699
|
+
* The provided mapFunction(child, key, index) will be called for each
|
|
1700
|
+
* leaf child.
|
|
1701
|
+
*
|
|
1702
|
+
* @param {?*} children Children tree container.
|
|
1703
|
+
* @param {function(*, int)} func The map function.
|
|
1704
|
+
* @param {*} context Context for mapFunction.
|
|
1705
|
+
* @return {object} Object containing the ordered map of results.
|
|
1706
|
+
*/
|
|
1707
|
+
function mapChildren(children, func, context) {
|
|
1708
|
+
if (children == null) {
|
|
1709
|
+
return children;
|
|
2749
1710
|
}
|
|
1711
|
+
var result = [];
|
|
1712
|
+
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1713
|
+
return result;
|
|
1714
|
+
}
|
|
2750
1715
|
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
return ReactPropTypes;
|
|
2755
|
-
};
|
|
1716
|
+
function forEachSingleChildDummy(traverseContext, child, name) {
|
|
1717
|
+
return null;
|
|
1718
|
+
}
|
|
2756
1719
|
|
|
2757
|
-
|
|
1720
|
+
/**
|
|
1721
|
+
* Count the number of children that are typically specified as
|
|
1722
|
+
* `props.children`.
|
|
1723
|
+
*
|
|
1724
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.count
|
|
1725
|
+
*
|
|
1726
|
+
* @param {?*} children Children tree container.
|
|
1727
|
+
* @return {number} The number of children.
|
|
1728
|
+
*/
|
|
1729
|
+
function countChildren(children, context) {
|
|
1730
|
+
return traverseAllChildren_1(children, forEachSingleChildDummy, null);
|
|
1731
|
+
}
|
|
2758
1732
|
|
|
1733
|
+
/**
|
|
1734
|
+
* Flatten a children object (typically specified as `props.children`) and
|
|
1735
|
+
* return an array with appropriately re-keyed children.
|
|
1736
|
+
*
|
|
1737
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
|
|
1738
|
+
*/
|
|
1739
|
+
function toArray(children) {
|
|
1740
|
+
var result = [];
|
|
1741
|
+
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction_1.thatReturnsArgument);
|
|
1742
|
+
return result;
|
|
1743
|
+
}
|
|
2759
1744
|
|
|
1745
|
+
var ReactChildren = {
|
|
1746
|
+
forEach: forEachChildren,
|
|
1747
|
+
map: mapChildren,
|
|
1748
|
+
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
|
1749
|
+
count: countChildren,
|
|
1750
|
+
toArray: toArray
|
|
1751
|
+
};
|
|
2760
1752
|
|
|
2761
|
-
var
|
|
1753
|
+
var ReactChildren_1 = ReactChildren;
|
|
2762
1754
|
|
|
2763
1755
|
/**
|
|
2764
1756
|
* Copyright 2013-present, Facebook, Inc.
|
|
@@ -2771,7 +1763,7 @@ var ReactPropTypes = factory(isValidElement);
|
|
|
2771
1763
|
* @providesModule ReactVersion
|
|
2772
1764
|
*/
|
|
2773
1765
|
|
|
2774
|
-
var ReactVersion = '16.0.0-alpha.
|
|
1766
|
+
var ReactVersion = '16.0.0-alpha.13';
|
|
2775
1767
|
|
|
2776
1768
|
/**
|
|
2777
1769
|
* Returns the first child in a collection of children and verifies that there
|
|
@@ -2794,741 +1786,377 @@ function onlyChild(children) {
|
|
|
2794
1786
|
|
|
2795
1787
|
var onlyChild_1 = onlyChild;
|
|
2796
1788
|
|
|
1789
|
+
/**
|
|
1790
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
1791
|
+
* All rights reserved.
|
|
1792
|
+
*
|
|
1793
|
+
* This source code is licensed under the BSD-style license found in the
|
|
1794
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1795
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1796
|
+
*/
|
|
1797
|
+
|
|
1798
|
+
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1799
|
+
|
|
1800
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
1801
|
+
|
|
2797
1802
|
{
|
|
2798
|
-
var
|
|
1803
|
+
var invariant$1 = invariant_1;
|
|
1804
|
+
var warning$2 = warning_1;
|
|
1805
|
+
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1806
|
+
var loggedTypeFailures = {};
|
|
2799
1807
|
}
|
|
2800
1808
|
|
|
2801
|
-
|
|
1809
|
+
/**
|
|
1810
|
+
* Assert that the values match with the type specs.
|
|
1811
|
+
* Error messages are memorized and will only be shown once.
|
|
1812
|
+
*
|
|
1813
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
1814
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
1815
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
1816
|
+
* @param {string} componentName Name of the component for error messages.
|
|
1817
|
+
* @param {?Function} getStack Returns the component stack.
|
|
1818
|
+
* @private
|
|
1819
|
+
*/
|
|
1820
|
+
function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
|
|
1821
|
+
{
|
|
1822
|
+
for (var typeSpecName in typeSpecs) {
|
|
1823
|
+
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
|
1824
|
+
var error;
|
|
1825
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
1826
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
1827
|
+
// After these have been cleaned up, we'll let them throw.
|
|
1828
|
+
try {
|
|
1829
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
1830
|
+
// behavior as without this statement except with a better message.
|
|
1831
|
+
invariant$1(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
|
|
1832
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
1833
|
+
} catch (ex) {
|
|
1834
|
+
error = ex;
|
|
1835
|
+
}
|
|
1836
|
+
warning$2(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
|
|
1837
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1838
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
1839
|
+
// same error.
|
|
1840
|
+
loggedTypeFailures[error.message] = true;
|
|
1841
|
+
|
|
1842
|
+
var stack = getStack ? getStack() : '';
|
|
2802
1843
|
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
1844
|
+
warning$2(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
2807
1849
|
}
|
|
2808
1850
|
|
|
2809
|
-
var
|
|
1851
|
+
var checkPropTypes_1 = checkPropTypes$1;
|
|
1852
|
+
|
|
1853
|
+
var ReactDebugCurrentFrame$1 = {};
|
|
1854
|
+
|
|
2810
1855
|
{
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
1856
|
+
var _require$2 = ReactComponentTreeHook_1,
|
|
1857
|
+
getStackAddendumByID = _require$2.getStackAddendumByID,
|
|
1858
|
+
getCurrentStackAddendum$2 = _require$2.getCurrentStackAddendum;
|
|
1859
|
+
|
|
1860
|
+
var _require2 = ReactFiberComponentTreeHook,
|
|
1861
|
+
getStackAddendumByWorkInProgressFiber$2 = _require2.getStackAddendumByWorkInProgressFiber;
|
|
1862
|
+
|
|
1863
|
+
// Component that is being worked on
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
ReactDebugCurrentFrame$1.current = null;
|
|
1867
|
+
|
|
1868
|
+
// Element that is being cloned or created
|
|
1869
|
+
ReactDebugCurrentFrame$1.element = null;
|
|
1870
|
+
|
|
1871
|
+
ReactDebugCurrentFrame$1.getStackAddendum = function () {
|
|
1872
|
+
var stack = null;
|
|
1873
|
+
var current = ReactDebugCurrentFrame$1.current;
|
|
1874
|
+
var element = ReactDebugCurrentFrame$1.element;
|
|
1875
|
+
if (current !== null) {
|
|
1876
|
+
if (typeof current === 'number') {
|
|
1877
|
+
// DebugID from Stack.
|
|
1878
|
+
var debugID = current;
|
|
1879
|
+
stack = getStackAddendumByID(debugID);
|
|
1880
|
+
} else if (typeof current.tag === 'number') {
|
|
1881
|
+
// This is a Fiber.
|
|
1882
|
+
// The stack will only be correct if this is a work in progress
|
|
1883
|
+
// version and we're calling it during reconciliation.
|
|
1884
|
+
var workInProgress = current;
|
|
1885
|
+
stack = getStackAddendumByWorkInProgressFiber$2(workInProgress);
|
|
1886
|
+
}
|
|
1887
|
+
} else if (element !== null) {
|
|
1888
|
+
stack = getCurrentStackAddendum$2(element);
|
|
1889
|
+
}
|
|
1890
|
+
return stack;
|
|
2815
1891
|
};
|
|
2816
1892
|
}
|
|
2817
1893
|
|
|
2818
|
-
|
|
2819
|
-
/**
|
|
2820
|
-
* Policies that describe methods in `ReactClassInterface`.
|
|
2821
|
-
*/
|
|
1894
|
+
var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame$1;
|
|
2822
1895
|
|
|
1896
|
+
{
|
|
1897
|
+
var checkPropTypes = checkPropTypes_1;
|
|
1898
|
+
var lowPriorityWarning$1 = lowPriorityWarning_1;
|
|
1899
|
+
var ReactDebugCurrentFrame = ReactDebugCurrentFrame_1;
|
|
1900
|
+
var warning$1 = warning_1;
|
|
2823
1901
|
|
|
2824
|
-
var
|
|
1902
|
+
var _require$1 = ReactComponentTreeHook_1,
|
|
1903
|
+
getCurrentStackAddendum$1 = _require$1.getCurrentStackAddendum;
|
|
1904
|
+
}
|
|
2825
1905
|
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
* or host components.
|
|
2829
|
-
*
|
|
2830
|
-
* To create a new type of `ReactClass`, pass a specification of
|
|
2831
|
-
* your new class to `React.createClass`. The only requirement of your class
|
|
2832
|
-
* specification is that you implement a `render` method.
|
|
2833
|
-
*
|
|
2834
|
-
* var MyComponent = React.createClass({
|
|
2835
|
-
* render: function() {
|
|
2836
|
-
* return <div>Hello World</div>;
|
|
2837
|
-
* }
|
|
2838
|
-
* });
|
|
2839
|
-
*
|
|
2840
|
-
* The class specification supports a specific protocol of methods that have
|
|
2841
|
-
* special meaning (e.g. `render`). See `ReactClassInterface` for
|
|
2842
|
-
* more the comprehensive protocol. Any other properties and methods in the
|
|
2843
|
-
* class specification will be available on the prototype.
|
|
2844
|
-
*
|
|
2845
|
-
* @interface ReactClassInterface
|
|
2846
|
-
* @internal
|
|
2847
|
-
*/
|
|
2848
|
-
var ReactClassInterface = {
|
|
2849
|
-
|
|
2850
|
-
/**
|
|
2851
|
-
* An array of Mixin objects to include when defining your component.
|
|
2852
|
-
*
|
|
2853
|
-
* @type {array}
|
|
2854
|
-
* @optional
|
|
2855
|
-
*/
|
|
2856
|
-
mixins: 'DEFINE_MANY',
|
|
2857
|
-
|
|
2858
|
-
/**
|
|
2859
|
-
* An object containing properties and methods that should be defined on
|
|
2860
|
-
* the component's constructor instead of its prototype (static methods).
|
|
2861
|
-
*
|
|
2862
|
-
* @type {object}
|
|
2863
|
-
* @optional
|
|
2864
|
-
*/
|
|
2865
|
-
statics: 'DEFINE_MANY',
|
|
2866
|
-
|
|
2867
|
-
/**
|
|
2868
|
-
* Definition of prop types for this component.
|
|
2869
|
-
*
|
|
2870
|
-
* @type {object}
|
|
2871
|
-
* @optional
|
|
2872
|
-
*/
|
|
2873
|
-
propTypes: 'DEFINE_MANY',
|
|
2874
|
-
|
|
2875
|
-
/**
|
|
2876
|
-
* Definition of context types for this component.
|
|
2877
|
-
*
|
|
2878
|
-
* @type {object}
|
|
2879
|
-
* @optional
|
|
2880
|
-
*/
|
|
2881
|
-
contextTypes: 'DEFINE_MANY',
|
|
2882
|
-
|
|
2883
|
-
/**
|
|
2884
|
-
* Definition of context types this component sets for its children.
|
|
2885
|
-
*
|
|
2886
|
-
* @type {object}
|
|
2887
|
-
* @optional
|
|
2888
|
-
*/
|
|
2889
|
-
childContextTypes: 'DEFINE_MANY',
|
|
2890
|
-
|
|
2891
|
-
// ==== Definition methods ====
|
|
2892
|
-
|
|
2893
|
-
/**
|
|
2894
|
-
* Invoked when the component is mounted. Values in the mapping will be set on
|
|
2895
|
-
* `this.props` if that prop is not specified (i.e. using an `in` check).
|
|
2896
|
-
*
|
|
2897
|
-
* This method is invoked before `getInitialState` and therefore cannot rely
|
|
2898
|
-
* on `this.state` or use `this.setState`.
|
|
2899
|
-
*
|
|
2900
|
-
* @return {object}
|
|
2901
|
-
* @optional
|
|
2902
|
-
*/
|
|
2903
|
-
getDefaultProps: 'DEFINE_MANY_MERGED',
|
|
2904
|
-
|
|
2905
|
-
/**
|
|
2906
|
-
* Invoked once before the component is mounted. The return value will be used
|
|
2907
|
-
* as the initial value of `this.state`.
|
|
2908
|
-
*
|
|
2909
|
-
* getInitialState: function() {
|
|
2910
|
-
* return {
|
|
2911
|
-
* isOn: false,
|
|
2912
|
-
* fooBaz: new BazFoo()
|
|
2913
|
-
* }
|
|
2914
|
-
* }
|
|
2915
|
-
*
|
|
2916
|
-
* @return {object}
|
|
2917
|
-
* @optional
|
|
2918
|
-
*/
|
|
2919
|
-
getInitialState: 'DEFINE_MANY_MERGED',
|
|
2920
|
-
|
|
2921
|
-
/**
|
|
2922
|
-
* @return {object}
|
|
2923
|
-
* @optional
|
|
2924
|
-
*/
|
|
2925
|
-
getChildContext: 'DEFINE_MANY_MERGED',
|
|
2926
|
-
|
|
2927
|
-
/**
|
|
2928
|
-
* Uses props from `this.props` and state from `this.state` to render the
|
|
2929
|
-
* structure of the component.
|
|
2930
|
-
*
|
|
2931
|
-
* No guarantees are made about when or how often this method is invoked, so
|
|
2932
|
-
* it must not have side effects.
|
|
2933
|
-
*
|
|
2934
|
-
* render: function() {
|
|
2935
|
-
* var name = this.props.name;
|
|
2936
|
-
* return <div>Hello, {name}!</div>;
|
|
2937
|
-
* }
|
|
2938
|
-
*
|
|
2939
|
-
* @return {ReactComponent}
|
|
2940
|
-
* @nosideeffects
|
|
2941
|
-
* @required
|
|
2942
|
-
*/
|
|
2943
|
-
render: 'DEFINE_ONCE',
|
|
2944
|
-
|
|
2945
|
-
// ==== Delegate methods ====
|
|
2946
|
-
|
|
2947
|
-
/**
|
|
2948
|
-
* Invoked when the component is initially created and about to be mounted.
|
|
2949
|
-
* This may have side effects, but any external subscriptions or data created
|
|
2950
|
-
* by this method must be cleaned up in `componentWillUnmount`.
|
|
2951
|
-
*
|
|
2952
|
-
* @optional
|
|
2953
|
-
*/
|
|
2954
|
-
componentWillMount: 'DEFINE_MANY',
|
|
2955
|
-
|
|
2956
|
-
/**
|
|
2957
|
-
* Invoked when the component has been mounted and has a DOM representation.
|
|
2958
|
-
* However, there is no guarantee that the DOM node is in the document.
|
|
2959
|
-
*
|
|
2960
|
-
* Use this as an opportunity to operate on the DOM when the component has
|
|
2961
|
-
* been mounted (initialized and rendered) for the first time.
|
|
2962
|
-
*
|
|
2963
|
-
* @param {DOMElement} rootNode DOM element representing the component.
|
|
2964
|
-
* @optional
|
|
2965
|
-
*/
|
|
2966
|
-
componentDidMount: 'DEFINE_MANY',
|
|
2967
|
-
|
|
2968
|
-
/**
|
|
2969
|
-
* Invoked before the component receives new props.
|
|
2970
|
-
*
|
|
2971
|
-
* Use this as an opportunity to react to a prop transition by updating the
|
|
2972
|
-
* state using `this.setState`. Current props are accessed via `this.props`.
|
|
2973
|
-
*
|
|
2974
|
-
* componentWillReceiveProps: function(nextProps, nextContext) {
|
|
2975
|
-
* this.setState({
|
|
2976
|
-
* likesIncreasing: nextProps.likeCount > this.props.likeCount
|
|
2977
|
-
* });
|
|
2978
|
-
* }
|
|
2979
|
-
*
|
|
2980
|
-
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
|
|
2981
|
-
* transition may cause a state change, but the opposite is not true. If you
|
|
2982
|
-
* need it, you are probably looking for `componentWillUpdate`.
|
|
2983
|
-
*
|
|
2984
|
-
* @param {object} nextProps
|
|
2985
|
-
* @optional
|
|
2986
|
-
*/
|
|
2987
|
-
componentWillReceiveProps: 'DEFINE_MANY',
|
|
2988
|
-
|
|
2989
|
-
/**
|
|
2990
|
-
* Invoked while deciding if the component should be updated as a result of
|
|
2991
|
-
* receiving new props, state and/or context.
|
|
2992
|
-
*
|
|
2993
|
-
* Use this as an opportunity to `return false` when you're certain that the
|
|
2994
|
-
* transition to the new props/state/context will not require a component
|
|
2995
|
-
* update.
|
|
2996
|
-
*
|
|
2997
|
-
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
|
|
2998
|
-
* return !equal(nextProps, this.props) ||
|
|
2999
|
-
* !equal(nextState, this.state) ||
|
|
3000
|
-
* !equal(nextContext, this.context);
|
|
3001
|
-
* }
|
|
3002
|
-
*
|
|
3003
|
-
* @param {object} nextProps
|
|
3004
|
-
* @param {?object} nextState
|
|
3005
|
-
* @param {?object} nextContext
|
|
3006
|
-
* @return {boolean} True if the component should update.
|
|
3007
|
-
* @optional
|
|
3008
|
-
*/
|
|
3009
|
-
shouldComponentUpdate: 'DEFINE_ONCE',
|
|
3010
|
-
|
|
3011
|
-
/**
|
|
3012
|
-
* Invoked when the component is about to update due to a transition from
|
|
3013
|
-
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
|
|
3014
|
-
* and `nextContext`.
|
|
3015
|
-
*
|
|
3016
|
-
* Use this as an opportunity to perform preparation before an update occurs.
|
|
3017
|
-
*
|
|
3018
|
-
* NOTE: You **cannot** use `this.setState()` in this method.
|
|
3019
|
-
*
|
|
3020
|
-
* @param {object} nextProps
|
|
3021
|
-
* @param {?object} nextState
|
|
3022
|
-
* @param {?object} nextContext
|
|
3023
|
-
* @param {ReactReconcileTransaction} transaction
|
|
3024
|
-
* @optional
|
|
3025
|
-
*/
|
|
3026
|
-
componentWillUpdate: 'DEFINE_MANY',
|
|
3027
|
-
|
|
3028
|
-
/**
|
|
3029
|
-
* Invoked when the component's DOM representation has been updated.
|
|
3030
|
-
*
|
|
3031
|
-
* Use this as an opportunity to operate on the DOM when the component has
|
|
3032
|
-
* been updated.
|
|
3033
|
-
*
|
|
3034
|
-
* @param {object} prevProps
|
|
3035
|
-
* @param {?object} prevState
|
|
3036
|
-
* @param {?object} prevContext
|
|
3037
|
-
* @param {DOMElement} rootNode DOM element representing the component.
|
|
3038
|
-
* @optional
|
|
3039
|
-
*/
|
|
3040
|
-
componentDidUpdate: 'DEFINE_MANY',
|
|
3041
|
-
|
|
3042
|
-
/**
|
|
3043
|
-
* Invoked when the component is about to be removed from its parent and have
|
|
3044
|
-
* its DOM representation destroyed.
|
|
3045
|
-
*
|
|
3046
|
-
* Use this as an opportunity to deallocate any external resources.
|
|
3047
|
-
*
|
|
3048
|
-
* NOTE: There is no `componentDidUnmount` since your component will have been
|
|
3049
|
-
* destroyed by that point.
|
|
3050
|
-
*
|
|
3051
|
-
* @optional
|
|
3052
|
-
*/
|
|
3053
|
-
componentWillUnmount: 'DEFINE_MANY',
|
|
3054
|
-
|
|
3055
|
-
// ==== Advanced methods ====
|
|
3056
|
-
|
|
3057
|
-
/**
|
|
3058
|
-
* Updates the component's currently mounted DOM representation.
|
|
3059
|
-
*
|
|
3060
|
-
* By default, this implements React's rendering and reconciliation algorithm.
|
|
3061
|
-
* Sophisticated clients may wish to override this.
|
|
3062
|
-
*
|
|
3063
|
-
* @param {ReactReconcileTransaction} transaction
|
|
3064
|
-
* @internal
|
|
3065
|
-
* @overridable
|
|
3066
|
-
*/
|
|
3067
|
-
updateComponent: 'OVERRIDE_BASE'
|
|
1906
|
+
var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
|
|
1907
|
+
var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
|
|
3068
1908
|
|
|
3069
|
-
|
|
1909
|
+
function getDeclarationErrorAddendum() {
|
|
1910
|
+
if (ReactCurrentOwner_1.current) {
|
|
1911
|
+
var name = getComponentName_1(ReactCurrentOwner_1.current);
|
|
1912
|
+
if (name) {
|
|
1913
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
return '';
|
|
1917
|
+
}
|
|
3070
1918
|
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
Constructor.childContextTypes = index({}, Constructor.childContextTypes, childContextTypes);
|
|
3096
|
-
},
|
|
3097
|
-
contextTypes: function (Constructor, contextTypes) {
|
|
3098
|
-
{
|
|
3099
|
-
validateTypeDef(Constructor, contextTypes, 'context');
|
|
3100
|
-
}
|
|
3101
|
-
Constructor.contextTypes = index({}, Constructor.contextTypes, contextTypes);
|
|
3102
|
-
},
|
|
3103
|
-
/**
|
|
3104
|
-
* Special case getDefaultProps which should move into statics but requires
|
|
3105
|
-
* automatic merging.
|
|
3106
|
-
*/
|
|
3107
|
-
getDefaultProps: function (Constructor, getDefaultProps) {
|
|
3108
|
-
if (Constructor.getDefaultProps) {
|
|
3109
|
-
Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
|
|
3110
|
-
} else {
|
|
3111
|
-
Constructor.getDefaultProps = getDefaultProps;
|
|
3112
|
-
}
|
|
3113
|
-
},
|
|
3114
|
-
propTypes: function (Constructor, propTypes) {
|
|
3115
|
-
{
|
|
3116
|
-
validateTypeDef(Constructor, propTypes, 'prop');
|
|
3117
|
-
}
|
|
3118
|
-
Constructor.propTypes = index({}, Constructor.propTypes, propTypes);
|
|
3119
|
-
},
|
|
3120
|
-
statics: function (Constructor, statics) {
|
|
3121
|
-
mixStaticSpecIntoComponent(Constructor, statics);
|
|
3122
|
-
},
|
|
3123
|
-
autobind: function () {} };
|
|
3124
|
-
|
|
3125
|
-
function validateTypeDef(Constructor, typeDef, location) {
|
|
3126
|
-
for (var propName in typeDef) {
|
|
3127
|
-
if (typeDef.hasOwnProperty(propName)) {
|
|
3128
|
-
// use a warning instead of an _invariant so components
|
|
3129
|
-
// don't show up in prod but only in true
|
|
3130
|
-
warning$3(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName);
|
|
3131
|
-
}
|
|
1919
|
+
function getSourceInfoErrorAddendum(elementProps) {
|
|
1920
|
+
if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
|
|
1921
|
+
var source = elementProps.__source;
|
|
1922
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
1923
|
+
var lineNumber = source.lineNumber;
|
|
1924
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
1925
|
+
}
|
|
1926
|
+
return '';
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
/**
|
|
1930
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1931
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
1932
|
+
* updates.
|
|
1933
|
+
*/
|
|
1934
|
+
var ownerHasKeyUseWarning = {};
|
|
1935
|
+
|
|
1936
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
1937
|
+
var info = getDeclarationErrorAddendum();
|
|
1938
|
+
|
|
1939
|
+
if (!info) {
|
|
1940
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1941
|
+
if (parentName) {
|
|
1942
|
+
info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
|
3132
1943
|
}
|
|
3133
1944
|
}
|
|
1945
|
+
return info;
|
|
1946
|
+
}
|
|
3134
1947
|
|
|
3135
|
-
|
|
3136
|
-
|
|
1948
|
+
/**
|
|
1949
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1950
|
+
* This element is in an array. The array could grow and shrink or be
|
|
1951
|
+
* reordered. All children that haven't already been validated are required to
|
|
1952
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1953
|
+
* will only be shown once.
|
|
1954
|
+
*
|
|
1955
|
+
* @internal
|
|
1956
|
+
* @param {ReactElement} element Element that requires a key.
|
|
1957
|
+
* @param {*} parentType element's parent's type.
|
|
1958
|
+
*/
|
|
1959
|
+
function validateExplicitKey(element, parentType) {
|
|
1960
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
1961
|
+
return;
|
|
1962
|
+
}
|
|
1963
|
+
element._store.validated = true;
|
|
3137
1964
|
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
1965
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1966
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1967
|
+
return;
|
|
1968
|
+
}
|
|
1969
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
3142
1970
|
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
1971
|
+
// Usually the current owner is the offender, but if it accepts children as a
|
|
1972
|
+
// property, it may be the creator of the child that's responsible for
|
|
1973
|
+
// assigning it a key.
|
|
1974
|
+
var childOwner = '';
|
|
1975
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner_1.current) {
|
|
1976
|
+
// Give the component that originally created this child.
|
|
1977
|
+
childOwner = ' It was passed a child from ' + getComponentName_1(element._owner) + '.';
|
|
3147
1978
|
}
|
|
3148
1979
|
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
* specification keys when building React classes.
|
|
3152
|
-
*/
|
|
3153
|
-
function mixSpecIntoComponent(Constructor, spec) {
|
|
3154
|
-
if (!spec) {
|
|
3155
|
-
{
|
|
3156
|
-
var typeofSpec = typeof spec;
|
|
3157
|
-
var isMixinValid = typeofSpec === 'object' && spec !== null;
|
|
1980
|
+
warning$1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getCurrentStackAddendum$1(element));
|
|
1981
|
+
}
|
|
3158
1982
|
|
|
3159
|
-
|
|
1983
|
+
/**
|
|
1984
|
+
* Ensure that every element either is passed in a static location, in an
|
|
1985
|
+
* array with an explicit keys property defined, or in an object literal
|
|
1986
|
+
* with valid key property.
|
|
1987
|
+
*
|
|
1988
|
+
* @internal
|
|
1989
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
1990
|
+
* @param {*} parentType node's parent's type.
|
|
1991
|
+
*/
|
|
1992
|
+
function validateChildKeys(node, parentType) {
|
|
1993
|
+
if (typeof node !== 'object') {
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
if (Array.isArray(node)) {
|
|
1997
|
+
for (var i = 0; i < node.length; i++) {
|
|
1998
|
+
var child = node[i];
|
|
1999
|
+
if (ReactElement_1.isValidElement(child)) {
|
|
2000
|
+
validateExplicitKey(child, parentType);
|
|
3160
2001
|
}
|
|
3161
|
-
|
|
3162
|
-
return;
|
|
3163
2002
|
}
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
var proto = Constructor.prototype;
|
|
3169
|
-
var autoBindPairs = proto.__reactAutoBindPairs;
|
|
3170
|
-
|
|
3171
|
-
// By handling mixins before any other properties, we ensure the same
|
|
3172
|
-
// chaining order is applied to methods with DEFINE_MANY policy, whether
|
|
3173
|
-
// mixins are listed before or after these methods in the spec.
|
|
3174
|
-
if (spec.hasOwnProperty(MIXINS_KEY)) {
|
|
3175
|
-
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
|
|
2003
|
+
} else if (ReactElement_1.isValidElement(node)) {
|
|
2004
|
+
// This element was passed in a valid location.
|
|
2005
|
+
if (node._store) {
|
|
2006
|
+
node._store.validated = true;
|
|
3176
2007
|
}
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
var property = spec[name];
|
|
3189
|
-
var isAlreadyDefined = proto.hasOwnProperty(name);
|
|
3190
|
-
validateMethodOverride(isAlreadyDefined, name);
|
|
3191
|
-
|
|
3192
|
-
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
|
|
3193
|
-
RESERVED_SPEC_KEYS[name](Constructor, property);
|
|
3194
|
-
} else {
|
|
3195
|
-
// Setup methods on prototype:
|
|
3196
|
-
// The following member methods should not be automatically bound:
|
|
3197
|
-
// 1. Expected ReactClass methods (in the "interface").
|
|
3198
|
-
// 2. Overridden methods (that were mixed in).
|
|
3199
|
-
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
|
|
3200
|
-
var isFunction = typeof property === 'function';
|
|
3201
|
-
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
|
|
3202
|
-
|
|
3203
|
-
if (shouldAutoBind) {
|
|
3204
|
-
autoBindPairs.push(name, property);
|
|
3205
|
-
proto[name] = property;
|
|
3206
|
-
} else {
|
|
3207
|
-
if (isAlreadyDefined) {
|
|
3208
|
-
var specPolicy = ReactClassInterface[name];
|
|
3209
|
-
|
|
3210
|
-
// These cases should already be caught by validateMethodOverride.
|
|
3211
|
-
invariant_1(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY'), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name);
|
|
3212
|
-
|
|
3213
|
-
// For methods which are defined more than once, call the existing
|
|
3214
|
-
// methods before calling the new property, merging if appropriate.
|
|
3215
|
-
if (specPolicy === 'DEFINE_MANY_MERGED') {
|
|
3216
|
-
proto[name] = createMergedResultFunction(proto[name], property);
|
|
3217
|
-
} else if (specPolicy === 'DEFINE_MANY') {
|
|
3218
|
-
proto[name] = createChainedFunction(proto[name], property);
|
|
3219
|
-
}
|
|
3220
|
-
} else {
|
|
3221
|
-
proto[name] = property;
|
|
3222
|
-
{
|
|
3223
|
-
// Add verbose displayName to the function, which helps when looking
|
|
3224
|
-
// at profiling tools.
|
|
3225
|
-
if (typeof property === 'function' && spec.displayName) {
|
|
3226
|
-
proto[name].displayName = spec.displayName + '_' + name;
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
2008
|
+
} else if (node) {
|
|
2009
|
+
var iteratorFn = ITERATOR_SYMBOL$1 && node[ITERATOR_SYMBOL$1] || node[FAUX_ITERATOR_SYMBOL$1];
|
|
2010
|
+
if (typeof iteratorFn === 'function') {
|
|
2011
|
+
// Entry iterators used to provide implicit keys,
|
|
2012
|
+
// but now we print a separate warning for them later.
|
|
2013
|
+
if (iteratorFn !== node.entries) {
|
|
2014
|
+
var iterator = iteratorFn.call(node);
|
|
2015
|
+
var step;
|
|
2016
|
+
while (!(step = iterator.next()).done) {
|
|
2017
|
+
if (ReactElement_1.isValidElement(step.value)) {
|
|
2018
|
+
validateExplicitKey(step.value, parentType);
|
|
3229
2019
|
}
|
|
3230
2020
|
}
|
|
3231
2021
|
}
|
|
3232
2022
|
}
|
|
3233
2023
|
}
|
|
2024
|
+
}
|
|
3234
2025
|
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
var isReserved = name in RESERVED_SPEC_KEYS;
|
|
3246
|
-
invariant_1(!isReserved, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name);
|
|
3247
|
-
|
|
3248
|
-
var isInherited = name in Constructor;
|
|
3249
|
-
invariant_1(!isInherited, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name);
|
|
3250
|
-
Constructor[name] = property;
|
|
3251
|
-
}
|
|
2026
|
+
/**
|
|
2027
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
2028
|
+
* provided by the type.
|
|
2029
|
+
*
|
|
2030
|
+
* @param {ReactElement} element
|
|
2031
|
+
*/
|
|
2032
|
+
function validatePropTypes(element) {
|
|
2033
|
+
var componentClass = element.type;
|
|
2034
|
+
if (typeof componentClass !== 'function') {
|
|
2035
|
+
return;
|
|
3252
2036
|
}
|
|
2037
|
+
var name = componentClass.displayName || componentClass.name;
|
|
3253
2038
|
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
*/
|
|
3261
|
-
function mergeIntoWithNoDuplicateKeys(one, two) {
|
|
3262
|
-
invariant_1(one && two && typeof one === 'object' && typeof two === 'object', 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.');
|
|
2039
|
+
// ReactNative `View.propTypes` have been deprecated in favor of `ViewPropTypes`.
|
|
2040
|
+
// In their place a temporary getter has been added with a deprecated warning message.
|
|
2041
|
+
// Avoid triggering that warning during validation using the temporary workaround,
|
|
2042
|
+
// __propTypesSecretDontUseThesePlease.
|
|
2043
|
+
// TODO (bvaughn) Revert this particular change any time after April 1 ReactNative tag.
|
|
2044
|
+
var propTypes = typeof componentClass.__propTypesSecretDontUseThesePlease === 'object' ? componentClass.__propTypesSecretDontUseThesePlease : componentClass.propTypes;
|
|
3263
2045
|
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
}
|
|
3270
|
-
return one;
|
|
2046
|
+
if (propTypes) {
|
|
2047
|
+
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
2048
|
+
}
|
|
2049
|
+
if (typeof componentClass.getDefaultProps === 'function') {
|
|
2050
|
+
warning$1(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
3271
2051
|
}
|
|
2052
|
+
}
|
|
3272
2053
|
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
return function mergedResult() {
|
|
3283
|
-
var a = one.apply(this, arguments);
|
|
3284
|
-
var b = two.apply(this, arguments);
|
|
3285
|
-
if (a == null) {
|
|
3286
|
-
return b;
|
|
3287
|
-
} else if (b == null) {
|
|
3288
|
-
return a;
|
|
2054
|
+
var ReactElementValidator$1 = {
|
|
2055
|
+
createElement: function (type, props, children) {
|
|
2056
|
+
var validType = typeof type === 'string' || typeof type === 'function';
|
|
2057
|
+
// We warn in this case but don't throw. We expect the element creation to
|
|
2058
|
+
// succeed and there will likely be errors in render.
|
|
2059
|
+
if (!validType) {
|
|
2060
|
+
var info = '';
|
|
2061
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2062
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
|
|
3289
2063
|
}
|
|
3290
|
-
var c = {};
|
|
3291
|
-
mergeIntoWithNoDuplicateKeys(c, a);
|
|
3292
|
-
mergeIntoWithNoDuplicateKeys(c, b);
|
|
3293
|
-
return c;
|
|
3294
|
-
};
|
|
3295
|
-
}
|
|
3296
2064
|
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
* @private
|
|
3304
|
-
*/
|
|
3305
|
-
function createChainedFunction(one, two) {
|
|
3306
|
-
return function chainedFunction() {
|
|
3307
|
-
one.apply(this, arguments);
|
|
3308
|
-
two.apply(this, arguments);
|
|
3309
|
-
};
|
|
3310
|
-
}
|
|
2065
|
+
var sourceInfo = getSourceInfoErrorAddendum(props);
|
|
2066
|
+
if (sourceInfo) {
|
|
2067
|
+
info += sourceInfo;
|
|
2068
|
+
} else {
|
|
2069
|
+
info += getDeclarationErrorAddendum();
|
|
2070
|
+
}
|
|
3311
2071
|
|
|
3312
|
-
|
|
3313
|
-
* Binds a method to the component.
|
|
3314
|
-
*
|
|
3315
|
-
* @param {object} component Component whose method is going to be bound.
|
|
3316
|
-
* @param {function} method Method to be bound.
|
|
3317
|
-
* @return {function} The bound method.
|
|
3318
|
-
*/
|
|
3319
|
-
function bindAutoBindMethod(component, method) {
|
|
3320
|
-
var boundMethod = method.bind(component);
|
|
3321
|
-
{
|
|
3322
|
-
boundMethod.__reactBoundContext = component;
|
|
3323
|
-
boundMethod.__reactBoundMethod = method;
|
|
3324
|
-
boundMethod.__reactBoundArguments = null;
|
|
3325
|
-
var componentName = component.constructor.displayName;
|
|
3326
|
-
var _bind = boundMethod.bind;
|
|
3327
|
-
boundMethod.bind = function (newThis) {
|
|
3328
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
3329
|
-
args[_key - 1] = arguments[_key];
|
|
3330
|
-
}
|
|
2072
|
+
info += getCurrentStackAddendum$1();
|
|
3331
2073
|
|
|
3332
|
-
|
|
3333
|
-
// ignore the value of "this" that the user is trying to use, so
|
|
3334
|
-
// let's warn.
|
|
3335
|
-
if (newThis !== component && newThis !== null) {
|
|
3336
|
-
warning$3(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName);
|
|
3337
|
-
} else if (!args.length) {
|
|
3338
|
-
warning$3(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName);
|
|
3339
|
-
return boundMethod;
|
|
3340
|
-
}
|
|
3341
|
-
var reboundMethod = _bind.apply(boundMethod, arguments);
|
|
3342
|
-
reboundMethod.__reactBoundContext = component;
|
|
3343
|
-
reboundMethod.__reactBoundMethod = method;
|
|
3344
|
-
reboundMethod.__reactBoundArguments = args;
|
|
3345
|
-
return reboundMethod;
|
|
3346
|
-
};
|
|
2074
|
+
warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info);
|
|
3347
2075
|
}
|
|
3348
|
-
return boundMethod;
|
|
3349
|
-
}
|
|
3350
2076
|
|
|
3351
|
-
|
|
3352
|
-
* Binds all auto-bound methods in a component.
|
|
3353
|
-
*
|
|
3354
|
-
* @param {object} component Component whose method is going to be bound.
|
|
3355
|
-
*/
|
|
3356
|
-
function bindAutoBindMethods(component) {
|
|
3357
|
-
var pairs = component.__reactAutoBindPairs;
|
|
3358
|
-
for (var i = 0; i < pairs.length; i += 2) {
|
|
3359
|
-
var autoBindKey = pairs[i];
|
|
3360
|
-
var method = pairs[i + 1];
|
|
3361
|
-
component[autoBindKey] = bindAutoBindMethod(component, method);
|
|
3362
|
-
}
|
|
3363
|
-
}
|
|
2077
|
+
var element = ReactElement_1.createElement.apply(this, arguments);
|
|
3364
2078
|
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
componentWillUnmount: function () {
|
|
3370
|
-
this.__isMounted = false;
|
|
2079
|
+
// The result can be nullish if a mock or a custom function is used.
|
|
2080
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2081
|
+
if (element == null) {
|
|
2082
|
+
return element;
|
|
3371
2083
|
}
|
|
3372
|
-
};
|
|
3373
2084
|
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
* therefore not already part of the modern ReactComponent.
|
|
3377
|
-
*/
|
|
3378
|
-
var ReactClassMixin = {
|
|
3379
|
-
|
|
3380
|
-
/**
|
|
3381
|
-
* TODO: This will be deprecated because state should always keep a consistent
|
|
3382
|
-
* type signature and the only use case for this, is to avoid that.
|
|
3383
|
-
*/
|
|
3384
|
-
replaceState: function (newState, callback) {
|
|
3385
|
-
this.updater.enqueueReplaceState(this, newState, callback);
|
|
3386
|
-
},
|
|
3387
|
-
|
|
3388
|
-
/**
|
|
3389
|
-
* Checks whether or not this composite component is mounted.
|
|
3390
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
3391
|
-
* @protected
|
|
3392
|
-
* @final
|
|
3393
|
-
*/
|
|
3394
|
-
isMounted: function () {
|
|
3395
|
-
{
|
|
3396
|
-
warning$3(this.__didWarnIsMounted, '%s: isMounted is deprecated. Instead, make sure to clean up ' + 'subscriptions and pending requests in componentWillUnmount to ' + 'prevent memory leaks.', this.constructor && this.constructor.displayName || this.name || 'Component');
|
|
3397
|
-
this.__didWarnIsMounted = true;
|
|
3398
|
-
}
|
|
3399
|
-
return !!this.__isMounted;
|
|
2085
|
+
{
|
|
2086
|
+
ReactDebugCurrentFrame.element = element;
|
|
3400
2087
|
}
|
|
3401
|
-
};
|
|
3402
|
-
|
|
3403
|
-
var ReactClassComponent = function () {};
|
|
3404
|
-
index(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
|
|
3405
|
-
|
|
3406
|
-
/**
|
|
3407
|
-
* Creates a composite component class given a class specification.
|
|
3408
|
-
* See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
|
|
3409
|
-
*
|
|
3410
|
-
* @param {object} spec Class specification (which must define `render`).
|
|
3411
|
-
* @return {function} Component constructor function.
|
|
3412
|
-
* @public
|
|
3413
|
-
*/
|
|
3414
|
-
function createClass(spec) {
|
|
3415
|
-
// To keep our warnings more understandable, we'll use a little hack here to
|
|
3416
|
-
// ensure that Constructor.name !== 'Constructor'. This makes sure we don't
|
|
3417
|
-
// unnecessarily identify a class without displayName as 'Constructor'.
|
|
3418
|
-
var Constructor = identity(function (props, context, updater) {
|
|
3419
|
-
// This constructor gets overridden by mocks. The argument is used
|
|
3420
|
-
// by mocks to assert on what gets mounted.
|
|
3421
|
-
|
|
3422
|
-
{
|
|
3423
|
-
warning$3(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory');
|
|
3424
|
-
}
|
|
3425
|
-
|
|
3426
|
-
// Wire up auto-binding
|
|
3427
|
-
if (this.__reactAutoBindPairs.length) {
|
|
3428
|
-
bindAutoBindMethods(this);
|
|
3429
|
-
}
|
|
3430
|
-
|
|
3431
|
-
this.props = props;
|
|
3432
|
-
this.context = context;
|
|
3433
|
-
this.refs = emptyObject_1;
|
|
3434
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
3435
2088
|
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
{
|
|
3443
|
-
|
|
3444
|
-
if (initialState === undefined && this.getInitialState._isMockFunction) {
|
|
3445
|
-
// This is probably bad practice. Consider warning here and
|
|
3446
|
-
// deprecating this convenience.
|
|
3447
|
-
initialState = null;
|
|
3448
|
-
}
|
|
2089
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
|
2090
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2091
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
2092
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2093
|
+
// fixed, the key warnings will appear.)
|
|
2094
|
+
if (validType) {
|
|
2095
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
2096
|
+
validateChildKeys(arguments[i], type);
|
|
3449
2097
|
}
|
|
3450
|
-
|
|
2098
|
+
}
|
|
3451
2099
|
|
|
3452
|
-
|
|
3453
|
-
});
|
|
3454
|
-
Constructor.prototype = new ReactClassComponent();
|
|
3455
|
-
Constructor.prototype.constructor = Constructor;
|
|
3456
|
-
Constructor.prototype.__reactAutoBindPairs = [];
|
|
2100
|
+
validatePropTypes(element);
|
|
3457
2101
|
|
|
3458
|
-
|
|
2102
|
+
{
|
|
2103
|
+
ReactDebugCurrentFrame.element = null;
|
|
2104
|
+
}
|
|
3459
2105
|
|
|
3460
|
-
|
|
3461
|
-
|
|
2106
|
+
return element;
|
|
2107
|
+
},
|
|
3462
2108
|
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
2109
|
+
createFactory: function (type) {
|
|
2110
|
+
var validatedFactory = ReactElementValidator$1.createElement.bind(null, type);
|
|
2111
|
+
// Legacy hook TODO: Warn if this is accessed
|
|
2112
|
+
validatedFactory.type = type;
|
|
3467
2113
|
|
|
3468
2114
|
{
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
}
|
|
2115
|
+
Object.defineProperty(validatedFactory, 'type', {
|
|
2116
|
+
enumerable: false,
|
|
2117
|
+
get: function () {
|
|
2118
|
+
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2119
|
+
Object.defineProperty(this, 'type', {
|
|
2120
|
+
value: type
|
|
2121
|
+
});
|
|
2122
|
+
return type;
|
|
2123
|
+
}
|
|
2124
|
+
});
|
|
3479
2125
|
}
|
|
3480
2126
|
|
|
3481
|
-
|
|
2127
|
+
return validatedFactory;
|
|
2128
|
+
},
|
|
3482
2129
|
|
|
2130
|
+
cloneElement: function (element, props, children) {
|
|
2131
|
+
var newElement = ReactElement_1.cloneElement.apply(this, arguments);
|
|
3483
2132
|
{
|
|
3484
|
-
|
|
3485
|
-
warning$3(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component');
|
|
2133
|
+
ReactDebugCurrentFrame.element = newElement;
|
|
3486
2134
|
}
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
for (var methodName in ReactClassInterface) {
|
|
3490
|
-
if (!Constructor.prototype[methodName]) {
|
|
3491
|
-
Constructor.prototype[methodName] = null;
|
|
3492
|
-
}
|
|
2135
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
2136
|
+
validateChildKeys(arguments[i], newElement.type);
|
|
3493
2137
|
}
|
|
3494
|
-
|
|
3495
|
-
|
|
2138
|
+
validatePropTypes(newElement);
|
|
2139
|
+
{
|
|
2140
|
+
ReactDebugCurrentFrame.element = null;
|
|
2141
|
+
}
|
|
2142
|
+
return newElement;
|
|
3496
2143
|
}
|
|
2144
|
+
};
|
|
3497
2145
|
|
|
3498
|
-
|
|
3499
|
-
}
|
|
3500
|
-
|
|
3501
|
-
var factory_1 = factory$3;
|
|
3502
|
-
|
|
3503
|
-
var Component = ReactBaseClasses.Component;
|
|
3504
|
-
|
|
3505
|
-
var isValidElement$1 = ReactElement_1.isValidElement;
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
var createClass = factory_1(Component, isValidElement$1, ReactNoopUpdateQueue_1);
|
|
2146
|
+
var ReactElementValidator_1 = ReactElementValidator$1;
|
|
3511
2147
|
|
|
3512
2148
|
var createElement = ReactElement_1.createElement;
|
|
3513
2149
|
var createFactory = ReactElement_1.createFactory;
|
|
3514
2150
|
var cloneElement = ReactElement_1.cloneElement;
|
|
3515
2151
|
|
|
3516
2152
|
{
|
|
3517
|
-
var warning = warning_1;
|
|
3518
|
-
var canDefineProperty = canDefineProperty_1;
|
|
3519
2153
|
var ReactElementValidator = ReactElementValidator_1;
|
|
3520
2154
|
createElement = ReactElementValidator.createElement;
|
|
3521
2155
|
createFactory = ReactElementValidator.createFactory;
|
|
3522
2156
|
cloneElement = ReactElementValidator.cloneElement;
|
|
3523
2157
|
}
|
|
3524
2158
|
|
|
3525
|
-
var createMixin = function (mixin) {
|
|
3526
|
-
return mixin;
|
|
3527
|
-
};
|
|
3528
|
-
|
|
3529
2159
|
var React = {
|
|
3530
|
-
// Modern
|
|
3531
|
-
|
|
3532
2160
|
Children: {
|
|
3533
2161
|
map: ReactChildren_1.map,
|
|
3534
2162
|
forEach: ReactChildren_1.forEach,
|
|
@@ -3544,19 +2172,7 @@ var React = {
|
|
|
3544
2172
|
cloneElement: cloneElement,
|
|
3545
2173
|
isValidElement: ReactElement_1.isValidElement,
|
|
3546
2174
|
|
|
3547
|
-
// TODO (bvaughn) Remove these getters in 16.0.0-alpha.10
|
|
3548
|
-
PropTypes: ReactPropTypes,
|
|
3549
|
-
checkPropTypes: checkPropTypes$1,
|
|
3550
|
-
createClass: createClass,
|
|
3551
|
-
|
|
3552
|
-
// Classic
|
|
3553
|
-
|
|
3554
2175
|
createFactory: createFactory,
|
|
3555
|
-
createMixin: createMixin,
|
|
3556
|
-
|
|
3557
|
-
// This looks DOM specific but these are actually isomorphic helpers
|
|
3558
|
-
// since they are just generating DOM strings.
|
|
3559
|
-
DOM: ReactDOMFactories_1,
|
|
3560
2176
|
|
|
3561
2177
|
version: ReactVersion,
|
|
3562
2178
|
|
|
@@ -3571,44 +2187,6 @@ var React = {
|
|
|
3571
2187
|
ReactComponentTreeHook: ReactComponentTreeHook_1,
|
|
3572
2188
|
ReactDebugCurrentFrame: ReactDebugCurrentFrame_1
|
|
3573
2189
|
});
|
|
3574
|
-
|
|
3575
|
-
var warnedForCheckPropTypes = false;
|
|
3576
|
-
var warnedForCreateMixin = false;
|
|
3577
|
-
var warnedForCreateClass = false;
|
|
3578
|
-
var warnedForPropTypes = false;
|
|
3579
|
-
|
|
3580
|
-
React.createMixin = function (mixin) {
|
|
3581
|
-
warning(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. You ' + 'can use this mixin directly instead.');
|
|
3582
|
-
warnedForCreateMixin = true;
|
|
3583
|
-
return mixin;
|
|
3584
|
-
};
|
|
3585
|
-
|
|
3586
|
-
// TODO (bvaughn) Remove both of these deprecation warnings in 16.0.0-alpha.10
|
|
3587
|
-
if (canDefineProperty) {
|
|
3588
|
-
Object.defineProperty(React, 'checkPropTypes', {
|
|
3589
|
-
get: function () {
|
|
3590
|
-
warning(warnedForCheckPropTypes, 'checkPropTypes has been moved to a separate package. ' + 'Accessing React.checkPropTypes is no longer supported ' + 'and will be removed completely in React 16. ' + 'Use the prop-types package on npm instead. ' + '(https://fb.me/migrating-from-react-proptypes)');
|
|
3591
|
-
warnedForCheckPropTypes = true;
|
|
3592
|
-
return ReactPropTypes;
|
|
3593
|
-
}
|
|
3594
|
-
});
|
|
3595
|
-
|
|
3596
|
-
Object.defineProperty(React, 'createClass', {
|
|
3597
|
-
get: function () {
|
|
3598
|
-
warning(warnedForCreateClass, 'React.createClass is no longer supported. Use a plain JavaScript ' + "class instead. If you're not yet ready to migrate, " + 'create-react-class is available on npm as a drop-in replacement. ' + '(https://fb.me/migrating-from-react-create-class)');
|
|
3599
|
-
warnedForCreateClass = true;
|
|
3600
|
-
return createClass;
|
|
3601
|
-
}
|
|
3602
|
-
});
|
|
3603
|
-
|
|
3604
|
-
Object.defineProperty(React, 'PropTypes', {
|
|
3605
|
-
get: function () {
|
|
3606
|
-
warning(warnedForPropTypes, 'PropTypes has been moved to a separate package. ' + 'Accessing React.PropTypes is no longer supported ' + 'and will be removed completely in React 16. ' + 'Use the prop-types package on npm instead. ' + '(https://fb.me/migrating-from-react-proptypes)');
|
|
3607
|
-
warnedForPropTypes = true;
|
|
3608
|
-
return ReactPropTypes;
|
|
3609
|
-
}
|
|
3610
|
-
});
|
|
3611
|
-
}
|
|
3612
2190
|
}
|
|
3613
2191
|
|
|
3614
2192
|
var React_1 = React;
|