react-router-dom
Advanced tools
Comparing version 6.0.0-beta.6 to 6.0.0-beta.7
import * as React from "react"; | ||
import { MemoryRouter, Navigate, Outlet, Route, Router, Routes, createRoutesFromChildren, generatePath, matchRoutes, matchPath, resolvePath, renderMatches, useBlocker, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes } from "react-router"; | ||
import { MemoryRouter, Navigate, Outlet, Route, Router, Routes, createRoutesFromChildren, generatePath, matchRoutes, matchPath, resolvePath, renderMatches, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes } from "react-router"; | ||
import type { State, To } from "history"; | ||
export { MemoryRouter, Navigate, Outlet, Route, Router, Routes, createRoutesFromChildren, generatePath, matchRoutes, matchPath, renderMatches, resolvePath, useBlocker, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes }; | ||
export { MemoryRouter, Navigate, Outlet, Route, Router, Routes, createRoutesFromChildren, generatePath, matchRoutes, matchPath, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes }; | ||
export type { MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigator, OutletProps, Params, PathMatch, RouteMatch, RouteObject, RouteProps, PathRouteProps, LayoutRouteProps, IndexRouteProps, RouterProps, RoutesProps } from "react-router"; | ||
@@ -50,15 +50,3 @@ /** @internal */ | ||
export declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>; | ||
export interface PromptProps { | ||
message: string; | ||
when?: boolean; | ||
} | ||
/** | ||
* A declarative interface for showing a window.confirm dialog with the given | ||
* message when the user tries to navigate away from the current page. | ||
* | ||
* This also serves as a reference implementation for anyone who wants to | ||
* create their own custom prompt component. | ||
*/ | ||
export declare function Prompt({ message, when }: PromptProps): null; | ||
/** | ||
* Handles the click behavior for router `<Link>` components. This is useful if | ||
@@ -74,7 +62,2 @@ * you need to create custom `<Link>` compoments with the same click behavior we | ||
/** | ||
* Prevents navigation away from the current page using a window.confirm prompt | ||
* with the given message. | ||
*/ | ||
export declare function usePrompt(message: string, when?: boolean): void; | ||
/** | ||
* A convenient wrapper for reading and writing search parameters via the | ||
@@ -81,0 +64,0 @@ * URLSearchParams interface. |
60
index.js
/** | ||
* React Router DOM v6.0.0-beta.6 | ||
* React Router DOM v6.0.0-beta.7 | ||
* | ||
@@ -13,4 +13,4 @@ * Copyright (c) Remix Software Inc. | ||
import { createBrowserHistory, createHashHistory, createPath } from 'history'; | ||
import { Router, useHref, useLocation, useResolvedPath, useNavigate, useBlocker } from 'react-router'; | ||
export { MemoryRouter, Navigate, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createRoutesFromChildren, generatePath, matchPath, matchRoutes, renderMatches, resolvePath, useBlocker, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes } from 'react-router'; | ||
import { Router, useHref, useLocation, useResolvedPath, useNavigate } from 'react-router'; | ||
export { MemoryRouter, Navigate, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createRoutesFromChildren, generatePath, matchPath, matchRoutes, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes } from 'react-router'; | ||
@@ -220,4 +220,4 @@ function _extends() { | ||
// value for `activeClassName`, but we are removing that API and can still | ||
// use the old default behavior for a cleraner upgrade path and keep the | ||
// simple styling rules working as the currently do. | ||
// use the old default behavior for a cleaner upgrade path and keep the | ||
// simple styling rules working as they currently do. | ||
className = [classNameProp, isActive ? "active" : null].filter(Boolean).join(" "); | ||
@@ -240,18 +240,2 @@ } | ||
NavLink.displayName = "NavLink"; | ||
} | ||
/** | ||
* A declarative interface for showing a window.confirm dialog with the given | ||
* message when the user tries to navigate away from the current page. | ||
* | ||
* This also serves as a reference implementation for anyone who wants to | ||
* create their own custom prompt component. | ||
*/ | ||
function Prompt(_ref5) { | ||
let { | ||
message, | ||
when | ||
} = _ref5; | ||
usePrompt(message, when); | ||
return null; | ||
} //////////////////////////////////////////////////////////////////////////////// | ||
@@ -267,2 +251,3 @@ // HOOKS | ||
function useLinkClickHandler(to, _temp) { | ||
@@ -282,29 +267,14 @@ let { | ||
) { | ||
event.preventDefault(); // If the URL hasn't changed, a regular <a> will do a replace instead of | ||
// a push, so do the same here. | ||
event.preventDefault(); // If the URL hasn't changed, a regular <a> will do a replace instead of | ||
// a push, so do the same here. | ||
let replace = !!replaceProp || createPath(location) === createPath(path); | ||
navigate(to, { | ||
replace, | ||
state | ||
}); | ||
} | ||
let replace = !!replaceProp || createPath(location) === createPath(path); | ||
navigate(to, { | ||
replace, | ||
state | ||
}); | ||
} | ||
}, [location, navigate, path, replaceProp, state, target, to]); | ||
} | ||
/** | ||
* Prevents navigation away from the current page using a window.confirm prompt | ||
* with the given message. | ||
*/ | ||
function usePrompt(message, when) { | ||
if (when === void 0) { | ||
when = true; | ||
} | ||
let blocker = useCallback(tx => { | ||
if (window.confirm(message)) tx.retry(); | ||
}, [message]); | ||
useBlocker(blocker, when); | ||
} | ||
/** | ||
* A convenient wrapper for reading and writing search parameters via the | ||
@@ -370,3 +340,3 @@ * URLSearchParams interface. | ||
export { BrowserRouter, HashRouter, Link, NavLink, Prompt, createSearchParams, useLinkClickHandler, usePrompt, useSearchParams }; | ||
export { BrowserRouter, HashRouter, Link, NavLink, createSearchParams, useLinkClickHandler, useSearchParams }; | ||
//# sourceMappingURL=index.js.map |
/** | ||
* React Router DOM v6.0.0-beta.6 | ||
* React Router DOM v6.0.0-beta.7 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
{ | ||
"name": "react-router-dom", | ||
"version": "6.0.0-beta.6", | ||
"version": "6.0.0-beta.7", | ||
"author": "Remix Software <hello@remix.run>", | ||
@@ -16,15 +16,4 @@ "description": "Declarative routing for React web applications", | ||
"unpkg": "./umd/react-router-dom.production.min.js", | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"import": "./index.js", | ||
"require": "./main.js" | ||
}, | ||
"./server": { | ||
"import": "./server.mjs", | ||
"require": "./server.js" | ||
} | ||
}, | ||
"dependencies": { | ||
"react-router": "6.0.0-beta.6" | ||
"react-router": "6.0.0-beta.7" | ||
}, | ||
@@ -31,0 +20,0 @@ "peerDependencies": { |
/** | ||
* React Router DOM v6.0.0-beta.6 | ||
* React Router DOM v6.0.0-beta.7 | ||
* | ||
@@ -13,4 +13,4 @@ * Copyright (c) Remix Software Inc. | ||
import { createBrowserHistory, createHashHistory, createPath } from 'history'; | ||
import { Router, useHref, useLocation, useResolvedPath, useNavigate, useBlocker } from 'react-router'; | ||
export { MemoryRouter, Navigate, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createRoutesFromChildren, generatePath, matchPath, matchRoutes, renderMatches, resolvePath, useBlocker, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes } from 'react-router'; | ||
import { Router, useHref, useLocation, useResolvedPath, useNavigate } from 'react-router'; | ||
export { MemoryRouter, Navigate, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createRoutesFromChildren, generatePath, matchPath, matchRoutes, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes } from 'react-router'; | ||
@@ -178,4 +178,4 @@ function warning(cond, message) { | ||
// value for `activeClassName`, but we are removing that API and can still | ||
// use the old default behavior for a cleraner upgrade path and keep the | ||
// simple styling rules working as the currently do. | ||
// use the old default behavior for a cleaner upgrade path and keep the | ||
// simple styling rules working as they currently do. | ||
className = [classNameProp, isActive ? "active" : null].filter(Boolean).join(" "); | ||
@@ -198,17 +198,2 @@ } | ||
NavLink.displayName = "NavLink"; | ||
} | ||
/** | ||
* A declarative interface for showing a window.confirm dialog with the given | ||
* message when the user tries to navigate away from the current page. | ||
* | ||
* This also serves as a reference implementation for anyone who wants to | ||
* create their own custom prompt component. | ||
*/ | ||
function Prompt({ | ||
message, | ||
when | ||
}) { | ||
usePrompt(message, when); | ||
return null; | ||
} //////////////////////////////////////////////////////////////////////////////// | ||
@@ -224,2 +209,3 @@ // HOOKS | ||
function useLinkClickHandler(to, { | ||
@@ -238,25 +224,14 @@ target, | ||
) { | ||
event.preventDefault(); // If the URL hasn't changed, a regular <a> will do a replace instead of | ||
// a push, so do the same here. | ||
event.preventDefault(); // If the URL hasn't changed, a regular <a> will do a replace instead of | ||
// a push, so do the same here. | ||
let replace = !!replaceProp || createPath(location) === createPath(path); | ||
navigate(to, { | ||
replace, | ||
state | ||
}); | ||
} | ||
let replace = !!replaceProp || createPath(location) === createPath(path); | ||
navigate(to, { | ||
replace, | ||
state | ||
}); | ||
} | ||
}, [location, navigate, path, replaceProp, state, target, to]); | ||
} | ||
/** | ||
* Prevents navigation away from the current page using a window.confirm prompt | ||
* with the given message. | ||
*/ | ||
function usePrompt(message, when = true) { | ||
let blocker = useCallback(tx => { | ||
if (window.confirm(message)) tx.retry(); | ||
}, [message]); | ||
useBlocker(blocker, when); | ||
} | ||
/** | ||
* A convenient wrapper for reading and writing search parameters via the | ||
@@ -318,3 +293,3 @@ * URLSearchParams interface. | ||
export { BrowserRouter, HashRouter, Link, NavLink, Prompt, createSearchParams, useLinkClickHandler, usePrompt, useSearchParams }; | ||
export { BrowserRouter, HashRouter, Link, NavLink, createSearchParams, useLinkClickHandler, useSearchParams }; | ||
//# sourceMappingURL=react-router-dom.development.js.map |
/** | ||
* React Router DOM v6.0.0-beta.6 | ||
* React Router DOM v6.0.0-beta.7 | ||
* | ||
@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc. | ||
*/ | ||
import{useRef as e,useState as t,useLayoutEffect as r,createElement as n,forwardRef as a,useCallback as o,useMemo as c}from"react";import{createBrowserHistory as i,createHashHistory as u,createPath as l}from"history";import{Router as s,useHref as f,useLocation as h,useResolvedPath as m,useNavigate as p,useBlocker as d}from"react-router";export{MemoryRouter,Navigate,Outlet,Route,Router,Routes,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,createRoutesFromChildren,generatePath,matchPath,matchRoutes,renderMatches,resolvePath,useBlocker,useHref,useInRouterContext,useLocation,useMatch,useNavigate,useOutlet,useParams,useResolvedPath,useRoutes}from"react-router";function y({basename:a,children:o,window:c}){let u=e();null==u.current&&(u.current=i({window:c}));let l=u.current,[f,h]=t({action:l.action,location:l.location});return r((()=>l.listen(h)),[l]),n(s,{basename:a,children:o,action:f.action,location:f.location,navigator:l})}function g({basename:a,children:o,window:c}){let i=e();null==i.current&&(i.current=u({window:c}));let l=i.current,[f,h]=t({action:l.action,location:l.location});return r((()=>l.listen(h)),[l]),n(s,{basename:a,children:o,action:f.action,location:f.location,navigator:l})}const v=a((function({onClick:e,replace:t=!1,state:r,target:a,to:o,...c},i){let u=f(o),l=A(o,{replace:t,state:r,target:a});return n("a",Object.assign({},c,{href:u,onClick:function(t){e&&e(t),t.defaultPrevented||l(t)},ref:i,target:a}))})),w=a((function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:a=!1,style:o,to:c,...i},u){let l=h(),s=m(c),f=l.pathname,p=s.pathname;t||(f=f.toLowerCase(),p=p.toLowerCase());let d,y=f===p||!a&&f.startsWith(p)&&"/"===f.charAt(p.length),g=y?e:void 0;d="function"==typeof r?r({isActive:y}):[r,y?"active":null].filter(Boolean).join(" ");let w="function"==typeof o?o({isActive:y}):o;return n(v,Object.assign({},i,{"aria-current":g,className:d,ref:u,style:w,to:c}))}));function R({message:e,when:t}){return C(e,t),null}function A(e,{target:t,replace:r,state:n}={}){let a=p(),c=h(),i=m(e);return o((o=>{if(!(0!==o.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(o))){o.preventDefault();let t=!!r||l(c)===l(i);a(e,{replace:t,state:n})}}),[c,a,i,r,n,t,e])}function C(e,t=!0){let r=o((t=>{window.confirm(e)&&t.retry()}),[e]);d(r,t)}function b(t){let r=e(N(t)),n=h(),a=c((()=>{let e=N(n.search);for(let t of r.current.keys())e.has(t)||r.current.getAll(t).forEach((r=>{e.append(t,r)}));return e}),[n.search]),i=p();return[a,o(((e,t)=>{i("?"+N(e),t)}),[i])]}function N(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}export{y as BrowserRouter,g as HashRouter,v as Link,w as NavLink,R as Prompt,N as createSearchParams,A as useLinkClickHandler,C as usePrompt,b as useSearchParams}; | ||
import{useRef as t,useState as e,useLayoutEffect as r,createElement as n,forwardRef as a,useCallback as o,useMemo as c}from"react";import{createBrowserHistory as i,createHashHistory as s,createPath as u}from"history";import{Router as l,useHref as f,useLocation as h,useResolvedPath as m,useNavigate as p}from"react-router";export{MemoryRouter,Navigate,Outlet,Route,Router,Routes,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,createRoutesFromChildren,generatePath,matchPath,matchRoutes,renderMatches,resolvePath,useHref,useInRouterContext,useLocation,useMatch,useNavigate,useOutlet,useParams,useResolvedPath,useRoutes}from"react-router";function d({basename:a,children:o,window:c}){let s=t();null==s.current&&(s.current=i({window:c}));let u=s.current,[f,h]=e({action:u.action,location:u.location});return r((()=>u.listen(h)),[u]),n(l,{basename:a,children:o,action:f.action,location:f.location,navigator:u})}function y({basename:a,children:o,window:c}){let i=t();null==i.current&&(i.current=s({window:c}));let u=i.current,[f,h]=e({action:u.action,location:u.location});return r((()=>u.listen(h)),[u]),n(l,{basename:a,children:o,action:f.action,location:f.location,navigator:u})}const g=a((function({onClick:t,replace:e=!1,state:r,target:a,to:o,...c},i){let s=f(o),u=R(o,{replace:e,state:r,target:a});return n("a",Object.assign({},c,{href:s,onClick:function(e){t&&t(e),e.defaultPrevented||u(e)},ref:i,target:a}))})),v=a((function({"aria-current":t="page",caseSensitive:e=!1,className:r="",end:a=!1,style:o,to:c,...i},s){let u=h(),l=m(c),f=u.pathname,p=l.pathname;e||(f=f.toLowerCase(),p=p.toLowerCase());let d,y=f===p||!a&&f.startsWith(p)&&"/"===f.charAt(p.length),v=y?t:void 0;d="function"==typeof r?r({isActive:y}):[r,y?"active":null].filter(Boolean).join(" ");let R="function"==typeof o?o({isActive:y}):o;return n(g,Object.assign({},i,{"aria-current":v,className:d,ref:s,style:R,to:c}))}));function R(t,{target:e,replace:r,state:n}={}){let a=p(),c=h(),i=m(t);return o((o=>{if(!(0!==o.button||e&&"_self"!==e||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(o))){o.preventDefault();let e=!!r||u(c)===u(i);a(t,{replace:e,state:n})}}),[c,a,i,r,n,e,t])}function w(e){let r=t(A(e)),n=h(),a=c((()=>{let t=A(n.search);for(let e of r.current.keys())t.has(e)||r.current.getAll(e).forEach((r=>{t.append(e,r)}));return t}),[n.search]),i=p();return[a,o(((t,e)=>{i("?"+A(t),e)}),[i])]}function A(t=""){return new URLSearchParams("string"==typeof t||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce(((e,r)=>{let n=t[r];return e.concat(Array.isArray(n)?n.map((t=>[r,t])):[[r,n]])}),[]))}export{d as BrowserRouter,y as HashRouter,g as Link,v as NavLink,A as createSearchParams,R as useLinkClickHandler,w as useSearchParams}; | ||
//# sourceMappingURL=react-router-dom.production.min.js.map |
@@ -53,6 +53,2 @@ 'use strict'; | ||
throw new Error(`You cannot use navigator.forward() on the server because it is a stateless ` + `environment.`); | ||
}, | ||
block() { | ||
throw new Error(`You cannot use navigator.block() on the server because it is a stateless ` + `environment.`); | ||
} | ||
@@ -59,0 +55,0 @@ |
/** | ||
* React Router DOM v6.0.0-beta.6 | ||
* React Router DOM v6.0.0-beta.7 | ||
* | ||
@@ -220,4 +220,4 @@ * Copyright (c) Remix Software Inc. | ||
// value for `activeClassName`, but we are removing that API and can still | ||
// use the old default behavior for a cleraner upgrade path and keep the | ||
// simple styling rules working as the currently do. | ||
// use the old default behavior for a cleaner upgrade path and keep the | ||
// simple styling rules working as they currently do. | ||
className = [classNameProp, isActive ? "active" : null].filter(Boolean).join(" "); | ||
@@ -240,18 +240,2 @@ } | ||
NavLink.displayName = "NavLink"; | ||
} | ||
/** | ||
* A declarative interface for showing a window.confirm dialog with the given | ||
* message when the user tries to navigate away from the current page. | ||
* | ||
* This also serves as a reference implementation for anyone who wants to | ||
* create their own custom prompt component. | ||
*/ | ||
function Prompt(_ref5) { | ||
let { | ||
message, | ||
when | ||
} = _ref5; | ||
usePrompt(message, when); | ||
return null; | ||
} //////////////////////////////////////////////////////////////////////////////// | ||
@@ -267,2 +251,3 @@ // HOOKS | ||
function useLinkClickHandler(to, _temp) { | ||
@@ -282,29 +267,14 @@ let { | ||
) { | ||
event.preventDefault(); // If the URL hasn't changed, a regular <a> will do a replace instead of | ||
// a push, so do the same here. | ||
event.preventDefault(); // If the URL hasn't changed, a regular <a> will do a replace instead of | ||
// a push, so do the same here. | ||
let replace = !!replaceProp || history.createPath(location) === history.createPath(path); | ||
navigate(to, { | ||
replace, | ||
state | ||
}); | ||
} | ||
let replace = !!replaceProp || history.createPath(location) === history.createPath(path); | ||
navigate(to, { | ||
replace, | ||
state | ||
}); | ||
} | ||
}, [location, navigate, path, replaceProp, state, target, to]); | ||
} | ||
/** | ||
* Prevents navigation away from the current page using a window.confirm prompt | ||
* with the given message. | ||
*/ | ||
function usePrompt(message, when) { | ||
if (when === void 0) { | ||
when = true; | ||
} | ||
let blocker = React.useCallback(tx => { | ||
if (window.confirm(message)) tx.retry(); | ||
}, [message]); | ||
reactRouter.useBlocker(blocker, when); | ||
} | ||
/** | ||
* A convenient wrapper for reading and writing search parameters via the | ||
@@ -460,8 +430,2 @@ * URLSearchParams interface. | ||
}); | ||
Object.defineProperty(exports, 'useBlocker', { | ||
enumerable: true, | ||
get: function () { | ||
return reactRouter.useBlocker; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'useHref', { | ||
@@ -525,6 +489,4 @@ enumerable: true, | ||
exports.NavLink = NavLink; | ||
exports.Prompt = Prompt; | ||
exports.createSearchParams = createSearchParams; | ||
exports.useLinkClickHandler = useLinkClickHandler; | ||
exports.usePrompt = usePrompt; | ||
exports.useSearchParams = useSearchParams; | ||
@@ -531,0 +493,0 @@ |
/** | ||
* React Router DOM v6.0.0-beta.6 | ||
* React Router DOM v6.0.0-beta.7 | ||
* | ||
@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("history"),require("react-router")):"function"==typeof define&&define.amd?define(["exports","react","history","react-router"],t):t((e=e||self).ReactRouterDOM={},e.React,e.HistoryLibrary,e.ReactRouter)}(this,(function(e,t,r,n){"use strict";function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}function a(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}const u=["onClick","replace","state","target","to"],c=["aria-current","caseSensitive","className","end","style","to"];const i=t.forwardRef((function(e,r){let{onClick:c,replace:i=!1,state:s,target:f,to:b}=e,d=a(e,u),m=n.useHref(b),y=l(b,{replace:i,state:s,target:f});return t.createElement("a",o({},d,{href:m,onClick:function(e){c&&c(e),e.defaultPrevented||y(e)},ref:r,target:f}))})),s=t.forwardRef((function(e,r){let{"aria-current":u="page",caseSensitive:s=!1,className:l="",end:f=!1,style:b,to:d}=e,m=a(e,c),y=n.useLocation(),p=n.useResolvedPath(d),h=y.pathname,g=p.pathname;s||(h=h.toLowerCase(),g=g.toLowerCase());let P,R=h===g||!f&&h.startsWith(g)&&"/"===h.charAt(g.length),O=R?u:void 0;P="function"==typeof l?l({isActive:R}):[l,R?"active":null].filter(Boolean).join(" ");let v="function"==typeof b?b({isActive:R}):b;return t.createElement(i,o({},m,{"aria-current":O,className:P,ref:r,style:v,to:d}))}));function l(e,o){let{target:a,replace:u,state:c}=void 0===o?{}:o,i=n.useNavigate(),s=n.useLocation(),l=n.useResolvedPath(e);return t.useCallback((t=>{if(!(0!==t.button||a&&"_self"!==a||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(t))){t.preventDefault();let n=!!u||r.createPath(s)===r.createPath(l);i(e,{replace:n,state:c})}}),[s,i,l,u,c,a,e])}function f(e,r){void 0===r&&(r=!0);let o=t.useCallback((t=>{window.confirm(e)&&t.retry()}),[e]);n.useBlocker(o,r)}function b(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return n.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return n.Navigate}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return n.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return n.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return n.Router}}),Object.defineProperty(e,"Routes",{enumerable:!0,get:function(){return n.Routes}}),Object.defineProperty(e,"UNSAFE_LocationContext",{enumerable:!0,get:function(){return n.UNSAFE_LocationContext}}),Object.defineProperty(e,"UNSAFE_NavigationContext",{enumerable:!0,get:function(){return n.UNSAFE_NavigationContext}}),Object.defineProperty(e,"UNSAFE_RouteContext",{enumerable:!0,get:function(){return n.UNSAFE_RouteContext}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return n.createRoutesFromChildren}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return n.generatePath}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return n.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return n.matchRoutes}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return n.renderMatches}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return n.resolvePath}}),Object.defineProperty(e,"useBlocker",{enumerable:!0,get:function(){return n.useBlocker}}),Object.defineProperty(e,"useHref",{enumerable:!0,get:function(){return n.useHref}}),Object.defineProperty(e,"useInRouterContext",{enumerable:!0,get:function(){return n.useInRouterContext}}),Object.defineProperty(e,"useLocation",{enumerable:!0,get:function(){return n.useLocation}}),Object.defineProperty(e,"useMatch",{enumerable:!0,get:function(){return n.useMatch}}),Object.defineProperty(e,"useNavigate",{enumerable:!0,get:function(){return n.useNavigate}}),Object.defineProperty(e,"useOutlet",{enumerable:!0,get:function(){return n.useOutlet}}),Object.defineProperty(e,"useParams",{enumerable:!0,get:function(){return n.useParams}}),Object.defineProperty(e,"useResolvedPath",{enumerable:!0,get:function(){return n.useResolvedPath}}),Object.defineProperty(e,"useRoutes",{enumerable:!0,get:function(){return n.useRoutes}}),e.BrowserRouter=function(e){let{basename:o,children:a,window:u}=e,c=t.useRef();null==c.current&&(c.current=r.createBrowserHistory({window:u}));let i=c.current,[s,l]=t.useState({action:i.action,location:i.location});return t.useLayoutEffect((()=>i.listen(l)),[i]),t.createElement(n.Router,{basename:o,children:a,action:s.action,location:s.location,navigator:i})},e.HashRouter=function(e){let{basename:o,children:a,window:u}=e,c=t.useRef();null==c.current&&(c.current=r.createHashHistory({window:u}));let i=c.current,[s,l]=t.useState({action:i.action,location:i.location});return t.useLayoutEffect((()=>i.listen(l)),[i]),t.createElement(n.Router,{basename:o,children:a,action:s.action,location:s.location,navigator:i})},e.Link=i,e.NavLink=s,e.Prompt=function(e){let{message:t,when:r}=e;return f(t,r),null},e.createSearchParams=b,e.useLinkClickHandler=l,e.usePrompt=f,e.useSearchParams=function(e){let r=t.useRef(b(e)),o=n.useLocation(),a=t.useMemo((()=>{let e=b(o.search);for(let t of r.current.keys())e.has(t)||r.current.getAll(t).forEach((r=>{e.append(t,r)}));return e}),[o.search]),u=n.useNavigate();return[a,t.useCallback(((e,t)=>{u("?"+b(e),t)}),[u])]},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("history"),require("react-router")):"function"==typeof define&&define.amd?define(["exports","react","history","react-router"],t):t((e=e||self).ReactRouterDOM={},e.React,e.HistoryLibrary,e.ReactRouter)}(this,(function(e,t,r,n){"use strict";function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}function o(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}const u=["onClick","replace","state","target","to"],c=["aria-current","caseSensitive","className","end","style","to"];const i=t.forwardRef((function(e,r){let{onClick:c,replace:i=!1,state:s,target:f,to:b}=e,d=o(e,u),y=n.useHref(b),m=l(b,{replace:i,state:s,target:f});return t.createElement("a",a({},d,{href:y,onClick:function(e){c&&c(e),e.defaultPrevented||m(e)},ref:r,target:f}))})),s=t.forwardRef((function(e,r){let{"aria-current":u="page",caseSensitive:s=!1,className:l="",end:f=!1,style:b,to:d}=e,y=o(e,c),m=n.useLocation(),p=n.useResolvedPath(d),h=m.pathname,g=p.pathname;s||(h=h.toLowerCase(),g=g.toLowerCase());let P,R=h===g||!f&&h.startsWith(g)&&"/"===h.charAt(g.length),O=R?u:void 0;P="function"==typeof l?l({isActive:R}):[l,R?"active":null].filter(Boolean).join(" ");let v="function"==typeof b?b({isActive:R}):b;return t.createElement(i,a({},y,{"aria-current":O,className:P,ref:r,style:v,to:d}))}));function l(e,a){let{target:o,replace:u,state:c}=void 0===a?{}:a,i=n.useNavigate(),s=n.useLocation(),l=n.useResolvedPath(e);return t.useCallback((t=>{if(!(0!==t.button||o&&"_self"!==o||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(t))){t.preventDefault();let n=!!u||r.createPath(s)===r.createPath(l);i(e,{replace:n,state:c})}}),[s,i,l,u,c,o,e])}function f(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return n.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return n.Navigate}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return n.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return n.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return n.Router}}),Object.defineProperty(e,"Routes",{enumerable:!0,get:function(){return n.Routes}}),Object.defineProperty(e,"UNSAFE_LocationContext",{enumerable:!0,get:function(){return n.UNSAFE_LocationContext}}),Object.defineProperty(e,"UNSAFE_NavigationContext",{enumerable:!0,get:function(){return n.UNSAFE_NavigationContext}}),Object.defineProperty(e,"UNSAFE_RouteContext",{enumerable:!0,get:function(){return n.UNSAFE_RouteContext}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return n.createRoutesFromChildren}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return n.generatePath}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return n.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return n.matchRoutes}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return n.renderMatches}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return n.resolvePath}}),Object.defineProperty(e,"useHref",{enumerable:!0,get:function(){return n.useHref}}),Object.defineProperty(e,"useInRouterContext",{enumerable:!0,get:function(){return n.useInRouterContext}}),Object.defineProperty(e,"useLocation",{enumerable:!0,get:function(){return n.useLocation}}),Object.defineProperty(e,"useMatch",{enumerable:!0,get:function(){return n.useMatch}}),Object.defineProperty(e,"useNavigate",{enumerable:!0,get:function(){return n.useNavigate}}),Object.defineProperty(e,"useOutlet",{enumerable:!0,get:function(){return n.useOutlet}}),Object.defineProperty(e,"useParams",{enumerable:!0,get:function(){return n.useParams}}),Object.defineProperty(e,"useResolvedPath",{enumerable:!0,get:function(){return n.useResolvedPath}}),Object.defineProperty(e,"useRoutes",{enumerable:!0,get:function(){return n.useRoutes}}),e.BrowserRouter=function(e){let{basename:a,children:o,window:u}=e,c=t.useRef();null==c.current&&(c.current=r.createBrowserHistory({window:u}));let i=c.current,[s,l]=t.useState({action:i.action,location:i.location});return t.useLayoutEffect((()=>i.listen(l)),[i]),t.createElement(n.Router,{basename:a,children:o,action:s.action,location:s.location,navigator:i})},e.HashRouter=function(e){let{basename:a,children:o,window:u}=e,c=t.useRef();null==c.current&&(c.current=r.createHashHistory({window:u}));let i=c.current,[s,l]=t.useState({action:i.action,location:i.location});return t.useLayoutEffect((()=>i.listen(l)),[i]),t.createElement(n.Router,{basename:a,children:o,action:s.action,location:s.location,navigator:i})},e.Link=i,e.NavLink=s,e.createSearchParams=f,e.useLinkClickHandler=l,e.useSearchParams=function(e){let r=t.useRef(f(e)),a=n.useLocation(),o=t.useMemo((()=>{let e=f(a.search);for(let t of r.current.keys())e.has(t)||r.current.getAll(t).forEach((r=>{e.append(t,r)}));return e}),[a.search]),u=n.useNavigate();return[o,t.useCallback(((e,t)=>{u("?"+f(e),t)}),[u])]},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=react-router-dom.production.min.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
149759
1293
+ Addedreact-router@6.0.0-beta.7(transitive)
- Removedreact-router@6.0.0-beta.6(transitive)
Updatedreact-router@6.0.0-beta.7