react 0.14.10 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/LICENSE +1 -1
  2. package/dist/react-with-addons.js +4900 -4627
  3. package/dist/react-with-addons.min.js +7 -7
  4. package/dist/react.js +4556 -4059
  5. package/dist/react.min.js +7 -7
  6. package/lib/AutoFocusUtils.js +3 -15
  7. package/lib/BeforeInputEventPlugin.js +8 -25
  8. package/lib/CSSProperty.js +10 -1
  9. package/lib/CSSPropertyOperations.js +49 -19
  10. package/lib/CallbackQueue.js +16 -4
  11. package/lib/ChangeEventPlugin.js +58 -54
  12. package/lib/DOMChildrenOperations.js +91 -61
  13. package/lib/DOMLazyTree.js +105 -0
  14. package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
  15. package/lib/DOMProperty.js +18 -39
  16. package/lib/DOMPropertyOperations.js +42 -53
  17. package/lib/Danger.js +13 -14
  18. package/lib/DefaultEventPluginOrder.js +1 -1
  19. package/lib/EnterLeaveEventPlugin.js +24 -43
  20. package/lib/EventConstants.js +6 -1
  21. package/lib/EventPluginHub.js +22 -66
  22. package/lib/EventPluginRegistry.js +30 -9
  23. package/lib/EventPluginUtils.js +61 -36
  24. package/lib/EventPropagators.js +19 -17
  25. package/lib/FallbackCompositionState.js +4 -4
  26. package/lib/HTMLDOMPropertyConfig.js +131 -152
  27. package/lib/LinkedStateMixin.js +1 -2
  28. package/lib/LinkedValueUtils.js +6 -7
  29. package/lib/MetaMatchers.js +2 -2
  30. package/lib/OrderedMap.js +17 -16
  31. package/lib/PooledClass.js +2 -2
  32. package/lib/React.js +50 -20
  33. package/lib/ReactBrowserEventEmitter.js +19 -26
  34. package/lib/ReactCSSTransitionGroup.js +4 -5
  35. package/lib/ReactCSSTransitionGroupChild.js +1 -6
  36. package/lib/ReactChildReconciler.js +15 -13
  37. package/lib/ReactChildren.js +5 -4
  38. package/lib/ReactClass.js +44 -92
  39. package/lib/ReactComponent.js +9 -10
  40. package/lib/ReactComponentBrowserEnvironment.js +9 -6
  41. package/lib/ReactComponentEnvironment.js +4 -4
  42. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  43. package/lib/ReactCompositeComponent.js +166 -74
  44. package/lib/ReactCurrentOwner.js +2 -1
  45. package/lib/ReactDOM.js +27 -15
  46. package/lib/ReactDOMButton.js +2 -2
  47. package/lib/ReactDOMComponent.js +186 -250
  48. package/lib/ReactDOMComponentFlags.js +18 -0
  49. package/lib/ReactDOMComponentTree.js +186 -0
  50. package/lib/ReactDOMContainerInfo.js +32 -0
  51. package/lib/ReactDOMDebugTool.js +61 -0
  52. package/lib/ReactDOMEmptyComponent.js +60 -0
  53. package/lib/ReactDOMFactories.js +1 -2
  54. package/lib/ReactDOMFeatureFlags.js +2 -2
  55. package/lib/ReactDOMIDOperations.js +5 -60
  56. package/lib/ReactDOMInput.js +73 -23
  57. package/lib/ReactDOMInstrumentation.js +16 -0
  58. package/lib/ReactDOMOption.js +14 -12
  59. package/lib/ReactDOMSelect.js +43 -19
  60. package/lib/ReactDOMSelection.js +4 -4
  61. package/lib/ReactDOMServer.js +1 -1
  62. package/lib/ReactDOMTextComponent.js +87 -45
  63. package/lib/ReactDOMTextarea.js +39 -11
  64. package/lib/ReactDOMTreeTraversal.js +134 -0
  65. package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
  66. package/lib/ReactDebugInstanceMap.js +102 -0
  67. package/lib/ReactDebugTool.js +72 -0
  68. package/lib/ReactDefaultBatchingStrategy.js +4 -3
  69. package/lib/ReactDefaultInjection.js +11 -15
  70. package/lib/ReactDefaultPerf.js +105 -26
  71. package/lib/ReactDefaultPerfAnalysis.js +23 -15
  72. package/lib/ReactElement.js +63 -23
  73. package/lib/ReactElementValidator.js +9 -9
  74. package/lib/ReactEmptyComponent.js +8 -33
  75. package/lib/ReactErrorUtils.js +1 -2
  76. package/lib/ReactEventEmitterMixin.js +3 -8
  77. package/lib/ReactEventListener.js +23 -77
  78. package/lib/ReactFeatureFlags.js +21 -0
  79. package/lib/ReactFragment.js +6 -6
  80. package/lib/ReactInjection.js +3 -3
  81. package/lib/ReactInputSelection.js +4 -4
  82. package/lib/ReactInstanceHandles.js +10 -12
  83. package/lib/ReactInstanceMap.js +2 -1
  84. package/lib/ReactInstrumentation.js +16 -0
  85. package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
  86. package/lib/ReactLink.js +2 -3
  87. package/lib/ReactMarkupChecksum.js +8 -3
  88. package/lib/ReactMount.js +88 -460
  89. package/lib/ReactMultiChild.js +106 -200
  90. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  91. package/lib/ReactNativeComponent.js +6 -5
  92. package/lib/ReactNodeTypes.js +37 -0
  93. package/lib/ReactNoopUpdateQueue.js +2 -25
  94. package/lib/ReactOwner.js +7 -6
  95. package/lib/ReactPerf.js +2 -2
  96. package/lib/ReactPropTransferer.js +5 -4
  97. package/lib/ReactPropTypeLocationNames.js +1 -1
  98. package/lib/ReactPropTypeLocations.js +1 -1
  99. package/lib/ReactPropTypes.js +31 -7
  100. package/lib/ReactReconcileTransaction.js +20 -9
  101. package/lib/ReactReconciler.js +29 -6
  102. package/lib/ReactRef.js +1 -1
  103. package/lib/ReactServerBatchingStrategy.js +1 -2
  104. package/lib/ReactServerRendering.js +17 -35
  105. package/lib/ReactServerRenderingTransaction.js +11 -29
  106. package/lib/ReactSimpleEmptyComponent.js +36 -0
  107. package/lib/ReactStateSetters.js +1 -1
  108. package/lib/ReactTestUtils.js +47 -28
  109. package/lib/ReactTransitionChildMapping.js +1 -2
  110. package/lib/ReactTransitionEvents.js +8 -44
  111. package/lib/ReactTransitionGroup.js +4 -3
  112. package/lib/ReactUMDEntry.js +26 -0
  113. package/lib/ReactUpdateQueue.js +24 -66
  114. package/lib/ReactUpdates.js +29 -11
  115. package/lib/ReactVersion.js +2 -2
  116. package/lib/ReactWithAddons.js +1 -21
  117. package/lib/ReactWithAddonsUMDEntry.js +26 -0
  118. package/lib/ResponderEventPlugin.js +54 -66
  119. package/lib/ResponderSyntheticEvent.js +2 -3
  120. package/lib/ResponderTouchHistoryStore.js +5 -5
  121. package/lib/SVGDOMPropertyConfig.js +267 -94
  122. package/lib/SelectEventPlugin.js +13 -18
  123. package/lib/SimpleEventPlugin.js +57 -17
  124. package/lib/SyntheticAnimationEvent.js +39 -0
  125. package/lib/SyntheticClipboardEvent.js +2 -3
  126. package/lib/SyntheticCompositionEvent.js +2 -3
  127. package/lib/SyntheticDragEvent.js +2 -3
  128. package/lib/SyntheticEvent.js +102 -21
  129. package/lib/SyntheticFocusEvent.js +2 -3
  130. package/lib/SyntheticInputEvent.js +2 -3
  131. package/lib/SyntheticKeyboardEvent.js +2 -3
  132. package/lib/SyntheticMouseEvent.js +2 -3
  133. package/lib/SyntheticTouchEvent.js +2 -3
  134. package/lib/SyntheticTransitionEvent.js +39 -0
  135. package/lib/SyntheticUIEvent.js +2 -3
  136. package/lib/SyntheticWheelEvent.js +2 -3
  137. package/lib/TapEventPlugin.js +3 -12
  138. package/lib/Transaction.js +3 -3
  139. package/lib/ViewportMetrics.js +1 -1
  140. package/lib/accumulate.js +2 -2
  141. package/lib/accumulateInto.js +2 -2
  142. package/lib/adler32.js +3 -2
  143. package/lib/canDefineProperty.js +1 -1
  144. package/lib/createHierarchyRenderer.js +1 -1
  145. package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
  146. package/lib/dangerousStyleValue.js +25 -3
  147. package/lib/deprecated.js +7 -4
  148. package/lib/escapeTextContentForBrowser.js +1 -1
  149. package/lib/findDOMNode.js +15 -8
  150. package/lib/flattenChildren.js +2 -2
  151. package/lib/forEachAccumulated.js +2 -1
  152. package/lib/getEventCharCode.js +2 -2
  153. package/lib/getEventKey.js +1 -2
  154. package/lib/getEventModifierState.js +1 -2
  155. package/lib/getEventTarget.js +8 -2
  156. package/lib/getIteratorFn.js +2 -2
  157. package/lib/getNativeComponentFromComposite.js +30 -0
  158. package/lib/getNodeForCharacterOffset.js +2 -1
  159. package/lib/getTestDocument.js +1 -1
  160. package/lib/getTextContentAccessor.js +1 -1
  161. package/lib/getVendorPrefixedEventName.js +101 -0
  162. package/lib/instantiateReactComponent.js +12 -13
  163. package/lib/isEventSupported.js +2 -2
  164. package/lib/isTextInputElement.js +2 -1
  165. package/lib/onlyChild.js +2 -2
  166. package/lib/quoteAttributeValueForBrowser.js +1 -1
  167. package/lib/reactComponentExpect.js +5 -4
  168. package/lib/renderSubtreeIntoContainer.js +1 -1
  169. package/lib/setInnerHTML.js +6 -14
  170. package/lib/setTextContent.js +1 -1
  171. package/lib/shallowCompare.js +1 -1
  172. package/lib/shouldUpdateReactComponent.js +2 -3
  173. package/lib/sliceChildren.js +1 -1
  174. package/lib/traverseAllChildren.js +8 -8
  175. package/lib/update.js +16 -15
  176. package/lib/validateDOMNesting.js +18 -13
  177. package/package.json +23 -32
  178. package/addons.js +0 -13
  179. package/cjs/react-jsx-dev-runtime.development.js +0 -861
  180. package/cjs/react-jsx-dev-runtime.production.min.js +0 -9
  181. package/cjs/react-jsx-runtime.development.js +0 -883
  182. package/cjs/react-jsx-runtime.production.min.js +0 -10
  183. package/jsx-dev-runtime.js +0 -7
  184. package/jsx-runtime.js +0 -7
  185. package/lib/Object.assign.js +0 -47
  186. package/lib/React.native.js +0 -5
  187. package/lib/ReactBrowserComponentMixin.js +0 -36
  188. package/lib/ReactEmptyComponentRegistry.js +0 -48
  189. package/lib/ReactIsomorphic.js +0 -74
  190. package/lib/ReactRootIndex.js +0 -29
  191. package/lib/ServerReactRootIndex.js +0 -29
  192. package/lib/cloneWithProps.js +0 -54
  193. package/lib/webcomponents.js +0 -6379
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2014-2015, Facebook, Inc.
2
+ * Copyright 2014-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,7 +7,6 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule ReactChildReconciler
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
@@ -23,10 +22,10 @@ function instantiateChild(childInstances, child, name) {
23
22
  // We found a component instance.
24
23
  var keyUnique = childInstances[name] === undefined;
25
24
  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.', name) : undefined;
25
+ 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.', name) : void 0;
27
26
  }
28
27
  if (child != null && keyUnique) {
29
- childInstances[name] = instantiateReactComponent(child, null);
28
+ childInstances[name] = instantiateReactComponent(child);
30
29
  }
31
30
  }
32
31
 
@@ -63,21 +62,22 @@ var ReactChildReconciler = {
63
62
  * @return {?object} A new set of child instances.
64
63
  * @internal
65
64
  */
66
- updateChildren: function (prevChildren, nextChildren, transaction, context) {
65
+ updateChildren: function (prevChildren, nextChildren, removedNodes, transaction, context) {
67
66
  // We currently don't have a way to track moves here but if we use iterators
68
67
  // instead of for..in we can zip the iterators and check if an item has
69
68
  // moved.
70
69
  // TODO: If nothing has changed, return the prevChildren object so that we
71
70
  // can quickly bailout if nothing has changed.
72
71
  if (!nextChildren && !prevChildren) {
73
- return null;
72
+ return;
74
73
  }
75
74
  var name;
75
+ var prevChild;
76
76
  for (name in nextChildren) {
77
77
  if (!nextChildren.hasOwnProperty(name)) {
78
78
  continue;
79
79
  }
80
- var prevChild = prevChildren && prevChildren[name];
80
+ prevChild = prevChildren && prevChildren[name];
81
81
  var prevElement = prevChild && prevChild._currentElement;
82
82
  var nextElement = nextChildren[name];
83
83
  if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
@@ -85,20 +85,22 @@ var ReactChildReconciler = {
85
85
  nextChildren[name] = prevChild;
86
86
  } else {
87
87
  if (prevChild) {
88
- ReactReconciler.unmountComponent(prevChild, name);
88
+ removedNodes[name] = ReactReconciler.getNativeNode(prevChild);
89
+ ReactReconciler.unmountComponent(prevChild, false);
89
90
  }
90
91
  // The child must be instantiated before it's mounted.
91
- var nextChildInstance = instantiateReactComponent(nextElement, null);
92
+ var nextChildInstance = instantiateReactComponent(nextElement);
92
93
  nextChildren[name] = nextChildInstance;
93
94
  }
94
95
  }
95
96
  // Unmount children that are no longer present.
96
97
  for (name in prevChildren) {
97
98
  if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
98
- ReactReconciler.unmountComponent(prevChildren[name]);
99
+ prevChild = prevChildren[name];
100
+ removedNodes[name] = ReactReconciler.getNativeNode(prevChild);
101
+ ReactReconciler.unmountComponent(prevChild, false);
99
102
  }
100
103
  }
101
- return nextChildren;
102
104
  },
103
105
 
104
106
  /**
@@ -108,11 +110,11 @@ var ReactChildReconciler = {
108
110
  * @param {?object} renderedChildren Previously initialized set of children.
109
111
  * @internal
110
112
  */
111
- unmountChildren: function (renderedChildren) {
113
+ unmountChildren: function (renderedChildren, safely) {
112
114
  for (var name in renderedChildren) {
113
115
  if (renderedChildren.hasOwnProperty(name)) {
114
116
  var renderedChild = renderedChildren[name];
115
- ReactReconciler.unmountComponent(renderedChild);
117
+ ReactReconciler.unmountComponent(renderedChild, safely);
116
118
  }
117
119
  }
118
120
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -20,9 +20,9 @@ var traverseAllChildren = require('./traverseAllChildren');
20
20
  var twoArgumentPooler = PooledClass.twoArgumentPooler;
21
21
  var fourArgumentPooler = PooledClass.fourArgumentPooler;
22
22
 
23
- var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
23
+ var userProvidedKeyEscapeRegex = /\/+/g;
24
24
  function escapeUserProvidedKey(text) {
25
- return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
25
+ return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
26
26
  }
27
27
 
28
28
  /**
@@ -102,6 +102,7 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
102
102
  var func = bookKeeping.func;
103
103
  var context = bookKeeping.context;
104
104
 
105
+
105
106
  var mappedChild = func.call(context, child, bookKeeping.count++);
106
107
  if (Array.isArray(mappedChild)) {
107
108
  mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
@@ -110,7 +111,7 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
110
111
  mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
111
112
  // Keep both the (mapped) and old keys if they differ, just as
112
113
  // traverseAllChildren used to do for objects as children
113
- keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
114
+ keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
114
115
  }
115
116
  result.push(mappedChild);
116
117
  }
package/lib/ReactClass.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -11,13 +11,14 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _assign = require('object-assign');
15
+
14
16
  var ReactComponent = require('./ReactComponent');
15
17
  var ReactElement = require('./ReactElement');
16
18
  var ReactPropTypeLocations = require('./ReactPropTypeLocations');
17
19
  var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
18
20
  var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
19
21
 
20
- var assign = require('./Object.assign');
21
22
  var emptyObject = require('fbjs/lib/emptyObject');
22
23
  var invariant = require('fbjs/lib/invariant');
23
24
  var keyMirror = require('fbjs/lib/keyMirror');
@@ -53,14 +54,6 @@ var SpecPolicy = keyMirror({
53
54
 
54
55
  var injectedMixins = [];
55
56
 
56
- var warnedSetProps = false;
57
- function warnSetProps() {
58
- if (!warnedSetProps) {
59
- warnedSetProps = true;
60
- process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
61
- }
62
- }
63
-
64
57
  /**
65
58
  * Composite components are higher-level components that compose other composite
66
59
  * or native components.
@@ -330,13 +323,13 @@ var RESERVED_SPEC_KEYS = {
330
323
  if (process.env.NODE_ENV !== 'production') {
331
324
  validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
332
325
  }
333
- Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
326
+ Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
334
327
  },
335
328
  contextTypes: function (Constructor, contextTypes) {
336
329
  if (process.env.NODE_ENV !== 'production') {
337
330
  validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
338
331
  }
339
- Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
332
+ Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
340
333
  },
341
334
  /**
342
335
  * Special case getDefaultProps which should move into statics but requires
@@ -353,7 +346,7 @@ var RESERVED_SPEC_KEYS = {
353
346
  if (process.env.NODE_ENV !== 'production') {
354
347
  validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
355
348
  }
356
- Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
349
+ Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
357
350
  },
358
351
  statics: function (Constructor, statics) {
359
352
  mixStaticSpecIntoComponent(Constructor, statics);
@@ -365,39 +358,40 @@ function validateTypeDef(Constructor, typeDef, location) {
365
358
  for (var propName in typeDef) {
366
359
  if (typeDef.hasOwnProperty(propName)) {
367
360
  // use a warning instead of an invariant so components
368
- // don't show up in prod but not in __DEV__
369
- process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
361
+ // don't show up in prod but only in __DEV__
362
+ process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
370
363
  }
371
364
  }
372
365
  }
373
366
 
374
- function validateMethodOverride(proto, name) {
367
+ function validateMethodOverride(isAlreadyDefined, name) {
375
368
  var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
376
369
 
377
370
  // Disallow overriding of base class methods unless explicitly allowed.
378
371
  if (ReactClassMixin.hasOwnProperty(name)) {
379
- !(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) : undefined;
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;
380
373
  }
381
374
 
382
375
  // Disallow defining methods more than once unless explicitly allowed.
383
- if (proto.hasOwnProperty(name)) {
384
- !(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) : undefined;
376
+ 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;
385
378
  }
386
379
  }
387
380
 
388
381
  /**
389
382
  * Mixin helper which handles policy validation and reserved
390
- * specification keys when building React classses.
383
+ * specification keys when building React classes.
391
384
  */
392
385
  function mixSpecIntoComponent(Constructor, spec) {
393
386
  if (!spec) {
394
387
  return;
395
388
  }
396
389
 
397
- !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
398
- !!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) : undefined;
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;
399
392
 
400
393
  var proto = Constructor.prototype;
394
+ var autoBindPairs = proto.__reactAutoBindPairs;
401
395
 
402
396
  // By handling mixins before any other properties, we ensure the same
403
397
  // chaining order is applied to methods with DEFINE_MANY policy, whether
@@ -417,7 +411,8 @@ function mixSpecIntoComponent(Constructor, spec) {
417
411
  }
418
412
 
419
413
  var property = spec[name];
420
- validateMethodOverride(proto, name);
414
+ var isAlreadyDefined = proto.hasOwnProperty(name);
415
+ validateMethodOverride(isAlreadyDefined, name);
421
416
 
422
417
  if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
423
418
  RESERVED_SPEC_KEYS[name](Constructor, property);
@@ -427,22 +422,18 @@ function mixSpecIntoComponent(Constructor, spec) {
427
422
  // 1. Expected ReactClass methods (in the "interface").
428
423
  // 2. Overridden methods (that were mixed in).
429
424
  var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
430
- var isAlreadyDefined = proto.hasOwnProperty(name);
431
425
  var isFunction = typeof property === 'function';
432
426
  var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
433
427
 
434
428
  if (shouldAutoBind) {
435
- if (!proto.__reactAutoBindMap) {
436
- proto.__reactAutoBindMap = {};
437
- }
438
- proto.__reactAutoBindMap[name] = property;
429
+ autoBindPairs.push(name, property);
439
430
  proto[name] = property;
440
431
  } else {
441
432
  if (isAlreadyDefined) {
442
433
  var specPolicy = ReactClassInterface[name];
443
434
 
444
435
  // These cases should already be caught by validateMethodOverride.
445
- !(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) : undefined;
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;
446
437
 
447
438
  // For methods which are defined more than once, call the existing
448
439
  // methods before calling the new property, merging if appropriate.
@@ -476,11 +467,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
476
467
  continue;
477
468
  }
478
469
 
479
- var isReserved = (name in RESERVED_SPEC_KEYS);
480
- !!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) : undefined;
470
+ 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;
481
472
 
482
- var isInherited = (name in Constructor);
483
- !!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) : undefined;
473
+ 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;
484
475
  Constructor[name] = property;
485
476
  }
486
477
  }
@@ -493,11 +484,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
493
484
  * @return {object} one after it has been mutated to contain everything in two.
494
485
  */
495
486
  function mergeIntoWithNoDuplicateKeys(one, two) {
496
- !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
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;
497
488
 
498
489
  for (var key in two) {
499
490
  if (two.hasOwnProperty(key)) {
500
- !(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) : undefined;
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;
501
492
  one[key] = two[key];
502
493
  }
503
494
  }
@@ -558,7 +549,6 @@ function bindAutoBindMethod(component, method) {
558
549
  boundMethod.__reactBoundArguments = null;
559
550
  var componentName = component.constructor.displayName;
560
551
  var _bind = boundMethod.bind;
561
- /* eslint-disable block-scoped-var, no-undef */
562
552
  boundMethod.bind = function (newThis) {
563
553
  for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
564
554
  args[_key - 1] = arguments[_key];
@@ -568,9 +558,9 @@ function bindAutoBindMethod(component, method) {
568
558
  // ignore the value of "this" that the user is trying to use, so
569
559
  // let's warn.
570
560
  if (newThis !== component && newThis !== null) {
571
- process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
561
+ process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
572
562
  } else if (!args.length) {
573
- process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
563
+ process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
574
564
  return boundMethod;
575
565
  }
576
566
  var reboundMethod = _bind.apply(boundMethod, arguments);
@@ -578,7 +568,6 @@ function bindAutoBindMethod(component, method) {
578
568
  reboundMethod.__reactBoundMethod = method;
579
569
  reboundMethod.__reactBoundArguments = args;
580
570
  return reboundMethod;
581
- /* eslint-enable */
582
571
  };
583
572
  }
584
573
  return boundMethod;
@@ -590,11 +579,11 @@ function bindAutoBindMethod(component, method) {
590
579
  * @param {object} component Component whose method is going to be bound.
591
580
  */
592
581
  function bindAutoBindMethods(component) {
593
- for (var autoBindKey in component.__reactAutoBindMap) {
594
- if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
595
- var method = component.__reactAutoBindMap[autoBindKey];
596
- component[autoBindKey] = bindAutoBindMethod(component, method);
597
- }
582
+ var pairs = component.__reactAutoBindPairs;
583
+ for (var i = 0; i < pairs.length; i += 2) {
584
+ var autoBindKey = pairs[i];
585
+ var method = pairs[i + 1];
586
+ component[autoBindKey] = bindAutoBindMethod(component, method);
598
587
  }
599
588
  }
600
589
 
@@ -611,7 +600,7 @@ var ReactClassMixin = {
611
600
  replaceState: function (newState, callback) {
612
601
  this.updater.enqueueReplaceState(this, newState);
613
602
  if (callback) {
614
- this.updater.enqueueCallback(this, callback);
603
+ this.updater.enqueueCallback(this, callback, 'replaceState');
615
604
  }
616
605
  },
617
606
 
@@ -623,49 +612,11 @@ var ReactClassMixin = {
623
612
  */
624
613
  isMounted: function () {
625
614
  return this.updater.isMounted(this);
626
- },
627
-
628
- /**
629
- * Sets a subset of the props.
630
- *
631
- * @param {object} partialProps Subset of the next props.
632
- * @param {?function} callback Called after props are updated.
633
- * @final
634
- * @public
635
- * @deprecated
636
- */
637
- setProps: function (partialProps, callback) {
638
- if (process.env.NODE_ENV !== 'production') {
639
- warnSetProps();
640
- }
641
- this.updater.enqueueSetProps(this, partialProps);
642
- if (callback) {
643
- this.updater.enqueueCallback(this, callback);
644
- }
645
- },
646
-
647
- /**
648
- * Replace all the props.
649
- *
650
- * @param {object} newProps Subset of the next props.
651
- * @param {?function} callback Called after props are updated.
652
- * @final
653
- * @public
654
- * @deprecated
655
- */
656
- replaceProps: function (newProps, callback) {
657
- if (process.env.NODE_ENV !== 'production') {
658
- warnSetProps();
659
- }
660
- this.updater.enqueueReplaceProps(this, newProps);
661
- if (callback) {
662
- this.updater.enqueueCallback(this, callback);
663
- }
664
615
  }
665
616
  };
666
617
 
667
618
  var ReactClassComponent = function () {};
668
- assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
619
+ _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
669
620
 
670
621
  /**
671
622
  * Module for creating composite components.
@@ -683,15 +634,15 @@ var ReactClass = {
683
634
  */
684
635
  createClass: function (spec) {
685
636
  var Constructor = function (props, context, updater) {
686
- // This constructor is overridden by mocks. The argument is used
637
+ // This constructor gets overridden by mocks. The argument is used
687
638
  // by mocks to assert on what gets mounted.
688
639
 
689
640
  if (process.env.NODE_ENV !== 'production') {
690
- process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
641
+ process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
691
642
  }
692
643
 
693
644
  // Wire up auto-binding
694
- if (this.__reactAutoBindMap) {
645
+ if (this.__reactAutoBindPairs.length) {
695
646
  bindAutoBindMethods(this);
696
647
  }
697
648
 
@@ -708,18 +659,19 @@ var ReactClass = {
708
659
  var initialState = this.getInitialState ? this.getInitialState() : null;
709
660
  if (process.env.NODE_ENV !== 'production') {
710
661
  // We allow auto-mocks to proceed as if they're returning null.
711
- if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
662
+ if (initialState === undefined && this.getInitialState._isMockFunction) {
712
663
  // This is probably bad practice. Consider warning here and
713
664
  // deprecating this convenience.
714
665
  initialState = null;
715
666
  }
716
667
  }
717
- !(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) : undefined;
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;
718
669
 
719
670
  this.state = initialState;
720
671
  };
721
672
  Constructor.prototype = new ReactClassComponent();
722
673
  Constructor.prototype.constructor = Constructor;
674
+ Constructor.prototype.__reactAutoBindPairs = [];
723
675
 
724
676
  injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
725
677
 
@@ -743,11 +695,11 @@ var ReactClass = {
743
695
  }
744
696
  }
745
697
 
746
- !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
698
+ !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : void 0;
747
699
 
748
700
  if (process.env.NODE_ENV !== 'production') {
749
- 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') : undefined;
750
- process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
701
+ 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;
702
+ process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
751
703
  }
752
704
 
753
705
  // Reduce time spent doing lookups by setting these on the prototype.