react 15.3.2-rc.1 → 15.4.0-rc.3

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 (209) hide show
  1. package/dist/react-with-addons.js +3863 -21388
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2639 -19486
  4. package/dist/react.min.js +2 -6
  5. package/lib/KeyEscapeUtils.js +0 -1
  6. package/lib/LinkedStateMixin.js +1 -3
  7. package/lib/PooledClass.js +3 -1
  8. package/lib/React.js +0 -1
  9. package/lib/ReactAddonsDOMDependencies.js +35 -0
  10. package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
  11. package/lib/ReactCSSTransitionGroup.js +60 -43
  12. package/lib/ReactCSSTransitionGroupChild.js +2 -3
  13. package/lib/ReactChildren.js +0 -1
  14. package/lib/ReactClass.js +38 -54
  15. package/lib/ReactComponent.js +0 -1
  16. package/lib/ReactComponentTreeDevtool.js +0 -1
  17. package/lib/ReactComponentTreeHook.js +84 -101
  18. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
  19. package/lib/ReactComponentWithPureRenderMixin.js +0 -1
  20. package/lib/ReactCurrentOwner.js +1 -2
  21. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
  22. package/lib/ReactDOMFactories.js +0 -1
  23. package/lib/ReactElement.js +6 -14
  24. package/lib/ReactElementSymbol.js +19 -0
  25. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
  26. package/lib/ReactElementValidator.js +1 -3
  27. package/lib/ReactFragment.js +0 -1
  28. package/lib/ReactLink.js +0 -1
  29. package/lib/ReactNoopUpdateQueue.js +0 -1
  30. package/lib/ReactPropTypeLocationNames.js +1 -1
  31. package/lib/ReactPropTypeLocations.js +2 -12
  32. package/lib/ReactPropTypes.js +5 -3
  33. package/lib/ReactPropTypesSecret.js +1 -1
  34. package/lib/ReactPureComponent.js +0 -1
  35. package/lib/ReactStateSetters.js +0 -1
  36. package/lib/ReactTransitionChildMapping.js +0 -1
  37. package/lib/ReactTransitionEvents.js +1 -2
  38. package/lib/ReactTransitionGroup.js +145 -142
  39. package/lib/ReactUMDEntry.js +11 -6
  40. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
  41. package/lib/ReactVersion.js +1 -2
  42. package/lib/ReactWithAddons.js +15 -3
  43. package/lib/ReactWithAddonsUMDEntry.js +11 -6
  44. package/lib/canDefineProperty.js +2 -1
  45. package/lib/checkReactTypeSpec.js +0 -1
  46. package/lib/deprecated.js +0 -1
  47. package/lib/flattenChildren.js +0 -1
  48. package/lib/getIteratorFn.js +0 -1
  49. package/lib/onlyChild.js +0 -1
  50. package/lib/reactProdInvariant.js +0 -1
  51. package/lib/sliceChildren.js +0 -1
  52. package/lib/traverseAllChildren.js +11 -3
  53. package/lib/update.js +6 -8
  54. package/package.json +1 -1
  55. package/lib/AutoFocusUtils.js +0 -24
  56. package/lib/BeforeInputEventPlugin.js +0 -390
  57. package/lib/CSSProperty.js +0 -148
  58. package/lib/CSSPropertyOperations.js +0 -205
  59. package/lib/CallbackQueue.js +0 -106
  60. package/lib/ChangeEventPlugin.js +0 -325
  61. package/lib/DOMChildrenOperations.js +0 -194
  62. package/lib/DOMLazyTree.js +0 -118
  63. package/lib/DOMProperty.js +0 -206
  64. package/lib/DOMPropertyOperations.js +0 -221
  65. package/lib/Danger.js +0 -48
  66. package/lib/DefaultEventPluginOrder.js +0 -27
  67. package/lib/DisabledInputUtils.js +0 -50
  68. package/lib/EnterLeaveEventPlugin.js +0 -105
  69. package/lib/EventConstants.js +0 -97
  70. package/lib/EventPluginHub.js +0 -251
  71. package/lib/EventPluginRegistry.js +0 -247
  72. package/lib/EventPluginUtils.js +0 -229
  73. package/lib/EventPropagators.js +0 -137
  74. package/lib/FallbackCompositionState.js +0 -95
  75. package/lib/HTMLDOMPropertyConfig.js +0 -212
  76. package/lib/LinkedValueUtils.js +0 -136
  77. package/lib/NativeMethodsMixin.js +0 -167
  78. package/lib/ReactBrowserEventEmitter.js +0 -330
  79. package/lib/ReactChildReconciler.js +0 -154
  80. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  81. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  82. package/lib/ReactComponentEnvironment.js +0 -45
  83. package/lib/ReactComponentTreeTestUtils.js +0 -87
  84. package/lib/ReactCompositeComponent.js +0 -904
  85. package/lib/ReactDOM.js +0 -110
  86. package/lib/ReactDOMButton.js +0 -24
  87. package/lib/ReactDOMComponent.js +0 -1006
  88. package/lib/ReactDOMComponentTree.js +0 -188
  89. package/lib/ReactDOMContainerInfo.js +0 -33
  90. package/lib/ReactDOMEmptyComponent.js +0 -60
  91. package/lib/ReactDOMFiber.js +0 -76
  92. package/lib/ReactDOMIDOperations.js +0 -34
  93. package/lib/ReactDOMInput.js +0 -269
  94. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  95. package/lib/ReactDOMOption.js +0 -123
  96. package/lib/ReactDOMSelect.js +0 -201
  97. package/lib/ReactDOMSelection.js +0 -212
  98. package/lib/ReactDOMServer.js +0 -26
  99. package/lib/ReactDOMTextComponent.js +0 -164
  100. package/lib/ReactDOMTextarea.js +0 -155
  101. package/lib/ReactDOMTreeTraversal.js +0 -136
  102. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  103. package/lib/ReactDebugTool.js +0 -301
  104. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  105. package/lib/ReactDefaultInjection.js +0 -84
  106. package/lib/ReactEmptyComponent.js +0 -30
  107. package/lib/ReactErrorUtils.js +0 -76
  108. package/lib/ReactEventEmitterMixin.js +0 -33
  109. package/lib/ReactEventListener.js +0 -157
  110. package/lib/ReactFeatureFlags.js +0 -22
  111. package/lib/ReactHostComponent.js +0 -76
  112. package/lib/ReactHostOperationHistoryHook.js +0 -37
  113. package/lib/ReactInjection.js +0 -36
  114. package/lib/ReactInputSelection.js +0 -124
  115. package/lib/ReactInstanceHandles.js +0 -302
  116. package/lib/ReactInstanceMap.js +0 -48
  117. package/lib/ReactInstrumentation.js +0 -21
  118. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  119. package/lib/ReactMarkupChecksum.js +0 -50
  120. package/lib/ReactMount.js +0 -534
  121. package/lib/ReactMultiChild.js +0 -451
  122. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  123. package/lib/ReactNative.js +0 -71
  124. package/lib/ReactNativeAttributePayload.js +0 -371
  125. package/lib/ReactNativeBaseComponent.js +0 -198
  126. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  127. package/lib/ReactNativeComponentEnvironment.js +0 -31
  128. package/lib/ReactNativeComponentTree.js +0 -68
  129. package/lib/ReactNativeContainerInfo.js +0 -21
  130. package/lib/ReactNativeDOMIDOperations.js +0 -79
  131. package/lib/ReactNativeDefaultInjection.js +0 -101
  132. package/lib/ReactNativeEventEmitter.js +0 -191
  133. package/lib/ReactNativeEventPluginOrder.js +0 -16
  134. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  135. package/lib/ReactNativeMount.js +0 -193
  136. package/lib/ReactNativePropRegistry.js +0 -52
  137. package/lib/ReactNativeReconcileTransaction.js +0 -129
  138. package/lib/ReactNativeTagHandles.js +0 -56
  139. package/lib/ReactNativeTextComponent.js +0 -71
  140. package/lib/ReactNativeTreeTraversal.js +0 -127
  141. package/lib/ReactNodeTypes.js +0 -40
  142. package/lib/ReactNoop.js +0 -173
  143. package/lib/ReactOwner.js +0 -94
  144. package/lib/ReactPerf.js +0 -494
  145. package/lib/ReactReconcileTransaction.js +0 -178
  146. package/lib/ReactReconciler.js +0 -168
  147. package/lib/ReactRef.js +0 -80
  148. package/lib/ReactServerBatchingStrategy.js +0 -22
  149. package/lib/ReactServerRendering.js +0 -90
  150. package/lib/ReactServerRenderingTransaction.js +0 -90
  151. package/lib/ReactServerUpdateQueue.js +0 -141
  152. package/lib/ReactSimpleEmptyComponent.js +0 -37
  153. package/lib/ReactTestMount.js +0 -126
  154. package/lib/ReactTestReconcileTransaction.js +0 -121
  155. package/lib/ReactTestRenderer.js +0 -144
  156. package/lib/ReactTestUtils.js +0 -518
  157. package/lib/ReactUpdateQueue.js +0 -226
  158. package/lib/ReactUpdates.js +0 -251
  159. package/lib/ResponderEventPlugin.js +0 -510
  160. package/lib/ResponderSyntheticEvent.js +0 -39
  161. package/lib/ResponderTouchHistoryStore.js +0 -184
  162. package/lib/SVGDOMPropertyConfig.js +0 -302
  163. package/lib/SelectEventPlugin.js +0 -196
  164. package/lib/SimpleEventPlugin.js +0 -635
  165. package/lib/SyntheticAnimationEvent.js +0 -39
  166. package/lib/SyntheticClipboardEvent.js +0 -38
  167. package/lib/SyntheticCompositionEvent.js +0 -36
  168. package/lib/SyntheticDragEvent.js +0 -36
  169. package/lib/SyntheticEvent.js +0 -268
  170. package/lib/SyntheticFocusEvent.js +0 -36
  171. package/lib/SyntheticInputEvent.js +0 -37
  172. package/lib/SyntheticKeyboardEvent.js +0 -84
  173. package/lib/SyntheticMouseEvent.js +0 -72
  174. package/lib/SyntheticTouchEvent.js +0 -45
  175. package/lib/SyntheticTransitionEvent.js +0 -39
  176. package/lib/SyntheticUIEvent.js +0 -59
  177. package/lib/SyntheticWheelEvent.js +0 -54
  178. package/lib/TapEventPlugin.js +0 -110
  179. package/lib/TouchHistoryMath.js +0 -99
  180. package/lib/Transaction.js +0 -233
  181. package/lib/ViewportMetrics.js +0 -27
  182. package/lib/accumulate.js +0 -46
  183. package/lib/accumulateInto.js +0 -58
  184. package/lib/adler32.js +0 -44
  185. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  186. package/lib/createReactNativeComponentClass.js +0 -42
  187. package/lib/dangerousStyleValue.js +0 -79
  188. package/lib/escapeTextContentForBrowser.js +0 -123
  189. package/lib/findDOMNode.js +0 -60
  190. package/lib/findNodeHandle.js +0 -91
  191. package/lib/forEachAccumulated.js +0 -31
  192. package/lib/getEventCharCode.js +0 -50
  193. package/lib/getEventKey.js +0 -102
  194. package/lib/getEventModifierState.js +0 -43
  195. package/lib/getEventTarget.js +0 -35
  196. package/lib/getHostComponentFromComposite.js +0 -30
  197. package/lib/getNodeForCharacterOffset.js +0 -74
  198. package/lib/getTestDocument.js +0 -21
  199. package/lib/getTextContentAccessor.js +0 -33
  200. package/lib/getVendorPrefixedEventName.js +0 -101
  201. package/lib/instantiateReactComponent.js +0 -119
  202. package/lib/isEventSupported.js +0 -60
  203. package/lib/isTextInputElement.js +0 -51
  204. package/lib/quoteAttributeValueForBrowser.js +0 -26
  205. package/lib/reactComponentExpect.js +0 -217
  206. package/lib/setInnerHTML.js +0 -98
  207. package/lib/setTextContent.js +0 -48
  208. package/lib/shouldUpdateReactComponent.js +0 -42
  209. package/lib/validateDOMNesting.js +0 -382
@@ -0,0 +1,19 @@
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
+ *
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ // The Symbol used to tag the ReactElement type. If there is no native Symbol
15
+ // nor polyfill, then a plain number is used for performance.
16
+
17
+ var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
18
+
19
+ module.exports = REACT_ELEMENT_TYPE;
@@ -1,18 +1,12 @@
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
10
  */
11
11
 
12
- 'use strict';
13
-
14
- var ReactDOMComponentFlags = {
15
- hasCachedChildNodes: 1 << 0
16
- };
17
-
18
- module.exports = ReactDOMComponentFlags;
12
+ 'use strict';
@@ -6,7 +6,6 @@
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 ReactElementValidator
10
9
  */
11
10
 
12
11
  /**
@@ -21,7 +20,6 @@
21
20
  var ReactCurrentOwner = require('./ReactCurrentOwner');
22
21
  var ReactComponentTreeHook = require('./ReactComponentTreeHook');
23
22
  var ReactElement = require('./ReactElement');
24
- var ReactPropTypeLocations = require('./ReactPropTypeLocations');
25
23
 
26
24
  var checkReactTypeSpec = require('./checkReactTypeSpec');
27
25
 
@@ -150,7 +148,7 @@ function validatePropTypes(element) {
150
148
  }
151
149
  var name = componentClass.displayName || componentClass.name;
152
150
  if (componentClass.propTypes) {
153
- checkReactTypeSpec(componentClass.propTypes, element.props, ReactPropTypeLocations.prop, name, element, null);
151
+ checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null);
154
152
  }
155
153
  if (typeof componentClass.getDefaultProps === 'function') {
156
154
  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,7 +6,6 @@
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 ReactFragment
10
9
  */
11
10
 
12
11
  'use strict';
package/lib/ReactLink.js CHANGED
@@ -6,7 +6,6 @@
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 ReactLink
10
9
  */
11
10
 
12
11
  'use strict';
@@ -6,7 +6,6 @@
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 ReactNoopUpdateQueue
10
9
  */
11
10
 
12
11
  'use strict';
@@ -6,7 +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
- * @providesModule ReactPropTypeLocationNames
9
+ *
10
10
  */
11
11
 
12
12
  'use strict';
@@ -6,17 +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
- * @providesModule ReactPropTypeLocations
9
+ *
10
10
  */
11
11
 
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;
12
+ 'use strict';
@@ -6,7 +6,6 @@
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 ReactPropTypes
10
9
  */
11
10
 
12
11
  'use strict';
@@ -131,7 +130,7 @@ function createChainableTypeChecker(validate) {
131
130
  if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {
132
131
  var cacheKey = componentName + ':' + propName;
133
132
  if (!manualPropTypeCallCache[cacheKey]) {
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 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;
133
+ 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;
135
134
  manualPropTypeCallCache[cacheKey] = true;
136
135
  }
137
136
  }
@@ -139,7 +138,10 @@ function createChainableTypeChecker(validate) {
139
138
  if (props[propName] == null) {
140
139
  var locationName = ReactPropTypeLocationNames[location];
141
140
  if (isRequired) {
142
- return new PropTypeError('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
141
+ if (props[propName] === null) {
142
+ return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
143
+ }
144
+ return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
143
145
  }
144
146
  return null;
145
147
  } else {
@@ -6,7 +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
- * @providesModule ReactPropTypesSecret
9
+ *
10
10
  */
11
11
 
12
12
  'use strict';
@@ -6,7 +6,6 @@
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 ReactPureComponent
10
9
  */
11
10
 
12
11
  'use strict';
@@ -6,7 +6,6 @@
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 ReactStateSetters
10
9
  */
11
10
 
12
11
  'use strict';
@@ -6,7 +6,6 @@
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 ReactTransitionChildMapping
10
9
  */
11
10
 
12
11
  'use strict';
@@ -6,14 +6,13 @@
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 ReactTransitionEvents
10
9
  */
11
10
 
12
11
  'use strict';
13
12
 
14
13
  var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
15
14
 
16
- var getVendorPrefixedEventName = require('./getVendorPrefixedEventName');
15
+ var getVendorPrefixedEventName = require('react-dom/lib/getVendorPrefixedEventName');
17
16
 
18
17
  var endEvents = [];
19
18
 
@@ -6,15 +6,20 @@
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 ReactTransitionGroup
10
9
  */
11
10
 
12
11
  'use strict';
13
12
 
14
13
  var _assign = require('object-assign');
15
14
 
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+
17
+ 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; }
18
+
19
+ 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; }
20
+
16
21
  var React = require('./React');
17
- var ReactInstanceMap = require('./ReactInstanceMap');
22
+ var ReactAddonsDOMDependencies = require('./ReactAddonsDOMDependencies');
18
23
  var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
19
24
 
20
25
  var emptyFunction = require('fbjs/lib/emptyFunction');
@@ -24,47 +29,140 @@ var emptyFunction = require('fbjs/lib/emptyFunction');
24
29
  * special lifecycle hooks are called.
25
30
  * See https://facebook.github.io/react/docs/animation.html#low-level-api-reacttransitiongroup
26
31
  */
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 {
32
+
33
+ var ReactTransitionGroup = function (_React$Component) {
34
+ _inherits(ReactTransitionGroup, _React$Component);
35
+
36
+ function ReactTransitionGroup() {
37
+ var _temp, _this, _ret;
38
+
39
+ _classCallCheck(this, ReactTransitionGroup);
40
+
41
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
42
+ args[_key] = arguments[_key];
43
+ }
44
+
45
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
44
46
  // TODO: can we get useful debug information to show at this point?
45
- children: ReactTransitionChildMapping.getChildMapping(this.props.children)
46
- };
47
- },
47
+ children: ReactTransitionChildMapping.getChildMapping(_this.props.children)
48
+ }, _this.performAppear = function (key) {
49
+ _this.currentlyTransitioningKeys[key] = true;
50
+
51
+ var component = _this.refs[key];
52
+
53
+ if (component.componentWillAppear) {
54
+ component.componentWillAppear(_this._handleDoneAppearing.bind(_this, key));
55
+ } else {
56
+ _this._handleDoneAppearing(key);
57
+ }
58
+ }, _this._handleDoneAppearing = function (key) {
59
+ var component = _this.refs[key];
60
+ if (component.componentDidAppear) {
61
+ component.componentDidAppear();
62
+ }
63
+
64
+ delete _this.currentlyTransitioningKeys[key];
65
+
66
+ var currentChildMapping;
67
+ if (process.env.NODE_ENV !== 'production') {
68
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(_this)._debugID);
69
+ } else {
70
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
71
+ }
72
+
73
+ if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
74
+ // This was removed before it had fully appeared. Remove it.
75
+ _this.performLeave(key);
76
+ }
77
+ }, _this.performEnter = function (key) {
78
+ _this.currentlyTransitioningKeys[key] = true;
79
+
80
+ var component = _this.refs[key];
81
+
82
+ if (component.componentWillEnter) {
83
+ component.componentWillEnter(_this._handleDoneEntering.bind(_this, key));
84
+ } else {
85
+ _this._handleDoneEntering(key);
86
+ }
87
+ }, _this._handleDoneEntering = function (key) {
88
+ var component = _this.refs[key];
89
+ if (component.componentDidEnter) {
90
+ component.componentDidEnter();
91
+ }
92
+
93
+ delete _this.currentlyTransitioningKeys[key];
94
+
95
+ var currentChildMapping;
96
+ if (process.env.NODE_ENV !== 'production') {
97
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(_this)._debugID);
98
+ } else {
99
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
100
+ }
48
101
 
49
- componentWillMount: function () {
102
+ if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
103
+ // This was removed before it had fully entered. Remove it.
104
+ _this.performLeave(key);
105
+ }
106
+ }, _this.performLeave = function (key) {
107
+ _this.currentlyTransitioningKeys[key] = true;
108
+
109
+ var component = _this.refs[key];
110
+ if (component.componentWillLeave) {
111
+ component.componentWillLeave(_this._handleDoneLeaving.bind(_this, key));
112
+ } else {
113
+ // Note that this is somewhat dangerous b/c it calls setState()
114
+ // again, effectively mutating the component before all the work
115
+ // is done.
116
+ _this._handleDoneLeaving(key);
117
+ }
118
+ }, _this._handleDoneLeaving = function (key) {
119
+ var component = _this.refs[key];
120
+
121
+ if (component.componentDidLeave) {
122
+ component.componentDidLeave();
123
+ }
124
+
125
+ delete _this.currentlyTransitioningKeys[key];
126
+
127
+ var currentChildMapping;
128
+ if (process.env.NODE_ENV !== 'production') {
129
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(_this)._debugID);
130
+ } else {
131
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children);
132
+ }
133
+
134
+ if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
135
+ // This entered again before it fully left. Add it again.
136
+ _this.performEnter(key);
137
+ } else {
138
+ _this.setState(function (state) {
139
+ var newChildren = _assign({}, state.children);
140
+ delete newChildren[key];
141
+ return { children: newChildren };
142
+ });
143
+ }
144
+ }, _temp), _possibleConstructorReturn(_this, _ret);
145
+ }
146
+
147
+ ReactTransitionGroup.prototype.componentWillMount = function componentWillMount() {
50
148
  this.currentlyTransitioningKeys = {};
51
149
  this.keysToEnter = [];
52
150
  this.keysToLeave = [];
53
- },
151
+ };
54
152
 
55
- componentDidMount: function () {
153
+ ReactTransitionGroup.prototype.componentDidMount = function componentDidMount() {
56
154
  var initialChildMapping = this.state.children;
57
155
  for (var key in initialChildMapping) {
58
156
  if (initialChildMapping[key]) {
59
157
  this.performAppear(key);
60
158
  }
61
159
  }
62
- },
160
+ };
63
161
 
64
- componentWillReceiveProps: function (nextProps) {
162
+ ReactTransitionGroup.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
65
163
  var nextChildMapping;
66
164
  if (process.env.NODE_ENV !== 'production') {
67
- nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children, ReactInstanceMap.get(this)._debugID);
165
+ nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children, ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID);
68
166
  } else {
69
167
  nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
70
168
  }
@@ -91,9 +189,9 @@ var ReactTransitionGroup = React.createClass({
91
189
  }
92
190
 
93
191
  // If we want to someday check for reordering, we could do it here.
94
- },
192
+ };
95
193
 
96
- componentDidUpdate: function () {
194
+ ReactTransitionGroup.prototype.componentDidUpdate = function componentDidUpdate() {
97
195
  var keysToEnter = this.keysToEnter;
98
196
  this.keysToEnter = [];
99
197
  keysToEnter.forEach(this.performEnter);
@@ -101,117 +199,9 @@ var ReactTransitionGroup = React.createClass({
101
199
  var keysToLeave = this.keysToLeave;
102
200
  this.keysToLeave = [];
103
201
  keysToLeave.forEach(this.performLeave);
104
- },
105
-
106
- performAppear: function (key) {
107
- this.currentlyTransitioningKeys[key] = true;
202
+ };
108
203
 
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 () {
204
+ ReactTransitionGroup.prototype.render = function render() {
215
205
  // TODO: we could get rid of the need for the wrapper node
216
206
  // by cloning a single child
217
207
  var childrenToRender = [];
@@ -240,7 +230,20 @@ var ReactTransitionGroup = React.createClass({
240
230
  delete props.component;
241
231
 
242
232
  return React.createElement(this.props.component, props, childrenToRender);
243
- }
244
- });
233
+ };
234
+
235
+ return ReactTransitionGroup;
236
+ }(React.Component);
237
+
238
+ ReactTransitionGroup.displayName = 'ReactTransitionGroup';
239
+ ReactTransitionGroup.propTypes = {
240
+ component: React.PropTypes.any,
241
+ childFactory: React.PropTypes.func
242
+ };
243
+ ReactTransitionGroup.defaultProps = {
244
+ component: 'span',
245
+ childFactory: emptyFunction.thatReturnsArgument
246
+ };
247
+
245
248
 
246
249
  module.exports = ReactTransitionGroup;