react 0.13.2 → 0.14.0-alpha3
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/README.md +1 -1
- package/addons.js +7 -0
- package/addons/CSSTransitionGroup.js +1 -0
- package/addons/LinkedStateMixin.js +1 -0
- package/addons/Perf.js +1 -0
- package/addons/PureRenderMixin.js +1 -0
- package/addons/TestUtils.js +1 -0
- package/addons/TransitionGroup.js +1 -0
- package/addons/batchedUpdates.js +1 -0
- package/addons/cloneWithProps.js +1 -0
- package/addons/createFragment.js +1 -0
- package/addons/renderSubtreeIntoContainer.js +1 -0
- package/addons/shallowCompare.js +1 -0
- package/addons/update.js +1 -0
- package/dist/JSXTransformer.js +3355 -1685
- package/dist/react-with-addons.js +3320 -5133
- package/dist/react-with-addons.min.js +6 -7
- package/dist/react.js +2962 -4548
- package/dist/react.min.js +5 -5
- package/lib/AutoFocusMixin.js +4 -3
- package/lib/BeforeInputEventPlugin.js +30 -118
- package/lib/CSSCore.js +12 -23
- package/lib/CSSProperty.js +4 -3
- package/lib/CSSPropertyOperations.js +14 -30
- package/lib/CallbackQueue.js +7 -10
- package/lib/ChangeEventPlugin.js +24 -88
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +13 -33
- package/lib/DOMProperty.js +41 -67
- package/lib/DOMPropertyOperations.js +30 -51
- package/lib/Danger.js +19 -62
- package/lib/DefaultEventPluginOrder.js +2 -12
- package/lib/EnterLeaveEventPlugin.js +11 -33
- package/lib/EventConstants.js +2 -2
- package/lib/EventListener.js +11 -13
- package/lib/EventPluginHub.js +44 -47
- package/lib/EventPluginRegistry.js +18 -74
- package/lib/EventPluginUtils.js +27 -38
- package/lib/EventPropagators.js +23 -26
- package/lib/ExecutionEnvironment.js +4 -8
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +7 -19
- package/lib/LinkedStateMixin.js +3 -6
- package/lib/LinkedValueUtils.js +34 -64
- package/lib/LocalEventTrapMixin.js +9 -16
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +8 -11
- package/lib/React.js +9 -129
- package/lib/ReactBrowserComponentMixin.js +9 -2
- package/lib/ReactBrowserEventEmitter.js +26 -82
- package/lib/ReactCSSTransitionGroup.js +13 -24
- package/lib/ReactCSSTransitionGroupChild.js +18 -28
- package/lib/ReactChildReconciler.js +11 -19
- package/lib/ReactChildren.js +21 -28
- package/lib/ReactClass.js +81 -234
- package/lib/ReactComponent.js +17 -33
- package/lib/ReactComponentBrowserEnvironment.js +4 -8
- package/lib/ReactComponentEnvironment.js +6 -12
- package/lib/ReactComponentWithPureRenderMixin.js +4 -5
- package/lib/ReactCompositeComponent.js +87 -311
- package/lib/ReactContext.js +2 -44
- package/lib/ReactCurrentOwner.js +1 -3
- package/lib/ReactDOM.js +4 -2
- package/lib/ReactDOMButton.js +3 -4
- package/lib/ReactDOMClient.js +85 -0
- package/lib/ReactDOMComponent.js +182 -146
- package/lib/ReactDOMForm.js +3 -3
- package/lib/ReactDOMIDOperations.js +11 -22
- package/lib/ReactDOMIframe.js +3 -3
- package/lib/ReactDOMImg.js +3 -3
- package/lib/ReactDOMInput.js +22 -35
- package/lib/ReactDOMOption.js +67 -10
- package/lib/ReactDOMSelect.js +50 -28
- package/lib/ReactDOMSelection.js +5 -20
- package/lib/ReactDOMServer.js +24 -0
- package/lib/ReactDOMTextComponent.js +17 -18
- package/lib/ReactDOMTextarea.js +15 -27
- package/lib/ReactDefaultBatchingStrategy.js +9 -13
- package/lib/ReactDefaultInjection.js +31 -40
- package/lib/ReactDefaultPerf.js +36 -69
- package/lib/ReactDefaultPerfAnalysis.js +8 -14
- package/lib/ReactElement.js +24 -57
- package/lib/ReactElementValidator.js +38 -105
- package/lib/ReactEmptyComponent.js +7 -11
- package/lib/ReactErrorUtils.js +2 -2
- package/lib/ReactEventEmitterMixin.js +3 -12
- package/lib/ReactEventListener.js +16 -38
- package/lib/ReactFragment.js +23 -54
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +11 -21
- package/lib/ReactInstanceHandles.js +27 -57
- package/lib/ReactInstanceMap.js +5 -5
- package/lib/ReactIsomorphic.js +70 -0
- package/lib/ReactLifeCycle.js +1 -1
- package/lib/ReactLink.js +2 -4
- package/lib/ReactMarkupChecksum.js +5 -10
- package/lib/ReactMount.js +137 -260
- package/lib/ReactMultiChild.js +19 -45
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +7 -11
- package/lib/ReactOwner.js +7 -24
- package/lib/ReactPerf.js +8 -12
- package/lib/ReactPropTransferer.js +4 -4
- package/lib/ReactPropTypeLocationNames.js +2 -2
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +41 -61
- package/lib/ReactReconcileTransaction.js +9 -34
- package/lib/ReactReconciler.js +9 -19
- package/lib/ReactRef.js +5 -8
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerRendering.js +7 -15
- package/lib/ReactServerRenderingTransaction.js +7 -32
- package/lib/ReactStateSetters.js +6 -6
- package/lib/ReactTestUtils.js +93 -165
- package/lib/ReactTransitionChildMapping.js +5 -7
- package/lib/ReactTransitionEvents.js +5 -5
- package/lib/ReactTransitionGroup.js +30 -52
- package/lib/ReactUpdateQueue.js +27 -90
- package/lib/ReactUpdates.js +27 -79
- package/lib/ReactWithAddons.js +7 -6
- package/lib/SVGDOMPropertyConfig.js +41 -4
- package/lib/SelectEventPlugin.js +28 -29
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +136 -128
- package/lib/SyntheticClipboardEvent.js +3 -7
- package/lib/SyntheticCompositionEvent.js +3 -9
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +8 -10
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +3 -9
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +8 -14
- package/lib/SyntheticTouchEvent.js +1 -1
- package/lib/SyntheticUIEvent.js +3 -3
- package/lib/SyntheticWheelEvent.js +11 -15
- package/lib/Transaction.js +12 -24
- package/lib/ViewportMetrics.js +2 -2
- package/lib/accumulateInto.js +2 -5
- package/lib/adler32.js +2 -4
- package/lib/camelize.js +4 -2
- package/lib/camelizeStyleName.js +2 -2
- package/lib/cloneWithProps.js +5 -11
- package/lib/containsNode.js +29 -16
- package/lib/createArrayFromMixed.js +17 -16
- package/lib/createFullPageComponent.js +4 -11
- package/lib/createNodesFromMarkup.js +6 -8
- package/lib/dangerousStyleValue.js +2 -3
- package/lib/emptyFunction.js +10 -4
- package/lib/emptyObject.js +1 -1
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +5 -24
- package/lib/flattenChildren.js +4 -10
- package/lib/focusNode.js +2 -3
- package/lib/forEachAccumulated.js +2 -2
- package/lib/getActiveElement.js +4 -2
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -1
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.js +2 -4
- package/lib/getMarkupWrap.js +7 -5
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getTextContentAccessor.js +2 -4
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +3 -1
- package/lib/hyphenateStyleName.js +2 -2
- package/lib/instantiateReactComponent.js +14 -38
- package/lib/invariant.js +8 -12
- package/lib/isEventSupported.js +7 -10
- package/lib/isNode.js +4 -6
- package/lib/isTextInputElement.js +2 -4
- package/lib/isTextNode.js +3 -1
- package/lib/joinClasses.js +2 -2
- package/lib/keyMirror.js +3 -6
- package/lib/keyOf.js +4 -3
- package/lib/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +2 -2
- package/lib/onlyChild.js +2 -5
- package/lib/performance.js +2 -5
- package/lib/performanceNow.js +3 -1
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/renderSubtreeIntoContainer.js +16 -0
- package/lib/setInnerHTML.js +11 -8
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +24 -0
- package/lib/shallowEqual.js +17 -11
- package/lib/shouldUpdateReactComponent.js +3 -64
- package/lib/toArray.js +8 -19
- package/lib/traverseAllChildren.js +22 -89
- package/lib/update.js +25 -85
- package/lib/validateDOMNesting.js +363 -0
- package/lib/warning.js +17 -15
- package/package.json +3 -3
- package/lib/MobileSafariClickEventPlugin.js +0 -56
- package/lib/ReactPutListenerQueue.js +0 -54
- package/lib/cx.js +0 -52
- package/lib/getReactRootElementInContainer.js +0 -33
|
@@ -23,11 +23,11 @@ var ReactTransitionChildMapping = {
|
|
|
23
23
|
* @param {*} children `this.props.children`
|
|
24
24
|
* @return {object} Mapping of key to child
|
|
25
25
|
*/
|
|
26
|
-
getChildMapping: function(children) {
|
|
26
|
+
getChildMapping: function (children) {
|
|
27
27
|
if (!children) {
|
|
28
28
|
return children;
|
|
29
29
|
}
|
|
30
|
-
return ReactFragment.extract(ReactChildren.map(children, function(child) {
|
|
30
|
+
return ReactFragment.extract(ReactChildren.map(children, function (child) {
|
|
31
31
|
return child;
|
|
32
32
|
}));
|
|
33
33
|
},
|
|
@@ -49,7 +49,7 @@ var ReactTransitionChildMapping = {
|
|
|
49
49
|
* @return {object} a key set that contains all keys in `prev` and all keys
|
|
50
50
|
* in `next` in a reasonable order.
|
|
51
51
|
*/
|
|
52
|
-
mergeChildMappings: function(prev, next) {
|
|
52
|
+
mergeChildMappings: function (prev, next) {
|
|
53
53
|
prev = prev || {};
|
|
54
54
|
next = next || {};
|
|
55
55
|
|
|
@@ -83,9 +83,7 @@ var ReactTransitionChildMapping = {
|
|
|
83
83
|
if (nextKeysPending.hasOwnProperty(nextKey)) {
|
|
84
84
|
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
|
|
85
85
|
var pendingNextKey = nextKeysPending[nextKey][i];
|
|
86
|
-
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(
|
|
87
|
-
pendingNextKey
|
|
88
|
-
);
|
|
86
|
+
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
89
|
childMapping[nextKey] = getValueForKey(nextKey);
|
|
@@ -100,4 +98,4 @@ var ReactTransitionChildMapping = {
|
|
|
100
98
|
}
|
|
101
99
|
};
|
|
102
100
|
|
|
103
|
-
module.exports = ReactTransitionChildMapping;
|
|
101
|
+
module.exports = ReactTransitionChildMapping;
|
|
@@ -84,26 +84,26 @@ function removeEventListener(node, eventName, eventListener) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
var ReactTransitionEvents = {
|
|
87
|
-
addEndEventListener: function(node, eventListener) {
|
|
87
|
+
addEndEventListener: function (node, eventListener) {
|
|
88
88
|
if (endEvents.length === 0) {
|
|
89
89
|
// If CSS transitions are not supported, trigger an "end animation"
|
|
90
90
|
// event immediately.
|
|
91
91
|
window.setTimeout(eventListener, 0);
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
endEvents.forEach(function(endEvent) {
|
|
94
|
+
endEvents.forEach(function (endEvent) {
|
|
95
95
|
addEventListener(node, endEvent, eventListener);
|
|
96
96
|
});
|
|
97
97
|
},
|
|
98
98
|
|
|
99
|
-
removeEndEventListener: function(node, eventListener) {
|
|
99
|
+
removeEndEventListener: function (node, eventListener) {
|
|
100
100
|
if (endEvents.length === 0) {
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
-
endEvents.forEach(function(endEvent) {
|
|
103
|
+
endEvents.forEach(function (endEvent) {
|
|
104
104
|
removeEventListener(node, endEvent, eventListener);
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
module.exports = ReactTransitionEvents;
|
|
109
|
+
module.exports = ReactTransitionEvents;
|
|
@@ -26,26 +26,26 @@ var ReactTransitionGroup = React.createClass({
|
|
|
26
26
|
childFactory: React.PropTypes.func
|
|
27
27
|
},
|
|
28
28
|
|
|
29
|
-
getDefaultProps: function() {
|
|
29
|
+
getDefaultProps: function () {
|
|
30
30
|
return {
|
|
31
31
|
component: 'span',
|
|
32
32
|
childFactory: emptyFunction.thatReturnsArgument
|
|
33
33
|
};
|
|
34
34
|
},
|
|
35
35
|
|
|
36
|
-
getInitialState: function() {
|
|
36
|
+
getInitialState: function () {
|
|
37
37
|
return {
|
|
38
38
|
children: ReactTransitionChildMapping.getChildMapping(this.props.children)
|
|
39
39
|
};
|
|
40
40
|
},
|
|
41
41
|
|
|
42
|
-
componentWillMount: function() {
|
|
42
|
+
componentWillMount: function () {
|
|
43
43
|
this.currentlyTransitioningKeys = {};
|
|
44
44
|
this.keysToEnter = [];
|
|
45
45
|
this.keysToLeave = [];
|
|
46
46
|
},
|
|
47
47
|
|
|
48
|
-
componentDidMount: function() {
|
|
48
|
+
componentDidMount: function () {
|
|
49
49
|
var initialChildMapping = this.state.children;
|
|
50
50
|
for (var key in initialChildMapping) {
|
|
51
51
|
if (initialChildMapping[key]) {
|
|
@@ -54,33 +54,26 @@ var ReactTransitionGroup = React.createClass({
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
|
|
57
|
-
componentWillReceiveProps: function(nextProps) {
|
|
58
|
-
var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
|
|
59
|
-
nextProps.children
|
|
60
|
-
);
|
|
57
|
+
componentWillReceiveProps: function (nextProps) {
|
|
58
|
+
var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
|
|
61
59
|
var prevChildMapping = this.state.children;
|
|
62
60
|
|
|
63
61
|
this.setState({
|
|
64
|
-
children: ReactTransitionChildMapping.mergeChildMappings(
|
|
65
|
-
prevChildMapping,
|
|
66
|
-
nextChildMapping
|
|
67
|
-
)
|
|
62
|
+
children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping)
|
|
68
63
|
});
|
|
69
64
|
|
|
70
65
|
var key;
|
|
71
66
|
|
|
72
67
|
for (key in nextChildMapping) {
|
|
73
68
|
var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
|
|
74
|
-
if (nextChildMapping[key] && !hasPrev &&
|
|
75
|
-
!this.currentlyTransitioningKeys[key]) {
|
|
69
|
+
if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) {
|
|
76
70
|
this.keysToEnter.push(key);
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
73
|
|
|
80
74
|
for (key in prevChildMapping) {
|
|
81
75
|
var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
|
|
82
|
-
if (prevChildMapping[key] && !hasNext &&
|
|
83
|
-
!this.currentlyTransitioningKeys[key]) {
|
|
76
|
+
if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) {
|
|
84
77
|
this.keysToLeave.push(key);
|
|
85
78
|
}
|
|
86
79
|
}
|
|
@@ -88,7 +81,7 @@ var ReactTransitionGroup = React.createClass({
|
|
|
88
81
|
// If we want to someday check for reordering, we could do it here.
|
|
89
82
|
},
|
|
90
83
|
|
|
91
|
-
componentDidUpdate: function() {
|
|
84
|
+
componentDidUpdate: function () {
|
|
92
85
|
var keysToEnter = this.keysToEnter;
|
|
93
86
|
this.keysToEnter = [];
|
|
94
87
|
keysToEnter.forEach(this.performEnter);
|
|
@@ -98,21 +91,19 @@ var ReactTransitionGroup = React.createClass({
|
|
|
98
91
|
keysToLeave.forEach(this.performLeave);
|
|
99
92
|
},
|
|
100
93
|
|
|
101
|
-
performAppear: function(key) {
|
|
94
|
+
performAppear: function (key) {
|
|
102
95
|
this.currentlyTransitioningKeys[key] = true;
|
|
103
96
|
|
|
104
97
|
var component = this.refs[key];
|
|
105
98
|
|
|
106
99
|
if (component.componentWillAppear) {
|
|
107
|
-
component.componentWillAppear(
|
|
108
|
-
this._handleDoneAppearing.bind(this, key)
|
|
109
|
-
);
|
|
100
|
+
component.componentWillAppear(this._handleDoneAppearing.bind(this, key));
|
|
110
101
|
} else {
|
|
111
102
|
this._handleDoneAppearing(key);
|
|
112
103
|
}
|
|
113
104
|
},
|
|
114
105
|
|
|
115
|
-
_handleDoneAppearing: function(key) {
|
|
106
|
+
_handleDoneAppearing: function (key) {
|
|
116
107
|
var component = this.refs[key];
|
|
117
108
|
if (component.componentDidAppear) {
|
|
118
109
|
component.componentDidAppear();
|
|
@@ -120,9 +111,7 @@ var ReactTransitionGroup = React.createClass({
|
|
|
120
111
|
|
|
121
112
|
delete this.currentlyTransitioningKeys[key];
|
|
122
113
|
|
|
123
|
-
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
|
|
124
|
-
this.props.children
|
|
125
|
-
);
|
|
114
|
+
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
|
|
126
115
|
|
|
127
116
|
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
|
|
128
117
|
// This was removed before it had fully appeared. Remove it.
|
|
@@ -130,21 +119,19 @@ var ReactTransitionGroup = React.createClass({
|
|
|
130
119
|
}
|
|
131
120
|
},
|
|
132
121
|
|
|
133
|
-
performEnter: function(key) {
|
|
122
|
+
performEnter: function (key) {
|
|
134
123
|
this.currentlyTransitioningKeys[key] = true;
|
|
135
124
|
|
|
136
125
|
var component = this.refs[key];
|
|
137
126
|
|
|
138
127
|
if (component.componentWillEnter) {
|
|
139
|
-
component.componentWillEnter(
|
|
140
|
-
this._handleDoneEntering.bind(this, key)
|
|
141
|
-
);
|
|
128
|
+
component.componentWillEnter(this._handleDoneEntering.bind(this, key));
|
|
142
129
|
} else {
|
|
143
130
|
this._handleDoneEntering(key);
|
|
144
131
|
}
|
|
145
132
|
},
|
|
146
133
|
|
|
147
|
-
_handleDoneEntering: function(key) {
|
|
134
|
+
_handleDoneEntering: function (key) {
|
|
148
135
|
var component = this.refs[key];
|
|
149
136
|
if (component.componentDidEnter) {
|
|
150
137
|
component.componentDidEnter();
|
|
@@ -152,9 +139,7 @@ var ReactTransitionGroup = React.createClass({
|
|
|
152
139
|
|
|
153
140
|
delete this.currentlyTransitioningKeys[key];
|
|
154
141
|
|
|
155
|
-
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
|
|
156
|
-
this.props.children
|
|
157
|
-
);
|
|
142
|
+
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
|
|
158
143
|
|
|
159
144
|
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
|
|
160
145
|
// This was removed before it had fully entered. Remove it.
|
|
@@ -162,7 +147,7 @@ var ReactTransitionGroup = React.createClass({
|
|
|
162
147
|
}
|
|
163
148
|
},
|
|
164
149
|
|
|
165
|
-
performLeave: function(key) {
|
|
150
|
+
performLeave: function (key) {
|
|
166
151
|
this.currentlyTransitioningKeys[key] = true;
|
|
167
152
|
|
|
168
153
|
var component = this.refs[key];
|
|
@@ -176,7 +161,7 @@ var ReactTransitionGroup = React.createClass({
|
|
|
176
161
|
}
|
|
177
162
|
},
|
|
178
163
|
|
|
179
|
-
_handleDoneLeaving: function(key) {
|
|
164
|
+
_handleDoneLeaving: function (key) {
|
|
180
165
|
var component = this.refs[key];
|
|
181
166
|
|
|
182
167
|
if (component.componentDidLeave) {
|
|
@@ -185,21 +170,21 @@ var ReactTransitionGroup = React.createClass({
|
|
|
185
170
|
|
|
186
171
|
delete this.currentlyTransitioningKeys[key];
|
|
187
172
|
|
|
188
|
-
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
|
|
189
|
-
this.props.children
|
|
190
|
-
);
|
|
173
|
+
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
|
|
191
174
|
|
|
192
175
|
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
|
|
193
176
|
// This entered again before it fully left. Add it again.
|
|
194
177
|
this.performEnter(key);
|
|
195
178
|
} else {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
179
|
+
this.setState(function (state) {
|
|
180
|
+
var newChildren = assign({}, state.children);
|
|
181
|
+
delete newChildren[key];
|
|
182
|
+
return { children: newChildren };
|
|
183
|
+
});
|
|
199
184
|
}
|
|
200
185
|
},
|
|
201
186
|
|
|
202
|
-
render: function() {
|
|
187
|
+
render: function () {
|
|
203
188
|
// TODO: we could get rid of the need for the wrapper node
|
|
204
189
|
// by cloning a single child
|
|
205
190
|
var childrenToRender = [];
|
|
@@ -211,18 +196,11 @@ var ReactTransitionGroup = React.createClass({
|
|
|
211
196
|
// already been removed. In case you need this behavior you can provide
|
|
212
197
|
// a childFactory function to wrap every child, even the ones that are
|
|
213
198
|
// leaving.
|
|
214
|
-
childrenToRender.push(cloneWithProps(
|
|
215
|
-
this.props.childFactory(child),
|
|
216
|
-
{ref: key, key: key}
|
|
217
|
-
));
|
|
199
|
+
childrenToRender.push(cloneWithProps(this.props.childFactory(child), { ref: key, key: key }));
|
|
218
200
|
}
|
|
219
201
|
}
|
|
220
|
-
return React.createElement(
|
|
221
|
-
this.props.component,
|
|
222
|
-
this.props,
|
|
223
|
-
childrenToRender
|
|
224
|
-
);
|
|
202
|
+
return React.createElement(this.props.component, this.props, childrenToRender);
|
|
225
203
|
}
|
|
226
204
|
});
|
|
227
205
|
|
|
228
|
-
module.exports = ReactTransitionGroup;
|
|
206
|
+
module.exports = ReactTransitionGroup;
|
package/lib/ReactUpdateQueue.js
CHANGED
|
@@ -32,28 +32,15 @@ function enqueueUpdate(internalInstance) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
|
|
35
|
-
(
|
|
36
|
-
ReactCurrentOwner.current == null,
|
|
37
|
-
'%s(...): Cannot update during an existing state transition ' +
|
|
38
|
-
'(such as within `render`). Render methods should be a pure function ' +
|
|
39
|
-
'of props and state.',
|
|
40
|
-
callerName
|
|
41
|
-
) : invariant(ReactCurrentOwner.current == null));
|
|
35
|
+
!(ReactCurrentOwner.current == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : invariant(false) : undefined;
|
|
42
36
|
|
|
43
37
|
var internalInstance = ReactInstanceMap.get(publicInstance);
|
|
44
38
|
if (!internalInstance) {
|
|
45
|
-
if (
|
|
39
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
46
40
|
// Only warn when we have a callerName. Otherwise we should be silent.
|
|
47
41
|
// We're probably calling from enqueueCallback. We don't want to warn
|
|
48
42
|
// there because we already warned for the corresponding lifecycle method.
|
|
49
|
-
|
|
50
|
-
!callerName,
|
|
51
|
-
'%s(...): Can only update a mounted or mounting component. ' +
|
|
52
|
-
'This usually means you called %s() on an unmounted ' +
|
|
53
|
-
'component. This is a no-op.',
|
|
54
|
-
callerName,
|
|
55
|
-
callerName
|
|
56
|
-
) : null);
|
|
43
|
+
'production' !== process.env.NODE_ENV ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted ' + 'component. This is a no-op.', callerName, callerName) : undefined;
|
|
57
44
|
}
|
|
58
45
|
return null;
|
|
59
46
|
}
|
|
@@ -79,13 +66,8 @@ var ReactUpdateQueue = {
|
|
|
79
66
|
* @param {?function} callback Called after state is updated.
|
|
80
67
|
* @internal
|
|
81
68
|
*/
|
|
82
|
-
enqueueCallback: function(publicInstance, callback) {
|
|
83
|
-
(
|
|
84
|
-
typeof callback === 'function',
|
|
85
|
-
'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
|
|
86
|
-
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
|
|
87
|
-
'isn\'t callable.'
|
|
88
|
-
) : invariant(typeof callback === 'function'));
|
|
69
|
+
enqueueCallback: function (publicInstance, callback) {
|
|
70
|
+
!(typeof callback === 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
|
|
89
71
|
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
|
|
90
72
|
|
|
91
73
|
// Previously we would throw an error if we didn't have an internal
|
|
@@ -93,8 +75,7 @@ var ReactUpdateQueue = {
|
|
|
93
75
|
// behavior we have in other enqueue* methods.
|
|
94
76
|
// We also need to ignore callbacks in componentWillMount. See
|
|
95
77
|
// enqueueUpdates.
|
|
96
|
-
if (!internalInstance ||
|
|
97
|
-
internalInstance === ReactLifeCycle.currentlyMountingInstance) {
|
|
78
|
+
if (!internalInstance || internalInstance === ReactLifeCycle.currentlyMountingInstance) {
|
|
98
79
|
return null;
|
|
99
80
|
}
|
|
100
81
|
|
|
@@ -110,13 +91,8 @@ var ReactUpdateQueue = {
|
|
|
110
91
|
enqueueUpdate(internalInstance);
|
|
111
92
|
},
|
|
112
93
|
|
|
113
|
-
enqueueCallbackInternal: function(internalInstance, callback) {
|
|
114
|
-
(
|
|
115
|
-
typeof callback === 'function',
|
|
116
|
-
'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
|
|
117
|
-
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
|
|
118
|
-
'isn\'t callable.'
|
|
119
|
-
) : invariant(typeof callback === 'function'));
|
|
94
|
+
enqueueCallbackInternal: function (internalInstance, callback) {
|
|
95
|
+
!(typeof callback === 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
|
|
120
96
|
if (internalInstance._pendingCallbacks) {
|
|
121
97
|
internalInstance._pendingCallbacks.push(callback);
|
|
122
98
|
} else {
|
|
@@ -138,11 +114,8 @@ var ReactUpdateQueue = {
|
|
|
138
114
|
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
139
115
|
* @internal
|
|
140
116
|
*/
|
|
141
|
-
enqueueForceUpdate: function(publicInstance) {
|
|
142
|
-
var internalInstance = getInternalInstanceReadyForUpdate(
|
|
143
|
-
publicInstance,
|
|
144
|
-
'forceUpdate'
|
|
145
|
-
);
|
|
117
|
+
enqueueForceUpdate: function (publicInstance) {
|
|
118
|
+
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
|
|
146
119
|
|
|
147
120
|
if (!internalInstance) {
|
|
148
121
|
return;
|
|
@@ -164,11 +137,8 @@ var ReactUpdateQueue = {
|
|
|
164
137
|
* @param {object} completeState Next state.
|
|
165
138
|
* @internal
|
|
166
139
|
*/
|
|
167
|
-
enqueueReplaceState: function(publicInstance, completeState) {
|
|
168
|
-
var internalInstance = getInternalInstanceReadyForUpdate(
|
|
169
|
-
publicInstance,
|
|
170
|
-
'replaceState'
|
|
171
|
-
);
|
|
140
|
+
enqueueReplaceState: function (publicInstance, completeState) {
|
|
141
|
+
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
|
|
172
142
|
|
|
173
143
|
if (!internalInstance) {
|
|
174
144
|
return;
|
|
@@ -190,19 +160,14 @@ var ReactUpdateQueue = {
|
|
|
190
160
|
* @param {object} partialState Next partial state to be merged with state.
|
|
191
161
|
* @internal
|
|
192
162
|
*/
|
|
193
|
-
enqueueSetState: function(publicInstance, partialState) {
|
|
194
|
-
var internalInstance = getInternalInstanceReadyForUpdate(
|
|
195
|
-
publicInstance,
|
|
196
|
-
'setState'
|
|
197
|
-
);
|
|
163
|
+
enqueueSetState: function (publicInstance, partialState) {
|
|
164
|
+
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
|
|
198
165
|
|
|
199
166
|
if (!internalInstance) {
|
|
200
167
|
return;
|
|
201
168
|
}
|
|
202
169
|
|
|
203
|
-
var queue =
|
|
204
|
-
internalInstance._pendingStateQueue ||
|
|
205
|
-
(internalInstance._pendingStateQueue = []);
|
|
170
|
+
var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
|
|
206
171
|
queue.push(partialState);
|
|
207
172
|
|
|
208
173
|
enqueueUpdate(internalInstance);
|
|
@@ -215,34 +180,20 @@ var ReactUpdateQueue = {
|
|
|
215
180
|
* @param {object} partialProps Subset of the next props.
|
|
216
181
|
* @internal
|
|
217
182
|
*/
|
|
218
|
-
enqueueSetProps: function(publicInstance, partialProps) {
|
|
219
|
-
var internalInstance = getInternalInstanceReadyForUpdate(
|
|
220
|
-
publicInstance,
|
|
221
|
-
'setProps'
|
|
222
|
-
);
|
|
183
|
+
enqueueSetProps: function (publicInstance, partialProps) {
|
|
184
|
+
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
|
|
223
185
|
|
|
224
186
|
if (!internalInstance) {
|
|
225
187
|
return;
|
|
226
188
|
}
|
|
227
189
|
|
|
228
|
-
|
|
229
|
-
internalInstance._isTopLevel,
|
|
230
|
-
'setProps(...): You called `setProps` on a ' +
|
|
231
|
-
'component with a parent. This is an anti-pattern since props will ' +
|
|
232
|
-
'get reactively updated when rendered. Instead, change the owner\'s ' +
|
|
233
|
-
'`render` method to pass the correct value as props to the component ' +
|
|
234
|
-
'where it is created.'
|
|
235
|
-
) : invariant(internalInstance._isTopLevel));
|
|
190
|
+
!internalInstance._isTopLevel ? 'production' !== process.env.NODE_ENV ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
|
|
236
191
|
|
|
237
192
|
// Merge with the pending element if it exists, otherwise with existing
|
|
238
193
|
// element props.
|
|
239
|
-
var element = internalInstance._pendingElement ||
|
|
240
|
-
internalInstance._currentElement;
|
|
194
|
+
var element = internalInstance._pendingElement || internalInstance._currentElement;
|
|
241
195
|
var props = assign({}, element.props, partialProps);
|
|
242
|
-
internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
|
|
243
|
-
element,
|
|
244
|
-
props
|
|
245
|
-
);
|
|
196
|
+
internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(element, props);
|
|
246
197
|
|
|
247
198
|
enqueueUpdate(internalInstance);
|
|
248
199
|
},
|
|
@@ -254,42 +205,28 @@ var ReactUpdateQueue = {
|
|
|
254
205
|
* @param {object} props New props.
|
|
255
206
|
* @internal
|
|
256
207
|
*/
|
|
257
|
-
enqueueReplaceProps: function(publicInstance, props) {
|
|
258
|
-
var internalInstance = getInternalInstanceReadyForUpdate(
|
|
259
|
-
publicInstance,
|
|
260
|
-
'replaceProps'
|
|
261
|
-
);
|
|
208
|
+
enqueueReplaceProps: function (publicInstance, props) {
|
|
209
|
+
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
|
|
262
210
|
|
|
263
211
|
if (!internalInstance) {
|
|
264
212
|
return;
|
|
265
213
|
}
|
|
266
214
|
|
|
267
|
-
|
|
268
|
-
internalInstance._isTopLevel,
|
|
269
|
-
'replaceProps(...): You called `replaceProps` on a ' +
|
|
270
|
-
'component with a parent. This is an anti-pattern since props will ' +
|
|
271
|
-
'get reactively updated when rendered. Instead, change the owner\'s ' +
|
|
272
|
-
'`render` method to pass the correct value as props to the component ' +
|
|
273
|
-
'where it is created.'
|
|
274
|
-
) : invariant(internalInstance._isTopLevel));
|
|
215
|
+
!internalInstance._isTopLevel ? 'production' !== process.env.NODE_ENV ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
|
|
275
216
|
|
|
276
217
|
// Merge with the pending element if it exists, otherwise with existing
|
|
277
218
|
// element props.
|
|
278
|
-
var element = internalInstance._pendingElement ||
|
|
279
|
-
|
|
280
|
-
internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
|
|
281
|
-
element,
|
|
282
|
-
props
|
|
283
|
-
);
|
|
219
|
+
var element = internalInstance._pendingElement || internalInstance._currentElement;
|
|
220
|
+
internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(element, props);
|
|
284
221
|
|
|
285
222
|
enqueueUpdate(internalInstance);
|
|
286
223
|
},
|
|
287
224
|
|
|
288
|
-
enqueueElementInternal: function(internalInstance, newElement) {
|
|
225
|
+
enqueueElementInternal: function (internalInstance, newElement) {
|
|
289
226
|
internalInstance._pendingElement = newElement;
|
|
290
227
|
enqueueUpdate(internalInstance);
|
|
291
228
|
}
|
|
292
229
|
|
|
293
230
|
};
|
|
294
231
|
|
|
295
|
-
module.exports = ReactUpdateQueue;
|
|
232
|
+
module.exports = ReactUpdateQueue;
|