react 15.0.3-alpha.2 → 15.2.0-rc.2

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 (121) hide show
  1. package/dist/react-with-addons.js +3324 -2009
  2. package/dist/react-with-addons.min.js +7 -6
  3. package/dist/react.js +2736 -2005
  4. package/dist/react.min.js +6 -6
  5. package/lib/CSSPropertyOperations.js +5 -5
  6. package/lib/CallbackQueue.js +3 -2
  7. package/lib/DOMChildrenOperations.js +42 -7
  8. package/lib/DOMLazyTree.js +9 -3
  9. package/lib/DOMProperty.js +6 -4
  10. package/lib/DOMPropertyOperations.js +35 -12
  11. package/lib/Danger.js +10 -8
  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/LinkedStateMixin.js +1 -0
  18. package/lib/LinkedValueUtils.js +5 -3
  19. package/lib/NativeMethodsMixin.js +6 -4
  20. package/lib/PooledClass.js +3 -1
  21. package/lib/React.js +1 -1
  22. package/lib/ReactCSSTransitionGroup.js +5 -0
  23. package/lib/ReactCSSTransitionGroupChild.js +15 -8
  24. package/lib/ReactChildReconciler.js +15 -6
  25. package/lib/ReactChildren.js +9 -1
  26. package/lib/ReactClass.js +15 -13
  27. package/lib/ReactComponent.js +3 -6
  28. package/lib/ReactComponentBrowserEnvironment.js +0 -5
  29. package/lib/ReactComponentEnvironment.js +3 -1
  30. package/lib/ReactComponentTreeDevtool.js +223 -0
  31. package/lib/ReactComponentTreeTestUtils.js +87 -0
  32. package/lib/ReactComponentWithPureRenderMixin.js +2 -0
  33. package/lib/ReactCompositeComponent.js +208 -119
  34. package/lib/ReactDOM.js +3 -6
  35. package/lib/ReactDOMButton.js +2 -2
  36. package/lib/ReactDOMComponent.js +162 -68
  37. package/lib/ReactDOMComponentTree.js +23 -21
  38. package/lib/ReactDOMDebugTool.js +7 -1
  39. package/lib/ReactDOMEmptyComponent.js +9 -9
  40. package/lib/ReactDOMFactories.js +1 -1
  41. package/lib/ReactDOMIDOperations.js +0 -5
  42. package/lib/ReactDOMInput.js +56 -18
  43. package/lib/ReactDOMOption.js +40 -26
  44. package/lib/ReactDOMSelect.js +3 -3
  45. package/lib/ReactDOMTextComponent.js +28 -26
  46. package/lib/ReactDOMTextarea.js +59 -32
  47. package/lib/ReactDOMTreeTraversal.js +18 -16
  48. package/lib/ReactDOMUnknownPropertyDevtool.js +65 -17
  49. package/lib/ReactDebugTool.js +250 -11
  50. package/lib/ReactDefaultInjection.js +2 -11
  51. package/lib/ReactElement.js +90 -25
  52. package/lib/ReactElementValidator.js +26 -81
  53. package/lib/ReactEventListener.js +2 -2
  54. package/lib/ReactFragment.js +8 -3
  55. package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
  56. package/lib/ReactHostOperationHistoryDevtool.js +37 -0
  57. package/lib/ReactInjection.js +2 -4
  58. package/lib/ReactInstanceHandles.js +8 -6
  59. package/lib/ReactLink.js +3 -0
  60. package/lib/ReactMount.js +43 -20
  61. package/lib/ReactMultiChild.js +51 -8
  62. package/lib/ReactNativeAttributePayload.js +5 -2
  63. package/lib/ReactNativeBaseComponent.js +7 -7
  64. package/lib/ReactNativeBridgeEventPlugin.js +1 -1
  65. package/lib/ReactNativeComponentTree.js +8 -6
  66. package/lib/ReactNativeDOMIDOperations.js +4 -8
  67. package/lib/ReactNativeDefaultInjection.js +9 -7
  68. package/lib/ReactNativeGlobalResponderHandler.js +1 -1
  69. package/lib/ReactNativeMount.js +25 -8
  70. package/lib/ReactNativeTagHandles.js +3 -1
  71. package/lib/ReactNativeTextComponent.js +18 -9
  72. package/lib/ReactNativeTreeTraversal.js +11 -11
  73. package/lib/ReactNodeTypes.js +5 -3
  74. package/lib/ReactNoop.js +76 -0
  75. package/lib/ReactOwner.js +4 -2
  76. package/lib/ReactPerf.js +473 -75
  77. package/lib/ReactPropTypes.js +23 -0
  78. package/lib/ReactReconcileTransaction.js +1 -1
  79. package/lib/ReactReconciler.js +57 -11
  80. package/lib/ReactServerRendering.js +24 -3
  81. package/lib/ReactSimpleEmptyComponent.js +4 -4
  82. package/lib/ReactTestMount.js +126 -0
  83. package/lib/ReactTestReconcileTransaction.js +100 -0
  84. package/lib/ReactTestRenderer.js +133 -0
  85. package/lib/ReactTestUtils.js +25 -10
  86. package/lib/ReactTransitionChildMapping.js +7 -1
  87. package/lib/ReactTransitionGroup.js +44 -5
  88. package/lib/ReactUpdateQueue.js +9 -1
  89. package/lib/ReactUpdates.js +30 -11
  90. package/lib/ReactVersion.js +1 -1
  91. package/lib/ReactWithAddons.js +1 -1
  92. package/lib/ResponderEventPlugin.js +8 -6
  93. package/lib/ResponderTouchHistoryStore.js +6 -4
  94. package/lib/SimpleEventPlugin.js +3 -1
  95. package/lib/SyntheticEvent.js +2 -3
  96. package/lib/SyntheticUIEvent.js +1 -1
  97. package/lib/Transaction.js +4 -2
  98. package/lib/accumulate.js +3 -1
  99. package/lib/accumulateInto.js +3 -1
  100. package/lib/checkReactTypeSpec.js +71 -0
  101. package/lib/createReactNativeComponentClass.js +2 -2
  102. package/lib/dangerousStyleValue.js +3 -1
  103. package/lib/escapeTextContentForBrowser.js +96 -12
  104. package/lib/findDOMNode.js +8 -4
  105. package/lib/findNodeHandle.js +5 -3
  106. package/lib/flattenChildren.js +13 -4
  107. package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
  108. package/lib/instantiateReactComponent.js +44 -10
  109. package/lib/onlyChild.js +10 -5
  110. package/lib/reactComponentExpect.js +3 -3
  111. package/lib/reactProdInvariant.js +38 -0
  112. package/lib/setInnerHTML.js +17 -1
  113. package/lib/setTextContent.js +8 -0
  114. package/lib/shallowCompare.js +1 -0
  115. package/lib/traverseAllChildren.js +3 -1
  116. package/lib/update.js +16 -11
  117. package/package.json +2 -2
  118. package/lib/MetaMatchers.js +0 -118
  119. package/lib/ReactDebugInstanceMap.js +0 -102
  120. package/lib/ReactDefaultPerf.js +0 -316
  121. package/lib/ReactDefaultPerfAnalysis.js +0 -210
@@ -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,
@@ -16,6 +16,7 @@ var ReactStateSetters = require('./ReactStateSetters');
16
16
 
17
17
  /**
18
18
  * A simple mixin around ReactLink.forState().
19
+ * See https://facebook.github.io/react/docs/two-way-binding-helpers.html
19
20
  */
20
21
  var LinkedStateMixin = {
21
22
  /**
@@ -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);
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;
@@ -37,6 +37,11 @@ function createTransitionTimeoutPropValidator(transitionType) {
37
37
  };
38
38
  }
39
39
 
40
+ /**
41
+ * An easy way to perform CSS transitions and animations when a React component
42
+ * enters or leaves the DOM.
43
+ * See https://facebook.github.io/react/docs/animation.html#high-level-api-reactcsstransitiongroup
44
+ */
40
45
  var ReactCSSTransitionGroup = React.createClass({
41
46
  displayName: 'ReactCSSTransitionGroup',
42
47
 
@@ -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) {
@@ -13,17 +13,18 @@
13
13
 
14
14
  var ReactReconciler = require('./ReactReconciler');
15
15
 
16
+ var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
16
17
  var instantiateReactComponent = require('./instantiateReactComponent');
17
18
  var KeyEscapeUtils = require('./KeyEscapeUtils');
18
19
  var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
19
20
  var traverseAllChildren = require('./traverseAllChildren');
20
21
  var warning = require('fbjs/lib/warning');
21
22
 
22
- function instantiateChild(childInstances, child, name) {
23
+ function instantiateChild(childInstances, child, name, selfDebugID) {
23
24
  // We found a component instance.
24
25
  var keyUnique = childInstances[name] === undefined;
25
26
  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;
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
30
  childInstances[name] = instantiateReactComponent(child);
@@ -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,7 +95,7 @@ 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.
@@ -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
  }
@@ -55,6 +55,8 @@ function forEachSingleChild(bookKeeping, child, name) {
55
55
  /**
56
56
  * Iterates through children that are typically specified as `props.children`.
57
57
  *
58
+ * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
59
+ *
58
60
  * The provided forEachFunc(child, index) will be called for each
59
61
  * leaf child.
60
62
  *
@@ -130,7 +132,9 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
130
132
  /**
131
133
  * Maps children that are typically specified as `props.children`.
132
134
  *
133
- * The provided mapFunction(child, index) will be called for each
135
+ * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
136
+ *
137
+ * The provided mapFunction(child, key, index) will be called for each
134
138
  * leaf child.
135
139
  *
136
140
  * @param {?*} children Children tree container.
@@ -155,6 +159,8 @@ function forEachSingleChildDummy(traverseContext, child, name) {
155
159
  * Count the number of children that are typically specified as
156
160
  * `props.children`.
157
161
  *
162
+ * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
163
+ *
158
164
  * @param {?*} children Children tree container.
159
165
  * @return {number} The number of children.
160
166
  */
@@ -165,6 +171,8 @@ function countChildren(children, context) {
165
171
  /**
166
172
  * Flatten a children object (typically specified as `props.children`) and
167
173
  * return an array with appropriately re-keyed children.
174
+ *
175
+ * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
168
176
  */
169
177
  function toArray(children) {
170
178
  var result = [];
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
  }
@@ -627,6 +628,7 @@ var ReactClass = {
627
628
 
628
629
  /**
629
630
  * Creates a composite component class given a class specification.
631
+ * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
630
632
  *
631
633
  * @param {object} spec Class specification (which must define `render`).
632
634
  * @return {function} Component constructor function.
@@ -665,7 +667,7 @@ var ReactClass = {
665
667
  initialState = null;
666
668
  }
667
669
  }
668
- !(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;
669
671
 
670
672
  this.state = initialState;
671
673
  };
@@ -695,7 +697,7 @@ var ReactClass = {
695
697
  }
696
698
  }
697
699
 
698
- !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;
699
701
 
700
702
  if (process.env.NODE_ENV !== 'production') {
701
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;