react 15.1.0 → 15.2.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 (124) hide show
  1. package/dist/react-with-addons.js +2685 -1842
  2. package/dist/react-with-addons.min.js +6 -6
  3. package/dist/react.js +2400 -1691
  4. package/dist/react.min.js +6 -6
  5. package/lib/CSSPropertyOperations.js +1 -1
  6. package/lib/CallbackQueue.js +3 -2
  7. package/lib/DOMChildrenOperations.js +9 -9
  8. package/lib/DOMLazyTree.js +3 -2
  9. package/lib/DOMProperty.js +5 -12
  10. package/lib/DOMPropertyOperations.js +21 -15
  11. package/lib/Danger.js +5 -101
  12. package/lib/DisabledInputUtils.js +5 -5
  13. package/lib/EventPluginHub.js +8 -2
  14. package/lib/EventPluginRegistry.js +13 -7
  15. package/lib/EventPluginUtils.js +3 -1
  16. package/lib/HTMLDOMPropertyConfig.js +1 -2
  17. package/lib/KeyEscapeUtils.js +2 -1
  18. package/lib/LinkedValueUtils.js +5 -3
  19. package/lib/NativeMethodsMixin.js +6 -4
  20. package/lib/PooledClass.js +4 -2
  21. package/lib/React.js +1 -1
  22. package/lib/ReactCSSTransitionGroupChild.js +15 -8
  23. package/lib/ReactChildReconciler.js +17 -8
  24. package/lib/ReactClass.js +14 -13
  25. package/lib/ReactComponent.js +3 -6
  26. package/lib/ReactComponentEnvironment.js +3 -1
  27. package/lib/ReactComponentTreeDevtool.js +89 -16
  28. package/lib/ReactComponentTreeTestUtils.js +87 -0
  29. package/lib/ReactCompositeComponent.js +87 -117
  30. package/lib/ReactDOM.js +2 -2
  31. package/lib/ReactDOMButton.js +2 -2
  32. package/lib/ReactDOMComponent.js +130 -76
  33. package/lib/ReactDOMComponentTree.js +23 -21
  34. package/lib/ReactDOMDebugTool.js +17 -11
  35. package/lib/ReactDOMEmptyComponent.js +9 -9
  36. package/lib/ReactDOMFactories.js +1 -1
  37. package/lib/ReactDOMFiber.js +78 -0
  38. package/lib/ReactDOMInput.js +64 -26
  39. package/lib/ReactDOMInstrumentation.js +7 -2
  40. package/lib/ReactDOMNullInputValuePropDevtool.js +43 -0
  41. package/lib/ReactDOMOption.js +40 -26
  42. package/lib/ReactDOMSelect.js +3 -16
  43. package/lib/ReactDOMTextComponent.js +21 -20
  44. package/lib/ReactDOMTextarea.js +59 -46
  45. package/lib/ReactDOMTreeTraversal.js +18 -16
  46. package/lib/ReactDOMUnknownPropertyDevtool.js +65 -17
  47. package/lib/ReactDebugTool.js +148 -95
  48. package/lib/ReactDefaultInjection.js +2 -2
  49. package/lib/ReactElement.js +64 -25
  50. package/lib/ReactElementValidator.js +26 -81
  51. package/lib/ReactEventListener.js +2 -2
  52. package/lib/ReactFeatureFlags.js +1 -0
  53. package/lib/ReactFragment.js +3 -1
  54. package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
  55. package/lib/{ReactNativeOperationHistoryDevtool.js → ReactHostOperationHistoryDevtool.js} +5 -5
  56. package/lib/ReactInjection.js +2 -2
  57. package/lib/ReactInstanceHandles.js +8 -6
  58. package/lib/ReactInstrumentation.js +7 -2
  59. package/lib/ReactMount.js +38 -32
  60. package/lib/ReactMultiChild.js +38 -11
  61. package/lib/ReactNativeAttributePayload.js +5 -2
  62. package/lib/ReactNativeBaseComponent.js +7 -7
  63. package/lib/ReactNativeBridgeEventPlugin.js +1 -1
  64. package/lib/ReactNativeComponentTree.js +8 -6
  65. package/lib/ReactNativeDOMIDOperations.js +1 -2
  66. package/lib/ReactNativeDefaultInjection.js +9 -7
  67. package/lib/ReactNativeGlobalResponderHandler.js +1 -1
  68. package/lib/ReactNativeMount.js +3 -14
  69. package/lib/ReactNativeReconcileTransaction.js +16 -0
  70. package/lib/ReactNativeTagHandles.js +3 -1
  71. package/lib/ReactNativeTextComponent.js +10 -9
  72. package/lib/ReactNativeTreeTraversal.js +11 -11
  73. package/lib/ReactNodeTypes.js +6 -3
  74. package/lib/ReactNoop.js +173 -0
  75. package/lib/ReactNoopUpdateQueue.js +6 -5
  76. package/lib/ReactOwner.js +4 -2
  77. package/lib/ReactPerf.js +83 -7
  78. package/lib/ReactPropTypes.js +23 -0
  79. package/lib/ReactReconcileTransaction.js +17 -1
  80. package/lib/ReactReconciler.js +12 -7
  81. package/lib/ReactServerRendering.js +5 -7
  82. package/lib/ReactServerRenderingTransaction.js +17 -0
  83. package/lib/ReactServerUpdateQueue.js +141 -0
  84. package/lib/ReactSimpleEmptyComponent.js +4 -4
  85. package/lib/ReactTestMount.js +115 -0
  86. package/lib/ReactTestReconcileTransaction.js +108 -0
  87. package/lib/ReactTestRenderer.js +133 -0
  88. package/lib/ReactTestUtils.js +17 -10
  89. package/lib/ReactTransitionChildMapping.js +7 -1
  90. package/lib/ReactTransitionGroup.js +41 -6
  91. package/lib/ReactUpdateQueue.js +13 -3
  92. package/lib/ReactUpdates.js +10 -18
  93. package/lib/ReactVersion.js +1 -1
  94. package/lib/ResponderEventPlugin.js +9 -7
  95. package/lib/ResponderTouchHistoryStore.js +99 -95
  96. package/lib/SimpleEventPlugin.js +3 -1
  97. package/lib/SyntheticEvent.js +2 -3
  98. package/lib/SyntheticUIEvent.js +1 -1
  99. package/lib/Transaction.js +4 -2
  100. package/lib/accumulate.js +17 -15
  101. package/lib/accumulateInto.js +11 -12
  102. package/lib/adler32.js +1 -0
  103. package/lib/checkReactTypeSpec.js +73 -0
  104. package/lib/createReactNativeComponentClass.js +2 -2
  105. package/lib/dangerousStyleValue.js +3 -1
  106. package/lib/deprecated.js +7 -1
  107. package/lib/escapeTextContentForBrowser.js +96 -12
  108. package/lib/findDOMNode.js +6 -4
  109. package/lib/findNodeHandle.js +5 -3
  110. package/lib/flattenChildren.js +22 -10
  111. package/lib/forEachAccumulated.js +3 -2
  112. package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
  113. package/lib/getIteratorFn.js +1 -0
  114. package/lib/instantiateReactComponent.js +21 -19
  115. package/lib/isTextInputElement.js +11 -1
  116. package/lib/onlyChild.js +3 -1
  117. package/lib/reactComponentExpect.js +3 -3
  118. package/lib/reactProdInvariant.js +39 -0
  119. package/lib/setInnerHTML.js +17 -1
  120. package/lib/setTextContent.js +8 -0
  121. package/lib/traverseAllChildren.js +3 -1
  122. package/lib/update.js +12 -11
  123. package/package.json +2 -2
  124. package/lib/MetaMatchers.js +0 -118
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var invariant = require('fbjs/lib/invariant');
15
17
 
16
18
  /**
@@ -36,15 +38,15 @@ function recomputePluginOrdering() {
36
38
  for (var pluginName in namesToPlugins) {
37
39
  var PluginModule = namesToPlugins[pluginName];
38
40
  var pluginIndex = EventPluginOrder.indexOf(pluginName);
39
- !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : void 0;
41
+ !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0;
40
42
  if (EventPluginRegistry.plugins[pluginIndex]) {
41
43
  continue;
42
44
  }
43
- !PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : void 0;
45
+ !PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0;
44
46
  EventPluginRegistry.plugins[pluginIndex] = PluginModule;
45
47
  var publishedEvents = PluginModule.eventTypes;
46
48
  for (var eventName in publishedEvents) {
47
- !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : void 0;
49
+ !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0;
48
50
  }
49
51
  }
50
52
  }
@@ -58,7 +60,7 @@ function recomputePluginOrdering() {
58
60
  * @private
59
61
  */
60
62
  function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
61
- !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : void 0;
63
+ !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0;
62
64
  EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
63
65
 
64
66
  var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
@@ -86,13 +88,17 @@ function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
86
88
  * @private
87
89
  */
88
90
  function publishRegistrationName(registrationName, PluginModule, eventName) {
89
- !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : void 0;
91
+ !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0;
90
92
  EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
91
93
  EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
92
94
 
93
95
  if (process.env.NODE_ENV !== 'production') {
94
96
  var lowerCasedName = registrationName.toLowerCase();
95
97
  EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
98
+
99
+ if (registrationName === 'onDoubleClick') {
100
+ EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
101
+ }
96
102
  }
97
103
  }
98
104
 
@@ -141,7 +147,7 @@ var EventPluginRegistry = {
141
147
  * @see {EventPluginHub.injection.injectEventPluginOrder}
142
148
  */
143
149
  injectEventPluginOrder: function (InjectedEventPluginOrder) {
144
- !!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : void 0;
150
+ !!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0;
145
151
  // Clone the ordering so it cannot be dynamically mutated.
146
152
  EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
147
153
  recomputePluginOrdering();
@@ -165,7 +171,7 @@ var EventPluginRegistry = {
165
171
  }
166
172
  var PluginModule = injectedNamesToPlugins[pluginName];
167
173
  if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
168
- !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : void 0;
174
+ !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0;
169
175
  namesToPlugins[pluginName] = PluginModule;
170
176
  isOrderingDirty = true;
171
177
  }
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var EventConstants = require('./EventConstants');
15
17
  var ReactErrorUtils = require('./ReactErrorUtils');
16
18
 
@@ -169,7 +171,7 @@ function executeDirectDispatch(event) {
169
171
  }
170
172
  var dispatchListener = event._dispatchListeners;
171
173
  var dispatchInstance = event._dispatchInstances;
172
- !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : void 0;
174
+ !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0;
173
175
  event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
174
176
  var res = dispatchListener ? dispatchListener(event) : null;
175
177
  event.currentTarget = null;
@@ -15,7 +15,6 @@ var DOMProperty = require('./DOMProperty');
15
15
 
16
16
  var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
17
17
  var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
18
- var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
19
18
  var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
20
19
  var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
21
20
  var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
@@ -149,7 +148,7 @@ var HTMLDOMPropertyConfig = {
149
148
  // Setting .type throws on non-<input> tags
150
149
  type: 0,
151
150
  useMap: 0,
152
- value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
151
+ value: 0,
153
152
  width: 0,
154
153
  wmode: 0,
155
154
  wrap: 0,
@@ -7,6 +7,7 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule KeyEscapeUtils
10
+ *
10
11
  */
11
12
 
12
13
  'use strict';
@@ -14,7 +15,7 @@
14
15
  /**
15
16
  * Escape and wrap key so it is safe to use as a reactid
16
17
  *
17
- * @param {*} key to be escaped.
18
+ * @param {string} key to be escaped.
18
19
  * @return {string} the escaped key.
19
20
  */
20
21
 
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var ReactPropTypes = require('./ReactPropTypes');
15
17
  var ReactPropTypeLocations = require('./ReactPropTypeLocations');
16
18
 
@@ -28,16 +30,16 @@ var hasReadOnlyValue = {
28
30
  };
29
31
 
30
32
  function _assertSingleLink(inputProps) {
31
- !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : void 0;
33
+ !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don\'t want to use valueLink and vice versa.') : _prodInvariant('87') : void 0;
32
34
  }
33
35
  function _assertValueLink(inputProps) {
34
36
  _assertSingleLink(inputProps);
35
- !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : void 0;
37
+ !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don\'t want to use valueLink.') : _prodInvariant('88') : void 0;
36
38
  }
37
39
 
38
40
  function _assertCheckedLink(inputProps) {
39
41
  _assertSingleLink(inputProps);
40
- !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : void 0;
42
+ !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don\'t want to use checkedLink') : _prodInvariant('89') : void 0;
41
43
  }
42
44
 
43
45
  var propTypes = {
@@ -11,9 +11,11 @@
11
11
  */
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var ReactNativeAttributePayload = require('./ReactNativeAttributePayload');
15
- var TextInputState = require('TextInputState');
16
- var UIManager = require('UIManager');
17
+ var TextInputState = require('react-native/lib/TextInputState');
18
+ var UIManager = require('react-native/lib/UIManager');
17
19
 
18
20
  var findNodeHandle = require('./findNodeHandle');
19
21
  var invariant = require('fbjs/lib/invariant');
@@ -140,7 +142,7 @@ if (process.env.NODE_ENV !== 'production') {
140
142
  // __DEV__ without actually implementing them (setting them to undefined
141
143
  // isn't allowed by ReactClass)
142
144
  var NativeMethodsMixin_DEV = NativeMethodsMixin;
143
- !(!NativeMethodsMixin_DEV.componentWillMount && !NativeMethodsMixin_DEV.componentWillReceiveProps) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Do not override existing functions.') : invariant(false) : void 0;
145
+ !(!NativeMethodsMixin_DEV.componentWillMount && !NativeMethodsMixin_DEV.componentWillReceiveProps) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Do not override existing functions.') : _prodInvariant('16') : void 0;
144
146
  NativeMethodsMixin_DEV.componentWillMount = function () {
145
147
  throwOnStylesProp(this, this.props);
146
148
  };
@@ -153,7 +155,7 @@ if (process.env.NODE_ENV !== 'production') {
153
155
  * In the future, we should cleanup callbacks by cancelling them instead of
154
156
  * using this.
155
157
  */
156
- var mountSafeCallback = function (context, callback) {
158
+ function mountSafeCallback(context, callback) {
157
159
  return function () {
158
160
  if (!callback || context.isMounted && !context.isMounted()) {
159
161
  return undefined;
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var invariant = require('fbjs/lib/invariant');
15
17
 
16
18
  /**
@@ -77,7 +79,7 @@ var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
77
79
 
78
80
  var standardReleaser = function (instance) {
79
81
  var Klass = this;
80
- !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : void 0;
82
+ !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
81
83
  instance.destructor();
82
84
  if (Klass.instancePool.length < Klass.poolSize) {
83
85
  Klass.instancePool.push(instance);
@@ -91,7 +93,7 @@ var DEFAULT_POOLER = oneArgumentPooler;
91
93
  * Augments `CopyConstructor` to be a poolable class, augmenting only the class
92
94
  * itself (statically) not adding any prototypical fields. Any CopyConstructor
93
95
  * you give this may have a `poolSize` property, and will look for a
94
- * prototypical `destructor` on instances (optional).
96
+ * prototypical `destructor` on instances.
95
97
  *
96
98
  * @param {Function} CopyConstructor Constructor that can be used to reset.
97
99
  * @param {Function} pooler Customizable pooler.
package/lib/React.js CHANGED
@@ -18,7 +18,6 @@ var ReactComponent = require('./ReactComponent');
18
18
  var ReactClass = require('./ReactClass');
19
19
  var ReactDOMFactories = require('./ReactDOMFactories');
20
20
  var ReactElement = require('./ReactElement');
21
- var ReactElementValidator = require('./ReactElementValidator');
22
21
  var ReactPropTypes = require('./ReactPropTypes');
23
22
  var ReactVersion = require('./ReactVersion');
24
23
 
@@ -30,6 +29,7 @@ var createFactory = ReactElement.createFactory;
30
29
  var cloneElement = ReactElement.cloneElement;
31
30
 
32
31
  if (process.env.NODE_ENV !== 'production') {
32
+ var ReactElementValidator = require('./ReactElementValidator');
33
33
  createElement = ReactElementValidator.createElement;
34
34
  createFactory = ReactElementValidator.createFactory;
35
35
  cloneElement = ReactElementValidator.cloneElement;
@@ -85,7 +85,7 @@ var ReactCSSTransitionGroupChild = React.createClass({
85
85
  CSSCore.addClass(node, className);
86
86
 
87
87
  // Need to do this to actually trigger a transition.
88
- this.queueClass(activeClassName);
88
+ this.queueClassAndNode(activeClassName, node);
89
89
 
90
90
  // If the user specified a timeout delay.
91
91
  if (userSpecifiedDelay) {
@@ -98,24 +98,29 @@ var ReactCSSTransitionGroupChild = React.createClass({
98
98
  }
99
99
  },
100
100
 
101
- queueClass: function (className) {
102
- this.classNameQueue.push(className);
101
+ queueClassAndNode: function (className, node) {
102
+ this.classNameAndNodeQueue.push({
103
+ className: className,
104
+ node: node
105
+ });
103
106
 
104
107
  if (!this.timeout) {
105
- this.timeout = setTimeout(this.flushClassNameQueue, TICK);
108
+ this.timeout = setTimeout(this.flushClassNameAndNodeQueue, TICK);
106
109
  }
107
110
  },
108
111
 
109
- flushClassNameQueue: function () {
112
+ flushClassNameAndNodeQueue: function () {
110
113
  if (this.isMounted()) {
111
- this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this)));
114
+ this.classNameAndNodeQueue.forEach(function (obj) {
115
+ CSSCore.addClass(obj.node, obj.className);
116
+ });
112
117
  }
113
- this.classNameQueue.length = 0;
118
+ this.classNameAndNodeQueue.length = 0;
114
119
  this.timeout = null;
115
120
  },
116
121
 
117
122
  componentWillMount: function () {
118
- this.classNameQueue = [];
123
+ this.classNameAndNodeQueue = [];
119
124
  this.transitionTimeouts = [];
120
125
  },
121
126
 
@@ -126,6 +131,8 @@ var ReactCSSTransitionGroupChild = React.createClass({
126
131
  this.transitionTimeouts.forEach(function (timeout) {
127
132
  clearTimeout(timeout);
128
133
  });
134
+
135
+ this.classNameAndNodeQueue.length = 0;
129
136
  },
130
137
 
131
138
  componentWillAppear: function (done) {
@@ -19,14 +19,15 @@ var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
19
19
  var traverseAllChildren = require('./traverseAllChildren');
20
20
  var warning = require('fbjs/lib/warning');
21
21
 
22
- function instantiateChild(childInstances, child, name) {
22
+ function instantiateChild(childInstances, child, name, selfDebugID) {
23
23
  // We found a component instance.
24
24
  var keyUnique = childInstances[name] === undefined;
25
25
  if (process.env.NODE_ENV !== 'production') {
26
- process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', KeyEscapeUtils.unescape(name)) : void 0;
26
+ var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
27
+ process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeDevtool.getStackAddendumByID(selfDebugID)) : void 0;
27
28
  }
28
29
  if (child != null && keyUnique) {
29
- childInstances[name] = instantiateReactComponent(child);
30
+ childInstances[name] = instantiateReactComponent(child, true);
30
31
  }
31
32
  }
32
33
 
@@ -44,12 +45,20 @@ var ReactChildReconciler = {
44
45
  * @return {?object} A set of child instances.
45
46
  * @internal
46
47
  */
47
- instantiateChildren: function (nestedChildNodes, transaction, context) {
48
+ instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // __DEV__ only
49
+ ) {
48
50
  if (nestedChildNodes == null) {
49
51
  return null;
50
52
  }
51
53
  var childInstances = {};
52
- traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
54
+
55
+ if (process.env.NODE_ENV !== 'production') {
56
+ traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
57
+ return instantiateChild(childInsts, child, name, selfDebugID);
58
+ }, childInstances);
59
+ } else {
60
+ traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
61
+ }
53
62
  return childInstances;
54
63
  },
55
64
 
@@ -86,11 +95,11 @@ var ReactChildReconciler = {
86
95
  nextChildren[name] = prevChild;
87
96
  } else {
88
97
  if (prevChild) {
89
- removedNodes[name] = ReactReconciler.getNativeNode(prevChild);
98
+ removedNodes[name] = ReactReconciler.getHostNode(prevChild);
90
99
  ReactReconciler.unmountComponent(prevChild, false);
91
100
  }
92
101
  // The child must be instantiated before it's mounted.
93
- var nextChildInstance = instantiateReactComponent(nextElement);
102
+ var nextChildInstance = instantiateReactComponent(nextElement, true);
94
103
  nextChildren[name] = nextChildInstance;
95
104
  }
96
105
  }
@@ -98,7 +107,7 @@ var ReactChildReconciler = {
98
107
  for (name in prevChildren) {
99
108
  if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
100
109
  prevChild = prevChildren[name];
101
- removedNodes[name] = ReactReconciler.getNativeNode(prevChild);
110
+ removedNodes[name] = ReactReconciler.getHostNode(prevChild);
102
111
  ReactReconciler.unmountComponent(prevChild, false);
103
112
  }
104
113
  }
package/lib/ReactClass.js CHANGED
@@ -11,7 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var _assign = require('object-assign');
14
+ var _prodInvariant = require('./reactProdInvariant'),
15
+ _assign = require('object-assign');
15
16
 
16
17
  var ReactComponent = require('./ReactComponent');
17
18
  var ReactElement = require('./ReactElement');
@@ -56,7 +57,7 @@ var injectedMixins = [];
56
57
 
57
58
  /**
58
59
  * Composite components are higher-level components that compose other composite
59
- * or native components.
60
+ * or host components.
60
61
  *
61
62
  * To create a new type of `ReactClass`, pass a specification of
62
63
  * your new class to `React.createClass`. The only requirement of your class
@@ -369,12 +370,12 @@ function validateMethodOverride(isAlreadyDefined, name) {
369
370
 
370
371
  // Disallow overriding of base class methods unless explicitly allowed.
371
372
  if (ReactClassMixin.hasOwnProperty(name)) {
372
- !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : void 0;
373
+ !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0;
373
374
  }
374
375
 
375
376
  // Disallow defining methods more than once unless explicitly allowed.
376
377
  if (isAlreadyDefined) {
377
- !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : void 0;
378
+ !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0;
378
379
  }
379
380
  }
380
381
 
@@ -387,8 +388,8 @@ function mixSpecIntoComponent(Constructor, spec) {
387
388
  return;
388
389
  }
389
390
 
390
- !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.') : invariant(false) : void 0;
391
- !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : void 0;
391
+ !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0;
392
+ !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0;
392
393
 
393
394
  var proto = Constructor.prototype;
394
395
  var autoBindPairs = proto.__reactAutoBindPairs;
@@ -433,7 +434,7 @@ function mixSpecIntoComponent(Constructor, spec) {
433
434
  var specPolicy = ReactClassInterface[name];
434
435
 
435
436
  // These cases should already be caught by validateMethodOverride.
436
- !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : void 0;
437
+ !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0;
437
438
 
438
439
  // For methods which are defined more than once, call the existing
439
440
  // methods before calling the new property, merging if appropriate.
@@ -468,10 +469,10 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
468
469
  }
469
470
 
470
471
  var isReserved = name in RESERVED_SPEC_KEYS;
471
- !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : void 0;
472
+ !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : _prodInvariant('78', name) : void 0;
472
473
 
473
474
  var isInherited = name in Constructor;
474
- !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : void 0;
475
+ !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0;
475
476
  Constructor[name] = property;
476
477
  }
477
478
  }
@@ -484,11 +485,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
484
485
  * @return {object} one after it has been mutated to contain everything in two.
485
486
  */
486
487
  function mergeIntoWithNoDuplicateKeys(one, two) {
487
- !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : void 0;
488
+ !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
488
489
 
489
490
  for (var key in two) {
490
491
  if (two.hasOwnProperty(key)) {
491
- !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : void 0;
492
+ !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : _prodInvariant('81', key) : void 0;
492
493
  one[key] = two[key];
493
494
  }
494
495
  }
@@ -666,7 +667,7 @@ var ReactClass = {
666
667
  initialState = null;
667
668
  }
668
669
  }
669
- !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : void 0;
670
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0;
670
671
 
671
672
  this.state = initialState;
672
673
  };
@@ -696,7 +697,7 @@ var ReactClass = {
696
697
  }
697
698
  }
698
699
 
699
- !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : void 0;
700
+ !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
700
701
 
701
702
  if (process.env.NODE_ENV !== 'production') {
702
703
  process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0;
@@ -11,8 +11,9 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
15
- var ReactInstrumentation = require('./ReactInstrumentation');
16
17
 
17
18
  var canDefineProperty = require('./canDefineProperty');
18
19
  var emptyObject = require('fbjs/lib/emptyObject');
@@ -59,11 +60,7 @@ ReactComponent.prototype.isReactComponent = {};
59
60
  * @protected
60
61
  */
61
62
  ReactComponent.prototype.setState = function (partialState, callback) {
62
- !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : void 0;
63
- if (process.env.NODE_ENV !== 'production') {
64
- ReactInstrumentation.debugTool.onSetState();
65
- process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
66
- }
63
+ !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0;
67
64
  this.updater.enqueueSetState(this, partialState);
68
65
  if (callback) {
69
66
  this.updater.enqueueCallback(this, callback, 'setState');