aboutsummaryrefslogtreecommitdiff
path: root/node_modules/react-dom/umd/react-dom-server.browser.development.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/react-dom/umd/react-dom-server.browser.development.js')
-rw-r--r--node_modules/react-dom/umd/react-dom-server.browser.development.js2960
1 files changed, 905 insertions, 2055 deletions
diff --git a/node_modules/react-dom/umd/react-dom-server.browser.development.js b/node_modules/react-dom/umd/react-dom-server.browser.development.js
index c7d541f17..2c5055500 100644
--- a/node_modules/react-dom/umd/react-dom-server.browser.development.js
+++ b/node_modules/react-dom/umd/react-dom-server.browser.development.js
@@ -1,4 +1,4 @@
-/** @license React v16.0.0
+/** @license React v16.2.0
* react-dom-server.browser.development.js
*
* Copyright (c) 2013-present, Facebook, Inc.
@@ -7,87 +7,30 @@
* LICENSE file in the root directory of this source tree.
*/
+'use strict';
+
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
typeof define === 'function' && define.amd ? define(['react'], factory) :
(global.ReactDOMServer = factory(global.React));
-}(this, (function (react) { 'use strict';
+}(this, (function (React) { 'use strict';
/**
- * 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
- *
+ * 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.
*/
-var ReactInternals = react.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
-
-var assign = ReactInternals.assign;
-
/**
* 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 DOMNamespaces
*/
-var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
-var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
-var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
-var Namespaces$1 = {
- html: HTML_NAMESPACE,
- mathml: MATH_NAMESPACE,
- svg: SVG_NAMESPACE
-};
-
-// Assumes there is no parent namespace.
-function getIntrinsicNamespace$1(type) {
- switch (type) {
- case 'svg':
- return SVG_NAMESPACE;
- case 'math':
- return MATH_NAMESPACE;
- default:
- return HTML_NAMESPACE;
- }
-}
-
-function getChildNamespace$1(parentNamespace, type) {
- if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
- // No (or default) parent namespace: potential entry point.
- return getIntrinsicNamespace$1(type);
- }
- if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
- // We're leaving SVG.
- return HTML_NAMESPACE;
- }
- // By default, pass namespace below.
- return parentNamespace;
-}
-
-var Namespaces_1 = Namespaces$1;
-var getIntrinsicNamespace_1 = getIntrinsicNamespace$1;
-var getChildNamespace_1 = getChildNamespace$1;
-
-var DOMNamespaces = {
- Namespaces: Namespaces_1,
- getIntrinsicNamespace: getIntrinsicNamespace_1,
- getChildNamespace: getChildNamespace_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.
- *
- */
/**
* Use invariant() to assert state which your program assumes to be true.
@@ -135,14 +78,14 @@ var invariant_1 = invariant;
// These attributes should be all lowercase to allow for
// case insensitive checks
-var RESERVED_PROPS$1 = {
+var RESERVED_PROPS = {
children: true,
dangerouslySetInnerHTML: true,
- autoFocus: true,
defaultValue: true,
defaultChecked: true,
innerHTML: true,
suppressContentEditableWarning: true,
+ suppressHydrationWarning: true,
style: true
};
@@ -193,7 +136,7 @@ var DOMPropertyInjection = {
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
for (var propName in Properties) {
- !!DOMProperty.properties.hasOwnProperty(propName) ? invariant_1(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : void 0;
+ !!properties.hasOwnProperty(propName) ? invariant_1(false, "injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.", propName) : void 0;
var lowerCased = propName.toLowerCase();
var propConfig = Properties[propName];
@@ -211,7 +154,7 @@ var DOMPropertyInjection = {
hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE),
hasStringBooleanValue: checkMask(propConfig, Injection.HAS_STRING_BOOLEAN_VALUE)
};
- !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? invariant_1(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : void 0;
+ !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? invariant_1(false, "DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s", propName) : void 0;
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
@@ -231,258 +174,399 @@ var DOMPropertyInjection = {
// without case-sensitivity. This allows the whitelist to pick up
// `allowfullscreen`, which should be written using the property configuration
// for `allowFullscreen`
- DOMProperty.properties[propName] = propertyInfo;
+ properties[propName] = propertyInfo;
}
}
};
/* eslint-disable max-len */
-var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
+var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
/* 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';
/**
- * DOMProperty exports lookup objects that can be used like functions:
- *
- * > DOMProperty.isValid['id']
- * true
- * > DOMProperty.isValid['foobar']
- * undefined
- *
- * Although this may be confusing, it performs better in general.
+ * Map from property "standard name" to an object with info about how to set
+ * the property in the DOM. Each object contains:
+ *
+ * attributeName:
+ * Used when rendering markup or with `*Attribute()`.
+ * attributeNamespace
+ * propertyName:
+ * Used on DOM node instances. (This includes properties that mutate due to
+ * external factors.)
+ * mutationMethod:
+ * If non-null, used instead of the property or `setAttribute()` after
+ * initial render.
+ * mustUseProperty:
+ * Whether the property must be accessed and mutated as an object property.
+ * hasBooleanValue:
+ * Whether the property should be removed when set to a falsey value.
+ * hasNumericValue:
+ * Whether the property must be numeric or parse as a numeric and should be
+ * removed when set to a falsey value.
+ * hasPositiveNumericValue:
+ * Whether the property must be positive numeric or parse as a positive
+ * numeric and should be removed when set to a falsey value.
+ * hasOverloadedBooleanValue:
+ * Whether the property can be used as a flag as well as with a value.
+ * Removed when strictly equal to false; present without a value when
+ * strictly equal to true; present with a value otherwise.
+ */
+var properties = {};
+
+/**
+ * Checks whether a property name is a writeable attribute.
+ * @method
+ */
+function shouldSetAttribute(name, value) {
+ if (isReservedProp(name)) {
+ return false;
+ }
+ if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
+ return false;
+ }
+ if (value === null) {
+ return true;
+ }
+ switch (typeof value) {
+ case 'boolean':
+ return shouldAttributeAcceptBooleanValue(name);
+ case 'undefined':
+ case 'number':
+ case 'string':
+ case 'object':
+ return true;
+ default:
+ // function, symbol
+ return false;
+ }
+}
+
+function getPropertyInfo(name) {
+ return properties.hasOwnProperty(name) ? properties[name] : null;
+}
+
+function shouldAttributeAcceptBooleanValue(name) {
+ if (isReservedProp(name)) {
+ return true;
+ }
+ var propertyInfo = getPropertyInfo(name);
+ if (propertyInfo) {
+ return propertyInfo.hasBooleanValue || propertyInfo.hasStringBooleanValue || propertyInfo.hasOverloadedBooleanValue;
+ }
+ var prefix = name.toLowerCase().slice(0, 5);
+ return prefix === 'data-' || prefix === 'aria-';
+}
+
+/**
+ * Checks to see if a property name is within the list of properties
+ * reserved for internal React operations. These properties should
+ * not be set on an HTML element.
*
- * @see http://jsperf.com/key-exists
- * @see http://jsperf.com/key-missing
+ * @private
+ * @param {string} name
+ * @return {boolean} If the name is within reserved props
*/
-var DOMProperty = {
- ID_ATTRIBUTE_NAME: 'data-reactid',
- ROOT_ATTRIBUTE_NAME: 'data-reactroot',
+function isReservedProp(name) {
+ return RESERVED_PROPS.hasOwnProperty(name);
+}
- ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
- ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
+var injection = DOMPropertyInjection;
- /**
- * Map from property "standard name" to an object with info about how to set
- * the property in the DOM. Each object contains:
- *
- * attributeName:
- * Used when rendering markup or with `*Attribute()`.
- * attributeNamespace
- * propertyName:
- * Used on DOM node instances. (This includes properties that mutate due to
- * external factors.)
- * mutationMethod:
- * If non-null, used instead of the property or `setAttribute()` after
- * initial render.
- * mustUseProperty:
- * Whether the property must be accessed and mutated as an object property.
- * hasBooleanValue:
- * Whether the property should be removed when set to a falsey value.
- * hasNumericValue:
- * Whether the property must be numeric or parse as a numeric and should be
- * removed when set to a falsey value.
- * hasPositiveNumericValue:
- * Whether the property must be positive numeric or parse as a positive
- * numeric and should be removed when set to a falsey value.
- * hasOverloadedBooleanValue:
- * Whether the property can be used as a flag as well as with a value.
- * Removed when strictly equal to false; present without a value when
- * strictly equal to true; present with a value otherwise.
- */
- properties: {},
+var MUST_USE_PROPERTY = injection.MUST_USE_PROPERTY;
+var HAS_BOOLEAN_VALUE = injection.HAS_BOOLEAN_VALUE;
+var HAS_NUMERIC_VALUE = injection.HAS_NUMERIC_VALUE;
+var HAS_POSITIVE_NUMERIC_VALUE = injection.HAS_POSITIVE_NUMERIC_VALUE;
+var HAS_OVERLOADED_BOOLEAN_VALUE = injection.HAS_OVERLOADED_BOOLEAN_VALUE;
+var HAS_STRING_BOOLEAN_VALUE = injection.HAS_STRING_BOOLEAN_VALUE;
- /**
- * Checks whether a property name is a writeable attribute.
- * @method
- */
- shouldSetAttribute: function (name, value) {
- if (DOMProperty.isReservedProp(name)) {
- return false;
- }
- if ((name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
- return false;
- }
- if (value === null) {
- return true;
- }
- switch (typeof value) {
- case 'boolean':
- return DOMProperty.shouldAttributeAcceptBooleanValue(name);
- case 'undefined':
- case 'number':
- case 'string':
- case 'object':
- return true;
- default:
- // function, symbol
- return false;
- }
+var HTMLDOMPropertyConfig = {
+ // When adding attributes to this list, be sure to also add them to
+ // the `possibleStandardNames` module to ensure casing and incorrect
+ // name warnings.
+ Properties: {
+ allowFullScreen: HAS_BOOLEAN_VALUE,
+ // specifies target context for links with `preload` type
+ async: HAS_BOOLEAN_VALUE,
+ // Note: there is a special case that prevents it from being written to the DOM
+ // on the client side because the browsers are inconsistent. Instead we call focus().
+ autoFocus: HAS_BOOLEAN_VALUE,
+ autoPlay: HAS_BOOLEAN_VALUE,
+ capture: HAS_OVERLOADED_BOOLEAN_VALUE,
+ checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
+ cols: HAS_POSITIVE_NUMERIC_VALUE,
+ contentEditable: HAS_STRING_BOOLEAN_VALUE,
+ controls: HAS_BOOLEAN_VALUE,
+ 'default': HAS_BOOLEAN_VALUE,
+ defer: HAS_BOOLEAN_VALUE,
+ disabled: HAS_BOOLEAN_VALUE,
+ download: HAS_OVERLOADED_BOOLEAN_VALUE,
+ draggable: HAS_STRING_BOOLEAN_VALUE,
+ formNoValidate: HAS_BOOLEAN_VALUE,
+ hidden: HAS_BOOLEAN_VALUE,
+ loop: HAS_BOOLEAN_VALUE,
+ // Caution; `option.selected` is not updated if `select.multiple` is
+ // disabled with `removeAttribute`.
+ multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
+ muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
+ noValidate: HAS_BOOLEAN_VALUE,
+ open: HAS_BOOLEAN_VALUE,
+ playsInline: HAS_BOOLEAN_VALUE,
+ readOnly: HAS_BOOLEAN_VALUE,
+ required: HAS_BOOLEAN_VALUE,
+ reversed: HAS_BOOLEAN_VALUE,
+ rows: HAS_POSITIVE_NUMERIC_VALUE,
+ rowSpan: HAS_NUMERIC_VALUE,
+ scoped: HAS_BOOLEAN_VALUE,
+ seamless: HAS_BOOLEAN_VALUE,
+ selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
+ size: HAS_POSITIVE_NUMERIC_VALUE,
+ start: HAS_NUMERIC_VALUE,
+ // support for projecting regular DOM Elements via V1 named slots ( shadow dom )
+ span: HAS_POSITIVE_NUMERIC_VALUE,
+ spellCheck: HAS_STRING_BOOLEAN_VALUE,
+ // Style must be explicitly set in the attribute list. React components
+ // expect a style object
+ style: 0,
+ // Keep it in the whitelist because it is case-sensitive for SVG.
+ tabIndex: 0,
+ // itemScope is for for Microdata support.
+ // See http://schema.org/docs/gs.html
+ itemScope: HAS_BOOLEAN_VALUE,
+ // These attributes must stay in the white-list because they have
+ // different attribute names (see DOMAttributeNames below)
+ acceptCharset: 0,
+ className: 0,
+ htmlFor: 0,
+ httpEquiv: 0,
+ // Attributes with mutation methods must be specified in the whitelist
+ // Set the string boolean flag to allow the behavior
+ value: HAS_STRING_BOOLEAN_VALUE
},
-
- getPropertyInfo: function (name) {
- return DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ DOMAttributeNames: {
+ acceptCharset: 'accept-charset',
+ className: 'class',
+ htmlFor: 'for',
+ httpEquiv: 'http-equiv'
},
- shouldAttributeAcceptBooleanValue: function (name) {
- if (DOMProperty.isReservedProp(name)) {
- return true;
- }
- var propertyInfo = DOMProperty.getPropertyInfo(name);
- if (propertyInfo) {
- return propertyInfo.hasBooleanValue || propertyInfo.hasStringBooleanValue || propertyInfo.hasOverloadedBooleanValue;
+ DOMMutationMethods: {
+ value: function (node, value) {
+ if (value == null) {
+ return node.removeAttribute('value');
+ }
+
+ // Number inputs get special treatment due to some edge cases in
+ // Chrome. Let everything else assign the value attribute as normal.
+ // https://github.com/facebook/react/issues/7253#issuecomment-236074326
+ if (node.type !== 'number' || node.hasAttribute('value') === false) {
+ node.setAttribute('value', '' + value);
+ } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) {
+ // Don't assign an attribute if validation reports bad
+ // input. Chrome will clear the value. Additionally, don't
+ // operate on inputs that have focus, otherwise Chrome might
+ // strip off trailing decimal places and cause the user's
+ // cursor position to jump to the beginning of the input.
+ //
+ // In ReactDOMInput, we have an onBlur event that will trigger
+ // this function again when focus is lost.
+ node.setAttribute('value', '' + value);
+ }
}
- var prefix = name.toLowerCase().slice(0, 5);
- return prefix === 'data-' || prefix === 'aria-';
- },
+ }
+};
+var HAS_STRING_BOOLEAN_VALUE$1 = injection.HAS_STRING_BOOLEAN_VALUE;
- /**
- * Checks to see if a property name is within the list of properties
- * reserved for internal React operations. These properties should
- * not be set on an HTML element.
- *
- * @private
- * @param {string} name
- * @return {boolean} If the name is within reserved props
- */
- isReservedProp: function (name) {
- return RESERVED_PROPS$1.hasOwnProperty(name);
- },
+var NS = {
+ xlink: 'http://www.w3.org/1999/xlink',
+ xml: 'http://www.w3.org/XML/1998/namespace'
+};
- injection: DOMPropertyInjection
+/**
+ * This is a list of all SVG attributes that need special casing,
+ * namespacing, or boolean value assignment.
+ *
+ * When adding attributes to this list, be sure to also add them to
+ * the `possibleStandardNames` module to ensure casing and incorrect
+ * name warnings.
+ *
+ * SVG Attributes List:
+ * https://www.w3.org/TR/SVG/attindex.html
+ * SMIL Spec:
+ * https://www.w3.org/TR/smil
+ */
+var ATTRS = ['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', 'x-height', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xmlns:xlink', 'xml:lang', 'xml:space'];
+
+var SVGDOMPropertyConfig = {
+ Properties: {
+ autoReverse: HAS_STRING_BOOLEAN_VALUE$1,
+ externalResourcesRequired: HAS_STRING_BOOLEAN_VALUE$1,
+ preserveAlpha: HAS_STRING_BOOLEAN_VALUE$1
+ },
+ DOMAttributeNames: {
+ autoReverse: 'autoReverse',
+ externalResourcesRequired: 'externalResourcesRequired',
+ preserveAlpha: 'preserveAlpha'
+ },
+ DOMAttributeNamespaces: {
+ xlinkActuate: NS.xlink,
+ xlinkArcrole: NS.xlink,
+ xlinkHref: NS.xlink,
+ xlinkRole: NS.xlink,
+ xlinkShow: NS.xlink,
+ xlinkTitle: NS.xlink,
+ xlinkType: NS.xlink,
+ xmlBase: NS.xml,
+ xmlLang: NS.xml,
+ xmlSpace: NS.xml
+ }
+};
+
+var CAMELIZE = /[\-\:]([a-z])/g;
+var capitalize = function (token) {
+ return token[1].toUpperCase();
};
-var DOMProperty_1 = DOMProperty;
+ATTRS.forEach(function (original) {
+ var reactName = original.replace(CAMELIZE, capitalize);
+
+ SVGDOMPropertyConfig.Properties[reactName] = 0;
+ SVGDOMPropertyConfig.DOMAttributeNames[reactName] = original;
+});
+
+injection.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
+injection.injectDOMPropertyConfig(SVGDOMPropertyConfig);
+
+// TODO: this is special because it gets imported during build.
+
+var ReactVersion = '16.2.0';
+
+var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+
+var _assign = ReactInternals.assign;
/**
- * Copyright (c) 2016-present, Facebook, Inc.
+ * 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.
*
- * Based on the escape-html library, which is used under the MIT License below:
- *
- * Copyright (c) 2012-2013 TJ Holowaychuk
- * Copyright (c) 2015 Andreas Lubbe
- * Copyright (c) 2015 Tiancheng "Timothy" Gu
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * 'Software'), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * @providesModule escapeTextContentForBrowser
+ *
*/
-// code copied and modified from escape-html
+function makeEmptyFunction(arg) {
+ return function () {
+ return arg;
+ };
+}
+
/**
- * Module variables.
- * @private
+ * This function accepts and discards inputs; it has no side effects. This is
+ * primarily useful idiomatically for overridable function endpoints which
+ * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
+var emptyFunction = function emptyFunction() {};
-var matchHtmlRegExp = /["'&<>]/;
+emptyFunction.thatReturns = makeEmptyFunction;
+emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
+emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
+emptyFunction.thatReturnsNull = makeEmptyFunction(null);
+emptyFunction.thatReturnsThis = function () {
+ return this;
+};
+emptyFunction.thatReturnsArgument = function (arg) {
+ return arg;
+};
+
+var emptyFunction_1 = emptyFunction;
/**
- * Escape special characters in the given string of html.
+ * 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.
*
- * @param {string} string The string to escape for inserting into HTML
- * @return {string}
- * @public
*/
-function escapeHtml(string) {
- var str = '' + string;
- var match = matchHtmlRegExp.exec(str);
- if (!match) {
- return str;
- }
- var escape;
- var html = '';
- var index = 0;
- var lastIndex = 0;
+var emptyObject = {};
- for (index = match.index; index < str.length; index++) {
- switch (str.charCodeAt(index)) {
- case 34:
- // "
- escape = '&quot;';
- break;
- case 38:
- // &
- escape = '&amp;';
- break;
- case 39:
- // '
- escape = '&#x27;'; // modified from escape-html; used to be '&#39'
- break;
- case 60:
- // <
- escape = '&lt;';
- break;
- case 62:
- // >
- escape = '&gt;';
- break;
- default:
- continue;
- }
+{
+ Object.freeze(emptyObject);
+}
- if (lastIndex !== index) {
- html += str.substring(lastIndex, index);
- }
+var emptyObject_1 = emptyObject;
- lastIndex = index + 1;
- html += escape;
- }
+/**
+ * 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.
+ *
+ * @typechecks
+ */
- return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
-}
-// end code copied and modified from escape-html
+var _uppercasePattern = /([A-Z])/g;
/**
- * Escapes text to prevent scripting attacks.
+ * Hyphenates a camelcased string, for example:
*
- * @param {*} text Text value to escape.
- * @return {string} An escaped string.
+ * > hyphenate('backgroundColor')
+ * < "background-color"
+ *
+ * For CSS style names, use `hyphenateStyleName` instead which works properly
+ * with all vendor prefixes, including `ms`.
+ *
+ * @param {string} string
+ * @return {string}
*/
-function escapeTextContentForBrowser(text) {
- if (typeof text === 'boolean' || typeof text === 'number') {
- // this shortcircuit helps perf for types that we know will never have
- // special characters, especially given that this function is used often
- // for numeric dom ids.
- return '' + text;
- }
- return escapeHtml(text);
+function hyphenate(string) {
+ return string.replace(_uppercasePattern, '-$1').toLowerCase();
}
-var escapeTextContentForBrowser_1 = escapeTextContentForBrowser;
+var hyphenate_1 = hyphenate;
/**
- * Escapes attribute value to prevent scripting attacks.
+ * Copyright (c) 2013-present, Facebook, Inc.
*
- * @param {*} value Value to escape.
- * @return {string} An escaped string.
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @typechecks
*/
-function quoteAttributeValueForBrowser(value) {
- return '"' + escapeTextContentForBrowser_1(value) + '"';
+
+
+
+
+
+var msPattern = /^ms-/;
+
+/**
+ * Hyphenates a camelcased CSS property name, for example:
+ *
+ * > hyphenateStyleName('backgroundColor')
+ * < "background-color"
+ * > hyphenateStyleName('MozTransition')
+ * < "-moz-transition"
+ * > hyphenateStyleName('msTransition')
+ * < "-ms-transition"
+ *
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
+ * is converted to `-ms-`.
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function hyphenateStyleName(string) {
+ return hyphenate_1(string).replace(msPattern, '-ms-');
}
-var quoteAttributeValueForBrowser_1 = quoteAttributeValueForBrowser;
+var hyphenateStyleName_1 = hyphenateStyleName;
/**
* Copyright (c) 2013-present, Facebook, Inc.
@@ -491,33 +575,38 @@ var quoteAttributeValueForBrowser_1 = quoteAttributeValueForBrowser;
* LICENSE file in the root directory of this source tree.
*
*
+ * @typechecks static-only
*/
-function makeEmptyFunction(arg) {
- return function () {
- return arg;
+
+
+/**
+ * Memoizes the return value of a function that accepts one string argument.
+ */
+
+function memoizeStringOnly(callback) {
+ var cache = {};
+ return function (string) {
+ if (!cache.hasOwnProperty(string)) {
+ cache[string] = callback.call(this, string);
+ }
+ return cache[string];
};
}
+var memoizeStringOnly_1 = memoizeStringOnly;
+
/**
- * This function accepts and discards inputs; it has no side effects. This is
- * primarily useful idiomatically for overridable function endpoints which
- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
+ * 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.
+ *
*/
-var emptyFunction = function emptyFunction() {};
-emptyFunction.thatReturns = makeEmptyFunction;
-emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
-emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
-emptyFunction.thatReturnsNull = makeEmptyFunction(null);
-emptyFunction.thatReturnsThis = function () {
- return this;
-};
-emptyFunction.thatReturnsArgument = function (arg) {
- return arg;
-};
-var emptyFunction_1 = emptyFunction;
+
+
/**
* Similar to invariant but only logs a warning if the condition is not met.
@@ -526,7 +615,7 @@ var emptyFunction_1 = emptyFunction;
* same logic and follow the same code paths.
*/
-var warning$2 = emptyFunction_1;
+var warning = emptyFunction_1;
{
var printWarning = function printWarning(format) {
@@ -549,7 +638,7 @@ var warning$2 = emptyFunction_1;
} catch (x) {}
};
- warning$2 = function warning(condition, format) {
+ warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
@@ -568,107 +657,20 @@ var warning$2 = emptyFunction_1;
};
}
-var warning_1 = warning$2;
-
-{
- var warning$1 = warning_1;
-}
-
-// isAttributeNameSafe() is currently duplicated in DOMPropertyOperations.
-// TODO: Find a better place for this.
-var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty_1.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty_1.ATTRIBUTE_NAME_CHAR + ']*$');
-var illegalAttributeNameCache = {};
-var validatedAttributeNameCache = {};
-function isAttributeNameSafe(attributeName) {
- if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
- return true;
- }
- if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
- return false;
- }
- if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
- validatedAttributeNameCache[attributeName] = true;
- return true;
- }
- illegalAttributeNameCache[attributeName] = true;
- {
- warning$1(false, 'Invalid attribute name: `%s`', attributeName);
- }
- return false;
-}
-
-// shouldIgnoreValue() is currently duplicated in DOMPropertyOperations.
-// TODO: Find a better place for this.
-function shouldIgnoreValue(propertyInfo, value) {
- return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
-}
+var warning_1 = warning;
/**
- * Operations for dealing with DOM properties.
+ * 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 DOMMarkupOperations = {
- /**
- * Creates markup for the ID property.
- *
- * @param {string} id Unescaped ID.
- * @return {string} Markup string.
- */
- createMarkupForID: function (id) {
- return DOMProperty_1.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser_1(id);
- },
- createMarkupForRoot: function () {
- return DOMProperty_1.ROOT_ATTRIBUTE_NAME + '=""';
- },
- /**
- * Creates markup for a property.
- *
- * @param {string} name
- * @param {*} value
- * @return {?string} Markup string, or null if the property was invalid.
- */
- createMarkupForProperty: function (name, value) {
- var propertyInfo = DOMProperty_1.getPropertyInfo(name);
- if (propertyInfo) {
- if (shouldIgnoreValue(propertyInfo, value)) {
- return '';
- }
- var attributeName = propertyInfo.attributeName;
- if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
- return attributeName + '=""';
- } else if (typeof value !== 'boolean' || DOMProperty_1.shouldAttributeAcceptBooleanValue(name)) {
- return attributeName + '=' + quoteAttributeValueForBrowser_1(value);
- }
- } else if (DOMProperty_1.shouldSetAttribute(name, value)) {
- if (value == null) {
- return '';
- }
- return name + '=' + quoteAttributeValueForBrowser_1(value);
- }
- return null;
- },
- /**
- * Creates markup for a custom property.
- *
- * @param {string} name
- * @param {*} value
- * @return {string} Markup string, or empty string if the property was invalid.
- */
- createMarkupForCustomAttribute: function (name, value) {
- if (!isAttributeNameSafe(name) || value == null) {
- return '';
- }
- return name + '=' + quoteAttributeValueForBrowser_1(value);
- }
-};
-
-var DOMMarkupOperations_1 = DOMMarkupOperations;
+var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
-function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
-}
+var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
/**
* Copyright (c) 2013-present, Facebook, Inc.
@@ -677,15 +679,13 @@ function createCommonjsModule(fn, module) {
* 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;
{
var invariant$2 = invariant_1;
- var warning$4 = warning_1;
- var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
- var loggedTypeFailures$1 = {};
+ var warning$2 = warning_1;
+ var ReactPropTypesSecret = ReactPropTypesSecret_1;
+ var loggedTypeFailures = {};
}
/**
@@ -699,7 +699,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)) {
@@ -711,591 +711,266 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant$2(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$2);
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
- warning$4(!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$1)) {
+ 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.
- loggedTypeFailures$1[error.message] = true;
+ loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
- warning$4(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;
+var checkPropTypes_1 = checkPropTypes;
-var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
- /* global Symbol */
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
+var describeComponentFrame = function (name, source, ownerName) {
+ return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
+};
- /**
- * Returns the iterator method function contained on the iterable object.
- *
- * Be sure to invoke the function with the iterable as context:
- *
- * var iteratorFn = getIteratorFn(myIterable);
- * if (iteratorFn) {
- * var iterator = iteratorFn.call(myIterable);
- * ...
- * }
- *
- * @param {?object} maybeIterable
- * @return {?function}
- */
- function getIteratorFn(maybeIterable) {
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
- if (typeof iteratorFn === 'function') {
- return iteratorFn;
- }
- }
+var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
- /**
- * Collection of methods that allow declaration and validation of props that are
- * supplied to React components. Example usage:
- *
- * var Props = require('ReactPropTypes');
- * var MyArticle = React.createClass({
- * propTypes: {
- * // An optional string prop named "description".
- * description: Props.string,
- *
- * // A required enum prop named "category".
- * category: Props.oneOf(['News','Photos']).isRequired,
- *
- * // A prop named "dialog" that requires an instance of Dialog.
- * dialog: Props.instanceOf(Dialog).isRequired
- * },
- * render: function() { ... }
- * });
- *
- * A more formal specification of how these methods are used:
- *
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
- * decl := ReactPropTypes.{type}(.isRequired)?
- *
- * Each and every declaration produces a function with the same signature. This
- * allows the creation of custom validation functions. For example:
- *
- * var MyLink = React.createClass({
- * propTypes: {
- * // An optional string or URI prop named "href".
- * href: function(props, propName, componentName) {
- * var propValue = props[propName];
- * if (propValue != null && typeof propValue !== 'string' &&
- * !(propValue instanceof URI)) {
- * return new Error(
- * 'Expected a string or an URI for ' + propName + ' in ' +
- * componentName
- * );
- * }
- * }
- * },
- * render: function() {...}
- * });
- *
- * @internal
- */
+var ReactCurrentOwner = ReactInternals$1.ReactCurrentOwner;
+var ReactDebugCurrentFrame = ReactInternals$1.ReactDebugCurrentFrame;
- var ANONYMOUS = '<<anonymous>>';
-
- // Important!
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
- var ReactPropTypes = {
- array: createPrimitiveTypeChecker('array'),
- bool: createPrimitiveTypeChecker('boolean'),
- func: createPrimitiveTypeChecker('function'),
- number: createPrimitiveTypeChecker('number'),
- object: createPrimitiveTypeChecker('object'),
- string: createPrimitiveTypeChecker('string'),
- symbol: createPrimitiveTypeChecker('symbol'),
-
- any: createAnyTypeChecker(),
- arrayOf: createArrayOfTypeChecker,
- element: createElementTypeChecker(),
- instanceOf: createInstanceTypeChecker,
- node: createNodeChecker(),
- objectOf: createObjectOfTypeChecker,
- oneOf: createEnumTypeChecker,
- oneOfType: createUnionTypeChecker,
- shape: createShapeTypeChecker,
- exact: createStrictShapeTypeChecker,
- };
+// 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'];
- /**
- * inlined Object.is polyfill to avoid requiring consumers ship their own
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
- */
- /*eslint-disable no-self-compare*/
- function is(x, y) {
- // SameValue algorithm
- if (x === y) {
- // Steps 1-5, 7-10
- // Steps 6.b-6.e: +0 != -0
- return x !== 0 || 1 / x === 1 / y;
- } else {
- // Step 6.a: NaN == NaN
- return x !== x && y !== y;
- }
- }
- /*eslint-enable no-self-compare*/
- /**
- * We use an Error-like object for backward compatibility as people may call
- * PropTypes directly and inspect their output. However, we don't use real
- * Errors anymore. We don't inspect their stack anyway, and creating them
- * is prohibitively expensive if they are created too often, such as what
- * happens in oneOfType() for any type before the one that matched.
- */
- function PropTypeError(message) {
- this.message = message;
- this.stack = '';
- }
- // Make `instanceof Error` still work for returned errors.
- PropTypeError.prototype = Error.prototype;
- function createChainableTypeChecker(validate) {
- {
- var manualPropTypeCallCache = {};
- var manualPropTypeWarningCount = 0;
- }
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
- componentName = componentName || ANONYMOUS;
- propFullName = propFullName || propName;
-
- if (secret !== ReactPropTypesSecret_1) {
- if (throwOnDirectAccess) {
- // New behavior only for users of `prop-types` package
- invariant_1(
- false,
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
- 'Use `PropTypes.checkPropTypes()` to call them. ' +
- 'Read more at http://fb.me/use-check-prop-types'
- );
- } else if ('development' !== 'production' && typeof console !== 'undefined') {
- // Old behavior for people using React.PropTypes
- var cacheKey = componentName + ':' + propName;
- if (
- !manualPropTypeCallCache[cacheKey] &&
- // Avoid spamming the console because they are often not actionable except for lib authors
- manualPropTypeWarningCount < 3
- ) {
- warning_1(
- false,
- 'You are manually calling a React.PropTypes validation ' +
- 'function for the `%s` prop on `%s`. This is deprecated ' +
- 'and will throw in the standalone `prop-types` package. ' +
- 'You may be seeing this warning due to a third-party PropTypes ' +
- 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
- propFullName,
- componentName
- );
- manualPropTypeCallCache[cacheKey] = true;
- manualPropTypeWarningCount++;
- }
- }
- }
- if (props[propName] == null) {
- if (isRequired) {
- if (props[propName] === null) {
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
- }
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
- }
- return null;
- } else {
- return validate(props, propName, componentName, location, propFullName);
- }
- }
- var chainedCheckType = checkType.bind(null, false);
- chainedCheckType.isRequired = checkType.bind(null, true);
- return chainedCheckType;
- }
+var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
- function createPrimitiveTypeChecker(expectedType) {
- function validate(props, propName, componentName, location, propFullName, secret) {
- var propValue = props[propName];
- var propType = getPropType(propValue);
- if (propType !== expectedType) {
- // `propValue` being instance of, say, date/regexp, pass the 'object'
- // check, but we can offer a more precise error message here rather than
- // 'of type `object`'.
- var preciseType = getPreciseType(propValue);
-
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
- }
- return null;
- }
- return createChainableTypeChecker(validate);
- }
+// code copied and modified from escape-html
+/**
+ * Module variables.
+ * @private
+ */
- function createAnyTypeChecker() {
- return createChainableTypeChecker(emptyFunction_1.thatReturnsNull);
- }
+var matchHtmlRegExp = /["'&<>]/;
- function createArrayOfTypeChecker(typeChecker) {
- function validate(props, propName, componentName, location, propFullName) {
- if (typeof typeChecker !== 'function') {
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
- }
- var propValue = props[propName];
- if (!Array.isArray(propValue)) {
- var propType = getPropType(propValue);
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
- }
- for (var i = 0; i < propValue.length; i++) {
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
- if (error instanceof Error) {
- return error;
- }
- }
- return null;
- }
- return createChainableTypeChecker(validate);
- }
+/**
+ * Escapes special characters and HTML entities in a given html string.
+ *
+ * @param {string} string HTML string to escape for later insertion
+ * @return {string}
+ * @public
+ */
- function createElementTypeChecker() {
- function validate(props, propName, componentName, location, propFullName) {
- var propValue = props[propName];
- if (!isValidElement(propValue)) {
- var propType = getPropType(propValue);
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
- }
- return null;
- }
- return createChainableTypeChecker(validate);
- }
+function escapeHtml(string) {
+ var str = '' + string;
+ var match = matchHtmlRegExp.exec(str);
- function createInstanceTypeChecker(expectedClass) {
- function validate(props, propName, componentName, location, propFullName) {
- if (!(props[propName] instanceof expectedClass)) {
- var expectedClassName = expectedClass.name || ANONYMOUS;
- var actualClassName = getClassName(props[propName]);
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
- }
- return null;
- }
- return createChainableTypeChecker(validate);
+ if (!match) {
+ return str;
}
- function createEnumTypeChecker(expectedValues) {
- if (!Array.isArray(expectedValues)) {
- warning_1(false, 'Invalid argument supplied to oneOf, expected an instance of array.');
- return emptyFunction_1.thatReturnsNull;
- }
-
- function validate(props, propName, componentName, location, propFullName) {
- var propValue = props[propName];
- for (var i = 0; i < expectedValues.length; i++) {
- if (is(propValue, expectedValues[i])) {
- return null;
- }
- }
-
- var valuesString = JSON.stringify(expectedValues);
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
- }
- return createChainableTypeChecker(validate);
- }
+ var escape;
+ var html = '';
+ var index = 0;
+ var lastIndex = 0;
- function createObjectOfTypeChecker(typeChecker) {
- function validate(props, propName, componentName, location, propFullName) {
- if (typeof typeChecker !== 'function') {
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
- }
- var propValue = props[propName];
- var propType = getPropType(propValue);
- if (propType !== 'object') {
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
- }
- for (var key in propValue) {
- if (propValue.hasOwnProperty(key)) {
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
- if (error instanceof Error) {
- return error;
- }
- }
- }
- return null;
+ for (index = match.index; index < str.length; index++) {
+ switch (str.charCodeAt(index)) {
+ case 34:
+ // "
+ escape = '&quot;';
+ break;
+ case 38:
+ // &
+ escape = '&amp;';
+ break;
+ case 39:
+ // '
+ escape = '&#x27;'; // modified from escape-html; used to be '&#39'
+ break;
+ case 60:
+ // <
+ escape = '&lt;';
+ break;
+ case 62:
+ // >
+ escape = '&gt;';
+ break;
+ default:
+ continue;
}
- return createChainableTypeChecker(validate);
- }
- function createUnionTypeChecker(arrayOfTypeCheckers) {
- if (!Array.isArray(arrayOfTypeCheckers)) {
- warning_1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.');
- return emptyFunction_1.thatReturnsNull;
- }
-
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
- var checker = arrayOfTypeCheckers[i];
- if (typeof checker !== 'function') {
- warning_1(
- false,
- 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
- 'received %s at index %s.',
- getPostfixForTypeWarning(checker),
- i
- );
- return emptyFunction_1.thatReturnsNull;
- }
+ if (lastIndex !== index) {
+ html += str.substring(lastIndex, index);
}
- function validate(props, propName, componentName, location, propFullName) {
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
- var checker = arrayOfTypeCheckers[i];
- if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
- return null;
- }
- }
-
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
- }
- return createChainableTypeChecker(validate);
+ lastIndex = index + 1;
+ html += escape;
}
- function createNodeChecker() {
- function validate(props, propName, componentName, location, propFullName) {
- if (!isNode(props[propName])) {
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
- }
- return null;
- }
- return createChainableTypeChecker(validate);
- }
+ return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
+}
+// end code copied and modified from escape-html
- function createShapeTypeChecker(shapeTypes) {
- function validate(props, propName, componentName, location, propFullName) {
- var propValue = props[propName];
- var propType = getPropType(propValue);
- if (propType !== 'object') {
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
- }
- for (var key in shapeTypes) {
- var checker = shapeTypes[key];
- if (!checker) {
- continue;
- }
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
- if (error) {
- return error;
- }
- }
- return null;
- }
- return createChainableTypeChecker(validate);
+/**
+ * Escapes text to prevent scripting attacks.
+ *
+ * @param {*} text Text value to escape.
+ * @return {string} An escaped string.
+ */
+function escapeTextForBrowser(text) {
+ if (typeof text === 'boolean' || typeof text === 'number') {
+ // this shortcircuit helps perf for types that we know will never have
+ // special characters, especially given that this function is used often
+ // for numeric dom ids.
+ return '' + text;
}
+ return escapeHtml(text);
+}
- function createStrictShapeTypeChecker(shapeTypes) {
- function validate(props, propName, componentName, location, propFullName) {
- var propValue = props[propName];
- var propType = getPropType(propValue);
- if (propType !== 'object') {
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
- }
- // We need to check all keys in case some are required but missing from
- // props.
- var allKeys = assign({}, props[propName], shapeTypes);
- for (var key in allKeys) {
- var checker = shapeTypes[key];
- if (!checker) {
- return new PropTypeError(
- 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
- '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
- );
- }
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
- if (error) {
- return error;
- }
- }
- return null;
- }
+/**
+ * Escapes attribute value to prevent scripting attacks.
+ *
+ * @param {*} value Value to escape.
+ * @return {string} An escaped string.
+ */
+function quoteAttributeValueForBrowser(value) {
+ return '"' + escapeTextForBrowser(value) + '"';
+}
- return createChainableTypeChecker(validate);
+// isAttributeNameSafe() is currently duplicated in DOMPropertyOperations.
+// TODO: Find a better place for this.
+var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
+var illegalAttributeNameCache = {};
+var validatedAttributeNameCache = {};
+function isAttributeNameSafe(attributeName) {
+ if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
+ return true;
}
-
- function isNode(propValue) {
- switch (typeof propValue) {
- case 'number':
- case 'string':
- case 'undefined':
- return true;
- case 'boolean':
- return !propValue;
- case 'object':
- if (Array.isArray(propValue)) {
- return propValue.every(isNode);
- }
- if (propValue === null || isValidElement(propValue)) {
- return true;
- }
-
- var iteratorFn = getIteratorFn(propValue);
- if (iteratorFn) {
- var iterator = iteratorFn.call(propValue);
- var step;
- if (iteratorFn !== propValue.entries) {
- while (!(step = iterator.next()).done) {
- if (!isNode(step.value)) {
- return false;
- }
- }
- } else {
- // Iterator will provide entry [k,v] tuples rather than values.
- while (!(step = iterator.next()).done) {
- var entry = step.value;
- if (entry) {
- if (!isNode(entry[1])) {
- return false;
- }
- }
- }
- }
- } else {
- return false;
- }
-
- return true;
- default:
- return false;
- }
+ if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
+ return false;
+ }
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
+ validatedAttributeNameCache[attributeName] = true;
+ return true;
+ }
+ illegalAttributeNameCache[attributeName] = true;
+ {
+ warning_1(false, 'Invalid attribute name: `%s`', attributeName);
}
+ return false;
+}
- function isSymbol(propType, propValue) {
- // Native Symbol.
- if (propType === 'symbol') {
- return true;
- }
+// shouldIgnoreValue() is currently duplicated in DOMPropertyOperations.
+// TODO: Find a better place for this.
+function shouldIgnoreValue(propertyInfo, value) {
+ return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
+}
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
- if (propValue['@@toStringTag'] === 'Symbol') {
- return true;
- }
+/**
+ * Operations for dealing with DOM properties.
+ */
- // Fallback for non-spec compliant Symbols which are polyfilled.
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
- return true;
- }
+/**
+ * Creates markup for the ID property.
+ *
+ * @param {string} id Unescaped ID.
+ * @return {string} Markup string.
+ */
- return false;
- }
- // Equivalent of `typeof` but with special handling for array and regexp.
- function getPropType(propValue) {
- var propType = typeof propValue;
- if (Array.isArray(propValue)) {
- return 'array';
- }
- if (propValue instanceof RegExp) {
- // Old webkits (at least until Android 4.0) return 'function' rather than
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
- // passes PropTypes.object.
- return 'object';
- }
- if (isSymbol(propType, propValue)) {
- return 'symbol';
- }
- return propType;
- }
+function createMarkupForRoot() {
+ return ROOT_ATTRIBUTE_NAME + '=""';
+}
- // This handles more types than `getPropType`. Only used for error messages.
- // See `createPrimitiveTypeChecker`.
- function getPreciseType(propValue) {
- if (typeof propValue === 'undefined' || propValue === null) {
- return '' + propValue;
- }
- var propType = getPropType(propValue);
- if (propType === 'object') {
- if (propValue instanceof Date) {
- return 'date';
- } else if (propValue instanceof RegExp) {
- return 'regexp';
- }
+/**
+ * Creates markup for a property.
+ *
+ * @param {string} name
+ * @param {*} value
+ * @return {?string} Markup string, or null if the property was invalid.
+ */
+function createMarkupForProperty(name, value) {
+ var propertyInfo = getPropertyInfo(name);
+ if (propertyInfo) {
+ if (shouldIgnoreValue(propertyInfo, value)) {
+ return '';
}
- return propType;
- }
-
- // Returns a string that is postfixed to a warning about an invalid type.
- // For example, "undefined" or "of type array"
- function getPostfixForTypeWarning(value) {
- var type = getPreciseType(value);
- switch (type) {
- case 'array':
- case 'object':
- return 'an ' + type;
- case 'boolean':
- case 'date':
- case 'regexp':
- return 'a ' + type;
- default:
- return type;
+ var attributeName = propertyInfo.attributeName;
+ if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ return attributeName + '=""';
+ } else if (typeof value !== 'boolean' || shouldAttributeAcceptBooleanValue(name)) {
+ return attributeName + '=' + quoteAttributeValueForBrowser(value);
}
- }
-
- // Returns class name of the object, if any.
- function getClassName(propValue) {
- if (!propValue.constructor || !propValue.constructor.name) {
- return ANONYMOUS;
+ } else if (shouldSetAttribute(name, value)) {
+ if (value == null) {
+ return '';
}
- return propValue.constructor.name;
+ return name + '=' + quoteAttributeValueForBrowser(value);
}
+ return null;
+}
- ReactPropTypes.checkPropTypes = checkPropTypes_1;
- ReactPropTypes.PropTypes = ReactPropTypes;
-
- return ReactPropTypes;
-};
-
-var index = createCommonjsModule(function (module) {
/**
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Creates markup for a custom property.
*
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
+ * @param {string} name
+ * @param {*} value
+ * @return {string} Markup string, or empty string if the property was invalid.
*/
+function createMarkupForCustomAttribute(name, value) {
+ if (!isAttributeNameSafe(name) || value == null) {
+ return '';
+ }
+ return name + '=' + quoteAttributeValueForBrowser(value);
+}
-{
- var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
- Symbol.for &&
- Symbol.for('react.element')) ||
- 0xeac7;
-
- var isValidElement = function(object) {
- return typeof object === 'object' &&
- object !== null &&
- object.$$typeof === REACT_ELEMENT_TYPE;
- };
+var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
+var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
+var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
- // By explicitly using `prop-types` you are opting into new development behavior.
- // http://fb.me/prop-types-in-prod
- var throwOnDirectAccess = true;
- module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
+var Namespaces = {
+ html: HTML_NAMESPACE,
+ mathml: MATH_NAMESPACE,
+ svg: SVG_NAMESPACE
+};
+
+// Assumes there is no parent namespace.
+function getIntrinsicNamespace(type) {
+ switch (type) {
+ case 'svg':
+ return SVG_NAMESPACE;
+ case 'math':
+ return MATH_NAMESPACE;
+ default:
+ return HTML_NAMESPACE;
+ }
+}
+
+function getChildNamespace(parentNamespace, type) {
+ if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
+ // No (or default) parent namespace: potential entry point.
+ return getIntrinsicNamespace(type);
+ }
+ if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
+ // We're leaving SVG.
+ return HTML_NAMESPACE;
+ }
+ // By default, pass namespace below.
+ return parentNamespace;
}
-});
var ReactControlledValuePropTypes = {
checkPropTypes: null
};
{
- var warning$3 = warning_1;
- var emptyFunction$2 = emptyFunction_1;
- var PropTypes = index;
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
-
- ReactControlledValuePropTypes.checkPropTypes = emptyFunction$2;
var hasReadOnlyValue = {
button: true,
checkbox: true,
@@ -1318,43 +993,18 @@ var ReactControlledValuePropTypes = {
return null;
}
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
- },
- onChange: PropTypes.func
+ }
};
- var loggedTypeFailures = {};
-
/**
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
ReactControlledValuePropTypes.checkPropTypes = function (tagName, props, getStack) {
- for (var propName in propTypes) {
- if (propTypes.hasOwnProperty(propName)) {
- var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret);
- }
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
- // Only monitor this failure once because there tends to be a lot of the
- // same error.
- loggedTypeFailures[error.message] = true;
-
- warning$3(false, 'Failed form propType: %s%s', error.message, getStack());
- }
- }
+ checkPropTypes_1(propTypes, props, 'prop', tagName, getStack);
};
}
-var ReactControlledValuePropTypes_1 = ReactControlledValuePropTypes;
-
-/**
- * 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 omittedCloseTags
- */
-
// For HTML, certain tags should omit their close tag. We keep a whitelist for
// those special-case tags.
@@ -1376,68 +1026,37 @@ var omittedCloseTags = {
wbr: true
};
-var omittedCloseTags_1 = omittedCloseTags;
-
// For HTML, certain tags cannot have children. This has the same purpose as
// `omittedCloseTags` except that `menuitem` should still have its closing tag.
-var voidElementTags = assign({
+var voidElementTags = _assign({
menuitem: true
-}, omittedCloseTags_1);
-
-var voidElementTags_1 = voidElementTags;
-
-{
- var warning$5 = warning_1;
-}
+}, omittedCloseTags);
var HTML = '__html';
-function getDeclarationErrorAddendum(getCurrentOwnerName) {
- {
- var ownerName = getCurrentOwnerName();
- if (ownerName) {
- // TODO: also report the stack.
- return '\n\nThis DOM node was rendered by `' + ownerName + '`.';
- }
- }
- return '';
-}
-
-function assertValidProps(tag, props, getCurrentOwnerName) {
+function assertValidProps(tag, props, getStack) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
- if (voidElementTags_1[tag]) {
- !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant_1(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, getDeclarationErrorAddendum(getCurrentOwnerName)) : void 0;
+ if (voidElementTags[tag]) {
+ !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant_1(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, getStack()) : void 0;
}
if (props.dangerouslySetInnerHTML != null) {
!(props.children == null) ? invariant_1(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? invariant_1(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
}
{
- warning$5(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.');
+ warning_1(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.%s', getStack());
}
- !(props.style == null || typeof props.style === 'object') ? invariant_1(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getDeclarationErrorAddendum(getCurrentOwnerName)) : void 0;
+ !(props.style == null || typeof props.style === 'object') ? invariant_1(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getStack()) : void 0;
}
-var assertValidProps_1 = assertValidProps;
-
-/**
- * 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 CSSProperty
- */
-
/**
* CSS properties which accept numbers but are not in units of "px".
*/
-
-var isUnitlessNumber$1 = {
+var isUnitlessNumber = {
animationIterationCount: true,
borderImageOutset: true,
borderImageSlice: true,
@@ -1501,84 +1120,13 @@ var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
-Object.keys(isUnitlessNumber$1).forEach(function (prop) {
+Object.keys(isUnitlessNumber).forEach(function (prop) {
prefixes.forEach(function (prefix) {
- isUnitlessNumber$1[prefixKey(prefix, prop)] = isUnitlessNumber$1[prop];
+ isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
/**
- * Most style properties can be unset by doing .style[prop] = '' but IE8
- * doesn't like doing that with shorthand properties so for the properties that
- * IE8 breaks on, which are listed here, we instead unset each of the
- * individual properties. See http://bugs.jquery.com/ticket/12385.
- * The 4-value 'clock' properties like margin, padding, border-width seem to
- * behave without any problems. Curiously, list-style works too without any
- * special prodding.
- */
-var shorthandPropertyExpansions = {
- background: {
- backgroundAttachment: true,
- backgroundColor: true,
- backgroundImage: true,
- backgroundPositionX: true,
- backgroundPositionY: true,
- backgroundRepeat: true
- },
- backgroundPosition: {
- backgroundPositionX: true,
- backgroundPositionY: true
- },
- border: {
- borderWidth: true,
- borderStyle: true,
- borderColor: true
- },
- borderBottom: {
- borderBottomWidth: true,
- borderBottomStyle: true,
- borderBottomColor: true
- },
- borderLeft: {
- borderLeftWidth: true,
- borderLeftStyle: true,
- borderLeftColor: true
- },
- borderRight: {
- borderRightWidth: true,
- borderRightStyle: true,
- borderRightColor: true
- },
- borderTop: {
- borderTopWidth: true,
- borderTopStyle: true,
- borderTopColor: true
- },
- font: {
- fontStyle: true,
- fontVariant: true,
- fontWeight: true,
- fontSize: true,
- lineHeight: true,
- fontFamily: true
- },
- outline: {
- outlineWidth: true,
- outlineStyle: true,
- outlineColor: true
- }
-};
-
-var CSSProperty = {
- isUnitlessNumber: isUnitlessNumber$1,
- shorthandPropertyExpansions: shorthandPropertyExpansions
-};
-
-var CSSProperty_1 = CSSProperty;
-
-var isUnitlessNumber = CSSProperty_1.isUnitlessNumber;
-
-/**
* Convert a value into the proper css writable value. The style name `name`
* should be logical (no hyphens), as specified
* in `CSSProperty.isUnitlessNumber`.
@@ -1610,113 +1158,6 @@ function dangerousStyleValue(name, value, isCustomProperty) {
return ('' + value).trim();
}
-var dangerousStyleValue_1 = dangerousStyleValue;
-
-/**
- * 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.
- *
- * @typechecks
- */
-
-var _uppercasePattern = /([A-Z])/g;
-
-/**
- * Hyphenates a camelcased string, for example:
- *
- * > hyphenate('backgroundColor')
- * < "background-color"
- *
- * For CSS style names, use `hyphenateStyleName` instead which works properly
- * with all vendor prefixes, including `ms`.
- *
- * @param {string} string
- * @return {string}
- */
-function hyphenate(string) {
- return string.replace(_uppercasePattern, '-$1').toLowerCase();
-}
-
-var hyphenate_1 = hyphenate;
-
-var msPattern = /^ms-/;
-
-/**
- * Hyphenates a camelcased CSS property name, for example:
- *
- * > hyphenateStyleName('backgroundColor')
- * < "background-color"
- * > hyphenateStyleName('MozTransition')
- * < "-moz-transition"
- * > hyphenateStyleName('msTransition')
- * < "-ms-transition"
- *
- * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
- * is converted to `-ms-`.
- *
- * @param {string} string
- * @return {string}
- */
-function hyphenateStyleName(string) {
- return hyphenate_1(string).replace(msPattern, '-ms-');
-}
-
-var hyphenateStyleName_1 = hyphenateStyleName;
-
-/**
- * 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.
- *
- *
- * @typechecks static-only
- */
-
-/**
- * Memoizes the return value of a function that accepts one string argument.
- */
-
-function memoizeStringOnly(callback) {
- var cache = {};
- return function (string) {
- if (!cache.hasOwnProperty(string)) {
- cache[string] = callback.call(this, string);
- }
- return cache[string];
- };
-}
-
-var memoizeStringOnly_1 = memoizeStringOnly;
-
-/**
- * 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 isCustomComponent
- *
- */
-
function isCustomComponent(tagName, props) {
if (tagName.indexOf('-') === -1) {
return typeof props.is === 'string';
@@ -1740,8 +1181,6 @@ function isCustomComponent(tagName, props) {
}
}
-var isCustomComponent_1 = isCustomComponent;
-
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
@@ -1770,6 +1209,19 @@ function camelize(string) {
var camelize_1 = camelize;
+/**
+ * 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.
+ *
+ * @typechecks
+ */
+
+
+
+
+
var msPattern$1 = /^-ms-/;
/**
@@ -1789,214 +1241,16 @@ var msPattern$1 = /^-ms-/;
* @param {string} string
* @return {string}
*/
-function camelizeStyleName$1(string) {
+function camelizeStyleName(string) {
return camelize_1(string.replace(msPattern$1, 'ms-'));
}
-var camelizeStyleName_1 = camelizeStyleName$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.
- *
- * @providesModule getComponentName
- *
- */
-
-function getComponentName$2(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$2;
-
-var ReactInternals$1 = react.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
-
-var ReactGlobalSharedState = {
- ReactCurrentOwner: ReactInternals$1.ReactCurrentOwner
-};
-
-{
- assign(ReactGlobalSharedState, {
- ReactComponentTreeHook: ReactInternals$1.ReactComponentTreeHook,
- ReactDebugCurrentFrame: ReactInternals$1.ReactDebugCurrentFrame
- });
-}
-
-var ReactGlobalSharedState_1 = ReactGlobalSharedState;
+var camelizeStyleName_1 = camelizeStyleName;
-/**
- * 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 ReactTypeOfWork
- *
- */
-
-var ReactTypeOfWork = {
- IndeterminateComponent: 0, // Before we know whether it is functional or class
- FunctionalComponent: 1,
- ClassComponent: 2,
- HostRoot: 3, // Root of a host tree. Could be nested inside another node.
- HostPortal: 4, // A subtree. Could be an entry point to a different renderer.
- HostComponent: 5,
- HostText: 6,
- CoroutineComponent: 7,
- CoroutineHandlerPhase: 8,
- YieldComponent: 9,
- Fragment: 10
-};
-
-/**
- * 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 IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent;
-var FunctionalComponent = ReactTypeOfWork.FunctionalComponent;
-var ClassComponent = ReactTypeOfWork.ClassComponent;
-var HostComponent = ReactTypeOfWork.HostComponent;
-
-
-
-
-function describeFiber(fiber) {
- switch (fiber.tag) {
- case IndeterminateComponent:
- case FunctionalComponent:
- case ClassComponent:
- case HostComponent:
- var owner = fiber._debugOwner;
- var source = fiber._debugSource;
- var name = getComponentName_1(fiber);
- var ownerName = null;
- if (owner) {
- ownerName = getComponentName_1(owner);
- }
- return describeComponentFrame$1(name, source, ownerName);
- default:
- return '';
- }
-}
-
-// This function can only be called with a work-in-progress fiber and
-// only during begin or complete phase. Do not call it under any other
-// circumstances.
-function getStackAddendumByWorkInProgressFiber$1(workInProgress) {
- var info = '';
- var node = workInProgress;
- do {
- info += describeFiber(node);
- // Otherwise this return pointer might point to the wrong tree:
- node = node['return'];
- } while (node);
- return info;
-}
-
-var ReactFiberComponentTreeHook = {
- getStackAddendumByWorkInProgressFiber: getStackAddendumByWorkInProgressFiber$1
-};
-
-var ReactDebugCurrentFrame$1 = ReactGlobalSharedState_1.ReactDebugCurrentFrame;
+var warnValidStyle = emptyFunction_1;
{
- var getComponentName$3 = getComponentName_1;
-
- var _require2$1 = ReactFiberComponentTreeHook,
- getStackAddendumByWorkInProgressFiber = _require2$1.getStackAddendumByWorkInProgressFiber;
-}
-
-function getCurrentFiberOwnerName$1() {
- {
- var fiber = ReactDebugCurrentFiber.current;
- if (fiber === null) {
- return null;
- }
- if (fiber._debugOwner != null) {
- return getComponentName$3(fiber._debugOwner);
- }
- }
- return null;
-}
-
-function getCurrentFiberStackAddendum() {
- {
- var fiber = ReactDebugCurrentFiber.current;
- if (fiber === null) {
- return null;
- }
- // Safe because if current fiber exists, we are reconciling,
- // and it is guaranteed to be the work-in-progress version.
- return getStackAddendumByWorkInProgressFiber(fiber);
- }
- return null;
-}
-
-function resetCurrentFiber() {
- ReactDebugCurrentFrame$1.getCurrentStack = null;
- ReactDebugCurrentFiber.current = null;
- ReactDebugCurrentFiber.phase = null;
-}
-
-function setCurrentFiber(fiber, phase) {
- ReactDebugCurrentFrame$1.getCurrentStack = getCurrentFiberStackAddendum;
- ReactDebugCurrentFiber.current = fiber;
- ReactDebugCurrentFiber.phase = phase;
-}
-
-var ReactDebugCurrentFiber = {
- current: null,
- phase: null,
- resetCurrentFiber: resetCurrentFiber,
- setCurrentFiber: setCurrentFiber,
- getCurrentFiberOwnerName: getCurrentFiberOwnerName$1,
- getCurrentFiberStackAddendum: getCurrentFiberStackAddendum
-};
-
-var ReactDebugCurrentFiber_1 = ReactDebugCurrentFiber;
-
-var warnValidStyle$1 = emptyFunction_1;
-
-{
- var camelizeStyleName = camelizeStyleName_1;
- var getComponentName$1 = getComponentName_1;
- var warning$6 = warning_1;
-
- var _require = ReactDebugCurrentFiber_1,
- getCurrentFiberOwnerName = _require.getCurrentFiberOwnerName;
-
// 'msTransform' is correct, but the other prefixes should be capitalized
-
-
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
// style values shouldn't contain a semicolon
@@ -2007,102 +1261,71 @@ var warnValidStyle$1 = emptyFunction_1;
var warnedForNaNValue = false;
var warnedForInfinityValue = false;
- var warnHyphenatedStyleName = function (name, owner) {
+ var warnHyphenatedStyleName = function (name, getStack) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- warning$6(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner));
+ warning_1(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName_1(name), getStack());
};
- var warnBadVendoredStyleName = function (name, owner) {
+ var warnBadVendoredStyleName = function (name, getStack) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- warning$6(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner));
+ warning_1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), getStack());
};
- var warnStyleValueWithSemicolon = function (name, value, owner) {
+ var warnStyleValueWithSemicolon = function (name, value, getStack) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
- warning$6(false, "Style property values shouldn't contain a semicolon.%s " + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, ''));
+ warning_1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.%s', name, value.replace(badStyleValueWithSemicolonPattern, ''), getStack());
};
- var warnStyleValueIsNaN = function (name, value, owner) {
+ var warnStyleValueIsNaN = function (name, value, getStack) {
if (warnedForNaNValue) {
return;
}
warnedForNaNValue = true;
- warning$6(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner));
+ warning_1(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, getStack());
};
- var warnStyleValueIsInfinity = function (name, value, owner) {
+ var warnStyleValueIsInfinity = function (name, value, getStack) {
if (warnedForInfinityValue) {
return;
}
warnedForInfinityValue = true;
- warning$6(false, '`Infinity` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner));
- };
-
- var checkRenderMessage = function (owner) {
- var ownerName;
- if (owner != null) {
- // Stack passes the owner manually all the way to CSSPropertyOperations.
- ownerName = getComponentName$1(owner);
- } else {
- // Fiber doesn't pass it but uses ReactDebugCurrentFiber to track it.
- // It is only enabled in development and tracks host components too.
- ownerName = getCurrentFiberOwnerName();
- // TODO: also report the stack.
- }
- if (ownerName) {
- return '\n\nCheck the render method of `' + ownerName + '`.';
- }
- return '';
+ warning_1(false, '`Infinity` is an invalid value for the `%s` css style property.%s', name, getStack());
};
- warnValidStyle$1 = function (name, value, component) {
- var owner;
- if (component) {
- // TODO: this only works with Stack. Seems like we need to add unit tests?
- owner = component._currentElement._owner;
- }
+ warnValidStyle = function (name, value, getStack) {
if (name.indexOf('-') > -1) {
- warnHyphenatedStyleName(name, owner);
+ warnHyphenatedStyleName(name, getStack);
} else if (badVendoredStyleNamePattern.test(name)) {
- warnBadVendoredStyleName(name, owner);
+ warnBadVendoredStyleName(name, getStack);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
- warnStyleValueWithSemicolon(name, value, owner);
+ warnStyleValueWithSemicolon(name, value, getStack);
}
if (typeof value === 'number') {
if (isNaN(value)) {
- warnStyleValueIsNaN(name, value, owner);
+ warnStyleValueIsNaN(name, value, getStack);
} else if (!isFinite(value)) {
- warnStyleValueIsInfinity(name, value, owner);
+ warnStyleValueIsInfinity(name, value, getStack);
}
}
};
}
-var warnValidStyle_1 = warnValidStyle$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.
- *
- * @providesModule validAriaProperties
- */
+var warnValidStyle$1 = warnValidStyle;
var ariaProperties = {
'aria-current': 0, // state
@@ -2159,57 +1382,36 @@ var ariaProperties = {
'aria-setsize': 0
};
-var validAriaProperties$1 = ariaProperties;
-
var warnedProperties = {};
-var rARIA = new RegExp('^(aria)-[' + DOMProperty_1.ATTRIBUTE_NAME_CHAR + ']*$');
-var rARIACamel = new RegExp('^(aria)[A-Z][' + DOMProperty_1.ATTRIBUTE_NAME_CHAR + ']*$');
+var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
+var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
var hasOwnProperty = Object.prototype.hasOwnProperty;
-{
- var warning$7 = warning_1;
-
- var _require$1 = ReactGlobalSharedState_1,
- ReactComponentTreeHook = _require$1.ReactComponentTreeHook,
- ReactDebugCurrentFrame$2 = _require$1.ReactDebugCurrentFrame;
-
- var getStackAddendumByID = ReactComponentTreeHook.getStackAddendumByID;
-
-
- var validAriaProperties = validAriaProperties$1;
-}
-
-function getStackAddendum$1(debugID) {
- if (debugID != null) {
- // This can only happen on Stack
- return getStackAddendumByID(debugID);
- } else {
- // This can only happen on Fiber / Server
- var stack = ReactDebugCurrentFrame$2.getStackAddendum();
- return stack != null ? stack : '';
- }
+function getStackAddendum$1() {
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
+ return stack != null ? stack : '';
}
-function validateProperty(tagName, name, debugID) {
+function validateProperty(tagName, name) {
if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
return true;
}
if (rARIACamel.test(name)) {
var ariaName = 'aria-' + name.slice(4).toLowerCase();
- var correctName = validAriaProperties.hasOwnProperty(ariaName) ? ariaName : null;
+ var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
// If this is an aria-* attribute, but is not listed in the known DOM
// DOM properties, then it is an invalid aria-* attribute.
if (correctName == null) {
- warning$7(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s', name, getStackAddendum$1(debugID));
+ warning_1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s', name, getStackAddendum$1());
warnedProperties[name] = true;
return true;
}
// aria-* attributes should be lowercase; suggest the lowercase version.
if (name !== correctName) {
- warning$7(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s', name, correctName, getStackAddendum$1(debugID));
+ warning_1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s', name, correctName, getStackAddendum$1());
warnedProperties[name] = true;
return true;
}
@@ -2217,7 +1419,7 @@ function validateProperty(tagName, name, debugID) {
if (rARIA.test(name)) {
var lowerCasedName = name.toLowerCase();
- var standardName = validAriaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
+ var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
// If this is an aria-* attribute, but is not listed in the known DOM
// DOM properties, then it is an invalid aria-* attribute.
@@ -2227,7 +1429,7 @@ function validateProperty(tagName, name, debugID) {
}
// aria-* attributes should be lowercase; suggest the lowercase version.
if (name !== standardName) {
- warning$7(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$1(debugID));
+ warning_1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$1());
warnedProperties[name] = true;
return true;
}
@@ -2236,11 +1438,11 @@ function validateProperty(tagName, name, debugID) {
return true;
}
-function warnInvalidARIAProps(type, props, debugID) {
+function warnInvalidARIAProps(type, props) {
var invalidProps = [];
for (var key in props) {
- var isValid = validateProperty(type, key, debugID);
+ var isValid = validateProperty(type, key);
if (!isValid) {
invalidProps.push(key);
}
@@ -2251,270 +1453,102 @@ function warnInvalidARIAProps(type, props, debugID) {
}).join(', ');
if (invalidProps.length === 1) {
- warning$7(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1(debugID));
+ warning_1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1());
} else if (invalidProps.length > 1) {
- warning$7(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1(debugID));
+ warning_1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1());
}
}
-function validateProperties(type, props, debugID /* Stack only */) {
- if (isCustomComponent_1(type, props)) {
+function validateProperties(type, props) {
+ if (isCustomComponent(type, props)) {
return;
}
- warnInvalidARIAProps(type, props, debugID);
-}
-
-var ReactDOMInvalidARIAHook = {
- // Fiber
- validateProperties: validateProperties,
- // Stack
- onBeforeMountComponent: function (debugID, element) {
- if (true && element != null && typeof element.type === 'string') {
- validateProperties(element.type, element.props, debugID);
- }
- },
- onBeforeUpdateComponent: function (debugID, element) {
- if (true && element != null && typeof element.type === 'string') {
- validateProperties(element.type, element.props, debugID);
- }
- }
-};
-
-var ReactDOMInvalidARIAHook_1 = ReactDOMInvalidARIAHook;
-
-{
- var warning$8 = warning_1;
-
- var _require$2 = ReactGlobalSharedState_1,
- ReactComponentTreeHook$1 = _require$2.ReactComponentTreeHook,
- ReactDebugCurrentFrame$3 = _require$2.ReactDebugCurrentFrame;
-
- var getStackAddendumByID$1 = ReactComponentTreeHook$1.getStackAddendumByID;
+ warnInvalidARIAProps(type, props);
}
var didWarnValueNull = false;
-function getStackAddendum$2(debugID) {
- if (debugID != null) {
- // This can only happen on Stack
- return getStackAddendumByID$1(debugID);
- } else {
- // This can only happen on Fiber / Server
- var stack = ReactDebugCurrentFrame$3.getStackAddendum();
- return stack != null ? stack : '';
- }
+function getStackAddendum$2() {
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
+ return stack != null ? stack : '';
}
-function validateProperties$1(type, props, debugID /* Stack only */) {
+function validateProperties$1(type, props) {
if (type !== 'input' && type !== 'textarea' && type !== 'select') {
return;
}
- if (props != null && props.value === null && !didWarnValueNull) {
- warning$8(false, '`value` prop on `%s` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', type, getStackAddendum$2(debugID));
+ if (props != null && props.value === null && !didWarnValueNull) {
didWarnValueNull = true;
- }
-}
-
-var ReactDOMNullInputValuePropHook = {
- // Fiber
- validateProperties: validateProperties$1,
- // Stack
- onBeforeMountComponent: function (debugID, element) {
- if (true && element != null && typeof element.type === 'string') {
- validateProperties$1(element.type, element.props, debugID);
- }
- },
- onBeforeUpdateComponent: function (debugID, element) {
- if (true && element != null && typeof element.type === 'string') {
- validateProperties$1(element.type, element.props, debugID);
+ if (type === 'select' && props.multiple) {
+ warning_1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.%s', type, getStackAddendum$2());
+ } else {
+ warning_1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', type, getStackAddendum$2());
}
}
-};
-
-var ReactDOMNullInputValuePropHook_1 = ReactDOMNullInputValuePropHook;
+}
/**
- * Injectable ordering of event plugins.
+ * Registers plugins so that they can extract and dispatch events.
+ *
+ * @see {EventPluginHub}
*/
-var eventPluginOrder = null;
/**
- * Injectable mapping from names to event plugin modules.
+ * Ordered list of injected plugins.
*/
-var namesToPlugins = {};
+
/**
- * Recomputes the plugin list using the injected plugins and plugin ordering.
- *
- * @private
+ * Mapping from event name to dispatch config
*/
-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);
- !(pluginIndex > -1) ? invariant_1(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0;
- if (EventPluginRegistry.plugins[pluginIndex]) {
- continue;
- }
- !pluginModule.extractEvents ? invariant_1(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0;
- EventPluginRegistry.plugins[pluginIndex] = pluginModule;
- var publishedEvents = pluginModule.eventTypes;
- for (var eventName in publishedEvents) {
- !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant_1(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0;
- }
- }
-}
+
/**
- * 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
+ * Mapping from registration name to plugin module
*/
-function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
- !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant_1(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
- EventPluginRegistry.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;
-}
+var registrationNameModules = {};
/**
- * 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
+ * Mapping from registration name to event name
*/
-function publishRegistrationName(registrationName, pluginModule, eventName) {
- !!EventPluginRegistry.registrationNameModules[registrationName] ? invariant_1(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0;
- EventPluginRegistry.registrationNameModules[registrationName] = pluginModule;
- EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
- {
- var lowerCasedName = registrationName.toLowerCase();
- EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
- if (registrationName === 'onDoubleClick') {
- EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
- }
- }
-}
+/**
+ * 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
/**
- * Registers plugins so that they can extract and dispatch events.
+ * 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.
*
- * @see {EventPluginHub}
+ * @param {array} InjectedEventPluginOrder
+ * @internal
+ * @see {EventPluginHub.injection.injectEventPluginOrder}
*/
-var EventPluginRegistry = {
- /**
- * Ordered list of injected plugins.
- */
- plugins: [],
-
- /**
- * Mapping from event name to dispatch config
- */
- eventNameDispatchConfigs: {},
-
- /**
- * Mapping from registration name to plugin module
- */
- registrationNameModules: {},
-
- /**
- * Mapping from registration name to event name
- */
- 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}
- */
- 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}
- */
- injectEventPluginOrder: function (injectedEventPluginOrder) {
- !!eventPluginOrder ? invariant_1(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0;
- // 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}
- */
- injectEventPluginsByName: function (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) {
- !!namesToPlugins[pluginName] ? invariant_1(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0;
- namesToPlugins[pluginName] = pluginModule;
- isOrderingDirty = true;
- }
- }
- if (isOrderingDirty) {
- recomputePluginOrdering();
- }
- }
-};
-var EventPluginRegistry_1 = EventPluginRegistry;
/**
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Injects plugins to be used by `EventPluginHub`. The plugin names must be
+ * in the ordering injected by `injectEventPluginOrder`.
*
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
+ * Plugins can be injected as part of page initialization or on-the-fly.
*
- * @providesModule possibleStandardNames
+ * @param {object} injectedNamesToPlugins Map from names to plugin modules.
+ * @internal
+ * @see {EventPluginHub.injection.injectEventPluginsByName}
*/
// When adding attributes to the HTML or SVG whitelist, be sure to
// also add them to this module to ensure casing and incorrect name
// warnings.
-var possibleStandardNames$1 = {
+var possibleStandardNames = {
// HTML
accept: 'accept',
acceptcharset: 'acceptCharset',
@@ -2522,7 +1556,6 @@ var possibleStandardNames$1 = {
accesskey: 'accessKey',
action: 'action',
allowfullscreen: 'allowFullScreen',
- allowtransparency: 'allowTransparency',
alt: 'alt',
as: 'as',
async: 'async',
@@ -2906,6 +1939,7 @@ var possibleStandardNames$1 = {
strokeopacity: 'strokeOpacity',
'stroke-opacity': 'strokeOpacity',
suppresscontenteditablewarning: 'suppressContentEditableWarning',
+ suppresshydrationwarning: 'suppressHydrationWarning',
surfacescale: 'surfaceScale',
systemlanguage: 'systemLanguage',
tablevalues: 'tableValues',
@@ -2999,63 +2033,54 @@ var possibleStandardNames$1 = {
zoomandpan: 'zoomAndPan'
};
-var possibleStandardNames_1 = possibleStandardNames$1;
-
-{
- var warning$9 = warning_1;
-
- var _require$3 = ReactGlobalSharedState_1,
- ReactComponentTreeHook$2 = _require$3.ReactComponentTreeHook,
- ReactDebugCurrentFrame$4 = _require$3.ReactDebugCurrentFrame;
-
- var getStackAddendumByID$2 = ReactComponentTreeHook$2.getStackAddendumByID;
-}
-
-function getStackAddendum$3(debugID) {
- if (debugID != null) {
- // This can only happen on Stack
- return getStackAddendumByID$2(debugID);
- } else {
- // This can only happen on Fiber / Server
- var stack = ReactDebugCurrentFrame$4.getStackAddendum();
- return stack != null ? stack : '';
- }
+function getStackAddendum$3() {
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
+ return stack != null ? stack : '';
}
{
var warnedProperties$1 = {};
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
- var EVENT_NAME_REGEX = /^on[A-Z]/;
- var rARIA$1 = new RegExp('^(aria)-[' + DOMProperty_1.ATTRIBUTE_NAME_CHAR + ']*$');
- var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + DOMProperty_1.ATTRIBUTE_NAME_CHAR + ']*$');
- var possibleStandardNames = possibleStandardNames_1;
+ var EVENT_NAME_REGEX = /^on./;
+ var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
+ var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
+ var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
- var validateProperty$1 = function (tagName, name, value, debugID) {
+ var validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
if (hasOwnProperty$1.call(warnedProperties$1, name) && warnedProperties$1[name]) {
return true;
}
- if (EventPluginRegistry_1.registrationNameModules.hasOwnProperty(name)) {
- return true;
- }
-
- if (EventPluginRegistry_1.plugins.length === 0 && EVENT_NAME_REGEX.test(name)) {
- // If no event plugins have been injected, we might be in a server environment.
- // Don't check events in this case.
- return true;
- }
-
var lowerCasedName = name.toLowerCase();
- var registrationName = EventPluginRegistry_1.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry_1.possibleRegistrationNames[lowerCasedName] : null;
-
- if (registrationName != null) {
- warning$9(false, 'Invalid event handler property `%s`. Did you mean `%s`?%s', name, registrationName, getStackAddendum$3(debugID));
+ if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
+ warning_1(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
warnedProperties$1[name] = true;
return true;
}
- if (lowerCasedName.indexOf('on') === 0) {
- warning$9(false, 'Unknown event handler property `%s`. It will be ignored.%s', name, getStackAddendum$3(debugID));
+ // We can't rely on the event system being injected on the server.
+ if (canUseEventSystem) {
+ if (registrationNameModules.hasOwnProperty(name)) {
+ return true;
+ }
+ var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
+ if (registrationName != null) {
+ warning_1(false, 'Invalid event handler property `%s`. Did you mean `%s`?%s', name, registrationName, getStackAddendum$3());
+ warnedProperties$1[name] = true;
+ return true;
+ }
+ if (EVENT_NAME_REGEX.test(name)) {
+ warning_1(false, 'Unknown event handler property `%s`. It will be ignored.%s', name, getStackAddendum$3());
+ warnedProperties$1[name] = true;
+ return true;
+ }
+ } else if (EVENT_NAME_REGEX.test(name)) {
+ // If no event plugins have been injected, we are in a server environment.
+ // So we can't tell if the event name is correct for sure, but we can filter
+ // out known bad ones like `onclick`. We can't suggest a specific replacement though.
+ if (INVALID_EVENT_NAME_REGEX.test(name)) {
+ warning_1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.%s', name, getStackAddendum$3());
+ }
warnedProperties$1[name] = true;
return true;
}
@@ -3065,56 +2090,54 @@ function getStackAddendum$3(debugID) {
return true;
}
- if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
- warning$9(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
- warnedProperties$1[name] = true;
- return true;
- }
-
if (lowerCasedName === 'innerhtml') {
- warning$9(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
+ warning_1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
warnedProperties$1[name] = true;
return true;
}
if (lowerCasedName === 'aria') {
- warning$9(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
+ warning_1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
warnedProperties$1[name] = true;
return true;
}
if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
- warning$9(false, 'Received a `%s` for string attribute `is`. If this is expected, cast ' + 'the value to a string.%s', typeof value, getStackAddendum$3(debugID));
+ warning_1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.%s', typeof value, getStackAddendum$3());
warnedProperties$1[name] = true;
return true;
}
if (typeof value === 'number' && isNaN(value)) {
- warning$9(false, 'Received NaN for numeric attribute `%s`. If this is expected, cast ' + 'the value to a string.%s', name, getStackAddendum$3(debugID));
+ warning_1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.%s', name, getStackAddendum$3());
warnedProperties$1[name] = true;
return true;
}
- var isReserved = DOMProperty_1.isReservedProp(name);
+ var isReserved = isReservedProp(name);
// Known attributes should match the casing specified in the property config.
if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
var standardName = possibleStandardNames[lowerCasedName];
if (standardName !== name) {
- warning$9(false, 'Invalid DOM property `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$3(debugID));
+ warning_1(false, 'Invalid DOM property `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$3());
warnedProperties$1[name] = true;
return true;
}
} else if (!isReserved && name !== lowerCasedName) {
// Unknown attributes should have lowercase casing since that's how they
// will be cased anyway with server rendering.
- warning$9(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.%s', name, lowerCasedName, getStackAddendum$3(debugID));
+ warning_1(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.%s', name, lowerCasedName, getStackAddendum$3());
warnedProperties$1[name] = true;
return true;
}
- if (typeof value === 'boolean') {
- warning$9(DOMProperty_1.shouldAttributeAcceptBooleanValue(name), 'Received `%s` for non-boolean attribute `%s`. If this is expected, cast ' + 'the value to a string.%s', value, name, getStackAddendum$3(debugID));
+ if (typeof value === 'boolean' && !shouldAttributeAcceptBooleanValue(name)) {
+ if (value) {
+ warning_1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.%s', value, name, name, value, name, getStackAddendum$3());
+ } else {
+ warning_1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.%s', value, name, name, value, name, name, name, getStackAddendum$3());
+ }
warnedProperties$1[name] = true;
return true;
}
@@ -3126,7 +2149,7 @@ function getStackAddendum$3(debugID) {
}
// Warn when a known attribute is a bad type
- if (!DOMProperty_1.shouldSetAttribute(name, value)) {
+ if (!shouldSetAttribute(name, value)) {
warnedProperties$1[name] = true;
return false;
}
@@ -3135,10 +2158,10 @@ function getStackAddendum$3(debugID) {
};
}
-var warnUnknownProperties = function (type, props, debugID) {
+var warnUnknownProperties = function (type, props, canUseEventSystem) {
var unknownProps = [];
for (var key in props) {
- var isValid = validateProperty$1(type, key, props[key], debugID);
+ var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
if (!isValid) {
unknownProps.push(key);
}
@@ -3148,80 +2171,34 @@ var warnUnknownProperties = function (type, props, debugID) {
return '`' + prop + '`';
}).join(', ');
if (unknownProps.length === 1) {
- warning$9(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3(debugID));
+ warning_1(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3());
} else if (unknownProps.length > 1) {
- warning$9(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3(debugID));
+ warning_1(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3());
}
};
-function validateProperties$2(type, props, debugID /* Stack only */) {
- if (isCustomComponent_1(type, props)) {
+function validateProperties$2(type, props, canUseEventSystem) {
+ if (isCustomComponent(type, props)) {
return;
}
- warnUnknownProperties(type, props, debugID);
+ warnUnknownProperties(type, props, canUseEventSystem);
}
-var ReactDOMUnknownPropertyHook = {
- // Fiber
- validateProperties: validateProperties$2,
- // Stack
- onBeforeMountComponent: function (debugID, element) {
- if (true && element != null && typeof element.type === 'string') {
- validateProperties$2(element.type, element.props, debugID);
- }
- },
- onBeforeUpdateComponent: function (debugID, element) {
- if (true && element != null && typeof element.type === 'string') {
- validateProperties$2(element.type, element.props, debugID);
- }
- }
-};
-
-var ReactDOMUnknownPropertyHook_1 = ReactDOMUnknownPropertyHook;
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-var Namespaces = DOMNamespaces.Namespaces;
-var getIntrinsicNamespace = DOMNamespaces.getIntrinsicNamespace;
-var getChildNamespace = DOMNamespaces.getChildNamespace;
-
-
-
-
-
+// Based on reading the React.Children implementation. TODO: type this somewhere?
+var toArray = React.Children.toArray;
-
-
-
-
-
-
-
-
-var toArray = react.Children.toArray;
+var getStackAddendum = emptyFunction_1.thatReturns('');
{
- var warning = warning_1;
- var checkPropTypes = checkPropTypes_1;
- var warnValidStyle = warnValidStyle_1;
-
- var _require2 = ReactDOMInvalidARIAHook_1,
- validateARIAProperties = _require2.validateProperties;
-
- var _require3 = ReactDOMNullInputValuePropHook_1,
- validateInputProperties = _require3.validateProperties;
-
- var _require4 = ReactDOMUnknownPropertyHook_1,
- validateUnknownProperties = _require4.validateProperties;
-
var validatePropertiesInDevelopment = function (type, props) {
- validateARIAProperties(type, props);
- validateInputProperties(type, props);
- validateUnknownProperties(type, props);
+ validateProperties(type, props);
+ validateProperties$1(type, props);
+ validateProperties$2(type, props, /* canUseEventSystem */false);
};
- var describeComponentFrame = describeComponentFrame$1;
var describeStackFrame = function (element) {
var source = element._source;
var type = element.type;
@@ -3230,13 +2207,11 @@ var toArray = react.Children.toArray;
return describeComponentFrame(name, source, ownerName);
};
- var _require5 = ReactGlobalSharedState_1,
- ReactDebugCurrentFrame = _require5.ReactDebugCurrentFrame;
-
var currentDebugStack = null;
var currentDebugElementStack = null;
var setCurrentDebugStack = function (stack) {
- currentDebugElementStack = stack[stack.length - 1].debugElementStack;
+ var frame = stack[stack.length - 1];
+ currentDebugElementStack = frame.debugElementStack;
// We are about to enter a new composite stack, reset the array.
currentDebugElementStack.length = 0;
currentDebugStack = stack;
@@ -3252,16 +2227,17 @@ var toArray = react.Children.toArray;
currentDebugStack = null;
ReactDebugCurrentFrame.getCurrentStack = null;
};
- var getStackAddendum = function () {
+ getStackAddendum = function () {
if (currentDebugStack === null) {
- return null;
+ return '';
}
var stack = '';
var debugStack = currentDebugStack;
for (var i = debugStack.length - 1; i >= 0; i--) {
- var debugElementStack = debugStack[i].debugElementStack;
- for (var ii = debugElementStack.length - 1; ii >= 0; ii--) {
- stack += describeStackFrame(debugElementStack[ii]);
+ var frame = debugStack[i];
+ var _debugElementStack = frame.debugElementStack;
+ for (var ii = _debugElementStack.length - 1; ii >= 0; ii--) {
+ stack += describeStackFrame(_debugElementStack[ii]);
}
}
return stack;
@@ -3273,6 +2249,7 @@ var didWarnDefaultChecked = false;
var didWarnDefaultSelectValue = false;
var didWarnDefaultTextareaValue = false;
var didWarnInvalidOptionChildren = false;
+var didWarnAboutNoopUpdateForComponent = {};
var valuePropNames = ['value', 'defaultValue'];
var newlineEatingTags = {
listing: true,
@@ -3300,7 +2277,7 @@ var processStyleName = memoizeStringOnly_1(function (styleName) {
return hyphenateStyleName_1(styleName);
});
-function createMarkupForStyles(styles, component) {
+function createMarkupForStyles(styles) {
var serialized = '';
var delimiter = '';
for (var styleName in styles) {
@@ -3311,12 +2288,12 @@ function createMarkupForStyles(styles, component) {
var styleValue = styles[styleName];
{
if (!isCustomProperty) {
- warnValidStyle(styleName, styleValue, component);
+ warnValidStyle$1(styleName, styleValue, getStackAddendum);
}
}
if (styleValue != null) {
serialized += delimiter + processStyleName(styleName) + ':';
- serialized += dangerousStyleValue_1(styleName, styleValue, isCustomProperty);
+ serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
delimiter = ';';
}
@@ -3327,7 +2304,14 @@ function createMarkupForStyles(styles, component) {
function warnNoop(publicInstance, callerName) {
{
var constructor = publicInstance.constructor;
- warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, constructor && getComponentName(constructor) || 'ReactClass');
+ var componentName = constructor && getComponentName(constructor) || 'ReactClass';
+ var warningKey = componentName + '.' + callerName;
+ if (didWarnAboutNoopUpdateForComponent[warningKey]) {
+ return;
+ }
+
+ warning_1(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
+ didWarnAboutNoopUpdateForComponent[warningKey] = true;
}
}
@@ -3344,17 +2328,33 @@ function getNonChildrenInnerMarkup(props) {
} else {
var content = props.children;
if (typeof content === 'string' || typeof content === 'number') {
- return escapeTextContentForBrowser_1(content);
+ return escapeTextForBrowser(content);
}
}
return null;
}
+function flattenTopLevelChildren(children) {
+ if (!React.isValidElement(children)) {
+ return toArray(children);
+ }
+ var element = children;
+ if (element.type !== REACT_FRAGMENT_TYPE) {
+ return [element];
+ }
+ var fragmentChildren = element.props.children;
+ if (!React.isValidElement(fragmentChildren)) {
+ return toArray(fragmentChildren);
+ }
+ var fragmentChildElement = fragmentChildren;
+ return [fragmentChildElement];
+}
+
function flattenOptionChildren(children) {
var content = '';
// Flatten children and warn if they aren't strings or numbers;
// invalid types are ignored.
- react.Children.forEach(children, function (child) {
+ React.Children.forEach(children, function (child) {
if (child == null) {
return;
}
@@ -3364,7 +2364,7 @@ function flattenOptionChildren(children) {
{
if (!didWarnInvalidOptionChildren) {
didWarnInvalidOptionChildren = true;
- warning(false, 'Only strings and numbers are supported as <option> children.');
+ warning_1(false, 'Only strings and numbers are supported as <option> children.');
}
}
}
@@ -3386,7 +2386,7 @@ function maskContext(type, context) {
function checkContextTypes(typeSpecs, values, location) {
{
- checkPropTypes(typeSpecs, values, location, 'Component', getStackAddendum);
+ checkPropTypes_1(typeSpecs, values, location, 'Component', getStackAddendum);
}
}
@@ -3401,13 +2401,14 @@ function processContext(type, context) {
}
var STYLE = 'style';
-var RESERVED_PROPS = {
+var RESERVED_PROPS$1 = {
children: null,
dangerouslySetInnerHTML: null,
- suppressContentEditableWarning: null
+ suppressContentEditableWarning: null,
+ suppressHydrationWarning: null
};
-function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeStaticMarkup, isRootElement, instForDebug) {
+function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeStaticMarkup, isRootElement) {
var ret = '<' + tagVerbatim;
for (var propKey in props) {
@@ -3419,15 +2420,15 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
continue;
}
if (propKey === STYLE) {
- propValue = createMarkupForStyles(propValue, instForDebug);
+ propValue = createMarkupForStyles(propValue);
}
var markup = null;
- if (isCustomComponent_1(tagLowercase, props)) {
- if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
- markup = DOMMarkupOperations_1.createMarkupForCustomAttribute(propKey, propValue);
+ if (isCustomComponent(tagLowercase, props)) {
+ if (!RESERVED_PROPS$1.hasOwnProperty(propKey)) {
+ markup = createMarkupForCustomAttribute(propKey, propValue);
}
} else {
- markup = DOMMarkupOperations_1.createMarkupForProperty(propKey, propValue);
+ markup = createMarkupForProperty(propKey, propValue);
}
if (markup) {
ret += ' ' + markup;
@@ -3441,7 +2442,7 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
}
if (isRootElement) {
- ret += ' ' + DOMMarkupOperations_1.createMarkupForRoot();
+ ret += ' ' + createMarkupForRoot();
}
return ret;
}
@@ -3453,11 +2454,13 @@ function validateRenderResult(child, type) {
}
function resolve(child, context) {
- while (react.isValidElement(child)) {
+ while (React.isValidElement(child)) {
+ // Safe because we just checked it's an element.
+ var element = child;
{
- pushElementToDebugStack(child);
+ pushElementToDebugStack(element);
}
- var Component = child.type;
+ var Component = element.type;
if (typeof Component !== 'function') {
break;
}
@@ -3489,9 +2492,9 @@ function resolve(child, context) {
};
if (shouldConstruct(Component)) {
- inst = new Component(child.props, publicContext, updater);
+ inst = new Component(element.props, publicContext, updater);
} else {
- inst = Component(child.props, publicContext, updater);
+ inst = Component(element.props, publicContext, updater);
if (inst == null || inst.render == null) {
child = inst;
validateRenderResult(child, Component);
@@ -3499,7 +2502,7 @@ function resolve(child, context) {
}
}
- inst.props = child.props;
+ inst.props = element.props;
inst.context = publicContext;
inst.updater = updater;
@@ -3522,13 +2525,13 @@ function resolve(child, context) {
var dontMutate = true;
for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
var partial = oldQueue[i];
- var partialState = typeof partial === 'function' ? partial.call(inst, nextState, child.props, publicContext) : partial;
+ var partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
if (partialState) {
if (dontMutate) {
dontMutate = false;
- nextState = assign({}, nextState, partialState);
+ nextState = _assign({}, nextState, partialState);
} else {
- assign(nextState, partialState);
+ _assign(nextState, partialState);
}
}
}
@@ -3552,29 +2555,33 @@ function resolve(child, context) {
var childContext;
if (typeof inst.getChildContext === 'function') {
var childContextTypes = Component.childContextTypes;
- !(typeof childContextTypes === 'object') ? invariant_1(false, '%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().', getComponentName(Component) || 'Unknown') : void 0;
- childContext = inst.getChildContext();
- for (var contextKey in childContext) {
- !(contextKey in childContextTypes) ? invariant_1(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
+ if (typeof childContextTypes === 'object') {
+ childContext = inst.getChildContext();
+ for (var contextKey in childContext) {
+ !(contextKey in childContextTypes) ? invariant_1(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
+ }
+ } else {
+ warning_1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
}
}
if (childContext) {
- context = assign({}, context, childContext);
+ context = _assign({}, context, childContext);
}
}
return { child: child, context: context };
}
var ReactDOMServerRenderer = function () {
- function ReactDOMServerRenderer(element, makeStaticMarkup) {
+ function ReactDOMServerRenderer(children, makeStaticMarkup) {
_classCallCheck(this, ReactDOMServerRenderer);
- var children = react.isValidElement(element) ? [element] : toArray(element);
+ var flatChildren = flattenTopLevelChildren(children);
+
var topFrame = {
// Assume all trees start in the HTML namespace (not totally true, but
// this is what we did historically)
domNamespace: Namespaces.html,
- children: children,
+ children: flatChildren,
childIndex: 0,
context: emptyObject_1,
footer: ''
@@ -3588,6 +2595,8 @@ var ReactDOMServerRenderer = function () {
this.previousWasTextNode = false;
this.makeStaticMarkup = makeStaticMarkup;
}
+ // TODO: type this more strictly:
+
ReactDOMServerRenderer.prototype.read = function read(bytes) {
if (this.exhausted) {
@@ -3602,8 +2611,11 @@ var ReactDOMServerRenderer = function () {
}
var frame = this.stack[this.stack.length - 1];
if (frame.childIndex >= frame.children.length) {
- out += frame.footer;
- this.previousWasTextNode = false;
+ var footer = frame.footer;
+ out += footer;
+ if (footer !== '') {
+ this.previousWasTextNode = false;
+ }
this.stack.pop();
if (frame.tag === 'select') {
this.currentSelectValue = null;
@@ -3630,39 +2642,55 @@ var ReactDOMServerRenderer = function () {
return '';
}
if (this.makeStaticMarkup) {
- return escapeTextContentForBrowser_1(text);
+ return escapeTextForBrowser(text);
}
if (this.previousWasTextNode) {
- return '<!-- -->' + escapeTextContentForBrowser_1(text);
+ return '<!-- -->' + escapeTextForBrowser(text);
}
this.previousWasTextNode = true;
- return escapeTextContentForBrowser_1(text);
+ return escapeTextForBrowser(text);
} else {
+ var nextChild;
+
var _resolve = resolve(child, context);
- child = _resolve.child;
+ nextChild = _resolve.child;
context = _resolve.context;
- if (child === null || child === false) {
+ if (nextChild === null || nextChild === false) {
return '';
- } else {
- if (react.isValidElement(child)) {
- return this.renderDOM(child, context, parentNamespace);
- } else {
- var children = toArray(child);
- var frame = {
- domNamespace: parentNamespace,
- children: children,
- childIndex: 0,
- context: context,
- footer: ''
- };
- {
- frame.debugElementStack = [];
- }
- this.stack.push(frame);
- return '';
+ } else if (!React.isValidElement(nextChild)) {
+ var nextChildren = toArray(nextChild);
+ var frame = {
+ domNamespace: parentNamespace,
+ children: nextChildren,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ frame.debugElementStack = [];
}
+ this.stack.push(frame);
+ return '';
+ } else if (nextChild.type === REACT_FRAGMENT_TYPE) {
+ var _nextChildren = toArray(nextChild.props.children);
+ var _frame = {
+ domNamespace: parentNamespace,
+ children: _nextChildren,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame.debugElementStack = [];
+ }
+ this.stack.push(_frame);
+ return '';
+ } else {
+ // Safe because we just checked it's an element.
+ var nextElement = nextChild;
+ return this.renderDOM(nextElement, context, parentNamespace);
}
}
};
@@ -3679,7 +2707,7 @@ var ReactDOMServerRenderer = function () {
if (namespace === Namespaces.html) {
// Should this check be gated by parent namespace? Not sure we want to
// allow <SVG> or <mATH>.
- warning(tag === element.type, '<%s /> is using uppercase HTML. Always use lowercase HTML tags ' + 'in React.', element.type);
+ warning_1(tag === element.type, '<%s /> is using uppercase HTML. Always use lowercase HTML tags ' + 'in React.', element.type);
}
}
@@ -3688,21 +2716,19 @@ var ReactDOMServerRenderer = function () {
var props = element.props;
if (tag === 'input') {
{
- ReactControlledValuePropTypes_1.checkPropTypes('input', props, function () {
- return '';
- });
+ ReactControlledValuePropTypes.checkPropTypes('input', props, getStackAddendum);
if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
- warning(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', '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', 'A component', props.type);
didWarnDefaultChecked = true;
}
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
- warning(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', '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', 'A component', props.type);
didWarnDefaultInputValue = true;
}
}
- props = assign({
+ props = _assign({
type: undefined
}, props, {
defaultChecked: undefined,
@@ -3712,11 +2738,9 @@ var ReactDOMServerRenderer = function () {
});
} else if (tag === 'textarea') {
{
- ReactControlledValuePropTypes_1.checkPropTypes('textarea', props, function () {
- return '';
- });
+ ReactControlledValuePropTypes.checkPropTypes('textarea', props, getStackAddendum);
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
- warning(false, 'Textarea 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 textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
+ warning_1(false, 'Textarea 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 textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
didWarnDefaultTextareaValue = true;
}
}
@@ -3728,7 +2752,7 @@ var ReactDOMServerRenderer = function () {
var textareaChildren = props.children;
if (textareaChildren != null) {
{
- warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
+ warning_1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
}
!(defaultValue == null) ? invariant_1(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
if (Array.isArray(textareaChildren)) {
@@ -3744,15 +2768,13 @@ var ReactDOMServerRenderer = function () {
initialValue = defaultValue;
}
- props = assign({}, props, {
+ props = _assign({}, props, {
value: undefined,
children: '' + initialValue
});
} else if (tag === 'select') {
{
- ReactControlledValuePropTypes_1.checkPropTypes('select', props, function () {
- return '';
- });
+ ReactControlledValuePropTypes.checkPropTypes('select', props, getStackAddendum);
for (var i = 0; i < valuePropNames.length; i++) {
var propName = valuePropNames[i];
@@ -3761,19 +2783,19 @@ var ReactDOMServerRenderer = function () {
}
var isArray = Array.isArray(props[propName]);
if (props.multiple && !isArray) {
- warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '');
+ warning_1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '');
} else if (!props.multiple && isArray) {
- warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '');
+ warning_1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '');
}
}
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
- warning(false, 'Select 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 select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
+ warning_1(false, 'Select 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 select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
didWarnDefaultSelectValue = true;
}
}
this.currentSelectValue = props.value != null ? props.value : props.defaultValue;
- props = assign({}, props, {
+ props = _assign({}, props, {
value: undefined
});
} else if (tag === 'option') {
@@ -3800,7 +2822,7 @@ var ReactDOMServerRenderer = function () {
selected = '' + selectValue === value;
}
- props = assign({
+ props = _assign({
selected: undefined,
children: undefined
}, props, {
@@ -3814,11 +2836,11 @@ var ReactDOMServerRenderer = function () {
validatePropertiesInDevelopment(tag, props);
}
- assertValidProps_1(tag, props);
+ assertValidProps(tag, props, getStackAddendum);
- var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1, null);
+ var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
var footer = '';
- if (omittedCloseTags_1.hasOwnProperty(tag)) {
+ if (omittedCloseTags.hasOwnProperty(tag)) {
out += '/>';
} else {
out += '>';
@@ -3857,21 +2879,20 @@ var ReactDOMServerRenderer = function () {
frame.debugElementStack = [];
}
this.stack.push(frame);
+ this.previousWasTextNode = false;
return out;
};
return ReactDOMServerRenderer;
}();
-var ReactPartialRenderer = ReactDOMServerRenderer;
-
/**
* Render a ReactElement to its initial HTML. This should only be used on the
* server.
- * See https://facebook.github.io/react/docs/react-dom-server.html#rendertostring
+ * See https://reactjs.org/docs/react-dom-server.html#rendertostring
*/
function renderToString(element) {
- var renderer = new ReactPartialRenderer(element, false);
+ var renderer = new ReactDOMServerRenderer(element, false);
var markup = renderer.read(Infinity);
return markup;
}
@@ -3879,212 +2900,41 @@ function renderToString(element) {
/**
* Similar to renderToString, except this doesn't create extra DOM attributes
* such as data-react-id that React uses internally.
- * See https://facebook.github.io/react/docs/react-dom-server.html#rendertostaticmarkup
+ * See https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup
*/
function renderToStaticMarkup(element) {
- var renderer = new ReactPartialRenderer(element, true);
+ var renderer = new ReactDOMServerRenderer(element, true);
var markup = renderer.read(Infinity);
return markup;
}
-var ReactDOMStringRenderer = {
- renderToString: renderToString,
- renderToStaticMarkup: renderToStaticMarkup
-};
-
-/**
- * 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';
-
-var MUST_USE_PROPERTY = DOMProperty_1.injection.MUST_USE_PROPERTY;
-var HAS_BOOLEAN_VALUE = DOMProperty_1.injection.HAS_BOOLEAN_VALUE;
-var HAS_NUMERIC_VALUE = DOMProperty_1.injection.HAS_NUMERIC_VALUE;
-var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty_1.injection.HAS_POSITIVE_NUMERIC_VALUE;
-var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty_1.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
-var HAS_STRING_BOOLEAN_VALUE = DOMProperty_1.injection.HAS_STRING_BOOLEAN_VALUE;
-
-var HTMLDOMPropertyConfig = {
- // When adding attributes to this list, be sure to also add them to
- // the `possibleStandardNames` module to ensure casing and incorrect
- // name warnings.
- Properties: {
- allowFullScreen: HAS_BOOLEAN_VALUE,
- // IE only true/false iFrame attribute
- // https://msdn.microsoft.com/en-us/library/ms533072(v=vs.85).aspx
- allowTransparency: HAS_STRING_BOOLEAN_VALUE,
- // specifies target context for links with `preload` type
- async: HAS_BOOLEAN_VALUE,
- // autoFocus is polyfilled/normalized by AutoFocusUtils
- // autoFocus: HAS_BOOLEAN_VALUE,
- autoPlay: HAS_BOOLEAN_VALUE,
- capture: HAS_BOOLEAN_VALUE,
- checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- cols: HAS_POSITIVE_NUMERIC_VALUE,
- contentEditable: HAS_STRING_BOOLEAN_VALUE,
- controls: HAS_BOOLEAN_VALUE,
- 'default': HAS_BOOLEAN_VALUE,
- defer: HAS_BOOLEAN_VALUE,
- disabled: HAS_BOOLEAN_VALUE,
- download: HAS_OVERLOADED_BOOLEAN_VALUE,
- draggable: HAS_STRING_BOOLEAN_VALUE,
- formNoValidate: HAS_BOOLEAN_VALUE,
- hidden: HAS_BOOLEAN_VALUE,
- loop: HAS_BOOLEAN_VALUE,
- // Caution; `option.selected` is not updated if `select.multiple` is
- // disabled with `removeAttribute`.
- multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- noValidate: HAS_BOOLEAN_VALUE,
- open: HAS_BOOLEAN_VALUE,
- playsInline: HAS_BOOLEAN_VALUE,
- readOnly: HAS_BOOLEAN_VALUE,
- required: HAS_BOOLEAN_VALUE,
- reversed: HAS_BOOLEAN_VALUE,
- rows: HAS_POSITIVE_NUMERIC_VALUE,
- rowSpan: HAS_NUMERIC_VALUE,
- scoped: HAS_BOOLEAN_VALUE,
- seamless: HAS_BOOLEAN_VALUE,
- selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- size: HAS_POSITIVE_NUMERIC_VALUE,
- start: HAS_NUMERIC_VALUE,
- // support for projecting regular DOM Elements via V1 named slots ( shadow dom )
- span: HAS_POSITIVE_NUMERIC_VALUE,
- spellCheck: HAS_STRING_BOOLEAN_VALUE,
- // Style must be explicitly set in the attribute list. React components
- // expect a style object
- style: 0,
- // itemScope is for for Microdata support.
- // See http://schema.org/docs/gs.html
- itemScope: HAS_BOOLEAN_VALUE,
- // These attributes must stay in the white-list because they have
- // different attribute names (see DOMAttributeNames below)
- acceptCharset: 0,
- className: 0,
- htmlFor: 0,
- httpEquiv: 0,
- // Attributes with mutation methods must be specified in the whitelist
- // Set the string boolean flag to allow the behavior
- value: HAS_STRING_BOOLEAN_VALUE
- },
- DOMAttributeNames: {
- acceptCharset: 'accept-charset',
- className: 'class',
- htmlFor: 'for',
- httpEquiv: 'http-equiv'
- },
- DOMMutationMethods: {
- value: function (node, value) {
- if (value == null) {
- return node.removeAttribute('value');
- }
-
- // Number inputs get special treatment due to some edge cases in
- // Chrome. Let everything else assign the value attribute as normal.
- // https://github.com/facebook/react/issues/7253#issuecomment-236074326
- if (node.type !== 'number' || node.hasAttribute('value') === false) {
- node.setAttribute('value', '' + value);
- } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) {
- // Don't assign an attribute if validation reports bad
- // input. Chrome will clear the value. Additionally, don't
- // operate on inputs that have focus, otherwise Chrome might
- // strip off trailing decimal places and cause the user's
- // cursor position to jump to the beginning of the input.
- //
- // In ReactDOMInput, we have an onBlur event that will trigger
- // this function again when focus is lost.
- node.setAttribute('value', '' + value);
- }
- }
- }
-};
-
-var HTMLDOMPropertyConfig_1 = HTMLDOMPropertyConfig;
-
-var HAS_STRING_BOOLEAN_VALUE$1 = DOMProperty_1.injection.HAS_STRING_BOOLEAN_VALUE;
-
-
-var NS = {
- xlink: 'http://www.w3.org/1999/xlink',
- xml: 'http://www.w3.org/XML/1998/namespace'
-};
-
-/**
- * This is a list of all SVG attributes that need special casing,
- * namespacing, or boolean value assignment.
- *
- * When adding attributes to this list, be sure to also add them to
- * the `possibleStandardNames` module to ensure casing and incorrect
- * name warnings.
- *
- * SVG Attributes List:
- * https://www.w3.org/TR/SVG/attindex.html
- * SMIL Spec:
- * https://www.w3.org/TR/smil
- */
-var ATTRS = ['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', 'x-height', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xmlns:xlink', 'xml:lang', 'xml:space'];
+function renderToNodeStream() {
+ invariant_1(false, 'ReactDOMServer.renderToNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead.');
+}
-var SVGDOMPropertyConfig = {
- Properties: {
- autoReverse: HAS_STRING_BOOLEAN_VALUE$1,
- externalResourcesRequired: HAS_STRING_BOOLEAN_VALUE$1,
- preserveAlpha: HAS_STRING_BOOLEAN_VALUE$1
- },
- DOMAttributeNames: {
- autoReverse: 'autoReverse',
- externalResourcesRequired: 'externalResourcesRequired',
- preserveAlpha: 'preserveAlpha'
- },
- DOMAttributeNamespaces: {
- xlinkActuate: NS.xlink,
- xlinkArcrole: NS.xlink,
- xlinkHref: NS.xlink,
- xlinkRole: NS.xlink,
- xlinkShow: NS.xlink,
- xlinkTitle: NS.xlink,
- xlinkType: NS.xlink,
- xmlBase: NS.xml,
- xmlLang: NS.xml,
- xmlSpace: NS.xml
- }
-};
+function renderToStaticNodeStream() {
+ invariant_1(false, 'ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead.');
+}
-var CAMELIZE = /[\-\:]([a-z])/g;
-var capitalize = function (token) {
- return token[1].toUpperCase();
+// Note: when changing this, also consider https://github.com/facebook/react/issues/11526
+var ReactDOMServerBrowser = {
+ renderToString: renderToString,
+ renderToStaticMarkup: renderToStaticMarkup,
+ renderToNodeStream: renderToNodeStream,
+ renderToStaticNodeStream: renderToStaticNodeStream,
+ version: ReactVersion
};
-ATTRS.forEach(function (original) {
- var reactName = original.replace(CAMELIZE, capitalize);
-
- SVGDOMPropertyConfig.Properties[reactName] = 0;
- SVGDOMPropertyConfig.DOMAttributeNames[reactName] = original;
+var ReactDOMServerBrowser$1 = Object.freeze({
+ default: ReactDOMServerBrowser
});
-var SVGDOMPropertyConfig_1 = SVGDOMPropertyConfig;
-
-DOMProperty_1.injection.injectDOMPropertyConfig(HTMLDOMPropertyConfig_1);
-DOMProperty_1.injection.injectDOMPropertyConfig(SVGDOMPropertyConfig_1);
+var ReactDOMServer = ( ReactDOMServerBrowser$1 && ReactDOMServerBrowser ) || ReactDOMServerBrowser$1;
-var ReactDOMServerBrowserEntry = {
- renderToString: ReactDOMStringRenderer.renderToString,
- renderToStaticMarkup: ReactDOMStringRenderer.renderToStaticMarkup,
- renderToNodeStream: function () {
- invariant_1(false, 'ReactDOMServer.renderToNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead.');
- },
- renderToStaticNodeStream: function () {
- invariant_1(false, 'ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead.');
- },
-
- version: ReactVersion
-};
+// TODO: decide on the top-level export form.
+// This is hacky but makes it work with both Rollup and Jest
+var server_browser = ReactDOMServer['default'] ? ReactDOMServer['default'] : ReactDOMServer;
-return ReactDOMServerBrowserEntry;
+return server_browser;
})));