react 16.0.0-alpha.13 → 16.0.0-beta.1
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 +745 -918
- package/cjs/react.production.min.js +1 -1
- package/package.json +1 -1
- package/umd/react.development.js +755 -935
- package/umd/react.production.min.js +2 -2
|
@@ -1 +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=
|
|
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=g,this.updater=n||R}function r(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||R}function o(){}function u(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||R}function l(e){return void 0!==e.ref}function i(e){return void 0!==e.key}function c(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}function a(e){return(""+e).replace(B,"$&/")}function f(e,t,n,r){if(Y.length){var o=Y.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=r,o.count=0,o}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function p(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,Y.length<W&&Y.push(e)}function s(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===D)return n(r,e,""===t?K+d(e,0):t),1;var u,l,i=0,c=""===t?K:t+M;if(Array.isArray(e))for(var a=0;a<e.length;a++)u=e[a],l=c+d(u,a),i+=s(u,l,n,r);else{var f=T&&e[T]||e[L];if("function"==typeof f)for(var p,y=f.call(e),m=0;!(p=y.next()).done;)u=p.value,l=c+d(u,m++),i+=s(u,l,n,r);else if("object"===o){var h=""+e;C("31","[object Object]"===h?"object with keys {"+Object.keys(e).join(", ")+"}":h,"")}}return i}function y(e,t,n){return null==e?0:s(e,"",t,n)}function d(e,t){return"object"==typeof e&&null!==e&&null!=e.key?c(e.key):t.toString(36)}function m(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=f(null,null,t,n);y(e,m,r),p(r)}function v(e,t,n){var r=e.result,o=e.keyPrefix,u=e.func,l=e.context,i=u.call(l,t,e.count++);Array.isArray(i)?b(i,r,n,j.thatReturnsArgument):null!=i&&(N.isValidElement(i)&&(i=N.cloneAndReplaceKey(i,o+(!i.key||t&&t.key===i.key?"":a(i.key)+"/")+n)),r.push(i))}function b(e,t,n,r,o){var u="";null!=n&&(u=a(n)+"/");var l=f(t,u,r,o);y(e,v,l),p(l)}function _(e,t,n){if(null==e)return e;var r=[];return b(e,r,null,t,n),r}function E(e,t){return y(e,j.thatReturnsNull,null)}function S(e){var t=[];return b(e,t,null,j.thatReturnsArgument),t}function k(e){return N.isValidElement(e)||C("143"),e}var A=require("object-assign"),g=require("fbjs/lib/emptyObject");require("fbjs/lib/invariant");var j=require("fbjs/lib/emptyFunction"),C=e,P={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")}},R=P;n.prototype.isReactComponent={},n.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&C("85"),this.updater.enqueueSetState(this,e,t,"setState")},n.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},o.prototype=n.prototype;var x=r.prototype=new o;x.constructor=r,A(x,n.prototype),x.isPureReactComponent=!0;var w=u.prototype=new o;w.constructor=u,A(w,n.prototype),w.unstable_isAsyncReactComponent=!0,w.render=function(){return this.props.children};var O={Component:n,PureComponent:r,AsyncComponent:u},q={current:null},U=q,$=Object.prototype.hasOwnProperty,F="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,V={key:!0,ref:!0,__self:!0,__source:!0},I=function(e,t,n,r,o,u,l){return{$$typeof:F,type:e,key:t,ref:n,props:l,_owner:u}};I.createElement=function(e,t,n){var r,o={},u=null,c=null,a=null,f=null;if(null!=t){l(t)&&(c=t.ref),i(t)&&(u=""+t.key),a=void 0===t.__self?null:t.__self,f=void 0===t.__source?null:t.__source;for(r in t)$.call(t,r)&&!V.hasOwnProperty(r)&&(o[r]=t[r])}var p=arguments.length-2;if(1===p)o.children=n;else if(p>1){for(var s=Array(p),y=0;y<p;y++)s[y]=arguments[y+2];o.children=s}if(e&&e.defaultProps){var d=e.defaultProps;for(r in d)void 0===o[r]&&(o[r]=d[r])}return I(e,u,c,a,f,U.current,o)},I.createFactory=function(e){var t=I.createElement.bind(null,e);return t.type=e,t},I.cloneAndReplaceKey=function(e,t){return I(e.type,t,e.ref,e._self,e._source,e._owner,e.props)},I.cloneElement=function(e,t,n){var r,o=A({},e.props),u=e.key,c=e.ref,a=e._self,f=e._source,p=e._owner;if(null!=t){l(t)&&(c=t.ref,p=U.current),i(t)&&(u=""+t.key);var s;e.type&&e.type.defaultProps&&(s=e.type.defaultProps);for(r in t)$.call(t,r)&&!V.hasOwnProperty(r)&&(void 0===t[r]&&void 0!==s?o[r]=s[r]:o[r]=t[r])}var y=arguments.length-2;if(1===y)o.children=n;else if(y>1){for(var d=Array(y),m=0;m<y;m++)d[m]=arguments[m+2];o.children=d}return I(e.type,u,c,a,f,p,o)},I.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===F};var N=I,T="function"==typeof Symbol&&Symbol.iterator,L="@@iterator",D="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,K=".",M=":",B=/\/+/g,W=10,Y=[],z={forEach:h,map:_,count:E,toArray:S},G=z,H="16.0.0-beta.1",J=k,Q=N.createElement,X=N.createFactory,Z=N.cloneElement,ee={Children:{map:G.map,forEach:G.forEach,count:G.count,toArray:G.toArray,only:J},Component:O.Component,PureComponent:O.PureComponent,unstable_AsyncComponent:O.AsyncComponent,createElement:Q,cloneElement:Z,isValidElement:N.isValidElement,createFactory:X,version:H,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:U}},te=ee;module.exports=te;
|
package/package.json
CHANGED
package/umd/react.development.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react.development.js v16.0.0-
|
|
2
|
+
* react.development.js v16.0.0-beta.1
|
|
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 = emptyFunction_1;
|
|
157
|
+
var warning$1 = emptyFunction_1;
|
|
158
158
|
|
|
159
159
|
{
|
|
160
160
|
(function () {
|
|
@@ -178,7 +178,7 @@ var warning = emptyFunction_1;
|
|
|
178
178
|
} catch (x) {}
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
warning = function warning(condition, format) {
|
|
181
|
+
warning$1 = 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,12 +198,16 @@ var warning = emptyFunction_1;
|
|
|
198
198
|
})();
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
var warning_1 = warning;
|
|
201
|
+
var warning_1 = warning$1;
|
|
202
|
+
|
|
203
|
+
{
|
|
204
|
+
var warning = warning_1;
|
|
205
|
+
}
|
|
202
206
|
|
|
203
207
|
function warnNoop(publicInstance, callerName) {
|
|
204
208
|
{
|
|
205
209
|
var constructor = publicInstance.constructor;
|
|
206
|
-
|
|
210
|
+
warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass');
|
|
207
211
|
}
|
|
208
212
|
}
|
|
209
213
|
|
|
@@ -515,112 +519,37 @@ function ReactPureComponent(props, context, updater) {
|
|
|
515
519
|
|
|
516
520
|
function ComponentDummy() {}
|
|
517
521
|
ComponentDummy.prototype = ReactComponent.prototype;
|
|
518
|
-
ReactPureComponent.prototype = new ComponentDummy();
|
|
519
|
-
|
|
522
|
+
var pureComponentPrototype = ReactPureComponent.prototype = new ComponentDummy();
|
|
523
|
+
pureComponentPrototype.constructor = ReactPureComponent;
|
|
520
524
|
// Avoid an extra prototype jump for these methods.
|
|
521
|
-
index(
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
var ReactBaseClasses = {
|
|
525
|
-
Component: ReactComponent,
|
|
526
|
-
PureComponent: ReactPureComponent
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Static poolers. Several custom versions for each potential number of
|
|
531
|
-
* arguments. A completely generic pooler is easy to implement, but would
|
|
532
|
-
* require accessing the `arguments` object. In each of these, `this` refers to
|
|
533
|
-
* the Class itself, not an instance. If any others are needed, simply add them
|
|
534
|
-
* here, or in their own files.
|
|
535
|
-
*/
|
|
536
|
-
var oneArgumentPooler = function (copyFieldsFrom) {
|
|
537
|
-
var Klass = this;
|
|
538
|
-
if (Klass.instancePool.length) {
|
|
539
|
-
var instance = Klass.instancePool.pop();
|
|
540
|
-
Klass.call(instance, copyFieldsFrom);
|
|
541
|
-
return instance;
|
|
542
|
-
} else {
|
|
543
|
-
return new Klass(copyFieldsFrom);
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
var twoArgumentPooler$1 = function (a1, a2) {
|
|
548
|
-
var Klass = this;
|
|
549
|
-
if (Klass.instancePool.length) {
|
|
550
|
-
var instance = Klass.instancePool.pop();
|
|
551
|
-
Klass.call(instance, a1, a2);
|
|
552
|
-
return instance;
|
|
553
|
-
} else {
|
|
554
|
-
return new Klass(a1, a2);
|
|
555
|
-
}
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
var threeArgumentPooler = function (a1, a2, a3) {
|
|
559
|
-
var Klass = this;
|
|
560
|
-
if (Klass.instancePool.length) {
|
|
561
|
-
var instance = Klass.instancePool.pop();
|
|
562
|
-
Klass.call(instance, a1, a2, a3);
|
|
563
|
-
return instance;
|
|
564
|
-
} else {
|
|
565
|
-
return new Klass(a1, a2, a3);
|
|
566
|
-
}
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
var fourArgumentPooler$1 = function (a1, a2, a3, a4) {
|
|
570
|
-
var Klass = this;
|
|
571
|
-
if (Klass.instancePool.length) {
|
|
572
|
-
var instance = Klass.instancePool.pop();
|
|
573
|
-
Klass.call(instance, a1, a2, a3, a4);
|
|
574
|
-
return instance;
|
|
575
|
-
} else {
|
|
576
|
-
return new Klass(a1, a2, a3, a4);
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
var standardReleaser = function (instance) {
|
|
581
|
-
var Klass = this;
|
|
582
|
-
!(instance instanceof Klass) ? invariant_1(false, 'Trying to release an instance into a pool of a different type.') : void 0;
|
|
583
|
-
instance.destructor();
|
|
584
|
-
if (Klass.instancePool.length < Klass.poolSize) {
|
|
585
|
-
Klass.instancePool.push(instance);
|
|
586
|
-
}
|
|
587
|
-
};
|
|
525
|
+
index(pureComponentPrototype, ReactComponent.prototype);
|
|
526
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
588
527
|
|
|
589
|
-
|
|
590
|
-
|
|
528
|
+
function ReactAsyncComponent(props, context, updater) {
|
|
529
|
+
// Duplicated from ReactComponent.
|
|
530
|
+
this.props = props;
|
|
531
|
+
this.context = context;
|
|
532
|
+
this.refs = emptyObject_1;
|
|
533
|
+
// We initialize the default updater but the real one gets injected by the
|
|
534
|
+
// renderer.
|
|
535
|
+
this.updater = updater || ReactNoopUpdateQueue_1;
|
|
536
|
+
}
|
|
591
537
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
* @param {Function} pooler Customizable pooler.
|
|
600
|
-
*/
|
|
601
|
-
var addPoolingTo = function (CopyConstructor, pooler) {
|
|
602
|
-
// Casting as any so that flow ignores the actual implementation and trusts
|
|
603
|
-
// it to match the type we declared
|
|
604
|
-
var NewKlass = CopyConstructor;
|
|
605
|
-
NewKlass.instancePool = [];
|
|
606
|
-
NewKlass.getPooled = pooler || DEFAULT_POOLER;
|
|
607
|
-
if (!NewKlass.poolSize) {
|
|
608
|
-
NewKlass.poolSize = DEFAULT_POOL_SIZE;
|
|
609
|
-
}
|
|
610
|
-
NewKlass.release = standardReleaser;
|
|
611
|
-
return NewKlass;
|
|
538
|
+
var asyncComponentPrototype = ReactAsyncComponent.prototype = new ComponentDummy();
|
|
539
|
+
asyncComponentPrototype.constructor = ReactAsyncComponent;
|
|
540
|
+
// Avoid an extra prototype jump for these methods.
|
|
541
|
+
index(asyncComponentPrototype, ReactComponent.prototype);
|
|
542
|
+
asyncComponentPrototype.unstable_isAsyncReactComponent = true;
|
|
543
|
+
asyncComponentPrototype.render = function () {
|
|
544
|
+
return this.props.children;
|
|
612
545
|
};
|
|
613
546
|
|
|
614
|
-
var
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
threeArgumentPooler: threeArgumentPooler,
|
|
619
|
-
fourArgumentPooler: fourArgumentPooler$1
|
|
547
|
+
var ReactBaseClasses = {
|
|
548
|
+
Component: ReactComponent,
|
|
549
|
+
PureComponent: ReactPureComponent,
|
|
550
|
+
AsyncComponent: ReactAsyncComponent
|
|
620
551
|
};
|
|
621
552
|
|
|
622
|
-
var PooledClass_1 = PooledClass;
|
|
623
|
-
|
|
624
553
|
/**
|
|
625
554
|
* Copyright 2013-present, Facebook, Inc.
|
|
626
555
|
* All rights reserved.
|
|
@@ -651,9 +580,13 @@ var ReactCurrentOwner_1 = ReactCurrentOwner;
|
|
|
651
580
|
|
|
652
581
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
653
582
|
|
|
583
|
+
{
|
|
584
|
+
var warning$3 = warning_1;
|
|
585
|
+
}
|
|
586
|
+
|
|
654
587
|
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
655
588
|
// nor polyfill, then a plain number is used for performance.
|
|
656
|
-
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
589
|
+
var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
657
590
|
|
|
658
591
|
var RESERVED_PROPS = {
|
|
659
592
|
key: true,
|
|
@@ -693,7 +626,7 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
693
626
|
var warnAboutAccessingKey = function () {
|
|
694
627
|
if (!specialPropKeyWarningShown) {
|
|
695
628
|
specialPropKeyWarningShown = true;
|
|
696
|
-
|
|
629
|
+
warning$3(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
697
630
|
}
|
|
698
631
|
};
|
|
699
632
|
warnAboutAccessingKey.isReactWarning = true;
|
|
@@ -707,7 +640,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
707
640
|
var warnAboutAccessingRef = function () {
|
|
708
641
|
if (!specialPropRefWarningShown) {
|
|
709
642
|
specialPropRefWarningShown = true;
|
|
710
|
-
|
|
643
|
+
warning$3(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
711
644
|
}
|
|
712
645
|
};
|
|
713
646
|
warnAboutAccessingRef.isReactWarning = true;
|
|
@@ -740,7 +673,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
740
673
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
741
674
|
var element = {
|
|
742
675
|
// This tag allow us to uniquely identify this as a React Element
|
|
743
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
676
|
+
$$typeof: REACT_ELEMENT_TYPE$1,
|
|
744
677
|
|
|
745
678
|
// Built-in properties that belong on the element
|
|
746
679
|
type: type,
|
|
@@ -855,7 +788,7 @@ ReactElement.createElement = function (type, config, children) {
|
|
|
855
788
|
}
|
|
856
789
|
{
|
|
857
790
|
if (key || ref) {
|
|
858
|
-
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
|
|
791
|
+
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE$1) {
|
|
859
792
|
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
860
793
|
if (key) {
|
|
861
794
|
defineKeyPropWarningGetter(props, displayName);
|
|
@@ -964,7 +897,7 @@ ReactElement.cloneElement = function (element, config, children) {
|
|
|
964
897
|
* @final
|
|
965
898
|
*/
|
|
966
899
|
ReactElement.isValidElement = function (object) {
|
|
967
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
900
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE$1;
|
|
968
901
|
};
|
|
969
902
|
|
|
970
903
|
var ReactElement_1 = ReactElement;
|
|
@@ -977,694 +910,252 @@ var ReactElement_1 = ReactElement;
|
|
|
977
910
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
978
911
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
979
912
|
*
|
|
980
|
-
* @providesModule
|
|
913
|
+
* @providesModule ReactDebugCurrentFrame
|
|
981
914
|
*
|
|
982
915
|
*/
|
|
983
916
|
|
|
984
|
-
var
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
};
|
|
917
|
+
var ReactDebugCurrentFrame = {};
|
|
918
|
+
|
|
919
|
+
{
|
|
920
|
+
// Component that is being worked on
|
|
921
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
922
|
+
|
|
923
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
924
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
925
|
+
if (impl) {
|
|
926
|
+
return impl();
|
|
927
|
+
}
|
|
928
|
+
return null;
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame;
|
|
933
|
+
|
|
934
|
+
{
|
|
935
|
+
var warning$2 = warning_1;
|
|
936
|
+
|
|
937
|
+
var _require = ReactDebugCurrentFrame_1,
|
|
938
|
+
getStackAddendum = _require.getStackAddendum;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
942
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
943
|
+
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
944
|
+
// nor polyfill, then a plain number is used for performance.
|
|
945
|
+
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
946
|
+
|
|
947
|
+
var SEPARATOR = '.';
|
|
948
|
+
var SUBSEPARATOR = ':';
|
|
997
949
|
|
|
998
950
|
/**
|
|
999
|
-
*
|
|
1000
|
-
* All rights reserved.
|
|
1001
|
-
*
|
|
1002
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1003
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1004
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
951
|
+
* Escape and wrap key so it is safe to use as a reactid
|
|
1005
952
|
*
|
|
1006
|
-
* @
|
|
1007
|
-
*
|
|
953
|
+
* @param {string} key to be escaped.
|
|
954
|
+
* @return {string} the escaped key.
|
|
1008
955
|
*/
|
|
956
|
+
function escape(key) {
|
|
957
|
+
var escapeRegex = /[=:]/g;
|
|
958
|
+
var escaperLookup = {
|
|
959
|
+
'=': '=0',
|
|
960
|
+
':': '=2'
|
|
961
|
+
};
|
|
962
|
+
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
|
963
|
+
return escaperLookup[match];
|
|
964
|
+
});
|
|
1009
965
|
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
966
|
+
return '$' + escapedString;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* TODO: Test that a single child and an array with one item have the same key
|
|
971
|
+
* pattern.
|
|
972
|
+
*/
|
|
973
|
+
|
|
974
|
+
var didWarnAboutMaps = false;
|
|
975
|
+
|
|
976
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
977
|
+
function escapeUserProvidedKey(text) {
|
|
978
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
var POOL_SIZE = 10;
|
|
982
|
+
var traverseContextPool = [];
|
|
983
|
+
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
984
|
+
if (traverseContextPool.length) {
|
|
985
|
+
var traverseContext = traverseContextPool.pop();
|
|
986
|
+
traverseContext.result = mapResult;
|
|
987
|
+
traverseContext.keyPrefix = keyPrefix;
|
|
988
|
+
traverseContext.func = mapFunction;
|
|
989
|
+
traverseContext.context = mapContext;
|
|
990
|
+
traverseContext.count = 0;
|
|
991
|
+
return traverseContext;
|
|
992
|
+
} else {
|
|
993
|
+
return {
|
|
994
|
+
result: mapResult,
|
|
995
|
+
keyPrefix: keyPrefix,
|
|
996
|
+
func: mapFunction,
|
|
997
|
+
context: mapContext,
|
|
998
|
+
count: 0
|
|
999
|
+
};
|
|
1015
1000
|
}
|
|
1016
|
-
|
|
1017
|
-
// Fiber reconciler
|
|
1018
|
-
var fiber = instanceOrFiber;
|
|
1019
|
-
var type = fiber.type;
|
|
1001
|
+
}
|
|
1020
1002
|
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1003
|
+
function releaseTraverseContext(traverseContext) {
|
|
1004
|
+
traverseContext.result = null;
|
|
1005
|
+
traverseContext.keyPrefix = null;
|
|
1006
|
+
traverseContext.func = null;
|
|
1007
|
+
traverseContext.context = null;
|
|
1008
|
+
traverseContext.count = 0;
|
|
1009
|
+
if (traverseContextPool.length < POOL_SIZE) {
|
|
1010
|
+
traverseContextPool.push(traverseContext);
|
|
1027
1011
|
}
|
|
1028
|
-
return null;
|
|
1029
1012
|
}
|
|
1030
1013
|
|
|
1031
|
-
|
|
1014
|
+
/**
|
|
1015
|
+
* @param {?*} children Children tree container.
|
|
1016
|
+
* @param {!string} nameSoFar Name of the key path so far.
|
|
1017
|
+
* @param {!function} callback Callback to invoke with each child found.
|
|
1018
|
+
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
1019
|
+
* process.
|
|
1020
|
+
* @return {!number} The number of children in this subtree.
|
|
1021
|
+
*/
|
|
1022
|
+
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
1023
|
+
var type = typeof children;
|
|
1032
1024
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1025
|
+
if (type === 'undefined' || type === 'boolean') {
|
|
1026
|
+
// All of the above are perceived as null.
|
|
1027
|
+
children = null;
|
|
1028
|
+
}
|
|
1037
1029
|
|
|
1030
|
+
if (children === null || type === 'string' || type === 'number' ||
|
|
1031
|
+
// The following is inlined from ReactElement. This means we can optimize
|
|
1032
|
+
// some checks. React Fiber also inlines this logic for similar purposes.
|
|
1033
|
+
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1034
|
+
callback(traverseContext, children,
|
|
1035
|
+
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1036
|
+
// so that it's consistent if the number of children grows.
|
|
1037
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
1038
|
+
return 1;
|
|
1039
|
+
}
|
|
1038
1040
|
|
|
1041
|
+
var child;
|
|
1042
|
+
var nextName;
|
|
1043
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1044
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1039
1045
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1046
|
+
if (Array.isArray(children)) {
|
|
1047
|
+
for (var i = 0; i < children.length; i++) {
|
|
1048
|
+
child = children[i];
|
|
1049
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
|
1050
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1051
|
+
}
|
|
1052
|
+
} else {
|
|
1053
|
+
var iteratorFn = ITERATOR_SYMBOL && children[ITERATOR_SYMBOL] || children[FAUX_ITERATOR_SYMBOL];
|
|
1054
|
+
if (typeof iteratorFn === 'function') {
|
|
1055
|
+
{
|
|
1056
|
+
// Warn about using Maps as children
|
|
1057
|
+
if (iteratorFn === children.entries) {
|
|
1058
|
+
warning$2(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getStackAddendum());
|
|
1059
|
+
didWarnAboutMaps = true;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1043
1062
|
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
var
|
|
1054
|
-
|
|
1055
|
-
|
|
1063
|
+
var iterator = iteratorFn.call(children);
|
|
1064
|
+
var step;
|
|
1065
|
+
var ii = 0;
|
|
1066
|
+
while (!(step = iterator.next()).done) {
|
|
1067
|
+
child = step.value;
|
|
1068
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
1069
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1070
|
+
}
|
|
1071
|
+
} else if (type === 'object') {
|
|
1072
|
+
var addendum = '';
|
|
1073
|
+
{
|
|
1074
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getStackAddendum();
|
|
1056
1075
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1076
|
+
var childrenString = '' + children;
|
|
1077
|
+
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);
|
|
1078
|
+
}
|
|
1060
1079
|
}
|
|
1080
|
+
|
|
1081
|
+
return subtreeCount;
|
|
1061
1082
|
}
|
|
1062
1083
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1084
|
+
/**
|
|
1085
|
+
* Traverses children that are typically specified as `props.children`, but
|
|
1086
|
+
* might also be specified through attributes:
|
|
1087
|
+
*
|
|
1088
|
+
* - `traverseAllChildren(this.props.children, ...)`
|
|
1089
|
+
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
1090
|
+
*
|
|
1091
|
+
* The `traverseContext` is an optional argument that is passed through the
|
|
1092
|
+
* entire traversal. It can be used to store accumulations or anything else that
|
|
1093
|
+
* the callback might find relevant.
|
|
1094
|
+
*
|
|
1095
|
+
* @param {?*} children Children tree object.
|
|
1096
|
+
* @param {!function} callback To invoke upon traversing each child.
|
|
1097
|
+
* @param {?*} traverseContext Context for traversal.
|
|
1098
|
+
* @return {!number} The number of children in this subtree.
|
|
1099
|
+
*/
|
|
1100
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
|
1101
|
+
if (children == null) {
|
|
1102
|
+
return 0;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1075
1106
|
}
|
|
1076
1107
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Generate a key string that identifies a component within a set.
|
|
1110
|
+
*
|
|
1111
|
+
* @param {*} component A component that could contain a manual key.
|
|
1112
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
1113
|
+
* @return {string}
|
|
1114
|
+
*/
|
|
1115
|
+
function getComponentKey(component, index) {
|
|
1116
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1117
|
+
// that we don't block potential future ES APIs.
|
|
1118
|
+
if (typeof component === 'object' && component !== null && component.key != null) {
|
|
1119
|
+
// Explicit key
|
|
1120
|
+
return escape(component.key);
|
|
1121
|
+
}
|
|
1122
|
+
// Implicit key determined by the index in the set
|
|
1123
|
+
return index.toString(36);
|
|
1124
|
+
}
|
|
1081
1125
|
|
|
1082
|
-
|
|
1083
|
-
var
|
|
1126
|
+
function forEachSingleChild(bookKeeping, child, name) {
|
|
1127
|
+
var func = bookKeeping.func,
|
|
1128
|
+
context = bookKeeping.context;
|
|
1084
1129
|
|
|
1130
|
+
func.call(context, child, bookKeeping.count++);
|
|
1131
|
+
}
|
|
1085
1132
|
|
|
1133
|
+
/**
|
|
1134
|
+
* Iterates through children that are typically specified as `props.children`.
|
|
1135
|
+
*
|
|
1136
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
|
|
1137
|
+
*
|
|
1138
|
+
* The provided forEachFunc(child, index) will be called for each
|
|
1139
|
+
* leaf child.
|
|
1140
|
+
*
|
|
1141
|
+
* @param {?*} children Children tree container.
|
|
1142
|
+
* @param {function(*, int)} forEachFunc
|
|
1143
|
+
* @param {*} forEachContext Context for forEachContext.
|
|
1144
|
+
*/
|
|
1145
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1146
|
+
if (children == null) {
|
|
1147
|
+
return children;
|
|
1148
|
+
}
|
|
1149
|
+
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
|
1150
|
+
traverseAllChildren(children, forEachSingleChild, traverseContext);
|
|
1151
|
+
releaseTraverseContext(traverseContext);
|
|
1152
|
+
}
|
|
1086
1153
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
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;
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
|
|
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);
|
|
1118
|
-
|
|
1119
|
-
var setItem;
|
|
1120
|
-
var getItem;
|
|
1121
|
-
var removeItem;
|
|
1122
|
-
var getItemIDs;
|
|
1123
|
-
var addRoot;
|
|
1124
|
-
var removeRoot;
|
|
1125
|
-
var getRootIDs;
|
|
1126
|
-
|
|
1127
|
-
if (canUseCollections) {
|
|
1128
|
-
var itemMap = new Map();
|
|
1129
|
-
var rootIDSet = new Set();
|
|
1130
|
-
|
|
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());
|
|
1142
|
-
};
|
|
1143
|
-
|
|
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 = {};
|
|
1156
|
-
|
|
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
|
-
};
|
|
1165
|
-
|
|
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
|
-
};
|
|
1181
|
-
|
|
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
|
-
};
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
var unmountedIDs = [];
|
|
1196
|
-
|
|
1197
|
-
function purgeDeep(id) {
|
|
1198
|
-
var item = getItem(id);
|
|
1199
|
-
if (item) {
|
|
1200
|
-
var childIDs = item.childIDs;
|
|
1201
|
-
|
|
1202
|
-
removeItem(id);
|
|
1203
|
-
childIDs.forEach(purgeDeep);
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
|
|
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';
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
|
|
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;
|
|
1224
|
-
|
|
1225
|
-
if (ownerID) {
|
|
1226
|
-
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
|
|
1227
|
-
}
|
|
1228
|
-
warning_1(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
|
|
1229
|
-
return describeComponentFrame(name || '', element && element._source, ownerName || '');
|
|
1230
|
-
}
|
|
1231
|
-
|
|
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;
|
|
1237
|
-
|
|
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.
|
|
1249
|
-
}
|
|
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;
|
|
1251
|
-
}
|
|
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;
|
|
1270
|
-
}
|
|
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);
|
|
1280
|
-
}
|
|
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);
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
unmountedIDs.push(id);
|
|
1306
|
-
},
|
|
1307
|
-
purgeUnmountedComponents: function () {
|
|
1308
|
-
if (ReactComponentTreeHook._preventPurging) {
|
|
1309
|
-
// Should only be used for testing.
|
|
1310
|
-
return;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
for (var i = 0; i < unmountedIDs.length; i++) {
|
|
1314
|
-
var id = unmountedIDs[i];
|
|
1315
|
-
purgeDeep(id);
|
|
1316
|
-
}
|
|
1317
|
-
unmountedIDs.length = 0;
|
|
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
|
-
}
|
|
1330
|
-
|
|
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);
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
return info;
|
|
1343
|
-
},
|
|
1344
|
-
getStackAddendumByID: function (id) {
|
|
1345
|
-
var info = '';
|
|
1346
|
-
while (id) {
|
|
1347
|
-
info += describeID(id);
|
|
1348
|
-
id = ReactComponentTreeHook.getParentID(id);
|
|
1349
|
-
}
|
|
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;
|
|
1360
|
-
}
|
|
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;
|
|
1371
|
-
}
|
|
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
|
|
1402
|
-
};
|
|
1403
|
-
|
|
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;
|
|
1411
|
-
|
|
1412
|
-
{
|
|
1413
|
-
var _require = ReactComponentTreeHook_1,
|
|
1414
|
-
getCurrentStackAddendum = _require.getCurrentStackAddendum;
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
var SEPARATOR = '.';
|
|
1418
|
-
var SUBSEPARATOR = ':';
|
|
1419
|
-
|
|
1420
|
-
/**
|
|
1421
|
-
* Escape and wrap key so it is safe to use as a reactid
|
|
1422
|
-
*
|
|
1423
|
-
* @param {string} key to be escaped.
|
|
1424
|
-
* @return {string} the escaped key.
|
|
1425
|
-
*/
|
|
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
|
-
});
|
|
1435
|
-
|
|
1436
|
-
return '$' + escapedString;
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
var unescapeInDev = emptyFunction_1;
|
|
1440
|
-
{
|
|
1441
|
-
/**
|
|
1442
|
-
* Unescape and unwrap key for human-readable display
|
|
1443
|
-
*
|
|
1444
|
-
* @param {string} key to unescape.
|
|
1445
|
-
* @return {string} the unescaped key.
|
|
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);
|
|
1454
|
-
|
|
1455
|
-
return ('' + keySubstring).replace(unescapeRegex, function (match) {
|
|
1456
|
-
return unescaperLookup[match];
|
|
1457
|
-
});
|
|
1458
|
-
};
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
/**
|
|
1462
|
-
* TODO: Test that a single child and an array with one item have the same key
|
|
1463
|
-
* pattern.
|
|
1464
|
-
*/
|
|
1465
|
-
|
|
1466
|
-
var didWarnAboutMaps = false;
|
|
1467
|
-
|
|
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);
|
|
1481
|
-
}
|
|
1482
|
-
// Implicit key determined by the index in the set
|
|
1483
|
-
return index.toString(36);
|
|
1484
|
-
}
|
|
1485
|
-
|
|
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;
|
|
1496
|
-
|
|
1497
|
-
if (type === 'undefined' || type === 'boolean') {
|
|
1498
|
-
// All of the above are perceived as null.
|
|
1499
|
-
children = null;
|
|
1500
|
-
}
|
|
1501
|
-
|
|
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;
|
|
1511
|
-
}
|
|
1512
|
-
|
|
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;
|
|
1517
|
-
|
|
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;
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
|
|
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);
|
|
1542
|
-
}
|
|
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();
|
|
1547
|
-
}
|
|
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);
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
return subtreeCount;
|
|
1554
|
-
}
|
|
1555
|
-
|
|
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;
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
var traverseAllChildren_1 = traverseAllChildren;
|
|
1581
|
-
|
|
1582
|
-
var twoArgumentPooler = PooledClass_1.twoArgumentPooler;
|
|
1583
|
-
var fourArgumentPooler = PooledClass_1.fourArgumentPooler;
|
|
1584
|
-
|
|
1585
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1586
|
-
function escapeUserProvidedKey(text) {
|
|
1587
|
-
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1588
|
-
}
|
|
1589
|
-
|
|
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);
|
|
1609
|
-
|
|
1610
|
-
function forEachSingleChild(bookKeeping, child, name) {
|
|
1611
|
-
var func = bookKeeping.func,
|
|
1612
|
-
context = bookKeeping.context;
|
|
1613
|
-
|
|
1614
|
-
func.call(context, child, bookKeeping.count++);
|
|
1615
|
-
}
|
|
1616
|
-
|
|
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;
|
|
1632
|
-
}
|
|
1633
|
-
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
|
|
1634
|
-
traverseAllChildren_1(children, forEachSingleChild, traverseContext);
|
|
1635
|
-
ForEachBookKeeping.release(traverseContext);
|
|
1636
|
-
}
|
|
1637
|
-
|
|
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);
|
|
1662
|
-
|
|
1663
|
-
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1664
|
-
var result = bookKeeping.result,
|
|
1665
|
-
keyPrefix = bookKeeping.keyPrefix,
|
|
1666
|
-
func = bookKeeping.func,
|
|
1667
|
-
context = bookKeeping.context;
|
|
1154
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1155
|
+
var result = bookKeeping.result,
|
|
1156
|
+
keyPrefix = bookKeeping.keyPrefix,
|
|
1157
|
+
func = bookKeeping.func,
|
|
1158
|
+
context = bookKeeping.context;
|
|
1668
1159
|
|
|
1669
1160
|
|
|
1670
1161
|
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
@@ -1686,9 +1177,9 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
|
1686
1177
|
if (prefix != null) {
|
|
1687
1178
|
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1688
1179
|
}
|
|
1689
|
-
var traverseContext =
|
|
1690
|
-
|
|
1691
|
-
|
|
1180
|
+
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
|
1181
|
+
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
|
1182
|
+
releaseTraverseContext(traverseContext);
|
|
1692
1183
|
}
|
|
1693
1184
|
|
|
1694
1185
|
/**
|
|
@@ -1713,10 +1204,6 @@ function mapChildren(children, func, context) {
|
|
|
1713
1204
|
return result;
|
|
1714
1205
|
}
|
|
1715
1206
|
|
|
1716
|
-
function forEachSingleChildDummy(traverseContext, child, name) {
|
|
1717
|
-
return null;
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
1207
|
/**
|
|
1721
1208
|
* Count the number of children that are typically specified as
|
|
1722
1209
|
* `props.children`.
|
|
@@ -1727,7 +1214,7 @@ function forEachSingleChildDummy(traverseContext, child, name) {
|
|
|
1727
1214
|
* @return {number} The number of children.
|
|
1728
1215
|
*/
|
|
1729
1216
|
function countChildren(children, context) {
|
|
1730
|
-
return
|
|
1217
|
+
return traverseAllChildren(children, emptyFunction_1.thatReturnsNull, null);
|
|
1731
1218
|
}
|
|
1732
1219
|
|
|
1733
1220
|
/**
|
|
@@ -1745,7 +1232,6 @@ function toArray(children) {
|
|
|
1745
1232
|
var ReactChildren = {
|
|
1746
1233
|
forEach: forEachChildren,
|
|
1747
1234
|
map: mapChildren,
|
|
1748
|
-
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
|
1749
1235
|
count: countChildren,
|
|
1750
1236
|
toArray: toArray
|
|
1751
1237
|
};
|
|
@@ -1763,7 +1249,7 @@ var ReactChildren_1 = ReactChildren;
|
|
|
1763
1249
|
* @providesModule ReactVersion
|
|
1764
1250
|
*/
|
|
1765
1251
|
|
|
1766
|
-
var ReactVersion = '16.0.0-
|
|
1252
|
+
var ReactVersion = '16.0.0-beta.1';
|
|
1767
1253
|
|
|
1768
1254
|
/**
|
|
1769
1255
|
* Returns the first child in a collection of children and verifies that there
|
|
@@ -1800,8 +1286,8 @@ var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
1800
1286
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
1801
1287
|
|
|
1802
1288
|
{
|
|
1803
|
-
var invariant$
|
|
1804
|
-
var warning$
|
|
1289
|
+
var invariant$2 = invariant_1;
|
|
1290
|
+
var warning$5 = warning_1;
|
|
1805
1291
|
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1806
1292
|
var loggedTypeFailures = {};
|
|
1807
1293
|
}
|
|
@@ -1828,87 +1314,119 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
|
|
|
1828
1314
|
try {
|
|
1829
1315
|
// This is intentionally an invariant that gets caught. It's the same
|
|
1830
1316
|
// behavior as without this statement except with a better message.
|
|
1831
|
-
invariant$
|
|
1317
|
+
invariant$2(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
1318
|
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
1833
1319
|
} catch (ex) {
|
|
1834
1320
|
error = ex;
|
|
1835
1321
|
}
|
|
1836
|
-
warning$
|
|
1322
|
+
warning$5(!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
1323
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1838
1324
|
// Only monitor this failure once because there tends to be a lot of the
|
|
1839
1325
|
// same error.
|
|
1840
1326
|
loggedTypeFailures[error.message] = true;
|
|
1841
1327
|
|
|
1842
|
-
var stack = getStack ? getStack() : '';
|
|
1328
|
+
var stack = getStack ? getStack() : '';
|
|
1329
|
+
|
|
1330
|
+
warning$5(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
var checkPropTypes_1 = checkPropTypes$1;
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Copyright 2016-present, Facebook, Inc.
|
|
1341
|
+
* All rights reserved.
|
|
1342
|
+
*
|
|
1343
|
+
* This source code is licensed under the BSD-style license found in the
|
|
1344
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1345
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1346
|
+
*
|
|
1347
|
+
*
|
|
1348
|
+
* @providesModule describeComponentFrame
|
|
1349
|
+
*/
|
|
1350
|
+
|
|
1351
|
+
var describeComponentFrame$1 = function (name, source, ownerName) {
|
|
1352
|
+
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
1357
|
+
* All rights reserved.
|
|
1358
|
+
*
|
|
1359
|
+
* This source code is licensed under the BSD-style license found in the
|
|
1360
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1361
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1362
|
+
*
|
|
1363
|
+
* @providesModule getComponentName
|
|
1364
|
+
*
|
|
1365
|
+
*/
|
|
1366
|
+
|
|
1367
|
+
function getComponentName$1(instanceOrFiber) {
|
|
1368
|
+
if (typeof instanceOrFiber.getName === 'function') {
|
|
1369
|
+
// Stack reconciler
|
|
1370
|
+
var instance = instanceOrFiber;
|
|
1371
|
+
return instance.getName();
|
|
1372
|
+
}
|
|
1373
|
+
if (typeof instanceOrFiber.tag === 'number') {
|
|
1374
|
+
// Fiber reconciler
|
|
1375
|
+
var fiber = instanceOrFiber;
|
|
1376
|
+
var type = fiber.type;
|
|
1843
1377
|
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1378
|
+
if (typeof type === 'string') {
|
|
1379
|
+
return type;
|
|
1380
|
+
}
|
|
1381
|
+
if (typeof type === 'function') {
|
|
1382
|
+
return type.displayName || type.name;
|
|
1847
1383
|
}
|
|
1848
1384
|
}
|
|
1385
|
+
return null;
|
|
1849
1386
|
}
|
|
1850
1387
|
|
|
1851
|
-
var
|
|
1852
|
-
|
|
1853
|
-
var ReactDebugCurrentFrame$1 = {};
|
|
1388
|
+
var getComponentName_1 = getComponentName$1;
|
|
1854
1389
|
|
|
1855
1390
|
{
|
|
1856
|
-
var
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
var
|
|
1861
|
-
|
|
1391
|
+
var checkPropTypes = checkPropTypes_1;
|
|
1392
|
+
var lowPriorityWarning$1 = lowPriorityWarning_1;
|
|
1393
|
+
var ReactDebugCurrentFrame$1 = ReactDebugCurrentFrame_1;
|
|
1394
|
+
var warning$4 = warning_1;
|
|
1395
|
+
var describeComponentFrame = describeComponentFrame$1;
|
|
1396
|
+
var getComponentName = getComponentName_1;
|
|
1862
1397
|
|
|
1863
|
-
|
|
1398
|
+
var currentlyValidatingElement = null;
|
|
1864
1399
|
|
|
1400
|
+
var getDisplayName = function (element) {
|
|
1401
|
+
if (element == null) {
|
|
1402
|
+
return '#empty';
|
|
1403
|
+
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1404
|
+
return '#text';
|
|
1405
|
+
} else if (typeof element.type === 'string') {
|
|
1406
|
+
return element.type;
|
|
1407
|
+
} else {
|
|
1408
|
+
return element.type.displayName || element.type.name || 'Unknown';
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1865
1411
|
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
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);
|
|
1412
|
+
var getStackAddendum$1 = function () {
|
|
1413
|
+
var stack = '';
|
|
1414
|
+
if (currentlyValidatingElement) {
|
|
1415
|
+
var name = getDisplayName(currentlyValidatingElement);
|
|
1416
|
+
var owner = currentlyValidatingElement._owner;
|
|
1417
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
|
|
1889
1418
|
}
|
|
1419
|
+
stack += ReactDebugCurrentFrame$1.getStackAddendum() || '';
|
|
1890
1420
|
return stack;
|
|
1891
1421
|
};
|
|
1892
1422
|
}
|
|
1893
1423
|
|
|
1894
|
-
var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame$1;
|
|
1895
|
-
|
|
1896
|
-
{
|
|
1897
|
-
var checkPropTypes = checkPropTypes_1;
|
|
1898
|
-
var lowPriorityWarning$1 = lowPriorityWarning_1;
|
|
1899
|
-
var ReactDebugCurrentFrame = ReactDebugCurrentFrame_1;
|
|
1900
|
-
var warning$1 = warning_1;
|
|
1901
|
-
|
|
1902
|
-
var _require$1 = ReactComponentTreeHook_1,
|
|
1903
|
-
getCurrentStackAddendum$1 = _require$1.getCurrentStackAddendum;
|
|
1904
|
-
}
|
|
1905
|
-
|
|
1906
1424
|
var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
|
|
1907
1425
|
var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
|
|
1908
1426
|
|
|
1909
1427
|
function getDeclarationErrorAddendum() {
|
|
1910
1428
|
if (ReactCurrentOwner_1.current) {
|
|
1911
|
-
var name =
|
|
1429
|
+
var name = getComponentName(ReactCurrentOwner_1.current);
|
|
1912
1430
|
if (name) {
|
|
1913
1431
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
1914
1432
|
}
|
|
@@ -1974,10 +1492,12 @@ function validateExplicitKey(element, parentType) {
|
|
|
1974
1492
|
var childOwner = '';
|
|
1975
1493
|
if (element && element._owner && element._owner !== ReactCurrentOwner_1.current) {
|
|
1976
1494
|
// Give the component that originally created this child.
|
|
1977
|
-
childOwner = ' It was passed a child from ' +
|
|
1495
|
+
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
|
1978
1496
|
}
|
|
1979
1497
|
|
|
1980
|
-
|
|
1498
|
+
currentlyValidatingElement = element;
|
|
1499
|
+
warning$4(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, getStackAddendum$1());
|
|
1500
|
+
currentlyValidatingElement = null;
|
|
1981
1501
|
}
|
|
1982
1502
|
|
|
1983
1503
|
/**
|
|
@@ -2023,127 +1543,426 @@ function validateChildKeys(node, parentType) {
|
|
|
2023
1543
|
}
|
|
2024
1544
|
}
|
|
2025
1545
|
|
|
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;
|
|
2036
|
-
}
|
|
2037
|
-
var name = componentClass.displayName || componentClass.name;
|
|
1546
|
+
/**
|
|
1547
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
1548
|
+
* provided by the type.
|
|
1549
|
+
*
|
|
1550
|
+
* @param {ReactElement} element
|
|
1551
|
+
*/
|
|
1552
|
+
function validatePropTypes(element) {
|
|
1553
|
+
var componentClass = element.type;
|
|
1554
|
+
if (typeof componentClass !== 'function') {
|
|
1555
|
+
return;
|
|
1556
|
+
}
|
|
1557
|
+
var name = componentClass.displayName || componentClass.name;
|
|
1558
|
+
|
|
1559
|
+
// ReactNative `View.propTypes` have been deprecated in favor of `ViewPropTypes`.
|
|
1560
|
+
// In their place a temporary getter has been added with a deprecated warning message.
|
|
1561
|
+
// Avoid triggering that warning during validation using the temporary workaround,
|
|
1562
|
+
// __propTypesSecretDontUseThesePlease.
|
|
1563
|
+
// TODO (bvaughn) Revert this particular change any time after April 1 ReactNative tag.
|
|
1564
|
+
var propTypes = typeof componentClass.__propTypesSecretDontUseThesePlease === 'object' ? componentClass.__propTypesSecretDontUseThesePlease : componentClass.propTypes;
|
|
1565
|
+
|
|
1566
|
+
if (propTypes) {
|
|
1567
|
+
currentlyValidatingElement = element;
|
|
1568
|
+
checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum$1);
|
|
1569
|
+
currentlyValidatingElement = null;
|
|
1570
|
+
}
|
|
1571
|
+
if (typeof componentClass.getDefaultProps === 'function') {
|
|
1572
|
+
warning$4(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
var ReactElementValidator$1 = {
|
|
1577
|
+
createElement: function (type, props, children) {
|
|
1578
|
+
var validType = typeof type === 'string' || typeof type === 'function';
|
|
1579
|
+
// We warn in this case but don't throw. We expect the element creation to
|
|
1580
|
+
// succeed and there will likely be errors in render.
|
|
1581
|
+
if (!validType) {
|
|
1582
|
+
var info = '';
|
|
1583
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1584
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
var sourceInfo = getSourceInfoErrorAddendum(props);
|
|
1588
|
+
if (sourceInfo) {
|
|
1589
|
+
info += sourceInfo;
|
|
1590
|
+
} else {
|
|
1591
|
+
info += getDeclarationErrorAddendum();
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
info += ReactDebugCurrentFrame$1.getStackAddendum() || '';
|
|
1595
|
+
|
|
1596
|
+
warning$4(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);
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
var element = ReactElement_1.createElement.apply(this, arguments);
|
|
1600
|
+
|
|
1601
|
+
// The result can be nullish if a mock or a custom function is used.
|
|
1602
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1603
|
+
if (element == null) {
|
|
1604
|
+
return element;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
|
1608
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1609
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
1610
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1611
|
+
// fixed, the key warnings will appear.)
|
|
1612
|
+
if (validType) {
|
|
1613
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
1614
|
+
validateChildKeys(arguments[i], type);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
validatePropTypes(element);
|
|
1619
|
+
|
|
1620
|
+
return element;
|
|
1621
|
+
},
|
|
1622
|
+
|
|
1623
|
+
createFactory: function (type) {
|
|
1624
|
+
var validatedFactory = ReactElementValidator$1.createElement.bind(null, type);
|
|
1625
|
+
// Legacy hook TODO: Warn if this is accessed
|
|
1626
|
+
validatedFactory.type = type;
|
|
1627
|
+
|
|
1628
|
+
{
|
|
1629
|
+
Object.defineProperty(validatedFactory, 'type', {
|
|
1630
|
+
enumerable: false,
|
|
1631
|
+
get: function () {
|
|
1632
|
+
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
1633
|
+
Object.defineProperty(this, 'type', {
|
|
1634
|
+
value: type
|
|
1635
|
+
});
|
|
1636
|
+
return type;
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
return validatedFactory;
|
|
1642
|
+
},
|
|
1643
|
+
|
|
1644
|
+
cloneElement: function (element, props, children) {
|
|
1645
|
+
var newElement = ReactElement_1.cloneElement.apply(this, arguments);
|
|
1646
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
1647
|
+
validateChildKeys(arguments[i], newElement.type);
|
|
1648
|
+
}
|
|
1649
|
+
validatePropTypes(newElement);
|
|
1650
|
+
return newElement;
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
|
|
1654
|
+
var ReactElementValidator_1 = ReactElementValidator$1;
|
|
1655
|
+
|
|
1656
|
+
{
|
|
1657
|
+
var warning$6 = warning_1;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
function isNative(fn) {
|
|
1661
|
+
// Based on isNative() from Lodash
|
|
1662
|
+
var funcToString = Function.prototype.toString;
|
|
1663
|
+
var reIsNative = RegExp('^' + funcToString
|
|
1664
|
+
// Take an example native function source for comparison
|
|
1665
|
+
.call(Object.prototype.hasOwnProperty)
|
|
1666
|
+
// Strip regex characters so we can use it for regex
|
|
1667
|
+
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
|
1668
|
+
// Remove hasOwnProperty from the template to make it generic
|
|
1669
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
1670
|
+
try {
|
|
1671
|
+
var source = funcToString.call(fn);
|
|
1672
|
+
return reIsNative.test(source);
|
|
1673
|
+
} catch (err) {
|
|
1674
|
+
return false;
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
var canUseCollections =
|
|
1679
|
+
// Array.from
|
|
1680
|
+
typeof Array.from === 'function' &&
|
|
1681
|
+
// Map
|
|
1682
|
+
typeof Map === 'function' && isNative(Map) &&
|
|
1683
|
+
// Map.prototype.keys
|
|
1684
|
+
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
|
|
1685
|
+
// Set
|
|
1686
|
+
typeof Set === 'function' && isNative(Set) &&
|
|
1687
|
+
// Set.prototype.keys
|
|
1688
|
+
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
|
|
1689
|
+
|
|
1690
|
+
var setItem;
|
|
1691
|
+
var getItem;
|
|
1692
|
+
var removeItem;
|
|
1693
|
+
var getItemIDs;
|
|
1694
|
+
var addRoot;
|
|
1695
|
+
var removeRoot;
|
|
1696
|
+
var getRootIDs;
|
|
1697
|
+
|
|
1698
|
+
if (canUseCollections) {
|
|
1699
|
+
var itemMap = new Map();
|
|
1700
|
+
var rootIDSet = new Set();
|
|
1701
|
+
|
|
1702
|
+
setItem = function (id, item) {
|
|
1703
|
+
itemMap.set(id, item);
|
|
1704
|
+
};
|
|
1705
|
+
getItem = function (id) {
|
|
1706
|
+
return itemMap.get(id);
|
|
1707
|
+
};
|
|
1708
|
+
removeItem = function (id) {
|
|
1709
|
+
itemMap['delete'](id);
|
|
1710
|
+
};
|
|
1711
|
+
getItemIDs = function () {
|
|
1712
|
+
return Array.from(itemMap.keys());
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
addRoot = function (id) {
|
|
1716
|
+
rootIDSet.add(id);
|
|
1717
|
+
};
|
|
1718
|
+
removeRoot = function (id) {
|
|
1719
|
+
rootIDSet['delete'](id);
|
|
1720
|
+
};
|
|
1721
|
+
getRootIDs = function () {
|
|
1722
|
+
return Array.from(rootIDSet.keys());
|
|
1723
|
+
};
|
|
1724
|
+
} else {
|
|
1725
|
+
var itemByKey = {};
|
|
1726
|
+
var rootByKey = {};
|
|
1727
|
+
|
|
1728
|
+
// Use non-numeric keys to prevent V8 performance issues:
|
|
1729
|
+
// https://github.com/facebook/react/pull/7232
|
|
1730
|
+
var getKeyFromID = function (id) {
|
|
1731
|
+
return '.' + id;
|
|
1732
|
+
};
|
|
1733
|
+
var getIDFromKey = function (key) {
|
|
1734
|
+
return parseInt(key.substr(1), 10);
|
|
1735
|
+
};
|
|
1736
|
+
|
|
1737
|
+
setItem = function (id, item) {
|
|
1738
|
+
var key = getKeyFromID(id);
|
|
1739
|
+
itemByKey[key] = item;
|
|
1740
|
+
};
|
|
1741
|
+
getItem = function (id) {
|
|
1742
|
+
var key = getKeyFromID(id);
|
|
1743
|
+
return itemByKey[key];
|
|
1744
|
+
};
|
|
1745
|
+
removeItem = function (id) {
|
|
1746
|
+
var key = getKeyFromID(id);
|
|
1747
|
+
delete itemByKey[key];
|
|
1748
|
+
};
|
|
1749
|
+
getItemIDs = function () {
|
|
1750
|
+
return Object.keys(itemByKey).map(getIDFromKey);
|
|
1751
|
+
};
|
|
1752
|
+
|
|
1753
|
+
addRoot = function (id) {
|
|
1754
|
+
var key = getKeyFromID(id);
|
|
1755
|
+
rootByKey[key] = true;
|
|
1756
|
+
};
|
|
1757
|
+
removeRoot = function (id) {
|
|
1758
|
+
var key = getKeyFromID(id);
|
|
1759
|
+
delete rootByKey[key];
|
|
1760
|
+
};
|
|
1761
|
+
getRootIDs = function () {
|
|
1762
|
+
return Object.keys(rootByKey).map(getIDFromKey);
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
var unmountedIDs = [];
|
|
2038
1767
|
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
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;
|
|
1768
|
+
function purgeDeep(id) {
|
|
1769
|
+
var item = getItem(id);
|
|
1770
|
+
if (item) {
|
|
1771
|
+
var childIDs = item.childIDs;
|
|
2045
1772
|
|
|
2046
|
-
|
|
2047
|
-
|
|
1773
|
+
removeItem(id);
|
|
1774
|
+
childIDs.forEach(purgeDeep);
|
|
2048
1775
|
}
|
|
2049
|
-
|
|
2050
|
-
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
function getDisplayName$1(element) {
|
|
1779
|
+
if (element == null) {
|
|
1780
|
+
return '#empty';
|
|
1781
|
+
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1782
|
+
return '#text';
|
|
1783
|
+
} else if (typeof element.type === 'string') {
|
|
1784
|
+
return element.type;
|
|
1785
|
+
} else {
|
|
1786
|
+
return element.type.displayName || element.type.name || 'Unknown';
|
|
2051
1787
|
}
|
|
2052
1788
|
}
|
|
2053
1789
|
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
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.";
|
|
2063
|
-
}
|
|
1790
|
+
function describeID(id) {
|
|
1791
|
+
var name = ReactComponentTreeHook.getDisplayName(id);
|
|
1792
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1793
|
+
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
|
1794
|
+
var ownerName = void 0;
|
|
2064
1795
|
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
1796
|
+
if (ownerID) {
|
|
1797
|
+
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
|
|
1798
|
+
}
|
|
1799
|
+
warning$6(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
|
|
1800
|
+
return describeComponentFrame$1(name || '', element && element._source, ownerName || '');
|
|
1801
|
+
}
|
|
2071
1802
|
|
|
2072
|
-
|
|
1803
|
+
var ReactComponentTreeHook = {
|
|
1804
|
+
onSetChildren: function (id, nextChildIDs) {
|
|
1805
|
+
var item = getItem(id);
|
|
1806
|
+
!item ? invariant_1(false, 'Item must have been set') : void 0;
|
|
1807
|
+
item.childIDs = nextChildIDs;
|
|
2073
1808
|
|
|
2074
|
-
|
|
1809
|
+
for (var i = 0; i < nextChildIDs.length; i++) {
|
|
1810
|
+
var nextChildID = nextChildIDs[i];
|
|
1811
|
+
var nextChild = getItem(nextChildID);
|
|
1812
|
+
!nextChild ? invariant_1(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1813
|
+
!(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;
|
|
1814
|
+
!nextChild.isMounted ? invariant_1(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1815
|
+
if (nextChild.parentID == null) {
|
|
1816
|
+
nextChild.parentID = id;
|
|
1817
|
+
// TODO: This shouldn't be necessary but mounting a new root during in
|
|
1818
|
+
// componentWillMount currently causes not-yet-mounted components to
|
|
1819
|
+
// be purged from our tree data so their parent id is missing.
|
|
1820
|
+
}
|
|
1821
|
+
!(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;
|
|
2075
1822
|
}
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
1823
|
+
},
|
|
1824
|
+
onBeforeMountComponent: function (id, element, parentID) {
|
|
1825
|
+
var item = {
|
|
1826
|
+
element: element,
|
|
1827
|
+
parentID: parentID,
|
|
1828
|
+
text: null,
|
|
1829
|
+
childIDs: [],
|
|
1830
|
+
isMounted: false,
|
|
1831
|
+
updateCount: 0
|
|
1832
|
+
};
|
|
1833
|
+
setItem(id, item);
|
|
1834
|
+
},
|
|
1835
|
+
onBeforeUpdateComponent: function (id, element) {
|
|
1836
|
+
var item = getItem(id);
|
|
1837
|
+
if (!item || !item.isMounted) {
|
|
1838
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1839
|
+
// In this case, ignore the element.
|
|
1840
|
+
return;
|
|
2083
1841
|
}
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
1842
|
+
item.element = element;
|
|
1843
|
+
},
|
|
1844
|
+
onMountComponent: function (id) {
|
|
1845
|
+
var item = getItem(id);
|
|
1846
|
+
!item ? invariant_1(false, 'Item must have been set') : void 0;
|
|
1847
|
+
item.isMounted = true;
|
|
1848
|
+
var isRoot = item.parentID === 0;
|
|
1849
|
+
if (isRoot) {
|
|
1850
|
+
addRoot(id);
|
|
2087
1851
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
1852
|
+
},
|
|
1853
|
+
onUpdateComponent: function (id) {
|
|
1854
|
+
var item = getItem(id);
|
|
1855
|
+
if (!item || !item.isMounted) {
|
|
1856
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1857
|
+
// In this case, ignore the element.
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
item.updateCount++;
|
|
1861
|
+
},
|
|
1862
|
+
onUnmountComponent: function (id) {
|
|
1863
|
+
var item = getItem(id);
|
|
1864
|
+
if (item) {
|
|
1865
|
+
// We need to check if it exists.
|
|
1866
|
+
// `item` might not exist if it is inside an error boundary, and a sibling
|
|
1867
|
+
// error boundary child threw while mounting. Then this instance never
|
|
1868
|
+
// got a chance to mount, but it still gets an unmounting event during
|
|
1869
|
+
// the error boundary cleanup.
|
|
1870
|
+
item.isMounted = false;
|
|
1871
|
+
var isRoot = item.parentID === 0;
|
|
1872
|
+
if (isRoot) {
|
|
1873
|
+
removeRoot(id);
|
|
2097
1874
|
}
|
|
2098
1875
|
}
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
{
|
|
2103
|
-
|
|
1876
|
+
unmountedIDs.push(id);
|
|
1877
|
+
},
|
|
1878
|
+
purgeUnmountedComponents: function () {
|
|
1879
|
+
if (ReactComponentTreeHook._preventPurging) {
|
|
1880
|
+
// Should only be used for testing.
|
|
1881
|
+
return;
|
|
2104
1882
|
}
|
|
2105
1883
|
|
|
2106
|
-
|
|
1884
|
+
for (var i = 0; i < unmountedIDs.length; i++) {
|
|
1885
|
+
var id = unmountedIDs[i];
|
|
1886
|
+
purgeDeep(id);
|
|
1887
|
+
}
|
|
1888
|
+
unmountedIDs.length = 0;
|
|
2107
1889
|
},
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
value: type
|
|
2121
|
-
});
|
|
2122
|
-
return type;
|
|
2123
|
-
}
|
|
2124
|
-
});
|
|
1890
|
+
isMounted: function (id) {
|
|
1891
|
+
var item = getItem(id);
|
|
1892
|
+
return item ? item.isMounted : false;
|
|
1893
|
+
},
|
|
1894
|
+
getCurrentStackAddendum: function () {
|
|
1895
|
+
var info = '';
|
|
1896
|
+
var currentOwner = ReactCurrentOwner_1.current;
|
|
1897
|
+
if (currentOwner) {
|
|
1898
|
+
invariant_1(typeof currentOwner.tag !== 'number', 'Fiber owners should not show up in Stack stack traces.');
|
|
1899
|
+
if (typeof currentOwner._debugID === 'number') {
|
|
1900
|
+
info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
|
|
1901
|
+
}
|
|
2125
1902
|
}
|
|
2126
|
-
|
|
2127
|
-
return validatedFactory;
|
|
1903
|
+
return info;
|
|
2128
1904
|
},
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
1905
|
+
getStackAddendumByID: function (id) {
|
|
1906
|
+
var info = '';
|
|
1907
|
+
while (id) {
|
|
1908
|
+
info += describeID(id);
|
|
1909
|
+
id = ReactComponentTreeHook.getParentID(id);
|
|
2134
1910
|
}
|
|
2135
|
-
|
|
2136
|
-
|
|
1911
|
+
return info;
|
|
1912
|
+
},
|
|
1913
|
+
getChildIDs: function (id) {
|
|
1914
|
+
var item = getItem(id);
|
|
1915
|
+
return item ? item.childIDs : [];
|
|
1916
|
+
},
|
|
1917
|
+
getDisplayName: function (id) {
|
|
1918
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1919
|
+
if (!element) {
|
|
1920
|
+
return null;
|
|
2137
1921
|
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
1922
|
+
return getDisplayName$1(element);
|
|
1923
|
+
},
|
|
1924
|
+
getElement: function (id) {
|
|
1925
|
+
var item = getItem(id);
|
|
1926
|
+
return item ? item.element : null;
|
|
1927
|
+
},
|
|
1928
|
+
getOwnerID: function (id) {
|
|
1929
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1930
|
+
if (!element || !element._owner) {
|
|
1931
|
+
return null;
|
|
2141
1932
|
}
|
|
2142
|
-
return
|
|
2143
|
-
}
|
|
1933
|
+
return element._owner._debugID;
|
|
1934
|
+
},
|
|
1935
|
+
getParentID: function (id) {
|
|
1936
|
+
var item = getItem(id);
|
|
1937
|
+
return item ? item.parentID : null;
|
|
1938
|
+
},
|
|
1939
|
+
getSource: function (id) {
|
|
1940
|
+
var item = getItem(id);
|
|
1941
|
+
var element = item ? item.element : null;
|
|
1942
|
+
var source = element != null ? element._source : null;
|
|
1943
|
+
return source;
|
|
1944
|
+
},
|
|
1945
|
+
getText: function (id) {
|
|
1946
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1947
|
+
if (typeof element === 'string') {
|
|
1948
|
+
return element;
|
|
1949
|
+
} else if (typeof element === 'number') {
|
|
1950
|
+
return '' + element;
|
|
1951
|
+
} else {
|
|
1952
|
+
return null;
|
|
1953
|
+
}
|
|
1954
|
+
},
|
|
1955
|
+
getUpdateCount: function (id) {
|
|
1956
|
+
var item = getItem(id);
|
|
1957
|
+
return item ? item.updateCount : 0;
|
|
1958
|
+
},
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
getRootIDs: getRootIDs,
|
|
1962
|
+
getRegisteredIDs: getItemIDs
|
|
2144
1963
|
};
|
|
2145
1964
|
|
|
2146
|
-
var
|
|
1965
|
+
var ReactComponentTreeHook_1 = ReactComponentTreeHook;
|
|
2147
1966
|
|
|
2148
1967
|
var createElement = ReactElement_1.createElement;
|
|
2149
1968
|
var createFactory = ReactElement_1.createFactory;
|
|
@@ -2167,6 +1986,7 @@ var React = {
|
|
|
2167
1986
|
|
|
2168
1987
|
Component: ReactBaseClasses.Component,
|
|
2169
1988
|
PureComponent: ReactBaseClasses.PureComponent,
|
|
1989
|
+
unstable_AsyncComponent: ReactBaseClasses.AsyncComponent,
|
|
2170
1990
|
|
|
2171
1991
|
createElement: createElement,
|
|
2172
1992
|
cloneElement: cloneElement,
|
|
@@ -2189,8 +2009,8 @@ var React = {
|
|
|
2189
2009
|
});
|
|
2190
2010
|
}
|
|
2191
2011
|
|
|
2192
|
-
var
|
|
2012
|
+
var ReactEntry = React;
|
|
2193
2013
|
|
|
2194
|
-
return
|
|
2014
|
+
return ReactEntry;
|
|
2195
2015
|
|
|
2196
2016
|
})));
|