react-dom 15.4.0-rc.3 → 15.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-dom-server.js +420 -364
- package/dist/react-dom-server.min.js +5 -5
- package/dist/react-dom.js +519 -464
- package/dist/react-dom.min.js +5 -5
- package/lib/EventPluginHub.js +27 -0
- package/lib/PooledClass.js +1 -13
- package/lib/ReactChildFiber.js +7 -9
- package/lib/ReactCompositeComponent.js +3 -3
- package/lib/ReactDOMComponent.js +10 -4
- package/lib/ReactDOMComponentTree.js +8 -1
- package/lib/ReactDOMInput.js +11 -1
- package/lib/ReactDOMTextarea.js +9 -3
- package/lib/ReactDOMUMDEntry.js +10 -9
- package/lib/ReactDebugTool.js +5 -6
- package/lib/ReactFiber.js +9 -9
- package/lib/ReactFiberBeginWork.js +26 -31
- package/lib/ReactFiberCommitWork.js +5 -7
- package/lib/ReactFiberCompleteWork.js +13 -14
- package/lib/ReactFiberReconciler.js +5 -8
- package/lib/ReactFiberRoot.js +2 -4
- package/lib/ReactFiberScheduler.js +13 -20
- package/lib/ReactHostComponent.js +1 -9
- package/lib/ReactInstanceType.js +9 -10
- package/lib/ReactOwner.js +2 -2
- package/lib/ReactPerf.js +45 -45
- package/lib/ReactReconciler.js +2 -2
- package/lib/ReactRef.js +5 -5
- package/lib/ReactReifiedYield.js +2 -4
- package/lib/ReactShallowRenderer.js +3 -4
- package/lib/ReactTestUtils.js +2 -2
- package/lib/ReactVersion.js +1 -1
- package/lib/ResponderTouchHistoryStore.js +3 -3
- package/lib/SimpleEventPlugin.js +1 -16
- package/lib/getNextDebugID.js +20 -0
- package/lib/instantiateReactComponent.js +13 -4
- package/lib/renderSubtreeIntoContainer.js +1 -2
- package/package.json +2 -2
package/lib/ReactPerf.js
CHANGED
|
@@ -88,13 +88,13 @@ function getExclusive() {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
flushHistory.forEach(function (flush) {
|
|
91
|
-
var measurements = flush.measurements
|
|
92
|
-
|
|
91
|
+
var measurements = flush.measurements,
|
|
92
|
+
treeSnapshot = flush.treeSnapshot;
|
|
93
93
|
|
|
94
94
|
measurements.forEach(function (measurement) {
|
|
95
|
-
var duration = measurement.duration
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
var duration = measurement.duration,
|
|
96
|
+
instanceID = measurement.instanceID,
|
|
97
|
+
timerType = measurement.timerType;
|
|
98
98
|
|
|
99
99
|
updateAggregatedStats(treeSnapshot, instanceID, timerType, function (stats) {
|
|
100
100
|
stats.totalDuration += duration;
|
|
@@ -125,9 +125,9 @@ function getInclusive() {
|
|
|
125
125
|
var affectedIDs = {};
|
|
126
126
|
|
|
127
127
|
function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) {
|
|
128
|
-
var _treeSnapshot$instanc = treeSnapshot[instanceID]
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
var _treeSnapshot$instanc = treeSnapshot[instanceID],
|
|
129
|
+
displayName = _treeSnapshot$instanc.displayName,
|
|
130
|
+
ownerID = _treeSnapshot$instanc.ownerID;
|
|
131
131
|
|
|
132
132
|
var owner = treeSnapshot[ownerID];
|
|
133
133
|
var key = (owner ? owner.displayName + ' > ' : '') + displayName;
|
|
@@ -150,8 +150,8 @@ function getInclusive() {
|
|
|
150
150
|
var measurements = flush.measurements;
|
|
151
151
|
|
|
152
152
|
measurements.forEach(function (measurement) {
|
|
153
|
-
var instanceID = measurement.instanceID
|
|
154
|
-
|
|
153
|
+
var instanceID = measurement.instanceID,
|
|
154
|
+
timerType = measurement.timerType;
|
|
155
155
|
|
|
156
156
|
if (timerType !== 'render') {
|
|
157
157
|
return;
|
|
@@ -161,13 +161,13 @@ function getInclusive() {
|
|
|
161
161
|
});
|
|
162
162
|
|
|
163
163
|
flushHistory.forEach(function (flush) {
|
|
164
|
-
var measurements = flush.measurements
|
|
165
|
-
|
|
164
|
+
var measurements = flush.measurements,
|
|
165
|
+
treeSnapshot = flush.treeSnapshot;
|
|
166
166
|
|
|
167
167
|
measurements.forEach(function (measurement) {
|
|
168
|
-
var duration = measurement.duration
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
var duration = measurement.duration,
|
|
169
|
+
instanceID = measurement.instanceID,
|
|
170
|
+
timerType = measurement.timerType;
|
|
171
171
|
|
|
172
172
|
if (timerType !== 'render') {
|
|
173
173
|
return;
|
|
@@ -210,9 +210,9 @@ function getWasted() {
|
|
|
210
210
|
var affectedIDs = {};
|
|
211
211
|
|
|
212
212
|
function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) {
|
|
213
|
-
var _treeSnapshot$instanc2 = treeSnapshot[instanceID]
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
var _treeSnapshot$instanc2 = treeSnapshot[instanceID],
|
|
214
|
+
displayName = _treeSnapshot$instanc2.displayName,
|
|
215
|
+
ownerID = _treeSnapshot$instanc2.ownerID;
|
|
216
216
|
|
|
217
217
|
var owner = treeSnapshot[ownerID];
|
|
218
218
|
var key = (owner ? owner.displayName + ' > ' : '') + displayName;
|
|
@@ -231,9 +231,9 @@ function getWasted() {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
flushHistory.forEach(function (flush) {
|
|
234
|
-
var measurements = flush.measurements
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
var measurements = flush.measurements,
|
|
235
|
+
treeSnapshot = flush.treeSnapshot,
|
|
236
|
+
operations = flush.operations;
|
|
237
237
|
|
|
238
238
|
var isDefinitelyNotWastedByID = {};
|
|
239
239
|
|
|
@@ -253,8 +253,8 @@ function getWasted() {
|
|
|
253
253
|
// These are potential candidates for being wasted renders.
|
|
254
254
|
var renderedCompositeIDs = {};
|
|
255
255
|
measurements.forEach(function (measurement) {
|
|
256
|
-
var instanceID = measurement.instanceID
|
|
257
|
-
|
|
256
|
+
var instanceID = measurement.instanceID,
|
|
257
|
+
timerType = measurement.timerType;
|
|
258
258
|
|
|
259
259
|
if (timerType !== 'render') {
|
|
260
260
|
return;
|
|
@@ -263,9 +263,9 @@ function getWasted() {
|
|
|
263
263
|
});
|
|
264
264
|
|
|
265
265
|
measurements.forEach(function (measurement) {
|
|
266
|
-
var duration = measurement.duration
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
var duration = measurement.duration,
|
|
267
|
+
instanceID = measurement.instanceID,
|
|
268
|
+
timerType = measurement.timerType;
|
|
269
269
|
|
|
270
270
|
if (timerType !== 'render') {
|
|
271
271
|
return;
|
|
@@ -318,16 +318,16 @@ function getOperations() {
|
|
|
318
318
|
|
|
319
319
|
var stats = [];
|
|
320
320
|
flushHistory.forEach(function (flush, flushIndex) {
|
|
321
|
-
var operations = flush.operations
|
|
322
|
-
|
|
321
|
+
var operations = flush.operations,
|
|
322
|
+
treeSnapshot = flush.treeSnapshot;
|
|
323
323
|
|
|
324
324
|
operations.forEach(function (operation) {
|
|
325
|
-
var instanceID = operation.instanceID
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
var _treeSnapshot$instanc3 = treeSnapshot[instanceID]
|
|
329
|
-
|
|
330
|
-
|
|
325
|
+
var instanceID = operation.instanceID,
|
|
326
|
+
type = operation.type,
|
|
327
|
+
payload = operation.payload;
|
|
328
|
+
var _treeSnapshot$instanc3 = treeSnapshot[instanceID],
|
|
329
|
+
displayName = _treeSnapshot$instanc3.displayName,
|
|
330
|
+
ownerID = _treeSnapshot$instanc3.ownerID;
|
|
331
331
|
|
|
332
332
|
var owner = treeSnapshot[ownerID];
|
|
333
333
|
var key = (owner ? owner.displayName + ' > ' : '') + displayName;
|
|
@@ -353,9 +353,9 @@ function printExclusive(flushHistory) {
|
|
|
353
353
|
|
|
354
354
|
var stats = getExclusive(flushHistory);
|
|
355
355
|
var table = stats.map(function (item) {
|
|
356
|
-
var key = item.key
|
|
357
|
-
|
|
358
|
-
|
|
356
|
+
var key = item.key,
|
|
357
|
+
instanceCount = item.instanceCount,
|
|
358
|
+
totalDuration = item.totalDuration;
|
|
359
359
|
|
|
360
360
|
var renderCount = item.counts.render || 0;
|
|
361
361
|
var renderDuration = item.durations.render || 0;
|
|
@@ -380,10 +380,10 @@ function printInclusive(flushHistory) {
|
|
|
380
380
|
|
|
381
381
|
var stats = getInclusive(flushHistory);
|
|
382
382
|
var table = stats.map(function (item) {
|
|
383
|
-
var key = item.key
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
383
|
+
var key = item.key,
|
|
384
|
+
instanceCount = item.instanceCount,
|
|
385
|
+
inclusiveRenderDuration = item.inclusiveRenderDuration,
|
|
386
|
+
renderCount = item.renderCount;
|
|
387
387
|
|
|
388
388
|
return {
|
|
389
389
|
'Owner > Component': key,
|
|
@@ -403,10 +403,10 @@ function printWasted(flushHistory) {
|
|
|
403
403
|
|
|
404
404
|
var stats = getWasted(flushHistory);
|
|
405
405
|
var table = stats.map(function (item) {
|
|
406
|
-
var key = item.key
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
var key = item.key,
|
|
407
|
+
instanceCount = item.instanceCount,
|
|
408
|
+
inclusiveRenderDuration = item.inclusiveRenderDuration,
|
|
409
|
+
renderCount = item.renderCount;
|
|
410
410
|
|
|
411
411
|
return {
|
|
412
412
|
'Owner > Component': key,
|
package/lib/ReactReconciler.js
CHANGED
|
@@ -19,8 +19,8 @@ var warning = require('fbjs/lib/warning');
|
|
|
19
19
|
* Helper to call ReactRef.attachRefs with this composite component, split out
|
|
20
20
|
* to avoid allocations in the transaction mount-ready queue.
|
|
21
21
|
*/
|
|
22
|
-
function attachRefs(
|
|
23
|
-
ReactRef.attachRefs(this, this._currentElement
|
|
22
|
+
function attachRefs() {
|
|
23
|
+
ReactRef.attachRefs(this, this._currentElement);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
var ReactReconciler = {
|
package/lib/ReactRef.js
CHANGED
|
@@ -15,12 +15,12 @@ var ReactOwner = require('./ReactOwner');
|
|
|
15
15
|
|
|
16
16
|
var ReactRef = {};
|
|
17
17
|
|
|
18
|
-
function attachRef(ref, component, owner
|
|
18
|
+
function attachRef(ref, component, owner) {
|
|
19
19
|
if (typeof ref === 'function') {
|
|
20
|
-
ref(component.getPublicInstance(
|
|
20
|
+
ref(component.getPublicInstance());
|
|
21
21
|
} else {
|
|
22
22
|
// Legacy ref
|
|
23
|
-
ReactOwner.addComponentAsRefTo(component, ref, owner
|
|
23
|
+
ReactOwner.addComponentAsRefTo(component, ref, owner);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -33,13 +33,13 @@ function detachRef(ref, component, owner) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
ReactRef.attachRefs = function (instance, element
|
|
36
|
+
ReactRef.attachRefs = function (instance, element) {
|
|
37
37
|
if (element === null || typeof element !== 'object') {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
var ref = element.ref;
|
|
41
41
|
if (ref != null) {
|
|
42
|
-
attachRef(ref, instance, element._owner
|
|
42
|
+
attachRef(ref, instance, element._owner);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
|
package/lib/ReactReifiedYield.js
CHANGED
|
@@ -11,10 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var _require = require('./ReactFiber')
|
|
15
|
-
|
|
16
|
-
var createFiberFromElementType = _require.createFiberFromElementType;
|
|
17
|
-
|
|
14
|
+
var _require = require('./ReactFiber'),
|
|
15
|
+
createFiberFromElementType = _require.createFiberFromElementType;
|
|
18
16
|
|
|
19
17
|
exports.createReifiedYield = function (yieldNode) {
|
|
20
18
|
var fiber = createFiberFromElementType(yieldNode.continuation, yieldNode.key);
|
|
@@ -22,10 +22,9 @@ var ReactReconciler = require('./ReactReconciler');
|
|
|
22
22
|
var ReactUpdates = require('./ReactUpdates');
|
|
23
23
|
|
|
24
24
|
var emptyObject = require('fbjs/lib/emptyObject');
|
|
25
|
+
var getNextDebugID = require('./getNextDebugID');
|
|
25
26
|
var invariant = require('fbjs/lib/invariant');
|
|
26
27
|
|
|
27
|
-
var nextDebugID = 1;
|
|
28
|
-
|
|
29
28
|
var NoopInternalComponent = function () {
|
|
30
29
|
function NoopInternalComponent(element) {
|
|
31
30
|
_classCallCheck(this, NoopInternalComponent);
|
|
@@ -34,7 +33,7 @@ var NoopInternalComponent = function () {
|
|
|
34
33
|
this._currentElement = element;
|
|
35
34
|
|
|
36
35
|
if (process.env.NODE_ENV !== 'production') {
|
|
37
|
-
this._debugID =
|
|
36
|
+
this._debugID = getNextDebugID();
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
|
|
@@ -61,7 +60,7 @@ var NoopInternalComponent = function () {
|
|
|
61
60
|
var ShallowComponentWrapper = function (element) {
|
|
62
61
|
// TODO: Consolidate with instantiateReactComponent
|
|
63
62
|
if (process.env.NODE_ENV !== 'production') {
|
|
64
|
-
this._debugID =
|
|
63
|
+
this._debugID = getNextDebugID();
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
this.construct(element);
|
package/lib/ReactTestUtils.js
CHANGED
|
@@ -69,14 +69,14 @@ function findAllInRenderedTreeInternal(inst, test) {
|
|
|
69
69
|
* @lends ReactTestUtils
|
|
70
70
|
*/
|
|
71
71
|
var ReactTestUtils = {
|
|
72
|
-
renderIntoDocument: function (
|
|
72
|
+
renderIntoDocument: function (element) {
|
|
73
73
|
var div = document.createElement('div');
|
|
74
74
|
// None of our tests actually require attaching the container to the
|
|
75
75
|
// DOM, and doing so creates a mess that we rely on test isolation to
|
|
76
76
|
// clean up, so we're going to stop honoring the name of this method
|
|
77
77
|
// (and probably rename it eventually) if no problems arise.
|
|
78
78
|
// document.documentElement.appendChild(div);
|
|
79
|
-
return ReactDOM.render(
|
|
79
|
+
return ReactDOM.render(element, div);
|
|
80
80
|
},
|
|
81
81
|
|
|
82
82
|
isElement: function (element) {
|
package/lib/ReactVersion.js
CHANGED
|
@@ -18,9 +18,9 @@ var EventPluginUtils = require('./EventPluginUtils');
|
|
|
18
18
|
var invariant = require('fbjs/lib/invariant');
|
|
19
19
|
var warning = require('fbjs/lib/warning');
|
|
20
20
|
|
|
21
|
-
var isEndish = EventPluginUtils.isEndish
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
var isEndish = EventPluginUtils.isEndish,
|
|
22
|
+
isMoveish = EventPluginUtils.isMoveish,
|
|
23
|
+
isStartish = EventPluginUtils.isStartish;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Tracks the position and time of each active touch by `touch.identifier`. We
|
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -80,18 +80,6 @@ function isInteractive(tag) {
|
|
|
80
80
|
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
function shouldPreventMouseEvent(inst) {
|
|
84
|
-
if (inst) {
|
|
85
|
-
var disabled = inst._currentElement && inst._currentElement.props.disabled;
|
|
86
|
-
|
|
87
|
-
if (disabled) {
|
|
88
|
-
return isInteractive(inst._tag);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
83
|
var SimpleEventPlugin = {
|
|
96
84
|
|
|
97
85
|
eventTypes: eventTypes,
|
|
@@ -162,10 +150,7 @@ var SimpleEventPlugin = {
|
|
|
162
150
|
case 'topMouseDown':
|
|
163
151
|
case 'topMouseMove':
|
|
164
152
|
case 'topMouseUp':
|
|
165
|
-
|
|
166
|
-
if (shouldPreventMouseEvent(targetInst)) {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
153
|
+
// TODO: Disabled elements should not respond to mouse events
|
|
169
154
|
/* falls through */
|
|
170
155
|
case 'topMouseOut':
|
|
171
156
|
case 'topMouseOver':
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var nextDebugID = 1;
|
|
15
|
+
|
|
16
|
+
function getNextDebugID() {
|
|
17
|
+
return nextDebugID++;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = getNextDebugID;
|
|
@@ -17,6 +17,7 @@ var ReactCompositeComponent = require('./ReactCompositeComponent');
|
|
|
17
17
|
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
18
18
|
var ReactHostComponent = require('./ReactHostComponent');
|
|
19
19
|
|
|
20
|
+
var getNextDebugID = require('./getNextDebugID');
|
|
20
21
|
var invariant = require('fbjs/lib/invariant');
|
|
21
22
|
var warning = require('fbjs/lib/warning');
|
|
22
23
|
|
|
@@ -49,8 +50,6 @@ function isInternalComponentType(type) {
|
|
|
49
50
|
return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
var nextDebugID = 1;
|
|
53
|
-
|
|
54
53
|
/**
|
|
55
54
|
* Given a ReactNode, create an instance that will actually be mounted.
|
|
56
55
|
*
|
|
@@ -66,7 +65,17 @@ function instantiateReactComponent(node, shouldHaveDebugID) {
|
|
|
66
65
|
instance = ReactEmptyComponent.create(instantiateReactComponent);
|
|
67
66
|
} else if (typeof node === 'object') {
|
|
68
67
|
var element = node;
|
|
69
|
-
|
|
68
|
+
var type = element.type;
|
|
69
|
+
if (typeof type !== 'function' && typeof type !== 'string') {
|
|
70
|
+
var info = '';
|
|
71
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
72
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
73
|
+
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
info += getDeclarationErrorAddendum(element._owner);
|
|
77
|
+
!false ? 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;
|
|
78
|
+
}
|
|
70
79
|
|
|
71
80
|
// Special case string values
|
|
72
81
|
if (typeof element.type === 'string') {
|
|
@@ -101,7 +110,7 @@ function instantiateReactComponent(node, shouldHaveDebugID) {
|
|
|
101
110
|
instance._mountImage = null;
|
|
102
111
|
|
|
103
112
|
if (process.env.NODE_ENV !== 'production') {
|
|
104
|
-
instance._debugID = shouldHaveDebugID ?
|
|
113
|
+
instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0;
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
// Internal instances should fully constructed at this point, so they should
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dom",
|
|
3
|
-
"version": "15.4.
|
|
3
|
+
"version": "15.4.2",
|
|
4
4
|
"description": "React package for working with the DOM.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "facebook/react",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"object-assign": "^4.1.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"react": "^15.4.
|
|
21
|
+
"react": "^15.4.2"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"LICENSE",
|