Socket
Socket
Sign inDemoInstall

react

Package Overview
Dependencies
Maintainers
7
Versions
1975
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react - npm Package Compare versions

Comparing version 15.2.0 to 15.2.1

lib/ReactDOMFiber.js

28

lib/accumulate.js

@@ -10,2 +10,3 @@ /**

* @providesModule accumulate
*
*/

@@ -28,21 +29,20 @@

!(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulate(...): Accumulated items must be not be null or undefined.') : _prodInvariant('29') : void 0;
if (current == null) {
return next;
} else {
// Both are not empty. Warning: Never call x.concat(y) when you are not
// certain that x is an Array (x could be a string with concat method).
var currentIsArray = Array.isArray(current);
var nextIsArray = Array.isArray(next);
if (currentIsArray) {
return current.concat(next);
} else {
if (nextIsArray) {
return [current].concat(next);
} else {
return [current, next];
}
}
}
// Both are not empty. Warning: Never call x.concat(y) when you are not
// certain that x is an Array (x could be a string with concat method).
if (Array.isArray(current)) {
return current.concat(next);
}
if (Array.isArray(next)) {
return [current].concat(next);
}
return [current, next];
}
module.exports = accumulate;

@@ -10,2 +10,3 @@ /**

* @providesModule accumulateInto
*
*/

@@ -20,3 +21,2 @@

/**
*
* Accumulates items that must not be null or undefined into the first one. This

@@ -36,2 +36,3 @@ * is used to conserve memory by avoiding array allocations, and thus sacrifices

!(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
if (current == null) {

@@ -43,11 +44,7 @@ return next;

// certain that x is an Array (x could be a string with concat method).
var currentIsArray = Array.isArray(current);
var nextIsArray = Array.isArray(next);
if (currentIsArray && nextIsArray) {
current.push.apply(current, next);
return current;
}
if (currentIsArray) {
if (Array.isArray(current)) {
if (Array.isArray(next)) {
current.push.apply(current, next);
return current;
}
current.push(next);

@@ -57,3 +54,3 @@ return current;

if (nextIsArray) {
if (Array.isArray(next)) {
// A bit too dangerous to mutate `next`.

@@ -60,0 +57,0 @@ return [current].concat(next);

@@ -10,2 +10,3 @@ /**

* @providesModule adler32
*
*/

@@ -12,0 +13,0 @@

@@ -16,3 +16,2 @@ /**

var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');

@@ -60,6 +59,9 @@

if (debugID !== null) {
componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID);
} else if (element !== null) {
componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element);
if (process.env.NODE_ENV !== 'production') {
var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
if (debugID !== null) {
componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID);
} else if (element !== null) {
componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element);
}
}

@@ -66,0 +68,0 @@

@@ -21,105 +21,7 @@ /**

var emptyFunction = require('fbjs/lib/emptyFunction');
var getMarkupWrap = require('fbjs/lib/getMarkupWrap');
var invariant = require('fbjs/lib/invariant');
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
/**
* Extracts the `nodeName` from a string of markup.
*
* NOTE: Extracting the `nodeName` does not require a regular expression match
* because we make assumptions about React-generated markup (i.e. there are no
* spaces surrounding the opening tag and there is at least one attribute).
*
* @param {string} markup String of markup.
* @return {string} Node name of the supplied markup.
* @see http://jsperf.com/extract-nodename
*/
function getNodeName(markup) {
return markup.substring(1, markup.indexOf(' '));
}
var Danger = {
/**
* Renders markup into an array of nodes. The markup is expected to render
* into a list of root nodes. Also, the length of `resultList` and
* `markupList` should be the same.
*
* @param {array<string>} markupList List of markup strings to render.
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
dangerouslyRenderMarkup: function (markupList) {
!ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString for server rendering.') : _prodInvariant('51') : void 0;
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
!markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : _prodInvariant('52') : void 0;
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
markupByNodeName[nodeName][i] = markupList[i];
}
var resultList = [];
var resultListAssignmentCount = 0;
for (nodeName in markupByNodeName) {
if (!markupByNodeName.hasOwnProperty(nodeName)) {
continue;
}
var markupListByNodeName = markupByNodeName[nodeName];
// This for-in loop skips the holes of the sparse array. The order of
// iteration should follow the order of assignment, which happens to match
// numerical index order, but we don't rely on that.
var resultIndex;
for (resultIndex in markupListByNodeName) {
if (markupListByNodeName.hasOwnProperty(resultIndex)) {
var markup = markupListByNodeName[resultIndex];
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
'$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
}
}
// Render each group of markup with similar wrapping `nodeName`.
var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
);
for (var j = 0; j < renderNodes.length; ++j) {
var renderNode = renderNodes[j];
if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
!!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : _prodInvariant('53') : void 0;
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
} else if (process.env.NODE_ENV !== 'production') {
console.error('Danger: Discarding unexpected node:', renderNode);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
!(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : _prodInvariant('54') : void 0;
!(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : _prodInvariant('55', markupList.length, resultList.length) : void 0;
return resultList;
},
/**
* Replaces a node with a string of markup at its current position within its

@@ -126,0 +28,0 @@ * parent. The markup must render into a single root node.

@@ -10,2 +10,3 @@ /**

* @providesModule deprecated
*
*/

@@ -46,3 +47,8 @@

// In particular, this is needed to support PropTypes
return _assign(newFn, fn);
_assign(newFn, fn);
// Flow is not smart enough to figure out that newFn is of the same type as
// fn. Since we don't want to lose out the type of the function, casting
// to any and force flow to use T.
return newFn;
}

@@ -49,0 +55,0 @@

@@ -28,3 +28,2 @@ /**

MUST_USE_PROPERTY: 0x1,
HAS_SIDE_EFFECTS: 0x2,
HAS_BOOLEAN_VALUE: 0x4,

@@ -88,3 +87,2 @@ HAS_NUMERIC_VALUE: 0x8,

mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),

@@ -95,4 +93,2 @@ hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),

};
!(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : _prodInvariant('49', propName) : void 0;
!(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0;

@@ -169,7 +165,2 @@

* Whether the property must be accessed and mutated as an object property.
* hasSideEffects:
* Whether or not setting a value causes side effects such as triggering
* resources to be loaded or text selection changes. If true, we read from
* the DOM before updating to ensure that the value is only set if it has
* changed.
* hasBooleanValue:

@@ -176,0 +167,0 @@ * Whether the property should be removed when set to a falsey value.

@@ -134,10 +134,5 @@ /**

} else if (propertyInfo.mustUseProperty) {
var propName = propertyInfo.propertyName;
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propertyInfo.propertyName] = value;
} else {

@@ -215,8 +210,5 @@ var attributeName = propertyInfo.attributeName;

if (propertyInfo.hasBooleanValue) {
// No HAS_SIDE_EFFECTS logic here, only `value` has it and is string.
node[propName] = false;
} else {
if (!propertyInfo.hasSideEffects || '' + node[propName] !== '') {
node[propName] = '';
}
node[propName] = '';
}

@@ -223,0 +215,0 @@ } else {

@@ -10,2 +10,3 @@ /**

* @providesModule flattenChildren
*
*/

@@ -15,3 +16,2 @@

var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
var KeyEscapeUtils = require('./KeyEscapeUtils');

@@ -29,10 +29,13 @@ var traverseAllChildren = require('./traverseAllChildren');

// We found a component instance.
var result = traverseContext;
var keyUnique = result[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
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;
if (traverseContext && typeof traverseContext === 'object') {
var result = traverseContext;
var keyUnique = result[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
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;
}
if (keyUnique && child != null) {
result[name] = child;
}
}
if (keyUnique && child != null) {
result[name] = child;
}
}

@@ -39,0 +42,0 @@

@@ -10,2 +10,3 @@ /**

* @providesModule forEachAccumulated
*
*/

@@ -23,3 +24,3 @@

var forEachAccumulated = function (arr, cb, scope) {
function forEachAccumulated(arr, cb, scope) {
if (Array.isArray(arr)) {

@@ -30,4 +31,4 @@ arr.forEach(cb, scope);

}
};
}
module.exports = forEachAccumulated;

@@ -10,2 +10,3 @@ /**

* @providesModule getIteratorFn
*
*/

@@ -12,0 +13,0 @@

@@ -75,10 +75,10 @@ /**

* @param {ReactNode} node
* @param {boolean} shouldHaveDebugID
* @return {object} A new instance of the element's constructor.
* @protected
*/
function instantiateReactComponent(node) {
function instantiateReactComponent(node, shouldHaveDebugID) {
var instance;
var isEmpty = node === null || node === false;
if (isEmpty) {
if (node === null || node === false) {
instance = ReactEmptyComponent.create(instantiateReactComponent);

@@ -122,6 +122,5 @@ } else if (typeof node === 'object') {

if (process.env.NODE_ENV !== 'production') {
var debugID = isEmpty ? 0 : nextDebugID++;
instance._debugID = debugID;
if (debugID !== 0) {
if (shouldHaveDebugID) {
var debugID = nextDebugID++;
instance._debugID = debugID;
var displayName = getDisplayName(instance);

@@ -133,2 +132,4 @@ ReactInstrumentation.debugTool.onSetDisplayName(debugID, displayName);

}
} else {
instance._debugID = 0;
}

@@ -135,0 +136,0 @@ }

@@ -10,2 +10,3 @@ /**

* @providesModule isTextInputElement
*
*/

@@ -39,5 +40,14 @@

var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
if (nodeName === 'input') {
return !!supportedInputTypes[elem.type];
}
if (nodeName === 'textarea') {
return true;
}
return false;
}
module.exports = isTextInputElement;

@@ -10,2 +10,3 @@ /**

* @providesModule KeyEscapeUtils
*
*/

@@ -18,3 +19,3 @@

*
* @param {*} key to be escaped.
* @param {string} key to be escaped.
* @return {string} the escaped key.

@@ -21,0 +22,0 @@ */

@@ -96,3 +96,3 @@ /**

* you give this may have a `poolSize` property, and will look for a
* prototypical `destructor` on instances (optional).
* prototypical `destructor` on instances.
*

@@ -99,0 +99,0 @@ * @param {Function} CopyConstructor Constructor that can be used to reset.

@@ -16,3 +16,2 @@ /**

var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
var instantiateReactComponent = require('./instantiateReactComponent');

@@ -28,6 +27,7 @@ var KeyEscapeUtils = require('./KeyEscapeUtils');

if (process.env.NODE_ENV !== 'production') {
var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
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;
}
if (child != null && keyUnique) {
childInstances[name] = instantiateReactComponent(child);
childInstances[name] = instantiateReactComponent(child, true);
}

@@ -104,3 +104,3 @@ }

// The child must be instantiated before it's mounted.
var nextChildInstance = instantiateReactComponent(nextElement);
var nextChildInstance = instantiateReactComponent(nextElement, true);
nextChildren[name] = nextChildInstance;

@@ -107,0 +107,0 @@ }

@@ -37,6 +37,2 @@ /**

};
// TODO: We need to do this awkward dance because TopLevelWrapper "never
// gets mounted" but its display name gets set in instantiateReactComponent
// before its debug ID is set to 0.
unmountedIDs[id] = true;
}

@@ -127,3 +123,2 @@ update(tree[id]);

});
delete unmountedIDs[id];
},

@@ -130,0 +125,0 @@ onMountRootComponent: function (id) {

@@ -26,3 +26,2 @@ /**

var ReactReconciler = require('./ReactReconciler');
var ReactUpdateQueue = require('./ReactUpdateQueue');

@@ -177,4 +176,6 @@ var checkReactTypeSpec = require('./checkReactTypeSpec');

var updateQueue = transaction.getUpdateQueue();
// Initialize the public class
var inst = this._constructComponent(publicProps, publicContext);
var inst = this._constructComponent(publicProps, publicContext, updateQueue);
var renderedElement;

@@ -208,3 +209,3 @@

inst.refs = emptyObject;
inst.updater = ReactUpdateQueue;
inst.updater = updateQueue;

@@ -257,7 +258,7 @@ this._instance = inst;

_constructComponent: function (publicProps, publicContext) {
_constructComponent: function (publicProps, publicContext, updateQueue) {
if (process.env.NODE_ENV !== 'production') {
ReactCurrentOwner.current = this;
try {
return this._constructComponentWithoutOwner(publicProps, publicContext);
return this._constructComponentWithoutOwner(publicProps, publicContext, updateQueue);
} finally {

@@ -267,7 +268,7 @@ ReactCurrentOwner.current = null;

} else {
return this._constructComponentWithoutOwner(publicProps, publicContext);
return this._constructComponentWithoutOwner(publicProps, publicContext, updateQueue);
}
},
_constructComponentWithoutOwner: function (publicProps, publicContext) {
_constructComponentWithoutOwner: function (publicProps, publicContext, updateQueue) {
var Component = this._currentElement.type;

@@ -281,3 +282,3 @@ var instanceOrElement;

}
instanceOrElement = new Component(publicProps, publicContext, ReactUpdateQueue);
instanceOrElement = new Component(publicProps, publicContext, updateQueue);
if (process.env.NODE_ENV !== 'production') {

@@ -296,3 +297,3 @@ if (this._debugID !== 0) {

}
instanceOrElement = Component(publicProps, publicContext, ReactUpdateQueue);
instanceOrElement = Component(publicProps, publicContext, updateQueue);
if (process.env.NODE_ENV !== 'production') {

@@ -313,2 +314,7 @@ if (this._debugID !== 0) {

} catch (e) {
if (process.env.NODE_ENV !== 'production') {
if (this._debugID !== 0) {
ReactInstrumentation.debugTool.onError();
}
}
// Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint

@@ -358,4 +364,6 @@ transaction.rollback(checkpoint);

this._renderedNodeType = ReactNodeTypes.getType(renderedElement);
var child = this._instantiateReactComponent(renderedElement);
var nodeType = ReactNodeTypes.getType(renderedElement);
this._renderedNodeType = nodeType;
var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
);
this._renderedComponent = child;

@@ -743,4 +751,6 @@ if (process.env.NODE_ENV !== 'production') {

this._renderedNodeType = ReactNodeTypes.getType(nextRenderedElement);
var child = this._instantiateReactComponent(nextRenderedElement);
var nodeType = ReactNodeTypes.getType(nextRenderedElement);
this._renderedNodeType = nodeType;
var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
);
this._renderedComponent = child;

@@ -747,0 +757,0 @@ if (process.env.NODE_ENV !== 'production') {

@@ -14,2 +14,5 @@ /**

var ReactInvalidSetStateWarningDevTool = require('./ReactInvalidSetStateWarningDevTool');
var ReactHostOperationHistoryDevtool = require('./ReactHostOperationHistoryDevtool');
var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');

@@ -24,14 +27,12 @@

function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
if (process.env.NODE_ENV !== 'production') {
eventHandlers.forEach(function (handler) {
try {
if (handler[handlerFunctionName]) {
handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
}
} catch (e) {
process.env.NODE_ENV !== 'production' ? warning(handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e + '\n' + e.stack) : void 0;
handlerDoesThrowForEvent[handlerFunctionName] = true;
eventHandlers.forEach(function (handler) {
try {
if (handler[handlerFunctionName]) {
handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
}
});
}
} catch (e) {
process.env.NODE_ENV !== 'production' ? warning(handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e + '\n' + e.stack) : void 0;
handlerDoesThrowForEvent[handlerFunctionName] = true;
}
});
}

@@ -73,28 +74,26 @@

function resetMeasurements() {
if (process.env.NODE_ENV !== 'production') {
var previousStartTime = currentFlushStartTime;
var previousMeasurements = currentFlushMeasurements || [];
var previousOperations = ReactHostOperationHistoryDevtool.getHistory();
var previousStartTime = currentFlushStartTime;
var previousMeasurements = currentFlushMeasurements || [];
var previousOperations = ReactHostOperationHistoryDevtool.getHistory();
if (!isProfiling || currentFlushNesting === 0) {
currentFlushStartTime = null;
currentFlushMeasurements = null;
clearHistory();
return;
}
if (currentFlushNesting === 0) {
currentFlushStartTime = null;
currentFlushMeasurements = null;
clearHistory();
return;
}
if (previousMeasurements.length || previousOperations.length) {
var registeredIDs = ReactComponentTreeDevtool.getRegisteredIDs();
flushHistory.push({
duration: performanceNow() - previousStartTime,
measurements: previousMeasurements || [],
operations: previousOperations || [],
treeSnapshot: getTreeSnapshot(registeredIDs)
});
}
if (previousMeasurements.length || previousOperations.length) {
var registeredIDs = ReactComponentTreeDevtool.getRegisteredIDs();
flushHistory.push({
duration: performanceNow() - previousStartTime,
measurements: previousMeasurements || [],
operations: previousOperations || [],
treeSnapshot: getTreeSnapshot(registeredIDs)
});
}
clearHistory();
currentFlushStartTime = performanceNow();
currentFlushMeasurements = [];
}
clearHistory();
currentFlushStartTime = performanceNow();
currentFlushMeasurements = [];
}

@@ -107,3 +106,3 @@

function beginLifeCycleTimer(debugID, timerType) {
if (!isProfiling || currentFlushNesting === 0) {
if (currentFlushNesting === 0) {
return;

@@ -119,11 +118,13 @@ }

function endLifeCycleTimer(debugID, timerType) {
if (!isProfiling || currentFlushNesting === 0) {
if (currentFlushNesting === 0) {
return;
}
process.env.NODE_ENV !== 'production' ? warning(currentTimerType === timerType, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
currentFlushMeasurements.push({
timerType: timerType,
instanceID: debugID,
duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration
});
if (isProfiling) {
currentFlushMeasurements.push({
timerType: timerType,
instanceID: debugID,
duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration
});
}
currentTimerStartTime = null;

@@ -180,21 +181,19 @@ currentTimerNestedFlushDuration = null;

beginProfiling: function () {
if (process.env.NODE_ENV !== 'production') {
if (isProfiling) {
return;
}
if (isProfiling) {
return;
}
isProfiling = true;
flushHistory.length = 0;
resetMeasurements();
}
isProfiling = true;
flushHistory.length = 0;
resetMeasurements();
ReactDebugTool.addDevtool(ReactHostOperationHistoryDevtool);
},
endProfiling: function () {
if (process.env.NODE_ENV !== 'production') {
if (!isProfiling) {
return;
}
if (!isProfiling) {
return;
}
isProfiling = false;
resetMeasurements();
}
isProfiling = false;
resetMeasurements();
ReactDebugTool.removeDevtool(ReactHostOperationHistoryDevtool);
},

@@ -205,15 +204,11 @@ getFlushHistory: function () {

onBeginFlush: function () {
if (process.env.NODE_ENV !== 'production') {
currentFlushNesting++;
resetMeasurements();
pauseCurrentLifeCycleTimer();
}
currentFlushNesting++;
resetMeasurements();
pauseCurrentLifeCycleTimer();
emitEvent('onBeginFlush');
},
onEndFlush: function () {
if (process.env.NODE_ENV !== 'production') {
resetMeasurements();
currentFlushNesting--;
resumeCurrentLifeCycleTimer();
}
resetMeasurements();
currentFlushNesting--;
resumeCurrentLifeCycleTimer();
emitEvent('onEndFlush');

@@ -224,11 +219,7 @@ },

emitEvent('onBeginLifeCycleTimer', debugID, timerType);
if (process.env.NODE_ENV !== 'production') {
beginLifeCycleTimer(debugID, timerType);
}
beginLifeCycleTimer(debugID, timerType);
},
onEndLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
if (process.env.NODE_ENV !== 'production') {
endLifeCycleTimer(debugID, timerType);
}
endLifeCycleTimer(debugID, timerType);
emitEvent('onEndLifeCycleTimer', debugID, timerType);

@@ -244,2 +235,8 @@ },

},
onError: function (debugID) {
if (currentTimerDebugID != null) {
endLifeCycleTimer(currentTimerDebugID, currentTimerType);
}
emitEvent('onError', debugID);
},
onBeginProcessingChildContext: function () {

@@ -264,2 +261,3 @@ emitEvent('onBeginProcessingChildContext');

checkDebugID(debugID);
childDebugIDs.forEach(checkDebugID);
emitEvent('onSetChildren', debugID, childDebugIDs);

@@ -308,15 +306,9 @@ },

if (process.env.NODE_ENV !== 'production') {
var ReactInvalidSetStateWarningDevTool = require('./ReactInvalidSetStateWarningDevTool');
var ReactHostOperationHistoryDevtool = require('./ReactHostOperationHistoryDevtool');
var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool);
ReactDebugTool.addDevtool(ReactComponentTreeDevtool);
ReactDebugTool.addDevtool(ReactHostOperationHistoryDevtool);
var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
if (/[?&]react_perf\b/.test(url)) {
ReactDebugTool.beginProfiling();
}
ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool);
ReactDebugTool.addDevtool(ReactComponentTreeDevtool);
var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
if (/[?&]react_perf\b/.test(url)) {
ReactDebugTool.beginProfiling();
}
module.exports = ReactDebugTool;

@@ -145,3 +145,3 @@ /**

if (voidElementTags[component._tag]) {
!(props.children == null && props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s is a void element tag and must not have `children` or use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : _prodInvariant('59', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : void 0;
!(props.children == null && props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : _prodInvariant('137', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : void 0;
}

@@ -148,0 +148,0 @@ if (props.dangerouslySetInnerHTML != null) {

@@ -14,2 +14,3 @@ /**

var ReactDOMNullInputValuePropDevtool = require('./ReactDOMNullInputValuePropDevtool');
var ReactDOMUnknownPropertyDevtool = require('./ReactDOMUnknownPropertyDevtool');

@@ -24,14 +25,12 @@ var ReactDebugTool = require('./ReactDebugTool');

function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
if (process.env.NODE_ENV !== 'production') {
eventHandlers.forEach(function (handler) {
try {
if (handler[handlerFunctionName]) {
handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
}
} catch (e) {
process.env.NODE_ENV !== 'production' ? warning(handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e + '\n' + e.stack) : void 0;
handlerDoesThrowForEvent[handlerFunctionName] = true;
eventHandlers.forEach(function (handler) {
try {
if (handler[handlerFunctionName]) {
handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
}
});
}
} catch (e) {
process.env.NODE_ENV !== 'production' ? warning(handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e + '\n' + e.stack) : void 0;
handlerDoesThrowForEvent[handlerFunctionName] = true;
}
});
}

@@ -68,3 +67,4 @@

ReactDOMDebugTool.addDevtool(ReactDOMUnknownPropertyDevtool);
ReactDOMDebugTool.addDevtool(ReactDOMNullInputValuePropDevtool);
module.exports = ReactDOMDebugTool;

@@ -28,3 +28,2 @@ /**

var didWarnCheckedLink = false;
var didWarnValueNull = false;
var didWarnValueDefaultValue = false;

@@ -42,10 +41,2 @@ var didWarnCheckedDefaultChecked = false;

function warnIfValueIsNull(props) {
if (props != null && props.value === null && !didWarnValueNull) {
process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `input` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
didWarnValueNull = true;
}
}
function isControlled(props) {

@@ -114,3 +105,2 @@ var usesChecked = props.type === 'checkbox' || props.type === 'radio';

}
warnIfValueIsNull(props);
}

@@ -135,4 +125,2 @@

if (process.env.NODE_ENV !== 'production') {
warnIfValueIsNull(props);
var controlled = isControlled(props);

@@ -180,7 +168,17 @@ var owner = inst._currentElement._owner;

postMountWrapper: function (inst) {
var props = inst._currentElement.props;
// This is in postMount because we need access to the DOM node, which is not
// available until after the component has mounted.
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
node.value = node.value; // Detach value from defaultValue
// Detach value from defaultValue. We won't do anything if we're working on
// submit or reset inputs as those values & defaultValues are linked. They
// are not resetable nodes so this operation doesn't matter and actually
// removes browser-default values (eg "Submit Query") when no value is
// provided.
if (props.type !== 'submit' && props.type !== 'reset') {
node.value = node.value;
}
// Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug

@@ -192,6 +190,10 @@ // this is needed to work around a chrome bug where setting defaultChecked

var name = node.name;
node.name = undefined;
if (name !== '') {
node.name = '';
}
node.defaultChecked = !node.defaultChecked;
node.defaultChecked = !node.defaultChecked;
node.name = name;
if (name !== '') {
node.name = name;
}
}

@@ -198,0 +200,0 @@ };

@@ -14,4 +14,9 @@ /**

var ReactDOMDebugTool = require('./ReactDOMDebugTool');
var debugTool = null;
module.exports = { debugTool: ReactDOMDebugTool };
if (process.env.NODE_ENV !== 'production') {
var ReactDOMDebugTool = require('./ReactDOMDebugTool');
debugTool = ReactDOMDebugTool;
}
module.exports = { debugTool: debugTool };

@@ -24,3 +24,2 @@ /**

var didWarnValueLink = false;
var didWarnValueNull = false;
var didWarnValueDefaultValue = false;

@@ -51,10 +50,2 @@

function warnIfValueIsNull(props) {
if (props != null && props.value === null && !didWarnValueNull) {
process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `select` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
didWarnValueNull = true;
}
}
var valuePropNames = ['value', 'defaultValue'];

@@ -151,3 +142,2 @@

checkSelectPropTypes(inst, props);
warnIfValueIsNull(props);
}

@@ -178,5 +168,2 @@

var props = inst._currentElement.props;
if (process.env.NODE_ENV !== 'production') {
warnIfValueIsNull(props);
}

@@ -183,0 +170,0 @@ // After the initial mount, we control selected-ness manually so don't pass

@@ -26,3 +26,2 @@ /**

var didWarnValueLink = false;
var didWarnValueNull = false;
var didWarnValDefaultVal = false;

@@ -37,10 +36,2 @@

function warnIfValueIsNull(props) {
if (props != null && props.value === null && !didWarnValueNull) {
process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `textarea` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
didWarnValueNull = true;
}
}
/**

@@ -91,3 +82,2 @@ * Implements a <textarea> host component that allows setting `value`, and

}
warnIfValueIsNull(props);
}

@@ -131,6 +121,2 @@

if (process.env.NODE_ENV !== 'production') {
warnIfValueIsNull(props);
}
var node = ReactDOMComponentTree.getNodeFromInstance(inst);

@@ -137,0 +123,0 @@ var value = LinkedValueUtils.getValue(props);

@@ -10,2 +10,3 @@ /**

* @providesModule ReactFeatureFlags
*
*/

@@ -12,0 +13,0 @@

@@ -14,4 +14,9 @@ /**

var ReactDebugTool = require('./ReactDebugTool');
var debugTool = null;
module.exports = { debugTool: ReactDebugTool };
if (process.env.NODE_ENV !== 'production') {
var ReactDebugTool = require('./ReactDebugTool');
debugTool = ReactDebugTool;
}
module.exports = { debugTool: debugTool };

@@ -25,2 +25,3 @@ /**

var ReactFeatureFlags = require('./ReactFeatureFlags');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactInstrumentation = require('./ReactInstrumentation');

@@ -251,5 +252,5 @@ var ReactMarkupChecksum = require('./ReactMarkupChecksum');

*/
_updateRootComponent: function (prevComponent, nextElement, container, callback) {
_updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) {
ReactMount.scrollMonitor(container, function () {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext);
if (callback) {

@@ -272,6 +273,2 @@ ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);

_renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onBeginFlush();
}
// Various parts of our code (such as ReactCompositeComponent's

@@ -285,10 +282,4 @@ // _renderValidatedComponent) assume that calls to render aren't nested;

ReactBrowserEventEmitter.ensureScrollValueMonitoring();
var componentInstance = instantiateReactComponent(nextElement);
var componentInstance = instantiateReactComponent(nextElement, false);
if (process.env.NODE_ENV !== 'production') {
// Mute future events from the top level wrapper.
// It is an implementation detail that devtools should not know about.
componentInstance._debugID = 0;
}
// The initial render is synchronous but any updates that happen during

@@ -306,3 +297,2 @@ // rendering, in componentWillMount or componentDidMount, will be batched

ReactInstrumentation.debugTool.onMountRootComponent(componentInstance._renderedComponent._debugID);
ReactInstrumentation.debugTool.onEndFlush();
}

@@ -327,3 +317,3 @@

renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
!(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;
!(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;
return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);

@@ -342,2 +332,10 @@ },

var nextContext;
if (parentComponent) {
var parentInst = ReactInstanceMap.get(parentComponent);
nextContext = parentInst._processChildContext(parentInst._context);
} else {
nextContext = emptyObject;
}
var prevComponent = getTopLevelWrapperInContainer(container);

@@ -353,3 +351,3 @@

};
ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback);
return publicInst;

@@ -381,3 +379,3 @@ } else {

var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance();
if (callback) {

@@ -384,0 +382,0 @@ callback.call(component);

@@ -161,5 +161,10 @@ /**

setChildrenForInstrumentation = function (children) {
ReactInstrumentation.debugTool.onSetChildren(getDebugID(this), children ? Object.keys(children).map(function (key) {
return children[key]._debugID;
}) : []);
var debugID = getDebugID(this);
// TODO: React Native empty components are also multichild.
// This means they still get into this method but don't have _debugID.
if (debugID !== 0) {
ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) {
return children[key]._debugID;
}) : []);
}
};

@@ -166,0 +171,0 @@ }

@@ -92,3 +92,3 @@ /**

if (shouldUpdateReactComponent(prevElement, nextElement)) {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextWrappedElement);
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextWrappedElement, emptyObject);
if (callback) {

@@ -110,15 +110,5 @@ ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);

var instance = instantiateReactComponent(nextWrappedElement);
var instance = instantiateReactComponent(nextWrappedElement, false);
ReactNativeMount._instancesByContainerID[containerTag] = instance;
if (process.env.NODE_ENV !== 'production') {
// Mute future events from the top level wrapper.
// It is an implementation detail that devtools should not know about.
instance._debugID = 0;
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onBeginFlush();
}
}
// The initial render is synchronous but any updates that happen during

@@ -132,3 +122,2 @@ // rendering, in componentWillMount or componentDidMount, will be batched

ReactInstrumentation.debugTool.onMountRootComponent(instance._renderedComponent._debugID);
ReactInstrumentation.debugTool.onEndFlush();
}

@@ -135,0 +124,0 @@ var component = instance.getPublicInstance();

@@ -19,2 +19,4 @@ /**

var Transaction = require('./Transaction');
var ReactInstrumentation = require('./ReactInstrumentation');
var ReactUpdateQueue = require('./ReactUpdateQueue');

@@ -48,2 +50,9 @@ /**

if (process.env.NODE_ENV !== 'production') {
TRANSACTION_WRAPPERS.push({
initialize: ReactInstrumentation.debugTool.onBeginFlush,
close: ReactInstrumentation.debugTool.onEndFlush
});
}
/**

@@ -89,2 +98,9 @@ * Currently:

/**
* @return {object} The queue to collect React async events.
*/
getUpdateQueue: function () {
return ReactUpdateQueue;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this

@@ -91,0 +107,0 @@ * instance to be reused.

@@ -10,2 +10,3 @@ /**

* @providesModule ReactNodeTypes
*
*/

@@ -12,0 +13,0 @@

@@ -27,4 +27,55 @@ /**

var TERMINAL_TAG = 99;
var instanceCounter = 0;
function recursivelyAppendChildren(flatArray, child) {
if (!child) {
return;
}
if (child.tag === TERMINAL_TAG) {
flatArray.push(child);
} else {
var node = child;
do {
recursivelyAppendChildren(flatArray, node.output);
} while (node = node.sibling);
}
}
function flattenChildren(children) {
var flatArray = [];
recursivelyAppendChildren(flatArray, children);
return flatArray;
}
var NoopRenderer = ReactFiberReconciler({
createHostInstance: function () {},
updateContainer: function (containerInfo, children) {
console.log('Update container #' + containerInfo.rootID);
containerInfo.children = flattenChildren(children);
},
createInstance: function (type, props, children) {
console.log('Create instance #' + instanceCounter);
var inst = {
tag: TERMINAL_TAG,
id: instanceCounter++,
type: type,
children: flattenChildren(children)
};
// Hide from unit tests
Object.defineProperty(inst, 'tag', { value: inst.tag, enumerable: false });
Object.defineProperty(inst, 'id', { value: inst.id, enumerable: false });
return inst;
},
prepareUpdate: function (instance, oldProps, newProps, children) {
console.log('Prepare for update on #' + instance.id);
return true;
},
commitUpdate: function (instance, oldProps, newProps, children) {
console.log('Commit update on #' + instance.id);
instance.children = flattenChildren(children);
},
deleteInstance: function (instance) {
console.log('Delete #' + instance.id);
},
scheduleHighPriCallback: function (callback) {

@@ -38,6 +89,16 @@ scheduledHighPriCallback = callback;

var rootContainer = { rootID: 0, children: [] };
var root = null;
var ReactNoop = {
root: rootContainer,
render: function (element) {
NoopRenderer.mountNewRoot(element);
if (!root) {
root = NoopRenderer.mountContainer(element, rootContainer);
} else {
NoopRenderer.updateContainer(element, root);
}
},

@@ -75,2 +136,38 @@ flushHighPri: function () {

ReactNoop.flushLowPri();
},
// Logs the current state of the tree.
dumpTree: function () {
if (!root) {
console.log('Nothing rendered yet.');
return;
}
function logHostInstances(children, depth) {
for (var i = 0; i < children.length; i++) {
var child = children[i];
console.log(' '.repeat(depth) + '- ' + child.type + '#' + child.id);
logHostInstances(child.children, depth + 1);
}
}
function logContainer(container, depth) {
console.log(' '.repeat(depth) + '- [root#' + container.rootID + ']');
logHostInstances(container.children, depth + 1);
}
function logFiber(fiber, depth) {
console.log(' '.repeat(depth) + '- ' + (fiber.type ? fiber.type.name || fiber.type : '[root]'), '[' + fiber.pendingWorkPriority + (fiber.pendingProps ? '*' : '') + ']');
if (fiber.child) {
logFiber(fiber.child, depth + 1);
}
if (fiber.sibling) {
logFiber(fiber.sibling, depth);
}
}
console.log('HOST INSTANCES:');
logContainer(rootContainer, 0);
console.log('FIBERS:');
logFiber(root.stateNode.current, 0);
}

@@ -77,0 +174,0 @@ };

@@ -16,5 +16,6 @@ /**

function warnTDZ(publicInstance, callerName) {
function warnNoop(publicInstance, callerName) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : void 0;
var constructor = publicInstance.constructor;
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
}

@@ -63,3 +64,3 @@ }

enqueueForceUpdate: function (publicInstance) {
warnTDZ(publicInstance, 'forceUpdate');
warnNoop(publicInstance, 'forceUpdate');
},

@@ -79,3 +80,3 @@

enqueueReplaceState: function (publicInstance, completeState) {
warnTDZ(publicInstance, 'replaceState');
warnNoop(publicInstance, 'replaceState');
},

@@ -94,3 +95,3 @@

enqueueSetState: function (publicInstance, partialState) {
warnTDZ(publicInstance, 'setState');
warnNoop(publicInstance, 'setState');
}

@@ -97,0 +98,0 @@ };

@@ -10,2 +10,3 @@ /**

* @providesModule reactProdInvariant
*
*/

@@ -12,0 +13,0 @@ 'use strict';

@@ -20,3 +20,5 @@ /**

var ReactInputSelection = require('./ReactInputSelection');
var ReactInstrumentation = require('./ReactInstrumentation');
var Transaction = require('./Transaction');
var ReactUpdateQueue = require('./ReactUpdateQueue');

@@ -91,2 +93,9 @@ /**

if (process.env.NODE_ENV !== 'production') {
TRANSACTION_WRAPPERS.push({
initialize: ReactInstrumentation.debugTool.onBeginFlush,
close: ReactInstrumentation.debugTool.onEndFlush
});
}
/**

@@ -138,2 +147,9 @@ * Currently:

/**
* @return {object} The queue to collect React async events.
*/
getUpdateQueue: function () {
return ReactUpdateQueue;
},
/**
* Save current transaction state -- if the return value from this method is

@@ -140,0 +156,0 @@ * passed to `rollback`, the transaction will be reset to that state.

@@ -41,10 +41,6 @@ /**

return transaction.perform(function () {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onBeginFlush();
}
var componentInstance = instantiateReactComponent(element);
var componentInstance = instantiateReactComponent(element, true);
var markup = ReactReconciler.mountComponent(componentInstance, transaction, null, ReactDOMContainerInfo(), emptyObject);
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onUnmountComponent(componentInstance._debugID);
ReactInstrumentation.debugTool.onEndFlush();
}

@@ -51,0 +47,0 @@ if (!makeStaticMarkup) {

@@ -18,2 +18,4 @@ /**

var Transaction = require('./Transaction');
var ReactInstrumentation = require('./ReactInstrumentation');
var ReactServerUpdateQueue = require('./ReactServerUpdateQueue');

@@ -27,2 +29,9 @@ /**

if (process.env.NODE_ENV !== 'production') {
TRANSACTION_WRAPPERS.push({
initialize: ReactInstrumentation.debugTool.onBeginFlush,
close: ReactInstrumentation.debugTool.onEndFlush
});
}
var noopCallbackQueue = {

@@ -40,2 +49,3 @@ enqueue: function () {}

this.useCreateElement = false;
this.updateQueue = new ReactServerUpdateQueue(this);
}

@@ -62,2 +72,9 @@

/**
* @return {object} The queue to collect React async events.
*/
getUpdateQueue: function () {
return this.updateQueue;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this

@@ -64,0 +81,0 @@ * instance to be reused.

@@ -99,14 +99,4 @@ /**

var instance = instantiateReactComponent(nextWrappedElement);
var instance = instantiateReactComponent(nextWrappedElement, false);
if (process.env.NODE_ENV !== 'production') {
// Mute future events from the top level wrapper.
// It is an implementation detail that devtools should not know about.
instance._debugID = 0;
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onBeginFlush();
}
}
// The initial render is synchronous but any updates that happen during

@@ -120,3 +110,2 @@ // rendering, in componentWillMount or componentDidMount, will be batched

ReactInstrumentation.debugTool.onMountRootComponent(instance._renderedComponent._debugID);
ReactInstrumentation.debugTool.onEndFlush();
}

@@ -123,0 +112,0 @@ return new ReactTestInstance(instance);

@@ -19,2 +19,3 @@ /**

var Transaction = require('./Transaction');
var ReactUpdateQueue = require('./ReactUpdateQueue');

@@ -88,2 +89,9 @@ /**

/**
* @return {object} The queue to collect React async events.
*/
getUpdateQueue: function () {
return ReactUpdateQueue;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this

@@ -90,0 +98,0 @@ * instance to be reused.

@@ -239,2 +239,3 @@ /**

delete props.transitionEnterTimeout;
delete props.transitionAppearTimeout;
delete props.component;

@@ -241,0 +242,0 @@

@@ -212,4 +212,6 @@ /**

enqueueElementInternal: function (internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueElementInternal: function (internalInstance, nextElement, nextContext) {
internalInstance._pendingElement = nextElement;
// TODO: introduce _pendingContext instead of setting it directly.
internalInstance._context = nextContext;
enqueueUpdate(internalInstance);

@@ -216,0 +218,0 @@ },

@@ -20,3 +20,2 @@ /**

var ReactFeatureFlags = require('./ReactFeatureFlags');
var ReactInstrumentation = require('./ReactInstrumentation');
var ReactReconciler = require('./ReactReconciler');

@@ -168,6 +167,2 @@ var Transaction = require('./Transaction');

var flushBatchedUpdates = function () {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onBeginFlush();
}
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents

@@ -192,6 +187,2 @@ // array and perform any updates enqueued by mount-ready handlers (i.e.,

}
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onEndFlush();
}
};

@@ -209,3 +200,3 @@

// verify that that's the case. (This is called by each top-level update
// function, like setProps, setState, forceUpdate, etc.; creation and
// function, like setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)

@@ -212,0 +203,0 @@

@@ -14,2 +14,2 @@ /**

module.exports = '15.2.0';
module.exports = '15.2.1';

@@ -441,3 +441,3 @@ /**

ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent, nativeEventTarget);
ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent);

@@ -444,0 +444,0 @@ var extracted = canTriggerTransfer(topLevelType, targetInst, nativeEvent) ? setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) : null;

@@ -10,2 +10,3 @@ /**

* @providesModule ResponderTouchHistoryStore
*
*/

@@ -20,26 +21,18 @@

var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
var isEndish = EventPluginUtils.isEndish;
var isMoveish = EventPluginUtils.isMoveish;
var isStartish = EventPluginUtils.isStartish;
var isEndish = EventPluginUtils.isEndish;
var MAX_TOUCH_BANK = 20;
/**
* Touch position/time tracking information by touchID. Typically, we'll only
* see IDs with a range of 1-20 (they are recycled when touches end and then
* start again). This data is commonly needed by many different interaction
* logic modules so precomputing it is very helpful to do once.
* Each touch object in `touchBank` is of the following form:
* { touchActive: boolean,
* startTimeStamp: number,
* startPageX: number,
* startPageY: number,
* currentPageX: number,
* currentPageY: number,
* currentTimeStamp: number
* }
* Tracks the position and time of each active touch by `touch.identifier`. We
* should typically only see IDs in the range of 1-20 because IDs get recycled
* when touches end and start again.
*/
var MAX_TOUCH_BANK = 20;
var touchBank = [];
var touchHistory = {
touchBank: [],
touchBank: touchBank,
numberActiveTouches: 0,

@@ -53,3 +46,3 @@ // If there is only one active touch, we remember its location. This prevents

var timestampForTouch = function (touch) {
function timestampForTouch(touch) {
// The legacy internal implementation provides "timeStamp", which has been

@@ -59,3 +52,3 @@ // renamed to "timestamp". Let both work for now while we iron it out

return touch.timeStamp || touch.timestamp;
};
}

@@ -65,10 +58,9 @@ /**

* include a built in velocity computation that can be reused globally.
* @param {Touch} touch Native touch object.
*/
var initializeTouchData = function (touch) {
function createTouchRecord(touch) {
return {
touchActive: true,
startTimeStamp: timestampForTouch(touch),
startPageX: touch.pageX,
startPageY: touch.pageY,
startTimeStamp: timestampForTouch(touch),
currentPageX: touch.pageX,

@@ -81,81 +73,91 @@ currentPageY: touch.pageY,

};
};
}
var reinitializeTouchTrack = function (touchTrack, touch) {
touchTrack.touchActive = true;
touchTrack.startTimeStamp = timestampForTouch(touch);
touchTrack.startPageX = touch.pageX;
touchTrack.startPageY = touch.pageY;
touchTrack.currentPageX = touch.pageX;
touchTrack.currentPageY = touch.pageY;
touchTrack.currentTimeStamp = timestampForTouch(touch);
touchTrack.previousPageX = touch.pageX;
touchTrack.previousPageY = touch.pageY;
touchTrack.previousTimeStamp = timestampForTouch(touch);
};
function resetTouchRecord(touchRecord, touch) {
touchRecord.touchActive = true;
touchRecord.startPageX = touch.pageX;
touchRecord.startPageY = touch.pageY;
touchRecord.startTimeStamp = timestampForTouch(touch);
touchRecord.currentPageX = touch.pageX;
touchRecord.currentPageY = touch.pageY;
touchRecord.currentTimeStamp = timestampForTouch(touch);
touchRecord.previousPageX = touch.pageX;
touchRecord.previousPageY = touch.pageY;
touchRecord.previousTimeStamp = timestampForTouch(touch);
}
var validateTouch = function (touch) {
var identifier = touch.identifier;
!(identifier != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch object is missing identifier') : _prodInvariant('133') : void 0;
if (identifier > MAX_TOUCH_BANK) {
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.');
}
};
function getTouchIdentifier(_ref) {
var identifier = _ref.identifier;
var recordStartTouchData = function (touch) {
var touchBank = touchHistory.touchBank;
var identifier = touch.identifier;
var touchTrack = touchBank[identifier];
if (process.env.NODE_ENV !== 'production') {
validateTouch(touch);
}
if (touchTrack) {
reinitializeTouchTrack(touchTrack, touch);
!(identifier != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch object is missing identifier.') : _prodInvariant('138') : void 0;
process.env.NODE_ENV !== 'production' ? warning(identifier <= MAX_TOUCH_BANK, 'Touch identifier %s is greater than maximum supported %s which causes ' + 'performance issues backfilling array locations for all of the indices.', identifier, MAX_TOUCH_BANK) : void 0;
return identifier;
}
function recordTouchStart(touch) {
var identifier = getTouchIdentifier(touch);
var touchRecord = touchBank[identifier];
if (touchRecord) {
resetTouchRecord(touchRecord, touch);
} else {
touchBank[touch.identifier] = initializeTouchData(touch);
touchBank[identifier] = createTouchRecord(touch);
}
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
};
}
var recordMoveTouchData = function (touch) {
var touchBank = touchHistory.touchBank;
var touchTrack = touchBank[touch.identifier];
if (process.env.NODE_ENV !== 'production') {
validateTouch(touch);
!touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : _prodInvariant('134') : void 0;
function recordTouchMove(touch) {
var touchRecord = touchBank[getTouchIdentifier(touch)];
if (touchRecord) {
touchRecord.touchActive = true;
touchRecord.previousPageX = touchRecord.currentPageX;
touchRecord.previousPageY = touchRecord.currentPageY;
touchRecord.previousTimeStamp = touchRecord.currentTimeStamp;
touchRecord.currentPageX = touch.pageX;
touchRecord.currentPageY = touch.pageY;
touchRecord.currentTimeStamp = timestampForTouch(touch);
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
} else {
console.error('Cannot record touch move without a touch start.\n' + 'Touch Move: %s\n', 'Touch Bank: %s', printTouch(touch), printTouchBank());
}
touchTrack.touchActive = true;
touchTrack.previousPageX = touchTrack.currentPageX;
touchTrack.previousPageY = touchTrack.currentPageY;
touchTrack.previousTimeStamp = touchTrack.currentTimeStamp;
touchTrack.currentPageX = touch.pageX;
touchTrack.currentPageY = touch.pageY;
touchTrack.currentTimeStamp = timestampForTouch(touch);
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
};
}
var recordEndTouchData = function (touch) {
var touchBank = touchHistory.touchBank;
var touchTrack = touchBank[touch.identifier];
if (process.env.NODE_ENV !== 'production') {
validateTouch(touch);
!touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : _prodInvariant('134') : void 0;
function recordTouchEnd(touch) {
var touchRecord = touchBank[getTouchIdentifier(touch)];
if (touchRecord) {
touchRecord.touchActive = false;
touchRecord.previousPageX = touchRecord.currentPageX;
touchRecord.previousPageY = touchRecord.currentPageY;
touchRecord.previousTimeStamp = touchRecord.currentTimeStamp;
touchRecord.currentPageX = touch.pageX;
touchRecord.currentPageY = touch.pageY;
touchRecord.currentTimeStamp = timestampForTouch(touch);
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
} else {
console.error('Cannot record touch end without a touch start.\n' + 'Touch End: %s\n', 'Touch Bank: %s', printTouch(touch), printTouchBank());
}
touchTrack.previousPageX = touchTrack.currentPageX;
touchTrack.previousPageY = touchTrack.currentPageY;
touchTrack.previousTimeStamp = touchTrack.currentTimeStamp;
touchTrack.currentPageX = touch.pageX;
touchTrack.currentPageY = touch.pageY;
touchTrack.currentTimeStamp = timestampForTouch(touch);
touchTrack.touchActive = false;
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
};
}
function printTouch(touch) {
return JSON.stringify({
identifier: touch.identifier,
pageX: touch.pageX,
pageY: touch.pageY,
timestamp: timestampForTouch(touch)
});
}
function printTouchBank() {
var printed = JSON.stringify(touchBank.slice(0, MAX_TOUCH_BANK));
if (touchBank.length > MAX_TOUCH_BANK) {
printed += ' (original size: ' + touchBank.length + ')';
}
return printed;
}
var ResponderTouchHistoryStore = {
recordTouchTrack: function (topLevelType, nativeEvent) {
var touchBank = touchHistory.touchBank;
if (isMoveish(topLevelType)) {
nativeEvent.changedTouches.forEach(recordMoveTouchData);
nativeEvent.changedTouches.forEach(recordTouchMove);
} else if (isStartish(topLevelType)) {
nativeEvent.changedTouches.forEach(recordStartTouchData);
nativeEvent.changedTouches.forEach(recordTouchStart);
touchHistory.numberActiveTouches = nativeEvent.touches.length;

@@ -166,3 +168,3 @@ if (touchHistory.numberActiveTouches === 1) {

} else if (isEndish(topLevelType)) {
nativeEvent.changedTouches.forEach(recordEndTouchData);
nativeEvent.changedTouches.forEach(recordTouchEnd);
touchHistory.numberActiveTouches = nativeEvent.touches.length;

@@ -178,5 +180,4 @@ if (touchHistory.numberActiveTouches === 1) {

if (process.env.NODE_ENV !== 'production') {
var activeTouchData = touchBank[touchHistory.indexOfSingleActiveTouch];
var foundActive = activeTouchData != null && !!activeTouchData.touchActive;
!foundActive ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot find single active touch') : _prodInvariant('135') : void 0;
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
process.env.NODE_ENV !== 'production' ? warning(activeRecord != null && activeRecord.touchActive, 'Cannot find single active touch.') : void 0;
}

@@ -187,2 +188,3 @@ }

touchHistory: touchHistory

@@ -189,0 +191,0 @@ };

{
"name": "react",
"description": "React is a JavaScript library for building user interfaces.",
"version": "15.2.0",
"version": "15.2.1",
"keywords": [

@@ -6,0 +6,0 @@ "react"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc