diff options
Diffstat (limited to 'node_modules/react/umd')
-rw-r--r-- | node_modules/react/umd/react.development.js | 1181 | ||||
-rw-r--r-- | node_modules/react/umd/react.production.min.js | 43 |
2 files changed, 456 insertions, 768 deletions
diff --git a/node_modules/react/umd/react.development.js b/node_modules/react/umd/react.development.js index 0c74d2b8b..654f3a82b 100644 --- a/node_modules/react/umd/react.development.js +++ b/node_modules/react/umd/react.development.js @@ -1,4 +1,4 @@ -/** @license React v16.0.0 +/** @license React v16.2.0 * react.development.js * * Copyright (c) 2013-present, Facebook, Inc. @@ -7,6 +7,8 @@ * LICENSE file in the root directory of this source tree. */ +'use strict'; + (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -19,6 +21,7 @@ object-assign @license MIT */ + /* eslint-disable no-unused-vars */ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; @@ -76,7 +79,7 @@ function shouldUseNative() { } } -var index = shouldUseNative() ? Object.assign : function (target, source) { +var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; @@ -103,16 +106,166 @@ var index = shouldUseNative() ? Object.assign : function (target, source) { return to; }; +// TODO: this is special because it gets imported during build. + +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. + * This is a replacement for `invariant(...)` used by the error code system + * and will _only_ be required by the corresponding babel pass. + * It always throws. + */ + /** * 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. * - * @providesModule reactProdInvariant - * */ + + +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. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + +var validateFormat = function validateFormat(format) {}; + +{ + validateFormat = function validateFormat(format) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + }; +} + +function invariant(condition, format, a, b, c, d, e, f) { + validateFormat(format); + + if (!condition) { + var error; + if (format === undefined) { + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error(format.replace(/%s/g, function () { + return args[argIndex++]; + })); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } +} + +var invariant_1 = invariant; + +/** + * Forked from fbjs/warning: + * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js + * + * Only change is we use console.warn instead of console.error, + * and do nothing when 'console' is not supported. + * This really simplifies the code. + * --- + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + +var lowPriorityWarning = function () {}; + +{ + var printWarning = function (format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.warn(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + lowPriorityWarning = function (condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + printWarning.apply(undefined, [format].concat(args)); + } + }; +} + +var lowPriorityWarning$1 = lowPriorityWarning; + /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -149,16 +302,28 @@ emptyFunction.thatReturnsArgument = function (arg) { var emptyFunction_1 = emptyFunction; /** + * Copyright (c) 2014-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. + * + */ + + + + + +/** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ -var warning$1 = emptyFunction_1; +var warning = emptyFunction_1; { - var printWarning = function printWarning(format) { + var printWarning$1 = function printWarning(format) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } @@ -178,7 +343,7 @@ var warning$1 = emptyFunction_1; } catch (x) {} }; - warning$1 = function warning(condition, format) { + warning = function warning(condition, format) { if (format === undefined) { throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); } @@ -192,21 +357,25 @@ var warning$1 = emptyFunction_1; args[_key2 - 2] = arguments[_key2]; } - printWarning.apply(undefined, [format].concat(args)); + printWarning$1.apply(undefined, [format].concat(args)); } }; } -var warning_1 = warning$1; +var warning_1 = warning; -{ - var warning = warning_1; -} +var didWarnStateUpdateForUnmountedComponent = {}; function warnNoop(publicInstance, callerName) { { var constructor = publicInstance.constructor; - 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.\n\nPlease check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass'); + var componentName = constructor && (constructor.displayName || constructor.name) || 'ReactClass'; + var warningKey = componentName + '.' + callerName; + if (didWarnStateUpdateForUnmountedComponent[warningKey]) { + return; + } + 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; } } @@ -278,151 +447,19 @@ var ReactNoopUpdateQueue = { } }; -var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue; - -/** - * 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; - -/** - * 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. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - -var validateFormat = function validateFormat(format) {}; - -{ - validateFormat = function validateFormat(format) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - }; -} - -function invariant(condition, format, a, b, c, d, e, f) { - validateFormat(format); - - if (!condition) { - var error; - if (format === undefined) { - error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error(format.replace(/%s/g, function () { - return args[argIndex++]; - })); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } -} - -var invariant_1 = invariant; - -/** - * Copyright (c) 2014-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. - * - * @providesModule lowPriorityWarning - */ - -/** - * Forked from fbjs/warning: - * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js - * - * Only change is we use console.warn instead of console.error, - * and do nothing when 'console' is not supported. - * This really simplifies the code. - * --- - * Similar to invariant but only logs a warning if the condition is not met. - * This can be used to log issues in development environments in critical - * paths. Removing the logging code for production environments will keep the - * same logic and follow the same code paths. - */ - -var lowPriorityWarning = function () {}; - -{ - var printWarning$1 = function (format) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - if (typeof console !== 'undefined') { - console.warn(message); - } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; - - lowPriorityWarning = function (condition, format) { - if (format === undefined) { - throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); - } - if (!condition) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; - } - - printWarning$1.apply(undefined, [format].concat(args)); - } - }; -} - -var lowPriorityWarning_1 = lowPriorityWarning; - /** * Base class helpers for the updating state of a component. */ -function ReactComponent(props, context, updater) { +function Component(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject_1; // We initialize the default updater but the real one gets injected by the // renderer. - this.updater = updater || ReactNoopUpdateQueue_1; + this.updater = updater || ReactNoopUpdateQueue; } -ReactComponent.prototype.isReactComponent = {}; +Component.prototype.isReactComponent = {}; /** * Sets a subset of the state. Always use this to mutate @@ -449,7 +486,7 @@ ReactComponent.prototype.isReactComponent = {}; * @final * @protected */ -ReactComponent.prototype.setState = function (partialState, callback) { +Component.prototype.setState = function (partialState, callback) { !(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'); }; @@ -468,7 +505,7 @@ ReactComponent.prototype.setState = function (partialState, callback) { * @final * @protected */ -ReactComponent.prototype.forceUpdate = function (callback) { +Component.prototype.forceUpdate = function (callback) { this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); }; @@ -483,9 +520,9 @@ ReactComponent.prototype.forceUpdate = function (callback) { replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] }; var defineDeprecationWarning = function (methodName, info) { - Object.defineProperty(ReactComponent.prototype, methodName, { + Object.defineProperty(Component.prototype, methodName, { get: function () { - lowPriorityWarning_1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); + lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); return undefined; } }); @@ -500,59 +537,43 @@ ReactComponent.prototype.forceUpdate = function (callback) { /** * Base class helpers for the updating state of a component. */ -function ReactPureComponent(props, context, updater) { - // Duplicated from ReactComponent. +function PureComponent(props, context, updater) { + // Duplicated from Component. this.props = props; this.context = context; this.refs = emptyObject_1; // We initialize the default updater but the real one gets injected by the // renderer. - this.updater = updater || ReactNoopUpdateQueue_1; + this.updater = updater || ReactNoopUpdateQueue; } function ComponentDummy() {} -ComponentDummy.prototype = ReactComponent.prototype; -var pureComponentPrototype = ReactPureComponent.prototype = new ComponentDummy(); -pureComponentPrototype.constructor = ReactPureComponent; +ComponentDummy.prototype = Component.prototype; +var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); +pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. -index(pureComponentPrototype, ReactComponent.prototype); +objectAssign(pureComponentPrototype, Component.prototype); pureComponentPrototype.isPureReactComponent = true; -function ReactAsyncComponent(props, context, updater) { - // Duplicated from ReactComponent. +function AsyncComponent(props, context, updater) { + // Duplicated from Component. this.props = props; this.context = context; this.refs = emptyObject_1; // We initialize the default updater but the real one gets injected by the // renderer. - this.updater = updater || ReactNoopUpdateQueue_1; + this.updater = updater || ReactNoopUpdateQueue; } -var asyncComponentPrototype = ReactAsyncComponent.prototype = new ComponentDummy(); -asyncComponentPrototype.constructor = ReactAsyncComponent; +var asyncComponentPrototype = AsyncComponent.prototype = new ComponentDummy(); +asyncComponentPrototype.constructor = AsyncComponent; // Avoid an extra prototype jump for these methods. -index(asyncComponentPrototype, ReactComponent.prototype); +objectAssign(asyncComponentPrototype, Component.prototype); asyncComponentPrototype.unstable_isAsyncReactComponent = true; asyncComponentPrototype.render = function () { return this.props.children; }; -var ReactBaseClasses = { - Component: ReactComponent, - PureComponent: ReactPureComponent, - AsyncComponent: ReactAsyncComponent -}; - -/** - * 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. - * - * @providesModule ReactCurrentOwner - * - */ - /** * Keeps track of the current owner. * @@ -567,18 +588,8 @@ var ReactCurrentOwner = { current: null }; -var ReactCurrentOwner_1 = ReactCurrentOwner; - var hasOwnProperty$1 = Object.prototype.hasOwnProperty; -{ - var warning$3 = warning_1; -} - -// 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, @@ -617,7 +628,7 @@ function defineKeyPropWarningGetter(props, displayName) { var warnAboutAccessingKey = function () { if (!specialPropKeyWarningShown) { specialPropKeyWarningShown = true; - warning$3(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; @@ -631,7 +642,7 @@ function defineRefPropWarningGetter(props, displayName) { var warnAboutAccessingRef = function () { if (!specialPropRefWarningShown) { specialPropRefWarningShown = true; - warning$3(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; @@ -664,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, @@ -719,9 +730,9 @@ var ReactElement = function (type, key, ref, self, source, owner, props) { /** * Create and return a new ReactElement of the given type. - * See https://facebook.github.io/react/docs/react-api.html#createelement + * See https://reactjs.org/docs/react-api.html#createelement */ -ReactElement.createElement = function (type, config, children) { +function createElement(type, config, children) { var propName; // Reserved names are extracted @@ -779,7 +790,7 @@ ReactElement.createElement = function (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); @@ -790,39 +801,30 @@ ReactElement.createElement = function (type, config, children) { } } } - return ReactElement(type, key, ref, self, source, ReactCurrentOwner_1.current, props); -}; + return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); +} /** * Return a function that produces ReactElements of a given type. - * See https://facebook.github.io/react/docs/react-api.html#createfactory + * See https://reactjs.org/docs/react-api.html#createfactory */ -ReactElement.createFactory = function (type) { - var factory = ReactElement.createElement.bind(null, type); - // Expose the type on the factory and the prototype so that it can be - // easily accessed on elements. E.g. `<Foo />.type === Foo`. - // This should not be named `constructor` since this may not be the function - // that created the element, and it may not even be a constructor. - // Legacy hook TODO: Warn if this is accessed - factory.type = type; - return factory; -}; -ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { + +function cloneAndReplaceKey(oldElement, newKey) { var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); return newElement; -}; +} /** * Clone and return a new ReactElement using element as the starting point. - * See https://facebook.github.io/react/docs/react-api.html#cloneelement + * See https://reactjs.org/docs/react-api.html#cloneelement */ -ReactElement.cloneElement = function (element, config, children) { +function cloneElement(element, config, children) { var propName; // Original props are copied - var props = index({}, element.props); + var props = objectAssign({}, element.props); // Reserved names are extracted var key = element.key; @@ -841,7 +843,7 @@ ReactElement.cloneElement = function (element, config, children) { if (hasValidRef(config)) { // Silently steal the ref from the parent. ref = config.ref; - owner = ReactCurrentOwner_1.current; + owner = ReactCurrentOwner.current; } if (hasValidKey(config)) { key = '' + config.key; @@ -878,30 +880,18 @@ ReactElement.cloneElement = function (element, config, children) { } return ReactElement(element.type, key, ref, self, source, owner, props); -}; +} /** * Verifies the object is a ReactElement. - * See https://facebook.github.io/react/docs/react-api.html#isvalidelement + * See https://reactjs.org/docs/react-api.html#isvalidelement * @param {?object} object * @return {boolean} True if `object` is a valid component. * @final */ -ReactElement.isValidElement = function (object) { - return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE$1; -}; - -var ReactElement_1 = ReactElement; - -/** - * 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. - * - * @providesModule ReactDebugCurrentFrame - * - */ +function isValidElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +} var ReactDebugCurrentFrame = {}; @@ -918,21 +908,6 @@ var ReactDebugCurrentFrame = {}; }; } -var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame; - -{ - var warning$2 = warning_1; - - var _require = ReactDebugCurrentFrame_1, - getStackAddendum = _require.getStackAddendum; -} - -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 SEPARATOR = '.'; var SUBSEPARATOR = ':'; @@ -1016,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) { + 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. @@ -1039,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$2(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', 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; } } @@ -1060,7 +1053,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) } else if (type === 'object') { var addendum = ''; { - addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getStackAddendum(); + addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum(); } var childrenString = '' + children; 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); @@ -1122,7 +1115,7 @@ function forEachSingleChild(bookKeeping, child, name) { /** * Iterates through children that are typically specified as `props.children`. * - * See https://facebook.github.io/react/docs/react-api.html#react.children.foreach + * See https://reactjs.org/docs/react-api.html#react.children.foreach * * The provided forEachFunc(child, index) will be called for each * leaf child. @@ -1151,8 +1144,8 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) { if (Array.isArray(mappedChild)) { mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction_1.thatReturnsArgument); } else if (mappedChild != null) { - if (ReactElement_1.isValidElement(mappedChild)) { - mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild, + if (isValidElement(mappedChild)) { + mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as // traverseAllChildren used to do for objects as children keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey); @@ -1174,7 +1167,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { /** * Maps children that are typically specified as `props.children`. * - * See https://facebook.github.io/react/docs/react-api.html#react.children.map + * See https://reactjs.org/docs/react-api.html#react.children.map * * The provided mapFunction(child, key, index) will be called for each * leaf child. @@ -1197,7 +1190,7 @@ function mapChildren(children, func, context) { * Count the number of children that are typically specified as * `props.children`. * - * See https://facebook.github.io/react/docs/react-api.html#react.children.count + * See https://reactjs.org/docs/react-api.html#react.children.count * * @param {?*} children Children tree container. * @return {number} The number of children. @@ -1210,7 +1203,7 @@ function countChildren(children, context) { * Flatten a children object (typically specified as `props.children`) and * return an array with appropriately re-keyed children. * - * See https://facebook.github.io/react/docs/react-api.html#react.children.toarray + * See https://reactjs.org/docs/react-api.html#react.children.toarray */ function toArray(children) { var result = []; @@ -1218,31 +1211,11 @@ function toArray(children) { return result; } -var ReactChildren = { - forEach: forEachChildren, - map: mapChildren, - count: countChildren, - toArray: toArray -}; - -var ReactChildren_1 = ReactChildren; - -/** - * 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. - * - * @providesModule ReactVersion - */ - -var ReactVersion = '16.0.0'; - /** * Returns the first child in a collection of children and verifies that there * is only one child in the collection. * - * See https://facebook.github.io/react/docs/react-api.html#react.children.only + * See https://reactjs.org/docs/react-api.html#react.children.only * * The current implementation of this function assumes that a single child gets * passed without a wrapper, but the purpose of this helper function is to @@ -1253,11 +1226,25 @@ var ReactVersion = '16.0.0'; * structure. */ function onlyChild(children) { - !ReactElement_1.isValidElement(children) ? invariant_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; } -var onlyChild_1 = onlyChild; +var describeComponentFrame = function (name, source, ownerName) { + return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); +}; + +function getComponentName(fiber) { + var type = fiber.type; + + if (typeof type === 'string') { + return type; + } + if (typeof type === 'function') { + return type.displayName || type.name; + } + return null; +} /** * Copyright (c) 2013-present, Facebook, Inc. @@ -1266,13 +1253,24 @@ var onlyChild_1 = onlyChild; * LICENSE file in the root directory of this source tree. */ + + var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; var ReactPropTypesSecret_1 = ReactPropTypesSecret$1; +/** + * 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 invariant$2 = invariant_1; - var warning$5 = warning_1; + var warning$2 = warning_1; var ReactPropTypesSecret = ReactPropTypesSecret_1; var loggedTypeFailures = {}; } @@ -1288,7 +1286,7 @@ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1; * @param {?Function} getStack Returns the component stack. * @private */ -function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) { +function checkPropTypes(typeSpecs, values, location, componentName, getStack) { { for (var typeSpecName in typeSpecs) { if (typeSpecs.hasOwnProperty(typeSpecName)) { @@ -1304,7 +1302,7 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) } catch (ex) { error = ex; } - warning$5(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); + warning$2(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); if (error instanceof Error && !(error.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the // same error. @@ -1312,72 +1310,27 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) var stack = getStack ? getStack() : ''; - warning$5(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); + warning$2(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); } } } } } -var checkPropTypes_1 = checkPropTypes$1; - -/** - * Copyright (c) 2016-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. - * - * - * @providesModule describeComponentFrame - */ - -var describeComponentFrame$1 = function (name, source, ownerName) { - return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); -}; +var checkPropTypes_1 = checkPropTypes; /** - * 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. - * - * @providesModule getComponentName - * + * ReactElementValidator provides a wrapper around a element factory + * which validates the props passed to the element. This is intended to be + * used only in DEV and could be replaced by a static type checker for languages + * that support it. */ -function getComponentName$1(instanceOrFiber) { - if (typeof instanceOrFiber.getName === 'function') { - // Stack reconciler - var instance = instanceOrFiber; - return instance.getName(); - } - if (typeof instanceOrFiber.tag === 'number') { - // Fiber reconciler - var fiber = instanceOrFiber; - var type = fiber.type; - - if (typeof type === 'string') { - return type; - } - if (typeof type === 'function') { - return type.displayName || type.name; - } - } - return null; -} - -var getComponentName_1 = getComponentName$1; - { - var checkPropTypes = checkPropTypes_1; - var lowPriorityWarning$1 = lowPriorityWarning_1; - var ReactDebugCurrentFrame$1 = ReactDebugCurrentFrame_1; - var warning$4 = warning_1; - var describeComponentFrame = describeComponentFrame$1; - var getComponentName = getComponentName_1; - var currentlyValidatingElement = null; + var propTypesMisspellWarningShown = false; + var getDisplayName = function (element) { if (element == null) { return '#empty'; @@ -1385,29 +1338,30 @@ var getComponentName_1 = getComponentName$1; return '#text'; } else if (typeof element.type === 'string') { return element.type; + } else if (element.type === REACT_FRAGMENT_TYPE) { + return 'React.Fragment'; } else { return element.type.displayName || element.type.name || 'Unknown'; } }; - var getStackAddendum$1 = function () { + var getStackAddendum = function () { var stack = ''; if (currentlyValidatingElement) { var name = getDisplayName(currentlyValidatingElement); var owner = currentlyValidatingElement._owner; stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner)); } - stack += ReactDebugCurrentFrame$1.getStackAddendum() || ''; + stack += ReactDebugCurrentFrame.getStackAddendum() || ''; return stack; }; -} -var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator; -var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec. + var VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]); +} function getDeclarationErrorAddendum() { - if (ReactCurrentOwner_1.current) { - var name = getComponentName(ReactCurrentOwner_1.current); + if (ReactCurrentOwner.current) { + var name = getComponentName(ReactCurrentOwner.current); if (name) { return '\n\nCheck the render method of `' + name + '`.'; } @@ -1471,14 +1425,14 @@ function validateExplicitKey(element, parentType) { // property, it may be the creator of the child that's responsible for // assigning it a key. var childOwner = ''; - if (element && element._owner && element._owner !== ReactCurrentOwner_1.current) { + if (element && element._owner && element._owner !== ReactCurrentOwner.current) { // Give the component that originally created this child. childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.'; } currentlyValidatingElement = element; { - warning$4(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$1()); + 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; } @@ -1499,17 +1453,17 @@ function validateChildKeys(node, parentType) { if (Array.isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; - if (ReactElement_1.isValidElement(child)) { + if (isValidElement(child)) { validateExplicitKey(child, parentType); } } - } else if (ReactElement_1.isValidElement(node)) { + } else if (isValidElement(node)) { // This element was passed in a valid location. if (node._store) { 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. @@ -1517,7 +1471,7 @@ function validateChildKeys(node, parentType) { var iterator = iteratorFn.call(node); var step; while (!(step = iterator.next()).done) { - if (ReactElement_1.isValidElement(step.value)) { + if (isValidElement(step.value)) { validateExplicitKey(step.value, parentType); } } @@ -1539,457 +1493,192 @@ function validatePropTypes(element) { } var name = componentClass.displayName || componentClass.name; var propTypes = componentClass.propTypes; - if (propTypes) { currentlyValidatingElement = element; - checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum$1); + 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$4(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.'); } } -var ReactElementValidator$1 = { - createElement: function (type, props, children) { - var validType = typeof type === 'string' || typeof type === 'function'; - // We warn in this case but don't throw. We expect the element creation to - // succeed and there will likely be errors in render. - 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."; - } - - var sourceInfo = getSourceInfoErrorAddendum(props); - if (sourceInfo) { - info += sourceInfo; - } else { - info += getDeclarationErrorAddendum(); - } - - info += ReactDebugCurrentFrame$1.getStackAddendum() || ''; +/** + * Given a fragment, validate that it can only be provided with fragment props + * @param {ReactElement} fragment + */ +function validateFragmentProps(fragment) { + currentlyValidatingElement = fragment; - warning$4(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 _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; - var element = ReactElement_1.createElement.apply(this, arguments); + try { + for (var _iterator = Object.keys(fragment.props)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var key = _step.value; - // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - if (element == null) { - return element; + if (!VALID_FRAGMENT_PROPS.has(key)) { + warning_1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum()); + break; + } } - - // Skip key warning if the type isn't valid since our key validation logic - // doesn't expect a non-string/function type and can throw confusing errors. - // We don't want exception behavior to differ between dev and prod. - // (Rendering will throw with a helpful message and as soon as the type is - // fixed, the key warnings will appear.) - if (validType) { - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], type); + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator['return']) { + _iterator['return'](); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; } } + } - validatePropTypes(element); - - return element; - }, + if (fragment.ref !== null) { + warning_1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum()); + } - createFactory: function (type) { - var validatedFactory = ReactElementValidator$1.createElement.bind(null, type); - // Legacy hook TODO: Warn if this is accessed - validatedFactory.type = type; + currentlyValidatingElement = null; +} - { - Object.defineProperty(validatedFactory, 'type', { - enumerable: false, - get: function () { - lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); - Object.defineProperty(this, 'type', { - value: type - }); - return type; - } - }); +function createElementWithValidation(type, props, children) { + var validType = typeof type === 'string' || typeof type === 'function' || typeof type === 'symbol' || typeof type === 'number'; + // We warn in this case but don't throw. We expect the element creation to + // succeed and there will likely be errors in render. + 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, or you might have mixed up default and named imports."; } - return validatedFactory; - }, - - cloneElement: function (element, props, children) { - var newElement = ReactElement_1.cloneElement.apply(this, arguments); - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], newElement.type); + var sourceInfo = getSourceInfoErrorAddendum(props); + if (sourceInfo) { + info += sourceInfo; + } else { + info += getDeclarationErrorAddendum(); } - validatePropTypes(newElement); - return newElement; - } -}; -var ReactElementValidator_1 = ReactElementValidator$1; + info += getStackAddendum() || ''; -{ - var warning$6 = warning_1; -} - -function isNative(fn) { - // Based on isNative() from Lodash - var funcToString = Function.prototype.toString; - var reIsNative = RegExp('^' + funcToString - // Take an example native function source for comparison - .call(Object.prototype.hasOwnProperty) - // Strip regex characters so we can use it for regex - .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') - // Remove hasOwnProperty from the template to make it generic - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); - try { - var source = funcToString.call(fn); - return reIsNative.test(source); - } catch (err) { - return false; + 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 canUseCollections = -// Array.from -typeof Array.from === 'function' && -// Map -typeof Map === 'function' && isNative(Map) && -// Map.prototype.keys -Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) && -// Set -typeof Set === 'function' && isNative(Set) && -// Set.prototype.keys -Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys); - -var setItem; -var getItem; -var removeItem; -var getItemIDs; -var addRoot; -var removeRoot; -var getRootIDs; - -if (canUseCollections) { - var itemMap = new Map(); - var rootIDSet = new Set(); - - setItem = function (id, item) { - itemMap.set(id, item); - }; - getItem = function (id) { - return itemMap.get(id); - }; - removeItem = function (id) { - itemMap['delete'](id); - }; - getItemIDs = function () { - return Array.from(itemMap.keys()); - }; - - addRoot = function (id) { - rootIDSet.add(id); - }; - removeRoot = function (id) { - rootIDSet['delete'](id); - }; - getRootIDs = function () { - return Array.from(rootIDSet.keys()); - }; -} else { - var itemByKey = {}; - var rootByKey = {}; - - // Use non-numeric keys to prevent V8 performance issues: - // https://github.com/facebook/react/pull/7232 - var getKeyFromID = function (id) { - return '.' + id; - }; - var getIDFromKey = function (key) { - return parseInt(key.substr(1), 10); - }; - - setItem = function (id, item) { - var key = getKeyFromID(id); - itemByKey[key] = item; - }; - getItem = function (id) { - var key = getKeyFromID(id); - return itemByKey[key]; - }; - removeItem = function (id) { - var key = getKeyFromID(id); - delete itemByKey[key]; - }; - getItemIDs = function () { - return Object.keys(itemByKey).map(getIDFromKey); - }; - - addRoot = function (id) { - var key = getKeyFromID(id); - rootByKey[key] = true; - }; - removeRoot = function (id) { - var key = getKeyFromID(id); - delete rootByKey[key]; - }; - getRootIDs = function () { - return Object.keys(rootByKey).map(getIDFromKey); - }; -} -var unmountedIDs = []; + var element = createElement.apply(this, arguments); -function purgeDeep(id) { - var item = getItem(id); - if (item) { - var childIDs = item.childIDs; + // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + if (element == null) { + return element; + } - removeItem(id); - childIDs.forEach(purgeDeep); + // Skip key warning if the type isn't valid since our key validation logic + // doesn't expect a non-string/function type and can throw confusing errors. + // We don't want exception behavior to differ between dev and prod. + // (Rendering will throw with a helpful message and as soon as the type is + // fixed, the key warnings will appear.) + if (validType) { + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], type); + } } -} -function getDisplayName$1(element) { - if (element == null) { - return '#empty'; - } else if (typeof element === 'string' || typeof element === 'number') { - return '#text'; - } else if (typeof element.type === 'string') { - return element.type; + if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE) { + validateFragmentProps(element); } else { - return element.type.displayName || element.type.name || 'Unknown'; + validatePropTypes(element); } -} -function describeID(id) { - var name = ReactComponentTreeHook.getDisplayName(id); - var element = ReactComponentTreeHook.getElement(id); - var ownerID = ReactComponentTreeHook.getOwnerID(id); - var ownerName = void 0; - - if (ownerID) { - ownerName = ReactComponentTreeHook.getDisplayName(ownerID); - } - warning$6(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id); - return describeComponentFrame$1(name || '', element && element._source, ownerName || ''); + return element; } -var ReactComponentTreeHook = { - onSetChildren: function (id, nextChildIDs) { - var item = getItem(id); - !item ? invariant_1(false, 'Item must have been set') : void 0; - item.childIDs = nextChildIDs; - - for (var i = 0; i < nextChildIDs.length; i++) { - var nextChildID = nextChildIDs[i]; - var nextChild = getItem(nextChildID); - !nextChild ? invariant_1(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0; - !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? invariant_1(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : void 0; - !nextChild.isMounted ? invariant_1(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0; - if (nextChild.parentID == null) { - nextChild.parentID = id; - // TODO: This shouldn't be necessary but mounting a new root during in - // componentWillMount currently causes not-yet-mounted components to - // be purged from our tree data so their parent id is missing. - } - !(nextChild.parentID === id) ? invariant_1(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : void 0; - } - }, - onBeforeMountComponent: function (id, element, parentID) { - var item = { - element: element, - parentID: parentID, - text: null, - childIDs: [], - isMounted: false, - updateCount: 0 - }; - setItem(id, item); - }, - onBeforeUpdateComponent: function (id, element) { - var item = getItem(id); - if (!item || !item.isMounted) { - // We may end up here as a result of setState() in componentWillUnmount(). - // In this case, ignore the element. - return; - } - item.element = element; - }, - onMountComponent: function (id) { - var item = getItem(id); - !item ? invariant_1(false, 'Item must have been set') : void 0; - item.isMounted = true; - var isRoot = item.parentID === 0; - if (isRoot) { - addRoot(id); - } - }, - onUpdateComponent: function (id) { - var item = getItem(id); - if (!item || !item.isMounted) { - // We may end up here as a result of setState() in componentWillUnmount(). - // In this case, ignore the element. - return; - } - item.updateCount++; - }, - onUnmountComponent: function (id) { - var item = getItem(id); - if (item) { - // We need to check if it exists. - // `item` might not exist if it is inside an error boundary, and a sibling - // error boundary child threw while mounting. Then this instance never - // got a chance to mount, but it still gets an unmounting event during - // the error boundary cleanup. - item.isMounted = false; - var isRoot = item.parentID === 0; - if (isRoot) { - removeRoot(id); - } - } - unmountedIDs.push(id); - }, - purgeUnmountedComponents: function () { - if (ReactComponentTreeHook._preventPurging) { - // Should only be used for testing. - return; - } +function createFactoryWithValidation(type) { + var validatedFactory = createElementWithValidation.bind(null, type); + // Legacy hook TODO: Warn if this is accessed + validatedFactory.type = type; - for (var i = 0; i < unmountedIDs.length; i++) { - var id = unmountedIDs[i]; - purgeDeep(id); - } - unmountedIDs.length = 0; - }, - isMounted: function (id) { - var item = getItem(id); - return item ? item.isMounted : false; - }, - getCurrentStackAddendum: function () { - var info = ''; - var currentOwner = ReactCurrentOwner_1.current; - if (currentOwner) { - !(typeof currentOwner.tag !== 'number') ? invariant_1(false, 'Fiber owners should not show up in Stack stack traces.') : void 0; - if (typeof currentOwner._debugID === 'number') { - info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID); + { + Object.defineProperty(validatedFactory, 'type', { + enumerable: false, + get: function () { + lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); + Object.defineProperty(this, 'type', { + value: type + }); + return type; } - } - return info; - }, - getStackAddendumByID: function (id) { - var info = ''; - while (id) { - info += describeID(id); - id = ReactComponentTreeHook.getParentID(id); - } - return info; - }, - getChildIDs: function (id) { - var item = getItem(id); - return item ? item.childIDs : []; - }, - getDisplayName: function (id) { - var element = ReactComponentTreeHook.getElement(id); - if (!element) { - return null; - } - return getDisplayName$1(element); - }, - getElement: function (id) { - var item = getItem(id); - return item ? item.element : null; - }, - getOwnerID: function (id) { - var element = ReactComponentTreeHook.getElement(id); - if (!element || !element._owner) { - return null; - } - return element._owner._debugID; - }, - getParentID: function (id) { - var item = getItem(id); - return item ? item.parentID : null; - }, - getSource: function (id) { - var item = getItem(id); - var element = item ? item.element : null; - var source = element != null ? element._source : null; - return source; - }, - getText: function (id) { - var element = ReactComponentTreeHook.getElement(id); - if (typeof element === 'string') { - return element; - } else if (typeof element === 'number') { - return '' + element; - } else { - return null; - } - }, - getUpdateCount: function (id) { - var item = getItem(id); - return item ? item.updateCount : 0; - }, - - - getRootIDs: getRootIDs, - getRegisteredIDs: getItemIDs -}; - -var ReactComponentTreeHook_1 = ReactComponentTreeHook; + }); + } -var createElement = ReactElement_1.createElement; -var createFactory = ReactElement_1.createFactory; -var cloneElement = ReactElement_1.cloneElement; + return validatedFactory; +} -{ - var ReactElementValidator = ReactElementValidator_1; - createElement = ReactElementValidator.createElement; - createFactory = ReactElementValidator.createFactory; - cloneElement = ReactElementValidator.cloneElement; +function cloneElementWithValidation(element, props, children) { + var newElement = cloneElement.apply(this, arguments); + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], newElement.type); + } + validatePropTypes(newElement); + return newElement; } var React = { Children: { - map: ReactChildren_1.map, - forEach: ReactChildren_1.forEach, - count: ReactChildren_1.count, - toArray: ReactChildren_1.toArray, - only: onlyChild_1 + map: mapChildren, + forEach: forEachChildren, + count: countChildren, + toArray: toArray, + only: onlyChild }, - Component: ReactBaseClasses.Component, - PureComponent: ReactBaseClasses.PureComponent, - unstable_AsyncComponent: ReactBaseClasses.AsyncComponent, + Component: Component, + PureComponent: PureComponent, + unstable_AsyncComponent: AsyncComponent, - createElement: createElement, - cloneElement: cloneElement, - isValidElement: ReactElement_1.isValidElement, + Fragment: REACT_FRAGMENT_TYPE, - createFactory: createFactory, + createElement: createElementWithValidation, + cloneElement: cloneElementWithValidation, + createFactory: createFactoryWithValidation, + isValidElement: isValidElement, version: ReactVersion, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { - ReactCurrentOwner: ReactCurrentOwner_1, + ReactCurrentOwner: ReactCurrentOwner, // Used by renderers to avoid bundling object-assign twice in UMD bundles: - assign: index + assign: objectAssign } }; { - index(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. - ReactComponentTreeHook: ReactComponentTreeHook_1, - ReactDebugCurrentFrame: ReactDebugCurrentFrame_1 + ReactDebugCurrentFrame: ReactDebugCurrentFrame, + // Shim for React DOM 16.0.0 which still destructured (but not used) this. + // TODO: remove in React 17.0. + ReactComponentTreeHook: {} }); } -var ReactEntry = React; -return ReactEntry; + +var React$2 = Object.freeze({ + default: React +}); + +var React$3 = ( React$2 && React ) || React$2; + +// TODO: decide on the top-level export form. +// This is hacky but makes it work with both Rollup and Jest. +var react = React$3['default'] ? React$3['default'] : React$3; + +return react; }))); diff --git a/node_modules/react/umd/react.production.min.js b/node_modules/react/umd/react.production.min.js index 79c7d2012..9c934d7d1 100644 --- a/node_modules/react/umd/react.production.min.js +++ b/node_modules/react/umd/react.production.min.js @@ -1,22 +1,21 @@ -/* - React v16.0.0 - react.production.min.js - - 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 strict';function y(){function q(){}function n(a,b,c,d,e,f,g){return{$$typeof:J,type:a,key:b,ref:c,props:g,_owner:f}}function z(a){for(var b=arguments.length-1,c="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,d=0;d<b;d++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[d+1]);b=Error(c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");b.name="Invariant Violation";b.framesToPop= -1;throw b;}function r(a,b,c){this.props=a;this.context=b;this.refs=A;this.updater=c||B}function C(a,b,c){this.props=a;this.context=b;this.refs=A;this.updater=c||B}function D(){}function E(a,b,c){this.props=a;this.context=b;this.refs=A;this.updater=c||B}function v(a){return function(){return a}}function R(a){var b={"\x3d":"\x3d0",":":"\x3d2"};return"$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}function K(a,b,c,d){if(w.length){var e=w.pop();e.result=a;e.keyPrefix=b;e.func=c;e.context=d;e.count= -0;return e}return{result:a,keyPrefix:b,func:c,context:d,count:0}}function L(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>w.length&&w.push(a)}function u(a,b,c,d){var e=typeof a;if("undefined"===e||"boolean"===e)a=null;if(null===a||"string"===e||"number"===e||"object"===e&&a.$$typeof===S)return c(d,a,""===b?"."+F(a,0):b),1;var f=0;b=""===b?".":b+":";if(Array.isArray(a))for(var g=0;g<a.length;g++){e=a[g];var h=b+F(e,g);f+=u(e,h,c,d)}else if(h=M&&a[M]||a["@@iterator"],"function"=== -typeof h)for(a=h.call(a),g=0;!(e=a.next()).done;)e=e.value,h=b+F(e,g++),f+=u(e,h,c,d);else"object"===e&&(c=""+a,z("31","[object Object]"===c?"object with keys {"+Object.keys(a).join(", ")+"}":c,""));return f}function F(a,b){return"object"===typeof a&&null!==a&&null!=a.key?R(a.key):b.toString(36)}function T(a,b){a.func.call(a.context,b,a.count++)}function U(a,b,c){var d=a.result,e=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?G(a,d,c,H.thatReturnsArgument):null!=a&&(t.isValidElement(a)&& -(a=t.cloneAndReplaceKey(a,e+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(N,"$\x26/")+"/")+c)),d.push(a))}function G(a,b,c,d,e){var f="";null!=c&&(f=(""+c).replace(N,"$\x26/")+"/");b=K(b,f,d,e);null==a||u(a,"",U,b);L(b)}var O=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,x=function(){try{if(!Object.assign)return!1;var a=new String("abc");a[5]="de";if("5"===Object.getOwnPropertyNames(a)[0])return!1;var b={};for(a=0;10>a;a++)b["_"+String.fromCharCode(a)]= -a;if("0123456789"!==Object.getOwnPropertyNames(b).map(function(a){return b[a]}).join(""))return!1;var c={};"abcdefghijklmnopqrst".split("").forEach(function(a){c[a]=a});return"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},c)).join("")?!1:!0}catch(d){return!1}}()?Object.assign:function(a,b){if(null===a||void 0===a)throw new TypeError("Object.assign cannot be called with null or undefined");var c=Object(a);for(var d,e=1;e<arguments.length;e++){var f=Object(arguments[e]);for(var g in f)V.call(f, -g)&&(c[g]=f[g]);if(O){d=O(f);for(var h=0;h<d.length;h++)W.call(f,d[h])&&(c[d[h]]=f[d[h]])}}return c},B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A={};r.prototype.isReactComponent={};r.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?z("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};r.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")}; -D.prototype=r.prototype;var k=C.prototype=new D;k.constructor=C;x(k,r.prototype);k.isPureReactComponent=!0;k=E.prototype=new D;k.constructor=E;x(k,r.prototype);k.unstable_isAsyncReactComponent=!0;k.render=function(){return this.props.children};var I={current:null},P=Object.prototype.hasOwnProperty,J="function"===typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103,Q={key:!0,ref:!0,__self:!0,__source:!0};n.createElement=function(a,b,c){var d,e={},f=null,g=null,h=null,k=null;if(null!= -b)for(d in void 0!==b.ref&&(g=b.ref),void 0!==b.key&&(f=""+b.key),h=void 0===b.__self?null:b.__self,k=void 0===b.__source?null:b.__source,b)P.call(b,d)&&!Q.hasOwnProperty(d)&&(e[d]=b[d]);var m=arguments.length-2;if(1===m)e.children=c;else if(1<m){for(var l=Array(m),p=0;p<m;p++)l[p]=arguments[p+2];e.children=l}if(a&&a.defaultProps)for(d in m=a.defaultProps,m)void 0===e[d]&&(e[d]=m[d]);return n(a,f,g,h,k,I.current,e)};n.createFactory=function(a){var b=n.createElement.bind(null,a);b.type=a;return b}; -n.cloneAndReplaceKey=function(a,b){return n(a.type,b,a.ref,a._self,a._source,a._owner,a.props)};n.cloneElement=function(a,b,c){var d=x({},a.props),e=a.key,f=a.ref,g=a._self,h=a._source,k=a._owner;if(null!=b){void 0!==b.ref&&(f=b.ref,k=I.current);void 0!==b.key&&(e=""+b.key);if(a.type&&a.type.defaultProps)var m=a.type.defaultProps;for(l in b)P.call(b,l)&&!Q.hasOwnProperty(l)&&(d[l]=void 0===b[l]&&void 0!==m?m[l]:b[l])}var l=arguments.length-2;if(1===l)d.children=c;else if(1<l){m=Array(l);for(var p= -0;p<l;p++)m[p]=arguments[p+2];d.children=m}return n(a.type,e,f,g,h,k,d)};n.isValidElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===J};var t=n;q.thatReturns=v;q.thatReturnsFalse=v(!1);q.thatReturnsTrue=v(!0);q.thatReturnsNull=v(null);q.thatReturnsThis=function(){return this};q.thatReturnsArgument=function(a){return a};var H=q,M="function"===typeof Symbol&&Symbol.iterator,S="function"===typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103,N=/\/+/g,w=[];return{Children:{map:function(a, -b,c){if(null==a)return a;var d=[];G(a,d,null,b,c);return d},forEach:function(a,b,c){if(null==a)return a;b=K(null,null,b,c);null==a||u(a,"",T,b);L(b)},count:function(a){return null==a?0:u(a,"",H.thatReturnsNull,null)},toArray:function(a){var b=[];G(a,b,null,H.thatReturnsArgument);return b},only:function(a){t.isValidElement(a)?void 0:z("143");return a}},Component:r,PureComponent:C,unstable_AsyncComponent:E,createElement:t.createElement,cloneElement:t.cloneElement,isValidElement:t.isValidElement,createFactory:t.createFactory, -version:"16.0.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:I,assign:x}}}"object"===typeof exports&&"undefined"!==typeof module?module.exports=y():"function"===typeof define&&define.amd?define(y):this.React=y(); +/** @license React v16.2.0 + * react.production.min.js + * + * 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 strict';(function(q,k){"object"===typeof exports&&"undefined"!==typeof module?module.exports=k():"function"===typeof define&&define.amd?define(k):q.React=k()})(this,function(){function q(a){for(var b=arguments.length-1,c="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,d=0;d<b;d++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[d+1]);b=Error(c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."); +b.name="Invariant Violation";b.framesToPop=1;throw b;}function k(a){return function(){return a}}function p(a,b,c){this.props=a;this.context=b;this.refs=w;this.updater=c||x}function y(a,b,c){this.props=a;this.context=b;this.refs=w;this.updater=c||x}function z(){}function A(a,b,c){this.props=a;this.context=b;this.refs=w;this.updater=c||x}function G(a,b,c){var d,f={},l=null,e=null;if(null!=b)for(d in void 0!==b.ref&&(e=b.ref),void 0!==b.key&&(l=""+b.key),b)H.call(b,d)&&!I.hasOwnProperty(d)&&(f[d]=b[d]); +var g=arguments.length-2;if(1===g)f.children=c;else if(1<g){for(var h=Array(g),n=0;n<g;n++)h[n]=arguments[n+2];f.children=h}if(a&&a.defaultProps)for(d in g=a.defaultProps,g)void 0===f[d]&&(f[d]=g[d]);return{$$typeof:r,type:a,key:l,ref:e,props:f,_owner:B.current}}function C(a){return"object"===typeof a&&null!==a&&a.$$typeof===r}function O(a){var b={"\x3d":"\x3d0",":":"\x3d2"};return"$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}function J(a,b,c,d){if(u.length){var f=u.pop();f.result=a;f.keyPrefix= +b;f.func=c;f.context=d;f.count=0;return f}return{result:a,keyPrefix:b,func:c,context:d,count:0}}function K(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>u.length&&u.push(a)}function t(a,b,c,d){var f=typeof a;if("undefined"===f||"boolean"===f)a=null;var l=!1;if(null===a)l=!0;else switch(f){case "string":case "number":l=!0;break;case "object":switch(a.$$typeof){case r:case P:case Q:case R:l=!0}}if(l)return c(d,a,""===b?"."+D(a,0):b),1;l=0;b=""===b?".":b+":";if(Array.isArray(a))for(var e= +0;e<a.length;e++){f=a[e];var g=b+D(f,e);l+=t(f,g,c,d)}else if(null===a||"undefined"===typeof a?g=null:(g=L&&a[L]||a["@@iterator"],g="function"===typeof g?g:null),"function"===typeof g)for(a=g.call(a),e=0;!(f=a.next()).done;)f=f.value,g=b+D(f,e++),l+=t(f,g,c,d);else"object"===f&&(c=""+a,q("31","[object Object]"===c?"object with keys {"+Object.keys(a).join(", ")+"}":c,""));return l}function D(a,b){return"object"===typeof a&&null!==a&&null!=a.key?O(a.key):b.toString(36)}function S(a,b,c){a.func.call(a.context, +b,a.count++)}function T(a,b,c){var d=a.result,f=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?E(a,d,c,F.thatReturnsArgument):null!=a&&(C(a)&&(b=f+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(M,"$\x26/")+"/")+c,a={$$typeof:r,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}),d.push(a))}function E(a,b,c,d,f){var e="";null!=c&&(e=(""+c).replace(M,"$\x26/")+"/");b=J(b,e,d,f);null==a||t(a,"",T,b);K(b)}var N=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty, +V=Object.prototype.propertyIsEnumerable,v=function(){try{if(!Object.assign)return!1;var a=new String("abc");a[5]="de";if("5"===Object.getOwnPropertyNames(a)[0])return!1;var b={};for(a=0;10>a;a++)b["_"+String.fromCharCode(a)]=a;if("0123456789"!==Object.getOwnPropertyNames(b).map(function(a){return b[a]}).join(""))return!1;var c={};"abcdefghijklmnopqrst".split("").forEach(function(a){c[a]=a});return"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},c)).join("")?!1:!0}catch(d){return!1}}()?Object.assign: +function(a,b){if(null===a||void 0===a)throw new TypeError("Object.assign cannot be called with null or undefined");var c=Object(a);for(var d,f=1;f<arguments.length;f++){var e=Object(arguments[f]);for(var h in e)U.call(e,h)&&(c[h]=e[h]);if(N){d=N(e);for(var g=0;g<d.length;g++)V.call(e,d[g])&&(c[d[g]]=e[d[g]])}}return c},h="function"===typeof Symbol&&Symbol["for"],r=h?Symbol["for"]("react.element"):60103,P=h?Symbol["for"]("react.call"):60104,Q=h?Symbol["for"]("react.return"):60105,R=h?Symbol["for"]("react.portal"): +60106;h=h?Symbol["for"]("react.fragment"):60107;var L="function"===typeof Symbol&&Symbol.iterator,w={},e=function(){};e.thatReturns=k;e.thatReturnsFalse=k(!1);e.thatReturnsTrue=k(!0);e.thatReturnsNull=k(null);e.thatReturnsThis=function(){return this};e.thatReturnsArgument=function(a){return a};var F=e,x={isMounted:function(a){return!1},enqueueForceUpdate:function(a,b,c){},enqueueReplaceState:function(a,b,c,d){},enqueueSetState:function(a,b,c,d){}};p.prototype.isReactComponent={};p.prototype.setState= +function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?q("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};p.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};z.prototype=p.prototype;e=y.prototype=new z;e.constructor=y;v(e,p.prototype);e.isPureReactComponent=!0;e=A.prototype=new z;e.constructor=A;v(e,p.prototype);e.unstable_isAsyncReactComponent=!0;e.render=function(){return this.props.children};var B={current:null},H=Object.prototype.hasOwnProperty, +I={key:!0,ref:!0,__self:!0,__source:!0},M=/\/+/g,u=[];h={Children:{map:function(a,b,c){if(null==a)return a;var d=[];E(a,d,null,b,c);return d},forEach:function(a,b,c){if(null==a)return a;b=J(null,null,b,c);null==a||t(a,"",S,b);K(b)},count:function(a,b){return null==a?0:t(a,"",F.thatReturnsNull,null)},toArray:function(a){var b=[];E(a,b,null,F.thatReturnsArgument);return b},only:function(a){C(a)?void 0:q("143");return a}},Component:p,PureComponent:y,unstable_AsyncComponent:A,Fragment:h,createElement:G, +cloneElement:function(a,b,c){var d=v({},a.props),e=a.key,h=a.ref,k=a._owner;if(null!=b){void 0!==b.ref&&(h=b.ref,k=B.current);void 0!==b.key&&(e=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(m in b)H.call(b,m)&&!I.hasOwnProperty(m)&&(d[m]=void 0===b[m]&&void 0!==g?g[m]:b[m])}var m=arguments.length-2;if(1===m)d.children=c;else if(1<m){g=Array(m);for(var n=0;n<m;n++)g[n]=arguments[n+2];d.children=g}return{$$typeof:r,type:a.type,key:e,ref:h,props:d,_owner:k}},createFactory:function(a){var b= +G.bind(null,a);b.type=a;return b},isValidElement:C,version:"16.2.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:B,assign:v}};h=(e=Object.freeze({default:h}))&&h||e;return h["default"]?h["default"]:h}); |