react 0.13.3 → 0.14.0-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/README.md +5 -2
  2. package/addons.js +7 -0
  3. package/dist/JSXTransformer.js +4101 -2432
  4. package/dist/react-with-addons.js +4389 -6277
  5. package/dist/react-with-addons.min.js +6 -8
  6. package/dist/react.js +4028 -5697
  7. package/dist/react.min.js +5 -6
  8. package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +16 -5
  9. package/lib/BeforeInputEventPlugin.js +30 -118
  10. package/lib/CSSCore.js +12 -23
  11. package/lib/CSSProperty.js +4 -3
  12. package/lib/CSSPropertyOperations.js +14 -30
  13. package/lib/CallbackQueue.js +7 -10
  14. package/lib/ChangeEventPlugin.js +26 -88
  15. package/lib/ClientReactRootIndex.js +2 -2
  16. package/lib/DOMChildrenOperations.js +13 -33
  17. package/lib/DOMProperty.js +86 -147
  18. package/lib/DOMPropertyOperations.js +91 -67
  19. package/lib/Danger.js +19 -62
  20. package/lib/DefaultEventPluginOrder.js +2 -12
  21. package/lib/EnterLeaveEventPlugin.js +11 -33
  22. package/lib/EventConstants.js +2 -2
  23. package/lib/EventListener.js +11 -13
  24. package/lib/EventPluginHub.js +44 -47
  25. package/lib/EventPluginRegistry.js +18 -74
  26. package/lib/EventPluginUtils.js +33 -44
  27. package/lib/EventPropagators.js +23 -26
  28. package/lib/ExecutionEnvironment.js +4 -8
  29. package/lib/FallbackCompositionState.js +3 -3
  30. package/lib/HTMLDOMPropertyConfig.js +15 -20
  31. package/lib/LinkedStateMixin.js +3 -6
  32. package/lib/LinkedValueUtils.js +71 -89
  33. package/lib/Object.assign.js +1 -1
  34. package/lib/PooledClass.js +20 -11
  35. package/lib/React.js +9 -129
  36. package/lib/ReactBrowserComponentMixin.js +9 -2
  37. package/lib/ReactBrowserEventEmitter.js +26 -82
  38. package/lib/ReactCSSTransitionGroup.js +13 -24
  39. package/lib/ReactCSSTransitionGroupChild.js +26 -28
  40. package/lib/ReactChildReconciler.js +11 -19
  41. package/lib/ReactChildren.js +24 -31
  42. package/lib/ReactClass.js +96 -267
  43. package/lib/ReactComponent.js +28 -57
  44. package/lib/ReactComponentBrowserEnvironment.js +4 -8
  45. package/lib/ReactComponentEnvironment.js +6 -12
  46. package/lib/ReactComponentWithPureRenderMixin.js +6 -7
  47. package/lib/ReactCompositeComponent.js +115 -381
  48. package/lib/ReactCurrentOwner.js +1 -3
  49. package/lib/ReactDOM.js +4 -2
  50. package/lib/ReactDOMButton.js +16 -28
  51. package/lib/ReactDOMClient.js +90 -0
  52. package/lib/ReactDOMComponent.js +468 -156
  53. package/lib/ReactDOMIDOperations.js +25 -22
  54. package/lib/ReactDOMInput.js +79 -108
  55. package/lib/ReactDOMOption.js +58 -20
  56. package/lib/ReactDOMSelect.js +95 -83
  57. package/lib/ReactDOMSelection.js +5 -20
  58. package/lib/ReactDOMServer.js +24 -0
  59. package/lib/ReactDOMTextComponent.js +17 -18
  60. package/lib/ReactDOMTextarea.js +44 -69
  61. package/lib/ReactDefaultBatchingStrategy.js +9 -13
  62. package/lib/ReactDefaultInjection.js +20 -76
  63. package/lib/ReactDefaultPerf.js +36 -69
  64. package/lib/ReactDefaultPerfAnalysis.js +8 -14
  65. package/lib/ReactElement.js +26 -120
  66. package/lib/ReactElementValidator.js +56 -192
  67. package/lib/ReactEmptyComponent.js +7 -11
  68. package/lib/ReactErrorUtils.js +3 -3
  69. package/lib/ReactEventEmitterMixin.js +3 -13
  70. package/lib/ReactEventListener.js +58 -40
  71. package/lib/ReactFragment.js +33 -59
  72. package/lib/ReactInjection.js +1 -1
  73. package/lib/ReactInputSelection.js +14 -23
  74. package/lib/ReactInstanceHandles.js +29 -58
  75. package/lib/ReactInstanceMap.js +5 -5
  76. package/lib/ReactIsomorphic.js +70 -0
  77. package/lib/ReactLink.js +2 -4
  78. package/lib/ReactMarkupChecksum.js +5 -10
  79. package/lib/ReactMount.js +142 -285
  80. package/lib/ReactMultiChild.js +19 -45
  81. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  82. package/lib/ReactNativeComponent.js +6 -15
  83. package/lib/ReactNoopUpdateQueue.js +118 -0
  84. package/lib/ReactOwner.js +7 -24
  85. package/lib/ReactPerf.js +8 -12
  86. package/lib/ReactPropTransferer.js +4 -4
  87. package/lib/ReactPropTypeLocationNames.js +2 -2
  88. package/lib/ReactPropTypeLocations.js +1 -1
  89. package/lib/ReactPropTypes.js +41 -61
  90. package/lib/ReactReconcileTransaction.js +11 -36
  91. package/lib/ReactReconciler.js +14 -26
  92. package/lib/ReactRef.js +5 -8
  93. package/lib/ReactRootIndex.js +2 -2
  94. package/lib/ReactServerBatchingStrategy.js +23 -0
  95. package/lib/ReactServerRendering.js +20 -15
  96. package/lib/ReactServerRenderingTransaction.js +9 -34
  97. package/lib/ReactStateSetters.js +6 -6
  98. package/lib/ReactTestUtils.js +137 -190
  99. package/lib/ReactTransitionChildMapping.js +5 -7
  100. package/lib/ReactTransitionEvents.js +5 -5
  101. package/lib/ReactTransitionGroup.js +30 -52
  102. package/lib/ReactUpdateQueue.js +69 -107
  103. package/lib/ReactUpdates.js +26 -81
  104. package/lib/ReactWithAddons.js +5 -6
  105. package/lib/SVGDOMPropertyConfig.js +39 -4
  106. package/lib/SelectEventPlugin.js +31 -33
  107. package/lib/ServerReactRootIndex.js +2 -2
  108. package/lib/SimpleEventPlugin.js +138 -130
  109. package/lib/SyntheticClipboardEvent.js +5 -9
  110. package/lib/SyntheticCompositionEvent.js +4 -10
  111. package/lib/SyntheticDragEvent.js +3 -3
  112. package/lib/SyntheticEvent.js +14 -15
  113. package/lib/SyntheticFocusEvent.js +3 -3
  114. package/lib/SyntheticInputEvent.js +4 -10
  115. package/lib/SyntheticKeyboardEvent.js +6 -6
  116. package/lib/SyntheticMouseEvent.js +10 -16
  117. package/lib/SyntheticTouchEvent.js +3 -3
  118. package/lib/SyntheticUIEvent.js +5 -5
  119. package/lib/SyntheticWheelEvent.js +13 -17
  120. package/lib/Transaction.js +22 -28
  121. package/lib/ViewportMetrics.js +2 -2
  122. package/lib/accumulateInto.js +2 -5
  123. package/lib/adler32.js +2 -4
  124. package/lib/camelize.js +4 -2
  125. package/lib/camelizeStyleName.js +2 -2
  126. package/lib/cloneWithProps.js +6 -12
  127. package/lib/containsNode.js +29 -16
  128. package/lib/createArrayFromMixed.js +17 -16
  129. package/lib/createNodesFromMarkup.js +6 -8
  130. package/lib/dangerousStyleValue.js +2 -3
  131. package/lib/deprecated.js +47 -0
  132. package/lib/emptyFunction.js +10 -4
  133. package/lib/emptyObject.js +1 -1
  134. package/lib/escapeTextContentForBrowser.js +1 -1
  135. package/lib/findDOMNode.js +7 -27
  136. package/lib/flattenChildren.js +4 -10
  137. package/lib/focusNode.js +2 -3
  138. package/lib/forEachAccumulated.js +3 -3
  139. package/lib/getActiveElement.js +4 -2
  140. package/lib/getEventCharCode.js +2 -2
  141. package/lib/getEventKey.js +1 -1
  142. package/lib/getEventModifierState.js +1 -2
  143. package/lib/getEventTarget.js +1 -1
  144. package/lib/getIteratorFn.js +2 -4
  145. package/lib/getMarkupWrap.js +18 -40
  146. package/lib/getNodeForCharacterOffset.js +1 -1
  147. package/lib/getTextContentAccessor.js +2 -4
  148. package/lib/getUnboundedScrollPosition.js +1 -1
  149. package/lib/hyphenate.js +3 -1
  150. package/lib/hyphenateStyleName.js +2 -2
  151. package/lib/instantiateReactComponent.js +23 -43
  152. package/lib/invariant.js +8 -12
  153. package/lib/isEventSupported.js +7 -10
  154. package/lib/isNode.js +4 -6
  155. package/lib/isTextInputElement.js +3 -4
  156. package/lib/isTextNode.js +3 -1
  157. package/lib/joinClasses.js +3 -3
  158. package/lib/keyMirror.js +3 -6
  159. package/lib/keyOf.js +4 -3
  160. package/lib/mapObject.js +1 -1
  161. package/lib/memoizeStringOnly.js +2 -2
  162. package/lib/onlyChild.js +2 -5
  163. package/lib/performance.js +2 -5
  164. package/lib/performanceNow.js +3 -1
  165. package/lib/quoteAttributeValueForBrowser.js +1 -1
  166. package/lib/renderSubtreeIntoContainer.js +16 -0
  167. package/lib/setInnerHTML.js +11 -8
  168. package/lib/setTextContent.js +3 -3
  169. package/lib/shallowCompare.js +24 -0
  170. package/lib/shallowEqual.js +17 -11
  171. package/lib/shouldUpdateReactComponent.js +3 -64
  172. package/lib/toArray.js +8 -19
  173. package/lib/traverseAllChildren.js +23 -90
  174. package/lib/update.js +25 -85
  175. package/lib/validateDOMNesting.js +363 -0
  176. package/lib/warning.js +15 -17
  177. package/package.json +3 -3
  178. package/react.js +53 -1
  179. package/lib/LocalEventTrapMixin.js +0 -53
  180. package/lib/MobileSafariClickEventPlugin.js +0 -56
  181. package/lib/ReactContext.js +0 -74
  182. package/lib/ReactDOMForm.js +0 -47
  183. package/lib/ReactDOMIframe.js +0 -43
  184. package/lib/ReactDOMImg.js +0 -44
  185. package/lib/ReactLifeCycle.js +0 -35
  186. package/lib/ReactPutListenerQueue.js +0 -54
  187. package/lib/createFullPageComponent.js +0 -58
  188. package/lib/cx.js +0 -52
  189. package/lib/getReactRootElementInContainer.js +0 -33
@@ -134,10 +134,7 @@ function enqueueTextContent(parentID, textContent) {
134
134
  */
135
135
  function processQueue() {
136
136
  if (updateQueue.length) {
137
- ReactComponentEnvironment.processChildrenUpdates(
138
- updateQueue,
139
- markupQueue
140
- );
137
+ ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
141
138
  clearQueue();
142
139
  }
143
140
  }
@@ -177,10 +174,8 @@ var ReactMultiChild = {
177
174
  * @return {array} An array of mounted representations.
178
175
  * @internal
179
176
  */
180
- mountChildren: function(nestedChildren, transaction, context) {
181
- var children = ReactChildReconciler.instantiateChildren(
182
- nestedChildren, transaction, context
183
- );
177
+ mountChildren: function (nestedChildren, transaction, context) {
178
+ var children = ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
184
179
  this._renderedChildren = children;
185
180
  var mountImages = [];
186
181
  var index = 0;
@@ -189,12 +184,7 @@ var ReactMultiChild = {
189
184
  var child = children[name];
190
185
  // Inlined for performance, see `ReactInstanceHandles.createReactID`.
191
186
  var rootID = this._rootNodeID + name;
192
- var mountImage = ReactReconciler.mountComponent(
193
- child,
194
- rootID,
195
- transaction,
196
- context
197
- );
187
+ var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
198
188
  child._mountIndex = index;
199
189
  mountImages.push(mountImage);
200
190
  index++;
@@ -209,7 +199,7 @@ var ReactMultiChild = {
209
199
  * @param {string} nextContent String of content.
210
200
  * @internal
211
201
  */
212
- updateTextContent: function(nextContent) {
202
+ updateTextContent: function (nextContent) {
213
203
  updateDepth++;
214
204
  var errorThrown = true;
215
205
  try {
@@ -244,7 +234,7 @@ var ReactMultiChild = {
244
234
  * @param {ReactReconcileTransaction} transaction
245
235
  * @internal
246
236
  */
247
- updateChildren: function(nextNestedChildren, transaction, context) {
237
+ updateChildren: function (nextNestedChildren, transaction, context) {
248
238
  updateDepth++;
249
239
  var errorThrown = true;
250
240
  try {
@@ -259,7 +249,6 @@ var ReactMultiChild = {
259
249
  processQueue();
260
250
  }
261
251
  }
262
-
263
252
  }
264
253
  },
265
254
 
@@ -272,11 +261,9 @@ var ReactMultiChild = {
272
261
  * @final
273
262
  * @protected
274
263
  */
275
- _updateChildren: function(nextNestedChildren, transaction, context) {
264
+ _updateChildren: function (nextNestedChildren, transaction, context) {
276
265
  var prevChildren = this._renderedChildren;
277
- var nextChildren = ReactChildReconciler.updateChildren(
278
- prevChildren, nextNestedChildren, transaction, context
279
- );
266
+ var nextChildren = ReactChildReconciler.updateChildren(prevChildren, nextNestedChildren, transaction, context);
280
267
  this._renderedChildren = nextChildren;
281
268
  if (!nextChildren && !prevChildren) {
282
269
  return;
@@ -303,16 +290,13 @@ var ReactMultiChild = {
303
290
  this._unmountChildByName(prevChild, name);
304
291
  }
305
292
  // The child must be instantiated before it's mounted.
306
- this._mountChildByNameAtIndex(
307
- nextChild, name, nextIndex, transaction, context
308
- );
293
+ this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
309
294
  }
310
295
  nextIndex++;
311
296
  }
312
297
  // Remove children that are no longer present.
313
298
  for (name in prevChildren) {
314
- if (prevChildren.hasOwnProperty(name) &&
315
- !(nextChildren && nextChildren.hasOwnProperty(name))) {
299
+ if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
316
300
  this._unmountChildByName(prevChildren[name], name);
317
301
  }
318
302
  }
@@ -324,7 +308,7 @@ var ReactMultiChild = {
324
308
  *
325
309
  * @internal
326
310
  */
327
- unmountChildren: function() {
311
+ unmountChildren: function () {
328
312
  var renderedChildren = this._renderedChildren;
329
313
  ReactChildReconciler.unmountChildren(renderedChildren);
330
314
  this._renderedChildren = null;
@@ -338,7 +322,7 @@ var ReactMultiChild = {
338
322
  * @param {number} lastIndex Last index visited of the siblings of `child`.
339
323
  * @protected
340
324
  */
341
- moveChild: function(child, toIndex, lastIndex) {
325
+ moveChild: function (child, toIndex, lastIndex) {
342
326
  // If the index of `child` is less than `lastIndex`, then it needs to
343
327
  // be moved. Otherwise, we do not need to move it because a child will be
344
328
  // inserted or moved before `child`.
@@ -354,7 +338,7 @@ var ReactMultiChild = {
354
338
  * @param {string} mountImage Markup to insert.
355
339
  * @protected
356
340
  */
357
- createChild: function(child, mountImage) {
341
+ createChild: function (child, mountImage) {
358
342
  enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
359
343
  },
360
344
 
@@ -364,7 +348,7 @@ var ReactMultiChild = {
364
348
  * @param {ReactComponent} child Child to remove.
365
349
  * @protected
366
350
  */
367
- removeChild: function(child) {
351
+ removeChild: function (child) {
368
352
  enqueueRemove(this._rootNodeID, child._mountIndex);
369
353
  },
370
354
 
@@ -374,7 +358,7 @@ var ReactMultiChild = {
374
358
  * @param {string} textContent Text content to set.
375
359
  * @protected
376
360
  */
377
- setTextContent: function(textContent) {
361
+ setTextContent: function (textContent) {
378
362
  enqueueTextContent(this._rootNodeID, textContent);
379
363
  },
380
364
 
@@ -389,20 +373,10 @@ var ReactMultiChild = {
389
373
  * @param {ReactReconcileTransaction} transaction
390
374
  * @private
391
375
  */
392
- _mountChildByNameAtIndex: function(
393
- child,
394
- name,
395
- index,
396
- transaction,
397
- context) {
376
+ _mountChildByNameAtIndex: function (child, name, index, transaction, context) {
398
377
  // Inlined for performance, see `ReactInstanceHandles.createReactID`.
399
378
  var rootID = this._rootNodeID + name;
400
- var mountImage = ReactReconciler.mountComponent(
401
- child,
402
- rootID,
403
- transaction,
404
- context
405
- );
379
+ var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
406
380
  child._mountIndex = index;
407
381
  this.createChild(child, mountImage);
408
382
  },
@@ -416,7 +390,7 @@ var ReactMultiChild = {
416
390
  * @param {string} name Name of the child in `this._renderedChildren`.
417
391
  * @private
418
392
  */
419
- _unmountChildByName: function(child, name) {
393
+ _unmountChildByName: function (child, name) {
420
394
  this.removeChild(child);
421
395
  child._mountIndex = null;
422
396
  }
@@ -425,4 +399,4 @@ var ReactMultiChild = {
425
399
 
426
400
  };
427
401
 
428
- module.exports = ReactMultiChild;
402
+ module.exports = ReactMultiChild;
@@ -28,4 +28,4 @@ var ReactMultiChildUpdateTypes = keyMirror({
28
28
  TEXT_CONTENT: null
29
29
  });
30
30
 
31
- module.exports = ReactMultiChildUpdateTypes;
31
+ module.exports = ReactMultiChildUpdateTypes;
@@ -16,30 +16,25 @@ var invariant = require("./invariant");
16
16
 
17
17
  var autoGenerateWrapperClass = null;
18
18
  var genericComponentClass = null;
19
- // This registry keeps track of wrapper classes around native tags
19
+ // This registry keeps track of wrapper classes around native tags.
20
20
  var tagToComponentClass = {};
21
21
  var textComponentClass = null;
22
22
 
23
23
  var ReactNativeComponentInjection = {
24
24
  // This accepts a class that receives the tag string. This is a catch all
25
25
  // that can render any kind of tag.
26
- injectGenericComponentClass: function(componentClass) {
26
+ injectGenericComponentClass: function (componentClass) {
27
27
  genericComponentClass = componentClass;
28
28
  },
29
29
  // This accepts a text component class that takes the text string to be
30
30
  // rendered as props.
31
- injectTextComponentClass: function(componentClass) {
31
+ injectTextComponentClass: function (componentClass) {
32
32
  textComponentClass = componentClass;
33
33
  },
34
34
  // This accepts a keyed object with classes as values. Each key represents a
35
35
  // tag. That particular tag will use this class instead of the generic one.
36
- injectComponentClasses: function(componentClasses) {
36
+ injectComponentClasses: function (componentClasses) {
37
37
  assign(tagToComponentClass, componentClasses);
38
- },
39
- // Temporary hack since we expect DOM refs to behave like composites,
40
- // for this release.
41
- injectAutoWrapper: function(wrapperFactory) {
42
- autoGenerateWrapperClass = wrapperFactory;
43
38
  }
44
39
  };
45
40
 
@@ -68,11 +63,7 @@ function getComponentClassForElement(element) {
68
63
  * @return {function} The internal class constructor function.
69
64
  */
70
65
  function createInternalComponent(element) {
71
- ("production" !== process.env.NODE_ENV ? invariant(
72
- genericComponentClass,
73
- 'There is no registered component for the tag %s',
74
- element.type
75
- ) : invariant(genericComponentClass));
66
+ !genericComponentClass ? 'production' !== process.env.NODE_ENV ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
76
67
  return new genericComponentClass(element.type, element.props);
77
68
  }
78
69
 
@@ -100,4 +91,4 @@ var ReactNativeComponent = {
100
91
  injection: ReactNativeComponentInjection
101
92
  };
102
93
 
103
- module.exports = ReactNativeComponent;
94
+ module.exports = ReactNativeComponent;
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Copyright 2015, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule ReactNoopUpdateQueue
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var warning = require("./warning");
15
+
16
+ function warnTDZ(publicInstance, callerName) {
17
+ if ('production' !== process.env.NODE_ENV) {
18
+ 'production' !== process.env.NODE_ENV ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
19
+ }
20
+ }
21
+
22
+ /**
23
+ * This is the abstract API for an update queue.
24
+ */
25
+ var ReactNoopUpdateQueue = {
26
+
27
+ /**
28
+ * Checks whether or not this composite component is mounted.
29
+ * @param {ReactClass} publicInstance The instance we want to test.
30
+ * @return {boolean} True if mounted, false otherwise.
31
+ * @protected
32
+ * @final
33
+ */
34
+ isMounted: function (publicInstance) {
35
+ return false;
36
+ },
37
+
38
+ /**
39
+ * Enqueue a callback that will be executed after all the pending updates
40
+ * have processed.
41
+ *
42
+ * @param {ReactClass} publicInstance The instance to use as `this` context.
43
+ * @param {?function} callback Called after state is updated.
44
+ * @internal
45
+ */
46
+ enqueueCallback: function (publicInstance, callback) {},
47
+
48
+ /**
49
+ * Forces an update. This should only be invoked when it is known with
50
+ * certainty that we are **not** in a DOM transaction.
51
+ *
52
+ * You may want to call this when you know that some deeper aspect of the
53
+ * component's state has changed but `setState` was not called.
54
+ *
55
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
56
+ * `componentWillUpdate` and `componentDidUpdate`.
57
+ *
58
+ * @param {ReactClass} publicInstance The instance that should rerender.
59
+ * @internal
60
+ */
61
+ enqueueForceUpdate: function (publicInstance) {
62
+ warnTDZ(publicInstance, 'forceUpdate');
63
+ },
64
+
65
+ /**
66
+ * Replaces all of the state. Always use this or `setState` to mutate state.
67
+ * You should treat `this.state` as immutable.
68
+ *
69
+ * There is no guarantee that `this.state` will be immediately updated, so
70
+ * accessing `this.state` after calling this method may return the old value.
71
+ *
72
+ * @param {ReactClass} publicInstance The instance that should rerender.
73
+ * @param {object} completeState Next state.
74
+ * @internal
75
+ */
76
+ enqueueReplaceState: function (publicInstance, completeState) {
77
+ warnTDZ(publicInstance, 'replaceState');
78
+ },
79
+
80
+ /**
81
+ * Sets a subset of the state. This only exists because _pendingState is
82
+ * internal. This provides a merging strategy that is not available to deep
83
+ * properties which is confusing. TODO: Expose pendingState or don't use it
84
+ * during the merge.
85
+ *
86
+ * @param {ReactClass} publicInstance The instance that should rerender.
87
+ * @param {object} partialState Next partial state to be merged with state.
88
+ * @internal
89
+ */
90
+ enqueueSetState: function (publicInstance, partialState) {
91
+ warnTDZ(publicInstance, 'setState');
92
+ },
93
+
94
+ /**
95
+ * Sets a subset of the props.
96
+ *
97
+ * @param {ReactClass} publicInstance The instance that should rerender.
98
+ * @param {object} partialProps Subset of the next props.
99
+ * @internal
100
+ */
101
+ enqueueSetProps: function (publicInstance, partialProps) {
102
+ warnTDZ(publicInstance, 'setProps');
103
+ },
104
+
105
+ /**
106
+ * Replaces all of the props.
107
+ *
108
+ * @param {ReactClass} publicInstance The instance that should rerender.
109
+ * @param {object} props New props.
110
+ * @internal
111
+ */
112
+ enqueueReplaceProps: function (publicInstance, props) {
113
+ warnTDZ(publicInstance, 'replaceProps');
114
+ }
115
+
116
+ };
117
+
118
+ module.exports = ReactNoopUpdateQueue;
package/lib/ReactOwner.js CHANGED
@@ -50,11 +50,8 @@ var ReactOwner = {
50
50
  * @return {boolean} True if `object` is a valid owner.
51
51
  * @final
52
52
  */
53
- isValidOwner: function(object) {
54
- return !!(
55
- (object &&
56
- typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
57
- );
53
+ isValidOwner: function (object) {
54
+ return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
58
55
  },
59
56
 
60
57
  /**
@@ -66,15 +63,8 @@ var ReactOwner = {
66
63
  * @final
67
64
  * @internal
68
65
  */
69
- addComponentAsRefTo: function(component, ref, owner) {
70
- ("production" !== process.env.NODE_ENV ? invariant(
71
- ReactOwner.isValidOwner(owner),
72
- 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
73
- 'usually means that you\'re trying to add a ref to a component that ' +
74
- 'doesn\'t have an owner (that is, was not created inside of another ' +
75
- 'component\'s `render` method). Try rendering this component inside of ' +
76
- 'a new top-level component which will hold the ref.'
77
- ) : invariant(ReactOwner.isValidOwner(owner)));
66
+ addComponentAsRefTo: function (component, ref, owner) {
67
+ !ReactOwner.isValidOwner(owner) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to add a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : invariant(false) : undefined;
78
68
  owner.attachRef(ref, component);
79
69
  },
80
70
 
@@ -87,15 +77,8 @@ var ReactOwner = {
87
77
  * @final
88
78
  * @internal
89
79
  */
90
- removeComponentAsRefFrom: function(component, ref, owner) {
91
- ("production" !== process.env.NODE_ENV ? invariant(
92
- ReactOwner.isValidOwner(owner),
93
- 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
94
- 'usually means that you\'re trying to remove a ref to a component that ' +
95
- 'doesn\'t have an owner (that is, was not created inside of another ' +
96
- 'component\'s `render` method). Try rendering this component inside of ' +
97
- 'a new top-level component which will hold the ref.'
98
- ) : invariant(ReactOwner.isValidOwner(owner)));
80
+ removeComponentAsRefFrom: function (component, ref, owner) {
81
+ !ReactOwner.isValidOwner(owner) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to remove a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : invariant(false) : undefined;
99
82
  // Check that `component` is still the current ref because we do not want to
100
83
  // detach the ref if another component stole it.
101
84
  if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
@@ -105,4 +88,4 @@ var ReactOwner = {
105
88
 
106
89
  };
107
90
 
108
- module.exports = ReactOwner;
91
+ module.exports = ReactOwner;
package/lib/ReactPerf.js CHANGED
@@ -34,17 +34,13 @@ var ReactPerf = {
34
34
  * @param {string} objectName
35
35
  * @param {object<string>} methodNames
36
36
  */
37
- measureMethods: function(object, objectName, methodNames) {
38
- if ("production" !== process.env.NODE_ENV) {
37
+ measureMethods: function (object, objectName, methodNames) {
38
+ if ('production' !== process.env.NODE_ENV) {
39
39
  for (var key in methodNames) {
40
40
  if (!methodNames.hasOwnProperty(key)) {
41
41
  continue;
42
42
  }
43
- object[key] = ReactPerf.measure(
44
- objectName,
45
- methodNames[key],
46
- object[key]
47
- );
43
+ object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
48
44
  }
49
45
  }
50
46
  },
@@ -57,10 +53,10 @@ var ReactPerf = {
57
53
  * @param {function} func
58
54
  * @return {function}
59
55
  */
60
- measure: function(objName, fnName, func) {
61
- if ("production" !== process.env.NODE_ENV) {
56
+ measure: function (objName, fnName, func) {
57
+ if ('production' !== process.env.NODE_ENV) {
62
58
  var measuredFunc = null;
63
- var wrapper = function() {
59
+ var wrapper = function () {
64
60
  if (ReactPerf.enableMeasure) {
65
61
  if (!measuredFunc) {
66
62
  measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
@@ -79,7 +75,7 @@ var ReactPerf = {
79
75
  /**
80
76
  * @param {function} measure
81
77
  */
82
- injectMeasure: function(measure) {
78
+ injectMeasure: function (measure) {
83
79
  ReactPerf.storedMeasure = measure;
84
80
  }
85
81
  }
@@ -97,4 +93,4 @@ function _noMeasure(objName, fnName, func) {
97
93
  return func;
98
94
  }
99
95
 
100
- module.exports = ReactPerf;
96
+ module.exports = ReactPerf;