react 16.0.0-alpha.7 → 16.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -7
- package/cjs/react.development.js +421 -1526
- package/cjs/react.production.min.js +1 -1
- package/package.json +4 -2
- package/umd/react.development.js +1855 -1721
- package/umd/react.production.min.js +2 -2
package/README.md
CHANGED
|
@@ -13,11 +13,4 @@ To use React in production mode, set the environment variable `NODE_ENV` to `pro
|
|
|
13
13
|
|
|
14
14
|
```js
|
|
15
15
|
var React = require('react');
|
|
16
|
-
|
|
17
|
-
// Addons are in separate packages:
|
|
18
|
-
var createFragment = require('react-addons-create-fragment');
|
|
19
|
-
var immutabilityHelpers = require('react-addons-update');
|
|
20
|
-
var CSSTransitionGroup = require('react-addons-css-transition-group');
|
|
21
16
|
```
|
|
22
|
-
|
|
23
|
-
For a complete list of addons visit the [addons documentation page](https://facebook.github.io/react/docs/addons.html).
|
package/cjs/react.development.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var objectAssign$1 = require('object-assign');
|
|
4
4
|
var warning = require('fbjs/lib/warning');
|
|
5
5
|
var emptyObject = require('fbjs/lib/emptyObject');
|
|
6
6
|
var invariant = require('fbjs/lib/invariant');
|
|
7
7
|
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
8
|
+
var checkPropTypes = require('prop-types/checkPropTypes');
|
|
9
|
+
var factory = require('prop-types/factory');
|
|
10
|
+
var factory$1 = require('create-react-class/factory');
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -107,18 +110,18 @@ var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue;
|
|
|
107
110
|
* @providesModule canDefineProperty
|
|
108
111
|
*/
|
|
109
112
|
|
|
110
|
-
var canDefineProperty = false;
|
|
113
|
+
var canDefineProperty$1 = false;
|
|
111
114
|
{
|
|
112
115
|
try {
|
|
113
116
|
// $FlowFixMe https://github.com/facebook/flow/issues/285
|
|
114
117
|
Object.defineProperty({}, 'x', { get: function () {} });
|
|
115
|
-
canDefineProperty = true;
|
|
118
|
+
canDefineProperty$1 = true;
|
|
116
119
|
} catch (x) {
|
|
117
120
|
// IE will fail on defineProperty
|
|
118
121
|
}
|
|
119
122
|
}
|
|
120
123
|
|
|
121
|
-
var canDefineProperty_1 = canDefineProperty;
|
|
124
|
+
var canDefineProperty_1 = canDefineProperty$1;
|
|
122
125
|
|
|
123
126
|
/**
|
|
124
127
|
* Base class helpers for the updating state of a component.
|
|
@@ -227,7 +230,7 @@ ComponentDummy.prototype = ReactComponent.prototype;
|
|
|
227
230
|
ReactPureComponent.prototype = new ComponentDummy();
|
|
228
231
|
ReactPureComponent.prototype.constructor = ReactPureComponent;
|
|
229
232
|
// Avoid an extra prototype jump for these methods.
|
|
230
|
-
|
|
233
|
+
objectAssign$1(ReactPureComponent.prototype, ReactComponent.prototype);
|
|
231
234
|
ReactPureComponent.prototype.isPureReactComponent = true;
|
|
232
235
|
|
|
233
236
|
var ReactBaseClasses = {
|
|
@@ -606,14 +609,14 @@ ReactElement.createElement = function (type, config, children) {
|
|
|
606
609
|
* See https://facebook.github.io/react/docs/react-api.html#createfactory
|
|
607
610
|
*/
|
|
608
611
|
ReactElement.createFactory = function (type) {
|
|
609
|
-
var factory = ReactElement.createElement.bind(null, type);
|
|
612
|
+
var factory$$1 = ReactElement.createElement.bind(null, type);
|
|
610
613
|
// Expose the type on the factory and the prototype so that it can be
|
|
611
614
|
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
|
|
612
615
|
// This should not be named `constructor` since this may not be the function
|
|
613
616
|
// that created the element, and it may not even be a constructor.
|
|
614
617
|
// Legacy hook TODO: Warn if this is accessed
|
|
615
|
-
factory.type = type;
|
|
616
|
-
return factory;
|
|
618
|
+
factory$$1.type = type;
|
|
619
|
+
return factory$$1;
|
|
617
620
|
};
|
|
618
621
|
|
|
619
622
|
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
|
|
@@ -630,7 +633,7 @@ ReactElement.cloneElement = function (element, config, children) {
|
|
|
630
633
|
var propName;
|
|
631
634
|
|
|
632
635
|
// Original props are copied
|
|
633
|
-
var props =
|
|
636
|
+
var props = objectAssign$1({}, element.props);
|
|
634
637
|
|
|
635
638
|
// Reserved names are extracted
|
|
636
639
|
var key = element.key;
|
|
@@ -799,1060 +802,6 @@ var KeyEscapeUtils = {
|
|
|
799
802
|
|
|
800
803
|
var KeyEscapeUtils_1 = KeyEscapeUtils;
|
|
801
804
|
|
|
802
|
-
var SEPARATOR = '.';
|
|
803
|
-
var SUBSEPARATOR = ':';
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* This is inlined from ReactElement since this file is shared between
|
|
807
|
-
* isomorphic and renderers. We could extract this to a
|
|
808
|
-
*
|
|
809
|
-
*/
|
|
810
|
-
|
|
811
|
-
/**
|
|
812
|
-
* TODO: Test that a single child and an array with one item have the same key
|
|
813
|
-
* pattern.
|
|
814
|
-
*/
|
|
815
|
-
|
|
816
|
-
var didWarnAboutMaps = false;
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* Generate a key string that identifies a component within a set.
|
|
820
|
-
*
|
|
821
|
-
* @param {*} component A component that could contain a manual key.
|
|
822
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
|
823
|
-
* @return {string}
|
|
824
|
-
*/
|
|
825
|
-
function getComponentKey(component, index) {
|
|
826
|
-
// Do some typechecking here since we call this blindly. We want to ensure
|
|
827
|
-
// that we don't block potential future ES APIs.
|
|
828
|
-
if (component && typeof component === 'object' && component.key != null) {
|
|
829
|
-
// Explicit key
|
|
830
|
-
return KeyEscapeUtils_1.escape(component.key);
|
|
831
|
-
}
|
|
832
|
-
// Implicit key determined by the index in the set
|
|
833
|
-
return index.toString(36);
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
/**
|
|
837
|
-
* @param {?*} children Children tree container.
|
|
838
|
-
* @param {!string} nameSoFar Name of the key path so far.
|
|
839
|
-
* @param {!function} callback Callback to invoke with each child found.
|
|
840
|
-
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
841
|
-
* process.
|
|
842
|
-
* @return {!number} The number of children in this subtree.
|
|
843
|
-
*/
|
|
844
|
-
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
845
|
-
var type = typeof children;
|
|
846
|
-
|
|
847
|
-
if (type === 'undefined' || type === 'boolean') {
|
|
848
|
-
// All of the above are perceived as null.
|
|
849
|
-
children = null;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
if (children === null || type === 'string' || type === 'number' ||
|
|
853
|
-
// The following is inlined from ReactElement. This means we can optimize
|
|
854
|
-
// some checks. React Fiber also inlines this logic for similar purposes.
|
|
855
|
-
type === 'object' && children.$$typeof === ReactElementSymbol) {
|
|
856
|
-
callback(traverseContext, children,
|
|
857
|
-
// If it's the only child, treat the name as if it was wrapped in an array
|
|
858
|
-
// so that it's consistent if the number of children grows.
|
|
859
|
-
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
860
|
-
return 1;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
var child;
|
|
864
|
-
var nextName;
|
|
865
|
-
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
866
|
-
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
867
|
-
|
|
868
|
-
if (Array.isArray(children)) {
|
|
869
|
-
for (var i = 0; i < children.length; i++) {
|
|
870
|
-
child = children[i];
|
|
871
|
-
nextName = nextNamePrefix + getComponentKey(child, i);
|
|
872
|
-
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
873
|
-
}
|
|
874
|
-
} else {
|
|
875
|
-
var iteratorFn = getIteratorFn_1(children);
|
|
876
|
-
if (iteratorFn) {
|
|
877
|
-
{
|
|
878
|
-
// Warn about using Maps as children
|
|
879
|
-
if (iteratorFn === children.entries) {
|
|
880
|
-
var mapsAsChildrenAddendum = '';
|
|
881
|
-
if (ReactCurrentOwner_1.current) {
|
|
882
|
-
var mapsAsChildrenOwnerName = ReactCurrentOwner_1.current.getName();
|
|
883
|
-
if (mapsAsChildrenOwnerName) {
|
|
884
|
-
mapsAsChildrenAddendum = '\n\nCheck the render method of `' + mapsAsChildrenOwnerName + '`.';
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
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);
|
|
888
|
-
didWarnAboutMaps = true;
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
var iterator = iteratorFn.call(children);
|
|
893
|
-
var step;
|
|
894
|
-
var ii = 0;
|
|
895
|
-
while (!(step = iterator.next()).done) {
|
|
896
|
-
child = step.value;
|
|
897
|
-
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
898
|
-
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
899
|
-
}
|
|
900
|
-
} else if (type === 'object') {
|
|
901
|
-
var addendum = '';
|
|
902
|
-
{
|
|
903
|
-
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.';
|
|
904
|
-
if (ReactCurrentOwner_1.current) {
|
|
905
|
-
var name = ReactCurrentOwner_1.current.getName();
|
|
906
|
-
if (name) {
|
|
907
|
-
addendum += '\n\nCheck the render method of `' + name + '`.';
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
var childrenString = '' + children;
|
|
912
|
-
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);
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
return subtreeCount;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
/**
|
|
920
|
-
* Traverses children that are typically specified as `props.children`, but
|
|
921
|
-
* might also be specified through attributes:
|
|
922
|
-
*
|
|
923
|
-
* - `traverseAllChildren(this.props.children, ...)`
|
|
924
|
-
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
925
|
-
*
|
|
926
|
-
* The `traverseContext` is an optional argument that is passed through the
|
|
927
|
-
* entire traversal. It can be used to store accumulations or anything else that
|
|
928
|
-
* the callback might find relevant.
|
|
929
|
-
*
|
|
930
|
-
* @param {?*} children Children tree object.
|
|
931
|
-
* @param {!function} callback To invoke upon traversing each child.
|
|
932
|
-
* @param {?*} traverseContext Context for traversal.
|
|
933
|
-
* @return {!number} The number of children in this subtree.
|
|
934
|
-
*/
|
|
935
|
-
function traverseAllChildren(children, callback, traverseContext) {
|
|
936
|
-
if (children == null) {
|
|
937
|
-
return 0;
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
var traverseAllChildren_1 = traverseAllChildren;
|
|
944
|
-
|
|
945
|
-
var twoArgumentPooler = PooledClass_1.twoArgumentPooler;
|
|
946
|
-
var fourArgumentPooler = PooledClass_1.fourArgumentPooler;
|
|
947
|
-
|
|
948
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
949
|
-
function escapeUserProvidedKey(text) {
|
|
950
|
-
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
/**
|
|
954
|
-
* PooledClass representing the bookkeeping associated with performing a child
|
|
955
|
-
* traversal. Allows avoiding binding callbacks.
|
|
956
|
-
*
|
|
957
|
-
* @constructor ForEachBookKeeping
|
|
958
|
-
* @param {!function} forEachFunction Function to perform traversal with.
|
|
959
|
-
* @param {?*} forEachContext Context to perform context with.
|
|
960
|
-
*/
|
|
961
|
-
function ForEachBookKeeping(forEachFunction, forEachContext) {
|
|
962
|
-
this.func = forEachFunction;
|
|
963
|
-
this.context = forEachContext;
|
|
964
|
-
this.count = 0;
|
|
965
|
-
}
|
|
966
|
-
ForEachBookKeeping.prototype.destructor = function () {
|
|
967
|
-
this.func = null;
|
|
968
|
-
this.context = null;
|
|
969
|
-
this.count = 0;
|
|
970
|
-
};
|
|
971
|
-
PooledClass_1.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
|
|
972
|
-
|
|
973
|
-
function forEachSingleChild(bookKeeping, child, name) {
|
|
974
|
-
var func = bookKeeping.func,
|
|
975
|
-
context = bookKeeping.context;
|
|
976
|
-
|
|
977
|
-
func.call(context, child, bookKeeping.count++);
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
/**
|
|
981
|
-
* Iterates through children that are typically specified as `props.children`.
|
|
982
|
-
*
|
|
983
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
|
|
984
|
-
*
|
|
985
|
-
* The provided forEachFunc(child, index) will be called for each
|
|
986
|
-
* leaf child.
|
|
987
|
-
*
|
|
988
|
-
* @param {?*} children Children tree container.
|
|
989
|
-
* @param {function(*, int)} forEachFunc
|
|
990
|
-
* @param {*} forEachContext Context for forEachContext.
|
|
991
|
-
*/
|
|
992
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
993
|
-
if (children == null) {
|
|
994
|
-
return children;
|
|
995
|
-
}
|
|
996
|
-
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
|
|
997
|
-
traverseAllChildren_1(children, forEachSingleChild, traverseContext);
|
|
998
|
-
ForEachBookKeeping.release(traverseContext);
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* PooledClass representing the bookkeeping associated with performing a child
|
|
1003
|
-
* mapping. Allows avoiding binding callbacks.
|
|
1004
|
-
*
|
|
1005
|
-
* @constructor MapBookKeeping
|
|
1006
|
-
* @param {!*} mapResult Object containing the ordered map of results.
|
|
1007
|
-
* @param {!function} mapFunction Function to perform mapping with.
|
|
1008
|
-
* @param {?*} mapContext Context to perform mapping with.
|
|
1009
|
-
*/
|
|
1010
|
-
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
1011
|
-
this.result = mapResult;
|
|
1012
|
-
this.keyPrefix = keyPrefix;
|
|
1013
|
-
this.func = mapFunction;
|
|
1014
|
-
this.context = mapContext;
|
|
1015
|
-
this.count = 0;
|
|
1016
|
-
}
|
|
1017
|
-
MapBookKeeping.prototype.destructor = function () {
|
|
1018
|
-
this.result = null;
|
|
1019
|
-
this.keyPrefix = null;
|
|
1020
|
-
this.func = null;
|
|
1021
|
-
this.context = null;
|
|
1022
|
-
this.count = 0;
|
|
1023
|
-
};
|
|
1024
|
-
PooledClass_1.addPoolingTo(MapBookKeeping, fourArgumentPooler);
|
|
1025
|
-
|
|
1026
|
-
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1027
|
-
var result = bookKeeping.result,
|
|
1028
|
-
keyPrefix = bookKeeping.keyPrefix,
|
|
1029
|
-
func = bookKeeping.func,
|
|
1030
|
-
context = bookKeeping.context;
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1034
|
-
if (Array.isArray(mappedChild)) {
|
|
1035
|
-
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
|
|
1036
|
-
} else if (mappedChild != null) {
|
|
1037
|
-
if (ReactElement_1.isValidElement(mappedChild)) {
|
|
1038
|
-
mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
|
|
1039
|
-
// Keep both the (mapped) and old keys if they differ, just as
|
|
1040
|
-
// traverseAllChildren used to do for objects as children
|
|
1041
|
-
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1042
|
-
}
|
|
1043
|
-
result.push(mappedChild);
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1048
|
-
var escapedPrefix = '';
|
|
1049
|
-
if (prefix != null) {
|
|
1050
|
-
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1051
|
-
}
|
|
1052
|
-
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
|
|
1053
|
-
traverseAllChildren_1(children, mapSingleChildIntoContext, traverseContext);
|
|
1054
|
-
MapBookKeeping.release(traverseContext);
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
/**
|
|
1058
|
-
* Maps children that are typically specified as `props.children`.
|
|
1059
|
-
*
|
|
1060
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.map
|
|
1061
|
-
*
|
|
1062
|
-
* The provided mapFunction(child, key, index) will be called for each
|
|
1063
|
-
* leaf child.
|
|
1064
|
-
*
|
|
1065
|
-
* @param {?*} children Children tree container.
|
|
1066
|
-
* @param {function(*, int)} func The map function.
|
|
1067
|
-
* @param {*} context Context for mapFunction.
|
|
1068
|
-
* @return {object} Object containing the ordered map of results.
|
|
1069
|
-
*/
|
|
1070
|
-
function mapChildren(children, func, context) {
|
|
1071
|
-
if (children == null) {
|
|
1072
|
-
return children;
|
|
1073
|
-
}
|
|
1074
|
-
var result = [];
|
|
1075
|
-
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1076
|
-
return result;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
function forEachSingleChildDummy(traverseContext, child, name) {
|
|
1080
|
-
return null;
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
/**
|
|
1084
|
-
* Count the number of children that are typically specified as
|
|
1085
|
-
* `props.children`.
|
|
1086
|
-
*
|
|
1087
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.count
|
|
1088
|
-
*
|
|
1089
|
-
* @param {?*} children Children tree container.
|
|
1090
|
-
* @return {number} The number of children.
|
|
1091
|
-
*/
|
|
1092
|
-
function countChildren(children, context) {
|
|
1093
|
-
return traverseAllChildren_1(children, forEachSingleChildDummy, null);
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
/**
|
|
1097
|
-
* Flatten a children object (typically specified as `props.children`) and
|
|
1098
|
-
* return an array with appropriately re-keyed children.
|
|
1099
|
-
*
|
|
1100
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
|
|
1101
|
-
*/
|
|
1102
|
-
function toArray(children) {
|
|
1103
|
-
var result = [];
|
|
1104
|
-
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
|
|
1105
|
-
return result;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
var ReactChildren = {
|
|
1109
|
-
forEach: forEachChildren,
|
|
1110
|
-
map: mapChildren,
|
|
1111
|
-
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
|
1112
|
-
count: countChildren,
|
|
1113
|
-
toArray: toArray
|
|
1114
|
-
};
|
|
1115
|
-
|
|
1116
|
-
var ReactChildren_1 = ReactChildren;
|
|
1117
|
-
|
|
1118
|
-
var ReactComponent$1 = ReactBaseClasses.Component;
|
|
1119
|
-
|
|
1120
|
-
var MIXINS_KEY = 'mixins';
|
|
1121
|
-
|
|
1122
|
-
// Helper function to allow the creation of anonymous functions which do not
|
|
1123
|
-
// have .name set to the name of the variable being assigned to.
|
|
1124
|
-
function identity(fn) {
|
|
1125
|
-
return fn;
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
/**
|
|
1129
|
-
* Policies that describe methods in `ReactClassInterface`.
|
|
1130
|
-
*/
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
/**
|
|
1134
|
-
* Composite components are higher-level components that compose other composite
|
|
1135
|
-
* or host components.
|
|
1136
|
-
*
|
|
1137
|
-
* To create a new type of `ReactClass`, pass a specification of
|
|
1138
|
-
* your new class to `React.createClass`. The only requirement of your class
|
|
1139
|
-
* specification is that you implement a `render` method.
|
|
1140
|
-
*
|
|
1141
|
-
* var MyComponent = React.createClass({
|
|
1142
|
-
* render: function() {
|
|
1143
|
-
* return <div>Hello World</div>;
|
|
1144
|
-
* }
|
|
1145
|
-
* });
|
|
1146
|
-
*
|
|
1147
|
-
* The class specification supports a specific protocol of methods that have
|
|
1148
|
-
* special meaning (e.g. `render`). See `ReactClassInterface` for
|
|
1149
|
-
* more the comprehensive protocol. Any other properties and methods in the
|
|
1150
|
-
* class specification will be available on the prototype.
|
|
1151
|
-
*
|
|
1152
|
-
* @interface ReactClassInterface
|
|
1153
|
-
* @internal
|
|
1154
|
-
*/
|
|
1155
|
-
var ReactClassInterface = {
|
|
1156
|
-
/**
|
|
1157
|
-
* An array of Mixin objects to include when defining your component.
|
|
1158
|
-
*
|
|
1159
|
-
* @type {array}
|
|
1160
|
-
* @optional
|
|
1161
|
-
*/
|
|
1162
|
-
mixins: 'DEFINE_MANY',
|
|
1163
|
-
|
|
1164
|
-
/**
|
|
1165
|
-
* An object containing properties and methods that should be defined on
|
|
1166
|
-
* the component's constructor instead of its prototype (static methods).
|
|
1167
|
-
*
|
|
1168
|
-
* @type {object}
|
|
1169
|
-
* @optional
|
|
1170
|
-
*/
|
|
1171
|
-
statics: 'DEFINE_MANY',
|
|
1172
|
-
|
|
1173
|
-
/**
|
|
1174
|
-
* Definition of prop types for this component.
|
|
1175
|
-
*
|
|
1176
|
-
* @type {object}
|
|
1177
|
-
* @optional
|
|
1178
|
-
*/
|
|
1179
|
-
propTypes: 'DEFINE_MANY',
|
|
1180
|
-
|
|
1181
|
-
/**
|
|
1182
|
-
* Definition of context types for this component.
|
|
1183
|
-
*
|
|
1184
|
-
* @type {object}
|
|
1185
|
-
* @optional
|
|
1186
|
-
*/
|
|
1187
|
-
contextTypes: 'DEFINE_MANY',
|
|
1188
|
-
|
|
1189
|
-
/**
|
|
1190
|
-
* Definition of context types this component sets for its children.
|
|
1191
|
-
*
|
|
1192
|
-
* @type {object}
|
|
1193
|
-
* @optional
|
|
1194
|
-
*/
|
|
1195
|
-
childContextTypes: 'DEFINE_MANY',
|
|
1196
|
-
|
|
1197
|
-
// ==== Definition methods ====
|
|
1198
|
-
|
|
1199
|
-
/**
|
|
1200
|
-
* Invoked when the component is mounted. Values in the mapping will be set on
|
|
1201
|
-
* `this.props` if that prop is not specified (i.e. using an `in` check).
|
|
1202
|
-
*
|
|
1203
|
-
* This method is invoked before `getInitialState` and therefore cannot rely
|
|
1204
|
-
* on `this.state` or use `this.setState`.
|
|
1205
|
-
*
|
|
1206
|
-
* @return {object}
|
|
1207
|
-
* @optional
|
|
1208
|
-
*/
|
|
1209
|
-
getDefaultProps: 'DEFINE_MANY_MERGED',
|
|
1210
|
-
|
|
1211
|
-
/**
|
|
1212
|
-
* Invoked once before the component is mounted. The return value will be used
|
|
1213
|
-
* as the initial value of `this.state`.
|
|
1214
|
-
*
|
|
1215
|
-
* getInitialState: function() {
|
|
1216
|
-
* return {
|
|
1217
|
-
* isOn: false,
|
|
1218
|
-
* fooBaz: new BazFoo()
|
|
1219
|
-
* }
|
|
1220
|
-
* }
|
|
1221
|
-
*
|
|
1222
|
-
* @return {object}
|
|
1223
|
-
* @optional
|
|
1224
|
-
*/
|
|
1225
|
-
getInitialState: 'DEFINE_MANY_MERGED',
|
|
1226
|
-
|
|
1227
|
-
/**
|
|
1228
|
-
* @return {object}
|
|
1229
|
-
* @optional
|
|
1230
|
-
*/
|
|
1231
|
-
getChildContext: 'DEFINE_MANY_MERGED',
|
|
1232
|
-
|
|
1233
|
-
/**
|
|
1234
|
-
* Uses props from `this.props` and state from `this.state` to render the
|
|
1235
|
-
* structure of the component.
|
|
1236
|
-
*
|
|
1237
|
-
* No guarantees are made about when or how often this method is invoked, so
|
|
1238
|
-
* it must not have side effects.
|
|
1239
|
-
*
|
|
1240
|
-
* render: function() {
|
|
1241
|
-
* var name = this.props.name;
|
|
1242
|
-
* return <div>Hello, {name}!</div>;
|
|
1243
|
-
* }
|
|
1244
|
-
*
|
|
1245
|
-
* @return {ReactComponent}
|
|
1246
|
-
* @required
|
|
1247
|
-
*/
|
|
1248
|
-
render: 'DEFINE_ONCE',
|
|
1249
|
-
|
|
1250
|
-
// ==== Delegate methods ====
|
|
1251
|
-
|
|
1252
|
-
/**
|
|
1253
|
-
* Invoked when the component is initially created and about to be mounted.
|
|
1254
|
-
* This may have side effects, but any external subscriptions or data created
|
|
1255
|
-
* by this method must be cleaned up in `componentWillUnmount`.
|
|
1256
|
-
*
|
|
1257
|
-
* @optional
|
|
1258
|
-
*/
|
|
1259
|
-
componentWillMount: 'DEFINE_MANY',
|
|
1260
|
-
|
|
1261
|
-
/**
|
|
1262
|
-
* Invoked when the component has been mounted and has a DOM representation.
|
|
1263
|
-
* However, there is no guarantee that the DOM node is in the document.
|
|
1264
|
-
*
|
|
1265
|
-
* Use this as an opportunity to operate on the DOM when the component has
|
|
1266
|
-
* been mounted (initialized and rendered) for the first time.
|
|
1267
|
-
*
|
|
1268
|
-
* @param {DOMElement} rootNode DOM element representing the component.
|
|
1269
|
-
* @optional
|
|
1270
|
-
*/
|
|
1271
|
-
componentDidMount: 'DEFINE_MANY',
|
|
1272
|
-
|
|
1273
|
-
/**
|
|
1274
|
-
* Invoked before the component receives new props.
|
|
1275
|
-
*
|
|
1276
|
-
* Use this as an opportunity to react to a prop transition by updating the
|
|
1277
|
-
* state using `this.setState`. Current props are accessed via `this.props`.
|
|
1278
|
-
*
|
|
1279
|
-
* componentWillReceiveProps: function(nextProps, nextContext) {
|
|
1280
|
-
* this.setState({
|
|
1281
|
-
* likesIncreasing: nextProps.likeCount > this.props.likeCount
|
|
1282
|
-
* });
|
|
1283
|
-
* }
|
|
1284
|
-
*
|
|
1285
|
-
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
|
|
1286
|
-
* transition may cause a state change, but the opposite is not true. If you
|
|
1287
|
-
* need it, you are probably looking for `componentWillUpdate`.
|
|
1288
|
-
*
|
|
1289
|
-
* @param {object} nextProps
|
|
1290
|
-
* @optional
|
|
1291
|
-
*/
|
|
1292
|
-
componentWillReceiveProps: 'DEFINE_MANY',
|
|
1293
|
-
|
|
1294
|
-
/**
|
|
1295
|
-
* Invoked while deciding if the component should be updated as a result of
|
|
1296
|
-
* receiving new props, state and/or context.
|
|
1297
|
-
*
|
|
1298
|
-
* Use this as an opportunity to `return false` when you're certain that the
|
|
1299
|
-
* transition to the new props/state/context will not require a component
|
|
1300
|
-
* update.
|
|
1301
|
-
*
|
|
1302
|
-
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
|
|
1303
|
-
* return !equal(nextProps, this.props) ||
|
|
1304
|
-
* !equal(nextState, this.state) ||
|
|
1305
|
-
* !equal(nextContext, this.context);
|
|
1306
|
-
* }
|
|
1307
|
-
*
|
|
1308
|
-
* @param {object} nextProps
|
|
1309
|
-
* @param {?object} nextState
|
|
1310
|
-
* @param {?object} nextContext
|
|
1311
|
-
* @return {boolean} True if the component should update.
|
|
1312
|
-
* @optional
|
|
1313
|
-
*/
|
|
1314
|
-
shouldComponentUpdate: 'DEFINE_ONCE',
|
|
1315
|
-
|
|
1316
|
-
/**
|
|
1317
|
-
* Invoked when the component is about to update due to a transition from
|
|
1318
|
-
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
|
|
1319
|
-
* and `nextContext`.
|
|
1320
|
-
*
|
|
1321
|
-
* Use this as an opportunity to perform preparation before an update occurs.
|
|
1322
|
-
*
|
|
1323
|
-
* NOTE: You **cannot** use `this.setState()` in this method.
|
|
1324
|
-
*
|
|
1325
|
-
* @param {object} nextProps
|
|
1326
|
-
* @param {?object} nextState
|
|
1327
|
-
* @param {?object} nextContext
|
|
1328
|
-
* @param {ReactReconcileTransaction} transaction
|
|
1329
|
-
* @optional
|
|
1330
|
-
*/
|
|
1331
|
-
componentWillUpdate: 'DEFINE_MANY',
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* Invoked when the component's DOM representation has been updated.
|
|
1335
|
-
*
|
|
1336
|
-
* Use this as an opportunity to operate on the DOM when the component has
|
|
1337
|
-
* been updated.
|
|
1338
|
-
*
|
|
1339
|
-
* @param {object} prevProps
|
|
1340
|
-
* @param {?object} prevState
|
|
1341
|
-
* @param {?object} prevContext
|
|
1342
|
-
* @param {DOMElement} rootNode DOM element representing the component.
|
|
1343
|
-
* @optional
|
|
1344
|
-
*/
|
|
1345
|
-
componentDidUpdate: 'DEFINE_MANY',
|
|
1346
|
-
|
|
1347
|
-
/**
|
|
1348
|
-
* Invoked when the component is about to be removed from its parent and have
|
|
1349
|
-
* its DOM representation destroyed.
|
|
1350
|
-
*
|
|
1351
|
-
* Use this as an opportunity to deallocate any external resources.
|
|
1352
|
-
*
|
|
1353
|
-
* NOTE: There is no `componentDidUnmount` since your component will have been
|
|
1354
|
-
* destroyed by that point.
|
|
1355
|
-
*
|
|
1356
|
-
* @optional
|
|
1357
|
-
*/
|
|
1358
|
-
componentWillUnmount: 'DEFINE_MANY',
|
|
1359
|
-
|
|
1360
|
-
// ==== Advanced methods ====
|
|
1361
|
-
|
|
1362
|
-
/**
|
|
1363
|
-
* Updates the component's currently mounted DOM representation.
|
|
1364
|
-
*
|
|
1365
|
-
* By default, this implements React's rendering and reconciliation algorithm.
|
|
1366
|
-
* Sophisticated clients may wish to override this.
|
|
1367
|
-
*
|
|
1368
|
-
* @param {ReactReconcileTransaction} transaction
|
|
1369
|
-
* @internal
|
|
1370
|
-
* @overridable
|
|
1371
|
-
*/
|
|
1372
|
-
updateComponent: 'OVERRIDE_BASE'
|
|
1373
|
-
};
|
|
1374
|
-
|
|
1375
|
-
/**
|
|
1376
|
-
* Mapping from class specification keys to special processing functions.
|
|
1377
|
-
*
|
|
1378
|
-
* Although these are declared like instance properties in the specification
|
|
1379
|
-
* when defining classes using `React.createClass`, they are actually static
|
|
1380
|
-
* and are accessible on the constructor instead of the prototype. Despite
|
|
1381
|
-
* being static, they must be defined outside of the "statics" key under
|
|
1382
|
-
* which all other static methods are defined.
|
|
1383
|
-
*/
|
|
1384
|
-
var RESERVED_SPEC_KEYS = {
|
|
1385
|
-
displayName: function (Constructor, displayName) {
|
|
1386
|
-
Constructor.displayName = displayName;
|
|
1387
|
-
},
|
|
1388
|
-
mixins: function (Constructor, mixins) {
|
|
1389
|
-
if (mixins) {
|
|
1390
|
-
for (var i = 0; i < mixins.length; i++) {
|
|
1391
|
-
mixSpecIntoComponent(Constructor, mixins[i]);
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
},
|
|
1395
|
-
childContextTypes: function (Constructor, childContextTypes) {
|
|
1396
|
-
{
|
|
1397
|
-
validateTypeDef(Constructor, childContextTypes, 'child context');
|
|
1398
|
-
}
|
|
1399
|
-
Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
|
|
1400
|
-
},
|
|
1401
|
-
contextTypes: function (Constructor, contextTypes) {
|
|
1402
|
-
{
|
|
1403
|
-
validateTypeDef(Constructor, contextTypes, 'context');
|
|
1404
|
-
}
|
|
1405
|
-
Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
|
|
1406
|
-
},
|
|
1407
|
-
/**
|
|
1408
|
-
* Special case getDefaultProps which should move into statics but requires
|
|
1409
|
-
* automatic merging.
|
|
1410
|
-
*/
|
|
1411
|
-
getDefaultProps: function (Constructor, getDefaultProps) {
|
|
1412
|
-
if (Constructor.getDefaultProps) {
|
|
1413
|
-
Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
|
|
1414
|
-
} else {
|
|
1415
|
-
Constructor.getDefaultProps = getDefaultProps;
|
|
1416
|
-
}
|
|
1417
|
-
},
|
|
1418
|
-
propTypes: function (Constructor, propTypes) {
|
|
1419
|
-
{
|
|
1420
|
-
validateTypeDef(Constructor, propTypes, 'prop');
|
|
1421
|
-
}
|
|
1422
|
-
Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
|
|
1423
|
-
},
|
|
1424
|
-
statics: function (Constructor, statics) {
|
|
1425
|
-
mixStaticSpecIntoComponent(Constructor, statics);
|
|
1426
|
-
},
|
|
1427
|
-
autobind: function () {} };
|
|
1428
|
-
|
|
1429
|
-
function validateTypeDef(Constructor, typeDef, location) {
|
|
1430
|
-
for (var propName in typeDef) {
|
|
1431
|
-
if (typeDef.hasOwnProperty(propName)) {
|
|
1432
|
-
// use a warning instead of an invariant so components
|
|
1433
|
-
// don't show up in prod but only in true
|
|
1434
|
-
warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', location, propName);
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
function validateMethodOverride(isAlreadyDefined, name) {
|
|
1440
|
-
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
|
|
1441
|
-
|
|
1442
|
-
// Disallow overriding of base class methods unless explicitly allowed.
|
|
1443
|
-
if (ReactClassMixin.hasOwnProperty(name)) {
|
|
1444
|
-
!(specPolicy === 'OVERRIDE_BASE') ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : void 0;
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
// Disallow defining methods more than once unless explicitly allowed.
|
|
1448
|
-
if (isAlreadyDefined) {
|
|
1449
|
-
!(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : void 0;
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
/**
|
|
1454
|
-
* Mixin helper which handles policy validation and reserved
|
|
1455
|
-
* specification keys when building React classes.
|
|
1456
|
-
*/
|
|
1457
|
-
function mixSpecIntoComponent(Constructor, spec) {
|
|
1458
|
-
if (!spec) {
|
|
1459
|
-
{
|
|
1460
|
-
var typeofSpec = typeof spec;
|
|
1461
|
-
var isMixinValid = typeofSpec === 'object' && spec !== null;
|
|
1462
|
-
|
|
1463
|
-
warning(isMixinValid, "%s: You're attempting to include a mixin that is either null " + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec);
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
|
-
return;
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
!(typeof spec !== 'function') ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : void 0;
|
|
1470
|
-
!!ReactElement_1.isValidElement(spec) ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : void 0;
|
|
1471
|
-
|
|
1472
|
-
var proto = Constructor.prototype;
|
|
1473
|
-
var autoBindPairs = proto.__reactAutoBindPairs;
|
|
1474
|
-
|
|
1475
|
-
// By handling mixins before any other properties, we ensure the same
|
|
1476
|
-
// chaining order is applied to methods with DEFINE_MANY policy, whether
|
|
1477
|
-
// mixins are listed before or after these methods in the spec.
|
|
1478
|
-
if (spec.hasOwnProperty(MIXINS_KEY)) {
|
|
1479
|
-
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
for (var name in spec) {
|
|
1483
|
-
if (!spec.hasOwnProperty(name)) {
|
|
1484
|
-
continue;
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
if (name === MIXINS_KEY) {
|
|
1488
|
-
// We have already handled mixins in a special case above.
|
|
1489
|
-
continue;
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
var property = spec[name];
|
|
1493
|
-
var isAlreadyDefined = proto.hasOwnProperty(name);
|
|
1494
|
-
validateMethodOverride(isAlreadyDefined, name);
|
|
1495
|
-
|
|
1496
|
-
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
|
|
1497
|
-
RESERVED_SPEC_KEYS[name](Constructor, property);
|
|
1498
|
-
} else {
|
|
1499
|
-
// Setup methods on prototype:
|
|
1500
|
-
// The following member methods should not be automatically bound:
|
|
1501
|
-
// 1. Expected ReactClass methods (in the "interface").
|
|
1502
|
-
// 2. Overridden methods (that were mixed in).
|
|
1503
|
-
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
|
|
1504
|
-
var isFunction = typeof property === 'function';
|
|
1505
|
-
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
|
|
1506
|
-
|
|
1507
|
-
if (shouldAutoBind) {
|
|
1508
|
-
autoBindPairs.push(name, property);
|
|
1509
|
-
proto[name] = property;
|
|
1510
|
-
} else {
|
|
1511
|
-
if (isAlreadyDefined) {
|
|
1512
|
-
var specPolicy = ReactClassInterface[name];
|
|
1513
|
-
|
|
1514
|
-
// These cases should already be caught by validateMethodOverride.
|
|
1515
|
-
!(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : void 0;
|
|
1516
|
-
|
|
1517
|
-
// For methods which are defined more than once, call the existing
|
|
1518
|
-
// methods before calling the new property, merging if appropriate.
|
|
1519
|
-
if (specPolicy === 'DEFINE_MANY_MERGED') {
|
|
1520
|
-
proto[name] = createMergedResultFunction(proto[name], property);
|
|
1521
|
-
} else if (specPolicy === 'DEFINE_MANY') {
|
|
1522
|
-
proto[name] = createChainedFunction(proto[name], property);
|
|
1523
|
-
}
|
|
1524
|
-
} else {
|
|
1525
|
-
proto[name] = property;
|
|
1526
|
-
{
|
|
1527
|
-
// Add verbose displayName to the function, which helps when looking
|
|
1528
|
-
// at profiling tools.
|
|
1529
|
-
if (typeof property === 'function' && spec.displayName) {
|
|
1530
|
-
proto[name].displayName = spec.displayName + '_' + name;
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
function mixStaticSpecIntoComponent(Constructor, statics) {
|
|
1540
|
-
if (!statics) {
|
|
1541
|
-
return;
|
|
1542
|
-
}
|
|
1543
|
-
for (var name in statics) {
|
|
1544
|
-
var property = statics[name];
|
|
1545
|
-
if (!statics.hasOwnProperty(name)) {
|
|
1546
|
-
continue;
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
var isReserved = name in RESERVED_SPEC_KEYS;
|
|
1550
|
-
!!isReserved ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : void 0;
|
|
1551
|
-
|
|
1552
|
-
var isInherited = name in Constructor;
|
|
1553
|
-
!!isInherited ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : void 0;
|
|
1554
|
-
Constructor[name] = property;
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
/**
|
|
1559
|
-
* Merge two objects, but throw if both contain the same key.
|
|
1560
|
-
*
|
|
1561
|
-
* @param {object} one The first object, which is mutated.
|
|
1562
|
-
* @param {object} two The second object
|
|
1563
|
-
* @return {object} one after it has been mutated to contain everything in two.
|
|
1564
|
-
*/
|
|
1565
|
-
function mergeIntoWithNoDuplicateKeys(one, two) {
|
|
1566
|
-
!(one && two && typeof one === 'object' && typeof two === 'object') ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : void 0;
|
|
1567
|
-
|
|
1568
|
-
for (var key in two) {
|
|
1569
|
-
if (two.hasOwnProperty(key)) {
|
|
1570
|
-
!(one[key] === undefined) ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : void 0;
|
|
1571
|
-
one[key] = two[key];
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
return one;
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
/**
|
|
1578
|
-
* Creates a function that invokes two functions and merges their return values.
|
|
1579
|
-
*
|
|
1580
|
-
* @param {function} one Function to invoke first.
|
|
1581
|
-
* @param {function} two Function to invoke second.
|
|
1582
|
-
* @return {function} Function that invokes the two argument functions.
|
|
1583
|
-
* @private
|
|
1584
|
-
*/
|
|
1585
|
-
function createMergedResultFunction(one, two) {
|
|
1586
|
-
return function mergedResult() {
|
|
1587
|
-
var a = one.apply(this, arguments);
|
|
1588
|
-
var b = two.apply(this, arguments);
|
|
1589
|
-
if (a == null) {
|
|
1590
|
-
return b;
|
|
1591
|
-
} else if (b == null) {
|
|
1592
|
-
return a;
|
|
1593
|
-
}
|
|
1594
|
-
var c = {};
|
|
1595
|
-
mergeIntoWithNoDuplicateKeys(c, a);
|
|
1596
|
-
mergeIntoWithNoDuplicateKeys(c, b);
|
|
1597
|
-
return c;
|
|
1598
|
-
};
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
/**
|
|
1602
|
-
* Creates a function that invokes two functions and ignores their return vales.
|
|
1603
|
-
*
|
|
1604
|
-
* @param {function} one Function to invoke first.
|
|
1605
|
-
* @param {function} two Function to invoke second.
|
|
1606
|
-
* @return {function} Function that invokes the two argument functions.
|
|
1607
|
-
* @private
|
|
1608
|
-
*/
|
|
1609
|
-
function createChainedFunction(one, two) {
|
|
1610
|
-
return function chainedFunction() {
|
|
1611
|
-
one.apply(this, arguments);
|
|
1612
|
-
two.apply(this, arguments);
|
|
1613
|
-
};
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
/**
|
|
1617
|
-
* Binds a method to the component.
|
|
1618
|
-
*
|
|
1619
|
-
* @param {object} component Component whose method is going to be bound.
|
|
1620
|
-
* @param {function} method Method to be bound.
|
|
1621
|
-
* @return {function} The bound method.
|
|
1622
|
-
*/
|
|
1623
|
-
function bindAutoBindMethod(component, method) {
|
|
1624
|
-
var boundMethod = method.bind(component);
|
|
1625
|
-
{
|
|
1626
|
-
boundMethod.__reactBoundContext = component;
|
|
1627
|
-
boundMethod.__reactBoundMethod = method;
|
|
1628
|
-
boundMethod.__reactBoundArguments = null;
|
|
1629
|
-
var componentName = component.constructor.displayName;
|
|
1630
|
-
var _bind = boundMethod.bind;
|
|
1631
|
-
boundMethod.bind = function (newThis) {
|
|
1632
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1633
|
-
args[_key - 1] = arguments[_key];
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
// User is trying to bind() an autobound method; we effectively will
|
|
1637
|
-
// ignore the value of "this" that the user is trying to use, so
|
|
1638
|
-
// let's warn.
|
|
1639
|
-
if (newThis !== component && newThis !== null) {
|
|
1640
|
-
warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance.\n\nSee %s', componentName);
|
|
1641
|
-
} else if (!args.length) {
|
|
1642
|
-
warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call.\n\nSee %s', componentName);
|
|
1643
|
-
return boundMethod;
|
|
1644
|
-
}
|
|
1645
|
-
var reboundMethod = _bind.apply(boundMethod, arguments);
|
|
1646
|
-
reboundMethod.__reactBoundContext = component;
|
|
1647
|
-
reboundMethod.__reactBoundMethod = method;
|
|
1648
|
-
reboundMethod.__reactBoundArguments = args;
|
|
1649
|
-
return reboundMethod;
|
|
1650
|
-
};
|
|
1651
|
-
}
|
|
1652
|
-
return boundMethod;
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
/**
|
|
1656
|
-
* Binds all auto-bound methods in a component.
|
|
1657
|
-
*
|
|
1658
|
-
* @param {object} component Component whose method is going to be bound.
|
|
1659
|
-
*/
|
|
1660
|
-
function bindAutoBindMethods(component) {
|
|
1661
|
-
var pairs = component.__reactAutoBindPairs;
|
|
1662
|
-
for (var i = 0; i < pairs.length; i += 2) {
|
|
1663
|
-
var autoBindKey = pairs[i];
|
|
1664
|
-
var method = pairs[i + 1];
|
|
1665
|
-
component[autoBindKey] = bindAutoBindMethod(component, method);
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
/**
|
|
1670
|
-
* Add more to the ReactClass base class. These are all legacy features and
|
|
1671
|
-
* therefore not already part of the modern ReactComponent.
|
|
1672
|
-
*/
|
|
1673
|
-
var ReactClassMixin = {
|
|
1674
|
-
/**
|
|
1675
|
-
* TODO: This will be deprecated because state should always keep a consistent
|
|
1676
|
-
* type signature and the only use case for this, is to avoid that.
|
|
1677
|
-
*/
|
|
1678
|
-
replaceState: function (newState, callback) {
|
|
1679
|
-
this.updater.enqueueReplaceState(this, newState, callback, 'replaceState');
|
|
1680
|
-
},
|
|
1681
|
-
|
|
1682
|
-
/**
|
|
1683
|
-
* Checks whether or not this composite component is mounted.
|
|
1684
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
1685
|
-
* @protected
|
|
1686
|
-
* @final
|
|
1687
|
-
*/
|
|
1688
|
-
isMounted: function () {
|
|
1689
|
-
return this.updater.isMounted(this);
|
|
1690
|
-
}
|
|
1691
|
-
};
|
|
1692
|
-
|
|
1693
|
-
var ReactClassComponent = function () {};
|
|
1694
|
-
_assign(ReactClassComponent.prototype, ReactComponent$1.prototype, ReactClassMixin);
|
|
1695
|
-
|
|
1696
|
-
/**
|
|
1697
|
-
* Module for creating composite components.
|
|
1698
|
-
*
|
|
1699
|
-
* @class ReactClass
|
|
1700
|
-
*/
|
|
1701
|
-
var ReactClass = {
|
|
1702
|
-
/**
|
|
1703
|
-
* Creates a composite component class given a class specification.
|
|
1704
|
-
* See https://facebook.github.io/react/docs/react-api.html#createclass
|
|
1705
|
-
*
|
|
1706
|
-
* @param {object} spec Class specification (which must define `render`).
|
|
1707
|
-
* @return {function} Component constructor function.
|
|
1708
|
-
* @public
|
|
1709
|
-
*/
|
|
1710
|
-
createClass: function (spec) {
|
|
1711
|
-
// To keep our warnings more understandable, we'll use a little hack here to
|
|
1712
|
-
// ensure that Constructor.name !== 'Constructor'. This makes sure we don't
|
|
1713
|
-
// unnecessarily identify a class without displayName as 'Constructor'.
|
|
1714
|
-
var Constructor = identity(function (props, context, updater) {
|
|
1715
|
-
// This constructor gets overridden by mocks. The argument is used
|
|
1716
|
-
// by mocks to assert on what gets mounted.
|
|
1717
|
-
|
|
1718
|
-
{
|
|
1719
|
-
warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory');
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
// Wire up auto-binding
|
|
1723
|
-
if (this.__reactAutoBindPairs.length) {
|
|
1724
|
-
bindAutoBindMethods(this);
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
this.props = props;
|
|
1728
|
-
this.context = context;
|
|
1729
|
-
this.refs = emptyObject;
|
|
1730
|
-
this.updater = updater || ReactNoopUpdateQueue_1;
|
|
1731
|
-
|
|
1732
|
-
this.state = null;
|
|
1733
|
-
|
|
1734
|
-
// ReactClasses doesn't have constructors. Instead, they use the
|
|
1735
|
-
// getInitialState and componentWillMount methods for initialization.
|
|
1736
|
-
|
|
1737
|
-
var initialState = this.getInitialState ? this.getInitialState() : null;
|
|
1738
|
-
{
|
|
1739
|
-
// We allow auto-mocks to proceed as if they're returning null.
|
|
1740
|
-
if (initialState === undefined && this.getInitialState._isMockFunction) {
|
|
1741
|
-
// This is probably bad practice. Consider warning here and
|
|
1742
|
-
// deprecating this convenience.
|
|
1743
|
-
initialState = null;
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : void 0;
|
|
1747
|
-
|
|
1748
|
-
this.state = initialState;
|
|
1749
|
-
});
|
|
1750
|
-
Constructor.prototype = new ReactClassComponent();
|
|
1751
|
-
Constructor.prototype.constructor = Constructor;
|
|
1752
|
-
Constructor.prototype.__reactAutoBindPairs = [];
|
|
1753
|
-
|
|
1754
|
-
mixSpecIntoComponent(Constructor, spec);
|
|
1755
|
-
|
|
1756
|
-
// Initialize the defaultProps property after all mixins have been merged.
|
|
1757
|
-
if (Constructor.getDefaultProps) {
|
|
1758
|
-
Constructor.defaultProps = Constructor.getDefaultProps();
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
{
|
|
1762
|
-
// This is a tag to indicate that the use of these method names is ok,
|
|
1763
|
-
// since it's used with createClass. If it's not, then it's likely a
|
|
1764
|
-
// mistake so we'll warn you to use the static property, property
|
|
1765
|
-
// initializer or constructor respectively.
|
|
1766
|
-
if (Constructor.getDefaultProps) {
|
|
1767
|
-
Constructor.getDefaultProps.isReactClassApproved = {};
|
|
1768
|
-
}
|
|
1769
|
-
if (Constructor.prototype.getInitialState) {
|
|
1770
|
-
Constructor.prototype.getInitialState.isReactClassApproved = {};
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
!Constructor.prototype.render ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : void 0;
|
|
1775
|
-
|
|
1776
|
-
{
|
|
1777
|
-
warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component');
|
|
1778
|
-
warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component');
|
|
1779
|
-
}
|
|
1780
|
-
|
|
1781
|
-
// Reduce time spent doing lookups by setting these on the prototype.
|
|
1782
|
-
for (var methodName in ReactClassInterface) {
|
|
1783
|
-
if (!Constructor.prototype[methodName]) {
|
|
1784
|
-
Constructor.prototype[methodName] = null;
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
return Constructor;
|
|
1789
|
-
}
|
|
1790
|
-
};
|
|
1791
|
-
|
|
1792
|
-
var ReactClass_1 = ReactClass;
|
|
1793
|
-
|
|
1794
|
-
/**
|
|
1795
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1796
|
-
* All rights reserved.
|
|
1797
|
-
*
|
|
1798
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1799
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1800
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1801
|
-
*
|
|
1802
|
-
*
|
|
1803
|
-
* @providesModule ReactPropTypesSecret
|
|
1804
|
-
*/
|
|
1805
|
-
|
|
1806
|
-
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1807
|
-
|
|
1808
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
1809
|
-
|
|
1810
|
-
var loggedTypeFailures = {};
|
|
1811
|
-
|
|
1812
|
-
/**
|
|
1813
|
-
* Assert that the values match with the type specs.
|
|
1814
|
-
* Error messages are memorized and will only be shown once.
|
|
1815
|
-
*
|
|
1816
|
-
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
1817
|
-
* @param {object} values Runtime values that need to be type-checked
|
|
1818
|
-
* @param {string} location e.g. "prop", "context", "child context"
|
|
1819
|
-
* @param {string} componentName Name of the component for error messages.
|
|
1820
|
-
* @param {?Function} getStack Returns the component stack.
|
|
1821
|
-
* @private
|
|
1822
|
-
*/
|
|
1823
|
-
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
1824
|
-
{
|
|
1825
|
-
for (var typeSpecName in typeSpecs) {
|
|
1826
|
-
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
|
1827
|
-
var error;
|
|
1828
|
-
// Prop type validation may throw. In case they do, we don't want to
|
|
1829
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
1830
|
-
// After these have been cleaned up, we'll let them throw.
|
|
1831
|
-
try {
|
|
1832
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
1833
|
-
// behavior as without this statement except with a better message.
|
|
1834
|
-
!(typeof typeSpecs[typeSpecName] === 'function') ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', location, typeSpecName) : void 0;
|
|
1835
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret_1);
|
|
1836
|
-
} catch (ex) {
|
|
1837
|
-
error = ex;
|
|
1838
|
-
}
|
|
1839
|
-
warning(!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);
|
|
1840
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1841
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
1842
|
-
// same error.
|
|
1843
|
-
loggedTypeFailures[error.message] = true;
|
|
1844
|
-
|
|
1845
|
-
var stack = getStack ? getStack() : '';
|
|
1846
|
-
|
|
1847
|
-
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
var checkPropTypes_1 = checkPropTypes;
|
|
1855
|
-
|
|
1856
805
|
/**
|
|
1857
806
|
* Copyright 2013-present, Facebook, Inc.
|
|
1858
807
|
* All rights reserved.
|
|
@@ -1947,7 +896,7 @@ function describeFiber(fiber) {
|
|
|
1947
896
|
// This function can only be called with a work-in-progress fiber and
|
|
1948
897
|
// only during begin or complete phase. Do not call it under any other
|
|
1949
898
|
// circumstances.
|
|
1950
|
-
function getStackAddendumByWorkInProgressFiber$
|
|
899
|
+
function getStackAddendumByWorkInProgressFiber$1(workInProgress) {
|
|
1951
900
|
var info = '';
|
|
1952
901
|
var node = workInProgress;
|
|
1953
902
|
do {
|
|
@@ -1959,11 +908,11 @@ function getStackAddendumByWorkInProgressFiber$2(workInProgress) {
|
|
|
1959
908
|
}
|
|
1960
909
|
|
|
1961
910
|
var ReactFiberComponentTreeHook = {
|
|
1962
|
-
getStackAddendumByWorkInProgressFiber: getStackAddendumByWorkInProgressFiber$
|
|
911
|
+
getStackAddendumByWorkInProgressFiber: getStackAddendumByWorkInProgressFiber$1,
|
|
1963
912
|
describeComponentFrame: describeComponentFrame$1
|
|
1964
913
|
};
|
|
1965
914
|
|
|
1966
|
-
var getStackAddendumByWorkInProgressFiber
|
|
915
|
+
var getStackAddendumByWorkInProgressFiber = ReactFiberComponentTreeHook.getStackAddendumByWorkInProgressFiber;
|
|
1967
916
|
var describeComponentFrame = ReactFiberComponentTreeHook.describeComponentFrame;
|
|
1968
917
|
|
|
1969
918
|
|
|
@@ -2219,7 +1168,7 @@ var ReactComponentTreeHook = {
|
|
|
2219
1168
|
var workInProgress = currentOwner;
|
|
2220
1169
|
// Safe because if current owner exists, we are reconciling,
|
|
2221
1170
|
// and it is guaranteed to be the work-in-progress version.
|
|
2222
|
-
info += getStackAddendumByWorkInProgressFiber
|
|
1171
|
+
info += getStackAddendumByWorkInProgressFiber(workInProgress);
|
|
2223
1172
|
} else if (typeof currentOwner._debugID === 'number') {
|
|
2224
1173
|
info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
|
|
2225
1174
|
}
|
|
@@ -2282,21 +1231,329 @@ var ReactComponentTreeHook = {
|
|
|
2282
1231
|
},
|
|
2283
1232
|
|
|
2284
1233
|
|
|
2285
|
-
getRootIDs: getRootIDs,
|
|
2286
|
-
getRegisteredIDs: getItemIDs
|
|
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) + '/';
|
|
1481
|
+
}
|
|
1482
|
+
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
|
|
1483
|
+
traverseAllChildren_1(children, mapSingleChildIntoContext, traverseContext);
|
|
1484
|
+
MapBookKeeping.release(traverseContext);
|
|
1485
|
+
}
|
|
1486
|
+
|
|
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;
|
|
1503
|
+
}
|
|
1504
|
+
var result = [];
|
|
1505
|
+
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1506
|
+
return result;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
function forEachSingleChildDummy(traverseContext, child, name) {
|
|
1510
|
+
return null;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
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
|
+
}
|
|
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
|
+
}
|
|
1537
|
+
|
|
1538
|
+
var ReactChildren = {
|
|
1539
|
+
forEach: forEachChildren,
|
|
1540
|
+
map: mapChildren,
|
|
1541
|
+
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
|
1542
|
+
count: countChildren,
|
|
1543
|
+
toArray: toArray
|
|
2287
1544
|
};
|
|
2288
1545
|
|
|
2289
|
-
var
|
|
1546
|
+
var ReactChildren_1 = ReactChildren;
|
|
2290
1547
|
|
|
2291
1548
|
var ReactDebugCurrentFrame$1 = {};
|
|
2292
1549
|
|
|
2293
1550
|
{
|
|
2294
|
-
var _require$
|
|
2295
|
-
getStackAddendumByID = _require$
|
|
2296
|
-
getCurrentStackAddendum$
|
|
1551
|
+
var _require$2 = ReactComponentTreeHook_1,
|
|
1552
|
+
getStackAddendumByID = _require$2.getStackAddendumByID,
|
|
1553
|
+
getCurrentStackAddendum$2 = _require$2.getCurrentStackAddendum;
|
|
2297
1554
|
|
|
2298
|
-
var _require2 = ReactFiberComponentTreeHook,
|
|
2299
|
-
getStackAddendumByWorkInProgressFiber = _require2.getStackAddendumByWorkInProgressFiber;
|
|
1555
|
+
var _require2$1 = ReactFiberComponentTreeHook,
|
|
1556
|
+
getStackAddendumByWorkInProgressFiber$2 = _require2$1.getStackAddendumByWorkInProgressFiber;
|
|
2300
1557
|
|
|
2301
1558
|
// Component that is being worked on
|
|
2302
1559
|
|
|
@@ -2320,10 +1577,10 @@ var ReactDebugCurrentFrame$1 = {};
|
|
|
2320
1577
|
// The stack will only be correct if this is a work in progress
|
|
2321
1578
|
// version and we're calling it during reconciliation.
|
|
2322
1579
|
var workInProgress = current;
|
|
2323
|
-
stack = getStackAddendumByWorkInProgressFiber(workInProgress);
|
|
1580
|
+
stack = getStackAddendumByWorkInProgressFiber$2(workInProgress);
|
|
2324
1581
|
}
|
|
2325
1582
|
} else if (element !== null) {
|
|
2326
|
-
stack = getCurrentStackAddendum$
|
|
1583
|
+
stack = getCurrentStackAddendum$2(element);
|
|
2327
1584
|
}
|
|
2328
1585
|
return stack;
|
|
2329
1586
|
};
|
|
@@ -2331,20 +1588,13 @@ var ReactDebugCurrentFrame$1 = {};
|
|
|
2331
1588
|
|
|
2332
1589
|
var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame$1;
|
|
2333
1590
|
|
|
2334
|
-
var getStackAddendum = ReactDebugCurrentFrame_1.getStackAddendum;
|
|
2335
|
-
|
|
2336
|
-
function checkReactTypeSpec(typeSpecs, values, location, componentName) {
|
|
2337
|
-
checkPropTypes_1(typeSpecs, values, location, componentName, getStackAddendum);
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
|
-
var checkReactTypeSpec_1 = checkReactTypeSpec;
|
|
2341
|
-
|
|
2342
1591
|
{
|
|
1592
|
+
var checkPropTypes$1 = checkPropTypes;
|
|
2343
1593
|
var warning$2 = warning;
|
|
2344
1594
|
var ReactDebugCurrentFrame = ReactDebugCurrentFrame_1;
|
|
2345
1595
|
|
|
2346
|
-
var _require = ReactComponentTreeHook_1,
|
|
2347
|
-
getCurrentStackAddendum = _require.getCurrentStackAddendum;
|
|
1596
|
+
var _require$1 = ReactComponentTreeHook_1,
|
|
1597
|
+
getCurrentStackAddendum$1 = _require$1.getCurrentStackAddendum;
|
|
2348
1598
|
}
|
|
2349
1599
|
|
|
2350
1600
|
function getDeclarationErrorAddendum() {
|
|
@@ -2403,13 +1653,11 @@ function validateExplicitKey(element, parentType) {
|
|
|
2403
1653
|
}
|
|
2404
1654
|
element._store.validated = true;
|
|
2405
1655
|
|
|
2406
|
-
var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {});
|
|
2407
|
-
|
|
2408
1656
|
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2409
|
-
if (
|
|
1657
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2410
1658
|
return;
|
|
2411
1659
|
}
|
|
2412
|
-
|
|
1660
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
2413
1661
|
|
|
2414
1662
|
// Usually the current owner is the offender, but if it accepts children as a
|
|
2415
1663
|
// property, it may be the creator of the child that's responsible for
|
|
@@ -2420,7 +1668,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
2420
1668
|
childOwner = ' It was passed a child from ' + getComponentName_1(element._owner) + '.';
|
|
2421
1669
|
}
|
|
2422
1670
|
|
|
2423
|
-
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(element));
|
|
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));
|
|
2424
1672
|
}
|
|
2425
1673
|
|
|
2426
1674
|
/**
|
|
@@ -2486,7 +1734,7 @@ function validatePropTypes(element) {
|
|
|
2486
1734
|
var propTypes = typeof componentClass.__propTypesSecretDontUseThesePlease === 'object' ? componentClass.__propTypesSecretDontUseThesePlease : componentClass.propTypes;
|
|
2487
1735
|
|
|
2488
1736
|
if (propTypes) {
|
|
2489
|
-
|
|
1737
|
+
checkPropTypes$1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
2490
1738
|
}
|
|
2491
1739
|
if (typeof componentClass.getDefaultProps === 'function') {
|
|
2492
1740
|
warning$2(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
@@ -2511,7 +1759,7 @@ var ReactElementValidator$2 = {
|
|
|
2511
1759
|
info += getDeclarationErrorAddendum();
|
|
2512
1760
|
}
|
|
2513
1761
|
|
|
2514
|
-
info += getCurrentStackAddendum();
|
|
1762
|
+
info += getCurrentStackAddendum$1();
|
|
2515
1763
|
|
|
2516
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);
|
|
2517
1765
|
}
|
|
@@ -2602,7 +1850,6 @@ var createDOMFactory = ReactElement_1.createFactory;
|
|
|
2602
1850
|
|
|
2603
1851
|
/**
|
|
2604
1852
|
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
|
|
2605
|
-
* This is also accessible via `React.DOM`.
|
|
2606
1853
|
*
|
|
2607
1854
|
* @public
|
|
2608
1855
|
*/
|
|
@@ -2745,414 +1992,11 @@ var ReactDOMFactories = {
|
|
|
2745
1992
|
|
|
2746
1993
|
var ReactDOMFactories_1 = ReactDOMFactories;
|
|
2747
1994
|
|
|
2748
|
-
|
|
2749
|
-
* Collection of methods that allow declaration and validation of props that are
|
|
2750
|
-
* supplied to React components. Example usage:
|
|
2751
|
-
*
|
|
2752
|
-
* var Props = require('ReactPropTypes');
|
|
2753
|
-
* var MyArticle = React.createClass({
|
|
2754
|
-
* propTypes: {
|
|
2755
|
-
* // An optional string prop named "description".
|
|
2756
|
-
* description: Props.string,
|
|
2757
|
-
*
|
|
2758
|
-
* // A required enum prop named "category".
|
|
2759
|
-
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
2760
|
-
*
|
|
2761
|
-
* // A prop named "dialog" that requires an instance of Dialog.
|
|
2762
|
-
* dialog: Props.instanceOf(Dialog).isRequired
|
|
2763
|
-
* },
|
|
2764
|
-
* render: function() { ... }
|
|
2765
|
-
* });
|
|
2766
|
-
*
|
|
2767
|
-
* A more formal specification of how these methods are used:
|
|
2768
|
-
*
|
|
2769
|
-
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
2770
|
-
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
2771
|
-
*
|
|
2772
|
-
* Each and every declaration produces a function with the same signature. This
|
|
2773
|
-
* allows the creation of custom validation functions. For example:
|
|
2774
|
-
*
|
|
2775
|
-
* var MyLink = React.createClass({
|
|
2776
|
-
* propTypes: {
|
|
2777
|
-
* // An optional string or URI prop named "href".
|
|
2778
|
-
* href: function(props, propName, componentName) {
|
|
2779
|
-
* var propValue = props[propName];
|
|
2780
|
-
* if (propValue != null && typeof propValue !== 'string' &&
|
|
2781
|
-
* !(propValue instanceof URI)) {
|
|
2782
|
-
* return new Error(
|
|
2783
|
-
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
2784
|
-
* componentName
|
|
2785
|
-
* );
|
|
2786
|
-
* }
|
|
2787
|
-
* }
|
|
2788
|
-
* },
|
|
2789
|
-
* render: function() {...}
|
|
2790
|
-
* });
|
|
2791
|
-
*
|
|
2792
|
-
* @internal
|
|
2793
|
-
*/
|
|
2794
|
-
|
|
2795
|
-
var ANONYMOUS = '<<anonymous>>';
|
|
2796
|
-
|
|
2797
|
-
var ReactPropTypes;
|
|
2798
|
-
|
|
2799
|
-
{
|
|
2800
|
-
// Keep in sync with production version below
|
|
2801
|
-
ReactPropTypes = {
|
|
2802
|
-
array: createPrimitiveTypeChecker('array'),
|
|
2803
|
-
bool: createPrimitiveTypeChecker('boolean'),
|
|
2804
|
-
func: createPrimitiveTypeChecker('function'),
|
|
2805
|
-
number: createPrimitiveTypeChecker('number'),
|
|
2806
|
-
object: createPrimitiveTypeChecker('object'),
|
|
2807
|
-
string: createPrimitiveTypeChecker('string'),
|
|
2808
|
-
symbol: createPrimitiveTypeChecker('symbol'),
|
|
2809
|
-
|
|
2810
|
-
any: createAnyTypeChecker(),
|
|
2811
|
-
arrayOf: createArrayOfTypeChecker,
|
|
2812
|
-
element: createElementTypeChecker(),
|
|
2813
|
-
instanceOf: createInstanceTypeChecker,
|
|
2814
|
-
node: createNodeChecker(),
|
|
2815
|
-
objectOf: createObjectOfTypeChecker,
|
|
2816
|
-
oneOf: createEnumTypeChecker,
|
|
2817
|
-
oneOfType: createUnionTypeChecker,
|
|
2818
|
-
shape: createShapeTypeChecker
|
|
2819
|
-
};
|
|
2820
|
-
}
|
|
2821
|
-
|
|
2822
|
-
/**
|
|
2823
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
2824
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
2825
|
-
*/
|
|
2826
|
-
/*eslint-disable no-self-compare*/
|
|
2827
|
-
function is(x, y) {
|
|
2828
|
-
// SameValue algorithm
|
|
2829
|
-
if (x === y) {
|
|
2830
|
-
// Steps 1-5, 7-10
|
|
2831
|
-
// Steps 6.b-6.e: +0 != -0
|
|
2832
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
2833
|
-
} else {
|
|
2834
|
-
// Step 6.a: NaN == NaN
|
|
2835
|
-
return x !== x && y !== y;
|
|
2836
|
-
}
|
|
2837
|
-
}
|
|
2838
|
-
/*eslint-enable no-self-compare*/
|
|
2839
|
-
|
|
2840
|
-
/**
|
|
2841
|
-
* We use an Error-like object for backward compatibility as people may call
|
|
2842
|
-
* PropTypes directly and inspect their output. However, we don't use real
|
|
2843
|
-
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
2844
|
-
* is prohibitively expensive if they are created too often, such as what
|
|
2845
|
-
* happens in oneOfType() for any type before the one that matched.
|
|
2846
|
-
*/
|
|
2847
|
-
function PropTypeError(message) {
|
|
2848
|
-
this.message = message;
|
|
2849
|
-
this.stack = '';
|
|
2850
|
-
}
|
|
2851
|
-
// Make `instanceof Error` still work for returned errors.
|
|
2852
|
-
PropTypeError.prototype = Error.prototype;
|
|
2853
|
-
|
|
2854
|
-
function createChainableTypeChecker(validate) {
|
|
2855
|
-
{
|
|
2856
|
-
var manualPropTypeCallCache = {};
|
|
2857
|
-
}
|
|
2858
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
2859
|
-
componentName = componentName || ANONYMOUS;
|
|
2860
|
-
propFullName = propFullName || propName;
|
|
2861
|
-
{
|
|
2862
|
-
if (secret !== ReactPropTypesSecret_1 && typeof console !== 'undefined') {
|
|
2863
|
-
var cacheKey = componentName + ':' + propName;
|
|
2864
|
-
if (!manualPropTypeCallCache[cacheKey]) {
|
|
2865
|
-
warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName);
|
|
2866
|
-
manualPropTypeCallCache[cacheKey] = true;
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
|
-
}
|
|
2870
|
-
if (props[propName] == null) {
|
|
2871
|
-
if (isRequired) {
|
|
2872
|
-
if (props[propName] === null) {
|
|
2873
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
2874
|
-
}
|
|
2875
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
2876
|
-
}
|
|
2877
|
-
return null;
|
|
2878
|
-
} else {
|
|
2879
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
2880
|
-
}
|
|
2881
|
-
}
|
|
2882
|
-
|
|
2883
|
-
var chainedCheckType = checkType.bind(null, false);
|
|
2884
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
2885
|
-
|
|
2886
|
-
return chainedCheckType;
|
|
2887
|
-
}
|
|
2888
|
-
|
|
2889
|
-
function createPrimitiveTypeChecker(expectedType) {
|
|
2890
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
2891
|
-
var propValue = props[propName];
|
|
2892
|
-
var propType = getPropType(propValue);
|
|
2893
|
-
if (propType !== expectedType) {
|
|
2894
|
-
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
2895
|
-
// check, but we can offer a more precise error message here rather than
|
|
2896
|
-
// 'of type `object`'.
|
|
2897
|
-
var preciseType = getPreciseType(propValue);
|
|
2898
|
-
|
|
2899
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
|
2900
|
-
}
|
|
2901
|
-
return null;
|
|
2902
|
-
}
|
|
2903
|
-
return createChainableTypeChecker(validate);
|
|
2904
|
-
}
|
|
2905
|
-
|
|
2906
|
-
function createAnyTypeChecker() {
|
|
2907
|
-
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
|
|
2908
|
-
}
|
|
2909
|
-
|
|
2910
|
-
function createArrayOfTypeChecker(typeChecker) {
|
|
2911
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2912
|
-
if (typeof typeChecker !== 'function') {
|
|
2913
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
2914
|
-
}
|
|
2915
|
-
var propValue = props[propName];
|
|
2916
|
-
if (!Array.isArray(propValue)) {
|
|
2917
|
-
var propType = getPropType(propValue);
|
|
2918
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
2919
|
-
}
|
|
2920
|
-
for (var i = 0; i < propValue.length; i++) {
|
|
2921
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
|
2922
|
-
if (error instanceof Error) {
|
|
2923
|
-
return error;
|
|
2924
|
-
}
|
|
2925
|
-
}
|
|
2926
|
-
return null;
|
|
2927
|
-
}
|
|
2928
|
-
return createChainableTypeChecker(validate);
|
|
2929
|
-
}
|
|
2930
|
-
|
|
2931
|
-
function createElementTypeChecker() {
|
|
2932
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2933
|
-
var propValue = props[propName];
|
|
2934
|
-
if (!ReactElement_1.isValidElement(propValue)) {
|
|
2935
|
-
var propType = getPropType(propValue);
|
|
2936
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
2937
|
-
}
|
|
2938
|
-
return null;
|
|
2939
|
-
}
|
|
2940
|
-
return createChainableTypeChecker(validate);
|
|
2941
|
-
}
|
|
2942
|
-
|
|
2943
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
2944
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2945
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
2946
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
2947
|
-
var actualClassName = getClassName(props[propName]);
|
|
2948
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
2949
|
-
}
|
|
2950
|
-
return null;
|
|
2951
|
-
}
|
|
2952
|
-
return createChainableTypeChecker(validate);
|
|
2953
|
-
}
|
|
2954
|
-
|
|
2955
|
-
function createEnumTypeChecker(expectedValues) {
|
|
2956
|
-
if (!Array.isArray(expectedValues)) {
|
|
2957
|
-
warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.');
|
|
2958
|
-
return emptyFunction.thatReturnsNull;
|
|
2959
|
-
}
|
|
2960
|
-
|
|
2961
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2962
|
-
var propValue = props[propName];
|
|
2963
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
2964
|
-
if (is(propValue, expectedValues[i])) {
|
|
2965
|
-
return null;
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
|
|
2969
|
-
var valuesString = JSON.stringify(expectedValues);
|
|
2970
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
2971
|
-
}
|
|
2972
|
-
return createChainableTypeChecker(validate);
|
|
2973
|
-
}
|
|
2974
|
-
|
|
2975
|
-
function createObjectOfTypeChecker(typeChecker) {
|
|
2976
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2977
|
-
if (typeof typeChecker !== 'function') {
|
|
2978
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
2979
|
-
}
|
|
2980
|
-
var propValue = props[propName];
|
|
2981
|
-
var propType = getPropType(propValue);
|
|
2982
|
-
if (propType !== 'object') {
|
|
2983
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
2984
|
-
}
|
|
2985
|
-
for (var key in propValue) {
|
|
2986
|
-
if (propValue.hasOwnProperty(key)) {
|
|
2987
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
2988
|
-
if (error instanceof Error) {
|
|
2989
|
-
return error;
|
|
2990
|
-
}
|
|
2991
|
-
}
|
|
2992
|
-
}
|
|
2993
|
-
return null;
|
|
2994
|
-
}
|
|
2995
|
-
return createChainableTypeChecker(validate);
|
|
2996
|
-
}
|
|
2997
|
-
|
|
2998
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
2999
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
3000
|
-
warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.');
|
|
3001
|
-
return emptyFunction.thatReturnsNull;
|
|
3002
|
-
}
|
|
3003
|
-
|
|
3004
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
3005
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
3006
|
-
var checker = arrayOfTypeCheckers[i];
|
|
3007
|
-
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
|
|
3008
|
-
return null;
|
|
3009
|
-
}
|
|
3010
|
-
}
|
|
3011
|
-
|
|
3012
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
|
3013
|
-
}
|
|
3014
|
-
return createChainableTypeChecker(validate);
|
|
3015
|
-
}
|
|
3016
|
-
|
|
3017
|
-
function createNodeChecker() {
|
|
3018
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
3019
|
-
if (!isNode(props[propName])) {
|
|
3020
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
3021
|
-
}
|
|
3022
|
-
return null;
|
|
3023
|
-
}
|
|
3024
|
-
return createChainableTypeChecker(validate);
|
|
3025
|
-
}
|
|
3026
|
-
|
|
3027
|
-
function createShapeTypeChecker(shapeTypes) {
|
|
3028
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
3029
|
-
var propValue = props[propName];
|
|
3030
|
-
var propType = getPropType(propValue);
|
|
3031
|
-
if (propType !== 'object') {
|
|
3032
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
3033
|
-
}
|
|
3034
|
-
for (var key in shapeTypes) {
|
|
3035
|
-
var checker = shapeTypes[key];
|
|
3036
|
-
if (!checker) {
|
|
3037
|
-
continue;
|
|
3038
|
-
}
|
|
3039
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
3040
|
-
if (error) {
|
|
3041
|
-
return error;
|
|
3042
|
-
}
|
|
3043
|
-
}
|
|
3044
|
-
return null;
|
|
3045
|
-
}
|
|
3046
|
-
return createChainableTypeChecker(validate);
|
|
3047
|
-
}
|
|
3048
|
-
|
|
3049
|
-
function isNode(propValue) {
|
|
3050
|
-
switch (typeof propValue) {
|
|
3051
|
-
case 'number':
|
|
3052
|
-
case 'string':
|
|
3053
|
-
case 'undefined':
|
|
3054
|
-
return true;
|
|
3055
|
-
case 'boolean':
|
|
3056
|
-
return !propValue;
|
|
3057
|
-
case 'object':
|
|
3058
|
-
if (Array.isArray(propValue)) {
|
|
3059
|
-
return propValue.every(isNode);
|
|
3060
|
-
}
|
|
3061
|
-
if (propValue === null || ReactElement_1.isValidElement(propValue)) {
|
|
3062
|
-
return true;
|
|
3063
|
-
}
|
|
3064
|
-
|
|
3065
|
-
var iteratorFn = getIteratorFn_1(propValue);
|
|
3066
|
-
if (iteratorFn) {
|
|
3067
|
-
var iterator = iteratorFn.call(propValue);
|
|
3068
|
-
var step;
|
|
3069
|
-
if (iteratorFn !== propValue.entries) {
|
|
3070
|
-
while (!(step = iterator.next()).done) {
|
|
3071
|
-
if (!isNode(step.value)) {
|
|
3072
|
-
return false;
|
|
3073
|
-
}
|
|
3074
|
-
}
|
|
3075
|
-
} else {
|
|
3076
|
-
// Iterator will provide entry [k,v] tuples rather than values.
|
|
3077
|
-
while (!(step = iterator.next()).done) {
|
|
3078
|
-
var entry = step.value;
|
|
3079
|
-
if (entry) {
|
|
3080
|
-
if (!isNode(entry[1])) {
|
|
3081
|
-
return false;
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
}
|
|
3085
|
-
}
|
|
3086
|
-
} else {
|
|
3087
|
-
return false;
|
|
3088
|
-
}
|
|
3089
|
-
|
|
3090
|
-
return true;
|
|
3091
|
-
default:
|
|
3092
|
-
return false;
|
|
3093
|
-
}
|
|
3094
|
-
}
|
|
3095
|
-
|
|
3096
|
-
function isSymbol(propType, propValue) {
|
|
3097
|
-
// Native Symbol.
|
|
3098
|
-
if (propType === 'symbol') {
|
|
3099
|
-
return true;
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
|
-
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
3103
|
-
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
3104
|
-
return true;
|
|
3105
|
-
}
|
|
3106
|
-
|
|
3107
|
-
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
3108
|
-
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
3109
|
-
return true;
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3112
|
-
return false;
|
|
3113
|
-
}
|
|
3114
|
-
|
|
3115
|
-
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
3116
|
-
function getPropType(propValue) {
|
|
3117
|
-
var propType = typeof propValue;
|
|
3118
|
-
if (Array.isArray(propValue)) {
|
|
3119
|
-
return 'array';
|
|
3120
|
-
}
|
|
3121
|
-
if (propValue instanceof RegExp) {
|
|
3122
|
-
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
3123
|
-
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
3124
|
-
// passes PropTypes.object.
|
|
3125
|
-
return 'object';
|
|
3126
|
-
}
|
|
3127
|
-
if (isSymbol(propType, propValue)) {
|
|
3128
|
-
return 'symbol';
|
|
3129
|
-
}
|
|
3130
|
-
return propType;
|
|
3131
|
-
}
|
|
1995
|
+
var isValidElement = ReactElement_1.isValidElement;
|
|
3132
1996
|
|
|
3133
|
-
// This handles more types than `getPropType`. Only used for error messages.
|
|
3134
|
-
// See `createPrimitiveTypeChecker`.
|
|
3135
|
-
function getPreciseType(propValue) {
|
|
3136
|
-
var propType = getPropType(propValue);
|
|
3137
|
-
if (propType === 'object') {
|
|
3138
|
-
if (propValue instanceof Date) {
|
|
3139
|
-
return 'date';
|
|
3140
|
-
} else if (propValue instanceof RegExp) {
|
|
3141
|
-
return 'regexp';
|
|
3142
|
-
}
|
|
3143
|
-
}
|
|
3144
|
-
return propType;
|
|
3145
|
-
}
|
|
3146
1997
|
|
|
3147
|
-
// Returns class name of the object, if any.
|
|
3148
|
-
function getClassName(propValue) {
|
|
3149
|
-
if (!propValue.constructor || !propValue.constructor.name) {
|
|
3150
|
-
return ANONYMOUS;
|
|
3151
|
-
}
|
|
3152
|
-
return propValue.constructor.name;
|
|
3153
|
-
}
|
|
3154
1998
|
|
|
3155
|
-
var
|
|
1999
|
+
var ReactPropTypes = factory(isValidElement);
|
|
3156
2000
|
|
|
3157
2001
|
/**
|
|
3158
2002
|
* Copyright 2013-present, Facebook, Inc.
|
|
@@ -3165,7 +2009,7 @@ var ReactPropTypes_1 = ReactPropTypes;
|
|
|
3165
2009
|
* @providesModule ReactVersion
|
|
3166
2010
|
*/
|
|
3167
2011
|
|
|
3168
|
-
var ReactVersion = '16.0.0-alpha.
|
|
2012
|
+
var ReactVersion = '16.0.0-alpha.11';
|
|
3169
2013
|
|
|
3170
2014
|
/**
|
|
3171
2015
|
* Returns the first child in a collection of children and verifies that there
|
|
@@ -3188,11 +2032,22 @@ function onlyChild(children) {
|
|
|
3188
2032
|
|
|
3189
2033
|
var onlyChild_1 = onlyChild;
|
|
3190
2034
|
|
|
2035
|
+
var Component = ReactBaseClasses.Component;
|
|
2036
|
+
|
|
2037
|
+
var isValidElement$1 = ReactElement_1.isValidElement;
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
|
|
2042
|
+
var createClass = factory$1(Component, isValidElement$1, ReactNoopUpdateQueue_1);
|
|
2043
|
+
|
|
3191
2044
|
var createElement = ReactElement_1.createElement;
|
|
3192
2045
|
var createFactory = ReactElement_1.createFactory;
|
|
3193
2046
|
var cloneElement = ReactElement_1.cloneElement;
|
|
3194
2047
|
|
|
3195
2048
|
{
|
|
2049
|
+
var warning$1 = warning;
|
|
2050
|
+
var canDefineProperty = canDefineProperty_1;
|
|
3196
2051
|
var ReactElementValidator = ReactElementValidator_1;
|
|
3197
2052
|
createElement = ReactElementValidator.createElement;
|
|
3198
2053
|
createFactory = ReactElementValidator.createFactory;
|
|
@@ -3203,16 +2058,6 @@ var createMixin = function (mixin) {
|
|
|
3203
2058
|
return mixin;
|
|
3204
2059
|
};
|
|
3205
2060
|
|
|
3206
|
-
{
|
|
3207
|
-
var warnedForCreateMixin = false;
|
|
3208
|
-
|
|
3209
|
-
createMixin = function (mixin) {
|
|
3210
|
-
warning(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. You ' + 'can use this mixin directly instead.');
|
|
3211
|
-
warnedForCreateMixin = true;
|
|
3212
|
-
return mixin;
|
|
3213
|
-
};
|
|
3214
|
-
}
|
|
3215
|
-
|
|
3216
2061
|
var React = {
|
|
3217
2062
|
// Modern
|
|
3218
2063
|
|
|
@@ -3231,12 +2076,13 @@ var React = {
|
|
|
3231
2076
|
cloneElement: cloneElement,
|
|
3232
2077
|
isValidElement: ReactElement_1.isValidElement,
|
|
3233
2078
|
|
|
3234
|
-
|
|
2079
|
+
// TODO (bvaughn) Remove these getters before 16.0.0
|
|
2080
|
+
PropTypes: ReactPropTypes,
|
|
2081
|
+
checkPropTypes: checkPropTypes,
|
|
2082
|
+
createClass: createClass,
|
|
3235
2083
|
|
|
3236
2084
|
// Classic
|
|
3237
2085
|
|
|
3238
|
-
PropTypes: ReactPropTypes_1,
|
|
3239
|
-
createClass: ReactClass_1.createClass,
|
|
3240
2086
|
createFactory: createFactory,
|
|
3241
2087
|
createMixin: createMixin,
|
|
3242
2088
|
|
|
@@ -3244,25 +2090,74 @@ var React = {
|
|
|
3244
2090
|
// since they are just generating DOM strings.
|
|
3245
2091
|
DOM: ReactDOMFactories_1,
|
|
3246
2092
|
|
|
3247
|
-
version: ReactVersion
|
|
3248
|
-
};
|
|
3249
|
-
|
|
3250
|
-
var React_1 = React;
|
|
2093
|
+
version: ReactVersion,
|
|
3251
2094
|
|
|
3252
|
-
// `version` will be added here by the React module.
|
|
3253
|
-
var ReactUMDEntry = _assign({
|
|
3254
2095
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
3255
2096
|
ReactCurrentOwner: ReactCurrentOwner_1
|
|
3256
2097
|
}
|
|
3257
|
-
}
|
|
2098
|
+
};
|
|
3258
2099
|
|
|
3259
2100
|
{
|
|
3260
|
-
|
|
3261
|
-
//
|
|
3262
|
-
ReactComponentTreeHook: ReactComponentTreeHook_1
|
|
2101
|
+
objectAssign$1(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
2102
|
+
// These should not be included in production.
|
|
2103
|
+
ReactComponentTreeHook: ReactComponentTreeHook_1,
|
|
2104
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame_1
|
|
2105
|
+
});
|
|
2106
|
+
|
|
2107
|
+
var warnedForCheckPropTypes = false;
|
|
2108
|
+
var warnedForCreateMixin = false;
|
|
2109
|
+
var warnedForCreateClass = false;
|
|
2110
|
+
var warnedForPropTypes = false;
|
|
2111
|
+
|
|
2112
|
+
React.createMixin = function (mixin) {
|
|
2113
|
+
warning$1(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. You ' + 'can use this mixin directly instead.');
|
|
2114
|
+
warnedForCreateMixin = true;
|
|
2115
|
+
return mixin;
|
|
2116
|
+
};
|
|
2117
|
+
|
|
2118
|
+
// TODO (bvaughn) Remove all of these accessors before 16.0.0
|
|
2119
|
+
if (canDefineProperty) {
|
|
2120
|
+
Object.defineProperty(React, 'checkPropTypes', {
|
|
2121
|
+
get: function () {
|
|
2122
|
+
warning$1(warnedForCheckPropTypes, 'checkPropTypes has been moved to a separate package. ' + 'Accessing React.checkPropTypes is no longer supported ' + 'and will be removed completely in React 16. ' + 'Use the prop-types package on npm instead. ' + '(https://fb.me/migrating-from-react-proptypes)');
|
|
2123
|
+
warnedForCheckPropTypes = true;
|
|
2124
|
+
return checkPropTypes;
|
|
2125
|
+
}
|
|
2126
|
+
});
|
|
2127
|
+
|
|
2128
|
+
Object.defineProperty(React, 'createClass', {
|
|
2129
|
+
get: function () {
|
|
2130
|
+
warning$1(warnedForCreateClass, 'React.createClass is no longer supported. Use a plain JavaScript ' + "class instead. If you're not yet ready to migrate, " + 'create-react-class is available on npm as a drop-in replacement. ' + '(https://fb.me/migrating-from-react-create-class)');
|
|
2131
|
+
warnedForCreateClass = true;
|
|
2132
|
+
return createClass;
|
|
2133
|
+
}
|
|
2134
|
+
});
|
|
2135
|
+
|
|
2136
|
+
Object.defineProperty(React, 'PropTypes', {
|
|
2137
|
+
get: function () {
|
|
2138
|
+
warning$1(warnedForPropTypes, 'PropTypes has been moved to a separate package. ' + 'Accessing React.PropTypes is no longer supported ' + 'and will be removed completely in React 16. ' + 'Use the prop-types package on npm instead. ' + '(https://fb.me/migrating-from-react-proptypes)');
|
|
2139
|
+
warnedForPropTypes = true;
|
|
2140
|
+
return ReactPropTypes;
|
|
2141
|
+
}
|
|
2142
|
+
});
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
// React.DOM factories are deprecated. Wrap these methods so that
|
|
2146
|
+
// invocations of the React.DOM namespace and alert users to switch
|
|
2147
|
+
// to the `react-addons-dom-factories` package.
|
|
2148
|
+
React.DOM = {};
|
|
2149
|
+
var warnedForFactories = false;
|
|
2150
|
+
Object.keys(ReactDOMFactories_1).forEach(function (factory$$1) {
|
|
2151
|
+
React.DOM[factory$$1] = function () {
|
|
2152
|
+
if (!warnedForFactories) {
|
|
2153
|
+
warning$1(false, 'Accessing factories like React.DOM.%s has been deprecated ' + 'and will be removed in the future. Use the ' + 'react-addons-dom-factories package instead.', factory$$1);
|
|
2154
|
+
warnedForFactories = true;
|
|
2155
|
+
}
|
|
2156
|
+
return ReactDOMFactories_1[factory$$1].apply(ReactDOMFactories_1, arguments);
|
|
2157
|
+
};
|
|
3263
2158
|
});
|
|
3264
2159
|
}
|
|
3265
2160
|
|
|
3266
|
-
var
|
|
2161
|
+
var React_1 = React;
|
|
3267
2162
|
|
|
3268
|
-
module.exports =
|
|
2163
|
+
module.exports = React_1;
|