react-router-dom-v5-compat 6.17.0-pre.0 → 6.17.0-pre.2
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/CHANGELOG.md +16 -0
- package/dist/index.js +233 -43
- package/dist/index.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/react-router-dom/index.d.ts +25 -3
- package/dist/umd/react-router-dom-v5-compat.development.js +249 -45
- package/dist/umd/react-router-dom-v5-compat.development.js.map +1 -1
- package/dist/umd/react-router-dom-v5-compat.production.min.js +2 -2
- package/dist/umd/react-router-dom-v5-compat.production.min.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# `react-router-dom-v5-compat`
|
|
2
2
|
|
|
3
|
+
## 6.17.0-pre.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- `react-router-dom@6.17.0-pre.2`
|
|
9
|
+
- `react-router@6.17.0-pre.2`
|
|
10
|
+
|
|
11
|
+
## 6.17.0-pre.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies:
|
|
16
|
+
- `react-router@6.17.0-pre.1`
|
|
17
|
+
- `react-router-dom@6.17.0-pre.1`
|
|
18
|
+
|
|
3
19
|
## 6.17.0-pre.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router DOM v5 Compat v6.17.0-pre.
|
|
2
|
+
* React Router DOM v5 Compat v6.17.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
|
-
import { UNSAFE_mapRouteProperties, Router, UNSAFE_NavigationContext, useHref, useResolvedPath, useLocation,
|
|
13
|
-
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router,
|
|
12
|
+
import { UNSAFE_mapRouteProperties, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, Router, UNSAFE_useRoutesImpl, UNSAFE_NavigationContext, useHref, useResolvedPath, useLocation, useNavigate, createPath, UNSAFE_useRouteId, UNSAFE_RouteContext, useMatches, useNavigation, unstable_useBlocker, Routes, Route } from 'react-router';
|
|
13
|
+
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, unstable_useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
|
|
14
14
|
import { stripBasename, UNSAFE_warning, createRouter, createBrowserHistory, createHashHistory, UNSAFE_ErrorResponseImpl, UNSAFE_invariant, joinPaths, matchPath } from '@remix-run/router';
|
|
15
15
|
import { parsePath, Action, createPath as createPath$1 } from 'history';
|
|
16
16
|
import { Route as Route$1, useHistory } from 'react-router-dom';
|
|
@@ -290,6 +290,12 @@ function deserializeErrors(errors) {
|
|
|
290
290
|
}
|
|
291
291
|
return serialized;
|
|
292
292
|
}
|
|
293
|
+
const ViewTransitionContext = /*#__PURE__*/React.createContext({
|
|
294
|
+
isTransitioning: false
|
|
295
|
+
});
|
|
296
|
+
if (process.env.NODE_ENV !== "production") {
|
|
297
|
+
ViewTransitionContext.displayName = "ViewTransition";
|
|
298
|
+
}
|
|
293
299
|
//#endregion
|
|
294
300
|
////////////////////////////////////////////////////////////////////////////////
|
|
295
301
|
//#region Components
|
|
@@ -317,16 +323,200 @@ function deserializeErrors(errors) {
|
|
|
317
323
|
*/
|
|
318
324
|
const START_TRANSITION = "startTransition";
|
|
319
325
|
const startTransitionImpl = React[START_TRANSITION];
|
|
326
|
+
function startTransitionSafe(cb) {
|
|
327
|
+
if (startTransitionImpl) {
|
|
328
|
+
startTransitionImpl(cb);
|
|
329
|
+
} else {
|
|
330
|
+
cb();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
class Deferred {
|
|
334
|
+
constructor() {
|
|
335
|
+
this.status = "pending";
|
|
336
|
+
this.promise = new Promise((resolve, reject) => {
|
|
337
|
+
this.resolve = value => {
|
|
338
|
+
if (this.status === "pending") {
|
|
339
|
+
this.status = "resolved";
|
|
340
|
+
resolve(value);
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
this.reject = reason => {
|
|
344
|
+
if (this.status === "pending") {
|
|
345
|
+
this.status = "rejected";
|
|
346
|
+
reject(reason);
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Given a Remix Router instance, render the appropriate UI
|
|
354
|
+
*/
|
|
355
|
+
function RouterProvider(_ref) {
|
|
356
|
+
let {
|
|
357
|
+
fallbackElement,
|
|
358
|
+
router,
|
|
359
|
+
future
|
|
360
|
+
} = _ref;
|
|
361
|
+
let [state, setStateImpl] = React.useState(router.state);
|
|
362
|
+
let [pendingState, setPendingState] = React.useState();
|
|
363
|
+
let [vtContext, setVtContext] = React.useState({
|
|
364
|
+
isTransitioning: false
|
|
365
|
+
});
|
|
366
|
+
let [renderDfd, setRenderDfd] = React.useState();
|
|
367
|
+
let [transition, setTransition] = React.useState();
|
|
368
|
+
let [interruption, setInterruption] = React.useState();
|
|
369
|
+
let {
|
|
370
|
+
v7_startTransition
|
|
371
|
+
} = future || {};
|
|
372
|
+
let optInStartTransition = React.useCallback(cb => {
|
|
373
|
+
if (v7_startTransition) {
|
|
374
|
+
startTransitionSafe(cb);
|
|
375
|
+
} else {
|
|
376
|
+
cb();
|
|
377
|
+
}
|
|
378
|
+
}, [v7_startTransition]);
|
|
379
|
+
let setState = React.useCallback((newState, _ref2) => {
|
|
380
|
+
let {
|
|
381
|
+
unstable_viewTransitionOpts: viewTransitionOpts
|
|
382
|
+
} = _ref2;
|
|
383
|
+
if (!viewTransitionOpts || router.window == null || typeof router.window.document.startViewTransition !== "function") {
|
|
384
|
+
// Mid-navigation state update, or startViewTransition isn't available
|
|
385
|
+
optInStartTransition(() => setStateImpl(newState));
|
|
386
|
+
} else if (transition && renderDfd) {
|
|
387
|
+
// Interrupting an in-progress transition, cancel and let everything flush
|
|
388
|
+
// out, and then kick off a new transition from the interruption state
|
|
389
|
+
renderDfd.resolve();
|
|
390
|
+
transition.skipTransition();
|
|
391
|
+
setInterruption({
|
|
392
|
+
state: newState,
|
|
393
|
+
currentLocation: viewTransitionOpts.currentLocation,
|
|
394
|
+
nextLocation: viewTransitionOpts.nextLocation
|
|
395
|
+
});
|
|
396
|
+
} else {
|
|
397
|
+
// Completed navigation update with opted-in view transitions, let 'er rip
|
|
398
|
+
setPendingState(newState);
|
|
399
|
+
setVtContext({
|
|
400
|
+
isTransitioning: true,
|
|
401
|
+
currentLocation: viewTransitionOpts.currentLocation,
|
|
402
|
+
nextLocation: viewTransitionOpts.nextLocation
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}, [optInStartTransition, transition, renderDfd, router.window]);
|
|
406
|
+
// Need to use a layout effect here so we are subscribed early enough to
|
|
407
|
+
// pick up on any render-driven redirects/navigations (useEffect/<Navigate>)
|
|
408
|
+
React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
|
|
409
|
+
// When we start a view transition, create a Deferred we can use for the
|
|
410
|
+
// eventual "completed" render
|
|
411
|
+
React.useEffect(() => {
|
|
412
|
+
if (vtContext.isTransitioning) {
|
|
413
|
+
setRenderDfd(new Deferred());
|
|
414
|
+
}
|
|
415
|
+
}, [vtContext.isTransitioning]);
|
|
416
|
+
// Once the deferred is created, kick off startViewTransition() to update the
|
|
417
|
+
// DOM and then wait on the Deferred to resolve (indicating the DOM update has
|
|
418
|
+
// happened)
|
|
419
|
+
React.useEffect(() => {
|
|
420
|
+
if (renderDfd && pendingState && router.window) {
|
|
421
|
+
let newState = pendingState;
|
|
422
|
+
let renderPromise = renderDfd.promise;
|
|
423
|
+
let transition = router.window.document.startViewTransition(async () => {
|
|
424
|
+
optInStartTransition(() => setStateImpl(newState));
|
|
425
|
+
await renderPromise;
|
|
426
|
+
});
|
|
427
|
+
transition.finished.finally(() => {
|
|
428
|
+
setRenderDfd(undefined);
|
|
429
|
+
setTransition(undefined);
|
|
430
|
+
setPendingState(undefined);
|
|
431
|
+
setVtContext({
|
|
432
|
+
isTransitioning: false
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
setTransition(transition);
|
|
436
|
+
}
|
|
437
|
+
}, [optInStartTransition, pendingState, renderDfd, router.window]);
|
|
438
|
+
// When the new location finally renders and is committed to the DOM, this
|
|
439
|
+
// effect will run to resolve the transition
|
|
440
|
+
React.useEffect(() => {
|
|
441
|
+
if (renderDfd && pendingState && state.location.key === pendingState.location.key) {
|
|
442
|
+
renderDfd.resolve();
|
|
443
|
+
}
|
|
444
|
+
}, [renderDfd, transition, state.location, pendingState]);
|
|
445
|
+
// If we get interrupted with a new navigation during a transition, we skip
|
|
446
|
+
// the active transition, let it cleanup, then kick it off again here
|
|
447
|
+
React.useEffect(() => {
|
|
448
|
+
if (!vtContext.isTransitioning && interruption) {
|
|
449
|
+
setPendingState(interruption.state);
|
|
450
|
+
setVtContext({
|
|
451
|
+
isTransitioning: true,
|
|
452
|
+
currentLocation: interruption.currentLocation,
|
|
453
|
+
nextLocation: interruption.nextLocation
|
|
454
|
+
});
|
|
455
|
+
setInterruption(undefined);
|
|
456
|
+
}
|
|
457
|
+
}, [vtContext.isTransitioning, interruption]);
|
|
458
|
+
let navigator = React.useMemo(() => {
|
|
459
|
+
return {
|
|
460
|
+
createHref: router.createHref,
|
|
461
|
+
encodeLocation: router.encodeLocation,
|
|
462
|
+
go: n => router.navigate(n),
|
|
463
|
+
push: (to, state, opts) => router.navigate(to, {
|
|
464
|
+
state,
|
|
465
|
+
preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
|
|
466
|
+
}),
|
|
467
|
+
replace: (to, state, opts) => router.navigate(to, {
|
|
468
|
+
replace: true,
|
|
469
|
+
state,
|
|
470
|
+
preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
|
|
471
|
+
})
|
|
472
|
+
};
|
|
473
|
+
}, [router]);
|
|
474
|
+
let basename = router.basename || "/";
|
|
475
|
+
let dataRouterContext = React.useMemo(() => ({
|
|
476
|
+
router,
|
|
477
|
+
navigator,
|
|
478
|
+
static: false,
|
|
479
|
+
basename
|
|
480
|
+
}), [router, navigator, basename]);
|
|
481
|
+
// The fragment and {null} here are important! We need them to keep React 18's
|
|
482
|
+
// useId happy when we are server-rendering since we may have a <script> here
|
|
483
|
+
// containing the hydrated server-side staticContext (from StaticRouterProvider).
|
|
484
|
+
// useId relies on the component tree structure to generate deterministic id's
|
|
485
|
+
// so we need to ensure it remains the same on the client even though
|
|
486
|
+
// we don't need the <script> tag
|
|
487
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UNSAFE_DataRouterContext.Provider, {
|
|
488
|
+
value: dataRouterContext
|
|
489
|
+
}, /*#__PURE__*/React.createElement(UNSAFE_DataRouterStateContext.Provider, {
|
|
490
|
+
value: state
|
|
491
|
+
}, /*#__PURE__*/React.createElement(ViewTransitionContext.Provider, {
|
|
492
|
+
value: vtContext
|
|
493
|
+
}, /*#__PURE__*/React.createElement(Router, {
|
|
494
|
+
basename: basename,
|
|
495
|
+
location: state.location,
|
|
496
|
+
navigationType: state.historyAction,
|
|
497
|
+
navigator: navigator
|
|
498
|
+
}, state.initialized ? /*#__PURE__*/React.createElement(DataRoutes, {
|
|
499
|
+
routes: router.routes,
|
|
500
|
+
state: state
|
|
501
|
+
}) : fallbackElement)))), null);
|
|
502
|
+
}
|
|
503
|
+
function DataRoutes(_ref3) {
|
|
504
|
+
let {
|
|
505
|
+
routes,
|
|
506
|
+
state
|
|
507
|
+
} = _ref3;
|
|
508
|
+
return UNSAFE_useRoutesImpl(routes, undefined, state);
|
|
509
|
+
}
|
|
320
510
|
/**
|
|
321
511
|
* A `<Router>` for use in web browsers. Provides the cleanest URLs.
|
|
322
512
|
*/
|
|
323
|
-
function BrowserRouter(
|
|
513
|
+
function BrowserRouter(_ref4) {
|
|
324
514
|
let {
|
|
325
515
|
basename,
|
|
326
516
|
children,
|
|
327
517
|
future,
|
|
328
518
|
window
|
|
329
|
-
} =
|
|
519
|
+
} = _ref4;
|
|
330
520
|
let historyRef = React.useRef();
|
|
331
521
|
if (historyRef.current == null) {
|
|
332
522
|
historyRef.current = createBrowserHistory({
|
|
@@ -358,13 +548,13 @@ function BrowserRouter(_ref) {
|
|
|
358
548
|
* A `<Router>` for use in web browsers. Stores the location in the hash
|
|
359
549
|
* portion of the URL so it is not sent to the server.
|
|
360
550
|
*/
|
|
361
|
-
function HashRouter(
|
|
551
|
+
function HashRouter(_ref5) {
|
|
362
552
|
let {
|
|
363
553
|
basename,
|
|
364
554
|
children,
|
|
365
555
|
future,
|
|
366
556
|
window
|
|
367
|
-
} =
|
|
557
|
+
} = _ref5;
|
|
368
558
|
let historyRef = React.useRef();
|
|
369
559
|
if (historyRef.current == null) {
|
|
370
560
|
historyRef.current = createHashHistory({
|
|
@@ -398,13 +588,13 @@ function HashRouter(_ref2) {
|
|
|
398
588
|
* two versions of the history library to your bundles unless you use the same
|
|
399
589
|
* version of the history library that React Router uses internally.
|
|
400
590
|
*/
|
|
401
|
-
function HistoryRouter(
|
|
591
|
+
function HistoryRouter(_ref6) {
|
|
402
592
|
let {
|
|
403
593
|
basename,
|
|
404
594
|
children,
|
|
405
595
|
future,
|
|
406
596
|
history
|
|
407
|
-
} =
|
|
597
|
+
} = _ref6;
|
|
408
598
|
let [state, setStateImpl] = React.useState({
|
|
409
599
|
action: history.action,
|
|
410
600
|
location: history.location
|
|
@@ -432,7 +622,7 @@ const ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
|
432
622
|
/**
|
|
433
623
|
* The public API for rendering a history-aware `<a>`.
|
|
434
624
|
*/
|
|
435
|
-
const Link = /*#__PURE__*/React.forwardRef(function LinkWithRef(
|
|
625
|
+
const Link = /*#__PURE__*/React.forwardRef(function LinkWithRef(_ref7, ref) {
|
|
436
626
|
let {
|
|
437
627
|
onClick,
|
|
438
628
|
relative,
|
|
@@ -443,8 +633,8 @@ const Link = /*#__PURE__*/React.forwardRef(function LinkWithRef(_ref4, ref) {
|
|
|
443
633
|
to,
|
|
444
634
|
preventScrollReset,
|
|
445
635
|
unstable_viewTransition
|
|
446
|
-
} =
|
|
447
|
-
rest = _objectWithoutPropertiesLoose(
|
|
636
|
+
} = _ref7,
|
|
637
|
+
rest = _objectWithoutPropertiesLoose(_ref7, _excluded);
|
|
448
638
|
let {
|
|
449
639
|
basename
|
|
450
640
|
} = React.useContext(UNSAFE_NavigationContext);
|
|
@@ -507,7 +697,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
507
697
|
/**
|
|
508
698
|
* A `<Link>` wrapper that knows if it's "active" or not.
|
|
509
699
|
*/
|
|
510
|
-
const NavLink = /*#__PURE__*/React.forwardRef(function NavLinkWithRef(
|
|
700
|
+
const NavLink = /*#__PURE__*/React.forwardRef(function NavLinkWithRef(_ref8, ref) {
|
|
511
701
|
let {
|
|
512
702
|
"aria-current": ariaCurrentProp = "page",
|
|
513
703
|
caseSensitive = false,
|
|
@@ -517,8 +707,8 @@ const NavLink = /*#__PURE__*/React.forwardRef(function NavLinkWithRef(_ref5, ref
|
|
|
517
707
|
to,
|
|
518
708
|
unstable_viewTransition,
|
|
519
709
|
children
|
|
520
|
-
} =
|
|
521
|
-
rest = _objectWithoutPropertiesLoose(
|
|
710
|
+
} = _ref8,
|
|
711
|
+
rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
|
|
522
712
|
let path = useResolvedPath(to, {
|
|
523
713
|
relative: rest.relative
|
|
524
714
|
});
|
|
@@ -587,7 +777,7 @@ const Form = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
587
777
|
if (process.env.NODE_ENV !== "production") {
|
|
588
778
|
Form.displayName = "Form";
|
|
589
779
|
}
|
|
590
|
-
const FormImpl = /*#__PURE__*/React.forwardRef((
|
|
780
|
+
const FormImpl = /*#__PURE__*/React.forwardRef((_ref9, forwardedRef) => {
|
|
591
781
|
let {
|
|
592
782
|
reloadDocument,
|
|
593
783
|
replace,
|
|
@@ -599,8 +789,8 @@ const FormImpl = /*#__PURE__*/React.forwardRef((_ref6, forwardedRef) => {
|
|
|
599
789
|
relative,
|
|
600
790
|
preventScrollReset,
|
|
601
791
|
unstable_viewTransition
|
|
602
|
-
} =
|
|
603
|
-
props = _objectWithoutPropertiesLoose(
|
|
792
|
+
} = _ref9,
|
|
793
|
+
props = _objectWithoutPropertiesLoose(_ref9, _excluded3);
|
|
604
794
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
605
795
|
let formAction = useFormAction(action, {
|
|
606
796
|
relative
|
|
@@ -634,11 +824,11 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
634
824
|
* This component will emulate the browser's scroll restoration on location
|
|
635
825
|
* changes.
|
|
636
826
|
*/
|
|
637
|
-
function ScrollRestoration(
|
|
827
|
+
function ScrollRestoration(_ref10) {
|
|
638
828
|
let {
|
|
639
829
|
getKey,
|
|
640
830
|
storageKey
|
|
641
|
-
} =
|
|
831
|
+
} = _ref10;
|
|
642
832
|
useScrollRestoration({
|
|
643
833
|
getKey,
|
|
644
834
|
storageKey
|
|
@@ -658,7 +848,6 @@ var DataRouterHook;
|
|
|
658
848
|
DataRouterHook["UseSubmit"] = "useSubmit";
|
|
659
849
|
DataRouterHook["UseSubmitFetcher"] = "useSubmitFetcher";
|
|
660
850
|
DataRouterHook["UseFetcher"] = "useFetcher";
|
|
661
|
-
DataRouterHook["useViewTransitionStates"] = "useViewTransitionStates";
|
|
662
851
|
DataRouterHook["useViewTransitionState"] = "useViewTransitionState";
|
|
663
852
|
})(DataRouterHook || (DataRouterHook = {}));
|
|
664
853
|
var DataRouterStateHook;
|
|
@@ -1072,11 +1261,11 @@ function usePageHide(callback, options) {
|
|
|
1072
1261
|
* very incorrectly in some cases) across browsers if user click addition
|
|
1073
1262
|
* back/forward navigations while the confirm is open. Use at your own risk.
|
|
1074
1263
|
*/
|
|
1075
|
-
function usePrompt(
|
|
1264
|
+
function usePrompt(_ref11) {
|
|
1076
1265
|
let {
|
|
1077
1266
|
when,
|
|
1078
1267
|
message
|
|
1079
|
-
} =
|
|
1268
|
+
} = _ref11;
|
|
1080
1269
|
let blocker = unstable_useBlocker(when);
|
|
1081
1270
|
React.useEffect(() => {
|
|
1082
1271
|
if (blocker.state === "blocked") {
|
|
@@ -1109,32 +1298,33 @@ function useViewTransitionState(to, opts) {
|
|
|
1109
1298
|
if (opts === void 0) {
|
|
1110
1299
|
opts = {};
|
|
1111
1300
|
}
|
|
1112
|
-
let vtContext = React.useContext(
|
|
1301
|
+
let vtContext = React.useContext(ViewTransitionContext);
|
|
1302
|
+
!(vtContext != null) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. " + "Did you accidentally import `RouterProvider` from `react-router`?") : UNSAFE_invariant(false) : void 0;
|
|
1113
1303
|
let {
|
|
1114
1304
|
basename
|
|
1115
1305
|
} = useDataRouterContext(DataRouterHook.useViewTransitionState);
|
|
1116
1306
|
let path = useResolvedPath(to, {
|
|
1117
1307
|
relative: opts.relative
|
|
1118
1308
|
});
|
|
1119
|
-
if (vtContext.isTransitioning) {
|
|
1120
|
-
|
|
1121
|
-
let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1122
|
-
// Transition is active if we're going to or coming from the indicated
|
|
1123
|
-
// destination. This ensures that other PUSH navigations that reverse
|
|
1124
|
-
// an indicated transition apply. I.e., on the list view you have:
|
|
1125
|
-
//
|
|
1126
|
-
// <NavLink to="/details/1" unstable_viewTransition>
|
|
1127
|
-
//
|
|
1128
|
-
// If you click the breadcrumb back to the list view:
|
|
1129
|
-
//
|
|
1130
|
-
// <NavLink to="/list" unstable_viewTransition>
|
|
1131
|
-
//
|
|
1132
|
-
// We should apply the transition because it's indicated as active going
|
|
1133
|
-
// from /list -> /details/1 and therefore should be active on the reverse
|
|
1134
|
-
// (even though this isn't strictly a POP reverse)
|
|
1135
|
-
return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
|
|
1309
|
+
if (!vtContext.isTransitioning) {
|
|
1310
|
+
return false;
|
|
1136
1311
|
}
|
|
1137
|
-
|
|
1312
|
+
let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1313
|
+
let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1314
|
+
// Transition is active if we're going to or coming from the indicated
|
|
1315
|
+
// destination. This ensures that other PUSH navigations that reverse
|
|
1316
|
+
// an indicated transition apply. I.e., on the list view you have:
|
|
1317
|
+
//
|
|
1318
|
+
// <NavLink to="/details/1" unstable_viewTransition>
|
|
1319
|
+
//
|
|
1320
|
+
// If you click the breadcrumb back to the list view:
|
|
1321
|
+
//
|
|
1322
|
+
// <NavLink to="/list" unstable_viewTransition>
|
|
1323
|
+
//
|
|
1324
|
+
// We should apply the transition because it's indicated as active going
|
|
1325
|
+
// from /list -> /details/1 and therefore should be active on the reverse
|
|
1326
|
+
// (even though this isn't strictly a POP reverse)
|
|
1327
|
+
return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
|
|
1138
1328
|
}
|
|
1139
1329
|
//#endregion
|
|
1140
1330
|
|
|
@@ -1241,5 +1431,5 @@ function StaticRouter(_ref2) {
|
|
|
1241
1431
|
});
|
|
1242
1432
|
}
|
|
1243
1433
|
|
|
1244
|
-
export { BrowserRouter, CompatRoute, CompatRouter, Form, HashRouter, Link, NavLink, ScrollRestoration, StaticRouter, useScrollRestoration as UNSAFE_useScrollRestoration, createBrowserRouter, createHashRouter, createSearchParams, HistoryRouter as unstable_HistoryRouter, usePrompt as unstable_usePrompt, useBeforeUnload, useFetcher, useFetchers, useFormAction, useLinkClickHandler, useSearchParams, useSubmit };
|
|
1434
|
+
export { BrowserRouter, CompatRoute, CompatRouter, Form, HashRouter, Link, NavLink, RouterProvider, ScrollRestoration, StaticRouter, useScrollRestoration as UNSAFE_useScrollRestoration, createBrowserRouter, createHashRouter, createSearchParams, HistoryRouter as unstable_HistoryRouter, usePrompt as unstable_usePrompt, useBeforeUnload, useFetcher, useFetchers, useFormAction, useLinkClickHandler, useSearchParams, useSubmit };
|
|
1245
1435
|
//# sourceMappingURL=index.js.map
|