react 15.3.1 → 15.4.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/react-with-addons.js +3901 -21391
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2671 -19498
  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 +5 -2
  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/traverseAllChildren.js +11 -2
  33. package/lib/update.js +6 -7
  34. package/package.json +1 -1
  35. package/lib/AutoFocusUtils.js +0 -24
  36. package/lib/BeforeInputEventPlugin.js +0 -388
  37. package/lib/CSSProperty.js +0 -148
  38. package/lib/CSSPropertyOperations.js +0 -205
  39. package/lib/CallbackQueue.js +0 -106
  40. package/lib/ChangeEventPlugin.js +0 -325
  41. package/lib/DOMChildrenOperations.js +0 -194
  42. package/lib/DOMLazyTree.js +0 -118
  43. package/lib/DOMProperty.js +0 -206
  44. package/lib/DOMPropertyOperations.js +0 -221
  45. package/lib/Danger.js +0 -48
  46. package/lib/DefaultEventPluginOrder.js +0 -27
  47. package/lib/DisabledInputUtils.js +0 -50
  48. package/lib/EnterLeaveEventPlugin.js +0 -105
  49. package/lib/EventConstants.js +0 -97
  50. package/lib/EventPluginHub.js +0 -251
  51. package/lib/EventPluginRegistry.js +0 -247
  52. package/lib/EventPluginUtils.js +0 -229
  53. package/lib/EventPropagators.js +0 -137
  54. package/lib/FallbackCompositionState.js +0 -95
  55. package/lib/HTMLDOMPropertyConfig.js +0 -209
  56. package/lib/LinkedValueUtils.js +0 -136
  57. package/lib/NativeMethodsMixin.js +0 -167
  58. package/lib/ReactBrowserEventEmitter.js +0 -317
  59. package/lib/ReactChildReconciler.js +0 -154
  60. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  61. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  62. package/lib/ReactComponentEnvironment.js +0 -45
  63. package/lib/ReactComponentTreeTestUtils.js +0 -87
  64. package/lib/ReactCompositeComponent.js +0 -920
  65. package/lib/ReactDOM.js +0 -110
  66. package/lib/ReactDOMButton.js +0 -24
  67. package/lib/ReactDOMComponent.js +0 -1005
  68. package/lib/ReactDOMComponentTree.js +0 -188
  69. package/lib/ReactDOMContainerInfo.js +0 -33
  70. package/lib/ReactDOMEmptyComponent.js +0 -60
  71. package/lib/ReactDOMFiber.js +0 -76
  72. package/lib/ReactDOMIDOperations.js +0 -34
  73. package/lib/ReactDOMInput.js +0 -269
  74. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  75. package/lib/ReactDOMOption.js +0 -123
  76. package/lib/ReactDOMSelect.js +0 -201
  77. package/lib/ReactDOMSelection.js +0 -212
  78. package/lib/ReactDOMServer.js +0 -26
  79. package/lib/ReactDOMTextComponent.js +0 -164
  80. package/lib/ReactDOMTextarea.js +0 -155
  81. package/lib/ReactDOMTreeTraversal.js +0 -136
  82. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  83. package/lib/ReactDebugTool.js +0 -307
  84. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  85. package/lib/ReactDefaultInjection.js +0 -84
  86. package/lib/ReactEmptyComponent.js +0 -30
  87. package/lib/ReactErrorUtils.js +0 -76
  88. package/lib/ReactEventEmitterMixin.js +0 -33
  89. package/lib/ReactEventListener.js +0 -157
  90. package/lib/ReactFeatureFlags.js +0 -22
  91. package/lib/ReactHostComponent.js +0 -76
  92. package/lib/ReactHostOperationHistoryHook.js +0 -37
  93. package/lib/ReactInjection.js +0 -36
  94. package/lib/ReactInputSelection.js +0 -124
  95. package/lib/ReactInstanceHandles.js +0 -302
  96. package/lib/ReactInstanceMap.js +0 -48
  97. package/lib/ReactInstrumentation.js +0 -21
  98. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  99. package/lib/ReactMarkupChecksum.js +0 -50
  100. package/lib/ReactMount.js +0 -534
  101. package/lib/ReactMultiChild.js +0 -451
  102. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  103. package/lib/ReactNative.js +0 -71
  104. package/lib/ReactNativeAttributePayload.js +0 -371
  105. package/lib/ReactNativeBaseComponent.js +0 -198
  106. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  107. package/lib/ReactNativeComponentEnvironment.js +0 -31
  108. package/lib/ReactNativeComponentTree.js +0 -68
  109. package/lib/ReactNativeContainerInfo.js +0 -21
  110. package/lib/ReactNativeDOMIDOperations.js +0 -79
  111. package/lib/ReactNativeDefaultInjection.js +0 -101
  112. package/lib/ReactNativeEventEmitter.js +0 -191
  113. package/lib/ReactNativeEventPluginOrder.js +0 -16
  114. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  115. package/lib/ReactNativeMount.js +0 -193
  116. package/lib/ReactNativePropRegistry.js +0 -52
  117. package/lib/ReactNativeReconcileTransaction.js +0 -116
  118. package/lib/ReactNativeTagHandles.js +0 -56
  119. package/lib/ReactNativeTextComponent.js +0 -71
  120. package/lib/ReactNativeTreeTraversal.js +0 -127
  121. package/lib/ReactNodeTypes.js +0 -40
  122. package/lib/ReactNoop.js +0 -173
  123. package/lib/ReactOwner.js +0 -94
  124. package/lib/ReactPerf.js +0 -494
  125. package/lib/ReactReconcileTransaction.js +0 -178
  126. package/lib/ReactReconciler.js +0 -168
  127. package/lib/ReactRef.js +0 -80
  128. package/lib/ReactServerBatchingStrategy.js +0 -22
  129. package/lib/ReactServerRendering.js +0 -90
  130. package/lib/ReactServerRenderingTransaction.js +0 -90
  131. package/lib/ReactServerUpdateQueue.js +0 -141
  132. package/lib/ReactSimpleEmptyComponent.js +0 -37
  133. package/lib/ReactTestMount.js +0 -126
  134. package/lib/ReactTestReconcileTransaction.js +0 -108
  135. package/lib/ReactTestRenderer.js +0 -144
  136. package/lib/ReactTestUtils.js +0 -518
  137. package/lib/ReactUpdateQueue.js +0 -226
  138. package/lib/ReactUpdates.js +0 -251
  139. package/lib/ResponderEventPlugin.js +0 -510
  140. package/lib/ResponderSyntheticEvent.js +0 -39
  141. package/lib/ResponderTouchHistoryStore.js +0 -184
  142. package/lib/SVGDOMPropertyConfig.js +0 -302
  143. package/lib/SelectEventPlugin.js +0 -196
  144. package/lib/SimpleEventPlugin.js +0 -635
  145. package/lib/SyntheticAnimationEvent.js +0 -39
  146. package/lib/SyntheticClipboardEvent.js +0 -38
  147. package/lib/SyntheticCompositionEvent.js +0 -36
  148. package/lib/SyntheticDragEvent.js +0 -36
  149. package/lib/SyntheticEvent.js +0 -267
  150. package/lib/SyntheticFocusEvent.js +0 -36
  151. package/lib/SyntheticInputEvent.js +0 -37
  152. package/lib/SyntheticKeyboardEvent.js +0 -84
  153. package/lib/SyntheticMouseEvent.js +0 -72
  154. package/lib/SyntheticTouchEvent.js +0 -45
  155. package/lib/SyntheticTransitionEvent.js +0 -39
  156. package/lib/SyntheticUIEvent.js +0 -59
  157. package/lib/SyntheticWheelEvent.js +0 -54
  158. package/lib/TapEventPlugin.js +0 -110
  159. package/lib/TouchHistoryMath.js +0 -99
  160. package/lib/Transaction.js +0 -233
  161. package/lib/ViewportMetrics.js +0 -27
  162. package/lib/accumulate.js +0 -46
  163. package/lib/accumulateInto.js +0 -58
  164. package/lib/adler32.js +0 -44
  165. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  166. package/lib/createReactNativeComponentClass.js +0 -42
  167. package/lib/dangerousStyleValue.js +0 -79
  168. package/lib/escapeTextContentForBrowser.js +0 -123
  169. package/lib/findDOMNode.js +0 -60
  170. package/lib/findNodeHandle.js +0 -91
  171. package/lib/forEachAccumulated.js +0 -31
  172. package/lib/getEventCharCode.js +0 -50
  173. package/lib/getEventKey.js +0 -102
  174. package/lib/getEventModifierState.js +0 -43
  175. package/lib/getEventTarget.js +0 -35
  176. package/lib/getHostComponentFromComposite.js +0 -30
  177. package/lib/getNodeForCharacterOffset.js +0 -74
  178. package/lib/getTestDocument.js +0 -21
  179. package/lib/getTextContentAccessor.js +0 -33
  180. package/lib/getVendorPrefixedEventName.js +0 -101
  181. package/lib/instantiateReactComponent.js +0 -119
  182. package/lib/isEventSupported.js +0 -60
  183. package/lib/isTextInputElement.js +0 -51
  184. package/lib/quoteAttributeValueForBrowser.js +0 -26
  185. package/lib/reactComponentExpect.js +0 -217
  186. package/lib/setInnerHTML.js +0 -98
  187. package/lib/setTextContent.js +0 -48
  188. package/lib/shouldUpdateReactComponent.js +0 -42
  189. 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';
@@ -131,7 +131,7 @@ function createChainableTypeChecker(validate) {
131
131
  if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {
132
132
  var cacheKey = componentName + ':' + propName;
133
133
  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;
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;
135
135
  manualPropTypeCallCache[cacheKey] = true;
136
136
  }
137
137
  }
@@ -139,7 +139,10 @@ function createChainableTypeChecker(validate) {
139
139
  if (props[propName] == null) {
140
140
  var locationName = ReactPropTypeLocationNames[location];
141
141
  if (isRequired) {
142
- return new PropTypeError('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`.'));
143
146
  }
144
147
  return null;
145
148
  } else {
@@ -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;