react 15.3.2-rc.1 → 15.4.0-rc.3

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.
Files changed (209) hide show
  1. package/dist/react-with-addons.js +3863 -21388
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2639 -19486
  4. package/dist/react.min.js +2 -6
  5. package/lib/KeyEscapeUtils.js +0 -1
  6. package/lib/LinkedStateMixin.js +1 -3
  7. package/lib/PooledClass.js +3 -1
  8. package/lib/React.js +0 -1
  9. package/lib/ReactAddonsDOMDependencies.js +35 -0
  10. package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
  11. package/lib/ReactCSSTransitionGroup.js +60 -43
  12. package/lib/ReactCSSTransitionGroupChild.js +2 -3
  13. package/lib/ReactChildren.js +0 -1
  14. package/lib/ReactClass.js +38 -54
  15. package/lib/ReactComponent.js +0 -1
  16. package/lib/ReactComponentTreeDevtool.js +0 -1
  17. package/lib/ReactComponentTreeHook.js +84 -101
  18. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
  19. package/lib/ReactComponentWithPureRenderMixin.js +0 -1
  20. package/lib/ReactCurrentOwner.js +1 -2
  21. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
  22. package/lib/ReactDOMFactories.js +0 -1
  23. package/lib/ReactElement.js +6 -14
  24. package/lib/ReactElementSymbol.js +19 -0
  25. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
  26. package/lib/ReactElementValidator.js +1 -3
  27. package/lib/ReactFragment.js +0 -1
  28. package/lib/ReactLink.js +0 -1
  29. package/lib/ReactNoopUpdateQueue.js +0 -1
  30. package/lib/ReactPropTypeLocationNames.js +1 -1
  31. package/lib/ReactPropTypeLocations.js +2 -12
  32. package/lib/ReactPropTypes.js +5 -3
  33. package/lib/ReactPropTypesSecret.js +1 -1
  34. package/lib/ReactPureComponent.js +0 -1
  35. package/lib/ReactStateSetters.js +0 -1
  36. package/lib/ReactTransitionChildMapping.js +0 -1
  37. package/lib/ReactTransitionEvents.js +1 -2
  38. package/lib/ReactTransitionGroup.js +145 -142
  39. package/lib/ReactUMDEntry.js +11 -6
  40. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
  41. package/lib/ReactVersion.js +1 -2
  42. package/lib/ReactWithAddons.js +15 -3
  43. package/lib/ReactWithAddonsUMDEntry.js +11 -6
  44. package/lib/canDefineProperty.js +2 -1
  45. package/lib/checkReactTypeSpec.js +0 -1
  46. package/lib/deprecated.js +0 -1
  47. package/lib/flattenChildren.js +0 -1
  48. package/lib/getIteratorFn.js +0 -1
  49. package/lib/onlyChild.js +0 -1
  50. package/lib/reactProdInvariant.js +0 -1
  51. package/lib/sliceChildren.js +0 -1
  52. package/lib/traverseAllChildren.js +11 -3
  53. package/lib/update.js +6 -8
  54. package/package.json +1 -1
  55. package/lib/AutoFocusUtils.js +0 -24
  56. package/lib/BeforeInputEventPlugin.js +0 -390
  57. package/lib/CSSProperty.js +0 -148
  58. package/lib/CSSPropertyOperations.js +0 -205
  59. package/lib/CallbackQueue.js +0 -106
  60. package/lib/ChangeEventPlugin.js +0 -325
  61. package/lib/DOMChildrenOperations.js +0 -194
  62. package/lib/DOMLazyTree.js +0 -118
  63. package/lib/DOMProperty.js +0 -206
  64. package/lib/DOMPropertyOperations.js +0 -221
  65. package/lib/Danger.js +0 -48
  66. package/lib/DefaultEventPluginOrder.js +0 -27
  67. package/lib/DisabledInputUtils.js +0 -50
  68. package/lib/EnterLeaveEventPlugin.js +0 -105
  69. package/lib/EventConstants.js +0 -97
  70. package/lib/EventPluginHub.js +0 -251
  71. package/lib/EventPluginRegistry.js +0 -247
  72. package/lib/EventPluginUtils.js +0 -229
  73. package/lib/EventPropagators.js +0 -137
  74. package/lib/FallbackCompositionState.js +0 -95
  75. package/lib/HTMLDOMPropertyConfig.js +0 -212
  76. package/lib/LinkedValueUtils.js +0 -136
  77. package/lib/NativeMethodsMixin.js +0 -167
  78. package/lib/ReactBrowserEventEmitter.js +0 -330
  79. package/lib/ReactChildReconciler.js +0 -154
  80. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  81. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  82. package/lib/ReactComponentEnvironment.js +0 -45
  83. package/lib/ReactComponentTreeTestUtils.js +0 -87
  84. package/lib/ReactCompositeComponent.js +0 -904
  85. package/lib/ReactDOM.js +0 -110
  86. package/lib/ReactDOMButton.js +0 -24
  87. package/lib/ReactDOMComponent.js +0 -1006
  88. package/lib/ReactDOMComponentTree.js +0 -188
  89. package/lib/ReactDOMContainerInfo.js +0 -33
  90. package/lib/ReactDOMEmptyComponent.js +0 -60
  91. package/lib/ReactDOMFiber.js +0 -76
  92. package/lib/ReactDOMIDOperations.js +0 -34
  93. package/lib/ReactDOMInput.js +0 -269
  94. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  95. package/lib/ReactDOMOption.js +0 -123
  96. package/lib/ReactDOMSelect.js +0 -201
  97. package/lib/ReactDOMSelection.js +0 -212
  98. package/lib/ReactDOMServer.js +0 -26
  99. package/lib/ReactDOMTextComponent.js +0 -164
  100. package/lib/ReactDOMTextarea.js +0 -155
  101. package/lib/ReactDOMTreeTraversal.js +0 -136
  102. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  103. package/lib/ReactDebugTool.js +0 -301
  104. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  105. package/lib/ReactDefaultInjection.js +0 -84
  106. package/lib/ReactEmptyComponent.js +0 -30
  107. package/lib/ReactErrorUtils.js +0 -76
  108. package/lib/ReactEventEmitterMixin.js +0 -33
  109. package/lib/ReactEventListener.js +0 -157
  110. package/lib/ReactFeatureFlags.js +0 -22
  111. package/lib/ReactHostComponent.js +0 -76
  112. package/lib/ReactHostOperationHistoryHook.js +0 -37
  113. package/lib/ReactInjection.js +0 -36
  114. package/lib/ReactInputSelection.js +0 -124
  115. package/lib/ReactInstanceHandles.js +0 -302
  116. package/lib/ReactInstanceMap.js +0 -48
  117. package/lib/ReactInstrumentation.js +0 -21
  118. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  119. package/lib/ReactMarkupChecksum.js +0 -50
  120. package/lib/ReactMount.js +0 -534
  121. package/lib/ReactMultiChild.js +0 -451
  122. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  123. package/lib/ReactNative.js +0 -71
  124. package/lib/ReactNativeAttributePayload.js +0 -371
  125. package/lib/ReactNativeBaseComponent.js +0 -198
  126. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  127. package/lib/ReactNativeComponentEnvironment.js +0 -31
  128. package/lib/ReactNativeComponentTree.js +0 -68
  129. package/lib/ReactNativeContainerInfo.js +0 -21
  130. package/lib/ReactNativeDOMIDOperations.js +0 -79
  131. package/lib/ReactNativeDefaultInjection.js +0 -101
  132. package/lib/ReactNativeEventEmitter.js +0 -191
  133. package/lib/ReactNativeEventPluginOrder.js +0 -16
  134. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  135. package/lib/ReactNativeMount.js +0 -193
  136. package/lib/ReactNativePropRegistry.js +0 -52
  137. package/lib/ReactNativeReconcileTransaction.js +0 -129
  138. package/lib/ReactNativeTagHandles.js +0 -56
  139. package/lib/ReactNativeTextComponent.js +0 -71
  140. package/lib/ReactNativeTreeTraversal.js +0 -127
  141. package/lib/ReactNodeTypes.js +0 -40
  142. package/lib/ReactNoop.js +0 -173
  143. package/lib/ReactOwner.js +0 -94
  144. package/lib/ReactPerf.js +0 -494
  145. package/lib/ReactReconcileTransaction.js +0 -178
  146. package/lib/ReactReconciler.js +0 -168
  147. package/lib/ReactRef.js +0 -80
  148. package/lib/ReactServerBatchingStrategy.js +0 -22
  149. package/lib/ReactServerRendering.js +0 -90
  150. package/lib/ReactServerRenderingTransaction.js +0 -90
  151. package/lib/ReactServerUpdateQueue.js +0 -141
  152. package/lib/ReactSimpleEmptyComponent.js +0 -37
  153. package/lib/ReactTestMount.js +0 -126
  154. package/lib/ReactTestReconcileTransaction.js +0 -121
  155. package/lib/ReactTestRenderer.js +0 -144
  156. package/lib/ReactTestUtils.js +0 -518
  157. package/lib/ReactUpdateQueue.js +0 -226
  158. package/lib/ReactUpdates.js +0 -251
  159. package/lib/ResponderEventPlugin.js +0 -510
  160. package/lib/ResponderSyntheticEvent.js +0 -39
  161. package/lib/ResponderTouchHistoryStore.js +0 -184
  162. package/lib/SVGDOMPropertyConfig.js +0 -302
  163. package/lib/SelectEventPlugin.js +0 -196
  164. package/lib/SimpleEventPlugin.js +0 -635
  165. package/lib/SyntheticAnimationEvent.js +0 -39
  166. package/lib/SyntheticClipboardEvent.js +0 -38
  167. package/lib/SyntheticCompositionEvent.js +0 -36
  168. package/lib/SyntheticDragEvent.js +0 -36
  169. package/lib/SyntheticEvent.js +0 -268
  170. package/lib/SyntheticFocusEvent.js +0 -36
  171. package/lib/SyntheticInputEvent.js +0 -37
  172. package/lib/SyntheticKeyboardEvent.js +0 -84
  173. package/lib/SyntheticMouseEvent.js +0 -72
  174. package/lib/SyntheticTouchEvent.js +0 -45
  175. package/lib/SyntheticTransitionEvent.js +0 -39
  176. package/lib/SyntheticUIEvent.js +0 -59
  177. package/lib/SyntheticWheelEvent.js +0 -54
  178. package/lib/TapEventPlugin.js +0 -110
  179. package/lib/TouchHistoryMath.js +0 -99
  180. package/lib/Transaction.js +0 -233
  181. package/lib/ViewportMetrics.js +0 -27
  182. package/lib/accumulate.js +0 -46
  183. package/lib/accumulateInto.js +0 -58
  184. package/lib/adler32.js +0 -44
  185. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  186. package/lib/createReactNativeComponentClass.js +0 -42
  187. package/lib/dangerousStyleValue.js +0 -79
  188. package/lib/escapeTextContentForBrowser.js +0 -123
  189. package/lib/findDOMNode.js +0 -60
  190. package/lib/findNodeHandle.js +0 -91
  191. package/lib/forEachAccumulated.js +0 -31
  192. package/lib/getEventCharCode.js +0 -50
  193. package/lib/getEventKey.js +0 -102
  194. package/lib/getEventModifierState.js +0 -43
  195. package/lib/getEventTarget.js +0 -35
  196. package/lib/getHostComponentFromComposite.js +0 -30
  197. package/lib/getNodeForCharacterOffset.js +0 -74
  198. package/lib/getTestDocument.js +0 -21
  199. package/lib/getTextContentAccessor.js +0 -33
  200. package/lib/getVendorPrefixedEventName.js +0 -101
  201. package/lib/instantiateReactComponent.js +0 -119
  202. package/lib/isEventSupported.js +0 -60
  203. package/lib/isTextInputElement.js +0 -51
  204. package/lib/quoteAttributeValueForBrowser.js +0 -26
  205. package/lib/reactComponentExpect.js +0 -217
  206. package/lib/setInnerHTML.js +0 -98
  207. package/lib/setTextContent.js +0 -48
  208. package/lib/shouldUpdateReactComponent.js +0 -42
  209. package/lib/validateDOMNesting.js +0 -382
package/lib/ReactPerf.js DELETED
@@ -1,494 +0,0 @@
1
- /**
2
- * Copyright 2016-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 ReactPerf
10
- */
11
-
12
- 'use strict';
13
-
14
- var _assign = require('object-assign');
15
-
16
- 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; };
17
-
18
- var ReactDebugTool = require('./ReactDebugTool');
19
- var warning = require('fbjs/lib/warning');
20
- var alreadyWarned = false;
21
-
22
- function roundFloat(val) {
23
- var base = arguments.length <= 1 || arguments[1] === undefined ? 2 : arguments[1];
24
-
25
- var n = Math.pow(10, base);
26
- return Math.floor(val * n) / n;
27
- }
28
-
29
- function warnInProduction() {
30
- if (alreadyWarned) {
31
- return;
32
- }
33
- alreadyWarned = true;
34
- if (typeof console !== 'undefined') {
35
- console.error('ReactPerf is not supported in the production builds of React. ' + 'To collect measurements, please use the development build of React instead.');
36
- }
37
- }
38
-
39
- function getLastMeasurements() {
40
- if (!(process.env.NODE_ENV !== 'production')) {
41
- warnInProduction();
42
- return [];
43
- }
44
-
45
- return ReactDebugTool.getFlushHistory();
46
- }
47
-
48
- function getExclusive() {
49
- var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getLastMeasurements() : arguments[0];
50
-
51
- if (!(process.env.NODE_ENV !== 'production')) {
52
- warnInProduction();
53
- return [];
54
- }
55
-
56
- var aggregatedStats = {};
57
- var affectedIDs = {};
58
-
59
- function updateAggregatedStats(treeSnapshot, instanceID, timerType, applyUpdate) {
60
- var displayName = treeSnapshot[instanceID].displayName;
61
-
62
- var key = displayName;
63
- var stats = aggregatedStats[key];
64
- if (!stats) {
65
- affectedIDs[key] = {};
66
- stats = aggregatedStats[key] = {
67
- key: key,
68
- instanceCount: 0,
69
- counts: {},
70
- durations: {},
71
- totalDuration: 0
72
- };
73
- }
74
- if (!stats.durations[timerType]) {
75
- stats.durations[timerType] = 0;
76
- }
77
- if (!stats.counts[timerType]) {
78
- stats.counts[timerType] = 0;
79
- }
80
- affectedIDs[key][instanceID] = true;
81
- applyUpdate(stats);
82
- }
83
-
84
- flushHistory.forEach(function (flush) {
85
- var measurements = flush.measurements;
86
- var treeSnapshot = flush.treeSnapshot;
87
-
88
- measurements.forEach(function (measurement) {
89
- var duration = measurement.duration;
90
- var instanceID = measurement.instanceID;
91
- var timerType = measurement.timerType;
92
-
93
- updateAggregatedStats(treeSnapshot, instanceID, timerType, function (stats) {
94
- stats.totalDuration += duration;
95
- stats.durations[timerType] += duration;
96
- stats.counts[timerType]++;
97
- });
98
- });
99
- });
100
-
101
- return Object.keys(aggregatedStats).map(function (key) {
102
- return _extends({}, aggregatedStats[key], {
103
- instanceCount: Object.keys(affectedIDs[key]).length
104
- });
105
- }).sort(function (a, b) {
106
- return b.totalDuration - a.totalDuration;
107
- });
108
- }
109
-
110
- function getInclusive() {
111
- var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getLastMeasurements() : arguments[0];
112
-
113
- if (!(process.env.NODE_ENV !== 'production')) {
114
- warnInProduction();
115
- return [];
116
- }
117
-
118
- var aggregatedStats = {};
119
- var affectedIDs = {};
120
-
121
- function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) {
122
- var _treeSnapshot$instanc = treeSnapshot[instanceID];
123
- var displayName = _treeSnapshot$instanc.displayName;
124
- var ownerID = _treeSnapshot$instanc.ownerID;
125
-
126
- var owner = treeSnapshot[ownerID];
127
- var key = (owner ? owner.displayName + ' > ' : '') + displayName;
128
- var stats = aggregatedStats[key];
129
- if (!stats) {
130
- affectedIDs[key] = {};
131
- stats = aggregatedStats[key] = {
132
- key: key,
133
- instanceCount: 0,
134
- inclusiveRenderDuration: 0,
135
- renderCount: 0
136
- };
137
- }
138
- affectedIDs[key][instanceID] = true;
139
- applyUpdate(stats);
140
- }
141
-
142
- var isCompositeByID = {};
143
- flushHistory.forEach(function (flush) {
144
- var measurements = flush.measurements;
145
-
146
- measurements.forEach(function (measurement) {
147
- var instanceID = measurement.instanceID;
148
- var timerType = measurement.timerType;
149
-
150
- if (timerType !== 'render') {
151
- return;
152
- }
153
- isCompositeByID[instanceID] = true;
154
- });
155
- });
156
-
157
- flushHistory.forEach(function (flush) {
158
- var measurements = flush.measurements;
159
- var treeSnapshot = flush.treeSnapshot;
160
-
161
- measurements.forEach(function (measurement) {
162
- var duration = measurement.duration;
163
- var instanceID = measurement.instanceID;
164
- var timerType = measurement.timerType;
165
-
166
- if (timerType !== 'render') {
167
- return;
168
- }
169
- updateAggregatedStats(treeSnapshot, instanceID, function (stats) {
170
- stats.renderCount++;
171
- });
172
- var nextParentID = instanceID;
173
- while (nextParentID) {
174
- // As we traverse parents, only count inclusive time towards composites.
175
- // We know something is a composite if its render() was called.
176
- if (isCompositeByID[nextParentID]) {
177
- updateAggregatedStats(treeSnapshot, nextParentID, function (stats) {
178
- stats.inclusiveRenderDuration += duration;
179
- });
180
- }
181
- nextParentID = treeSnapshot[nextParentID].parentID;
182
- }
183
- });
184
- });
185
-
186
- return Object.keys(aggregatedStats).map(function (key) {
187
- return _extends({}, aggregatedStats[key], {
188
- instanceCount: Object.keys(affectedIDs[key]).length
189
- });
190
- }).sort(function (a, b) {
191
- return b.inclusiveRenderDuration - a.inclusiveRenderDuration;
192
- });
193
- }
194
-
195
- function getWasted() {
196
- var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getLastMeasurements() : arguments[0];
197
-
198
- if (!(process.env.NODE_ENV !== 'production')) {
199
- warnInProduction();
200
- return [];
201
- }
202
-
203
- var aggregatedStats = {};
204
- var affectedIDs = {};
205
-
206
- function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) {
207
- var _treeSnapshot$instanc2 = treeSnapshot[instanceID];
208
- var displayName = _treeSnapshot$instanc2.displayName;
209
- var ownerID = _treeSnapshot$instanc2.ownerID;
210
-
211
- var owner = treeSnapshot[ownerID];
212
- var key = (owner ? owner.displayName + ' > ' : '') + displayName;
213
- var stats = aggregatedStats[key];
214
- if (!stats) {
215
- affectedIDs[key] = {};
216
- stats = aggregatedStats[key] = {
217
- key: key,
218
- instanceCount: 0,
219
- inclusiveRenderDuration: 0,
220
- renderCount: 0
221
- };
222
- }
223
- affectedIDs[key][instanceID] = true;
224
- applyUpdate(stats);
225
- }
226
-
227
- flushHistory.forEach(function (flush) {
228
- var measurements = flush.measurements;
229
- var treeSnapshot = flush.treeSnapshot;
230
- var operations = flush.operations;
231
-
232
- var isDefinitelyNotWastedByID = {};
233
-
234
- // Find host components associated with an operation in this batch.
235
- // Mark all components in their parent tree as definitely not wasted.
236
- operations.forEach(function (operation) {
237
- var instanceID = operation.instanceID;
238
-
239
- var nextParentID = instanceID;
240
- while (nextParentID) {
241
- isDefinitelyNotWastedByID[nextParentID] = true;
242
- nextParentID = treeSnapshot[nextParentID].parentID;
243
- }
244
- });
245
-
246
- // Find composite components that rendered in this batch.
247
- // These are potential candidates for being wasted renders.
248
- var renderedCompositeIDs = {};
249
- measurements.forEach(function (measurement) {
250
- var instanceID = measurement.instanceID;
251
- var timerType = measurement.timerType;
252
-
253
- if (timerType !== 'render') {
254
- return;
255
- }
256
- renderedCompositeIDs[instanceID] = true;
257
- });
258
-
259
- measurements.forEach(function (measurement) {
260
- var duration = measurement.duration;
261
- var instanceID = measurement.instanceID;
262
- var timerType = measurement.timerType;
263
-
264
- if (timerType !== 'render') {
265
- return;
266
- }
267
-
268
- // If there was a DOM update below this component, or it has just been
269
- // mounted, its render() is not considered wasted.
270
- var updateCount = treeSnapshot[instanceID].updateCount;
271
-
272
- if (isDefinitelyNotWastedByID[instanceID] || updateCount === 0) {
273
- return;
274
- }
275
-
276
- // We consider this render() wasted.
277
- updateAggregatedStats(treeSnapshot, instanceID, function (stats) {
278
- stats.renderCount++;
279
- });
280
-
281
- var nextParentID = instanceID;
282
- while (nextParentID) {
283
- // Any parents rendered during this batch are considered wasted
284
- // unless we previously marked them as dirty.
285
- var isWasted = renderedCompositeIDs[nextParentID] && !isDefinitelyNotWastedByID[nextParentID];
286
- if (isWasted) {
287
- updateAggregatedStats(treeSnapshot, nextParentID, function (stats) {
288
- stats.inclusiveRenderDuration += duration;
289
- });
290
- }
291
- nextParentID = treeSnapshot[nextParentID].parentID;
292
- }
293
- });
294
- });
295
-
296
- return Object.keys(aggregatedStats).map(function (key) {
297
- return _extends({}, aggregatedStats[key], {
298
- instanceCount: Object.keys(affectedIDs[key]).length
299
- });
300
- }).sort(function (a, b) {
301
- return b.inclusiveRenderDuration - a.inclusiveRenderDuration;
302
- });
303
- }
304
-
305
- function getOperations() {
306
- var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getLastMeasurements() : arguments[0];
307
-
308
- if (!(process.env.NODE_ENV !== 'production')) {
309
- warnInProduction();
310
- return [];
311
- }
312
-
313
- var stats = [];
314
- flushHistory.forEach(function (flush, flushIndex) {
315
- var operations = flush.operations;
316
- var treeSnapshot = flush.treeSnapshot;
317
-
318
- operations.forEach(function (operation) {
319
- var instanceID = operation.instanceID;
320
- var type = operation.type;
321
- var payload = operation.payload;
322
- var _treeSnapshot$instanc3 = treeSnapshot[instanceID];
323
- var displayName = _treeSnapshot$instanc3.displayName;
324
- var ownerID = _treeSnapshot$instanc3.ownerID;
325
-
326
- var owner = treeSnapshot[ownerID];
327
- var key = (owner ? owner.displayName + ' > ' : '') + displayName;
328
-
329
- stats.push({
330
- flushIndex: flushIndex,
331
- instanceID: instanceID,
332
- key: key,
333
- type: type,
334
- ownerID: ownerID,
335
- payload: payload
336
- });
337
- });
338
- });
339
- return stats;
340
- }
341
-
342
- function printExclusive(flushHistory) {
343
- if (!(process.env.NODE_ENV !== 'production')) {
344
- warnInProduction();
345
- return;
346
- }
347
-
348
- var stats = getExclusive(flushHistory);
349
- var table = stats.map(function (item) {
350
- var key = item.key;
351
- var instanceCount = item.instanceCount;
352
- var totalDuration = item.totalDuration;
353
-
354
- var renderCount = item.counts.render || 0;
355
- var renderDuration = item.durations.render || 0;
356
- return {
357
- 'Component': key,
358
- 'Total time (ms)': roundFloat(totalDuration),
359
- 'Instance count': instanceCount,
360
- 'Total render time (ms)': roundFloat(renderDuration),
361
- 'Average render time (ms)': renderCount ? roundFloat(renderDuration / renderCount) : undefined,
362
- 'Render count': renderCount,
363
- 'Total lifecycle time (ms)': roundFloat(totalDuration - renderDuration)
364
- };
365
- });
366
- console.table(table);
367
- }
368
-
369
- function printInclusive(flushHistory) {
370
- if (!(process.env.NODE_ENV !== 'production')) {
371
- warnInProduction();
372
- return;
373
- }
374
-
375
- var stats = getInclusive(flushHistory);
376
- var table = stats.map(function (item) {
377
- var key = item.key;
378
- var instanceCount = item.instanceCount;
379
- var inclusiveRenderDuration = item.inclusiveRenderDuration;
380
- var renderCount = item.renderCount;
381
-
382
- return {
383
- 'Owner > Component': key,
384
- 'Inclusive render time (ms)': roundFloat(inclusiveRenderDuration),
385
- 'Instance count': instanceCount,
386
- 'Render count': renderCount
387
- };
388
- });
389
- console.table(table);
390
- }
391
-
392
- function printWasted(flushHistory) {
393
- if (!(process.env.NODE_ENV !== 'production')) {
394
- warnInProduction();
395
- return;
396
- }
397
-
398
- var stats = getWasted(flushHistory);
399
- var table = stats.map(function (item) {
400
- var key = item.key;
401
- var instanceCount = item.instanceCount;
402
- var inclusiveRenderDuration = item.inclusiveRenderDuration;
403
- var renderCount = item.renderCount;
404
-
405
- return {
406
- 'Owner > Component': key,
407
- 'Inclusive wasted time (ms)': roundFloat(inclusiveRenderDuration),
408
- 'Instance count': instanceCount,
409
- 'Render count': renderCount
410
- };
411
- });
412
- console.table(table);
413
- }
414
-
415
- function printOperations(flushHistory) {
416
- if (!(process.env.NODE_ENV !== 'production')) {
417
- warnInProduction();
418
- return;
419
- }
420
-
421
- var stats = getOperations(flushHistory);
422
- var table = stats.map(function (stat) {
423
- return {
424
- 'Owner > Node': stat.key,
425
- 'Operation': stat.type,
426
- 'Payload': typeof stat.payload === 'object' ? JSON.stringify(stat.payload) : stat.payload,
427
- 'Flush index': stat.flushIndex,
428
- 'Owner Component ID': stat.ownerID,
429
- 'DOM Component ID': stat.instanceID
430
- };
431
- });
432
- console.table(table);
433
- }
434
-
435
- var warnedAboutPrintDOM = false;
436
- function printDOM(measurements) {
437
- process.env.NODE_ENV !== 'production' ? warning(warnedAboutPrintDOM, '`ReactPerf.printDOM(...)` is deprecated. Use ' + '`ReactPerf.printOperations(...)` instead.') : void 0;
438
- warnedAboutPrintDOM = true;
439
- return printOperations(measurements);
440
- }
441
-
442
- var warnedAboutGetMeasurementsSummaryMap = false;
443
- function getMeasurementsSummaryMap(measurements) {
444
- process.env.NODE_ENV !== 'production' ? warning(warnedAboutGetMeasurementsSummaryMap, '`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use ' + '`ReactPerf.getWasted(...)` instead.') : void 0;
445
- warnedAboutGetMeasurementsSummaryMap = true;
446
- return getWasted(measurements);
447
- }
448
-
449
- function start() {
450
- if (!(process.env.NODE_ENV !== 'production')) {
451
- warnInProduction();
452
- return;
453
- }
454
-
455
- ReactDebugTool.beginProfiling();
456
- }
457
-
458
- function stop() {
459
- if (!(process.env.NODE_ENV !== 'production')) {
460
- warnInProduction();
461
- return;
462
- }
463
-
464
- ReactDebugTool.endProfiling();
465
- }
466
-
467
- function isRunning() {
468
- if (!(process.env.NODE_ENV !== 'production')) {
469
- warnInProduction();
470
- return false;
471
- }
472
-
473
- return ReactDebugTool.isProfiling();
474
- }
475
-
476
- var ReactPerfAnalysis = {
477
- getLastMeasurements: getLastMeasurements,
478
- getExclusive: getExclusive,
479
- getInclusive: getInclusive,
480
- getWasted: getWasted,
481
- getOperations: getOperations,
482
- printExclusive: printExclusive,
483
- printInclusive: printInclusive,
484
- printWasted: printWasted,
485
- printOperations: printOperations,
486
- start: start,
487
- stop: stop,
488
- isRunning: isRunning,
489
- // Deprecated:
490
- printDOM: printDOM,
491
- getMeasurementsSummaryMap: getMeasurementsSummaryMap
492
- };
493
-
494
- module.exports = ReactPerfAnalysis;