react 0.12.2 → 0.13.0-beta.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 +986 -511
- package/dist/react-with-addons.js +6076 -4560
- package/dist/react-with-addons.min.js +6 -7
- package/dist/react.js +5386 -4170
- package/dist/react.min.js +6 -7
- package/lib/AutoFocusMixin.js +2 -2
- package/lib/BeforeInputEventPlugin.js +388 -115
- package/lib/CSSCore.js +1 -1
- package/lib/CSSProperty.js +2 -2
- package/lib/CSSPropertyOperations.js +58 -11
- package/lib/CallbackQueue.js +3 -3
- package/lib/ChangeEventPlugin.js +4 -4
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +10 -47
- package/lib/DOMProperty.js +2 -2
- package/lib/DOMPropertyOperations.js +11 -16
- package/lib/Danger.js +8 -7
- package/lib/DefaultEventPluginOrder.js +3 -4
- package/lib/EnterLeaveEventPlugin.js +2 -2
- package/lib/EventConstants.js +2 -2
- package/lib/EventListener.js +1 -1
- package/lib/EventPluginHub.js +10 -8
- package/lib/EventPluginRegistry.js +2 -2
- package/lib/EventPluginUtils.js +4 -4
- package/lib/EventPropagators.js +2 -2
- package/lib/ExecutionEnvironment.js +3 -4
- package/lib/FallbackCompositionState.js +89 -0
- package/lib/HTMLDOMPropertyConfig.js +23 -10
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +4 -4
- package/lib/LocalEventTrapMixin.js +10 -3
- package/lib/MobileSafariClickEventPlugin.js +2 -2
- package/lib/Object.assign.js +4 -2
- package/lib/PooledClass.js +2 -2
- package/lib/React.js +19 -58
- package/lib/ReactBrowserComponentMixin.js +4 -14
- package/lib/ReactBrowserEventEmitter.js +6 -8
- package/lib/ReactCSSTransitionGroup.js +5 -2
- package/lib/ReactCSSTransitionGroupChild.js +20 -7
- package/lib/ReactChildReconciler.js +125 -0
- package/lib/ReactChildren.js +13 -10
- package/lib/ReactClass.js +918 -0
- package/lib/ReactComponent.js +98 -406
- package/lib/ReactComponentBrowserEnvironment.js +11 -84
- package/lib/ReactComponentEnvironment.js +57 -0
- package/lib/ReactComponentWithPureRenderMixin.js +2 -2
- package/lib/ReactCompositeComponent.js +574 -1140
- package/lib/ReactContext.js +17 -3
- package/lib/ReactCurrentOwner.js +2 -2
- package/lib/ReactDOM.js +4 -9
- package/lib/ReactDOMButton.js +6 -7
- package/lib/ReactDOMComponent.js +123 -105
- package/lib/ReactDOMForm.js +6 -7
- package/lib/ReactDOMIDOperations.js +59 -77
- package/lib/ReactDOMIframe.js +43 -0
- package/lib/ReactDOMImg.js +5 -7
- package/lib/ReactDOMInput.js +6 -7
- package/lib/ReactDOMOption.js +6 -7
- package/lib/ReactDOMSelect.js +58 -66
- package/lib/ReactDOMSelection.js +7 -3
- package/lib/{ReactTextComponent.js → ReactDOMTextComponent.js} +48 -37
- package/lib/ReactDOMTextarea.js +6 -7
- package/lib/ReactDefaultBatchingStrategy.js +5 -5
- package/lib/ReactDefaultInjection.js +39 -9
- package/lib/ReactDefaultPerf.js +17 -8
- package/lib/ReactDefaultPerfAnalysis.js +2 -2
- package/lib/ReactElement.js +23 -15
- package/lib/ReactElementValidator.js +206 -89
- package/lib/ReactEmptyComponent.js +33 -15
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +2 -2
- package/lib/ReactEventListener.js +4 -5
- package/lib/ReactFragment.js +172 -0
- package/lib/ReactInjection.js +8 -6
- package/lib/ReactInputSelection.js +4 -5
- package/lib/ReactInstanceHandles.js +4 -3
- package/lib/ReactInstanceMap.js +47 -0
- package/lib/ReactLifeCycle.js +35 -0
- package/lib/ReactLink.js +2 -2
- package/lib/ReactMarkupChecksum.js +2 -2
- package/lib/ReactMount.js +264 -71
- package/lib/ReactMultiChild.js +50 -48
- package/lib/ReactMultiChildUpdateTypes.js +2 -2
- package/lib/ReactNativeComponent.js +59 -25
- package/lib/ReactOwner.js +5 -49
- package/lib/ReactPerf.js +22 -2
- package/lib/ReactPropTransferer.js +3 -58
- package/lib/ReactPropTypeLocationNames.js +2 -2
- package/lib/ReactPropTypeLocations.js +2 -2
- package/lib/ReactPropTypes.js +17 -25
- package/lib/ReactPutListenerQueue.js +2 -2
- package/lib/ReactReconcileTransaction.js +2 -2
- package/lib/ReactReconciler.js +121 -0
- package/lib/ReactRef.js +69 -0
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerRendering.js +6 -4
- package/lib/ReactServerRenderingTransaction.js +2 -2
- package/lib/ReactStateSetters.js +2 -2
- package/lib/ReactTestUtils.js +113 -27
- package/lib/ReactTransitionChildMapping.js +8 -4
- package/lib/ReactTransitionEvents.js +2 -2
- package/lib/ReactTransitionGroup.js +53 -12
- package/lib/ReactUpdateQueue.js +295 -0
- package/lib/ReactUpdates.js +54 -62
- package/lib/ReactWithAddons.js +4 -2
- package/lib/SVGDOMPropertyConfig.js +2 -2
- package/lib/SelectEventPlugin.js +4 -4
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +4 -4
- package/lib/SyntheticClipboardEvent.js +2 -3
- package/lib/SyntheticCompositionEvent.js +2 -3
- package/lib/SyntheticDragEvent.js +2 -2
- package/lib/SyntheticEvent.js +12 -4
- package/lib/SyntheticFocusEvent.js +2 -2
- package/lib/SyntheticInputEvent.js +2 -3
- package/lib/SyntheticKeyboardEvent.js +2 -2
- package/lib/SyntheticMouseEvent.js +3 -5
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +2 -2
- package/lib/Transaction.js +4 -4
- package/lib/ViewportMetrics.js +3 -6
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +2 -2
- package/lib/camelize.js +1 -1
- package/lib/camelizeStyleName.js +1 -1
- package/lib/cloneWithProps.js +4 -4
- package/lib/containsNode.js +1 -1
- package/lib/{createArrayFrom.js → createArrayFromMixed.js} +6 -6
- package/lib/createFullPageComponent.js +4 -4
- package/lib/createNodesFromMarkup.js +4 -4
- package/lib/cx.js +1 -1
- package/lib/dangerousStyleValue.js +2 -2
- package/lib/emptyFunction.js +1 -1
- package/lib/emptyObject.js +1 -1
- package/lib/{escapeTextForBrowser.js → escapeTextContentForBrowser.js} +10 -11
- package/lib/findDOMNode.js +51 -0
- package/lib/flattenChildren.js +12 -23
- package/lib/focusNode.js +1 -1
- package/lib/forEachAccumulated.js +2 -2
- package/lib/getActiveElement.js +1 -1
- package/lib/getEventCharCode.js +2 -2
- package/lib/getEventKey.js +2 -2
- package/lib/getEventModifierState.js +2 -2
- package/lib/getEventTarget.js +2 -2
- package/lib/getIteratorFn.js +42 -0
- package/lib/getMarkupWrap.js +1 -1
- package/lib/getNodeForCharacterOffset.js +3 -3
- package/lib/getReactRootElementInContainer.js +2 -2
- package/lib/getTextContentAccessor.js +2 -2
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +1 -1
- package/lib/hyphenateStyleName.js +1 -1
- package/lib/instantiateReactComponent.js +90 -68
- package/lib/invariant.js +1 -1
- package/lib/isEventSupported.js +2 -2
- package/lib/isNode.js +4 -5
- package/lib/isTextInputElement.js +3 -4
- package/lib/isTextNode.js +1 -1
- package/lib/joinClasses.js +2 -2
- package/lib/keyMirror.js +2 -2
- package/lib/keyOf.js +1 -1
- package/lib/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +5 -6
- package/lib/onlyChild.js +2 -2
- package/lib/performance.js +1 -1
- package/lib/performanceNow.js +1 -1
- package/lib/quoteAttributeValueForBrowser.js +26 -0
- package/lib/setInnerHTML.js +13 -2
- package/lib/setTextContent.js +40 -0
- package/lib/shallowEqual.js +2 -2
- package/lib/shouldUpdateReactComponent.js +71 -7
- package/lib/toArray.js +2 -2
- package/lib/traverseAllChildren.js +114 -56
- package/lib/update.js +2 -2
- package/lib/warning.js +20 -2
- package/package.json +1 -1
- package/lib/CompositionEventPlugin.js +0 -257
- package/lib/ReactLegacyElement.js +0 -243
- package/lib/copyProperties.js +0 -54
- package/lib/deprecated.js +0 -47
- package/lib/merge.js +0 -34
- package/lib/mergeInto.js +0 -24
- package/lib/monitorCodeUse.js +0 -30
package/lib/ReactRootIndex.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var ReactRootIndexInjection = {
|
|
16
16
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @typechecks static-only
|
|
10
10
|
* @providesModule ReactServerRendering
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactElement = require("./ReactElement");
|
|
15
15
|
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
@@ -17,6 +17,7 @@ var ReactMarkupChecksum = require("./ReactMarkupChecksum");
|
|
|
17
17
|
var ReactServerRenderingTransaction =
|
|
18
18
|
require("./ReactServerRenderingTransaction");
|
|
19
19
|
|
|
20
|
+
var emptyObject = require("./emptyObject");
|
|
20
21
|
var instantiateReactComponent = require("./instantiateReactComponent");
|
|
21
22
|
var invariant = require("./invariant");
|
|
22
23
|
|
|
@@ -37,7 +38,8 @@ function renderToString(element) {
|
|
|
37
38
|
|
|
38
39
|
return transaction.perform(function() {
|
|
39
40
|
var componentInstance = instantiateReactComponent(element, null);
|
|
40
|
-
var markup =
|
|
41
|
+
var markup =
|
|
42
|
+
componentInstance.mountComponent(id, transaction, emptyObject);
|
|
41
43
|
return ReactMarkupChecksum.addChecksumToMarkup(markup);
|
|
42
44
|
}, null);
|
|
43
45
|
} finally {
|
|
@@ -63,7 +65,7 @@ function renderToStaticMarkup(element) {
|
|
|
63
65
|
|
|
64
66
|
return transaction.perform(function() {
|
|
65
67
|
var componentInstance = instantiateReactComponent(element, null);
|
|
66
|
-
return componentInstance.mountComponent(id, transaction,
|
|
68
|
+
return componentInstance.mountComponent(id, transaction, emptyObject);
|
|
67
69
|
}, null);
|
|
68
70
|
} finally {
|
|
69
71
|
ReactServerRenderingTransaction.release(transaction);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2014, Facebook, Inc.
|
|
2
|
+
* Copyright 2014-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var PooledClass = require("./PooledClass");
|
|
16
16
|
var CallbackQueue = require("./CallbackQueue");
|
package/lib/ReactStateSetters.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule ReactStateSetters
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactStateSetters = {
|
|
15
15
|
/**
|
package/lib/ReactTestUtils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule ReactTestUtils
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var EventConstants = require("./EventConstants");
|
|
15
15
|
var EventPluginHub = require("./EventPluginHub");
|
|
@@ -17,8 +17,10 @@ var EventPropagators = require("./EventPropagators");
|
|
|
17
17
|
var React = require("./React");
|
|
18
18
|
var ReactElement = require("./ReactElement");
|
|
19
19
|
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
|
|
20
|
+
var ReactCompositeComponent = require("./ReactCompositeComponent");
|
|
21
|
+
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
22
|
+
var ReactInstanceMap = require("./ReactInstanceMap");
|
|
20
23
|
var ReactMount = require("./ReactMount");
|
|
21
|
-
var ReactTextComponent = require("./ReactTextComponent");
|
|
22
24
|
var ReactUpdates = require("./ReactUpdates");
|
|
23
25
|
var SyntheticEvent = require("./SyntheticEvent");
|
|
24
26
|
|
|
@@ -55,12 +57,14 @@ var ReactTestUtils = {
|
|
|
55
57
|
isElementOfType: function(inst, convenienceConstructor) {
|
|
56
58
|
return (
|
|
57
59
|
ReactElement.isValidElement(inst) &&
|
|
58
|
-
inst.type === convenienceConstructor
|
|
60
|
+
inst.type === convenienceConstructor
|
|
59
61
|
);
|
|
60
62
|
},
|
|
61
63
|
|
|
62
64
|
isDOMComponent: function(inst) {
|
|
63
|
-
|
|
65
|
+
// TODO: Fix this heuristic. It's just here because composites can currently
|
|
66
|
+
// pretend to be DOM components.
|
|
67
|
+
return !!(inst && inst.getDOMNode && inst.tagName);
|
|
64
68
|
},
|
|
65
69
|
|
|
66
70
|
isDOMComponentElement: function(inst) {
|
|
@@ -76,7 +80,7 @@ var ReactTestUtils = {
|
|
|
76
80
|
|
|
77
81
|
isCompositeComponentWithType: function(inst, type) {
|
|
78
82
|
return !!(ReactTestUtils.isCompositeComponent(inst) &&
|
|
79
|
-
(inst.constructor === type
|
|
83
|
+
(inst.constructor === type));
|
|
80
84
|
},
|
|
81
85
|
|
|
82
86
|
isCompositeComponentElement: function(inst) {
|
|
@@ -97,8 +101,12 @@ var ReactTestUtils = {
|
|
|
97
101
|
(inst.constructor === type));
|
|
98
102
|
},
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
getRenderedChildOfCompositeComponent: function(inst) {
|
|
105
|
+
if (!ReactTestUtils.isCompositeComponent(inst)) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
var internalInstance = ReactInstanceMap.get(inst);
|
|
109
|
+
return internalInstance._renderedComponent.getPublicInstance();
|
|
102
110
|
},
|
|
103
111
|
|
|
104
112
|
findAllInRenderedTree: function(inst, test) {
|
|
@@ -107,19 +115,31 @@ var ReactTestUtils = {
|
|
|
107
115
|
}
|
|
108
116
|
var ret = test(inst) ? [inst] : [];
|
|
109
117
|
if (ReactTestUtils.isDOMComponent(inst)) {
|
|
110
|
-
var
|
|
118
|
+
var internalInstance = ReactInstanceMap.get(inst);
|
|
119
|
+
var renderedChildren = internalInstance
|
|
120
|
+
._renderedComponent
|
|
121
|
+
._renderedChildren;
|
|
111
122
|
var key;
|
|
112
123
|
for (key in renderedChildren) {
|
|
113
124
|
if (!renderedChildren.hasOwnProperty(key)) {
|
|
114
125
|
continue;
|
|
115
126
|
}
|
|
127
|
+
if (!renderedChildren[key].getPublicInstance) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
116
130
|
ret = ret.concat(
|
|
117
|
-
ReactTestUtils.findAllInRenderedTree(
|
|
131
|
+
ReactTestUtils.findAllInRenderedTree(
|
|
132
|
+
renderedChildren[key].getPublicInstance(),
|
|
133
|
+
test
|
|
134
|
+
)
|
|
118
135
|
);
|
|
119
136
|
}
|
|
120
137
|
} else if (ReactTestUtils.isCompositeComponent(inst)) {
|
|
121
138
|
ret = ret.concat(
|
|
122
|
-
ReactTestUtils.findAllInRenderedTree(
|
|
139
|
+
ReactTestUtils.findAllInRenderedTree(
|
|
140
|
+
ReactTestUtils.getRenderedChildOfCompositeComponent(inst),
|
|
141
|
+
test
|
|
142
|
+
)
|
|
123
143
|
);
|
|
124
144
|
}
|
|
125
145
|
return ret;
|
|
@@ -134,8 +154,7 @@ var ReactTestUtils = {
|
|
|
134
154
|
return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
|
|
135
155
|
var instClassName = inst.props.className;
|
|
136
156
|
return ReactTestUtils.isDOMComponent(inst) && (
|
|
137
|
-
instClassName &&
|
|
138
|
-
(' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1
|
|
157
|
+
(instClassName && (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1)
|
|
139
158
|
);
|
|
140
159
|
});
|
|
141
160
|
},
|
|
@@ -150,7 +169,9 @@ var ReactTestUtils = {
|
|
|
150
169
|
var all =
|
|
151
170
|
ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
|
|
152
171
|
if (all.length !== 1) {
|
|
153
|
-
throw new Error('Did not find exactly one match
|
|
172
|
+
throw new Error('Did not find exactly one match '+
|
|
173
|
+
'(found: ' + all.length + ') for class:' + className
|
|
174
|
+
);
|
|
154
175
|
}
|
|
155
176
|
return all[0];
|
|
156
177
|
},
|
|
@@ -231,21 +252,14 @@ var ReactTestUtils = {
|
|
|
231
252
|
mockComponent: function(module, mockTagName) {
|
|
232
253
|
mockTagName = mockTagName || module.mockTagName || "div";
|
|
233
254
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
);
|
|
241
|
-
}
|
|
255
|
+
module.prototype.render.mockImplementation(function() {
|
|
256
|
+
return React.createElement(
|
|
257
|
+
mockTagName,
|
|
258
|
+
null,
|
|
259
|
+
this.props.children
|
|
260
|
+
);
|
|
242
261
|
});
|
|
243
262
|
|
|
244
|
-
module.mockImplementation(ConvenienceConstructor);
|
|
245
|
-
|
|
246
|
-
module.type = ConvenienceConstructor.type;
|
|
247
|
-
module.isReactLegacyFactory = true;
|
|
248
|
-
|
|
249
263
|
return this;
|
|
250
264
|
},
|
|
251
265
|
|
|
@@ -290,10 +304,82 @@ var ReactTestUtils = {
|
|
|
290
304
|
};
|
|
291
305
|
},
|
|
292
306
|
|
|
307
|
+
createRenderer: function() {
|
|
308
|
+
return new ReactShallowRenderer();
|
|
309
|
+
},
|
|
310
|
+
|
|
293
311
|
Simulate: null,
|
|
294
312
|
SimulateNative: {}
|
|
295
313
|
};
|
|
296
314
|
|
|
315
|
+
/**
|
|
316
|
+
* @class ReactShallowRenderer
|
|
317
|
+
*/
|
|
318
|
+
var ReactShallowRenderer = function() {
|
|
319
|
+
this._instance = null;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
ReactShallowRenderer.prototype.getRenderOutput = function() {
|
|
323
|
+
return (
|
|
324
|
+
(this._instance && this._instance._renderedComponent &&
|
|
325
|
+
this._instance._renderedComponent._currentElement)
|
|
326
|
+
|| null
|
|
327
|
+
);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
var NoopInternalComponent = function(element) {
|
|
331
|
+
this._currentElement = element;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
NoopInternalComponent.prototype = {
|
|
335
|
+
|
|
336
|
+
mountComponent: function() {
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
receiveComponent: function(element) {
|
|
340
|
+
this._currentElement = element;
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
unmountComponent: function() {
|
|
344
|
+
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
var ShallowComponentWrapper = function() { };
|
|
350
|
+
assign(
|
|
351
|
+
ShallowComponentWrapper.prototype,
|
|
352
|
+
ReactCompositeComponent.Mixin, {
|
|
353
|
+
_instantiateReactComponent: function(element) {
|
|
354
|
+
return new NoopInternalComponent(element);
|
|
355
|
+
},
|
|
356
|
+
_replaceNodeWithMarkupByID: function() {},
|
|
357
|
+
_renderValidatedComponent:
|
|
358
|
+
ReactCompositeComponent.Mixin.
|
|
359
|
+
_renderValidatedComponentWithoutOwnerOrContext
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
|
|
363
|
+
ReactShallowRenderer.prototype.render = function(element, context) {
|
|
364
|
+
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
|
|
365
|
+
this._render(element, transaction, context);
|
|
366
|
+
ReactUpdates.ReactReconcileTransaction.release(transaction);
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
ReactShallowRenderer.prototype._render = function(element, transaction, context) {
|
|
370
|
+
if (!this._instance) {
|
|
371
|
+
var rootID = ReactInstanceHandles.createReactRootID();
|
|
372
|
+
var instance = new ShallowComponentWrapper(element.type);
|
|
373
|
+
instance.construct(element);
|
|
374
|
+
|
|
375
|
+
instance.mountComponent(rootID, transaction, context);
|
|
376
|
+
|
|
377
|
+
this._instance = instance;
|
|
378
|
+
} else {
|
|
379
|
+
this._instance.receiveComponent(element, transaction, context);
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
|
|
297
383
|
/**
|
|
298
384
|
* Exports:
|
|
299
385
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
* @providesModule ReactTransitionChildMapping
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var ReactChildren = require("./ReactChildren");
|
|
16
|
+
var ReactFragment = require("./ReactFragment");
|
|
16
17
|
|
|
17
18
|
var ReactTransitionChildMapping = {
|
|
18
19
|
/**
|
|
@@ -23,9 +24,12 @@ var ReactTransitionChildMapping = {
|
|
|
23
24
|
* @return {object} Mapping of key to child
|
|
24
25
|
*/
|
|
25
26
|
getChildMapping: function(children) {
|
|
26
|
-
|
|
27
|
+
if (!children) {
|
|
28
|
+
return children;
|
|
29
|
+
}
|
|
30
|
+
return ReactFragment.extract(ReactChildren.map(children, function(child) {
|
|
27
31
|
return child;
|
|
28
|
-
});
|
|
32
|
+
}));
|
|
29
33
|
},
|
|
30
34
|
|
|
31
35
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule ReactTransitionEvents
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
15
15
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule ReactTransitionGroup
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var React = require("./React");
|
|
15
15
|
var ReactTransitionChildMapping = require("./ReactTransitionChildMapping");
|
|
@@ -39,6 +39,21 @@ var ReactTransitionGroup = React.createClass({
|
|
|
39
39
|
};
|
|
40
40
|
},
|
|
41
41
|
|
|
42
|
+
componentWillMount: function() {
|
|
43
|
+
this.currentlyTransitioningKeys = {};
|
|
44
|
+
this.keysToEnter = [];
|
|
45
|
+
this.keysToLeave = [];
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
componentDidMount: function() {
|
|
49
|
+
var initialChildMapping = this.state.children;
|
|
50
|
+
for (var key in initialChildMapping) {
|
|
51
|
+
if (initialChildMapping[key]) {
|
|
52
|
+
this.performAppear(key);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
42
57
|
componentWillReceiveProps: function(nextProps) {
|
|
43
58
|
var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
|
|
44
59
|
nextProps.children
|
|
@@ -73,12 +88,6 @@ var ReactTransitionGroup = React.createClass({
|
|
|
73
88
|
// If we want to someday check for reordering, we could do it here.
|
|
74
89
|
},
|
|
75
90
|
|
|
76
|
-
componentWillMount: function() {
|
|
77
|
-
this.currentlyTransitioningKeys = {};
|
|
78
|
-
this.keysToEnter = [];
|
|
79
|
-
this.keysToLeave = [];
|
|
80
|
-
},
|
|
81
|
-
|
|
82
91
|
componentDidUpdate: function() {
|
|
83
92
|
var keysToEnter = this.keysToEnter;
|
|
84
93
|
this.keysToEnter = [];
|
|
@@ -89,6 +98,38 @@ var ReactTransitionGroup = React.createClass({
|
|
|
89
98
|
keysToLeave.forEach(this.performLeave);
|
|
90
99
|
},
|
|
91
100
|
|
|
101
|
+
performAppear: function(key) {
|
|
102
|
+
this.currentlyTransitioningKeys[key] = true;
|
|
103
|
+
|
|
104
|
+
var component = this.refs[key];
|
|
105
|
+
|
|
106
|
+
if (component.componentWillAppear) {
|
|
107
|
+
component.componentWillAppear(
|
|
108
|
+
this._handleDoneAppearing.bind(this, key)
|
|
109
|
+
);
|
|
110
|
+
} else {
|
|
111
|
+
this._handleDoneAppearing(key);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
_handleDoneAppearing: function(key) {
|
|
116
|
+
var component = this.refs[key];
|
|
117
|
+
if (component.componentDidAppear) {
|
|
118
|
+
component.componentDidAppear();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
delete this.currentlyTransitioningKeys[key];
|
|
122
|
+
|
|
123
|
+
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
|
|
124
|
+
this.props.children
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
|
|
128
|
+
// This was removed before it had fully appeared. Remove it.
|
|
129
|
+
this.performLeave(key);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
92
133
|
performEnter: function(key) {
|
|
93
134
|
this.currentlyTransitioningKeys[key] = true;
|
|
94
135
|
|
|
@@ -161,7 +202,7 @@ var ReactTransitionGroup = React.createClass({
|
|
|
161
202
|
render: function() {
|
|
162
203
|
// TODO: we could get rid of the need for the wrapper node
|
|
163
204
|
// by cloning a single child
|
|
164
|
-
var childrenToRender =
|
|
205
|
+
var childrenToRender = [];
|
|
165
206
|
for (var key in this.state.children) {
|
|
166
207
|
var child = this.state.children[key];
|
|
167
208
|
if (child) {
|
|
@@ -170,10 +211,10 @@ var ReactTransitionGroup = React.createClass({
|
|
|
170
211
|
// already been removed. In case you need this behavior you can provide
|
|
171
212
|
// a childFactory function to wrap every child, even the ones that are
|
|
172
213
|
// leaving.
|
|
173
|
-
childrenToRender
|
|
214
|
+
childrenToRender.push(cloneWithProps(
|
|
174
215
|
this.props.childFactory(child),
|
|
175
|
-
{ref: key}
|
|
176
|
-
);
|
|
216
|
+
{ref: key, key: key}
|
|
217
|
+
));
|
|
177
218
|
}
|
|
178
219
|
}
|
|
179
220
|
return React.createElement(
|