react 16.0.0-alpha.9 → 16.0.0-alpha.10
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 +621 -633
- package/cjs/react.production.min.js +1 -1
- package/package.json +1 -1
- package/umd/react.development.js +788 -762
- package/umd/react.production.min.js +2 -2
package/cjs/react.development.js
CHANGED
|
@@ -802,457 +802,139 @@ var KeyEscapeUtils = {
|
|
|
802
802
|
|
|
803
803
|
var KeyEscapeUtils_1 = KeyEscapeUtils;
|
|
804
804
|
|
|
805
|
-
var SEPARATOR = '.';
|
|
806
|
-
var SUBSEPARATOR = ':';
|
|
807
|
-
|
|
808
805
|
/**
|
|
809
|
-
*
|
|
810
|
-
*
|
|
806
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
807
|
+
* All rights reserved.
|
|
811
808
|
*
|
|
809
|
+
* This source code is licensed under the BSD-style license found in the
|
|
810
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
811
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
812
|
+
*
|
|
813
|
+
* @providesModule ReactTypeOfWork
|
|
814
|
+
*
|
|
812
815
|
*/
|
|
813
816
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
817
|
+
var ReactTypeOfWork = {
|
|
818
|
+
IndeterminateComponent: 0, // Before we know whether it is functional or class
|
|
819
|
+
FunctionalComponent: 1,
|
|
820
|
+
ClassComponent: 2,
|
|
821
|
+
HostRoot: 3, // Root of a host tree. Could be nested inside another node.
|
|
822
|
+
HostPortal: 4, // A subtree. Could be an entry point to a different renderer.
|
|
823
|
+
HostComponent: 5,
|
|
824
|
+
HostText: 6,
|
|
825
|
+
CoroutineComponent: 7,
|
|
826
|
+
CoroutineHandlerPhase: 8,
|
|
827
|
+
YieldComponent: 9,
|
|
828
|
+
Fragment: 10
|
|
829
|
+
};
|
|
820
830
|
|
|
821
831
|
/**
|
|
822
|
-
*
|
|
832
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
833
|
+
* All rights reserved.
|
|
823
834
|
*
|
|
824
|
-
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
// that we don't block potential future ES APIs.
|
|
831
|
-
if (component && typeof component === 'object' && component.key != null) {
|
|
832
|
-
// Explicit key
|
|
833
|
-
return KeyEscapeUtils_1.escape(component.key);
|
|
834
|
-
}
|
|
835
|
-
// Implicit key determined by the index in the set
|
|
836
|
-
return index.toString(36);
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* @param {?*} children Children tree container.
|
|
841
|
-
* @param {!string} nameSoFar Name of the key path so far.
|
|
842
|
-
* @param {!function} callback Callback to invoke with each child found.
|
|
843
|
-
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
844
|
-
* process.
|
|
845
|
-
* @return {!number} The number of children in this subtree.
|
|
835
|
+
* This source code is licensed under the BSD-style license found in the
|
|
836
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
837
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
838
|
+
*
|
|
839
|
+
* @providesModule getComponentName
|
|
840
|
+
*
|
|
846
841
|
*/
|
|
847
|
-
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
848
|
-
var type = typeof children;
|
|
849
842
|
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
843
|
+
function getComponentName(instanceOrFiber) {
|
|
844
|
+
if (typeof instanceOrFiber.getName === 'function') {
|
|
845
|
+
// Stack reconciler
|
|
846
|
+
var instance = instanceOrFiber;
|
|
847
|
+
return instance.getName();
|
|
853
848
|
}
|
|
849
|
+
if (typeof instanceOrFiber.tag === 'number') {
|
|
850
|
+
// Fiber reconciler
|
|
851
|
+
var fiber = instanceOrFiber;
|
|
852
|
+
var type = fiber.type;
|
|
854
853
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
// so that it's consistent if the number of children grows.
|
|
862
|
-
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
863
|
-
return 1;
|
|
854
|
+
if (typeof type === 'string') {
|
|
855
|
+
return type;
|
|
856
|
+
}
|
|
857
|
+
if (typeof type === 'function') {
|
|
858
|
+
return type.displayName || type.name;
|
|
859
|
+
}
|
|
864
860
|
}
|
|
861
|
+
return null;
|
|
862
|
+
}
|
|
865
863
|
|
|
866
|
-
|
|
867
|
-
var nextName;
|
|
868
|
-
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
869
|
-
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
864
|
+
var getComponentName_1 = getComponentName;
|
|
870
865
|
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
876
|
-
}
|
|
877
|
-
} else {
|
|
878
|
-
var iteratorFn = getIteratorFn_1(children);
|
|
879
|
-
if (iteratorFn) {
|
|
880
|
-
{
|
|
881
|
-
// Warn about using Maps as children
|
|
882
|
-
if (iteratorFn === children.entries) {
|
|
883
|
-
var mapsAsChildrenAddendum = '';
|
|
884
|
-
if (ReactCurrentOwner_1.current) {
|
|
885
|
-
var mapsAsChildrenOwnerName = ReactCurrentOwner_1.current.getName();
|
|
886
|
-
if (mapsAsChildrenOwnerName) {
|
|
887
|
-
mapsAsChildrenAddendum = '\n\nCheck the render method of `' + mapsAsChildrenOwnerName + '`.';
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
warning(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);
|
|
891
|
-
didWarnAboutMaps = true;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
866
|
+
var IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent;
|
|
867
|
+
var FunctionalComponent = ReactTypeOfWork.FunctionalComponent;
|
|
868
|
+
var ClassComponent = ReactTypeOfWork.ClassComponent;
|
|
869
|
+
var HostComponent = ReactTypeOfWork.HostComponent;
|
|
894
870
|
|
|
895
|
-
var iterator = iteratorFn.call(children);
|
|
896
|
-
var step;
|
|
897
|
-
var ii = 0;
|
|
898
|
-
while (!(step = iterator.next()).done) {
|
|
899
|
-
child = step.value;
|
|
900
|
-
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
901
|
-
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
902
|
-
}
|
|
903
|
-
} else if (type === 'object') {
|
|
904
|
-
var addendum = '';
|
|
905
|
-
{
|
|
906
|
-
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.';
|
|
907
|
-
if (ReactCurrentOwner_1.current) {
|
|
908
|
-
var name = ReactCurrentOwner_1.current.getName();
|
|
909
|
-
if (name) {
|
|
910
|
-
addendum += '\n\nCheck the render method of `' + name + '`.';
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
var childrenString = '' + children;
|
|
915
|
-
invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
871
|
|
|
919
|
-
|
|
872
|
+
|
|
873
|
+
function describeComponentFrame$1(name, source, ownerName) {
|
|
874
|
+
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
920
875
|
}
|
|
921
876
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
function traverseAllChildren(children, callback, traverseContext) {
|
|
939
|
-
if (children == null) {
|
|
940
|
-
return 0;
|
|
877
|
+
function describeFiber(fiber) {
|
|
878
|
+
switch (fiber.tag) {
|
|
879
|
+
case IndeterminateComponent:
|
|
880
|
+
case FunctionalComponent:
|
|
881
|
+
case ClassComponent:
|
|
882
|
+
case HostComponent:
|
|
883
|
+
var owner = fiber._debugOwner;
|
|
884
|
+
var source = fiber._debugSource;
|
|
885
|
+
var name = getComponentName_1(fiber);
|
|
886
|
+
var ownerName = null;
|
|
887
|
+
if (owner) {
|
|
888
|
+
ownerName = getComponentName_1(owner);
|
|
889
|
+
}
|
|
890
|
+
return describeComponentFrame$1(name, source, ownerName);
|
|
891
|
+
default:
|
|
892
|
+
return '';
|
|
941
893
|
}
|
|
894
|
+
}
|
|
942
895
|
|
|
943
|
-
|
|
896
|
+
// This function can only be called with a work-in-progress fiber and
|
|
897
|
+
// only during begin or complete phase. Do not call it under any other
|
|
898
|
+
// circumstances.
|
|
899
|
+
function getStackAddendumByWorkInProgressFiber$1(workInProgress) {
|
|
900
|
+
var info = '';
|
|
901
|
+
var node = workInProgress;
|
|
902
|
+
do {
|
|
903
|
+
info += describeFiber(node);
|
|
904
|
+
// Otherwise this return pointer might point to the wrong tree:
|
|
905
|
+
node = node['return'];
|
|
906
|
+
} while (node);
|
|
907
|
+
return info;
|
|
944
908
|
}
|
|
945
909
|
|
|
946
|
-
var
|
|
910
|
+
var ReactFiberComponentTreeHook = {
|
|
911
|
+
getStackAddendumByWorkInProgressFiber: getStackAddendumByWorkInProgressFiber$1,
|
|
912
|
+
describeComponentFrame: describeComponentFrame$1
|
|
913
|
+
};
|
|
947
914
|
|
|
948
|
-
var
|
|
949
|
-
var
|
|
915
|
+
var getStackAddendumByWorkInProgressFiber = ReactFiberComponentTreeHook.getStackAddendumByWorkInProgressFiber;
|
|
916
|
+
var describeComponentFrame = ReactFiberComponentTreeHook.describeComponentFrame;
|
|
950
917
|
|
|
951
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
952
|
-
function escapeUserProvidedKey(text) {
|
|
953
|
-
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
954
|
-
}
|
|
955
918
|
|
|
956
|
-
/**
|
|
957
|
-
* PooledClass representing the bookkeeping associated with performing a child
|
|
958
|
-
* traversal. Allows avoiding binding callbacks.
|
|
959
|
-
*
|
|
960
|
-
* @constructor ForEachBookKeeping
|
|
961
|
-
* @param {!function} forEachFunction Function to perform traversal with.
|
|
962
|
-
* @param {?*} forEachContext Context to perform context with.
|
|
963
|
-
*/
|
|
964
|
-
function ForEachBookKeeping(forEachFunction, forEachContext) {
|
|
965
|
-
this.func = forEachFunction;
|
|
966
|
-
this.context = forEachContext;
|
|
967
|
-
this.count = 0;
|
|
968
|
-
}
|
|
969
|
-
ForEachBookKeeping.prototype.destructor = function () {
|
|
970
|
-
this.func = null;
|
|
971
|
-
this.context = null;
|
|
972
|
-
this.count = 0;
|
|
973
|
-
};
|
|
974
|
-
PooledClass_1.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
|
|
975
919
|
|
|
976
|
-
function forEachSingleChild(bookKeeping, child, name) {
|
|
977
|
-
var func = bookKeeping.func,
|
|
978
|
-
context = bookKeeping.context;
|
|
979
920
|
|
|
980
|
-
func.call(context, child, bookKeeping.count++);
|
|
981
|
-
}
|
|
982
921
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
|
|
1000
|
-
traverseAllChildren_1(children, forEachSingleChild, traverseContext);
|
|
1001
|
-
ForEachBookKeeping.release(traverseContext);
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
/**
|
|
1005
|
-
* PooledClass representing the bookkeeping associated with performing a child
|
|
1006
|
-
* mapping. Allows avoiding binding callbacks.
|
|
1007
|
-
*
|
|
1008
|
-
* @constructor MapBookKeeping
|
|
1009
|
-
* @param {!*} mapResult Object containing the ordered map of results.
|
|
1010
|
-
* @param {!function} mapFunction Function to perform mapping with.
|
|
1011
|
-
* @param {?*} mapContext Context to perform mapping with.
|
|
1012
|
-
*/
|
|
1013
|
-
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
1014
|
-
this.result = mapResult;
|
|
1015
|
-
this.keyPrefix = keyPrefix;
|
|
1016
|
-
this.func = mapFunction;
|
|
1017
|
-
this.context = mapContext;
|
|
1018
|
-
this.count = 0;
|
|
1019
|
-
}
|
|
1020
|
-
MapBookKeeping.prototype.destructor = function () {
|
|
1021
|
-
this.result = null;
|
|
1022
|
-
this.keyPrefix = null;
|
|
1023
|
-
this.func = null;
|
|
1024
|
-
this.context = null;
|
|
1025
|
-
this.count = 0;
|
|
1026
|
-
};
|
|
1027
|
-
PooledClass_1.addPoolingTo(MapBookKeeping, fourArgumentPooler);
|
|
1028
|
-
|
|
1029
|
-
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1030
|
-
var result = bookKeeping.result,
|
|
1031
|
-
keyPrefix = bookKeeping.keyPrefix,
|
|
1032
|
-
func = bookKeeping.func,
|
|
1033
|
-
context = bookKeeping.context;
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1037
|
-
if (Array.isArray(mappedChild)) {
|
|
1038
|
-
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
|
|
1039
|
-
} else if (mappedChild != null) {
|
|
1040
|
-
if (ReactElement_1.isValidElement(mappedChild)) {
|
|
1041
|
-
mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
|
|
1042
|
-
// Keep both the (mapped) and old keys if they differ, just as
|
|
1043
|
-
// traverseAllChildren used to do for objects as children
|
|
1044
|
-
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1045
|
-
}
|
|
1046
|
-
result.push(mappedChild);
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1051
|
-
var escapedPrefix = '';
|
|
1052
|
-
if (prefix != null) {
|
|
1053
|
-
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1054
|
-
}
|
|
1055
|
-
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
|
|
1056
|
-
traverseAllChildren_1(children, mapSingleChildIntoContext, traverseContext);
|
|
1057
|
-
MapBookKeeping.release(traverseContext);
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
/**
|
|
1061
|
-
* Maps children that are typically specified as `props.children`.
|
|
1062
|
-
*
|
|
1063
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.map
|
|
1064
|
-
*
|
|
1065
|
-
* The provided mapFunction(child, key, index) will be called for each
|
|
1066
|
-
* leaf child.
|
|
1067
|
-
*
|
|
1068
|
-
* @param {?*} children Children tree container.
|
|
1069
|
-
* @param {function(*, int)} func The map function.
|
|
1070
|
-
* @param {*} context Context for mapFunction.
|
|
1071
|
-
* @return {object} Object containing the ordered map of results.
|
|
1072
|
-
*/
|
|
1073
|
-
function mapChildren(children, func, context) {
|
|
1074
|
-
if (children == null) {
|
|
1075
|
-
return children;
|
|
1076
|
-
}
|
|
1077
|
-
var result = [];
|
|
1078
|
-
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1079
|
-
return result;
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
function forEachSingleChildDummy(traverseContext, child, name) {
|
|
1083
|
-
return null;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
/**
|
|
1087
|
-
* Count the number of children that are typically specified as
|
|
1088
|
-
* `props.children`.
|
|
1089
|
-
*
|
|
1090
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.count
|
|
1091
|
-
*
|
|
1092
|
-
* @param {?*} children Children tree container.
|
|
1093
|
-
* @return {number} The number of children.
|
|
1094
|
-
*/
|
|
1095
|
-
function countChildren(children, context) {
|
|
1096
|
-
return traverseAllChildren_1(children, forEachSingleChildDummy, null);
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
/**
|
|
1100
|
-
* Flatten a children object (typically specified as `props.children`) and
|
|
1101
|
-
* return an array with appropriately re-keyed children.
|
|
1102
|
-
*
|
|
1103
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
|
|
1104
|
-
*/
|
|
1105
|
-
function toArray(children) {
|
|
1106
|
-
var result = [];
|
|
1107
|
-
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
|
|
1108
|
-
return result;
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
var ReactChildren = {
|
|
1112
|
-
forEach: forEachChildren,
|
|
1113
|
-
map: mapChildren,
|
|
1114
|
-
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
|
1115
|
-
count: countChildren,
|
|
1116
|
-
toArray: toArray
|
|
1117
|
-
};
|
|
1118
|
-
|
|
1119
|
-
var ReactChildren_1 = ReactChildren;
|
|
1120
|
-
|
|
1121
|
-
/**
|
|
1122
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1123
|
-
* All rights reserved.
|
|
1124
|
-
*
|
|
1125
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1126
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1127
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1128
|
-
*
|
|
1129
|
-
* @providesModule getComponentName
|
|
1130
|
-
*
|
|
1131
|
-
*/
|
|
1132
|
-
|
|
1133
|
-
function getComponentName(instanceOrFiber) {
|
|
1134
|
-
if (typeof instanceOrFiber.getName === 'function') {
|
|
1135
|
-
// Stack reconciler
|
|
1136
|
-
var instance = instanceOrFiber;
|
|
1137
|
-
return instance.getName();
|
|
1138
|
-
}
|
|
1139
|
-
if (typeof instanceOrFiber.tag === 'number') {
|
|
1140
|
-
// Fiber reconciler
|
|
1141
|
-
var fiber = instanceOrFiber;
|
|
1142
|
-
var type = fiber.type;
|
|
1143
|
-
|
|
1144
|
-
if (typeof type === 'string') {
|
|
1145
|
-
return type;
|
|
1146
|
-
}
|
|
1147
|
-
if (typeof type === 'function') {
|
|
1148
|
-
return type.displayName || type.name;
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
return null;
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
var getComponentName_1 = getComponentName;
|
|
1155
|
-
|
|
1156
|
-
var checkPropTypes$2 = checkPropTypes;
|
|
1157
|
-
|
|
1158
|
-
/**
|
|
1159
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1160
|
-
* All rights reserved.
|
|
1161
|
-
*
|
|
1162
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1163
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1164
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1165
|
-
*
|
|
1166
|
-
* @providesModule ReactTypeOfWork
|
|
1167
|
-
*
|
|
1168
|
-
*/
|
|
1169
|
-
|
|
1170
|
-
var ReactTypeOfWork = {
|
|
1171
|
-
IndeterminateComponent: 0, // Before we know whether it is functional or class
|
|
1172
|
-
FunctionalComponent: 1,
|
|
1173
|
-
ClassComponent: 2,
|
|
1174
|
-
HostRoot: 3, // Root of a host tree. Could be nested inside another node.
|
|
1175
|
-
HostPortal: 4, // A subtree. Could be an entry point to a different renderer.
|
|
1176
|
-
HostComponent: 5,
|
|
1177
|
-
HostText: 6,
|
|
1178
|
-
CoroutineComponent: 7,
|
|
1179
|
-
CoroutineHandlerPhase: 8,
|
|
1180
|
-
YieldComponent: 9,
|
|
1181
|
-
Fragment: 10
|
|
1182
|
-
};
|
|
1183
|
-
|
|
1184
|
-
var IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent;
|
|
1185
|
-
var FunctionalComponent = ReactTypeOfWork.FunctionalComponent;
|
|
1186
|
-
var ClassComponent = ReactTypeOfWork.ClassComponent;
|
|
1187
|
-
var HostComponent = ReactTypeOfWork.HostComponent;
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
function describeComponentFrame$1(name, source, ownerName) {
|
|
1192
|
-
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
function describeFiber(fiber) {
|
|
1196
|
-
switch (fiber.tag) {
|
|
1197
|
-
case IndeterminateComponent:
|
|
1198
|
-
case FunctionalComponent:
|
|
1199
|
-
case ClassComponent:
|
|
1200
|
-
case HostComponent:
|
|
1201
|
-
var owner = fiber._debugOwner;
|
|
1202
|
-
var source = fiber._debugSource;
|
|
1203
|
-
var name = getComponentName_1(fiber);
|
|
1204
|
-
var ownerName = null;
|
|
1205
|
-
if (owner) {
|
|
1206
|
-
ownerName = getComponentName_1(owner);
|
|
1207
|
-
}
|
|
1208
|
-
return describeComponentFrame$1(name, source, ownerName);
|
|
1209
|
-
default:
|
|
1210
|
-
return '';
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
// This function can only be called with a work-in-progress fiber and
|
|
1215
|
-
// only during begin or complete phase. Do not call it under any other
|
|
1216
|
-
// circumstances.
|
|
1217
|
-
function getStackAddendumByWorkInProgressFiber$2(workInProgress) {
|
|
1218
|
-
var info = '';
|
|
1219
|
-
var node = workInProgress;
|
|
1220
|
-
do {
|
|
1221
|
-
info += describeFiber(node);
|
|
1222
|
-
// Otherwise this return pointer might point to the wrong tree:
|
|
1223
|
-
node = node['return'];
|
|
1224
|
-
} while (node);
|
|
1225
|
-
return info;
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
var ReactFiberComponentTreeHook = {
|
|
1229
|
-
getStackAddendumByWorkInProgressFiber: getStackAddendumByWorkInProgressFiber$2,
|
|
1230
|
-
describeComponentFrame: describeComponentFrame$1
|
|
1231
|
-
};
|
|
1232
|
-
|
|
1233
|
-
var getStackAddendumByWorkInProgressFiber$1 = ReactFiberComponentTreeHook.getStackAddendumByWorkInProgressFiber;
|
|
1234
|
-
var describeComponentFrame = ReactFiberComponentTreeHook.describeComponentFrame;
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
function isNative(fn) {
|
|
1241
|
-
// Based on isNative() from Lodash
|
|
1242
|
-
var funcToString = Function.prototype.toString;
|
|
1243
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1244
|
-
var reIsNative = RegExp('^' + funcToString
|
|
1245
|
-
// Take an example native function source for comparison
|
|
1246
|
-
.call(hasOwnProperty)
|
|
1247
|
-
// Strip regex characters so we can use it for regex
|
|
1248
|
-
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
|
1249
|
-
// Remove hasOwnProperty from the template to make it generic
|
|
1250
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
1251
|
-
try {
|
|
1252
|
-
var source = funcToString.call(fn);
|
|
1253
|
-
return reIsNative.test(source);
|
|
1254
|
-
} catch (err) {
|
|
1255
|
-
return false;
|
|
922
|
+
function isNative(fn) {
|
|
923
|
+
// Based on isNative() from Lodash
|
|
924
|
+
var funcToString = Function.prototype.toString;
|
|
925
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
926
|
+
var reIsNative = RegExp('^' + funcToString
|
|
927
|
+
// Take an example native function source for comparison
|
|
928
|
+
.call(hasOwnProperty)
|
|
929
|
+
// Strip regex characters so we can use it for regex
|
|
930
|
+
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
|
931
|
+
// Remove hasOwnProperty from the template to make it generic
|
|
932
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
933
|
+
try {
|
|
934
|
+
var source = funcToString.call(fn);
|
|
935
|
+
return reIsNative.test(source);
|
|
936
|
+
} catch (err) {
|
|
937
|
+
return false;
|
|
1256
938
|
}
|
|
1257
939
|
}
|
|
1258
940
|
|
|
@@ -1356,214 +1038,522 @@ function purgeDeep(id) {
|
|
|
1356
1038
|
}
|
|
1357
1039
|
}
|
|
1358
1040
|
|
|
1359
|
-
function getDisplayName(element) {
|
|
1360
|
-
if (element == null) {
|
|
1361
|
-
return '#empty';
|
|
1362
|
-
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1363
|
-
return '#text';
|
|
1364
|
-
} else if (typeof element.type === 'string') {
|
|
1365
|
-
return element.type;
|
|
1366
|
-
} else {
|
|
1367
|
-
return element.type.displayName || element.type.name || 'Unknown';
|
|
1041
|
+
function getDisplayName(element) {
|
|
1042
|
+
if (element == null) {
|
|
1043
|
+
return '#empty';
|
|
1044
|
+
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1045
|
+
return '#text';
|
|
1046
|
+
} else if (typeof element.type === 'string') {
|
|
1047
|
+
return element.type;
|
|
1048
|
+
} else {
|
|
1049
|
+
return element.type.displayName || element.type.name || 'Unknown';
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
function describeID(id) {
|
|
1054
|
+
var name = ReactComponentTreeHook.getDisplayName(id);
|
|
1055
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1056
|
+
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
|
1057
|
+
var ownerName = void 0;
|
|
1058
|
+
|
|
1059
|
+
if (ownerID) {
|
|
1060
|
+
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
|
|
1061
|
+
}
|
|
1062
|
+
warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
|
|
1063
|
+
return describeComponentFrame(name || '', element && element._source, ownerName || '');
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
var ReactComponentTreeHook = {
|
|
1067
|
+
onSetChildren: function (id, nextChildIDs) {
|
|
1068
|
+
var item = getItem(id);
|
|
1069
|
+
invariant(item, 'Item must have been set');
|
|
1070
|
+
item.childIDs = nextChildIDs;
|
|
1071
|
+
|
|
1072
|
+
for (var i = 0; i < nextChildIDs.length; i++) {
|
|
1073
|
+
var nextChildID = nextChildIDs[i];
|
|
1074
|
+
var nextChild = getItem(nextChildID);
|
|
1075
|
+
!nextChild ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1076
|
+
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : void 0;
|
|
1077
|
+
!nextChild.isMounted ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1078
|
+
if (nextChild.parentID == null) {
|
|
1079
|
+
nextChild.parentID = id;
|
|
1080
|
+
// TODO: This shouldn't be necessary but mounting a new root during in
|
|
1081
|
+
// componentWillMount currently causes not-yet-mounted components to
|
|
1082
|
+
// be purged from our tree data so their parent id is missing.
|
|
1083
|
+
}
|
|
1084
|
+
!(nextChild.parentID === id) ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : void 0;
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
onBeforeMountComponent: function (id, element, parentID) {
|
|
1088
|
+
var item = {
|
|
1089
|
+
element: element,
|
|
1090
|
+
parentID: parentID,
|
|
1091
|
+
text: null,
|
|
1092
|
+
childIDs: [],
|
|
1093
|
+
isMounted: false,
|
|
1094
|
+
updateCount: 0
|
|
1095
|
+
};
|
|
1096
|
+
setItem(id, item);
|
|
1097
|
+
},
|
|
1098
|
+
onBeforeUpdateComponent: function (id, element) {
|
|
1099
|
+
var item = getItem(id);
|
|
1100
|
+
if (!item || !item.isMounted) {
|
|
1101
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1102
|
+
// In this case, ignore the element.
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
item.element = element;
|
|
1106
|
+
},
|
|
1107
|
+
onMountComponent: function (id) {
|
|
1108
|
+
var item = getItem(id);
|
|
1109
|
+
invariant(item, 'Item must have been set');
|
|
1110
|
+
item.isMounted = true;
|
|
1111
|
+
var isRoot = item.parentID === 0;
|
|
1112
|
+
if (isRoot) {
|
|
1113
|
+
addRoot(id);
|
|
1114
|
+
}
|
|
1115
|
+
},
|
|
1116
|
+
onUpdateComponent: function (id) {
|
|
1117
|
+
var item = getItem(id);
|
|
1118
|
+
if (!item || !item.isMounted) {
|
|
1119
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1120
|
+
// In this case, ignore the element.
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
item.updateCount++;
|
|
1124
|
+
},
|
|
1125
|
+
onUnmountComponent: function (id) {
|
|
1126
|
+
var item = getItem(id);
|
|
1127
|
+
if (item) {
|
|
1128
|
+
// We need to check if it exists.
|
|
1129
|
+
// `item` might not exist if it is inside an error boundary, and a sibling
|
|
1130
|
+
// error boundary child threw while mounting. Then this instance never
|
|
1131
|
+
// got a chance to mount, but it still gets an unmounting event during
|
|
1132
|
+
// the error boundary cleanup.
|
|
1133
|
+
item.isMounted = false;
|
|
1134
|
+
var isRoot = item.parentID === 0;
|
|
1135
|
+
if (isRoot) {
|
|
1136
|
+
removeRoot(id);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
unmountedIDs.push(id);
|
|
1140
|
+
},
|
|
1141
|
+
purgeUnmountedComponents: function () {
|
|
1142
|
+
if (ReactComponentTreeHook._preventPurging) {
|
|
1143
|
+
// Should only be used for testing.
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
for (var i = 0; i < unmountedIDs.length; i++) {
|
|
1148
|
+
var id = unmountedIDs[i];
|
|
1149
|
+
purgeDeep(id);
|
|
1150
|
+
}
|
|
1151
|
+
unmountedIDs.length = 0;
|
|
1152
|
+
},
|
|
1153
|
+
isMounted: function (id) {
|
|
1154
|
+
var item = getItem(id);
|
|
1155
|
+
return item ? item.isMounted : false;
|
|
1156
|
+
},
|
|
1157
|
+
getCurrentStackAddendum: function (topElement) {
|
|
1158
|
+
var info = '';
|
|
1159
|
+
if (topElement) {
|
|
1160
|
+
var name = getDisplayName(topElement);
|
|
1161
|
+
var owner = topElement._owner;
|
|
1162
|
+
info += describeComponentFrame(name, topElement._source, owner && getComponentName_1(owner));
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
var currentOwner = ReactCurrentOwner_1.current;
|
|
1166
|
+
if (currentOwner) {
|
|
1167
|
+
if (typeof currentOwner.tag === 'number') {
|
|
1168
|
+
var workInProgress = currentOwner;
|
|
1169
|
+
// Safe because if current owner exists, we are reconciling,
|
|
1170
|
+
// and it is guaranteed to be the work-in-progress version.
|
|
1171
|
+
info += getStackAddendumByWorkInProgressFiber(workInProgress);
|
|
1172
|
+
} else if (typeof currentOwner._debugID === 'number') {
|
|
1173
|
+
info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
return info;
|
|
1177
|
+
},
|
|
1178
|
+
getStackAddendumByID: function (id) {
|
|
1179
|
+
var info = '';
|
|
1180
|
+
while (id) {
|
|
1181
|
+
info += describeID(id);
|
|
1182
|
+
id = ReactComponentTreeHook.getParentID(id);
|
|
1183
|
+
}
|
|
1184
|
+
return info;
|
|
1185
|
+
},
|
|
1186
|
+
getChildIDs: function (id) {
|
|
1187
|
+
var item = getItem(id);
|
|
1188
|
+
return item ? item.childIDs : [];
|
|
1189
|
+
},
|
|
1190
|
+
getDisplayName: function (id) {
|
|
1191
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1192
|
+
if (!element) {
|
|
1193
|
+
return null;
|
|
1194
|
+
}
|
|
1195
|
+
return getDisplayName(element);
|
|
1196
|
+
},
|
|
1197
|
+
getElement: function (id) {
|
|
1198
|
+
var item = getItem(id);
|
|
1199
|
+
return item ? item.element : null;
|
|
1200
|
+
},
|
|
1201
|
+
getOwnerID: function (id) {
|
|
1202
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1203
|
+
if (!element || !element._owner) {
|
|
1204
|
+
return null;
|
|
1205
|
+
}
|
|
1206
|
+
return element._owner._debugID;
|
|
1207
|
+
},
|
|
1208
|
+
getParentID: function (id) {
|
|
1209
|
+
var item = getItem(id);
|
|
1210
|
+
return item ? item.parentID : null;
|
|
1211
|
+
},
|
|
1212
|
+
getSource: function (id) {
|
|
1213
|
+
var item = getItem(id);
|
|
1214
|
+
var element = item ? item.element : null;
|
|
1215
|
+
var source = element != null ? element._source : null;
|
|
1216
|
+
return source;
|
|
1217
|
+
},
|
|
1218
|
+
getText: function (id) {
|
|
1219
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1220
|
+
if (typeof element === 'string') {
|
|
1221
|
+
return element;
|
|
1222
|
+
} else if (typeof element === 'number') {
|
|
1223
|
+
return '' + element;
|
|
1224
|
+
} else {
|
|
1225
|
+
return null;
|
|
1226
|
+
}
|
|
1227
|
+
},
|
|
1228
|
+
getUpdateCount: function (id) {
|
|
1229
|
+
var item = getItem(id);
|
|
1230
|
+
return item ? item.updateCount : 0;
|
|
1231
|
+
},
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
getRootIDs: getRootIDs,
|
|
1235
|
+
getRegisteredIDs: getItemIDs
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
var ReactComponentTreeHook_1 = ReactComponentTreeHook;
|
|
1239
|
+
|
|
1240
|
+
{
|
|
1241
|
+
var _require = ReactComponentTreeHook_1,
|
|
1242
|
+
getCurrentStackAddendum = _require.getCurrentStackAddendum;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
var SEPARATOR = '.';
|
|
1246
|
+
var SUBSEPARATOR = ':';
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* This is inlined from ReactElement since this file is shared between
|
|
1250
|
+
* isomorphic and renderers. We could extract this to a
|
|
1251
|
+
*
|
|
1252
|
+
*/
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* TODO: Test that a single child and an array with one item have the same key
|
|
1256
|
+
* pattern.
|
|
1257
|
+
*/
|
|
1258
|
+
|
|
1259
|
+
var didWarnAboutMaps = false;
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Generate a key string that identifies a component within a set.
|
|
1263
|
+
*
|
|
1264
|
+
* @param {*} component A component that could contain a manual key.
|
|
1265
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
1266
|
+
* @return {string}
|
|
1267
|
+
*/
|
|
1268
|
+
function getComponentKey(component, index) {
|
|
1269
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1270
|
+
// that we don't block potential future ES APIs.
|
|
1271
|
+
if (component && typeof component === 'object' && component.key != null) {
|
|
1272
|
+
// Explicit key
|
|
1273
|
+
return KeyEscapeUtils_1.escape(component.key);
|
|
1274
|
+
}
|
|
1275
|
+
// Implicit key determined by the index in the set
|
|
1276
|
+
return index.toString(36);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* @param {?*} children Children tree container.
|
|
1281
|
+
* @param {!string} nameSoFar Name of the key path so far.
|
|
1282
|
+
* @param {!function} callback Callback to invoke with each child found.
|
|
1283
|
+
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
1284
|
+
* process.
|
|
1285
|
+
* @return {!number} The number of children in this subtree.
|
|
1286
|
+
*/
|
|
1287
|
+
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
1288
|
+
var type = typeof children;
|
|
1289
|
+
|
|
1290
|
+
if (type === 'undefined' || type === 'boolean') {
|
|
1291
|
+
// All of the above are perceived as null.
|
|
1292
|
+
children = null;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
if (children === null || type === 'string' || type === 'number' ||
|
|
1296
|
+
// The following is inlined from ReactElement. This means we can optimize
|
|
1297
|
+
// some checks. React Fiber also inlines this logic for similar purposes.
|
|
1298
|
+
type === 'object' && children.$$typeof === ReactElementSymbol) {
|
|
1299
|
+
callback(traverseContext, children,
|
|
1300
|
+
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1301
|
+
// so that it's consistent if the number of children grows.
|
|
1302
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
1303
|
+
return 1;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
var child;
|
|
1307
|
+
var nextName;
|
|
1308
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1309
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1310
|
+
|
|
1311
|
+
if (Array.isArray(children)) {
|
|
1312
|
+
for (var i = 0; i < children.length; i++) {
|
|
1313
|
+
child = children[i];
|
|
1314
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
|
1315
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1316
|
+
}
|
|
1317
|
+
} else {
|
|
1318
|
+
var iteratorFn = getIteratorFn_1(children);
|
|
1319
|
+
if (iteratorFn) {
|
|
1320
|
+
{
|
|
1321
|
+
// Warn about using Maps as children
|
|
1322
|
+
if (iteratorFn === children.entries) {
|
|
1323
|
+
warning(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());
|
|
1324
|
+
didWarnAboutMaps = true;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
var iterator = iteratorFn.call(children);
|
|
1329
|
+
var step;
|
|
1330
|
+
var ii = 0;
|
|
1331
|
+
while (!(step = iterator.next()).done) {
|
|
1332
|
+
child = step.value;
|
|
1333
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
1334
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1335
|
+
}
|
|
1336
|
+
} else if (type === 'object') {
|
|
1337
|
+
var addendum = '';
|
|
1338
|
+
{
|
|
1339
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentStackAddendum();
|
|
1340
|
+
}
|
|
1341
|
+
var childrenString = '' + children;
|
|
1342
|
+
invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
return subtreeCount;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Traverses children that are typically specified as `props.children`, but
|
|
1351
|
+
* might also be specified through attributes:
|
|
1352
|
+
*
|
|
1353
|
+
* - `traverseAllChildren(this.props.children, ...)`
|
|
1354
|
+
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
1355
|
+
*
|
|
1356
|
+
* The `traverseContext` is an optional argument that is passed through the
|
|
1357
|
+
* entire traversal. It can be used to store accumulations or anything else that
|
|
1358
|
+
* the callback might find relevant.
|
|
1359
|
+
*
|
|
1360
|
+
* @param {?*} children Children tree object.
|
|
1361
|
+
* @param {!function} callback To invoke upon traversing each child.
|
|
1362
|
+
* @param {?*} traverseContext Context for traversal.
|
|
1363
|
+
* @return {!number} The number of children in this subtree.
|
|
1364
|
+
*/
|
|
1365
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
|
1366
|
+
if (children == null) {
|
|
1367
|
+
return 0;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
var traverseAllChildren_1 = traverseAllChildren;
|
|
1374
|
+
|
|
1375
|
+
var twoArgumentPooler = PooledClass_1.twoArgumentPooler;
|
|
1376
|
+
var fourArgumentPooler = PooledClass_1.fourArgumentPooler;
|
|
1377
|
+
|
|
1378
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1379
|
+
function escapeUserProvidedKey(text) {
|
|
1380
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* PooledClass representing the bookkeeping associated with performing a child
|
|
1385
|
+
* traversal. Allows avoiding binding callbacks.
|
|
1386
|
+
*
|
|
1387
|
+
* @constructor ForEachBookKeeping
|
|
1388
|
+
* @param {!function} forEachFunction Function to perform traversal with.
|
|
1389
|
+
* @param {?*} forEachContext Context to perform context with.
|
|
1390
|
+
*/
|
|
1391
|
+
function ForEachBookKeeping(forEachFunction, forEachContext) {
|
|
1392
|
+
this.func = forEachFunction;
|
|
1393
|
+
this.context = forEachContext;
|
|
1394
|
+
this.count = 0;
|
|
1395
|
+
}
|
|
1396
|
+
ForEachBookKeeping.prototype.destructor = function () {
|
|
1397
|
+
this.func = null;
|
|
1398
|
+
this.context = null;
|
|
1399
|
+
this.count = 0;
|
|
1400
|
+
};
|
|
1401
|
+
PooledClass_1.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
|
|
1402
|
+
|
|
1403
|
+
function forEachSingleChild(bookKeeping, child, name) {
|
|
1404
|
+
var func = bookKeeping.func,
|
|
1405
|
+
context = bookKeeping.context;
|
|
1406
|
+
|
|
1407
|
+
func.call(context, child, bookKeeping.count++);
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Iterates through children that are typically specified as `props.children`.
|
|
1412
|
+
*
|
|
1413
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
|
|
1414
|
+
*
|
|
1415
|
+
* The provided forEachFunc(child, index) will be called for each
|
|
1416
|
+
* leaf child.
|
|
1417
|
+
*
|
|
1418
|
+
* @param {?*} children Children tree container.
|
|
1419
|
+
* @param {function(*, int)} forEachFunc
|
|
1420
|
+
* @param {*} forEachContext Context for forEachContext.
|
|
1421
|
+
*/
|
|
1422
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1423
|
+
if (children == null) {
|
|
1424
|
+
return children;
|
|
1425
|
+
}
|
|
1426
|
+
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
|
|
1427
|
+
traverseAllChildren_1(children, forEachSingleChild, traverseContext);
|
|
1428
|
+
ForEachBookKeeping.release(traverseContext);
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* PooledClass representing the bookkeeping associated with performing a child
|
|
1433
|
+
* mapping. Allows avoiding binding callbacks.
|
|
1434
|
+
*
|
|
1435
|
+
* @constructor MapBookKeeping
|
|
1436
|
+
* @param {!*} mapResult Object containing the ordered map of results.
|
|
1437
|
+
* @param {!function} mapFunction Function to perform mapping with.
|
|
1438
|
+
* @param {?*} mapContext Context to perform mapping with.
|
|
1439
|
+
*/
|
|
1440
|
+
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
1441
|
+
this.result = mapResult;
|
|
1442
|
+
this.keyPrefix = keyPrefix;
|
|
1443
|
+
this.func = mapFunction;
|
|
1444
|
+
this.context = mapContext;
|
|
1445
|
+
this.count = 0;
|
|
1446
|
+
}
|
|
1447
|
+
MapBookKeeping.prototype.destructor = function () {
|
|
1448
|
+
this.result = null;
|
|
1449
|
+
this.keyPrefix = null;
|
|
1450
|
+
this.func = null;
|
|
1451
|
+
this.context = null;
|
|
1452
|
+
this.count = 0;
|
|
1453
|
+
};
|
|
1454
|
+
PooledClass_1.addPoolingTo(MapBookKeeping, fourArgumentPooler);
|
|
1455
|
+
|
|
1456
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1457
|
+
var result = bookKeeping.result,
|
|
1458
|
+
keyPrefix = bookKeeping.keyPrefix,
|
|
1459
|
+
func = bookKeeping.func,
|
|
1460
|
+
context = bookKeeping.context;
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1464
|
+
if (Array.isArray(mappedChild)) {
|
|
1465
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
|
|
1466
|
+
} else if (mappedChild != null) {
|
|
1467
|
+
if (ReactElement_1.isValidElement(mappedChild)) {
|
|
1468
|
+
mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
|
|
1469
|
+
// Keep both the (mapped) and old keys if they differ, just as
|
|
1470
|
+
// traverseAllChildren used to do for objects as children
|
|
1471
|
+
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1472
|
+
}
|
|
1473
|
+
result.push(mappedChild);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1478
|
+
var escapedPrefix = '';
|
|
1479
|
+
if (prefix != null) {
|
|
1480
|
+
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1368
1481
|
}
|
|
1482
|
+
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
|
|
1483
|
+
traverseAllChildren_1(children, mapSingleChildIntoContext, traverseContext);
|
|
1484
|
+
MapBookKeeping.release(traverseContext);
|
|
1369
1485
|
}
|
|
1370
1486
|
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1487
|
+
/**
|
|
1488
|
+
* Maps children that are typically specified as `props.children`.
|
|
1489
|
+
*
|
|
1490
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.map
|
|
1491
|
+
*
|
|
1492
|
+
* The provided mapFunction(child, key, index) will be called for each
|
|
1493
|
+
* leaf child.
|
|
1494
|
+
*
|
|
1495
|
+
* @param {?*} children Children tree container.
|
|
1496
|
+
* @param {function(*, int)} func The map function.
|
|
1497
|
+
* @param {*} context Context for mapFunction.
|
|
1498
|
+
* @return {object} Object containing the ordered map of results.
|
|
1499
|
+
*/
|
|
1500
|
+
function mapChildren(children, func, context) {
|
|
1501
|
+
if (children == null) {
|
|
1502
|
+
return children;
|
|
1379
1503
|
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1504
|
+
var result = [];
|
|
1505
|
+
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1506
|
+
return result;
|
|
1382
1507
|
}
|
|
1383
1508
|
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
invariant(item, 'Item must have been set');
|
|
1388
|
-
item.childIDs = nextChildIDs;
|
|
1389
|
-
|
|
1390
|
-
for (var i = 0; i < nextChildIDs.length; i++) {
|
|
1391
|
-
var nextChildID = nextChildIDs[i];
|
|
1392
|
-
var nextChild = getItem(nextChildID);
|
|
1393
|
-
!nextChild ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1394
|
-
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : void 0;
|
|
1395
|
-
!nextChild.isMounted ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1396
|
-
if (nextChild.parentID == null) {
|
|
1397
|
-
nextChild.parentID = id;
|
|
1398
|
-
// TODO: This shouldn't be necessary but mounting a new root during in
|
|
1399
|
-
// componentWillMount currently causes not-yet-mounted components to
|
|
1400
|
-
// be purged from our tree data so their parent id is missing.
|
|
1401
|
-
}
|
|
1402
|
-
!(nextChild.parentID === id) ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : void 0;
|
|
1403
|
-
}
|
|
1404
|
-
},
|
|
1405
|
-
onBeforeMountComponent: function (id, element, parentID) {
|
|
1406
|
-
var item = {
|
|
1407
|
-
element: element,
|
|
1408
|
-
parentID: parentID,
|
|
1409
|
-
text: null,
|
|
1410
|
-
childIDs: [],
|
|
1411
|
-
isMounted: false,
|
|
1412
|
-
updateCount: 0
|
|
1413
|
-
};
|
|
1414
|
-
setItem(id, item);
|
|
1415
|
-
},
|
|
1416
|
-
onBeforeUpdateComponent: function (id, element) {
|
|
1417
|
-
var item = getItem(id);
|
|
1418
|
-
if (!item || !item.isMounted) {
|
|
1419
|
-
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1420
|
-
// In this case, ignore the element.
|
|
1421
|
-
return;
|
|
1422
|
-
}
|
|
1423
|
-
item.element = element;
|
|
1424
|
-
},
|
|
1425
|
-
onMountComponent: function (id) {
|
|
1426
|
-
var item = getItem(id);
|
|
1427
|
-
invariant(item, 'Item must have been set');
|
|
1428
|
-
item.isMounted = true;
|
|
1429
|
-
var isRoot = item.parentID === 0;
|
|
1430
|
-
if (isRoot) {
|
|
1431
|
-
addRoot(id);
|
|
1432
|
-
}
|
|
1433
|
-
},
|
|
1434
|
-
onUpdateComponent: function (id) {
|
|
1435
|
-
var item = getItem(id);
|
|
1436
|
-
if (!item || !item.isMounted) {
|
|
1437
|
-
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1438
|
-
// In this case, ignore the element.
|
|
1439
|
-
return;
|
|
1440
|
-
}
|
|
1441
|
-
item.updateCount++;
|
|
1442
|
-
},
|
|
1443
|
-
onUnmountComponent: function (id) {
|
|
1444
|
-
var item = getItem(id);
|
|
1445
|
-
if (item) {
|
|
1446
|
-
// We need to check if it exists.
|
|
1447
|
-
// `item` might not exist if it is inside an error boundary, and a sibling
|
|
1448
|
-
// error boundary child threw while mounting. Then this instance never
|
|
1449
|
-
// got a chance to mount, but it still gets an unmounting event during
|
|
1450
|
-
// the error boundary cleanup.
|
|
1451
|
-
item.isMounted = false;
|
|
1452
|
-
var isRoot = item.parentID === 0;
|
|
1453
|
-
if (isRoot) {
|
|
1454
|
-
removeRoot(id);
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
unmountedIDs.push(id);
|
|
1458
|
-
},
|
|
1459
|
-
purgeUnmountedComponents: function () {
|
|
1460
|
-
if (ReactComponentTreeHook._preventPurging) {
|
|
1461
|
-
// Should only be used for testing.
|
|
1462
|
-
return;
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
for (var i = 0; i < unmountedIDs.length; i++) {
|
|
1466
|
-
var id = unmountedIDs[i];
|
|
1467
|
-
purgeDeep(id);
|
|
1468
|
-
}
|
|
1469
|
-
unmountedIDs.length = 0;
|
|
1470
|
-
},
|
|
1471
|
-
isMounted: function (id) {
|
|
1472
|
-
var item = getItem(id);
|
|
1473
|
-
return item ? item.isMounted : false;
|
|
1474
|
-
},
|
|
1475
|
-
getCurrentStackAddendum: function (topElement) {
|
|
1476
|
-
var info = '';
|
|
1477
|
-
if (topElement) {
|
|
1478
|
-
var name = getDisplayName(topElement);
|
|
1479
|
-
var owner = topElement._owner;
|
|
1480
|
-
info += describeComponentFrame(name, topElement._source, owner && getComponentName_1(owner));
|
|
1481
|
-
}
|
|
1509
|
+
function forEachSingleChildDummy(traverseContext, child, name) {
|
|
1510
|
+
return null;
|
|
1511
|
+
}
|
|
1482
1512
|
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
},
|
|
1496
|
-
getStackAddendumByID: function (id) {
|
|
1497
|
-
var info = '';
|
|
1498
|
-
while (id) {
|
|
1499
|
-
info += describeID(id);
|
|
1500
|
-
id = ReactComponentTreeHook.getParentID(id);
|
|
1501
|
-
}
|
|
1502
|
-
return info;
|
|
1503
|
-
},
|
|
1504
|
-
getChildIDs: function (id) {
|
|
1505
|
-
var item = getItem(id);
|
|
1506
|
-
return item ? item.childIDs : [];
|
|
1507
|
-
},
|
|
1508
|
-
getDisplayName: function (id) {
|
|
1509
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1510
|
-
if (!element) {
|
|
1511
|
-
return null;
|
|
1512
|
-
}
|
|
1513
|
-
return getDisplayName(element);
|
|
1514
|
-
},
|
|
1515
|
-
getElement: function (id) {
|
|
1516
|
-
var item = getItem(id);
|
|
1517
|
-
return item ? item.element : null;
|
|
1518
|
-
},
|
|
1519
|
-
getOwnerID: function (id) {
|
|
1520
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1521
|
-
if (!element || !element._owner) {
|
|
1522
|
-
return null;
|
|
1523
|
-
}
|
|
1524
|
-
return element._owner._debugID;
|
|
1525
|
-
},
|
|
1526
|
-
getParentID: function (id) {
|
|
1527
|
-
var item = getItem(id);
|
|
1528
|
-
return item ? item.parentID : null;
|
|
1529
|
-
},
|
|
1530
|
-
getSource: function (id) {
|
|
1531
|
-
var item = getItem(id);
|
|
1532
|
-
var element = item ? item.element : null;
|
|
1533
|
-
var source = element != null ? element._source : null;
|
|
1534
|
-
return source;
|
|
1535
|
-
},
|
|
1536
|
-
getText: function (id) {
|
|
1537
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1538
|
-
if (typeof element === 'string') {
|
|
1539
|
-
return element;
|
|
1540
|
-
} else if (typeof element === 'number') {
|
|
1541
|
-
return '' + element;
|
|
1542
|
-
} else {
|
|
1543
|
-
return null;
|
|
1544
|
-
}
|
|
1545
|
-
},
|
|
1546
|
-
getUpdateCount: function (id) {
|
|
1547
|
-
var item = getItem(id);
|
|
1548
|
-
return item ? item.updateCount : 0;
|
|
1549
|
-
},
|
|
1513
|
+
/**
|
|
1514
|
+
* Count the number of children that are typically specified as
|
|
1515
|
+
* `props.children`.
|
|
1516
|
+
*
|
|
1517
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.count
|
|
1518
|
+
*
|
|
1519
|
+
* @param {?*} children Children tree container.
|
|
1520
|
+
* @return {number} The number of children.
|
|
1521
|
+
*/
|
|
1522
|
+
function countChildren(children, context) {
|
|
1523
|
+
return traverseAllChildren_1(children, forEachSingleChildDummy, null);
|
|
1524
|
+
}
|
|
1550
1525
|
|
|
1526
|
+
/**
|
|
1527
|
+
* Flatten a children object (typically specified as `props.children`) and
|
|
1528
|
+
* return an array with appropriately re-keyed children.
|
|
1529
|
+
*
|
|
1530
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
|
|
1531
|
+
*/
|
|
1532
|
+
function toArray(children) {
|
|
1533
|
+
var result = [];
|
|
1534
|
+
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
|
|
1535
|
+
return result;
|
|
1536
|
+
}
|
|
1551
1537
|
|
|
1552
|
-
|
|
1553
|
-
|
|
1538
|
+
var ReactChildren = {
|
|
1539
|
+
forEach: forEachChildren,
|
|
1540
|
+
map: mapChildren,
|
|
1541
|
+
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
|
1542
|
+
count: countChildren,
|
|
1543
|
+
toArray: toArray
|
|
1554
1544
|
};
|
|
1555
1545
|
|
|
1556
|
-
var
|
|
1546
|
+
var ReactChildren_1 = ReactChildren;
|
|
1557
1547
|
|
|
1558
1548
|
var ReactDebugCurrentFrame$1 = {};
|
|
1559
1549
|
|
|
1560
1550
|
{
|
|
1561
|
-
var _require$
|
|
1562
|
-
getStackAddendumByID = _require$
|
|
1563
|
-
getCurrentStackAddendum$
|
|
1551
|
+
var _require$2 = ReactComponentTreeHook_1,
|
|
1552
|
+
getStackAddendumByID = _require$2.getStackAddendumByID,
|
|
1553
|
+
getCurrentStackAddendum$2 = _require$2.getCurrentStackAddendum;
|
|
1564
1554
|
|
|
1565
1555
|
var _require2$1 = ReactFiberComponentTreeHook,
|
|
1566
|
-
getStackAddendumByWorkInProgressFiber = _require2$1.getStackAddendumByWorkInProgressFiber;
|
|
1556
|
+
getStackAddendumByWorkInProgressFiber$2 = _require2$1.getStackAddendumByWorkInProgressFiber;
|
|
1567
1557
|
|
|
1568
1558
|
// Component that is being worked on
|
|
1569
1559
|
|
|
@@ -1587,10 +1577,10 @@ var ReactDebugCurrentFrame$1 = {};
|
|
|
1587
1577
|
// The stack will only be correct if this is a work in progress
|
|
1588
1578
|
// version and we're calling it during reconciliation.
|
|
1589
1579
|
var workInProgress = current;
|
|
1590
|
-
stack = getStackAddendumByWorkInProgressFiber(workInProgress);
|
|
1580
|
+
stack = getStackAddendumByWorkInProgressFiber$2(workInProgress);
|
|
1591
1581
|
}
|
|
1592
1582
|
} else if (element !== null) {
|
|
1593
|
-
stack = getCurrentStackAddendum$
|
|
1583
|
+
stack = getCurrentStackAddendum$2(element);
|
|
1594
1584
|
}
|
|
1595
1585
|
return stack;
|
|
1596
1586
|
};
|
|
@@ -1599,12 +1589,12 @@ var ReactDebugCurrentFrame$1 = {};
|
|
|
1599
1589
|
var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame$1;
|
|
1600
1590
|
|
|
1601
1591
|
{
|
|
1602
|
-
var checkPropTypes$1 = checkPropTypes
|
|
1603
|
-
var warning$
|
|
1592
|
+
var checkPropTypes$1 = checkPropTypes;
|
|
1593
|
+
var warning$2 = warning;
|
|
1604
1594
|
var ReactDebugCurrentFrame = ReactDebugCurrentFrame_1;
|
|
1605
1595
|
|
|
1606
|
-
var _require = ReactComponentTreeHook_1,
|
|
1607
|
-
getCurrentStackAddendum = _require.getCurrentStackAddendum;
|
|
1596
|
+
var _require$1 = ReactComponentTreeHook_1,
|
|
1597
|
+
getCurrentStackAddendum$1 = _require$1.getCurrentStackAddendum;
|
|
1608
1598
|
}
|
|
1609
1599
|
|
|
1610
1600
|
function getDeclarationErrorAddendum() {
|
|
@@ -1663,13 +1653,11 @@ function validateExplicitKey(element, parentType) {
|
|
|
1663
1653
|
}
|
|
1664
1654
|
element._store.validated = true;
|
|
1665
1655
|
|
|
1666
|
-
var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {});
|
|
1667
|
-
|
|
1668
1656
|
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1669
|
-
if (
|
|
1657
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1670
1658
|
return;
|
|
1671
1659
|
}
|
|
1672
|
-
|
|
1660
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
1673
1661
|
|
|
1674
1662
|
// Usually the current owner is the offender, but if it accepts children as a
|
|
1675
1663
|
// property, it may be the creator of the child that's responsible for
|
|
@@ -1680,7 +1668,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
1680
1668
|
childOwner = ' It was passed a child from ' + getComponentName_1(element._owner) + '.';
|
|
1681
1669
|
}
|
|
1682
1670
|
|
|
1683
|
-
warning$
|
|
1671
|
+
warning$2(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));
|
|
1684
1672
|
}
|
|
1685
1673
|
|
|
1686
1674
|
/**
|
|
@@ -1749,7 +1737,7 @@ function validatePropTypes(element) {
|
|
|
1749
1737
|
checkPropTypes$1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
1750
1738
|
}
|
|
1751
1739
|
if (typeof componentClass.getDefaultProps === 'function') {
|
|
1752
|
-
warning$
|
|
1740
|
+
warning$2(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1753
1741
|
}
|
|
1754
1742
|
}
|
|
1755
1743
|
|
|
@@ -1771,9 +1759,9 @@ var ReactElementValidator$2 = {
|
|
|
1771
1759
|
info += getDeclarationErrorAddendum();
|
|
1772
1760
|
}
|
|
1773
1761
|
|
|
1774
|
-
info += getCurrentStackAddendum();
|
|
1762
|
+
info += getCurrentStackAddendum$1();
|
|
1775
1763
|
|
|
1776
|
-
warning$
|
|
1764
|
+
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);
|
|
1777
1765
|
}
|
|
1778
1766
|
|
|
1779
1767
|
var element = ReactElement_1.createElement.apply(this, arguments);
|
|
@@ -1818,7 +1806,7 @@ var ReactElementValidator$2 = {
|
|
|
1818
1806
|
Object.defineProperty(validatedFactory, 'type', {
|
|
1819
1807
|
enumerable: false,
|
|
1820
1808
|
get: function () {
|
|
1821
|
-
warning$
|
|
1809
|
+
warning$2(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
1822
1810
|
Object.defineProperty(this, 'type', {
|
|
1823
1811
|
value: type
|
|
1824
1812
|
});
|
|
@@ -2022,7 +2010,7 @@ var ReactPropTypes = factory(isValidElement);
|
|
|
2022
2010
|
* @providesModule ReactVersion
|
|
2023
2011
|
*/
|
|
2024
2012
|
|
|
2025
|
-
var ReactVersion = '16.0.0-alpha.
|
|
2013
|
+
var ReactVersion = '16.0.0-alpha.10';
|
|
2026
2014
|
|
|
2027
2015
|
/**
|
|
2028
2016
|
* Returns the first child in a collection of children and verifies that there
|
|
@@ -2089,9 +2077,9 @@ var React = {
|
|
|
2089
2077
|
cloneElement: cloneElement,
|
|
2090
2078
|
isValidElement: ReactElement_1.isValidElement,
|
|
2091
2079
|
|
|
2092
|
-
// TODO (bvaughn) Remove these getters
|
|
2080
|
+
// TODO (bvaughn) Remove these getters before 16.0.0
|
|
2093
2081
|
PropTypes: ReactPropTypes,
|
|
2094
|
-
checkPropTypes: checkPropTypes
|
|
2082
|
+
checkPropTypes: checkPropTypes,
|
|
2095
2083
|
createClass: createClass,
|
|
2096
2084
|
|
|
2097
2085
|
// Classic
|
|
@@ -2128,7 +2116,7 @@ var React = {
|
|
|
2128
2116
|
return mixin;
|
|
2129
2117
|
};
|
|
2130
2118
|
|
|
2131
|
-
// TODO (bvaughn) Remove both of these deprecation warnings
|
|
2119
|
+
// TODO (bvaughn) Remove both of these deprecation warnings before 16.0.0
|
|
2132
2120
|
if (canDefineProperty) {
|
|
2133
2121
|
Object.defineProperty(React, 'checkPropTypes', {
|
|
2134
2122
|
get: function () {
|