react-rails 1.10.0 → 1.11.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +5 -2
- data/lib/assets/react-source/development-with-addons/react-server.js +2064 -1704
- data/lib/assets/react-source/development-with-addons/react.js +2101 -1741
- data/lib/assets/react-source/development/react-server.js +104 -78
- data/lib/assets/react-source/development/react.js +96 -63
- data/lib/assets/react-source/production-with-addons/react-server.js +11 -6
- data/lib/assets/react-source/production-with-addons/react.js +11 -6
- data/lib/assets/react-source/production/react-server.js +11 -6
- data/lib/assets/react-source/production/react.js +11 -6
- data/lib/react/rails/controller_renderer.rb +10 -3
- data/lib/react/rails/version.rb +1 -1
- data/lib/react/server_rendering.rb +2 -2
- data/lib/react/server_rendering/sprockets_renderer.rb +1 -1
- data/lib/react/server_rendering/yaml_manifest_container.rb +9 -3
- metadata +2 -30
@@ -347,8 +347,15 @@
|
|
347
347
|
/* 4 */
|
348
348
|
/***/ function(module, exports) {
|
349
349
|
|
350
|
+
/*
|
351
|
+
object-assign
|
352
|
+
(c) Sindre Sorhus
|
353
|
+
@license MIT
|
354
|
+
*/
|
355
|
+
|
350
356
|
'use strict';
|
351
357
|
/* eslint-disable no-unused-vars */
|
358
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
352
359
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
353
360
|
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
354
361
|
|
@@ -369,7 +376,7 @@
|
|
369
376
|
// Detect buggy property enumeration order in older V8 versions.
|
370
377
|
|
371
378
|
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
372
|
-
var test1 = new String('abc'); // eslint-disable-line
|
379
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
373
380
|
test1[5] = 'de';
|
374
381
|
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
375
382
|
return false;
|
@@ -398,7 +405,7 @@
|
|
398
405
|
}
|
399
406
|
|
400
407
|
return true;
|
401
|
-
} catch (
|
408
|
+
} catch (err) {
|
402
409
|
// We don't expect any of the above to throw, but better to be safe.
|
403
410
|
return false;
|
404
411
|
}
|
@@ -418,8 +425,8 @@
|
|
418
425
|
}
|
419
426
|
}
|
420
427
|
|
421
|
-
if (
|
422
|
-
symbols =
|
428
|
+
if (getOwnPropertySymbols) {
|
429
|
+
symbols = getOwnPropertySymbols(from);
|
423
430
|
for (var i = 0; i < symbols.length; i++) {
|
424
431
|
if (propIsEnumerable.call(from, symbols[i])) {
|
425
432
|
to[symbols[i]] = from[symbols[i]];
|
@@ -699,17 +706,6 @@
|
|
699
706
|
}
|
700
707
|
};
|
701
708
|
|
702
|
-
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
|
703
|
-
var Klass = this;
|
704
|
-
if (Klass.instancePool.length) {
|
705
|
-
var instance = Klass.instancePool.pop();
|
706
|
-
Klass.call(instance, a1, a2, a3, a4, a5);
|
707
|
-
return instance;
|
708
|
-
} else {
|
709
|
-
return new Klass(a1, a2, a3, a4, a5);
|
710
|
-
}
|
711
|
-
};
|
712
|
-
|
713
709
|
var standardReleaser = function (instance) {
|
714
710
|
var Klass = this;
|
715
711
|
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
|
@@ -749,8 +745,7 @@
|
|
749
745
|
oneArgumentPooler: oneArgumentPooler,
|
750
746
|
twoArgumentPooler: twoArgumentPooler,
|
751
747
|
threeArgumentPooler: threeArgumentPooler,
|
752
|
-
fourArgumentPooler: fourArgumentPooler
|
753
|
-
fiveArgumentPooler: fiveArgumentPooler
|
748
|
+
fourArgumentPooler: fourArgumentPooler
|
754
749
|
};
|
755
750
|
|
756
751
|
module.exports = PooledClass;
|
@@ -826,12 +821,18 @@
|
|
826
821
|
* will remain to ensure logic does not differ in production.
|
827
822
|
*/
|
828
823
|
|
829
|
-
function
|
830
|
-
|
824
|
+
var validateFormat = function validateFormat(format) {};
|
825
|
+
|
826
|
+
if (process.env.NODE_ENV !== 'production') {
|
827
|
+
validateFormat = function validateFormat(format) {
|
831
828
|
if (format === undefined) {
|
832
829
|
throw new Error('invariant requires an error message argument');
|
833
830
|
}
|
834
|
-
}
|
831
|
+
};
|
832
|
+
}
|
833
|
+
|
834
|
+
function invariant(condition, format, a, b, c, d, e, f) {
|
835
|
+
validateFormat(format);
|
835
836
|
|
836
837
|
if (!condition) {
|
837
838
|
var error;
|
@@ -3084,7 +3085,14 @@
|
|
3084
3085
|
// We warn in this case but don't throw. We expect the element creation to
|
3085
3086
|
// succeed and there will likely be errors in render.
|
3086
3087
|
if (!validType) {
|
3087
|
-
|
3088
|
+
if (typeof type !== 'function' && typeof type !== 'string') {
|
3089
|
+
var info = '';
|
3090
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
3091
|
+
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
|
3092
|
+
}
|
3093
|
+
info += getDeclarationErrorAddendum();
|
3094
|
+
process.env.NODE_ENV !== 'production' ? warning(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) : void 0;
|
3095
|
+
}
|
3088
3096
|
}
|
3089
3097
|
|
3090
3098
|
var element = ReactElement.createElement.apply(this, arguments);
|
@@ -4055,7 +4063,7 @@
|
|
4055
4063
|
|
4056
4064
|
'use strict';
|
4057
4065
|
|
4058
|
-
module.exports = '15.4.
|
4066
|
+
module.exports = '15.4.2';
|
4059
4067
|
|
4060
4068
|
/***/ },
|
4061
4069
|
/* 31 */
|
@@ -4253,6 +4261,13 @@
|
|
4253
4261
|
|
4254
4262
|
var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
|
4255
4263
|
|
4264
|
+
/**
|
4265
|
+
* Check if a given node should be cached.
|
4266
|
+
*/
|
4267
|
+
function shouldPrecacheNode(node, nodeID) {
|
4268
|
+
return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' ';
|
4269
|
+
}
|
4270
|
+
|
4256
4271
|
/**
|
4257
4272
|
* Drill down (through composites and empty components) until we get a host or
|
4258
4273
|
* host text component.
|
@@ -4318,7 +4333,7 @@
|
|
4318
4333
|
}
|
4319
4334
|
// We assume the child nodes are in the same order as the child instances.
|
4320
4335
|
for (; childNode !== null; childNode = childNode.nextSibling) {
|
4321
|
-
if (
|
4336
|
+
if (shouldPrecacheNode(childNode, childID)) {
|
4322
4337
|
precacheNode(childInst, childNode);
|
4323
4338
|
continue outer;
|
4324
4339
|
}
|
@@ -6559,17 +6574,6 @@
|
|
6559
6574
|
}
|
6560
6575
|
};
|
6561
6576
|
|
6562
|
-
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
|
6563
|
-
var Klass = this;
|
6564
|
-
if (Klass.instancePool.length) {
|
6565
|
-
var instance = Klass.instancePool.pop();
|
6566
|
-
Klass.call(instance, a1, a2, a3, a4, a5);
|
6567
|
-
return instance;
|
6568
|
-
} else {
|
6569
|
-
return new Klass(a1, a2, a3, a4, a5);
|
6570
|
-
}
|
6571
|
-
};
|
6572
|
-
|
6573
6577
|
var standardReleaser = function (instance) {
|
6574
6578
|
var Klass = this;
|
6575
6579
|
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
|
@@ -6609,8 +6613,7 @@
|
|
6609
6613
|
oneArgumentPooler: oneArgumentPooler,
|
6610
6614
|
twoArgumentPooler: twoArgumentPooler,
|
6611
6615
|
threeArgumentPooler: threeArgumentPooler,
|
6612
|
-
fourArgumentPooler: fourArgumentPooler
|
6613
|
-
fiveArgumentPooler: fiveArgumentPooler
|
6616
|
+
fourArgumentPooler: fourArgumentPooler
|
6614
6617
|
};
|
6615
6618
|
|
6616
6619
|
module.exports = PooledClass;
|
@@ -11428,12 +11431,18 @@
|
|
11428
11431
|
} else {
|
11429
11432
|
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
|
11430
11433
|
var childrenToUse = contentToUse != null ? null : props.children;
|
11434
|
+
// TODO: Validate that text is allowed as a child of this node
|
11431
11435
|
if (contentToUse != null) {
|
11432
|
-
//
|
11433
|
-
|
11434
|
-
|
11436
|
+
// Avoid setting textContent when the text is empty. In IE11 setting
|
11437
|
+
// textContent on a text area will cause the placeholder to not
|
11438
|
+
// show within the textarea until it has been focused and blurred again.
|
11439
|
+
// https://github.com/facebook/react/issues/6731#issuecomment-254874553
|
11440
|
+
if (contentToUse !== '') {
|
11441
|
+
if (process.env.NODE_ENV !== 'production') {
|
11442
|
+
setAndValidateContentChildDev.call(this, contentToUse);
|
11443
|
+
}
|
11444
|
+
DOMLazyTree.queueText(lazyTree, contentToUse);
|
11435
11445
|
}
|
11436
|
-
DOMLazyTree.queueText(lazyTree, contentToUse);
|
11437
11446
|
} else if (childrenToUse != null) {
|
11438
11447
|
var mountImages = this.mountChildren(childrenToUse, transaction, context);
|
11439
11448
|
for (var i = 0; i < mountImages.length; i++) {
|
@@ -13353,7 +13362,17 @@
|
|
13353
13362
|
}
|
13354
13363
|
} else {
|
13355
13364
|
if (props.value == null && props.defaultValue != null) {
|
13356
|
-
|
13365
|
+
// In Chrome, assigning defaultValue to certain input types triggers input validation.
|
13366
|
+
// For number inputs, the display value loses trailing decimal points. For email inputs,
|
13367
|
+
// Chrome raises "The specified value <x> is not a valid email address".
|
13368
|
+
//
|
13369
|
+
// Here we check to see if the defaultValue has actually changed, avoiding these problems
|
13370
|
+
// when the user is inputting text
|
13371
|
+
//
|
13372
|
+
// https://github.com/facebook/react/issues/7253
|
13373
|
+
if (node.defaultValue !== '' + props.defaultValue) {
|
13374
|
+
node.defaultValue = '' + props.defaultValue;
|
13375
|
+
}
|
13357
13376
|
}
|
13358
13377
|
if (props.checked == null && props.defaultChecked != null) {
|
13359
13378
|
node.defaultChecked = !!props.defaultChecked;
|
@@ -14100,9 +14119,15 @@
|
|
14100
14119
|
// This is in postMount because we need access to the DOM node, which is not
|
14101
14120
|
// available until after the component has mounted.
|
14102
14121
|
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
|
14122
|
+
var textContent = node.textContent;
|
14103
14123
|
|
14104
|
-
//
|
14105
|
-
|
14124
|
+
// Only set node.value if textContent is equal to the expected
|
14125
|
+
// initial value. In IE10/IE11 there is a bug where the placeholder attribute
|
14126
|
+
// will populate textContent as well.
|
14127
|
+
// https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
|
14128
|
+
if (textContent === inst._wrapperState.initialValue) {
|
14129
|
+
node.value = textContent;
|
14130
|
+
}
|
14106
14131
|
}
|
14107
14132
|
};
|
14108
14133
|
|
@@ -14904,7 +14929,17 @@
|
|
14904
14929
|
instance = ReactEmptyComponent.create(instantiateReactComponent);
|
14905
14930
|
} else if (typeof node === 'object') {
|
14906
14931
|
var element = node;
|
14907
|
-
|
14932
|
+
var type = element.type;
|
14933
|
+
if (typeof type !== 'function' && typeof type !== 'string') {
|
14934
|
+
var info = '';
|
14935
|
+
if (process.env.NODE_ENV !== 'production') {
|
14936
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
14937
|
+
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
|
14938
|
+
}
|
14939
|
+
}
|
14940
|
+
info += getDeclarationErrorAddendum(element._owner);
|
14941
|
+
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element 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) : _prodInvariant('130', type == null ? type : typeof type, info) : void 0;
|
14942
|
+
}
|
14908
14943
|
|
14909
14944
|
// Special case string values
|
14910
14945
|
if (typeof element.type === 'string') {
|
@@ -15194,7 +15229,7 @@
|
|
15194
15229
|
// Since plain JS classes are defined without any special initialization
|
15195
15230
|
// logic, we can not catch common errors early. Therefore, we have to
|
15196
15231
|
// catch them here, at initialization time, instead.
|
15197
|
-
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0;
|
15232
|
+
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved || inst.state, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0;
|
15198
15233
|
process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0;
|
15199
15234
|
process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0;
|
15200
15235
|
process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0;
|
@@ -16198,14 +16233,11 @@
|
|
16198
16233
|
|
16199
16234
|
'use strict';
|
16200
16235
|
|
16201
|
-
var _prodInvariant = __webpack_require__(35)
|
16202
|
-
_assign = __webpack_require__(4);
|
16236
|
+
var _prodInvariant = __webpack_require__(35);
|
16203
16237
|
|
16204
16238
|
var invariant = __webpack_require__(8);
|
16205
16239
|
|
16206
16240
|
var genericComponentClass = null;
|
16207
|
-
// This registry keeps track of wrapper classes around host tags.
|
16208
|
-
var tagToComponentClass = {};
|
16209
16241
|
var textComponentClass = null;
|
16210
16242
|
|
16211
16243
|
var ReactHostComponentInjection = {
|
@@ -16218,11 +16250,6 @@
|
|
16218
16250
|
// rendered as props.
|
16219
16251
|
injectTextComponentClass: function (componentClass) {
|
16220
16252
|
textComponentClass = componentClass;
|
16221
|
-
},
|
16222
|
-
// This accepts a keyed object with classes as values. Each key represents a
|
16223
|
-
// tag. That particular tag will use this class instead of the generic one.
|
16224
|
-
injectComponentClasses: function (componentClasses) {
|
16225
|
-
_assign(tagToComponentClass, componentClasses);
|
16226
16253
|
}
|
16227
16254
|
};
|
16228
16255
|
|
@@ -18262,10 +18289,10 @@
|
|
18262
18289
|
*/
|
18263
18290
|
|
18264
18291
|
function getUnboundedScrollPosition(scrollable) {
|
18265
|
-
if (scrollable
|
18292
|
+
if (scrollable.Window && scrollable instanceof scrollable.Window) {
|
18266
18293
|
return {
|
18267
|
-
x:
|
18268
|
-
y:
|
18294
|
+
x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,
|
18295
|
+
y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop
|
18269
18296
|
};
|
18270
18297
|
}
|
18271
18298
|
return {
|
@@ -19014,7 +19041,9 @@
|
|
19014
19041
|
* @return {boolean} Whether or not the object is a DOM node.
|
19015
19042
|
*/
|
19016
19043
|
function isNode(object) {
|
19017
|
-
|
19044
|
+
var doc = object ? object.ownerDocument || object : document;
|
19045
|
+
var defaultView = doc.defaultView || window;
|
19046
|
+
return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
|
19018
19047
|
}
|
19019
19048
|
|
19020
19049
|
module.exports = isNode;
|
@@ -19044,15 +19073,19 @@
|
|
19044
19073
|
*
|
19045
19074
|
* The activeElement will be null only if the document or document body is not
|
19046
19075
|
* yet defined.
|
19076
|
+
*
|
19077
|
+
* @param {?DOMDocument} doc Defaults to current document.
|
19078
|
+
* @return {?DOMElement}
|
19047
19079
|
*/
|
19048
|
-
function getActiveElement() /*?DOMElement*/{
|
19049
|
-
|
19080
|
+
function getActiveElement(doc) /*?DOMElement*/{
|
19081
|
+
doc = doc || (typeof document !== 'undefined' ? document : undefined);
|
19082
|
+
if (typeof doc === 'undefined') {
|
19050
19083
|
return null;
|
19051
19084
|
}
|
19052
19085
|
try {
|
19053
|
-
return
|
19086
|
+
return doc.activeElement || doc.body;
|
19054
19087
|
} catch (e) {
|
19055
|
-
return
|
19088
|
+
return doc.body;
|
19056
19089
|
}
|
19057
19090
|
}
|
19058
19091
|
|
@@ -21077,7 +21110,7 @@
|
|
21077
21110
|
|
21078
21111
|
'use strict';
|
21079
21112
|
|
21080
|
-
module.exports = '15.4.
|
21113
|
+
module.exports = '15.4.2';
|
21081
21114
|
|
21082
21115
|
/***/ },
|
21083
21116
|
/* 172 */
|
@@ -21467,15 +21500,15 @@
|
|
21467
21500
|
|
21468
21501
|
/* WEBPACK VAR INJECTION */(function(process) {var addons = {};
|
21469
21502
|
addons.TransitionGroup = __webpack_require__(179);
|
21470
|
-
addons.CSSTransitionGroup = __webpack_require__(
|
21503
|
+
addons.CSSTransitionGroup = __webpack_require__(183);
|
21471
21504
|
addons.LinkedStateMixin = __webpack_require__(193);
|
21472
|
-
addons.createFragment = __webpack_require__(
|
21473
|
-
addons.update = __webpack_require__(
|
21474
|
-
addons.PureRenderMixin = __webpack_require__(
|
21505
|
+
addons.createFragment = __webpack_require__(194);
|
21506
|
+
addons.update = __webpack_require__(195);
|
21507
|
+
addons.PureRenderMixin = __webpack_require__(196);
|
21475
21508
|
|
21476
21509
|
if (process.env.NODE_ENV !== "production") {
|
21477
|
-
addons.TestUtils = __webpack_require__(
|
21478
|
-
addons.Perf = __webpack_require__(
|
21510
|
+
addons.TestUtils = __webpack_require__(197);
|
21511
|
+
addons.Perf = __webpack_require__(198);
|
21479
21512
|
}
|
21480
21513
|
|
21481
21514
|
module.exports = addons;
|
@@ -21492,7 +21525,7 @@
|
|
21492
21525
|
/* 180 */
|
21493
21526
|
/***/ function(module, exports, __webpack_require__) {
|
21494
21527
|
|
21495
|
-
|
21528
|
+
/**
|
21496
21529
|
* Copyright 2013-present, Facebook, Inc.
|
21497
21530
|
* All rights reserved.
|
21498
21531
|
*
|
@@ -21513,8 +21546,7 @@
|
|
21513
21546
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
21514
21547
|
|
21515
21548
|
var React = __webpack_require__(2);
|
21516
|
-
var
|
21517
|
-
var ReactTransitionChildMapping = __webpack_require__(186);
|
21549
|
+
var ReactTransitionChildMapping = __webpack_require__(181);
|
21518
21550
|
|
21519
21551
|
var emptyFunction = __webpack_require__(12);
|
21520
21552
|
|
@@ -21557,12 +21589,7 @@
|
|
21557
21589
|
|
21558
21590
|
delete _this.currentlyTransitioningKeys[key];
|
21559
21591
|
|
21560
|
-
var currentChildMapping;
|
21561
|
-
if (process.env.NODE_ENV !== 'production') {
|
21562
|
-
currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(_this)._debugID);
|
21563
|
-
} else {
|
21564
|
-
currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
|
21565
|
-
}
|
21592
|
+
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
|
21566
21593
|
|
21567
21594
|
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
|
21568
21595
|
// This was removed before it had fully appeared. Remove it.
|
@@ -21586,12 +21613,7 @@
|
|
21586
21613
|
|
21587
21614
|
delete _this.currentlyTransitioningKeys[key];
|
21588
21615
|
|
21589
|
-
var currentChildMapping;
|
21590
|
-
if (process.env.NODE_ENV !== 'production') {
|
21591
|
-
currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(_this)._debugID);
|
21592
|
-
} else {
|
21593
|
-
currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
|
21594
|
-
}
|
21616
|
+
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
|
21595
21617
|
|
21596
21618
|
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
|
21597
21619
|
// This was removed before it had fully entered. Remove it.
|
@@ -21618,12 +21640,7 @@
|
|
21618
21640
|
|
21619
21641
|
delete _this.currentlyTransitioningKeys[key];
|
21620
21642
|
|
21621
|
-
var currentChildMapping;
|
21622
|
-
if (process.env.NODE_ENV !== 'production') {
|
21623
|
-
currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(_this)._debugID);
|
21624
|
-
} else {
|
21625
|
-
currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
|
21626
|
-
}
|
21643
|
+
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
|
21627
21644
|
|
21628
21645
|
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
|
21629
21646
|
// This entered again before it fully left. Add it again.
|
@@ -21654,12 +21671,7 @@
|
|
21654
21671
|
};
|
21655
21672
|
|
21656
21673
|
ReactTransitionGroup.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
21657
|
-
var nextChildMapping;
|
21658
|
-
if (process.env.NODE_ENV !== 'production') {
|
21659
|
-
nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID);
|
21660
|
-
} else {
|
21661
|
-
nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
|
21662
|
-
}
|
21674
|
+
var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
|
21663
21675
|
var prevChildMapping = this.state.children;
|
21664
21676
|
|
21665
21677
|
this.setState({
|
@@ -21741,7 +21753,6 @@
|
|
21741
21753
|
|
21742
21754
|
|
21743
21755
|
module.exports = ReactTransitionGroup;
|
21744
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
21745
21756
|
|
21746
21757
|
/***/ },
|
21747
21758
|
/* 181 */
|
@@ -21759,29 +21770,96 @@
|
|
21759
21770
|
|
21760
21771
|
'use strict';
|
21761
21772
|
|
21762
|
-
var
|
21763
|
-
var ReactInstanceMap = __webpack_require__(116);
|
21773
|
+
var flattenChildren = __webpack_require__(182);
|
21764
21774
|
|
21765
|
-
|
21766
|
-
|
21767
|
-
|
21775
|
+
var ReactTransitionChildMapping = {
|
21776
|
+
/**
|
21777
|
+
* Given `this.props.children`, return an object mapping key to child. Just
|
21778
|
+
* simple syntactic sugar around flattenChildren().
|
21779
|
+
*
|
21780
|
+
* @param {*} children `this.props.children`
|
21781
|
+
* @param {number=} selfDebugID Optional debugID of the current internal instance.
|
21782
|
+
* @return {object} Mapping of key to child
|
21783
|
+
*/
|
21784
|
+
getChildMapping: function (children, selfDebugID) {
|
21785
|
+
if (!children) {
|
21786
|
+
return children;
|
21787
|
+
}
|
21768
21788
|
|
21769
|
-
|
21770
|
-
|
21771
|
-
|
21789
|
+
if (process.env.NODE_ENV !== 'production') {
|
21790
|
+
return flattenChildren(children, selfDebugID);
|
21791
|
+
}
|
21772
21792
|
|
21773
|
-
|
21774
|
-
|
21775
|
-
var ReactTestUtils = __webpack_require__(183);
|
21793
|
+
return flattenChildren(children);
|
21794
|
+
},
|
21776
21795
|
|
21777
|
-
|
21778
|
-
|
21779
|
-
|
21796
|
+
/**
|
21797
|
+
* When you're adding or removing children some may be added or removed in the
|
21798
|
+
* same render pass. We want to show *both* since we want to simultaneously
|
21799
|
+
* animate elements in and out. This function takes a previous set of keys
|
21800
|
+
* and a new set of keys and merges them with its best guess of the correct
|
21801
|
+
* ordering. In the future we may expose some of the utilities in
|
21802
|
+
* ReactMultiChild to make this easy, but for now React itself does not
|
21803
|
+
* directly have this concept of the union of prevChildren and nextChildren
|
21804
|
+
* so we implement it here.
|
21805
|
+
*
|
21806
|
+
* @param {object} prev prev children as returned from
|
21807
|
+
* `ReactTransitionChildMapping.getChildMapping()`.
|
21808
|
+
* @param {object} next next children as returned from
|
21809
|
+
* `ReactTransitionChildMapping.getChildMapping()`.
|
21810
|
+
* @return {object} a key set that contains all keys in `prev` and all keys
|
21811
|
+
* in `next` in a reasonable order.
|
21812
|
+
*/
|
21813
|
+
mergeChildMappings: function (prev, next) {
|
21814
|
+
prev = prev || {};
|
21815
|
+
next = next || {};
|
21780
21816
|
|
21781
|
-
|
21782
|
-
|
21783
|
-
|
21784
|
-
|
21817
|
+
function getValueForKey(key) {
|
21818
|
+
if (next.hasOwnProperty(key)) {
|
21819
|
+
return next[key];
|
21820
|
+
} else {
|
21821
|
+
return prev[key];
|
21822
|
+
}
|
21823
|
+
}
|
21824
|
+
|
21825
|
+
// For each key of `next`, the list of keys to insert before that key in
|
21826
|
+
// the combined list
|
21827
|
+
var nextKeysPending = {};
|
21828
|
+
|
21829
|
+
var pendingKeys = [];
|
21830
|
+
for (var prevKey in prev) {
|
21831
|
+
if (next.hasOwnProperty(prevKey)) {
|
21832
|
+
if (pendingKeys.length) {
|
21833
|
+
nextKeysPending[prevKey] = pendingKeys;
|
21834
|
+
pendingKeys = [];
|
21835
|
+
}
|
21836
|
+
} else {
|
21837
|
+
pendingKeys.push(prevKey);
|
21838
|
+
}
|
21839
|
+
}
|
21840
|
+
|
21841
|
+
var i;
|
21842
|
+
var childMapping = {};
|
21843
|
+
for (var nextKey in next) {
|
21844
|
+
if (nextKeysPending.hasOwnProperty(nextKey)) {
|
21845
|
+
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
|
21846
|
+
var pendingNextKey = nextKeysPending[nextKey][i];
|
21847
|
+
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
|
21848
|
+
}
|
21849
|
+
}
|
21850
|
+
childMapping[nextKey] = getValueForKey(nextKey);
|
21851
|
+
}
|
21852
|
+
|
21853
|
+
// Finally, add the keys which didn't appear before any key in `next`
|
21854
|
+
for (i = 0; i < pendingKeys.length; i++) {
|
21855
|
+
childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
|
21856
|
+
}
|
21857
|
+
|
21858
|
+
return childMapping;
|
21859
|
+
}
|
21860
|
+
};
|
21861
|
+
|
21862
|
+
module.exports = ReactTransitionChildMapping;
|
21785
21863
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
21786
21864
|
|
21787
21865
|
/***/ },
|
@@ -21789,7 +21867,7 @@
|
|
21789
21867
|
/***/ function(module, exports, __webpack_require__) {
|
21790
21868
|
|
21791
21869
|
/* WEBPACK VAR INJECTION */(function(process) {/**
|
21792
|
-
* Copyright
|
21870
|
+
* Copyright 2013-present, Facebook, Inc.
|
21793
21871
|
* All rights reserved.
|
21794
21872
|
*
|
21795
21873
|
* This source code is licensed under the BSD-style license found in the
|
@@ -21801,1010 +21879,906 @@
|
|
21801
21879
|
|
21802
21880
|
'use strict';
|
21803
21881
|
|
21804
|
-
var
|
21805
|
-
|
21806
|
-
var _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
21807
|
-
|
21808
|
-
var ReactDebugTool = __webpack_require__(63);
|
21882
|
+
var KeyEscapeUtils = __webpack_require__(17);
|
21883
|
+
var traverseAllChildren = __webpack_require__(15);
|
21809
21884
|
var warning = __webpack_require__(11);
|
21810
|
-
var alreadyWarned = false;
|
21811
21885
|
|
21812
|
-
|
21813
|
-
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
21814
|
-
|
21815
|
-
var n = Math.pow(10, base);
|
21816
|
-
return Math.floor(val * n) / n;
|
21817
|
-
}
|
21886
|
+
var ReactComponentTreeHook;
|
21818
21887
|
|
21819
|
-
|
21820
|
-
|
21821
|
-
|
21822
|
-
|
21888
|
+
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') {
|
21889
|
+
// Temporary hack.
|
21890
|
+
// Inline requires don't work well with Jest:
|
21891
|
+
// https://github.com/facebook/react/issues/7240
|
21892
|
+
// Remove the inline requires when we don't need them anymore:
|
21893
|
+
// https://github.com/facebook/react/pull/7178
|
21894
|
+
ReactComponentTreeHook = __webpack_require__(26);
|
21823
21895
|
}
|
21824
21896
|
|
21825
|
-
|
21826
|
-
|
21827
|
-
|
21828
|
-
|
21829
|
-
|
21830
|
-
|
21831
|
-
|
21897
|
+
/**
|
21898
|
+
* @param {function} traverseContext Context passed through traversal.
|
21899
|
+
* @param {?ReactComponent} child React child component.
|
21900
|
+
* @param {!string} name String name of key path to child.
|
21901
|
+
* @param {number=} selfDebugID Optional debugID of the current internal instance.
|
21902
|
+
*/
|
21903
|
+
function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) {
|
21904
|
+
// We found a component instance.
|
21905
|
+
if (traverseContext && typeof traverseContext === 'object') {
|
21906
|
+
var result = traverseContext;
|
21907
|
+
var keyUnique = result[name] === undefined;
|
21908
|
+
if (process.env.NODE_ENV !== 'production') {
|
21909
|
+
if (!ReactComponentTreeHook) {
|
21910
|
+
ReactComponentTreeHook = __webpack_require__(26);
|
21911
|
+
}
|
21912
|
+
if (!keyUnique) {
|
21913
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
|
21914
|
+
}
|
21915
|
+
}
|
21916
|
+
if (keyUnique && child != null) {
|
21917
|
+
result[name] = child;
|
21918
|
+
}
|
21832
21919
|
}
|
21833
21920
|
}
|
21834
21921
|
|
21835
|
-
|
21836
|
-
|
21837
|
-
|
21838
|
-
|
21922
|
+
/**
|
21923
|
+
* Flattens children that are typically specified as `props.children`. Any null
|
21924
|
+
* children will not be included in the resulting object.
|
21925
|
+
* @return {!object} flattened children keyed by name.
|
21926
|
+
*/
|
21927
|
+
function flattenChildren(children, selfDebugID) {
|
21928
|
+
if (children == null) {
|
21929
|
+
return children;
|
21839
21930
|
}
|
21931
|
+
var result = {};
|
21840
21932
|
|
21841
|
-
|
21933
|
+
if (process.env.NODE_ENV !== 'production') {
|
21934
|
+
traverseAllChildren(children, function (traverseContext, child, name) {
|
21935
|
+
return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID);
|
21936
|
+
}, result);
|
21937
|
+
} else {
|
21938
|
+
traverseAllChildren(children, flattenSingleChildIntoContext, result);
|
21939
|
+
}
|
21940
|
+
return result;
|
21842
21941
|
}
|
21843
21942
|
|
21844
|
-
|
21845
|
-
|
21943
|
+
module.exports = flattenChildren;
|
21944
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
21846
21945
|
|
21847
|
-
|
21848
|
-
|
21849
|
-
|
21850
|
-
}
|
21946
|
+
/***/ },
|
21947
|
+
/* 183 */
|
21948
|
+
/***/ function(module, exports, __webpack_require__) {
|
21851
21949
|
|
21852
|
-
|
21853
|
-
var affectedIDs = {};
|
21950
|
+
module.exports = __webpack_require__(184);
|
21854
21951
|
|
21855
|
-
|
21856
|
-
|
21952
|
+
/***/ },
|
21953
|
+
/* 184 */
|
21954
|
+
/***/ function(module, exports, __webpack_require__) {
|
21857
21955
|
|
21858
|
-
|
21859
|
-
|
21860
|
-
|
21861
|
-
|
21862
|
-
|
21863
|
-
|
21864
|
-
|
21865
|
-
|
21866
|
-
|
21867
|
-
totalDuration: 0
|
21868
|
-
};
|
21869
|
-
}
|
21870
|
-
if (!stats.durations[timerType]) {
|
21871
|
-
stats.durations[timerType] = 0;
|
21872
|
-
}
|
21873
|
-
if (!stats.counts[timerType]) {
|
21874
|
-
stats.counts[timerType] = 0;
|
21875
|
-
}
|
21876
|
-
affectedIDs[key][instanceID] = true;
|
21877
|
-
applyUpdate(stats);
|
21878
|
-
}
|
21956
|
+
/**
|
21957
|
+
* Copyright 2013-present, Facebook, Inc.
|
21958
|
+
* All rights reserved.
|
21959
|
+
*
|
21960
|
+
* This source code is licensed under the BSD-style license found in the
|
21961
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
21962
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
21963
|
+
*
|
21964
|
+
*/
|
21879
21965
|
|
21880
|
-
|
21881
|
-
var measurements = flush.measurements,
|
21882
|
-
treeSnapshot = flush.treeSnapshot;
|
21966
|
+
'use strict';
|
21883
21967
|
|
21884
|
-
|
21885
|
-
var duration = measurement.duration,
|
21886
|
-
instanceID = measurement.instanceID,
|
21887
|
-
timerType = measurement.timerType;
|
21968
|
+
var _assign = __webpack_require__(4);
|
21888
21969
|
|
21889
|
-
|
21890
|
-
stats.totalDuration += duration;
|
21891
|
-
stats.durations[timerType] += duration;
|
21892
|
-
stats.counts[timerType]++;
|
21893
|
-
});
|
21894
|
-
});
|
21895
|
-
});
|
21970
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
21896
21971
|
|
21897
|
-
|
21898
|
-
return _extends({}, aggregatedStats[key], {
|
21899
|
-
instanceCount: Object.keys(affectedIDs[key]).length
|
21900
|
-
});
|
21901
|
-
}).sort(function (a, b) {
|
21902
|
-
return b.totalDuration - a.totalDuration;
|
21903
|
-
});
|
21904
|
-
}
|
21972
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
21905
21973
|
|
21906
|
-
function
|
21907
|
-
var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements();
|
21974
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
21908
21975
|
|
21909
|
-
|
21910
|
-
warnInProduction();
|
21911
|
-
return [];
|
21912
|
-
}
|
21976
|
+
var React = __webpack_require__(2);
|
21913
21977
|
|
21914
|
-
|
21915
|
-
|
21978
|
+
var ReactTransitionGroup = __webpack_require__(180);
|
21979
|
+
var ReactCSSTransitionGroupChild = __webpack_require__(185);
|
21916
21980
|
|
21917
|
-
|
21918
|
-
|
21919
|
-
|
21920
|
-
ownerID = _treeSnapshot$instanc.ownerID;
|
21981
|
+
function createTransitionTimeoutPropValidator(transitionType) {
|
21982
|
+
var timeoutPropName = 'transition' + transitionType + 'Timeout';
|
21983
|
+
var enabledPropName = 'transition' + transitionType;
|
21921
21984
|
|
21922
|
-
|
21923
|
-
|
21924
|
-
|
21925
|
-
|
21926
|
-
|
21927
|
-
|
21928
|
-
|
21929
|
-
|
21930
|
-
|
21931
|
-
|
21932
|
-
}
|
21985
|
+
return function (props) {
|
21986
|
+
// If the transition is enabled
|
21987
|
+
if (props[enabledPropName]) {
|
21988
|
+
// If no timeout duration is provided
|
21989
|
+
if (props[timeoutPropName] == null) {
|
21990
|
+
return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
|
21991
|
+
|
21992
|
+
// If the duration isn't a number
|
21993
|
+
} else if (typeof props[timeoutPropName] !== 'number') {
|
21994
|
+
return new Error(timeoutPropName + ' must be a number (in milliseconds)');
|
21995
|
+
}
|
21933
21996
|
}
|
21934
|
-
|
21935
|
-
|
21936
|
-
}
|
21997
|
+
};
|
21998
|
+
}
|
21937
21999
|
|
21938
|
-
|
21939
|
-
|
21940
|
-
|
22000
|
+
/**
|
22001
|
+
* An easy way to perform CSS transitions and animations when a React component
|
22002
|
+
* enters or leaves the DOM.
|
22003
|
+
* See https://facebook.github.io/react/docs/animation.html#high-level-api-reactcsstransitiongroup
|
22004
|
+
*/
|
21941
22005
|
|
21942
|
-
|
21943
|
-
|
21944
|
-
timerType = measurement.timerType;
|
22006
|
+
var ReactCSSTransitionGroup = function (_React$Component) {
|
22007
|
+
_inherits(ReactCSSTransitionGroup, _React$Component);
|
21945
22008
|
|
21946
|
-
|
21947
|
-
|
21948
|
-
}
|
21949
|
-
isCompositeByID[instanceID] = true;
|
21950
|
-
});
|
21951
|
-
});
|
22009
|
+
function ReactCSSTransitionGroup() {
|
22010
|
+
var _temp, _this, _ret;
|
21952
22011
|
|
21953
|
-
|
21954
|
-
var measurements = flush.measurements,
|
21955
|
-
treeSnapshot = flush.treeSnapshot;
|
22012
|
+
_classCallCheck(this, ReactCSSTransitionGroup);
|
21956
22013
|
|
21957
|
-
|
21958
|
-
|
21959
|
-
|
21960
|
-
timerType = measurement.timerType;
|
22014
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
22015
|
+
args[_key] = arguments[_key];
|
22016
|
+
}
|
21961
22017
|
|
21962
|
-
|
21963
|
-
|
21964
|
-
|
21965
|
-
|
21966
|
-
|
21967
|
-
|
21968
|
-
|
21969
|
-
|
21970
|
-
|
21971
|
-
|
21972
|
-
|
21973
|
-
|
21974
|
-
|
21975
|
-
|
21976
|
-
|
21977
|
-
nextParentID = treeSnapshot[nextParentID].parentID;
|
21978
|
-
}
|
21979
|
-
});
|
21980
|
-
});
|
22018
|
+
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this._wrapChild = function (child) {
|
22019
|
+
// We need to provide this childFactory so that
|
22020
|
+
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
|
22021
|
+
// leave while it is leaving.
|
22022
|
+
return React.createElement(ReactCSSTransitionGroupChild, {
|
22023
|
+
name: _this.props.transitionName,
|
22024
|
+
appear: _this.props.transitionAppear,
|
22025
|
+
enter: _this.props.transitionEnter,
|
22026
|
+
leave: _this.props.transitionLeave,
|
22027
|
+
appearTimeout: _this.props.transitionAppearTimeout,
|
22028
|
+
enterTimeout: _this.props.transitionEnterTimeout,
|
22029
|
+
leaveTimeout: _this.props.transitionLeaveTimeout
|
22030
|
+
}, child);
|
22031
|
+
}, _temp), _possibleConstructorReturn(_this, _ret);
|
22032
|
+
}
|
21981
22033
|
|
21982
|
-
|
21983
|
-
return
|
21984
|
-
|
21985
|
-
});
|
21986
|
-
}).sort(function (a, b) {
|
21987
|
-
return b.inclusiveRenderDuration - a.inclusiveRenderDuration;
|
21988
|
-
});
|
21989
|
-
}
|
22034
|
+
ReactCSSTransitionGroup.prototype.render = function render() {
|
22035
|
+
return React.createElement(ReactTransitionGroup, _assign({}, this.props, { childFactory: this._wrapChild }));
|
22036
|
+
};
|
21990
22037
|
|
21991
|
-
|
21992
|
-
|
22038
|
+
return ReactCSSTransitionGroup;
|
22039
|
+
}(React.Component);
|
21993
22040
|
|
21994
|
-
|
21995
|
-
|
21996
|
-
|
21997
|
-
}
|
22041
|
+
ReactCSSTransitionGroup.displayName = 'ReactCSSTransitionGroup';
|
22042
|
+
ReactCSSTransitionGroup.propTypes = {
|
22043
|
+
transitionName: ReactCSSTransitionGroupChild.propTypes.name,
|
21998
22044
|
|
21999
|
-
|
22000
|
-
|
22045
|
+
transitionAppear: React.PropTypes.bool,
|
22046
|
+
transitionEnter: React.PropTypes.bool,
|
22047
|
+
transitionLeave: React.PropTypes.bool,
|
22048
|
+
transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
|
22049
|
+
transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
|
22050
|
+
transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave')
|
22051
|
+
};
|
22052
|
+
ReactCSSTransitionGroup.defaultProps = {
|
22053
|
+
transitionAppear: false,
|
22054
|
+
transitionEnter: true,
|
22055
|
+
transitionLeave: true
|
22056
|
+
};
|
22001
22057
|
|
22002
|
-
function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) {
|
22003
|
-
var _treeSnapshot$instanc2 = treeSnapshot[instanceID],
|
22004
|
-
displayName = _treeSnapshot$instanc2.displayName,
|
22005
|
-
ownerID = _treeSnapshot$instanc2.ownerID;
|
22006
22058
|
|
22007
|
-
|
22008
|
-
var key = (owner ? owner.displayName + ' > ' : '') + displayName;
|
22009
|
-
var stats = aggregatedStats[key];
|
22010
|
-
if (!stats) {
|
22011
|
-
affectedIDs[key] = {};
|
22012
|
-
stats = aggregatedStats[key] = {
|
22013
|
-
key: key,
|
22014
|
-
instanceCount: 0,
|
22015
|
-
inclusiveRenderDuration: 0,
|
22016
|
-
renderCount: 0
|
22017
|
-
};
|
22018
|
-
}
|
22019
|
-
affectedIDs[key][instanceID] = true;
|
22020
|
-
applyUpdate(stats);
|
22021
|
-
}
|
22059
|
+
module.exports = ReactCSSTransitionGroup;
|
22022
22060
|
|
22023
|
-
|
22024
|
-
|
22025
|
-
|
22026
|
-
operations = flush.operations;
|
22061
|
+
/***/ },
|
22062
|
+
/* 185 */
|
22063
|
+
/***/ function(module, exports, __webpack_require__) {
|
22027
22064
|
|
22028
|
-
|
22065
|
+
/**
|
22066
|
+
* Copyright 2013-present, Facebook, Inc.
|
22067
|
+
* All rights reserved.
|
22068
|
+
*
|
22069
|
+
* This source code is licensed under the BSD-style license found in the
|
22070
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
22071
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
22072
|
+
*
|
22073
|
+
*/
|
22029
22074
|
|
22030
|
-
|
22031
|
-
// Mark all components in their parent tree as definitely not wasted.
|
22032
|
-
operations.forEach(function (operation) {
|
22033
|
-
var instanceID = operation.instanceID;
|
22075
|
+
'use strict';
|
22034
22076
|
|
22035
|
-
|
22036
|
-
|
22037
|
-
isDefinitelyNotWastedByID[nextParentID] = true;
|
22038
|
-
nextParentID = treeSnapshot[nextParentID].parentID;
|
22039
|
-
}
|
22040
|
-
});
|
22077
|
+
var React = __webpack_require__(2);
|
22078
|
+
var ReactAddonsDOMDependencies = __webpack_require__(186);
|
22041
22079
|
|
22042
|
-
|
22043
|
-
|
22044
|
-
var renderedCompositeIDs = {};
|
22045
|
-
measurements.forEach(function (measurement) {
|
22046
|
-
var instanceID = measurement.instanceID,
|
22047
|
-
timerType = measurement.timerType;
|
22080
|
+
var CSSCore = __webpack_require__(191);
|
22081
|
+
var ReactTransitionEvents = __webpack_require__(192);
|
22048
22082
|
|
22049
|
-
|
22050
|
-
return;
|
22051
|
-
}
|
22052
|
-
renderedCompositeIDs[instanceID] = true;
|
22053
|
-
});
|
22083
|
+
var onlyChild = __webpack_require__(31);
|
22054
22084
|
|
22055
|
-
|
22056
|
-
var duration = measurement.duration,
|
22057
|
-
instanceID = measurement.instanceID,
|
22058
|
-
timerType = measurement.timerType;
|
22085
|
+
var TICK = 17;
|
22059
22086
|
|
22060
|
-
|
22061
|
-
|
22087
|
+
var ReactCSSTransitionGroupChild = React.createClass({
|
22088
|
+
displayName: 'ReactCSSTransitionGroupChild',
|
22089
|
+
|
22090
|
+
propTypes: {
|
22091
|
+
name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
|
22092
|
+
enter: React.PropTypes.string,
|
22093
|
+
leave: React.PropTypes.string,
|
22094
|
+
active: React.PropTypes.string
|
22095
|
+
}), React.PropTypes.shape({
|
22096
|
+
enter: React.PropTypes.string,
|
22097
|
+
enterActive: React.PropTypes.string,
|
22098
|
+
leave: React.PropTypes.string,
|
22099
|
+
leaveActive: React.PropTypes.string,
|
22100
|
+
appear: React.PropTypes.string,
|
22101
|
+
appearActive: React.PropTypes.string
|
22102
|
+
})]).isRequired,
|
22103
|
+
|
22104
|
+
// Once we require timeouts to be specified, we can remove the
|
22105
|
+
// boolean flags (appear etc.) and just accept a number
|
22106
|
+
// or a bool for the timeout flags (appearTimeout etc.)
|
22107
|
+
appear: React.PropTypes.bool,
|
22108
|
+
enter: React.PropTypes.bool,
|
22109
|
+
leave: React.PropTypes.bool,
|
22110
|
+
appearTimeout: React.PropTypes.number,
|
22111
|
+
enterTimeout: React.PropTypes.number,
|
22112
|
+
leaveTimeout: React.PropTypes.number
|
22113
|
+
},
|
22114
|
+
|
22115
|
+
transition: function (animationType, finishCallback, userSpecifiedDelay) {
|
22116
|
+
var node = ReactAddonsDOMDependencies.getReactDOM().findDOMNode(this);
|
22117
|
+
|
22118
|
+
if (!node) {
|
22119
|
+
if (finishCallback) {
|
22120
|
+
finishCallback();
|
22062
22121
|
}
|
22122
|
+
return;
|
22123
|
+
}
|
22063
22124
|
|
22064
|
-
|
22065
|
-
|
22066
|
-
|
22125
|
+
var className = this.props.name[animationType] || this.props.name + '-' + animationType;
|
22126
|
+
var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
|
22127
|
+
var timeout = null;
|
22067
22128
|
|
22068
|
-
|
22129
|
+
var endListener = function (e) {
|
22130
|
+
if (e && e.target !== node) {
|
22069
22131
|
return;
|
22070
22132
|
}
|
22071
22133
|
|
22072
|
-
|
22073
|
-
updateAggregatedStats(treeSnapshot, instanceID, function (stats) {
|
22074
|
-
stats.renderCount++;
|
22075
|
-
});
|
22134
|
+
clearTimeout(timeout);
|
22076
22135
|
|
22077
|
-
|
22078
|
-
|
22079
|
-
// Any parents rendered during this batch are considered wasted
|
22080
|
-
// unless we previously marked them as dirty.
|
22081
|
-
var isWasted = renderedCompositeIDs[nextParentID] && !isDefinitelyNotWastedByID[nextParentID];
|
22082
|
-
if (isWasted) {
|
22083
|
-
updateAggregatedStats(treeSnapshot, nextParentID, function (stats) {
|
22084
|
-
stats.inclusiveRenderDuration += duration;
|
22085
|
-
});
|
22086
|
-
}
|
22087
|
-
nextParentID = treeSnapshot[nextParentID].parentID;
|
22088
|
-
}
|
22089
|
-
});
|
22090
|
-
});
|
22136
|
+
CSSCore.removeClass(node, className);
|
22137
|
+
CSSCore.removeClass(node, activeClassName);
|
22091
22138
|
|
22092
|
-
|
22093
|
-
return _extends({}, aggregatedStats[key], {
|
22094
|
-
instanceCount: Object.keys(affectedIDs[key]).length
|
22095
|
-
});
|
22096
|
-
}).sort(function (a, b) {
|
22097
|
-
return b.inclusiveRenderDuration - a.inclusiveRenderDuration;
|
22098
|
-
});
|
22099
|
-
}
|
22139
|
+
ReactTransitionEvents.removeEndEventListener(node, endListener);
|
22100
22140
|
|
22101
|
-
|
22102
|
-
|
22141
|
+
// Usually this optional callback is used for informing an owner of
|
22142
|
+
// a leave animation and telling it to remove the child.
|
22143
|
+
if (finishCallback) {
|
22144
|
+
finishCallback();
|
22145
|
+
}
|
22146
|
+
};
|
22103
22147
|
|
22104
|
-
|
22105
|
-
warnInProduction();
|
22106
|
-
return [];
|
22107
|
-
}
|
22148
|
+
CSSCore.addClass(node, className);
|
22108
22149
|
|
22109
|
-
|
22110
|
-
|
22111
|
-
var operations = flush.operations,
|
22112
|
-
treeSnapshot = flush.treeSnapshot;
|
22150
|
+
// Need to do this to actually trigger a transition.
|
22151
|
+
this.queueClassAndNode(activeClassName, node);
|
22113
22152
|
|
22114
|
-
|
22115
|
-
|
22116
|
-
|
22117
|
-
|
22118
|
-
|
22119
|
-
|
22120
|
-
|
22153
|
+
// If the user specified a timeout delay.
|
22154
|
+
if (userSpecifiedDelay) {
|
22155
|
+
// Clean-up the animation after the specified delay
|
22156
|
+
timeout = setTimeout(endListener, userSpecifiedDelay);
|
22157
|
+
this.transitionTimeouts.push(timeout);
|
22158
|
+
} else {
|
22159
|
+
// DEPRECATED: this listener will be removed in a future version of react
|
22160
|
+
ReactTransitionEvents.addEndEventListener(node, endListener);
|
22161
|
+
}
|
22162
|
+
},
|
22121
22163
|
|
22122
|
-
|
22123
|
-
|
22164
|
+
queueClassAndNode: function (className, node) {
|
22165
|
+
this.classNameAndNodeQueue.push({
|
22166
|
+
className: className,
|
22167
|
+
node: node
|
22168
|
+
});
|
22124
22169
|
|
22125
|
-
|
22126
|
-
|
22127
|
-
|
22128
|
-
|
22129
|
-
|
22130
|
-
|
22131
|
-
|
22170
|
+
if (!this.timeout) {
|
22171
|
+
this.timeout = setTimeout(this.flushClassNameAndNodeQueue, TICK);
|
22172
|
+
}
|
22173
|
+
},
|
22174
|
+
|
22175
|
+
flushClassNameAndNodeQueue: function () {
|
22176
|
+
if (this.isMounted()) {
|
22177
|
+
this.classNameAndNodeQueue.forEach(function (obj) {
|
22178
|
+
CSSCore.addClass(obj.node, obj.className);
|
22132
22179
|
});
|
22133
|
-
}
|
22134
|
-
|
22135
|
-
|
22136
|
-
|
22180
|
+
}
|
22181
|
+
this.classNameAndNodeQueue.length = 0;
|
22182
|
+
this.timeout = null;
|
22183
|
+
},
|
22137
22184
|
|
22138
|
-
|
22139
|
-
|
22140
|
-
|
22141
|
-
|
22142
|
-
}
|
22185
|
+
componentWillMount: function () {
|
22186
|
+
this.classNameAndNodeQueue = [];
|
22187
|
+
this.transitionTimeouts = [];
|
22188
|
+
},
|
22143
22189
|
|
22144
|
-
|
22145
|
-
|
22146
|
-
|
22147
|
-
|
22148
|
-
|
22190
|
+
componentWillUnmount: function () {
|
22191
|
+
if (this.timeout) {
|
22192
|
+
clearTimeout(this.timeout);
|
22193
|
+
}
|
22194
|
+
this.transitionTimeouts.forEach(function (timeout) {
|
22195
|
+
clearTimeout(timeout);
|
22196
|
+
});
|
22149
22197
|
|
22150
|
-
|
22151
|
-
|
22152
|
-
return {
|
22153
|
-
'Component': key,
|
22154
|
-
'Total time (ms)': roundFloat(totalDuration),
|
22155
|
-
'Instance count': instanceCount,
|
22156
|
-
'Total render time (ms)': roundFloat(renderDuration),
|
22157
|
-
'Average render time (ms)': renderCount ? roundFloat(renderDuration / renderCount) : undefined,
|
22158
|
-
'Render count': renderCount,
|
22159
|
-
'Total lifecycle time (ms)': roundFloat(totalDuration - renderDuration)
|
22160
|
-
};
|
22161
|
-
});
|
22162
|
-
consoleTable(table);
|
22163
|
-
}
|
22198
|
+
this.classNameAndNodeQueue.length = 0;
|
22199
|
+
},
|
22164
22200
|
|
22165
|
-
|
22166
|
-
|
22167
|
-
|
22168
|
-
|
22169
|
-
|
22201
|
+
componentWillAppear: function (done) {
|
22202
|
+
if (this.props.appear) {
|
22203
|
+
this.transition('appear', done, this.props.appearTimeout);
|
22204
|
+
} else {
|
22205
|
+
done();
|
22206
|
+
}
|
22207
|
+
},
|
22170
22208
|
|
22171
|
-
|
22172
|
-
|
22173
|
-
|
22174
|
-
|
22175
|
-
|
22176
|
-
|
22209
|
+
componentWillEnter: function (done) {
|
22210
|
+
if (this.props.enter) {
|
22211
|
+
this.transition('enter', done, this.props.enterTimeout);
|
22212
|
+
} else {
|
22213
|
+
done();
|
22214
|
+
}
|
22215
|
+
},
|
22177
22216
|
|
22178
|
-
|
22179
|
-
|
22180
|
-
'
|
22181
|
-
|
22182
|
-
|
22183
|
-
}
|
22184
|
-
}
|
22185
|
-
consoleTable(table);
|
22186
|
-
}
|
22217
|
+
componentWillLeave: function (done) {
|
22218
|
+
if (this.props.leave) {
|
22219
|
+
this.transition('leave', done, this.props.leaveTimeout);
|
22220
|
+
} else {
|
22221
|
+
done();
|
22222
|
+
}
|
22223
|
+
},
|
22187
22224
|
|
22188
|
-
|
22189
|
-
|
22190
|
-
warnInProduction();
|
22191
|
-
return;
|
22225
|
+
render: function () {
|
22226
|
+
return onlyChild(this.props.children);
|
22192
22227
|
}
|
22228
|
+
});
|
22193
22229
|
|
22194
|
-
|
22195
|
-
var table = stats.map(function (item) {
|
22196
|
-
var key = item.key,
|
22197
|
-
instanceCount = item.instanceCount,
|
22198
|
-
inclusiveRenderDuration = item.inclusiveRenderDuration,
|
22199
|
-
renderCount = item.renderCount;
|
22230
|
+
module.exports = ReactCSSTransitionGroupChild;
|
22200
22231
|
|
22201
|
-
|
22202
|
-
|
22203
|
-
|
22204
|
-
'Instance count': instanceCount,
|
22205
|
-
'Render count': renderCount
|
22206
|
-
};
|
22207
|
-
});
|
22208
|
-
consoleTable(table);
|
22209
|
-
}
|
22210
|
-
|
22211
|
-
function printOperations(flushHistory) {
|
22212
|
-
if (!(process.env.NODE_ENV !== 'production')) {
|
22213
|
-
warnInProduction();
|
22214
|
-
return;
|
22215
|
-
}
|
22216
|
-
|
22217
|
-
var stats = getOperations(flushHistory);
|
22218
|
-
var table = stats.map(function (stat) {
|
22219
|
-
return {
|
22220
|
-
'Owner > Node': stat.key,
|
22221
|
-
'Operation': stat.type,
|
22222
|
-
'Payload': typeof stat.payload === 'object' ? JSON.stringify(stat.payload) : stat.payload,
|
22223
|
-
'Flush index': stat.flushIndex,
|
22224
|
-
'Owner Component ID': stat.ownerID,
|
22225
|
-
'DOM Component ID': stat.instanceID
|
22226
|
-
};
|
22227
|
-
});
|
22228
|
-
consoleTable(table);
|
22229
|
-
}
|
22230
|
-
|
22231
|
-
var warnedAboutPrintDOM = false;
|
22232
|
-
function printDOM(measurements) {
|
22233
|
-
process.env.NODE_ENV !== 'production' ? warning(warnedAboutPrintDOM, '`ReactPerf.printDOM(...)` is deprecated. Use ' + '`ReactPerf.printOperations(...)` instead.') : void 0;
|
22234
|
-
warnedAboutPrintDOM = true;
|
22235
|
-
return printOperations(measurements);
|
22236
|
-
}
|
22232
|
+
/***/ },
|
22233
|
+
/* 186 */
|
22234
|
+
/***/ function(module, exports, __webpack_require__) {
|
22237
22235
|
|
22238
|
-
|
22239
|
-
|
22240
|
-
|
22241
|
-
|
22242
|
-
|
22243
|
-
|
22236
|
+
/* WEBPACK VAR INJECTION */(function(process) {/**
|
22237
|
+
* Copyright 2013-present, Facebook, Inc.
|
22238
|
+
* All rights reserved.
|
22239
|
+
*
|
22240
|
+
* This source code is licensed under the BSD-style license found in the
|
22241
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
22242
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
22243
|
+
*
|
22244
|
+
*/
|
22244
22245
|
|
22245
|
-
|
22246
|
-
if (!(process.env.NODE_ENV !== 'production')) {
|
22247
|
-
warnInProduction();
|
22248
|
-
return;
|
22249
|
-
}
|
22246
|
+
'use strict';
|
22250
22247
|
|
22251
|
-
|
22252
|
-
}
|
22248
|
+
var ReactDOM = __webpack_require__(33);
|
22253
22249
|
|
22254
|
-
function
|
22255
|
-
|
22256
|
-
|
22257
|
-
return;
|
22258
|
-
}
|
22250
|
+
exports.getReactDOM = function () {
|
22251
|
+
return ReactDOM;
|
22252
|
+
};
|
22259
22253
|
|
22260
|
-
|
22261
|
-
|
22254
|
+
if (process.env.NODE_ENV !== 'production') {
|
22255
|
+
var ReactPerf;
|
22256
|
+
var ReactTestUtils;
|
22262
22257
|
|
22263
|
-
|
22264
|
-
|
22265
|
-
|
22266
|
-
|
22267
|
-
|
22258
|
+
exports.getReactPerf = function () {
|
22259
|
+
if (!ReactPerf) {
|
22260
|
+
ReactPerf = __webpack_require__(187);
|
22261
|
+
}
|
22262
|
+
return ReactPerf;
|
22263
|
+
};
|
22268
22264
|
|
22269
|
-
|
22265
|
+
exports.getReactTestUtils = function () {
|
22266
|
+
if (!ReactTestUtils) {
|
22267
|
+
ReactTestUtils = __webpack_require__(188);
|
22268
|
+
}
|
22269
|
+
return ReactTestUtils;
|
22270
|
+
};
|
22270
22271
|
}
|
22271
|
-
|
22272
|
-
var ReactPerfAnalysis = {
|
22273
|
-
getLastMeasurements: getLastMeasurements,
|
22274
|
-
getExclusive: getExclusive,
|
22275
|
-
getInclusive: getInclusive,
|
22276
|
-
getWasted: getWasted,
|
22277
|
-
getOperations: getOperations,
|
22278
|
-
printExclusive: printExclusive,
|
22279
|
-
printInclusive: printInclusive,
|
22280
|
-
printWasted: printWasted,
|
22281
|
-
printOperations: printOperations,
|
22282
|
-
start: start,
|
22283
|
-
stop: stop,
|
22284
|
-
isRunning: isRunning,
|
22285
|
-
// Deprecated:
|
22286
|
-
printDOM: printDOM,
|
22287
|
-
getMeasurementsSummaryMap: getMeasurementsSummaryMap
|
22288
|
-
};
|
22289
|
-
|
22290
|
-
module.exports = ReactPerfAnalysis;
|
22291
22272
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
22292
22273
|
|
22293
22274
|
/***/ },
|
22294
|
-
/*
|
22275
|
+
/* 187 */
|
22295
22276
|
/***/ function(module, exports, __webpack_require__) {
|
22296
22277
|
|
22297
22278
|
/* WEBPACK VAR INJECTION */(function(process) {/**
|
22298
|
-
* Copyright
|
22279
|
+
* Copyright 2016-present, Facebook, Inc.
|
22299
22280
|
* All rights reserved.
|
22300
22281
|
*
|
22301
22282
|
* This source code is licensed under the BSD-style license found in the
|
22302
22283
|
* LICENSE file in the root directory of this source tree. An additional grant
|
22303
22284
|
* of patent rights can be found in the PATENTS file in the same directory.
|
22304
22285
|
*
|
22286
|
+
*
|
22305
22287
|
*/
|
22306
22288
|
|
22307
22289
|
'use strict';
|
22308
22290
|
|
22309
|
-
var
|
22310
|
-
_assign = __webpack_require__(4);
|
22291
|
+
var _assign = __webpack_require__(4);
|
22311
22292
|
|
22312
|
-
var
|
22313
|
-
var EventPluginHub = __webpack_require__(42);
|
22314
|
-
var EventPluginRegistry = __webpack_require__(43);
|
22315
|
-
var EventPropagators = __webpack_require__(41);
|
22316
|
-
var React = __webpack_require__(2);
|
22317
|
-
var ReactDOM = __webpack_require__(33);
|
22318
|
-
var ReactDOMComponentTree = __webpack_require__(34);
|
22319
|
-
var ReactBrowserEventEmitter = __webpack_require__(105);
|
22320
|
-
var ReactInstanceMap = __webpack_require__(116);
|
22321
|
-
var ReactUpdates = __webpack_require__(56);
|
22322
|
-
var SyntheticEvent = __webpack_require__(53);
|
22323
|
-
var ReactShallowRenderer = __webpack_require__(185);
|
22293
|
+
var _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
22324
22294
|
|
22325
|
-
var
|
22326
|
-
var
|
22295
|
+
var ReactDebugTool = __webpack_require__(63);
|
22296
|
+
var warning = __webpack_require__(11);
|
22297
|
+
var alreadyWarned = false;
|
22327
22298
|
|
22328
|
-
|
22299
|
+
function roundFloat(val) {
|
22300
|
+
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
22329
22301
|
|
22330
|
-
|
22302
|
+
var n = Math.pow(10, base);
|
22303
|
+
return Math.floor(val * n) / n;
|
22304
|
+
}
|
22331
22305
|
|
22332
|
-
|
22333
|
-
|
22334
|
-
|
22306
|
+
// Flow type definition of console.table is too strict right now, see
|
22307
|
+
// https://github.com/facebook/flow/pull/2353 for updates
|
22308
|
+
function consoleTable(table) {
|
22309
|
+
console.table(table);
|
22310
|
+
}
|
22335
22311
|
|
22336
|
-
function
|
22337
|
-
if (
|
22338
|
-
return
|
22312
|
+
function warnInProduction() {
|
22313
|
+
if (alreadyWarned) {
|
22314
|
+
return;
|
22339
22315
|
}
|
22340
|
-
|
22341
|
-
|
22342
|
-
|
22343
|
-
if (ReactTestUtils.isDOMComponent(publicInst)) {
|
22344
|
-
var renderedChildren = inst._renderedChildren;
|
22345
|
-
var key;
|
22346
|
-
for (key in renderedChildren) {
|
22347
|
-
if (!renderedChildren.hasOwnProperty(key)) {
|
22348
|
-
continue;
|
22349
|
-
}
|
22350
|
-
ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
|
22351
|
-
}
|
22352
|
-
} else if (React.isValidElement(currentElement) && typeof currentElement.type === 'function') {
|
22353
|
-
ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
|
22316
|
+
alreadyWarned = true;
|
22317
|
+
if (typeof console !== 'undefined') {
|
22318
|
+
console.error('ReactPerf is not supported in the production builds of React. ' + 'To collect measurements, please use the development build of React instead.');
|
22354
22319
|
}
|
22355
|
-
return ret;
|
22356
22320
|
}
|
22357
22321
|
|
22358
|
-
|
22359
|
-
|
22360
|
-
|
22361
|
-
|
22362
|
-
|
22363
|
-
* Todo: Support the entire DOM.scry query syntax. For now, these simple
|
22364
|
-
* utilities will suffice for testing purposes.
|
22365
|
-
* @lends ReactTestUtils
|
22366
|
-
*/
|
22367
|
-
var ReactTestUtils = {
|
22368
|
-
renderIntoDocument: function (element) {
|
22369
|
-
var div = document.createElement('div');
|
22370
|
-
// None of our tests actually require attaching the container to the
|
22371
|
-
// DOM, and doing so creates a mess that we rely on test isolation to
|
22372
|
-
// clean up, so we're going to stop honoring the name of this method
|
22373
|
-
// (and probably rename it eventually) if no problems arise.
|
22374
|
-
// document.documentElement.appendChild(div);
|
22375
|
-
return ReactDOM.render(element, div);
|
22376
|
-
},
|
22322
|
+
function getLastMeasurements() {
|
22323
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22324
|
+
warnInProduction();
|
22325
|
+
return [];
|
22326
|
+
}
|
22377
22327
|
|
22378
|
-
|
22379
|
-
|
22380
|
-
},
|
22328
|
+
return ReactDebugTool.getFlushHistory();
|
22329
|
+
}
|
22381
22330
|
|
22382
|
-
|
22383
|
-
|
22384
|
-
},
|
22331
|
+
function getExclusive() {
|
22332
|
+
var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements();
|
22385
22333
|
|
22386
|
-
|
22387
|
-
|
22388
|
-
|
22334
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22335
|
+
warnInProduction();
|
22336
|
+
return [];
|
22337
|
+
}
|
22389
22338
|
|
22390
|
-
|
22391
|
-
|
22392
|
-
},
|
22339
|
+
var aggregatedStats = {};
|
22340
|
+
var affectedIDs = {};
|
22393
22341
|
|
22394
|
-
|
22395
|
-
|
22396
|
-
// Accessing inst.setState warns; just return false as that'll be what
|
22397
|
-
// this returns when we have DOM nodes as refs directly
|
22398
|
-
return false;
|
22399
|
-
}
|
22400
|
-
return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
|
22401
|
-
},
|
22342
|
+
function updateAggregatedStats(treeSnapshot, instanceID, timerType, applyUpdate) {
|
22343
|
+
var displayName = treeSnapshot[instanceID].displayName;
|
22402
22344
|
|
22403
|
-
|
22404
|
-
|
22405
|
-
|
22345
|
+
var key = displayName;
|
22346
|
+
var stats = aggregatedStats[key];
|
22347
|
+
if (!stats) {
|
22348
|
+
affectedIDs[key] = {};
|
22349
|
+
stats = aggregatedStats[key] = {
|
22350
|
+
key: key,
|
22351
|
+
instanceCount: 0,
|
22352
|
+
counts: {},
|
22353
|
+
durations: {},
|
22354
|
+
totalDuration: 0
|
22355
|
+
};
|
22406
22356
|
}
|
22407
|
-
|
22408
|
-
|
22357
|
+
if (!stats.durations[timerType]) {
|
22358
|
+
stats.durations[timerType] = 0;
|
22359
|
+
}
|
22360
|
+
if (!stats.counts[timerType]) {
|
22361
|
+
stats.counts[timerType] = 0;
|
22362
|
+
}
|
22363
|
+
affectedIDs[key][instanceID] = true;
|
22364
|
+
applyUpdate(stats);
|
22365
|
+
}
|
22409
22366
|
|
22410
|
-
|
22411
|
-
|
22367
|
+
flushHistory.forEach(function (flush) {
|
22368
|
+
var measurements = flush.measurements,
|
22369
|
+
treeSnapshot = flush.treeSnapshot;
|
22412
22370
|
|
22413
|
-
|
22414
|
-
|
22415
|
-
|
22416
|
-
|
22417
|
-
// We check the prototype of the type that will get mounted, not the
|
22418
|
-
// instance itself. This is a future proof way of duck typing.
|
22419
|
-
var prototype = inst.type.prototype;
|
22420
|
-
return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
|
22421
|
-
},
|
22371
|
+
measurements.forEach(function (measurement) {
|
22372
|
+
var duration = measurement.duration,
|
22373
|
+
instanceID = measurement.instanceID,
|
22374
|
+
timerType = measurement.timerType;
|
22422
22375
|
|
22423
|
-
|
22424
|
-
|
22425
|
-
|
22376
|
+
updateAggregatedStats(treeSnapshot, instanceID, timerType, function (stats) {
|
22377
|
+
stats.totalDuration += duration;
|
22378
|
+
stats.durations[timerType] += duration;
|
22379
|
+
stats.counts[timerType]++;
|
22380
|
+
});
|
22381
|
+
});
|
22382
|
+
});
|
22426
22383
|
|
22427
|
-
|
22428
|
-
|
22384
|
+
return Object.keys(aggregatedStats).map(function (key) {
|
22385
|
+
return _extends({}, aggregatedStats[key], {
|
22386
|
+
instanceCount: Object.keys(affectedIDs[key]).length
|
22387
|
+
});
|
22388
|
+
}).sort(function (a, b) {
|
22389
|
+
return b.totalDuration - a.totalDuration;
|
22390
|
+
});
|
22391
|
+
}
|
22429
22392
|
|
22430
|
-
|
22431
|
-
|
22432
|
-
return null;
|
22433
|
-
}
|
22434
|
-
var internalInstance = ReactInstanceMap.get(inst);
|
22435
|
-
return internalInstance._renderedComponent.getPublicInstance();
|
22436
|
-
},
|
22393
|
+
function getInclusive() {
|
22394
|
+
var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements();
|
22437
22395
|
|
22438
|
-
|
22439
|
-
|
22440
|
-
|
22396
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22397
|
+
warnInProduction();
|
22398
|
+
return [];
|
22399
|
+
}
|
22400
|
+
|
22401
|
+
var aggregatedStats = {};
|
22402
|
+
var affectedIDs = {};
|
22403
|
+
|
22404
|
+
function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) {
|
22405
|
+
var _treeSnapshot$instanc = treeSnapshot[instanceID],
|
22406
|
+
displayName = _treeSnapshot$instanc.displayName,
|
22407
|
+
ownerID = _treeSnapshot$instanc.ownerID;
|
22408
|
+
|
22409
|
+
var owner = treeSnapshot[ownerID];
|
22410
|
+
var key = (owner ? owner.displayName + ' > ' : '') + displayName;
|
22411
|
+
var stats = aggregatedStats[key];
|
22412
|
+
if (!stats) {
|
22413
|
+
affectedIDs[key] = {};
|
22414
|
+
stats = aggregatedStats[key] = {
|
22415
|
+
key: key,
|
22416
|
+
instanceCount: 0,
|
22417
|
+
inclusiveRenderDuration: 0,
|
22418
|
+
renderCount: 0
|
22419
|
+
};
|
22441
22420
|
}
|
22442
|
-
|
22443
|
-
|
22444
|
-
}
|
22421
|
+
affectedIDs[key][instanceID] = true;
|
22422
|
+
applyUpdate(stats);
|
22423
|
+
}
|
22445
22424
|
|
22446
|
-
|
22447
|
-
|
22448
|
-
|
22449
|
-
* @return {array} an array of all the matches.
|
22450
|
-
*/
|
22451
|
-
scryRenderedDOMComponentsWithClass: function (root, classNames) {
|
22452
|
-
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
|
22453
|
-
if (ReactTestUtils.isDOMComponent(inst)) {
|
22454
|
-
var className = inst.className;
|
22455
|
-
if (typeof className !== 'string') {
|
22456
|
-
// SVG, probably.
|
22457
|
-
className = inst.getAttribute('class') || '';
|
22458
|
-
}
|
22459
|
-
var classList = className.split(/\s+/);
|
22425
|
+
var isCompositeByID = {};
|
22426
|
+
flushHistory.forEach(function (flush) {
|
22427
|
+
var measurements = flush.measurements;
|
22460
22428
|
|
22461
|
-
|
22462
|
-
|
22463
|
-
|
22464
|
-
|
22465
|
-
|
22466
|
-
|
22467
|
-
});
|
22429
|
+
measurements.forEach(function (measurement) {
|
22430
|
+
var instanceID = measurement.instanceID,
|
22431
|
+
timerType = measurement.timerType;
|
22432
|
+
|
22433
|
+
if (timerType !== 'render') {
|
22434
|
+
return;
|
22468
22435
|
}
|
22469
|
-
|
22436
|
+
isCompositeByID[instanceID] = true;
|
22470
22437
|
});
|
22471
|
-
}
|
22438
|
+
});
|
22472
22439
|
|
22473
|
-
|
22474
|
-
|
22475
|
-
|
22476
|
-
* number of matches besides one.
|
22477
|
-
* @return {!ReactDOMComponent} The one match.
|
22478
|
-
*/
|
22479
|
-
findRenderedDOMComponentWithClass: function (root, className) {
|
22480
|
-
var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
|
22481
|
-
if (all.length !== 1) {
|
22482
|
-
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
|
22483
|
-
}
|
22484
|
-
return all[0];
|
22485
|
-
},
|
22440
|
+
flushHistory.forEach(function (flush) {
|
22441
|
+
var measurements = flush.measurements,
|
22442
|
+
treeSnapshot = flush.treeSnapshot;
|
22486
22443
|
|
22487
|
-
|
22488
|
-
|
22489
|
-
|
22490
|
-
|
22491
|
-
*/
|
22492
|
-
scryRenderedDOMComponentsWithTag: function (root, tagName) {
|
22493
|
-
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
|
22494
|
-
return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
|
22495
|
-
});
|
22496
|
-
},
|
22444
|
+
measurements.forEach(function (measurement) {
|
22445
|
+
var duration = measurement.duration,
|
22446
|
+
instanceID = measurement.instanceID,
|
22447
|
+
timerType = measurement.timerType;
|
22497
22448
|
|
22498
|
-
|
22499
|
-
|
22500
|
-
|
22501
|
-
|
22502
|
-
|
22503
|
-
|
22504
|
-
|
22505
|
-
|
22506
|
-
|
22507
|
-
|
22508
|
-
|
22509
|
-
|
22510
|
-
|
22449
|
+
if (timerType !== 'render') {
|
22450
|
+
return;
|
22451
|
+
}
|
22452
|
+
updateAggregatedStats(treeSnapshot, instanceID, function (stats) {
|
22453
|
+
stats.renderCount++;
|
22454
|
+
});
|
22455
|
+
var nextParentID = instanceID;
|
22456
|
+
while (nextParentID) {
|
22457
|
+
// As we traverse parents, only count inclusive time towards composites.
|
22458
|
+
// We know something is a composite if its render() was called.
|
22459
|
+
if (isCompositeByID[nextParentID]) {
|
22460
|
+
updateAggregatedStats(treeSnapshot, nextParentID, function (stats) {
|
22461
|
+
stats.inclusiveRenderDuration += duration;
|
22462
|
+
});
|
22463
|
+
}
|
22464
|
+
nextParentID = treeSnapshot[nextParentID].parentID;
|
22465
|
+
}
|
22466
|
+
});
|
22467
|
+
});
|
22511
22468
|
|
22512
|
-
|
22513
|
-
|
22514
|
-
|
22515
|
-
*/
|
22516
|
-
scryRenderedComponentsWithType: function (root, componentType) {
|
22517
|
-
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
|
22518
|
-
return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
|
22469
|
+
return Object.keys(aggregatedStats).map(function (key) {
|
22470
|
+
return _extends({}, aggregatedStats[key], {
|
22471
|
+
instanceCount: Object.keys(affectedIDs[key]).length
|
22519
22472
|
});
|
22520
|
-
},
|
22473
|
+
}).sort(function (a, b) {
|
22474
|
+
return b.inclusiveRenderDuration - a.inclusiveRenderDuration;
|
22475
|
+
});
|
22476
|
+
}
|
22521
22477
|
|
22522
|
-
|
22523
|
-
|
22524
|
-
|
22525
|
-
|
22526
|
-
|
22527
|
-
|
22528
|
-
|
22529
|
-
|
22530
|
-
|
22531
|
-
|
22478
|
+
function getWasted() {
|
22479
|
+
var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements();
|
22480
|
+
|
22481
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22482
|
+
warnInProduction();
|
22483
|
+
return [];
|
22484
|
+
}
|
22485
|
+
|
22486
|
+
var aggregatedStats = {};
|
22487
|
+
var affectedIDs = {};
|
22488
|
+
|
22489
|
+
function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) {
|
22490
|
+
var _treeSnapshot$instanc2 = treeSnapshot[instanceID],
|
22491
|
+
displayName = _treeSnapshot$instanc2.displayName,
|
22492
|
+
ownerID = _treeSnapshot$instanc2.ownerID;
|
22493
|
+
|
22494
|
+
var owner = treeSnapshot[ownerID];
|
22495
|
+
var key = (owner ? owner.displayName + ' > ' : '') + displayName;
|
22496
|
+
var stats = aggregatedStats[key];
|
22497
|
+
if (!stats) {
|
22498
|
+
affectedIDs[key] = {};
|
22499
|
+
stats = aggregatedStats[key] = {
|
22500
|
+
key: key,
|
22501
|
+
instanceCount: 0,
|
22502
|
+
inclusiveRenderDuration: 0,
|
22503
|
+
renderCount: 0
|
22504
|
+
};
|
22532
22505
|
}
|
22533
|
-
|
22534
|
-
|
22506
|
+
affectedIDs[key][instanceID] = true;
|
22507
|
+
applyUpdate(stats);
|
22508
|
+
}
|
22535
22509
|
|
22536
|
-
|
22537
|
-
|
22538
|
-
|
22539
|
-
|
22540
|
-
* <div> containing any provided children.
|
22541
|
-
*
|
22542
|
-
* @param {object} module the mock function object exported from a
|
22543
|
-
* module that defines the component to be mocked
|
22544
|
-
* @param {?string} mockTagName optional dummy root tag name to return
|
22545
|
-
* from render method (overrides
|
22546
|
-
* module.mockTagName if provided)
|
22547
|
-
* @return {object} the ReactTestUtils object (for chaining)
|
22548
|
-
*/
|
22549
|
-
mockComponent: function (module, mockTagName) {
|
22550
|
-
mockTagName = mockTagName || module.mockTagName || 'div';
|
22510
|
+
flushHistory.forEach(function (flush) {
|
22511
|
+
var measurements = flush.measurements,
|
22512
|
+
treeSnapshot = flush.treeSnapshot,
|
22513
|
+
operations = flush.operations;
|
22551
22514
|
|
22552
|
-
|
22553
|
-
|
22515
|
+
var isDefinitelyNotWastedByID = {};
|
22516
|
+
|
22517
|
+
// Find host components associated with an operation in this batch.
|
22518
|
+
// Mark all components in their parent tree as definitely not wasted.
|
22519
|
+
operations.forEach(function (operation) {
|
22520
|
+
var instanceID = operation.instanceID;
|
22521
|
+
|
22522
|
+
var nextParentID = instanceID;
|
22523
|
+
while (nextParentID) {
|
22524
|
+
isDefinitelyNotWastedByID[nextParentID] = true;
|
22525
|
+
nextParentID = treeSnapshot[nextParentID].parentID;
|
22526
|
+
}
|
22527
|
+
});
|
22528
|
+
|
22529
|
+
// Find composite components that rendered in this batch.
|
22530
|
+
// These are potential candidates for being wasted renders.
|
22531
|
+
var renderedCompositeIDs = {};
|
22532
|
+
measurements.forEach(function (measurement) {
|
22533
|
+
var instanceID = measurement.instanceID,
|
22534
|
+
timerType = measurement.timerType;
|
22535
|
+
|
22536
|
+
if (timerType !== 'render') {
|
22537
|
+
return;
|
22538
|
+
}
|
22539
|
+
renderedCompositeIDs[instanceID] = true;
|
22554
22540
|
});
|
22555
22541
|
|
22556
|
-
|
22557
|
-
|
22542
|
+
measurements.forEach(function (measurement) {
|
22543
|
+
var duration = measurement.duration,
|
22544
|
+
instanceID = measurement.instanceID,
|
22545
|
+
timerType = measurement.timerType;
|
22558
22546
|
|
22559
|
-
|
22560
|
-
|
22561
|
-
|
22562
|
-
* @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
|
22563
|
-
* @param {!Element} node The dom to simulate an event occurring on.
|
22564
|
-
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
|
22565
|
-
*/
|
22566
|
-
simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
|
22567
|
-
fakeNativeEvent.target = node;
|
22568
|
-
ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
|
22569
|
-
},
|
22547
|
+
if (timerType !== 'render') {
|
22548
|
+
return;
|
22549
|
+
}
|
22570
22550
|
|
22571
|
-
|
22572
|
-
|
22573
|
-
|
22574
|
-
* @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
|
22575
|
-
* @param {!ReactDOMComponent} comp
|
22576
|
-
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
|
22577
|
-
*/
|
22578
|
-
simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
|
22579
|
-
ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
|
22580
|
-
},
|
22551
|
+
// If there was a DOM update below this component, or it has just been
|
22552
|
+
// mounted, its render() is not considered wasted.
|
22553
|
+
var updateCount = treeSnapshot[instanceID].updateCount;
|
22581
22554
|
|
22582
|
-
|
22583
|
-
|
22584
|
-
|
22585
|
-
};
|
22586
|
-
},
|
22555
|
+
if (isDefinitelyNotWastedByID[instanceID] || updateCount === 0) {
|
22556
|
+
return;
|
22557
|
+
}
|
22587
22558
|
|
22588
|
-
|
22589
|
-
|
22590
|
-
|
22559
|
+
// We consider this render() wasted.
|
22560
|
+
updateAggregatedStats(treeSnapshot, instanceID, function (stats) {
|
22561
|
+
stats.renderCount++;
|
22562
|
+
});
|
22591
22563
|
|
22592
|
-
|
22593
|
-
|
22594
|
-
|
22564
|
+
var nextParentID = instanceID;
|
22565
|
+
while (nextParentID) {
|
22566
|
+
// Any parents rendered during this batch are considered wasted
|
22567
|
+
// unless we previously marked them as dirty.
|
22568
|
+
var isWasted = renderedCompositeIDs[nextParentID] && !isDefinitelyNotWastedByID[nextParentID];
|
22569
|
+
if (isWasted) {
|
22570
|
+
updateAggregatedStats(treeSnapshot, nextParentID, function (stats) {
|
22571
|
+
stats.inclusiveRenderDuration += duration;
|
22572
|
+
});
|
22573
|
+
}
|
22574
|
+
nextParentID = treeSnapshot[nextParentID].parentID;
|
22575
|
+
}
|
22576
|
+
});
|
22577
|
+
});
|
22595
22578
|
|
22596
|
-
|
22597
|
-
|
22598
|
-
|
22599
|
-
|
22600
|
-
|
22601
|
-
|
22602
|
-
|
22603
|
-
|
22604
|
-
function makeSimulator(eventType) {
|
22605
|
-
return function (domComponentOrNode, eventData) {
|
22606
|
-
var node;
|
22607
|
-
!!React.isValidElement(domComponentOrNode) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.Simulate expects a component instance and not a ReactElement.TestUtils.Simulate will not work if you are using shallow rendering.') : _prodInvariant('14') : void 0;
|
22608
|
-
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
|
22609
|
-
node = findDOMNode(domComponentOrNode);
|
22610
|
-
} else if (domComponentOrNode.tagName) {
|
22611
|
-
node = domComponentOrNode;
|
22612
|
-
}
|
22579
|
+
return Object.keys(aggregatedStats).map(function (key) {
|
22580
|
+
return _extends({}, aggregatedStats[key], {
|
22581
|
+
instanceCount: Object.keys(affectedIDs[key]).length
|
22582
|
+
});
|
22583
|
+
}).sort(function (a, b) {
|
22584
|
+
return b.inclusiveRenderDuration - a.inclusiveRenderDuration;
|
22585
|
+
});
|
22586
|
+
}
|
22613
22587
|
|
22614
|
-
|
22588
|
+
function getOperations() {
|
22589
|
+
var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements();
|
22615
22590
|
|
22616
|
-
|
22617
|
-
|
22618
|
-
|
22591
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22592
|
+
warnInProduction();
|
22593
|
+
return [];
|
22594
|
+
}
|
22619
22595
|
|
22620
|
-
|
22621
|
-
|
22622
|
-
var
|
22623
|
-
|
22624
|
-
// sure it's marked and won't warn when setting additional properties.
|
22625
|
-
event.persist();
|
22626
|
-
_assign(event, eventData);
|
22596
|
+
var stats = [];
|
22597
|
+
flushHistory.forEach(function (flush, flushIndex) {
|
22598
|
+
var operations = flush.operations,
|
22599
|
+
treeSnapshot = flush.treeSnapshot;
|
22627
22600
|
|
22628
|
-
|
22629
|
-
|
22630
|
-
|
22631
|
-
|
22632
|
-
|
22601
|
+
operations.forEach(function (operation) {
|
22602
|
+
var instanceID = operation.instanceID,
|
22603
|
+
type = operation.type,
|
22604
|
+
payload = operation.payload;
|
22605
|
+
var _treeSnapshot$instanc3 = treeSnapshot[instanceID],
|
22606
|
+
displayName = _treeSnapshot$instanc3.displayName,
|
22607
|
+
ownerID = _treeSnapshot$instanc3.ownerID;
|
22633
22608
|
|
22634
|
-
|
22635
|
-
|
22636
|
-
|
22609
|
+
var owner = treeSnapshot[ownerID];
|
22610
|
+
var key = (owner ? owner.displayName + ' > ' : '') + displayName;
|
22611
|
+
|
22612
|
+
stats.push({
|
22613
|
+
flushIndex: flushIndex,
|
22614
|
+
instanceID: instanceID,
|
22615
|
+
key: key,
|
22616
|
+
type: type,
|
22617
|
+
ownerID: ownerID,
|
22618
|
+
payload: payload
|
22619
|
+
});
|
22637
22620
|
});
|
22638
|
-
};
|
22621
|
+
});
|
22622
|
+
return stats;
|
22639
22623
|
}
|
22640
22624
|
|
22641
|
-
function
|
22642
|
-
|
22625
|
+
function printExclusive(flushHistory) {
|
22626
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22627
|
+
warnInProduction();
|
22628
|
+
return;
|
22629
|
+
}
|
22643
22630
|
|
22644
|
-
var
|
22645
|
-
|
22646
|
-
|
22647
|
-
|
22648
|
-
|
22649
|
-
|
22650
|
-
|
22631
|
+
var stats = getExclusive(flushHistory);
|
22632
|
+
var table = stats.map(function (item) {
|
22633
|
+
var key = item.key,
|
22634
|
+
instanceCount = item.instanceCount,
|
22635
|
+
totalDuration = item.totalDuration;
|
22636
|
+
|
22637
|
+
var renderCount = item.counts.render || 0;
|
22638
|
+
var renderDuration = item.durations.render || 0;
|
22639
|
+
return {
|
22640
|
+
'Component': key,
|
22641
|
+
'Total time (ms)': roundFloat(totalDuration),
|
22642
|
+
'Instance count': instanceCount,
|
22643
|
+
'Total render time (ms)': roundFloat(renderDuration),
|
22644
|
+
'Average render time (ms)': renderCount ? roundFloat(renderDuration / renderCount) : undefined,
|
22645
|
+
'Render count': renderCount,
|
22646
|
+
'Total lifecycle time (ms)': roundFloat(totalDuration - renderDuration)
|
22647
|
+
};
|
22648
|
+
});
|
22649
|
+
consoleTable(table);
|
22650
|
+
}
|
22651
|
+
|
22652
|
+
function printInclusive(flushHistory) {
|
22653
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22654
|
+
warnInProduction();
|
22655
|
+
return;
|
22651
22656
|
}
|
22657
|
+
|
22658
|
+
var stats = getInclusive(flushHistory);
|
22659
|
+
var table = stats.map(function (item) {
|
22660
|
+
var key = item.key,
|
22661
|
+
instanceCount = item.instanceCount,
|
22662
|
+
inclusiveRenderDuration = item.inclusiveRenderDuration,
|
22663
|
+
renderCount = item.renderCount;
|
22664
|
+
|
22665
|
+
return {
|
22666
|
+
'Owner > Component': key,
|
22667
|
+
'Inclusive render time (ms)': roundFloat(inclusiveRenderDuration),
|
22668
|
+
'Instance count': instanceCount,
|
22669
|
+
'Render count': renderCount
|
22670
|
+
};
|
22671
|
+
});
|
22672
|
+
consoleTable(table);
|
22652
22673
|
}
|
22653
22674
|
|
22654
|
-
|
22655
|
-
|
22656
|
-
|
22657
|
-
|
22658
|
-
|
22659
|
-
};
|
22660
|
-
var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
|
22661
|
-
EventPluginHub.injection.injectEventPluginsByName = function () {
|
22662
|
-
oldInjectEventPlugins.apply(this, arguments);
|
22663
|
-
buildSimulators();
|
22664
|
-
};
|
22675
|
+
function printWasted(flushHistory) {
|
22676
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22677
|
+
warnInProduction();
|
22678
|
+
return;
|
22679
|
+
}
|
22665
22680
|
|
22666
|
-
|
22681
|
+
var stats = getWasted(flushHistory);
|
22682
|
+
var table = stats.map(function (item) {
|
22683
|
+
var key = item.key,
|
22684
|
+
instanceCount = item.instanceCount,
|
22685
|
+
inclusiveRenderDuration = item.inclusiveRenderDuration,
|
22686
|
+
renderCount = item.renderCount;
|
22667
22687
|
|
22668
|
-
|
22669
|
-
|
22670
|
-
|
22671
|
-
|
22672
|
-
|
22673
|
-
|
22674
|
-
|
22675
|
-
|
22676
|
-
|
22677
|
-
|
22678
|
-
|
22679
|
-
|
22680
|
-
|
22681
|
-
|
22682
|
-
|
22688
|
+
return {
|
22689
|
+
'Owner > Component': key,
|
22690
|
+
'Inclusive wasted time (ms)': roundFloat(inclusiveRenderDuration),
|
22691
|
+
'Instance count': instanceCount,
|
22692
|
+
'Render count': renderCount
|
22693
|
+
};
|
22694
|
+
});
|
22695
|
+
consoleTable(table);
|
22696
|
+
}
|
22697
|
+
|
22698
|
+
function printOperations(flushHistory) {
|
22699
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22700
|
+
warnInProduction();
|
22701
|
+
return;
|
22702
|
+
}
|
22703
|
+
|
22704
|
+
var stats = getOperations(flushHistory);
|
22705
|
+
var table = stats.map(function (stat) {
|
22706
|
+
return {
|
22707
|
+
'Owner > Node': stat.key,
|
22708
|
+
'Operation': stat.type,
|
22709
|
+
'Payload': typeof stat.payload === 'object' ? JSON.stringify(stat.payload) : stat.payload,
|
22710
|
+
'Flush index': stat.flushIndex,
|
22711
|
+
'Owner Component ID': stat.ownerID,
|
22712
|
+
'DOM Component ID': stat.instanceID
|
22713
|
+
};
|
22714
|
+
});
|
22715
|
+
consoleTable(table);
|
22716
|
+
}
|
22683
22717
|
|
22684
|
-
|
22685
|
-
|
22686
|
-
|
22687
|
-
|
22688
|
-
|
22689
|
-
ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
|
22690
|
-
} else if (domComponentOrNode.tagName) {
|
22691
|
-
// Will allow on actual dom nodes.
|
22692
|
-
ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
|
22693
|
-
}
|
22694
|
-
};
|
22718
|
+
var warnedAboutPrintDOM = false;
|
22719
|
+
function printDOM(measurements) {
|
22720
|
+
process.env.NODE_ENV !== 'production' ? warning(warnedAboutPrintDOM, '`ReactPerf.printDOM(...)` is deprecated. Use ' + '`ReactPerf.printOperations(...)` instead.') : void 0;
|
22721
|
+
warnedAboutPrintDOM = true;
|
22722
|
+
return printOperations(measurements);
|
22695
22723
|
}
|
22696
22724
|
|
22697
|
-
|
22698
|
-
|
22699
|
-
|
22700
|
-
|
22701
|
-
|
22702
|
-
|
22703
|
-
*/
|
22704
|
-
ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
|
22705
|
-
});
|
22725
|
+
var warnedAboutGetMeasurementsSummaryMap = false;
|
22726
|
+
function getMeasurementsSummaryMap(measurements) {
|
22727
|
+
process.env.NODE_ENV !== 'production' ? warning(warnedAboutGetMeasurementsSummaryMap, '`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use ' + '`ReactPerf.getWasted(...)` instead.') : void 0;
|
22728
|
+
warnedAboutGetMeasurementsSummaryMap = true;
|
22729
|
+
return getWasted(measurements);
|
22730
|
+
}
|
22706
22731
|
|
22707
|
-
|
22708
|
-
|
22732
|
+
function start() {
|
22733
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22734
|
+
warnInProduction();
|
22735
|
+
return;
|
22736
|
+
}
|
22709
22737
|
|
22710
|
-
|
22711
|
-
|
22712
|
-
/***/ function(module, exports) {
|
22738
|
+
ReactDebugTool.beginProfiling();
|
22739
|
+
}
|
22713
22740
|
|
22714
|
-
|
22715
|
-
|
22716
|
-
|
22717
|
-
|
22718
|
-
|
22719
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
22720
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
22721
|
-
*
|
22722
|
-
*/
|
22741
|
+
function stop() {
|
22742
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22743
|
+
warnInProduction();
|
22744
|
+
return;
|
22745
|
+
}
|
22723
22746
|
|
22724
|
-
|
22747
|
+
ReactDebugTool.endProfiling();
|
22748
|
+
}
|
22725
22749
|
|
22726
|
-
|
22727
|
-
|
22728
|
-
|
22729
|
-
|
22730
|
-
|
22731
|
-
topAnimationEnd: null,
|
22732
|
-
topAnimationIteration: null,
|
22733
|
-
topAnimationStart: null,
|
22734
|
-
topBlur: null,
|
22735
|
-
topCanPlay: null,
|
22736
|
-
topCanPlayThrough: null,
|
22737
|
-
topChange: null,
|
22738
|
-
topClick: null,
|
22739
|
-
topCompositionEnd: null,
|
22740
|
-
topCompositionStart: null,
|
22741
|
-
topCompositionUpdate: null,
|
22742
|
-
topContextMenu: null,
|
22743
|
-
topCopy: null,
|
22744
|
-
topCut: null,
|
22745
|
-
topDoubleClick: null,
|
22746
|
-
topDrag: null,
|
22747
|
-
topDragEnd: null,
|
22748
|
-
topDragEnter: null,
|
22749
|
-
topDragExit: null,
|
22750
|
-
topDragLeave: null,
|
22751
|
-
topDragOver: null,
|
22752
|
-
topDragStart: null,
|
22753
|
-
topDrop: null,
|
22754
|
-
topDurationChange: null,
|
22755
|
-
topEmptied: null,
|
22756
|
-
topEncrypted: null,
|
22757
|
-
topEnded: null,
|
22758
|
-
topError: null,
|
22759
|
-
topFocus: null,
|
22760
|
-
topInput: null,
|
22761
|
-
topInvalid: null,
|
22762
|
-
topKeyDown: null,
|
22763
|
-
topKeyPress: null,
|
22764
|
-
topKeyUp: null,
|
22765
|
-
topLoad: null,
|
22766
|
-
topLoadedData: null,
|
22767
|
-
topLoadedMetadata: null,
|
22768
|
-
topLoadStart: null,
|
22769
|
-
topMouseDown: null,
|
22770
|
-
topMouseMove: null,
|
22771
|
-
topMouseOut: null,
|
22772
|
-
topMouseOver: null,
|
22773
|
-
topMouseUp: null,
|
22774
|
-
topPaste: null,
|
22775
|
-
topPause: null,
|
22776
|
-
topPlay: null,
|
22777
|
-
topPlaying: null,
|
22778
|
-
topProgress: null,
|
22779
|
-
topRateChange: null,
|
22780
|
-
topReset: null,
|
22781
|
-
topScroll: null,
|
22782
|
-
topSeeked: null,
|
22783
|
-
topSeeking: null,
|
22784
|
-
topSelectionChange: null,
|
22785
|
-
topStalled: null,
|
22786
|
-
topSubmit: null,
|
22787
|
-
topSuspend: null,
|
22788
|
-
topTextInput: null,
|
22789
|
-
topTimeUpdate: null,
|
22790
|
-
topTouchCancel: null,
|
22791
|
-
topTouchEnd: null,
|
22792
|
-
topTouchMove: null,
|
22793
|
-
topTouchStart: null,
|
22794
|
-
topTransitionEnd: null,
|
22795
|
-
topVolumeChange: null,
|
22796
|
-
topWaiting: null,
|
22797
|
-
topWheel: null
|
22798
|
-
};
|
22750
|
+
function isRunning() {
|
22751
|
+
if (!(process.env.NODE_ENV !== 'production')) {
|
22752
|
+
warnInProduction();
|
22753
|
+
return false;
|
22754
|
+
}
|
22799
22755
|
|
22800
|
-
|
22801
|
-
|
22756
|
+
return ReactDebugTool.isProfiling();
|
22757
|
+
}
|
22758
|
+
|
22759
|
+
var ReactPerfAnalysis = {
|
22760
|
+
getLastMeasurements: getLastMeasurements,
|
22761
|
+
getExclusive: getExclusive,
|
22762
|
+
getInclusive: getInclusive,
|
22763
|
+
getWasted: getWasted,
|
22764
|
+
getOperations: getOperations,
|
22765
|
+
printExclusive: printExclusive,
|
22766
|
+
printInclusive: printInclusive,
|
22767
|
+
printWasted: printWasted,
|
22768
|
+
printOperations: printOperations,
|
22769
|
+
start: start,
|
22770
|
+
stop: stop,
|
22771
|
+
isRunning: isRunning,
|
22772
|
+
// Deprecated:
|
22773
|
+
printDOM: printDOM,
|
22774
|
+
getMeasurementsSummaryMap: getMeasurementsSummaryMap
|
22802
22775
|
};
|
22803
22776
|
|
22804
|
-
module.exports =
|
22777
|
+
module.exports = ReactPerfAnalysis;
|
22778
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
22805
22779
|
|
22806
22780
|
/***/ },
|
22807
|
-
/*
|
22781
|
+
/* 188 */
|
22808
22782
|
/***/ function(module, exports, __webpack_require__) {
|
22809
22783
|
|
22810
22784
|
/* WEBPACK VAR INJECTION */(function(process) {/**
|
@@ -22822,436 +22796,505 @@
|
|
22822
22796
|
var _prodInvariant = __webpack_require__(35),
|
22823
22797
|
_assign = __webpack_require__(4);
|
22824
22798
|
|
22825
|
-
|
22826
|
-
|
22799
|
+
var EventConstants = __webpack_require__(189);
|
22800
|
+
var EventPluginHub = __webpack_require__(42);
|
22801
|
+
var EventPluginRegistry = __webpack_require__(43);
|
22802
|
+
var EventPropagators = __webpack_require__(41);
|
22827
22803
|
var React = __webpack_require__(2);
|
22828
|
-
var
|
22829
|
-
var
|
22830
|
-
var
|
22804
|
+
var ReactDOM = __webpack_require__(33);
|
22805
|
+
var ReactDOMComponentTree = __webpack_require__(34);
|
22806
|
+
var ReactBrowserEventEmitter = __webpack_require__(105);
|
22807
|
+
var ReactInstanceMap = __webpack_require__(116);
|
22831
22808
|
var ReactUpdates = __webpack_require__(56);
|
22809
|
+
var SyntheticEvent = __webpack_require__(53);
|
22810
|
+
var ReactShallowRenderer = __webpack_require__(190);
|
22832
22811
|
|
22833
|
-
var
|
22834
|
-
var getNextDebugID = __webpack_require__(127);
|
22812
|
+
var findDOMNode = __webpack_require__(172);
|
22835
22813
|
var invariant = __webpack_require__(8);
|
22836
22814
|
|
22837
|
-
var
|
22838
|
-
function NoopInternalComponent(element) {
|
22839
|
-
_classCallCheck(this, NoopInternalComponent);
|
22815
|
+
var topLevelTypes = EventConstants.topLevelTypes;
|
22840
22816
|
|
22841
|
-
|
22842
|
-
this._currentElement = element;
|
22817
|
+
function Event(suffix) {}
|
22843
22818
|
|
22844
|
-
|
22845
|
-
|
22819
|
+
/**
|
22820
|
+
* @class ReactTestUtils
|
22821
|
+
*/
|
22822
|
+
|
22823
|
+
function findAllInRenderedTreeInternal(inst, test) {
|
22824
|
+
if (!inst || !inst.getPublicInstance) {
|
22825
|
+
return [];
|
22826
|
+
}
|
22827
|
+
var publicInst = inst.getPublicInstance();
|
22828
|
+
var ret = test(publicInst) ? [publicInst] : [];
|
22829
|
+
var currentElement = inst._currentElement;
|
22830
|
+
if (ReactTestUtils.isDOMComponent(publicInst)) {
|
22831
|
+
var renderedChildren = inst._renderedChildren;
|
22832
|
+
var key;
|
22833
|
+
for (key in renderedChildren) {
|
22834
|
+
if (!renderedChildren.hasOwnProperty(key)) {
|
22835
|
+
continue;
|
22836
|
+
}
|
22837
|
+
ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
|
22846
22838
|
}
|
22839
|
+
} else if (React.isValidElement(currentElement) && typeof currentElement.type === 'function') {
|
22840
|
+
ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
|
22847
22841
|
}
|
22842
|
+
return ret;
|
22843
|
+
}
|
22848
22844
|
|
22849
|
-
|
22850
|
-
|
22851
|
-
|
22852
|
-
|
22853
|
-
|
22854
|
-
|
22855
|
-
|
22856
|
-
|
22857
|
-
|
22858
|
-
|
22859
|
-
|
22860
|
-
|
22861
|
-
|
22862
|
-
|
22863
|
-
|
22864
|
-
|
22865
|
-
|
22866
|
-
|
22867
|
-
|
22868
|
-
|
22869
|
-
var ShallowComponentWrapper = function (element) {
|
22870
|
-
// TODO: Consolidate with instantiateReactComponent
|
22871
|
-
if (process.env.NODE_ENV !== 'production') {
|
22872
|
-
this._debugID = getNextDebugID();
|
22873
|
-
}
|
22845
|
+
/**
|
22846
|
+
* Utilities for making it easy to test React components.
|
22847
|
+
*
|
22848
|
+
* See https://facebook.github.io/react/docs/test-utils.html
|
22849
|
+
*
|
22850
|
+
* Todo: Support the entire DOM.scry query syntax. For now, these simple
|
22851
|
+
* utilities will suffice for testing purposes.
|
22852
|
+
* @lends ReactTestUtils
|
22853
|
+
*/
|
22854
|
+
var ReactTestUtils = {
|
22855
|
+
renderIntoDocument: function (element) {
|
22856
|
+
var div = document.createElement('div');
|
22857
|
+
// None of our tests actually require attaching the container to the
|
22858
|
+
// DOM, and doing so creates a mess that we rely on test isolation to
|
22859
|
+
// clean up, so we're going to stop honoring the name of this method
|
22860
|
+
// (and probably rename it eventually) if no problems arise.
|
22861
|
+
// document.documentElement.appendChild(div);
|
22862
|
+
return ReactDOM.render(element, div);
|
22863
|
+
},
|
22874
22864
|
|
22875
|
-
|
22876
|
-
|
22877
|
-
_assign(ShallowComponentWrapper.prototype, ReactCompositeComponent, {
|
22878
|
-
_constructComponent: ReactCompositeComponent._constructComponentWithoutOwner,
|
22879
|
-
_instantiateReactComponent: function (element) {
|
22880
|
-
return new NoopInternalComponent(element);
|
22865
|
+
isElement: function (element) {
|
22866
|
+
return React.isValidElement(element);
|
22881
22867
|
},
|
22882
|
-
_replaceNodeWithMarkup: function () {},
|
22883
|
-
_renderValidatedComponent: ReactCompositeComponent._renderValidatedComponentWithoutOwnerOrContext
|
22884
|
-
});
|
22885
22868
|
|
22886
|
-
|
22887
|
-
|
22888
|
-
|
22889
|
-
ReactUpdates.ReactReconcileTransaction.release(transaction);
|
22890
|
-
}
|
22869
|
+
isElementOfType: function (inst, convenienceConstructor) {
|
22870
|
+
return React.isValidElement(inst) && inst.type === convenienceConstructor;
|
22871
|
+
},
|
22891
22872
|
|
22892
|
-
|
22893
|
-
|
22894
|
-
|
22873
|
+
isDOMComponent: function (inst) {
|
22874
|
+
return !!(inst && inst.nodeType === 1 && inst.tagName);
|
22875
|
+
},
|
22895
22876
|
|
22896
|
-
|
22897
|
-
|
22877
|
+
isDOMComponentElement: function (inst) {
|
22878
|
+
return !!(inst && React.isValidElement(inst) && !!inst.tagName);
|
22879
|
+
},
|
22898
22880
|
|
22899
|
-
|
22900
|
-
|
22901
|
-
|
22881
|
+
isCompositeComponent: function (inst) {
|
22882
|
+
if (ReactTestUtils.isDOMComponent(inst)) {
|
22883
|
+
// Accessing inst.setState warns; just return false as that'll be what
|
22884
|
+
// this returns when we have DOM nodes as refs directly
|
22885
|
+
return false;
|
22886
|
+
}
|
22887
|
+
return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
|
22888
|
+
},
|
22902
22889
|
|
22903
|
-
|
22904
|
-
|
22905
|
-
|
22906
|
-
|
22907
|
-
|
22890
|
+
isCompositeComponentWithType: function (inst, type) {
|
22891
|
+
if (!ReactTestUtils.isCompositeComponent(inst)) {
|
22892
|
+
return false;
|
22893
|
+
}
|
22894
|
+
var internalInstance = ReactInstanceMap.get(inst);
|
22895
|
+
var constructor = internalInstance._currentElement.type;
|
22908
22896
|
|
22909
|
-
|
22910
|
-
|
22897
|
+
return constructor === type;
|
22898
|
+
},
|
22911
22899
|
|
22912
|
-
|
22913
|
-
|
22900
|
+
isCompositeComponentElement: function (inst) {
|
22901
|
+
if (!React.isValidElement(inst)) {
|
22902
|
+
return false;
|
22914
22903
|
}
|
22915
|
-
|
22904
|
+
// We check the prototype of the type that will get mounted, not the
|
22905
|
+
// instance itself. This is a future proof way of duck typing.
|
22906
|
+
var prototype = inst.type.prototype;
|
22907
|
+
return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
|
22908
|
+
},
|
22916
22909
|
|
22917
|
-
|
22918
|
-
|
22910
|
+
isCompositeComponentElementWithType: function (inst, type) {
|
22911
|
+
var internalInstance = ReactInstanceMap.get(inst);
|
22912
|
+
var constructor = internalInstance._currentElement.type;
|
22919
22913
|
|
22920
|
-
|
22921
|
-
|
22922
|
-
};
|
22914
|
+
return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type);
|
22915
|
+
},
|
22923
22916
|
|
22924
|
-
|
22925
|
-
if (
|
22926
|
-
|
22917
|
+
getRenderedChildOfCompositeComponent: function (inst) {
|
22918
|
+
if (!ReactTestUtils.isCompositeComponent(inst)) {
|
22919
|
+
return null;
|
22927
22920
|
}
|
22928
|
-
|
22921
|
+
var internalInstance = ReactInstanceMap.get(inst);
|
22922
|
+
return internalInstance._renderedComponent.getPublicInstance();
|
22923
|
+
},
|
22929
22924
|
|
22930
|
-
|
22931
|
-
if (
|
22932
|
-
|
22933
|
-
} else {
|
22934
|
-
var instance = new ShallowComponentWrapper(element);
|
22935
|
-
ReactReconciler.mountComponent(instance, transaction, null, null, context, 0);
|
22936
|
-
this._instance = instance;
|
22925
|
+
findAllInRenderedTree: function (inst, test) {
|
22926
|
+
if (!inst) {
|
22927
|
+
return [];
|
22937
22928
|
}
|
22938
|
-
|
22939
|
-
|
22940
|
-
|
22941
|
-
}();
|
22942
|
-
|
22943
|
-
module.exports = ReactShallowRenderer;
|
22944
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
22929
|
+
!ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : _prodInvariant('10') : void 0;
|
22930
|
+
return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
|
22931
|
+
},
|
22945
22932
|
|
22946
|
-
|
22947
|
-
|
22948
|
-
|
22933
|
+
/**
|
22934
|
+
* Finds all instance of components in the rendered tree that are DOM
|
22935
|
+
* components with the class name matching `className`.
|
22936
|
+
* @return {array} an array of all the matches.
|
22937
|
+
*/
|
22938
|
+
scryRenderedDOMComponentsWithClass: function (root, classNames) {
|
22939
|
+
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
|
22940
|
+
if (ReactTestUtils.isDOMComponent(inst)) {
|
22941
|
+
var className = inst.className;
|
22942
|
+
if (typeof className !== 'string') {
|
22943
|
+
// SVG, probably.
|
22944
|
+
className = inst.getAttribute('class') || '';
|
22945
|
+
}
|
22946
|
+
var classList = className.split(/\s+/);
|
22949
22947
|
|
22950
|
-
|
22951
|
-
|
22952
|
-
|
22953
|
-
|
22954
|
-
|
22955
|
-
|
22956
|
-
|
22957
|
-
|
22958
|
-
|
22948
|
+
if (!Array.isArray(classNames)) {
|
22949
|
+
!(classNames !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument.') : _prodInvariant('11') : void 0;
|
22950
|
+
classNames = classNames.split(/\s+/);
|
22951
|
+
}
|
22952
|
+
return classNames.every(function (name) {
|
22953
|
+
return classList.indexOf(name) !== -1;
|
22954
|
+
});
|
22955
|
+
}
|
22956
|
+
return false;
|
22957
|
+
});
|
22958
|
+
},
|
22959
22959
|
|
22960
|
-
|
22960
|
+
/**
|
22961
|
+
* Like scryRenderedDOMComponentsWithClass but expects there to be one result,
|
22962
|
+
* and returns that one result, or throws exception if there is any other
|
22963
|
+
* number of matches besides one.
|
22964
|
+
* @return {!ReactDOMComponent} The one match.
|
22965
|
+
*/
|
22966
|
+
findRenderedDOMComponentWithClass: function (root, className) {
|
22967
|
+
var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
|
22968
|
+
if (all.length !== 1) {
|
22969
|
+
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
|
22970
|
+
}
|
22971
|
+
return all[0];
|
22972
|
+
},
|
22961
22973
|
|
22962
|
-
|
22974
|
+
/**
|
22975
|
+
* Finds all instance of components in the rendered tree that are DOM
|
22976
|
+
* components with the tag name matching `tagName`.
|
22977
|
+
* @return {array} an array of all the matches.
|
22978
|
+
*/
|
22979
|
+
scryRenderedDOMComponentsWithTag: function (root, tagName) {
|
22980
|
+
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
|
22981
|
+
return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
|
22982
|
+
});
|
22983
|
+
},
|
22963
22984
|
|
22964
|
-
var ReactTransitionChildMapping = {
|
22965
22985
|
/**
|
22966
|
-
*
|
22967
|
-
*
|
22968
|
-
*
|
22969
|
-
* @
|
22970
|
-
* @param {number=} selfDebugID Optional debugID of the current internal instance.
|
22971
|
-
* @return {object} Mapping of key to child
|
22986
|
+
* Like scryRenderedDOMComponentsWithTag but expects there to be one result,
|
22987
|
+
* and returns that one result, or throws exception if there is any other
|
22988
|
+
* number of matches besides one.
|
22989
|
+
* @return {!ReactDOMComponent} The one match.
|
22972
22990
|
*/
|
22973
|
-
|
22974
|
-
|
22975
|
-
|
22991
|
+
findRenderedDOMComponentWithTag: function (root, tagName) {
|
22992
|
+
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
|
22993
|
+
if (all.length !== 1) {
|
22994
|
+
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
|
22976
22995
|
}
|
22996
|
+
return all[0];
|
22997
|
+
},
|
22977
22998
|
|
22978
|
-
|
22979
|
-
|
22980
|
-
|
22999
|
+
/**
|
23000
|
+
* Finds all instances of components with type equal to `componentType`.
|
23001
|
+
* @return {array} an array of all the matches.
|
23002
|
+
*/
|
23003
|
+
scryRenderedComponentsWithType: function (root, componentType) {
|
23004
|
+
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
|
23005
|
+
return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
|
23006
|
+
});
|
23007
|
+
},
|
22981
23008
|
|
22982
|
-
|
23009
|
+
/**
|
23010
|
+
* Same as `scryRenderedComponentsWithType` but expects there to be one result
|
23011
|
+
* and returns that one result, or throws exception if there is any other
|
23012
|
+
* number of matches besides one.
|
23013
|
+
* @return {!ReactComponent} The one match.
|
23014
|
+
*/
|
23015
|
+
findRenderedComponentWithType: function (root, componentType) {
|
23016
|
+
var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
|
23017
|
+
if (all.length !== 1) {
|
23018
|
+
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
|
23019
|
+
}
|
23020
|
+
return all[0];
|
22983
23021
|
},
|
22984
23022
|
|
22985
23023
|
/**
|
22986
|
-
*
|
22987
|
-
*
|
22988
|
-
*
|
22989
|
-
*
|
22990
|
-
* ordering. In the future we may expose some of the utilities in
|
22991
|
-
* ReactMultiChild to make this easy, but for now React itself does not
|
22992
|
-
* directly have this concept of the union of prevChildren and nextChildren
|
22993
|
-
* so we implement it here.
|
23024
|
+
* Pass a mocked component module to this method to augment it with
|
23025
|
+
* useful methods that allow it to be used as a dummy React component.
|
23026
|
+
* Instead of rendering as usual, the component will become a simple
|
23027
|
+
* <div> containing any provided children.
|
22994
23028
|
*
|
22995
|
-
* @param {object}
|
22996
|
-
*
|
22997
|
-
* @param {
|
22998
|
-
*
|
22999
|
-
*
|
23000
|
-
*
|
23029
|
+
* @param {object} module the mock function object exported from a
|
23030
|
+
* module that defines the component to be mocked
|
23031
|
+
* @param {?string} mockTagName optional dummy root tag name to return
|
23032
|
+
* from render method (overrides
|
23033
|
+
* module.mockTagName if provided)
|
23034
|
+
* @return {object} the ReactTestUtils object (for chaining)
|
23001
23035
|
*/
|
23002
|
-
|
23003
|
-
|
23004
|
-
next = next || {};
|
23005
|
-
|
23006
|
-
function getValueForKey(key) {
|
23007
|
-
if (next.hasOwnProperty(key)) {
|
23008
|
-
return next[key];
|
23009
|
-
} else {
|
23010
|
-
return prev[key];
|
23011
|
-
}
|
23012
|
-
}
|
23036
|
+
mockComponent: function (module, mockTagName) {
|
23037
|
+
mockTagName = mockTagName || module.mockTagName || 'div';
|
23013
23038
|
|
23014
|
-
|
23015
|
-
|
23016
|
-
|
23039
|
+
module.prototype.render.mockImplementation(function () {
|
23040
|
+
return React.createElement(mockTagName, null, this.props.children);
|
23041
|
+
});
|
23017
23042
|
|
23018
|
-
|
23019
|
-
|
23020
|
-
if (next.hasOwnProperty(prevKey)) {
|
23021
|
-
if (pendingKeys.length) {
|
23022
|
-
nextKeysPending[prevKey] = pendingKeys;
|
23023
|
-
pendingKeys = [];
|
23024
|
-
}
|
23025
|
-
} else {
|
23026
|
-
pendingKeys.push(prevKey);
|
23027
|
-
}
|
23028
|
-
}
|
23043
|
+
return this;
|
23044
|
+
},
|
23029
23045
|
|
23030
|
-
|
23031
|
-
|
23032
|
-
|
23033
|
-
|
23034
|
-
|
23035
|
-
|
23036
|
-
|
23037
|
-
|
23038
|
-
|
23039
|
-
|
23040
|
-
|
23046
|
+
/**
|
23047
|
+
* Simulates a top level event being dispatched from a raw event that occurred
|
23048
|
+
* on an `Element` node.
|
23049
|
+
* @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
|
23050
|
+
* @param {!Element} node The dom to simulate an event occurring on.
|
23051
|
+
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
|
23052
|
+
*/
|
23053
|
+
simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
|
23054
|
+
fakeNativeEvent.target = node;
|
23055
|
+
ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
|
23056
|
+
},
|
23041
23057
|
|
23042
|
-
|
23043
|
-
|
23044
|
-
|
23045
|
-
|
23058
|
+
/**
|
23059
|
+
* Simulates a top level event being dispatched from a raw event that occurred
|
23060
|
+
* on the `ReactDOMComponent` `comp`.
|
23061
|
+
* @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
|
23062
|
+
* @param {!ReactDOMComponent} comp
|
23063
|
+
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
|
23064
|
+
*/
|
23065
|
+
simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
|
23066
|
+
ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
|
23067
|
+
},
|
23046
23068
|
|
23047
|
-
|
23048
|
-
|
23049
|
-
|
23069
|
+
nativeTouchData: function (x, y) {
|
23070
|
+
return {
|
23071
|
+
touches: [{ pageX: x, pageY: y }]
|
23072
|
+
};
|
23073
|
+
},
|
23050
23074
|
|
23051
|
-
|
23052
|
-
|
23075
|
+
createRenderer: function () {
|
23076
|
+
return new ReactShallowRenderer();
|
23077
|
+
},
|
23053
23078
|
|
23054
|
-
|
23055
|
-
|
23056
|
-
|
23079
|
+
Simulate: null,
|
23080
|
+
SimulateNative: {}
|
23081
|
+
};
|
23057
23082
|
|
23058
|
-
|
23059
|
-
*
|
23060
|
-
* All rights reserved.
|
23061
|
-
*
|
23062
|
-
* This source code is licensed under the BSD-style license found in the
|
23063
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
23064
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
23083
|
+
/**
|
23084
|
+
* Exports:
|
23065
23085
|
*
|
23066
|
-
*
|
23086
|
+
* - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
|
23087
|
+
* - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
|
23088
|
+
* - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`
|
23089
|
+
* - ... (All keys from event plugin `eventTypes` objects)
|
23067
23090
|
*/
|
23091
|
+
function makeSimulator(eventType) {
|
23092
|
+
return function (domComponentOrNode, eventData) {
|
23093
|
+
var node;
|
23094
|
+
!!React.isValidElement(domComponentOrNode) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.Simulate expects a component instance and not a ReactElement.TestUtils.Simulate will not work if you are using shallow rendering.') : _prodInvariant('14') : void 0;
|
23095
|
+
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
|
23096
|
+
node = findDOMNode(domComponentOrNode);
|
23097
|
+
} else if (domComponentOrNode.tagName) {
|
23098
|
+
node = domComponentOrNode;
|
23099
|
+
}
|
23068
23100
|
|
23069
|
-
|
23070
|
-
|
23071
|
-
var KeyEscapeUtils = __webpack_require__(17);
|
23072
|
-
var traverseAllChildren = __webpack_require__(15);
|
23073
|
-
var warning = __webpack_require__(11);
|
23101
|
+
var dispatchConfig = EventPluginRegistry.eventNameDispatchConfigs[eventType];
|
23074
23102
|
|
23075
|
-
|
23103
|
+
var fakeNativeEvent = new Event();
|
23104
|
+
fakeNativeEvent.target = node;
|
23105
|
+
fakeNativeEvent.type = eventType.toLowerCase();
|
23076
23106
|
|
23077
|
-
|
23078
|
-
|
23079
|
-
|
23080
|
-
|
23081
|
-
|
23082
|
-
|
23083
|
-
|
23084
|
-
}
|
23107
|
+
// We don't use SyntheticEvent.getPooled in order to not have to worry about
|
23108
|
+
// properly destroying any properties assigned from `eventData` upon release
|
23109
|
+
var event = new SyntheticEvent(dispatchConfig, ReactDOMComponentTree.getInstanceFromNode(node), fakeNativeEvent, node);
|
23110
|
+
// Since we aren't using pooling, always persist the event. This will make
|
23111
|
+
// sure it's marked and won't warn when setting additional properties.
|
23112
|
+
event.persist();
|
23113
|
+
_assign(event, eventData);
|
23085
23114
|
|
23086
|
-
|
23087
|
-
|
23088
|
-
|
23089
|
-
|
23090
|
-
* @param {number=} selfDebugID Optional debugID of the current internal instance.
|
23091
|
-
*/
|
23092
|
-
function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) {
|
23093
|
-
// We found a component instance.
|
23094
|
-
if (traverseContext && typeof traverseContext === 'object') {
|
23095
|
-
var result = traverseContext;
|
23096
|
-
var keyUnique = result[name] === undefined;
|
23097
|
-
if (process.env.NODE_ENV !== 'production') {
|
23098
|
-
if (!ReactComponentTreeHook) {
|
23099
|
-
ReactComponentTreeHook = __webpack_require__(26);
|
23100
|
-
}
|
23101
|
-
if (!keyUnique) {
|
23102
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
|
23103
|
-
}
|
23104
|
-
}
|
23105
|
-
if (keyUnique && child != null) {
|
23106
|
-
result[name] = child;
|
23115
|
+
if (dispatchConfig.phasedRegistrationNames) {
|
23116
|
+
EventPropagators.accumulateTwoPhaseDispatches(event);
|
23117
|
+
} else {
|
23118
|
+
EventPropagators.accumulateDirectDispatches(event);
|
23107
23119
|
}
|
23108
|
-
|
23120
|
+
|
23121
|
+
ReactUpdates.batchedUpdates(function () {
|
23122
|
+
EventPluginHub.enqueueEvents(event);
|
23123
|
+
EventPluginHub.processEventQueue(true);
|
23124
|
+
});
|
23125
|
+
};
|
23109
23126
|
}
|
23110
23127
|
|
23111
|
-
|
23112
|
-
|
23113
|
-
* children will not be included in the resulting object.
|
23114
|
-
* @return {!object} flattened children keyed by name.
|
23115
|
-
*/
|
23116
|
-
function flattenChildren(children, selfDebugID) {
|
23117
|
-
if (children == null) {
|
23118
|
-
return children;
|
23119
|
-
}
|
23120
|
-
var result = {};
|
23128
|
+
function buildSimulators() {
|
23129
|
+
ReactTestUtils.Simulate = {};
|
23121
23130
|
|
23122
|
-
|
23123
|
-
|
23124
|
-
|
23125
|
-
|
23126
|
-
|
23127
|
-
|
23131
|
+
var eventType;
|
23132
|
+
for (eventType in EventPluginRegistry.eventNameDispatchConfigs) {
|
23133
|
+
/**
|
23134
|
+
* @param {!Element|ReactDOMComponent} domComponentOrNode
|
23135
|
+
* @param {?object} eventData Fake event data to use in SyntheticEvent.
|
23136
|
+
*/
|
23137
|
+
ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
|
23128
23138
|
}
|
23129
|
-
return result;
|
23130
23139
|
}
|
23131
23140
|
|
23132
|
-
|
23133
|
-
|
23134
|
-
|
23135
|
-
|
23136
|
-
|
23137
|
-
|
23138
|
-
|
23139
|
-
|
23141
|
+
// Rebuild ReactTestUtils.Simulate whenever event plugins are injected
|
23142
|
+
var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
|
23143
|
+
EventPluginHub.injection.injectEventPluginOrder = function () {
|
23144
|
+
oldInjectEventPluginOrder.apply(this, arguments);
|
23145
|
+
buildSimulators();
|
23146
|
+
};
|
23147
|
+
var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
|
23148
|
+
EventPluginHub.injection.injectEventPluginsByName = function () {
|
23149
|
+
oldInjectEventPlugins.apply(this, arguments);
|
23150
|
+
buildSimulators();
|
23151
|
+
};
|
23140
23152
|
|
23141
|
-
|
23142
|
-
/* 189 */
|
23143
|
-
/***/ function(module, exports, __webpack_require__) {
|
23153
|
+
buildSimulators();
|
23144
23154
|
|
23145
23155
|
/**
|
23146
|
-
*
|
23147
|
-
* All rights reserved.
|
23156
|
+
* Exports:
|
23148
23157
|
*
|
23149
|
-
*
|
23150
|
-
*
|
23151
|
-
*
|
23158
|
+
* - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
|
23159
|
+
* - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
|
23160
|
+
* - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
|
23161
|
+
* - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
|
23162
|
+
* - ... (All keys from `EventConstants.topLevelTypes`)
|
23152
23163
|
*
|
23164
|
+
* Note: Top level event types are a subset of the entire set of handler types
|
23165
|
+
* (which include a broader set of "synthetic" events). For example, onDragDone
|
23166
|
+
* is a synthetic event. Except when testing an event plugin or React's event
|
23167
|
+
* handling code specifically, you probably want to use ReactTestUtils.Simulate
|
23168
|
+
* to dispatch synthetic events.
|
23153
23169
|
*/
|
23154
23170
|
|
23155
|
-
|
23156
|
-
|
23157
|
-
|
23158
|
-
|
23159
|
-
|
23160
|
-
|
23161
|
-
|
23162
|
-
|
23163
|
-
|
23164
|
-
|
23165
|
-
var React = __webpack_require__(2);
|
23166
|
-
|
23167
|
-
var ReactTransitionGroup = __webpack_require__(180);
|
23168
|
-
var ReactCSSTransitionGroupChild = __webpack_require__(190);
|
23169
|
-
|
23170
|
-
function createTransitionTimeoutPropValidator(transitionType) {
|
23171
|
-
var timeoutPropName = 'transition' + transitionType + 'Timeout';
|
23172
|
-
var enabledPropName = 'transition' + transitionType;
|
23173
|
-
|
23174
|
-
return function (props) {
|
23175
|
-
// If the transition is enabled
|
23176
|
-
if (props[enabledPropName]) {
|
23177
|
-
// If no timeout duration is provided
|
23178
|
-
if (props[timeoutPropName] == null) {
|
23179
|
-
return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
|
23180
|
-
|
23181
|
-
// If the duration isn't a number
|
23182
|
-
} else if (typeof props[timeoutPropName] !== 'number') {
|
23183
|
-
return new Error(timeoutPropName + ' must be a number (in milliseconds)');
|
23184
|
-
}
|
23171
|
+
function makeNativeSimulator(eventType) {
|
23172
|
+
return function (domComponentOrNode, nativeEventData) {
|
23173
|
+
var fakeNativeEvent = new Event(eventType);
|
23174
|
+
_assign(fakeNativeEvent, nativeEventData);
|
23175
|
+
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
|
23176
|
+
ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
|
23177
|
+
} else if (domComponentOrNode.tagName) {
|
23178
|
+
// Will allow on actual dom nodes.
|
23179
|
+
ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
|
23185
23180
|
}
|
23186
23181
|
};
|
23187
23182
|
}
|
23188
23183
|
|
23189
|
-
|
23190
|
-
|
23191
|
-
|
23192
|
-
|
23193
|
-
|
23194
|
-
|
23195
|
-
|
23196
|
-
|
23197
|
-
|
23198
|
-
function ReactCSSTransitionGroup() {
|
23199
|
-
var _temp, _this, _ret;
|
23200
|
-
|
23201
|
-
_classCallCheck(this, ReactCSSTransitionGroup);
|
23202
|
-
|
23203
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
23204
|
-
args[_key] = arguments[_key];
|
23205
|
-
}
|
23184
|
+
Object.keys(topLevelTypes).forEach(function (eventType) {
|
23185
|
+
// Event type is stored as 'topClick' - we transform that to 'click'
|
23186
|
+
var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
|
23187
|
+
/**
|
23188
|
+
* @param {!Element|ReactDOMComponent} domComponentOrNode
|
23189
|
+
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
|
23190
|
+
*/
|
23191
|
+
ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
|
23192
|
+
});
|
23206
23193
|
|
23207
|
-
|
23208
|
-
|
23209
|
-
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
|
23210
|
-
// leave while it is leaving.
|
23211
|
-
return React.createElement(ReactCSSTransitionGroupChild, {
|
23212
|
-
name: _this.props.transitionName,
|
23213
|
-
appear: _this.props.transitionAppear,
|
23214
|
-
enter: _this.props.transitionEnter,
|
23215
|
-
leave: _this.props.transitionLeave,
|
23216
|
-
appearTimeout: _this.props.transitionAppearTimeout,
|
23217
|
-
enterTimeout: _this.props.transitionEnterTimeout,
|
23218
|
-
leaveTimeout: _this.props.transitionLeaveTimeout
|
23219
|
-
}, child);
|
23220
|
-
}, _temp), _possibleConstructorReturn(_this, _ret);
|
23221
|
-
}
|
23194
|
+
module.exports = ReactTestUtils;
|
23195
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
23222
23196
|
|
23223
|
-
|
23224
|
-
|
23225
|
-
|
23197
|
+
/***/ },
|
23198
|
+
/* 189 */
|
23199
|
+
/***/ function(module, exports) {
|
23226
23200
|
|
23227
|
-
|
23228
|
-
|
23201
|
+
/**
|
23202
|
+
* Copyright 2013-present, Facebook, Inc.
|
23203
|
+
* All rights reserved.
|
23204
|
+
*
|
23205
|
+
* This source code is licensed under the BSD-style license found in the
|
23206
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
23207
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
23208
|
+
*
|
23209
|
+
*/
|
23229
23210
|
|
23230
|
-
|
23231
|
-
ReactCSSTransitionGroup.propTypes = {
|
23232
|
-
transitionName: ReactCSSTransitionGroupChild.propTypes.name,
|
23211
|
+
'use strict';
|
23233
23212
|
|
23234
|
-
|
23235
|
-
|
23236
|
-
|
23237
|
-
|
23238
|
-
|
23239
|
-
|
23240
|
-
|
23241
|
-
|
23242
|
-
|
23243
|
-
|
23244
|
-
|
23213
|
+
/**
|
23214
|
+
* Types of raw signals from the browser caught at the top level.
|
23215
|
+
*/
|
23216
|
+
var topLevelTypes = {
|
23217
|
+
topAbort: null,
|
23218
|
+
topAnimationEnd: null,
|
23219
|
+
topAnimationIteration: null,
|
23220
|
+
topAnimationStart: null,
|
23221
|
+
topBlur: null,
|
23222
|
+
topCanPlay: null,
|
23223
|
+
topCanPlayThrough: null,
|
23224
|
+
topChange: null,
|
23225
|
+
topClick: null,
|
23226
|
+
topCompositionEnd: null,
|
23227
|
+
topCompositionStart: null,
|
23228
|
+
topCompositionUpdate: null,
|
23229
|
+
topContextMenu: null,
|
23230
|
+
topCopy: null,
|
23231
|
+
topCut: null,
|
23232
|
+
topDoubleClick: null,
|
23233
|
+
topDrag: null,
|
23234
|
+
topDragEnd: null,
|
23235
|
+
topDragEnter: null,
|
23236
|
+
topDragExit: null,
|
23237
|
+
topDragLeave: null,
|
23238
|
+
topDragOver: null,
|
23239
|
+
topDragStart: null,
|
23240
|
+
topDrop: null,
|
23241
|
+
topDurationChange: null,
|
23242
|
+
topEmptied: null,
|
23243
|
+
topEncrypted: null,
|
23244
|
+
topEnded: null,
|
23245
|
+
topError: null,
|
23246
|
+
topFocus: null,
|
23247
|
+
topInput: null,
|
23248
|
+
topInvalid: null,
|
23249
|
+
topKeyDown: null,
|
23250
|
+
topKeyPress: null,
|
23251
|
+
topKeyUp: null,
|
23252
|
+
topLoad: null,
|
23253
|
+
topLoadedData: null,
|
23254
|
+
topLoadedMetadata: null,
|
23255
|
+
topLoadStart: null,
|
23256
|
+
topMouseDown: null,
|
23257
|
+
topMouseMove: null,
|
23258
|
+
topMouseOut: null,
|
23259
|
+
topMouseOver: null,
|
23260
|
+
topMouseUp: null,
|
23261
|
+
topPaste: null,
|
23262
|
+
topPause: null,
|
23263
|
+
topPlay: null,
|
23264
|
+
topPlaying: null,
|
23265
|
+
topProgress: null,
|
23266
|
+
topRateChange: null,
|
23267
|
+
topReset: null,
|
23268
|
+
topScroll: null,
|
23269
|
+
topSeeked: null,
|
23270
|
+
topSeeking: null,
|
23271
|
+
topSelectionChange: null,
|
23272
|
+
topStalled: null,
|
23273
|
+
topSubmit: null,
|
23274
|
+
topSuspend: null,
|
23275
|
+
topTextInput: null,
|
23276
|
+
topTimeUpdate: null,
|
23277
|
+
topTouchCancel: null,
|
23278
|
+
topTouchEnd: null,
|
23279
|
+
topTouchMove: null,
|
23280
|
+
topTouchStart: null,
|
23281
|
+
topTransitionEnd: null,
|
23282
|
+
topVolumeChange: null,
|
23283
|
+
topWaiting: null,
|
23284
|
+
topWheel: null
|
23245
23285
|
};
|
23246
23286
|
|
23287
|
+
var EventConstants = {
|
23288
|
+
topLevelTypes: topLevelTypes
|
23289
|
+
};
|
23247
23290
|
|
23248
|
-
module.exports =
|
23291
|
+
module.exports = EventConstants;
|
23249
23292
|
|
23250
23293
|
/***/ },
|
23251
23294
|
/* 190 */
|
23252
23295
|
/***/ function(module, exports, __webpack_require__) {
|
23253
23296
|
|
23254
|
-
/**
|
23297
|
+
/* WEBPACK VAR INJECTION */(function(process) {/**
|
23255
23298
|
* Copyright 2013-present, Facebook, Inc.
|
23256
23299
|
* All rights reserved.
|
23257
23300
|
*
|
@@ -23263,160 +23306,129 @@
|
|
23263
23306
|
|
23264
23307
|
'use strict';
|
23265
23308
|
|
23266
|
-
var
|
23267
|
-
|
23268
|
-
|
23269
|
-
var CSSCore = __webpack_require__(191);
|
23270
|
-
var ReactTransitionEvents = __webpack_require__(192);
|
23271
|
-
|
23272
|
-
var onlyChild = __webpack_require__(31);
|
23309
|
+
var _prodInvariant = __webpack_require__(35),
|
23310
|
+
_assign = __webpack_require__(4);
|
23273
23311
|
|
23274
|
-
|
23312
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
23275
23313
|
|
23276
|
-
var
|
23277
|
-
|
23314
|
+
var React = __webpack_require__(2);
|
23315
|
+
var ReactDefaultInjection = __webpack_require__(38);
|
23316
|
+
var ReactCompositeComponent = __webpack_require__(119);
|
23317
|
+
var ReactReconciler = __webpack_require__(59);
|
23318
|
+
var ReactUpdates = __webpack_require__(56);
|
23278
23319
|
|
23279
|
-
|
23280
|
-
|
23281
|
-
|
23282
|
-
leave: React.PropTypes.string,
|
23283
|
-
active: React.PropTypes.string
|
23284
|
-
}), React.PropTypes.shape({
|
23285
|
-
enter: React.PropTypes.string,
|
23286
|
-
enterActive: React.PropTypes.string,
|
23287
|
-
leave: React.PropTypes.string,
|
23288
|
-
leaveActive: React.PropTypes.string,
|
23289
|
-
appear: React.PropTypes.string,
|
23290
|
-
appearActive: React.PropTypes.string
|
23291
|
-
})]).isRequired,
|
23320
|
+
var emptyObject = __webpack_require__(20);
|
23321
|
+
var getNextDebugID = __webpack_require__(127);
|
23322
|
+
var invariant = __webpack_require__(8);
|
23292
23323
|
|
23293
|
-
|
23294
|
-
|
23295
|
-
|
23296
|
-
appear: React.PropTypes.bool,
|
23297
|
-
enter: React.PropTypes.bool,
|
23298
|
-
leave: React.PropTypes.bool,
|
23299
|
-
appearTimeout: React.PropTypes.number,
|
23300
|
-
enterTimeout: React.PropTypes.number,
|
23301
|
-
leaveTimeout: React.PropTypes.number
|
23302
|
-
},
|
23324
|
+
var NoopInternalComponent = function () {
|
23325
|
+
function NoopInternalComponent(element) {
|
23326
|
+
_classCallCheck(this, NoopInternalComponent);
|
23303
23327
|
|
23304
|
-
|
23305
|
-
|
23328
|
+
this._renderedOutput = element;
|
23329
|
+
this._currentElement = element;
|
23306
23330
|
|
23307
|
-
if (
|
23308
|
-
|
23309
|
-
finishCallback();
|
23310
|
-
}
|
23311
|
-
return;
|
23331
|
+
if (process.env.NODE_ENV !== 'production') {
|
23332
|
+
this._debugID = getNextDebugID();
|
23312
23333
|
}
|
23334
|
+
}
|
23313
23335
|
|
23314
|
-
|
23315
|
-
var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
|
23316
|
-
var timeout = null;
|
23336
|
+
NoopInternalComponent.prototype.mountComponent = function mountComponent() {};
|
23317
23337
|
|
23318
|
-
|
23319
|
-
|
23320
|
-
|
23321
|
-
|
23338
|
+
NoopInternalComponent.prototype.receiveComponent = function receiveComponent(element) {
|
23339
|
+
this._renderedOutput = element;
|
23340
|
+
this._currentElement = element;
|
23341
|
+
};
|
23322
23342
|
|
23323
|
-
|
23343
|
+
NoopInternalComponent.prototype.unmountComponent = function unmountComponent() {};
|
23324
23344
|
|
23325
|
-
|
23326
|
-
|
23345
|
+
NoopInternalComponent.prototype.getHostNode = function getHostNode() {
|
23346
|
+
return undefined;
|
23347
|
+
};
|
23327
23348
|
|
23328
|
-
|
23349
|
+
NoopInternalComponent.prototype.getPublicInstance = function getPublicInstance() {
|
23350
|
+
return null;
|
23351
|
+
};
|
23329
23352
|
|
23330
|
-
|
23331
|
-
|
23332
|
-
if (finishCallback) {
|
23333
|
-
finishCallback();
|
23334
|
-
}
|
23335
|
-
};
|
23353
|
+
return NoopInternalComponent;
|
23354
|
+
}();
|
23336
23355
|
|
23337
|
-
|
23356
|
+
var ShallowComponentWrapper = function (element) {
|
23357
|
+
// TODO: Consolidate with instantiateReactComponent
|
23358
|
+
if (process.env.NODE_ENV !== 'production') {
|
23359
|
+
this._debugID = getNextDebugID();
|
23360
|
+
}
|
23361
|
+
|
23362
|
+
this.construct(element);
|
23363
|
+
};
|
23364
|
+
_assign(ShallowComponentWrapper.prototype, ReactCompositeComponent, {
|
23365
|
+
_constructComponent: ReactCompositeComponent._constructComponentWithoutOwner,
|
23366
|
+
_instantiateReactComponent: function (element) {
|
23367
|
+
return new NoopInternalComponent(element);
|
23368
|
+
},
|
23369
|
+
_replaceNodeWithMarkup: function () {},
|
23370
|
+
_renderValidatedComponent: ReactCompositeComponent._renderValidatedComponentWithoutOwnerOrContext
|
23371
|
+
});
|
23338
23372
|
|
23339
|
-
|
23340
|
-
|
23373
|
+
function _batchedRender(renderer, element, context) {
|
23374
|
+
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(true);
|
23375
|
+
renderer._render(element, transaction, context);
|
23376
|
+
ReactUpdates.ReactReconcileTransaction.release(transaction);
|
23377
|
+
}
|
23341
23378
|
|
23342
|
-
|
23343
|
-
|
23344
|
-
|
23345
|
-
timeout = setTimeout(endListener, userSpecifiedDelay);
|
23346
|
-
this.transitionTimeouts.push(timeout);
|
23347
|
-
} else {
|
23348
|
-
// DEPRECATED: this listener will be removed in a future version of react
|
23349
|
-
ReactTransitionEvents.addEndEventListener(node, endListener);
|
23350
|
-
}
|
23351
|
-
},
|
23379
|
+
var ReactShallowRenderer = function () {
|
23380
|
+
function ReactShallowRenderer() {
|
23381
|
+
_classCallCheck(this, ReactShallowRenderer);
|
23352
23382
|
|
23353
|
-
|
23354
|
-
|
23355
|
-
className: className,
|
23356
|
-
node: node
|
23357
|
-
});
|
23383
|
+
this._instance = null;
|
23384
|
+
}
|
23358
23385
|
|
23359
|
-
|
23360
|
-
|
23361
|
-
|
23362
|
-
},
|
23386
|
+
ReactShallowRenderer.prototype.getMountedInstance = function getMountedInstance() {
|
23387
|
+
return this._instance ? this._instance._instance : null;
|
23388
|
+
};
|
23363
23389
|
|
23364
|
-
|
23365
|
-
|
23366
|
-
|
23367
|
-
|
23368
|
-
|
23369
|
-
}
|
23370
|
-
this.classNameAndNodeQueue.length = 0;
|
23371
|
-
this.timeout = null;
|
23372
|
-
},
|
23390
|
+
ReactShallowRenderer.prototype.render = function render(element, context) {
|
23391
|
+
// Ensure we've done the default injections. This might not be true in the
|
23392
|
+
// case of a simple test that only requires React and the TestUtils in
|
23393
|
+
// conjunction with an inline-requires transform.
|
23394
|
+
ReactDefaultInjection.inject();
|
23373
23395
|
|
23374
|
-
|
23375
|
-
|
23376
|
-
this.transitionTimeouts = [];
|
23377
|
-
},
|
23396
|
+
!React.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : _prodInvariant('12', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : void 0;
|
23397
|
+
!(typeof element.type !== 'string') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (%s). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead.', element.type) : _prodInvariant('13', element.type) : void 0;
|
23378
23398
|
|
23379
|
-
|
23380
|
-
|
23381
|
-
clearTimeout(this.timeout);
|
23399
|
+
if (!context) {
|
23400
|
+
context = emptyObject;
|
23382
23401
|
}
|
23383
|
-
|
23384
|
-
clearTimeout(timeout);
|
23385
|
-
});
|
23402
|
+
ReactUpdates.batchedUpdates(_batchedRender, this, element, context);
|
23386
23403
|
|
23387
|
-
this.
|
23388
|
-
}
|
23404
|
+
return this.getRenderOutput();
|
23405
|
+
};
|
23389
23406
|
|
23390
|
-
|
23391
|
-
|
23392
|
-
|
23393
|
-
} else {
|
23394
|
-
done();
|
23395
|
-
}
|
23396
|
-
},
|
23407
|
+
ReactShallowRenderer.prototype.getRenderOutput = function getRenderOutput() {
|
23408
|
+
return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
|
23409
|
+
};
|
23397
23410
|
|
23398
|
-
|
23399
|
-
if (this.
|
23400
|
-
this.
|
23401
|
-
} else {
|
23402
|
-
done();
|
23411
|
+
ReactShallowRenderer.prototype.unmount = function unmount() {
|
23412
|
+
if (this._instance) {
|
23413
|
+
ReactReconciler.unmountComponent(this._instance, false);
|
23403
23414
|
}
|
23404
|
-
}
|
23415
|
+
};
|
23405
23416
|
|
23406
|
-
|
23407
|
-
if (this.
|
23408
|
-
this.
|
23417
|
+
ReactShallowRenderer.prototype._render = function _render(element, transaction, context) {
|
23418
|
+
if (this._instance) {
|
23419
|
+
ReactReconciler.receiveComponent(this._instance, element, transaction, context);
|
23409
23420
|
} else {
|
23410
|
-
|
23421
|
+
var instance = new ShallowComponentWrapper(element);
|
23422
|
+
ReactReconciler.mountComponent(instance, transaction, null, null, context, 0);
|
23423
|
+
this._instance = instance;
|
23411
23424
|
}
|
23412
|
-
}
|
23425
|
+
};
|
23413
23426
|
|
23414
|
-
|
23415
|
-
|
23416
|
-
}
|
23417
|
-
});
|
23427
|
+
return ReactShallowRenderer;
|
23428
|
+
}();
|
23418
23429
|
|
23419
|
-
module.exports =
|
23430
|
+
module.exports = ReactShallowRenderer;
|
23431
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
23420
23432
|
|
23421
23433
|
/***/ },
|
23422
23434
|
/* 191 */
|
@@ -23624,13 +23636,7 @@
|
|
23624
23636
|
|
23625
23637
|
/***/ },
|
23626
23638
|
/* 193 */
|
23627
|
-
/***/ function(module, exports
|
23628
|
-
|
23629
|
-
module.exports = __webpack_require__(194);
|
23630
|
-
|
23631
|
-
/***/ },
|
23632
|
-
/* 194 */
|
23633
|
-
/***/ function(module, exports, __webpack_require__) {
|
23639
|
+
/***/ function(module, exports) {
|
23634
23640
|
|
23635
23641
|
/**
|
23636
23642
|
* Copyright 2013-present, Facebook, Inc.
|
@@ -23639,13 +23645,156 @@
|
|
23639
23645
|
* This source code is licensed under the BSD-style license found in the
|
23640
23646
|
* LICENSE file in the root directory of this source tree. An additional grant
|
23641
23647
|
* of patent rights can be found in the PATENTS file in the same directory.
|
23642
|
-
*
|
23643
23648
|
*/
|
23644
23649
|
|
23645
23650
|
'use strict';
|
23646
23651
|
|
23647
|
-
|
23648
|
-
|
23652
|
+
/**
|
23653
|
+
* ReactLink encapsulates a common pattern in which a component wants to modify
|
23654
|
+
* a prop received from its parent. ReactLink allows the parent to pass down a
|
23655
|
+
* value coupled with a callback that, when invoked, expresses an intent to
|
23656
|
+
* modify that value. For example:
|
23657
|
+
*
|
23658
|
+
* React.createClass({
|
23659
|
+
* getInitialState: function() {
|
23660
|
+
* return {value: ''};
|
23661
|
+
* },
|
23662
|
+
* render: function() {
|
23663
|
+
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
|
23664
|
+
* return <input valueLink={valueLink} />;
|
23665
|
+
* },
|
23666
|
+
* _handleValueChange: function(newValue) {
|
23667
|
+
* this.setState({value: newValue});
|
23668
|
+
* }
|
23669
|
+
* });
|
23670
|
+
*
|
23671
|
+
* We have provided some sugary mixins to make the creation and
|
23672
|
+
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
|
23673
|
+
*/
|
23674
|
+
|
23675
|
+
/**
|
23676
|
+
* Deprecated: An an easy way to express two-way binding with React.
|
23677
|
+
* See https://facebook.github.io/react/docs/two-way-binding-helpers.html
|
23678
|
+
*
|
23679
|
+
* @param {*} value current value of the link
|
23680
|
+
* @param {function} requestChange callback to request a change
|
23681
|
+
*/
|
23682
|
+
function ReactLink(value, requestChange) {
|
23683
|
+
this.value = value;
|
23684
|
+
this.requestChange = requestChange;
|
23685
|
+
}
|
23686
|
+
|
23687
|
+
/**
|
23688
|
+
* Creates a PropType that enforces the ReactLink API and optionally checks the
|
23689
|
+
* type of the value being passed inside the link. Example:
|
23690
|
+
*
|
23691
|
+
* MyComponent.propTypes = {
|
23692
|
+
* tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number)
|
23693
|
+
* }
|
23694
|
+
*/
|
23695
|
+
function createLinkTypeChecker(linkType) {
|
23696
|
+
var shapes = {
|
23697
|
+
value: linkType === undefined ?
|
23698
|
+
React.PropTypes.any.isRequired :
|
23699
|
+
linkType.isRequired,
|
23700
|
+
requestChange: React.PropTypes.func.isRequired,
|
23701
|
+
};
|
23702
|
+
return React.PropTypes.shape(shapes);
|
23703
|
+
}
|
23704
|
+
|
23705
|
+
ReactLink.PropTypes = {
|
23706
|
+
link: createLinkTypeChecker,
|
23707
|
+
};
|
23708
|
+
|
23709
|
+
var ReactStateSetters = {
|
23710
|
+
/**
|
23711
|
+
* Returns a function that calls the provided function, and uses the result
|
23712
|
+
* of that to set the component's state.
|
23713
|
+
*
|
23714
|
+
* @param {ReactCompositeComponent} component
|
23715
|
+
* @param {function} funcReturningState Returned callback uses this to
|
23716
|
+
* determine how to update state.
|
23717
|
+
* @return {function} callback that when invoked uses funcReturningState to
|
23718
|
+
* determined the object literal to setState.
|
23719
|
+
*/
|
23720
|
+
createStateSetter: function(component, funcReturningState) {
|
23721
|
+
return function(a, b, c, d, e, f) {
|
23722
|
+
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
|
23723
|
+
if (partialState) {
|
23724
|
+
component.setState(partialState);
|
23725
|
+
}
|
23726
|
+
};
|
23727
|
+
},
|
23728
|
+
|
23729
|
+
/**
|
23730
|
+
* Returns a single-argument callback that can be used to update a single
|
23731
|
+
* key in the component's state.
|
23732
|
+
*
|
23733
|
+
* Note: this is memoized function, which makes it inexpensive to call.
|
23734
|
+
*
|
23735
|
+
* @param {ReactCompositeComponent} component
|
23736
|
+
* @param {string} key The key in the state that you should update.
|
23737
|
+
* @return {function} callback of 1 argument which calls setState() with
|
23738
|
+
* the provided keyName and callback argument.
|
23739
|
+
*/
|
23740
|
+
createStateKeySetter: function(component, key) {
|
23741
|
+
// Memoize the setters.
|
23742
|
+
var cache = component.__keySetters || (component.__keySetters = {});
|
23743
|
+
return cache[key] || (cache[key] = createStateKeySetter(component, key));
|
23744
|
+
},
|
23745
|
+
};
|
23746
|
+
|
23747
|
+
function createStateKeySetter(component, key) {
|
23748
|
+
// Partial state is allocated outside of the function closure so it can be
|
23749
|
+
// reused with every call, avoiding memory allocation when this function
|
23750
|
+
// is called.
|
23751
|
+
var partialState = {};
|
23752
|
+
return function stateKeySetter(value) {
|
23753
|
+
partialState[key] = value;
|
23754
|
+
component.setState(partialState);
|
23755
|
+
};
|
23756
|
+
}
|
23757
|
+
|
23758
|
+
ReactStateSetters.Mixin = {
|
23759
|
+
/**
|
23760
|
+
* Returns a function that calls the provided function, and uses the result
|
23761
|
+
* of that to set the component's state.
|
23762
|
+
*
|
23763
|
+
* For example, these statements are equivalent:
|
23764
|
+
*
|
23765
|
+
* this.setState({x: 1});
|
23766
|
+
* this.createStateSetter(function(xValue) {
|
23767
|
+
* return {x: xValue};
|
23768
|
+
* })(1);
|
23769
|
+
*
|
23770
|
+
* @param {function} funcReturningState Returned callback uses this to
|
23771
|
+
* determine how to update state.
|
23772
|
+
* @return {function} callback that when invoked uses funcReturningState to
|
23773
|
+
* determined the object literal to setState.
|
23774
|
+
*/
|
23775
|
+
createStateSetter: function(funcReturningState) {
|
23776
|
+
return ReactStateSetters.createStateSetter(this, funcReturningState);
|
23777
|
+
},
|
23778
|
+
|
23779
|
+
/**
|
23780
|
+
* Returns a single-argument callback that can be used to update a single
|
23781
|
+
* key in the component's state.
|
23782
|
+
*
|
23783
|
+
* For example, these statements are equivalent:
|
23784
|
+
*
|
23785
|
+
* this.setState({x: 1});
|
23786
|
+
* this.createStateKeySetter('x')(1);
|
23787
|
+
*
|
23788
|
+
* Note: this is memoized function, which makes it inexpensive to call.
|
23789
|
+
*
|
23790
|
+
* @param {string} key The key in the state that you should update.
|
23791
|
+
* @return {function} callback of 1 argument which calls setState() with
|
23792
|
+
* the provided keyName and callback argument.
|
23793
|
+
*/
|
23794
|
+
createStateKeySetter: function(key) {
|
23795
|
+
return ReactStateSetters.createStateKeySetter(this, key);
|
23796
|
+
},
|
23797
|
+
};
|
23649
23798
|
|
23650
23799
|
/**
|
23651
23800
|
* A simple mixin around ReactLink.forState().
|
@@ -23660,284 +23809,466 @@
|
|
23660
23809
|
* @param {string} key state key to update.
|
23661
23810
|
* @return {ReactLink} ReactLink instance linking to the state.
|
23662
23811
|
*/
|
23663
|
-
linkState: function
|
23664
|
-
return new ReactLink(
|
23665
|
-
|
23812
|
+
linkState: function(key) {
|
23813
|
+
return new ReactLink(
|
23814
|
+
this.state[key],
|
23815
|
+
ReactStateSetters.createStateKeySetter(this, key)
|
23816
|
+
);
|
23817
|
+
},
|
23666
23818
|
};
|
23667
23819
|
|
23668
23820
|
module.exports = LinkedStateMixin;
|
23669
23821
|
|
23822
|
+
|
23670
23823
|
/***/ },
|
23671
|
-
/*
|
23824
|
+
/* 194 */
|
23672
23825
|
/***/ function(module, exports, __webpack_require__) {
|
23673
23826
|
|
23674
|
-
/**
|
23675
|
-
* Copyright
|
23827
|
+
/* WEBPACK VAR INJECTION */(function(process) {/**
|
23828
|
+
* Copyright 2015-present, Facebook, Inc.
|
23676
23829
|
* All rights reserved.
|
23677
23830
|
*
|
23678
23831
|
* This source code is licensed under the BSD-style license found in the
|
23679
23832
|
* LICENSE file in the root directory of this source tree. An additional grant
|
23680
23833
|
* of patent rights can be found in the PATENTS file in the same directory.
|
23681
23834
|
*
|
23835
|
+
* @providesModule createReactFragment
|
23682
23836
|
*/
|
23683
23837
|
|
23684
23838
|
'use strict';
|
23685
23839
|
|
23686
|
-
|
23687
|
-
* ReactLink encapsulates a common pattern in which a component wants to modify
|
23688
|
-
* a prop received from its parent. ReactLink allows the parent to pass down a
|
23689
|
-
* value coupled with a callback that, when invoked, expresses an intent to
|
23690
|
-
* modify that value. For example:
|
23691
|
-
*
|
23692
|
-
* React.createClass({
|
23693
|
-
* getInitialState: function() {
|
23694
|
-
* return {value: ''};
|
23695
|
-
* },
|
23696
|
-
* render: function() {
|
23697
|
-
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
|
23698
|
-
* return <input valueLink={valueLink} />;
|
23699
|
-
* },
|
23700
|
-
* _handleValueChange: function(newValue) {
|
23701
|
-
* this.setState({value: newValue});
|
23702
|
-
* }
|
23703
|
-
* });
|
23704
|
-
*
|
23705
|
-
* We have provided some sugary mixins to make the creation and
|
23706
|
-
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
|
23707
|
-
*/
|
23840
|
+
var React = __webpack_require__(1);
|
23708
23841
|
|
23709
|
-
var
|
23842
|
+
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
23843
|
+
Symbol.for &&
|
23844
|
+
Symbol.for('react.element')) ||
|
23845
|
+
0xeac7;
|
23710
23846
|
|
23711
|
-
|
23712
|
-
|
23713
|
-
|
23714
|
-
|
23715
|
-
* @param {*} value current value of the link
|
23716
|
-
* @param {function} requestChange callback to request a change
|
23717
|
-
*/
|
23718
|
-
function ReactLink(value, requestChange) {
|
23719
|
-
this.value = value;
|
23720
|
-
this.requestChange = requestChange;
|
23847
|
+
function makeEmptyFunction(arg) {
|
23848
|
+
return function () {
|
23849
|
+
return arg;
|
23850
|
+
};
|
23721
23851
|
}
|
23852
|
+
var emptyFunction = function emptyFunction() {};
|
23853
|
+
emptyFunction.thatReturns = makeEmptyFunction;
|
23854
|
+
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
23855
|
+
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
23856
|
+
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
23857
|
+
emptyFunction.thatReturnsThis = function () {
|
23858
|
+
return this;
|
23859
|
+
};
|
23860
|
+
emptyFunction.thatReturnsArgument = function (arg) {
|
23861
|
+
return arg;
|
23862
|
+
};
|
23722
23863
|
|
23723
|
-
|
23724
|
-
|
23725
|
-
|
23726
|
-
|
23727
|
-
|
23728
|
-
|
23729
|
-
|
23730
|
-
*/
|
23731
|
-
function createLinkTypeChecker(linkType) {
|
23732
|
-
var shapes = {
|
23733
|
-
value: linkType === undefined ? React.PropTypes.any.isRequired : linkType.isRequired,
|
23734
|
-
requestChange: React.PropTypes.func.isRequired
|
23864
|
+
var validateFormat = function validateFormat(format) {};
|
23865
|
+
|
23866
|
+
if (process.env.NODE_ENV !== 'production') {
|
23867
|
+
validateFormat = function validateFormat(format) {
|
23868
|
+
if (format === undefined) {
|
23869
|
+
throw new Error('invariant requires an error message argument');
|
23870
|
+
}
|
23735
23871
|
};
|
23736
|
-
return React.PropTypes.shape(shapes);
|
23737
23872
|
}
|
23738
23873
|
|
23739
|
-
|
23740
|
-
|
23741
|
-
};
|
23874
|
+
function invariant(condition, format, a, b, c, d, e, f) {
|
23875
|
+
validateFormat(format);
|
23742
23876
|
|
23743
|
-
|
23877
|
+
if (!condition) {
|
23878
|
+
var error;
|
23879
|
+
if (format === undefined) {
|
23880
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
23881
|
+
} else {
|
23882
|
+
var args = [a, b, c, d, e, f];
|
23883
|
+
var argIndex = 0;
|
23884
|
+
error = new Error(format.replace(/%s/g, function () {
|
23885
|
+
return args[argIndex++];
|
23886
|
+
}));
|
23887
|
+
error.name = 'Invariant Violation';
|
23888
|
+
}
|
23744
23889
|
|
23745
|
-
|
23746
|
-
|
23747
|
-
|
23890
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
23891
|
+
throw error;
|
23892
|
+
}
|
23893
|
+
}
|
23748
23894
|
|
23749
|
-
|
23750
|
-
* Copyright 2013-present, Facebook, Inc.
|
23751
|
-
* All rights reserved.
|
23752
|
-
*
|
23753
|
-
* This source code is licensed under the BSD-style license found in the
|
23754
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
23755
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
23756
|
-
*
|
23757
|
-
*/
|
23895
|
+
var warning = emptyFunction;
|
23758
23896
|
|
23759
|
-
'
|
23897
|
+
if (process.env.NODE_ENV !== 'production') {
|
23898
|
+
(function () {
|
23899
|
+
var printWarning = function printWarning(format) {
|
23900
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
23901
|
+
args[_key - 1] = arguments[_key];
|
23902
|
+
}
|
23760
23903
|
|
23761
|
-
|
23762
|
-
|
23763
|
-
|
23764
|
-
|
23765
|
-
|
23766
|
-
|
23767
|
-
* @param {function} funcReturningState Returned callback uses this to
|
23768
|
-
* determine how to update state.
|
23769
|
-
* @return {function} callback that when invoked uses funcReturningState to
|
23770
|
-
* determined the object literal to setState.
|
23771
|
-
*/
|
23772
|
-
createStateSetter: function (component, funcReturningState) {
|
23773
|
-
return function (a, b, c, d, e, f) {
|
23774
|
-
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
|
23775
|
-
if (partialState) {
|
23776
|
-
component.setState(partialState);
|
23904
|
+
var argIndex = 0;
|
23905
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
23906
|
+
return args[argIndex++];
|
23907
|
+
});
|
23908
|
+
if (typeof console !== 'undefined') {
|
23909
|
+
console.error(message);
|
23777
23910
|
}
|
23911
|
+
try {
|
23912
|
+
// --- Welcome to debugging React ---
|
23913
|
+
// This error was thrown as a convenience so that you can use this stack
|
23914
|
+
// to find the callsite that caused this warning to fire.
|
23915
|
+
throw new Error(message);
|
23916
|
+
} catch (x) {}
|
23778
23917
|
};
|
23779
|
-
},
|
23780
23918
|
|
23781
|
-
|
23782
|
-
|
23783
|
-
|
23784
|
-
|
23785
|
-
|
23786
|
-
|
23787
|
-
|
23788
|
-
|
23789
|
-
|
23790
|
-
|
23791
|
-
|
23792
|
-
|
23793
|
-
|
23794
|
-
|
23795
|
-
|
23919
|
+
warning = function warning(condition, format) {
|
23920
|
+
if (format === undefined) {
|
23921
|
+
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
23922
|
+
}
|
23923
|
+
|
23924
|
+
if (format.indexOf('Failed Composite propType: ') === 0) {
|
23925
|
+
return; // Ignore CompositeComponent proptype check.
|
23926
|
+
}
|
23927
|
+
|
23928
|
+
if (!condition) {
|
23929
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
23930
|
+
args[_key2 - 2] = arguments[_key2];
|
23931
|
+
}
|
23932
|
+
|
23933
|
+
printWarning.apply(undefined, [format].concat(args));
|
23934
|
+
}
|
23935
|
+
};
|
23936
|
+
})();
|
23937
|
+
}
|
23938
|
+
|
23939
|
+
var SEPARATOR = '.';
|
23940
|
+
var SUBSEPARATOR = ':';
|
23941
|
+
|
23942
|
+
var didWarnAboutMaps = false;
|
23943
|
+
|
23944
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
23945
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
23946
|
+
|
23947
|
+
function getIteratorFn(maybeIterable) {
|
23948
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
23949
|
+
if (typeof iteratorFn === 'function') {
|
23950
|
+
return iteratorFn;
|
23951
|
+
}
|
23952
|
+
}
|
23953
|
+
|
23954
|
+
function escape(key) {
|
23955
|
+
var escapeRegex = /[=:]/g;
|
23956
|
+
var escaperLookup = {
|
23957
|
+
'=': '=0',
|
23958
|
+
':': '=2'
|
23959
|
+
};
|
23960
|
+
var escapedString = ('' + key).replace(escapeRegex, function(match) {
|
23961
|
+
return escaperLookup[match];
|
23962
|
+
});
|
23963
|
+
|
23964
|
+
return '$' + escapedString;
|
23965
|
+
}
|
23966
|
+
|
23967
|
+
function getComponentKey(component, index) {
|
23968
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
23969
|
+
// that we don't block potential future ES APIs.
|
23970
|
+
if (component && typeof component === 'object' && component.key != null) {
|
23971
|
+
// Explicit key
|
23972
|
+
return escape(component.key);
|
23973
|
+
}
|
23974
|
+
// Implicit key determined by the index in the set
|
23975
|
+
return index.toString(36);
|
23976
|
+
}
|
23977
|
+
|
23978
|
+
function traverseAllChildrenImpl(
|
23979
|
+
children,
|
23980
|
+
nameSoFar,
|
23981
|
+
callback,
|
23982
|
+
traverseContext
|
23983
|
+
) {
|
23984
|
+
var type = typeof children;
|
23985
|
+
|
23986
|
+
if (type === 'undefined' || type === 'boolean') {
|
23987
|
+
// All of the above are perceived as null.
|
23988
|
+
children = null;
|
23989
|
+
}
|
23990
|
+
|
23991
|
+
if (
|
23992
|
+
children === null ||
|
23993
|
+
type === 'string' ||
|
23994
|
+
type === 'number' ||
|
23995
|
+
// The following is inlined from ReactElement. This means we can optimize
|
23996
|
+
// some checks. React Fiber also inlines this logic for similar purposes.
|
23997
|
+
(type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE)
|
23998
|
+
) {
|
23999
|
+
callback(
|
24000
|
+
traverseContext,
|
24001
|
+
children,
|
24002
|
+
// If it's the only child, treat the name as if it was wrapped in an array
|
24003
|
+
// so that it's consistent if the number of children grows.
|
24004
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar
|
24005
|
+
);
|
24006
|
+
return 1;
|
24007
|
+
}
|
24008
|
+
|
24009
|
+
var child;
|
24010
|
+
var nextName;
|
24011
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
24012
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
24013
|
+
|
24014
|
+
if (Array.isArray(children)) {
|
24015
|
+
for (var i = 0; i < children.length; i++) {
|
24016
|
+
child = children[i];
|
24017
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
24018
|
+
subtreeCount += traverseAllChildrenImpl(
|
24019
|
+
child,
|
24020
|
+
nextName,
|
24021
|
+
callback,
|
24022
|
+
traverseContext
|
24023
|
+
);
|
24024
|
+
}
|
24025
|
+
} else {
|
24026
|
+
var iteratorFn = getIteratorFn(children);
|
24027
|
+
if (iteratorFn) {
|
24028
|
+
if (process.env.NODE_ENV !== "production") {
|
24029
|
+
// Warn about using Maps as children
|
24030
|
+
if (iteratorFn === children.entries) {
|
24031
|
+
warning(
|
24032
|
+
didWarnAboutMaps,
|
24033
|
+
'Using Maps as children is unsupported and will likely yield ' +
|
24034
|
+
'unexpected results. Convert it to a sequence/iterable of keyed ' +
|
24035
|
+
'ReactElements instead.'
|
24036
|
+
);
|
24037
|
+
didWarnAboutMaps = true;
|
24038
|
+
}
|
24039
|
+
}
|
24040
|
+
|
24041
|
+
var iterator = iteratorFn.call(children);
|
24042
|
+
var step;
|
24043
|
+
var ii = 0;
|
24044
|
+
while (!(step = iterator.next()).done) {
|
24045
|
+
child = step.value;
|
24046
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
24047
|
+
subtreeCount += traverseAllChildrenImpl(
|
24048
|
+
child,
|
24049
|
+
nextName,
|
24050
|
+
callback,
|
24051
|
+
traverseContext
|
24052
|
+
);
|
24053
|
+
}
|
24054
|
+
} else if (type === 'object') {
|
24055
|
+
var addendum = '';
|
24056
|
+
if (process.env.NODE_ENV !== "production") {
|
24057
|
+
addendum = ' If you meant to render a collection of children, use an array ' +
|
24058
|
+
'instead or wrap the object using createFragment(object) from the ' +
|
24059
|
+
'React add-ons.';
|
24060
|
+
}
|
24061
|
+
var childrenString = '' + children;
|
24062
|
+
invariant(
|
24063
|
+
false,
|
24064
|
+
'Objects are not valid as a React child (found: %s).%s',
|
24065
|
+
childrenString === '[object Object]'
|
24066
|
+
? 'object with keys {' + Object.keys(children).join(', ') + '}'
|
24067
|
+
: childrenString,
|
24068
|
+
addendum
|
24069
|
+
);
|
24070
|
+
}
|
24071
|
+
}
|
24072
|
+
|
24073
|
+
return subtreeCount;
|
24074
|
+
}
|
24075
|
+
|
24076
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
24077
|
+
if (children == null) {
|
24078
|
+
return 0;
|
23796
24079
|
}
|
23797
|
-
};
|
23798
24080
|
|
23799
|
-
|
23800
|
-
// Partial state is allocated outside of the function closure so it can be
|
23801
|
-
// reused with every call, avoiding memory allocation when this function
|
23802
|
-
// is called.
|
23803
|
-
var partialState = {};
|
23804
|
-
return function stateKeySetter(value) {
|
23805
|
-
partialState[key] = value;
|
23806
|
-
component.setState(partialState);
|
23807
|
-
};
|
24081
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
23808
24082
|
}
|
23809
24083
|
|
23810
|
-
|
23811
|
-
|
23812
|
-
|
23813
|
-
|
23814
|
-
*
|
23815
|
-
* For example, these statements are equivalent:
|
23816
|
-
*
|
23817
|
-
* this.setState({x: 1});
|
23818
|
-
* this.createStateSetter(function(xValue) {
|
23819
|
-
* return {x: xValue};
|
23820
|
-
* })(1);
|
23821
|
-
*
|
23822
|
-
* @param {function} funcReturningState Returned callback uses this to
|
23823
|
-
* determine how to update state.
|
23824
|
-
* @return {function} callback that when invoked uses funcReturningState to
|
23825
|
-
* determined the object literal to setState.
|
23826
|
-
*/
|
23827
|
-
createStateSetter: function (funcReturningState) {
|
23828
|
-
return ReactStateSetters.createStateSetter(this, funcReturningState);
|
23829
|
-
},
|
24084
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
24085
|
+
function escapeUserProvidedKey(text) {
|
24086
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
24087
|
+
}
|
23830
24088
|
|
23831
|
-
|
23832
|
-
|
23833
|
-
|
23834
|
-
|
23835
|
-
|
23836
|
-
|
23837
|
-
|
23838
|
-
|
23839
|
-
*
|
23840
|
-
* Note: this is memoized function, which makes it inexpensive to call.
|
23841
|
-
*
|
23842
|
-
* @param {string} key The key in the state that you should update.
|
23843
|
-
* @return {function} callback of 1 argument which calls setState() with
|
23844
|
-
* the provided keyName and callback argument.
|
23845
|
-
*/
|
23846
|
-
createStateKeySetter: function (key) {
|
23847
|
-
return ReactStateSetters.createStateKeySetter(this, key);
|
23848
|
-
}
|
24089
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
24090
|
+
return React.cloneElement(
|
24091
|
+
oldElement,
|
24092
|
+
{ key: newKey },
|
24093
|
+
oldElement.props !== undefined
|
24094
|
+
? oldElement.props.children
|
24095
|
+
: undefined
|
24096
|
+
);
|
23849
24097
|
};
|
23850
24098
|
|
23851
|
-
|
23852
|
-
|
23853
|
-
/***/ },
|
23854
|
-
/* 197 */
|
23855
|
-
/***/ function(module, exports, __webpack_require__) {
|
24099
|
+
var DEFAULT_POOL_SIZE = 10;
|
24100
|
+
var DEFAULT_POOLER = oneArgumentPooler;
|
23856
24101
|
|
23857
|
-
|
24102
|
+
var oneArgumentPooler = function(copyFieldsFrom) {
|
24103
|
+
var Klass = this;
|
24104
|
+
if (Klass.instancePool.length) {
|
24105
|
+
var instance = Klass.instancePool.pop();
|
24106
|
+
Klass.call(instance, copyFieldsFrom);
|
24107
|
+
return instance;
|
24108
|
+
} else {
|
24109
|
+
return new Klass(copyFieldsFrom);
|
24110
|
+
}
|
24111
|
+
};
|
23858
24112
|
|
23859
|
-
|
23860
|
-
|
23861
|
-
|
24113
|
+
var addPoolingTo = function addPoolingTo(
|
24114
|
+
CopyConstructor,
|
24115
|
+
pooler
|
24116
|
+
) {
|
24117
|
+
// Casting as any so that flow ignores the actual implementation and trusts
|
24118
|
+
// it to match the type we declared
|
24119
|
+
var NewKlass = CopyConstructor;
|
24120
|
+
NewKlass.instancePool = [];
|
24121
|
+
NewKlass.getPooled = pooler || DEFAULT_POOLER;
|
24122
|
+
if (!NewKlass.poolSize) {
|
24123
|
+
NewKlass.poolSize = DEFAULT_POOL_SIZE;
|
24124
|
+
}
|
24125
|
+
NewKlass.release = standardReleaser;
|
24126
|
+
return NewKlass;
|
24127
|
+
};
|
23862
24128
|
|
23863
|
-
|
23864
|
-
|
23865
|
-
|
23866
|
-
|
23867
|
-
|
23868
|
-
|
23869
|
-
|
23870
|
-
|
23871
|
-
|
24129
|
+
var standardReleaser = function standardReleaser(instance) {
|
24130
|
+
var Klass = this;
|
24131
|
+
invariant(
|
24132
|
+
instance instanceof Klass,
|
24133
|
+
'Trying to release an instance into a pool of a different type.'
|
24134
|
+
);
|
24135
|
+
instance.destructor();
|
24136
|
+
if (Klass.instancePool.length < Klass.poolSize) {
|
24137
|
+
Klass.instancePool.push(instance);
|
24138
|
+
}
|
24139
|
+
};
|
23872
24140
|
|
23873
|
-
|
24141
|
+
var fourArgumentPooler = function fourArgumentPooler(a1, a2, a3, a4) {
|
24142
|
+
var Klass = this;
|
24143
|
+
if (Klass.instancePool.length) {
|
24144
|
+
var instance = Klass.instancePool.pop();
|
24145
|
+
Klass.call(instance, a1, a2, a3, a4);
|
24146
|
+
return instance;
|
24147
|
+
} else {
|
24148
|
+
return new Klass(a1, a2, a3, a4);
|
24149
|
+
}
|
24150
|
+
};
|
23874
24151
|
|
23875
|
-
|
24152
|
+
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
|
24153
|
+
this.result = mapResult;
|
24154
|
+
this.keyPrefix = keyPrefix;
|
24155
|
+
this.func = mapFunction;
|
24156
|
+
this.context = mapContext;
|
24157
|
+
this.count = 0;
|
24158
|
+
}
|
24159
|
+
MapBookKeeping.prototype.destructor = function() {
|
24160
|
+
this.result = null;
|
24161
|
+
this.keyPrefix = null;
|
24162
|
+
this.func = null;
|
24163
|
+
this.context = null;
|
24164
|
+
this.count = 0;
|
24165
|
+
};
|
24166
|
+
addPoolingTo(MapBookKeeping, fourArgumentPooler);
|
23876
24167
|
|
23877
|
-
|
23878
|
-
|
24168
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
24169
|
+
var result = bookKeeping.result;
|
24170
|
+
var keyPrefix = bookKeeping.keyPrefix;
|
24171
|
+
var func = bookKeeping.func;
|
24172
|
+
var context = bookKeeping.context;
|
23879
24173
|
|
23880
|
-
|
23881
|
-
|
23882
|
-
|
24174
|
+
var mappedChild = func.call(context, child, bookKeeping.count++);
|
24175
|
+
if (Array.isArray(mappedChild)) {
|
24176
|
+
mapIntoWithKeyPrefixInternal(
|
24177
|
+
mappedChild,
|
24178
|
+
result,
|
24179
|
+
childKey,
|
24180
|
+
emptyFunction.thatReturnsArgument
|
24181
|
+
);
|
24182
|
+
} else if (mappedChild != null) {
|
24183
|
+
if (React.isValidElement(mappedChild)) {
|
24184
|
+
mappedChild = cloneAndReplaceKey(
|
24185
|
+
mappedChild,
|
24186
|
+
// Keep both the (mapped) and old keys if they differ, just as
|
24187
|
+
// traverseAllChildren used to do for objects as children
|
24188
|
+
keyPrefix +
|
24189
|
+
(mappedChild.key && (!child || child.key !== mappedChild.key)
|
24190
|
+
? escapeUserProvidedKey(mappedChild.key) + '/'
|
24191
|
+
: '') +
|
24192
|
+
childKey
|
24193
|
+
);
|
24194
|
+
}
|
24195
|
+
result.push(mappedChild);
|
24196
|
+
}
|
24197
|
+
}
|
23883
24198
|
|
23884
|
-
|
23885
|
-
|
23886
|
-
|
23887
|
-
|
23888
|
-
|
23889
|
-
|
23890
|
-
|
24199
|
+
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
24200
|
+
var escapedPrefix = '';
|
24201
|
+
if (prefix != null) {
|
24202
|
+
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
24203
|
+
}
|
24204
|
+
var traverseContext = MapBookKeeping.getPooled(
|
24205
|
+
array,
|
24206
|
+
escapedPrefix,
|
24207
|
+
func,
|
24208
|
+
context
|
24209
|
+
);
|
24210
|
+
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
24211
|
+
MapBookKeeping.release(traverseContext);
|
24212
|
+
}
|
23891
24213
|
|
23892
24214
|
var numericPropertyRegex = /^\d+$/;
|
23893
24215
|
|
23894
24216
|
var warnedAboutNumeric = false;
|
23895
24217
|
|
23896
|
-
|
23897
|
-
|
23898
|
-
|
23899
|
-
|
23900
|
-
|
23901
|
-
|
23902
|
-
|
23903
|
-
|
23904
|
-
|
23905
|
-
|
23906
|
-
|
23907
|
-
|
23908
|
-
|
23909
|
-
|
23910
|
-
|
23911
|
-
|
23912
|
-
|
24218
|
+
function createReactFragment(object) {
|
24219
|
+
if (typeof object !== 'object' || !object || Array.isArray(object)) {
|
24220
|
+
warning(
|
24221
|
+
false,
|
24222
|
+
'React.addons.createFragment only accepts a single object. Got: %s',
|
24223
|
+
object
|
24224
|
+
);
|
24225
|
+
return object;
|
24226
|
+
}
|
24227
|
+
if (React.isValidElement(object)) {
|
24228
|
+
warning(
|
24229
|
+
false,
|
24230
|
+
'React.addons.createFragment does not accept a ReactElement ' +
|
24231
|
+
'without a wrapper object.'
|
24232
|
+
);
|
24233
|
+
return object;
|
24234
|
+
}
|
23913
24235
|
|
23914
|
-
|
24236
|
+
invariant(
|
24237
|
+
object.nodeType !== 1,
|
24238
|
+
'React.addons.createFragment(...): Encountered an invalid child; DOM ' +
|
24239
|
+
'elements are not valid children of React components.'
|
24240
|
+
);
|
23915
24241
|
|
23916
|
-
|
23917
|
-
if (process.env.NODE_ENV !== 'production') {
|
23918
|
-
if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
|
23919
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : void 0;
|
23920
|
-
warnedAboutNumeric = true;
|
23921
|
-
}
|
23922
|
-
}
|
23923
|
-
ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument);
|
23924
|
-
}
|
24242
|
+
var result = [];
|
23925
24243
|
|
23926
|
-
|
24244
|
+
for (var key in object) {
|
24245
|
+
if (process.env.NODE_ENV !== "production") {
|
24246
|
+
if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
|
24247
|
+
warning(
|
24248
|
+
false,
|
24249
|
+
'React.addons.createFragment(...): Child objects should have ' +
|
24250
|
+
'non-numeric keys so ordering is preserved.'
|
24251
|
+
);
|
24252
|
+
warnedAboutNumeric = true;
|
24253
|
+
}
|
24254
|
+
}
|
24255
|
+
mapIntoWithKeyPrefixInternal(
|
24256
|
+
object[key],
|
24257
|
+
result,
|
24258
|
+
key,
|
24259
|
+
emptyFunction.thatReturnsArgument
|
24260
|
+
);
|
23927
24261
|
}
|
23928
|
-
};
|
23929
24262
|
|
23930
|
-
|
23931
|
-
|
24263
|
+
return result;
|
24264
|
+
}
|
23932
24265
|
|
23933
|
-
|
23934
|
-
/* 199 */
|
23935
|
-
/***/ function(module, exports, __webpack_require__) {
|
24266
|
+
module.exports = createReactFragment;
|
23936
24267
|
|
23937
|
-
|
24268
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
23938
24269
|
|
23939
24270
|
/***/ },
|
23940
|
-
/*
|
24271
|
+
/* 195 */
|
23941
24272
|
/***/ function(module, exports, __webpack_require__) {
|
23942
24273
|
|
23943
24274
|
/* WEBPACK VAR INJECTION */(function(process) {/**
|
@@ -23948,23 +24279,50 @@
|
|
23948
24279
|
* LICENSE file in the root directory of this source tree. An additional grant
|
23949
24280
|
* of patent rights can be found in the PATENTS file in the same directory.
|
23950
24281
|
*
|
24282
|
+
* @providesModule update
|
23951
24283
|
*/
|
23952
24284
|
|
23953
|
-
|
24285
|
+
/* global hasOwnProperty:true */
|
23954
24286
|
|
23955
24287
|
'use strict';
|
23956
24288
|
|
23957
|
-
var
|
23958
|
-
|
24289
|
+
var NODE_ENV = process.env.NODE_ENV;
|
24290
|
+
|
24291
|
+
var invariant = function(condition, format, a, b, c, d, e, f) {
|
24292
|
+
if (NODE_ENV !== 'production') {
|
24293
|
+
if (format === undefined) {
|
24294
|
+
throw new Error('invariant requires an error message argument');
|
24295
|
+
}
|
24296
|
+
}
|
24297
|
+
|
24298
|
+
if (!condition) {
|
24299
|
+
var error;
|
24300
|
+
if (format === undefined) {
|
24301
|
+
error = new Error(
|
24302
|
+
'Minified exception occurred; use the non-minified dev environment ' +
|
24303
|
+
'for the full error message and additional helpful warnings.'
|
24304
|
+
);
|
24305
|
+
} else {
|
24306
|
+
var args = [a, b, c, d, e, f];
|
24307
|
+
var argIndex = 0;
|
24308
|
+
error = new Error(
|
24309
|
+
format.replace(/%s/g, function() { return args[argIndex++]; })
|
24310
|
+
);
|
24311
|
+
error.name = 'Invariant Violation';
|
24312
|
+
}
|
24313
|
+
|
24314
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
24315
|
+
throw error;
|
24316
|
+
}
|
24317
|
+
};
|
23959
24318
|
|
23960
|
-
var invariant = __webpack_require__(8);
|
23961
24319
|
var hasOwnProperty = {}.hasOwnProperty;
|
23962
24320
|
|
23963
24321
|
function shallowCopy(x) {
|
23964
24322
|
if (Array.isArray(x)) {
|
23965
24323
|
return x.concat();
|
23966
24324
|
} else if (x && typeof x === 'object') {
|
23967
|
-
return
|
24325
|
+
return Object.assign(new x.constructor(), x);
|
23968
24326
|
} else {
|
23969
24327
|
return x;
|
23970
24328
|
}
|
@@ -23977,18 +24335,36 @@
|
|
23977
24335
|
var COMMAND_MERGE = '$merge';
|
23978
24336
|
var COMMAND_APPLY = '$apply';
|
23979
24337
|
|
23980
|
-
var ALL_COMMANDS_LIST = [
|
24338
|
+
var ALL_COMMANDS_LIST = [
|
24339
|
+
COMMAND_PUSH,
|
24340
|
+
COMMAND_UNSHIFT,
|
24341
|
+
COMMAND_SPLICE,
|
24342
|
+
COMMAND_SET,
|
24343
|
+
COMMAND_MERGE,
|
24344
|
+
COMMAND_APPLY,
|
24345
|
+
];
|
23981
24346
|
|
23982
24347
|
var ALL_COMMANDS_SET = {};
|
23983
24348
|
|
23984
|
-
ALL_COMMANDS_LIST.forEach(function
|
24349
|
+
ALL_COMMANDS_LIST.forEach(function(command) {
|
23985
24350
|
ALL_COMMANDS_SET[command] = true;
|
23986
24351
|
});
|
23987
24352
|
|
23988
24353
|
function invariantArrayCase(value, spec, command) {
|
23989
|
-
|
24354
|
+
invariant(
|
24355
|
+
Array.isArray(value),
|
24356
|
+
'update(): expected target of %s to be an array; got %s.',
|
24357
|
+
command,
|
24358
|
+
value
|
24359
|
+
);
|
23990
24360
|
var specValue = spec[command];
|
23991
|
-
|
24361
|
+
invariant(
|
24362
|
+
Array.isArray(specValue),
|
24363
|
+
'update(): expected spec of %s to be an array; got %s. ' +
|
24364
|
+
'Did you forget to wrap your parameter in an array?',
|
24365
|
+
command,
|
24366
|
+
specValue
|
24367
|
+
);
|
23992
24368
|
}
|
23993
24369
|
|
23994
24370
|
/**
|
@@ -23996,10 +24372,20 @@
|
|
23996
24372
|
* See https://facebook.github.io/react/docs/update.html for details.
|
23997
24373
|
*/
|
23998
24374
|
function update(value, spec) {
|
23999
|
-
|
24375
|
+
invariant(
|
24376
|
+
typeof spec === 'object',
|
24377
|
+
'update(): You provided a key path to update() that did not contain one ' +
|
24378
|
+
'of %s. Did you forget to include {%s: ...}?',
|
24379
|
+
ALL_COMMANDS_LIST.join(', '),
|
24380
|
+
COMMAND_SET
|
24381
|
+
);
|
24000
24382
|
|
24001
24383
|
if (hasOwnProperty.call(spec, COMMAND_SET)) {
|
24002
|
-
|
24384
|
+
invariant(
|
24385
|
+
Object.keys(spec).length === 1,
|
24386
|
+
'Cannot have more than one key in an object with %s',
|
24387
|
+
COMMAND_SET
|
24388
|
+
);
|
24003
24389
|
|
24004
24390
|
return spec[COMMAND_SET];
|
24005
24391
|
}
|
@@ -24008,36 +24394,68 @@
|
|
24008
24394
|
|
24009
24395
|
if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
|
24010
24396
|
var mergeObj = spec[COMMAND_MERGE];
|
24011
|
-
|
24012
|
-
|
24013
|
-
|
24397
|
+
invariant(
|
24398
|
+
mergeObj && typeof mergeObj === 'object',
|
24399
|
+
'update(): %s expects a spec of type \'object\'; got %s',
|
24400
|
+
COMMAND_MERGE,
|
24401
|
+
mergeObj
|
24402
|
+
);
|
24403
|
+
invariant(
|
24404
|
+
nextValue && typeof nextValue === 'object',
|
24405
|
+
'update(): %s expects a target of type \'object\'; got %s',
|
24406
|
+
COMMAND_MERGE,
|
24407
|
+
nextValue
|
24408
|
+
);
|
24409
|
+
Object.assign(nextValue, spec[COMMAND_MERGE]);
|
24014
24410
|
}
|
24015
24411
|
|
24016
24412
|
if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
|
24017
24413
|
invariantArrayCase(value, spec, COMMAND_PUSH);
|
24018
|
-
spec[COMMAND_PUSH].forEach(function
|
24414
|
+
spec[COMMAND_PUSH].forEach(function(item) {
|
24019
24415
|
nextValue.push(item);
|
24020
24416
|
});
|
24021
24417
|
}
|
24022
24418
|
|
24023
24419
|
if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
|
24024
24420
|
invariantArrayCase(value, spec, COMMAND_UNSHIFT);
|
24025
|
-
spec[COMMAND_UNSHIFT].forEach(function
|
24421
|
+
spec[COMMAND_UNSHIFT].forEach(function(item) {
|
24026
24422
|
nextValue.unshift(item);
|
24027
24423
|
});
|
24028
24424
|
}
|
24029
24425
|
|
24030
24426
|
if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
|
24031
|
-
|
24032
|
-
|
24033
|
-
|
24034
|
-
|
24427
|
+
invariant(
|
24428
|
+
Array.isArray(value),
|
24429
|
+
'Expected %s target to be an array; got %s',
|
24430
|
+
COMMAND_SPLICE,
|
24431
|
+
value
|
24432
|
+
);
|
24433
|
+
invariant(
|
24434
|
+
Array.isArray(spec[COMMAND_SPLICE]),
|
24435
|
+
'update(): expected spec of %s to be an array of arrays; got %s. ' +
|
24436
|
+
'Did you forget to wrap your parameters in an array?',
|
24437
|
+
COMMAND_SPLICE,
|
24438
|
+
spec[COMMAND_SPLICE]
|
24439
|
+
);
|
24440
|
+
spec[COMMAND_SPLICE].forEach(function(args) {
|
24441
|
+
invariant(
|
24442
|
+
Array.isArray(args),
|
24443
|
+
'update(): expected spec of %s to be an array of arrays; got %s. ' +
|
24444
|
+
'Did you forget to wrap your parameters in an array?',
|
24445
|
+
COMMAND_SPLICE,
|
24446
|
+
spec[COMMAND_SPLICE]
|
24447
|
+
);
|
24035
24448
|
nextValue.splice.apply(nextValue, args);
|
24036
24449
|
});
|
24037
24450
|
}
|
24038
24451
|
|
24039
24452
|
if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
|
24040
|
-
|
24453
|
+
invariant(
|
24454
|
+
typeof spec[COMMAND_APPLY] === 'function',
|
24455
|
+
'update(): expected spec of %s to be a function; got %s.',
|
24456
|
+
COMMAND_APPLY,
|
24457
|
+
spec[COMMAND_APPLY]
|
24458
|
+
);
|
24041
24459
|
nextValue = spec[COMMAND_APPLY](nextValue);
|
24042
24460
|
}
|
24043
24461
|
|
@@ -24051,72 +24469,15 @@
|
|
24051
24469
|
}
|
24052
24470
|
|
24053
24471
|
module.exports = update;
|
24054
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
24055
|
-
|
24056
|
-
/***/ },
|
24057
|
-
/* 201 */
|
24058
|
-
/***/ function(module, exports, __webpack_require__) {
|
24059
|
-
|
24060
|
-
module.exports = __webpack_require__(202);
|
24061
|
-
|
24062
|
-
/***/ },
|
24063
|
-
/* 202 */
|
24064
|
-
/***/ function(module, exports, __webpack_require__) {
|
24065
|
-
|
24066
|
-
/**
|
24067
|
-
* Copyright 2013-present, Facebook, Inc.
|
24068
|
-
* All rights reserved.
|
24069
|
-
*
|
24070
|
-
* This source code is licensed under the BSD-style license found in the
|
24071
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
24072
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
24073
|
-
*
|
24074
|
-
*/
|
24075
|
-
|
24076
|
-
'use strict';
|
24077
|
-
|
24078
|
-
var shallowCompare = __webpack_require__(203);
|
24079
|
-
|
24080
|
-
/**
|
24081
|
-
* If your React component's render function is "pure", e.g. it will render the
|
24082
|
-
* same result given the same props and state, provide this mixin for a
|
24083
|
-
* considerable performance boost.
|
24084
|
-
*
|
24085
|
-
* Most React components have pure render functions.
|
24086
|
-
*
|
24087
|
-
* Example:
|
24088
|
-
*
|
24089
|
-
* var ReactComponentWithPureRenderMixin =
|
24090
|
-
* require('ReactComponentWithPureRenderMixin');
|
24091
|
-
* React.createClass({
|
24092
|
-
* mixins: [ReactComponentWithPureRenderMixin],
|
24093
|
-
*
|
24094
|
-
* render: function() {
|
24095
|
-
* return <div className={this.props.className}>foo</div>;
|
24096
|
-
* }
|
24097
|
-
* });
|
24098
|
-
*
|
24099
|
-
* Note: This only checks shallow equality for props and state. If these contain
|
24100
|
-
* complex data structures this mixin may have false-negatives for deeper
|
24101
|
-
* differences. Only mixin to components which have simple props and state, or
|
24102
|
-
* use `forceUpdate()` when you know deep data structures have changed.
|
24103
|
-
*
|
24104
|
-
* See https://facebook.github.io/react/docs/pure-render-mixin.html
|
24105
|
-
*/
|
24106
|
-
var ReactComponentWithPureRenderMixin = {
|
24107
|
-
shouldComponentUpdate: function (nextProps, nextState) {
|
24108
|
-
return shallowCompare(this, nextProps, nextState);
|
24109
|
-
}
|
24110
|
-
};
|
24111
24472
|
|
24112
|
-
|
24473
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
|
24113
24474
|
|
24114
24475
|
/***/ },
|
24115
|
-
/*
|
24476
|
+
/* 196 */
|
24116
24477
|
/***/ function(module, exports, __webpack_require__) {
|
24117
24478
|
|
24118
24479
|
/**
|
24119
|
-
* Copyright
|
24480
|
+
* Copyright 2015-present, Facebook, Inc.
|
24120
24481
|
* All rights reserved.
|
24121
24482
|
*
|
24122
24483
|
* This source code is licensed under the BSD-style license found in the
|
@@ -24129,28 +24490,27 @@
|
|
24129
24490
|
|
24130
24491
|
var shallowEqual = __webpack_require__(123);
|
24131
24492
|
|
24132
|
-
|
24133
|
-
|
24134
|
-
|
24135
|
-
|
24136
|
-
|
24137
|
-
|
24138
|
-
|
24139
|
-
}
|
24493
|
+
module.exports = {
|
24494
|
+
shouldComponentUpdate: function(nextProps, nextState) {
|
24495
|
+
return (
|
24496
|
+
!shallowEqual(this.props, nextProps) ||
|
24497
|
+
!shallowEqual(this.state, nextState)
|
24498
|
+
);
|
24499
|
+
},
|
24500
|
+
};
|
24140
24501
|
|
24141
|
-
module.exports = shallowCompare;
|
24142
24502
|
|
24143
24503
|
/***/ },
|
24144
|
-
/*
|
24504
|
+
/* 197 */
|
24145
24505
|
/***/ function(module, exports, __webpack_require__) {
|
24146
24506
|
|
24147
|
-
module.exports = __webpack_require__(
|
24507
|
+
module.exports = __webpack_require__(188);
|
24148
24508
|
|
24149
24509
|
/***/ },
|
24150
|
-
/*
|
24510
|
+
/* 198 */
|
24151
24511
|
/***/ function(module, exports, __webpack_require__) {
|
24152
24512
|
|
24153
|
-
module.exports = __webpack_require__(
|
24513
|
+
module.exports = __webpack_require__(187);
|
24154
24514
|
|
24155
24515
|
/***/ }
|
24156
24516
|
/******/ ]);
|