react 19.1.0 → 19.2.4

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.
@@ -57,6 +57,7 @@
57
57
  this.refs = emptyObject;
58
58
  this.updater = updater || ReactNoopUpdateQueue;
59
59
  }
60
+ function noop() {}
60
61
  function testStringCoercion(value) {
61
62
  return "" + value;
62
63
  }
@@ -116,7 +117,7 @@
116
117
  case REACT_PORTAL_TYPE:
117
118
  return "Portal";
118
119
  case REACT_CONTEXT_TYPE:
119
- return (type.displayName || "Context") + ".Provider";
120
+ return type.displayName || "Context";
120
121
  case REACT_CONSUMER_TYPE:
121
122
  return (type._context.displayName || "Context") + ".Consumer";
122
123
  case REACT_FORWARD_REF_TYPE:
@@ -196,17 +197,8 @@
196
197
  componentName = this.props.ref;
197
198
  return void 0 !== componentName ? componentName : null;
198
199
  }
199
- function ReactElement(
200
- type,
201
- key,
202
- self,
203
- source,
204
- owner,
205
- props,
206
- debugStack,
207
- debugTask
208
- ) {
209
- self = props.ref;
200
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
201
+ var refProp = props.ref;
210
202
  type = {
211
203
  $$typeof: REACT_ELEMENT_TYPE,
212
204
  type: type,
@@ -214,7 +206,7 @@
214
206
  props: props,
215
207
  _owner: owner
216
208
  };
217
- null !== (void 0 !== self ? self : null)
209
+ null !== (void 0 !== refProp ? refProp : null)
218
210
  ? Object.defineProperty(type, "ref", {
219
211
  enumerable: !1,
220
212
  get: elementRefGetterWithDeprecationWarning
@@ -252,10 +244,8 @@
252
244
  newKey = ReactElement(
253
245
  oldElement.type,
254
246
  newKey,
255
- void 0,
256
- void 0,
257
- oldElement._owner,
258
247
  oldElement.props,
248
+ oldElement._owner,
259
249
  oldElement._debugStack,
260
250
  oldElement._debugTask
261
251
  );
@@ -263,6 +253,18 @@
263
253
  (newKey._store.validated = oldElement._store.validated);
264
254
  return newKey;
265
255
  }
256
+ function validateChildKeys(node) {
257
+ isValidElement(node)
258
+ ? node._store && (node._store.validated = 1)
259
+ : "object" === typeof node &&
260
+ null !== node &&
261
+ node.$$typeof === REACT_LAZY_TYPE &&
262
+ ("fulfilled" === node._payload.status
263
+ ? isValidElement(node._payload.value) &&
264
+ node._payload.value._store &&
265
+ (node._payload.value._store.validated = 1)
266
+ : node._store && (node._store.validated = 1));
267
+ }
266
268
  function isValidElement(object) {
267
269
  return (
268
270
  "object" === typeof object &&
@@ -286,7 +288,6 @@
286
288
  ? (checkKeyStringCoercion(element.key), escape("" + element.key))
287
289
  : index.toString(36);
288
290
  }
289
- function noop$1() {}
290
291
  function resolveThenable(thenable) {
291
292
  switch (thenable.status) {
292
293
  case "fulfilled":
@@ -296,7 +297,7 @@
296
297
  default:
297
298
  switch (
298
299
  ("string" === typeof thenable.status
299
- ? thenable.then(noop$1, noop$1)
300
+ ? thenable.then(noop, noop)
300
301
  : ((thenable.status = "pending"),
301
302
  thenable.then(
302
303
  function (fulfilledValue) {
@@ -458,35 +459,56 @@
458
459
  }
459
460
  function lazyInitializer(payload) {
460
461
  if (-1 === payload._status) {
461
- var ctor = payload._result;
462
- ctor = ctor();
463
- ctor.then(
462
+ var ioInfo = payload._ioInfo;
463
+ null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
464
+ ioInfo = payload._result;
465
+ var thenable = ioInfo();
466
+ thenable.then(
464
467
  function (moduleObject) {
465
- if (0 === payload._status || -1 === payload._status)
466
- (payload._status = 1), (payload._result = moduleObject);
468
+ if (0 === payload._status || -1 === payload._status) {
469
+ payload._status = 1;
470
+ payload._result = moduleObject;
471
+ var _ioInfo = payload._ioInfo;
472
+ null != _ioInfo && (_ioInfo.end = performance.now());
473
+ void 0 === thenable.status &&
474
+ ((thenable.status = "fulfilled"),
475
+ (thenable.value = moduleObject));
476
+ }
467
477
  },
468
478
  function (error) {
469
- if (0 === payload._status || -1 === payload._status)
470
- (payload._status = 2), (payload._result = error);
479
+ if (0 === payload._status || -1 === payload._status) {
480
+ payload._status = 2;
481
+ payload._result = error;
482
+ var _ioInfo2 = payload._ioInfo;
483
+ null != _ioInfo2 && (_ioInfo2.end = performance.now());
484
+ void 0 === thenable.status &&
485
+ ((thenable.status = "rejected"), (thenable.reason = error));
486
+ }
471
487
  }
472
488
  );
489
+ ioInfo = payload._ioInfo;
490
+ if (null != ioInfo) {
491
+ ioInfo.value = thenable;
492
+ var displayName = thenable.displayName;
493
+ "string" === typeof displayName && (ioInfo.name = displayName);
494
+ }
473
495
  -1 === payload._status &&
474
- ((payload._status = 0), (payload._result = ctor));
496
+ ((payload._status = 0), (payload._result = thenable));
475
497
  }
476
498
  if (1 === payload._status)
477
499
  return (
478
- (ctor = payload._result),
479
- void 0 === ctor &&
500
+ (ioInfo = payload._result),
501
+ void 0 === ioInfo &&
480
502
  console.error(
481
503
  "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
482
- ctor
504
+ ioInfo
483
505
  ),
484
- "default" in ctor ||
506
+ "default" in ioInfo ||
485
507
  console.error(
486
508
  "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
487
- ctor
509
+ ioInfo
488
510
  ),
489
- ctor.default
511
+ ioInfo.default
490
512
  );
491
513
  throw payload._result;
492
514
  }
@@ -498,7 +520,9 @@
498
520
  );
499
521
  return dispatcher;
500
522
  }
501
- function noop() {}
523
+ function releaseAsyncTransition() {
524
+ ReactSharedInternals.asyncTransitions--;
525
+ }
502
526
  function enqueueTask(task) {
503
527
  if (null === enqueueTaskImpl)
504
528
  try {
@@ -590,9 +614,8 @@
590
614
  REACT_PORTAL_TYPE = Symbol.for("react.portal"),
591
615
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
592
616
  REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
593
- REACT_PROFILER_TYPE = Symbol.for("react.profiler");
594
- Symbol.for("react.provider");
595
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
617
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
618
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
596
619
  REACT_CONTEXT_TYPE = Symbol.for("react.context"),
597
620
  REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
598
621
  REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
@@ -635,16 +658,15 @@
635
658
  this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
636
659
  };
637
660
  var deprecatedAPIs = {
638
- isMounted: [
639
- "isMounted",
640
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
641
- ],
642
- replaceState: [
643
- "replaceState",
644
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
645
- ]
646
- },
647
- fnName;
661
+ isMounted: [
662
+ "isMounted",
663
+ "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
664
+ ],
665
+ replaceState: [
666
+ "replaceState",
667
+ "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
668
+ ]
669
+ };
648
670
  for (fnName in deprecatedAPIs)
649
671
  deprecatedAPIs.hasOwnProperty(fnName) &&
650
672
  defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
@@ -660,8 +682,8 @@
660
682
  A: null,
661
683
  T: null,
662
684
  S: null,
663
- V: null,
664
685
  actQueue: null,
686
+ asyncTransitions: 0,
665
687
  isBatchingLegacy: !1,
666
688
  didScheduleLegacyUpdate: !1,
667
689
  didUsePromise: !1,
@@ -676,15 +698,16 @@
676
698
  return null;
677
699
  };
678
700
  deprecatedAPIs = {
679
- "react-stack-bottom-frame": function (callStackForError) {
701
+ react_stack_bottom_frame: function (callStackForError) {
680
702
  return callStackForError();
681
703
  }
682
704
  };
683
705
  var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
684
706
  var didWarnAboutElementRef = {};
685
- var unknownOwnerDebugStack = deprecatedAPIs[
686
- "react-stack-bottom-frame"
687
- ].bind(deprecatedAPIs, UnknownOwner)();
707
+ var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
708
+ deprecatedAPIs,
709
+ UnknownOwner
710
+ )();
688
711
  var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
689
712
  var didWarnAboutMaps = !1,
690
713
  userProvidedKeyEscapeRegex = /\/+/g,
@@ -736,7 +759,7 @@
736
759
  return resolveDispatcher().useMemoCache(size);
737
760
  }
738
761
  });
739
- exports.Children = {
762
+ var fnName = {
740
763
  map: mapChildren,
741
764
  forEach: function (children, forEachFunc, forEachContext) {
742
765
  mapChildren(
@@ -769,6 +792,8 @@
769
792
  return children;
770
793
  }
771
794
  };
795
+ exports.Activity = REACT_ACTIVITY_TYPE;
796
+ exports.Children = fnName;
772
797
  exports.Component = Component;
773
798
  exports.Fragment = REACT_FRAGMENT_TYPE;
774
799
  exports.Profiler = REACT_PROFILER_TYPE;
@@ -894,6 +919,9 @@
894
919
  return fn.apply(null, arguments);
895
920
  };
896
921
  };
922
+ exports.cacheSignal = function () {
923
+ return null;
924
+ };
897
925
  exports.captureOwnerStack = function () {
898
926
  var getCurrentStack = ReactSharedInternals.getCurrentStack;
899
927
  return null === getCurrentStack ? null : getCurrentStack();
@@ -946,16 +974,13 @@
946
974
  props = ReactElement(
947
975
  element.type,
948
976
  key,
949
- void 0,
950
- void 0,
951
- owner,
952
977
  props,
978
+ owner,
953
979
  element._debugStack,
954
980
  element._debugTask
955
981
  );
956
982
  for (key = 2; key < arguments.length; key++)
957
- (owner = arguments[key]),
958
- isValidElement(owner) && owner._store && (owner._store.validated = 1);
983
+ validateChildKeys(arguments[key]);
959
984
  return props;
960
985
  };
961
986
  exports.createContext = function (defaultValue) {
@@ -977,12 +1002,10 @@
977
1002
  return defaultValue;
978
1003
  };
979
1004
  exports.createElement = function (type, config, children) {
980
- for (var i = 2; i < arguments.length; i++) {
981
- var node = arguments[i];
982
- isValidElement(node) && node._store && (node._store.validated = 1);
983
- }
1005
+ for (var i = 2; i < arguments.length; i++)
1006
+ validateChildKeys(arguments[i]);
984
1007
  i = {};
985
- node = null;
1008
+ var key = null;
986
1009
  if (null != config)
987
1010
  for (propName in (didWarnAboutOldJSXRuntime ||
988
1011
  !("__self" in config) ||
@@ -992,7 +1015,7 @@
992
1015
  "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
993
1016
  )),
994
1017
  hasValidKey(config) &&
995
- (checkKeyStringCoercion(config.key), (node = "" + config.key)),
1018
+ (checkKeyStringCoercion(config.key), (key = "" + config.key)),
996
1019
  config))
997
1020
  hasOwnProperty.call(config, propName) &&
998
1021
  "key" !== propName &&
@@ -1014,7 +1037,7 @@
1014
1037
  if (type && type.defaultProps)
1015
1038
  for (propName in ((childrenLength = type.defaultProps), childrenLength))
1016
1039
  void 0 === i[propName] && (i[propName] = childrenLength[propName]);
1017
- node &&
1040
+ key &&
1018
1041
  defineKeyPropWarningGetter(
1019
1042
  i,
1020
1043
  "function" === typeof type
@@ -1024,11 +1047,9 @@
1024
1047
  var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1025
1048
  return ReactElement(
1026
1049
  type,
1027
- node,
1028
- void 0,
1029
- void 0,
1030
- getOwner(),
1050
+ key,
1031
1051
  i,
1052
+ getOwner(),
1032
1053
  propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1033
1054
  propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1034
1055
  );
@@ -1081,11 +1102,24 @@
1081
1102
  };
1082
1103
  exports.isValidElement = isValidElement;
1083
1104
  exports.lazy = function (ctor) {
1084
- return {
1085
- $$typeof: REACT_LAZY_TYPE,
1086
- _payload: { _status: -1, _result: ctor },
1087
- _init: lazyInitializer
1088
- };
1105
+ ctor = { _status: -1, _result: ctor };
1106
+ var lazyType = {
1107
+ $$typeof: REACT_LAZY_TYPE,
1108
+ _payload: ctor,
1109
+ _init: lazyInitializer
1110
+ },
1111
+ ioInfo = {
1112
+ name: "lazy",
1113
+ start: -1,
1114
+ end: -1,
1115
+ value: null,
1116
+ owner: null,
1117
+ debugStack: Error("react-stack-top-frame"),
1118
+ debugTask: console.createTask ? console.createTask("lazy()") : null
1119
+ };
1120
+ ctor._ioInfo = ioInfo;
1121
+ lazyType._debugInfo = [{ awaited: ioInfo }];
1122
+ return lazyType;
1089
1123
  };
1090
1124
  exports.memo = function (type, compare) {
1091
1125
  null == type &&
@@ -1118,8 +1152,8 @@
1118
1152
  exports.startTransition = function (scope) {
1119
1153
  var prevTransition = ReactSharedInternals.T,
1120
1154
  currentTransition = {};
1121
- ReactSharedInternals.T = currentTransition;
1122
1155
  currentTransition._updatedFibers = new Set();
1156
+ ReactSharedInternals.T = currentTransition;
1123
1157
  try {
1124
1158
  var returnValue = scope(),
1125
1159
  onStartTransitionFinish = ReactSharedInternals.S;
@@ -1128,7 +1162,9 @@
1128
1162
  "object" === typeof returnValue &&
1129
1163
  null !== returnValue &&
1130
1164
  "function" === typeof returnValue.then &&
1131
- returnValue.then(noop, reportGlobalError);
1165
+ (ReactSharedInternals.asyncTransitions++,
1166
+ returnValue.then(releaseAsyncTransition, releaseAsyncTransition),
1167
+ returnValue.then(noop, reportGlobalError));
1132
1168
  } catch (error) {
1133
1169
  reportGlobalError(error);
1134
1170
  } finally {
@@ -1140,6 +1176,14 @@
1140
1176
  console.warn(
1141
1177
  "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
1142
1178
  )),
1179
+ null !== prevTransition &&
1180
+ null !== currentTransition.types &&
1181
+ (null !== prevTransition.types &&
1182
+ prevTransition.types !== currentTransition.types &&
1183
+ console.error(
1184
+ "We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."
1185
+ ),
1186
+ (prevTransition.types = currentTransition.types)),
1143
1187
  (ReactSharedInternals.T = prevTransition);
1144
1188
  }
1145
1189
  };
@@ -1173,17 +1217,15 @@
1173
1217
  exports.useDeferredValue = function (value, initialValue) {
1174
1218
  return resolveDispatcher().useDeferredValue(value, initialValue);
1175
1219
  };
1176
- exports.useEffect = function (create, createDeps, update) {
1220
+ exports.useEffect = function (create, deps) {
1177
1221
  null == create &&
1178
1222
  console.warn(
1179
1223
  "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1180
1224
  );
1181
- var dispatcher = resolveDispatcher();
1182
- if ("function" === typeof update)
1183
- throw Error(
1184
- "useEffect CRUD overload is not enabled in this build of React."
1185
- );
1186
- return dispatcher.useEffect(create, createDeps);
1225
+ return resolveDispatcher().useEffect(create, deps);
1226
+ };
1227
+ exports.useEffectEvent = function (callback) {
1228
+ return resolveDispatcher().useEffectEvent(callback);
1187
1229
  };
1188
1230
  exports.useId = function () {
1189
1231
  return resolveDispatcher().useId();
@@ -1234,7 +1276,7 @@
1234
1276
  exports.useTransition = function () {
1235
1277
  return resolveDispatcher().useTransition();
1236
1278
  };
1237
- exports.version = "19.1.0";
1279
+ exports.version = "19.2.4";
1238
1280
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1239
1281
  "function" ===
1240
1282
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&