react 15.1.0 → 15.2.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/dist/react-with-addons.js +2685 -1842
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +2400 -1691
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +1 -1
- package/lib/CallbackQueue.js +3 -2
- package/lib/DOMChildrenOperations.js +9 -9
- package/lib/DOMLazyTree.js +3 -2
- package/lib/DOMProperty.js +5 -12
- package/lib/DOMPropertyOperations.js +21 -15
- package/lib/Danger.js +5 -101
- package/lib/DisabledInputUtils.js +5 -5
- package/lib/EventPluginHub.js +8 -2
- package/lib/EventPluginRegistry.js +13 -7
- package/lib/EventPluginUtils.js +3 -1
- package/lib/HTMLDOMPropertyConfig.js +1 -2
- package/lib/KeyEscapeUtils.js +2 -1
- package/lib/LinkedValueUtils.js +5 -3
- package/lib/NativeMethodsMixin.js +6 -4
- package/lib/PooledClass.js +4 -2
- package/lib/React.js +1 -1
- package/lib/ReactCSSTransitionGroupChild.js +15 -8
- package/lib/ReactChildReconciler.js +17 -8
- package/lib/ReactClass.js +14 -13
- package/lib/ReactComponent.js +3 -6
- package/lib/ReactComponentEnvironment.js +3 -1
- package/lib/ReactComponentTreeDevtool.js +89 -16
- package/lib/ReactComponentTreeTestUtils.js +87 -0
- package/lib/ReactCompositeComponent.js +87 -117
- package/lib/ReactDOM.js +2 -2
- package/lib/ReactDOMButton.js +2 -2
- package/lib/ReactDOMComponent.js +130 -76
- package/lib/ReactDOMComponentTree.js +23 -21
- package/lib/ReactDOMDebugTool.js +17 -11
- package/lib/ReactDOMEmptyComponent.js +9 -9
- package/lib/ReactDOMFactories.js +1 -1
- package/lib/ReactDOMFiber.js +78 -0
- package/lib/ReactDOMInput.js +64 -26
- package/lib/ReactDOMInstrumentation.js +7 -2
- package/lib/ReactDOMNullInputValuePropDevtool.js +43 -0
- package/lib/ReactDOMOption.js +40 -26
- package/lib/ReactDOMSelect.js +3 -16
- package/lib/ReactDOMTextComponent.js +21 -20
- package/lib/ReactDOMTextarea.js +59 -46
- package/lib/ReactDOMTreeTraversal.js +18 -16
- package/lib/ReactDOMUnknownPropertyDevtool.js +65 -17
- package/lib/ReactDebugTool.js +148 -95
- package/lib/ReactDefaultInjection.js +2 -2
- package/lib/ReactElement.js +64 -25
- package/lib/ReactElementValidator.js +26 -81
- package/lib/ReactEventListener.js +2 -2
- package/lib/ReactFeatureFlags.js +1 -0
- package/lib/ReactFragment.js +3 -1
- package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
- package/lib/{ReactNativeOperationHistoryDevtool.js → ReactHostOperationHistoryDevtool.js} +5 -5
- package/lib/ReactInjection.js +2 -2
- package/lib/ReactInstanceHandles.js +8 -6
- package/lib/ReactInstrumentation.js +7 -2
- package/lib/ReactMount.js +38 -32
- package/lib/ReactMultiChild.js +38 -11
- package/lib/ReactNativeAttributePayload.js +5 -2
- package/lib/ReactNativeBaseComponent.js +7 -7
- package/lib/ReactNativeBridgeEventPlugin.js +1 -1
- package/lib/ReactNativeComponentTree.js +8 -6
- package/lib/ReactNativeDOMIDOperations.js +1 -2
- package/lib/ReactNativeDefaultInjection.js +9 -7
- package/lib/ReactNativeGlobalResponderHandler.js +1 -1
- package/lib/ReactNativeMount.js +3 -14
- package/lib/ReactNativeReconcileTransaction.js +16 -0
- package/lib/ReactNativeTagHandles.js +3 -1
- package/lib/ReactNativeTextComponent.js +10 -9
- package/lib/ReactNativeTreeTraversal.js +11 -11
- package/lib/ReactNodeTypes.js +6 -3
- package/lib/ReactNoop.js +173 -0
- package/lib/ReactNoopUpdateQueue.js +6 -5
- package/lib/ReactOwner.js +4 -2
- package/lib/ReactPerf.js +83 -7
- package/lib/ReactPropTypes.js +23 -0
- package/lib/ReactReconcileTransaction.js +17 -1
- package/lib/ReactReconciler.js +12 -7
- package/lib/ReactServerRendering.js +5 -7
- package/lib/ReactServerRenderingTransaction.js +17 -0
- package/lib/ReactServerUpdateQueue.js +141 -0
- package/lib/ReactSimpleEmptyComponent.js +4 -4
- package/lib/ReactTestMount.js +115 -0
- package/lib/ReactTestReconcileTransaction.js +108 -0
- package/lib/ReactTestRenderer.js +133 -0
- package/lib/ReactTestUtils.js +17 -10
- package/lib/ReactTransitionChildMapping.js +7 -1
- package/lib/ReactTransitionGroup.js +41 -6
- package/lib/ReactUpdateQueue.js +13 -3
- package/lib/ReactUpdates.js +10 -18
- package/lib/ReactVersion.js +1 -1
- package/lib/ResponderEventPlugin.js +9 -7
- package/lib/ResponderTouchHistoryStore.js +99 -95
- package/lib/SimpleEventPlugin.js +3 -1
- package/lib/SyntheticEvent.js +2 -3
- package/lib/SyntheticUIEvent.js +1 -1
- package/lib/Transaction.js +4 -2
- package/lib/accumulate.js +17 -15
- package/lib/accumulateInto.js +11 -12
- package/lib/adler32.js +1 -0
- package/lib/checkReactTypeSpec.js +73 -0
- package/lib/createReactNativeComponentClass.js +2 -2
- package/lib/dangerousStyleValue.js +3 -1
- package/lib/deprecated.js +7 -1
- package/lib/escapeTextContentForBrowser.js +96 -12
- package/lib/findDOMNode.js +6 -4
- package/lib/findNodeHandle.js +5 -3
- package/lib/flattenChildren.js +22 -10
- package/lib/forEachAccumulated.js +3 -2
- package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
- package/lib/getIteratorFn.js +1 -0
- package/lib/instantiateReactComponent.js +21 -19
- package/lib/isTextInputElement.js +11 -1
- package/lib/onlyChild.js +3 -1
- package/lib/reactComponentExpect.js +3 -3
- package/lib/reactProdInvariant.js +39 -0
- package/lib/setInnerHTML.js +17 -1
- package/lib/setTextContent.js +8 -0
- package/lib/traverseAllChildren.js +3 -1
- package/lib/update.js +12 -11
- package/package.json +2 -2
- package/lib/MetaMatchers.js +0 -118
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var invariant = require('fbjs/lib/invariant');
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -36,15 +38,15 @@ function recomputePluginOrdering() {
|
|
|
36
38
|
for (var pluginName in namesToPlugins) {
|
|
37
39
|
var PluginModule = namesToPlugins[pluginName];
|
|
38
40
|
var pluginIndex = EventPluginOrder.indexOf(pluginName);
|
|
39
|
-
!(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in
|
|
41
|
+
!(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0;
|
|
40
42
|
if (EventPluginRegistry.plugins[pluginIndex]) {
|
|
41
43
|
continue;
|
|
42
44
|
}
|
|
43
|
-
!PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents`
|
|
45
|
+
!PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0;
|
|
44
46
|
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
|
|
45
47
|
var publishedEvents = PluginModule.eventTypes;
|
|
46
48
|
for (var eventName in publishedEvents) {
|
|
47
|
-
!publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) :
|
|
49
|
+
!publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0;
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -58,7 +60,7 @@ function recomputePluginOrdering() {
|
|
|
58
60
|
* @private
|
|
59
61
|
*/
|
|
60
62
|
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
|
|
61
|
-
!!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same
|
|
63
|
+
!!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0;
|
|
62
64
|
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
|
|
63
65
|
|
|
64
66
|
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
|
|
@@ -86,13 +88,17 @@ function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
|
|
|
86
88
|
* @private
|
|
87
89
|
*/
|
|
88
90
|
function publishRegistrationName(registrationName, PluginModule, eventName) {
|
|
89
|
-
!!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same
|
|
91
|
+
!!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0;
|
|
90
92
|
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
|
|
91
93
|
EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
|
|
92
94
|
|
|
93
95
|
if (process.env.NODE_ENV !== 'production') {
|
|
94
96
|
var lowerCasedName = registrationName.toLowerCase();
|
|
95
97
|
EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
|
|
98
|
+
|
|
99
|
+
if (registrationName === 'onDoubleClick') {
|
|
100
|
+
EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
|
|
101
|
+
}
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
|
|
@@ -141,7 +147,7 @@ var EventPluginRegistry = {
|
|
|
141
147
|
* @see {EventPluginHub.injection.injectEventPluginOrder}
|
|
142
148
|
*/
|
|
143
149
|
injectEventPluginOrder: function (InjectedEventPluginOrder) {
|
|
144
|
-
!!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than
|
|
150
|
+
!!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0;
|
|
145
151
|
// Clone the ordering so it cannot be dynamically mutated.
|
|
146
152
|
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
|
|
147
153
|
recomputePluginOrdering();
|
|
@@ -165,7 +171,7 @@ var EventPluginRegistry = {
|
|
|
165
171
|
}
|
|
166
172
|
var PluginModule = injectedNamesToPlugins[pluginName];
|
|
167
173
|
if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
|
|
168
|
-
!!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins
|
|
174
|
+
!!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0;
|
|
169
175
|
namesToPlugins[pluginName] = PluginModule;
|
|
170
176
|
isOrderingDirty = true;
|
|
171
177
|
}
|
package/lib/EventPluginUtils.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var EventConstants = require('./EventConstants');
|
|
15
17
|
var ReactErrorUtils = require('./ReactErrorUtils');
|
|
16
18
|
|
|
@@ -169,7 +171,7 @@ function executeDirectDispatch(event) {
|
|
|
169
171
|
}
|
|
170
172
|
var dispatchListener = event._dispatchListeners;
|
|
171
173
|
var dispatchInstance = event._dispatchInstances;
|
|
172
|
-
!!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') :
|
|
174
|
+
!!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0;
|
|
173
175
|
event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
|
|
174
176
|
var res = dispatchListener ? dispatchListener(event) : null;
|
|
175
177
|
event.currentTarget = null;
|
|
@@ -15,7 +15,6 @@ var DOMProperty = require('./DOMProperty');
|
|
|
15
15
|
|
|
16
16
|
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
|
|
17
17
|
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
|
|
18
|
-
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
|
|
19
18
|
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
|
|
20
19
|
var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
|
|
21
20
|
var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
|
|
@@ -149,7 +148,7 @@ var HTMLDOMPropertyConfig = {
|
|
|
149
148
|
// Setting .type throws on non-<input> tags
|
|
150
149
|
type: 0,
|
|
151
150
|
useMap: 0,
|
|
152
|
-
value:
|
|
151
|
+
value: 0,
|
|
153
152
|
width: 0,
|
|
154
153
|
wmode: 0,
|
|
155
154
|
wrap: 0,
|
package/lib/KeyEscapeUtils.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
9
|
* @providesModule KeyEscapeUtils
|
|
10
|
+
*
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
'use strict';
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
/**
|
|
15
16
|
* Escape and wrap key so it is safe to use as a reactid
|
|
16
17
|
*
|
|
17
|
-
* @param {
|
|
18
|
+
* @param {string} key to be escaped.
|
|
18
19
|
* @return {string} the escaped key.
|
|
19
20
|
*/
|
|
20
21
|
|
package/lib/LinkedValueUtils.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var ReactPropTypes = require('./ReactPropTypes');
|
|
15
17
|
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
|
|
16
18
|
|
|
@@ -28,16 +30,16 @@ var hasReadOnlyValue = {
|
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
function _assertSingleLink(inputProps) {
|
|
31
|
-
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use
|
|
33
|
+
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don\'t want to use valueLink and vice versa.') : _prodInvariant('87') : void 0;
|
|
32
34
|
}
|
|
33
35
|
function _assertValueLink(inputProps) {
|
|
34
36
|
_assertSingleLink(inputProps);
|
|
35
|
-
!(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want
|
|
37
|
+
!(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don\'t want to use valueLink.') : _prodInvariant('88') : void 0;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
function _assertCheckedLink(inputProps) {
|
|
39
41
|
_assertSingleLink(inputProps);
|
|
40
|
-
!(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event.
|
|
42
|
+
!(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don\'t want to use checkedLink') : _prodInvariant('89') : void 0;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
var propTypes = {
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
*/
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var ReactNativeAttributePayload = require('./ReactNativeAttributePayload');
|
|
15
|
-
var TextInputState = require('TextInputState');
|
|
16
|
-
var UIManager = require('UIManager');
|
|
17
|
+
var TextInputState = require('react-native/lib/TextInputState');
|
|
18
|
+
var UIManager = require('react-native/lib/UIManager');
|
|
17
19
|
|
|
18
20
|
var findNodeHandle = require('./findNodeHandle');
|
|
19
21
|
var invariant = require('fbjs/lib/invariant');
|
|
@@ -140,7 +142,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
140
142
|
// __DEV__ without actually implementing them (setting them to undefined
|
|
141
143
|
// isn't allowed by ReactClass)
|
|
142
144
|
var NativeMethodsMixin_DEV = NativeMethodsMixin;
|
|
143
|
-
!(!NativeMethodsMixin_DEV.componentWillMount && !NativeMethodsMixin_DEV.componentWillReceiveProps) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Do not override existing functions.') :
|
|
145
|
+
!(!NativeMethodsMixin_DEV.componentWillMount && !NativeMethodsMixin_DEV.componentWillReceiveProps) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Do not override existing functions.') : _prodInvariant('16') : void 0;
|
|
144
146
|
NativeMethodsMixin_DEV.componentWillMount = function () {
|
|
145
147
|
throwOnStylesProp(this, this.props);
|
|
146
148
|
};
|
|
@@ -153,7 +155,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
153
155
|
* In the future, we should cleanup callbacks by cancelling them instead of
|
|
154
156
|
* using this.
|
|
155
157
|
*/
|
|
156
|
-
|
|
158
|
+
function mountSafeCallback(context, callback) {
|
|
157
159
|
return function () {
|
|
158
160
|
if (!callback || context.isMounted && !context.isMounted()) {
|
|
159
161
|
return undefined;
|
package/lib/PooledClass.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var invariant = require('fbjs/lib/invariant');
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -77,7 +79,7 @@ var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
|
|
|
77
79
|
|
|
78
80
|
var standardReleaser = function (instance) {
|
|
79
81
|
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.') :
|
|
82
|
+
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
|
|
81
83
|
instance.destructor();
|
|
82
84
|
if (Klass.instancePool.length < Klass.poolSize) {
|
|
83
85
|
Klass.instancePool.push(instance);
|
|
@@ -91,7 +93,7 @@ var DEFAULT_POOLER = oneArgumentPooler;
|
|
|
91
93
|
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
|
|
92
94
|
* itself (statically) not adding any prototypical fields. Any CopyConstructor
|
|
93
95
|
* you give this may have a `poolSize` property, and will look for a
|
|
94
|
-
* prototypical `destructor` on instances
|
|
96
|
+
* prototypical `destructor` on instances.
|
|
95
97
|
*
|
|
96
98
|
* @param {Function} CopyConstructor Constructor that can be used to reset.
|
|
97
99
|
* @param {Function} pooler Customizable pooler.
|
package/lib/React.js
CHANGED
|
@@ -18,7 +18,6 @@ var ReactComponent = require('./ReactComponent');
|
|
|
18
18
|
var ReactClass = require('./ReactClass');
|
|
19
19
|
var ReactDOMFactories = require('./ReactDOMFactories');
|
|
20
20
|
var ReactElement = require('./ReactElement');
|
|
21
|
-
var ReactElementValidator = require('./ReactElementValidator');
|
|
22
21
|
var ReactPropTypes = require('./ReactPropTypes');
|
|
23
22
|
var ReactVersion = require('./ReactVersion');
|
|
24
23
|
|
|
@@ -30,6 +29,7 @@ var createFactory = ReactElement.createFactory;
|
|
|
30
29
|
var cloneElement = ReactElement.cloneElement;
|
|
31
30
|
|
|
32
31
|
if (process.env.NODE_ENV !== 'production') {
|
|
32
|
+
var ReactElementValidator = require('./ReactElementValidator');
|
|
33
33
|
createElement = ReactElementValidator.createElement;
|
|
34
34
|
createFactory = ReactElementValidator.createFactory;
|
|
35
35
|
cloneElement = ReactElementValidator.cloneElement;
|
|
@@ -85,7 +85,7 @@ var ReactCSSTransitionGroupChild = React.createClass({
|
|
|
85
85
|
CSSCore.addClass(node, className);
|
|
86
86
|
|
|
87
87
|
// Need to do this to actually trigger a transition.
|
|
88
|
-
this.
|
|
88
|
+
this.queueClassAndNode(activeClassName, node);
|
|
89
89
|
|
|
90
90
|
// If the user specified a timeout delay.
|
|
91
91
|
if (userSpecifiedDelay) {
|
|
@@ -98,24 +98,29 @@ var ReactCSSTransitionGroupChild = React.createClass({
|
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
this.
|
|
101
|
+
queueClassAndNode: function (className, node) {
|
|
102
|
+
this.classNameAndNodeQueue.push({
|
|
103
|
+
className: className,
|
|
104
|
+
node: node
|
|
105
|
+
});
|
|
103
106
|
|
|
104
107
|
if (!this.timeout) {
|
|
105
|
-
this.timeout = setTimeout(this.
|
|
108
|
+
this.timeout = setTimeout(this.flushClassNameAndNodeQueue, TICK);
|
|
106
109
|
}
|
|
107
110
|
},
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
flushClassNameAndNodeQueue: function () {
|
|
110
113
|
if (this.isMounted()) {
|
|
111
|
-
this.
|
|
114
|
+
this.classNameAndNodeQueue.forEach(function (obj) {
|
|
115
|
+
CSSCore.addClass(obj.node, obj.className);
|
|
116
|
+
});
|
|
112
117
|
}
|
|
113
|
-
this.
|
|
118
|
+
this.classNameAndNodeQueue.length = 0;
|
|
114
119
|
this.timeout = null;
|
|
115
120
|
},
|
|
116
121
|
|
|
117
122
|
componentWillMount: function () {
|
|
118
|
-
this.
|
|
123
|
+
this.classNameAndNodeQueue = [];
|
|
119
124
|
this.transitionTimeouts = [];
|
|
120
125
|
},
|
|
121
126
|
|
|
@@ -126,6 +131,8 @@ var ReactCSSTransitionGroupChild = React.createClass({
|
|
|
126
131
|
this.transitionTimeouts.forEach(function (timeout) {
|
|
127
132
|
clearTimeout(timeout);
|
|
128
133
|
});
|
|
134
|
+
|
|
135
|
+
this.classNameAndNodeQueue.length = 0;
|
|
129
136
|
},
|
|
130
137
|
|
|
131
138
|
componentWillAppear: function (done) {
|
|
@@ -19,14 +19,15 @@ var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
|
|
|
19
19
|
var traverseAllChildren = require('./traverseAllChildren');
|
|
20
20
|
var warning = require('fbjs/lib/warning');
|
|
21
21
|
|
|
22
|
-
function instantiateChild(childInstances, child, name) {
|
|
22
|
+
function instantiateChild(childInstances, child, name, selfDebugID) {
|
|
23
23
|
// We found a component instance.
|
|
24
24
|
var keyUnique = childInstances[name] === undefined;
|
|
25
25
|
if (process.env.NODE_ENV !== 'production') {
|
|
26
|
-
|
|
26
|
+
var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
|
|
27
|
+
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.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeDevtool.getStackAddendumByID(selfDebugID)) : void 0;
|
|
27
28
|
}
|
|
28
29
|
if (child != null && keyUnique) {
|
|
29
|
-
childInstances[name] = instantiateReactComponent(child);
|
|
30
|
+
childInstances[name] = instantiateReactComponent(child, true);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -44,12 +45,20 @@ var ReactChildReconciler = {
|
|
|
44
45
|
* @return {?object} A set of child instances.
|
|
45
46
|
* @internal
|
|
46
47
|
*/
|
|
47
|
-
instantiateChildren: function (nestedChildNodes, transaction, context
|
|
48
|
+
instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // __DEV__ only
|
|
49
|
+
) {
|
|
48
50
|
if (nestedChildNodes == null) {
|
|
49
51
|
return null;
|
|
50
52
|
}
|
|
51
53
|
var childInstances = {};
|
|
52
|
-
|
|
54
|
+
|
|
55
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
56
|
+
traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
|
|
57
|
+
return instantiateChild(childInsts, child, name, selfDebugID);
|
|
58
|
+
}, childInstances);
|
|
59
|
+
} else {
|
|
60
|
+
traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
|
|
61
|
+
}
|
|
53
62
|
return childInstances;
|
|
54
63
|
},
|
|
55
64
|
|
|
@@ -86,11 +95,11 @@ var ReactChildReconciler = {
|
|
|
86
95
|
nextChildren[name] = prevChild;
|
|
87
96
|
} else {
|
|
88
97
|
if (prevChild) {
|
|
89
|
-
removedNodes[name] = ReactReconciler.
|
|
98
|
+
removedNodes[name] = ReactReconciler.getHostNode(prevChild);
|
|
90
99
|
ReactReconciler.unmountComponent(prevChild, false);
|
|
91
100
|
}
|
|
92
101
|
// The child must be instantiated before it's mounted.
|
|
93
|
-
var nextChildInstance = instantiateReactComponent(nextElement);
|
|
102
|
+
var nextChildInstance = instantiateReactComponent(nextElement, true);
|
|
94
103
|
nextChildren[name] = nextChildInstance;
|
|
95
104
|
}
|
|
96
105
|
}
|
|
@@ -98,7 +107,7 @@ var ReactChildReconciler = {
|
|
|
98
107
|
for (name in prevChildren) {
|
|
99
108
|
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
|
|
100
109
|
prevChild = prevChildren[name];
|
|
101
|
-
removedNodes[name] = ReactReconciler.
|
|
110
|
+
removedNodes[name] = ReactReconciler.getHostNode(prevChild);
|
|
102
111
|
ReactReconciler.unmountComponent(prevChild, false);
|
|
103
112
|
}
|
|
104
113
|
}
|
package/lib/ReactClass.js
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant'),
|
|
15
|
+
_assign = require('object-assign');
|
|
15
16
|
|
|
16
17
|
var ReactComponent = require('./ReactComponent');
|
|
17
18
|
var ReactElement = require('./ReactElement');
|
|
@@ -56,7 +57,7 @@ var injectedMixins = [];
|
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* Composite components are higher-level components that compose other composite
|
|
59
|
-
* or
|
|
60
|
+
* or host components.
|
|
60
61
|
*
|
|
61
62
|
* To create a new type of `ReactClass`, pass a specification of
|
|
62
63
|
* your new class to `React.createClass`. The only requirement of your class
|
|
@@ -369,12 +370,12 @@ function validateMethodOverride(isAlreadyDefined, name) {
|
|
|
369
370
|
|
|
370
371
|
// Disallow overriding of base class methods unless explicitly allowed.
|
|
371
372
|
if (ReactClassMixin.hasOwnProperty(name)) {
|
|
372
|
-
!(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override
|
|
373
|
+
!(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) : _prodInvariant('73', name) : void 0;
|
|
373
374
|
}
|
|
374
375
|
|
|
375
376
|
// Disallow defining methods more than once unless explicitly allowed.
|
|
376
377
|
if (isAlreadyDefined) {
|
|
377
|
-
!(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define
|
|
378
|
+
!(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) : _prodInvariant('74', name) : void 0;
|
|
378
379
|
}
|
|
379
380
|
}
|
|
380
381
|
|
|
@@ -387,8 +388,8 @@ function mixSpecIntoComponent(Constructor, spec) {
|
|
|
387
388
|
return;
|
|
388
389
|
}
|
|
389
390
|
|
|
390
|
-
!(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to
|
|
391
|
-
!!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to
|
|
391
|
+
!(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.') : _prodInvariant('75') : void 0;
|
|
392
|
+
!!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.') : _prodInvariant('76') : void 0;
|
|
392
393
|
|
|
393
394
|
var proto = Constructor.prototype;
|
|
394
395
|
var autoBindPairs = proto.__reactAutoBindPairs;
|
|
@@ -433,7 +434,7 @@ function mixSpecIntoComponent(Constructor, spec) {
|
|
|
433
434
|
var specPolicy = ReactClassInterface[name];
|
|
434
435
|
|
|
435
436
|
// These cases should already be caught by validateMethodOverride.
|
|
436
|
-
!(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
|
|
437
|
+
!(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) : _prodInvariant('77', specPolicy, name) : void 0;
|
|
437
438
|
|
|
438
439
|
// For methods which are defined more than once, call the existing
|
|
439
440
|
// methods before calling the new property, merging if appropriate.
|
|
@@ -468,10 +469,10 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
|
|
|
468
469
|
}
|
|
469
470
|
|
|
470
471
|
var isReserved = name in RESERVED_SPEC_KEYS;
|
|
471
|
-
!!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved
|
|
472
|
+
!!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) : _prodInvariant('78', name) : void 0;
|
|
472
473
|
|
|
473
474
|
var isInherited = name in Constructor;
|
|
474
|
-
!!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define
|
|
475
|
+
!!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) : _prodInvariant('79', name) : void 0;
|
|
475
476
|
Constructor[name] = property;
|
|
476
477
|
}
|
|
477
478
|
}
|
|
@@ -484,11 +485,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
|
|
|
484
485
|
* @return {object} one after it has been mutated to contain everything in two.
|
|
485
486
|
*/
|
|
486
487
|
function mergeIntoWithNoDuplicateKeys(one, two) {
|
|
487
|
-
!(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') :
|
|
488
|
+
!(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
|
|
488
489
|
|
|
489
490
|
for (var key in two) {
|
|
490
491
|
if (two.hasOwnProperty(key)) {
|
|
491
|
-
!(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys():
|
|
492
|
+
!(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) : _prodInvariant('81', key) : void 0;
|
|
492
493
|
one[key] = two[key];
|
|
493
494
|
}
|
|
494
495
|
}
|
|
@@ -666,7 +667,7 @@ var ReactClass = {
|
|
|
666
667
|
initialState = null;
|
|
667
668
|
}
|
|
668
669
|
}
|
|
669
|
-
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') :
|
|
670
|
+
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0;
|
|
670
671
|
|
|
671
672
|
this.state = initialState;
|
|
672
673
|
};
|
|
@@ -696,7 +697,7 @@ var ReactClass = {
|
|
|
696
697
|
}
|
|
697
698
|
}
|
|
698
699
|
|
|
699
|
-
!Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') :
|
|
700
|
+
!Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
|
|
700
701
|
|
|
701
702
|
if (process.env.NODE_ENV !== 'production') {
|
|
702
703
|
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;
|
package/lib/ReactComponent.js
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
|
|
15
|
-
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
16
17
|
|
|
17
18
|
var canDefineProperty = require('./canDefineProperty');
|
|
18
19
|
var emptyObject = require('fbjs/lib/emptyObject');
|
|
@@ -59,11 +60,7 @@ ReactComponent.prototype.isReactComponent = {};
|
|
|
59
60
|
* @protected
|
|
60
61
|
*/
|
|
61
62
|
ReactComponent.prototype.setState = function (partialState, callback) {
|
|
62
|
-
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a
|
|
63
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
64
|
-
ReactInstrumentation.debugTool.onSetState();
|
|
65
|
-
process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
|
|
66
|
-
}
|
|
63
|
+
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0;
|
|
67
64
|
this.updater.enqueueSetState(this, partialState);
|
|
68
65
|
if (callback) {
|
|
69
66
|
this.updater.enqueueCallback(this, callback, 'setState');
|