react 15.3.1-rc.2 → 15.4.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/react-with-addons.js +3961 -21387
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2701 -19464
  4. package/dist/react.min.js +2 -6
  5. package/lib/LinkedStateMixin.js +1 -2
  6. package/lib/PooledClass.js +3 -0
  7. package/lib/ReactAddonsDOMDependencies.js +36 -0
  8. package/lib/ReactAddonsDOMDependenciesUMDShim.js +32 -0
  9. package/lib/ReactCSSTransitionGroup.js +60 -42
  10. package/lib/ReactCSSTransitionGroupChild.js +2 -2
  11. package/lib/ReactClass.js +38 -53
  12. package/lib/ReactComponentTreeHook.js +84 -100
  13. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +5 -7
  14. package/lib/ReactCurrentOwner.js +1 -1
  15. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +6 -4
  16. package/lib/ReactElement.js +6 -29
  17. package/lib/ReactElementSymbol.js +20 -0
  18. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +4 -9
  19. package/lib/ReactElementValidator.js +1 -2
  20. package/lib/ReactPropTypeLocationNames.js +1 -0
  21. package/lib/ReactPropTypeLocations.js +2 -11
  22. package/lib/ReactPropTypes.js +30 -13
  23. package/lib/ReactPropTypesSecret.js +1 -0
  24. package/lib/ReactTransitionEvents.js +1 -1
  25. package/lib/ReactTransitionGroup.js +145 -141
  26. package/lib/ReactUMDEntry.js +11 -5
  27. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +4 -6
  28. package/lib/ReactVersion.js +1 -1
  29. package/lib/ReactWithAddons.js +15 -2
  30. package/lib/ReactWithAddonsUMDEntry.js +11 -5
  31. package/lib/canDefineProperty.js +2 -0
  32. package/lib/onlyChild.js +1 -1
  33. package/lib/traverseAllChildren.js +11 -2
  34. package/lib/update.js +6 -7
  35. package/package.json +2 -2
  36. package/lib/AutoFocusUtils.js +0 -24
  37. package/lib/BeforeInputEventPlugin.js +0 -388
  38. package/lib/CSSProperty.js +0 -148
  39. package/lib/CSSPropertyOperations.js +0 -205
  40. package/lib/CallbackQueue.js +0 -106
  41. package/lib/ChangeEventPlugin.js +0 -325
  42. package/lib/DOMChildrenOperations.js +0 -194
  43. package/lib/DOMLazyTree.js +0 -118
  44. package/lib/DOMProperty.js +0 -206
  45. package/lib/DOMPropertyOperations.js +0 -221
  46. package/lib/Danger.js +0 -48
  47. package/lib/DefaultEventPluginOrder.js +0 -27
  48. package/lib/DisabledInputUtils.js +0 -50
  49. package/lib/EnterLeaveEventPlugin.js +0 -105
  50. package/lib/EventConstants.js +0 -97
  51. package/lib/EventPluginHub.js +0 -251
  52. package/lib/EventPluginRegistry.js +0 -247
  53. package/lib/EventPluginUtils.js +0 -229
  54. package/lib/EventPropagators.js +0 -137
  55. package/lib/FallbackCompositionState.js +0 -95
  56. package/lib/HTMLDOMPropertyConfig.js +0 -209
  57. package/lib/LinkedValueUtils.js +0 -136
  58. package/lib/NativeMethodsMixin.js +0 -167
  59. package/lib/ReactBrowserEventEmitter.js +0 -317
  60. package/lib/ReactChildReconciler.js +0 -154
  61. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  62. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  63. package/lib/ReactComponentEnvironment.js +0 -45
  64. package/lib/ReactComponentTreeTestUtils.js +0 -87
  65. package/lib/ReactCompositeComponent.js +0 -920
  66. package/lib/ReactDOM.js +0 -110
  67. package/lib/ReactDOMButton.js +0 -24
  68. package/lib/ReactDOMComponent.js +0 -1005
  69. package/lib/ReactDOMComponentTree.js +0 -188
  70. package/lib/ReactDOMContainerInfo.js +0 -33
  71. package/lib/ReactDOMEmptyComponent.js +0 -60
  72. package/lib/ReactDOMFiber.js +0 -78
  73. package/lib/ReactDOMIDOperations.js +0 -34
  74. package/lib/ReactDOMInput.js +0 -269
  75. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  76. package/lib/ReactDOMOption.js +0 -123
  77. package/lib/ReactDOMSelect.js +0 -201
  78. package/lib/ReactDOMSelection.js +0 -212
  79. package/lib/ReactDOMServer.js +0 -26
  80. package/lib/ReactDOMTextComponent.js +0 -164
  81. package/lib/ReactDOMTextarea.js +0 -155
  82. package/lib/ReactDOMTreeTraversal.js +0 -136
  83. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  84. package/lib/ReactDebugTool.js +0 -307
  85. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  86. package/lib/ReactDefaultInjection.js +0 -84
  87. package/lib/ReactEmptyComponent.js +0 -30
  88. package/lib/ReactErrorUtils.js +0 -76
  89. package/lib/ReactEventEmitterMixin.js +0 -33
  90. package/lib/ReactEventListener.js +0 -157
  91. package/lib/ReactFeatureFlags.js +0 -22
  92. package/lib/ReactHostComponent.js +0 -76
  93. package/lib/ReactHostOperationHistoryHook.js +0 -37
  94. package/lib/ReactInjection.js +0 -36
  95. package/lib/ReactInputSelection.js +0 -124
  96. package/lib/ReactInstanceHandles.js +0 -302
  97. package/lib/ReactInstanceMap.js +0 -48
  98. package/lib/ReactInstrumentation.js +0 -21
  99. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  100. package/lib/ReactMarkupChecksum.js +0 -50
  101. package/lib/ReactMount.js +0 -495
  102. package/lib/ReactMultiChild.js +0 -451
  103. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  104. package/lib/ReactNative.js +0 -71
  105. package/lib/ReactNativeAttributePayload.js +0 -371
  106. package/lib/ReactNativeBaseComponent.js +0 -198
  107. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  108. package/lib/ReactNativeComponentEnvironment.js +0 -31
  109. package/lib/ReactNativeComponentTree.js +0 -68
  110. package/lib/ReactNativeContainerInfo.js +0 -21
  111. package/lib/ReactNativeDOMIDOperations.js +0 -79
  112. package/lib/ReactNativeDefaultInjection.js +0 -101
  113. package/lib/ReactNativeEventEmitter.js +0 -191
  114. package/lib/ReactNativeEventPluginOrder.js +0 -16
  115. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  116. package/lib/ReactNativeMount.js +0 -193
  117. package/lib/ReactNativePropRegistry.js +0 -52
  118. package/lib/ReactNativeReconcileTransaction.js +0 -116
  119. package/lib/ReactNativeTagHandles.js +0 -56
  120. package/lib/ReactNativeTextComponent.js +0 -71
  121. package/lib/ReactNativeTreeTraversal.js +0 -127
  122. package/lib/ReactNodeTypes.js +0 -40
  123. package/lib/ReactNoop.js +0 -173
  124. package/lib/ReactOwner.js +0 -94
  125. package/lib/ReactPerf.js +0 -494
  126. package/lib/ReactReconcileTransaction.js +0 -178
  127. package/lib/ReactReconciler.js +0 -168
  128. package/lib/ReactRef.js +0 -80
  129. package/lib/ReactServerBatchingStrategy.js +0 -22
  130. package/lib/ReactServerRendering.js +0 -90
  131. package/lib/ReactServerRenderingTransaction.js +0 -90
  132. package/lib/ReactServerUpdateQueue.js +0 -141
  133. package/lib/ReactSimpleEmptyComponent.js +0 -37
  134. package/lib/ReactTestMount.js +0 -123
  135. package/lib/ReactTestReconcileTransaction.js +0 -108
  136. package/lib/ReactTestRenderer.js +0 -144
  137. package/lib/ReactTestUtils.js +0 -518
  138. package/lib/ReactUpdateQueue.js +0 -226
  139. package/lib/ReactUpdates.js +0 -251
  140. package/lib/ResponderEventPlugin.js +0 -510
  141. package/lib/ResponderSyntheticEvent.js +0 -39
  142. package/lib/ResponderTouchHistoryStore.js +0 -184
  143. package/lib/SVGDOMPropertyConfig.js +0 -302
  144. package/lib/SelectEventPlugin.js +0 -196
  145. package/lib/SimpleEventPlugin.js +0 -635
  146. package/lib/SyntheticAnimationEvent.js +0 -39
  147. package/lib/SyntheticClipboardEvent.js +0 -38
  148. package/lib/SyntheticCompositionEvent.js +0 -36
  149. package/lib/SyntheticDragEvent.js +0 -36
  150. package/lib/SyntheticEvent.js +0 -267
  151. package/lib/SyntheticFocusEvent.js +0 -36
  152. package/lib/SyntheticInputEvent.js +0 -37
  153. package/lib/SyntheticKeyboardEvent.js +0 -84
  154. package/lib/SyntheticMouseEvent.js +0 -72
  155. package/lib/SyntheticTouchEvent.js +0 -45
  156. package/lib/SyntheticTransitionEvent.js +0 -39
  157. package/lib/SyntheticUIEvent.js +0 -59
  158. package/lib/SyntheticWheelEvent.js +0 -54
  159. package/lib/TapEventPlugin.js +0 -110
  160. package/lib/TouchHistoryMath.js +0 -99
  161. package/lib/Transaction.js +0 -233
  162. package/lib/ViewportMetrics.js +0 -27
  163. package/lib/accumulate.js +0 -46
  164. package/lib/accumulateInto.js +0 -58
  165. package/lib/adler32.js +0 -44
  166. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  167. package/lib/createReactNativeComponentClass.js +0 -42
  168. package/lib/dangerousStyleValue.js +0 -79
  169. package/lib/escapeTextContentForBrowser.js +0 -122
  170. package/lib/findDOMNode.js +0 -60
  171. package/lib/findNodeHandle.js +0 -91
  172. package/lib/forEachAccumulated.js +0 -31
  173. package/lib/getEventCharCode.js +0 -50
  174. package/lib/getEventKey.js +0 -102
  175. package/lib/getEventModifierState.js +0 -43
  176. package/lib/getEventTarget.js +0 -35
  177. package/lib/getHostComponentFromComposite.js +0 -30
  178. package/lib/getNodeForCharacterOffset.js +0 -74
  179. package/lib/getTestDocument.js +0 -21
  180. package/lib/getTextContentAccessor.js +0 -33
  181. package/lib/getVendorPrefixedEventName.js +0 -101
  182. package/lib/instantiateReactComponent.js +0 -119
  183. package/lib/isEventSupported.js +0 -60
  184. package/lib/isTextInputElement.js +0 -51
  185. package/lib/quoteAttributeValueForBrowser.js +0 -26
  186. package/lib/reactComponentExpect.js +0 -217
  187. package/lib/setInnerHTML.js +0 -98
  188. package/lib/setTextContent.js +0 -48
  189. package/lib/shouldUpdateReactComponent.js +0 -42
  190. package/lib/validateDOMNesting.js +0 -369
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2014-present, 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 ReactElementSymbol
10
+ *
11
+ */
12
+
13
+ 'use strict';
14
+
15
+ // The Symbol used to tag the ReactElement type. If there is no native Symbol
16
+ // nor polyfill, then a plain number is used for performance.
17
+
18
+ var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
19
+
20
+ module.exports = REACT_ELEMENT_TYPE;
@@ -1,18 +1,13 @@
1
1
  /**
2
- * Copyright 2015-present, Facebook, Inc.
2
+ * Copyright 2016-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
6
6
  * LICENSE file in the root directory of this source tree. An additional grant
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
- * @providesModule ReactDOMComponentFlags
9
+ *
10
+ * @providesModule ReactElementType
10
11
  */
11
12
 
12
- 'use strict';
13
-
14
- var ReactDOMComponentFlags = {
15
- hasCachedChildNodes: 1 << 0
16
- };
17
-
18
- module.exports = ReactDOMComponentFlags;
13
+ 'use strict';
@@ -21,7 +21,6 @@
21
21
  var ReactCurrentOwner = require('./ReactCurrentOwner');
22
22
  var ReactComponentTreeHook = require('./ReactComponentTreeHook');
23
23
  var ReactElement = require('./ReactElement');
24
- var ReactPropTypeLocations = require('./ReactPropTypeLocations');
25
24
 
26
25
  var checkReactTypeSpec = require('./checkReactTypeSpec');
27
26
 
@@ -150,7 +149,7 @@ function validatePropTypes(element) {
150
149
  }
151
150
  var name = componentClass.displayName || componentClass.name;
152
151
  if (componentClass.propTypes) {
153
- checkReactTypeSpec(componentClass.propTypes, element.props, ReactPropTypeLocations.prop, name, element, null);
152
+ checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null);
154
153
  }
155
154
  if (typeof componentClass.getDefaultProps === 'function') {
156
155
  process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
@@ -6,6 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree. An additional grant
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
+ *
9
10
  * @providesModule ReactPropTypeLocationNames
10
11
  */
11
12
 
@@ -6,17 +6,8 @@
6
6
  * LICENSE file in the root directory of this source tree. An additional grant
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
+ *
9
10
  * @providesModule ReactPropTypeLocations
10
11
  */
11
12
 
12
- 'use strict';
13
-
14
- var keyMirror = require('fbjs/lib/keyMirror');
15
-
16
- var ReactPropTypeLocations = keyMirror({
17
- prop: null,
18
- context: null,
19
- childContext: null
20
- });
21
-
22
- module.exports = ReactPropTypeLocations;
13
+ 'use strict';
@@ -106,6 +106,20 @@ function is(x, y) {
106
106
  }
107
107
  /*eslint-enable no-self-compare*/
108
108
 
109
+ /**
110
+ * We use an Error-like object for backward compatibility as people may call
111
+ * PropTypes directly and inspect their output. However we don't use real
112
+ * Errors anymore. We don't inspect their stack anyway, and creating them
113
+ * is prohibitively expensive if they are created too often, such as what
114
+ * happens in oneOfType() for any type before the one that matched.
115
+ */
116
+ function PropTypeError(message) {
117
+ this.message = message;
118
+ this.stack = '';
119
+ }
120
+ // Make `instanceof Error` still work for returned errors.
121
+ PropTypeError.prototype = Error.prototype;
122
+
109
123
  function createChainableTypeChecker(validate) {
110
124
  if (process.env.NODE_ENV !== 'production') {
111
125
  var manualPropTypeCallCache = {};
@@ -117,7 +131,7 @@ function createChainableTypeChecker(validate) {
117
131
  if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {
118
132
  var cacheKey = componentName + ':' + propName;
119
133
  if (!manualPropTypeCallCache[cacheKey]) {
120
- process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in the next major version. You may be ' + 'seeing this warning due to a third-party PropTypes library. ' + 'See https://fb.me/react-warning-dont-call-proptypes for details.', propFullName, componentName) : void 0;
134
+ process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName) : void 0;
121
135
  manualPropTypeCallCache[cacheKey] = true;
122
136
  }
123
137
  }
@@ -125,7 +139,10 @@ function createChainableTypeChecker(validate) {
125
139
  if (props[propName] == null) {
126
140
  var locationName = ReactPropTypeLocationNames[location];
127
141
  if (isRequired) {
128
- return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
142
+ if (props[propName] === null) {
143
+ return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
144
+ }
145
+ return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
129
146
  }
130
147
  return null;
131
148
  } else {
@@ -150,7 +167,7 @@ function createPrimitiveTypeChecker(expectedType) {
150
167
  // 'of type `object`'.
151
168
  var preciseType = getPreciseType(propValue);
152
169
 
153
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
170
+ return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
154
171
  }
155
172
  return null;
156
173
  }
@@ -164,13 +181,13 @@ function createAnyTypeChecker() {
164
181
  function createArrayOfTypeChecker(typeChecker) {
165
182
  function validate(props, propName, componentName, location, propFullName) {
166
183
  if (typeof typeChecker !== 'function') {
167
- return new Error('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
184
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
168
185
  }
169
186
  var propValue = props[propName];
170
187
  if (!Array.isArray(propValue)) {
171
188
  var locationName = ReactPropTypeLocationNames[location];
172
189
  var propType = getPropType(propValue);
173
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
190
+ return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
174
191
  }
175
192
  for (var i = 0; i < propValue.length; i++) {
176
193
  var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
@@ -189,7 +206,7 @@ function createElementTypeChecker() {
189
206
  if (!ReactElement.isValidElement(propValue)) {
190
207
  var locationName = ReactPropTypeLocationNames[location];
191
208
  var propType = getPropType(propValue);
192
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
209
+ return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
193
210
  }
194
211
  return null;
195
212
  }
@@ -202,7 +219,7 @@ function createInstanceTypeChecker(expectedClass) {
202
219
  var locationName = ReactPropTypeLocationNames[location];
203
220
  var expectedClassName = expectedClass.name || ANONYMOUS;
204
221
  var actualClassName = getClassName(props[propName]);
205
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
222
+ return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
206
223
  }
207
224
  return null;
208
225
  }
@@ -225,7 +242,7 @@ function createEnumTypeChecker(expectedValues) {
225
242
 
226
243
  var locationName = ReactPropTypeLocationNames[location];
227
244
  var valuesString = JSON.stringify(expectedValues);
228
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
245
+ return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
229
246
  }
230
247
  return createChainableTypeChecker(validate);
231
248
  }
@@ -233,13 +250,13 @@ function createEnumTypeChecker(expectedValues) {
233
250
  function createObjectOfTypeChecker(typeChecker) {
234
251
  function validate(props, propName, componentName, location, propFullName) {
235
252
  if (typeof typeChecker !== 'function') {
236
- return new Error('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
253
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
237
254
  }
238
255
  var propValue = props[propName];
239
256
  var propType = getPropType(propValue);
240
257
  if (propType !== 'object') {
241
258
  var locationName = ReactPropTypeLocationNames[location];
242
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
259
+ return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
243
260
  }
244
261
  for (var key in propValue) {
245
262
  if (propValue.hasOwnProperty(key)) {
@@ -269,7 +286,7 @@ function createUnionTypeChecker(arrayOfTypeCheckers) {
269
286
  }
270
287
 
271
288
  var locationName = ReactPropTypeLocationNames[location];
272
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
289
+ return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
273
290
  }
274
291
  return createChainableTypeChecker(validate);
275
292
  }
@@ -278,7 +295,7 @@ function createNodeChecker() {
278
295
  function validate(props, propName, componentName, location, propFullName) {
279
296
  if (!isNode(props[propName])) {
280
297
  var locationName = ReactPropTypeLocationNames[location];
281
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
298
+ return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
282
299
  }
283
300
  return null;
284
301
  }
@@ -291,7 +308,7 @@ function createShapeTypeChecker(shapeTypes) {
291
308
  var propType = getPropType(propValue);
292
309
  if (propType !== 'object') {
293
310
  var locationName = ReactPropTypeLocationNames[location];
294
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
311
+ return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
295
312
  }
296
313
  for (var key in shapeTypes) {
297
314
  var checker = shapeTypes[key];
@@ -6,6 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree. An additional grant
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
+ *
9
10
  * @providesModule ReactPropTypesSecret
10
11
  */
11
12
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
15
15
 
16
- var getVendorPrefixedEventName = require('./getVendorPrefixedEventName');
16
+ var getVendorPrefixedEventName = require('react-dom/lib/getVendorPrefixedEventName');
17
17
 
18
18
  var endEvents = [];
19
19
 
@@ -13,8 +13,14 @@
13
13
 
14
14
  var _assign = require('object-assign');
15
15
 
16
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
+
18
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
19
+
20
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
21
+
16
22
  var React = require('./React');
17
- var ReactInstanceMap = require('./ReactInstanceMap');
23
+ var ReactAddonsDOMDependencies = require('./ReactAddonsDOMDependencies');
18
24
  var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
19
25
 
20
26
  var emptyFunction = require('fbjs/lib/emptyFunction');
@@ -24,47 +30,140 @@ var emptyFunction = require('fbjs/lib/emptyFunction');
24
30
  * special lifecycle hooks are called.
25
31
  * See https://facebook.github.io/react/docs/animation.html#low-level-api-reacttransitiongroup
26
32
  */
27
- var ReactTransitionGroup = React.createClass({
28
- displayName: 'ReactTransitionGroup',
29
-
30
- propTypes: {
31
- component: React.PropTypes.any,
32
- childFactory: React.PropTypes.func
33
- },
34
-
35
- getDefaultProps: function () {
36
- return {
37
- component: 'span',
38
- childFactory: emptyFunction.thatReturnsArgument
39
- };
40
- },
41
-
42
- getInitialState: function () {
43
- return {
33
+
34
+ var ReactTransitionGroup = function (_React$Component) {
35
+ _inherits(ReactTransitionGroup, _React$Component);
36
+
37
+ function ReactTransitionGroup() {
38
+ var _temp, _this, _ret;
39
+
40
+ _classCallCheck(this, ReactTransitionGroup);
41
+
42
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
43
+ args[_key] = arguments[_key];
44
+ }
45
+
46
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
44
47
  // TODO: can we get useful debug information to show at this point?
45
- children: ReactTransitionChildMapping.getChildMapping(this.props.children)
46
- };
47
- },
48
+ children: ReactTransitionChildMapping.getChildMapping(_this.props.children)
49
+ }, _this.performAppear = function (key) {
50
+ _this.currentlyTransitioningKeys[key] = true;
51
+
52
+ var component = _this.refs[key];
53
+
54
+ if (component.componentWillAppear) {
55
+ component.componentWillAppear(_this._handleDoneAppearing.bind(_this, key));
56
+ } else {
57
+ _this._handleDoneAppearing(key);
58
+ }
59
+ }, _this._handleDoneAppearing = function (key) {
60
+ var component = _this.refs[key];
61
+ if (component.componentDidAppear) {
62
+ component.componentDidAppear();
63
+ }
64
+
65
+ delete _this.currentlyTransitioningKeys[key];
66
+
67
+ var currentChildMapping;
68
+ if (process.env.NODE_ENV !== 'production') {
69
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(_this)._debugID);
70
+ } else {
71
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
72
+ }
73
+
74
+ if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
75
+ // This was removed before it had fully appeared. Remove it.
76
+ _this.performLeave(key);
77
+ }
78
+ }, _this.performEnter = function (key) {
79
+ _this.currentlyTransitioningKeys[key] = true;
80
+
81
+ var component = _this.refs[key];
82
+
83
+ if (component.componentWillEnter) {
84
+ component.componentWillEnter(_this._handleDoneEntering.bind(_this, key));
85
+ } else {
86
+ _this._handleDoneEntering(key);
87
+ }
88
+ }, _this._handleDoneEntering = function (key) {
89
+ var component = _this.refs[key];
90
+ if (component.componentDidEnter) {
91
+ component.componentDidEnter();
92
+ }
93
+
94
+ delete _this.currentlyTransitioningKeys[key];
95
+
96
+ var currentChildMapping;
97
+ if (process.env.NODE_ENV !== 'production') {
98
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(_this)._debugID);
99
+ } else {
100
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
101
+ }
48
102
 
49
- componentWillMount: function () {
103
+ if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
104
+ // This was removed before it had fully entered. Remove it.
105
+ _this.performLeave(key);
106
+ }
107
+ }, _this.performLeave = function (key) {
108
+ _this.currentlyTransitioningKeys[key] = true;
109
+
110
+ var component = _this.refs[key];
111
+ if (component.componentWillLeave) {
112
+ component.componentWillLeave(_this._handleDoneLeaving.bind(_this, key));
113
+ } else {
114
+ // Note that this is somewhat dangerous b/c it calls setState()
115
+ // again, effectively mutating the component before all the work
116
+ // is done.
117
+ _this._handleDoneLeaving(key);
118
+ }
119
+ }, _this._handleDoneLeaving = function (key) {
120
+ var component = _this.refs[key];
121
+
122
+ if (component.componentDidLeave) {
123
+ component.componentDidLeave();
124
+ }
125
+
126
+ delete _this.currentlyTransitioningKeys[key];
127
+
128
+ var currentChildMapping;
129
+ if (process.env.NODE_ENV !== 'production') {
130
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(_this)._debugID);
131
+ } else {
132
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
133
+ }
134
+
135
+ if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
136
+ // This entered again before it fully left. Add it again.
137
+ _this.performEnter(key);
138
+ } else {
139
+ _this.setState(function (state) {
140
+ var newChildren = _assign({}, state.children);
141
+ delete newChildren[key];
142
+ return { children: newChildren };
143
+ });
144
+ }
145
+ }, _temp), _possibleConstructorReturn(_this, _ret);
146
+ }
147
+
148
+ ReactTransitionGroup.prototype.componentWillMount = function componentWillMount() {
50
149
  this.currentlyTransitioningKeys = {};
51
150
  this.keysToEnter = [];
52
151
  this.keysToLeave = [];
53
- },
152
+ };
54
153
 
55
- componentDidMount: function () {
154
+ ReactTransitionGroup.prototype.componentDidMount = function componentDidMount() {
56
155
  var initialChildMapping = this.state.children;
57
156
  for (var key in initialChildMapping) {
58
157
  if (initialChildMapping[key]) {
59
158
  this.performAppear(key);
60
159
  }
61
160
  }
62
- },
161
+ };
63
162
 
64
- componentWillReceiveProps: function (nextProps) {
163
+ ReactTransitionGroup.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
65
164
  var nextChildMapping;
66
165
  if (process.env.NODE_ENV !== 'production') {
67
- nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children, ReactInstanceMap.get(this)._debugID);
166
+ nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID);
68
167
  } else {
69
168
  nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
70
169
  }
@@ -91,9 +190,9 @@ var ReactTransitionGroup = React.createClass({
91
190
  }
92
191
 
93
192
  // If we want to someday check for reordering, we could do it here.
94
- },
193
+ };
95
194
 
96
- componentDidUpdate: function () {
195
+ ReactTransitionGroup.prototype.componentDidUpdate = function componentDidUpdate() {
97
196
  var keysToEnter = this.keysToEnter;
98
197
  this.keysToEnter = [];
99
198
  keysToEnter.forEach(this.performEnter);
@@ -101,117 +200,9 @@ var ReactTransitionGroup = React.createClass({
101
200
  var keysToLeave = this.keysToLeave;
102
201
  this.keysToLeave = [];
103
202
  keysToLeave.forEach(this.performLeave);
104
- },
105
-
106
- performAppear: function (key) {
107
- this.currentlyTransitioningKeys[key] = true;
203
+ };
108
204
 
109
- var component = this.refs[key];
110
-
111
- if (component.componentWillAppear) {
112
- component.componentWillAppear(this._handleDoneAppearing.bind(this, key));
113
- } else {
114
- this._handleDoneAppearing(key);
115
- }
116
- },
117
-
118
- _handleDoneAppearing: function (key) {
119
- var component = this.refs[key];
120
- if (component.componentDidAppear) {
121
- component.componentDidAppear();
122
- }
123
-
124
- delete this.currentlyTransitioningKeys[key];
125
-
126
- var currentChildMapping;
127
- if (process.env.NODE_ENV !== 'production') {
128
- currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children, ReactInstanceMap.get(this)._debugID);
129
- } else {
130
- currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
131
- }
132
-
133
- if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
134
- // This was removed before it had fully appeared. Remove it.
135
- this.performLeave(key);
136
- }
137
- },
138
-
139
- performEnter: function (key) {
140
- this.currentlyTransitioningKeys[key] = true;
141
-
142
- var component = this.refs[key];
143
-
144
- if (component.componentWillEnter) {
145
- component.componentWillEnter(this._handleDoneEntering.bind(this, key));
146
- } else {
147
- this._handleDoneEntering(key);
148
- }
149
- },
150
-
151
- _handleDoneEntering: function (key) {
152
- var component = this.refs[key];
153
- if (component.componentDidEnter) {
154
- component.componentDidEnter();
155
- }
156
-
157
- delete this.currentlyTransitioningKeys[key];
158
-
159
- var currentChildMapping;
160
- if (process.env.NODE_ENV !== 'production') {
161
- currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children, ReactInstanceMap.get(this)._debugID);
162
- } else {
163
- currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
164
- }
165
-
166
- if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
167
- // This was removed before it had fully entered. Remove it.
168
- this.performLeave(key);
169
- }
170
- },
171
-
172
- performLeave: function (key) {
173
- this.currentlyTransitioningKeys[key] = true;
174
-
175
- var component = this.refs[key];
176
- if (component.componentWillLeave) {
177
- component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
178
- } else {
179
- // Note that this is somewhat dangerous b/c it calls setState()
180
- // again, effectively mutating the component before all the work
181
- // is done.
182
- this._handleDoneLeaving(key);
183
- }
184
- },
185
-
186
- _handleDoneLeaving: function (key) {
187
- var component = this.refs[key];
188
-
189
- if (component.componentDidLeave) {
190
- component.componentDidLeave();
191
- }
192
-
193
- delete this.currentlyTransitioningKeys[key];
194
-
195
- var currentChildMapping;
196
- if (process.env.NODE_ENV !== 'production') {
197
- currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children, ReactInstanceMap.get(this)._debugID);
198
- } else {
199
- currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
200
- }
201
-
202
- if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
203
- // This entered again before it fully left. Add it again.
204
- this.performEnter(key);
205
- } else {
206
- this.setState(function (state) {
207
- var newChildren = _assign({}, state.children);
208
- delete newChildren[key];
209
- return { children: newChildren };
210
- });
211
- }
212
- },
213
-
214
- render: function () {
205
+ ReactTransitionGroup.prototype.render = function render() {
215
206
  // TODO: we could get rid of the need for the wrapper node
216
207
  // by cloning a single child
217
208
  var childrenToRender = [];
@@ -240,7 +231,20 @@ var ReactTransitionGroup = React.createClass({
240
231
  delete props.component;
241
232
 
242
233
  return React.createElement(this.props.component, props, childrenToRender);
243
- }
244
- });
234
+ };
235
+
236
+ return ReactTransitionGroup;
237
+ }(React.Component);
238
+
239
+ ReactTransitionGroup.displayName = 'ReactTransitionGroup';
240
+ ReactTransitionGroup.propTypes = {
241
+ component: React.PropTypes.any,
242
+ childFactory: React.PropTypes.func
243
+ };
244
+ ReactTransitionGroup.defaultProps = {
245
+ component: 'span',
246
+ childFactory: emptyFunction.thatReturnsArgument
247
+ };
248
+
245
249
 
246
250
  module.exports = ReactTransitionGroup;