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.
- package/dist/JSXTransformer.js +2714 -7859
- package/dist/react-with-addons.js +3139 -3593
- package/dist/react-with-addons.min.js +11 -17
- package/dist/react.js +2940 -3308
- package/dist/react.min.js +11 -16
- package/lib/AutoFocusMixin.js +5 -12
- package/lib/BeforeInputEventPlugin.js +12 -14
- package/lib/CSSCore.js +6 -13
- package/lib/CSSProperty.js +10 -14
- package/lib/CSSPropertyOperations.js +46 -12
- package/lib/CallbackQueue.js +7 -14
- package/lib/ChangeEventPlugin.js +5 -12
- package/lib/ClientReactRootIndex.js +5 -12
- package/lib/CompositionEventPlugin.js +5 -12
- package/lib/DOMChildrenOperations.js +8 -15
- package/lib/DOMProperty.js +16 -19
- package/lib/DOMPropertyOperations.js +14 -14
- package/lib/Danger.js +12 -17
- package/lib/DefaultEventPluginOrder.js +5 -12
- package/lib/EnterLeaveEventPlugin.js +5 -12
- package/lib/EventConstants.js +5 -12
- package/lib/EventListener.js +14 -0
- package/lib/EventPluginHub.js +8 -26
- package/lib/EventPluginRegistry.js +5 -12
- package/lib/EventPluginUtils.js +5 -12
- package/lib/EventPropagators.js +12 -17
- package/lib/ExecutionEnvironment.js +5 -12
- package/lib/HTMLDOMPropertyConfig.js +16 -15
- package/lib/LinkedStateMixin.js +5 -12
- package/lib/LinkedValueUtils.js +5 -12
- package/lib/LocalEventTrapMixin.js +8 -14
- package/lib/MobileSafariClickEventPlugin.js +5 -12
- package/lib/Object.assign.js +45 -0
- package/lib/PooledClass.js +5 -12
- package/lib/React.js +87 -54
- package/lib/ReactBrowserComponentMixin.js +5 -12
- package/lib/ReactBrowserEventEmitter.js +7 -14
- package/lib/ReactCSSTransitionGroup.js +15 -17
- package/lib/ReactCSSTransitionGroupChild.js +9 -13
- package/lib/ReactChildren.js +5 -12
- package/lib/ReactComponent.js +61 -68
- package/lib/ReactComponentBrowserEnvironment.js +5 -12
- package/lib/ReactComponentWithPureRenderMixin.js +5 -12
- package/lib/ReactCompositeComponent.js +191 -180
- package/lib/ReactContext.js +8 -15
- package/lib/ReactCurrentOwner.js +5 -12
- package/lib/ReactDOM.js +145 -177
- package/lib/ReactDOMButton.js +8 -14
- package/lib/ReactDOMComponent.js +103 -38
- package/lib/ReactDOMForm.js +9 -15
- package/lib/ReactDOMIDOperations.js +5 -12
- package/lib/ReactDOMImg.js +8 -14
- package/lib/ReactDOMInput.js +30 -38
- package/lib/ReactDOMOption.js +8 -14
- package/lib/ReactDOMSelect.js +25 -24
- package/lib/ReactDOMSelection.js +11 -18
- package/lib/ReactDOMTextarea.js +19 -24
- package/lib/ReactDefaultBatchingStrategy.js +14 -18
- package/lib/ReactDefaultInjection.js +23 -26
- package/lib/ReactDefaultPerf.js +14 -17
- package/lib/ReactDefaultPerfAnalysis.js +18 -17
- package/lib/ReactElement.js +242 -0
- package/lib/{ReactDescriptorValidator.js → ReactElementValidator.js} +51 -56
- package/lib/ReactEmptyComponent.js +8 -13
- package/lib/ReactErrorUtils.js +5 -12
- package/lib/ReactEventEmitterMixin.js +5 -12
- package/lib/ReactEventListener.js +7 -14
- package/lib/ReactInjection.js +7 -14
- package/lib/ReactInputSelection.js +5 -12
- package/lib/ReactInstanceHandles.js +5 -12
- package/lib/ReactLegacyElement.js +243 -0
- package/lib/ReactLink.js +5 -12
- package/lib/ReactMarkupChecksum.js +5 -12
- package/lib/ReactMount.js +45 -32
- package/lib/ReactMultiChild.js +14 -18
- package/lib/ReactMultiChildUpdateTypes.js +5 -12
- package/lib/ReactNativeComponent.js +69 -0
- package/lib/ReactOwner.js +5 -12
- package/lib/ReactPerf.js +8 -13
- package/lib/ReactPropTransferer.js +34 -33
- package/lib/ReactPropTypeLocationNames.js +5 -12
- package/lib/ReactPropTypeLocations.js +5 -12
- package/lib/ReactPropTypes.js +38 -29
- package/lib/ReactPutListenerQueue.js +7 -14
- package/lib/ReactReconcileTransaction.js +7 -15
- package/lib/ReactRootIndex.js +5 -12
- package/lib/ReactServerRendering.js +21 -34
- package/lib/ReactServerRenderingTransaction.js +11 -15
- package/lib/ReactStateSetters.js +5 -12
- package/lib/ReactTestUtils.js +31 -33
- package/lib/ReactTextComponent.js +18 -21
- package/lib/ReactTransitionChildMapping.js +6 -13
- package/lib/ReactTransitionEvents.js +5 -12
- package/lib/ReactTransitionGroup.js +14 -17
- package/lib/ReactUpdates.js +43 -22
- package/lib/ReactWithAddons.js +7 -13
- package/lib/SVGDOMPropertyConfig.js +5 -12
- package/lib/SelectEventPlugin.js +13 -20
- package/lib/ServerReactRootIndex.js +5 -12
- package/lib/SimpleEventPlugin.js +20 -15
- package/lib/SyntheticClipboardEvent.js +5 -12
- package/lib/SyntheticCompositionEvent.js +5 -12
- package/lib/SyntheticDragEvent.js +5 -12
- package/lib/SyntheticEvent.js +9 -17
- package/lib/SyntheticFocusEvent.js +5 -12
- package/lib/SyntheticInputEvent.js +4 -11
- package/lib/SyntheticKeyboardEvent.js +17 -19
- package/lib/SyntheticMouseEvent.js +5 -12
- package/lib/SyntheticTouchEvent.js +5 -12
- package/lib/SyntheticUIEvent.js +5 -12
- package/lib/SyntheticWheelEvent.js +5 -12
- package/lib/Transaction.js +5 -12
- package/lib/ViewportMetrics.js +5 -12
- package/lib/accumulateInto.js +62 -0
- package/lib/adler32.js +6 -13
- package/lib/camelize.js +30 -0
- package/lib/camelizeStyleName.js +40 -0
- package/lib/cloneWithProps.js +9 -15
- package/lib/containsNode.js +5 -12
- package/lib/copyProperties.js +12 -12
- package/lib/createArrayFrom.js +5 -12
- package/lib/createFullPageComponent.js +12 -18
- package/lib/createNodesFromMarkup.js +5 -12
- package/lib/cx.js +5 -12
- package/lib/dangerousStyleValue.js +5 -12
- package/lib/deprecated.js +47 -0
- package/lib/emptyFunction.js +11 -22
- package/lib/emptyObject.js +5 -12
- package/lib/escapeTextForBrowser.js +5 -12
- package/lib/flattenChildren.js +19 -13
- package/lib/focusNode.js +10 -16
- package/lib/forEachAccumulated.js +5 -12
- package/lib/getActiveElement.js +5 -12
- package/lib/getEventCharCode.js +50 -0
- package/lib/getEventKey.js +9 -21
- package/lib/getEventModifierState.js +4 -11
- package/lib/getEventTarget.js +5 -12
- package/lib/getMarkupWrap.js +5 -12
- package/lib/getNodeForCharacterOffset.js +5 -12
- package/lib/getReactRootElementInContainer.js +5 -12
- package/lib/getTextContentAccessor.js +5 -12
- package/lib/getUnboundedScrollPosition.js +5 -12
- package/lib/hyphenate.js +5 -12
- package/lib/hyphenateStyleName.js +8 -15
- package/lib/instantiateReactComponent.js +90 -42
- package/lib/invariant.js +5 -12
- package/lib/isEventSupported.js +5 -12
- package/lib/isNode.js +5 -12
- package/lib/isTextInputElement.js +5 -12
- package/lib/isTextNode.js +5 -12
- package/lib/joinClasses.js +8 -13
- package/lib/keyMirror.js +5 -12
- package/lib/keyOf.js +5 -12
- package/lib/mapObject.js +35 -36
- package/lib/memoizeStringOnly.js +5 -12
- package/lib/merge.js +14 -17
- package/lib/mergeInto.js +13 -35
- package/lib/monitorCodeUse.js +5 -12
- package/lib/onlyChild.js +8 -15
- package/lib/performance.js +5 -12
- package/lib/performanceNow.js +5 -12
- package/lib/setInnerHTML.js +10 -19
- package/lib/shallowEqual.js +6 -13
- package/lib/shouldUpdateReactComponent.js +14 -22
- package/lib/toArray.js +5 -12
- package/lib/traverseAllChildren.js +34 -48
- package/lib/update.js +8 -15
- package/lib/warning.js +6 -13
- package/package.json +3 -8
- package/lib/ReactDescriptor.js +0 -251
- package/lib/accumulate.js +0 -54
- package/lib/mergeHelpers.js +0 -147
- package/lib/mixInto.js +0 -34
package/lib/ReactTestUtils.js
CHANGED
|
@@ -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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
|
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
|
|
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.
|
|
48
|
+
return React.render(instance, div);
|
|
58
49
|
},
|
|
59
50
|
|
|
60
|
-
|
|
61
|
-
return
|
|
51
|
+
isElement: function(element) {
|
|
52
|
+
return ReactElement.isValidElement(element);
|
|
62
53
|
},
|
|
63
54
|
|
|
64
|
-
|
|
55
|
+
isElementOfType: function(inst, convenienceConstructor) {
|
|
65
56
|
return (
|
|
66
|
-
|
|
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
|
-
|
|
66
|
+
isDOMComponentElement: function(inst) {
|
|
76
67
|
return !!(inst &&
|
|
77
|
-
|
|
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
|
-
|
|
92
|
-
if (!
|
|
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
|
-
|
|
105
|
-
return !!(ReactTestUtils.
|
|
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
|
-
|
|
232
|
+
mockTagName = mockTagName || module.mockTagName || "div";
|
|
233
|
+
|
|
234
|
+
var ConvenienceConstructor = React.createClass({displayName: "ConvenienceConstructor",
|
|
242
235
|
render: function() {
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
|
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(
|
|
46
|
-
|
|
37
|
+
var ReactTextComponent = function(props) {
|
|
38
|
+
// This constructor and it's argument is currently used by mocks.
|
|
47
39
|
};
|
|
48
40
|
|
|
49
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
|
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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
25
|
+
component: React.PropTypes.any,
|
|
33
26
|
childFactory: React.PropTypes.func
|
|
34
27
|
},
|
|
35
28
|
|
|
36
29
|
getDefaultProps: function() {
|
|
37
30
|
return {
|
|
38
|
-
component:
|
|
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 =
|
|
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
|
|
179
|
+
return React.createElement(
|
|
180
|
+
this.props.component,
|
|
181
|
+
this.props,
|
|
182
|
+
childrenToRender
|
|
183
|
+
);
|
|
187
184
|
}
|
|
188
185
|
});
|
|
189
186
|
|
package/lib/ReactUpdates.js
CHANGED
|
@@ -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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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(
|
|
71
|
+
this.callbackQueue = CallbackQueue.getPooled();
|
|
77
72
|
this.reconcileTransaction =
|
|
78
73
|
ReactUpdates.ReactReconcileTransaction.getPooled();
|
|
79
74
|
}
|
|
80
75
|
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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;
|
package/lib/ReactWithAddons.js
CHANGED
|
@@ -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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
-
|