Completely updated React, fixed #11, (hopefully)

This commit is contained in:
2018-03-04 19:11:49 -05:00
parent 6e0afd6e2a
commit 34e5f5139a
13674 changed files with 333464 additions and 473223 deletions

View File

@@ -1,4 +1,4 @@
/** @license React v16.1.0
/** @license React v16.2.0
* react.development.js
*
* Copyright (c) 2013-present, Facebook, Inc.
@@ -79,7 +79,7 @@ function shouldUseNative() {
}
}
var objectAssign$1 = shouldUseNative() ? Object.assign : function (target, source) {
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
@@ -108,7 +108,31 @@ var objectAssign$1 = shouldUseNative() ? Object.assign : function (target, sourc
// TODO: this is special because it gets imported during build.
var ReactVersion = '16.1.0';
var ReactVersion = '16.2.0';
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7;
var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8;
var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator';
function getIteratorFn(maybeIterable) {
if (maybeIterable === null || typeof maybeIterable === 'undefined') {
return null;
}
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
if (typeof maybeIterator === 'function') {
return maybeIterator;
}
return null;
}
/**
* WARNING: DO NOT manually require this module.
@@ -127,6 +151,24 @@ var ReactVersion = '16.1.0';
var emptyObject = {};
{
Object.freeze(emptyObject);
}
var emptyObject_1 = emptyObject;
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
/**
* Use invariant() to assert state which your program assumes to be true.
*
@@ -169,40 +211,7 @@ function invariant(condition, format, a, b, c, d, e, f) {
}
}
var invariant_1$1 = invariant;
// Exports React.Fragment
var enableReactFragment = false;
// Exports ReactDOM.createRoot
// Mutating mode (React DOM, React ART, React Native):
// Experimental noop mode (currently unused):
// Experimental persistent mode (CS):
// Only used in www builds.
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var emptyObject = {};
{
Object.freeze(emptyObject);
}
var emptyObject_1 = emptyObject;
var invariant_1 = invariant;
/**
* Forked from fbjs/warning:
@@ -353,7 +362,7 @@ var warning = emptyFunction_1;
};
}
var warning_1$1 = warning;
var warning_1 = warning;
var didWarnStateUpdateForUnmountedComponent = {};
@@ -365,7 +374,7 @@ function warnNoop(publicInstance, callerName) {
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
return;
}
warning_1$1(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.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
warning_1(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.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
}
}
@@ -478,7 +487,7 @@ Component.prototype.isReactComponent = {};
* @protected
*/
Component.prototype.setState = function (partialState, callback) {
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant_1$1(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant_1(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
this.updater.enqueueSetState(this, partialState, callback, 'setState');
};
@@ -543,7 +552,7 @@ ComponentDummy.prototype = Component.prototype;
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
pureComponentPrototype.constructor = PureComponent;
// Avoid an extra prototype jump for these methods.
objectAssign$1(pureComponentPrototype, Component.prototype);
objectAssign(pureComponentPrototype, Component.prototype);
pureComponentPrototype.isPureReactComponent = true;
function AsyncComponent(props, context, updater) {
@@ -559,7 +568,7 @@ function AsyncComponent(props, context, updater) {
var asyncComponentPrototype = AsyncComponent.prototype = new ComponentDummy();
asyncComponentPrototype.constructor = AsyncComponent;
// Avoid an extra prototype jump for these methods.
objectAssign$1(asyncComponentPrototype, Component.prototype);
objectAssign(asyncComponentPrototype, Component.prototype);
asyncComponentPrototype.unstable_isAsyncReactComponent = true;
asyncComponentPrototype.render = function () {
return this.props.children;
@@ -581,10 +590,6 @@ var ReactCurrentOwner = {
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
ref: true,
@@ -623,7 +628,7 @@ function defineKeyPropWarningGetter(props, displayName) {
var warnAboutAccessingKey = function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
warning_1$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
warning_1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
}
};
warnAboutAccessingKey.isReactWarning = true;
@@ -637,7 +642,7 @@ function defineRefPropWarningGetter(props, displayName) {
var warnAboutAccessingRef = function () {
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
warning_1$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
warning_1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
}
};
warnAboutAccessingRef.isReactWarning = true;
@@ -670,7 +675,7 @@ function defineRefPropWarningGetter(props, displayName) {
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allow us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE$1,
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
@@ -785,7 +790,7 @@ function createElement(type, config, children) {
}
{
if (key || ref) {
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE$1) {
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
if (key) {
defineKeyPropWarningGetter(props, displayName);
@@ -819,7 +824,7 @@ function cloneElement(element, config, children) {
var propName;
// Original props are copied
var props = objectAssign$1({}, element.props);
var props = objectAssign({}, element.props);
// Reserved names are extracted
var key = element.key;
@@ -885,7 +890,7 @@ function cloneElement(element, config, children) {
* @final
*/
function isValidElement(object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE$1;
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
var ReactDebugCurrentFrame = {};
@@ -903,12 +908,6 @@ var ReactDebugCurrentFrame = {};
};
}
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var REACT_PORTAL_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.portal') || 0xeaca;
var SEPARATOR = '.';
var SUBSEPARATOR = ':';
@@ -992,10 +991,28 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
children = null;
}
if (children === null || type === 'string' || type === 'number' ||
// The following is inlined from ReactElement. This means we can optimize
// some checks. React Fiber also inlines this logic for similar purposes.
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE || type === 'object' && children.$$typeof === REACT_PORTAL_TYPE) {
var invokeCallback = false;
if (children === null) {
invokeCallback = true;
} else {
switch (type) {
case 'string':
case 'number':
invokeCallback = true;
break;
case 'object':
switch (children.$$typeof) {
case REACT_ELEMENT_TYPE:
case REACT_CALL_TYPE:
case REACT_RETURN_TYPE:
case REACT_PORTAL_TYPE:
invokeCallback = true;
}
}
}
if (invokeCallback) {
callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
@@ -1015,12 +1032,12 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = ITERATOR_SYMBOL && children[ITERATOR_SYMBOL] || children[FAUX_ITERATOR_SYMBOL];
var iteratorFn = getIteratorFn(children);
if (typeof iteratorFn === 'function') {
{
// Warn about using Maps as children
if (iteratorFn === children.entries) {
warning_1$1(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', ReactDebugCurrentFrame.getStackAddendum());
warning_1(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', ReactDebugCurrentFrame.getStackAddendum());
didWarnAboutMaps = true;
}
}
@@ -1039,7 +1056,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
}
var childrenString = '' + children;
invariant_1$1(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
invariant_1(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
}
}
@@ -1209,7 +1226,7 @@ function toArray(children) {
* structure.
*/
function onlyChild(children) {
!isValidElement(children) ? invariant_1$1(false, 'React.Children.only expected to receive a single React element child.') : void 0;
!isValidElement(children) ? invariant_1(false, 'React.Children.only expected to receive a single React element child.') : void 0;
return children;
}
@@ -1252,8 +1269,8 @@ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
{
var invariant$2 = invariant_1$1;
var warning$2 = warning_1$1;
var invariant$2 = invariant_1;
var warning$2 = warning_1;
var ReactPropTypesSecret = ReactPropTypesSecret_1;
var loggedTypeFailures = {};
}
@@ -1300,7 +1317,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
}
}
var checkPropTypes_1$1 = checkPropTypes;
var checkPropTypes_1 = checkPropTypes;
/**
* ReactElementValidator provides a wrapper around a element factory
@@ -1312,6 +1329,8 @@ var checkPropTypes_1$1 = checkPropTypes;
{
var currentlyValidatingElement = null;
var propTypesMisspellWarningShown = false;
var getDisplayName = function (element) {
if (element == null) {
return '#empty';
@@ -1319,7 +1338,7 @@ var checkPropTypes_1$1 = checkPropTypes;
return '#text';
} else if (typeof element.type === 'string') {
return element.type;
} else if (element.type === REACT_FRAGMENT_TYPE$1) {
} else if (element.type === REACT_FRAGMENT_TYPE) {
return 'React.Fragment';
} else {
return element.type.displayName || element.type.name || 'Unknown';
@@ -1337,14 +1356,9 @@ var checkPropTypes_1$1 = checkPropTypes;
return stack;
};
var REACT_FRAGMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.fragment') || 0xeacb;
var VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
}
var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
var name = getComponentName(ReactCurrentOwner.current);
@@ -1418,7 +1432,7 @@ function validateExplicitKey(element, parentType) {
currentlyValidatingElement = element;
{
warning_1$1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getStackAddendum());
warning_1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getStackAddendum());
}
currentlyValidatingElement = null;
}
@@ -1449,7 +1463,7 @@ function validateChildKeys(node, parentType) {
node._store.validated = true;
}
} else if (node) {
var iteratorFn = ITERATOR_SYMBOL$1 && node[ITERATOR_SYMBOL$1] || node[FAUX_ITERATOR_SYMBOL$1];
var iteratorFn = getIteratorFn(node);
if (typeof iteratorFn === 'function') {
// Entry iterators used to provide implicit keys,
// but now we print a separate warning for them later.
@@ -1479,14 +1493,16 @@ function validatePropTypes(element) {
}
var name = componentClass.displayName || componentClass.name;
var propTypes = componentClass.propTypes;
if (propTypes) {
currentlyValidatingElement = element;
checkPropTypes_1$1(propTypes, element.props, 'prop', name, getStackAddendum);
checkPropTypes_1(propTypes, element.props, 'prop', name, getStackAddendum);
currentlyValidatingElement = null;
} else if (componentClass.PropTypes !== undefined && !propTypesMisspellWarningShown) {
propTypesMisspellWarningShown = true;
warning_1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
}
if (typeof componentClass.getDefaultProps === 'function') {
warning_1$1(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
warning_1(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
}
}
@@ -1506,7 +1522,7 @@ function validateFragmentProps(fragment) {
var key = _step.value;
if (!VALID_FRAGMENT_PROPS.has(key)) {
warning_1$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum());
warning_1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum());
break;
}
}
@@ -1526,7 +1542,7 @@ function validateFragmentProps(fragment) {
}
if (fragment.ref !== null) {
warning_1$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
warning_1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
}
currentlyValidatingElement = null;
@@ -1539,7 +1555,7 @@ function createElementWithValidation(type, props, children) {
if (!validType) {
var info = '';
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
}
var sourceInfo = getSourceInfoErrorAddendum(props);
@@ -1551,7 +1567,7 @@ function createElementWithValidation(type, props, children) {
info += getStackAddendum() || '';
warning_1$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info);
warning_1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info);
}
var element = createElement.apply(this, arguments);
@@ -1573,7 +1589,7 @@ function createElementWithValidation(type, props, children) {
}
}
if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE$1) {
if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE) {
validateFragmentProps(element);
} else {
validatePropTypes(element);
@@ -1612,8 +1628,6 @@ function cloneElementWithValidation(element, props, children) {
return newElement;
}
var REACT_FRAGMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.fragment') || 0xeacb;
var React = {
Children: {
map: mapChildren,
@@ -1627,6 +1641,8 @@ var React = {
PureComponent: PureComponent,
unstable_AsyncComponent: AsyncComponent,
Fragment: REACT_FRAGMENT_TYPE,
createElement: createElementWithValidation,
cloneElement: cloneElementWithValidation,
createFactory: createFactoryWithValidation,
@@ -1637,16 +1653,12 @@ var React = {
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
ReactCurrentOwner: ReactCurrentOwner,
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
assign: objectAssign$1
assign: objectAssign
}
};
if (enableReactFragment) {
React.Fragment = REACT_FRAGMENT_TYPE;
}
{
objectAssign$1(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
objectAssign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
// These should not be included in production.
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
// Shim for React DOM 16.0.0 which still destructured (but not used) this.