react-dom 16.11.0 → 16.12.0

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.
Files changed (42) hide show
  1. package/build-info.json +4 -4
  2. package/cjs/react-dom-server.browser.development.js +7 -9
  3. package/cjs/react-dom-server.browser.production.min.js +2 -2
  4. package/cjs/react-dom-server.node.development.js +7 -9
  5. package/cjs/react-dom-server.node.production.min.js +2 -2
  6. package/cjs/react-dom-test-utils.development.js +10 -8
  7. package/cjs/react-dom-test-utils.production.min.js +1 -1
  8. package/cjs/react-dom-unstable-fizz.browser.development.js +9 -5
  9. package/cjs/react-dom-unstable-fizz.browser.production.min.js +3 -3
  10. package/cjs/react-dom-unstable-fizz.node.development.js +23 -10
  11. package/cjs/react-dom-unstable-fizz.node.production.min.js +4 -3
  12. package/cjs/react-dom-unstable-flight-client.development.js +357 -0
  13. package/cjs/react-dom-unstable-flight-client.production.min.js +16 -0
  14. package/cjs/react-dom-unstable-flight-server.browser.development.js +392 -0
  15. package/cjs/react-dom-unstable-flight-server.browser.production.min.js +16 -0
  16. package/cjs/react-dom-unstable-flight-server.node.development.js +415 -0
  17. package/cjs/react-dom-unstable-flight-server.node.production.min.js +16 -0
  18. package/cjs/react-dom-unstable-native-dependencies.development.js +1 -1
  19. package/cjs/react-dom-unstable-native-dependencies.production.min.js +1 -1
  20. package/cjs/react-dom.development.js +324 -256
  21. package/cjs/react-dom.production.min.js +31 -31
  22. package/cjs/react-dom.profiling.min.js +31 -31
  23. package/package.json +8 -3
  24. package/umd/react-dom-server.browser.development.js +7 -9
  25. package/umd/react-dom-server.browser.production.min.js +2 -2
  26. package/umd/react-dom-test-utils.development.js +10 -8
  27. package/umd/react-dom-test-utils.production.min.js +1 -1
  28. package/umd/react-dom-unstable-fizz.browser.development.js +9 -5
  29. package/umd/react-dom-unstable-fizz.browser.production.min.js +3 -3
  30. package/umd/react-dom-unstable-flight-client.development.js +357 -0
  31. package/umd/react-dom-unstable-flight-client.production.min.js +14 -0
  32. package/umd/react-dom-unstable-flight-server.browser.development.js +390 -0
  33. package/umd/react-dom-unstable-flight-server.browser.production.min.js +14 -0
  34. package/umd/react-dom-unstable-native-dependencies.development.js +1 -1
  35. package/umd/react-dom-unstable-native-dependencies.production.min.js +1 -1
  36. package/umd/react-dom.development.js +324 -256
  37. package/umd/react-dom.production.min.js +191 -190
  38. package/umd/react-dom.profiling.min.js +204 -204
  39. package/unstable-flight-client.js +7 -0
  40. package/unstable-flight-server.browser.js +7 -0
  41. package/unstable-flight-server.js +3 -0
  42. package/unstable-flight-server.node.js +7 -0
@@ -1,4 +1,4 @@
1
- /** @license React v16.11.0
1
+ /** @license React v16.12.0
2
2
  * react-dom.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -1289,12 +1289,8 @@ function restoreStateIfNeeded() {
1289
1289
  }
1290
1290
  }
1291
1291
 
1292
- var enableUserTimingAPI = true; // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
1293
-
1294
- var debugRenderPhaseSideEffects = false; // In some cases, StrictMode should also double-render lifecycles.
1295
- // This can be confusing for tests though,
1296
- // And it can be bad for performance in production.
1297
- // This feature flag can be used to control the behavior:
1292
+ var enableUserTimingAPI = true; // Helps identify side effects in render-phase lifecycle hooks and setState
1293
+ // reducers by double invoking them in Strict Mode.
1298
1294
 
1299
1295
  var debugRenderPhaseSideEffectsForStrictMode = true; // To preserve the "Pause on caught exceptions" behavior of the debugger, we
1300
1296
  // replay the begin phase of a failed component inside invokeGuardedCallback.
@@ -1330,7 +1326,7 @@ var enableFundamentalAPI = false; // Experimental Scope support.
1330
1326
  var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
1331
1327
 
1332
1328
  // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
1333
- // Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
1329
+ // Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
1334
1330
 
1335
1331
  var warnAboutUnmockedScheduler = false; // For tests, we flush suspense fallbacks in an act scope;
1336
1332
  // *except* in some of our own tests, where we test incremental loading states.
@@ -1349,7 +1345,7 @@ var warnAboutDefaultPropsOnFunctionComponents = false;
1349
1345
  var warnAboutStringRefs = false;
1350
1346
  var disableLegacyContext = false;
1351
1347
  var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
1352
- var enableTrustedTypesIntegration = false;
1348
+ var enableTrustedTypesIntegration = false; // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
1353
1349
 
1354
1350
  // the renderer. Such as when we're dispatching events or if third party
1355
1351
  // libraries need to call batchedUpdates. Eventually, this API will go away when
@@ -3900,7 +3896,7 @@ var ShouldCapture =
3900
3896
  /* */
3901
3897
  4096;
3902
3898
 
3903
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
3899
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
3904
3900
  function getNearestMountedFiber(fiber) {
3905
3901
  var node = fiber;
3906
3902
  var nearestMounted = fiber;
@@ -3965,7 +3961,7 @@ function isFiberMounted(fiber) {
3965
3961
  }
3966
3962
  function isMounted(component) {
3967
3963
  {
3968
- var owner = ReactCurrentOwner$1.current;
3964
+ var owner = ReactCurrentOwner.current;
3969
3965
 
3970
3966
  if (owner !== null && owner.tag === ClassComponent) {
3971
3967
  var ownerFiber = owner;
@@ -9719,14 +9715,31 @@ function insertInContainerBefore(container, child, beforeChild) {
9719
9715
  } else {
9720
9716
  container.insertBefore(child, beforeChild);
9721
9717
  }
9718
+ } // This is a specific event for the React Flare
9719
+ // event system, so event responders can act
9720
+ // accordingly to a DOM node being unmounted that
9721
+ // previously had active document focus.
9722
+
9723
+ function dispatchDetachedVisibleNodeEvent(child) {
9724
+ if (enableFlareAPI && selectionInformation && child === selectionInformation.focusedElem) {
9725
+ var targetFiber = getClosestInstanceFromNode(child); // Simlulate a blur event to the React Flare responder system.
9726
+
9727
+ dispatchEventForResponderEventSystem('detachedvisiblenode', targetFiber, {
9728
+ target: child,
9729
+ timeStamp: Date.now()
9730
+ }, child, RESPONDER_EVENT_SYSTEM | IS_PASSIVE);
9731
+ }
9722
9732
  }
9733
+
9723
9734
  function removeChild(parentInstance, child) {
9735
+ dispatchDetachedVisibleNodeEvent(child);
9724
9736
  parentInstance.removeChild(child);
9725
9737
  }
9726
9738
  function removeChildFromContainer(container, child) {
9727
9739
  if (container.nodeType === COMMENT_NODE) {
9728
9740
  container.parentNode.removeChild(child);
9729
9741
  } else {
9742
+ dispatchDetachedVisibleNodeEvent(child);
9730
9743
  container.removeChild(child);
9731
9744
  }
9732
9745
  }
@@ -10118,11 +10131,17 @@ function precacheFiberNode(hostInst, node) {
10118
10131
  }
10119
10132
  function markContainerAsRoot(hostRoot, node) {
10120
10133
  node[internalContainerInstanceKey] = hostRoot;
10134
+ }
10135
+ function unmarkContainerAsRoot(node) {
10136
+ node[internalContainerInstanceKey] = null;
10137
+ }
10138
+ function isContainerMarkedAsRoot(node) {
10139
+ return !!node[internalContainerInstanceKey];
10121
10140
  } // Given a DOM node, return the closest HostComponent or HostText fiber ancestor.
10122
10141
  // If the target node is part of a hydrated or not yet rendered subtree, then
10123
10142
  // this may also return a SuspenseComponent or HostRoot to indicate that.
10124
10143
  // Conceptually the HostRoot fiber is a child of the Container node. So if you
10125
- // pass the Container node as the targetNode, you wiill not actually get the
10144
+ // pass the Container node as the targetNode, you will not actually get the
10126
10145
  // HostRoot back. To get to the HostRoot, you need to pass a child of it.
10127
10146
  // The same thing applies to Suspense boundaries.
10128
10147
 
@@ -12148,7 +12167,7 @@ function findCurrentUnmaskedContext(fiber) {
12148
12167
  }
12149
12168
 
12150
12169
  var LegacyRoot = 0;
12151
- var BatchedRoot = 1;
12170
+ var BlockingRoot = 1;
12152
12171
  var ConcurrentRoot = 2;
12153
12172
 
12154
12173
  var ReactInternals$2 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
@@ -12344,10 +12363,10 @@ function flushSyncCallbackQueueImpl() {
12344
12363
  }
12345
12364
 
12346
12365
  var NoMode = 0;
12347
- var StrictMode = 1; // TODO: Remove BatchedMode and ConcurrentMode by reading from the root
12366
+ var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
12348
12367
  // tag instead
12349
12368
 
12350
- var BatchedMode = 2;
12369
+ var BlockingMode = 2;
12351
12370
  var ConcurrentMode = 4;
12352
12371
  var ProfileMode = 8;
12353
12372
 
@@ -13729,7 +13748,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
13729
13748
  {
13730
13749
  enterDisallowedContextReadInDEV();
13731
13750
 
13732
- if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
13751
+ if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
13733
13752
  payload.call(instance, prevState, nextProps);
13734
13753
  }
13735
13754
  }
@@ -13763,7 +13782,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
13763
13782
  {
13764
13783
  enterDisallowedContextReadInDEV();
13765
13784
 
13766
- if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
13785
+ if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
13767
13786
  _payload.call(instance, prevState, nextProps);
13768
13787
  }
13769
13788
  }
@@ -14076,7 +14095,7 @@ function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromPro
14076
14095
  var prevState = workInProgress.memoizedState;
14077
14096
 
14078
14097
  {
14079
- if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
14098
+ if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
14080
14099
  // Invoke the function an extra time to help detect side-effects.
14081
14100
  getDerivedStateFromProps(nextProps, prevState);
14082
14101
  }
@@ -14323,7 +14342,7 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
14323
14342
 
14324
14343
 
14325
14344
  {
14326
- if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
14345
+ if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
14327
14346
  new ctor(props, context); // eslint-disable-line no-new
14328
14347
  }
14329
14348
  }
@@ -18269,7 +18288,7 @@ function updateForwardRef(current$$1, workInProgress, Component, nextProps, rend
18269
18288
  setCurrentPhase('render');
18270
18289
  nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
18271
18290
 
18272
- if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
18291
+ if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
18273
18292
  // Only double-render components with Hooks
18274
18293
  if (workInProgress.memoizedState !== null) {
18275
18294
  nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
@@ -18473,7 +18492,7 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
18473
18492
  setCurrentPhase('render');
18474
18493
  nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
18475
18494
 
18476
- if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
18495
+ if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
18477
18496
  // Only double-render components with Hooks
18478
18497
  if (workInProgress.memoizedState !== null) {
18479
18498
  nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
@@ -18596,7 +18615,7 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
18596
18615
  setCurrentPhase('render');
18597
18616
  nextChildren = instance.render();
18598
18617
 
18599
- if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
18618
+ if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
18600
18619
  instance.render();
18601
18620
  }
18602
18621
 
@@ -18969,7 +18988,7 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
18969
18988
  warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(Component) || 'Unknown');
18970
18989
  }
18971
18990
 
18972
- if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
18991
+ if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
18973
18992
  // Only double-render components with Hooks
18974
18993
  if (workInProgress.memoizedState !== null) {
18975
18994
  value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
@@ -19145,8 +19164,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
19145
19164
  var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
19146
19165
  primaryChildFragment.return = workInProgress;
19147
19166
 
19148
- if ((workInProgress.mode & BatchedMode) === NoMode) {
19149
- // Outside of batched mode, we commit the effects from the
19167
+ if ((workInProgress.mode & BlockingMode) === NoMode) {
19168
+ // Outside of blocking mode, we commit the effects from the
19150
19169
  // partially completed, timed-out tree, too.
19151
19170
  var progressedState = workInProgress.memoizedState;
19152
19171
  var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
@@ -19209,8 +19228,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
19209
19228
 
19210
19229
  _primaryChildFragment.child = null;
19211
19230
 
19212
- if ((workInProgress.mode & BatchedMode) === NoMode) {
19213
- // Outside of batched mode, we commit the effects from the
19231
+ if ((workInProgress.mode & BlockingMode) === NoMode) {
19232
+ // Outside of blocking mode, we commit the effects from the
19214
19233
  // partially completed, timed-out tree, too.
19215
19234
  var _progressedChild = _primaryChildFragment.child = workInProgress.child;
19216
19235
 
@@ -19269,8 +19288,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
19269
19288
 
19270
19289
  _primaryChildFragment2.return = workInProgress;
19271
19290
 
19272
- if ((workInProgress.mode & BatchedMode) === NoMode) {
19273
- // Outside of batched mode, we commit the effects from the
19291
+ if ((workInProgress.mode & BlockingMode) === NoMode) {
19292
+ // Outside of blocking mode, we commit the effects from the
19274
19293
  // partially completed, timed-out tree, too.
19275
19294
  var _progressedState = workInProgress.memoizedState;
19276
19295
 
@@ -19354,8 +19373,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
19354
19373
  // primaryChildFragment.effectTag |= Placement;
19355
19374
 
19356
19375
 
19357
- if ((workInProgress.mode & BatchedMode) === NoMode) {
19358
- // Outside of batched mode, we commit the effects from the
19376
+ if ((workInProgress.mode & BlockingMode) === NoMode) {
19377
+ // Outside of blocking mode, we commit the effects from the
19359
19378
  // partially completed, timed-out tree, too.
19360
19379
  var _progressedState2 = workInProgress.memoizedState;
19361
19380
 
@@ -19424,9 +19443,9 @@ function retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, rend
19424
19443
  function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, renderExpirationTime) {
19425
19444
  // During the first pass, we'll bail out and not drill into the children.
19426
19445
  // Instead, we'll leave the content in place and try to hydrate it later.
19427
- if ((workInProgress.mode & BatchedMode) === NoMode) {
19446
+ if ((workInProgress.mode & BlockingMode) === NoMode) {
19428
19447
  {
19429
- warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.createSyncRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.');
19448
+ warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.createBlockingRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.');
19430
19449
  }
19431
19450
 
19432
19451
  workInProgress.expirationTime = Sync;
@@ -19468,7 +19487,7 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
19468
19487
  // but after we've already committed once.
19469
19488
  warnIfHydrating();
19470
19489
 
19471
- if ((workInProgress.mode & BatchedMode) === NoMode) {
19490
+ if ((workInProgress.mode & BlockingMode) === NoMode) {
19472
19491
  return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
19473
19492
  }
19474
19493
 
@@ -19790,8 +19809,8 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
19790
19809
 
19791
19810
  pushSuspenseContext(workInProgress, suspenseContext);
19792
19811
 
19793
- if ((workInProgress.mode & BatchedMode) === NoMode) {
19794
- // Outside of batched mode, SuspenseList doesn't work so we just
19812
+ if ((workInProgress.mode & BlockingMode) === NoMode) {
19813
+ // Outside of blocking mode, SuspenseList doesn't work so we just
19795
19814
  // use make it a noop by treating it as the default revealOrder.
19796
19815
  workInProgress.memoizedState = null;
19797
19816
  } else {
@@ -20163,7 +20182,12 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
20163
20182
 
20164
20183
  case Profiler:
20165
20184
  if (enableProfilerTimer) {
20166
- workInProgress.effectTag |= Update;
20185
+ // Profiler should only call onRender when one of its descendants actually rendered.
20186
+ var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
20187
+
20188
+ if (hasChildWork) {
20189
+ workInProgress.effectTag |= Update;
20190
+ }
20167
20191
  }
20168
20192
 
20169
20193
  break;
@@ -20219,10 +20243,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
20219
20243
  case SuspenseListComponent:
20220
20244
  {
20221
20245
  var didSuspendBefore = (current$$1.effectTag & DidCapture) !== NoEffect;
20222
- var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
20246
+
20247
+ var _hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
20223
20248
 
20224
20249
  if (didSuspendBefore) {
20225
- if (hasChildWork) {
20250
+ if (_hasChildWork) {
20226
20251
  // If something was in fallback state last time, and we have all the
20227
20252
  // same children then we're still in progressive loading state.
20228
20253
  // Something might get unblocked by state updates or retries in the
@@ -20251,7 +20276,7 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
20251
20276
 
20252
20277
  pushSuspenseContext(workInProgress, suspenseStackCursor.current);
20253
20278
 
20254
- if (hasChildWork) {
20279
+ if (_hasChildWork) {
20255
20280
  break;
20256
20281
  } else {
20257
20282
  // If none of the children had any work, that means that none of
@@ -20434,14 +20459,19 @@ function getSuspenseFallbackChild(fiber) {
20434
20459
  return fiber.child.sibling.child;
20435
20460
  }
20436
20461
 
20462
+ var emptyObject$1 = {};
20463
+
20437
20464
  function collectScopedNodes(node, fn, scopedNodes) {
20438
20465
  if (enableScopeAPI) {
20439
20466
  if (node.tag === HostComponent) {
20440
20467
  var _type = node.type,
20441
- memoizedProps = node.memoizedProps;
20468
+ memoizedProps = node.memoizedProps,
20469
+ stateNode = node.stateNode;
20470
+
20471
+ var _instance = getPublicInstance(stateNode);
20442
20472
 
20443
- if (fn(_type, memoizedProps) === true) {
20444
- scopedNodes.push(getPublicInstance(node.stateNode));
20473
+ if (_instance !== null && fn(_type, memoizedProps || emptyObject$1, _instance) === true) {
20474
+ scopedNodes.push(_instance);
20445
20475
  }
20446
20476
  }
20447
20477
 
@@ -20461,10 +20491,13 @@ function collectFirstScopedNode(node, fn) {
20461
20491
  if (enableScopeAPI) {
20462
20492
  if (node.tag === HostComponent) {
20463
20493
  var _type2 = node.type,
20464
- memoizedProps = node.memoizedProps;
20494
+ memoizedProps = node.memoizedProps,
20495
+ stateNode = node.stateNode;
20496
+
20497
+ var _instance2 = getPublicInstance(stateNode);
20465
20498
 
20466
- if (fn(_type2, memoizedProps) === true) {
20467
- return getPublicInstance(node.stateNode);
20499
+ if (_instance2 !== null && fn(_type2, memoizedProps, _instance2) === true) {
20500
+ return _instance2;
20468
20501
  }
20469
20502
  }
20470
20503
 
@@ -21348,12 +21381,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
21348
21381
  }
21349
21382
 
21350
21383
  if (nextDidTimeout && !prevDidTimeout) {
21351
- // If this subtreee is running in batched mode we can suspend,
21384
+ // If this subtreee is running in blocking mode we can suspend,
21352
21385
  // otherwise we won't suspend.
21353
21386
  // TODO: This will still suspend a synchronous tree if anything
21354
21387
  // in the concurrent tree already suspended during this render.
21355
21388
  // This is a known bug.
21356
- if ((workInProgress.mode & BatchedMode) !== NoMode) {
21389
+ if ((workInProgress.mode & BlockingMode) !== NoMode) {
21357
21390
  // TODO: Move this back to throwException because this is too late
21358
21391
  // if this is a large tree which is common for initial loads. We
21359
21392
  // don't know if we should restart a render or not until we get
@@ -21542,9 +21575,9 @@ function completeWork(current, workInProgress, renderExpirationTime) {
21542
21575
 
21543
21576
  cutOffTailIfNeeded(renderState, true); // This might have been modified.
21544
21577
 
21545
- if (renderState.tail === null && renderState.tailMode === 'hidden') {
21578
+ if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate) {
21546
21579
  // We need to delete the row we just rendered.
21547
- // Reset the effect list to what it w as before we rendered this
21580
+ // Reset the effect list to what it was before we rendered this
21548
21581
  // child. The nested children have already appended themselves.
21549
21582
  var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
21550
21583
 
@@ -23460,17 +23493,17 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
23460
23493
  _workInProgress.updateQueue = updateQueue;
23461
23494
  } else {
23462
23495
  thenables.add(thenable);
23463
- } // If the boundary is outside of batched mode, we should *not*
23496
+ } // If the boundary is outside of blocking mode, we should *not*
23464
23497
  // suspend the commit. Pretend as if the suspended component rendered
23465
23498
  // null and keep rendering. In the commit phase, we'll schedule a
23466
23499
  // subsequent synchronous update to re-render the Suspense.
23467
23500
  //
23468
23501
  // Note: It doesn't matter whether the component that suspended was
23469
- // inside a batched mode tree. If the Suspense is outside of it, we
23502
+ // inside a blocking mode tree. If the Suspense is outside of it, we
23470
23503
  // should *not* suspend the commit.
23471
23504
 
23472
23505
 
23473
- if ((_workInProgress.mode & BatchedMode) === NoMode) {
23506
+ if ((_workInProgress.mode & BlockingMode) === NoMode) {
23474
23507
  _workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete.
23475
23508
  // But we shouldn't call any lifecycle methods or callbacks. Remove
23476
23509
  // all lifecycle effect tags.
@@ -23717,7 +23750,7 @@ function getCurrentTime() {
23717
23750
  function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
23718
23751
  var mode = fiber.mode;
23719
23752
 
23720
- if ((mode & BatchedMode) === NoMode) {
23753
+ if ((mode & BlockingMode) === NoMode) {
23721
23754
  return Sync;
23722
23755
  }
23723
23756
 
@@ -23818,7 +23851,7 @@ function scheduleUpdateOnFiber(fiber, expirationTime) {
23818
23851
  // a batch. This is intentionally inside scheduleUpdateOnFiber instead of
23819
23852
  // scheduleCallbackForFiber to preserve the ability to schedule a callback
23820
23853
  // without immediately flushing it. We only do this for user-initiated
23821
- // updates, to preserve historical behavior of sync mode.
23854
+ // updates, to preserve historical behavior of legacy mode.
23822
23855
  flushSyncCallbackQueue();
23823
23856
  }
23824
23857
  }
@@ -25037,7 +25070,16 @@ function commitRoot(root) {
25037
25070
  }
25038
25071
 
25039
25072
  function commitRootImpl(root, renderPriorityLevel) {
25040
- flushPassiveEffects();
25073
+ do {
25074
+ // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
25075
+ // means `flushPassiveEffects` will sometimes result in additional
25076
+ // passive effects. So we need to keep flushing in a loop until there are
25077
+ // no more pending effects.
25078
+ // TODO: Might be better if `flushPassiveEffects` did not automatically
25079
+ // flush synchronous work at the end, to avoid factoring hazards like this.
25080
+ flushPassiveEffects();
25081
+ } while (rootWithPendingPassiveEffects !== null);
25082
+
25041
25083
  flushRenderPhaseStrictModeWarningsInDEV();
25042
25084
 
25043
25085
  if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
@@ -25964,7 +26006,7 @@ var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent
25964
26006
  function warnIfUnmockedScheduler(fiber) {
25965
26007
  {
25966
26008
  if (didWarnAboutUnmockedScheduler === false && unstable_flushAllWithoutAsserting === undefined) {
25967
- if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {
26009
+ if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
25968
26010
  didWarnAboutUnmockedScheduler = true;
25969
26011
  warningWithoutStack$1(false, 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
25970
26012
  } else if (warnAboutUnmockedScheduler === true) {
@@ -26607,9 +26649,9 @@ function createHostRootFiber(tag) {
26607
26649
  var mode;
26608
26650
 
26609
26651
  if (tag === ConcurrentRoot) {
26610
- mode = ConcurrentMode | BatchedMode | StrictMode;
26611
- } else if (tag === BatchedRoot) {
26612
- mode = BatchedMode | StrictMode;
26652
+ mode = ConcurrentMode | BlockingMode | StrictMode;
26653
+ } else if (tag === BlockingRoot) {
26654
+ mode = BlockingMode | StrictMode;
26613
26655
  } else {
26614
26656
  mode = NoMode;
26615
26657
  }
@@ -26651,7 +26693,7 @@ key, pendingProps, owner, mode, expirationTime) {
26651
26693
 
26652
26694
  case REACT_CONCURRENT_MODE_TYPE:
26653
26695
  fiberTag = Mode;
26654
- mode |= ConcurrentMode | BatchedMode | StrictMode;
26696
+ mode |= ConcurrentMode | BlockingMode | StrictMode;
26655
26697
  break;
26656
26698
 
26657
26699
  case REACT_STRICT_MODE_TYPE:
@@ -27434,63 +27476,44 @@ function injectIntoDevTools(devToolsConfig) {
27434
27476
  // This file intentionally does *not* have the Flow annotation.
27435
27477
  // Don't add it. See `./inline-typed.js` for an explanation.
27436
27478
 
27437
- function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
27438
- implementation) {
27439
- var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
27440
- return {
27441
- // This tag allow us to uniquely identify this as a React Portal
27442
- $$typeof: REACT_PORTAL_TYPE,
27443
- key: key == null ? null : '' + key,
27444
- children: children,
27445
- containerInfo: containerInfo,
27446
- implementation: implementation
27447
- };
27479
+ // TODO: This type is shared between the reconciler and ReactDOM, but will
27480
+ // eventually be lifted out to the renderer.
27481
+ function ReactDOMRoot(container, options) {
27482
+ this._internalRoot = createRootImpl(container, ConcurrentRoot, options);
27448
27483
  }
27449
27484
 
27450
- // TODO: this is special because it gets imported during build.
27451
-
27452
- var ReactVersion = '16.11.0';
27485
+ function ReactDOMBlockingRoot(container, tag, options) {
27486
+ this._internalRoot = createRootImpl(container, tag, options);
27487
+ }
27453
27488
 
27454
- // TODO: This type is shared between the reconciler and ReactDOM, but will
27455
- // eventually be lifted out to the renderer.
27456
- setAttemptSynchronousHydration(attemptSynchronousHydration$1);
27457
- setAttemptUserBlockingHydration(attemptUserBlockingHydration$1);
27458
- setAttemptContinuousHydration(attemptContinuousHydration$1);
27459
- setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1);
27460
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
27461
- var topLevelUpdateWarnings;
27462
- var warnOnInvalidCallback;
27463
- var didWarnAboutUnstableCreatePortal = false;
27489
+ ReactDOMRoot.prototype.render = ReactDOMBlockingRoot.prototype.render = function (children, callback) {
27490
+ var root = this._internalRoot;
27491
+ var cb = callback === undefined ? null : callback;
27464
27492
 
27465
- {
27466
- if (typeof Map !== 'function' || // $FlowIssue Flow incorrectly thinks Map has no prototype
27467
- Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowIssue Flow incorrectly thinks Set has no prototype
27468
- Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
27469
- warningWithoutStack$1(false, 'React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
27493
+ {
27494
+ warnOnInvalidCallback(cb, 'render');
27470
27495
  }
27471
27496
 
27472
- topLevelUpdateWarnings = function (container) {
27473
- if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
27474
- var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
27497
+ updateContainer(children, root, null, cb);
27498
+ };
27475
27499
 
27476
- if (hostInstance) {
27477
- !(hostInstance.parentNode === container) ? warningWithoutStack$1(false, 'render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.') : void 0;
27478
- }
27479
- }
27500
+ ReactDOMRoot.prototype.unmount = ReactDOMBlockingRoot.prototype.unmount = function (callback) {
27501
+ var root = this._internalRoot;
27502
+ var cb = callback === undefined ? null : callback;
27480
27503
 
27481
- var isRootRenderedBySomeReact = !!container._reactRootContainer;
27482
- var rootEl = getReactRootElementInContainer(container);
27483
- var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
27484
- !(!hasNonRootReactChild || isRootRenderedBySomeReact) ? warningWithoutStack$1(false, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
27485
- !(container.nodeType !== ELEMENT_NODE || !container.tagName || container.tagName.toUpperCase() !== 'BODY') ? warningWithoutStack$1(false, 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
27486
- };
27504
+ {
27505
+ warnOnInvalidCallback(cb, 'render');
27506
+ }
27487
27507
 
27488
- warnOnInvalidCallback = function (callback, callerName) {
27489
- !(callback === null || typeof callback === 'function') ? warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback) : void 0;
27490
- };
27491
- }
27508
+ var container = root.containerInfo;
27509
+ updateContainer(null, root, null, function () {
27510
+ unmarkContainerAsRoot(container);
27492
27511
 
27493
- setRestoreImplementation(restoreControlledState$$1);
27512
+ if (cb !== null) {
27513
+ cb();
27514
+ }
27515
+ });
27516
+ };
27494
27517
 
27495
27518
  function createRootImpl(container, tag, options) {
27496
27519
  // Tag is either LegacyRoot or Concurrent Root
@@ -27507,46 +27530,70 @@ function createRootImpl(container, tag, options) {
27507
27530
  return root;
27508
27531
  }
27509
27532
 
27510
- function ReactSyncRoot(container, tag, options) {
27511
- this._internalRoot = createRootImpl(container, tag, options);
27512
- }
27533
+ function createRoot(container, options) {
27534
+ if (!isValidContainer(container)) {
27535
+ {
27536
+ throw Error("createRoot(...): Target container is not a DOM element.");
27537
+ }
27538
+ }
27513
27539
 
27514
- function ReactRoot(container, options) {
27515
- this._internalRoot = createRootImpl(container, ConcurrentRoot, options);
27540
+ warnIfReactDOMContainerInDEV(container);
27541
+ return new ReactDOMRoot(container, options);
27516
27542
  }
27543
+ function createBlockingRoot(container, options) {
27544
+ if (!isValidContainer(container)) {
27545
+ {
27546
+ throw Error("createRoot(...): Target container is not a DOM element.");
27547
+ }
27548
+ }
27517
27549
 
27518
- ReactRoot.prototype.render = ReactSyncRoot.prototype.render = function (children, callback) {
27519
- var root = this._internalRoot;
27520
- callback = callback === undefined ? null : callback;
27521
-
27550
+ warnIfReactDOMContainerInDEV(container);
27551
+ return new ReactDOMBlockingRoot(container, BlockingRoot, options);
27552
+ }
27553
+ function createLegacyRoot(container, options) {
27554
+ return new ReactDOMBlockingRoot(container, LegacyRoot, options);
27555
+ }
27556
+ function isValidContainer(node) {
27557
+ return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable '));
27558
+ }
27559
+ function warnOnInvalidCallback(callback, callerName) {
27522
27560
  {
27523
- warnOnInvalidCallback(callback, 'render');
27561
+ !(callback === null || typeof callback === 'function') ? warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback) : void 0;
27524
27562
  }
27563
+ }
27525
27564
 
27526
- updateContainer(children, root, null, callback);
27527
- };
27528
-
27529
- ReactRoot.prototype.unmount = ReactSyncRoot.prototype.unmount = function (callback) {
27530
- var root = this._internalRoot;
27531
- callback = callback === undefined ? null : callback;
27532
-
27565
+ function warnIfReactDOMContainerInDEV(container) {
27533
27566
  {
27534
- warnOnInvalidCallback(callback, 'render');
27567
+ if (isContainerMarkedAsRoot(container)) {
27568
+ if (container._reactRootContainer) {
27569
+ warningWithoutStack$1(false, 'You are calling ReactDOM.createRoot() on a container that was previously ' + 'passed to ReactDOM.render(). This is not supported.');
27570
+ } else {
27571
+ warningWithoutStack$1(false, 'You are calling ReactDOM.createRoot() on a container that ' + 'has already been passed to createRoot() before. Instead, call ' + 'root.render() on the existing root instead if you want to update it.');
27572
+ }
27573
+ }
27535
27574
  }
27575
+ }
27536
27576
 
27537
- updateContainer(null, root, null, callback);
27538
- };
27539
- /**
27540
- * True if the supplied DOM node is a valid node element.
27541
- *
27542
- * @param {?DOMElement} node The candidate DOM node.
27543
- * @return {boolean} True if the DOM is a valid DOM node.
27544
- * @internal
27545
- */
27577
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
27578
+ var topLevelUpdateWarnings;
27579
+ var warnedAboutHydrateAPI = false;
27546
27580
 
27581
+ {
27582
+ topLevelUpdateWarnings = function (container) {
27583
+ if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
27584
+ var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
27547
27585
 
27548
- function isValidContainer(node) {
27549
- return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable '));
27586
+ if (hostInstance) {
27587
+ !(hostInstance.parentNode === container) ? warningWithoutStack$1(false, 'render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.') : void 0;
27588
+ }
27589
+ }
27590
+
27591
+ var isRootRenderedBySomeReact = !!container._reactRootContainer;
27592
+ var rootEl = getReactRootElementInContainer(container);
27593
+ var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
27594
+ !(!hasNonRootReactChild || isRootRenderedBySomeReact) ? warningWithoutStack$1(false, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
27595
+ !(container.nodeType !== ELEMENT_NODE || !container.tagName || container.tagName.toUpperCase() !== 'BODY') ? warningWithoutStack$1(false, 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
27596
+ };
27550
27597
  }
27551
27598
 
27552
27599
  function getReactRootElementInContainer(container) {
@@ -27566,9 +27613,6 @@ function shouldHydrateDueToLegacyHeuristic(container) {
27566
27613
  return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
27567
27614
  }
27568
27615
 
27569
- setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1);
27570
- var warnedAboutHydrateAPI = false;
27571
-
27572
27616
  function legacyCreateRootFromDOMContainer(container, forceHydrate) {
27573
27617
  var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container); // First clear any existing content.
27574
27618
 
@@ -27593,10 +27637,9 @@ function legacyCreateRootFromDOMContainer(container, forceHydrate) {
27593
27637
  warnedAboutHydrateAPI = true;
27594
27638
  lowPriorityWarningWithoutStack$1(false, 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
27595
27639
  }
27596
- } // Legacy roots are not batched.
27597
-
27640
+ }
27598
27641
 
27599
- return new ReactSyncRoot(container, LegacyRoot, shouldHydrate ? {
27642
+ return createLegacyRoot(container, shouldHydrate ? {
27600
27643
  hydrate: true
27601
27644
  } : undefined);
27602
27645
  }
@@ -27650,128 +27693,182 @@ function legacyRenderSubtreeIntoContainer(parentComponent, children, container,
27650
27693
  return getPublicRootInstance(fiberRoot);
27651
27694
  }
27652
27695
 
27653
- function createPortal$$1(children, container) {
27654
- var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
27696
+ function findDOMNode(componentOrElement) {
27697
+ {
27698
+ var owner = ReactCurrentOwner$1.current;
27655
27699
 
27700
+ if (owner !== null && owner.stateNode !== null) {
27701
+ var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
27702
+ !warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner.type) || 'A component') : void 0;
27703
+ owner.stateNode._warnedAboutRefsInRender = true;
27704
+ }
27705
+ }
27706
+
27707
+ if (componentOrElement == null) {
27708
+ return null;
27709
+ }
27710
+
27711
+ if (componentOrElement.nodeType === ELEMENT_NODE) {
27712
+ return componentOrElement;
27713
+ }
27714
+
27715
+ {
27716
+ return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
27717
+ }
27718
+
27719
+ return findHostInstance(componentOrElement);
27720
+ }
27721
+ function hydrate(element, container, callback) {
27656
27722
  if (!isValidContainer(container)) {
27657
27723
  {
27658
27724
  throw Error("Target container is not a DOM element.");
27659
27725
  }
27660
- } // TODO: pass ReactDOM portal implementation as third argument
27726
+ }
27661
27727
 
27728
+ {
27729
+ var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
27662
27730
 
27663
- return createPortal$1(children, container, null, key);
27664
- }
27731
+ if (isModernRoot) {
27732
+ warningWithoutStack$1(false, 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?');
27733
+ }
27734
+ } // TODO: throw or warn if we couldn't hydrate?
27665
27735
 
27666
- var ReactDOM = {
27667
- createPortal: createPortal$$1,
27668
- findDOMNode: function (componentOrElement) {
27736
+
27737
+ return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
27738
+ }
27739
+ function render(element, container, callback) {
27740
+ if (!isValidContainer(container)) {
27669
27741
  {
27670
- var owner = ReactCurrentOwner.current;
27742
+ throw Error("Target container is not a DOM element.");
27743
+ }
27744
+ }
27671
27745
 
27672
- if (owner !== null && owner.stateNode !== null) {
27673
- var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
27674
- !warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner.type) || 'A component') : void 0;
27675
- owner.stateNode._warnedAboutRefsInRender = true;
27676
- }
27746
+ {
27747
+ var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
27748
+
27749
+ if (isModernRoot) {
27750
+ warningWithoutStack$1(false, 'You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call root.render(element)?');
27677
27751
  }
27752
+ }
27678
27753
 
27679
- if (componentOrElement == null) {
27680
- return null;
27754
+ return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
27755
+ }
27756
+ function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
27757
+ if (!isValidContainer(containerNode)) {
27758
+ {
27759
+ throw Error("Target container is not a DOM element.");
27681
27760
  }
27761
+ }
27682
27762
 
27683
- if (componentOrElement.nodeType === ELEMENT_NODE) {
27684
- return componentOrElement;
27763
+ if (!(parentComponent != null && has$1(parentComponent))) {
27764
+ {
27765
+ throw Error("parentComponent must be a valid React Component");
27685
27766
  }
27767
+ }
27686
27768
 
27769
+ return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
27770
+ }
27771
+ function unmountComponentAtNode(container) {
27772
+ if (!isValidContainer(container)) {
27687
27773
  {
27688
- return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
27774
+ throw Error("unmountComponentAtNode(...): Target container is not a DOM element.");
27689
27775
  }
27776
+ }
27690
27777
 
27691
- return findHostInstance(componentOrElement);
27692
- },
27693
- hydrate: function (element, container, callback) {
27694
- if (!isValidContainer(container)) {
27695
- {
27696
- throw Error("Target container is not a DOM element.");
27697
- }
27778
+ {
27779
+ var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
27780
+
27781
+ if (isModernRoot) {
27782
+ warningWithoutStack$1(false, 'You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.unmount()?');
27698
27783
  }
27784
+ }
27699
27785
 
27786
+ if (container._reactRootContainer) {
27700
27787
  {
27701
- !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?') : void 0;
27702
- } // TODO: throw or warn if we couldn't hydrate?
27788
+ var rootEl = getReactRootElementInContainer(container);
27789
+ var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
27790
+ !!renderedByDifferentReact ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
27791
+ } // Unmount should not be batched.
27703
27792
 
27704
27793
 
27705
- return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
27706
- },
27707
- render: function (element, container, callback) {
27708
- if (!isValidContainer(container)) {
27709
- {
27710
- throw Error("Target container is not a DOM element.");
27711
- }
27712
- }
27794
+ unbatchedUpdates(function () {
27795
+ legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
27796
+ container._reactRootContainer = null;
27797
+ unmarkContainerAsRoot(container);
27798
+ });
27799
+ }); // If you call unmountComponentAtNode twice in quick succession, you'll
27800
+ // get `true` twice. That's probably fine?
27713
27801
 
27802
+ return true;
27803
+ } else {
27714
27804
  {
27715
- !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call root.render(element)?') : void 0;
27716
- }
27805
+ var _rootEl = getReactRootElementInContainer(container);
27717
27806
 
27718
- return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
27719
- },
27720
- unstable_renderSubtreeIntoContainer: function (parentComponent, element, containerNode, callback) {
27721
- if (!isValidContainer(containerNode)) {
27722
- {
27723
- throw Error("Target container is not a DOM element.");
27724
- }
27725
- }
27807
+ var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl)); // Check if the container itself is a React root node.
27726
27808
 
27727
- if (!(parentComponent != null && has$1(parentComponent))) {
27728
- {
27729
- throw Error("parentComponent must be a valid React Component");
27730
- }
27809
+ var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
27810
+ !!hasNonRootReactChild ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
27731
27811
  }
27732
27812
 
27733
- return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
27734
- },
27735
- unmountComponentAtNode: function (container) {
27736
- if (!isValidContainer(container)) {
27737
- {
27738
- throw Error("unmountComponentAtNode(...): Target container is not a DOM element.");
27739
- }
27740
- }
27813
+ return false;
27814
+ }
27815
+ }
27741
27816
 
27742
- {
27743
- !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.unmount()?') : void 0;
27744
- }
27817
+ function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
27818
+ implementation) {
27819
+ var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
27820
+ return {
27821
+ // This tag allow us to uniquely identify this as a React Portal
27822
+ $$typeof: REACT_PORTAL_TYPE,
27823
+ key: key == null ? null : '' + key,
27824
+ children: children,
27825
+ containerInfo: containerInfo,
27826
+ implementation: implementation
27827
+ };
27828
+ }
27745
27829
 
27746
- if (container._reactRootContainer) {
27747
- {
27748
- var rootEl = getReactRootElementInContainer(container);
27749
- var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
27750
- !!renderedByDifferentReact ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
27751
- } // Unmount should not be batched.
27830
+ // TODO: this is special because it gets imported during build.
27752
27831
 
27832
+ var ReactVersion = '16.12.0';
27753
27833
 
27754
- unbatchedUpdates(function () {
27755
- legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
27756
- container._reactRootContainer = null;
27757
- });
27758
- }); // If you call unmountComponentAtNode twice in quick succession, you'll
27759
- // get `true` twice. That's probably fine?
27834
+ setAttemptSynchronousHydration(attemptSynchronousHydration$1);
27835
+ setAttemptUserBlockingHydration(attemptUserBlockingHydration$1);
27836
+ setAttemptContinuousHydration(attemptContinuousHydration$1);
27837
+ setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1);
27838
+ var didWarnAboutUnstableCreatePortal = false;
27760
27839
 
27761
- return true;
27762
- } else {
27763
- {
27764
- var _rootEl = getReactRootElementInContainer(container);
27840
+ {
27841
+ if (typeof Map !== 'function' || // $FlowIssue Flow incorrectly thinks Map has no prototype
27842
+ Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowIssue Flow incorrectly thinks Set has no prototype
27843
+ Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
27844
+ warningWithoutStack$1(false, 'React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
27845
+ }
27846
+ }
27765
27847
 
27766
- var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl)); // Check if the container itself is a React root node.
27848
+ setRestoreImplementation(restoreControlledState$$1);
27849
+ setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1);
27767
27850
 
27768
- var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
27769
- !!hasNonRootReactChild ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
27770
- }
27851
+ function createPortal$$1(children, container) {
27852
+ var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
27771
27853
 
27772
- return false;
27854
+ if (!isValidContainer(container)) {
27855
+ {
27856
+ throw Error("Target container is not a DOM element.");
27773
27857
  }
27774
- },
27858
+ } // TODO: pass ReactDOM portal implementation as third argument
27859
+
27860
+
27861
+ return createPortal$1(children, container, null, key);
27862
+ }
27863
+
27864
+ var ReactDOM = {
27865
+ createPortal: createPortal$$1,
27866
+ // Legacy
27867
+ findDOMNode: findDOMNode,
27868
+ hydrate: hydrate,
27869
+ render: render,
27870
+ unstable_renderSubtreeIntoContainer: unstable_renderSubtreeIntoContainer,
27871
+ unmountComponentAtNode: unmountComponentAtNode,
27775
27872
  // Temporary alias since we already shipped React 16 RC with it.
27776
27873
  // TODO: remove in React 17.
27777
27874
  unstable_createPortal: function () {
@@ -27791,38 +27888,9 @@ var ReactDOM = {
27791
27888
  }
27792
27889
  };
27793
27890
 
27794
- function createRoot(container, options) {
27795
- if (!isValidContainer(container)) {
27796
- {
27797
- throw Error("createRoot(...): Target container is not a DOM element.");
27798
- }
27799
- }
27800
-
27801
- warnIfReactDOMContainerInDEV(container);
27802
- return new ReactRoot(container, options);
27803
- }
27804
-
27805
- function createSyncRoot(container, options) {
27806
- if (!isValidContainer(container)) {
27807
- {
27808
- throw Error("createRoot(...): Target container is not a DOM element.");
27809
- }
27810
- }
27811
-
27812
- warnIfReactDOMContainerInDEV(container);
27813
- return new ReactSyncRoot(container, BatchedRoot, options);
27814
- }
27815
-
27816
- function warnIfReactDOMContainerInDEV(container) {
27817
- {
27818
- !!container._reactRootContainer ? warningWithoutStack$1(false, 'You are calling ReactDOM.createRoot() on a container that was previously ' + 'passed to ReactDOM.render(). This is not supported.') : void 0;
27819
- container._reactHasBeenPassedToCreateRootDEV = true;
27820
- }
27821
- }
27822
-
27823
27891
  if (exposeConcurrentModeAPIs) {
27824
27892
  ReactDOM.createRoot = createRoot;
27825
- ReactDOM.createSyncRoot = createSyncRoot;
27893
+ ReactDOM.createBlockingRoot = createBlockingRoot;
27826
27894
  ReactDOM.unstable_discreteUpdates = discreteUpdates$1;
27827
27895
  ReactDOM.unstable_flushDiscreteUpdates = flushDiscreteUpdates;
27828
27896
  ReactDOM.unstable_flushControlled = flushControlled;