diff --git a/mopidy_iris/static/app.js b/mopidy_iris/static/app.js index f4e4cd0f..3167a38c 100644 --- a/mopidy_iris/static/app.js +++ b/mopidy_iris/static/app.js @@ -1522,14 +1522,11 @@ var MEMO_STATICS = { }; var TYPE_STATICS = {}; TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; -TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; function getStatics(component) { - // React v16.11 and below if (reactIs.isMemo(component)) { return MEMO_STATICS; - } // React v16.12 and above - + } return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; } @@ -14862,7 +14859,7 @@ module.exports = ReactPropTypesSecret; /***/ (function(module, exports, __webpack_require__) { "use strict"; -/** @license React v16.13.0 +/** @license React v16.12.0 * react-dom.development.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -14881,92 +14878,240 @@ if (true) { var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); -var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/react-dom/node_modules/scheduler/index.js"); +var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js"); var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); -var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/react-dom/node_modules/scheduler/tracing.js"); +var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/scheduler/tracing.js"); -var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions. -// Current owner and dispatcher used to share the same ref, -// but PR #14548 split them out to better support the react-debug-tools package. +// Do not require this module directly! Use normal `invariant` calls with +// template literal strings. The messages will be replaced with error codes +// during build. -if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) { - ReactSharedInternals.ReactCurrentDispatcher = { - current: null - }; -} - -if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) { - ReactSharedInternals.ReactCurrentBatchConfig = { - suspense: null - }; -} - -// by calls to these methods by a Babel plugin. -// -// In PROD (or in packages without access to React internals), -// they are left as they are instead. - -function warn(format) { - { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - printWarning('warn', format, args); - } -} -function error(format) { - { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } -} - -function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0; - - if (!hasExistingStack) { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } - } - - var argsWithFormat = args.map(function (item) { - return '' + item; - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - - 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. - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - throw new Error(message); - } catch (x) {} - } -} +/** + * 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. + */ if (!React) { { - throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." ); + throw Error("ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM."); + } +} + +/** + * Injectable ordering of event plugins. + */ +var eventPluginOrder = null; +/** + * Injectable mapping from names to event plugin modules. + */ + +var namesToPlugins = {}; +/** + * Recomputes the plugin list using the injected plugins and plugin ordering. + * + * @private + */ + +function recomputePluginOrdering() { + if (!eventPluginOrder) { + // Wait until an `eventPluginOrder` is injected. + return; + } + + for (var pluginName in namesToPlugins) { + var pluginModule = namesToPlugins[pluginName]; + var pluginIndex = eventPluginOrder.indexOf(pluginName); + + if (!(pluginIndex > -1)) { + { + throw Error("EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`."); + } + } + + if (plugins[pluginIndex]) { + continue; + } + + if (!pluginModule.extractEvents) { + { + throw Error("EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not."); + } + } + + plugins[pluginIndex] = pluginModule; + var publishedEvents = pluginModule.eventTypes; + + for (var eventName in publishedEvents) { + if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) { + { + throw Error("EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`."); + } + } + } + } +} +/** + * Publishes an event so that it can be dispatched by the supplied plugin. + * + * @param {object} dispatchConfig Dispatch configuration for the event. + * @param {object} PluginModule Plugin publishing the event. + * @return {boolean} True if the event was successfully published. + * @private + */ + + +function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { + if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { + { + throw Error("EventPluginHub: More than one plugin attempted to publish the same event name, `" + eventName + "`."); + } + } + + eventNameDispatchConfigs[eventName] = dispatchConfig; + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + + if (phasedRegistrationNames) { + for (var phaseName in phasedRegistrationNames) { + if (phasedRegistrationNames.hasOwnProperty(phaseName)) { + var phasedRegistrationName = phasedRegistrationNames[phaseName]; + publishRegistrationName(phasedRegistrationName, pluginModule, eventName); + } + } + + return true; + } else if (dispatchConfig.registrationName) { + publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); + return true; + } + + return false; +} +/** + * Publishes a registration name that is used to identify dispatched events. + * + * @param {string} registrationName Registration name to add. + * @param {object} PluginModule Plugin publishing the event. + * @private + */ + + +function publishRegistrationName(registrationName, pluginModule, eventName) { + if (!!registrationNameModules[registrationName]) { + { + throw Error("EventPluginHub: More than one plugin attempted to publish the same registration name, `" + registrationName + "`."); + } + } + + registrationNameModules[registrationName] = pluginModule; + registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; + + { + var lowerCasedName = registrationName.toLowerCase(); + possibleRegistrationNames[lowerCasedName] = registrationName; + + if (registrationName === 'onDoubleClick') { + possibleRegistrationNames.ondblclick = registrationName; + } + } +} +/** + * Registers plugins so that they can extract and dispatch events. + * + * @see {EventPluginHub} + */ + +/** + * Ordered list of injected plugins. + */ + + +var plugins = []; +/** + * Mapping from event name to dispatch config + */ + +var eventNameDispatchConfigs = {}; +/** + * Mapping from registration name to plugin module + */ + +var registrationNameModules = {}; +/** + * Mapping from registration name to event name + */ + +var registrationNameDependencies = {}; +/** + * Mapping from lowercase registration names to the properly cased version, + * used to warn in the case of missing event handlers. Available + * only in true. + * @type {Object} + */ + +var possibleRegistrationNames = {}; // Trust the developer to only use possibleRegistrationNames in true + +/** + * Injects an ordering of plugins (by plugin name). This allows the ordering + * to be decoupled from injection of the actual plugins so that ordering is + * always deterministic regardless of packaging, on-the-fly injection, etc. + * + * @param {array} InjectedEventPluginOrder + * @internal + * @see {EventPluginHub.injection.injectEventPluginOrder} + */ + +function injectEventPluginOrder(injectedEventPluginOrder) { + if (!!eventPluginOrder) { + { + throw Error("EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."); + } + } // Clone the ordering so it cannot be dynamically mutated. + + + eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); + recomputePluginOrdering(); +} +/** + * Injects plugins to be used by `EventPluginHub`. The plugin names must be + * in the ordering injected by `injectEventPluginOrder`. + * + * Plugins can be injected as part of page initialization or on-the-fly. + * + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + * @internal + * @see {EventPluginHub.injection.injectEventPluginsByName} + */ + +function injectEventPluginsByName(injectedNamesToPlugins) { + var isOrderingDirty = false; + + for (var pluginName in injectedNamesToPlugins) { + if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { + continue; + } + + var pluginModule = injectedNamesToPlugins[pluginName]; + + if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { + if (!!namesToPlugins[pluginName]) { + { + throw Error("EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`."); + } + } + + namesToPlugins[pluginName] = pluginModule; + isOrderingDirty = true; + } + } + + if (isOrderingDirty) { + recomputePluginOrdering(); } } @@ -15011,7 +15156,7 @@ var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) // So we preemptively throw with a better message instead. if (!(typeof document !== 'undefined')) { { - throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." ); + throw Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous."); } } @@ -15203,12 +15348,64 @@ function clearCaughtError() { } else { { { - throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." ); + throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue."); } } } } +/** + * 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 warningWithoutStack = function () {}; + +{ + warningWithoutStack = function (condition, format) { + for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; + } + + if (format === undefined) { + throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument'); + } + + if (args.length > 8) { + // Check before the condition to catch violations early. + throw new Error('warningWithoutStack() currently supports at most 8 arguments.'); + } + + if (condition) { + return; + } + + if (typeof console !== 'undefined') { + var argsWithFormat = args.map(function (item) { + return '' + item; + }); + argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it + // breaks IE9: https://github.com/facebook/react/issues/13610 + + Function.prototype.apply.call(console.error, console, argsWithFormat); + } + + 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. + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + throw new Error(message); + } catch (x) {} + }; +} + +var warningWithoutStack$1 = warningWithoutStack; + var getFiberCurrentPropsFromNode = null; var getInstanceFromNode = null; var getNodeFromInstance = null; @@ -15218,9 +15415,7 @@ function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeI getNodeFromInstance = getNodeFromInstanceImpl; { - if (!getNodeFromInstance || !getInstanceFromNode) { - error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.'); - } + !(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0; } } var validateEventDispatches; @@ -15233,10 +15428,7 @@ var validateEventDispatches; var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; var instancesIsArr = Array.isArray(dispatchInstances); var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; - - if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) { - error('EventPluginUtils: Invalid `event`.'); - } + !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0; }; } /** @@ -15281,6 +15473,273 @@ function executeDispatchesInOrder(event) { event._dispatchListeners = null; event._dispatchInstances = null; } +/** + * @see executeDispatchesInOrderStopAtTrueImpl + */ + + + +/** + * Execution of a "direct" dispatch - there must be at most one dispatch + * accumulated on the event or it is considered an error. It doesn't really make + * sense for an event with multiple dispatches (bubbled) to keep track of the + * return values at each dispatch execution, but it does tend to make sense when + * dealing with "direct" dispatches. + * + * @return {*} The return value of executing the single dispatch. + */ + + +/** + * @param {SyntheticEvent} event + * @return {boolean} True iff number of dispatches accumulated is greater than 0. + */ + +/** + * Accumulates items that must not be null or undefined into the first one. This + * is used to conserve memory by avoiding array allocations, and thus sacrifices + * API cleanness. Since `current` can be null before being passed in and not + * null after this function, make sure to assign it back to `current`: + * + * `a = accumulateInto(a, b);` + * + * This API should be sparingly used. Try `accumulate` for something cleaner. + * + * @return {*|array<*>} An accumulation of items. + */ + +function accumulateInto(current, next) { + if (!(next != null)) { + { + throw Error("accumulateInto(...): Accumulated items must not be null or undefined."); + } + } + + if (current == null) { + return 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)) { + if (Array.isArray(next)) { + current.push.apply(current, next); + return current; + } + + current.push(next); + return current; + } + + if (Array.isArray(next)) { + // A bit too dangerous to mutate `next`. + return [current].concat(next); + } + + return [current, next]; +} + +/** + * @param {array} arr an "accumulation" of items which is either an Array or + * a single item. Useful when paired with the `accumulate` module. This is a + * simple utility that allows us to reason about a collection of items, but + * handling the case when there is exactly one item (and we do not need to + * allocate an array). + * @param {function} cb Callback invoked with each element or a collection. + * @param {?} [scope] Scope used as `this` in a callback. + */ +function forEachAccumulated(arr, cb, scope) { + if (Array.isArray(arr)) { + arr.forEach(cb, scope); + } else if (arr) { + cb.call(scope, arr); + } +} + +/** + * Internal queue of events that have accumulated their dispatches and are + * waiting to have their dispatches executed. + */ + +var eventQueue = null; +/** + * Dispatches an event and releases it back into the pool, unless persistent. + * + * @param {?object} event Synthetic event to be dispatched. + * @private + */ + +var executeDispatchesAndRelease = function (event) { + if (event) { + executeDispatchesInOrder(event); + + if (!event.isPersistent()) { + event.constructor.release(event); + } + } +}; + +var executeDispatchesAndReleaseTopLevel = function (e) { + return executeDispatchesAndRelease(e); +}; + +function runEventsInBatch(events) { + if (events !== null) { + eventQueue = accumulateInto(eventQueue, events); + } // Set `eventQueue` to null before processing it so that we can tell if more + // events get enqueued while processing. + + + var processingEventQueue = eventQueue; + eventQueue = null; + + if (!processingEventQueue) { + return; + } + + forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); + + if (!!eventQueue) { + { + throw Error("processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented."); + } + } // This would be a good time to rethrow if any of the event handlers threw. + + + rethrowCaughtError(); +} + +function isInteractive(tag) { + return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; +} + +function shouldPreventMouseEvent(name, type, props) { + switch (name) { + case 'onClick': + case 'onClickCapture': + case 'onDoubleClick': + case 'onDoubleClickCapture': + case 'onMouseDown': + case 'onMouseDownCapture': + case 'onMouseMove': + case 'onMouseMoveCapture': + case 'onMouseUp': + case 'onMouseUpCapture': + return !!(props.disabled && isInteractive(type)); + + default: + return false; + } +} +/** + * This is a unified interface for event plugins to be installed and configured. + * + * Event plugins can implement the following properties: + * + * `extractEvents` {function(string, DOMEventTarget, string, object): *} + * Required. When a top-level event is fired, this method is expected to + * extract synthetic events that will in turn be queued and dispatched. + * + * `eventTypes` {object} + * Optional, plugins that fire events must publish a mapping of registration + * names that are used to register listeners. Values of this mapping must + * be objects that contain `registrationName` or `phasedRegistrationNames`. + * + * `executeDispatch` {function(object, function, string)} + * Optional, allows plugins to override how an event gets dispatched. By + * default, the listener is simply invoked. + * + * Each plugin that is injected into `EventsPluginHub` is immediately operable. + * + * @public + */ + +/** + * Methods for injecting dependencies. + */ + + +var injection = { + /** + * @param {array} InjectedEventPluginOrder + * @public + */ + injectEventPluginOrder: injectEventPluginOrder, + + /** + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + */ + injectEventPluginsByName: injectEventPluginsByName +}; +/** + * @param {object} inst The instance, which is the source of events. + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @return {?function} The stored callback. + */ + +function getListener(inst, registrationName) { + var listener; // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not + // live here; needs to be moved to a better place soon + + var stateNode = inst.stateNode; + + if (!stateNode) { + // Work in progress (ex: onload events in incremental mode). + return null; + } + + var props = getFiberCurrentPropsFromNode(stateNode); + + if (!props) { + // Work in progress. + return null; + } + + listener = props[registrationName]; + + if (shouldPreventMouseEvent(registrationName, inst.type, props)) { + return null; + } + + if (!(!listener || typeof listener === 'function')) { + { + throw Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type."); + } + } + + return listener; +} +/** + * Allows registered plugins an opportunity to extract events from top-level + * native browser events. + * + * @return {*} An accumulation of synthetic events. + * @internal + */ + +function extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) { + var events = null; + + for (var i = 0; i < plugins.length; i++) { + // Not every plugin in the ordering may be loaded at runtime. + var possiblePlugin = plugins[i]; + + if (possiblePlugin) { + var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags); + + if (extractedEvents) { + events = accumulateInto(events, extractedEvents); + } + } + } + + return events; +} + +function runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) { + var events = extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags); + runEventsInBatch(events); +} var FunctionComponent = 0; var ClassComponent = 1; @@ -15307,10 +15766,25 @@ var DehydratedFragment = 18; var SuspenseListComponent = 19; var FundamentalComponent = 20; var ScopeComponent = 21; -var Block = 22; + +var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions. +// Current owner and dispatcher used to share the same ref, +// but PR #14548 split them out to better support the react-debug-tools package. + +if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) { + ReactSharedInternals.ReactCurrentDispatcher = { + current: null + }; +} + +if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) { + ReactSharedInternals.ReactCurrentBatchConfig = { + suspense: null + }; +} var BEFORE_SLASH_RE = /^(.*)[\\\/]/; -function describeComponentFrame (name, source, ownerName) { +var describeComponentFrame = function (name, source, ownerName) { var sourceInfo = ''; if (source) { @@ -15340,7 +15814,7 @@ function describeComponentFrame (name, source, ownerName) { } return '\n in ' + (name || 'Unknown') + sourceInfo; -} +}; // 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. @@ -15352,13 +15826,18 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +// (unstable) APIs that have been removed. Can we remove the symbols? + + var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; -var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; +var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; +var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; function getIteratorFn(maybeIterable) { @@ -15375,6 +15854,34 @@ function getIteratorFn(maybeIterable) { return null; } +/** + * 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 = warningWithoutStack$1; + +{ + warning = function (condition, format) { + if (condition) { + return; + } + + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args + + for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; + } + + warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack])); + }; +} + +var warning$1 = warning; + var Uninitialized = -1; var Pending = 0; var Resolved = 1; @@ -15394,7 +15901,7 @@ function initializeLazyComponentType(lazyComponent) { { if (defaultExport === undefined) { - error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject); + warning$1(false, 'lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject); } } @@ -15423,7 +15930,7 @@ function getComponentName(type) { { if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); + warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); } } @@ -15469,9 +15976,6 @@ function getComponentName(type) { case REACT_MEMO_TYPE: return getComponentName(type.type); - case REACT_BLOCK_TYPE: - return getComponentName(type.render); - case REACT_LAZY_TYPE: { var thenable = type; @@ -15553,6 +16057,8 @@ function getCurrentFiberStackInDev() { return getStackByFiberInDevAndProd(current); } + + return ''; } function resetCurrentFiber() { { @@ -15574,219 +16080,19 @@ function setCurrentPhase(lifeCyclePhase) { } } -/** - * Injectable ordering of event plugins. - */ -var eventPluginOrder = null; -/** - * Injectable mapping from names to event plugin modules. - */ - -var namesToPlugins = {}; -/** - * Recomputes the plugin list using the injected plugins and plugin ordering. - * - * @private - */ - -function recomputePluginOrdering() { - if (!eventPluginOrder) { - // Wait until an `eventPluginOrder` is injected. - return; - } - - for (var pluginName in namesToPlugins) { - var pluginModule = namesToPlugins[pluginName]; - var pluginIndex = eventPluginOrder.indexOf(pluginName); - - if (!(pluginIndex > -1)) { - { - throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`." ); - } - } - - if (plugins[pluginIndex]) { - continue; - } - - if (!pluginModule.extractEvents) { - { - throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not." ); - } - } - - plugins[pluginIndex] = pluginModule; - var publishedEvents = pluginModule.eventTypes; - - for (var eventName in publishedEvents) { - if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) { - { - throw Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`." ); - } - } - } - } -} -/** - * Publishes an event so that it can be dispatched by the supplied plugin. - * - * @param {object} dispatchConfig Dispatch configuration for the event. - * @param {object} PluginModule Plugin publishing the event. - * @return {boolean} True if the event was successfully published. - * @private - */ - - -function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { - if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { - { - throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + eventName + "`." ); - } - } - - eventNameDispatchConfigs[eventName] = dispatchConfig; - var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; - - if (phasedRegistrationNames) { - for (var phaseName in phasedRegistrationNames) { - if (phasedRegistrationNames.hasOwnProperty(phaseName)) { - var phasedRegistrationName = phasedRegistrationNames[phaseName]; - publishRegistrationName(phasedRegistrationName, pluginModule, eventName); - } - } - - return true; - } else if (dispatchConfig.registrationName) { - publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); - return true; - } - - return false; -} -/** - * Publishes a registration name that is used to identify dispatched events. - * - * @param {string} registrationName Registration name to add. - * @param {object} PluginModule Plugin publishing the event. - * @private - */ - - -function publishRegistrationName(registrationName, pluginModule, eventName) { - if (!!registrationNameModules[registrationName]) { - { - throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + registrationName + "`." ); - } - } - - registrationNameModules[registrationName] = pluginModule; - registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; - - { - var lowerCasedName = registrationName.toLowerCase(); - possibleRegistrationNames[lowerCasedName] = registrationName; - - if (registrationName === 'onDoubleClick') { - possibleRegistrationNames.ondblclick = registrationName; - } - } -} -/** - * Registers plugins so that they can extract and dispatch events. - */ - -/** - * Ordered list of injected plugins. - */ - - -var plugins = []; -/** - * Mapping from event name to dispatch config - */ - -var eventNameDispatchConfigs = {}; -/** - * Mapping from registration name to plugin module - */ - -var registrationNameModules = {}; -/** - * Mapping from registration name to event name - */ - -var registrationNameDependencies = {}; -/** - * Mapping from lowercase registration names to the properly cased version, - * used to warn in the case of missing event handlers. Available - * only in true. - * @type {Object} - */ - -var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true - -/** - * Injects an ordering of plugins (by plugin name). This allows the ordering - * to be decoupled from injection of the actual plugins so that ordering is - * always deterministic regardless of packaging, on-the-fly injection, etc. - * - * @param {array} InjectedEventPluginOrder - * @internal - */ - -function injectEventPluginOrder(injectedEventPluginOrder) { - if (!!eventPluginOrder) { - { - throw Error( "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." ); - } - } // Clone the ordering so it cannot be dynamically mutated. - - - eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); - recomputePluginOrdering(); -} -/** - * Injects plugins to be used by plugin event system. The plugin names must be - * in the ordering injected by `injectEventPluginOrder`. - * - * Plugins can be injected as part of page initialization or on-the-fly. - * - * @param {object} injectedNamesToPlugins Map from names to plugin modules. - * @internal - */ - -function injectEventPluginsByName(injectedNamesToPlugins) { - var isOrderingDirty = false; - - for (var pluginName in injectedNamesToPlugins) { - if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { - continue; - } - - var pluginModule = injectedNamesToPlugins[pluginName]; - - if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { - if (!!namesToPlugins[pluginName]) { - { - throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`." ); - } - } - - namesToPlugins[pluginName] = pluginModule; - isOrderingDirty = true; - } - } - - if (isOrderingDirty) { - recomputePluginOrdering(); - } -} - var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); +function endsWith(subject, search) { + var length = subject.length; + return subject.substring(length - search.length, length) === search; +} + var PLUGIN_EVENT_SYSTEM = 1; +var RESPONDER_EVENT_SYSTEM = 1 << 1; +var IS_PASSIVE = 1 << 2; +var IS_ACTIVE = 1 << 3; +var PASSIVE_NOT_SUPPORTED = 1 << 4; var IS_REPLAYED = 1 << 5; -var IS_FIRST_ANCESTOR = 1 << 6; var restoreImpl = null; var restoreTarget = null; @@ -15804,17 +16110,12 @@ function restoreStateOfTarget(target) { if (!(typeof restoreImpl === 'function')) { { - throw Error( "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." ); + throw Error("setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue."); } } - var stateNode = internalInstance.stateNode; // Guard against Fiber being unmounted. - - if (stateNode) { - var _props = getFiberCurrentPropsFromNode(stateNode); - - restoreImpl(internalInstance.stateNode, internalInstance.type, _props); - } + var props = getFiberCurrentPropsFromNode(internalInstance.stateNode); + restoreImpl(internalInstance.stateNode, internalInstance.type, props); } function setRestoreImplementation(impl) { @@ -15852,12 +16153,63 @@ function restoreStateIfNeeded() { } } +var enableUserTimingAPI = true; // Helps identify side effects in render-phase lifecycle hooks and setState +// reducers by double invoking them in Strict Mode. + +var debugRenderPhaseSideEffectsForStrictMode = true; // To preserve the "Pause on caught exceptions" behavior of the debugger, we +// replay the begin phase of a failed component inside invokeGuardedCallback. + +var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6: + +var warnAboutDeprecatedLifecycles = true; // Gather advanced timing metrics for Profiler subtrees. + var enableProfilerTimer = true; // Trace which interactions trigger each commit. -var enableDeprecatedFlareAPI = false; // Experimental Host Component support. +var enableSchedulerTracing = true; // SSR experiments + +var enableSuspenseServerRenderer = false; +var enableSelectiveHydration = false; // Only used in www builds. + + // Only used in www builds. + + // Disable javascript: URL strings in href for XSS protection. + +var disableJavaScriptURLs = false; // React Fire: prevent the value and checked attributes from syncing +// with their related DOM properties + +var disableInputAttributeSyncing = false; // These APIs will no longer be "unstable" in the upcoming 16.7 release, +// Control this behavior with a flag to support 16.6 minor releases in the meanwhile. + +var exposeConcurrentModeAPIs = false; +var warnAboutShorthandPropertyCollision = false; // Experimental React Flare event system and event components support. + +var enableFlareAPI = false; // Experimental Host Component support. var enableFundamentalAPI = false; // Experimental Scope support. + +var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107 + + // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?) +// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version + +var warnAboutUnmockedScheduler = false; // For tests, we flush suspense fallbacks in an act scope; +// *except* in some of our own tests, where we test incremental loading states. + +var flushSuspenseFallbacksInTests = true; // Add a callback property to suspense to notify which promises are currently +// in the update queue. This allows reporting and tracing of what is causing +// the user to see a loading state. +// Also allows hydration callbacks to fire when a dehydrated boundary gets +// hydrated or deleted. + +var enableSuspenseCallback = false; // Part of the simplification of React.createElement so we can eventually move +// from React.createElement to React.jsx +// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md + +var warnAboutDefaultPropsOnFunctionComponents = false; var warnAboutStringRefs = false; +var disableLegacyContext = false; +var disableSchedulerTimeoutBasedOnReactExpirationTime = false; +var enableTrustedTypesIntegration = false; // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance // the renderer. Such as when we're dispatching events or if third party // libraries need to call batchedUpdates. Eventually, this API will go away when @@ -15869,8 +16221,8 @@ var batchedUpdatesImpl = function (fn, bookkeeping) { return fn(bookkeeping); }; -var discreteUpdatesImpl = function (fn, a, b, c, d) { - return fn(a, b, c, d); +var discreteUpdatesImpl = function (fn, a, b, c) { + return fn(a, b, c); }; var flushDiscreteUpdatesImpl = function () {}; @@ -15927,12 +16279,24 @@ function batchedEventUpdates(fn, a, b) { finishEventHandler(); } } // This is for the React Flare event system -function discreteUpdates(fn, a, b, c, d) { + +function executeUserEventHandler(fn, value) { + var previouslyInEventHandler = isInsideEventHandler; + + try { + isInsideEventHandler = true; + var type = typeof value === 'object' && value !== null ? value.type : ''; + invokeGuardedCallbackAndCatchFirstError(type, fn, undefined, value); + } finally { + isInsideEventHandler = previouslyInEventHandler; + } +} +function discreteUpdates(fn, a, b, c) { var prevIsInsideEventHandler = isInsideEventHandler; isInsideEventHandler = true; try { - return discreteUpdatesImpl(fn, a, b, c, d); + return discreteUpdatesImpl(fn, a, b, c); } finally { isInsideEventHandler = prevIsInsideEventHandler; @@ -15941,6 +16305,7 @@ function discreteUpdates(fn, a, b, c, d) { } } } +var lastFlushedEventTimeStamp = 0; function flushDiscreteUpdatesIfNeeded(timeStamp) { // event.timeStamp isn't overly reliable due to inconsistencies in // how different browsers have historically provided the time stamp. @@ -15954,7 +16319,8 @@ function flushDiscreteUpdatesIfNeeded(timeStamp) { // such as if an earlier flush removes or adds event listeners that // are fired in the subsequent flush. However, this is the same // behaviour as we had before this change, so the risks are low. - if (!isInsideEventHandler && (!enableDeprecatedFlareAPI )) { + if (!isInsideEventHandler && (!enableFlareAPI || timeStamp === 0 || lastFlushedEventTimeStamp !== timeStamp)) { + lastFlushedEventTimeStamp = timeStamp; flushDiscreteUpdatesImpl(); } } @@ -15969,6 +16335,474 @@ var DiscreteEvent = 0; var UserBlockingEvent = 1; var ContinuousEvent = 2; +// CommonJS interop named imports. + +var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var runWithPriority = Scheduler.unstable_runWithPriority; +var listenToResponderEventTypesImpl; +function setListenToResponderEventTypes(_listenToResponderEventTypesImpl) { + listenToResponderEventTypesImpl = _listenToResponderEventTypesImpl; +} +var rootEventTypesToEventResponderInstances = new Map(); +var DoNotPropagateToNextResponder = 0; +var PropagateToNextResponder = 1; +var currentTimeStamp = 0; +var currentInstance = null; +var currentDocument = null; +var currentPropagationBehavior = DoNotPropagateToNextResponder; +var eventResponderContext = { + dispatchEvent: function (eventValue, eventListener, eventPriority) { + validateResponderContext(); + validateEventValue(eventValue); + + switch (eventPriority) { + case DiscreteEvent: + { + flushDiscreteUpdatesIfNeeded(currentTimeStamp); + discreteUpdates(function () { + return executeUserEventHandler(eventListener, eventValue); + }); + break; + } + + case UserBlockingEvent: + { + runWithPriority(UserBlockingPriority, function () { + return executeUserEventHandler(eventListener, eventValue); + }); + break; + } + + case ContinuousEvent: + { + executeUserEventHandler(eventListener, eventValue); + break; + } + } + }, + isTargetWithinResponder: function (target) { + validateResponderContext(); + + if (target != null) { + var fiber = getClosestInstanceFromNode(target); + var responderFiber = currentInstance.fiber; + + while (fiber !== null) { + if (fiber === responderFiber || fiber.alternate === responderFiber) { + return true; + } + + fiber = fiber.return; + } + } + + return false; + }, + isTargetWithinResponderScope: function (target) { + validateResponderContext(); + var componentInstance = currentInstance; + var responder = componentInstance.responder; + + if (target != null) { + var fiber = getClosestInstanceFromNode(target); + var responderFiber = currentInstance.fiber; + + while (fiber !== null) { + if (fiber === responderFiber || fiber.alternate === responderFiber) { + return true; + } + + if (doesFiberHaveResponder(fiber, responder)) { + return false; + } + + fiber = fiber.return; + } + } + + return false; + }, + isTargetWithinNode: function (childTarget, parentTarget) { + validateResponderContext(); + var childFiber = getClosestInstanceFromNode(childTarget); + var parentFiber = getClosestInstanceFromNode(parentTarget); + + if (childFiber != null && parentFiber != null) { + var parentAlternateFiber = parentFiber.alternate; + var node = childFiber; + + while (node !== null) { + if (node === parentFiber || node === parentAlternateFiber) { + return true; + } + + node = node.return; + } + + return false; + } // Fallback to DOM APIs + + + return parentTarget.contains(childTarget); + }, + addRootEventTypes: function (rootEventTypes) { + validateResponderContext(); + listenToResponderEventTypesImpl(rootEventTypes, currentDocument); + + for (var i = 0; i < rootEventTypes.length; i++) { + var rootEventType = rootEventTypes[i]; + var eventResponderInstance = currentInstance; + registerRootEventType(rootEventType, eventResponderInstance); + } + }, + removeRootEventTypes: function (rootEventTypes) { + validateResponderContext(); + + for (var i = 0; i < rootEventTypes.length; i++) { + var rootEventType = rootEventTypes[i]; + var rootEventResponders = rootEventTypesToEventResponderInstances.get(rootEventType); + var rootEventTypesSet = currentInstance.rootEventTypes; + + if (rootEventTypesSet !== null) { + rootEventTypesSet.delete(rootEventType); + } + + if (rootEventResponders !== undefined) { + rootEventResponders.delete(currentInstance); + } + } + }, + getActiveDocument: getActiveDocument, + objectAssign: _assign, + getTimeStamp: function () { + validateResponderContext(); + return currentTimeStamp; + }, + isTargetWithinHostComponent: function (target, elementType) { + validateResponderContext(); + var fiber = getClosestInstanceFromNode(target); + + while (fiber !== null) { + if (fiber.tag === HostComponent && fiber.type === elementType) { + return true; + } + + fiber = fiber.return; + } + + return false; + }, + continuePropagation: function () { + currentPropagationBehavior = PropagateToNextResponder; + }, + enqueueStateRestore: enqueueStateRestore, + getResponderNode: function () { + validateResponderContext(); + var responderFiber = currentInstance.fiber; + + if (responderFiber.tag === ScopeComponent) { + return null; + } + + return responderFiber.stateNode; + } +}; + +function validateEventValue(eventValue) { + if (typeof eventValue === 'object' && eventValue !== null) { + var target = eventValue.target, + type = eventValue.type, + timeStamp = eventValue.timeStamp; + + if (target == null || type == null || timeStamp == null) { + throw new Error('context.dispatchEvent: "target", "timeStamp", and "type" fields on event object are required.'); + } + + var showWarning = function (name) { + { + warning$1(false, '%s is not available on event objects created from event responder modules (React Flare). ' + 'Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.%s }`', name, name); + } + }; + + eventValue.isDefaultPrevented = function () { + { + showWarning('isDefaultPrevented()'); + } + }; + + eventValue.isPropagationStopped = function () { + { + showWarning('isPropagationStopped()'); + } + }; // $FlowFixMe: we don't need value, Flow thinks we do + + + Object.defineProperty(eventValue, 'nativeEvent', { + get: function () { + { + showWarning('nativeEvent'); + } + } + }); + } +} + +function doesFiberHaveResponder(fiber, responder) { + var tag = fiber.tag; + + if (tag === HostComponent || tag === ScopeComponent) { + var dependencies = fiber.dependencies; + + if (dependencies !== null) { + var respondersMap = dependencies.responders; + + if (respondersMap !== null && respondersMap.has(responder)) { + return true; + } + } + } + + return false; +} + +function getActiveDocument() { + return currentDocument; +} + +function createDOMResponderEvent(topLevelType, nativeEvent, nativeEventTarget, passive, passiveSupported) { + var _ref = nativeEvent, + buttons = _ref.buttons, + pointerType = _ref.pointerType; + var eventPointerType = ''; + + if (pointerType !== undefined) { + eventPointerType = pointerType; + } else if (nativeEvent.key !== undefined) { + eventPointerType = 'keyboard'; + } else if (buttons !== undefined) { + eventPointerType = 'mouse'; + } else if (nativeEvent.changedTouches !== undefined) { + eventPointerType = 'touch'; + } + + return { + nativeEvent: nativeEvent, + passive: passive, + passiveSupported: passiveSupported, + pointerType: eventPointerType, + target: nativeEventTarget, + type: topLevelType + }; +} + +function responderEventTypesContainType(eventTypes, type) { + for (var i = 0, len = eventTypes.length; i < len; i++) { + if (eventTypes[i] === type) { + return true; + } + } + + return false; +} + +function validateResponderTargetEventTypes(eventType, responder) { + var targetEventTypes = responder.targetEventTypes; // Validate the target event type exists on the responder + + if (targetEventTypes !== null) { + return responderEventTypesContainType(targetEventTypes, eventType); + } + + return false; +} + +function traverseAndHandleEventResponderInstances(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags) { + var isPassiveEvent = (eventSystemFlags & IS_PASSIVE) !== 0; + var isPassiveSupported = (eventSystemFlags & PASSIVE_NOT_SUPPORTED) === 0; + var isPassive = isPassiveEvent || !isPassiveSupported; + var eventType = isPassive ? topLevelType : topLevelType + '_active'; // Trigger event responders in this order: + // - Bubble target responder phase + // - Root responder phase + + var visitedResponders = new Set(); + var responderEvent = createDOMResponderEvent(topLevelType, nativeEvent, nativeEventTarget, isPassiveEvent, isPassiveSupported); + var node = targetFiber; + var insidePortal = false; + + while (node !== null) { + var _node = node, + dependencies = _node.dependencies, + tag = _node.tag; + + if (tag === HostPortal) { + insidePortal = true; + } else if ((tag === HostComponent || tag === ScopeComponent) && dependencies !== null) { + var respondersMap = dependencies.responders; + + if (respondersMap !== null) { + var responderInstances = Array.from(respondersMap.values()); + + for (var i = 0, length = responderInstances.length; i < length; i++) { + var responderInstance = responderInstances[i]; + var props = responderInstance.props, + responder = responderInstance.responder, + state = responderInstance.state; + + if (!visitedResponders.has(responder) && validateResponderTargetEventTypes(eventType, responder) && (!insidePortal || responder.targetPortalPropagation)) { + visitedResponders.add(responder); + var onEvent = responder.onEvent; + + if (onEvent !== null) { + currentInstance = responderInstance; + onEvent(responderEvent, eventResponderContext, props, state); + + if (currentPropagationBehavior === PropagateToNextResponder) { + visitedResponders.delete(responder); + currentPropagationBehavior = DoNotPropagateToNextResponder; + } + } + } + } + } + } + + node = node.return; + } // Root phase + + + var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(eventType); + + if (rootEventResponderInstances !== undefined) { + var _responderInstances = Array.from(rootEventResponderInstances); + + for (var _i = 0; _i < _responderInstances.length; _i++) { + var _responderInstance = _responderInstances[_i]; + var props = _responderInstance.props, + responder = _responderInstance.responder, + state = _responderInstance.state; + var onRootEvent = responder.onRootEvent; + + if (onRootEvent !== null) { + currentInstance = _responderInstance; + onRootEvent(responderEvent, eventResponderContext, props, state); + } + } + } +} + +function mountEventResponder(responder, responderInstance, props, state) { + var onMount = responder.onMount; + + if (onMount !== null) { + var previousInstance = currentInstance; + currentInstance = responderInstance; + + try { + batchedEventUpdates(function () { + onMount(eventResponderContext, props, state); + }); + } finally { + currentInstance = previousInstance; + } + } +} +function unmountEventResponder(responderInstance) { + var responder = responderInstance.responder; + var onUnmount = responder.onUnmount; + + if (onUnmount !== null) { + var props = responderInstance.props, + state = responderInstance.state; + var previousInstance = currentInstance; + currentInstance = responderInstance; + + try { + batchedEventUpdates(function () { + onUnmount(eventResponderContext, props, state); + }); + } finally { + currentInstance = previousInstance; + } + } + + var rootEventTypesSet = responderInstance.rootEventTypes; + + if (rootEventTypesSet !== null) { + var rootEventTypes = Array.from(rootEventTypesSet); + + for (var i = 0; i < rootEventTypes.length; i++) { + var topLevelEventType = rootEventTypes[i]; + var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(topLevelEventType); + + if (rootEventResponderInstances !== undefined) { + rootEventResponderInstances.delete(responderInstance); + } + } + } +} + +function validateResponderContext() { + if (!(currentInstance !== null)) { + { + throw Error("An event responder context was used outside of an event cycle."); + } + } +} + +function dispatchEventForResponderEventSystem(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags) { + if (enableFlareAPI) { + var previousInstance = currentInstance; + var previousTimeStamp = currentTimeStamp; + var previousDocument = currentDocument; + var previousPropagationBehavior = currentPropagationBehavior; + currentPropagationBehavior = DoNotPropagateToNextResponder; // nodeType 9 is DOCUMENT_NODE + + currentDocument = nativeEventTarget.nodeType === 9 ? nativeEventTarget : nativeEventTarget.ownerDocument; // We might want to control timeStamp another way here + + currentTimeStamp = nativeEvent.timeStamp; + + try { + batchedEventUpdates(function () { + traverseAndHandleEventResponderInstances(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags); + }); + } finally { + currentInstance = previousInstance; + currentTimeStamp = previousTimeStamp; + currentDocument = previousDocument; + currentPropagationBehavior = previousPropagationBehavior; + } + } +} +function addRootEventTypesForResponderInstance(responderInstance, rootEventTypes) { + for (var i = 0; i < rootEventTypes.length; i++) { + var rootEventType = rootEventTypes[i]; + registerRootEventType(rootEventType, responderInstance); + } +} + +function registerRootEventType(rootEventType, eventResponderInstance) { + var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(rootEventType); + + if (rootEventResponderInstances === undefined) { + rootEventResponderInstances = new Set(); + rootEventTypesToEventResponderInstances.set(rootEventType, rootEventResponderInstances); + } + + var rootEventTypesSet = eventResponderInstance.rootEventTypes; + + if (rootEventTypesSet === null) { + rootEventTypesSet = eventResponderInstance.rootEventTypes = new Set(); + } + + if (!!rootEventTypesSet.has(rootEventType)) { + { + throw Error("addRootEventTypes() found a duplicate root event type of \"" + rootEventType + "\". This might be because the event type exists in the event responder \"rootEventTypes\" array or because of a previous addRootEventTypes() using this root event type."); + } + } + + rootEventTypesSet.add(rootEventType); + rootEventResponderInstances.add(eventResponderInstance); +} + // A reserved attribute. // It is handled by React separately and shouldn't be written to the DOM. var RESERVED = 0; // A simple string attribute. @@ -16001,6 +16835,7 @@ var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\ /* eslint-enable max-len */ var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; + var ROOT_ATTRIBUTE_NAME = 'data-reactroot'; var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$'); var hasOwnProperty = Object.prototype.hasOwnProperty; @@ -16023,7 +16858,7 @@ function isAttributeNameSafe(attributeName) { illegalAttributeNameCache[attributeName] = true; { - error('Invalid attribute name: `%s`', attributeName); + warning$1(false, 'Invalid attribute name: `%s`', attributeName); } return false; @@ -16123,12 +16958,10 @@ function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attribut var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM. -var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular +['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular // elements (not just inputs). Now that ReactDOMInput assigns to the // defaultValue property -- do we need this? -'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style']; - -reservedProps.forEach(function (name) { +'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty name, // attributeName null, // attributeNamespace @@ -16177,10 +17010,7 @@ reservedProps.forEach(function (name) { ['checked', // Note: `option.selected` is not updated if `select.multiple` is // disabled with `removeAttribute`. We have special logic for handling this. -'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list, -// you'll need to set attributeName to name.toLowerCase() -// instead in the assignment below. -].forEach(function (name) { +'multiple', 'muted', 'selected'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty name, // attributeName null, // attributeNamespace @@ -16188,20 +17018,14 @@ reservedProps.forEach(function (name) { }); // These are HTML attributes that are "overloaded booleans": they behave like // booleans, but can also accept a string value. -['capture', 'download' // NOTE: if you add a camelCased prop to this list, -// you'll need to set attributeName to name.toLowerCase() -// instead in the assignment below. -].forEach(function (name) { +['capture', 'download'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty name, // attributeName null, // attributeNamespace false); }); // These are HTML attributes that must be positive numbers. -['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list, -// you'll need to set attributeName to name.toLowerCase() -// instead in the assignment below. -].forEach(function (name) { +['cols', 'rows', 'size', 'span'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty name, // attributeName null, // attributeNamespace @@ -16222,32 +17046,23 @@ var capitalize = function (token) { // or boolean value assignment. Regular attributes that just accept strings // and have the same names are omitted, just like in the HTML whitelist. // Some of these attributes can be hard to find. This list was created by -// scraping the MDN documentation. +// scrapping the MDN documentation. -['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list, -// you'll need to set attributeName to name.toLowerCase() -// instead in the assignment below. -].forEach(function (attributeName) { +['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, null, // attributeNamespace false); }); // String SVG attributes with the xlink namespace. -['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list, -// you'll need to set attributeName to name.toLowerCase() -// instead in the assignment below. -].forEach(function (attributeName) { +['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, 'http://www.w3.org/1999/xlink', false); }); // String SVG attributes with the xml namespace. -['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list, -// you'll need to set attributeName to name.toLowerCase() -// instead in the assignment below. -].forEach(function (attributeName) { +['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, 'http://www.w3.org/XML/1998/namespace', false); @@ -16293,15 +17108,78 @@ var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r var didWarn = false; function sanitizeURL(url) { - { - if (!didWarn && isJavaScriptProtocol.test(url)) { - didWarn = true; - - error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url)); + if (disableJavaScriptURLs) { + if (!!isJavaScriptProtocol.test(url)) { + { + throw Error("React has blocked a javascript: URL as a security precaution." + (ReactDebugCurrentFrame$1.getStackAddendum())); + } } + } else if ( true && !didWarn && isJavaScriptProtocol.test(url)) { + didWarn = true; + warning$1(false, 'A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url)); } } +// Flow does not allow string concatenation of most non-string types. To work +// around this limitation, we use an opaque type that can only be obtained by +// passing the value through getToStringValue first. +function toString(value) { + return '' + value; +} +function getToStringValue(value) { + switch (typeof value) { + case 'boolean': + case 'number': + case 'object': + case 'string': + case 'undefined': + return value; + + default: + // function, symbol are assigned as empty strings + return ''; + } +} +/** Trusted value is a wrapper for "safe" values which can be assigned to DOM execution sinks. */ + +/** + * We allow passing objects with toString method as element attributes or in dangerouslySetInnerHTML + * and we do validations that the value is safe. Once we do validation we want to use the validated + * value instead of the object (because object.toString may return something else on next call). + * + * If application uses Trusted Types we don't stringify trusted values, but preserve them as objects. + */ +var toStringOrTrustedType = toString; + +if (enableTrustedTypesIntegration && typeof trustedTypes !== 'undefined') { + toStringOrTrustedType = function (value) { + if (typeof value === 'object' && (trustedTypes.isHTML(value) || trustedTypes.isScript(value) || trustedTypes.isScriptURL(value) || + /* TrustedURLs are deprecated and will be removed soon: https://github.com/WICG/trusted-types/pull/204 */ + trustedTypes.isURL && trustedTypes.isURL(value))) { + // Pass Trusted Types through. + return value; + } + + return toString(value); + }; +} + +/** + * Set attribute for a node. The attribute value can be either string or + * Trusted value (if application uses Trusted Types). + */ +function setAttribute(node, attributeName, attributeValue) { + node.setAttribute(attributeName, attributeValue); +} +/** + * Set attribute with namespace for a node. The attribute value can be either string or + * Trusted value (if application uses Trusted Types). + */ + +function setAttributeNS(node, attributeNamespace, attributeName, attributeValue) { + node.setAttributeNS(attributeNamespace, attributeName, attributeValue); +} + /** * Get the value for a property on a node. Only used in DEV for SSR validation. * The "expected" argument is used as a hint of what the expected value is. @@ -16313,7 +17191,7 @@ function getValueForProperty(node, name, expected, propertyInfo) { var propertyName = propertyInfo.propertyName; return node[propertyName]; } else { - if ( propertyInfo.sanitizeURL) { + if (!disableJavaScriptURLs && propertyInfo.sanitizeURL) { // If we haven't fully disabled javascript: URLs, and if // the hydration is successful of a javascript: URL, we // still want to warn on the client. @@ -16423,7 +17301,7 @@ function setValueForProperty(node, name, value, isCustomComponentTag) { if (value === null) { node.removeAttribute(_attributeName); } else { - node.setAttribute(_attributeName, '' + value); + setAttribute(node, _attributeName, toStringOrTrustedType(value)); } } @@ -16464,9 +17342,7 @@ function setValueForProperty(node, name, value, isCustomComponentTag) { } else { // `setAttribute` with objects becomes only `[object]` in IE8/9, // ('' + value) makes it output the correct toString()-value. - { - attributeValue = '' + value; - } + attributeValue = toStringOrTrustedType(value); if (propertyInfo.sanitizeURL) { sanitizeURL(attributeValue.toString()); @@ -16474,34 +17350,13 @@ function setValueForProperty(node, name, value, isCustomComponentTag) { } if (attributeNamespace) { - node.setAttributeNS(attributeNamespace, attributeName, attributeValue); + setAttributeNS(node, attributeNamespace, attributeName, attributeValue); } else { - node.setAttribute(attributeName, attributeValue); + setAttribute(node, attributeName, attributeValue); } } } -// Flow does not allow string concatenation of most non-string types. To work -// around this limitation, we use an opaque type that can only be obtained by -// passing the value through getToStringValue first. -function toString(value) { - return '' + value; -} -function getToStringValue(value) { - switch (typeof value) { - case 'boolean': - case 'number': - case 'object': - case 'string': - case 'undefined': - return value; - - default: - // function, symbol are assigned as empty strings - return ''; - } -} - var ReactDebugCurrentFrame$2 = null; var ReactControlledValuePropTypes = { checkPropTypes: null @@ -16520,14 +17375,14 @@ var ReactControlledValuePropTypes = { }; var propTypes = { value: function (props, propName, componentName) { - if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) { + if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) { return null; } return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); }, checked: function (props, propName, componentName) { - if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) { + if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) { return null; } @@ -16651,6 +17506,7 @@ function updateValueIfChanged(node) { return false; } +// TODO: direct imports like some-package/src/* are bad. Fix me. var didWarnValueDefaultValue = false; var didWarnCheckedDefaultChecked = false; var didWarnControlledToUncontrolled = false; @@ -16696,14 +17552,12 @@ function initWrapperState(element, props) { ReactControlledValuePropTypes.checkPropTypes('input', props); if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { - error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); - + warning$1(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); didWarnCheckedDefaultChecked = true; } if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { - error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); - + warning$1(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); didWarnValueDefaultValue = true; } } @@ -16731,14 +17585,12 @@ function updateWrapper(element, props) { var controlled = isControlled(props); if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { - error('A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); - + warning$1(false, 'A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); didWarnUncontrolledToControlled = true; } if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { - error('A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); - + warning$1(false, 'A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); didWarnControlledToUncontrolled = true; } } @@ -16764,7 +17616,14 @@ function updateWrapper(element, props) { return; } - { + if (disableInputAttributeSyncing) { + // When not syncing the value attribute, React only assigns a new value + // whenever the defaultValue React prop has changed. When not present, + // React does nothing + if (props.hasOwnProperty('defaultValue')) { + setDefaultValue(node, props.type, getToStringValue(props.defaultValue)); + } + } else { // When syncing the value attribute, the value comes from a cascade of // properties: // 1. The value React property @@ -16777,7 +17636,16 @@ function updateWrapper(element, props) { } } - { + if (disableInputAttributeSyncing) { + // When not syncing the checked attribute, the attribute is directly + // controllable from the defaultValue React property. It needs to be + // updated as new props come in. + if (props.defaultChecked == null) { + node.removeAttribute('checked'); + } else { + node.defaultChecked = !!props.defaultChecked; + } + } else { // When syncing the checked attribute, it only changes when it needs // to be removed, such as transitioning from a checkbox into a text input if (props.checked == null && props.defaultChecked != null) { @@ -16802,7 +17670,24 @@ function postMountWrapper(element, props, isHydrating) { // from being lost during SSR hydration. if (!isHydrating) { - { + if (disableInputAttributeSyncing) { + var value = getToStringValue(props.value); // When not syncing the value attribute, the value property points + // directly to the React prop. Only assign it if it exists. + + if (value != null) { + // Always assign on buttons so that it is possible to assign an + // empty string to clear button text. + // + // Otherwise, do not re-assign the value property if is empty. This + // potentially avoids a DOM write and prevents Firefox (~60.0.1) from + // prematurely marking required inputs as invalid. Equality is compared + // to the current value in case the browser provided value is not an + // empty string. + if (isButton || value !== node.value) { + node.value = toString(value); + } + } + } else { // When syncing the value attribute, the value property should use // the wrapperState._initialValue property. This uses: // @@ -16815,7 +17700,15 @@ function postMountWrapper(element, props, isHydrating) { } } - { + if (disableInputAttributeSyncing) { + // When not syncing the value attribute, assign the value attribute + // directly from the defaultValue React property (when present) + var defaultValue = getToStringValue(props.defaultValue); + + if (defaultValue != null) { + node.defaultValue = toString(defaultValue); + } + } else { // Otherwise, the value attribute is synchronized to the property, // so we assign defaultValue to the same thing as the value property // assignment step above. @@ -16834,7 +17727,23 @@ function postMountWrapper(element, props, isHydrating) { node.name = ''; } - { + if (disableInputAttributeSyncing) { + // When not syncing the checked attribute, the checked property + // never gets assigned. It must be manually set. We don't want + // to do this when hydrating so that existing user input isn't + // modified + if (!isHydrating) { + updateChecked(element, props); + } // Only assign the checked attribute if it is defined. This saves + // a DOM write when controlling the checked attribute isn't needed + // (text inputs, submit/reset) + + + if (props.hasOwnProperty('defaultChecked')) { + node.defaultChecked = !node.defaultChecked; + node.defaultChecked = !!props.defaultChecked; + } + } else { // When syncing the checked attribute, both the checked property and // attribute are assigned at the same time using defaultChecked. This uses: // @@ -16849,7 +17758,7 @@ function postMountWrapper(element, props, isHydrating) { node.name = name; } } -function restoreControlledState(element, props) { +function restoreControlledState$1(element, props) { var node = element; updateWrapper(node, props); updateNamedCousins(node, props); @@ -16889,7 +17798,7 @@ function updateNamedCousins(rootNode, props) { if (!otherProps) { { - throw Error( "ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported." ); + throw Error("ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported."); } } // We need update the tracked value on the named cousin since the value // was changed but the input saw no event or value set @@ -16971,16 +17880,14 @@ function validateProps(element, props) { if (!didWarnInvalidChild) { didWarnInvalidChild = true; - - error('Only strings and numbers are supported as