react 19.0.0-canary-48ec17b86-20240402 → 19.0.0-canary-fd0da3eef-20240404
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/react-jsx-dev-runtime.development.js +65 -80
- package/cjs/react-jsx-runtime.development.js +65 -80
- package/cjs/react-jsx-runtime.production.js +19 -29
- package/cjs/react-jsx-runtime.production.min.js +1 -2
- package/cjs/react-jsx-runtime.production.min.js.map +1 -1
- package/cjs/react-jsx-runtime.profiling.js +19 -29
- package/cjs/react-jsx-runtime.profiling.min.js +1 -2
- package/cjs/react-jsx-runtime.profiling.min.js.map +1 -1
- package/cjs/react-jsx-runtime.react-server.development.js +65 -80
- package/cjs/react-jsx-runtime.react-server.production.js +19 -29
- package/cjs/react-jsx-runtime.react-server.production.min.js +1 -2
- package/cjs/react-jsx-runtime.react-server.production.min.js.map +1 -1
- package/cjs/react.development.js +97 -220
- package/cjs/react.production.js +25 -53
- package/cjs/react.production.min.js +21 -21
- package/cjs/react.production.min.js.map +1 -1
- package/cjs/react.react-server.development.js +70 -142
- package/cjs/react.react-server.production.js +22 -48
- package/cjs/react.react-server.production.min.js +18 -19
- package/cjs/react.react-server.production.min.js.map +1 -1
- package/package.json +1 -1
- package/umd/react.development.js +97 -220
- package/umd/react.production.min.js +24 -25
- package/umd/react.profiling.min.js +24 -25
@@ -96,14 +96,13 @@ var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
96
96
|
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
97
97
|
|
98
98
|
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
99
|
-
//
|
100
|
-
//
|
101
|
-
//
|
102
|
-
// -----------------------------------------------------------------------------
|
99
|
+
// as a normal prop instead of stripping it from the props object.
|
100
|
+
// Passes `ref` as a normal prop instead of stripping it from the props object
|
101
|
+
// during element creation.
|
103
102
|
|
104
|
-
var
|
103
|
+
var enableRefAsProp = true;
|
105
104
|
|
106
|
-
var enableRenderableContext =
|
105
|
+
var enableRenderableContext = true; // -----------------------------------------------------------------------------
|
107
106
|
// stuff. Intended to enable React core members to more easily debug scheduling
|
108
107
|
// issues in DEV builds.
|
109
108
|
|
@@ -177,20 +176,20 @@ function getComponentNameFromType(type) {
|
|
177
176
|
switch (type.$$typeof) {
|
178
177
|
case REACT_PROVIDER_TYPE:
|
179
178
|
{
|
180
|
-
|
181
|
-
return getContextName(provider._context) + '.Provider';
|
179
|
+
return null;
|
182
180
|
}
|
183
181
|
|
184
182
|
case REACT_CONTEXT_TYPE:
|
185
183
|
var context = type;
|
186
184
|
|
187
185
|
{
|
188
|
-
return getContextName(context) + '.
|
186
|
+
return getContextName(context) + '.Provider';
|
189
187
|
}
|
190
188
|
|
191
189
|
case REACT_CONSUMER_TYPE:
|
192
190
|
{
|
193
|
-
|
191
|
+
var consumer = type;
|
192
|
+
return getContextName(consumer._context) + '.Consumer';
|
194
193
|
}
|
195
194
|
|
196
195
|
case REACT_FORWARD_REF_TYPE:
|
@@ -308,7 +307,7 @@ function isValidElementType(type) {
|
|
308
307
|
}
|
309
308
|
|
310
309
|
if (typeof type === 'object' && type !== null) {
|
311
|
-
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof ===
|
310
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || !enableRenderableContext || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
312
311
|
// types supported by any Flight configuration anywhere since
|
313
312
|
// we don't know which Flight build this will end up being used
|
314
313
|
// with.
|
@@ -751,11 +750,10 @@ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
751
750
|
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
752
751
|
var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference');
|
753
752
|
var specialPropKeyWarningShown;
|
754
|
-
var
|
755
|
-
var didWarnAboutStringRefs;
|
753
|
+
var didWarnAboutElementRef;
|
756
754
|
|
757
755
|
{
|
758
|
-
|
756
|
+
didWarnAboutElementRef = {};
|
759
757
|
}
|
760
758
|
|
761
759
|
function hasValidRef(config) {
|
@@ -786,20 +784,6 @@ function hasValidKey(config) {
|
|
786
784
|
return config.key !== undefined;
|
787
785
|
}
|
788
786
|
|
789
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
790
|
-
{
|
791
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
792
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
793
|
-
|
794
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
795
|
-
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://react.dev/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
796
|
-
|
797
|
-
didWarnAboutStringRefs[componentName] = true;
|
798
|
-
}
|
799
|
-
}
|
800
|
-
}
|
801
|
-
}
|
802
|
-
|
803
787
|
function defineKeyPropWarningGetter(props, displayName) {
|
804
788
|
{
|
805
789
|
var warnAboutAccessingKey = function () {
|
@@ -818,23 +802,20 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
818
802
|
}
|
819
803
|
}
|
820
804
|
|
821
|
-
function
|
805
|
+
function elementRefGetterWithDeprecationWarning() {
|
822
806
|
{
|
823
|
-
|
824
|
-
var warnAboutAccessingRef = function () {
|
825
|
-
if (!specialPropRefWarningShown) {
|
826
|
-
specialPropRefWarningShown = true;
|
807
|
+
var componentName = getComponentNameFromType(this.type);
|
827
808
|
|
828
|
-
|
829
|
-
|
830
|
-
};
|
809
|
+
if (!didWarnAboutElementRef[componentName]) {
|
810
|
+
didWarnAboutElementRef[componentName] = true;
|
831
811
|
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
812
|
+
error('Accessing element.ref was removed in React 19. ref is now a ' + 'regular prop. It will be removed from the JSX Element ' + 'type in a future release.');
|
813
|
+
} // An undefined `element.ref` is coerced to `null` for
|
814
|
+
// backwards compatibility.
|
815
|
+
|
816
|
+
|
817
|
+
var refProp = this.props.ref;
|
818
|
+
return refProp !== undefined ? refProp : null;
|
838
819
|
}
|
839
820
|
}
|
840
821
|
/**
|
@@ -863,25 +844,60 @@ function ReactElement(type, key, _ref, self, source, owner, props) {
|
|
863
844
|
var ref;
|
864
845
|
|
865
846
|
{
|
866
|
-
|
847
|
+
// When enableRefAsProp is on, ignore whatever was passed as the ref
|
848
|
+
// argument and treat `props.ref` as the source of truth. The only thing we
|
849
|
+
// use this for is `element.ref`, which will log a deprecation warning on
|
850
|
+
// access. In the next release, we can remove `element.ref` as well as the
|
851
|
+
// `ref` argument.
|
852
|
+
var refProp = props.ref; // An undefined `element.ref` is coerced to `null` for
|
853
|
+
// backwards compatibility.
|
854
|
+
|
855
|
+
ref = refProp !== undefined ? refProp : null;
|
867
856
|
}
|
868
857
|
|
869
858
|
var element;
|
870
859
|
|
871
860
|
{
|
872
|
-
// In
|
873
|
-
//
|
861
|
+
// In dev, make `ref` a non-enumerable property with a warning. It's non-
|
862
|
+
// enumerable so that test matchers and serializers don't access it and
|
863
|
+
// trigger the warning.
|
864
|
+
//
|
865
|
+
// `ref` will be removed from the element completely in a future release.
|
874
866
|
element = {
|
875
867
|
// This tag allows us to uniquely identify this as a React Element
|
876
868
|
$$typeof: REACT_ELEMENT_TYPE,
|
877
869
|
// Built-in properties that belong on the element
|
878
870
|
type: type,
|
879
871
|
key: key,
|
880
|
-
ref: ref,
|
881
872
|
props: props,
|
882
873
|
// Record the component responsible for creating this element.
|
883
874
|
_owner: owner
|
884
875
|
};
|
876
|
+
|
877
|
+
if (ref !== null) {
|
878
|
+
Object.defineProperty(element, 'ref', {
|
879
|
+
enumerable: false,
|
880
|
+
get: elementRefGetterWithDeprecationWarning
|
881
|
+
});
|
882
|
+
} else {
|
883
|
+
// Don't warn on access if a ref is not given. This reduces false
|
884
|
+
// positives in cases where a test serializer uses
|
885
|
+
// getOwnPropertyDescriptors to compare objects, like Jest does, which is
|
886
|
+
// a problem because it bypasses non-enumerability.
|
887
|
+
//
|
888
|
+
// So unfortunately this will trigger a false positive warning in Jest
|
889
|
+
// when the diff is printed:
|
890
|
+
//
|
891
|
+
// expect(<div ref={ref} />).toEqual(<span ref={ref} />);
|
892
|
+
//
|
893
|
+
// A bit sketchy, but this is what we've done for the `props.key` and
|
894
|
+
// `props.ref` accessors for years, which implies it will be good enough
|
895
|
+
// for `element.ref`, too. Let's see if anyone complains.
|
896
|
+
Object.defineProperty(element, 'ref', {
|
897
|
+
enumerable: false,
|
898
|
+
value: null
|
899
|
+
});
|
900
|
+
}
|
885
901
|
}
|
886
902
|
|
887
903
|
{
|
@@ -1023,45 +1039,22 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
|
|
1023
1039
|
key = '' + config.key;
|
1024
1040
|
}
|
1025
1041
|
|
1026
|
-
if (hasValidRef(config))
|
1027
|
-
{
|
1028
|
-
ref = config.ref;
|
1029
|
-
}
|
1030
|
-
|
1031
|
-
{
|
1032
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
1033
|
-
}
|
1034
|
-
} // Remaining properties are added to a new props object
|
1042
|
+
if (hasValidRef(config)) ; // Remaining properties are added to a new props object
|
1035
1043
|
|
1036
1044
|
|
1037
1045
|
for (propName in config) {
|
1038
1046
|
if (hasOwnProperty.call(config, propName) && // Skip over reserved prop names
|
1039
|
-
propName !== 'key' && (
|
1047
|
+
propName !== 'key' && (enableRefAsProp )) {
|
1040
1048
|
props[propName] = config[propName];
|
1041
1049
|
}
|
1042
|
-
} // Resolve default props
|
1043
|
-
|
1044
|
-
|
1045
|
-
if (type && type.defaultProps) {
|
1046
|
-
var defaultProps = type.defaultProps;
|
1047
|
-
|
1048
|
-
for (propName in defaultProps) {
|
1049
|
-
if (props[propName] === undefined) {
|
1050
|
-
props[propName] = defaultProps[propName];
|
1051
|
-
}
|
1052
|
-
}
|
1053
1050
|
}
|
1054
1051
|
|
1055
|
-
if (key ||
|
1052
|
+
if (key || !enableRefAsProp ) {
|
1056
1053
|
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
1057
1054
|
|
1058
1055
|
if (key) {
|
1059
1056
|
defineKeyPropWarningGetter(props, displayName);
|
1060
1057
|
}
|
1061
|
-
|
1062
|
-
if (ref) {
|
1063
|
-
defineRefPropWarningGetter(props, displayName);
|
1064
|
-
}
|
1065
1058
|
}
|
1066
1059
|
|
1067
1060
|
var element = ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
@@ -1244,14 +1237,6 @@ function validateFragmentProps(fragment) {
|
|
1244
1237
|
break;
|
1245
1238
|
}
|
1246
1239
|
}
|
1247
|
-
|
1248
|
-
if (fragment.ref !== null) {
|
1249
|
-
setCurrentlyValidatingElement(fragment);
|
1250
|
-
|
1251
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
1252
|
-
|
1253
|
-
setCurrentlyValidatingElement(null);
|
1254
|
-
}
|
1255
1240
|
}
|
1256
1241
|
}
|
1257
1242
|
|
@@ -96,14 +96,13 @@ var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
96
96
|
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
97
97
|
|
98
98
|
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
99
|
-
//
|
100
|
-
//
|
101
|
-
//
|
102
|
-
// -----------------------------------------------------------------------------
|
99
|
+
// as a normal prop instead of stripping it from the props object.
|
100
|
+
// Passes `ref` as a normal prop instead of stripping it from the props object
|
101
|
+
// during element creation.
|
103
102
|
|
104
|
-
var
|
103
|
+
var enableRefAsProp = true;
|
105
104
|
|
106
|
-
var enableRenderableContext =
|
105
|
+
var enableRenderableContext = true; // -----------------------------------------------------------------------------
|
107
106
|
// stuff. Intended to enable React core members to more easily debug scheduling
|
108
107
|
// issues in DEV builds.
|
109
108
|
|
@@ -177,20 +176,20 @@ function getComponentNameFromType(type) {
|
|
177
176
|
switch (type.$$typeof) {
|
178
177
|
case REACT_PROVIDER_TYPE:
|
179
178
|
{
|
180
|
-
|
181
|
-
return getContextName(provider._context) + '.Provider';
|
179
|
+
return null;
|
182
180
|
}
|
183
181
|
|
184
182
|
case REACT_CONTEXT_TYPE:
|
185
183
|
var context = type;
|
186
184
|
|
187
185
|
{
|
188
|
-
return getContextName(context) + '.
|
186
|
+
return getContextName(context) + '.Provider';
|
189
187
|
}
|
190
188
|
|
191
189
|
case REACT_CONSUMER_TYPE:
|
192
190
|
{
|
193
|
-
|
191
|
+
var consumer = type;
|
192
|
+
return getContextName(consumer._context) + '.Consumer';
|
194
193
|
}
|
195
194
|
|
196
195
|
case REACT_FORWARD_REF_TYPE:
|
@@ -308,7 +307,7 @@ function isValidElementType(type) {
|
|
308
307
|
}
|
309
308
|
|
310
309
|
if (typeof type === 'object' && type !== null) {
|
311
|
-
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof ===
|
310
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || !enableRenderableContext || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
312
311
|
// types supported by any Flight configuration anywhere since
|
313
312
|
// we don't know which Flight build this will end up being used
|
314
313
|
// with.
|
@@ -751,11 +750,10 @@ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
751
750
|
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
752
751
|
var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference');
|
753
752
|
var specialPropKeyWarningShown;
|
754
|
-
var
|
755
|
-
var didWarnAboutStringRefs;
|
753
|
+
var didWarnAboutElementRef;
|
756
754
|
|
757
755
|
{
|
758
|
-
|
756
|
+
didWarnAboutElementRef = {};
|
759
757
|
}
|
760
758
|
|
761
759
|
function hasValidRef(config) {
|
@@ -786,20 +784,6 @@ function hasValidKey(config) {
|
|
786
784
|
return config.key !== undefined;
|
787
785
|
}
|
788
786
|
|
789
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
790
|
-
{
|
791
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
792
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
793
|
-
|
794
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
795
|
-
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://react.dev/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
796
|
-
|
797
|
-
didWarnAboutStringRefs[componentName] = true;
|
798
|
-
}
|
799
|
-
}
|
800
|
-
}
|
801
|
-
}
|
802
|
-
|
803
787
|
function defineKeyPropWarningGetter(props, displayName) {
|
804
788
|
{
|
805
789
|
var warnAboutAccessingKey = function () {
|
@@ -818,23 +802,20 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
818
802
|
}
|
819
803
|
}
|
820
804
|
|
821
|
-
function
|
805
|
+
function elementRefGetterWithDeprecationWarning() {
|
822
806
|
{
|
823
|
-
|
824
|
-
var warnAboutAccessingRef = function () {
|
825
|
-
if (!specialPropRefWarningShown) {
|
826
|
-
specialPropRefWarningShown = true;
|
807
|
+
var componentName = getComponentNameFromType(this.type);
|
827
808
|
|
828
|
-
|
829
|
-
|
830
|
-
};
|
809
|
+
if (!didWarnAboutElementRef[componentName]) {
|
810
|
+
didWarnAboutElementRef[componentName] = true;
|
831
811
|
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
812
|
+
error('Accessing element.ref was removed in React 19. ref is now a ' + 'regular prop. It will be removed from the JSX Element ' + 'type in a future release.');
|
813
|
+
} // An undefined `element.ref` is coerced to `null` for
|
814
|
+
// backwards compatibility.
|
815
|
+
|
816
|
+
|
817
|
+
var refProp = this.props.ref;
|
818
|
+
return refProp !== undefined ? refProp : null;
|
838
819
|
}
|
839
820
|
}
|
840
821
|
/**
|
@@ -863,25 +844,60 @@ function ReactElement(type, key, _ref, self, source, owner, props) {
|
|
863
844
|
var ref;
|
864
845
|
|
865
846
|
{
|
866
|
-
|
847
|
+
// When enableRefAsProp is on, ignore whatever was passed as the ref
|
848
|
+
// argument and treat `props.ref` as the source of truth. The only thing we
|
849
|
+
// use this for is `element.ref`, which will log a deprecation warning on
|
850
|
+
// access. In the next release, we can remove `element.ref` as well as the
|
851
|
+
// `ref` argument.
|
852
|
+
var refProp = props.ref; // An undefined `element.ref` is coerced to `null` for
|
853
|
+
// backwards compatibility.
|
854
|
+
|
855
|
+
ref = refProp !== undefined ? refProp : null;
|
867
856
|
}
|
868
857
|
|
869
858
|
var element;
|
870
859
|
|
871
860
|
{
|
872
|
-
// In
|
873
|
-
//
|
861
|
+
// In dev, make `ref` a non-enumerable property with a warning. It's non-
|
862
|
+
// enumerable so that test matchers and serializers don't access it and
|
863
|
+
// trigger the warning.
|
864
|
+
//
|
865
|
+
// `ref` will be removed from the element completely in a future release.
|
874
866
|
element = {
|
875
867
|
// This tag allows us to uniquely identify this as a React Element
|
876
868
|
$$typeof: REACT_ELEMENT_TYPE,
|
877
869
|
// Built-in properties that belong on the element
|
878
870
|
type: type,
|
879
871
|
key: key,
|
880
|
-
ref: ref,
|
881
872
|
props: props,
|
882
873
|
// Record the component responsible for creating this element.
|
883
874
|
_owner: owner
|
884
875
|
};
|
876
|
+
|
877
|
+
if (ref !== null) {
|
878
|
+
Object.defineProperty(element, 'ref', {
|
879
|
+
enumerable: false,
|
880
|
+
get: elementRefGetterWithDeprecationWarning
|
881
|
+
});
|
882
|
+
} else {
|
883
|
+
// Don't warn on access if a ref is not given. This reduces false
|
884
|
+
// positives in cases where a test serializer uses
|
885
|
+
// getOwnPropertyDescriptors to compare objects, like Jest does, which is
|
886
|
+
// a problem because it bypasses non-enumerability.
|
887
|
+
//
|
888
|
+
// So unfortunately this will trigger a false positive warning in Jest
|
889
|
+
// when the diff is printed:
|
890
|
+
//
|
891
|
+
// expect(<div ref={ref} />).toEqual(<span ref={ref} />);
|
892
|
+
//
|
893
|
+
// A bit sketchy, but this is what we've done for the `props.key` and
|
894
|
+
// `props.ref` accessors for years, which implies it will be good enough
|
895
|
+
// for `element.ref`, too. Let's see if anyone complains.
|
896
|
+
Object.defineProperty(element, 'ref', {
|
897
|
+
enumerable: false,
|
898
|
+
value: null
|
899
|
+
});
|
900
|
+
}
|
885
901
|
}
|
886
902
|
|
887
903
|
{
|
@@ -1047,45 +1063,22 @@ function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {
|
|
1047
1063
|
key = '' + config.key;
|
1048
1064
|
}
|
1049
1065
|
|
1050
|
-
if (hasValidRef(config))
|
1051
|
-
{
|
1052
|
-
ref = config.ref;
|
1053
|
-
}
|
1054
|
-
|
1055
|
-
{
|
1056
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
1057
|
-
}
|
1058
|
-
} // Remaining properties are added to a new props object
|
1066
|
+
if (hasValidRef(config)) ; // Remaining properties are added to a new props object
|
1059
1067
|
|
1060
1068
|
|
1061
1069
|
for (propName in config) {
|
1062
1070
|
if (hasOwnProperty.call(config, propName) && // Skip over reserved prop names
|
1063
|
-
propName !== 'key' && (
|
1071
|
+
propName !== 'key' && (enableRefAsProp )) {
|
1064
1072
|
props[propName] = config[propName];
|
1065
1073
|
}
|
1066
|
-
} // Resolve default props
|
1067
|
-
|
1068
|
-
|
1069
|
-
if (type && type.defaultProps) {
|
1070
|
-
var defaultProps = type.defaultProps;
|
1071
|
-
|
1072
|
-
for (propName in defaultProps) {
|
1073
|
-
if (props[propName] === undefined) {
|
1074
|
-
props[propName] = defaultProps[propName];
|
1075
|
-
}
|
1076
|
-
}
|
1077
1074
|
}
|
1078
1075
|
|
1079
|
-
if (key ||
|
1076
|
+
if (key || !enableRefAsProp ) {
|
1080
1077
|
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
1081
1078
|
|
1082
1079
|
if (key) {
|
1083
1080
|
defineKeyPropWarningGetter(props, displayName);
|
1084
1081
|
}
|
1085
|
-
|
1086
|
-
if (ref) {
|
1087
|
-
defineRefPropWarningGetter(props, displayName);
|
1088
|
-
}
|
1089
1082
|
}
|
1090
1083
|
|
1091
1084
|
var element = ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
@@ -1268,14 +1261,6 @@ function validateFragmentProps(fragment) {
|
|
1268
1261
|
break;
|
1269
1262
|
}
|
1270
1263
|
}
|
1271
|
-
|
1272
|
-
if (fragment.ref !== null) {
|
1273
|
-
setCurrentlyValidatingElement(fragment);
|
1274
|
-
|
1275
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
1276
|
-
|
1277
|
-
setCurrentlyValidatingElement(null);
|
1278
|
-
}
|
1279
1264
|
}
|
1280
1265
|
}
|
1281
1266
|
|
@@ -19,6 +19,13 @@ var React = require('react');
|
|
19
19
|
const REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
20
20
|
const REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
21
21
|
|
22
|
+
// -----------------------------------------------------------------------------
|
23
|
+
// as a normal prop instead of stripping it from the props object.
|
24
|
+
// Passes `ref` as a normal prop instead of stripping it from the props object
|
25
|
+
// during element creation.
|
26
|
+
|
27
|
+
const enableRefAsProp = true;
|
28
|
+
|
22
29
|
const ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
23
30
|
|
24
31
|
// $FlowFixMe[method-unbinding]
|
@@ -26,11 +33,6 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
26
33
|
|
27
34
|
const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
28
35
|
|
29
|
-
function hasValidRef(config) {
|
30
|
-
|
31
|
-
return config.ref !== undefined;
|
32
|
-
}
|
33
|
-
|
34
36
|
function hasValidKey(config) {
|
35
37
|
|
36
38
|
return config.key !== undefined;
|
@@ -61,14 +63,21 @@ function ReactElement(type, key, _ref, self, source, owner, props) {
|
|
61
63
|
let ref;
|
62
64
|
|
63
65
|
{
|
64
|
-
|
66
|
+
// When enableRefAsProp is on, ignore whatever was passed as the ref
|
67
|
+
// argument and treat `props.ref` as the source of truth. The only thing we
|
68
|
+
// use this for is `element.ref`, which will log a deprecation warning on
|
69
|
+
// access. In the next release, we can remove `element.ref` as well as the
|
70
|
+
// `ref` argument.
|
71
|
+
const refProp = props.ref; // An undefined `element.ref` is coerced to `null` for
|
72
|
+
// backwards compatibility.
|
73
|
+
|
74
|
+
ref = refProp !== undefined ? refProp : null;
|
65
75
|
}
|
66
76
|
|
67
77
|
let element;
|
68
78
|
|
69
79
|
{
|
70
|
-
// In prod, `ref` is a regular property
|
71
|
-
// future release.
|
80
|
+
// In prod, `ref` is a regular property and _owner doesn't exist.
|
72
81
|
element = {
|
73
82
|
// This tag allows us to uniquely identify this as a React Element
|
74
83
|
$$typeof: REACT_ELEMENT_TYPE,
|
@@ -76,9 +85,7 @@ function ReactElement(type, key, _ref, self, source, owner, props) {
|
|
76
85
|
type,
|
77
86
|
key,
|
78
87
|
ref,
|
79
|
-
props
|
80
|
-
// Record the component responsible for creating this element.
|
81
|
-
_owner: owner
|
88
|
+
props
|
82
89
|
};
|
83
90
|
}
|
84
91
|
|
@@ -114,29 +121,12 @@ function jsxProd(type, config, maybeKey) {
|
|
114
121
|
key = '' + config.key;
|
115
122
|
}
|
116
123
|
|
117
|
-
if (hasValidRef(config)) {
|
118
|
-
{
|
119
|
-
ref = config.ref;
|
120
|
-
}
|
121
|
-
} // Remaining properties are added to a new props object
|
122
|
-
|
123
124
|
|
124
125
|
for (propName in config) {
|
125
126
|
if (hasOwnProperty.call(config, propName) && // Skip over reserved prop names
|
126
|
-
propName !== 'key' && (
|
127
|
+
propName !== 'key' && (enableRefAsProp )) {
|
127
128
|
props[propName] = config[propName];
|
128
129
|
}
|
129
|
-
} // Resolve default props
|
130
|
-
|
131
|
-
|
132
|
-
if (type && type.defaultProps) {
|
133
|
-
const defaultProps = type.defaultProps;
|
134
|
-
|
135
|
-
for (propName in defaultProps) {
|
136
|
-
if (props[propName] === undefined) {
|
137
|
-
props[propName] = defaultProps[propName];
|
138
|
-
}
|
139
|
-
}
|
140
130
|
}
|
141
131
|
|
142
132
|
return ReactElement(type, key, ref, undefined, undefined, ReactCurrentOwner.current, props);
|
@@ -7,7 +7,6 @@
|
|
7
7
|
This source code is licensed under the MIT license found in the
|
8
8
|
LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
|
-
'use strict';
|
11
|
-
function p(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&"key"!==b&&"ref"!==b&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=p;exports.jsxs=p;
|
10
|
+
'use strict';require("react");var e=Symbol.for("react.element"),g=Symbol.for("react.fragment"),h=Object.prototype.hasOwnProperty;function k(l,a,f){var b,c={},d=null;void 0!==f&&(d=""+f);void 0!==a.key&&(d=""+a.key);for(b in a)h.call(a,b)&&"key"!==b&&(c[b]=a[b]);a=c.ref;return{$$typeof:e,type:l,key:d,ref:void 0!==a?a:null,props:c}}exports.Fragment=g;exports.jsx=k;exports.jsxs=k;
|
12
11
|
|
13
12
|
//# sourceMappingURL=react-jsx-runtime.production.min.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"react-jsx-runtime.production.min.js","lineCount":
|
1
|
+
{"version":3,"file":"react-jsx-runtime.production.min.js","lineCount":10,"mappings":"A;;;;;;;;;aAYYA,OAAA,CAAQ,OAAR,CAMZ,KAAMC,EAAqBC,MAAOC,CAAAA,GAAP,CAAW,eAAX,CAA3B,CACMC,EAAsBF,MAAOC,CAAAA,GAAP,CAAW,gBAAX,CAD5B,CAaME,EAAiBC,MAAOC,CAAAA,SAAUF,CAAAA,cAsExCG,SAASA,EAAO,CAACC,CAAD,CAAOC,CAAP,CAAeC,CAAf,CAAyB,CACvC,IAAIC,CAAJ,CAEMC,EAAQ,EAFd,CAGIC,EAAM,IAQOC,KAAAA,EAAjB,GAAIJ,CAAJ,GAEEG,CAFF,CAEQ,EAFR,CAEaH,CAFb,CA5EsBI,KAAAA,EAiFtB,GAAgBL,CAjFFI,CAAAA,GAiFd,GAEEA,CAFF,CAEQ,EAFR,CAEaJ,CAAOI,CAAAA,GAFpB,CAMA,KAAKF,CAAL,GAAiBF,EAAjB,CACML,CAAeW,CAAAA,IAAf,CAAoBN,CAApB,CAA4BE,CAA5B,CAAJ,EACa,KADb,GACAA,CADA,GAEEC,CAAA,CAAMD,CAAN,CAFF,CAEoBF,CAAA,CAAOE,CAAP,CAFpB,CAvDMK,EAAAA,CA6D6EJ,CA7D7DK,CAAAA,GA6DxB,OAnDYC,CAERC,SAAUnB,CAFFkB,CAIRV,KA+CgBA,CAnDRU,CAKRL,IA8CsBA,CAnDdK,CAMRD,IAbgBH,IAAAA,EAAZG,GAAAD,CAAAC,CAAwBD,CAAxBC,CAAkC,IAO9BC,CAORN,MA4CiFA,CAnDzEM,CAqB2B,CAsCzCE,OAAQC,CAAAA,QAAR,CAAmBlB,CACnBiB,QAAQE,CAAAA,GAAR,CAAcA,CACdF,QAAQG,CAAAA,IAAR,CAAeA;","sources":["react-jsx-runtime.production.js"],"names":["require","REACT_ELEMENT_TYPE","Symbol","for","REACT_FRAGMENT_TYPE","hasOwnProperty","Object","prototype","jsxProd","type","config","maybeKey","propName","props","key","undefined","call","refProp","ref","element","$$typeof","exports","Fragment","jsx","jsxs"],"ignoreList":[0]}
|