react 0.14.10 → 15.0.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.
Files changed (193) hide show
  1. package/LICENSE +1 -1
  2. package/dist/react-with-addons.js +4900 -4627
  3. package/dist/react-with-addons.min.js +7 -7
  4. package/dist/react.js +4556 -4059
  5. package/dist/react.min.js +7 -7
  6. package/lib/AutoFocusUtils.js +3 -15
  7. package/lib/BeforeInputEventPlugin.js +8 -25
  8. package/lib/CSSProperty.js +10 -1
  9. package/lib/CSSPropertyOperations.js +49 -19
  10. package/lib/CallbackQueue.js +16 -4
  11. package/lib/ChangeEventPlugin.js +58 -54
  12. package/lib/DOMChildrenOperations.js +91 -61
  13. package/lib/DOMLazyTree.js +105 -0
  14. package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
  15. package/lib/DOMProperty.js +18 -39
  16. package/lib/DOMPropertyOperations.js +42 -53
  17. package/lib/Danger.js +13 -14
  18. package/lib/DefaultEventPluginOrder.js +1 -1
  19. package/lib/EnterLeaveEventPlugin.js +24 -43
  20. package/lib/EventConstants.js +6 -1
  21. package/lib/EventPluginHub.js +22 -66
  22. package/lib/EventPluginRegistry.js +30 -9
  23. package/lib/EventPluginUtils.js +61 -36
  24. package/lib/EventPropagators.js +19 -17
  25. package/lib/FallbackCompositionState.js +4 -4
  26. package/lib/HTMLDOMPropertyConfig.js +131 -152
  27. package/lib/LinkedStateMixin.js +1 -2
  28. package/lib/LinkedValueUtils.js +6 -7
  29. package/lib/MetaMatchers.js +2 -2
  30. package/lib/OrderedMap.js +17 -16
  31. package/lib/PooledClass.js +2 -2
  32. package/lib/React.js +50 -20
  33. package/lib/ReactBrowserEventEmitter.js +19 -26
  34. package/lib/ReactCSSTransitionGroup.js +4 -5
  35. package/lib/ReactCSSTransitionGroupChild.js +1 -6
  36. package/lib/ReactChildReconciler.js +15 -13
  37. package/lib/ReactChildren.js +5 -4
  38. package/lib/ReactClass.js +44 -92
  39. package/lib/ReactComponent.js +9 -10
  40. package/lib/ReactComponentBrowserEnvironment.js +9 -6
  41. package/lib/ReactComponentEnvironment.js +4 -4
  42. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  43. package/lib/ReactCompositeComponent.js +166 -74
  44. package/lib/ReactCurrentOwner.js +2 -1
  45. package/lib/ReactDOM.js +27 -15
  46. package/lib/ReactDOMButton.js +2 -2
  47. package/lib/ReactDOMComponent.js +186 -250
  48. package/lib/ReactDOMComponentFlags.js +18 -0
  49. package/lib/ReactDOMComponentTree.js +186 -0
  50. package/lib/ReactDOMContainerInfo.js +32 -0
  51. package/lib/ReactDOMDebugTool.js +61 -0
  52. package/lib/ReactDOMEmptyComponent.js +60 -0
  53. package/lib/ReactDOMFactories.js +1 -2
  54. package/lib/ReactDOMFeatureFlags.js +2 -2
  55. package/lib/ReactDOMIDOperations.js +5 -60
  56. package/lib/ReactDOMInput.js +73 -23
  57. package/lib/ReactDOMInstrumentation.js +16 -0
  58. package/lib/ReactDOMOption.js +14 -12
  59. package/lib/ReactDOMSelect.js +43 -19
  60. package/lib/ReactDOMSelection.js +4 -4
  61. package/lib/ReactDOMServer.js +1 -1
  62. package/lib/ReactDOMTextComponent.js +87 -45
  63. package/lib/ReactDOMTextarea.js +39 -11
  64. package/lib/ReactDOMTreeTraversal.js +134 -0
  65. package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
  66. package/lib/ReactDebugInstanceMap.js +102 -0
  67. package/lib/ReactDebugTool.js +72 -0
  68. package/lib/ReactDefaultBatchingStrategy.js +4 -3
  69. package/lib/ReactDefaultInjection.js +11 -15
  70. package/lib/ReactDefaultPerf.js +105 -26
  71. package/lib/ReactDefaultPerfAnalysis.js +23 -15
  72. package/lib/ReactElement.js +63 -23
  73. package/lib/ReactElementValidator.js +9 -9
  74. package/lib/ReactEmptyComponent.js +8 -33
  75. package/lib/ReactErrorUtils.js +1 -2
  76. package/lib/ReactEventEmitterMixin.js +3 -8
  77. package/lib/ReactEventListener.js +23 -77
  78. package/lib/ReactFeatureFlags.js +21 -0
  79. package/lib/ReactFragment.js +6 -6
  80. package/lib/ReactInjection.js +3 -3
  81. package/lib/ReactInputSelection.js +4 -4
  82. package/lib/ReactInstanceHandles.js +10 -12
  83. package/lib/ReactInstanceMap.js +2 -1
  84. package/lib/ReactInstrumentation.js +16 -0
  85. package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
  86. package/lib/ReactLink.js +2 -3
  87. package/lib/ReactMarkupChecksum.js +8 -3
  88. package/lib/ReactMount.js +88 -460
  89. package/lib/ReactMultiChild.js +106 -200
  90. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  91. package/lib/ReactNativeComponent.js +6 -5
  92. package/lib/ReactNodeTypes.js +37 -0
  93. package/lib/ReactNoopUpdateQueue.js +2 -25
  94. package/lib/ReactOwner.js +7 -6
  95. package/lib/ReactPerf.js +2 -2
  96. package/lib/ReactPropTransferer.js +5 -4
  97. package/lib/ReactPropTypeLocationNames.js +1 -1
  98. package/lib/ReactPropTypeLocations.js +1 -1
  99. package/lib/ReactPropTypes.js +31 -7
  100. package/lib/ReactReconcileTransaction.js +20 -9
  101. package/lib/ReactReconciler.js +29 -6
  102. package/lib/ReactRef.js +1 -1
  103. package/lib/ReactServerBatchingStrategy.js +1 -2
  104. package/lib/ReactServerRendering.js +17 -35
  105. package/lib/ReactServerRenderingTransaction.js +11 -29
  106. package/lib/ReactSimpleEmptyComponent.js +36 -0
  107. package/lib/ReactStateSetters.js +1 -1
  108. package/lib/ReactTestUtils.js +47 -28
  109. package/lib/ReactTransitionChildMapping.js +1 -2
  110. package/lib/ReactTransitionEvents.js +8 -44
  111. package/lib/ReactTransitionGroup.js +4 -3
  112. package/lib/ReactUMDEntry.js +26 -0
  113. package/lib/ReactUpdateQueue.js +24 -66
  114. package/lib/ReactUpdates.js +29 -11
  115. package/lib/ReactVersion.js +2 -2
  116. package/lib/ReactWithAddons.js +1 -21
  117. package/lib/ReactWithAddonsUMDEntry.js +26 -0
  118. package/lib/ResponderEventPlugin.js +54 -66
  119. package/lib/ResponderSyntheticEvent.js +2 -3
  120. package/lib/ResponderTouchHistoryStore.js +5 -5
  121. package/lib/SVGDOMPropertyConfig.js +267 -94
  122. package/lib/SelectEventPlugin.js +13 -18
  123. package/lib/SimpleEventPlugin.js +57 -17
  124. package/lib/SyntheticAnimationEvent.js +39 -0
  125. package/lib/SyntheticClipboardEvent.js +2 -3
  126. package/lib/SyntheticCompositionEvent.js +2 -3
  127. package/lib/SyntheticDragEvent.js +2 -3
  128. package/lib/SyntheticEvent.js +102 -21
  129. package/lib/SyntheticFocusEvent.js +2 -3
  130. package/lib/SyntheticInputEvent.js +2 -3
  131. package/lib/SyntheticKeyboardEvent.js +2 -3
  132. package/lib/SyntheticMouseEvent.js +2 -3
  133. package/lib/SyntheticTouchEvent.js +2 -3
  134. package/lib/SyntheticTransitionEvent.js +39 -0
  135. package/lib/SyntheticUIEvent.js +2 -3
  136. package/lib/SyntheticWheelEvent.js +2 -3
  137. package/lib/TapEventPlugin.js +3 -12
  138. package/lib/Transaction.js +3 -3
  139. package/lib/ViewportMetrics.js +1 -1
  140. package/lib/accumulate.js +2 -2
  141. package/lib/accumulateInto.js +2 -2
  142. package/lib/adler32.js +3 -2
  143. package/lib/canDefineProperty.js +1 -1
  144. package/lib/createHierarchyRenderer.js +1 -1
  145. package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
  146. package/lib/dangerousStyleValue.js +25 -3
  147. package/lib/deprecated.js +7 -4
  148. package/lib/escapeTextContentForBrowser.js +1 -1
  149. package/lib/findDOMNode.js +15 -8
  150. package/lib/flattenChildren.js +2 -2
  151. package/lib/forEachAccumulated.js +2 -1
  152. package/lib/getEventCharCode.js +2 -2
  153. package/lib/getEventKey.js +1 -2
  154. package/lib/getEventModifierState.js +1 -2
  155. package/lib/getEventTarget.js +8 -2
  156. package/lib/getIteratorFn.js +2 -2
  157. package/lib/getNativeComponentFromComposite.js +30 -0
  158. package/lib/getNodeForCharacterOffset.js +2 -1
  159. package/lib/getTestDocument.js +1 -1
  160. package/lib/getTextContentAccessor.js +1 -1
  161. package/lib/getVendorPrefixedEventName.js +101 -0
  162. package/lib/instantiateReactComponent.js +12 -13
  163. package/lib/isEventSupported.js +2 -2
  164. package/lib/isTextInputElement.js +2 -1
  165. package/lib/onlyChild.js +2 -2
  166. package/lib/quoteAttributeValueForBrowser.js +1 -1
  167. package/lib/reactComponentExpect.js +5 -4
  168. package/lib/renderSubtreeIntoContainer.js +1 -1
  169. package/lib/setInnerHTML.js +6 -14
  170. package/lib/setTextContent.js +1 -1
  171. package/lib/shallowCompare.js +1 -1
  172. package/lib/shouldUpdateReactComponent.js +2 -3
  173. package/lib/sliceChildren.js +1 -1
  174. package/lib/traverseAllChildren.js +8 -8
  175. package/lib/update.js +16 -15
  176. package/lib/validateDOMNesting.js +18 -13
  177. package/package.json +23 -32
  178. package/addons.js +0 -13
  179. package/cjs/react-jsx-dev-runtime.development.js +0 -861
  180. package/cjs/react-jsx-dev-runtime.production.min.js +0 -9
  181. package/cjs/react-jsx-runtime.development.js +0 -883
  182. package/cjs/react-jsx-runtime.production.min.js +0 -10
  183. package/jsx-dev-runtime.js +0 -7
  184. package/jsx-runtime.js +0 -7
  185. package/lib/Object.assign.js +0 -47
  186. package/lib/React.native.js +0 -5
  187. package/lib/ReactBrowserComponentMixin.js +0 -36
  188. package/lib/ReactEmptyComponentRegistry.js +0 -48
  189. package/lib/ReactIsomorphic.js +0 -74
  190. package/lib/ReactRootIndex.js +0 -29
  191. package/lib/ServerReactRootIndex.js +0 -29
  192. package/lib/cloneWithProps.js +0 -54
  193. package/lib/webcomponents.js +0 -6379
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -11,10 +11,11 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _assign = require('object-assign');
15
+
14
16
  var ReactUpdates = require('./ReactUpdates');
15
17
  var Transaction = require('./Transaction');
16
18
 
17
- var assign = require('./Object.assign');
18
19
  var emptyFunction = require('fbjs/lib/emptyFunction');
19
20
 
20
21
  var RESET_BATCHED_UPDATES = {
@@ -35,7 +36,7 @@ function ReactDefaultBatchingStrategyTransaction() {
35
36
  this.reinitializeTransaction();
36
37
  }
37
38
 
38
- assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
39
+ _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
39
40
  getTransactionWrappers: function () {
40
41
  return TRANSACTION_WRAPPERS;
41
42
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -13,25 +13,23 @@
13
13
 
14
14
  var BeforeInputEventPlugin = require('./BeforeInputEventPlugin');
15
15
  var ChangeEventPlugin = require('./ChangeEventPlugin');
16
- var ClientReactRootIndex = require('./ClientReactRootIndex');
17
16
  var DefaultEventPluginOrder = require('./DefaultEventPluginOrder');
18
17
  var EnterLeaveEventPlugin = require('./EnterLeaveEventPlugin');
19
18
  var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
20
19
  var HTMLDOMPropertyConfig = require('./HTMLDOMPropertyConfig');
21
- var ReactBrowserComponentMixin = require('./ReactBrowserComponentMixin');
22
20
  var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
23
- var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
24
21
  var ReactDOMComponent = require('./ReactDOMComponent');
22
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
23
+ var ReactDOMEmptyComponent = require('./ReactDOMEmptyComponent');
24
+ var ReactDOMTreeTraversal = require('./ReactDOMTreeTraversal');
25
25
  var ReactDOMTextComponent = require('./ReactDOMTextComponent');
26
+ var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
26
27
  var ReactEventListener = require('./ReactEventListener');
27
28
  var ReactInjection = require('./ReactInjection');
28
- var ReactInstanceHandles = require('./ReactInstanceHandles');
29
- var ReactMount = require('./ReactMount');
30
29
  var ReactReconcileTransaction = require('./ReactReconcileTransaction');
30
+ var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
31
31
  var SelectEventPlugin = require('./SelectEventPlugin');
32
- var ServerReactRootIndex = require('./ServerReactRootIndex');
33
32
  var SimpleEventPlugin = require('./SimpleEventPlugin');
34
- var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
35
33
 
36
34
  var alreadyInjected = false;
37
35
 
@@ -50,8 +48,8 @@ function inject() {
50
48
  * Inject modules for resolving DOM hierarchy and plugin ordering.
51
49
  */
52
50
  ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
53
- ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
54
- ReactInjection.EventPluginHub.injectMount(ReactMount);
51
+ ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
52
+ ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
55
53
 
56
54
  /**
57
55
  * Some important event plugins included by default (without having to require
@@ -69,18 +67,16 @@ function inject() {
69
67
 
70
68
  ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
71
69
 
72
- ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
73
-
74
70
  ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
75
71
  ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
76
72
 
77
- ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
73
+ ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
74
+ return new ReactDOMEmptyComponent(instantiate);
75
+ });
78
76
 
79
77
  ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
80
78
  ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
81
79
 
82
- ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
83
-
84
80
  ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
85
81
 
86
82
  if (process.env.NODE_ENV !== 'production') {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,17 +7,18 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule ReactDefaultPerf
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
15
14
  var DOMProperty = require('./DOMProperty');
15
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
16
16
  var ReactDefaultPerfAnalysis = require('./ReactDefaultPerfAnalysis');
17
17
  var ReactMount = require('./ReactMount');
18
18
  var ReactPerf = require('./ReactPerf');
19
19
 
20
20
  var performanceNow = require('fbjs/lib/performanceNow');
21
+ var warning = require('fbjs/lib/warning');
21
22
 
22
23
  function roundFloat(val) {
23
24
  return Math.floor(val * 100) / 100;
@@ -27,9 +28,59 @@ function addValue(obj, key, val) {
27
28
  obj[key] = (obj[key] || 0) + val;
28
29
  }
29
30
 
31
+ // Composite/text components don't have any built-in ID: we have to make our own
32
+ var compositeIDMap;
33
+ var compositeIDCounter = 17000;
34
+ function getIDOfComposite(inst) {
35
+ if (!compositeIDMap) {
36
+ compositeIDMap = new WeakMap();
37
+ }
38
+ if (compositeIDMap.has(inst)) {
39
+ return compositeIDMap.get(inst);
40
+ } else {
41
+ var id = compositeIDCounter++;
42
+ compositeIDMap.set(inst, id);
43
+ return id;
44
+ }
45
+ }
46
+
47
+ function getID(inst) {
48
+ if (inst.hasOwnProperty('_rootNodeID')) {
49
+ return inst._rootNodeID;
50
+ } else {
51
+ return getIDOfComposite(inst);
52
+ }
53
+ }
54
+
55
+ function stripComplexValues(key, value) {
56
+ if (typeof value !== 'object' || Array.isArray(value) || value == null) {
57
+ return value;
58
+ }
59
+ var prototype = Object.getPrototypeOf(value);
60
+ if (!prototype || prototype === Object.prototype) {
61
+ return value;
62
+ }
63
+ return '<not serializable>';
64
+ }
65
+
66
+ // This implementation of ReactPerf is going away some time mid 15.x.
67
+ // While we plan to keep most of the API, the actual format of measurements
68
+ // will change dramatically. To signal this, we wrap them into an opaque-ish
69
+ // object to discourage reaching into it until the API stabilizes.
70
+ function wrapLegacyMeasurements(measurements) {
71
+ return { __unstable_this_format_will_change: measurements };
72
+ }
73
+ function unwrapLegacyMeasurements(measurements) {
74
+ return measurements && measurements.__unstable_this_format_will_change || measurements;
75
+ }
76
+
77
+ var warnedAboutPrintDOM = false;
78
+ var warnedAboutGetMeasurementsSummaryMap = false;
79
+
30
80
  var ReactDefaultPerf = {
31
81
  _allMeasurements: [], // last item in the list is the current one
32
82
  _mountStack: [0],
83
+ _compositeStack: [],
33
84
  _injected: false,
34
85
 
35
86
  start: function () {
@@ -46,11 +97,11 @@ var ReactDefaultPerf = {
46
97
  },
47
98
 
48
99
  getLastMeasurements: function () {
49
- return ReactDefaultPerf._allMeasurements;
100
+ return wrapLegacyMeasurements(ReactDefaultPerf._allMeasurements);
50
101
  },
51
102
 
52
103
  printExclusive: function (measurements) {
53
- measurements = measurements || ReactDefaultPerf._allMeasurements;
104
+ measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements);
54
105
  var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
55
106
  console.table(summary.map(function (item) {
56
107
  return {
@@ -68,7 +119,7 @@ var ReactDefaultPerf = {
68
119
  },
69
120
 
70
121
  printInclusive: function (measurements) {
71
- measurements = measurements || ReactDefaultPerf._allMeasurements;
122
+ measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements);
72
123
  var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
73
124
  console.table(summary.map(function (item) {
74
125
  return {
@@ -81,6 +132,13 @@ var ReactDefaultPerf = {
81
132
  },
82
133
 
83
134
  getMeasurementsSummaryMap: function (measurements) {
135
+ process.env.NODE_ENV !== 'production' ? warning(warnedAboutGetMeasurementsSummaryMap, '`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use ' + '`ReactPerf.getWasted(...)` instead.') : void 0;
136
+ warnedAboutGetMeasurementsSummaryMap = true;
137
+ return ReactDefaultPerf.getWasted(measurements);
138
+ },
139
+
140
+ getWasted: function (measurements) {
141
+ measurements = unwrapLegacyMeasurements(measurements);
84
142
  var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
85
143
  return summary.map(function (item) {
86
144
  return {
@@ -92,19 +150,25 @@ var ReactDefaultPerf = {
92
150
  },
93
151
 
94
152
  printWasted: function (measurements) {
95
- measurements = measurements || ReactDefaultPerf._allMeasurements;
96
- console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
153
+ measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements);
154
+ console.table(ReactDefaultPerf.getWasted(measurements));
97
155
  console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
98
156
  },
99
157
 
100
158
  printDOM: function (measurements) {
101
- measurements = measurements || ReactDefaultPerf._allMeasurements;
159
+ process.env.NODE_ENV !== 'production' ? warning(warnedAboutPrintDOM, '`ReactPerf.printDOM(...)` is deprecated. Use ' + '`ReactPerf.printOperations(...)` instead.') : void 0;
160
+ warnedAboutPrintDOM = true;
161
+ return ReactDefaultPerf.printOperations(measurements);
162
+ },
163
+
164
+ printOperations: function (measurements) {
165
+ measurements = unwrapLegacyMeasurements(measurements || ReactDefaultPerf._allMeasurements);
102
166
  var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
103
167
  console.table(summary.map(function (item) {
104
168
  var result = {};
105
169
  result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
106
170
  result.type = item.type;
107
- result.args = JSON.stringify(item.args);
171
+ result.args = JSON.stringify(item.args, stripComplexValues);
108
172
  return result;
109
173
  }));
110
174
  console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
@@ -112,7 +176,8 @@ var ReactDefaultPerf = {
112
176
 
113
177
  _recordWrite: function (id, fnName, totalTime, args) {
114
178
  // TODO: totalTime isn't that useful since it doesn't count paints/reflows
115
- var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
179
+ var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
180
+ var writes = entry.writes;
116
181
  writes[id] = writes[id] || [];
117
182
  writes[id].push({
118
183
  type: fnName,
@@ -131,36 +196,38 @@ var ReactDefaultPerf = {
131
196
  var rv;
132
197
  var start;
133
198
 
199
+ var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
200
+
134
201
  if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
135
202
  // A "measurement" is a set of metrics recorded for each flush. We want
136
203
  // to group the metrics for a given flush together so we can look at the
137
204
  // components that rendered and the DOM operations that actually
138
205
  // happened to determine the amount of "wasted work" performed.
139
- ReactDefaultPerf._allMeasurements.push({
206
+ ReactDefaultPerf._allMeasurements.push(entry = {
140
207
  exclusive: {},
141
208
  inclusive: {},
142
209
  render: {},
143
210
  counts: {},
144
211
  writes: {},
145
212
  displayNames: {},
213
+ hierarchy: {},
146
214
  totalTime: 0,
147
215
  created: {}
148
216
  });
149
217
  start = performanceNow();
150
218
  rv = func.apply(this, args);
151
- ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
219
+ entry.totalTime = performanceNow() - start;
152
220
  return rv;
153
- } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
221
+ } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations' || moduleName === 'ReactComponentBrowserEnvironment') {
154
222
  start = performanceNow();
155
223
  rv = func.apply(this, args);
156
224
  totalTime = performanceNow() - start;
157
225
 
158
226
  if (fnName === '_mountImageIntoNode') {
159
- var mountID = ReactMount.getID(args[1]);
160
- ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
227
+ ReactDefaultPerf._recordWrite('', fnName, totalTime, args[0]);
161
228
  } else if (fnName === 'dangerouslyProcessChildrenUpdates') {
162
229
  // special format
163
- args[0].forEach(function (update) {
230
+ args[1].forEach(function (update) {
164
231
  var writeArgs = {};
165
232
  if (update.fromIndex !== null) {
166
233
  writeArgs.fromIndex = update.fromIndex;
@@ -168,19 +235,23 @@ var ReactDefaultPerf = {
168
235
  if (update.toIndex !== null) {
169
236
  writeArgs.toIndex = update.toIndex;
170
237
  }
171
- if (update.textContent !== null) {
172
- writeArgs.textContent = update.textContent;
238
+ if (update.content !== null) {
239
+ writeArgs.content = update.content;
173
240
  }
174
- if (update.markupIndex !== null) {
175
- writeArgs.markup = args[1][update.markupIndex];
176
- }
177
- ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
241
+ ReactDefaultPerf._recordWrite(args[0]._rootNodeID, update.type, totalTime, writeArgs);
178
242
  });
179
243
  } else {
180
244
  // basic format
181
245
  var id = args[0];
182
- if (typeof id === 'object') {
183
- id = ReactMount.getID(args[0]);
246
+ if (moduleName === 'EventPluginHub') {
247
+ id = id._rootNodeID;
248
+ } else if (fnName === 'replaceNodeWithMarkup') {
249
+ // Old node is already unmounted; can't get its instance
250
+ id = ReactDOMComponentTree.getInstanceFromNode(args[1].node)._rootNodeID;
251
+ } else if (fnName === 'replaceDelimitedText') {
252
+ id = getID(ReactDOMComponentTree.getInstanceFromNode(args[0]));
253
+ } else if (typeof id === 'object') {
254
+ id = getID(ReactDOMComponentTree.getInstanceFromNode(args[0]));
184
255
  }
185
256
  ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
186
257
  }
@@ -192,12 +263,11 @@ var ReactDefaultPerf = {
192
263
  return func.apply(this, args);
193
264
  }
194
265
 
195
- var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
266
+ var rootNodeID = getIDOfComposite(this);
196
267
  var isRender = fnName === '_renderValidatedComponent';
197
268
  var isMount = fnName === 'mountComponent';
198
269
 
199
270
  var mountStack = ReactDefaultPerf._mountStack;
200
- var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
201
271
 
202
272
  if (isRender) {
203
273
  addValue(entry.counts, rootNodeID, 1);
@@ -206,10 +276,14 @@ var ReactDefaultPerf = {
206
276
  mountStack.push(0);
207
277
  }
208
278
 
279
+ ReactDefaultPerf._compositeStack.push(rootNodeID);
280
+
209
281
  start = performanceNow();
210
282
  rv = func.apply(this, args);
211
283
  totalTime = performanceNow() - start;
212
284
 
285
+ ReactDefaultPerf._compositeStack.pop();
286
+
213
287
  if (isRender) {
214
288
  addValue(entry.render, rootNodeID, totalTime);
215
289
  } else if (isMount) {
@@ -226,6 +300,11 @@ var ReactDefaultPerf = {
226
300
  owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
227
301
  };
228
302
 
303
+ return rv;
304
+ } else if ((moduleName === 'ReactDOMComponent' || moduleName === 'ReactDOMTextComponent') && (fnName === 'mountComponent' || fnName === 'receiveComponent')) {
305
+
306
+ rv = func.apply(this, args);
307
+ entry.hierarchy[getID(this)] = ReactDefaultPerf._compositeStack.slice();
229
308
  return rv;
230
309
  } else {
231
310
  return func.apply(this, args);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -11,9 +11,10 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var assign = require('./Object.assign');
15
-
16
14
  // Don't try to save users less than 1.2ms (a number I made up)
15
+
16
+ var _assign = require('object-assign');
17
+
17
18
  var DONT_CARE_THRESHOLD = 1.2;
18
19
  var DOM_OPERATION_TYPES = {
19
20
  '_mountImageIntoNode': 'set innerHTML',
@@ -27,7 +28,7 @@ var DOM_OPERATION_TYPES = {
27
28
  'deleteValueForProperty': 'remove attribute',
28
29
  'setValueForStyles': 'update styles',
29
30
  'replaceNodeWithMarkup': 'replace',
30
- 'updateTextContent': 'set textContent'
31
+ 'replaceDelimitedText': 'replace'
31
32
  };
32
33
 
33
34
  function getTotalTime(measurements) {
@@ -65,7 +66,7 @@ function getExclusiveSummary(measurements) {
65
66
 
66
67
  for (var i = 0; i < measurements.length; i++) {
67
68
  var measurement = measurements[i];
68
- var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
69
+ var allIDs = _assign({}, measurement.exclusive, measurement.inclusive);
69
70
 
70
71
  for (var id in allIDs) {
71
72
  displayName = measurement.displayNames[id].current;
@@ -113,7 +114,7 @@ function getInclusiveSummary(measurements, onlyClean) {
113
114
 
114
115
  for (var i = 0; i < measurements.length; i++) {
115
116
  var measurement = measurements[i];
116
- var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
117
+ var allIDs = _assign({}, measurement.exclusive, measurement.inclusive);
117
118
  var cleanComponents;
118
119
 
119
120
  if (onlyClean) {
@@ -167,18 +168,25 @@ function getUnchangedComponents(measurement) {
167
168
  // render anything to the DOM and return a mapping of their ID to
168
169
  // the amount of time it took to render the entire subtree.
169
170
  var cleanComponents = {};
170
- var dirtyLeafIDs = Object.keys(measurement.writes);
171
- var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
171
+ var writes = measurement.writes;
172
+ var dirtyComposites = {};
173
+ Object.keys(writes).forEach(function (id) {
174
+ writes[id].forEach(function (write) {
175
+ // Root mounting (innerHTML set) is recorded with an ID of ''
176
+ if (id !== '') {
177
+ measurement.hierarchy[id].forEach(function (c) {
178
+ return dirtyComposites[c] = true;
179
+ });
180
+ }
181
+ });
182
+ });
183
+ var allIDs = _assign({}, measurement.exclusive, measurement.inclusive);
172
184
 
173
185
  for (var id in allIDs) {
174
186
  var isDirty = false;
175
- // For each component that rendered, see if a component that triggered
176
- // a DOM op is in its subtree.
177
- for (var i = 0; i < dirtyLeafIDs.length; i++) {
178
- if (dirtyLeafIDs[i].indexOf(id) === 0) {
179
- isDirty = true;
180
- break;
181
- }
187
+ // See if any of the DOM operations applied to this component's subtree.
188
+ if (dirtyComposites[id]) {
189
+ isDirty = true;
182
190
  }
183
191
  // check if component newly created
184
192
  if (measurement.created[id]) {