From 3b33617b805d619ae52b8eca6223de2ef2b9d6ed Mon Sep 17 00:00:00 2001 From: acdlite Date: Thu, 8 Feb 2024 16:08:53 +0000 Subject: [PATCH] Delete more redundant JSX code (#28276) Found another redundant implementation of JSX code. Not being used anywhere so safe to delete. DiffTrain build for [d3def47935e8912c197f78c78c97c2476fa1a77a](https://github.com/facebook/react/commit/d3def47935e8912c197f78c78c97c2476fa1a77a) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/React-dev.classic.js | 743 +++++++++--------- compiled/facebook-www/React-dev.modern.js | 743 +++++++++--------- compiled/facebook-www/React-prod.classic.js | 64 +- compiled/facebook-www/React-prod.modern.js | 64 +- .../facebook-www/React-profiling.classic.js | 64 +- .../facebook-www/React-profiling.modern.js | 64 +- .../ReactDOMTesting-dev.classic.js | 2 +- .../ReactDOMTesting-prod.classic.js | 6 +- .../facebook-www/ReactServer-dev.modern.js | 743 +++++++++--------- .../facebook-www/ReactServer-prod.modern.js | 64 +- 11 files changed, 1281 insertions(+), 1278 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index cca1fb214cbc2..868f37ff3cea7 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -b229f540e2da91370611945f9875e00a96196df6 +d3def47935e8912c197f78c78c97c2476fa1a77a diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index 9c9019955a94b..bd716659c1a7d 100644 --- a/compiled/facebook-www/React-dev.classic.js +++ b/compiled/facebook-www/React-dev.classic.js @@ -24,7 +24,7 @@ if (__DEV__) { ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } - var ReactVersion = "18.3.0-www-classic-28532002"; + var ReactVersion = "18.3.0-www-classic-20554b66"; // ATTENTION // When adding new symbols to this file, @@ -1652,412 +1652,144 @@ if (__DEV__) { } } - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; - var specialPropKeyWarningShown; - var specialPropRefWarningShown; - var didWarnAboutStringRefs; - - { - didWarnAboutStringRefs = {}; - } + var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"); - function hasValidRef(config) { + function setCurrentlyValidatingElement$1(element) { { - if (hasOwnProperty.call(config, "ref")) { - var getter = Object.getOwnPropertyDescriptor(config, "ref").get; - - if (getter && getter.isReactWarning) { - return false; - } + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV( + element.type, + owner ? owner.type : null + ); + setExtraStackFrame(stack); + } else { + setExtraStackFrame(null); } } - - return config.ref !== undefined; } - function hasValidKey(config) { - { - if (hasOwnProperty.call(config, "key")) { - var getter = Object.getOwnPropertyDescriptor(config, "key").get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } + var propTypesMisspellWarningShown$1; - return config.key !== undefined; + { + propTypesMisspellWarningShown$1 = false; } - function warnIfStringRefCannotBeAutoConverted(config, self) { - { - if ( - typeof config.ref === "string" && - ReactCurrentOwner$1.current && - self && - ReactCurrentOwner$1.current.stateNode !== self - ) { - var componentName = getComponentNameFromType( - ReactCurrentOwner$1.current.type - ); - - if (!didWarnAboutStringRefs[componentName]) { - error( - 'Component "%s" contains the string ref "%s". ' + - "Support for string refs will be removed in a future major release. " + - "This case cannot be automatically converted to an arrow function. " + - "We ask you to manually fix this case by using useRef() or createRef() instead. " + - "Learn more about using refs safely here: " + - "https://reactjs.org/link/strict-mode-string-ref", - getComponentNameFromType(ReactCurrentOwner$1.current.type), - config.ref - ); + function getDeclarationErrorAddendum$1() { + if (ReactCurrentOwner$2.current) { + var name = getComponentNameFromType(ReactCurrentOwner$2.current.type); - didWarnAboutStringRefs[componentName] = true; - } + if (name) { + return "\n\nCheck the render method of `" + name + "`."; } } + + return ""; } - function defineKeyPropWarningGetter(props, displayName) { - { - var warnAboutAccessingKey = function () { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; + function getSourceInfoErrorAddendum$1(source) { + if (source !== undefined) { + var fileName = source.fileName.replace(/^.*[\\\/]/, ""); + var lineNumber = source.lineNumber; + return "\n\nCheck your code at " + fileName + ":" + lineNumber + "."; + } - error( - "%s: `key` is not a prop. Trying to access it will result " + - "in `undefined` being returned. If you need to access the same " + - "value within the child component, you should pass it as a different " + - "prop. (https://reactjs.org/link/special-props)", - displayName - ); - } - }; + return ""; + } - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, "key", { - get: warnAboutAccessingKey, - configurable: true - }); + function getSourceInfoErrorAddendumForProps(elementProps) { + if (elementProps !== null && elementProps !== undefined) { + return getSourceInfoErrorAddendum$1(elementProps.__source); } + + return ""; } + /** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ - function defineRefPropWarningGetter(props, displayName) { - { - var warnAboutAccessingRef = function () { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; + var ownerHasKeyUseWarning$1 = {}; - error( - "%s: `ref` is not a prop. Trying to access it will result " + - "in `undefined` being returned. If you need to access the same " + - "value within the child component, you should pass it as a different " + - "prop. (https://reactjs.org/link/special-props)", - displayName - ); - } - }; + function getCurrentComponentErrorInfo$1(parentType) { + var info = getDeclarationErrorAddendum$1(); - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, "ref", { - get: warnAboutAccessingRef, - configurable: true - }); + if (!info) { + var parentName = getComponentNameFromType(parentType); + + if (parentName) { + info = + "\n\nCheck the top-level render call using <" + parentName + ">."; + } } + + return info; } /** - * Factory method to create a new React element. This no longer adheres to - * the class pattern, so do not use new to call it. Also, instanceof check - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check - * if something is a React Element. + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. * - * @param {*} type - * @param {*} props - * @param {*} key - * @param {string|object} ref - * @param {*} owner - * @param {*} self A *temporary* helper to detect places where `this` is - * different from the `owner` when React.createElement is called, so that we - * can warn. We want to get rid of owner and replace string `ref`s with arrow - * functions, and as long as `this` and owner are the same, there will be no - * change in behavior. - * @param {*} source An annotation object (added by a transpiler or otherwise) - * indicating filename, line number, and/or other information. * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. */ - function ReactElement(type, key, ref, self, source, owner, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: ref, - props: props, - // Record the component responsible for creating this element. - _owner: owner - }; + function validateExplicitKey$1(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } - { - // The validation flag is currently mutative. We put it on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - element._store = {}; // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. + element._store.validated = true; + var currentComponentErrorInfo = + getCurrentComponentErrorInfo$1(parentType); - Object.defineProperty(element._store, "validated", { - configurable: false, - enumerable: false, - writable: true, - value: false - }); // debugInfo contains Server Component debug information. + if (ownerHasKeyUseWarning$1[currentComponentErrorInfo]) { + return; + } - Object.defineProperty(element, "_debugInfo", { - configurable: false, - enumerable: false, - writable: true, - value: null - }); + ownerHasKeyUseWarning$1[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } + var childOwner = ""; + + if ( + element && + element._owner && + element._owner !== ReactCurrentOwner$2.current + ) { + // Give the component that originally created this child. + childOwner = + " It was passed a child from " + + getComponentNameFromType(element._owner.type) + + "."; } - return element; + { + setCurrentlyValidatingElement$1(element); + + error( + 'Each child in a list should have a unique "key" prop.' + + "%s%s See https://reactjs.org/link/warning-keys for more information.", + currentComponentErrorInfo, + childOwner + ); + + setCurrentlyValidatingElement$1(null); + } } /** - * https://github.com/reactjs/rfcs/pull/107 - * @param {*} type - * @param {object} props - * @param {string} key - */ - - function jsxDEV$1(type, config, maybeKey, source, self) { - { - var propName; // Reserved names are extracted - - var props = {}; - var key = null; - var ref = null; // Currently, key can be spread in as a prop. This causes a potential - // issue if key is also explicitly declared (ie.
- // or
). We want to deprecate key spread, - // but as an intermediary step, we will use jsxDEV for everything except - //
, because we aren't currently able to tell if - // key is explicitly declared to be undefined or not. - - if (maybeKey !== undefined) { - { - checkKeyStringCoercion(maybeKey); - } - - key = "" + maybeKey; - } - - if (hasValidKey(config)) { - { - checkKeyStringCoercion(config.key); - } - - key = "" + config.key; - } - - if (hasValidRef(config)) { - ref = config.ref; - warnIfStringRefCannotBeAutoConverted(config, self); - } // Remaining properties are added to a new props object - - for (propName in config) { - if ( - hasOwnProperty.call(config, propName) && // Skip over reserved prop names - propName !== "key" && // TODO: `ref` will no longer be reserved in the next major - propName !== "ref" - ) { - props[propName] = config[propName]; - } - } // Resolve default props - - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - - if (key || ref) { - var displayName = - typeof type === "function" - ? type.displayName || type.name || "Unknown" - : type; - - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - - return ReactElement( - type, - key, - ref, - self, - source, - ReactCurrentOwner$1.current, - props - ); - } - } - - var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"); - - function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV( - element.type, - owner ? owner.type : null - ); - setExtraStackFrame(stack); - } else { - setExtraStackFrame(null); - } - } - } - - var propTypesMisspellWarningShown$1; - - { - propTypesMisspellWarningShown$1 = false; - } - - function getDeclarationErrorAddendum$1() { - if (ReactCurrentOwner$2.current) { - var name = getComponentNameFromType(ReactCurrentOwner$2.current.type); - - if (name) { - return "\n\nCheck the render method of `" + name + "`."; - } - } - - return ""; - } - - function getSourceInfoErrorAddendum$1(source) { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ""); - var lineNumber = source.lineNumber; - return "\n\nCheck your code at " + fileName + ":" + lineNumber + "."; - } - - return ""; - } - - function getSourceInfoErrorAddendumForProps(elementProps) { - if (elementProps !== null && elementProps !== undefined) { - return getSourceInfoErrorAddendum$1(elementProps.__source); - } - - return ""; - } - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - var ownerHasKeyUseWarning$1 = {}; - - function getCurrentComponentErrorInfo$1(parentType) { - var info = getDeclarationErrorAddendum$1(); - - if (!info) { - var parentName = getComponentNameFromType(parentType); - - if (parentName) { - info = - "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - - return info; - } - /** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - - function validateExplicitKey$1(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - - element._store.validated = true; - var currentComponentErrorInfo = - getCurrentComponentErrorInfo$1(parentType); - - if (ownerHasKeyUseWarning$1[currentComponentErrorInfo]) { - return; - } - - ownerHasKeyUseWarning$1[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - - var childOwner = ""; - - if ( - element && - element._owner && - element._owner !== ReactCurrentOwner$2.current - ) { - // Give the component that originally created this child. - childOwner = - " It was passed a child from " + - getComponentNameFromType(element._owner.type) + - "."; - } - - { - setCurrentlyValidatingElement$1(element); - - error( - 'Each child in a list should have a unique "key" prop.' + - "%s%s See https://reactjs.org/link/warning-keys for more information.", - currentComponentErrorInfo, - childOwner - ); - - setCurrentlyValidatingElement$1(null); - } - } - /** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. */ function validateChildKeys$1(node, parentType) { @@ -2196,6 +1928,7 @@ if (__DEV__) { } } } + function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to // succeed and there will likely be errors in render. @@ -3650,6 +3383,274 @@ if (__DEV__) { only: onlyChild }; + var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; + var specialPropKeyWarningShown; + var specialPropRefWarningShown; + var didWarnAboutStringRefs; + + { + didWarnAboutStringRefs = {}; + } + + function hasValidRef(config) { + { + if (hasOwnProperty.call(config, "ref")) { + var getter = Object.getOwnPropertyDescriptor(config, "ref").get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.ref !== undefined; + } + + function hasValidKey(config) { + { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.key !== undefined; + } + + function warnIfStringRefCannotBeAutoConverted(config, self) { + { + if ( + typeof config.ref === "string" && + ReactCurrentOwner$1.current && + self && + ReactCurrentOwner$1.current.stateNode !== self + ) { + var componentName = getComponentNameFromType( + ReactCurrentOwner$1.current.type + ); + + if (!didWarnAboutStringRefs[componentName]) { + error( + 'Component "%s" contains the string ref "%s". ' + + "Support for string refs will be removed in a future major release. " + + "This case cannot be automatically converted to an arrow function. " + + "We ask you to manually fix this case by using useRef() or createRef() instead. " + + "Learn more about using refs safely here: " + + "https://reactjs.org/link/strict-mode-string-ref", + getComponentNameFromType(ReactCurrentOwner$1.current.type), + config.ref + ); + + didWarnAboutStringRefs[componentName] = true; + } + } + } + } + + function defineKeyPropWarningGetter(props, displayName) { + { + var warnAboutAccessingKey = function () { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + + error( + "%s: `key` is not a prop. Trying to access it will result " + + "in `undefined` being returned. If you need to access the same " + + "value within the child component, you should pass it as a different " + + "prop. (https://reactjs.org/link/special-props)", + displayName + ); + } + }; + + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: true + }); + } + } + + function defineRefPropWarningGetter(props, displayName) { + { + var warnAboutAccessingRef = function () { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + + error( + "%s: `ref` is not a prop. Trying to access it will result " + + "in `undefined` being returned. If you need to access the same " + + "value within the child component, you should pass it as a different " + + "prop. (https://reactjs.org/link/special-props)", + displayName + ); + } + }; + + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, "ref", { + get: warnAboutAccessingRef, + configurable: true + }); + } + } + /** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, instanceof check + * will not work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} props + * @param {*} key + * @param {string|object} ref + * @param {*} owner + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @internal + */ + + function ReactElement(type, key, ref, self, source, owner, props) { + var element = { + // This tag allows us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + // Record the component responsible for creating this element. + _owner: owner + }; + + { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + + Object.defineProperty(element._store, "validated", { + configurable: false, + enumerable: false, + writable: true, + value: false + }); // debugInfo contains Server Component debug information. + + Object.defineProperty(element, "_debugInfo", { + configurable: false, + enumerable: false, + writable: true, + value: null + }); + + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; + } + /** + * https://github.com/reactjs/rfcs/pull/107 + * @param {*} type + * @param {object} props + * @param {string} key + */ + + function jsxDEV$1(type, config, maybeKey, source, self) { + { + var propName; // Reserved names are extracted + + var props = {}; + var key = null; + var ref = null; // Currently, key can be spread in as a prop. This causes a potential + // issue if key is also explicitly declared (ie.
+ // or
). We want to deprecate key spread, + // but as an intermediary step, we will use jsxDEV for everything except + //
, because we aren't currently able to tell if + // key is explicitly declared to be undefined or not. + + if (maybeKey !== undefined) { + { + checkKeyStringCoercion(maybeKey); + } + + key = "" + maybeKey; + } + + if (hasValidKey(config)) { + { + checkKeyStringCoercion(config.key); + } + + key = "" + config.key; + } + + if (hasValidRef(config)) { + ref = config.ref; + warnIfStringRefCannotBeAutoConverted(config, self); + } // Remaining properties are added to a new props object + + for (propName in config) { + if ( + hasOwnProperty.call(config, propName) && // Skip over reserved prop names + propName !== "key" && // TODO: `ref` will no longer be reserved in the next major + propName !== "ref" + ) { + props[propName] = config[propName]; + } + } // Resolve default props + + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + + if (key || ref) { + var displayName = + typeof type === "function" + ? type.displayName || type.name || "Unknown" + : type; + + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + + return ReactElement( + type, + key, + ref, + self, + source, + ReactCurrentOwner$1.current, + props + ); + } + } + var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index c19d216e3b2d0..e6d452d1f0eef 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -24,7 +24,7 @@ if (__DEV__) { ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } - var ReactVersion = "18.3.0-www-modern-f7a0584c"; + var ReactVersion = "18.3.0-www-modern-94139f2c"; // ATTENTION // When adding new symbols to this file, @@ -1652,412 +1652,144 @@ if (__DEV__) { } } - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; - var specialPropKeyWarningShown; - var specialPropRefWarningShown; - var didWarnAboutStringRefs; - - { - didWarnAboutStringRefs = {}; - } + var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"); - function hasValidRef(config) { + function setCurrentlyValidatingElement$1(element) { { - if (hasOwnProperty.call(config, "ref")) { - var getter = Object.getOwnPropertyDescriptor(config, "ref").get; - - if (getter && getter.isReactWarning) { - return false; - } + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV( + element.type, + owner ? owner.type : null + ); + setExtraStackFrame(stack); + } else { + setExtraStackFrame(null); } } - - return config.ref !== undefined; } - function hasValidKey(config) { - { - if (hasOwnProperty.call(config, "key")) { - var getter = Object.getOwnPropertyDescriptor(config, "key").get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } + var propTypesMisspellWarningShown$1; - return config.key !== undefined; + { + propTypesMisspellWarningShown$1 = false; } - function warnIfStringRefCannotBeAutoConverted(config, self) { - { - if ( - typeof config.ref === "string" && - ReactCurrentOwner$1.current && - self && - ReactCurrentOwner$1.current.stateNode !== self - ) { - var componentName = getComponentNameFromType( - ReactCurrentOwner$1.current.type - ); - - if (!didWarnAboutStringRefs[componentName]) { - error( - 'Component "%s" contains the string ref "%s". ' + - "Support for string refs will be removed in a future major release. " + - "This case cannot be automatically converted to an arrow function. " + - "We ask you to manually fix this case by using useRef() or createRef() instead. " + - "Learn more about using refs safely here: " + - "https://reactjs.org/link/strict-mode-string-ref", - getComponentNameFromType(ReactCurrentOwner$1.current.type), - config.ref - ); + function getDeclarationErrorAddendum$1() { + if (ReactCurrentOwner$2.current) { + var name = getComponentNameFromType(ReactCurrentOwner$2.current.type); - didWarnAboutStringRefs[componentName] = true; - } + if (name) { + return "\n\nCheck the render method of `" + name + "`."; } } + + return ""; } - function defineKeyPropWarningGetter(props, displayName) { - { - var warnAboutAccessingKey = function () { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; + function getSourceInfoErrorAddendum$1(source) { + if (source !== undefined) { + var fileName = source.fileName.replace(/^.*[\\\/]/, ""); + var lineNumber = source.lineNumber; + return "\n\nCheck your code at " + fileName + ":" + lineNumber + "."; + } - error( - "%s: `key` is not a prop. Trying to access it will result " + - "in `undefined` being returned. If you need to access the same " + - "value within the child component, you should pass it as a different " + - "prop. (https://reactjs.org/link/special-props)", - displayName - ); - } - }; + return ""; + } - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, "key", { - get: warnAboutAccessingKey, - configurable: true - }); + function getSourceInfoErrorAddendumForProps(elementProps) { + if (elementProps !== null && elementProps !== undefined) { + return getSourceInfoErrorAddendum$1(elementProps.__source); } + + return ""; } + /** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ - function defineRefPropWarningGetter(props, displayName) { - { - var warnAboutAccessingRef = function () { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; + var ownerHasKeyUseWarning$1 = {}; - error( - "%s: `ref` is not a prop. Trying to access it will result " + - "in `undefined` being returned. If you need to access the same " + - "value within the child component, you should pass it as a different " + - "prop. (https://reactjs.org/link/special-props)", - displayName - ); - } - }; + function getCurrentComponentErrorInfo$1(parentType) { + var info = getDeclarationErrorAddendum$1(); - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, "ref", { - get: warnAboutAccessingRef, - configurable: true - }); + if (!info) { + var parentName = getComponentNameFromType(parentType); + + if (parentName) { + info = + "\n\nCheck the top-level render call using <" + parentName + ">."; + } } + + return info; } /** - * Factory method to create a new React element. This no longer adheres to - * the class pattern, so do not use new to call it. Also, instanceof check - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check - * if something is a React Element. + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. * - * @param {*} type - * @param {*} props - * @param {*} key - * @param {string|object} ref - * @param {*} owner - * @param {*} self A *temporary* helper to detect places where `this` is - * different from the `owner` when React.createElement is called, so that we - * can warn. We want to get rid of owner and replace string `ref`s with arrow - * functions, and as long as `this` and owner are the same, there will be no - * change in behavior. - * @param {*} source An annotation object (added by a transpiler or otherwise) - * indicating filename, line number, and/or other information. * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. */ - function ReactElement(type, key, ref, self, source, owner, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: ref, - props: props, - // Record the component responsible for creating this element. - _owner: owner - }; + function validateExplicitKey$1(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } - { - // The validation flag is currently mutative. We put it on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - element._store = {}; // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. + element._store.validated = true; + var currentComponentErrorInfo = + getCurrentComponentErrorInfo$1(parentType); - Object.defineProperty(element._store, "validated", { - configurable: false, - enumerable: false, - writable: true, - value: false - }); // debugInfo contains Server Component debug information. + if (ownerHasKeyUseWarning$1[currentComponentErrorInfo]) { + return; + } - Object.defineProperty(element, "_debugInfo", { - configurable: false, - enumerable: false, - writable: true, - value: null - }); + ownerHasKeyUseWarning$1[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } + var childOwner = ""; + + if ( + element && + element._owner && + element._owner !== ReactCurrentOwner$2.current + ) { + // Give the component that originally created this child. + childOwner = + " It was passed a child from " + + getComponentNameFromType(element._owner.type) + + "."; } - return element; + { + setCurrentlyValidatingElement$1(element); + + error( + 'Each child in a list should have a unique "key" prop.' + + "%s%s See https://reactjs.org/link/warning-keys for more information.", + currentComponentErrorInfo, + childOwner + ); + + setCurrentlyValidatingElement$1(null); + } } /** - * https://github.com/reactjs/rfcs/pull/107 - * @param {*} type - * @param {object} props - * @param {string} key - */ - - function jsxDEV$1(type, config, maybeKey, source, self) { - { - var propName; // Reserved names are extracted - - var props = {}; - var key = null; - var ref = null; // Currently, key can be spread in as a prop. This causes a potential - // issue if key is also explicitly declared (ie.
- // or
). We want to deprecate key spread, - // but as an intermediary step, we will use jsxDEV for everything except - //
, because we aren't currently able to tell if - // key is explicitly declared to be undefined or not. - - if (maybeKey !== undefined) { - { - checkKeyStringCoercion(maybeKey); - } - - key = "" + maybeKey; - } - - if (hasValidKey(config)) { - { - checkKeyStringCoercion(config.key); - } - - key = "" + config.key; - } - - if (hasValidRef(config)) { - ref = config.ref; - warnIfStringRefCannotBeAutoConverted(config, self); - } // Remaining properties are added to a new props object - - for (propName in config) { - if ( - hasOwnProperty.call(config, propName) && // Skip over reserved prop names - propName !== "key" && // TODO: `ref` will no longer be reserved in the next major - propName !== "ref" - ) { - props[propName] = config[propName]; - } - } // Resolve default props - - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - - if (key || ref) { - var displayName = - typeof type === "function" - ? type.displayName || type.name || "Unknown" - : type; - - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - - return ReactElement( - type, - key, - ref, - self, - source, - ReactCurrentOwner$1.current, - props - ); - } - } - - var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"); - - function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV( - element.type, - owner ? owner.type : null - ); - setExtraStackFrame(stack); - } else { - setExtraStackFrame(null); - } - } - } - - var propTypesMisspellWarningShown$1; - - { - propTypesMisspellWarningShown$1 = false; - } - - function getDeclarationErrorAddendum$1() { - if (ReactCurrentOwner$2.current) { - var name = getComponentNameFromType(ReactCurrentOwner$2.current.type); - - if (name) { - return "\n\nCheck the render method of `" + name + "`."; - } - } - - return ""; - } - - function getSourceInfoErrorAddendum$1(source) { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ""); - var lineNumber = source.lineNumber; - return "\n\nCheck your code at " + fileName + ":" + lineNumber + "."; - } - - return ""; - } - - function getSourceInfoErrorAddendumForProps(elementProps) { - if (elementProps !== null && elementProps !== undefined) { - return getSourceInfoErrorAddendum$1(elementProps.__source); - } - - return ""; - } - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - var ownerHasKeyUseWarning$1 = {}; - - function getCurrentComponentErrorInfo$1(parentType) { - var info = getDeclarationErrorAddendum$1(); - - if (!info) { - var parentName = getComponentNameFromType(parentType); - - if (parentName) { - info = - "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - - return info; - } - /** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - - function validateExplicitKey$1(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - - element._store.validated = true; - var currentComponentErrorInfo = - getCurrentComponentErrorInfo$1(parentType); - - if (ownerHasKeyUseWarning$1[currentComponentErrorInfo]) { - return; - } - - ownerHasKeyUseWarning$1[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - - var childOwner = ""; - - if ( - element && - element._owner && - element._owner !== ReactCurrentOwner$2.current - ) { - // Give the component that originally created this child. - childOwner = - " It was passed a child from " + - getComponentNameFromType(element._owner.type) + - "."; - } - - { - setCurrentlyValidatingElement$1(element); - - error( - 'Each child in a list should have a unique "key" prop.' + - "%s%s See https://reactjs.org/link/warning-keys for more information.", - currentComponentErrorInfo, - childOwner - ); - - setCurrentlyValidatingElement$1(null); - } - } - /** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. */ function validateChildKeys$1(node, parentType) { @@ -2196,6 +1928,7 @@ if (__DEV__) { } } } + function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to // succeed and there will likely be errors in render. @@ -3615,6 +3348,274 @@ if (__DEV__) { only: onlyChild }; + var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; + var specialPropKeyWarningShown; + var specialPropRefWarningShown; + var didWarnAboutStringRefs; + + { + didWarnAboutStringRefs = {}; + } + + function hasValidRef(config) { + { + if (hasOwnProperty.call(config, "ref")) { + var getter = Object.getOwnPropertyDescriptor(config, "ref").get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.ref !== undefined; + } + + function hasValidKey(config) { + { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.key !== undefined; + } + + function warnIfStringRefCannotBeAutoConverted(config, self) { + { + if ( + typeof config.ref === "string" && + ReactCurrentOwner$1.current && + self && + ReactCurrentOwner$1.current.stateNode !== self + ) { + var componentName = getComponentNameFromType( + ReactCurrentOwner$1.current.type + ); + + if (!didWarnAboutStringRefs[componentName]) { + error( + 'Component "%s" contains the string ref "%s". ' + + "Support for string refs will be removed in a future major release. " + + "This case cannot be automatically converted to an arrow function. " + + "We ask you to manually fix this case by using useRef() or createRef() instead. " + + "Learn more about using refs safely here: " + + "https://reactjs.org/link/strict-mode-string-ref", + getComponentNameFromType(ReactCurrentOwner$1.current.type), + config.ref + ); + + didWarnAboutStringRefs[componentName] = true; + } + } + } + } + + function defineKeyPropWarningGetter(props, displayName) { + { + var warnAboutAccessingKey = function () { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + + error( + "%s: `key` is not a prop. Trying to access it will result " + + "in `undefined` being returned. If you need to access the same " + + "value within the child component, you should pass it as a different " + + "prop. (https://reactjs.org/link/special-props)", + displayName + ); + } + }; + + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: true + }); + } + } + + function defineRefPropWarningGetter(props, displayName) { + { + var warnAboutAccessingRef = function () { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + + error( + "%s: `ref` is not a prop. Trying to access it will result " + + "in `undefined` being returned. If you need to access the same " + + "value within the child component, you should pass it as a different " + + "prop. (https://reactjs.org/link/special-props)", + displayName + ); + } + }; + + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, "ref", { + get: warnAboutAccessingRef, + configurable: true + }); + } + } + /** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, instanceof check + * will not work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} props + * @param {*} key + * @param {string|object} ref + * @param {*} owner + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @internal + */ + + function ReactElement(type, key, ref, self, source, owner, props) { + var element = { + // This tag allows us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + // Record the component responsible for creating this element. + _owner: owner + }; + + { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + + Object.defineProperty(element._store, "validated", { + configurable: false, + enumerable: false, + writable: true, + value: false + }); // debugInfo contains Server Component debug information. + + Object.defineProperty(element, "_debugInfo", { + configurable: false, + enumerable: false, + writable: true, + value: null + }); + + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; + } + /** + * https://github.com/reactjs/rfcs/pull/107 + * @param {*} type + * @param {object} props + * @param {string} key + */ + + function jsxDEV$1(type, config, maybeKey, source, self) { + { + var propName; // Reserved names are extracted + + var props = {}; + var key = null; + var ref = null; // Currently, key can be spread in as a prop. This causes a potential + // issue if key is also explicitly declared (ie.
+ // or
). We want to deprecate key spread, + // but as an intermediary step, we will use jsxDEV for everything except + //
, because we aren't currently able to tell if + // key is explicitly declared to be undefined or not. + + if (maybeKey !== undefined) { + { + checkKeyStringCoercion(maybeKey); + } + + key = "" + maybeKey; + } + + if (hasValidKey(config)) { + { + checkKeyStringCoercion(config.key); + } + + key = "" + config.key; + } + + if (hasValidRef(config)) { + ref = config.ref; + warnIfStringRefCannotBeAutoConverted(config, self); + } // Remaining properties are added to a new props object + + for (propName in config) { + if ( + hasOwnProperty.call(config, propName) && // Skip over reserved prop names + propName !== "key" && // TODO: `ref` will no longer be reserved in the next major + propName !== "ref" + ) { + props[propName] = config[propName]; + } + } // Resolve default props + + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + + if (key || ref) { + var displayName = + typeof type === "function" + ? type.displayName || type.name || "Unknown" + : type; + + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + + return ReactElement( + type, + key, + ref, + self, + source, + ReactCurrentOwner$1.current, + props + ); + } + } + var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); diff --git a/compiled/facebook-www/React-prod.classic.js b/compiled/facebook-www/React-prod.classic.js index cd6c2fb5c451a..b7ae115a9a87d 100644 --- a/compiled/facebook-www/React-prod.classic.js +++ b/compiled/facebook-www/React-prod.classic.js @@ -148,33 +148,7 @@ var ReactCurrentDispatcher = { current: null }, ReactCurrentCache: ReactCurrentCache, ReactCurrentBatchConfig: ReactCurrentBatchConfig, ReactCurrentOwner: ReactCurrentOwner$1 - }, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; -function jsx$1(type, config, maybeKey) { - var propName, - props = {}, - key = null, - ref = null; - void 0 !== maybeKey && (key = "" + maybeKey); - void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); - for (propName in config) - hasOwnProperty.call(config, propName) && - "key" !== propName && - "ref" !== propName && - (props[propName] = config[propName]); - if (type && type.defaultProps) - for (propName in ((config = type.defaultProps), config)) - void 0 === props[propName] && (props[propName] = config[propName]); - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key, - ref: ref, - props: props, - _owner: ReactCurrentOwner.current }; -} function escape(key) { var escaperLookup = { "=": "=0", ":": "=2" }; return ( @@ -313,11 +287,37 @@ function lazyInitializer(payload) { } function noop() {} var onError = - "function" === typeof reportError - ? reportError - : function (error) { - console.error(error); - }; + "function" === typeof reportError + ? reportError + : function (error) { + console.error(error); + }, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; +function jsx$1(type, config, maybeKey) { + var propName, + props = {}, + key = null, + ref = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + void 0 !== config.ref && (ref = config.ref); + for (propName in config) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "ref" !== propName && + (props[propName] = config[propName]); + if (type && type.defaultProps) + for (propName in ((config = type.defaultProps), config)) + void 0 === props[propName] && (props[propName] = config[propName]); + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: ref, + props: props, + _owner: ReactCurrentOwner.current + }; +} exports.Children = { map: mapChildren, forEach: function (children, forEachFunc, forEachContext) { @@ -570,4 +570,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-www-classic-b20371a1"; +exports.version = "18.3.0-www-classic-11e5103a"; diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index 36be5deae8a43..c16f12ae9c32f 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -119,33 +119,7 @@ var ReactCurrentDispatcher = { current: null }, ReactCurrentCache: ReactCurrentCache, ReactCurrentBatchConfig: ReactCurrentBatchConfig, ReactCurrentOwner: ReactCurrentOwner$1 - }, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; -function jsx$1(type, config, maybeKey) { - var propName, - props = {}, - key = null, - ref = null; - void 0 !== maybeKey && (key = "" + maybeKey); - void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); - for (propName in config) - hasOwnProperty.call(config, propName) && - "key" !== propName && - "ref" !== propName && - (props[propName] = config[propName]); - if (type && type.defaultProps) - for (propName in ((config = type.defaultProps), config)) - void 0 === props[propName] && (props[propName] = config[propName]); - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key, - ref: ref, - props: props, - _owner: ReactCurrentOwner.current }; -} function escape(key) { var escaperLookup = { "=": "=0", ":": "=2" }; return ( @@ -284,11 +258,37 @@ function lazyInitializer(payload) { } function noop() {} var onError = - "function" === typeof reportError - ? reportError - : function (error) { - console.error(error); - }; + "function" === typeof reportError + ? reportError + : function (error) { + console.error(error); + }, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; +function jsx$1(type, config, maybeKey) { + var propName, + props = {}, + key = null, + ref = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + void 0 !== config.ref && (ref = config.ref); + for (propName in config) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "ref" !== propName && + (props[propName] = config[propName]); + if (type && type.defaultProps) + for (propName in ((config = type.defaultProps), config)) + void 0 === props[propName] && (props[propName] = config[propName]); + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: ref, + props: props, + _owner: ReactCurrentOwner.current + }; +} exports.Children = { map: mapChildren, forEach: function (children, forEachFunc, forEachContext) { @@ -562,4 +562,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-www-modern-97aa8a4c"; +exports.version = "18.3.0-www-modern-72c0502c"; diff --git a/compiled/facebook-www/React-profiling.classic.js b/compiled/facebook-www/React-profiling.classic.js index 9a89b82bb07fa..11d50d57f82c8 100644 --- a/compiled/facebook-www/React-profiling.classic.js +++ b/compiled/facebook-www/React-profiling.classic.js @@ -152,33 +152,7 @@ var ReactCurrentDispatcher = { current: null }, ReactCurrentCache: ReactCurrentCache, ReactCurrentBatchConfig: ReactCurrentBatchConfig, ReactCurrentOwner: ReactCurrentOwner$1 - }, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; -function jsx$1(type, config, maybeKey) { - var propName, - props = {}, - key = null, - ref = null; - void 0 !== maybeKey && (key = "" + maybeKey); - void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); - for (propName in config) - hasOwnProperty.call(config, propName) && - "key" !== propName && - "ref" !== propName && - (props[propName] = config[propName]); - if (type && type.defaultProps) - for (propName in ((config = type.defaultProps), config)) - void 0 === props[propName] && (props[propName] = config[propName]); - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key, - ref: ref, - props: props, - _owner: ReactCurrentOwner.current }; -} function escape(key) { var escaperLookup = { "=": "=0", ":": "=2" }; return ( @@ -317,11 +291,37 @@ function lazyInitializer(payload) { } function noop() {} var onError = - "function" === typeof reportError - ? reportError - : function (error) { - console.error(error); - }; + "function" === typeof reportError + ? reportError + : function (error) { + console.error(error); + }, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; +function jsx$1(type, config, maybeKey) { + var propName, + props = {}, + key = null, + ref = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + void 0 !== config.ref && (ref = config.ref); + for (propName in config) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "ref" !== propName && + (props[propName] = config[propName]); + if (type && type.defaultProps) + for (propName in ((config = type.defaultProps), config)) + void 0 === props[propName] && (props[propName] = config[propName]); + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: ref, + props: props, + _owner: ReactCurrentOwner.current + }; +} exports.Children = { map: mapChildren, forEach: function (children, forEachFunc, forEachContext) { @@ -574,7 +574,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-www-classic-593873f6"; +exports.version = "18.3.0-www-classic-7b6adb38"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/React-profiling.modern.js b/compiled/facebook-www/React-profiling.modern.js index 463c545f78a2b..913bcb817a439 100644 --- a/compiled/facebook-www/React-profiling.modern.js +++ b/compiled/facebook-www/React-profiling.modern.js @@ -123,33 +123,7 @@ var ReactCurrentDispatcher = { current: null }, ReactCurrentCache: ReactCurrentCache, ReactCurrentBatchConfig: ReactCurrentBatchConfig, ReactCurrentOwner: ReactCurrentOwner$1 - }, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; -function jsx$1(type, config, maybeKey) { - var propName, - props = {}, - key = null, - ref = null; - void 0 !== maybeKey && (key = "" + maybeKey); - void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); - for (propName in config) - hasOwnProperty.call(config, propName) && - "key" !== propName && - "ref" !== propName && - (props[propName] = config[propName]); - if (type && type.defaultProps) - for (propName in ((config = type.defaultProps), config)) - void 0 === props[propName] && (props[propName] = config[propName]); - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key, - ref: ref, - props: props, - _owner: ReactCurrentOwner.current }; -} function escape(key) { var escaperLookup = { "=": "=0", ":": "=2" }; return ( @@ -288,11 +262,37 @@ function lazyInitializer(payload) { } function noop() {} var onError = - "function" === typeof reportError - ? reportError - : function (error) { - console.error(error); - }; + "function" === typeof reportError + ? reportError + : function (error) { + console.error(error); + }, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; +function jsx$1(type, config, maybeKey) { + var propName, + props = {}, + key = null, + ref = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + void 0 !== config.ref && (ref = config.ref); + for (propName in config) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "ref" !== propName && + (props[propName] = config[propName]); + if (type && type.defaultProps) + for (propName in ((config = type.defaultProps), config)) + void 0 === props[propName] && (props[propName] = config[propName]); + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: ref, + props: props, + _owner: ReactCurrentOwner.current + }; +} exports.Children = { map: mapChildren, forEach: function (children, forEachFunc, forEachContext) { @@ -566,7 +566,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-www-modern-81490c14"; +exports.version = "18.3.0-www-modern-5a1ab6a0"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index f0828de4342df..9d1afb5ea96cc 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -36343,7 +36343,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-www-classic-b20371a1"; + var ReactVersion = "18.3.0-www-classic-11e5103a"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index d6c8b105c3d2d..b4e0e9740b443 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -17485,7 +17485,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1825 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-593873f6", + version: "18.3.0-www-classic-7b6adb38", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2194 = { @@ -17515,7 +17515,7 @@ var internals$jscomp$inline_2194 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-593873f6" + reconcilerVersion: "18.3.0-www-classic-7b6adb38" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2195 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -18016,4 +18016,4 @@ exports.useFormStatus = function () { return ReactCurrentDispatcher$2.current.useHostTransitionStatus(); throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-classic-593873f6"; +exports.version = "18.3.0-www-classic-7b6adb38"; diff --git a/compiled/facebook-www/ReactServer-dev.modern.js b/compiled/facebook-www/ReactServer-dev.modern.js index 6c60b29956184..682eb31ef123e 100644 --- a/compiled/facebook-www/ReactServer-dev.modern.js +++ b/compiled/facebook-www/ReactServer-dev.modern.js @@ -1365,412 +1365,144 @@ if (__DEV__) { } } - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; - var specialPropKeyWarningShown; - var specialPropRefWarningShown; - var didWarnAboutStringRefs; - - { - didWarnAboutStringRefs = {}; - } + var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"); - function hasValidRef(config) { + function setCurrentlyValidatingElement$1(element) { { - if (hasOwnProperty.call(config, "ref")) { - var getter = Object.getOwnPropertyDescriptor(config, "ref").get; - - if (getter && getter.isReactWarning) { - return false; - } + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV( + element.type, + owner ? owner.type : null + ); + setExtraStackFrame(stack); + } else { + setExtraStackFrame(null); } } - - return config.ref !== undefined; } - function hasValidKey(config) { - { - if (hasOwnProperty.call(config, "key")) { - var getter = Object.getOwnPropertyDescriptor(config, "key").get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } + var propTypesMisspellWarningShown$1; - return config.key !== undefined; + { + propTypesMisspellWarningShown$1 = false; } - function warnIfStringRefCannotBeAutoConverted(config, self) { - { - if ( - typeof config.ref === "string" && - ReactCurrentOwner$1.current && - self && - ReactCurrentOwner$1.current.stateNode !== self - ) { - var componentName = getComponentNameFromType( - ReactCurrentOwner$1.current.type - ); - - if (!didWarnAboutStringRefs[componentName]) { - error( - 'Component "%s" contains the string ref "%s". ' + - "Support for string refs will be removed in a future major release. " + - "This case cannot be automatically converted to an arrow function. " + - "We ask you to manually fix this case by using useRef() or createRef() instead. " + - "Learn more about using refs safely here: " + - "https://reactjs.org/link/strict-mode-string-ref", - getComponentNameFromType(ReactCurrentOwner$1.current.type), - config.ref - ); + function getDeclarationErrorAddendum$1() { + if (ReactCurrentOwner$2.current) { + var name = getComponentNameFromType(ReactCurrentOwner$2.current.type); - didWarnAboutStringRefs[componentName] = true; - } + if (name) { + return "\n\nCheck the render method of `" + name + "`."; } } + + return ""; } - function defineKeyPropWarningGetter(props, displayName) { - { - var warnAboutAccessingKey = function () { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; + function getSourceInfoErrorAddendum$1(source) { + if (source !== undefined) { + var fileName = source.fileName.replace(/^.*[\\\/]/, ""); + var lineNumber = source.lineNumber; + return "\n\nCheck your code at " + fileName + ":" + lineNumber + "."; + } - error( - "%s: `key` is not a prop. Trying to access it will result " + - "in `undefined` being returned. If you need to access the same " + - "value within the child component, you should pass it as a different " + - "prop. (https://reactjs.org/link/special-props)", - displayName - ); - } - }; + return ""; + } - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, "key", { - get: warnAboutAccessingKey, - configurable: true - }); + function getSourceInfoErrorAddendumForProps(elementProps) { + if (elementProps !== null && elementProps !== undefined) { + return getSourceInfoErrorAddendum$1(elementProps.__source); } + + return ""; } + /** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ - function defineRefPropWarningGetter(props, displayName) { - { - var warnAboutAccessingRef = function () { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; + var ownerHasKeyUseWarning$1 = {}; - error( - "%s: `ref` is not a prop. Trying to access it will result " + - "in `undefined` being returned. If you need to access the same " + - "value within the child component, you should pass it as a different " + - "prop. (https://reactjs.org/link/special-props)", - displayName - ); - } - }; + function getCurrentComponentErrorInfo$1(parentType) { + var info = getDeclarationErrorAddendum$1(); - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, "ref", { - get: warnAboutAccessingRef, - configurable: true - }); + if (!info) { + var parentName = getComponentNameFromType(parentType); + + if (parentName) { + info = + "\n\nCheck the top-level render call using <" + parentName + ">."; + } } + + return info; } /** - * Factory method to create a new React element. This no longer adheres to - * the class pattern, so do not use new to call it. Also, instanceof check - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check - * if something is a React Element. + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. * - * @param {*} type - * @param {*} props - * @param {*} key - * @param {string|object} ref - * @param {*} owner - * @param {*} self A *temporary* helper to detect places where `this` is - * different from the `owner` when React.createElement is called, so that we - * can warn. We want to get rid of owner and replace string `ref`s with arrow - * functions, and as long as `this` and owner are the same, there will be no - * change in behavior. - * @param {*} source An annotation object (added by a transpiler or otherwise) - * indicating filename, line number, and/or other information. * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. */ - function ReactElement(type, key, ref, self, source, owner, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: ref, - props: props, - // Record the component responsible for creating this element. - _owner: owner - }; + function validateExplicitKey$1(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } - { - // The validation flag is currently mutative. We put it on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - element._store = {}; // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. + element._store.validated = true; + var currentComponentErrorInfo = + getCurrentComponentErrorInfo$1(parentType); - Object.defineProperty(element._store, "validated", { - configurable: false, - enumerable: false, - writable: true, - value: false - }); // debugInfo contains Server Component debug information. + if (ownerHasKeyUseWarning$1[currentComponentErrorInfo]) { + return; + } - Object.defineProperty(element, "_debugInfo", { - configurable: false, - enumerable: false, - writable: true, - value: null - }); + ownerHasKeyUseWarning$1[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } + var childOwner = ""; + + if ( + element && + element._owner && + element._owner !== ReactCurrentOwner$2.current + ) { + // Give the component that originally created this child. + childOwner = + " It was passed a child from " + + getComponentNameFromType(element._owner.type) + + "."; } - return element; + { + setCurrentlyValidatingElement$1(element); + + error( + 'Each child in a list should have a unique "key" prop.' + + "%s%s See https://reactjs.org/link/warning-keys for more information.", + currentComponentErrorInfo, + childOwner + ); + + setCurrentlyValidatingElement$1(null); + } } /** - * https://github.com/reactjs/rfcs/pull/107 - * @param {*} type - * @param {object} props - * @param {string} key - */ - - function jsxDEV$1(type, config, maybeKey, source, self) { - { - var propName; // Reserved names are extracted - - var props = {}; - var key = null; - var ref = null; // Currently, key can be spread in as a prop. This causes a potential - // issue if key is also explicitly declared (ie.
- // or
). We want to deprecate key spread, - // but as an intermediary step, we will use jsxDEV for everything except - //
, because we aren't currently able to tell if - // key is explicitly declared to be undefined or not. - - if (maybeKey !== undefined) { - { - checkKeyStringCoercion(maybeKey); - } - - key = "" + maybeKey; - } - - if (hasValidKey(config)) { - { - checkKeyStringCoercion(config.key); - } - - key = "" + config.key; - } - - if (hasValidRef(config)) { - ref = config.ref; - warnIfStringRefCannotBeAutoConverted(config, self); - } // Remaining properties are added to a new props object - - for (propName in config) { - if ( - hasOwnProperty.call(config, propName) && // Skip over reserved prop names - propName !== "key" && // TODO: `ref` will no longer be reserved in the next major - propName !== "ref" - ) { - props[propName] = config[propName]; - } - } // Resolve default props - - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - - if (key || ref) { - var displayName = - typeof type === "function" - ? type.displayName || type.name || "Unknown" - : type; - - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - - return ReactElement( - type, - key, - ref, - self, - source, - ReactCurrentOwner$1.current, - props - ); - } - } - - var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"); - - function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV( - element.type, - owner ? owner.type : null - ); - setExtraStackFrame(stack); - } else { - setExtraStackFrame(null); - } - } - } - - var propTypesMisspellWarningShown$1; - - { - propTypesMisspellWarningShown$1 = false; - } - - function getDeclarationErrorAddendum$1() { - if (ReactCurrentOwner$2.current) { - var name = getComponentNameFromType(ReactCurrentOwner$2.current.type); - - if (name) { - return "\n\nCheck the render method of `" + name + "`."; - } - } - - return ""; - } - - function getSourceInfoErrorAddendum$1(source) { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ""); - var lineNumber = source.lineNumber; - return "\n\nCheck your code at " + fileName + ":" + lineNumber + "."; - } - - return ""; - } - - function getSourceInfoErrorAddendumForProps(elementProps) { - if (elementProps !== null && elementProps !== undefined) { - return getSourceInfoErrorAddendum$1(elementProps.__source); - } - - return ""; - } - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - var ownerHasKeyUseWarning$1 = {}; - - function getCurrentComponentErrorInfo$1(parentType) { - var info = getDeclarationErrorAddendum$1(); - - if (!info) { - var parentName = getComponentNameFromType(parentType); - - if (parentName) { - info = - "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - - return info; - } - /** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - - function validateExplicitKey$1(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - - element._store.validated = true; - var currentComponentErrorInfo = - getCurrentComponentErrorInfo$1(parentType); - - if (ownerHasKeyUseWarning$1[currentComponentErrorInfo]) { - return; - } - - ownerHasKeyUseWarning$1[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - - var childOwner = ""; - - if ( - element && - element._owner && - element._owner !== ReactCurrentOwner$2.current - ) { - // Give the component that originally created this child. - childOwner = - " It was passed a child from " + - getComponentNameFromType(element._owner.type) + - "."; - } - - { - setCurrentlyValidatingElement$1(element); - - error( - 'Each child in a list should have a unique "key" prop.' + - "%s%s See https://reactjs.org/link/warning-keys for more information.", - currentComponentErrorInfo, - childOwner - ); - - setCurrentlyValidatingElement$1(null); - } - } - /** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. */ function validateChildKeys$1(node, parentType) { @@ -1909,6 +1641,7 @@ if (__DEV__) { } } } + function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to // succeed and there will likely be errors in render. @@ -2835,7 +2568,7 @@ if (__DEV__) { console["error"](error); }; - var ReactVersion = "18.3.0-www-modern-61a7b928"; + var ReactVersion = "18.3.0-www-modern-d5f8dfac"; // Patch fetch var Children = { @@ -2846,6 +2579,274 @@ if (__DEV__) { only: onlyChild }; + var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; + var specialPropKeyWarningShown; + var specialPropRefWarningShown; + var didWarnAboutStringRefs; + + { + didWarnAboutStringRefs = {}; + } + + function hasValidRef(config) { + { + if (hasOwnProperty.call(config, "ref")) { + var getter = Object.getOwnPropertyDescriptor(config, "ref").get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.ref !== undefined; + } + + function hasValidKey(config) { + { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.key !== undefined; + } + + function warnIfStringRefCannotBeAutoConverted(config, self) { + { + if ( + typeof config.ref === "string" && + ReactCurrentOwner$1.current && + self && + ReactCurrentOwner$1.current.stateNode !== self + ) { + var componentName = getComponentNameFromType( + ReactCurrentOwner$1.current.type + ); + + if (!didWarnAboutStringRefs[componentName]) { + error( + 'Component "%s" contains the string ref "%s". ' + + "Support for string refs will be removed in a future major release. " + + "This case cannot be automatically converted to an arrow function. " + + "We ask you to manually fix this case by using useRef() or createRef() instead. " + + "Learn more about using refs safely here: " + + "https://reactjs.org/link/strict-mode-string-ref", + getComponentNameFromType(ReactCurrentOwner$1.current.type), + config.ref + ); + + didWarnAboutStringRefs[componentName] = true; + } + } + } + } + + function defineKeyPropWarningGetter(props, displayName) { + { + var warnAboutAccessingKey = function () { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + + error( + "%s: `key` is not a prop. Trying to access it will result " + + "in `undefined` being returned. If you need to access the same " + + "value within the child component, you should pass it as a different " + + "prop. (https://reactjs.org/link/special-props)", + displayName + ); + } + }; + + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: true + }); + } + } + + function defineRefPropWarningGetter(props, displayName) { + { + var warnAboutAccessingRef = function () { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + + error( + "%s: `ref` is not a prop. Trying to access it will result " + + "in `undefined` being returned. If you need to access the same " + + "value within the child component, you should pass it as a different " + + "prop. (https://reactjs.org/link/special-props)", + displayName + ); + } + }; + + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, "ref", { + get: warnAboutAccessingRef, + configurable: true + }); + } + } + /** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, instanceof check + * will not work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} props + * @param {*} key + * @param {string|object} ref + * @param {*} owner + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @internal + */ + + function ReactElement(type, key, ref, self, source, owner, props) { + var element = { + // This tag allows us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + // Record the component responsible for creating this element. + _owner: owner + }; + + { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + + Object.defineProperty(element._store, "validated", { + configurable: false, + enumerable: false, + writable: true, + value: false + }); // debugInfo contains Server Component debug information. + + Object.defineProperty(element, "_debugInfo", { + configurable: false, + enumerable: false, + writable: true, + value: null + }); + + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; + } + /** + * https://github.com/reactjs/rfcs/pull/107 + * @param {*} type + * @param {object} props + * @param {string} key + */ + + function jsxDEV$1(type, config, maybeKey, source, self) { + { + var propName; // Reserved names are extracted + + var props = {}; + var key = null; + var ref = null; // Currently, key can be spread in as a prop. This causes a potential + // issue if key is also explicitly declared (ie.
+ // or
). We want to deprecate key spread, + // but as an intermediary step, we will use jsxDEV for everything except + //
, because we aren't currently able to tell if + // key is explicitly declared to be undefined or not. + + if (maybeKey !== undefined) { + { + checkKeyStringCoercion(maybeKey); + } + + key = "" + maybeKey; + } + + if (hasValidKey(config)) { + { + checkKeyStringCoercion(config.key); + } + + key = "" + config.key; + } + + if (hasValidRef(config)) { + ref = config.ref; + warnIfStringRefCannotBeAutoConverted(config, self); + } // Remaining properties are added to a new props object + + for (propName in config) { + if ( + hasOwnProperty.call(config, propName) && // Skip over reserved prop names + propName !== "key" && // TODO: `ref` will no longer be reserved in the next major + propName !== "ref" + ) { + props[propName] = config[propName]; + } + } // Resolve default props + + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + + if (key || ref) { + var displayName = + typeof type === "function" + ? type.displayName || type.name || "Unknown" + : type; + + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + + return ReactElement( + type, + key, + ref, + self, + source, + ReactCurrentOwner$1.current, + props + ); + } + } + var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); diff --git a/compiled/facebook-www/ReactServer-prod.modern.js b/compiled/facebook-www/ReactServer-prod.modern.js index 0415d7d8c80e1..bac184e3f5be4 100644 --- a/compiled/facebook-www/ReactServer-prod.modern.js +++ b/compiled/facebook-www/ReactServer-prod.modern.js @@ -83,32 +83,6 @@ function isValidElement(object) { object.$$typeof === REACT_ELEMENT_TYPE ); } -var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; -function jsx$1(type, config, maybeKey) { - var propName, - props = {}, - key = null, - ref = null; - void 0 !== maybeKey && (key = "" + maybeKey); - void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); - for (propName in config) - hasOwnProperty.call(config, propName) && - "key" !== propName && - "ref" !== propName && - (props[propName] = config[propName]); - if (type && type.defaultProps) - for (propName in ((config = type.defaultProps), config)) - void 0 === props[propName] && (props[propName] = config[propName]); - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key, - ref: ref, - props: props, - _owner: ReactCurrentOwner.current - }; -} function escape(key) { var escaperLookup = { "=": "=0", ":": "=2" }; return ( @@ -255,11 +229,37 @@ function createCacheNode() { var ReactCurrentBatchConfig = { transition: null }; function noop() {} var onError = - "function" === typeof reportError - ? reportError - : function (error) { - console.error(error); - }; + "function" === typeof reportError + ? reportError + : function (error) { + console.error(error); + }, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; +function jsx$1(type, config, maybeKey) { + var propName, + props = {}, + key = null, + ref = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + void 0 !== config.ref && (ref = config.ref); + for (propName in config) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "ref" !== propName && + (props[propName] = config[propName]); + if (type && type.defaultProps) + for (propName in ((config = type.defaultProps), config)) + void 0 === props[propName] && (props[propName] = config[propName]); + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: ref, + props: props, + _owner: ReactCurrentOwner.current + }; +} exports.Children = { map: mapChildren, forEach: function (children, forEachFunc, forEachContext) { @@ -468,4 +468,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactCurrentDispatcher.current.useMemo(create, deps); }; -exports.version = "18.3.0-www-modern-8cbdba22"; +exports.version = "18.3.0-www-modern-b9404dd8";