react 0.14.0-beta1 → 0.14.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 (173) hide show
  1. package/addons.js +8 -3
  2. package/dist/react-with-addons.js +5048 -4095
  3. package/dist/react-with-addons.min.js +6 -6
  4. package/dist/react.js +4555 -3729
  5. package/dist/react.min.js +6 -5
  6. package/lib/AutoFocusUtils.js +3 -3
  7. package/lib/BeforeInputEventPlugin.js +13 -13
  8. package/lib/CSSProperty.js +18 -3
  9. package/lib/CSSPropertyOperations.js +27 -14
  10. package/lib/CallbackQueue.js +4 -4
  11. package/lib/ChangeEventPlugin.js +15 -14
  12. package/lib/DOMChildrenOperations.js +22 -7
  13. package/lib/DOMProperty.js +8 -8
  14. package/lib/DOMPropertyOperations.js +23 -10
  15. package/lib/Danger.js +21 -16
  16. package/lib/DefaultEventPluginOrder.js +2 -2
  17. package/lib/EnterLeaveEventPlugin.js +18 -10
  18. package/lib/EventConstants.js +23 -1
  19. package/lib/EventPluginHub.js +29 -21
  20. package/lib/EventPluginRegistry.js +8 -8
  21. package/lib/EventPluginUtils.js +34 -38
  22. package/lib/EventPropagators.js +8 -8
  23. package/lib/FallbackCompositionState.js +9 -3
  24. package/lib/HTMLDOMPropertyConfig.js +24 -4
  25. package/lib/LinkedStateMixin.js +2 -2
  26. package/lib/LinkedValueUtils.js +8 -8
  27. package/lib/MetaMatchers.js +118 -0
  28. package/lib/OrderedMap.js +453 -0
  29. package/lib/PooledClass.js +3 -5
  30. package/lib/React.js +18 -7
  31. package/lib/ReactBrowserComponentMixin.js +4 -4
  32. package/lib/ReactBrowserEventEmitter.js +36 -7
  33. package/lib/ReactCSSTransitionGroup.js +35 -9
  34. package/lib/ReactCSSTransitionGroupChild.js +48 -30
  35. package/lib/ReactChildReconciler.js +24 -19
  36. package/lib/ReactChildren.js +72 -32
  37. package/lib/ReactClass.js +46 -46
  38. package/lib/ReactComponent.js +18 -16
  39. package/lib/ReactComponentBrowserEnvironment.js +2 -2
  40. package/lib/ReactComponentEnvironment.js +2 -2
  41. package/lib/ReactComponentWithPureRenderMixin.js +1 -1
  42. package/lib/ReactCompositeComponent.js +95 -44
  43. package/lib/ReactDOM.js +74 -159
  44. package/lib/ReactDOMComponent.js +235 -93
  45. package/lib/ReactDOMFactories.js +177 -0
  46. package/lib/{emptyObject.js → ReactDOMFeatureFlags.js} +6 -8
  47. package/lib/ReactDOMIDOperations.js +8 -81
  48. package/lib/ReactDOMInput.js +18 -9
  49. package/lib/ReactDOMOption.js +7 -7
  50. package/lib/ReactDOMSelect.js +9 -9
  51. package/lib/ReactDOMSelection.js +19 -3
  52. package/lib/ReactDOMServer.js +5 -3
  53. package/lib/ReactDOMTextComponent.js +33 -20
  54. package/lib/ReactDOMTextarea.js +14 -12
  55. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  56. package/lib/ReactDefaultInjection.js +23 -25
  57. package/lib/ReactDefaultPerf.js +17 -11
  58. package/lib/ReactDefaultPerfAnalysis.js +13 -12
  59. package/lib/ReactElement.js +85 -39
  60. package/lib/ReactElementValidator.js +47 -90
  61. package/lib/ReactEmptyComponent.js +26 -62
  62. package/lib/ReactEmptyComponentRegistry.js +48 -0
  63. package/lib/ReactErrorUtils.js +53 -9
  64. package/lib/ReactEventEmitterMixin.js +2 -2
  65. package/lib/ReactEventListener.js +33 -21
  66. package/lib/ReactFragment.js +27 -118
  67. package/lib/ReactInjection.js +10 -12
  68. package/lib/ReactInputSelection.js +4 -4
  69. package/lib/ReactInstanceHandles.js +10 -11
  70. package/lib/ReactIsomorphic.js +15 -11
  71. package/lib/ReactLink.js +2 -2
  72. package/lib/ReactMarkupChecksum.js +6 -2
  73. package/lib/ReactMount.js +186 -85
  74. package/lib/ReactMultiChild.js +119 -25
  75. package/lib/ReactMultiChildUpdateTypes.js +2 -1
  76. package/lib/ReactNativeComponent.js +3 -3
  77. package/lib/ReactNoopUpdateQueue.js +3 -3
  78. package/lib/ReactOwner.js +3 -3
  79. package/lib/ReactPerf.js +2 -2
  80. package/lib/ReactPropTransferer.js +3 -3
  81. package/lib/ReactPropTypeLocationNames.js +1 -1
  82. package/lib/ReactPropTypeLocations.js +1 -1
  83. package/lib/ReactPropTypes.js +38 -9
  84. package/lib/ReactReconcileTransaction.js +10 -8
  85. package/lib/ReactReconciler.js +5 -6
  86. package/lib/ReactRef.js +14 -2
  87. package/lib/ReactServerBatchingStrategy.js +5 -5
  88. package/lib/ReactServerRendering.js +12 -12
  89. package/lib/ReactServerRenderingTransaction.js +6 -5
  90. package/lib/ReactTestUtils.js +47 -39
  91. package/lib/ReactTransitionChildMapping.js +3 -6
  92. package/lib/ReactTransitionEvents.js +1 -1
  93. package/lib/ReactTransitionGroup.js +5 -6
  94. package/lib/ReactUpdateQueue.js +19 -19
  95. package/lib/ReactUpdates.js +15 -15
  96. package/lib/{performance.js → ReactVersion.js} +3 -12
  97. package/lib/ReactWithAddons.js +24 -15
  98. package/lib/ResponderEventPlugin.js +514 -0
  99. package/lib/ResponderSyntheticEvent.js +40 -0
  100. package/lib/ResponderTouchHistoryStore.js +180 -0
  101. package/lib/SVGDOMPropertyConfig.js +1 -1
  102. package/lib/SelectEventPlugin.js +19 -9
  103. package/lib/SimpleEventPlugin.js +198 -43
  104. package/lib/SyntheticClipboardEvent.js +1 -1
  105. package/lib/SyntheticCompositionEvent.js +1 -1
  106. package/lib/SyntheticDragEvent.js +1 -1
  107. package/lib/SyntheticEvent.js +18 -4
  108. package/lib/SyntheticFocusEvent.js +1 -1
  109. package/lib/SyntheticInputEvent.js +1 -1
  110. package/lib/SyntheticKeyboardEvent.js +4 -4
  111. package/lib/SyntheticMouseEvent.js +3 -3
  112. package/lib/SyntheticTouchEvent.js +2 -2
  113. package/lib/SyntheticUIEvent.js +2 -2
  114. package/lib/SyntheticWheelEvent.js +1 -1
  115. package/lib/TapEventPlugin.js +119 -0
  116. package/lib/Transaction.js +7 -7
  117. package/lib/accumulate.js +44 -0
  118. package/lib/accumulateInto.js +2 -2
  119. package/lib/adler32.js +19 -7
  120. package/lib/cloneWithProps.js +11 -6
  121. package/lib/createHierarchyRenderer.js +85 -0
  122. package/lib/dangerousStyleValue.js +1 -1
  123. package/lib/deprecated.js +7 -6
  124. package/lib/findDOMNode.js +9 -9
  125. package/lib/flattenChildren.js +4 -4
  126. package/lib/getEventKey.js +1 -1
  127. package/lib/{isTextNode.js → getTestDocument.js} +7 -11
  128. package/lib/getTextContentAccessor.js +1 -1
  129. package/lib/instantiateReactComponent.js +15 -17
  130. package/lib/isEventSupported.js +1 -1
  131. package/lib/onlyChild.js +3 -3
  132. package/lib/quoteAttributeValueForBrowser.js +1 -1
  133. package/lib/reactComponentExpect.js +216 -0
  134. package/lib/renderSubtreeIntoContainer.js +1 -1
  135. package/lib/setInnerHTML.js +1 -1
  136. package/lib/setTextContent.js +3 -3
  137. package/lib/shallowCompare.js +1 -1
  138. package/lib/shouldUpdateReactComponent.js +12 -8
  139. package/lib/sliceChildren.js +34 -0
  140. package/lib/traverseAllChildren.js +25 -18
  141. package/lib/update.js +13 -13
  142. package/lib/validateDOMNesting.js +6 -6
  143. package/lib/webcomponents.js +6379 -0
  144. package/package.json +4 -6
  145. package/react.js +1 -51
  146. package/dist/JSXTransformer.js +0 -17588
  147. package/lib/CSSCore.js +0 -97
  148. package/lib/EventListener.js +0 -84
  149. package/lib/ExecutionEnvironment.js +0 -38
  150. package/lib/ReactDOMClient.js +0 -90
  151. package/lib/camelize.js +0 -32
  152. package/lib/camelizeStyleName.js +0 -40
  153. package/lib/containsNode.js +0 -55
  154. package/lib/createArrayFromMixed.js +0 -85
  155. package/lib/createNodesFromMarkup.js +0 -84
  156. package/lib/emptyFunction.js +0 -38
  157. package/lib/focusNode.js +0 -26
  158. package/lib/getActiveElement.js +0 -29
  159. package/lib/getMarkupWrap.js +0 -93
  160. package/lib/getUnboundedScrollPosition.js +0 -38
  161. package/lib/hyphenate.js +0 -33
  162. package/lib/hyphenateStyleName.js +0 -39
  163. package/lib/invariant.js +0 -49
  164. package/lib/isNode.js +0 -23
  165. package/lib/joinClasses.js +0 -39
  166. package/lib/keyMirror.js +0 -48
  167. package/lib/keyOf.js +0 -35
  168. package/lib/mapObject.js +0 -51
  169. package/lib/memoizeStringOnly.js +0 -31
  170. package/lib/performanceNow.js +0 -28
  171. package/lib/shallowEqual.js +0 -48
  172. package/lib/toArray.js +0 -57
  173. package/lib/warning.js +0 -57
@@ -11,14 +11,19 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var PooledClass = require("./PooledClass");
15
- var ReactFragment = require("./ReactFragment");
14
+ var PooledClass = require('./PooledClass');
15
+ var ReactElement = require('./ReactElement');
16
16
 
17
- var traverseAllChildren = require("./traverseAllChildren");
18
- var warning = require("./warning");
17
+ var emptyFunction = require('fbjs/lib/emptyFunction');
18
+ var traverseAllChildren = require('./traverseAllChildren');
19
19
 
20
20
  var twoArgumentPooler = PooledClass.twoArgumentPooler;
21
- var threeArgumentPooler = PooledClass.threeArgumentPooler;
21
+ var fourArgumentPooler = PooledClass.fourArgumentPooler;
22
+
23
+ var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
24
+ function escapeUserProvidedKey(text) {
25
+ return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
26
+ }
22
27
 
23
28
  /**
24
29
  * PooledClass representing the bookkeeping associated with performing a child
@@ -33,11 +38,18 @@ function ForEachBookKeeping(forEachFunction, forEachContext) {
33
38
  this.context = forEachContext;
34
39
  this.count = 0;
35
40
  }
41
+ ForEachBookKeeping.prototype.destructor = function () {
42
+ this.func = null;
43
+ this.context = null;
44
+ this.count = 0;
45
+ };
36
46
  PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
37
47
 
38
- function forEachSingleChild(traverseContext, child, name) {
39
- var bookKeeping = traverseContext;
40
- bookKeeping.func.call(bookKeeping.context, child, bookKeeping.count++);
48
+ function forEachSingleChild(bookKeeping, child, name) {
49
+ var func = bookKeeping.func;
50
+ var context = bookKeeping.context;
51
+
52
+ func.call(context, child, bookKeeping.count++);
41
53
  }
42
54
 
43
55
  /**
@@ -54,7 +66,6 @@ function forEachChildren(children, forEachFunc, forEachContext) {
54
66
  if (children == null) {
55
67
  return children;
56
68
  }
57
-
58
69
  var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
59
70
  traverseAllChildren(children, forEachSingleChild, traverseContext);
60
71
  ForEachBookKeeping.release(traverseContext);
@@ -69,27 +80,50 @@ function forEachChildren(children, forEachFunc, forEachContext) {
69
80
  * @param {!function} mapFunction Function to perform mapping with.
70
81
  * @param {?*} mapContext Context to perform mapping with.
71
82
  */
72
- function MapBookKeeping(mapResult, mapFunction, mapContext) {
83
+ function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
73
84
  this.result = mapResult;
85
+ this.keyPrefix = keyPrefix;
74
86
  this.func = mapFunction;
75
87
  this.context = mapContext;
76
88
  this.count = 0;
77
89
  }
78
- PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
79
-
80
- function mapSingleChildIntoContext(traverseContext, child, name) {
81
- var bookKeeping = traverseContext;
82
- var mapResult = bookKeeping.result;
83
-
84
- var keyUnique = mapResult[name] === undefined;
85
- if ('production' !== process.env.NODE_ENV) {
86
- 'production' !== process.env.NODE_ENV ? warning(keyUnique, 'ReactChildren.map(...): 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;
90
+ MapBookKeeping.prototype.destructor = function () {
91
+ this.result = null;
92
+ this.keyPrefix = null;
93
+ this.func = null;
94
+ this.context = null;
95
+ this.count = 0;
96
+ };
97
+ PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
98
+
99
+ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
100
+ var result = bookKeeping.result;
101
+ var keyPrefix = bookKeeping.keyPrefix;
102
+ var func = bookKeeping.func;
103
+ var context = bookKeeping.context;
104
+
105
+ var mappedChild = func.call(context, child, bookKeeping.count++);
106
+ if (Array.isArray(mappedChild)) {
107
+ mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
108
+ } else if (mappedChild != null) {
109
+ if (ReactElement.isValidElement(mappedChild)) {
110
+ mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
111
+ // Keep both the (mapped) and old keys if they differ, just as
112
+ // traverseAllChildren used to do for objects as children
113
+ keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
114
+ }
115
+ result.push(mappedChild);
87
116
  }
117
+ }
88
118
 
89
- if (keyUnique) {
90
- var mappedChild = bookKeeping.func.call(bookKeeping.context, child, bookKeeping.count++);
91
- mapResult[name] = mappedChild;
119
+ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
120
+ var escapedPrefix = '';
121
+ if (prefix != null) {
122
+ escapedPrefix = escapeUserProvidedKey(prefix) + '/';
92
123
  }
124
+ var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
125
+ traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
126
+ MapBookKeeping.release(traverseContext);
93
127
  }
94
128
 
95
129
  /**
@@ -98,9 +132,6 @@ function mapSingleChildIntoContext(traverseContext, child, name) {
98
132
  * The provided mapFunction(child, key, index) will be called for each
99
133
  * leaf child.
100
134
  *
101
- * TODO: This may likely break any calls to `ReactChildren.map` that were
102
- * previously relying on the fact that we guarded against null children.
103
- *
104
135
  * @param {?*} children Children tree container.
105
136
  * @param {function(*, int)} func The map function.
106
137
  * @param {*} context Context for mapFunction.
@@ -110,12 +141,9 @@ function mapChildren(children, func, context) {
110
141
  if (children == null) {
111
142
  return children;
112
143
  }
113
-
114
- var mapResult = {};
115
- var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
116
- traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
117
- MapBookKeeping.release(traverseContext);
118
- return ReactFragment.create(mapResult);
144
+ var result = [];
145
+ mapIntoWithKeyPrefixInternal(children, result, null, func, context);
146
+ return result;
119
147
  }
120
148
 
121
149
  function forEachSingleChildDummy(traverseContext, child, name) {
@@ -133,10 +161,22 @@ function countChildren(children, context) {
133
161
  return traverseAllChildren(children, forEachSingleChildDummy, null);
134
162
  }
135
163
 
164
+ /**
165
+ * Flatten a children object (typically specified as `props.children`) and
166
+ * return an array with appropriately re-keyed children.
167
+ */
168
+ function toArray(children) {
169
+ var result = [];
170
+ mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
171
+ return result;
172
+ }
173
+
136
174
  var ReactChildren = {
137
175
  forEach: forEachChildren,
138
176
  map: mapChildren,
139
- count: countChildren
177
+ mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
178
+ count: countChildren,
179
+ toArray: toArray
140
180
  };
141
181
 
142
182
  module.exports = ReactChildren;
package/lib/ReactClass.js CHANGED
@@ -11,19 +11,18 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactComponent = require("./ReactComponent");
15
- var ReactElement = require("./ReactElement");
16
- var ReactErrorUtils = require("./ReactErrorUtils");
17
- var ReactPropTypeLocations = require("./ReactPropTypeLocations");
18
- var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
19
- var ReactNoopUpdateQueue = require("./ReactNoopUpdateQueue");
20
-
21
- var assign = require("./Object.assign");
22
- var emptyObject = require("./emptyObject");
23
- var invariant = require("./invariant");
24
- var keyMirror = require("./keyMirror");
25
- var keyOf = require("./keyOf");
26
- var warning = require("./warning");
14
+ var ReactComponent = require('./ReactComponent');
15
+ var ReactElement = require('./ReactElement');
16
+ var ReactPropTypeLocations = require('./ReactPropTypeLocations');
17
+ var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
18
+ var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
19
+
20
+ var assign = require('./Object.assign');
21
+ var emptyObject = require('fbjs/lib/emptyObject');
22
+ var invariant = require('fbjs/lib/invariant');
23
+ var keyMirror = require('fbjs/lib/keyMirror');
24
+ var keyOf = require('fbjs/lib/keyOf');
25
+ var warning = require('fbjs/lib/warning');
27
26
 
28
27
  var MIXINS_KEY = keyOf({ mixins: null });
29
28
 
@@ -58,7 +57,7 @@ var warnedSetProps = false;
58
57
  function warnSetProps() {
59
58
  if (!warnedSetProps) {
60
59
  warnedSetProps = true;
61
- 'production' !== process.env.NODE_ENV ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call React.render again at the top level.') : undefined;
60
+ process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
62
61
  }
63
62
  }
64
63
 
@@ -328,13 +327,13 @@ var RESERVED_SPEC_KEYS = {
328
327
  }
329
328
  },
330
329
  childContextTypes: function (Constructor, childContextTypes) {
331
- if ('production' !== process.env.NODE_ENV) {
330
+ if (process.env.NODE_ENV !== 'production') {
332
331
  validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
333
332
  }
334
333
  Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
335
334
  },
336
335
  contextTypes: function (Constructor, contextTypes) {
337
- if ('production' !== process.env.NODE_ENV) {
336
+ if (process.env.NODE_ENV !== 'production') {
338
337
  validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
339
338
  }
340
339
  Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
@@ -351,22 +350,23 @@ var RESERVED_SPEC_KEYS = {
351
350
  }
352
351
  },
353
352
  propTypes: function (Constructor, propTypes) {
354
- if ('production' !== process.env.NODE_ENV) {
353
+ if (process.env.NODE_ENV !== 'production') {
355
354
  validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
356
355
  }
357
356
  Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
358
357
  },
359
358
  statics: function (Constructor, statics) {
360
359
  mixStaticSpecIntoComponent(Constructor, statics);
361
- }
362
- };
360
+ },
361
+ autobind: function () {} };
363
362
 
363
+ // noop
364
364
  function validateTypeDef(Constructor, typeDef, location) {
365
365
  for (var propName in typeDef) {
366
366
  if (typeDef.hasOwnProperty(propName)) {
367
367
  // use a warning instead of an invariant so components
368
368
  // don't show up in prod but not in __DEV__
369
- 'production' !== process.env.NODE_ENV ? 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;
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;
370
370
  }
371
371
  }
372
372
  }
@@ -376,12 +376,12 @@ function validateMethodOverride(proto, name) {
376
376
 
377
377
  // Disallow overriding of base class methods unless explicitly allowed.
378
378
  if (ReactClassMixin.hasOwnProperty(name)) {
379
- !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? 'production' !== process.env.NODE_ENV ? 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;
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;
380
380
  }
381
381
 
382
382
  // Disallow defining methods more than once unless explicitly allowed.
383
383
  if (proto.hasOwnProperty(name)) {
384
- !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? 'production' !== process.env.NODE_ENV ? 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;
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;
385
385
  }
386
386
  }
387
387
 
@@ -394,8 +394,8 @@ function mixSpecIntoComponent(Constructor, spec) {
394
394
  return;
395
395
  }
396
396
 
397
- !(typeof spec !== 'function') ? 'production' !== process.env.NODE_ENV ? 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) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
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;
399
399
 
400
400
  var proto = Constructor.prototype;
401
401
 
@@ -429,7 +429,7 @@ function mixSpecIntoComponent(Constructor, spec) {
429
429
  var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
430
430
  var isAlreadyDefined = proto.hasOwnProperty(name);
431
431
  var isFunction = typeof property === 'function';
432
- var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined;
432
+ var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
433
433
 
434
434
  if (shouldAutoBind) {
435
435
  if (!proto.__reactAutoBindMap) {
@@ -442,7 +442,7 @@ function mixSpecIntoComponent(Constructor, spec) {
442
442
  var specPolicy = ReactClassInterface[name];
443
443
 
444
444
  // These cases should already be caught by validateMethodOverride.
445
- !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
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;
446
446
 
447
447
  // For methods which are defined more than once, call the existing
448
448
  // methods before calling the new property, merging if appropriate.
@@ -453,7 +453,7 @@ function mixSpecIntoComponent(Constructor, spec) {
453
453
  }
454
454
  } else {
455
455
  proto[name] = property;
456
- if ('production' !== process.env.NODE_ENV) {
456
+ if (process.env.NODE_ENV !== 'production') {
457
457
  // Add verbose displayName to the function, which helps when looking
458
458
  // at profiling tools.
459
459
  if (typeof property === 'function' && spec.displayName) {
@@ -477,10 +477,10 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
477
477
  }
478
478
 
479
479
  var isReserved = (name in RESERVED_SPEC_KEYS);
480
- !!isReserved ? 'production' !== process.env.NODE_ENV ? 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;
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;
481
481
 
482
482
  var isInherited = (name in Constructor);
483
- !!isInherited ? 'production' !== process.env.NODE_ENV ? 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;
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;
484
484
  Constructor[name] = property;
485
485
  }
486
486
  }
@@ -493,11 +493,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
493
493
  * @return {object} one after it has been mutated to contain everything in two.
494
494
  */
495
495
  function mergeIntoWithNoDuplicateKeys(one, two) {
496
- !(one && two && typeof one === 'object' && typeof two === 'object') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
496
+ !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
497
497
 
498
498
  for (var key in two) {
499
499
  if (two.hasOwnProperty(key)) {
500
- !(one[key] === undefined) ? 'production' !== process.env.NODE_ENV ? 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;
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;
501
501
  one[key] = two[key];
502
502
  }
503
503
  }
@@ -552,7 +552,7 @@ function createChainedFunction(one, two) {
552
552
  */
553
553
  function bindAutoBindMethod(component, method) {
554
554
  var boundMethod = method.bind(component);
555
- if ('production' !== process.env.NODE_ENV) {
555
+ if (process.env.NODE_ENV !== 'production') {
556
556
  boundMethod.__reactBoundContext = component;
557
557
  boundMethod.__reactBoundMethod = method;
558
558
  boundMethod.__reactBoundArguments = null;
@@ -568,9 +568,9 @@ function bindAutoBindMethod(component, method) {
568
568
  // ignore the value of "this" that the user is trying to use, so
569
569
  // let's warn.
570
570
  if (newThis !== component && newThis !== null) {
571
- 'production' !== process.env.NODE_ENV ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
571
+ process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
572
572
  } else if (!args.length) {
573
- 'production' !== process.env.NODE_ENV ? 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;
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;
574
574
  return boundMethod;
575
575
  }
576
576
  var reboundMethod = _bind.apply(boundMethod, arguments);
@@ -593,7 +593,7 @@ function bindAutoBindMethods(component) {
593
593
  for (var autoBindKey in component.__reactAutoBindMap) {
594
594
  if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
595
595
  var method = component.__reactAutoBindMap[autoBindKey];
596
- component[autoBindKey] = bindAutoBindMethod(component, ReactErrorUtils.guard(method, component.constructor.displayName + '.' + autoBindKey));
596
+ component[autoBindKey] = bindAutoBindMethod(component, method);
597
597
  }
598
598
  }
599
599
  }
@@ -635,7 +635,7 @@ var ReactClassMixin = {
635
635
  * @deprecated
636
636
  */
637
637
  setProps: function (partialProps, callback) {
638
- if ('production' !== process.env.NODE_ENV) {
638
+ if (process.env.NODE_ENV !== 'production') {
639
639
  warnSetProps();
640
640
  }
641
641
  this.updater.enqueueSetProps(this, partialProps);
@@ -654,7 +654,7 @@ var ReactClassMixin = {
654
654
  * @deprecated
655
655
  */
656
656
  replaceProps: function (newProps, callback) {
657
- if ('production' !== process.env.NODE_ENV) {
657
+ if (process.env.NODE_ENV !== 'production') {
658
658
  warnSetProps();
659
659
  }
660
660
  this.updater.enqueueReplaceProps(this, newProps);
@@ -686,8 +686,8 @@ var ReactClass = {
686
686
  // This constructor is overridden by mocks. The argument is used
687
687
  // by mocks to assert on what gets mounted.
688
688
 
689
- if ('production' !== process.env.NODE_ENV) {
690
- 'production' !== process.env.NODE_ENV ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
689
+ 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;
691
691
  }
692
692
 
693
693
  // Wire up auto-binding
@@ -706,7 +706,7 @@ var ReactClass = {
706
706
  // getInitialState and componentWillMount methods for initialization.
707
707
 
708
708
  var initialState = this.getInitialState ? this.getInitialState() : null;
709
- if ('production' !== process.env.NODE_ENV) {
709
+ if (process.env.NODE_ENV !== 'production') {
710
710
  // We allow auto-mocks to proceed as if they're returning null.
711
711
  if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
712
712
  // This is probably bad practice. Consider warning here and
@@ -714,7 +714,7 @@ var ReactClass = {
714
714
  initialState = null;
715
715
  }
716
716
  }
717
- !(typeof initialState === 'object' && !Array.isArray(initialState)) ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
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;
718
718
 
719
719
  this.state = initialState;
720
720
  };
@@ -730,7 +730,7 @@ var ReactClass = {
730
730
  Constructor.defaultProps = Constructor.getDefaultProps();
731
731
  }
732
732
 
733
- if ('production' !== process.env.NODE_ENV) {
733
+ if (process.env.NODE_ENV !== 'production') {
734
734
  // This is a tag to indicate that the use of these method names is ok,
735
735
  // since it's used with createClass. If it's not, then it's likely a
736
736
  // mistake so we'll warn you to use the static property, property
@@ -743,11 +743,11 @@ var ReactClass = {
743
743
  }
744
744
  }
745
745
 
746
- !Constructor.prototype.render ? 'production' !== process.env.NODE_ENV ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
746
+ !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
747
747
 
748
- if ('production' !== process.env.NODE_ENV) {
749
- 'production' !== process.env.NODE_ENV ? 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
- 'production' !== process.env.NODE_ENV ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
748
+ 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;
751
751
  }
752
752
 
753
753
  // Reduce time spent doing lookups by setting these on the prototype.
@@ -11,11 +11,11 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactNoopUpdateQueue = require("./ReactNoopUpdateQueue");
14
+ var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
15
15
 
16
- var emptyObject = require("./emptyObject");
17
- var invariant = require("./invariant");
18
- var warning = require("./warning");
16
+ var emptyObject = require('fbjs/lib/emptyObject');
17
+ var invariant = require('fbjs/lib/invariant');
18
+ var warning = require('fbjs/lib/warning');
19
19
 
20
20
  /**
21
21
  * Base class helpers for the updating state of a component.
@@ -29,6 +29,8 @@ function ReactComponent(props, context, updater) {
29
29
  this.updater = updater || ReactNoopUpdateQueue;
30
30
  }
31
31
 
32
+ ReactComponent.prototype.isReactComponent = {};
33
+
32
34
  /**
33
35
  * Sets a subset of the state. Always use this to mutate
34
36
  * state. You should treat `this.state` as immutable.
@@ -55,9 +57,9 @@ function ReactComponent(props, context, updater) {
55
57
  * @protected
56
58
  */
57
59
  ReactComponent.prototype.setState = function (partialState, callback) {
58
- !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
59
- if ('production' !== process.env.NODE_ENV) {
60
- 'production' !== process.env.NODE_ENV ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
60
+ !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
61
+ if (process.env.NODE_ENV !== 'production') {
62
+ process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
61
63
  }
62
64
  this.updater.enqueueSetState(this, partialState);
63
65
  if (callback) {
@@ -91,23 +93,25 @@ ReactComponent.prototype.forceUpdate = function (callback) {
91
93
  * we would like to deprecate them, we're not going to move them over to this
92
94
  * modern base class. Instead, we define a getter that warns if it's accessed.
93
95
  */
94
- if ('production' !== process.env.NODE_ENV) {
96
+ if (process.env.NODE_ENV !== 'production') {
95
97
  var deprecatedAPIs = {
96
- getDOMNode: ['getDOMNode', 'Use React.findDOMNode(component) instead.'],
98
+ getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
97
99
  isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
98
- replaceProps: ['replaceProps', 'Instead, call React.render again at the top level.'],
100
+ replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
99
101
  replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
100
- setProps: ['setProps', 'Instead, call React.render again at the top level.']
102
+ setProps: ['setProps', 'Instead, call render again at the top level.']
101
103
  };
102
104
  var defineDeprecationWarning = function (methodName, info) {
103
105
  try {
104
106
  Object.defineProperty(ReactComponent.prototype, methodName, {
105
107
  get: function () {
106
- 'production' !== process.env.NODE_ENV ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
108
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
107
109
  return undefined;
108
110
  }
109
111
  });
110
- } catch (x) {}
112
+ } catch (x) {
113
+ // IE will fail on defineProperty (es5-shim/sham too)
114
+ }
111
115
  };
112
116
  for (var fnName in deprecatedAPIs) {
113
117
  if (deprecatedAPIs.hasOwnProperty(fnName)) {
@@ -116,6 +120,4 @@ if ('production' !== process.env.NODE_ENV) {
116
120
  }
117
121
  }
118
122
 
119
- module.exports = ReactComponent;
120
-
121
- // IE will fail on defineProperty (es5-shim/sham too)
123
+ module.exports = ReactComponent;