react 15.0.3-alpha.1 → 15.2.0-rc.1
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-with-addons.js +3311 -2007
- package/dist/react-with-addons.min.js +7 -6
- package/dist/react.js +2734 -2014
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +5 -5
- package/lib/CallbackQueue.js +3 -2
- package/lib/DOMChildrenOperations.js +42 -7
- package/lib/DOMLazyTree.js +18 -5
- package/lib/DOMProperty.js +6 -4
- package/lib/DOMPropertyOperations.js +35 -12
- package/lib/Danger.js +10 -8
- package/lib/DisabledInputUtils.js +5 -5
- package/lib/EventPluginHub.js +8 -2
- package/lib/EventPluginRegistry.js +13 -7
- package/lib/EventPluginUtils.js +3 -1
- package/lib/HTMLDOMPropertyConfig.js +1 -2
- package/lib/LinkedStateMixin.js +1 -0
- package/lib/LinkedValueUtils.js +5 -3
- package/lib/NativeMethodsMixin.js +6 -4
- package/lib/PooledClass.js +3 -1
- package/lib/React.js +1 -1
- package/lib/ReactCSSTransitionGroup.js +5 -0
- package/lib/ReactCSSTransitionGroupChild.js +15 -8
- package/lib/ReactChildReconciler.js +15 -6
- package/lib/ReactChildren.js +9 -1
- package/lib/ReactClass.js +15 -13
- package/lib/ReactComponent.js +3 -6
- package/lib/ReactComponentBrowserEnvironment.js +0 -5
- package/lib/ReactComponentEnvironment.js +3 -1
- package/lib/ReactComponentTreeDevtool.js +223 -0
- package/lib/ReactComponentTreeTestUtils.js +87 -0
- package/lib/ReactComponentWithPureRenderMixin.js +2 -0
- package/lib/ReactCompositeComponent.js +208 -119
- package/lib/ReactDOM.js +3 -6
- package/lib/ReactDOMButton.js +2 -2
- package/lib/ReactDOMComponent.js +165 -71
- package/lib/ReactDOMComponentTree.js +23 -21
- package/lib/ReactDOMDebugTool.js +7 -1
- package/lib/ReactDOMEmptyComponent.js +9 -9
- package/lib/ReactDOMFactories.js +1 -1
- package/lib/ReactDOMIDOperations.js +0 -5
- package/lib/ReactDOMInput.js +57 -19
- package/lib/ReactDOMOption.js +40 -26
- package/lib/ReactDOMSelect.js +3 -3
- package/lib/ReactDOMTextComponent.js +28 -26
- package/lib/ReactDOMTextarea.js +59 -32
- package/lib/ReactDOMTreeTraversal.js +18 -16
- package/lib/ReactDOMUnknownPropertyDevtool.js +41 -15
- package/lib/ReactDebugTool.js +250 -11
- package/lib/ReactDefaultInjection.js +2 -11
- package/lib/ReactElement.js +90 -25
- package/lib/ReactElementValidator.js +26 -81
- package/lib/ReactEventListener.js +2 -2
- package/lib/ReactFragment.js +8 -3
- package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
- package/lib/ReactHostOperationHistoryDevtool.js +37 -0
- package/lib/ReactInjection.js +2 -4
- package/lib/ReactInstanceHandles.js +8 -6
- package/lib/ReactLink.js +3 -0
- package/lib/ReactMount.js +43 -20
- package/lib/ReactMultiChild.js +51 -8
- package/lib/ReactNativeAttributePayload.js +5 -2
- package/lib/ReactNativeBaseComponent.js +7 -7
- package/lib/ReactNativeBridgeEventPlugin.js +1 -1
- package/lib/ReactNativeComponentTree.js +8 -6
- package/lib/ReactNativeDOMIDOperations.js +4 -8
- package/lib/ReactNativeDefaultInjection.js +9 -7
- package/lib/ReactNativeGlobalResponderHandler.js +1 -1
- package/lib/ReactNativeMount.js +25 -8
- package/lib/ReactNativeTagHandles.js +3 -1
- package/lib/ReactNativeTextComponent.js +18 -9
- package/lib/ReactNativeTreeTraversal.js +11 -11
- package/lib/ReactNodeTypes.js +5 -3
- package/lib/ReactNoop.js +76 -0
- package/lib/ReactOwner.js +4 -2
- package/lib/ReactPerf.js +473 -75
- package/lib/ReactPropTypes.js +23 -0
- package/lib/ReactReconcileTransaction.js +1 -1
- package/lib/ReactReconciler.js +57 -11
- package/lib/ReactServerRendering.js +24 -3
- package/lib/ReactServerRenderingTransaction.js +5 -1
- package/lib/ReactSimpleEmptyComponent.js +4 -4
- package/lib/ReactTestMount.js +126 -0
- package/lib/ReactTestReconcileTransaction.js +100 -0
- package/lib/ReactTestRenderer.js +133 -0
- package/lib/ReactTestUtils.js +25 -10
- package/lib/ReactTransitionChildMapping.js +7 -1
- package/lib/ReactTransitionGroup.js +44 -5
- package/lib/ReactUpdateQueue.js +9 -1
- package/lib/ReactUpdates.js +30 -11
- package/lib/ReactVersion.js +1 -1
- package/lib/ReactWithAddons.js +1 -1
- package/lib/ResponderEventPlugin.js +8 -6
- package/lib/ResponderTouchHistoryStore.js +6 -4
- package/lib/SimpleEventPlugin.js +3 -1
- package/lib/SyntheticEvent.js +2 -3
- package/lib/SyntheticUIEvent.js +1 -1
- package/lib/Transaction.js +4 -2
- package/lib/accumulate.js +3 -1
- package/lib/accumulateInto.js +3 -1
- package/lib/checkReactTypeSpec.js +71 -0
- package/lib/createReactNativeComponentClass.js +2 -2
- package/lib/dangerousStyleValue.js +3 -1
- package/lib/escapeTextContentForBrowser.js +96 -12
- package/lib/findDOMNode.js +8 -4
- package/lib/findNodeHandle.js +5 -3
- package/lib/flattenChildren.js +13 -4
- package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
- package/lib/instantiateReactComponent.js +44 -10
- package/lib/onlyChild.js +10 -5
- package/lib/reactComponentExpect.js +3 -3
- package/lib/reactProdInvariant.js +38 -0
- package/lib/setInnerHTML.js +17 -1
- package/lib/setTextContent.js +8 -0
- package/lib/shallowCompare.js +1 -0
- package/lib/traverseAllChildren.js +3 -1
- package/lib/update.js +16 -11
- package/package.json +2 -2
- package/lib/MetaMatchers.js +0 -118
- package/lib/ReactDebugInstanceMap.js +0 -102
- package/lib/ReactDefaultPerf.js +0 -316
- package/lib/ReactDefaultPerfAnalysis.js +0 -210
|
@@ -1,210 +0,0 @@
|
|
|
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
|
-
* @providesModule ReactDefaultPerfAnalysis
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
// Don't try to save users less than 1.2ms (a number I made up)
|
|
15
|
-
|
|
16
|
-
var _assign = require('object-assign');
|
|
17
|
-
|
|
18
|
-
var DONT_CARE_THRESHOLD = 1.2;
|
|
19
|
-
var DOM_OPERATION_TYPES = {
|
|
20
|
-
'_mountImageIntoNode': 'set innerHTML',
|
|
21
|
-
INSERT_MARKUP: 'set innerHTML',
|
|
22
|
-
MOVE_EXISTING: 'move',
|
|
23
|
-
REMOVE_NODE: 'remove',
|
|
24
|
-
SET_MARKUP: 'set innerHTML',
|
|
25
|
-
TEXT_CONTENT: 'set textContent',
|
|
26
|
-
'setValueForProperty': 'update attribute',
|
|
27
|
-
'setValueForAttribute': 'update attribute',
|
|
28
|
-
'deleteValueForProperty': 'remove attribute',
|
|
29
|
-
'setValueForStyles': 'update styles',
|
|
30
|
-
'replaceNodeWithMarkup': 'replace',
|
|
31
|
-
'replaceDelimitedText': 'replace'
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
function getTotalTime(measurements) {
|
|
35
|
-
// TODO: return number of DOM ops? could be misleading.
|
|
36
|
-
// TODO: measure dropped frames after reconcile?
|
|
37
|
-
// TODO: log total time of each reconcile and the top-level component
|
|
38
|
-
// class that triggered it.
|
|
39
|
-
var totalTime = 0;
|
|
40
|
-
for (var i = 0; i < measurements.length; i++) {
|
|
41
|
-
var measurement = measurements[i];
|
|
42
|
-
totalTime += measurement.totalTime;
|
|
43
|
-
}
|
|
44
|
-
return totalTime;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function getDOMSummary(measurements) {
|
|
48
|
-
var items = [];
|
|
49
|
-
measurements.forEach(function (measurement) {
|
|
50
|
-
Object.keys(measurement.writes).forEach(function (id) {
|
|
51
|
-
measurement.writes[id].forEach(function (write) {
|
|
52
|
-
items.push({
|
|
53
|
-
id: id,
|
|
54
|
-
type: DOM_OPERATION_TYPES[write.type] || write.type,
|
|
55
|
-
args: write.args
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
return items;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function getExclusiveSummary(measurements) {
|
|
64
|
-
var candidates = {};
|
|
65
|
-
var displayName;
|
|
66
|
-
|
|
67
|
-
for (var i = 0; i < measurements.length; i++) {
|
|
68
|
-
var measurement = measurements[i];
|
|
69
|
-
var allIDs = _assign({}, measurement.exclusive, measurement.inclusive);
|
|
70
|
-
|
|
71
|
-
for (var id in allIDs) {
|
|
72
|
-
displayName = measurement.displayNames[id].current;
|
|
73
|
-
|
|
74
|
-
candidates[displayName] = candidates[displayName] || {
|
|
75
|
-
componentName: displayName,
|
|
76
|
-
inclusive: 0,
|
|
77
|
-
exclusive: 0,
|
|
78
|
-
render: 0,
|
|
79
|
-
count: 0
|
|
80
|
-
};
|
|
81
|
-
if (measurement.render[id]) {
|
|
82
|
-
candidates[displayName].render += measurement.render[id];
|
|
83
|
-
}
|
|
84
|
-
if (measurement.exclusive[id]) {
|
|
85
|
-
candidates[displayName].exclusive += measurement.exclusive[id];
|
|
86
|
-
}
|
|
87
|
-
if (measurement.inclusive[id]) {
|
|
88
|
-
candidates[displayName].inclusive += measurement.inclusive[id];
|
|
89
|
-
}
|
|
90
|
-
if (measurement.counts[id]) {
|
|
91
|
-
candidates[displayName].count += measurement.counts[id];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Now make a sorted array with the results.
|
|
97
|
-
var arr = [];
|
|
98
|
-
for (displayName in candidates) {
|
|
99
|
-
if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
|
|
100
|
-
arr.push(candidates[displayName]);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
arr.sort(function (a, b) {
|
|
105
|
-
return b.exclusive - a.exclusive;
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
return arr;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function getInclusiveSummary(measurements, onlyClean) {
|
|
112
|
-
var candidates = {};
|
|
113
|
-
var inclusiveKey;
|
|
114
|
-
|
|
115
|
-
for (var i = 0; i < measurements.length; i++) {
|
|
116
|
-
var measurement = measurements[i];
|
|
117
|
-
var allIDs = _assign({}, measurement.exclusive, measurement.inclusive);
|
|
118
|
-
var cleanComponents;
|
|
119
|
-
|
|
120
|
-
if (onlyClean) {
|
|
121
|
-
cleanComponents = getUnchangedComponents(measurement);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
for (var id in allIDs) {
|
|
125
|
-
if (onlyClean && !cleanComponents[id]) {
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
var displayName = measurement.displayNames[id];
|
|
130
|
-
|
|
131
|
-
// Inclusive time is not useful for many components without knowing where
|
|
132
|
-
// they are instantiated. So we aggregate inclusive time with both the
|
|
133
|
-
// owner and current displayName as the key.
|
|
134
|
-
inclusiveKey = displayName.owner + ' > ' + displayName.current;
|
|
135
|
-
|
|
136
|
-
candidates[inclusiveKey] = candidates[inclusiveKey] || {
|
|
137
|
-
componentName: inclusiveKey,
|
|
138
|
-
time: 0,
|
|
139
|
-
count: 0
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
if (measurement.inclusive[id]) {
|
|
143
|
-
candidates[inclusiveKey].time += measurement.inclusive[id];
|
|
144
|
-
}
|
|
145
|
-
if (measurement.counts[id]) {
|
|
146
|
-
candidates[inclusiveKey].count += measurement.counts[id];
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Now make a sorted array with the results.
|
|
152
|
-
var arr = [];
|
|
153
|
-
for (inclusiveKey in candidates) {
|
|
154
|
-
if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
|
|
155
|
-
arr.push(candidates[inclusiveKey]);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
arr.sort(function (a, b) {
|
|
160
|
-
return b.time - a.time;
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
return arr;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function getUnchangedComponents(measurement) {
|
|
167
|
-
// For a given reconcile, look at which components did not actually
|
|
168
|
-
// render anything to the DOM and return a mapping of their ID to
|
|
169
|
-
// the amount of time it took to render the entire subtree.
|
|
170
|
-
var cleanComponents = {};
|
|
171
|
-
var writes = measurement.writes;
|
|
172
|
-
var hierarchy = measurement.hierarchy;
|
|
173
|
-
var dirtyComposites = {};
|
|
174
|
-
Object.keys(writes).forEach(function (id) {
|
|
175
|
-
writes[id].forEach(function (write) {
|
|
176
|
-
// Root mounting (innerHTML set) is recorded with an ID of ''
|
|
177
|
-
if (id !== '' && hierarchy.hasOwnProperty(id)) {
|
|
178
|
-
hierarchy[id].forEach(function (c) {
|
|
179
|
-
return dirtyComposites[c] = true;
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
var allIDs = _assign({}, measurement.exclusive, measurement.inclusive);
|
|
185
|
-
|
|
186
|
-
for (var id in allIDs) {
|
|
187
|
-
var isDirty = false;
|
|
188
|
-
// See if any of the DOM operations applied to this component's subtree.
|
|
189
|
-
if (dirtyComposites[id]) {
|
|
190
|
-
isDirty = true;
|
|
191
|
-
}
|
|
192
|
-
// check if component newly created
|
|
193
|
-
if (measurement.created[id]) {
|
|
194
|
-
isDirty = true;
|
|
195
|
-
}
|
|
196
|
-
if (!isDirty && measurement.counts[id] > 0) {
|
|
197
|
-
cleanComponents[id] = true;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return cleanComponents;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
var ReactDefaultPerfAnalysis = {
|
|
204
|
-
getExclusiveSummary: getExclusiveSummary,
|
|
205
|
-
getInclusiveSummary: getInclusiveSummary,
|
|
206
|
-
getDOMSummary: getDOMSummary,
|
|
207
|
-
getTotalTime: getTotalTime
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
module.exports = ReactDefaultPerfAnalysis;
|