react 19.0.0-canary-48ec17b86-20240402 → 19.0.0-canary-7a2609eed-20240403

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.
@@ -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
- // Ready for next major.
100
- //
101
- // Alias __NEXT_MAJOR__ to false for easier skimming.
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 __NEXT_MAJOR__ = false; // Removes legacy style context
103
+ var enableRefAsProp = true;
105
104
 
106
- var enableRenderableContext = __NEXT_MAJOR__; // -----------------------------------------------------------------------------
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
- var provider = type;
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) + '.Consumer';
186
+ return getContextName(context) + '.Provider';
189
187
  }
190
188
 
191
189
  case REACT_CONSUMER_TYPE:
192
190
  {
193
- return null;
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 === REACT_PROVIDER_TYPE || enableRenderableContext || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
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 specialPropRefWarningShown;
755
- var didWarnAboutStringRefs;
753
+ var didWarnAboutElementRef;
756
754
 
757
755
  {
758
- didWarnAboutStringRefs = {};
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 defineRefPropWarningGetter(props, displayName) {
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
- 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://react.dev/link/special-props)', displayName);
829
- }
830
- };
809
+ if (!didWarnAboutElementRef[componentName]) {
810
+ didWarnAboutElementRef[componentName] = true;
831
811
 
832
- warnAboutAccessingRef.isReactWarning = true;
833
- Object.defineProperty(props, 'ref', {
834
- get: warnAboutAccessingRef,
835
- configurable: true
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
- ref = _ref;
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 prod, `ref` is a regular property. It will be removed in a
873
- // future release.
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,20 +1039,12 @@ 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' && (propName !== 'ref')) {
1047
+ propName !== 'key' && (enableRefAsProp )) {
1040
1048
  props[propName] = config[propName];
1041
1049
  }
1042
1050
  } // Resolve default props
@@ -1052,16 +1060,12 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
1052
1060
  }
1053
1061
  }
1054
1062
 
1055
- if (key || ref) {
1063
+ if (key || !enableRefAsProp ) {
1056
1064
  var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1057
1065
 
1058
1066
  if (key) {
1059
1067
  defineKeyPropWarningGetter(props, displayName);
1060
1068
  }
1061
-
1062
- if (ref) {
1063
- defineRefPropWarningGetter(props, displayName);
1064
- }
1065
1069
  }
1066
1070
 
1067
1071
  var element = ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
@@ -1244,14 +1248,6 @@ function validateFragmentProps(fragment) {
1244
1248
  break;
1245
1249
  }
1246
1250
  }
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
1251
  }
1256
1252
  }
1257
1253
 
@@ -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
- // Ready for next major.
100
- //
101
- // Alias __NEXT_MAJOR__ to false for easier skimming.
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 __NEXT_MAJOR__ = false; // Removes legacy style context
103
+ var enableRefAsProp = true;
105
104
 
106
- var enableRenderableContext = __NEXT_MAJOR__; // -----------------------------------------------------------------------------
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
- var provider = type;
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) + '.Consumer';
186
+ return getContextName(context) + '.Provider';
189
187
  }
190
188
 
191
189
  case REACT_CONSUMER_TYPE:
192
190
  {
193
- return null;
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 === REACT_PROVIDER_TYPE || enableRenderableContext || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
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 specialPropRefWarningShown;
755
- var didWarnAboutStringRefs;
753
+ var didWarnAboutElementRef;
756
754
 
757
755
  {
758
- didWarnAboutStringRefs = {};
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 defineRefPropWarningGetter(props, displayName) {
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
- 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://react.dev/link/special-props)', displayName);
829
- }
830
- };
809
+ if (!didWarnAboutElementRef[componentName]) {
810
+ didWarnAboutElementRef[componentName] = true;
831
811
 
832
- warnAboutAccessingRef.isReactWarning = true;
833
- Object.defineProperty(props, 'ref', {
834
- get: warnAboutAccessingRef,
835
- configurable: true
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
- ref = _ref;
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 prod, `ref` is a regular property. It will be removed in a
873
- // future release.
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,20 +1063,12 @@ 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' && (propName !== 'ref')) {
1071
+ propName !== 'key' && (enableRefAsProp )) {
1064
1072
  props[propName] = config[propName];
1065
1073
  }
1066
1074
  } // Resolve default props
@@ -1076,16 +1084,12 @@ function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {
1076
1084
  }
1077
1085
  }
1078
1086
 
1079
- if (key || ref) {
1087
+ if (key || !enableRefAsProp ) {
1080
1088
  var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1081
1089
 
1082
1090
  if (key) {
1083
1091
  defineKeyPropWarningGetter(props, displayName);
1084
1092
  }
1085
-
1086
- if (ref) {
1087
- defineRefPropWarningGetter(props, displayName);
1088
- }
1089
1093
  }
1090
1094
 
1091
1095
  var element = ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
@@ -1268,14 +1272,6 @@ function validateFragmentProps(fragment) {
1268
1272
  break;
1269
1273
  }
1270
1274
  }
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
1275
  }
1280
1276
  }
1281
1277
 
@@ -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,7 +63,15 @@ function ReactElement(type, key, _ref, self, source, owner, props) {
61
63
  let ref;
62
64
 
63
65
  {
64
- ref = _ref;
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;
@@ -114,16 +124,10 @@ function jsxProd(type, config, maybeKey) {
114
124
  key = '' + config.key;
115
125
  }
116
126
 
117
- if (hasValidRef(config)) {
118
- {
119
- ref = config.ref;
120
- }
121
- } // Remaining properties are added to a new props object
122
-
123
127
 
124
128
  for (propName in config) {
125
129
  if (hasOwnProperty.call(config, propName) && // Skip over reserved prop names
126
- propName !== 'key' && (propName !== 'ref')) {
130
+ propName !== 'key' && (enableRefAsProp )) {
127
131
  props[propName] = config[propName];
128
132
  }
129
133
  } // Resolve default props
@@ -7,7 +7,7 @@
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';var f=require("react"),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
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';var f=require("react"),h=Symbol.for("react.element"),k=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
11
+ function n(d,b,g){var c={},e=null;void 0!==g&&(e=""+g);void 0!==b.key&&(e=""+b.key);for(a in b)l.call(b,a)&&"key"!==a&&(c[a]=b[a]);if(d&&d.defaultProps)for(a in b=d.defaultProps,b)void 0===c[a]&&(c[a]=b[a]);var a=c.ref;return{$$typeof:h,type:d,key:e,ref:void 0!==a?a:null,props:c,_owner:m.current}}exports.Fragment=k;exports.jsx=n;exports.jsxs=n;
12
12
 
13
13
  //# sourceMappingURL=react-jsx-runtime.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-jsx-runtime.production.min.js","lineCount":11,"mappings":"A;;;;;;;;;aAYA,IAAIA,EAAQC,OAAA,CAAQ,OAAR,CAAZ,CAMMC,EAAqBC,MAAOC,CAAAA,GAAP,CAAW,eAAX,CAN3B,CAO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CI,OAAQC,CAAAA,QAAR,CAAmBtB,CACnBqB,QAAQE,CAAAA,GAAR,CAAcA,CACdF,QAAQG,CAAAA,IAAR,CAAeA;","sources":["react-jsx-runtime.production.js"],"names":["React","require","REACT_ELEMENT_TYPE","Symbol","for","REACT_FRAGMENT_TYPE","hasOwnProperty","Object","prototype","ReactCurrentOwner","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","jsxProd","type","config","maybeKey","propName","props","key","ref","undefined","call","defaultProps","element","$$typeof","_owner","current","exports","Fragment","jsx","jsxs"],"ignoreList":[0]}
1
+ {"version":3,"file":"react-jsx-runtime.production.min.js","lineCount":11,"mappings":"A;;;;;;;;;aAYA,IAAIA,EAAQC,OAAA,CAAQ,OAAR,CAAZ,CAMMC,EAAqBC,MAAOC,CAAAA,GAAP,CAAW,eAAX,CAN3B,CAOMC,EAAsBF,MAAOC,CAAAA,GAAP,CAAW,gBAAX,CAP5B,CAmBME,EAAiBC,MAAOC,CAAAA,SAAUF,CAAAA,cAnBxC,CAqBMG,EALuBT,CAAMU,CAAAA,kDAKYD,CAAAA,iBAuE/CE;QAASA,EAAO,CAACC,CAAD,CAAOC,CAAP,CAAeC,CAAf,CAAyB,CACvC,IAEMC,EAAQ,EAFd,CAGIC,EAAM,IAQOC,KAAAA,EAAjB,GAAIH,CAAJ,GAEEE,CAFF,CAEQ,EAFR,CAEaF,CAFb,CA/EsBG,KAAAA,EAoFtB,GAAgBJ,CApFFG,CAAAA,GAoFd,GAEEA,CAFF,CAEQ,EAFR,CAEaH,CAAOG,CAAAA,GAFpB,CAMA,KAAKE,CAAL,GAAiBL,EAAjB,CACMP,CAAea,CAAAA,IAAf,CAAoBN,CAApB,CAA4BK,CAA5B,CAAJ,EACa,KADb,GACAA,CADA,GAEEH,CAAA,CAAMG,CAAN,CAFF,CAEoBL,CAAA,CAAOK,CAAP,CAFpB,CAOF,IAAIN,CAAJ,EAAYA,CAAKQ,CAAAA,YAAjB,CAGE,IAAKF,CAAL,GAFME,EAEWA,CAFIR,CAAKQ,CAAAA,YAETA,CAAAA,CAAjB,CAC0BH,IAAAA,EAAxB,GAAIF,CAAA,CAAMG,CAAN,CAAJ,GACEH,CAAA,CAAMG,CAAN,CADF,CACoBE,CAAA,CAAaF,CAAb,CADpB,CArEIG,KAAAA,EA2E6EN,CA3E7DO,CAAAA,GA2ExB,OAhEYC,CAERC,SAAUtB,CAFFqB,CAIRX,KA4DgBA,CAhERW,CAKRP,IA2DsBA,CAhEdO,CAMRD,IAdgBL,IAAAA,EAAZK,GAAAD,CAAAC,CAAwBD,CAAxBC,CAAkC,IAQ9BC,CAORR,MAyDiFA,CAhEzEQ,CASRE,OAuDsDhB,CAAkBiB,CAAAA,OAhEhEH,CAuB2B,CAiDzCI,OAAQC,CAAAA,QAAR,CAAmBvB,CACnBsB,QAAQE,CAAAA,GAAR,CAAcA,CACdF,QAAQG,CAAAA,IAAR,CAAeA;","sources":["react-jsx-runtime.production.js"],"names":["React","require","REACT_ELEMENT_TYPE","Symbol","for","REACT_FRAGMENT_TYPE","hasOwnProperty","Object","prototype","ReactCurrentOwner","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","jsxProd","type","config","maybeKey","props","key","undefined","propName","call","defaultProps","refProp","ref","element","$$typeof","_owner","current","exports","Fragment","jsx","jsxs"],"ignoreList":[0]}
@@ -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,7 +63,15 @@ function ReactElement(type, key, _ref, self, source, owner, props) {
61
63
  let ref;
62
64
 
63
65
  {
64
- ref = _ref;
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;
@@ -114,16 +124,10 @@ function jsxProd(type, config, maybeKey) {
114
124
  key = '' + config.key;
115
125
  }
116
126
 
117
- if (hasValidRef(config)) {
118
- {
119
- ref = config.ref;
120
- }
121
- } // Remaining properties are added to a new props object
122
-
123
127
 
124
128
  for (propName in config) {
125
129
  if (hasOwnProperty.call(config, propName) && // Skip over reserved prop names
126
- propName !== 'key' && (propName !== 'ref')) {
130
+ propName !== 'key' && (enableRefAsProp )) {
127
131
  props[propName] = config[propName];
128
132
  }
129
133
  } // Resolve default props
@@ -7,7 +7,7 @@
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';var f=require("react"),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
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';var f=require("react"),h=Symbol.for("react.element"),k=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
11
+ function n(d,b,g){var c={},e=null;void 0!==g&&(e=""+g);void 0!==b.key&&(e=""+b.key);for(a in b)l.call(b,a)&&"key"!==a&&(c[a]=b[a]);if(d&&d.defaultProps)for(a in b=d.defaultProps,b)void 0===c[a]&&(c[a]=b[a]);var a=c.ref;return{$$typeof:h,type:d,key:e,ref:void 0!==a?a:null,props:c,_owner:m.current}}exports.Fragment=k;exports.jsx=n;exports.jsxs=n;
12
12
 
13
13
  //# sourceMappingURL=react-jsx-runtime.profiling.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-jsx-runtime.profiling.min.js","lineCount":11,"mappings":"A;;;;;;;;;aAYA,IAAIA,EAAQC,OAAA,CAAQ,OAAR,CAAZ,CAMMC,EAAqBC,MAAOC,CAAAA,GAAP,CAAW,eAAX,CAN3B,CAOMC,EAAsBF,MAAOC,CAAAA,GAAP,CAAW,gBAAX,CAP5B,CAYME,EAAiBC,MAAOC,CAAAA,SAAUF,CAAAA,cAZxC,CAcMG,EALuBT,CAAMU,CAAAA,kDAKYD,CAAAA,iBAoE/CE;QAASA,EAAO,CAACC,CAAD,CAAOC,CAAP,CAAeC,CAAf,CAAyB,CACvC,IAAIC,CAAJ,CAEMC,EAAQ,EAFd,CAGIC,EAAM,IAHV,CAIIC,EAAM,IAOOC,KAAAA,EAAjB,GAAIL,CAAJ,GAEEG,CAFF,CAEQ,EAFR,CAEaH,CAFb,CAvEsBK,KAAAA,EA4EtB,GAAgBN,CA5EFI,CAAAA,GA4Ed,GAEEA,CAFF,CAEQ,EAFR,CAEaJ,CAAOI,CAAAA,GAFpB,CAjFsBE,KAAAA,EAsFtB,GAAgBN,CAtFFK,CAAAA,GAsFd,GAEIA,CAFJ,CAEUL,CAAOK,CAAAA,GAFjB,CAOA,KAAKH,CAAL,GAAiBF,EAAjB,CACMP,CAAec,CAAAA,IAAf,CAAoBP,CAApB,CAA4BE,CAA5B,CAAJ,EACa,KADb,GACAA,CADA,EACoC,KADpC,GACuBA,CADvB,GAEEC,CAAA,CAAMD,CAAN,CAFF,CAEoBF,CAAA,CAAOE,CAAP,CAFpB,CAOF,IAAIH,CAAJ,EAAYA,CAAKS,CAAAA,YAAjB,CAGE,IAAKN,CAAL,GAFMM,EAEWA,CAFIT,CAAKS,CAAAA,YAETA,CAAAA,CAAjB,CAC0BF,IAAAA,EAAxB,GAAIH,CAAA,CAAMD,CAAN,CAAJ,GACEC,CAAA,CAAMD,CAAN,CADF,CACoBM,CAAA,CAAaN,CAAb,CADpB,CAMJ,OAtEYO,CAERC,SAAUrB,CAFFoB,CAIRV,KAkEgBA,CAtERU,CAKRL,IAiEsBA,CAtEdK,CAMRJ,IAgE2BA,CAtEnBI,CAORN,MA+DiFA,CAtEzEM,CASRE,OA6DsDf,CAAkBgB,CAAAA,OAtEhEH,CAuB2B,CAuDzCI,OAAQC,CAAAA,QAAR,CAAmBtB,CACnBqB,QAAQE,CAAAA,GAAR,CAAcA,CACdF,QAAQG,CAAAA,IAAR,CAAeA;","sources":["react-jsx-runtime.profiling.js"],"names":["React","require","REACT_ELEMENT_TYPE","Symbol","for","REACT_FRAGMENT_TYPE","hasOwnProperty","Object","prototype","ReactCurrentOwner","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","jsxProd","type","config","maybeKey","propName","props","key","ref","undefined","call","defaultProps","element","$$typeof","_owner","current","exports","Fragment","jsx","jsxs"],"ignoreList":[0]}
1
+ {"version":3,"file":"react-jsx-runtime.profiling.min.js","lineCount":11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EzEQ,CASRE,OAuDsDhB,CAAkBiB,CAAAA,OAhEhEH,CAuB2B,CAiDzCI,OAAQC,CAAAA,QAAR,CAAmBvB,CACnBsB,QAAQE,CAAAA,GAAR,CAAcA,CACdF,QAAQG,CAAAA,IAAR,CAAeA;","sources":["react-jsx-runtime.profiling.js"],"names":["React","require","REACT_ELEMENT_TYPE","Symbol","for","REACT_FRAGMENT_TYPE","hasOwnProperty","Object","prototype","ReactCurrentOwner","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","jsxProd","type","config","maybeKey","props","key","undefined","propName","call","defaultProps","refProp","ref","element","$$typeof","_owner","current","exports","Fragment","jsx","jsxs"],"ignoreList":[0]}