react 16.0.0-alpha.8 → 16.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/react.development.js +83 -1184
- package/cjs/react.production.min.js +1 -1
- package/package.json +4 -2
- package/umd/react.development.js +1181 -1081
- package/umd/react.production.min.js +2 -2
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;
|
|
@@ -1115,682 +1118,6 @@ var ReactChildren = {
|
|
|
1115
1118
|
|
|
1116
1119
|
var ReactChildren_1 = ReactChildren;
|
|
1117
1120
|
|
|
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
1121
|
/**
|
|
1795
1122
|
* Copyright 2013-present, Facebook, Inc.
|
|
1796
1123
|
* All rights reserved.
|
|
@@ -1826,67 +1153,7 @@ function getComponentName(instanceOrFiber) {
|
|
|
1826
1153
|
|
|
1827
1154
|
var getComponentName_1 = getComponentName;
|
|
1828
1155
|
|
|
1829
|
-
|
|
1830
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1831
|
-
* All rights reserved.
|
|
1832
|
-
*
|
|
1833
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1834
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1835
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1836
|
-
*
|
|
1837
|
-
*
|
|
1838
|
-
* @providesModule ReactPropTypesSecret
|
|
1839
|
-
*/
|
|
1840
|
-
|
|
1841
|
-
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1842
|
-
|
|
1843
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
1844
|
-
|
|
1845
|
-
var loggedTypeFailures = {};
|
|
1846
|
-
|
|
1847
|
-
/**
|
|
1848
|
-
* Assert that the values match with the type specs.
|
|
1849
|
-
* Error messages are memorized and will only be shown once.
|
|
1850
|
-
*
|
|
1851
|
-
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
1852
|
-
* @param {object} values Runtime values that need to be type-checked
|
|
1853
|
-
* @param {string} location e.g. "prop", "context", "child context"
|
|
1854
|
-
* @param {string} componentName Name of the component for error messages.
|
|
1855
|
-
* @param {?Function} getStack Returns the component stack.
|
|
1856
|
-
* @private
|
|
1857
|
-
*/
|
|
1858
|
-
function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
|
|
1859
|
-
{
|
|
1860
|
-
for (var typeSpecName in typeSpecs) {
|
|
1861
|
-
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
|
1862
|
-
var error;
|
|
1863
|
-
// Prop type validation may throw. In case they do, we don't want to
|
|
1864
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
1865
|
-
// After these have been cleaned up, we'll let them throw.
|
|
1866
|
-
try {
|
|
1867
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
1868
|
-
// behavior as without this statement except with a better message.
|
|
1869
|
-
!(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;
|
|
1870
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret_1);
|
|
1871
|
-
} catch (ex) {
|
|
1872
|
-
error = ex;
|
|
1873
|
-
}
|
|
1874
|
-
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);
|
|
1875
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1876
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
1877
|
-
// same error.
|
|
1878
|
-
loggedTypeFailures[error.message] = true;
|
|
1879
|
-
|
|
1880
|
-
var stack = getStack ? getStack() : '';
|
|
1881
|
-
|
|
1882
|
-
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
var checkPropTypes_1 = checkPropTypes$1;
|
|
1156
|
+
var checkPropTypes$2 = checkPropTypes;
|
|
1890
1157
|
|
|
1891
1158
|
/**
|
|
1892
1159
|
* Copyright 2013-present, Facebook, Inc.
|
|
@@ -2295,8 +1562,8 @@ var ReactDebugCurrentFrame$1 = {};
|
|
|
2295
1562
|
getStackAddendumByID = _require$1.getStackAddendumByID,
|
|
2296
1563
|
getCurrentStackAddendum$1 = _require$1.getCurrentStackAddendum;
|
|
2297
1564
|
|
|
2298
|
-
var _require2 = ReactFiberComponentTreeHook,
|
|
2299
|
-
getStackAddendumByWorkInProgressFiber = _require2.getStackAddendumByWorkInProgressFiber;
|
|
1565
|
+
var _require2$1 = ReactFiberComponentTreeHook,
|
|
1566
|
+
getStackAddendumByWorkInProgressFiber = _require2$1.getStackAddendumByWorkInProgressFiber;
|
|
2300
1567
|
|
|
2301
1568
|
// Component that is being worked on
|
|
2302
1569
|
|
|
@@ -2332,8 +1599,8 @@ var ReactDebugCurrentFrame$1 = {};
|
|
|
2332
1599
|
var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame$1;
|
|
2333
1600
|
|
|
2334
1601
|
{
|
|
2335
|
-
var checkPropTypes =
|
|
2336
|
-
var warning$
|
|
1602
|
+
var checkPropTypes$1 = checkPropTypes$2;
|
|
1603
|
+
var warning$3 = warning;
|
|
2337
1604
|
var ReactDebugCurrentFrame = ReactDebugCurrentFrame_1;
|
|
2338
1605
|
|
|
2339
1606
|
var _require = ReactComponentTreeHook_1,
|
|
@@ -2413,7 +1680,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
2413
1680
|
childOwner = ' It was passed a child from ' + getComponentName_1(element._owner) + '.';
|
|
2414
1681
|
}
|
|
2415
1682
|
|
|
2416
|
-
warning$
|
|
1683
|
+
warning$3(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));
|
|
2417
1684
|
}
|
|
2418
1685
|
|
|
2419
1686
|
/**
|
|
@@ -2479,10 +1746,10 @@ function validatePropTypes(element) {
|
|
|
2479
1746
|
var propTypes = typeof componentClass.__propTypesSecretDontUseThesePlease === 'object' ? componentClass.__propTypesSecretDontUseThesePlease : componentClass.propTypes;
|
|
2480
1747
|
|
|
2481
1748
|
if (propTypes) {
|
|
2482
|
-
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
1749
|
+
checkPropTypes$1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
2483
1750
|
}
|
|
2484
1751
|
if (typeof componentClass.getDefaultProps === 'function') {
|
|
2485
|
-
warning$
|
|
1752
|
+
warning$3(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2486
1753
|
}
|
|
2487
1754
|
}
|
|
2488
1755
|
|
|
@@ -2506,7 +1773,7 @@ var ReactElementValidator$2 = {
|
|
|
2506
1773
|
|
|
2507
1774
|
info += getCurrentStackAddendum();
|
|
2508
1775
|
|
|
2509
|
-
warning$
|
|
1776
|
+
warning$3(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);
|
|
2510
1777
|
}
|
|
2511
1778
|
|
|
2512
1779
|
var element = ReactElement_1.createElement.apply(this, arguments);
|
|
@@ -2551,7 +1818,7 @@ var ReactElementValidator$2 = {
|
|
|
2551
1818
|
Object.defineProperty(validatedFactory, 'type', {
|
|
2552
1819
|
enumerable: false,
|
|
2553
1820
|
get: function () {
|
|
2554
|
-
warning$
|
|
1821
|
+
warning$3(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2555
1822
|
Object.defineProperty(this, 'type', {
|
|
2556
1823
|
value: type
|
|
2557
1824
|
});
|
|
@@ -2738,414 +2005,11 @@ var ReactDOMFactories = {
|
|
|
2738
2005
|
|
|
2739
2006
|
var ReactDOMFactories_1 = ReactDOMFactories;
|
|
2740
2007
|
|
|
2741
|
-
|
|
2742
|
-
* Collection of methods that allow declaration and validation of props that are
|
|
2743
|
-
* supplied to React components. Example usage:
|
|
2744
|
-
*
|
|
2745
|
-
* var Props = require('ReactPropTypes');
|
|
2746
|
-
* var MyArticle = React.createClass({
|
|
2747
|
-
* propTypes: {
|
|
2748
|
-
* // An optional string prop named "description".
|
|
2749
|
-
* description: Props.string,
|
|
2750
|
-
*
|
|
2751
|
-
* // A required enum prop named "category".
|
|
2752
|
-
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
2753
|
-
*
|
|
2754
|
-
* // A prop named "dialog" that requires an instance of Dialog.
|
|
2755
|
-
* dialog: Props.instanceOf(Dialog).isRequired
|
|
2756
|
-
* },
|
|
2757
|
-
* render: function() { ... }
|
|
2758
|
-
* });
|
|
2759
|
-
*
|
|
2760
|
-
* A more formal specification of how these methods are used:
|
|
2761
|
-
*
|
|
2762
|
-
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
2763
|
-
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
2764
|
-
*
|
|
2765
|
-
* Each and every declaration produces a function with the same signature. This
|
|
2766
|
-
* allows the creation of custom validation functions. For example:
|
|
2767
|
-
*
|
|
2768
|
-
* var MyLink = React.createClass({
|
|
2769
|
-
* propTypes: {
|
|
2770
|
-
* // An optional string or URI prop named "href".
|
|
2771
|
-
* href: function(props, propName, componentName) {
|
|
2772
|
-
* var propValue = props[propName];
|
|
2773
|
-
* if (propValue != null && typeof propValue !== 'string' &&
|
|
2774
|
-
* !(propValue instanceof URI)) {
|
|
2775
|
-
* return new Error(
|
|
2776
|
-
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
2777
|
-
* componentName
|
|
2778
|
-
* );
|
|
2779
|
-
* }
|
|
2780
|
-
* }
|
|
2781
|
-
* },
|
|
2782
|
-
* render: function() {...}
|
|
2783
|
-
* });
|
|
2784
|
-
*
|
|
2785
|
-
* @internal
|
|
2786
|
-
*/
|
|
2787
|
-
|
|
2788
|
-
var ANONYMOUS = '<<anonymous>>';
|
|
2789
|
-
|
|
2790
|
-
var ReactPropTypes;
|
|
2791
|
-
|
|
2792
|
-
{
|
|
2793
|
-
// Keep in sync with production version below
|
|
2794
|
-
ReactPropTypes = {
|
|
2795
|
-
array: createPrimitiveTypeChecker('array'),
|
|
2796
|
-
bool: createPrimitiveTypeChecker('boolean'),
|
|
2797
|
-
func: createPrimitiveTypeChecker('function'),
|
|
2798
|
-
number: createPrimitiveTypeChecker('number'),
|
|
2799
|
-
object: createPrimitiveTypeChecker('object'),
|
|
2800
|
-
string: createPrimitiveTypeChecker('string'),
|
|
2801
|
-
symbol: createPrimitiveTypeChecker('symbol'),
|
|
2802
|
-
|
|
2803
|
-
any: createAnyTypeChecker(),
|
|
2804
|
-
arrayOf: createArrayOfTypeChecker,
|
|
2805
|
-
element: createElementTypeChecker(),
|
|
2806
|
-
instanceOf: createInstanceTypeChecker,
|
|
2807
|
-
node: createNodeChecker(),
|
|
2808
|
-
objectOf: createObjectOfTypeChecker,
|
|
2809
|
-
oneOf: createEnumTypeChecker,
|
|
2810
|
-
oneOfType: createUnionTypeChecker,
|
|
2811
|
-
shape: createShapeTypeChecker
|
|
2812
|
-
};
|
|
2813
|
-
}
|
|
2814
|
-
|
|
2815
|
-
/**
|
|
2816
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
2817
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
2818
|
-
*/
|
|
2819
|
-
/*eslint-disable no-self-compare*/
|
|
2820
|
-
function is(x, y) {
|
|
2821
|
-
// SameValue algorithm
|
|
2822
|
-
if (x === y) {
|
|
2823
|
-
// Steps 1-5, 7-10
|
|
2824
|
-
// Steps 6.b-6.e: +0 != -0
|
|
2825
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
2826
|
-
} else {
|
|
2827
|
-
// Step 6.a: NaN == NaN
|
|
2828
|
-
return x !== x && y !== y;
|
|
2829
|
-
}
|
|
2830
|
-
}
|
|
2831
|
-
/*eslint-enable no-self-compare*/
|
|
2832
|
-
|
|
2833
|
-
/**
|
|
2834
|
-
* We use an Error-like object for backward compatibility as people may call
|
|
2835
|
-
* PropTypes directly and inspect their output. However, we don't use real
|
|
2836
|
-
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
2837
|
-
* is prohibitively expensive if they are created too often, such as what
|
|
2838
|
-
* happens in oneOfType() for any type before the one that matched.
|
|
2839
|
-
*/
|
|
2840
|
-
function PropTypeError(message) {
|
|
2841
|
-
this.message = message;
|
|
2842
|
-
this.stack = '';
|
|
2843
|
-
}
|
|
2844
|
-
// Make `instanceof Error` still work for returned errors.
|
|
2845
|
-
PropTypeError.prototype = Error.prototype;
|
|
2846
|
-
|
|
2847
|
-
function createChainableTypeChecker(validate) {
|
|
2848
|
-
{
|
|
2849
|
-
var manualPropTypeCallCache = {};
|
|
2850
|
-
}
|
|
2851
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
2852
|
-
componentName = componentName || ANONYMOUS;
|
|
2853
|
-
propFullName = propFullName || propName;
|
|
2854
|
-
{
|
|
2855
|
-
if (secret !== ReactPropTypesSecret_1 && typeof console !== 'undefined') {
|
|
2856
|
-
var cacheKey = componentName + ':' + propName;
|
|
2857
|
-
if (!manualPropTypeCallCache[cacheKey]) {
|
|
2858
|
-
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);
|
|
2859
|
-
manualPropTypeCallCache[cacheKey] = true;
|
|
2860
|
-
}
|
|
2861
|
-
}
|
|
2862
|
-
}
|
|
2863
|
-
if (props[propName] == null) {
|
|
2864
|
-
if (isRequired) {
|
|
2865
|
-
if (props[propName] === null) {
|
|
2866
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
2867
|
-
}
|
|
2868
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
2869
|
-
}
|
|
2870
|
-
return null;
|
|
2871
|
-
} else {
|
|
2872
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
|
|
2876
|
-
var chainedCheckType = checkType.bind(null, false);
|
|
2877
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
2878
|
-
|
|
2879
|
-
return chainedCheckType;
|
|
2880
|
-
}
|
|
2881
|
-
|
|
2882
|
-
function createPrimitiveTypeChecker(expectedType) {
|
|
2883
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
2884
|
-
var propValue = props[propName];
|
|
2885
|
-
var propType = getPropType(propValue);
|
|
2886
|
-
if (propType !== expectedType) {
|
|
2887
|
-
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
2888
|
-
// check, but we can offer a more precise error message here rather than
|
|
2889
|
-
// 'of type `object`'.
|
|
2890
|
-
var preciseType = getPreciseType(propValue);
|
|
2891
|
-
|
|
2892
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
|
2893
|
-
}
|
|
2894
|
-
return null;
|
|
2895
|
-
}
|
|
2896
|
-
return createChainableTypeChecker(validate);
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
|
-
function createAnyTypeChecker() {
|
|
2900
|
-
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
|
-
function createArrayOfTypeChecker(typeChecker) {
|
|
2904
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2905
|
-
if (typeof typeChecker !== 'function') {
|
|
2906
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
2907
|
-
}
|
|
2908
|
-
var propValue = props[propName];
|
|
2909
|
-
if (!Array.isArray(propValue)) {
|
|
2910
|
-
var propType = getPropType(propValue);
|
|
2911
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
2912
|
-
}
|
|
2913
|
-
for (var i = 0; i < propValue.length; i++) {
|
|
2914
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
|
2915
|
-
if (error instanceof Error) {
|
|
2916
|
-
return error;
|
|
2917
|
-
}
|
|
2918
|
-
}
|
|
2919
|
-
return null;
|
|
2920
|
-
}
|
|
2921
|
-
return createChainableTypeChecker(validate);
|
|
2922
|
-
}
|
|
2923
|
-
|
|
2924
|
-
function createElementTypeChecker() {
|
|
2925
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2926
|
-
var propValue = props[propName];
|
|
2927
|
-
if (!ReactElement_1.isValidElement(propValue)) {
|
|
2928
|
-
var propType = getPropType(propValue);
|
|
2929
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
2930
|
-
}
|
|
2931
|
-
return null;
|
|
2932
|
-
}
|
|
2933
|
-
return createChainableTypeChecker(validate);
|
|
2934
|
-
}
|
|
2935
|
-
|
|
2936
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
2937
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2938
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
2939
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
2940
|
-
var actualClassName = getClassName(props[propName]);
|
|
2941
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
2942
|
-
}
|
|
2943
|
-
return null;
|
|
2944
|
-
}
|
|
2945
|
-
return createChainableTypeChecker(validate);
|
|
2946
|
-
}
|
|
2947
|
-
|
|
2948
|
-
function createEnumTypeChecker(expectedValues) {
|
|
2949
|
-
if (!Array.isArray(expectedValues)) {
|
|
2950
|
-
warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.');
|
|
2951
|
-
return emptyFunction.thatReturnsNull;
|
|
2952
|
-
}
|
|
2953
|
-
|
|
2954
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2955
|
-
var propValue = props[propName];
|
|
2956
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
2957
|
-
if (is(propValue, expectedValues[i])) {
|
|
2958
|
-
return null;
|
|
2959
|
-
}
|
|
2960
|
-
}
|
|
2961
|
-
|
|
2962
|
-
var valuesString = JSON.stringify(expectedValues);
|
|
2963
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
2964
|
-
}
|
|
2965
|
-
return createChainableTypeChecker(validate);
|
|
2966
|
-
}
|
|
2008
|
+
var isValidElement = ReactElement_1.isValidElement;
|
|
2967
2009
|
|
|
2968
|
-
function createObjectOfTypeChecker(typeChecker) {
|
|
2969
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2970
|
-
if (typeof typeChecker !== 'function') {
|
|
2971
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
2972
|
-
}
|
|
2973
|
-
var propValue = props[propName];
|
|
2974
|
-
var propType = getPropType(propValue);
|
|
2975
|
-
if (propType !== 'object') {
|
|
2976
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
2977
|
-
}
|
|
2978
|
-
for (var key in propValue) {
|
|
2979
|
-
if (propValue.hasOwnProperty(key)) {
|
|
2980
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
2981
|
-
if (error instanceof Error) {
|
|
2982
|
-
return error;
|
|
2983
|
-
}
|
|
2984
|
-
}
|
|
2985
|
-
}
|
|
2986
|
-
return null;
|
|
2987
|
-
}
|
|
2988
|
-
return createChainableTypeChecker(validate);
|
|
2989
|
-
}
|
|
2990
2010
|
|
|
2991
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
2992
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
2993
|
-
warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.');
|
|
2994
|
-
return emptyFunction.thatReturnsNull;
|
|
2995
|
-
}
|
|
2996
2011
|
|
|
2997
|
-
|
|
2998
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
2999
|
-
var checker = arrayOfTypeCheckers[i];
|
|
3000
|
-
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
|
|
3001
|
-
return null;
|
|
3002
|
-
}
|
|
3003
|
-
}
|
|
3004
|
-
|
|
3005
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
|
3006
|
-
}
|
|
3007
|
-
return createChainableTypeChecker(validate);
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
|
-
function createNodeChecker() {
|
|
3011
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
3012
|
-
if (!isNode(props[propName])) {
|
|
3013
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
3014
|
-
}
|
|
3015
|
-
return null;
|
|
3016
|
-
}
|
|
3017
|
-
return createChainableTypeChecker(validate);
|
|
3018
|
-
}
|
|
3019
|
-
|
|
3020
|
-
function createShapeTypeChecker(shapeTypes) {
|
|
3021
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
3022
|
-
var propValue = props[propName];
|
|
3023
|
-
var propType = getPropType(propValue);
|
|
3024
|
-
if (propType !== 'object') {
|
|
3025
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
3026
|
-
}
|
|
3027
|
-
for (var key in shapeTypes) {
|
|
3028
|
-
var checker = shapeTypes[key];
|
|
3029
|
-
if (!checker) {
|
|
3030
|
-
continue;
|
|
3031
|
-
}
|
|
3032
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
3033
|
-
if (error) {
|
|
3034
|
-
return error;
|
|
3035
|
-
}
|
|
3036
|
-
}
|
|
3037
|
-
return null;
|
|
3038
|
-
}
|
|
3039
|
-
return createChainableTypeChecker(validate);
|
|
3040
|
-
}
|
|
3041
|
-
|
|
3042
|
-
function isNode(propValue) {
|
|
3043
|
-
switch (typeof propValue) {
|
|
3044
|
-
case 'number':
|
|
3045
|
-
case 'string':
|
|
3046
|
-
case 'undefined':
|
|
3047
|
-
return true;
|
|
3048
|
-
case 'boolean':
|
|
3049
|
-
return !propValue;
|
|
3050
|
-
case 'object':
|
|
3051
|
-
if (Array.isArray(propValue)) {
|
|
3052
|
-
return propValue.every(isNode);
|
|
3053
|
-
}
|
|
3054
|
-
if (propValue === null || ReactElement_1.isValidElement(propValue)) {
|
|
3055
|
-
return true;
|
|
3056
|
-
}
|
|
3057
|
-
|
|
3058
|
-
var iteratorFn = getIteratorFn_1(propValue);
|
|
3059
|
-
if (iteratorFn) {
|
|
3060
|
-
var iterator = iteratorFn.call(propValue);
|
|
3061
|
-
var step;
|
|
3062
|
-
if (iteratorFn !== propValue.entries) {
|
|
3063
|
-
while (!(step = iterator.next()).done) {
|
|
3064
|
-
if (!isNode(step.value)) {
|
|
3065
|
-
return false;
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
|
-
} else {
|
|
3069
|
-
// Iterator will provide entry [k,v] tuples rather than values.
|
|
3070
|
-
while (!(step = iterator.next()).done) {
|
|
3071
|
-
var entry = step.value;
|
|
3072
|
-
if (entry) {
|
|
3073
|
-
if (!isNode(entry[1])) {
|
|
3074
|
-
return false;
|
|
3075
|
-
}
|
|
3076
|
-
}
|
|
3077
|
-
}
|
|
3078
|
-
}
|
|
3079
|
-
} else {
|
|
3080
|
-
return false;
|
|
3081
|
-
}
|
|
3082
|
-
|
|
3083
|
-
return true;
|
|
3084
|
-
default:
|
|
3085
|
-
return false;
|
|
3086
|
-
}
|
|
3087
|
-
}
|
|
3088
|
-
|
|
3089
|
-
function isSymbol(propType, propValue) {
|
|
3090
|
-
// Native Symbol.
|
|
3091
|
-
if (propType === 'symbol') {
|
|
3092
|
-
return true;
|
|
3093
|
-
}
|
|
3094
|
-
|
|
3095
|
-
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
3096
|
-
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
3097
|
-
return true;
|
|
3098
|
-
}
|
|
3099
|
-
|
|
3100
|
-
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
3101
|
-
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
3102
|
-
return true;
|
|
3103
|
-
}
|
|
3104
|
-
|
|
3105
|
-
return false;
|
|
3106
|
-
}
|
|
3107
|
-
|
|
3108
|
-
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
3109
|
-
function getPropType(propValue) {
|
|
3110
|
-
var propType = typeof propValue;
|
|
3111
|
-
if (Array.isArray(propValue)) {
|
|
3112
|
-
return 'array';
|
|
3113
|
-
}
|
|
3114
|
-
if (propValue instanceof RegExp) {
|
|
3115
|
-
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
3116
|
-
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
3117
|
-
// passes PropTypes.object.
|
|
3118
|
-
return 'object';
|
|
3119
|
-
}
|
|
3120
|
-
if (isSymbol(propType, propValue)) {
|
|
3121
|
-
return 'symbol';
|
|
3122
|
-
}
|
|
3123
|
-
return propType;
|
|
3124
|
-
}
|
|
3125
|
-
|
|
3126
|
-
// This handles more types than `getPropType`. Only used for error messages.
|
|
3127
|
-
// See `createPrimitiveTypeChecker`.
|
|
3128
|
-
function getPreciseType(propValue) {
|
|
3129
|
-
var propType = getPropType(propValue);
|
|
3130
|
-
if (propType === 'object') {
|
|
3131
|
-
if (propValue instanceof Date) {
|
|
3132
|
-
return 'date';
|
|
3133
|
-
} else if (propValue instanceof RegExp) {
|
|
3134
|
-
return 'regexp';
|
|
3135
|
-
}
|
|
3136
|
-
}
|
|
3137
|
-
return propType;
|
|
3138
|
-
}
|
|
3139
|
-
|
|
3140
|
-
// Returns class name of the object, if any.
|
|
3141
|
-
function getClassName(propValue) {
|
|
3142
|
-
if (!propValue.constructor || !propValue.constructor.name) {
|
|
3143
|
-
return ANONYMOUS;
|
|
3144
|
-
}
|
|
3145
|
-
return propValue.constructor.name;
|
|
3146
|
-
}
|
|
3147
|
-
|
|
3148
|
-
var ReactPropTypes_1 = ReactPropTypes;
|
|
2012
|
+
var ReactPropTypes = factory(isValidElement);
|
|
3149
2013
|
|
|
3150
2014
|
/**
|
|
3151
2015
|
* Copyright 2013-present, Facebook, Inc.
|
|
@@ -3158,7 +2022,7 @@ var ReactPropTypes_1 = ReactPropTypes;
|
|
|
3158
2022
|
* @providesModule ReactVersion
|
|
3159
2023
|
*/
|
|
3160
2024
|
|
|
3161
|
-
var ReactVersion = '16.0.0-alpha.
|
|
2025
|
+
var ReactVersion = '16.0.0-alpha.9';
|
|
3162
2026
|
|
|
3163
2027
|
/**
|
|
3164
2028
|
* Returns the first child in a collection of children and verifies that there
|
|
@@ -3181,11 +2045,22 @@ function onlyChild(children) {
|
|
|
3181
2045
|
|
|
3182
2046
|
var onlyChild_1 = onlyChild;
|
|
3183
2047
|
|
|
2048
|
+
var Component = ReactBaseClasses.Component;
|
|
2049
|
+
|
|
2050
|
+
var isValidElement$1 = ReactElement_1.isValidElement;
|
|
2051
|
+
|
|
2052
|
+
|
|
2053
|
+
|
|
2054
|
+
|
|
2055
|
+
var createClass = factory$1(Component, isValidElement$1, ReactNoopUpdateQueue_1);
|
|
2056
|
+
|
|
3184
2057
|
var createElement = ReactElement_1.createElement;
|
|
3185
2058
|
var createFactory = ReactElement_1.createFactory;
|
|
3186
2059
|
var cloneElement = ReactElement_1.cloneElement;
|
|
3187
2060
|
|
|
3188
2061
|
{
|
|
2062
|
+
var warning$1 = warning;
|
|
2063
|
+
var canDefineProperty = canDefineProperty_1;
|
|
3189
2064
|
var ReactElementValidator = ReactElementValidator_1;
|
|
3190
2065
|
createElement = ReactElementValidator.createElement;
|
|
3191
2066
|
createFactory = ReactElementValidator.createFactory;
|
|
@@ -3196,16 +2071,6 @@ var createMixin = function (mixin) {
|
|
|
3196
2071
|
return mixin;
|
|
3197
2072
|
};
|
|
3198
2073
|
|
|
3199
|
-
{
|
|
3200
|
-
var warnedForCreateMixin = false;
|
|
3201
|
-
|
|
3202
|
-
createMixin = function (mixin) {
|
|
3203
|
-
warning(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. You ' + 'can use this mixin directly instead.');
|
|
3204
|
-
warnedForCreateMixin = true;
|
|
3205
|
-
return mixin;
|
|
3206
|
-
};
|
|
3207
|
-
}
|
|
3208
|
-
|
|
3209
2074
|
var React = {
|
|
3210
2075
|
// Modern
|
|
3211
2076
|
|
|
@@ -3224,12 +2089,13 @@ var React = {
|
|
|
3224
2089
|
cloneElement: cloneElement,
|
|
3225
2090
|
isValidElement: ReactElement_1.isValidElement,
|
|
3226
2091
|
|
|
3227
|
-
|
|
2092
|
+
// TODO (bvaughn) Remove these getters in 16.0.0-alpha.10
|
|
2093
|
+
PropTypes: ReactPropTypes,
|
|
2094
|
+
checkPropTypes: checkPropTypes$2,
|
|
2095
|
+
createClass: createClass,
|
|
3228
2096
|
|
|
3229
2097
|
// Classic
|
|
3230
2098
|
|
|
3231
|
-
PropTypes: ReactPropTypes_1,
|
|
3232
|
-
createClass: ReactClass_1.createClass,
|
|
3233
2099
|
createFactory: createFactory,
|
|
3234
2100
|
createMixin: createMixin,
|
|
3235
2101
|
|
|
@@ -3237,26 +2103,59 @@ var React = {
|
|
|
3237
2103
|
// since they are just generating DOM strings.
|
|
3238
2104
|
DOM: ReactDOMFactories_1,
|
|
3239
2105
|
|
|
3240
|
-
version: ReactVersion
|
|
3241
|
-
};
|
|
3242
|
-
|
|
3243
|
-
var React_1 = React;
|
|
2106
|
+
version: ReactVersion,
|
|
3244
2107
|
|
|
3245
|
-
// `version` will be added here by the React module.
|
|
3246
|
-
var ReactUMDEntry = _assign({
|
|
3247
2108
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
3248
2109
|
ReactCurrentOwner: ReactCurrentOwner_1
|
|
3249
2110
|
}
|
|
3250
|
-
}
|
|
2111
|
+
};
|
|
3251
2112
|
|
|
3252
2113
|
{
|
|
3253
|
-
|
|
2114
|
+
objectAssign$1(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
3254
2115
|
// These should not be included in production.
|
|
3255
2116
|
ReactComponentTreeHook: ReactComponentTreeHook_1,
|
|
3256
2117
|
ReactDebugCurrentFrame: ReactDebugCurrentFrame_1
|
|
3257
2118
|
});
|
|
2119
|
+
|
|
2120
|
+
var warnedForCheckPropTypes = false;
|
|
2121
|
+
var warnedForCreateMixin = false;
|
|
2122
|
+
var warnedForCreateClass = false;
|
|
2123
|
+
var warnedForPropTypes = false;
|
|
2124
|
+
|
|
2125
|
+
React.createMixin = function (mixin) {
|
|
2126
|
+
warning$1(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. You ' + 'can use this mixin directly instead.');
|
|
2127
|
+
warnedForCreateMixin = true;
|
|
2128
|
+
return mixin;
|
|
2129
|
+
};
|
|
2130
|
+
|
|
2131
|
+
// TODO (bvaughn) Remove both of these deprecation warnings in 16.0.0-alpha.10
|
|
2132
|
+
if (canDefineProperty) {
|
|
2133
|
+
Object.defineProperty(React, 'checkPropTypes', {
|
|
2134
|
+
get: function () {
|
|
2135
|
+
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)');
|
|
2136
|
+
warnedForCheckPropTypes = true;
|
|
2137
|
+
return ReactPropTypes;
|
|
2138
|
+
}
|
|
2139
|
+
});
|
|
2140
|
+
|
|
2141
|
+
Object.defineProperty(React, 'createClass', {
|
|
2142
|
+
get: function () {
|
|
2143
|
+
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)');
|
|
2144
|
+
warnedForCreateClass = true;
|
|
2145
|
+
return createClass;
|
|
2146
|
+
}
|
|
2147
|
+
});
|
|
2148
|
+
|
|
2149
|
+
Object.defineProperty(React, 'PropTypes', {
|
|
2150
|
+
get: function () {
|
|
2151
|
+
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)');
|
|
2152
|
+
warnedForPropTypes = true;
|
|
2153
|
+
return ReactPropTypes;
|
|
2154
|
+
}
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
3258
2157
|
}
|
|
3259
2158
|
|
|
3260
|
-
var
|
|
2159
|
+
var React_1 = React;
|
|
3261
2160
|
|
|
3262
|
-
module.exports =
|
|
2161
|
+
module.exports = React_1;
|