react 15.3.2 → 15.4.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.
Files changed (189) hide show
  1. package/dist/react-with-addons.js +3898 -21383
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2672 -19494
  4. package/dist/react.min.js +2 -6
  5. package/lib/LinkedStateMixin.js +1 -2
  6. package/lib/PooledClass.js +3 -0
  7. package/lib/ReactAddonsDOMDependencies.js +36 -0
  8. package/lib/ReactAddonsDOMDependenciesUMDShim.js +32 -0
  9. package/lib/ReactCSSTransitionGroup.js +60 -42
  10. package/lib/ReactCSSTransitionGroupChild.js +2 -2
  11. package/lib/ReactClass.js +38 -53
  12. package/lib/ReactComponentTreeHook.js +84 -100
  13. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +5 -7
  14. package/lib/ReactCurrentOwner.js +1 -1
  15. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +6 -4
  16. package/lib/ReactElement.js +6 -13
  17. package/lib/ReactElementSymbol.js +20 -0
  18. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +4 -9
  19. package/lib/ReactElementValidator.js +1 -2
  20. package/lib/ReactPropTypeLocationNames.js +1 -0
  21. package/lib/ReactPropTypeLocations.js +2 -11
  22. package/lib/ReactPropTypes.js +5 -2
  23. package/lib/ReactPropTypesSecret.js +1 -0
  24. package/lib/ReactTransitionEvents.js +1 -1
  25. package/lib/ReactTransitionGroup.js +145 -141
  26. package/lib/ReactUMDEntry.js +11 -5
  27. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +4 -6
  28. package/lib/ReactVersion.js +1 -1
  29. package/lib/ReactWithAddons.js +15 -2
  30. package/lib/ReactWithAddonsUMDEntry.js +11 -5
  31. package/lib/canDefineProperty.js +2 -0
  32. package/lib/traverseAllChildren.js +11 -2
  33. package/lib/update.js +6 -7
  34. package/package.json +1 -1
  35. package/lib/AutoFocusUtils.js +0 -24
  36. package/lib/BeforeInputEventPlugin.js +0 -390
  37. package/lib/CSSProperty.js +0 -148
  38. package/lib/CSSPropertyOperations.js +0 -205
  39. package/lib/CallbackQueue.js +0 -106
  40. package/lib/ChangeEventPlugin.js +0 -325
  41. package/lib/DOMChildrenOperations.js +0 -194
  42. package/lib/DOMLazyTree.js +0 -118
  43. package/lib/DOMProperty.js +0 -206
  44. package/lib/DOMPropertyOperations.js +0 -221
  45. package/lib/Danger.js +0 -48
  46. package/lib/DefaultEventPluginOrder.js +0 -27
  47. package/lib/DisabledInputUtils.js +0 -50
  48. package/lib/EnterLeaveEventPlugin.js +0 -105
  49. package/lib/EventConstants.js +0 -97
  50. package/lib/EventPluginHub.js +0 -251
  51. package/lib/EventPluginRegistry.js +0 -247
  52. package/lib/EventPluginUtils.js +0 -229
  53. package/lib/EventPropagators.js +0 -137
  54. package/lib/FallbackCompositionState.js +0 -95
  55. package/lib/HTMLDOMPropertyConfig.js +0 -212
  56. package/lib/LinkedValueUtils.js +0 -136
  57. package/lib/NativeMethodsMixin.js +0 -167
  58. package/lib/ReactBrowserEventEmitter.js +0 -330
  59. package/lib/ReactChildReconciler.js +0 -154
  60. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  61. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  62. package/lib/ReactComponentEnvironment.js +0 -45
  63. package/lib/ReactComponentTreeTestUtils.js +0 -87
  64. package/lib/ReactCompositeComponent.js +0 -904
  65. package/lib/ReactDOM.js +0 -110
  66. package/lib/ReactDOMButton.js +0 -24
  67. package/lib/ReactDOMComponent.js +0 -1006
  68. package/lib/ReactDOMComponentTree.js +0 -188
  69. package/lib/ReactDOMContainerInfo.js +0 -33
  70. package/lib/ReactDOMEmptyComponent.js +0 -60
  71. package/lib/ReactDOMFiber.js +0 -76
  72. package/lib/ReactDOMIDOperations.js +0 -34
  73. package/lib/ReactDOMInput.js +0 -269
  74. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  75. package/lib/ReactDOMOption.js +0 -123
  76. package/lib/ReactDOMSelect.js +0 -201
  77. package/lib/ReactDOMSelection.js +0 -212
  78. package/lib/ReactDOMServer.js +0 -26
  79. package/lib/ReactDOMTextComponent.js +0 -164
  80. package/lib/ReactDOMTextarea.js +0 -155
  81. package/lib/ReactDOMTreeTraversal.js +0 -136
  82. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  83. package/lib/ReactDebugTool.js +0 -301
  84. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  85. package/lib/ReactDefaultInjection.js +0 -84
  86. package/lib/ReactEmptyComponent.js +0 -30
  87. package/lib/ReactErrorUtils.js +0 -76
  88. package/lib/ReactEventEmitterMixin.js +0 -33
  89. package/lib/ReactEventListener.js +0 -157
  90. package/lib/ReactFeatureFlags.js +0 -22
  91. package/lib/ReactHostComponent.js +0 -76
  92. package/lib/ReactHostOperationHistoryHook.js +0 -37
  93. package/lib/ReactInjection.js +0 -36
  94. package/lib/ReactInputSelection.js +0 -124
  95. package/lib/ReactInstanceHandles.js +0 -302
  96. package/lib/ReactInstanceMap.js +0 -48
  97. package/lib/ReactInstrumentation.js +0 -21
  98. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  99. package/lib/ReactMarkupChecksum.js +0 -50
  100. package/lib/ReactMount.js +0 -534
  101. package/lib/ReactMultiChild.js +0 -451
  102. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  103. package/lib/ReactNative.js +0 -71
  104. package/lib/ReactNativeAttributePayload.js +0 -371
  105. package/lib/ReactNativeBaseComponent.js +0 -198
  106. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  107. package/lib/ReactNativeComponentEnvironment.js +0 -31
  108. package/lib/ReactNativeComponentTree.js +0 -68
  109. package/lib/ReactNativeContainerInfo.js +0 -21
  110. package/lib/ReactNativeDOMIDOperations.js +0 -79
  111. package/lib/ReactNativeDefaultInjection.js +0 -101
  112. package/lib/ReactNativeEventEmitter.js +0 -191
  113. package/lib/ReactNativeEventPluginOrder.js +0 -16
  114. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  115. package/lib/ReactNativeMount.js +0 -193
  116. package/lib/ReactNativePropRegistry.js +0 -52
  117. package/lib/ReactNativeReconcileTransaction.js +0 -129
  118. package/lib/ReactNativeTagHandles.js +0 -56
  119. package/lib/ReactNativeTextComponent.js +0 -71
  120. package/lib/ReactNativeTreeTraversal.js +0 -127
  121. package/lib/ReactNodeTypes.js +0 -40
  122. package/lib/ReactNoop.js +0 -173
  123. package/lib/ReactOwner.js +0 -94
  124. package/lib/ReactPerf.js +0 -494
  125. package/lib/ReactReconcileTransaction.js +0 -178
  126. package/lib/ReactReconciler.js +0 -168
  127. package/lib/ReactRef.js +0 -80
  128. package/lib/ReactServerBatchingStrategy.js +0 -22
  129. package/lib/ReactServerRendering.js +0 -90
  130. package/lib/ReactServerRenderingTransaction.js +0 -90
  131. package/lib/ReactServerUpdateQueue.js +0 -141
  132. package/lib/ReactSimpleEmptyComponent.js +0 -37
  133. package/lib/ReactTestMount.js +0 -126
  134. package/lib/ReactTestReconcileTransaction.js +0 -121
  135. package/lib/ReactTestRenderer.js +0 -144
  136. package/lib/ReactTestUtils.js +0 -518
  137. package/lib/ReactUpdateQueue.js +0 -226
  138. package/lib/ReactUpdates.js +0 -251
  139. package/lib/ResponderEventPlugin.js +0 -510
  140. package/lib/ResponderSyntheticEvent.js +0 -39
  141. package/lib/ResponderTouchHistoryStore.js +0 -184
  142. package/lib/SVGDOMPropertyConfig.js +0 -302
  143. package/lib/SelectEventPlugin.js +0 -196
  144. package/lib/SimpleEventPlugin.js +0 -635
  145. package/lib/SyntheticAnimationEvent.js +0 -39
  146. package/lib/SyntheticClipboardEvent.js +0 -38
  147. package/lib/SyntheticCompositionEvent.js +0 -36
  148. package/lib/SyntheticDragEvent.js +0 -36
  149. package/lib/SyntheticEvent.js +0 -268
  150. package/lib/SyntheticFocusEvent.js +0 -36
  151. package/lib/SyntheticInputEvent.js +0 -37
  152. package/lib/SyntheticKeyboardEvent.js +0 -84
  153. package/lib/SyntheticMouseEvent.js +0 -72
  154. package/lib/SyntheticTouchEvent.js +0 -45
  155. package/lib/SyntheticTransitionEvent.js +0 -39
  156. package/lib/SyntheticUIEvent.js +0 -59
  157. package/lib/SyntheticWheelEvent.js +0 -54
  158. package/lib/TapEventPlugin.js +0 -110
  159. package/lib/TouchHistoryMath.js +0 -99
  160. package/lib/Transaction.js +0 -233
  161. package/lib/ViewportMetrics.js +0 -27
  162. package/lib/accumulate.js +0 -46
  163. package/lib/accumulateInto.js +0 -58
  164. package/lib/adler32.js +0 -44
  165. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  166. package/lib/createReactNativeComponentClass.js +0 -42
  167. package/lib/dangerousStyleValue.js +0 -79
  168. package/lib/escapeTextContentForBrowser.js +0 -123
  169. package/lib/findDOMNode.js +0 -60
  170. package/lib/findNodeHandle.js +0 -91
  171. package/lib/forEachAccumulated.js +0 -31
  172. package/lib/getEventCharCode.js +0 -50
  173. package/lib/getEventKey.js +0 -102
  174. package/lib/getEventModifierState.js +0 -43
  175. package/lib/getEventTarget.js +0 -35
  176. package/lib/getHostComponentFromComposite.js +0 -30
  177. package/lib/getNodeForCharacterOffset.js +0 -74
  178. package/lib/getTestDocument.js +0 -21
  179. package/lib/getTextContentAccessor.js +0 -33
  180. package/lib/getVendorPrefixedEventName.js +0 -101
  181. package/lib/instantiateReactComponent.js +0 -119
  182. package/lib/isEventSupported.js +0 -60
  183. package/lib/isTextInputElement.js +0 -51
  184. package/lib/quoteAttributeValueForBrowser.js +0 -26
  185. package/lib/reactComponentExpect.js +0 -217
  186. package/lib/setInnerHTML.js +0 -98
  187. package/lib/setTextContent.js +0 -48
  188. package/lib/shouldUpdateReactComponent.js +0 -42
  189. 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;