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.
- package/build-info.json +4 -4
- package/cjs/react-dom-server.browser.development.js +7 -9
- package/cjs/react-dom-server.browser.production.min.js +2 -2
- package/cjs/react-dom-server.node.development.js +7 -9
- package/cjs/react-dom-server.node.production.min.js +2 -2
- package/cjs/react-dom-test-utils.development.js +10 -8
- package/cjs/react-dom-test-utils.production.min.js +1 -1
- package/cjs/react-dom-unstable-fizz.browser.development.js +9 -5
- package/cjs/react-dom-unstable-fizz.browser.production.min.js +3 -3
- package/cjs/react-dom-unstable-fizz.node.development.js +23 -10
- package/cjs/react-dom-unstable-fizz.node.production.min.js +4 -3
- package/cjs/react-dom-unstable-flight-client.development.js +357 -0
- package/cjs/react-dom-unstable-flight-client.production.min.js +16 -0
- package/cjs/react-dom-unstable-flight-server.browser.development.js +392 -0
- package/cjs/react-dom-unstable-flight-server.browser.production.min.js +16 -0
- package/cjs/react-dom-unstable-flight-server.node.development.js +415 -0
- package/cjs/react-dom-unstable-flight-server.node.production.min.js +16 -0
- package/cjs/react-dom-unstable-native-dependencies.development.js +1 -1
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +1 -1
- package/cjs/react-dom.development.js +324 -256
- package/cjs/react-dom.production.min.js +31 -31
- package/cjs/react-dom.profiling.min.js +31 -31
- package/package.json +8 -3
- package/umd/react-dom-server.browser.development.js +7 -9
- package/umd/react-dom-server.browser.production.min.js +2 -2
- package/umd/react-dom-test-utils.development.js +10 -8
- package/umd/react-dom-test-utils.production.min.js +1 -1
- package/umd/react-dom-unstable-fizz.browser.development.js +9 -5
- package/umd/react-dom-unstable-fizz.browser.production.min.js +3 -3
- package/umd/react-dom-unstable-flight-client.development.js +357 -0
- package/umd/react-dom-unstable-flight-client.production.min.js +14 -0
- package/umd/react-dom-unstable-flight-server.browser.development.js +390 -0
- package/umd/react-dom-unstable-flight-server.browser.production.min.js +14 -0
- package/umd/react-dom-unstable-native-dependencies.development.js +1 -1
- package/umd/react-dom-unstable-native-dependencies.production.min.js +1 -1
- package/umd/react-dom.development.js +324 -256
- package/umd/react-dom.production.min.js +191 -190
- package/umd/react-dom.profiling.min.js +204 -204
- package/unstable-flight-client.js +7 -0
- package/unstable-flight-server.browser.js +7 -0
- package/unstable-flight-server.js +3 -0
- package/unstable-flight-server.node.js +7 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.12.0
|
|
2
2
|
* react-dom.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1292,12 +1292,8 @@ function restoreStateIfNeeded() {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
1294
|
|
|
1295
|
-
var enableUserTimingAPI = true; // Helps identify side effects in
|
|
1296
|
-
|
|
1297
|
-
var debugRenderPhaseSideEffects = false; // In some cases, StrictMode should also double-render lifecycles.
|
|
1298
|
-
// This can be confusing for tests though,
|
|
1299
|
-
// And it can be bad for performance in production.
|
|
1300
|
-
// This feature flag can be used to control the behavior:
|
|
1295
|
+
var enableUserTimingAPI = true; // Helps identify side effects in render-phase lifecycle hooks and setState
|
|
1296
|
+
// reducers by double invoking them in Strict Mode.
|
|
1301
1297
|
|
|
1302
1298
|
var debugRenderPhaseSideEffectsForStrictMode = true; // To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
1303
1299
|
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
@@ -1333,7 +1329,7 @@ var enableFundamentalAPI = false; // Experimental Scope support.
|
|
|
1333
1329
|
var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
1334
1330
|
|
|
1335
1331
|
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
1336
|
-
// Till then, we warn about the missing mock, but still fallback to a
|
|
1332
|
+
// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
|
|
1337
1333
|
|
|
1338
1334
|
var warnAboutUnmockedScheduler = false; // For tests, we flush suspense fallbacks in an act scope;
|
|
1339
1335
|
// *except* in some of our own tests, where we test incremental loading states.
|
|
@@ -1352,7 +1348,7 @@ var warnAboutDefaultPropsOnFunctionComponents = false;
|
|
|
1352
1348
|
var warnAboutStringRefs = false;
|
|
1353
1349
|
var disableLegacyContext = false;
|
|
1354
1350
|
var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
|
|
1355
|
-
var enableTrustedTypesIntegration = false;
|
|
1351
|
+
var enableTrustedTypesIntegration = false; // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
|
|
1356
1352
|
|
|
1357
1353
|
// the renderer. Such as when we're dispatching events or if third party
|
|
1358
1354
|
// libraries need to call batchedUpdates. Eventually, this API will go away when
|
|
@@ -3766,7 +3762,7 @@ var ShouldCapture =
|
|
|
3766
3762
|
/* */
|
|
3767
3763
|
4096;
|
|
3768
3764
|
|
|
3769
|
-
var ReactCurrentOwner
|
|
3765
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
3770
3766
|
function getNearestMountedFiber(fiber) {
|
|
3771
3767
|
var node = fiber;
|
|
3772
3768
|
var nearestMounted = fiber;
|
|
@@ -3831,7 +3827,7 @@ function isFiberMounted(fiber) {
|
|
|
3831
3827
|
}
|
|
3832
3828
|
function isMounted(component) {
|
|
3833
3829
|
{
|
|
3834
|
-
var owner = ReactCurrentOwner
|
|
3830
|
+
var owner = ReactCurrentOwner.current;
|
|
3835
3831
|
|
|
3836
3832
|
if (owner !== null && owner.tag === ClassComponent) {
|
|
3837
3833
|
var ownerFiber = owner;
|
|
@@ -9585,14 +9581,31 @@ function insertInContainerBefore(container, child, beforeChild) {
|
|
|
9585
9581
|
} else {
|
|
9586
9582
|
container.insertBefore(child, beforeChild);
|
|
9587
9583
|
}
|
|
9584
|
+
} // This is a specific event for the React Flare
|
|
9585
|
+
// event system, so event responders can act
|
|
9586
|
+
// accordingly to a DOM node being unmounted that
|
|
9587
|
+
// previously had active document focus.
|
|
9588
|
+
|
|
9589
|
+
function dispatchDetachedVisibleNodeEvent(child) {
|
|
9590
|
+
if (enableFlareAPI && selectionInformation && child === selectionInformation.focusedElem) {
|
|
9591
|
+
var targetFiber = getClosestInstanceFromNode(child); // Simlulate a blur event to the React Flare responder system.
|
|
9592
|
+
|
|
9593
|
+
dispatchEventForResponderEventSystem('detachedvisiblenode', targetFiber, {
|
|
9594
|
+
target: child,
|
|
9595
|
+
timeStamp: Date.now()
|
|
9596
|
+
}, child, RESPONDER_EVENT_SYSTEM | IS_PASSIVE);
|
|
9597
|
+
}
|
|
9588
9598
|
}
|
|
9599
|
+
|
|
9589
9600
|
function removeChild(parentInstance, child) {
|
|
9601
|
+
dispatchDetachedVisibleNodeEvent(child);
|
|
9590
9602
|
parentInstance.removeChild(child);
|
|
9591
9603
|
}
|
|
9592
9604
|
function removeChildFromContainer(container, child) {
|
|
9593
9605
|
if (container.nodeType === COMMENT_NODE) {
|
|
9594
9606
|
container.parentNode.removeChild(child);
|
|
9595
9607
|
} else {
|
|
9608
|
+
dispatchDetachedVisibleNodeEvent(child);
|
|
9596
9609
|
container.removeChild(child);
|
|
9597
9610
|
}
|
|
9598
9611
|
}
|
|
@@ -9984,11 +9997,17 @@ function precacheFiberNode(hostInst, node) {
|
|
|
9984
9997
|
}
|
|
9985
9998
|
function markContainerAsRoot(hostRoot, node) {
|
|
9986
9999
|
node[internalContainerInstanceKey] = hostRoot;
|
|
10000
|
+
}
|
|
10001
|
+
function unmarkContainerAsRoot(node) {
|
|
10002
|
+
node[internalContainerInstanceKey] = null;
|
|
10003
|
+
}
|
|
10004
|
+
function isContainerMarkedAsRoot(node) {
|
|
10005
|
+
return !!node[internalContainerInstanceKey];
|
|
9987
10006
|
} // Given a DOM node, return the closest HostComponent or HostText fiber ancestor.
|
|
9988
10007
|
// If the target node is part of a hydrated or not yet rendered subtree, then
|
|
9989
10008
|
// this may also return a SuspenseComponent or HostRoot to indicate that.
|
|
9990
10009
|
// Conceptually the HostRoot fiber is a child of the Container node. So if you
|
|
9991
|
-
// pass the Container node as the targetNode, you
|
|
10010
|
+
// pass the Container node as the targetNode, you will not actually get the
|
|
9992
10011
|
// HostRoot back. To get to the HostRoot, you need to pass a child of it.
|
|
9993
10012
|
// The same thing applies to Suspense boundaries.
|
|
9994
10013
|
|
|
@@ -12014,7 +12033,7 @@ function findCurrentUnmaskedContext(fiber) {
|
|
|
12014
12033
|
}
|
|
12015
12034
|
|
|
12016
12035
|
var LegacyRoot = 0;
|
|
12017
|
-
var
|
|
12036
|
+
var BlockingRoot = 1;
|
|
12018
12037
|
var ConcurrentRoot = 2;
|
|
12019
12038
|
|
|
12020
12039
|
// Intentionally not named imports because Rollup would use dynamic dispatch for
|
|
@@ -12198,10 +12217,10 @@ function flushSyncCallbackQueueImpl() {
|
|
|
12198
12217
|
}
|
|
12199
12218
|
|
|
12200
12219
|
var NoMode = 0;
|
|
12201
|
-
var StrictMode = 1; // TODO: Remove
|
|
12220
|
+
var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
|
|
12202
12221
|
// tag instead
|
|
12203
12222
|
|
|
12204
|
-
var
|
|
12223
|
+
var BlockingMode = 2;
|
|
12205
12224
|
var ConcurrentMode = 4;
|
|
12206
12225
|
var ProfileMode = 8;
|
|
12207
12226
|
|
|
@@ -13583,7 +13602,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
13583
13602
|
{
|
|
13584
13603
|
enterDisallowedContextReadInDEV();
|
|
13585
13604
|
|
|
13586
|
-
if (
|
|
13605
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
13587
13606
|
payload.call(instance, prevState, nextProps);
|
|
13588
13607
|
}
|
|
13589
13608
|
}
|
|
@@ -13617,7 +13636,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
13617
13636
|
{
|
|
13618
13637
|
enterDisallowedContextReadInDEV();
|
|
13619
13638
|
|
|
13620
|
-
if (
|
|
13639
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
13621
13640
|
_payload.call(instance, prevState, nextProps);
|
|
13622
13641
|
}
|
|
13623
13642
|
}
|
|
@@ -13930,7 +13949,7 @@ function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromPro
|
|
|
13930
13949
|
var prevState = workInProgress.memoizedState;
|
|
13931
13950
|
|
|
13932
13951
|
{
|
|
13933
|
-
if (
|
|
13952
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
13934
13953
|
// Invoke the function an extra time to help detect side-effects.
|
|
13935
13954
|
getDerivedStateFromProps(nextProps, prevState);
|
|
13936
13955
|
}
|
|
@@ -14177,7 +14196,7 @@ function constructClassInstance(workInProgress, ctor, props, renderExpirationTim
|
|
|
14177
14196
|
|
|
14178
14197
|
|
|
14179
14198
|
{
|
|
14180
|
-
if (
|
|
14199
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
14181
14200
|
new ctor(props, context); // eslint-disable-line no-new
|
|
14182
14201
|
}
|
|
14183
14202
|
}
|
|
@@ -18123,7 +18142,7 @@ function updateForwardRef(current$$1, workInProgress, Component, nextProps, rend
|
|
|
18123
18142
|
setCurrentPhase('render');
|
|
18124
18143
|
nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
|
18125
18144
|
|
|
18126
|
-
if (
|
|
18145
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
18127
18146
|
// Only double-render components with Hooks
|
|
18128
18147
|
if (workInProgress.memoizedState !== null) {
|
|
18129
18148
|
nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
|
@@ -18327,7 +18346,7 @@ function updateFunctionComponent(current$$1, workInProgress, Component, nextProp
|
|
|
18327
18346
|
setCurrentPhase('render');
|
|
18328
18347
|
nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
|
18329
18348
|
|
|
18330
|
-
if (
|
|
18349
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
18331
18350
|
// Only double-render components with Hooks
|
|
18332
18351
|
if (workInProgress.memoizedState !== null) {
|
|
18333
18352
|
nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
|
@@ -18450,7 +18469,7 @@ function finishClassComponent(current$$1, workInProgress, Component, shouldUpdat
|
|
|
18450
18469
|
setCurrentPhase('render');
|
|
18451
18470
|
nextChildren = instance.render();
|
|
18452
18471
|
|
|
18453
|
-
if (
|
|
18472
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
18454
18473
|
instance.render();
|
|
18455
18474
|
}
|
|
18456
18475
|
|
|
@@ -18823,7 +18842,7 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
|
|
|
18823
18842
|
warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(Component) || 'Unknown');
|
|
18824
18843
|
}
|
|
18825
18844
|
|
|
18826
|
-
if (
|
|
18845
|
+
if (debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
|
18827
18846
|
// Only double-render components with Hooks
|
|
18828
18847
|
if (workInProgress.memoizedState !== null) {
|
|
18829
18848
|
value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
|
|
@@ -18999,8 +19018,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
18999
19018
|
var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
|
19000
19019
|
primaryChildFragment.return = workInProgress;
|
|
19001
19020
|
|
|
19002
|
-
if ((workInProgress.mode &
|
|
19003
|
-
// Outside of
|
|
19021
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
19022
|
+
// Outside of blocking mode, we commit the effects from the
|
|
19004
19023
|
// partially completed, timed-out tree, too.
|
|
19005
19024
|
var progressedState = workInProgress.memoizedState;
|
|
19006
19025
|
var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
|
|
@@ -19063,8 +19082,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
19063
19082
|
|
|
19064
19083
|
_primaryChildFragment.child = null;
|
|
19065
19084
|
|
|
19066
|
-
if ((workInProgress.mode &
|
|
19067
|
-
// Outside of
|
|
19085
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
19086
|
+
// Outside of blocking mode, we commit the effects from the
|
|
19068
19087
|
// partially completed, timed-out tree, too.
|
|
19069
19088
|
var _progressedChild = _primaryChildFragment.child = workInProgress.child;
|
|
19070
19089
|
|
|
@@ -19123,8 +19142,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
19123
19142
|
|
|
19124
19143
|
_primaryChildFragment2.return = workInProgress;
|
|
19125
19144
|
|
|
19126
|
-
if ((workInProgress.mode &
|
|
19127
|
-
// Outside of
|
|
19145
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
19146
|
+
// Outside of blocking mode, we commit the effects from the
|
|
19128
19147
|
// partially completed, timed-out tree, too.
|
|
19129
19148
|
var _progressedState = workInProgress.memoizedState;
|
|
19130
19149
|
|
|
@@ -19208,8 +19227,8 @@ function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTim
|
|
|
19208
19227
|
// primaryChildFragment.effectTag |= Placement;
|
|
19209
19228
|
|
|
19210
19229
|
|
|
19211
|
-
if ((workInProgress.mode &
|
|
19212
|
-
// Outside of
|
|
19230
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
19231
|
+
// Outside of blocking mode, we commit the effects from the
|
|
19213
19232
|
// partially completed, timed-out tree, too.
|
|
19214
19233
|
var _progressedState2 = workInProgress.memoizedState;
|
|
19215
19234
|
|
|
@@ -19278,9 +19297,9 @@ function retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, rend
|
|
|
19278
19297
|
function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, renderExpirationTime) {
|
|
19279
19298
|
// During the first pass, we'll bail out and not drill into the children.
|
|
19280
19299
|
// Instead, we'll leave the content in place and try to hydrate it later.
|
|
19281
|
-
if ((workInProgress.mode &
|
|
19300
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
19282
19301
|
{
|
|
19283
|
-
warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.
|
|
19302
|
+
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.');
|
|
19284
19303
|
}
|
|
19285
19304
|
|
|
19286
19305
|
workInProgress.expirationTime = Sync;
|
|
@@ -19322,7 +19341,7 @@ function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseI
|
|
|
19322
19341
|
// but after we've already committed once.
|
|
19323
19342
|
warnIfHydrating();
|
|
19324
19343
|
|
|
19325
|
-
if ((workInProgress.mode &
|
|
19344
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
19326
19345
|
return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
|
|
19327
19346
|
}
|
|
19328
19347
|
|
|
@@ -19644,8 +19663,8 @@ function updateSuspenseListComponent(current$$1, workInProgress, renderExpiratio
|
|
|
19644
19663
|
|
|
19645
19664
|
pushSuspenseContext(workInProgress, suspenseContext);
|
|
19646
19665
|
|
|
19647
|
-
if ((workInProgress.mode &
|
|
19648
|
-
// Outside of
|
|
19666
|
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
|
19667
|
+
// Outside of blocking mode, SuspenseList doesn't work so we just
|
|
19649
19668
|
// use make it a noop by treating it as the default revealOrder.
|
|
19650
19669
|
workInProgress.memoizedState = null;
|
|
19651
19670
|
} else {
|
|
@@ -20017,7 +20036,12 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
20017
20036
|
|
|
20018
20037
|
case Profiler:
|
|
20019
20038
|
if (enableProfilerTimer) {
|
|
20020
|
-
|
|
20039
|
+
// Profiler should only call onRender when one of its descendants actually rendered.
|
|
20040
|
+
var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
|
20041
|
+
|
|
20042
|
+
if (hasChildWork) {
|
|
20043
|
+
workInProgress.effectTag |= Update;
|
|
20044
|
+
}
|
|
20021
20045
|
}
|
|
20022
20046
|
|
|
20023
20047
|
break;
|
|
@@ -20073,10 +20097,11 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
20073
20097
|
case SuspenseListComponent:
|
|
20074
20098
|
{
|
|
20075
20099
|
var didSuspendBefore = (current$$1.effectTag & DidCapture) !== NoEffect;
|
|
20076
|
-
|
|
20100
|
+
|
|
20101
|
+
var _hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
|
20077
20102
|
|
|
20078
20103
|
if (didSuspendBefore) {
|
|
20079
|
-
if (
|
|
20104
|
+
if (_hasChildWork) {
|
|
20080
20105
|
// If something was in fallback state last time, and we have all the
|
|
20081
20106
|
// same children then we're still in progressive loading state.
|
|
20082
20107
|
// Something might get unblocked by state updates or retries in the
|
|
@@ -20105,7 +20130,7 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
|
|
20105
20130
|
|
|
20106
20131
|
pushSuspenseContext(workInProgress, suspenseStackCursor.current);
|
|
20107
20132
|
|
|
20108
|
-
if (
|
|
20133
|
+
if (_hasChildWork) {
|
|
20109
20134
|
break;
|
|
20110
20135
|
} else {
|
|
20111
20136
|
// If none of the children had any work, that means that none of
|
|
@@ -20288,14 +20313,19 @@ function getSuspenseFallbackChild(fiber) {
|
|
|
20288
20313
|
return fiber.child.sibling.child;
|
|
20289
20314
|
}
|
|
20290
20315
|
|
|
20316
|
+
var emptyObject$1 = {};
|
|
20317
|
+
|
|
20291
20318
|
function collectScopedNodes(node, fn, scopedNodes) {
|
|
20292
20319
|
if (enableScopeAPI) {
|
|
20293
20320
|
if (node.tag === HostComponent) {
|
|
20294
20321
|
var _type = node.type,
|
|
20295
|
-
memoizedProps = node.memoizedProps
|
|
20322
|
+
memoizedProps = node.memoizedProps,
|
|
20323
|
+
stateNode = node.stateNode;
|
|
20324
|
+
|
|
20325
|
+
var _instance = getPublicInstance(stateNode);
|
|
20296
20326
|
|
|
20297
|
-
if (fn(_type, memoizedProps) === true) {
|
|
20298
|
-
scopedNodes.push(
|
|
20327
|
+
if (_instance !== null && fn(_type, memoizedProps || emptyObject$1, _instance) === true) {
|
|
20328
|
+
scopedNodes.push(_instance);
|
|
20299
20329
|
}
|
|
20300
20330
|
}
|
|
20301
20331
|
|
|
@@ -20315,10 +20345,13 @@ function collectFirstScopedNode(node, fn) {
|
|
|
20315
20345
|
if (enableScopeAPI) {
|
|
20316
20346
|
if (node.tag === HostComponent) {
|
|
20317
20347
|
var _type2 = node.type,
|
|
20318
|
-
memoizedProps = node.memoizedProps
|
|
20348
|
+
memoizedProps = node.memoizedProps,
|
|
20349
|
+
stateNode = node.stateNode;
|
|
20350
|
+
|
|
20351
|
+
var _instance2 = getPublicInstance(stateNode);
|
|
20319
20352
|
|
|
20320
|
-
if (fn(_type2, memoizedProps) === true) {
|
|
20321
|
-
return
|
|
20353
|
+
if (_instance2 !== null && fn(_type2, memoizedProps, _instance2) === true) {
|
|
20354
|
+
return _instance2;
|
|
20322
20355
|
}
|
|
20323
20356
|
}
|
|
20324
20357
|
|
|
@@ -21202,12 +21235,12 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
21202
21235
|
}
|
|
21203
21236
|
|
|
21204
21237
|
if (nextDidTimeout && !prevDidTimeout) {
|
|
21205
|
-
// If this subtreee is running in
|
|
21238
|
+
// If this subtreee is running in blocking mode we can suspend,
|
|
21206
21239
|
// otherwise we won't suspend.
|
|
21207
21240
|
// TODO: This will still suspend a synchronous tree if anything
|
|
21208
21241
|
// in the concurrent tree already suspended during this render.
|
|
21209
21242
|
// This is a known bug.
|
|
21210
|
-
if ((workInProgress.mode &
|
|
21243
|
+
if ((workInProgress.mode & BlockingMode) !== NoMode) {
|
|
21211
21244
|
// TODO: Move this back to throwException because this is too late
|
|
21212
21245
|
// if this is a large tree which is common for initial loads. We
|
|
21213
21246
|
// don't know if we should restart a render or not until we get
|
|
@@ -21396,9 +21429,9 @@ function completeWork(current, workInProgress, renderExpirationTime) {
|
|
|
21396
21429
|
|
|
21397
21430
|
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
21398
21431
|
|
|
21399
|
-
if (renderState.tail === null && renderState.tailMode === 'hidden') {
|
|
21432
|
+
if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate) {
|
|
21400
21433
|
// We need to delete the row we just rendered.
|
|
21401
|
-
// Reset the effect list to what it
|
|
21434
|
+
// Reset the effect list to what it was before we rendered this
|
|
21402
21435
|
// child. The nested children have already appended themselves.
|
|
21403
21436
|
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
|
21404
21437
|
|
|
@@ -23314,17 +23347,17 @@ function throwException(root, returnFiber, sourceFiber, value, renderExpirationT
|
|
|
23314
23347
|
_workInProgress.updateQueue = updateQueue;
|
|
23315
23348
|
} else {
|
|
23316
23349
|
thenables.add(thenable);
|
|
23317
|
-
} // If the boundary is outside of
|
|
23350
|
+
} // If the boundary is outside of blocking mode, we should *not*
|
|
23318
23351
|
// suspend the commit. Pretend as if the suspended component rendered
|
|
23319
23352
|
// null and keep rendering. In the commit phase, we'll schedule a
|
|
23320
23353
|
// subsequent synchronous update to re-render the Suspense.
|
|
23321
23354
|
//
|
|
23322
23355
|
// Note: It doesn't matter whether the component that suspended was
|
|
23323
|
-
// inside a
|
|
23356
|
+
// inside a blocking mode tree. If the Suspense is outside of it, we
|
|
23324
23357
|
// should *not* suspend the commit.
|
|
23325
23358
|
|
|
23326
23359
|
|
|
23327
|
-
if ((_workInProgress.mode &
|
|
23360
|
+
if ((_workInProgress.mode & BlockingMode) === NoMode) {
|
|
23328
23361
|
_workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete.
|
|
23329
23362
|
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
23330
23363
|
// all lifecycle effect tags.
|
|
@@ -23571,7 +23604,7 @@ function getCurrentTime() {
|
|
|
23571
23604
|
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
|
23572
23605
|
var mode = fiber.mode;
|
|
23573
23606
|
|
|
23574
|
-
if ((mode &
|
|
23607
|
+
if ((mode & BlockingMode) === NoMode) {
|
|
23575
23608
|
return Sync;
|
|
23576
23609
|
}
|
|
23577
23610
|
|
|
@@ -23672,7 +23705,7 @@ function scheduleUpdateOnFiber(fiber, expirationTime) {
|
|
|
23672
23705
|
// a batch. This is intentionally inside scheduleUpdateOnFiber instead of
|
|
23673
23706
|
// scheduleCallbackForFiber to preserve the ability to schedule a callback
|
|
23674
23707
|
// without immediately flushing it. We only do this for user-initiated
|
|
23675
|
-
// updates, to preserve historical behavior of
|
|
23708
|
+
// updates, to preserve historical behavior of legacy mode.
|
|
23676
23709
|
flushSyncCallbackQueue();
|
|
23677
23710
|
}
|
|
23678
23711
|
}
|
|
@@ -24891,7 +24924,16 @@ function commitRoot(root) {
|
|
|
24891
24924
|
}
|
|
24892
24925
|
|
|
24893
24926
|
function commitRootImpl(root, renderPriorityLevel) {
|
|
24894
|
-
|
|
24927
|
+
do {
|
|
24928
|
+
// `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
|
|
24929
|
+
// means `flushPassiveEffects` will sometimes result in additional
|
|
24930
|
+
// passive effects. So we need to keep flushing in a loop until there are
|
|
24931
|
+
// no more pending effects.
|
|
24932
|
+
// TODO: Might be better if `flushPassiveEffects` did not automatically
|
|
24933
|
+
// flush synchronous work at the end, to avoid factoring hazards like this.
|
|
24934
|
+
flushPassiveEffects();
|
|
24935
|
+
} while (rootWithPendingPassiveEffects !== null);
|
|
24936
|
+
|
|
24895
24937
|
flushRenderPhaseStrictModeWarningsInDEV();
|
|
24896
24938
|
|
|
24897
24939
|
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
|
@@ -25818,7 +25860,7 @@ var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent
|
|
|
25818
25860
|
function warnIfUnmockedScheduler(fiber) {
|
|
25819
25861
|
{
|
|
25820
25862
|
if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {
|
|
25821
|
-
if (fiber.mode &
|
|
25863
|
+
if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
|
|
25822
25864
|
didWarnAboutUnmockedScheduler = true;
|
|
25823
25865
|
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');
|
|
25824
25866
|
} else if (warnAboutUnmockedScheduler === true) {
|
|
@@ -26461,9 +26503,9 @@ function createHostRootFiber(tag) {
|
|
|
26461
26503
|
var mode;
|
|
26462
26504
|
|
|
26463
26505
|
if (tag === ConcurrentRoot) {
|
|
26464
|
-
mode = ConcurrentMode |
|
|
26465
|
-
} else if (tag ===
|
|
26466
|
-
mode =
|
|
26506
|
+
mode = ConcurrentMode | BlockingMode | StrictMode;
|
|
26507
|
+
} else if (tag === BlockingRoot) {
|
|
26508
|
+
mode = BlockingMode | StrictMode;
|
|
26467
26509
|
} else {
|
|
26468
26510
|
mode = NoMode;
|
|
26469
26511
|
}
|
|
@@ -26505,7 +26547,7 @@ key, pendingProps, owner, mode, expirationTime) {
|
|
|
26505
26547
|
|
|
26506
26548
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
26507
26549
|
fiberTag = Mode;
|
|
26508
|
-
mode |= ConcurrentMode |
|
|
26550
|
+
mode |= ConcurrentMode | BlockingMode | StrictMode;
|
|
26509
26551
|
break;
|
|
26510
26552
|
|
|
26511
26553
|
case REACT_STRICT_MODE_TYPE:
|
|
@@ -27288,63 +27330,44 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
27288
27330
|
// This file intentionally does *not* have the Flow annotation.
|
|
27289
27331
|
// Don't add it. See `./inline-typed.js` for an explanation.
|
|
27290
27332
|
|
|
27291
|
-
|
|
27292
|
-
|
|
27293
|
-
|
|
27294
|
-
|
|
27295
|
-
// This tag allow us to uniquely identify this as a React Portal
|
|
27296
|
-
$$typeof: REACT_PORTAL_TYPE,
|
|
27297
|
-
key: key == null ? null : '' + key,
|
|
27298
|
-
children: children,
|
|
27299
|
-
containerInfo: containerInfo,
|
|
27300
|
-
implementation: implementation
|
|
27301
|
-
};
|
|
27333
|
+
// TODO: This type is shared between the reconciler and ReactDOM, but will
|
|
27334
|
+
// eventually be lifted out to the renderer.
|
|
27335
|
+
function ReactDOMRoot(container, options) {
|
|
27336
|
+
this._internalRoot = createRootImpl(container, ConcurrentRoot, options);
|
|
27302
27337
|
}
|
|
27303
27338
|
|
|
27304
|
-
|
|
27305
|
-
|
|
27306
|
-
|
|
27339
|
+
function ReactDOMBlockingRoot(container, tag, options) {
|
|
27340
|
+
this._internalRoot = createRootImpl(container, tag, options);
|
|
27341
|
+
}
|
|
27307
27342
|
|
|
27308
|
-
|
|
27309
|
-
|
|
27310
|
-
|
|
27311
|
-
setAttemptUserBlockingHydration(attemptUserBlockingHydration$1);
|
|
27312
|
-
setAttemptContinuousHydration(attemptContinuousHydration$1);
|
|
27313
|
-
setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1);
|
|
27314
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
27315
|
-
var topLevelUpdateWarnings;
|
|
27316
|
-
var warnOnInvalidCallback;
|
|
27317
|
-
var didWarnAboutUnstableCreatePortal = false;
|
|
27343
|
+
ReactDOMRoot.prototype.render = ReactDOMBlockingRoot.prototype.render = function (children, callback) {
|
|
27344
|
+
var root = this._internalRoot;
|
|
27345
|
+
var cb = callback === undefined ? null : callback;
|
|
27318
27346
|
|
|
27319
|
-
{
|
|
27320
|
-
|
|
27321
|
-
Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowIssue Flow incorrectly thinks Set has no prototype
|
|
27322
|
-
Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
|
|
27323
|
-
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');
|
|
27347
|
+
{
|
|
27348
|
+
warnOnInvalidCallback(cb, 'render');
|
|
27324
27349
|
}
|
|
27325
27350
|
|
|
27326
|
-
|
|
27327
|
-
|
|
27328
|
-
var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
|
|
27351
|
+
updateContainer(children, root, null, cb);
|
|
27352
|
+
};
|
|
27329
27353
|
|
|
27330
|
-
|
|
27331
|
-
|
|
27332
|
-
|
|
27333
|
-
}
|
|
27354
|
+
ReactDOMRoot.prototype.unmount = ReactDOMBlockingRoot.prototype.unmount = function (callback) {
|
|
27355
|
+
var root = this._internalRoot;
|
|
27356
|
+
var cb = callback === undefined ? null : callback;
|
|
27334
27357
|
|
|
27335
|
-
|
|
27336
|
-
|
|
27337
|
-
|
|
27338
|
-
!(!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;
|
|
27339
|
-
!(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;
|
|
27340
|
-
};
|
|
27358
|
+
{
|
|
27359
|
+
warnOnInvalidCallback(cb, 'render');
|
|
27360
|
+
}
|
|
27341
27361
|
|
|
27342
|
-
|
|
27343
|
-
|
|
27344
|
-
|
|
27345
|
-
}
|
|
27362
|
+
var container = root.containerInfo;
|
|
27363
|
+
updateContainer(null, root, null, function () {
|
|
27364
|
+
unmarkContainerAsRoot(container);
|
|
27346
27365
|
|
|
27347
|
-
|
|
27366
|
+
if (cb !== null) {
|
|
27367
|
+
cb();
|
|
27368
|
+
}
|
|
27369
|
+
});
|
|
27370
|
+
};
|
|
27348
27371
|
|
|
27349
27372
|
function createRootImpl(container, tag, options) {
|
|
27350
27373
|
// Tag is either LegacyRoot or Concurrent Root
|
|
@@ -27361,46 +27384,70 @@ function createRootImpl(container, tag, options) {
|
|
|
27361
27384
|
return root;
|
|
27362
27385
|
}
|
|
27363
27386
|
|
|
27364
|
-
function
|
|
27365
|
-
|
|
27366
|
-
|
|
27387
|
+
function createRoot(container, options) {
|
|
27388
|
+
if (!isValidContainer(container)) {
|
|
27389
|
+
{
|
|
27390
|
+
throw Error("createRoot(...): Target container is not a DOM element.");
|
|
27391
|
+
}
|
|
27392
|
+
}
|
|
27367
27393
|
|
|
27368
|
-
|
|
27369
|
-
|
|
27394
|
+
warnIfReactDOMContainerInDEV(container);
|
|
27395
|
+
return new ReactDOMRoot(container, options);
|
|
27370
27396
|
}
|
|
27397
|
+
function createBlockingRoot(container, options) {
|
|
27398
|
+
if (!isValidContainer(container)) {
|
|
27399
|
+
{
|
|
27400
|
+
throw Error("createRoot(...): Target container is not a DOM element.");
|
|
27401
|
+
}
|
|
27402
|
+
}
|
|
27371
27403
|
|
|
27372
|
-
|
|
27373
|
-
|
|
27374
|
-
|
|
27375
|
-
|
|
27404
|
+
warnIfReactDOMContainerInDEV(container);
|
|
27405
|
+
return new ReactDOMBlockingRoot(container, BlockingRoot, options);
|
|
27406
|
+
}
|
|
27407
|
+
function createLegacyRoot(container, options) {
|
|
27408
|
+
return new ReactDOMBlockingRoot(container, LegacyRoot, options);
|
|
27409
|
+
}
|
|
27410
|
+
function isValidContainer(node) {
|
|
27411
|
+
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 '));
|
|
27412
|
+
}
|
|
27413
|
+
function warnOnInvalidCallback(callback, callerName) {
|
|
27376
27414
|
{
|
|
27377
|
-
|
|
27415
|
+
!(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;
|
|
27378
27416
|
}
|
|
27417
|
+
}
|
|
27379
27418
|
|
|
27380
|
-
|
|
27381
|
-
};
|
|
27382
|
-
|
|
27383
|
-
ReactRoot.prototype.unmount = ReactSyncRoot.prototype.unmount = function (callback) {
|
|
27384
|
-
var root = this._internalRoot;
|
|
27385
|
-
callback = callback === undefined ? null : callback;
|
|
27386
|
-
|
|
27419
|
+
function warnIfReactDOMContainerInDEV(container) {
|
|
27387
27420
|
{
|
|
27388
|
-
|
|
27421
|
+
if (isContainerMarkedAsRoot(container)) {
|
|
27422
|
+
if (container._reactRootContainer) {
|
|
27423
|
+
warningWithoutStack$1(false, 'You are calling ReactDOM.createRoot() on a container that was previously ' + 'passed to ReactDOM.render(). This is not supported.');
|
|
27424
|
+
} else {
|
|
27425
|
+
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.');
|
|
27426
|
+
}
|
|
27427
|
+
}
|
|
27389
27428
|
}
|
|
27429
|
+
}
|
|
27390
27430
|
|
|
27391
|
-
|
|
27392
|
-
|
|
27393
|
-
|
|
27394
|
-
* True if the supplied DOM node is a valid node element.
|
|
27395
|
-
*
|
|
27396
|
-
* @param {?DOMElement} node The candidate DOM node.
|
|
27397
|
-
* @return {boolean} True if the DOM is a valid DOM node.
|
|
27398
|
-
* @internal
|
|
27399
|
-
*/
|
|
27431
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
27432
|
+
var topLevelUpdateWarnings;
|
|
27433
|
+
var warnedAboutHydrateAPI = false;
|
|
27400
27434
|
|
|
27435
|
+
{
|
|
27436
|
+
topLevelUpdateWarnings = function (container) {
|
|
27437
|
+
if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
|
|
27438
|
+
var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
|
|
27401
27439
|
|
|
27402
|
-
|
|
27403
|
-
|
|
27440
|
+
if (hostInstance) {
|
|
27441
|
+
!(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;
|
|
27442
|
+
}
|
|
27443
|
+
}
|
|
27444
|
+
|
|
27445
|
+
var isRootRenderedBySomeReact = !!container._reactRootContainer;
|
|
27446
|
+
var rootEl = getReactRootElementInContainer(container);
|
|
27447
|
+
var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
|
|
27448
|
+
!(!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;
|
|
27449
|
+
!(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;
|
|
27450
|
+
};
|
|
27404
27451
|
}
|
|
27405
27452
|
|
|
27406
27453
|
function getReactRootElementInContainer(container) {
|
|
@@ -27420,9 +27467,6 @@ function shouldHydrateDueToLegacyHeuristic(container) {
|
|
|
27420
27467
|
return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
|
|
27421
27468
|
}
|
|
27422
27469
|
|
|
27423
|
-
setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1);
|
|
27424
|
-
var warnedAboutHydrateAPI = false;
|
|
27425
|
-
|
|
27426
27470
|
function legacyCreateRootFromDOMContainer(container, forceHydrate) {
|
|
27427
27471
|
var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container); // First clear any existing content.
|
|
27428
27472
|
|
|
@@ -27447,10 +27491,9 @@ function legacyCreateRootFromDOMContainer(container, forceHydrate) {
|
|
|
27447
27491
|
warnedAboutHydrateAPI = true;
|
|
27448
27492
|
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.');
|
|
27449
27493
|
}
|
|
27450
|
-
}
|
|
27451
|
-
|
|
27494
|
+
}
|
|
27452
27495
|
|
|
27453
|
-
return
|
|
27496
|
+
return createLegacyRoot(container, shouldHydrate ? {
|
|
27454
27497
|
hydrate: true
|
|
27455
27498
|
} : undefined);
|
|
27456
27499
|
}
|
|
@@ -27504,128 +27547,182 @@ function legacyRenderSubtreeIntoContainer(parentComponent, children, container,
|
|
|
27504
27547
|
return getPublicRootInstance(fiberRoot);
|
|
27505
27548
|
}
|
|
27506
27549
|
|
|
27507
|
-
function
|
|
27508
|
-
|
|
27550
|
+
function findDOMNode(componentOrElement) {
|
|
27551
|
+
{
|
|
27552
|
+
var owner = ReactCurrentOwner$1.current;
|
|
27509
27553
|
|
|
27554
|
+
if (owner !== null && owner.stateNode !== null) {
|
|
27555
|
+
var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
|
|
27556
|
+
!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;
|
|
27557
|
+
owner.stateNode._warnedAboutRefsInRender = true;
|
|
27558
|
+
}
|
|
27559
|
+
}
|
|
27560
|
+
|
|
27561
|
+
if (componentOrElement == null) {
|
|
27562
|
+
return null;
|
|
27563
|
+
}
|
|
27564
|
+
|
|
27565
|
+
if (componentOrElement.nodeType === ELEMENT_NODE) {
|
|
27566
|
+
return componentOrElement;
|
|
27567
|
+
}
|
|
27568
|
+
|
|
27569
|
+
{
|
|
27570
|
+
return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
|
|
27571
|
+
}
|
|
27572
|
+
|
|
27573
|
+
return findHostInstance(componentOrElement);
|
|
27574
|
+
}
|
|
27575
|
+
function hydrate(element, container, callback) {
|
|
27510
27576
|
if (!isValidContainer(container)) {
|
|
27511
27577
|
{
|
|
27512
27578
|
throw Error("Target container is not a DOM element.");
|
|
27513
27579
|
}
|
|
27514
|
-
}
|
|
27580
|
+
}
|
|
27515
27581
|
|
|
27582
|
+
{
|
|
27583
|
+
var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
|
|
27516
27584
|
|
|
27517
|
-
|
|
27518
|
-
}
|
|
27585
|
+
if (isModernRoot) {
|
|
27586
|
+
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)?');
|
|
27587
|
+
}
|
|
27588
|
+
} // TODO: throw or warn if we couldn't hydrate?
|
|
27519
27589
|
|
|
27520
|
-
|
|
27521
|
-
|
|
27522
|
-
|
|
27590
|
+
|
|
27591
|
+
return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
|
|
27592
|
+
}
|
|
27593
|
+
function render(element, container, callback) {
|
|
27594
|
+
if (!isValidContainer(container)) {
|
|
27523
27595
|
{
|
|
27524
|
-
|
|
27596
|
+
throw Error("Target container is not a DOM element.");
|
|
27597
|
+
}
|
|
27598
|
+
}
|
|
27525
27599
|
|
|
27526
|
-
|
|
27527
|
-
|
|
27528
|
-
|
|
27529
|
-
|
|
27530
|
-
|
|
27600
|
+
{
|
|
27601
|
+
var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
|
|
27602
|
+
|
|
27603
|
+
if (isModernRoot) {
|
|
27604
|
+
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)?');
|
|
27531
27605
|
}
|
|
27606
|
+
}
|
|
27532
27607
|
|
|
27533
|
-
|
|
27534
|
-
|
|
27608
|
+
return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
|
|
27609
|
+
}
|
|
27610
|
+
function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
|
|
27611
|
+
if (!isValidContainer(containerNode)) {
|
|
27612
|
+
{
|
|
27613
|
+
throw Error("Target container is not a DOM element.");
|
|
27535
27614
|
}
|
|
27615
|
+
}
|
|
27536
27616
|
|
|
27537
|
-
|
|
27538
|
-
|
|
27617
|
+
if (!(parentComponent != null && has(parentComponent))) {
|
|
27618
|
+
{
|
|
27619
|
+
throw Error("parentComponent must be a valid React Component");
|
|
27539
27620
|
}
|
|
27621
|
+
}
|
|
27540
27622
|
|
|
27623
|
+
return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
|
|
27624
|
+
}
|
|
27625
|
+
function unmountComponentAtNode(container) {
|
|
27626
|
+
if (!isValidContainer(container)) {
|
|
27541
27627
|
{
|
|
27542
|
-
|
|
27628
|
+
throw Error("unmountComponentAtNode(...): Target container is not a DOM element.");
|
|
27543
27629
|
}
|
|
27630
|
+
}
|
|
27544
27631
|
|
|
27545
|
-
|
|
27546
|
-
|
|
27547
|
-
|
|
27548
|
-
if (
|
|
27549
|
-
|
|
27550
|
-
throw Error("Target container is not a DOM element.");
|
|
27551
|
-
}
|
|
27632
|
+
{
|
|
27633
|
+
var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
|
|
27634
|
+
|
|
27635
|
+
if (isModernRoot) {
|
|
27636
|
+
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()?');
|
|
27552
27637
|
}
|
|
27638
|
+
}
|
|
27553
27639
|
|
|
27640
|
+
if (container._reactRootContainer) {
|
|
27554
27641
|
{
|
|
27555
|
-
|
|
27556
|
-
|
|
27642
|
+
var rootEl = getReactRootElementInContainer(container);
|
|
27643
|
+
var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
|
|
27644
|
+
!!renderedByDifferentReact ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
|
|
27645
|
+
} // Unmount should not be batched.
|
|
27557
27646
|
|
|
27558
27647
|
|
|
27559
|
-
|
|
27560
|
-
|
|
27561
|
-
|
|
27562
|
-
|
|
27563
|
-
|
|
27564
|
-
|
|
27565
|
-
|
|
27566
|
-
}
|
|
27648
|
+
unbatchedUpdates(function () {
|
|
27649
|
+
legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
|
|
27650
|
+
container._reactRootContainer = null;
|
|
27651
|
+
unmarkContainerAsRoot(container);
|
|
27652
|
+
});
|
|
27653
|
+
}); // If you call unmountComponentAtNode twice in quick succession, you'll
|
|
27654
|
+
// get `true` twice. That's probably fine?
|
|
27567
27655
|
|
|
27656
|
+
return true;
|
|
27657
|
+
} else {
|
|
27568
27658
|
{
|
|
27569
|
-
|
|
27570
|
-
}
|
|
27659
|
+
var _rootEl = getReactRootElementInContainer(container);
|
|
27571
27660
|
|
|
27572
|
-
|
|
27573
|
-
},
|
|
27574
|
-
unstable_renderSubtreeIntoContainer: function (parentComponent, element, containerNode, callback) {
|
|
27575
|
-
if (!isValidContainer(containerNode)) {
|
|
27576
|
-
{
|
|
27577
|
-
throw Error("Target container is not a DOM element.");
|
|
27578
|
-
}
|
|
27579
|
-
}
|
|
27661
|
+
var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl)); // Check if the container itself is a React root node.
|
|
27580
27662
|
|
|
27581
|
-
|
|
27582
|
-
|
|
27583
|
-
throw Error("parentComponent must be a valid React Component");
|
|
27584
|
-
}
|
|
27663
|
+
var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
|
|
27664
|
+
!!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;
|
|
27585
27665
|
}
|
|
27586
27666
|
|
|
27587
|
-
return
|
|
27588
|
-
}
|
|
27589
|
-
|
|
27590
|
-
if (!isValidContainer(container)) {
|
|
27591
|
-
{
|
|
27592
|
-
throw Error("unmountComponentAtNode(...): Target container is not a DOM element.");
|
|
27593
|
-
}
|
|
27594
|
-
}
|
|
27667
|
+
return false;
|
|
27668
|
+
}
|
|
27669
|
+
}
|
|
27595
27670
|
|
|
27596
|
-
|
|
27597
|
-
|
|
27598
|
-
|
|
27671
|
+
function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
|
|
27672
|
+
implementation) {
|
|
27673
|
+
var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
27674
|
+
return {
|
|
27675
|
+
// This tag allow us to uniquely identify this as a React Portal
|
|
27676
|
+
$$typeof: REACT_PORTAL_TYPE,
|
|
27677
|
+
key: key == null ? null : '' + key,
|
|
27678
|
+
children: children,
|
|
27679
|
+
containerInfo: containerInfo,
|
|
27680
|
+
implementation: implementation
|
|
27681
|
+
};
|
|
27682
|
+
}
|
|
27599
27683
|
|
|
27600
|
-
|
|
27601
|
-
{
|
|
27602
|
-
var rootEl = getReactRootElementInContainer(container);
|
|
27603
|
-
var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
|
|
27604
|
-
!!renderedByDifferentReact ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
|
|
27605
|
-
} // Unmount should not be batched.
|
|
27684
|
+
// TODO: this is special because it gets imported during build.
|
|
27606
27685
|
|
|
27686
|
+
var ReactVersion = '16.12.0';
|
|
27607
27687
|
|
|
27608
|
-
|
|
27609
|
-
|
|
27610
|
-
|
|
27611
|
-
|
|
27612
|
-
|
|
27613
|
-
// get `true` twice. That's probably fine?
|
|
27688
|
+
setAttemptSynchronousHydration(attemptSynchronousHydration$1);
|
|
27689
|
+
setAttemptUserBlockingHydration(attemptUserBlockingHydration$1);
|
|
27690
|
+
setAttemptContinuousHydration(attemptContinuousHydration$1);
|
|
27691
|
+
setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1);
|
|
27692
|
+
var didWarnAboutUnstableCreatePortal = false;
|
|
27614
27693
|
|
|
27615
|
-
|
|
27616
|
-
|
|
27617
|
-
|
|
27618
|
-
|
|
27694
|
+
{
|
|
27695
|
+
if (typeof Map !== 'function' || // $FlowIssue Flow incorrectly thinks Map has no prototype
|
|
27696
|
+
Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowIssue Flow incorrectly thinks Set has no prototype
|
|
27697
|
+
Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
|
|
27698
|
+
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');
|
|
27699
|
+
}
|
|
27700
|
+
}
|
|
27619
27701
|
|
|
27620
|
-
|
|
27702
|
+
setRestoreImplementation(restoreControlledState$$1);
|
|
27703
|
+
setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1);
|
|
27621
27704
|
|
|
27622
|
-
|
|
27623
|
-
|
|
27624
|
-
}
|
|
27705
|
+
function createPortal$$1(children, container) {
|
|
27706
|
+
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
27625
27707
|
|
|
27626
|
-
|
|
27708
|
+
if (!isValidContainer(container)) {
|
|
27709
|
+
{
|
|
27710
|
+
throw Error("Target container is not a DOM element.");
|
|
27627
27711
|
}
|
|
27628
|
-
}
|
|
27712
|
+
} // TODO: pass ReactDOM portal implementation as third argument
|
|
27713
|
+
|
|
27714
|
+
|
|
27715
|
+
return createPortal$1(children, container, null, key);
|
|
27716
|
+
}
|
|
27717
|
+
|
|
27718
|
+
var ReactDOM = {
|
|
27719
|
+
createPortal: createPortal$$1,
|
|
27720
|
+
// Legacy
|
|
27721
|
+
findDOMNode: findDOMNode,
|
|
27722
|
+
hydrate: hydrate,
|
|
27723
|
+
render: render,
|
|
27724
|
+
unstable_renderSubtreeIntoContainer: unstable_renderSubtreeIntoContainer,
|
|
27725
|
+
unmountComponentAtNode: unmountComponentAtNode,
|
|
27629
27726
|
// Temporary alias since we already shipped React 16 RC with it.
|
|
27630
27727
|
// TODO: remove in React 17.
|
|
27631
27728
|
unstable_createPortal: function () {
|
|
@@ -27645,38 +27742,9 @@ var ReactDOM = {
|
|
|
27645
27742
|
}
|
|
27646
27743
|
};
|
|
27647
27744
|
|
|
27648
|
-
function createRoot(container, options) {
|
|
27649
|
-
if (!isValidContainer(container)) {
|
|
27650
|
-
{
|
|
27651
|
-
throw Error("createRoot(...): Target container is not a DOM element.");
|
|
27652
|
-
}
|
|
27653
|
-
}
|
|
27654
|
-
|
|
27655
|
-
warnIfReactDOMContainerInDEV(container);
|
|
27656
|
-
return new ReactRoot(container, options);
|
|
27657
|
-
}
|
|
27658
|
-
|
|
27659
|
-
function createSyncRoot(container, options) {
|
|
27660
|
-
if (!isValidContainer(container)) {
|
|
27661
|
-
{
|
|
27662
|
-
throw Error("createRoot(...): Target container is not a DOM element.");
|
|
27663
|
-
}
|
|
27664
|
-
}
|
|
27665
|
-
|
|
27666
|
-
warnIfReactDOMContainerInDEV(container);
|
|
27667
|
-
return new ReactSyncRoot(container, BatchedRoot, options);
|
|
27668
|
-
}
|
|
27669
|
-
|
|
27670
|
-
function warnIfReactDOMContainerInDEV(container) {
|
|
27671
|
-
{
|
|
27672
|
-
!!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;
|
|
27673
|
-
container._reactHasBeenPassedToCreateRootDEV = true;
|
|
27674
|
-
}
|
|
27675
|
-
}
|
|
27676
|
-
|
|
27677
27745
|
if (exposeConcurrentModeAPIs) {
|
|
27678
27746
|
ReactDOM.createRoot = createRoot;
|
|
27679
|
-
ReactDOM.
|
|
27747
|
+
ReactDOM.createBlockingRoot = createBlockingRoot;
|
|
27680
27748
|
ReactDOM.unstable_discreteUpdates = discreteUpdates$1;
|
|
27681
27749
|
ReactDOM.unstable_flushDiscreteUpdates = flushDiscreteUpdates;
|
|
27682
27750
|
ReactDOM.unstable_flushControlled = flushControlled;
|