react 0.11.2 → 0.12.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 (173) hide show
  1. package/dist/JSXTransformer.js +2714 -7859
  2. package/dist/react-with-addons.js +3139 -3593
  3. package/dist/react-with-addons.min.js +11 -17
  4. package/dist/react.js +2940 -3308
  5. package/dist/react.min.js +11 -16
  6. package/lib/AutoFocusMixin.js +5 -12
  7. package/lib/BeforeInputEventPlugin.js +12 -14
  8. package/lib/CSSCore.js +6 -13
  9. package/lib/CSSProperty.js +10 -14
  10. package/lib/CSSPropertyOperations.js +46 -12
  11. package/lib/CallbackQueue.js +7 -14
  12. package/lib/ChangeEventPlugin.js +5 -12
  13. package/lib/ClientReactRootIndex.js +5 -12
  14. package/lib/CompositionEventPlugin.js +5 -12
  15. package/lib/DOMChildrenOperations.js +8 -15
  16. package/lib/DOMProperty.js +16 -19
  17. package/lib/DOMPropertyOperations.js +14 -14
  18. package/lib/Danger.js +12 -17
  19. package/lib/DefaultEventPluginOrder.js +5 -12
  20. package/lib/EnterLeaveEventPlugin.js +5 -12
  21. package/lib/EventConstants.js +5 -12
  22. package/lib/EventListener.js +14 -0
  23. package/lib/EventPluginHub.js +8 -26
  24. package/lib/EventPluginRegistry.js +5 -12
  25. package/lib/EventPluginUtils.js +5 -12
  26. package/lib/EventPropagators.js +12 -17
  27. package/lib/ExecutionEnvironment.js +5 -12
  28. package/lib/HTMLDOMPropertyConfig.js +16 -15
  29. package/lib/LinkedStateMixin.js +5 -12
  30. package/lib/LinkedValueUtils.js +5 -12
  31. package/lib/LocalEventTrapMixin.js +8 -14
  32. package/lib/MobileSafariClickEventPlugin.js +5 -12
  33. package/lib/Object.assign.js +45 -0
  34. package/lib/PooledClass.js +5 -12
  35. package/lib/React.js +87 -54
  36. package/lib/ReactBrowserComponentMixin.js +5 -12
  37. package/lib/ReactBrowserEventEmitter.js +7 -14
  38. package/lib/ReactCSSTransitionGroup.js +15 -17
  39. package/lib/ReactCSSTransitionGroupChild.js +9 -13
  40. package/lib/ReactChildren.js +5 -12
  41. package/lib/ReactComponent.js +61 -68
  42. package/lib/ReactComponentBrowserEnvironment.js +5 -12
  43. package/lib/ReactComponentWithPureRenderMixin.js +5 -12
  44. package/lib/ReactCompositeComponent.js +191 -180
  45. package/lib/ReactContext.js +8 -15
  46. package/lib/ReactCurrentOwner.js +5 -12
  47. package/lib/ReactDOM.js +145 -177
  48. package/lib/ReactDOMButton.js +8 -14
  49. package/lib/ReactDOMComponent.js +103 -38
  50. package/lib/ReactDOMForm.js +9 -15
  51. package/lib/ReactDOMIDOperations.js +5 -12
  52. package/lib/ReactDOMImg.js +8 -14
  53. package/lib/ReactDOMInput.js +30 -38
  54. package/lib/ReactDOMOption.js +8 -14
  55. package/lib/ReactDOMSelect.js +25 -24
  56. package/lib/ReactDOMSelection.js +11 -18
  57. package/lib/ReactDOMTextarea.js +19 -24
  58. package/lib/ReactDefaultBatchingStrategy.js +14 -18
  59. package/lib/ReactDefaultInjection.js +23 -26
  60. package/lib/ReactDefaultPerf.js +14 -17
  61. package/lib/ReactDefaultPerfAnalysis.js +18 -17
  62. package/lib/ReactElement.js +242 -0
  63. package/lib/{ReactDescriptorValidator.js → ReactElementValidator.js} +51 -56
  64. package/lib/ReactEmptyComponent.js +8 -13
  65. package/lib/ReactErrorUtils.js +5 -12
  66. package/lib/ReactEventEmitterMixin.js +5 -12
  67. package/lib/ReactEventListener.js +7 -14
  68. package/lib/ReactInjection.js +7 -14
  69. package/lib/ReactInputSelection.js +5 -12
  70. package/lib/ReactInstanceHandles.js +5 -12
  71. package/lib/ReactLegacyElement.js +243 -0
  72. package/lib/ReactLink.js +5 -12
  73. package/lib/ReactMarkupChecksum.js +5 -12
  74. package/lib/ReactMount.js +45 -32
  75. package/lib/ReactMultiChild.js +14 -18
  76. package/lib/ReactMultiChildUpdateTypes.js +5 -12
  77. package/lib/ReactNativeComponent.js +69 -0
  78. package/lib/ReactOwner.js +5 -12
  79. package/lib/ReactPerf.js +8 -13
  80. package/lib/ReactPropTransferer.js +34 -33
  81. package/lib/ReactPropTypeLocationNames.js +5 -12
  82. package/lib/ReactPropTypeLocations.js +5 -12
  83. package/lib/ReactPropTypes.js +38 -29
  84. package/lib/ReactPutListenerQueue.js +7 -14
  85. package/lib/ReactReconcileTransaction.js +7 -15
  86. package/lib/ReactRootIndex.js +5 -12
  87. package/lib/ReactServerRendering.js +21 -34
  88. package/lib/ReactServerRenderingTransaction.js +11 -15
  89. package/lib/ReactStateSetters.js +5 -12
  90. package/lib/ReactTestUtils.js +31 -33
  91. package/lib/ReactTextComponent.js +18 -21
  92. package/lib/ReactTransitionChildMapping.js +6 -13
  93. package/lib/ReactTransitionEvents.js +5 -12
  94. package/lib/ReactTransitionGroup.js +14 -17
  95. package/lib/ReactUpdates.js +43 -22
  96. package/lib/ReactWithAddons.js +7 -13
  97. package/lib/SVGDOMPropertyConfig.js +5 -12
  98. package/lib/SelectEventPlugin.js +13 -20
  99. package/lib/ServerReactRootIndex.js +5 -12
  100. package/lib/SimpleEventPlugin.js +20 -15
  101. package/lib/SyntheticClipboardEvent.js +5 -12
  102. package/lib/SyntheticCompositionEvent.js +5 -12
  103. package/lib/SyntheticDragEvent.js +5 -12
  104. package/lib/SyntheticEvent.js +9 -17
  105. package/lib/SyntheticFocusEvent.js +5 -12
  106. package/lib/SyntheticInputEvent.js +4 -11
  107. package/lib/SyntheticKeyboardEvent.js +17 -19
  108. package/lib/SyntheticMouseEvent.js +5 -12
  109. package/lib/SyntheticTouchEvent.js +5 -12
  110. package/lib/SyntheticUIEvent.js +5 -12
  111. package/lib/SyntheticWheelEvent.js +5 -12
  112. package/lib/Transaction.js +5 -12
  113. package/lib/ViewportMetrics.js +5 -12
  114. package/lib/accumulateInto.js +62 -0
  115. package/lib/adler32.js +6 -13
  116. package/lib/camelize.js +30 -0
  117. package/lib/camelizeStyleName.js +40 -0
  118. package/lib/cloneWithProps.js +9 -15
  119. package/lib/containsNode.js +5 -12
  120. package/lib/copyProperties.js +12 -12
  121. package/lib/createArrayFrom.js +5 -12
  122. package/lib/createFullPageComponent.js +12 -18
  123. package/lib/createNodesFromMarkup.js +5 -12
  124. package/lib/cx.js +5 -12
  125. package/lib/dangerousStyleValue.js +5 -12
  126. package/lib/deprecated.js +47 -0
  127. package/lib/emptyFunction.js +11 -22
  128. package/lib/emptyObject.js +5 -12
  129. package/lib/escapeTextForBrowser.js +5 -12
  130. package/lib/flattenChildren.js +19 -13
  131. package/lib/focusNode.js +10 -16
  132. package/lib/forEachAccumulated.js +5 -12
  133. package/lib/getActiveElement.js +5 -12
  134. package/lib/getEventCharCode.js +50 -0
  135. package/lib/getEventKey.js +9 -21
  136. package/lib/getEventModifierState.js +4 -11
  137. package/lib/getEventTarget.js +5 -12
  138. package/lib/getMarkupWrap.js +5 -12
  139. package/lib/getNodeForCharacterOffset.js +5 -12
  140. package/lib/getReactRootElementInContainer.js +5 -12
  141. package/lib/getTextContentAccessor.js +5 -12
  142. package/lib/getUnboundedScrollPosition.js +5 -12
  143. package/lib/hyphenate.js +5 -12
  144. package/lib/hyphenateStyleName.js +8 -15
  145. package/lib/instantiateReactComponent.js +90 -42
  146. package/lib/invariant.js +5 -12
  147. package/lib/isEventSupported.js +5 -12
  148. package/lib/isNode.js +5 -12
  149. package/lib/isTextInputElement.js +5 -12
  150. package/lib/isTextNode.js +5 -12
  151. package/lib/joinClasses.js +8 -13
  152. package/lib/keyMirror.js +5 -12
  153. package/lib/keyOf.js +5 -12
  154. package/lib/mapObject.js +35 -36
  155. package/lib/memoizeStringOnly.js +5 -12
  156. package/lib/merge.js +14 -17
  157. package/lib/mergeInto.js +13 -35
  158. package/lib/monitorCodeUse.js +5 -12
  159. package/lib/onlyChild.js +8 -15
  160. package/lib/performance.js +5 -12
  161. package/lib/performanceNow.js +5 -12
  162. package/lib/setInnerHTML.js +10 -19
  163. package/lib/shallowEqual.js +6 -13
  164. package/lib/shouldUpdateReactComponent.js +14 -22
  165. package/lib/toArray.js +5 -12
  166. package/lib/traverseAllChildren.js +34 -48
  167. package/lib/update.js +8 -15
  168. package/lib/warning.js +6 -13
  169. package/package.json +3 -8
  170. package/lib/ReactDescriptor.js +0 -251
  171. package/lib/accumulate.js +0 -54
  172. package/lib/mergeHelpers.js +0 -147
  173. package/lib/mixInto.js +0 -34
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
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.
15
8
  *
16
9
  * @providesModule ReactTestUtils
17
10
  */
@@ -22,16 +15,14 @@ var EventConstants = require("./EventConstants");
22
15
  var EventPluginHub = require("./EventPluginHub");
23
16
  var EventPropagators = require("./EventPropagators");
24
17
  var React = require("./React");
25
- var ReactDescriptor = require("./ReactDescriptor");
26
- var ReactDOM = require("./ReactDOM");
18
+ var ReactElement = require("./ReactElement");
27
19
  var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
28
20
  var ReactMount = require("./ReactMount");
29
21
  var ReactTextComponent = require("./ReactTextComponent");
30
22
  var ReactUpdates = require("./ReactUpdates");
31
23
  var SyntheticEvent = require("./SyntheticEvent");
32
24
 
33
- var mergeInto = require("./mergeInto");
34
- var copyProperties = require("./copyProperties");
25
+ var assign = require("./Object.assign");
35
26
 
36
27
  var topLevelTypes = EventConstants.topLevelTypes;
37
28
 
@@ -54,16 +45,16 @@ var ReactTestUtils = {
54
45
  // clean up, so we're going to stop honoring the name of this method
55
46
  // (and probably rename it eventually) if no problems arise.
56
47
  // document.documentElement.appendChild(div);
57
- return React.renderComponent(instance, div);
48
+ return React.render(instance, div);
58
49
  },
59
50
 
60
- isDescriptor: function(descriptor) {
61
- return ReactDescriptor.isValidDescriptor(descriptor);
51
+ isElement: function(element) {
52
+ return ReactElement.isValidElement(element);
62
53
  },
63
54
 
64
- isDescriptorOfType: function(inst, convenienceConstructor) {
55
+ isElementOfType: function(inst, convenienceConstructor) {
65
56
  return (
66
- ReactDescriptor.isValidDescriptor(inst) &&
57
+ ReactElement.isValidElement(inst) &&
67
58
  inst.type === convenienceConstructor.type
68
59
  );
69
60
  },
@@ -72,9 +63,9 @@ var ReactTestUtils = {
72
63
  return !!(inst && inst.mountComponent && inst.tagName);
73
64
  },
74
65
 
75
- isDOMComponentDescriptor: function(inst) {
66
+ isDOMComponentElement: function(inst) {
76
67
  return !!(inst &&
77
- ReactDescriptor.isValidDescriptor(inst) &&
68
+ ReactElement.isValidElement(inst) &&
78
69
  !!inst.tagName);
79
70
  },
80
71
 
@@ -88,8 +79,8 @@ var ReactTestUtils = {
88
79
  (inst.constructor === type.type));
89
80
  },
90
81
 
91
- isCompositeComponentDescriptor: function(inst) {
92
- if (!ReactDescriptor.isValidDescriptor(inst)) {
82
+ isCompositeComponentElement: function(inst) {
83
+ if (!ReactElement.isValidElement(inst)) {
93
84
  return false;
94
85
  }
95
86
  // We check the prototype of the type that will get mounted, not the
@@ -101,8 +92,8 @@ var ReactTestUtils = {
101
92
  );
102
93
  },
103
94
 
104
- isCompositeComponentDescriptorWithType: function(inst, type) {
105
- return !!(ReactTestUtils.isCompositeComponentDescriptor(inst) &&
95
+ isCompositeComponentElementWithType: function(inst, type) {
96
+ return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
106
97
  (inst.constructor === type));
107
98
  },
108
99
 
@@ -238,16 +229,23 @@ var ReactTestUtils = {
238
229
  * @return {object} the ReactTestUtils object (for chaining)
239
230
  */
240
231
  mockComponent: function(module, mockTagName) {
241
- var ConvenienceConstructor = React.createClass({
232
+ mockTagName = mockTagName || module.mockTagName || "div";
233
+
234
+ var ConvenienceConstructor = React.createClass({displayName: "ConvenienceConstructor",
242
235
  render: function() {
243
- var mockTagName = mockTagName || module.mockTagName || "div";
244
- return ReactDOM[mockTagName](null, this.props.children);
236
+ return React.createElement(
237
+ mockTagName,
238
+ null,
239
+ this.props.children
240
+ );
245
241
  }
246
242
  });
247
243
 
248
- copyProperties(module, ConvenienceConstructor);
249
244
  module.mockImplementation(ConvenienceConstructor);
250
245
 
246
+ module.type = ConvenienceConstructor.type;
247
+ module.isReactLegacyFactory = true;
248
+
251
249
  return this;
252
250
  },
253
251
 
@@ -322,7 +320,7 @@ function makeSimulator(eventType) {
322
320
  ReactMount.getID(node),
323
321
  fakeNativeEvent
324
322
  );
325
- mergeInto(event, eventData);
323
+ assign(event, eventData);
326
324
  EventPropagators.accumulateTwoPhaseDispatches(event);
327
325
 
328
326
  ReactUpdates.batchedUpdates(function() {
@@ -378,7 +376,7 @@ buildSimulators();
378
376
  function makeNativeSimulator(eventType) {
379
377
  return function(domComponentOrNode, nativeEventData) {
380
378
  var fakeNativeEvent = new Event(eventType);
381
- mergeInto(fakeNativeEvent, nativeEventData);
379
+ assign(fakeNativeEvent, nativeEventData);
382
380
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
383
381
  ReactTestUtils.simulateNativeEventOnDOMComponent(
384
382
  eventType,
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
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.
15
8
  *
16
9
  * @providesModule ReactTextComponent
17
10
  * @typechecks static-only
@@ -20,12 +13,11 @@
20
13
  "use strict";
21
14
 
22
15
  var DOMPropertyOperations = require("./DOMPropertyOperations");
23
- var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
24
16
  var ReactComponent = require("./ReactComponent");
25
- var ReactDescriptor = require("./ReactDescriptor");
17
+ var ReactElement = require("./ReactElement");
26
18
 
19
+ var assign = require("./Object.assign");
27
20
  var escapeTextForBrowser = require("./escapeTextForBrowser");
28
- var mixInto = require("./mixInto");
29
21
 
30
22
  /**
31
23
  * Text nodes violate a couple assumptions that React makes about components:
@@ -42,13 +34,11 @@ var mixInto = require("./mixInto");
42
34
  * @extends ReactComponent
43
35
  * @internal
44
36
  */
45
- var ReactTextComponent = function(descriptor) {
46
- this.construct(descriptor);
37
+ var ReactTextComponent = function(props) {
38
+ // This constructor and it's argument is currently used by mocks.
47
39
  };
48
40
 
49
- mixInto(ReactTextComponent, ReactComponent.Mixin);
50
- mixInto(ReactTextComponent, ReactBrowserComponentMixin);
51
- mixInto(ReactTextComponent, {
41
+ assign(ReactTextComponent.prototype, ReactComponent.Mixin, {
52
42
 
53
43
  /**
54
44
  * Creates the markup for this text node. This node is not intended to have
@@ -104,4 +94,11 @@ mixInto(ReactTextComponent, {
104
94
 
105
95
  });
106
96
 
107
- module.exports = ReactDescriptor.createFactory(ReactTextComponent);
97
+ var ReactTextComponentFactory = function(text) {
98
+ // Bypass validation and configuration
99
+ return new ReactElement(ReactTextComponent, null, null, null, null, text);
100
+ };
101
+
102
+ ReactTextComponentFactory.type = ReactTextComponent;
103
+
104
+ module.exports = ReactTextComponentFactory;
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
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.
15
8
  *
16
9
  * @typechecks static-only
17
10
  * @providesModule ReactTransitionChildMapping
@@ -37,7 +30,7 @@ var ReactTransitionChildMapping = {
37
30
 
38
31
  /**
39
32
  * When you're adding or removing children some may be added or removed in the
40
- * same render pass. We want ot show *both* since we want to simultaneously
33
+ * same render pass. We want to show *both* since we want to simultaneously
41
34
  * animate elements in and out. This function takes a previous set of keys
42
35
  * and a new set of keys and merges them with its best guess of the correct
43
36
  * ordering. In the future we may expose some of the utilities in
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
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.
15
8
  *
16
9
  * @providesModule ReactTransitionEvents
17
10
  */
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
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.
15
8
  *
16
9
  * @providesModule ReactTransitionGroup
17
10
  */
@@ -21,21 +14,21 @@
21
14
  var React = require("./React");
22
15
  var ReactTransitionChildMapping = require("./ReactTransitionChildMapping");
23
16
 
17
+ var assign = require("./Object.assign");
24
18
  var cloneWithProps = require("./cloneWithProps");
25
19
  var emptyFunction = require("./emptyFunction");
26
- var merge = require("./merge");
27
20
 
28
21
  var ReactTransitionGroup = React.createClass({
29
22
  displayName: 'ReactTransitionGroup',
30
23
 
31
24
  propTypes: {
32
- component: React.PropTypes.func,
25
+ component: React.PropTypes.any,
33
26
  childFactory: React.PropTypes.func
34
27
  },
35
28
 
36
29
  getDefaultProps: function() {
37
30
  return {
38
- component: React.DOM.span,
31
+ component: 'span',
39
32
  childFactory: emptyFunction.thatReturnsArgument
40
33
  };
41
34
  },
@@ -159,7 +152,7 @@ var ReactTransitionGroup = React.createClass({
159
152
  // This entered again before it fully left. Add it again.
160
153
  this.performEnter(key);
161
154
  } else {
162
- var newChildren = merge(this.state.children);
155
+ var newChildren = assign({}, this.state.children);
163
156
  delete newChildren[key];
164
157
  this.setState({children: newChildren});
165
158
  }
@@ -183,7 +176,11 @@ var ReactTransitionGroup = React.createClass({
183
176
  );
184
177
  }
185
178
  }
186
- return this.transferPropsTo(this.props.component(null, childrenToRender));
179
+ return React.createElement(
180
+ this.props.component,
181
+ this.props,
182
+ childrenToRender
183
+ );
187
184
  }
188
185
  });
189
186
 
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
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.
15
8
  *
16
9
  * @providesModule ReactUpdates
17
10
  */
@@ -24,11 +17,13 @@ var ReactCurrentOwner = require("./ReactCurrentOwner");
24
17
  var ReactPerf = require("./ReactPerf");
25
18
  var Transaction = require("./Transaction");
26
19
 
20
+ var assign = require("./Object.assign");
27
21
  var invariant = require("./invariant");
28
- var mixInto = require("./mixInto");
29
22
  var warning = require("./warning");
30
23
 
31
24
  var dirtyComponents = [];
25
+ var asapCallbackQueue = CallbackQueue.getPooled();
26
+ var asapEnqueued = false;
32
27
 
33
28
  var batchingStrategy = null;
34
29
 
@@ -73,13 +68,14 @@ var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
73
68
  function ReactUpdatesFlushTransaction() {
74
69
  this.reinitializeTransaction();
75
70
  this.dirtyComponentsLength = null;
76
- this.callbackQueue = CallbackQueue.getPooled(null);
71
+ this.callbackQueue = CallbackQueue.getPooled();
77
72
  this.reconcileTransaction =
78
73
  ReactUpdates.ReactReconcileTransaction.getPooled();
79
74
  }
80
75
 
81
- mixInto(ReactUpdatesFlushTransaction, Transaction.Mixin);
82
- mixInto(ReactUpdatesFlushTransaction, {
76
+ assign(
77
+ ReactUpdatesFlushTransaction.prototype,
78
+ Transaction.Mixin, {
83
79
  getTransactionWrappers: function() {
84
80
  return TRANSACTION_WRAPPERS;
85
81
  },
@@ -170,11 +166,21 @@ var flushBatchedUpdates = ReactPerf.measure(
170
166
  // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
171
167
  // array and perform any updates enqueued by mount-ready handlers (i.e.,
172
168
  // componentDidUpdate) but we need to check here too in order to catch
173
- // updates enqueued by setState callbacks.
174
- while (dirtyComponents.length) {
175
- var transaction = ReactUpdatesFlushTransaction.getPooled();
176
- transaction.perform(runBatchedUpdates, null, transaction);
177
- ReactUpdatesFlushTransaction.release(transaction);
169
+ // updates enqueued by setState callbacks and asap calls.
170
+ while (dirtyComponents.length || asapEnqueued) {
171
+ if (dirtyComponents.length) {
172
+ var transaction = ReactUpdatesFlushTransaction.getPooled();
173
+ transaction.perform(runBatchedUpdates, null, transaction);
174
+ ReactUpdatesFlushTransaction.release(transaction);
175
+ }
176
+
177
+ if (asapEnqueued) {
178
+ asapEnqueued = false;
179
+ var queue = asapCallbackQueue;
180
+ asapCallbackQueue = CallbackQueue.getPooled();
181
+ queue.notifyAll();
182
+ CallbackQueue.release(queue);
183
+ }
178
184
  }
179
185
  }
180
186
  );
@@ -221,6 +227,20 @@ function enqueueUpdate(component, callback) {
221
227
  }
222
228
  }
223
229
 
230
+ /**
231
+ * Enqueue a callback to be run at the end of the current batching cycle. Throws
232
+ * if no updates are currently being performed.
233
+ */
234
+ function asap(callback, context) {
235
+ ("production" !== process.env.NODE_ENV ? invariant(
236
+ batchingStrategy.isBatchingUpdates,
237
+ 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
238
+ 'updates are not being batched.'
239
+ ) : invariant(batchingStrategy.isBatchingUpdates));
240
+ asapCallbackQueue.enqueue(callback, context);
241
+ asapEnqueued = true;
242
+ }
243
+
224
244
  var ReactUpdatesInjection = {
225
245
  injectReconcileTransaction: function(ReconcileTransaction) {
226
246
  ("production" !== process.env.NODE_ENV ? invariant(
@@ -259,7 +279,8 @@ var ReactUpdates = {
259
279
  batchedUpdates: batchedUpdates,
260
280
  enqueueUpdate: enqueueUpdate,
261
281
  flushBatchedUpdates: flushBatchedUpdates,
262
- injection: ReactUpdatesInjection
282
+ injection: ReactUpdatesInjection,
283
+ asap: asap
263
284
  };
264
285
 
265
286
  module.exports = ReactUpdates;
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
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.
15
8
  *
16
9
  * @providesModule ReactWithAddons
17
10
  */
@@ -31,6 +24,7 @@ var ReactComponentWithPureRenderMixin =
31
24
  require("./ReactComponentWithPureRenderMixin");
32
25
  var ReactCSSTransitionGroup = require("./ReactCSSTransitionGroup");
33
26
  var ReactTransitionGroup = require("./ReactTransitionGroup");
27
+ var ReactUpdates = require("./ReactUpdates");
34
28
 
35
29
  var cx = require("./cx");
36
30
  var cloneWithProps = require("./cloneWithProps");
@@ -42,6 +36,7 @@ React.addons = {
42
36
  PureRenderMixin: ReactComponentWithPureRenderMixin,
43
37
  TransitionGroup: ReactTransitionGroup,
44
38
 
39
+ batchedUpdates: ReactUpdates.batchedUpdates,
45
40
  classSet: cx,
46
41
  cloneWithProps: cloneWithProps,
47
42
  update: update
@@ -53,4 +48,3 @@ if ("production" !== process.env.NODE_ENV) {
53
48
  }
54
49
 
55
50
  module.exports = React;
56
-