1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | import { invariant, joinPaths, matchPath, UNSAFE_getPathContributingMatches, warning, resolveTo, parsePath, matchRoutes, Action, isRouteErrorResponse, createMemoryHistory, stripBasename, AbortedDeferredError, createRouter } from '@remix-run/router';
|
12 | export { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, resolvePath } from '@remix-run/router';
|
13 | import * as React from 'react';
|
14 |
|
15 | function _extends() {
|
16 | _extends = Object.assign ? Object.assign.bind() : function (target) {
|
17 | for (var i = 1; i < arguments.length; i++) {
|
18 | var source = arguments[i];
|
19 |
|
20 | for (var key in source) {
|
21 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
22 | target[key] = source[key];
|
23 | }
|
24 | }
|
25 | }
|
26 |
|
27 | return target;
|
28 | };
|
29 | return _extends.apply(this, arguments);
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | function isPolyfill(x, y) {
|
44 | return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y
|
45 | ;
|
46 | }
|
47 |
|
48 | const is = typeof Object.is === "function" ? Object.is : isPolyfill;
|
49 |
|
50 |
|
51 | const {
|
52 | useState,
|
53 | useEffect,
|
54 | useLayoutEffect,
|
55 | useDebugValue
|
56 | } = React;
|
57 | let didWarnOld18Alpha = false;
|
58 | let didWarnUncachedGetSnapshot = false;
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | function useSyncExternalStore$2(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
70 | // React do not expose a way to check if we're hydrating. So users of the shim
|
71 |
|
72 |
|
73 | getServerSnapshot) {
|
74 | if (process.env.NODE_ENV !== "production") {
|
75 | if (!didWarnOld18Alpha) {
|
76 | if ("startTransition" in React) {
|
77 | didWarnOld18Alpha = true;
|
78 | console.error("You are using an outdated, pre-release alpha of React 18 that " + "does not support useSyncExternalStore. The " + "use-sync-external-store shim will not work correctly. Upgrade " + "to a newer pre-release.");
|
79 | }
|
80 | }
|
81 | }
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | const value = getSnapshot();
|
88 |
|
89 | if (process.env.NODE_ENV !== "production") {
|
90 | if (!didWarnUncachedGetSnapshot) {
|
91 | const cachedValue = getSnapshot();
|
92 |
|
93 | if (!is(value, cachedValue)) {
|
94 | console.error("The result of getSnapshot should be cached to avoid an infinite loop");
|
95 | didWarnUncachedGetSnapshot = true;
|
96 | }
|
97 | }
|
98 | }
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 | const [{
|
115 | inst
|
116 | }, forceUpdate] = useState({
|
117 | inst: {
|
118 | value,
|
119 | getSnapshot
|
120 | }
|
121 | });
|
122 |
|
123 |
|
124 |
|
125 | useLayoutEffect(() => {
|
126 | inst.value = value;
|
127 | inst.getSnapshot = getSnapshot;
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | if (checkIfSnapshotChanged(inst)) {
|
133 |
|
134 | forceUpdate({
|
135 | inst
|
136 | });
|
137 | }
|
138 |
|
139 | }, [subscribe, value, getSnapshot]);
|
140 | useEffect(() => {
|
141 |
|
142 |
|
143 | if (checkIfSnapshotChanged(inst)) {
|
144 |
|
145 | forceUpdate({
|
146 | inst
|
147 | });
|
148 | }
|
149 |
|
150 | const handleStoreChange = () => {
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 | if (checkIfSnapshotChanged(inst)) {
|
158 |
|
159 | forceUpdate({
|
160 | inst
|
161 | });
|
162 | }
|
163 | };
|
164 |
|
165 |
|
166 | return subscribe(handleStoreChange);
|
167 | }, [subscribe]);
|
168 | useDebugValue(value);
|
169 | return value;
|
170 | }
|
171 |
|
172 | function checkIfSnapshotChanged(inst) {
|
173 | const latestGetSnapshot = inst.getSnapshot;
|
174 | const prevValue = inst.value;
|
175 |
|
176 | try {
|
177 | const nextValue = latestGetSnapshot();
|
178 | return !is(prevValue, nextValue);
|
179 | } catch (error) {
|
180 | return true;
|
181 | }
|
182 | }
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 | function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
193 |
|
194 |
|
195 |
|
196 |
|
197 | return getSnapshot();
|
198 | }
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 | const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
206 | const isServerEnvironment = !canUseDOM;
|
207 | const shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
208 | const useSyncExternalStore = "useSyncExternalStore" in React ? (module => module.useSyncExternalStore)(React) : shim;
|
209 |
|
210 | const DataRouterContext = React.createContext(null);
|
211 |
|
212 | if (process.env.NODE_ENV !== "production") {
|
213 | DataRouterContext.displayName = "DataRouter";
|
214 | }
|
215 |
|
216 | const DataRouterStateContext = React.createContext(null);
|
217 |
|
218 | if (process.env.NODE_ENV !== "production") {
|
219 | DataRouterStateContext.displayName = "DataRouterState";
|
220 | }
|
221 |
|
222 | const AwaitContext = React.createContext(null);
|
223 |
|
224 | if (process.env.NODE_ENV !== "production") {
|
225 | AwaitContext.displayName = "Await";
|
226 | }
|
227 |
|
228 | const NavigationContext = React.createContext(null);
|
229 |
|
230 | if (process.env.NODE_ENV !== "production") {
|
231 | NavigationContext.displayName = "Navigation";
|
232 | }
|
233 |
|
234 | const LocationContext = React.createContext(null);
|
235 |
|
236 | if (process.env.NODE_ENV !== "production") {
|
237 | LocationContext.displayName = "Location";
|
238 | }
|
239 |
|
240 | const RouteContext = React.createContext({
|
241 | outlet: null,
|
242 | matches: []
|
243 | });
|
244 |
|
245 | if (process.env.NODE_ENV !== "production") {
|
246 | RouteContext.displayName = "Route";
|
247 | }
|
248 |
|
249 | const RouteErrorContext = React.createContext(null);
|
250 |
|
251 | if (process.env.NODE_ENV !== "production") {
|
252 | RouteErrorContext.displayName = "RouteError";
|
253 | }
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 | function useHref(to, _temp) {
|
263 | let {
|
264 | relative
|
265 | } = _temp === void 0 ? {} : _temp;
|
266 | !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false,
|
267 |
|
268 | "useHref() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
|
269 | let {
|
270 | basename,
|
271 | navigator
|
272 | } = React.useContext(NavigationContext);
|
273 | let {
|
274 | hash,
|
275 | pathname,
|
276 | search
|
277 | } = useResolvedPath(to, {
|
278 | relative
|
279 | });
|
280 | let joinedPathname = pathname;
|
281 |
|
282 |
|
283 |
|
284 |
|
285 | if (basename !== "/") {
|
286 | joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
|
287 | }
|
288 |
|
289 | return navigator.createHref({
|
290 | pathname: joinedPathname,
|
291 | search,
|
292 | hash
|
293 | });
|
294 | }
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 | function useInRouterContext() {
|
302 | return React.useContext(LocationContext) != null;
|
303 | }
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 | function useLocation() {
|
316 | !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false,
|
317 |
|
318 | "useLocation() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
|
319 | return React.useContext(LocationContext).location;
|
320 | }
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 | function useNavigationType() {
|
329 | return React.useContext(LocationContext).navigationType;
|
330 | }
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 | function useMatch(pattern) {
|
340 | !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false,
|
341 |
|
342 | "useMatch() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
|
343 | let {
|
344 | pathname
|
345 | } = useLocation();
|
346 | return React.useMemo(() => matchPath(pattern, pathname), [pathname, pattern]);
|
347 | }
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 | function useNavigate() {
|
359 | !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false,
|
360 |
|
361 | "useNavigate() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
|
362 | let {
|
363 | basename,
|
364 | navigator
|
365 | } = React.useContext(NavigationContext);
|
366 | let {
|
367 | matches
|
368 | } = React.useContext(RouteContext);
|
369 | let {
|
370 | pathname: locationPathname
|
371 | } = useLocation();
|
372 | let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));
|
373 | let activeRef = React.useRef(false);
|
374 | React.useEffect(() => {
|
375 | activeRef.current = true;
|
376 | });
|
377 | let navigate = React.useCallback(function (to, options) {
|
378 | if (options === void 0) {
|
379 | options = {};
|
380 | }
|
381 |
|
382 | process.env.NODE_ENV !== "production" ? warning(activeRef.current, "You should call navigate() in a React.useEffect(), not when " + "your component is first rendered.") : void 0;
|
383 | if (!activeRef.current) return;
|
384 |
|
385 | if (typeof to === "number") {
|
386 | navigator.go(to);
|
387 | return;
|
388 | }
|
389 |
|
390 | let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
|
391 |
|
392 |
|
393 |
|
394 |
|
395 | if (basename !== "/") {
|
396 | path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
397 | }
|
398 |
|
399 | (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);
|
400 | }, [basename, navigator, routePathnamesJson, locationPathname]);
|
401 | return navigate;
|
402 | }
|
403 | const OutletContext = React.createContext(null);
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 | function useOutletContext() {
|
411 | return React.useContext(OutletContext);
|
412 | }
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 | function useOutlet(context) {
|
421 | let outlet = React.useContext(RouteContext).outlet;
|
422 |
|
423 | if (outlet) {
|
424 | return React.createElement(OutletContext.Provider, {
|
425 | value: context
|
426 | }, outlet);
|
427 | }
|
428 |
|
429 | return outlet;
|
430 | }
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 | function useParams() {
|
439 | let {
|
440 | matches
|
441 | } = React.useContext(RouteContext);
|
442 | let routeMatch = matches[matches.length - 1];
|
443 | return routeMatch ? routeMatch.params : {};
|
444 | }
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 | function useResolvedPath(to, _temp2) {
|
452 | let {
|
453 | relative
|
454 | } = _temp2 === void 0 ? {} : _temp2;
|
455 | let {
|
456 | matches
|
457 | } = React.useContext(RouteContext);
|
458 | let {
|
459 | pathname: locationPathname
|
460 | } = useLocation();
|
461 | let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));
|
462 | return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
|
463 | }
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 | function useRoutes(routes, locationArg) {
|
474 | !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false,
|
475 |
|
476 | "useRoutes() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
|
477 | let {
|
478 | navigator
|
479 | } = React.useContext(NavigationContext);
|
480 | let dataRouterStateContext = React.useContext(DataRouterStateContext);
|
481 | let {
|
482 | matches: parentMatches
|
483 | } = React.useContext(RouteContext);
|
484 | let routeMatch = parentMatches[parentMatches.length - 1];
|
485 | let parentParams = routeMatch ? routeMatch.params : {};
|
486 | let parentPathname = routeMatch ? routeMatch.pathname : "/";
|
487 | let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
|
488 | let parentRoute = routeMatch && routeMatch.route;
|
489 |
|
490 | if (process.env.NODE_ENV !== "production") {
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 | let parentPath = parentRoute && parentRoute.path || "";
|
512 | warningOnce(parentPathname, !parentRoute || parentPath.endsWith("*"), "You rendered descendant <Routes> (or called `useRoutes()`) at " + ("\"" + parentPathname + "\" (under <Route path=\"" + parentPath + "\">) but the ") + "parent route path has no trailing \"*\". This means if you navigate " + "deeper, the parent won't match anymore and therefore the child " + "routes will never render.\n\n" + ("Please change the parent <Route path=\"" + parentPath + "\"> to <Route ") + ("path=\"" + (parentPath === "/" ? "*" : parentPath + "/*") + "\">."));
|
513 | }
|
514 |
|
515 | let locationFromContext = useLocation();
|
516 | let location;
|
517 |
|
518 | if (locationArg) {
|
519 | var _parsedLocationArg$pa;
|
520 |
|
521 | let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
522 | !(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== "production" ? invariant(false, "When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, " + "the location pathname must begin with the portion of the URL pathname that was " + ("matched by all parent routes. The current pathname base is \"" + parentPathnameBase + "\" ") + ("but pathname \"" + parsedLocationArg.pathname + "\" was given in the `location` prop.")) : invariant(false) : void 0;
|
523 | location = parsedLocationArg;
|
524 | } else {
|
525 | location = locationFromContext;
|
526 | }
|
527 |
|
528 | let pathname = location.pathname || "/";
|
529 | let remainingPathname = parentPathnameBase === "/" ? pathname : pathname.slice(parentPathnameBase.length) || "/";
|
530 | let matches = matchRoutes(routes, {
|
531 | pathname: remainingPathname
|
532 | });
|
533 |
|
534 | if (process.env.NODE_ENV !== "production") {
|
535 | process.env.NODE_ENV !== "production" ? warning(parentRoute || matches != null, "No routes matched location \"" + location.pathname + location.search + location.hash + "\" ") : void 0;
|
536 | process.env.NODE_ENV !== "production" ? warning(matches == null || matches[matches.length - 1].route.element !== undefined, "Matched leaf route at location \"" + location.pathname + location.search + location.hash + "\" does not have an element. " + "This means it will render an <Outlet /> with a null value by default resulting in an \"empty\" page.") : void 0;
|
537 | }
|
538 |
|
539 | let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {
|
540 | params: Object.assign({}, parentParams, match.params),
|
541 | pathname: joinPaths([parentPathnameBase,
|
542 | navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),
|
543 | pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([parentPathnameBase,
|
544 | navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])
|
545 | })), parentMatches, dataRouterStateContext || undefined);
|
546 |
|
547 |
|
548 |
|
549 |
|
550 | if (locationArg && renderedMatches) {
|
551 | return React.createElement(LocationContext.Provider, {
|
552 | value: {
|
553 | location: _extends({
|
554 | pathname: "/",
|
555 | search: "",
|
556 | hash: "",
|
557 | state: null,
|
558 | key: "default"
|
559 | }, location),
|
560 | navigationType: Action.Pop
|
561 | }
|
562 | }, renderedMatches);
|
563 | }
|
564 |
|
565 | return renderedMatches;
|
566 | }
|
567 |
|
568 | function DefaultErrorElement() {
|
569 | let error = useRouteError();
|
570 | let message = isRouteErrorResponse(error) ? error.status + " " + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);
|
571 | let stack = error instanceof Error ? error.stack : null;
|
572 | let lightgrey = "rgba(200,200,200, 0.5)";
|
573 | let preStyles = {
|
574 | padding: "0.5rem",
|
575 | backgroundColor: lightgrey
|
576 | };
|
577 | let codeStyles = {
|
578 | padding: "2px 4px",
|
579 | backgroundColor: lightgrey
|
580 | };
|
581 | return React.createElement(React.Fragment, null, React.createElement("h2", null, "Unhandled Thrown Error!"), React.createElement("h3", {
|
582 | style: {
|
583 | fontStyle: "italic"
|
584 | }
|
585 | }, message), stack ? React.createElement("pre", {
|
586 | style: preStyles
|
587 | }, stack) : null, React.createElement("p", null, "\uD83D\uDCBF Hey developer \uD83D\uDC4B"), React.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own\xA0", React.createElement("code", {
|
588 | style: codeStyles
|
589 | }, "errorElement"), " props on\xA0", React.createElement("code", {
|
590 | style: codeStyles
|
591 | }, "<Route>")));
|
592 | }
|
593 |
|
594 | class RenderErrorBoundary extends React.Component {
|
595 | constructor(props) {
|
596 | super(props);
|
597 | this.state = {
|
598 | location: props.location,
|
599 | error: props.error
|
600 | };
|
601 | }
|
602 |
|
603 | static getDerivedStateFromError(error) {
|
604 | return {
|
605 | error: error
|
606 | };
|
607 | }
|
608 |
|
609 | static getDerivedStateFromProps(props, state) {
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 | if (state.location !== props.location) {
|
619 | return {
|
620 | error: props.error,
|
621 | location: props.location
|
622 | };
|
623 | }
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 | return {
|
630 | error: props.error || state.error,
|
631 | location: state.location
|
632 | };
|
633 | }
|
634 |
|
635 | componentDidCatch(error, errorInfo) {
|
636 | console.error("React Router caught the following error during render", error, errorInfo);
|
637 | }
|
638 |
|
639 | render() {
|
640 | return this.state.error ? React.createElement(RouteContext.Provider, {
|
641 | value: this.props.routeContext
|
642 | }, React.createElement(RouteErrorContext.Provider, {
|
643 | value: this.state.error,
|
644 | children: this.props.component
|
645 | })) : this.props.children;
|
646 | }
|
647 |
|
648 | }
|
649 |
|
650 | function RenderedRoute(_ref) {
|
651 | let {
|
652 | routeContext,
|
653 | match,
|
654 | children
|
655 | } = _ref;
|
656 | let dataRouterContext = React.useContext(DataRouterContext);
|
657 |
|
658 |
|
659 | if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && match.route.errorElement) {
|
660 | dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
|
661 | }
|
662 |
|
663 | return React.createElement(RouteContext.Provider, {
|
664 | value: routeContext
|
665 | }, children);
|
666 | }
|
667 |
|
668 | function _renderMatches(matches, parentMatches, dataRouterState) {
|
669 | if (parentMatches === void 0) {
|
670 | parentMatches = [];
|
671 | }
|
672 |
|
673 | if (matches == null) {
|
674 | if (dataRouterState != null && dataRouterState.errors) {
|
675 |
|
676 |
|
677 | matches = dataRouterState.matches;
|
678 | } else {
|
679 | return null;
|
680 | }
|
681 | }
|
682 |
|
683 | let renderedMatches = matches;
|
684 |
|
685 | let errors = dataRouterState == null ? void 0 : dataRouterState.errors;
|
686 |
|
687 | if (errors != null) {
|
688 | let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]));
|
689 | !(errorIndex >= 0) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not find a matching route for the current errors: " + errors) : invariant(false) : void 0;
|
690 | renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));
|
691 | }
|
692 |
|
693 | return renderedMatches.reduceRight((outlet, match, index) => {
|
694 | let error = match.route.id ? errors == null ? void 0 : errors[match.route.id] : null;
|
695 |
|
696 | let errorElement = dataRouterState ? match.route.errorElement || React.createElement(DefaultErrorElement, null) : null;
|
697 | let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));
|
698 |
|
699 | let getChildren = () => React.createElement(RenderedRoute, {
|
700 | match: match,
|
701 | routeContext: {
|
702 | outlet,
|
703 | matches
|
704 | }
|
705 | }, error ? errorElement : match.route.element !== undefined ? match.route.element : outlet);
|
706 |
|
707 |
|
708 |
|
709 |
|
710 | return dataRouterState && (match.route.errorElement || index === 0) ? React.createElement(RenderErrorBoundary, {
|
711 | location: dataRouterState.location,
|
712 | component: errorElement,
|
713 | error: error,
|
714 | children: getChildren(),
|
715 | routeContext: {
|
716 | outlet: null,
|
717 | matches
|
718 | }
|
719 | }) : getChildren();
|
720 | }, null);
|
721 | }
|
722 | var DataRouterHook;
|
723 |
|
724 | (function (DataRouterHook) {
|
725 | DataRouterHook["UseBlocker"] = "useBlocker";
|
726 | DataRouterHook["UseRevalidator"] = "useRevalidator";
|
727 | })(DataRouterHook || (DataRouterHook = {}));
|
728 |
|
729 | var DataRouterStateHook;
|
730 |
|
731 | (function (DataRouterStateHook) {
|
732 | DataRouterStateHook["UseLoaderData"] = "useLoaderData";
|
733 | DataRouterStateHook["UseActionData"] = "useActionData";
|
734 | DataRouterStateHook["UseRouteError"] = "useRouteError";
|
735 | DataRouterStateHook["UseNavigation"] = "useNavigation";
|
736 | DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
|
737 | DataRouterStateHook["UseMatches"] = "useMatches";
|
738 | DataRouterStateHook["UseRevalidator"] = "useRevalidator";
|
739 | })(DataRouterStateHook || (DataRouterStateHook = {}));
|
740 |
|
741 | function getDataRouterConsoleError(hookName) {
|
742 | return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
|
743 | }
|
744 |
|
745 | function useDataRouterContext(hookName) {
|
746 | let ctx = React.useContext(DataRouterContext);
|
747 | !ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
|
748 | return ctx;
|
749 | }
|
750 |
|
751 | function useDataRouterState(hookName) {
|
752 | let state = React.useContext(DataRouterStateContext);
|
753 | !state ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
|
754 | return state;
|
755 | }
|
756 |
|
757 | function useRouteContext(hookName) {
|
758 | let route = React.useContext(RouteContext);
|
759 | !route ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
|
760 | return route;
|
761 | }
|
762 |
|
763 | function useCurrentRouteId(hookName) {
|
764 | let route = useRouteContext(hookName);
|
765 | let thisRoute = route.matches[route.matches.length - 1];
|
766 | !thisRoute.route.id ? process.env.NODE_ENV !== "production" ? invariant(false, hookName + " can only be used on routes that contain a unique \"id\"") : invariant(false) : void 0;
|
767 | return thisRoute.route.id;
|
768 | }
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 | function useNavigation() {
|
776 | let state = useDataRouterState(DataRouterStateHook.UseNavigation);
|
777 | return state.navigation;
|
778 | }
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 | function useRevalidator() {
|
785 | let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);
|
786 | let state = useDataRouterState(DataRouterStateHook.UseRevalidator);
|
787 | return {
|
788 | revalidate: dataRouterContext.router.revalidate,
|
789 | state: state.revalidation
|
790 | };
|
791 | }
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 | function useMatches() {
|
798 | let {
|
799 | matches,
|
800 | loaderData
|
801 | } = useDataRouterState(DataRouterStateHook.UseMatches);
|
802 | return React.useMemo(() => matches.map(match => {
|
803 | let {
|
804 | pathname,
|
805 | params
|
806 | } = match;
|
807 |
|
808 |
|
809 |
|
810 | return {
|
811 | id: match.route.id,
|
812 | pathname,
|
813 | params,
|
814 | data: loaderData[match.route.id],
|
815 | handle: match.route.handle
|
816 | };
|
817 | }), [matches, loaderData]);
|
818 | }
|
819 |
|
820 |
|
821 |
|
822 |
|
823 | function useLoaderData() {
|
824 | let state = useDataRouterState(DataRouterStateHook.UseLoaderData);
|
825 | let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);
|
826 |
|
827 | if (state.errors && state.errors[routeId] != null) {
|
828 | console.error("You cannot `useLoaderData` in an errorElement (routeId: " + routeId + ")");
|
829 | return undefined;
|
830 | }
|
831 |
|
832 | return state.loaderData[routeId];
|
833 | }
|
834 |
|
835 |
|
836 |
|
837 |
|
838 | function useRouteLoaderData(routeId) {
|
839 | let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);
|
840 | return state.loaderData[routeId];
|
841 | }
|
842 |
|
843 |
|
844 |
|
845 |
|
846 | function useActionData() {
|
847 | let state = useDataRouterState(DataRouterStateHook.UseActionData);
|
848 | let route = React.useContext(RouteContext);
|
849 | !route ? process.env.NODE_ENV !== "production" ? invariant(false, "useActionData must be used inside a RouteContext") : invariant(false) : void 0;
|
850 | return Object.values((state == null ? void 0 : state.actionData) || {})[0];
|
851 | }
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 | function useRouteError() {
|
859 | var _state$errors;
|
860 |
|
861 | let error = React.useContext(RouteErrorContext);
|
862 | let state = useDataRouterState(DataRouterStateHook.UseRouteError);
|
863 | let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);
|
864 |
|
865 |
|
866 | if (error) {
|
867 | return error;
|
868 | }
|
869 |
|
870 |
|
871 | return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];
|
872 | }
|
873 |
|
874 |
|
875 |
|
876 |
|
877 | function useAsyncValue() {
|
878 | let value = React.useContext(AwaitContext);
|
879 | return value == null ? void 0 : value._data;
|
880 | }
|
881 |
|
882 |
|
883 |
|
884 |
|
885 | function useAsyncError() {
|
886 | let value = React.useContext(AwaitContext);
|
887 | return value == null ? void 0 : value._error;
|
888 | }
|
889 |
|
890 |
|
891 | let blockerKey = "blocker-singleton";
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 | function useBlocker(shouldBlock) {
|
900 | let {
|
901 | router
|
902 | } = useDataRouterContext(DataRouterHook.UseBlocker);
|
903 | let blockerFunction = React.useCallback(args => {
|
904 | return typeof shouldBlock === "function" ? !!shouldBlock(args) : !!shouldBlock;
|
905 | }, [shouldBlock]);
|
906 | let blocker = router.getBlocker(blockerKey, blockerFunction);
|
907 |
|
908 | React.useEffect(() => () => router.deleteBlocker(blockerKey), [router]);
|
909 | return blocker;
|
910 | }
|
911 | const alreadyWarned = {};
|
912 |
|
913 | function warningOnce(key, cond, message) {
|
914 | if (!cond && !alreadyWarned[key]) {
|
915 | alreadyWarned[key] = true;
|
916 | process.env.NODE_ENV !== "production" ? warning(false, message) : void 0;
|
917 | }
|
918 | }
|
919 |
|
920 |
|
921 |
|
922 |
|
923 | function RouterProvider(_ref) {
|
924 | let {
|
925 | fallbackElement,
|
926 | router
|
927 | } = _ref;
|
928 |
|
929 | let state = useSyncExternalStore(router.subscribe, () => router.state,
|
930 |
|
931 |
|
932 | () => router.state);
|
933 | let navigator = React.useMemo(() => {
|
934 | return {
|
935 | createHref: router.createHref,
|
936 | encodeLocation: router.encodeLocation,
|
937 | go: n => router.navigate(n),
|
938 | push: (to, state, opts) => router.navigate(to, {
|
939 | state,
|
940 | preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
|
941 | }),
|
942 | replace: (to, state, opts) => router.navigate(to, {
|
943 | replace: true,
|
944 | state,
|
945 | preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
|
946 | })
|
947 | };
|
948 | }, [router]);
|
949 | let basename = router.basename || "/";
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 | return React.createElement(React.Fragment, null, React.createElement(DataRouterContext.Provider, {
|
957 | value: {
|
958 | router,
|
959 | navigator,
|
960 | static: false,
|
961 |
|
962 | basename
|
963 | }
|
964 | }, React.createElement(DataRouterStateContext.Provider, {
|
965 | value: state
|
966 | }, React.createElement(Router, {
|
967 | basename: router.basename,
|
968 | location: router.state.location,
|
969 | navigationType: router.state.historyAction,
|
970 | navigator: navigator
|
971 | }, router.state.initialized ? React.createElement(Routes, null) : fallbackElement))), null);
|
972 | }
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 | function MemoryRouter(_ref2) {
|
980 | let {
|
981 | basename,
|
982 | children,
|
983 | initialEntries,
|
984 | initialIndex
|
985 | } = _ref2;
|
986 | let historyRef = React.useRef();
|
987 |
|
988 | if (historyRef.current == null) {
|
989 | historyRef.current = createMemoryHistory({
|
990 | initialEntries,
|
991 | initialIndex,
|
992 | v5Compat: true
|
993 | });
|
994 | }
|
995 |
|
996 | let history = historyRef.current;
|
997 | let [state, setState] = React.useState({
|
998 | action: history.action,
|
999 | location: history.location
|
1000 | });
|
1001 | React.useLayoutEffect(() => history.listen(setState), [history]);
|
1002 | return React.createElement(Router, {
|
1003 | basename: basename,
|
1004 | children: children,
|
1005 | location: state.location,
|
1006 | navigationType: state.action,
|
1007 | navigator: history
|
1008 | });
|
1009 | }
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 | function Navigate(_ref3) {
|
1021 | let {
|
1022 | to,
|
1023 | replace,
|
1024 | state,
|
1025 | relative
|
1026 | } = _ref3;
|
1027 | !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false,
|
1028 |
|
1029 | "<Navigate> may be used only in the context of a <Router> component.") : invariant(false) : void 0;
|
1030 | process.env.NODE_ENV !== "production" ? warning(!React.useContext(NavigationContext).static, "<Navigate> must not be used on the initial render in a <StaticRouter>. " + "This is a no-op, but you should modify your code so the <Navigate> is " + "only ever rendered in response to some user interaction or state change.") : void 0;
|
1031 | let dataRouterState = React.useContext(DataRouterStateContext);
|
1032 | let navigate = useNavigate();
|
1033 | React.useEffect(() => {
|
1034 |
|
1035 |
|
1036 |
|
1037 | if (dataRouterState && dataRouterState.navigation.state !== "idle") {
|
1038 | return;
|
1039 | }
|
1040 |
|
1041 | navigate(to, {
|
1042 | replace,
|
1043 | state,
|
1044 | relative
|
1045 | });
|
1046 | });
|
1047 | return null;
|
1048 | }
|
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 | function Outlet(props) {
|
1056 | return useOutlet(props.context);
|
1057 | }
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 | function Route(_props) {
|
1065 | process.env.NODE_ENV !== "production" ? invariant(false, "A <Route> is only ever to be used as the child of <Routes> element, " + "never rendered directly. Please wrap your <Route> in a <Routes>.") : invariant(false) ;
|
1066 | }
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 | function Router(_ref4) {
|
1078 | let {
|
1079 | basename: basenameProp = "/",
|
1080 | children = null,
|
1081 | location: locationProp,
|
1082 | navigationType = Action.Pop,
|
1083 | navigator,
|
1084 | static: staticProp = false
|
1085 | } = _ref4;
|
1086 | !!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, "You cannot render a <Router> inside another <Router>." + " You should never have more than one in your app.") : invariant(false) : void 0;
|
1087 |
|
1088 |
|
1089 | let basename = basenameProp.replace(/^\/*/, "/");
|
1090 | let navigationContext = React.useMemo(() => ({
|
1091 | basename,
|
1092 | navigator,
|
1093 | static: staticProp
|
1094 | }), [basename, navigator, staticProp]);
|
1095 |
|
1096 | if (typeof locationProp === "string") {
|
1097 | locationProp = parsePath(locationProp);
|
1098 | }
|
1099 |
|
1100 | let {
|
1101 | pathname = "/",
|
1102 | search = "",
|
1103 | hash = "",
|
1104 | state = null,
|
1105 | key = "default"
|
1106 | } = locationProp;
|
1107 | let location = React.useMemo(() => {
|
1108 | let trailingPathname = stripBasename(pathname, basename);
|
1109 |
|
1110 | if (trailingPathname == null) {
|
1111 | return null;
|
1112 | }
|
1113 |
|
1114 | return {
|
1115 | pathname: trailingPathname,
|
1116 | search,
|
1117 | hash,
|
1118 | state,
|
1119 | key
|
1120 | };
|
1121 | }, [basename, pathname, search, hash, state, key]);
|
1122 | process.env.NODE_ENV !== "production" ? warning(location != null, "<Router basename=\"" + basename + "\"> is not able to match the URL " + ("\"" + pathname + search + hash + "\" because it does not start with the ") + "basename, so the <Router> won't render anything.") : void 0;
|
1123 |
|
1124 | if (location == null) {
|
1125 | return null;
|
1126 | }
|
1127 |
|
1128 | return React.createElement(NavigationContext.Provider, {
|
1129 | value: navigationContext
|
1130 | }, React.createElement(LocationContext.Provider, {
|
1131 | children: children,
|
1132 | value: {
|
1133 | location,
|
1134 | navigationType
|
1135 | }
|
1136 | }));
|
1137 | }
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 | function Routes(_ref5) {
|
1146 | let {
|
1147 | children,
|
1148 | location
|
1149 | } = _ref5;
|
1150 | let dataRouterContext = React.useContext(DataRouterContext);
|
1151 |
|
1152 |
|
1153 |
|
1154 | let routes = dataRouterContext && !children ? dataRouterContext.router.routes : createRoutesFromChildren(children);
|
1155 | return useRoutes(routes, location);
|
1156 | }
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 | function Await(_ref6) {
|
1163 | let {
|
1164 | children,
|
1165 | errorElement,
|
1166 | resolve
|
1167 | } = _ref6;
|
1168 | return React.createElement(AwaitErrorBoundary, {
|
1169 | resolve: resolve,
|
1170 | errorElement: errorElement
|
1171 | }, React.createElement(ResolveAwait, null, children));
|
1172 | }
|
1173 | var AwaitRenderStatus;
|
1174 |
|
1175 | (function (AwaitRenderStatus) {
|
1176 | AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
|
1177 | AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
|
1178 | AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
|
1179 | })(AwaitRenderStatus || (AwaitRenderStatus = {}));
|
1180 |
|
1181 | const neverSettledPromise = new Promise(() => {});
|
1182 |
|
1183 | class AwaitErrorBoundary extends React.Component {
|
1184 | constructor(props) {
|
1185 | super(props);
|
1186 | this.state = {
|
1187 | error: null
|
1188 | };
|
1189 | }
|
1190 |
|
1191 | static getDerivedStateFromError(error) {
|
1192 | return {
|
1193 | error
|
1194 | };
|
1195 | }
|
1196 |
|
1197 | componentDidCatch(error, errorInfo) {
|
1198 | console.error("<Await> caught the following error during render", error, errorInfo);
|
1199 | }
|
1200 |
|
1201 | render() {
|
1202 | let {
|
1203 | children,
|
1204 | errorElement,
|
1205 | resolve
|
1206 | } = this.props;
|
1207 | let promise = null;
|
1208 | let status = AwaitRenderStatus.pending;
|
1209 |
|
1210 | if (!(resolve instanceof Promise)) {
|
1211 |
|
1212 | status = AwaitRenderStatus.success;
|
1213 | promise = Promise.resolve();
|
1214 | Object.defineProperty(promise, "_tracked", {
|
1215 | get: () => true
|
1216 | });
|
1217 | Object.defineProperty(promise, "_data", {
|
1218 | get: () => resolve
|
1219 | });
|
1220 | } else if (this.state.error) {
|
1221 |
|
1222 | status = AwaitRenderStatus.error;
|
1223 | let renderError = this.state.error;
|
1224 | promise = Promise.reject().catch(() => {});
|
1225 |
|
1226 | Object.defineProperty(promise, "_tracked", {
|
1227 | get: () => true
|
1228 | });
|
1229 | Object.defineProperty(promise, "_error", {
|
1230 | get: () => renderError
|
1231 | });
|
1232 | } else if (resolve._tracked) {
|
1233 |
|
1234 | promise = resolve;
|
1235 | status = promise._error !== undefined ? AwaitRenderStatus.error : promise._data !== undefined ? AwaitRenderStatus.success : AwaitRenderStatus.pending;
|
1236 | } else {
|
1237 |
|
1238 | status = AwaitRenderStatus.pending;
|
1239 | Object.defineProperty(resolve, "_tracked", {
|
1240 | get: () => true
|
1241 | });
|
1242 | promise = resolve.then(data => Object.defineProperty(resolve, "_data", {
|
1243 | get: () => data
|
1244 | }), error => Object.defineProperty(resolve, "_error", {
|
1245 | get: () => error
|
1246 | }));
|
1247 | }
|
1248 |
|
1249 | if (status === AwaitRenderStatus.error && promise._error instanceof AbortedDeferredError) {
|
1250 |
|
1251 | throw neverSettledPromise;
|
1252 | }
|
1253 |
|
1254 | if (status === AwaitRenderStatus.error && !errorElement) {
|
1255 |
|
1256 | throw promise._error;
|
1257 | }
|
1258 |
|
1259 | if (status === AwaitRenderStatus.error) {
|
1260 |
|
1261 | return React.createElement(AwaitContext.Provider, {
|
1262 | value: promise,
|
1263 | children: errorElement
|
1264 | });
|
1265 | }
|
1266 |
|
1267 | if (status === AwaitRenderStatus.success) {
|
1268 |
|
1269 | return React.createElement(AwaitContext.Provider, {
|
1270 | value: promise,
|
1271 | children: children
|
1272 | });
|
1273 | }
|
1274 |
|
1275 |
|
1276 | throw promise;
|
1277 | }
|
1278 |
|
1279 | }
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 | function ResolveAwait(_ref7) {
|
1287 | let {
|
1288 | children
|
1289 | } = _ref7;
|
1290 | let data = useAsyncValue();
|
1291 | let toRender = typeof children === "function" ? children(data) : children;
|
1292 | return React.createElement(React.Fragment, null, toRender);
|
1293 | }
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 | function createRoutesFromChildren(children, parentPath) {
|
1307 | if (parentPath === void 0) {
|
1308 | parentPath = [];
|
1309 | }
|
1310 |
|
1311 | let routes = [];
|
1312 | React.Children.forEach(children, (element, index) => {
|
1313 | if (! React.isValidElement(element)) {
|
1314 |
|
1315 |
|
1316 | return;
|
1317 | }
|
1318 |
|
1319 | if (element.type === React.Fragment) {
|
1320 |
|
1321 | routes.push.apply(routes, createRoutesFromChildren(element.props.children, parentPath));
|
1322 | return;
|
1323 | }
|
1324 |
|
1325 | !(element.type === Route) ? process.env.NODE_ENV !== "production" ? invariant(false, "[" + (typeof element.type === "string" ? element.type : element.type.name) + "] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>") : invariant(false) : void 0;
|
1326 | !(!element.props.index || !element.props.children) ? process.env.NODE_ENV !== "production" ? invariant(false, "An index route cannot have child routes.") : invariant(false) : void 0;
|
1327 | let treePath = [...parentPath, index];
|
1328 | let route = {
|
1329 | id: element.props.id || treePath.join("-"),
|
1330 | caseSensitive: element.props.caseSensitive,
|
1331 | element: element.props.element,
|
1332 | index: element.props.index,
|
1333 | path: element.props.path,
|
1334 | loader: element.props.loader,
|
1335 | action: element.props.action,
|
1336 | errorElement: element.props.errorElement,
|
1337 | hasErrorBoundary: element.props.errorElement != null,
|
1338 | shouldRevalidate: element.props.shouldRevalidate,
|
1339 | handle: element.props.handle
|
1340 | };
|
1341 |
|
1342 | if (element.props.children) {
|
1343 | route.children = createRoutesFromChildren(element.props.children, treePath);
|
1344 | }
|
1345 |
|
1346 | routes.push(route);
|
1347 | });
|
1348 | return routes;
|
1349 | }
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 | function renderMatches(matches) {
|
1355 | return _renderMatches(matches);
|
1356 | }
|
1357 |
|
1358 |
|
1359 |
|
1360 |
|
1361 |
|
1362 |
|
1363 | function enhanceManualRouteObjects(routes) {
|
1364 | return routes.map(route => {
|
1365 | let routeClone = _extends({}, route);
|
1366 |
|
1367 | if (routeClone.hasErrorBoundary == null) {
|
1368 | routeClone.hasErrorBoundary = routeClone.errorElement != null;
|
1369 | }
|
1370 |
|
1371 | if (routeClone.children) {
|
1372 | routeClone.children = enhanceManualRouteObjects(routeClone.children);
|
1373 | }
|
1374 |
|
1375 | return routeClone;
|
1376 | });
|
1377 | }
|
1378 |
|
1379 | function createMemoryRouter(routes, opts) {
|
1380 | return createRouter({
|
1381 | basename: opts == null ? void 0 : opts.basename,
|
1382 | history: createMemoryHistory({
|
1383 | initialEntries: opts == null ? void 0 : opts.initialEntries,
|
1384 | initialIndex: opts == null ? void 0 : opts.initialIndex
|
1385 | }),
|
1386 | hydrationData: opts == null ? void 0 : opts.hydrationData,
|
1387 | routes: enhanceManualRouteObjects(routes)
|
1388 | }).initialize();
|
1389 | }
|
1390 |
|
1391 | export { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, enhanceManualRouteObjects as UNSAFE_enhanceManualRouteObjects, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, useBlocker as unstable_useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
1392 |
|