react 0.14.8 → 15.0.0-rc.1
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/LICENSE +1 -1
- package/addons.js +2 -0
- package/dist/react-with-addons.js +4203 -4148
- package/dist/react-with-addons.min.js +7 -7
- package/dist/react.js +4159 -3850
- package/dist/react.min.js +7 -7
- package/lib/AutoFocusUtils.js +3 -15
- package/lib/BeforeInputEventPlugin.js +8 -25
- package/lib/CSSProperty.js +4 -1
- package/lib/CSSPropertyOperations.js +24 -10
- package/lib/CallbackQueue.js +13 -2
- package/lib/ChangeEventPlugin.js +58 -54
- package/lib/DOMChildrenOperations.js +93 -60
- package/lib/DOMLazyTree.js +96 -0
- package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
- package/lib/DOMProperty.js +18 -39
- package/lib/DOMPropertyOperations.js +87 -53
- package/lib/Danger.js +13 -14
- package/lib/DefaultEventPluginOrder.js +1 -1
- package/lib/EnterLeaveEventPlugin.js +24 -43
- package/lib/EventConstants.js +6 -1
- package/lib/EventPluginHub.js +22 -66
- package/lib/EventPluginRegistry.js +30 -9
- package/lib/EventPluginUtils.js +61 -36
- package/lib/EventPropagators.js +19 -17
- package/lib/FallbackCompositionState.js +1 -2
- package/lib/HTMLDOMPropertyConfig.js +69 -90
- package/lib/LinkedStateMixin.js +1 -2
- package/lib/LinkedValueUtils.js +5 -6
- package/lib/MetaMatchers.js +2 -2
- package/lib/Object.assign.js +1 -1
- package/lib/OrderedMap.js +14 -14
- package/lib/PooledClass.js +2 -2
- package/lib/React.js +1 -13
- package/lib/ReactBrowserEventEmitter.js +16 -24
- package/lib/ReactCSSTransitionGroup.js +1 -2
- package/lib/ReactCSSTransitionGroupChild.js +1 -6
- package/lib/ReactChildReconciler.js +15 -13
- package/lib/ReactChildren.js +5 -4
- package/lib/ReactClass.js +37 -86
- package/lib/ReactComponent.js +7 -8
- package/lib/ReactComponentBrowserEnvironment.js +9 -6
- package/lib/ReactComponentEnvironment.js +4 -4
- package/lib/ReactComponentWithPureRenderMixin.js +2 -2
- package/lib/ReactCompositeComponent.js +160 -69
- package/lib/ReactCurrentOwner.js +2 -1
- package/lib/ReactDOM.js +27 -15
- package/lib/ReactDOMButton.js +2 -2
- package/lib/ReactDOMComponent.js +188 -244
- package/lib/ReactDOMComponentFlags.js +18 -0
- package/lib/ReactDOMComponentTree.js +186 -0
- package/lib/ReactDOMContainerInfo.js +32 -0
- package/lib/ReactDOMDebugTool.js +69 -0
- package/lib/ReactDOMEmptyComponent.js +60 -0
- package/lib/ReactDOMFactories.js +1 -2
- package/lib/ReactDOMFeatureFlags.js +2 -2
- package/lib/ReactDOMIDOperations.js +5 -60
- package/lib/ReactDOMInput.js +71 -22
- package/lib/ReactDOMInstrumentation.js +16 -0
- package/lib/ReactDOMOption.js +11 -10
- package/lib/ReactDOMSVGDeprecatedAttributeDevtool.js +61 -0
- package/lib/ReactDOMSelect.js +40 -17
- package/lib/ReactDOMSelection.js +4 -4
- package/lib/ReactDOMServer.js +1 -1
- package/lib/ReactDOMTextComponent.js +84 -43
- package/lib/ReactDOMTextarea.js +36 -9
- package/lib/ReactDOMTreeTraversal.js +134 -0
- package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
- package/lib/ReactDebugTool.js +72 -0
- package/lib/ReactDefaultBatchingStrategy.js +1 -1
- package/lib/ReactDefaultInjection.js +11 -15
- package/lib/ReactDefaultPerf.js +59 -19
- package/lib/ReactDefaultPerfAnalysis.js +17 -9
- package/lib/ReactElement.js +60 -21
- package/lib/ReactElementValidator.js +8 -8
- package/lib/ReactEmptyComponent.js +8 -33
- package/lib/ReactErrorUtils.js +1 -2
- package/lib/ReactEventEmitterMixin.js +3 -8
- package/lib/ReactEventListener.js +20 -75
- package/lib/ReactFeatureFlags.js +21 -0
- package/lib/ReactFragment.js +6 -6
- package/lib/ReactInjection.js +3 -3
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -12
- package/lib/ReactInstanceMap.js +2 -1
- package/lib/ReactInstrumentation.js +16 -0
- package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
- package/lib/ReactIsomorphic.js +1 -1
- package/lib/ReactLink.js +2 -3
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +87 -460
- package/lib/ReactMultiChild.js +106 -200
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +3 -3
- package/lib/ReactNodeTypes.js +37 -0
- package/lib/ReactNoopUpdateQueue.js +2 -25
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +1 -1
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +27 -3
- package/lib/ReactReconcileTransaction.js +17 -6
- package/lib/ReactReconciler.js +29 -6
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +1 -2
- package/lib/ReactServerRendering.js +17 -35
- package/lib/ReactServerRenderingTransaction.js +8 -26
- package/lib/ReactSimpleEmptyComponent.js +36 -0
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +33 -24
- package/lib/ReactTransitionChildMapping.js +1 -2
- package/lib/ReactTransitionEvents.js +8 -44
- package/lib/ReactTransitionGroup.js +1 -1
- package/lib/ReactUpdateQueue.js +6 -65
- package/lib/ReactUpdates.js +26 -9
- package/lib/ReactVersion.js +2 -2
- package/lib/ReactWithAddons.js +1 -14
- package/lib/ResponderEventPlugin.js +54 -66
- package/lib/ResponderSyntheticEvent.js +1 -2
- package/lib/ResponderTouchHistoryStore.js +5 -5
- package/lib/SVGDOMPropertyConfig.js +25 -66
- package/lib/SelectEventPlugin.js +13 -18
- package/lib/SimpleEventPlugin.js +57 -17
- package/lib/SyntheticAnimationEvent.js +39 -0
- package/lib/SyntheticClipboardEvent.js +2 -3
- package/lib/SyntheticCompositionEvent.js +2 -3
- package/lib/SyntheticDragEvent.js +2 -3
- package/lib/SyntheticEvent.js +97 -17
- package/lib/SyntheticFocusEvent.js +2 -3
- package/lib/SyntheticInputEvent.js +2 -3
- package/lib/SyntheticKeyboardEvent.js +2 -3
- package/lib/SyntheticMouseEvent.js +2 -3
- package/lib/SyntheticTouchEvent.js +2 -3
- package/lib/SyntheticTransitionEvent.js +39 -0
- package/lib/SyntheticUIEvent.js +2 -3
- package/lib/SyntheticWheelEvent.js +2 -3
- package/lib/TapEventPlugin.js +3 -12
- package/lib/Transaction.js +3 -3
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +2 -2
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +3 -2
- package/lib/canDefineProperty.js +1 -1
- package/lib/createHierarchyRenderer.js +1 -1
- package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
- package/lib/dangerousStyleValue.js +25 -3
- package/lib/deprecated.js +4 -2
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +15 -8
- package/lib/flattenChildren.js +2 -2
- package/lib/forEachAccumulated.js +2 -1
- package/lib/getEventCharCode.js +2 -2
- package/lib/getEventKey.js +1 -2
- package/lib/getEventModifierState.js +1 -2
- package/lib/getEventTarget.js +8 -2
- package/lib/getIteratorFn.js +2 -2
- package/lib/getNativeComponentFromComposite.js +30 -0
- package/lib/getNodeForCharacterOffset.js +2 -1
- package/lib/getTestDocument.js +1 -1
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/getVendorPrefixedEventName.js +101 -0
- package/lib/instantiateReactComponent.js +9 -11
- package/lib/isEventSupported.js +2 -2
- package/lib/isTextInputElement.js +2 -1
- package/lib/onlyChild.js +2 -2
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +2 -2
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +5 -14
- package/lib/setTextContent.js +1 -1
- package/lib/shallowCompare.js +1 -1
- package/lib/shouldUpdateReactComponent.js +2 -3
- package/lib/sliceChildren.js +1 -1
- package/lib/traverseAllChildren.js +8 -8
- package/lib/update.js +12 -12
- package/lib/validateDOMNesting.js +15 -11
- package/package.json +2 -2
- package/lib/ReactBrowserComponentMixin.js +0 -36
- package/lib/ReactEmptyComponentRegistry.js +0 -48
- package/lib/ReactRootIndex.js +0 -29
- package/lib/ServerReactRootIndex.js +0 -29
- package/lib/cloneWithProps.js +0 -54
- package/lib/webcomponents.js +0 -6379
package/lib/MetaMatchers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2015, Facebook, Inc.
|
|
2
|
+
* Copyright 2015-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
function getRunnerWithResults(describeFunction) {
|
|
21
21
|
if (describeFunction._cachedRunner) {
|
|
22
22
|
// Cached result of execution. This is a convenience way to test against
|
|
23
|
-
// the same
|
|
23
|
+
// the same authoritative function multiple times.
|
|
24
24
|
return describeFunction._cachedRunner;
|
|
25
25
|
}
|
|
26
26
|
// Patch the current global environment.
|
package/lib/Object.assign.js
CHANGED
package/lib/OrderedMap.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -34,7 +34,7 @@ function extractObjectFromArray(arr, keyExtractor) {
|
|
|
34
34
|
var key = keyExtractor(item);
|
|
35
35
|
assertValidPublicKey(key);
|
|
36
36
|
var normalizedKey = PREFIX + key;
|
|
37
|
-
!!(normalizedKey in normalizedObj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: IDs returned by the key extraction function must be unique.') : invariant(false) :
|
|
37
|
+
!!(normalizedKey in normalizedObj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: IDs returned by the key extraction function must be unique.') : invariant(false) : void 0;
|
|
38
38
|
normalizedObj[normalizedKey] = item;
|
|
39
39
|
}
|
|
40
40
|
return normalizedObj;
|
|
@@ -81,7 +81,7 @@ function OrderedMapImpl(normalizedObj, computedLength) {
|
|
|
81
81
|
* @throws Error if key is not appropriate for use in `OrderedMap`.
|
|
82
82
|
*/
|
|
83
83
|
function assertValidPublicKey(key) {
|
|
84
|
-
!(key !== '' && (typeof key === 'string' || typeof key === 'number')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: Key must be non-empty, non-null string or number.') : invariant(false) :
|
|
84
|
+
!(key !== '' && (typeof key === 'string' || typeof key === 'number')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: Key must be non-empty, non-null string or number.') : invariant(false) : void 0;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
@@ -94,7 +94,7 @@ function assertValidPublicKey(key) {
|
|
|
94
94
|
* @throws Error if range arguments are out of bounds.
|
|
95
95
|
*/
|
|
96
96
|
function assertValidRangeIndices(start, length, actualLen) {
|
|
97
|
-
!(typeof start === 'number' && typeof length === 'number' && length >= 0 && start >= 0 && start + length <= actualLen) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: `mapRange` and `forEachRange` expect non-negative start and ' + 'length arguments within the bounds of the instance.') : invariant(false) :
|
|
97
|
+
!(typeof start === 'number' && typeof length === 'number' && length >= 0 && start >= 0 && start + length <= actualLen) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: `mapRange` and `forEachRange` expect non-negative start and ' + 'length arguments within the bounds of the instance.') : invariant(false) : void 0;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
@@ -107,7 +107,7 @@ function assertValidRangeIndices(start, length, actualLen) {
|
|
|
107
107
|
*/
|
|
108
108
|
function _fromNormalizedObjects(a, b) {
|
|
109
109
|
// Second optional, both must be plain JavaScript objects.
|
|
110
|
-
!(a && a.constructor === Object && (!b || b.constructor === Object)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: Corrupted instance of OrderedMap detected.') : invariant(false) :
|
|
110
|
+
!(a && a.constructor === Object && (!b || b.constructor === Object)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: Corrupted instance of OrderedMap detected.') : invariant(false) : void 0;
|
|
111
111
|
|
|
112
112
|
var newSet = {};
|
|
113
113
|
var length = 0;
|
|
@@ -183,7 +183,7 @@ var OrderedMapMethods = {
|
|
|
183
183
|
* merge.
|
|
184
184
|
*/
|
|
185
185
|
merge: function (orderedMap) {
|
|
186
|
-
!(orderedMap instanceof OrderedMapImpl) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.merge(...): Expected an OrderedMap instance.') : invariant(false) :
|
|
186
|
+
!(orderedMap instanceof OrderedMapImpl) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.merge(...): Expected an OrderedMap instance.') : invariant(false) : void 0;
|
|
187
187
|
return _fromNormalizedObjects(this._normalizedObj, orderedMap._normalizedObj);
|
|
188
188
|
},
|
|
189
189
|
|
|
@@ -295,16 +295,16 @@ var OrderedMapMethods = {
|
|
|
295
295
|
mapKeyRange: function (cb, startKey, endKey, context) {
|
|
296
296
|
var startIndex = this.indexOfKey(startKey);
|
|
297
297
|
var endIndex = this.indexOfKey(endKey);
|
|
298
|
-
!(startIndex !== undefined && endIndex !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mapKeyRange must be given keys that are present.') : invariant(false) :
|
|
299
|
-
!(endIndex >= startIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.mapKeyRange(...): `endKey` must not come before `startIndex`.') : invariant(false) :
|
|
298
|
+
!(startIndex !== undefined && endIndex !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mapKeyRange must be given keys that are present.') : invariant(false) : void 0;
|
|
299
|
+
!(endIndex >= startIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.mapKeyRange(...): `endKey` must not come before `startIndex`.') : invariant(false) : void 0;
|
|
300
300
|
return this.mapRange(cb, startIndex, endIndex - startIndex + 1, context);
|
|
301
301
|
},
|
|
302
302
|
|
|
303
303
|
forEachKeyRange: function (cb, startKey, endKey, context) {
|
|
304
304
|
var startIndex = this.indexOfKey(startKey);
|
|
305
305
|
var endIndex = this.indexOfKey(endKey);
|
|
306
|
-
!(startIndex !== undefined && endIndex !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'forEachKeyRange must be given keys that are present.') : invariant(false) :
|
|
307
|
-
!(endIndex >= startIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.forEachKeyRange(...): `endKey` must not come before ' + '`startIndex`.') : invariant(false) :
|
|
306
|
+
!(startIndex !== undefined && endIndex !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'forEachKeyRange must be given keys that are present.') : invariant(false) : void 0;
|
|
307
|
+
!(endIndex >= startIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.forEachKeyRange(...): `endKey` must not come before ' + '`startIndex`.') : invariant(false) : void 0;
|
|
308
308
|
this.forEachRange(cb, startIndex, endIndex - startIndex + 1, context);
|
|
309
309
|
},
|
|
310
310
|
|
|
@@ -348,7 +348,7 @@ var OrderedMapMethods = {
|
|
|
348
348
|
*/
|
|
349
349
|
nthKeyAfter: function (key, n) {
|
|
350
350
|
var curIndex = this.indexOfKey(key);
|
|
351
|
-
!(curIndex !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.nthKeyAfter: The key `%s` does not exist in this instance.', key) : invariant(false) :
|
|
351
|
+
!(curIndex !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.nthKeyAfter: The key `%s` does not exist in this instance.', key) : invariant(false) : void 0;
|
|
352
352
|
return this.keyAtIndex(curIndex + n);
|
|
353
353
|
},
|
|
354
354
|
|
|
@@ -439,13 +439,13 @@ assign(OrderedMapImpl.prototype, OrderedMapMethods);
|
|
|
439
439
|
|
|
440
440
|
var OrderedMap = {
|
|
441
441
|
from: function (orderedMap) {
|
|
442
|
-
!(orderedMap instanceof OrderedMapImpl) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.from(...): Expected an OrderedMap instance.') : invariant(false) :
|
|
442
|
+
!(orderedMap instanceof OrderedMapImpl) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.from(...): Expected an OrderedMap instance.') : invariant(false) : void 0;
|
|
443
443
|
return _fromNormalizedObjects(orderedMap._normalizedObj, null);
|
|
444
444
|
},
|
|
445
445
|
|
|
446
446
|
fromArray: function (arr, keyExtractor) {
|
|
447
|
-
!Array.isArray(arr) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.fromArray(...): First argument must be an array.') : invariant(false) :
|
|
448
|
-
!(typeof keyExtractor === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.fromArray(...): Second argument must be a function used ' + 'to determine the unique key for each entry.') : invariant(false) :
|
|
447
|
+
!Array.isArray(arr) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.fromArray(...): First argument must be an array.') : invariant(false) : void 0;
|
|
448
|
+
!(typeof keyExtractor === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.fromArray(...): Second argument must be a function used ' + 'to determine the unique key for each entry.') : invariant(false) : void 0;
|
|
449
449
|
return new OrderedMapImpl(extractObjectFromArray(arr, keyExtractor), arr.length);
|
|
450
450
|
}
|
|
451
451
|
};
|
package/lib/PooledClass.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -77,7 +77,7 @@ var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
|
|
|
77
77
|
|
|
78
78
|
var standardReleaser = function (instance) {
|
|
79
79
|
var Klass = this;
|
|
80
|
-
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) :
|
|
80
|
+
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : void 0;
|
|
81
81
|
instance.destructor();
|
|
82
82
|
if (Klass.instancePool.length < Klass.poolSize) {
|
|
83
83
|
Klass.instancePool.push(instance);
|
package/lib/React.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -16,24 +16,12 @@ var ReactDOMServer = require('./ReactDOMServer');
|
|
|
16
16
|
var ReactIsomorphic = require('./ReactIsomorphic');
|
|
17
17
|
|
|
18
18
|
var assign = require('./Object.assign');
|
|
19
|
-
var deprecated = require('./deprecated');
|
|
20
19
|
|
|
21
20
|
// `version` will be added here by ReactIsomorphic.
|
|
22
21
|
var React = {};
|
|
23
22
|
|
|
24
23
|
assign(React, ReactIsomorphic);
|
|
25
24
|
|
|
26
|
-
assign(React, {
|
|
27
|
-
// ReactDOM
|
|
28
|
-
findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
|
|
29
|
-
render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
|
|
30
|
-
unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
|
|
31
|
-
|
|
32
|
-
// ReactDOMServer
|
|
33
|
-
renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
|
|
34
|
-
renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
|
|
35
|
-
});
|
|
36
|
-
|
|
37
25
|
React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
|
|
38
26
|
React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
|
|
39
27
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -7,19 +7,17 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
9
|
* @providesModule ReactBrowserEventEmitter
|
|
10
|
-
* @typechecks static-only
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
'use strict';
|
|
14
13
|
|
|
15
14
|
var EventConstants = require('./EventConstants');
|
|
16
|
-
var EventPluginHub = require('./EventPluginHub');
|
|
17
15
|
var EventPluginRegistry = require('./EventPluginRegistry');
|
|
18
16
|
var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
|
|
19
|
-
var ReactPerf = require('./ReactPerf');
|
|
20
17
|
var ViewportMetrics = require('./ViewportMetrics');
|
|
21
18
|
|
|
22
19
|
var assign = require('./Object.assign');
|
|
20
|
+
var getVendorPrefixedEventName = require('./getVendorPrefixedEventName');
|
|
23
21
|
var isEventSupported = require('./isEventSupported');
|
|
24
22
|
|
|
25
23
|
/**
|
|
@@ -77,6 +75,7 @@ var isEventSupported = require('./isEventSupported');
|
|
|
77
75
|
* React Core . General Purpose Event Plugin System
|
|
78
76
|
*/
|
|
79
77
|
|
|
78
|
+
var hasEventPageXY;
|
|
80
79
|
var alreadyListeningTo = {};
|
|
81
80
|
var isMonitoringScrollValue = false;
|
|
82
81
|
var reactTopListenersCounter = 0;
|
|
@@ -86,6 +85,9 @@ var reactTopListenersCounter = 0;
|
|
|
86
85
|
// events so we don't include them here
|
|
87
86
|
var topEventMapping = {
|
|
88
87
|
topAbort: 'abort',
|
|
88
|
+
topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
|
|
89
|
+
topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
|
|
90
|
+
topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
|
|
89
91
|
topBlur: 'blur',
|
|
90
92
|
topCanPlay: 'canplay',
|
|
91
93
|
topCanPlayThrough: 'canplaythrough',
|
|
@@ -142,6 +144,7 @@ var topEventMapping = {
|
|
|
142
144
|
topTouchEnd: 'touchend',
|
|
143
145
|
topTouchMove: 'touchmove',
|
|
144
146
|
topTouchStart: 'touchstart',
|
|
147
|
+
topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
|
|
145
148
|
topVolumeChange: 'volumechange',
|
|
146
149
|
topWaiting: 'waiting',
|
|
147
150
|
topWheel: 'wheel'
|
|
@@ -166,7 +169,7 @@ function getListeningForDocument(mountAt) {
|
|
|
166
169
|
* `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
|
|
167
170
|
* example:
|
|
168
171
|
*
|
|
169
|
-
*
|
|
172
|
+
* EventPluginHub.putListener('myID', 'onClick', myFunction);
|
|
170
173
|
*
|
|
171
174
|
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
|
|
172
175
|
*
|
|
@@ -290,35 +293,24 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|
|
290
293
|
* Listens to window scroll and resize events. We cache scroll values so that
|
|
291
294
|
* application code can access them without triggering reflows.
|
|
292
295
|
*
|
|
296
|
+
* ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
|
|
297
|
+
* pageX/pageY isn't supported (legacy browsers).
|
|
298
|
+
*
|
|
293
299
|
* NOTE: Scroll events do not bubble.
|
|
294
300
|
*
|
|
295
301
|
* @see http://www.quirksmode.org/dom/events/scroll.html
|
|
296
302
|
*/
|
|
297
303
|
ensureScrollValueMonitoring: function () {
|
|
298
|
-
if (
|
|
304
|
+
if (hasEventPageXY === undefined) {
|
|
305
|
+
hasEventPageXY = document.createEvent && 'pageX' in document.createEvent('MouseEvent');
|
|
306
|
+
}
|
|
307
|
+
if (!hasEventPageXY && !isMonitoringScrollValue) {
|
|
299
308
|
var refresh = ViewportMetrics.refreshScrollValues;
|
|
300
309
|
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
|
|
301
310
|
isMonitoringScrollValue = true;
|
|
302
311
|
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
|
|
306
|
-
|
|
307
|
-
registrationNameModules: EventPluginHub.registrationNameModules,
|
|
308
|
-
|
|
309
|
-
putListener: EventPluginHub.putListener,
|
|
310
|
-
|
|
311
|
-
getListener: EventPluginHub.getListener,
|
|
312
|
-
|
|
313
|
-
deleteListener: EventPluginHub.deleteListener,
|
|
314
|
-
|
|
315
|
-
deleteAllListeners: EventPluginHub.deleteAllListeners
|
|
316
|
-
|
|
317
|
-
});
|
|
312
|
+
}
|
|
318
313
|
|
|
319
|
-
ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
|
|
320
|
-
putListener: 'putListener',
|
|
321
|
-
deleteListener: 'deleteListener'
|
|
322
314
|
});
|
|
323
315
|
|
|
324
316
|
module.exports = ReactBrowserEventEmitter;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @typechecks
|
|
10
9
|
* @providesModule ReactCSSTransitionGroup
|
|
11
10
|
*/
|
|
12
11
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @typechecks
|
|
10
9
|
* @providesModule ReactCSSTransitionGroupChild
|
|
11
10
|
*/
|
|
12
11
|
|
|
@@ -20,10 +19,6 @@ var ReactTransitionEvents = require('./ReactTransitionEvents');
|
|
|
20
19
|
|
|
21
20
|
var onlyChild = require('./onlyChild');
|
|
22
21
|
|
|
23
|
-
// We don't remove the element from the DOM until we receive an animationend or
|
|
24
|
-
// transitionend event. If the user screws up and forgets to add an animation
|
|
25
|
-
// their node will be stuck in the DOM forever, so we detect if an animation
|
|
26
|
-
// does not start and if it doesn't, we just call the end listener immediately.
|
|
27
22
|
var TICK = 17;
|
|
28
23
|
|
|
29
24
|
var ReactCSSTransitionGroupChild = React.createClass({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2014-
|
|
2
|
+
* Copyright 2014-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
9
|
* @providesModule ReactChildReconciler
|
|
10
|
-
* @typechecks static-only
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
'use strict';
|
|
@@ -23,10 +22,10 @@ function instantiateChild(childInstances, child, name) {
|
|
|
23
22
|
// We found a component instance.
|
|
24
23
|
var keyUnique = childInstances[name] === undefined;
|
|
25
24
|
if (process.env.NODE_ENV !== 'production') {
|
|
26
|
-
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) :
|
|
25
|
+
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : void 0;
|
|
27
26
|
}
|
|
28
27
|
if (child != null && keyUnique) {
|
|
29
|
-
childInstances[name] = instantiateReactComponent(child
|
|
28
|
+
childInstances[name] = instantiateReactComponent(child);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
|
|
@@ -63,21 +62,22 @@ var ReactChildReconciler = {
|
|
|
63
62
|
* @return {?object} A new set of child instances.
|
|
64
63
|
* @internal
|
|
65
64
|
*/
|
|
66
|
-
updateChildren: function (prevChildren, nextChildren, transaction, context) {
|
|
65
|
+
updateChildren: function (prevChildren, nextChildren, removedNodes, transaction, context) {
|
|
67
66
|
// We currently don't have a way to track moves here but if we use iterators
|
|
68
67
|
// instead of for..in we can zip the iterators and check if an item has
|
|
69
68
|
// moved.
|
|
70
69
|
// TODO: If nothing has changed, return the prevChildren object so that we
|
|
71
70
|
// can quickly bailout if nothing has changed.
|
|
72
71
|
if (!nextChildren && !prevChildren) {
|
|
73
|
-
return
|
|
72
|
+
return;
|
|
74
73
|
}
|
|
75
74
|
var name;
|
|
75
|
+
var prevChild;
|
|
76
76
|
for (name in nextChildren) {
|
|
77
77
|
if (!nextChildren.hasOwnProperty(name)) {
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
prevChild = prevChildren && prevChildren[name];
|
|
81
81
|
var prevElement = prevChild && prevChild._currentElement;
|
|
82
82
|
var nextElement = nextChildren[name];
|
|
83
83
|
if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
|
|
@@ -85,20 +85,22 @@ var ReactChildReconciler = {
|
|
|
85
85
|
nextChildren[name] = prevChild;
|
|
86
86
|
} else {
|
|
87
87
|
if (prevChild) {
|
|
88
|
-
ReactReconciler.
|
|
88
|
+
removedNodes[name] = ReactReconciler.getNativeNode(prevChild);
|
|
89
|
+
ReactReconciler.unmountComponent(prevChild, false);
|
|
89
90
|
}
|
|
90
91
|
// The child must be instantiated before it's mounted.
|
|
91
|
-
var nextChildInstance = instantiateReactComponent(nextElement
|
|
92
|
+
var nextChildInstance = instantiateReactComponent(nextElement);
|
|
92
93
|
nextChildren[name] = nextChildInstance;
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
// Unmount children that are no longer present.
|
|
96
97
|
for (name in prevChildren) {
|
|
97
98
|
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
|
|
98
|
-
|
|
99
|
+
prevChild = prevChildren[name];
|
|
100
|
+
removedNodes[name] = ReactReconciler.getNativeNode(prevChild);
|
|
101
|
+
ReactReconciler.unmountComponent(prevChild, false);
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
return nextChildren;
|
|
102
104
|
},
|
|
103
105
|
|
|
104
106
|
/**
|
|
@@ -108,11 +110,11 @@ var ReactChildReconciler = {
|
|
|
108
110
|
* @param {?object} renderedChildren Previously initialized set of children.
|
|
109
111
|
* @internal
|
|
110
112
|
*/
|
|
111
|
-
unmountChildren: function (renderedChildren) {
|
|
113
|
+
unmountChildren: function (renderedChildren, safely) {
|
|
112
114
|
for (var name in renderedChildren) {
|
|
113
115
|
if (renderedChildren.hasOwnProperty(name)) {
|
|
114
116
|
var renderedChild = renderedChildren[name];
|
|
115
|
-
ReactReconciler.unmountComponent(renderedChild);
|
|
117
|
+
ReactReconciler.unmountComponent(renderedChild, safely);
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
}
|
package/lib/ReactChildren.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -20,9 +20,9 @@ var traverseAllChildren = require('./traverseAllChildren');
|
|
|
20
20
|
var twoArgumentPooler = PooledClass.twoArgumentPooler;
|
|
21
21
|
var fourArgumentPooler = PooledClass.fourArgumentPooler;
|
|
22
22
|
|
|
23
|
-
var userProvidedKeyEscapeRegex =
|
|
23
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
24
24
|
function escapeUserProvidedKey(text) {
|
|
25
|
-
return ('' + text).replace(userProvidedKeyEscapeRegex, '
|
|
25
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -102,6 +102,7 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
|
102
102
|
var func = bookKeeping.func;
|
|
103
103
|
var context = bookKeeping.context;
|
|
104
104
|
|
|
105
|
+
|
|
105
106
|
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
106
107
|
if (Array.isArray(mappedChild)) {
|
|
107
108
|
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
|
|
@@ -110,7 +111,7 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
|
110
111
|
mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
|
|
111
112
|
// Keep both the (mapped) and old keys if they differ, just as
|
|
112
113
|
// traverseAllChildren used to do for objects as children
|
|
113
|
-
keyPrefix + (mappedChild
|
|
114
|
+
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
114
115
|
}
|
|
115
116
|
result.push(mappedChild);
|
|
116
117
|
}
|
package/lib/ReactClass.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -53,14 +53,6 @@ var SpecPolicy = keyMirror({
|
|
|
53
53
|
|
|
54
54
|
var injectedMixins = [];
|
|
55
55
|
|
|
56
|
-
var warnedSetProps = false;
|
|
57
|
-
function warnSetProps() {
|
|
58
|
-
if (!warnedSetProps) {
|
|
59
|
-
warnedSetProps = true;
|
|
60
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
56
|
/**
|
|
65
57
|
* Composite components are higher-level components that compose other composite
|
|
66
58
|
* or native components.
|
|
@@ -365,39 +357,40 @@ function validateTypeDef(Constructor, typeDef, location) {
|
|
|
365
357
|
for (var propName in typeDef) {
|
|
366
358
|
if (typeDef.hasOwnProperty(propName)) {
|
|
367
359
|
// use a warning instead of an invariant so components
|
|
368
|
-
// don't show up in prod but
|
|
369
|
-
process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) :
|
|
360
|
+
// don't show up in prod but only in __DEV__
|
|
361
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
|
|
370
362
|
}
|
|
371
363
|
}
|
|
372
364
|
}
|
|
373
365
|
|
|
374
|
-
function validateMethodOverride(
|
|
366
|
+
function validateMethodOverride(isAlreadyDefined, name) {
|
|
375
367
|
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
|
|
376
368
|
|
|
377
369
|
// Disallow overriding of base class methods unless explicitly allowed.
|
|
378
370
|
if (ReactClassMixin.hasOwnProperty(name)) {
|
|
379
|
-
!(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) :
|
|
371
|
+
!(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : void 0;
|
|
380
372
|
}
|
|
381
373
|
|
|
382
374
|
// Disallow defining methods more than once unless explicitly allowed.
|
|
383
|
-
if (
|
|
384
|
-
!(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) :
|
|
375
|
+
if (isAlreadyDefined) {
|
|
376
|
+
!(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : void 0;
|
|
385
377
|
}
|
|
386
378
|
}
|
|
387
379
|
|
|
388
380
|
/**
|
|
389
381
|
* Mixin helper which handles policy validation and reserved
|
|
390
|
-
* specification keys when building React
|
|
382
|
+
* specification keys when building React classes.
|
|
391
383
|
*/
|
|
392
384
|
function mixSpecIntoComponent(Constructor, spec) {
|
|
393
385
|
if (!spec) {
|
|
394
386
|
return;
|
|
395
387
|
}
|
|
396
388
|
|
|
397
|
-
!(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) :
|
|
398
|
-
!!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) :
|
|
389
|
+
!(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.') : invariant(false) : void 0;
|
|
390
|
+
!!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : void 0;
|
|
399
391
|
|
|
400
392
|
var proto = Constructor.prototype;
|
|
393
|
+
var autoBindPairs = proto.__reactAutoBindPairs;
|
|
401
394
|
|
|
402
395
|
// By handling mixins before any other properties, we ensure the same
|
|
403
396
|
// chaining order is applied to methods with DEFINE_MANY policy, whether
|
|
@@ -417,7 +410,8 @@ function mixSpecIntoComponent(Constructor, spec) {
|
|
|
417
410
|
}
|
|
418
411
|
|
|
419
412
|
var property = spec[name];
|
|
420
|
-
|
|
413
|
+
var isAlreadyDefined = proto.hasOwnProperty(name);
|
|
414
|
+
validateMethodOverride(isAlreadyDefined, name);
|
|
421
415
|
|
|
422
416
|
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
|
|
423
417
|
RESERVED_SPEC_KEYS[name](Constructor, property);
|
|
@@ -427,22 +421,18 @@ function mixSpecIntoComponent(Constructor, spec) {
|
|
|
427
421
|
// 1. Expected ReactClass methods (in the "interface").
|
|
428
422
|
// 2. Overridden methods (that were mixed in).
|
|
429
423
|
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
|
|
430
|
-
var isAlreadyDefined = proto.hasOwnProperty(name);
|
|
431
424
|
var isFunction = typeof property === 'function';
|
|
432
425
|
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
|
|
433
426
|
|
|
434
427
|
if (shouldAutoBind) {
|
|
435
|
-
|
|
436
|
-
proto.__reactAutoBindMap = {};
|
|
437
|
-
}
|
|
438
|
-
proto.__reactAutoBindMap[name] = property;
|
|
428
|
+
autoBindPairs.push(name, property);
|
|
439
429
|
proto[name] = property;
|
|
440
430
|
} else {
|
|
441
431
|
if (isAlreadyDefined) {
|
|
442
432
|
var specPolicy = ReactClassInterface[name];
|
|
443
433
|
|
|
444
434
|
// These cases should already be caught by validateMethodOverride.
|
|
445
|
-
!(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) :
|
|
435
|
+
!(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : void 0;
|
|
446
436
|
|
|
447
437
|
// For methods which are defined more than once, call the existing
|
|
448
438
|
// methods before calling the new property, merging if appropriate.
|
|
@@ -476,11 +466,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
|
|
|
476
466
|
continue;
|
|
477
467
|
}
|
|
478
468
|
|
|
479
|
-
var isReserved =
|
|
480
|
-
!!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) :
|
|
469
|
+
var isReserved = name in RESERVED_SPEC_KEYS;
|
|
470
|
+
!!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : void 0;
|
|
481
471
|
|
|
482
|
-
var isInherited =
|
|
483
|
-
!!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) :
|
|
472
|
+
var isInherited = name in Constructor;
|
|
473
|
+
!!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : void 0;
|
|
484
474
|
Constructor[name] = property;
|
|
485
475
|
}
|
|
486
476
|
}
|
|
@@ -493,11 +483,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
|
|
|
493
483
|
* @return {object} one after it has been mutated to contain everything in two.
|
|
494
484
|
*/
|
|
495
485
|
function mergeIntoWithNoDuplicateKeys(one, two) {
|
|
496
|
-
!(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) :
|
|
486
|
+
!(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : void 0;
|
|
497
487
|
|
|
498
488
|
for (var key in two) {
|
|
499
489
|
if (two.hasOwnProperty(key)) {
|
|
500
|
-
!(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) :
|
|
490
|
+
!(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : void 0;
|
|
501
491
|
one[key] = two[key];
|
|
502
492
|
}
|
|
503
493
|
}
|
|
@@ -558,7 +548,6 @@ function bindAutoBindMethod(component, method) {
|
|
|
558
548
|
boundMethod.__reactBoundArguments = null;
|
|
559
549
|
var componentName = component.constructor.displayName;
|
|
560
550
|
var _bind = boundMethod.bind;
|
|
561
|
-
/* eslint-disable block-scoped-var, no-undef */
|
|
562
551
|
boundMethod.bind = function (newThis) {
|
|
563
552
|
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
564
553
|
args[_key - 1] = arguments[_key];
|
|
@@ -568,9 +557,9 @@ function bindAutoBindMethod(component, method) {
|
|
|
568
557
|
// ignore the value of "this" that the user is trying to use, so
|
|
569
558
|
// let's warn.
|
|
570
559
|
if (newThis !== component && newThis !== null) {
|
|
571
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) :
|
|
560
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
|
|
572
561
|
} else if (!args.length) {
|
|
573
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) :
|
|
562
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
|
|
574
563
|
return boundMethod;
|
|
575
564
|
}
|
|
576
565
|
var reboundMethod = _bind.apply(boundMethod, arguments);
|
|
@@ -578,7 +567,6 @@ function bindAutoBindMethod(component, method) {
|
|
|
578
567
|
reboundMethod.__reactBoundMethod = method;
|
|
579
568
|
reboundMethod.__reactBoundArguments = args;
|
|
580
569
|
return reboundMethod;
|
|
581
|
-
/* eslint-enable */
|
|
582
570
|
};
|
|
583
571
|
}
|
|
584
572
|
return boundMethod;
|
|
@@ -590,11 +578,11 @@ function bindAutoBindMethod(component, method) {
|
|
|
590
578
|
* @param {object} component Component whose method is going to be bound.
|
|
591
579
|
*/
|
|
592
580
|
function bindAutoBindMethods(component) {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
581
|
+
var pairs = component.__reactAutoBindPairs;
|
|
582
|
+
for (var i = 0; i < pairs.length; i += 2) {
|
|
583
|
+
var autoBindKey = pairs[i];
|
|
584
|
+
var method = pairs[i + 1];
|
|
585
|
+
component[autoBindKey] = bindAutoBindMethod(component, method);
|
|
598
586
|
}
|
|
599
587
|
}
|
|
600
588
|
|
|
@@ -623,44 +611,6 @@ var ReactClassMixin = {
|
|
|
623
611
|
*/
|
|
624
612
|
isMounted: function () {
|
|
625
613
|
return this.updater.isMounted(this);
|
|
626
|
-
},
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* Sets a subset of the props.
|
|
630
|
-
*
|
|
631
|
-
* @param {object} partialProps Subset of the next props.
|
|
632
|
-
* @param {?function} callback Called after props are updated.
|
|
633
|
-
* @final
|
|
634
|
-
* @public
|
|
635
|
-
* @deprecated
|
|
636
|
-
*/
|
|
637
|
-
setProps: function (partialProps, callback) {
|
|
638
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
639
|
-
warnSetProps();
|
|
640
|
-
}
|
|
641
|
-
this.updater.enqueueSetProps(this, partialProps);
|
|
642
|
-
if (callback) {
|
|
643
|
-
this.updater.enqueueCallback(this, callback);
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
|
|
647
|
-
/**
|
|
648
|
-
* Replace all the props.
|
|
649
|
-
*
|
|
650
|
-
* @param {object} newProps Subset of the next props.
|
|
651
|
-
* @param {?function} callback Called after props are updated.
|
|
652
|
-
* @final
|
|
653
|
-
* @public
|
|
654
|
-
* @deprecated
|
|
655
|
-
*/
|
|
656
|
-
replaceProps: function (newProps, callback) {
|
|
657
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
658
|
-
warnSetProps();
|
|
659
|
-
}
|
|
660
|
-
this.updater.enqueueReplaceProps(this, newProps);
|
|
661
|
-
if (callback) {
|
|
662
|
-
this.updater.enqueueCallback(this, callback);
|
|
663
|
-
}
|
|
664
614
|
}
|
|
665
615
|
};
|
|
666
616
|
|
|
@@ -683,15 +633,15 @@ var ReactClass = {
|
|
|
683
633
|
*/
|
|
684
634
|
createClass: function (spec) {
|
|
685
635
|
var Constructor = function (props, context, updater) {
|
|
686
|
-
// This constructor
|
|
636
|
+
// This constructor gets overridden by mocks. The argument is used
|
|
687
637
|
// by mocks to assert on what gets mounted.
|
|
688
638
|
|
|
689
639
|
if (process.env.NODE_ENV !== 'production') {
|
|
690
|
-
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') :
|
|
640
|
+
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
|
|
691
641
|
}
|
|
692
642
|
|
|
693
643
|
// Wire up auto-binding
|
|
694
|
-
if (this.
|
|
644
|
+
if (this.__reactAutoBindPairs.length) {
|
|
695
645
|
bindAutoBindMethods(this);
|
|
696
646
|
}
|
|
697
647
|
|
|
@@ -708,18 +658,19 @@ var ReactClass = {
|
|
|
708
658
|
var initialState = this.getInitialState ? this.getInitialState() : null;
|
|
709
659
|
if (process.env.NODE_ENV !== 'production') {
|
|
710
660
|
// We allow auto-mocks to proceed as if they're returning null.
|
|
711
|
-
if (
|
|
661
|
+
if (initialState === undefined && this.getInitialState._isMockFunction) {
|
|
712
662
|
// This is probably bad practice. Consider warning here and
|
|
713
663
|
// deprecating this convenience.
|
|
714
664
|
initialState = null;
|
|
715
665
|
}
|
|
716
666
|
}
|
|
717
|
-
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) :
|
|
667
|
+
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : void 0;
|
|
718
668
|
|
|
719
669
|
this.state = initialState;
|
|
720
670
|
};
|
|
721
671
|
Constructor.prototype = new ReactClassComponent();
|
|
722
672
|
Constructor.prototype.constructor = Constructor;
|
|
673
|
+
Constructor.prototype.__reactAutoBindPairs = [];
|
|
723
674
|
|
|
724
675
|
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
|
|
725
676
|
|
|
@@ -743,11 +694,11 @@ var ReactClass = {
|
|
|
743
694
|
}
|
|
744
695
|
}
|
|
745
696
|
|
|
746
|
-
!Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) :
|
|
697
|
+
!Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : void 0;
|
|
747
698
|
|
|
748
699
|
if (process.env.NODE_ENV !== 'production') {
|
|
749
|
-
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') :
|
|
750
|
-
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') :
|
|
700
|
+
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0;
|
|
701
|
+
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
|
|
751
702
|
}
|
|
752
703
|
|
|
753
704
|
// Reduce time spent doing lookups by setting these on the prototype.
|