react 15.1.0-alpha.1 → 15.2.0
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 +2145 -1396
- package/dist/react-with-addons.min.js +7 -6
- package/dist/react.js +1941 -1329
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +1 -1
- package/lib/CallbackQueue.js +3 -2
- package/lib/DOMChildrenOperations.js +15 -8
- package/lib/DOMLazyTree.js +3 -2
- package/lib/DOMProperty.js +6 -4
- package/lib/DOMPropertyOperations.js +17 -3
- package/lib/Danger.js +10 -8
- 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/LinkedValueUtils.js +5 -3
- package/lib/NativeMethodsMixin.js +6 -4
- package/lib/PooledClass.js +3 -1
- package/lib/React.js +1 -1
- package/lib/ReactCSSTransitionGroupChild.js +15 -8
- package/lib/ReactChildReconciler.js +15 -6
- package/lib/ReactClass.js +14 -13
- package/lib/ReactComponent.js +3 -6
- package/lib/ReactComponentEnvironment.js +3 -1
- package/lib/ReactComponentTreeDevtool.js +99 -16
- package/lib/ReactComponentTreeTestUtils.js +87 -0
- package/lib/ReactCompositeComponent.js +66 -106
- 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 +7 -1
- package/lib/ReactDOMEmptyComponent.js +9 -9
- package/lib/ReactDOMFactories.js +1 -1
- package/lib/ReactDOMInput.js +52 -16
- package/lib/ReactDOMOption.js +40 -26
- package/lib/ReactDOMSelect.js +3 -3
- package/lib/ReactDOMTextComponent.js +21 -20
- package/lib/ReactDOMTextarea.js +59 -32
- package/lib/ReactDOMTreeTraversal.js +18 -16
- package/lib/ReactDOMUnknownPropertyDevtool.js +65 -17
- package/lib/ReactDebugTool.js +132 -45
- package/lib/ReactDefaultInjection.js +2 -2
- package/lib/ReactElement.js +64 -25
- package/lib/ReactElementValidator.js +26 -81
- package/lib/ReactErrorUtils.js +15 -65
- package/lib/ReactEventListener.js +2 -2
- package/lib/ReactFragment.js +3 -1
- package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
- package/lib/{ReactNativeOperationHistoryDevtool.js → ReactHostOperationHistoryDevtool.js} +9 -4
- package/lib/ReactInjection.js +2 -2
- package/lib/ReactInstanceHandles.js +8 -6
- package/lib/ReactMount.js +25 -14
- package/lib/ReactMultiChild.js +31 -9
- 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 +7 -1
- package/lib/ReactNativeTagHandles.js +3 -1
- package/lib/ReactNativeTextComponent.js +10 -9
- package/lib/ReactNativeTreeTraversal.js +11 -11
- package/lib/ReactNodeTypes.js +5 -3
- package/lib/ReactNoop.js +76 -0
- package/lib/ReactOwner.js +4 -2
- package/lib/ReactPerf.js +83 -7
- package/lib/ReactPropTypes.js +23 -0
- package/lib/ReactReconcileTransaction.js +1 -1
- package/lib/ReactReconciler.js +12 -7
- package/lib/ReactServerRendering.js +8 -2
- package/lib/ReactSimpleEmptyComponent.js +4 -4
- package/lib/ReactTestMount.js +126 -0
- package/lib/ReactTestReconcileTransaction.js +100 -0
- package/lib/ReactTestRenderer.js +133 -0
- package/lib/ReactTestUtils.js +21 -10
- package/lib/ReactTransitionChildMapping.js +7 -1
- package/lib/ReactTransitionGroup.js +40 -6
- package/lib/ReactUpdateQueue.js +9 -1
- package/lib/ReactUpdates.js +9 -8
- package/lib/ReactVersion.js +1 -1
- package/lib/ResponderEventPlugin.js +8 -6
- package/lib/ResponderTouchHistoryStore.js +6 -4
- 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 +3 -1
- package/lib/accumulateInto.js +3 -1
- package/lib/checkReactTypeSpec.js +71 -0
- package/lib/createReactNativeComponentClass.js +2 -2
- package/lib/dangerousStyleValue.js +3 -1
- package/lib/escapeTextContentForBrowser.js +96 -12
- package/lib/findDOMNode.js +6 -4
- package/lib/findNodeHandle.js +5 -3
- package/lib/flattenChildren.js +13 -4
- package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
- package/lib/instantiateReactComponent.js +20 -17
- package/lib/onlyChild.js +3 -1
- package/lib/reactComponentExpect.js +3 -3
- package/lib/reactProdInvariant.js +38 -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
package/lib/ReactTestUtils.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 EventConstants = require('./EventConstants');
|
|
17
18
|
var EventPluginHub = require('./EventPluginHub');
|
|
@@ -25,6 +26,8 @@ var ReactElement = require('./ReactElement');
|
|
|
25
26
|
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
26
27
|
var ReactCompositeComponent = require('./ReactCompositeComponent');
|
|
27
28
|
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
29
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
30
|
+
var ReactReconciler = require('./ReactReconciler');
|
|
28
31
|
var ReactUpdates = require('./ReactUpdates');
|
|
29
32
|
var SyntheticEvent = require('./SyntheticEvent');
|
|
30
33
|
|
|
@@ -146,7 +149,7 @@ var ReactTestUtils = {
|
|
|
146
149
|
if (!inst) {
|
|
147
150
|
return [];
|
|
148
151
|
}
|
|
149
|
-
!ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') :
|
|
152
|
+
!ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : _prodInvariant('10') : void 0;
|
|
150
153
|
return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
|
|
151
154
|
},
|
|
152
155
|
|
|
@@ -166,7 +169,7 @@ var ReactTestUtils = {
|
|
|
166
169
|
var classList = className.split(/\s+/);
|
|
167
170
|
|
|
168
171
|
if (!Array.isArray(classNames)) {
|
|
169
|
-
!(classNames !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.scryRenderedDOMComponentsWithClass expects a
|
|
172
|
+
!(classNames !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument.') : _prodInvariant('11') : void 0;
|
|
170
173
|
classNames = classNames.split(/\s+/);
|
|
171
174
|
}
|
|
172
175
|
return classNames.every(function (name) {
|
|
@@ -311,9 +314,12 @@ ReactShallowRenderer.prototype.getMountedInstance = function () {
|
|
|
311
314
|
return this._instance ? this._instance._instance : null;
|
|
312
315
|
};
|
|
313
316
|
|
|
317
|
+
var nextDebugID = 1;
|
|
318
|
+
|
|
314
319
|
var NoopInternalComponent = function (element) {
|
|
315
320
|
this._renderedOutput = element;
|
|
316
321
|
this._currentElement = element;
|
|
322
|
+
this._debugID = nextDebugID++;
|
|
317
323
|
};
|
|
318
324
|
|
|
319
325
|
NoopInternalComponent.prototype = {
|
|
@@ -325,7 +331,7 @@ NoopInternalComponent.prototype = {
|
|
|
325
331
|
this._currentElement = element;
|
|
326
332
|
},
|
|
327
333
|
|
|
328
|
-
|
|
334
|
+
getHostNode: function () {
|
|
329
335
|
return undefined;
|
|
330
336
|
},
|
|
331
337
|
|
|
@@ -337,6 +343,11 @@ NoopInternalComponent.prototype = {
|
|
|
337
343
|
};
|
|
338
344
|
|
|
339
345
|
var ShallowComponentWrapper = function (element) {
|
|
346
|
+
// TODO: Consolidate with instantiateReactComponent
|
|
347
|
+
this._debugID = nextDebugID++;
|
|
348
|
+
var displayName = element.type.displayName || element.type.name || 'Unknown';
|
|
349
|
+
ReactInstrumentation.debugTool.onSetDisplayName(this._debugID, displayName);
|
|
350
|
+
|
|
340
351
|
this.construct(element);
|
|
341
352
|
};
|
|
342
353
|
_assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
|
|
@@ -354,8 +365,8 @@ ReactShallowRenderer.prototype.render = function (element, context) {
|
|
|
354
365
|
// conjunction with an inline-requires transform.
|
|
355
366
|
ReactDefaultInjection.inject();
|
|
356
367
|
|
|
357
|
-
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') :
|
|
358
|
-
!(typeof element.type !== 'string') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom
|
|
368
|
+
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : _prodInvariant('12', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : void 0;
|
|
369
|
+
!(typeof element.type !== 'string') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (%s). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead.', element.type) : _prodInvariant('13', element.type) : void 0;
|
|
359
370
|
|
|
360
371
|
if (!context) {
|
|
361
372
|
context = emptyObject;
|
|
@@ -377,16 +388,16 @@ ReactShallowRenderer.prototype.getRenderOutput = function () {
|
|
|
377
388
|
|
|
378
389
|
ReactShallowRenderer.prototype.unmount = function () {
|
|
379
390
|
if (this._instance) {
|
|
380
|
-
this._instance
|
|
391
|
+
ReactReconciler.unmountComponent(this._instance, false);
|
|
381
392
|
}
|
|
382
393
|
};
|
|
383
394
|
|
|
384
395
|
ReactShallowRenderer.prototype._render = function (element, transaction, context) {
|
|
385
396
|
if (this._instance) {
|
|
386
|
-
this._instance
|
|
397
|
+
ReactReconciler.receiveComponent(this._instance, element, transaction, context);
|
|
387
398
|
} else {
|
|
388
399
|
var instance = new ShallowComponentWrapper(element);
|
|
389
|
-
|
|
400
|
+
ReactReconciler.mountComponent(instance, transaction, null, null, context);
|
|
390
401
|
this._instance = instance;
|
|
391
402
|
}
|
|
392
403
|
};
|
|
@@ -402,7 +413,7 @@ ReactShallowRenderer.prototype._render = function (element, transaction, context
|
|
|
402
413
|
function makeSimulator(eventType) {
|
|
403
414
|
return function (domComponentOrNode, eventData) {
|
|
404
415
|
var node;
|
|
405
|
-
!!React.isValidElement(domComponentOrNode) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.Simulate expects a component instance and not a ReactElement.
|
|
416
|
+
!!React.isValidElement(domComponentOrNode) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.Simulate expects a component instance and not a ReactElement.TestUtils.Simulate will not work if you are using shallow rendering.') : _prodInvariant('14') : void 0;
|
|
406
417
|
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
|
|
407
418
|
node = findDOMNode(domComponentOrNode);
|
|
408
419
|
} else if (domComponentOrNode.tagName) {
|
|
@@ -19,12 +19,18 @@ var ReactTransitionChildMapping = {
|
|
|
19
19
|
* simple syntactic sugar around flattenChildren().
|
|
20
20
|
*
|
|
21
21
|
* @param {*} children `this.props.children`
|
|
22
|
+
* @param {number=} selfDebugID Optional debugID of the current internal instance.
|
|
22
23
|
* @return {object} Mapping of key to child
|
|
23
24
|
*/
|
|
24
|
-
getChildMapping: function (children) {
|
|
25
|
+
getChildMapping: function (children, selfDebugID) {
|
|
25
26
|
if (!children) {
|
|
26
27
|
return children;
|
|
27
28
|
}
|
|
29
|
+
|
|
30
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
31
|
+
return flattenChildren(children, selfDebugID);
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
return flattenChildren(children);
|
|
29
35
|
},
|
|
30
36
|
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
var _assign = require('object-assign');
|
|
15
15
|
|
|
16
16
|
var React = require('./React');
|
|
17
|
+
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
17
18
|
var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
|
|
18
19
|
|
|
19
20
|
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
* A basis for
|
|
23
|
+
* A basis for animations. When children are declaratively added or removed,
|
|
23
24
|
* special lifecycle hooks are called.
|
|
24
25
|
* See https://facebook.github.io/react/docs/animation.html#low-level-api-reacttransitiongroup
|
|
25
26
|
*/
|
|
@@ -40,6 +41,7 @@ var ReactTransitionGroup = React.createClass({
|
|
|
40
41
|
|
|
41
42
|
getInitialState: function () {
|
|
42
43
|
return {
|
|
44
|
+
// TODO: can we get useful debug information to show at this point?
|
|
43
45
|
children: ReactTransitionChildMapping.getChildMapping(this.props.children)
|
|
44
46
|
};
|
|
45
47
|
},
|
|
@@ -60,7 +62,12 @@ var ReactTransitionGroup = React.createClass({
|
|
|
60
62
|
},
|
|
61
63
|
|
|
62
64
|
componentWillReceiveProps: function (nextProps) {
|
|
63
|
-
var nextChildMapping
|
|
65
|
+
var nextChildMapping;
|
|
66
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
67
|
+
nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children, ReactInstanceMap.get(this)._debugID);
|
|
68
|
+
} else {
|
|
69
|
+
nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
|
|
70
|
+
}
|
|
64
71
|
var prevChildMapping = this.state.children;
|
|
65
72
|
|
|
66
73
|
this.setState({
|
|
@@ -116,7 +123,12 @@ var ReactTransitionGroup = React.createClass({
|
|
|
116
123
|
|
|
117
124
|
delete this.currentlyTransitioningKeys[key];
|
|
118
125
|
|
|
119
|
-
var currentChildMapping
|
|
126
|
+
var currentChildMapping;
|
|
127
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
128
|
+
currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children, ReactInstanceMap.get(this)._debugID);
|
|
129
|
+
} else {
|
|
130
|
+
currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
|
|
131
|
+
}
|
|
120
132
|
|
|
121
133
|
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
|
|
122
134
|
// This was removed before it had fully appeared. Remove it.
|
|
@@ -144,7 +156,12 @@ var ReactTransitionGroup = React.createClass({
|
|
|
144
156
|
|
|
145
157
|
delete this.currentlyTransitioningKeys[key];
|
|
146
158
|
|
|
147
|
-
var currentChildMapping
|
|
159
|
+
var currentChildMapping;
|
|
160
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
161
|
+
currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children, ReactInstanceMap.get(this)._debugID);
|
|
162
|
+
} else {
|
|
163
|
+
currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
|
|
164
|
+
}
|
|
148
165
|
|
|
149
166
|
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
|
|
150
167
|
// This was removed before it had fully entered. Remove it.
|
|
@@ -175,7 +192,12 @@ var ReactTransitionGroup = React.createClass({
|
|
|
175
192
|
|
|
176
193
|
delete this.currentlyTransitioningKeys[key];
|
|
177
194
|
|
|
178
|
-
var currentChildMapping
|
|
195
|
+
var currentChildMapping;
|
|
196
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
197
|
+
currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children, ReactInstanceMap.get(this)._debugID);
|
|
198
|
+
} else {
|
|
199
|
+
currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
|
|
200
|
+
}
|
|
179
201
|
|
|
180
202
|
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
|
|
181
203
|
// This entered again before it fully left. Add it again.
|
|
@@ -204,7 +226,19 @@ var ReactTransitionGroup = React.createClass({
|
|
|
204
226
|
childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
|
|
205
227
|
}
|
|
206
228
|
}
|
|
207
|
-
|
|
229
|
+
|
|
230
|
+
// Do not forward ReactTransitionGroup props to primitive DOM nodes
|
|
231
|
+
var props = _assign({}, this.props);
|
|
232
|
+
delete props.transitionLeave;
|
|
233
|
+
delete props.transitionName;
|
|
234
|
+
delete props.transitionAppear;
|
|
235
|
+
delete props.transitionEnter;
|
|
236
|
+
delete props.childFactory;
|
|
237
|
+
delete props.transitionLeaveTimeout;
|
|
238
|
+
delete props.transitionEnterTimeout;
|
|
239
|
+
delete props.component;
|
|
240
|
+
|
|
241
|
+
return React.createElement(this.props.component, props, childrenToRender);
|
|
208
242
|
}
|
|
209
243
|
});
|
|
210
244
|
|
package/lib/ReactUpdateQueue.js
CHANGED
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
15
17
|
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
18
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
16
19
|
var ReactUpdates = require('./ReactUpdates');
|
|
17
20
|
|
|
18
21
|
var invariant = require('fbjs/lib/invariant');
|
|
@@ -189,6 +192,11 @@ var ReactUpdateQueue = {
|
|
|
189
192
|
* @internal
|
|
190
193
|
*/
|
|
191
194
|
enqueueSetState: function (publicInstance, partialState) {
|
|
195
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
196
|
+
ReactInstrumentation.debugTool.onSetState();
|
|
197
|
+
process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
192
200
|
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
|
|
193
201
|
|
|
194
202
|
if (!internalInstance) {
|
|
@@ -207,7 +215,7 @@ var ReactUpdateQueue = {
|
|
|
207
215
|
},
|
|
208
216
|
|
|
209
217
|
validateCallback: function (callback, callerName) {
|
|
210
|
-
!(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a
|
|
218
|
+
!(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0;
|
|
211
219
|
}
|
|
212
220
|
|
|
213
221
|
};
|
package/lib/ReactUpdates.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 CallbackQueue = require('./CallbackQueue');
|
|
17
18
|
var PooledClass = require('./PooledClass');
|
|
@@ -30,7 +31,7 @@ var asapEnqueued = false;
|
|
|
30
31
|
var batchingStrategy = null;
|
|
31
32
|
|
|
32
33
|
function ensureInjected() {
|
|
33
|
-
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching
|
|
34
|
+
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
var NESTED_UPDATES = {
|
|
@@ -111,7 +112,7 @@ function mountOrderComparator(c1, c2) {
|
|
|
111
112
|
|
|
112
113
|
function runBatchedUpdates(transaction) {
|
|
113
114
|
var len = transaction.dirtyComponentsLength;
|
|
114
|
-
!(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to
|
|
115
|
+
!(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0;
|
|
115
116
|
|
|
116
117
|
// Since reconciling a component higher in the owner hierarchy usually (not
|
|
117
118
|
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
|
|
@@ -221,21 +222,21 @@ function enqueueUpdate(component) {
|
|
|
221
222
|
* if no updates are currently being performed.
|
|
222
223
|
*/
|
|
223
224
|
function asap(callback, context) {
|
|
224
|
-
!batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context
|
|
225
|
+
!batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0;
|
|
225
226
|
asapCallbackQueue.enqueue(callback, context);
|
|
226
227
|
asapEnqueued = true;
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
var ReactUpdatesInjection = {
|
|
230
231
|
injectReconcileTransaction: function (ReconcileTransaction) {
|
|
231
|
-
!ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') :
|
|
232
|
+
!ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0;
|
|
232
233
|
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
|
|
233
234
|
},
|
|
234
235
|
|
|
235
236
|
injectBatchingStrategy: function (_batchingStrategy) {
|
|
236
|
-
!_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') :
|
|
237
|
-
!(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') :
|
|
238
|
-
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') :
|
|
237
|
+
!_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0;
|
|
238
|
+
!(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0;
|
|
239
|
+
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0;
|
|
239
240
|
batchingStrategy = _batchingStrategy;
|
|
240
241
|
}
|
|
241
242
|
};
|
package/lib/ReactVersion.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 EventPluginUtils = require('./EventPluginUtils');
|
|
16
18
|
var EventPropagators = require('./EventPropagators');
|
|
@@ -45,11 +47,11 @@ var trackedTouchCount = 0;
|
|
|
45
47
|
*/
|
|
46
48
|
var previousActiveTouches = 0;
|
|
47
49
|
|
|
48
|
-
var changeResponder = function (nextResponderInst,
|
|
50
|
+
var changeResponder = function (nextResponderInst, blockHostResponder) {
|
|
49
51
|
var oldResponderInst = responderInst;
|
|
50
52
|
responderInst = nextResponderInst;
|
|
51
53
|
if (ResponderEventPlugin.GlobalResponderHandler !== null) {
|
|
52
|
-
ResponderEventPlugin.GlobalResponderHandler.onChange(oldResponderInst, nextResponderInst,
|
|
54
|
+
ResponderEventPlugin.GlobalResponderHandler.onChange(oldResponderInst, nextResponderInst, blockHostResponder);
|
|
53
55
|
}
|
|
54
56
|
};
|
|
55
57
|
|
|
@@ -342,7 +344,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
|
|
|
342
344
|
grantEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
|
|
343
345
|
|
|
344
346
|
EventPropagators.accumulateDirectDispatches(grantEvent);
|
|
345
|
-
var
|
|
347
|
+
var blockHostResponder = executeDirectDispatch(grantEvent) === true;
|
|
346
348
|
if (responderInst) {
|
|
347
349
|
|
|
348
350
|
var terminationRequestEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget);
|
|
@@ -358,7 +360,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
|
|
|
358
360
|
terminateEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
|
|
359
361
|
EventPropagators.accumulateDirectDispatches(terminateEvent);
|
|
360
362
|
extracted = accumulate(extracted, [grantEvent, terminateEvent]);
|
|
361
|
-
changeResponder(wantsResponderInst,
|
|
363
|
+
changeResponder(wantsResponderInst, blockHostResponder);
|
|
362
364
|
} else {
|
|
363
365
|
var rejectEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderReject, wantsResponderInst, nativeEvent, nativeEventTarget);
|
|
364
366
|
rejectEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
|
|
@@ -367,7 +369,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
|
|
|
367
369
|
}
|
|
368
370
|
} else {
|
|
369
371
|
extracted = accumulate(extracted, grantEvent);
|
|
370
|
-
changeResponder(wantsResponderInst,
|
|
372
|
+
changeResponder(wantsResponderInst, blockHostResponder);
|
|
371
373
|
}
|
|
372
374
|
return extracted;
|
|
373
375
|
}
|
|
@@ -433,7 +435,7 @@ var ResponderEventPlugin = {
|
|
|
433
435
|
trackedTouchCount += 1;
|
|
434
436
|
} else if (isEndish(topLevelType)) {
|
|
435
437
|
trackedTouchCount -= 1;
|
|
436
|
-
!(trackedTouchCount >= 0) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Ended a touch event which was not counted in trackedTouchCount.') :
|
|
438
|
+
!(trackedTouchCount >= 0) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Ended a touch event which was not counted in trackedTouchCount.') : _prodInvariant('132') : void 0;
|
|
437
439
|
}
|
|
438
440
|
|
|
439
441
|
ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent, nativeEventTarget);
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var EventPluginUtils = require('./EventPluginUtils');
|
|
15
17
|
|
|
16
18
|
var invariant = require('fbjs/lib/invariant');
|
|
@@ -88,7 +90,7 @@ var reinitializeTouchTrack = function (touchTrack, touch) {
|
|
|
88
90
|
|
|
89
91
|
var validateTouch = function (touch) {
|
|
90
92
|
var identifier = touch.identifier;
|
|
91
|
-
!(identifier != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch object is missing identifier') :
|
|
93
|
+
!(identifier != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch object is missing identifier') : _prodInvariant('133') : void 0;
|
|
92
94
|
if (identifier > MAX_TOUCH_BANK) {
|
|
93
95
|
console.warn('Touch identifier ' + identifier + ' is greater than maximum ' + 'supported ' + MAX_TOUCH_BANK + ' which causes performance issues ' + 'backfilling array locations for all of the indices.');
|
|
94
96
|
}
|
|
@@ -114,7 +116,7 @@ var recordMoveTouchData = function (touch) {
|
|
|
114
116
|
var touchTrack = touchBank[touch.identifier];
|
|
115
117
|
if (process.env.NODE_ENV !== 'production') {
|
|
116
118
|
validateTouch(touch);
|
|
117
|
-
!touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') :
|
|
119
|
+
!touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : _prodInvariant('134') : void 0;
|
|
118
120
|
}
|
|
119
121
|
touchTrack.touchActive = true;
|
|
120
122
|
touchTrack.previousPageX = touchTrack.currentPageX;
|
|
@@ -131,7 +133,7 @@ var recordEndTouchData = function (touch) {
|
|
|
131
133
|
var touchTrack = touchBank[touch.identifier];
|
|
132
134
|
if (process.env.NODE_ENV !== 'production') {
|
|
133
135
|
validateTouch(touch);
|
|
134
|
-
!touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') :
|
|
136
|
+
!touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : _prodInvariant('134') : void 0;
|
|
135
137
|
}
|
|
136
138
|
touchTrack.previousPageX = touchTrack.currentPageX;
|
|
137
139
|
touchTrack.previousPageY = touchTrack.currentPageY;
|
|
@@ -168,7 +170,7 @@ var ResponderTouchHistoryStore = {
|
|
|
168
170
|
if (process.env.NODE_ENV !== 'production') {
|
|
169
171
|
var activeTouchData = touchBank[touchHistory.indexOfSingleActiveTouch];
|
|
170
172
|
var foundActive = activeTouchData != null && !!activeTouchData.touchActive;
|
|
171
|
-
!foundActive ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot find single active touch') :
|
|
173
|
+
!foundActive ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot find single active touch') : _prodInvariant('135') : void 0;
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
}
|
package/lib/SimpleEventPlugin.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 EventListener = require('fbjs/lib/EventListener');
|
|
16
18
|
var EventPropagators = require('./EventPropagators');
|
|
@@ -594,7 +596,7 @@ var SimpleEventPlugin = {
|
|
|
594
596
|
EventConstructor = SyntheticClipboardEvent;
|
|
595
597
|
break;
|
|
596
598
|
}
|
|
597
|
-
!EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) :
|
|
599
|
+
!EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0;
|
|
598
600
|
var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
|
|
599
601
|
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
600
602
|
return event;
|
package/lib/SyntheticEvent.js
CHANGED
|
@@ -165,10 +165,9 @@ _assign(SyntheticEvent.prototype, {
|
|
|
165
165
|
this[shouldBeReleasedProperties[i]] = null;
|
|
166
166
|
}
|
|
167
167
|
if (process.env.NODE_ENV !== 'production') {
|
|
168
|
-
var noop = require('fbjs/lib/emptyFunction');
|
|
169
168
|
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
|
|
170
|
-
Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault',
|
|
171
|
-
Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation',
|
|
169
|
+
Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
|
|
170
|
+
Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
173
|
|