react-router-dom 6.0.1 → 6.0.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/index.d.ts +2 -1
- package/index.js +5 -4
- package/index.js.map +1 -1
- package/main.js +1 -1
- package/package.json +2 -2
- package/react-router-dom.development.js +4 -3
- package/react-router-dom.development.js.map +1 -1
- package/react-router-dom.production.min.js +2 -2
- package/react-router-dom.production.min.js.map +1 -1
- package/umd/react-router-dom.development.js +5 -4
- package/umd/react-router-dom.development.js.map +1 -1
- package/umd/react-router-dom.production.min.js +2 -2
- package/umd/react-router-dom.production.min.js.map +1 -1
package/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface HashRouterProps {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function HashRouter({ basename, children, window }: HashRouterProps): JSX.Element;
|
|
27
27
|
export interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
|
|
28
|
+
reloadDocument?: boolean;
|
|
28
29
|
replace?: boolean;
|
|
29
30
|
state?: any;
|
|
30
31
|
to: To;
|
|
@@ -49,7 +50,7 @@ export interface NavLinkProps extends Omit<LinkProps, "className" | "style"> {
|
|
|
49
50
|
export declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
50
51
|
/**
|
|
51
52
|
* Handles the click behavior for router `<Link>` components. This is useful if
|
|
52
|
-
* you need to create custom `<Link>`
|
|
53
|
+
* you need to create custom `<Link>` components with the same click behavior we
|
|
53
54
|
* use in our exported `<Link>`.
|
|
54
55
|
*/
|
|
55
56
|
export declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state }?: {
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router DOM v6.0.
|
|
2
|
+
* React Router DOM v6.0.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -46,7 +46,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
46
46
|
return target;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const _excluded = ["onClick", "replace", "state", "target", "to"],
|
|
49
|
+
const _excluded = ["onClick", "reloadDocument", "replace", "state", "target", "to"],
|
|
50
50
|
_excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to"];
|
|
51
51
|
|
|
52
52
|
function warning(cond, message) {
|
|
@@ -142,6 +142,7 @@ function isModifiedEvent(event) {
|
|
|
142
142
|
const Link = /*#__PURE__*/forwardRef(function LinkWithRef(_ref3, ref) {
|
|
143
143
|
let {
|
|
144
144
|
onClick,
|
|
145
|
+
reloadDocument,
|
|
145
146
|
replace = false,
|
|
146
147
|
state,
|
|
147
148
|
target,
|
|
@@ -159,7 +160,7 @@ const Link = /*#__PURE__*/forwardRef(function LinkWithRef(_ref3, ref) {
|
|
|
159
160
|
function handleClick(event) {
|
|
160
161
|
if (onClick) onClick(event);
|
|
161
162
|
|
|
162
|
-
if (!event.defaultPrevented) {
|
|
163
|
+
if (!event.defaultPrevented && !reloadDocument) {
|
|
163
164
|
internalOnClick(event);
|
|
164
165
|
}
|
|
165
166
|
}
|
|
@@ -241,7 +242,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
241
242
|
|
|
242
243
|
/**
|
|
243
244
|
* Handles the click behavior for router `<Link>` components. This is useful if
|
|
244
|
-
* you need to create custom `<Link>`
|
|
245
|
+
* you need to create custom `<Link>` components with the same click behavior we
|
|
245
246
|
* use in our exported `<Link>`.
|
|
246
247
|
*/
|
|
247
248
|
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../packages/react-router-dom/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { BrowserHistory, HashHistory } from \"history\";\nimport { createBrowserHistory, createHashHistory, createPath } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n resolvePath,\n renderMatches,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n} from \"react-router\";\nimport type { To } from \"react-router\";\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// RE-EXPORTS\n////////////////////////////////////////////////////////////////////////////////\n\n// Note: Keep in sync with react-router exports!\nexport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n renderMatches,\n resolvePath,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n};\n\nexport type {\n Location,\n Path,\n To,\n NavigationType,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigator,\n OutletProps,\n Params,\n PathMatch,\n RouteMatch,\n RouteObject,\n RouteProps,\n PathRouteProps,\n LayoutRouteProps,\n IndexRouteProps,\n RouterProps,\n RoutesProps\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext\n} from \"react-router\";\n\n////////////////////////////////////////////////////////////////////////////////\n// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nfunction isModifiedEvent(event: React.MouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n replace?: boolean;\n state?: any;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n { onClick, replace = false, state, target, to, ...rest },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, { replace, state, target });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps extends Omit<LinkProps, \"className\" | \"style\"> {\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: { isActive: boolean }) => React.CSSProperties);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n ...rest\n },\n ref\n ) {\n let location = useLocation();\n let path = useResolvedPath(to);\n\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive =\n locationPathname === toPathname ||\n (!end &&\n locationPathname.startsWith(toPathname) &&\n locationPathname.charAt(toPathname.length) === \"/\");\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\" ? styleProp({ isActive }) : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n />\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` compoments with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here.\n let replace =\n !!replaceProp || createPath(location) === createPath(path);\n\n navigate(to, { replace, state });\n }\n },\n [location, navigate, path, replaceProp, state, target, to]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n"],"names":["warning","cond","message","console","warn","Error","e","BrowserRouter","basename","children","window","historyRef","React","current","createBrowserHistory","history","state","setState","action","location","listen","React.createElement","HashRouter","createHashHistory","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","Link","LinkWithRef","ref","onClick","replace","target","to","rest","href","useHref","internalOnClick","useLinkClickHandler","handleClick","defaultPrevented","displayName","NavLink","NavLinkWithRef","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","useLocation","path","useResolvedPath","locationPathname","pathname","toPathname","toLowerCase","isActive","startsWith","charAt","length","ariaCurrent","undefined","filter","Boolean","join","replaceProp","navigate","useNavigate","button","preventDefault","createPath","useSearchParams","defaultInit","URLSearchParams","defaultSearchParamsRef","createSearchParams","searchParams","search","key","keys","has","getAll","forEach","value","append","setSearchParams","nextInit","navigateOptions","init","Array","isArray","Object","reduce","memo","concat","map","v"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAASA,OAAT,CAAiBC,IAAjB,EAAgCC,OAAhC,EAAuD;AACrD,MAAI,CAACD,IAAL,EAAW;AACT;AACA,QAAI,OAAOE,OAAP,KAAmB,WAAvB,EAAoCA,OAAO,CAACC,IAAR,CAAaF,OAAb;;AAEpC,QAAI;AACF;AACA;AACA;AACA;AACA;AACA,YAAM,IAAIG,KAAJ,CAAUH,OAAV,CAAN,CANE;AAQH,KARD,CAQE,OAAOI,CAAP,EAAU;AACb;AACF;AA4ED;AACA;;AAQA;AACA;AACA;AACO,SAASC,aAAT,OAIgB;AAAA,MAJO;AAC5BC,IAAAA,QAD4B;AAE5BC,IAAAA,QAF4B;AAG5BC,IAAAA;AAH4B,GAIP;AACrB,MAAIC,UAAU,GAAGC,MAAA,EAAjB;;AACA,MAAID,UAAU,CAACE,OAAX,IAAsB,IAA1B,EAAgC;AAC9BF,IAAAA,UAAU,CAACE,OAAX,GAAqBC,oBAAoB,CAAC;AAAEJ,MAAAA;AAAF,KAAD,CAAzC;AACD;;AAED,MAAIK,OAAO,GAAGJ,UAAU,CAACE,OAAzB;AACA,MAAI,CAACG,KAAD,EAAQC,QAAR,IAAoBL,QAAA,CAAe;AACrCM,IAAAA,MAAM,EAAEH,OAAO,CAACG,MADqB;AAErCC,I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CAAcF,IAAd,CADA,IAEAA,IAAI,YAAYf,eAFhB,GAGIe,IAHJ,GAIIG,MAAM,CAACZ,IAAP,CAAYS,IAAZ,EAAkBI,MAAlB,CAAyB,CAACC,IAAD,EAAOf,GAAP,KAAe;AACtC,QAAIK,KAAK,GAAGK,IAAI,CAACV,GAAD,CAAhB;AACA,WAAOe,IAAI,CAACC,MAAL,CACLL,KAAK,CAACC,OAAN,CAAcP,KAAd,IAAuBA,KAAK,CAACY,GAAN,CAAUC,CAAC,IAAI,CAAClB,GAAD,EAAMkB,CAAN,CAAf,CAAvB,GAAkD,CAAC,CAAClB,GAAD,EAAMK,KAAN,CAAD,CAD7C,CAAP;AAGD,GALD,EAKG,EALH,CALC,CAAP;AAYD;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../packages/react-router-dom/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { BrowserHistory, HashHistory } from \"history\";\nimport { createBrowserHistory, createHashHistory, createPath } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n resolvePath,\n renderMatches,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n} from \"react-router\";\nimport type { To } from \"react-router\";\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// RE-EXPORTS\n////////////////////////////////////////////////////////////////////////////////\n\n// Note: Keep in sync with react-router exports!\nexport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n renderMatches,\n resolvePath,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n};\n\nexport type {\n Location,\n Path,\n To,\n NavigationType,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigator,\n OutletProps,\n Params,\n PathMatch,\n RouteMatch,\n RouteObject,\n RouteProps,\n PathRouteProps,\n LayoutRouteProps,\n IndexRouteProps,\n RouterProps,\n RoutesProps\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext\n} from \"react-router\";\n\n////////////////////////////////////////////////////////////////////////////////\n// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nfunction isModifiedEvent(event: React.MouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n reloadDocument?: boolean;\n replace?: boolean;\n state?: any;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n { onClick, reloadDocument, replace = false, state, target, to, ...rest },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, { replace, state, target });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented && !reloadDocument) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps extends Omit<LinkProps, \"className\" | \"style\"> {\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: { isActive: boolean }) => React.CSSProperties);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n ...rest\n },\n ref\n ) {\n let location = useLocation();\n let path = useResolvedPath(to);\n\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive =\n locationPathname === toPathname ||\n (!end &&\n locationPathname.startsWith(toPathname) &&\n locationPathname.charAt(toPathname.length) === \"/\");\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\" ? styleProp({ isActive }) : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n />\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` components with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here.\n let replace =\n !!replaceProp || createPath(location) === createPath(path);\n\n navigate(to, { replace, state });\n }\n },\n [location, navigate, path, replaceProp, state, target, to]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n"],"names":["warning","cond","message","console","warn","Error","e","BrowserRouter","basename","children","window","historyRef","React","current","createBrowserHistory","history","state","setState","action","location","listen","React.createElement","HashRouter","createHashHistory","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","Link","LinkWithRef","ref","onClick","reloadDocument","replace","target","to","rest","href","useHref","internalOnClick","useLinkClickHandler","handleClick","defaultPrevented","displayName","NavLink","NavLinkWithRef","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","useLocation","path","useResolvedPath","locationPathname","pathname","toPathname","toLowerCase","isActive","startsWith","charAt","length","ariaCurrent","undefined","filter","Boolean","join","replaceProp","navigate","useNavigate","button","preventDefault","createPath","useSearchParams","defaultInit","URLSearchParams","defaultSearchParamsRef","createSearchParams","searchParams","search","key","keys","has","getAll","forEach","value","append","setSearchParams","nextInit","navigateOptions","init","Array","isArray","Object","reduce","memo","concat","map","v"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAASA,OAAT,CAAiBC,IAAjB,EAAgCC,OAAhC,EAAuD;AACrD,MAAI,CAACD,IAAL,EAAW;AACT;AACA,QAAI,OAAOE,OAA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|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-router-dom",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"author": "Remix Software <hello@remix.run>",
|
|
5
5
|
"description": "Declarative routing for React web applications",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"types": "./index.d.ts",
|
|
15
15
|
"unpkg": "./umd/react-router-dom.production.min.js",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"react-router": "6.0.
|
|
17
|
+
"react-router": "6.0.2",
|
|
18
18
|
"history": "^5.1.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router DOM v6.0.
|
|
2
|
+
* React Router DOM v6.0.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -103,6 +103,7 @@ function isModifiedEvent(event) {
|
|
|
103
103
|
*/
|
|
104
104
|
const Link = /*#__PURE__*/forwardRef(function LinkWithRef({
|
|
105
105
|
onClick,
|
|
106
|
+
reloadDocument,
|
|
106
107
|
replace = false,
|
|
107
108
|
state,
|
|
108
109
|
target,
|
|
@@ -119,7 +120,7 @@ const Link = /*#__PURE__*/forwardRef(function LinkWithRef({
|
|
|
119
120
|
function handleClick(event) {
|
|
120
121
|
if (onClick) onClick(event);
|
|
121
122
|
|
|
122
|
-
if (!event.defaultPrevented) {
|
|
123
|
+
if (!event.defaultPrevented && !reloadDocument) {
|
|
123
124
|
internalOnClick(event);
|
|
124
125
|
}
|
|
125
126
|
}
|
|
@@ -199,7 +200,7 @@ const NavLink = /*#__PURE__*/forwardRef(function NavLinkWithRef({
|
|
|
199
200
|
|
|
200
201
|
/**
|
|
201
202
|
* Handles the click behavior for router `<Link>` components. This is useful if
|
|
202
|
-
* you need to create custom `<Link>`
|
|
203
|
+
* you need to create custom `<Link>` components with the same click behavior we
|
|
203
204
|
* use in our exported `<Link>`.
|
|
204
205
|
*/
|
|
205
206
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-router-dom.development.js","sources":["../../../packages/react-router-dom/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { BrowserHistory, HashHistory } from \"history\";\nimport { createBrowserHistory, createHashHistory, createPath } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n resolvePath,\n renderMatches,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n} from \"react-router\";\nimport type { To } from \"react-router\";\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// RE-EXPORTS\n////////////////////////////////////////////////////////////////////////////////\n\n// Note: Keep in sync with react-router exports!\nexport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n renderMatches,\n resolvePath,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n};\n\nexport type {\n Location,\n Path,\n To,\n NavigationType,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigator,\n OutletProps,\n Params,\n PathMatch,\n RouteMatch,\n RouteObject,\n RouteProps,\n PathRouteProps,\n LayoutRouteProps,\n IndexRouteProps,\n RouterProps,\n RoutesProps\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext\n} from \"react-router\";\n\n////////////////////////////////////////////////////////////////////////////////\n// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nfunction isModifiedEvent(event: React.MouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n replace?: boolean;\n state?: any;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n { onClick, replace = false, state, target, to, ...rest },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, { replace, state, target });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps extends Omit<LinkProps, \"className\" | \"style\"> {\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: { isActive: boolean }) => React.CSSProperties);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n ...rest\n },\n ref\n ) {\n let location = useLocation();\n let path = useResolvedPath(to);\n\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive =\n locationPathname === toPathname ||\n (!end &&\n locationPathname.startsWith(toPathname) &&\n locationPathname.charAt(toPathname.length) === \"/\");\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\" ? styleProp({ isActive }) : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n />\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` compoments with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here.\n let replace =\n !!replaceProp || createPath(location) === createPath(path);\n\n navigate(to, { replace, state });\n }\n },\n [location, navigate, path, replaceProp, state, target, to]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n"],"names":["warning","cond","message","console","warn","Error","e","BrowserRouter","basename","children","window","historyRef","React","current","createBrowserHistory","history","state","setState","action","location","listen","React.createElement","HashRouter","createHashHistory","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","Link","LinkWithRef","onClick","replace","target","to","rest","ref","href","useHref","internalOnClick","useLinkClickHandler","handleClick","defaultPrevented","displayName","NavLink","NavLinkWithRef","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","useLocation","path","useResolvedPath","locationPathname","pathname","toPathname","toLowerCase","isActive","startsWith","charAt","length","ariaCurrent","undefined","filter","Boolean","join","replaceProp","navigate","useNavigate","button","preventDefault","createPath","useSearchParams","defaultInit","URLSearchParams","defaultSearchParamsRef","createSearchParams","searchParams","search","key","keys","has","getAll","forEach","value","append","setSearchParams","nextInit","navigateOptions","init","Array","isArray","Object","reduce","memo","concat","map","v"],"mappings":";;;;;;;;;;;;;;;AA6BA,SAASA,OAAT,CAAiBC,IAAjB,EAAgCC,OAAhC,EAAuD;AACrD,MAAI,CAACD,IAAL,EAAW;AACT;AACA,QAAI,OAAOE,OAAP,KAAmB,WAAvB,EAAoCA,OAAO,CAACC,IAAR,CAAaF,OAAb;;AAEpC,QAAI;AACF;AACA;AACA;AACA;AACA;AACA,YAAM,IAAIG,KAAJ,CAAUH,OAAV,CAAN,CANE;AAQH,KARD,CAQE,OAAOI,CAAP,EAAU;AACb;AACF;AA4ED;AACA;;AAQA;AACA;AACA;AACO,SAASC,aAAT,CAAuB;AAC5BC,EAAAA,QAD4B;AAE5BC,EAAAA,QAF4B;AAG5BC,EAAAA;AAH4B,CAAvB,EAIgB;AACrB,MAAIC,UAAU,GAAGC,MAAA,EAAjB;;AACA,MAAID,UAAU,CAACE,OAAX,IAAsB,IAA1B,EAAgC;AAC9BF,IAAAA,UAAU,CAACE,OAAX,GAAqBC,oBAAoB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G,EADvB,EAEY;AACjB,SAAO,IAAIf,eAAJ,CACL,OAAOe,IAAP,KAAgB,QAAhB,IACAC,KAAK,CAACC,OAAN,CAAcF,IAAd,CADA,IAEAA,IAAI,YAAYf,eAFhB,GAGIe,IAHJ,GAIIG,MAAM,CAACZ,IAAP,CAAYS,IAAZ,EAAkBI,MAAlB,CAAyB,CAACC,IAAD,EAAOf,GAAP,KAAe;AACtC,QAAIK,KAAK,GAAGK,IAAI,CAACV,GAAD,CAAhB;AACA,WAAOe,IAAI,CAACC,MAAL,CACLL,KAAK,CAACC,OAAN,CAAcP,KAAd,IAAuBA,KAAK,CAACY,GAAN,CAAUC,CAAC,IAAI,CAAClB,GAAD,EAAMkB,CAAN,CAAf,CAAvB,GAAkD,CAAC,CAAClB,GAAD,EAAMK,KAAN,CAAD,CAD7C,CAAP;AAGD,GALD,EAKG,EALH,CALC,CAAP;AAYD;;;;"}
|
|
1
|
+
{"version":3,"file":"react-router-dom.development.js","sources":["../../../packages/react-router-dom/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { BrowserHistory, HashHistory } from \"history\";\nimport { createBrowserHistory, createHashHistory, createPath } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n resolvePath,\n renderMatches,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n} from \"react-router\";\nimport type { To } from \"react-router\";\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// RE-EXPORTS\n////////////////////////////////////////////////////////////////////////////////\n\n// Note: Keep in sync with react-router exports!\nexport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n renderMatches,\n resolvePath,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n};\n\nexport type {\n Location,\n Path,\n To,\n NavigationType,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigator,\n OutletProps,\n Params,\n PathMatch,\n RouteMatch,\n RouteObject,\n RouteProps,\n PathRouteProps,\n LayoutRouteProps,\n IndexRouteProps,\n RouterProps,\n RoutesProps\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext\n} from \"react-router\";\n\n////////////////////////////////////////////////////////////////////////////////\n// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nfunction isModifiedEvent(event: React.MouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n reloadDocument?: boolean;\n replace?: boolean;\n state?: any;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n { onClick, reloadDocument, replace = false, state, target, to, ...rest },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, { replace, state, target });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented && !reloadDocument) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps extends Omit<LinkProps, \"className\" | \"style\"> {\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: { isActive: boolean }) => React.CSSProperties);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n ...rest\n },\n ref\n ) {\n let location = useLocation();\n let path = useResolvedPath(to);\n\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive =\n locationPathname === toPathname ||\n (!end &&\n locationPathname.startsWith(toPathname) &&\n locationPathname.charAt(toPathname.length) === \"/\");\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\" ? styleProp({ isActive }) : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n />\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` components with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here.\n let replace =\n !!replaceProp || createPath(location) === createPath(path);\n\n navigate(to, { replace, state });\n }\n },\n [location, navigate, path, replaceProp, state, target, to]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n"],"names":["warning","cond","message","console","warn","Error","e","BrowserRouter","basename","children","window","historyRef","React","current","createBrowserHistory","history","state","setState","action","location","listen","React.createElement","HashRouter","createHashHistory","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","Link","LinkWithRef","onClick","reloadDocument","replace","target","to","rest","ref","href","useHref","internalOnClick","useLinkClickHandler","handleClick","defaultPrevented","displayName","NavLink","NavLinkWithRef","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","useLocation","path","useResolvedPath","locationPathname","pathname","toPathname","toLowerCase","isActive","startsWith","charAt","length","ariaCurrent","undefined","filter","Boolean","join","replaceProp","navigate","useNavigate","button","preventDefault","createPath","useSearchParams","defaultInit","URLSearchParams","defaultSearchParamsRef","createSearchParams","searchParams","search","key","keys","has","getAll","forEach","value","append","setSearchParams","nextInit","navigateOptions","init","Array","isArray","Object","reduce","memo","concat","map","v"],"mappings":";;;;;;;;;;;;;;;AA6BA,SAASA,OAAT,CAAiBC,IAAjB,EAAgCC,OAAhC,E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|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{useRef as e,useState as t,useLayoutEffect as r,createElement as a,forwardRef as n,useCallback as o,useMemo as
|
|
11
|
+
import{useRef as e,useState as t,useLayoutEffect as r,createElement as a,forwardRef as n,useCallback as o,useMemo as c}from"react";import{createBrowserHistory as i,createHashHistory as u,createPath as s}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,useNavigationType,useOutlet,useParams,useResolvedPath,useRoutes}from"react-router";function y({basename:n,children:o,window:c}){let u=e();null==u.current&&(u.current=i({window:c}));let s=u.current,[f,h]=t({action:s.action,location:s.location});return r((()=>s.listen(h)),[s]),a(l,{basename:n,children:o,location:f.location,navigationType:f.action,navigator:s})}function g({basename:n,children:o,window:c}){let i=e();null==i.current&&(i.current=u({window:c}));let s=i.current,[f,h]=t({action:s.action,location:s.location});return r((()=>s.listen(h)),[s]),a(l,{basename:n,children:o,location:f.location,navigationType:f.action,navigator:s})}const d=n((function({onClick:e,reloadDocument:t,replace:r=!1,state:n,target:o,to:c,...i},u){let s=f(c),l=R(c,{replace:r,state:n,target:o});return a("a",Object.assign({},i,{href:s,onClick:function(r){e&&e(r),r.defaultPrevented||t||l(r)},ref:u,target:o}))})),v=n((function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:n=!1,style:o,to:c,...i},u){let s=h(),l=m(c),f=s.pathname,p=l.pathname;t||(f=f.toLowerCase(),p=p.toLowerCase());let y,g=f===p||!n&&f.startsWith(p)&&"/"===f.charAt(p.length),v=g?e:void 0;y="function"==typeof r?r({isActive:g}):[r,g?"active":null].filter(Boolean).join(" ");let R="function"==typeof o?o({isActive:g}):o;return a(d,Object.assign({},i,{"aria-current":v,className:y,ref:u,style:R,to:c}))}));function R(e,{target:t,replace:r,state:a}={}){let n=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||s(c)===s(i);n(e,{replace:t,state:a})}}),[c,n,i,r,a,t,e])}function w(t){let r=e(A(t)),a=h(),n=c((()=>{let e=A(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]),i=p();return[n,o(((e,t)=>{i("?"+A(e),t)}),[i])]}function A(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map((e=>[r,e])):[[r,a]])}),[]))}export{y as BrowserRouter,g as HashRouter,d as Link,v as NavLink,A as createSearchParams,R as useLinkClickHandler,w as useSearchParams};
|
|
12
12
|
//# sourceMappingURL=react-router-dom.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-router-dom.production.min.js","sources":["../../../packages/react-router-dom/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { BrowserHistory, HashHistory } from \"history\";\nimport { createBrowserHistory, createHashHistory, createPath } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n resolvePath,\n renderMatches,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n} from \"react-router\";\nimport type { To } from \"react-router\";\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// RE-EXPORTS\n////////////////////////////////////////////////////////////////////////////////\n\n// Note: Keep in sync with react-router exports!\nexport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n renderMatches,\n resolvePath,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n};\n\nexport type {\n Location,\n Path,\n To,\n NavigationType,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigator,\n OutletProps,\n Params,\n PathMatch,\n RouteMatch,\n RouteObject,\n RouteProps,\n PathRouteProps,\n LayoutRouteProps,\n IndexRouteProps,\n RouterProps,\n RoutesProps\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext\n} from \"react-router\";\n\n////////////////////////////////////////////////////////////////////////////////\n// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nfunction isModifiedEvent(event: React.MouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n replace?: boolean;\n state?: any;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n { onClick, replace = false, state, target, to, ...rest },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, { replace, state, target });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps extends Omit<LinkProps, \"className\" | \"style\"> {\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: { isActive: boolean }) => React.CSSProperties);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n ...rest\n },\n ref\n ) {\n let location = useLocation();\n let path = useResolvedPath(to);\n\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive =\n locationPathname === toPathname ||\n (!end &&\n locationPathname.startsWith(toPathname) &&\n locationPathname.charAt(toPathname.length) === \"/\");\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\" ? styleProp({ isActive }) : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n />\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` compoments with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here.\n let replace =\n !!replaceProp || createPath(location) === createPath(path);\n\n navigate(to, { replace, state });\n }\n },\n [location, navigate, path, replaceProp, state, target, to]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n"],"names":["BrowserRouter","basename","children","window","historyRef","React","current","createBrowserHistory","history","state","setState","action","location","listen","React.createElement","Router","navigationType","navigator","HashRouter","createHashHistory","Link","onClick","replace","target","to","rest","ref","href","useHref","internalOnClick","useLinkClickHandler","event","defaultPrevented","NavLink","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","useLocation","path","useResolvedPath","locationPathname","pathname","toPathname","toLowerCase","isActive","startsWith","charAt","length","ariaCurrent","undefined","filter","Boolean","join","replaceProp","navigate","useNavigate","button","metaKey","altKey","ctrlKey","shiftKey","isModifiedEvent","preventDefault","createPath","useSearchParams","defaultInit","defaultSearchParamsRef","createSearchParams","searchParams","search","key","keys","has","getAll","forEach","value","append","nextInit","navigateOptions","init","URLSearchParams","Array","isArray","Object","reduce","memo","concat","map","v"],"mappings":";;;;;;;;;;oqBAoIO,SAASA,GAAcC,SAC5BA,EAD4BC,SAE5BA,EAF4BC,OAG5BA,QAEIC,EAAaC,IACS,MAAtBD,EAAWE,UACbF,EAAWE,QAAUC,EAAqB,CAAEJ,OAAAA,SAG1CK,EAAUJ,EAAWE,SACpBG,EAAOC,GAAYL,EAAe,CACrCM,OAAQH,EAAQG,OAChBC,SAAUJ,EAAQI,kBAGpBP,GAAsB,IAAMG,EAAQK,OAAOH,IAAW,CAACF,IAGrDM,EAACC,GACCd,SAAUA,EACVC,SAAUA,EACVU,SAAUH,EAAMG,SAChBI,eAAgBP,EAAME,OACtBM,UAAWT,IAeV,SAASU,GAAWjB,SAAEA,EAAFC,SAAYA,EAAZC,OAAsBA,QAC3CC,EAAaC,IACS,MAAtBD,EAAWE,UACbF,EAAWE,QAAUa,EAAkB,CAAEhB,OAAAA,SAGvCK,EAAUJ,EAAWE,SACpBG,EAAOC,GAAYL,EAAe,CACrCM,OAAQH,EAAQG,OAChBC,SAAUJ,EAAQI,kBAGpBP,GAAsB,IAAMG,EAAQK,OAAOH,IAAW,CAACF,IAGrDM,EAACC,GACCd,SAAUA,EACVC,SAAUA,EACVU,SAAUH,EAAMG,SAChBI,eAAgBP,EAAME,OACtBM,UAAWT,UAmBJY,EAAOf,GAClB,UACEgB,QAAEA,EAAFC,QAAWA,GAAU,EAArBb,MAA4BA,EAA5Bc,OAAmCA,EAAnCC,GAA2CA,KAAOC,GAClDC,OAEIC,EAAOC,EAAQJ,GACfK,EAAkBC,EAAoBN,EAAI,CAAEF,QAAAA,EAASb,MAAAA,EAAOc,OAAAA,kCAaxDE,QACEE,mBAZRI,GAEIV,GAASA,EAAQU,GAChBA,EAAMC,kBACTH,EAAgBE,QAUXL,SACGH,QAsBHU,EAAU5B,GACrB,yBAEoB6B,EAAkB,OADpCC,cAEEA,GAAgB,EAChBC,UAAWC,EAAgB,GAH7BC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,QAAQuE,OAAOH,GAAKI,SAAQC,IACjDP,EAAaQ,OAAON,EAAKK,aAKxBP,IACN,CAAC5D,EAAS6D,SAETf,EAAWC,UAWR,CAACa,EAVcnE,GACpB,CACE4E,EACAC,KAEAxB,EAAS,IAAMa,EAAmBU,GAAWC,KAE/C,CAACxB,KAmCE,SAASa,EACdY,EAA4B,WAErB,IAAIC,gBACO,iBAATD,GACPE,MAAMC,QAAQH,IACdA,aAAgBC,gBACZD,EACAI,OAAOZ,KAAKQ,GAAMK,QAAO,CAACC,EAAMf,SAC1BK,EAAQI,EAAKT,UACVe,EAAKC,OACVL,MAAMC,QAAQP,GAASA,EAAMY,KAAIC,GAAK,CAAClB,EAAKkB,KAAM,CAAC,CAAClB,EAAKK,OAE1D"}
|
|
1
|
+
{"version":3,"file":"react-router-dom.production.min.js","sources":["../../../packages/react-router-dom/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { BrowserHistory, HashHistory } from \"history\";\nimport { createBrowserHistory, createHashHistory, createPath } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n resolvePath,\n renderMatches,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n} from \"react-router\";\nimport type { To } from \"react-router\";\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// RE-EXPORTS\n////////////////////////////////////////////////////////////////////////////////\n\n// Note: Keep in sync with react-router exports!\nexport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n renderMatches,\n resolvePath,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n};\n\nexport type {\n Location,\n Path,\n To,\n NavigationType,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigator,\n OutletProps,\n Params,\n PathMatch,\n RouteMatch,\n RouteObject,\n RouteProps,\n PathRouteProps,\n LayoutRouteProps,\n IndexRouteProps,\n RouterProps,\n RoutesProps\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext\n} from \"react-router\";\n\n////////////////////////////////////////////////////////////////////////////////\n// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nfunction isModifiedEvent(event: React.MouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n reloadDocument?: boolean;\n replace?: boolean;\n state?: any;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n { onClick, reloadDocument, replace = false, state, target, to, ...rest },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, { replace, state, target });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented && !reloadDocument) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps extends Omit<LinkProps, \"className\" | \"style\"> {\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: { isActive: boolean }) => React.CSSProperties);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n ...rest\n },\n ref\n ) {\n let location = useLocation();\n let path = useResolvedPath(to);\n\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive =\n locationPathname === toPathname ||\n (!end &&\n locationPathname.startsWith(toPathname) &&\n locationPathname.charAt(toPathname.length) === \"/\");\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\" ? styleProp({ isActive }) : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n />\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` components with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here.\n let replace =\n !!replaceProp || createPath(location) === createPath(path);\n\n navigate(to, { replace, state });\n }\n },\n [location, navigate, path, replaceProp, state, target, to]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n"],"names":["BrowserRouter","basename","children","window","historyRef","React","current","createBrowserHistory","history","state","setState","action","location","listen","React.createElement","Router","navigationType","navigator","HashRouter","createHashHistory","Link","onClick","reloadDocument","replace","target","to","rest","ref","href","useHref","internalOnClick","useLinkClickHandler","event","defaultPrevented","NavLink","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","useLocation","path","useResolvedPath","locationPathname","pathname","toPathname","toLowerCase","isActive","startsWith","charAt","length","ariaCurrent","undefined","filter","Boolean","join","replaceProp","navigate","useNavigate","button","metaKey","altKey","ctrlKey","shiftKey","isModifiedEvent","preventDefault","createPath","useSearchParams","defaultInit","defaultSearchParamsRef","createSearchParams","searchParams","search","key","keys","has","getAll","forEach","value","append","nextInit","navigateOptions","init","URLSearchParams","Array","isArray","Object","reduce","memo","concat","map","v"],"mappings":";;;;;;;;;;oqBAoIO,SAASA,GAAcC,SAC5BA,EAD4BC,SAE5BA,EAF4BC,OAG5BA,QAEIC,EAAaC,IACS,MAAtBD,EAAWE,UACbF,EAAWE,QAAUC,EAAqB,CAAEJ,OAAAA,SAG1CK,EAAUJ,EAAWE,SACpBG,EAAOC,GAAYL,EAA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,gBACO,iBAATD,GACPE,MAAMC,QAAQH,IACdA,aAAgBC,gBACZD,EACAI,OAAOZ,KAAKQ,GAAMK,QAAO,CAACC,EAAMf,SAC1BK,EAAQI,EAAKT,UACVe,EAAKC,OACVL,MAAMC,QAAQP,GAASA,EAAMY,KAAIC,GAAK,CAAClB,EAAKkB,KAAM,CAAC,CAAClB,EAAKK,OAE1D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router DOM v6.0.
|
|
2
|
+
* React Router DOM v6.0.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
return target;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const _excluded = ["onClick", "replace", "state", "target", "to"],
|
|
50
|
+
const _excluded = ["onClick", "reloadDocument", "replace", "state", "target", "to"],
|
|
51
51
|
_excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to"];
|
|
52
52
|
|
|
53
53
|
function warning(cond, message) {
|
|
@@ -143,6 +143,7 @@
|
|
|
143
143
|
const Link = /*#__PURE__*/React.forwardRef(function LinkWithRef(_ref3, ref) {
|
|
144
144
|
let {
|
|
145
145
|
onClick,
|
|
146
|
+
reloadDocument,
|
|
146
147
|
replace = false,
|
|
147
148
|
state,
|
|
148
149
|
target,
|
|
@@ -160,7 +161,7 @@
|
|
|
160
161
|
function handleClick(event) {
|
|
161
162
|
if (onClick) onClick(event);
|
|
162
163
|
|
|
163
|
-
if (!event.defaultPrevented) {
|
|
164
|
+
if (!event.defaultPrevented && !reloadDocument) {
|
|
164
165
|
internalOnClick(event);
|
|
165
166
|
}
|
|
166
167
|
}
|
|
@@ -242,7 +243,7 @@
|
|
|
242
243
|
|
|
243
244
|
/**
|
|
244
245
|
* Handles the click behavior for router `<Link>` components. This is useful if
|
|
245
|
-
* you need to create custom `<Link>`
|
|
246
|
+
* you need to create custom `<Link>` components with the same click behavior we
|
|
246
247
|
* use in our exported `<Link>`.
|
|
247
248
|
*/
|
|
248
249
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-router-dom.development.js","sources":["../../../../packages/react-router-dom/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { BrowserHistory, HashHistory } from \"history\";\nimport { createBrowserHistory, createHashHistory, createPath } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n resolvePath,\n renderMatches,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n} from \"react-router\";\nimport type { To } from \"react-router\";\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// RE-EXPORTS\n////////////////////////////////////////////////////////////////////////////////\n\n// Note: Keep in sync with react-router exports!\nexport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n renderMatches,\n resolvePath,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n};\n\nexport type {\n Location,\n Path,\n To,\n NavigationType,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigator,\n OutletProps,\n Params,\n PathMatch,\n RouteMatch,\n RouteObject,\n RouteProps,\n PathRouteProps,\n LayoutRouteProps,\n IndexRouteProps,\n RouterProps,\n RoutesProps\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext\n} from \"react-router\";\n\n////////////////////////////////////////////////////////////////////////////////\n// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nfunction isModifiedEvent(event: React.MouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n replace?: boolean;\n state?: any;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n { onClick, replace = false, state, target, to, ...rest },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, { replace, state, target });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps extends Omit<LinkProps, \"className\" | \"style\"> {\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: { isActive: boolean }) => React.CSSProperties);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n ...rest\n },\n ref\n ) {\n let location = useLocation();\n let path = useResolvedPath(to);\n\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive =\n locationPathname === toPathname ||\n (!end &&\n locationPathname.startsWith(toPathname) &&\n locationPathname.charAt(toPathname.length) === \"/\");\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\" ? styleProp({ isActive }) : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n />\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` compoments with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here.\n let replace =\n !!replaceProp || createPath(location) === createPath(path);\n\n navigate(to, { replace, state });\n }\n },\n [location, navigate, path, replaceProp, state, target, to]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n"],"names":["warning","cond","message","console","warn","Error","e","BrowserRouter","basename","children","window","historyRef","React","current","createBrowserHistory","history","state","setState","action","location","listen","React.createElement","Router","HashRouter","createHashHistory","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","Link","LinkWithRef","ref","onClick","replace","target","to","rest","href","useHref","internalOnClick","useLinkClickHandler","handleClick","defaultPrevented","displayName","NavLink","NavLinkWithRef","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","useLocation","path","useResolvedPath","locationPathname","pathname","toPathname","toLowerCase","isActive","startsWith","charAt","length","ariaCurrent","undefined","filter","Boolean","join","replaceProp","navigate","useNavigate","button","preventDefault","createPath","useSearchParams","defaultInit","URLSearchParams","defaultSearchParamsRef","createSearchParams","searchParams","search","key","keys","has","getAll","forEach","value","append","setSearchParams","nextInit","navigateOptions","init","Array","isArray","Object","reduce","memo","concat","map","v"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA,SAASA,OAAT,CAAiBC,IAAjB,EAAgCC,OAAhC,EAAuD;EACrD,MAAI,CAACD,IAAL,EAAW;EACT;EACA,QAAI,OAAOE,OAAP,KAAmB,WAAvB,EAAoCA,OAAO,CAACC,IAAR,CAAaF,OAAb;;EAEpC,QAAI;EACF;EACA;EACA;EACA;EACA;EACA,YAAM,IAAIG,KAAJ,CAAUH,OAAV,CAAN,CANE;EAQH,KARD,CAQE,OAAOI,CAAP,EAAU;EACb;EACF;EA4ED;EACA;;EAQA;EACA;EACA;EACO,SAASC,aAAT,OAIgB;EAAA,MAJO;EAC5BC,IAAAA,QAD4B;EAE5BC,IAAAA,QAF4B;EAG5BC,IAAAA;EAH4B,GAIP;EACrB,MAAIC,UAAU,GAAGC,YAAA,EAAjB;;EACA,MAAID,UAAU,CAACE,OAAX,IAAsB,IAA1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EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACO,SAASV,kBAAT,CACLa,IADK,EAEY;EAAA,MADjBA,IACiB;EADjBA,IAAAA,IACiB,GADW,EACX;EAAA;;EACjB,SAAO,IAAIf,eAAJ,CACL,OAAOe,IAAP,KAAgB,QAAhB,IACAC,KAAK,CAACC,OAAN,CAAcF,IAAd,CADA,IAEAA,IAAI,YAAYf,eAFhB,GAGIe,IAHJ,GAIIG,MAAM,CAACZ,IAAP,CAAYS,IAAZ,EAAkBI,MAAlB,CAAyB,CAACC,IAAD,EAAOf,GAAP,KAAe;EACtC,QAAIK,KAAK,GAAGK,IAAI,CAACV,GAAD,CAAhB;EACA,WAAOe,IAAI,CAACC,MAAL,CACLL,KAAK,CAACC,OAAN,CAAcP,KAAd,IAAuBA,KAAK,CAACY,GAAN,CAAUC,CAAC,IAAI,CAAClB,GAAD,EAAMkB,CAAN,CAAf,CAAvB,GAAkD,CAAC,CAAClB,GAAD,EAAMK,KAAN,CAAD,CAD7C,CAAP;EAGD,GALD,EAKG,EALH,CALC,CAAP;EAYD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"react-router-dom.development.js","sources":["../../../../packages/react-router-dom/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { BrowserHistory, HashHistory } from \"history\";\nimport { createBrowserHistory, createHashHistory, createPath } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n resolvePath,\n renderMatches,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n} from \"react-router\";\nimport type { To } from \"react-router\";\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// RE-EXPORTS\n////////////////////////////////////////////////////////////////////////////////\n\n// Note: Keep in sync with react-router exports!\nexport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n renderMatches,\n resolvePath,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n};\n\nexport type {\n Location,\n Path,\n To,\n NavigationType,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigator,\n OutletProps,\n Params,\n PathMatch,\n RouteMatch,\n RouteObject,\n RouteProps,\n PathRouteProps,\n LayoutRouteProps,\n IndexRouteProps,\n RouterProps,\n RoutesProps\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext\n} from \"react-router\";\n\n////////////////////////////////////////////////////////////////////////////////\n// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nfunction isModifiedEvent(event: React.MouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n reloadDocument?: boolean;\n replace?: boolean;\n state?: any;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n { onClick, reloadDocument, replace = false, state, target, to, ...rest },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, { replace, state, target });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented && !reloadDocument) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps extends Omit<LinkProps, \"className\" | \"style\"> {\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: { isActive: boolean }) => React.CSSProperties);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n ...rest\n },\n ref\n ) {\n let location = useLocation();\n let path = useResolvedPath(to);\n\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive =\n locationPathname === toPathname ||\n (!end &&\n locationPathname.startsWith(toPathname) &&\n locationPathname.charAt(toPathname.length) === \"/\");\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\" ? styleProp({ isActive }) : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n />\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` components with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here.\n let replace =\n !!replaceProp || createPath(location) === createPath(path);\n\n navigate(to, { replace, state });\n }\n },\n [location, navigate, path, replaceProp, state, target, to]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n"],"names":["warning","cond","message","console","warn","Error","e","BrowserRouter","basename","children","window","historyRef","React","current","createBrowserHistory","history","state","setState","action","location","listen","React.createElement","Router","HashRouter","createHashHistory","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","Link","LinkWithRef","ref","onClick","reloadDocument","replace","target","to","rest","href","useHref","internalOnClick","useLinkClickHandler","handleClick","defaultPrevented","displayName","NavLink","NavLinkWithRef","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","useLocation","path","useResolvedPath","locationPathname","pathname","toPathname","toLowerCase","isActive","startsWith","charAt","length","ariaCurrent","undefined","filter","Boolean","join","replaceProp","navigate","useNavigate","button","preventDefault","createPath","useSearchParams","defaultInit","URLSearchParams","defaultSearchParamsRef","createSearchParams","searchParams","search","key","keys","has","getAll","forEach","value","append","setSearchParams","nextInit","navigateOptions","init","Array","isArray","Object","reduce","memo","concat","map","v"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA,SAASA,OAAT,CAAiBC,IAAjB,EAAgCC,OAAhC,EAAuD;EACrD,MAAI,CAACD,IAAL,EAAW;EACT;EACA,QAAI,OAAOE,OAAP,KAAmB,WAAvB,EAAoCA,OAAO,CAACC,IAAR,CAAaF,OAAb;;EAEpC,QAAI;EACF;EACA;EACA;EACA;EACA;EACA,YAAM,IAAIG,KAAJ,CAAUH,OAAV,CAAN,CANE;EAQH,KARD,CAQE,OAAOI,CAAP,EAAU;EACb;EACF;EA4ED;EACA;;EAQA;EACA;EACA;EACO,SAASC,aAAT,OAIgB;EAAA,MAJO;EAC5BC,IAAAA,QAD4B;EAE5BC,IAAAA,QAF4B;EAG5BC,IAAAA;EAH4B,GAIP;EACrB,MAAIC,UAAU,GAAGC,YAAA,EAAjB;;EACA,MAAID,UAAU,CAACE,OAAX,IAAsB,IAA1B,EAAgC;EAC9BF,IAAAA,UAAU,CAACE,OAAX,GAAqBC,4BAAoB,CAAC;EAAEJ,MAAAA;EAAF,KAAD,CAAzC;EACD;;EAED,MAAIK,SAAO,GAAGJ,UAAU,CAACE,OAAzB;EACA,MAAI,CAACG,KAAD,EAAQC,QAAR,IAAoBL,cAAA,CAAe;EACrCM,IAAAA,MAAM,EAAEH,SAAO,CAACG,MADqB;EAErCC,IAAAA,QAAQ,EAAEJ,SAAO,CAACI;EAFmB,GAAf,CAAxB;EAKAP,EAAAA,qBAAA,CAA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AAYf,eAFhB,GAGIe,IAHJ,GAIIG,MAAM,CAACZ,IAAP,CAAYS,IAAZ,EAAkBI,MAAlB,CAAyB,CAACC,IAAD,EAAOf,GAAP,KAAe;EACtC,QAAIK,KAAK,GAAGK,IAAI,CAACV,GAAD,CAAhB;EACA,WAAOe,IAAI,CAACC,MAAL,CACLL,KAAK,CAACC,OAAN,CAAcP,KAAd,IAAuBA,KAAK,CAACY,GAAN,CAAUC,CAAC,IAAI,CAAClB,GAAD,EAAMkB,CAAN,CAAf,CAAvB,GAAkD,CAAC,CAAClB,GAAD,EAAMK,KAAN,CAAD,CAD7C,CAAP;EAGD,GALD,EAKG,EALH,CALC,CAAP;EAYD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router DOM v6.0.
|
|
2
|
+
* React Router DOM v6.0.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
!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:
|
|
11
|
+
!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","reloadDocument","replace","state","target","to"],c=["aria-current","caseSensitive","className","end","style","to"];const i=t.forwardRef((function(e,r){let{onClick:c,reloadDocument:i,replace:s=!1,state:f,target:d,to:b}=e,y=o(e,u),m=n.useHref(b),p=l(b,{replace:s,state:f,target:d});return t.createElement("a",a({},y,{href:m,onClick:function(e){c&&c(e),e.defaultPrevented||i||p(e)},ref:r,target:d}))})),s=t.forwardRef((function(e,r){let{"aria-current":u="page",caseSensitive:s=!1,className:l="",end:f=!1,style:d,to:b}=e,y=o(e,c),m=n.useLocation(),p=n.useResolvedPath(b),g=m.pathname,h=p.pathname;s||(g=g.toLowerCase(),h=h.toLowerCase());let P,R=g===h||!f&&g.startsWith(h)&&"/"===g.charAt(h.length),O=R?u:void 0;P="function"==typeof l?l({isActive:R}):[l,R?"active":null].filter(Boolean).join(" ");let v="function"==typeof d?d({isActive:R}):d;return t.createElement(i,a({},y,{"aria-current":O,className:P,ref:r,style:v,to:b}))}));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,"useNavigationType",{enumerable:!0,get:function(){return n.useNavigationType}}),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,location:s.location,navigationType:s.action,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,location:s.location,navigationType:s.action,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})}));
|
|
12
12
|
//# sourceMappingURL=react-router-dom.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-router-dom.production.min.js","sources":["../../../../packages/react-router-dom/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { BrowserHistory, HashHistory } from \"history\";\nimport { createBrowserHistory, createHashHistory, createPath } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n resolvePath,\n renderMatches,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n} from \"react-router\";\nimport type { To } from \"react-router\";\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// RE-EXPORTS\n////////////////////////////////////////////////////////////////////////////////\n\n// Note: Keep in sync with react-router exports!\nexport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n renderMatches,\n resolvePath,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n};\n\nexport type {\n Location,\n Path,\n To,\n NavigationType,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigator,\n OutletProps,\n Params,\n PathMatch,\n RouteMatch,\n RouteObject,\n RouteProps,\n PathRouteProps,\n LayoutRouteProps,\n IndexRouteProps,\n RouterProps,\n RoutesProps\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext\n} from \"react-router\";\n\n////////////////////////////////////////////////////////////////////////////////\n// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nfunction isModifiedEvent(event: React.MouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n replace?: boolean;\n state?: any;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n { onClick, replace = false, state, target, to, ...rest },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, { replace, state, target });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps extends Omit<LinkProps, \"className\" | \"style\"> {\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: { isActive: boolean }) => React.CSSProperties);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n ...rest\n },\n ref\n ) {\n let location = useLocation();\n let path = useResolvedPath(to);\n\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive =\n locationPathname === toPathname ||\n (!end &&\n locationPathname.startsWith(toPathname) &&\n locationPathname.charAt(toPathname.length) === \"/\");\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\" ? styleProp({ isActive }) : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n />\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` compoments with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here.\n let replace =\n !!replaceProp || createPath(location) === createPath(path);\n\n navigate(to, { replace, state });\n }\n },\n [location, navigate, path, replaceProp, state, target, to]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n"],"names":["Link","React","ref","onClick","replace","state","target","to","rest","href","useHref","internalOnClick","useLinkClickHandler","event","defaultPrevented","NavLink","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","location","useLocation","path","useResolvedPath","locationPathname","pathname","toPathname","toLowerCase","isActive","startsWith","charAt","length","ariaCurrent","undefined","filter","Boolean","join","React.createElement","replaceProp","navigate","useNavigate","button","metaKey","altKey","ctrlKey","shiftKey","isModifiedEvent","preventDefault","createPath","createSearchParams","init","URLSearchParams","Array","isArray","Object","keys","reduce","memo","key","value","concat","map","v","basename","children","window","historyRef","current","createBrowserHistory","history","setState","action","listen","Router","navigationType","navigator","createHashHistory","defaultInit","defaultSearchParamsRef","searchParams","search","has","getAll","forEach","append","nextInit","navigateOptions"],"mappings":";;;;;;;;;;wyBAkNaA,EAAOC,cAClB,WAEEC,OADAC,QAAEA,EAAFC,QAAWA,GAAU,EAArBC,MAA4BA,EAA5BC,OAAmCA,EAAnCC,GAA2CA,KAAOC,SAG9CC,EAAOC,UAAQH,GACfI,EAAkBC,EAAoBL,EAAI,CAAEH,QAAAA,EAASC,MAAAA,EAAOC,OAAAA,oCAaxDE,GACJC,KAAMA,EACNN,iBAbFU,GAEIV,GAASA,EAAQU,GAChBA,EAAMC,kBACTH,EAAgBE,IAUhBX,IAAKA,EACLI,OAAQA,QAsBHS,EAAUd,cACrB,WAUEC,sBARkBc,EAAkB,OADpCC,cAEEA,GAAgB,EAChBC,UAAWC,EAAgB,GAH7BC,IAIEA,GAAM,EACNC,MAAOC,EALTf,GAMEA,KACGC,SAIDe,EAAWC,gBACXC,EAAOC,kBAAgBnB,GAEvBoB,EAAmBJ,EAASK,SAC5BC,EAAaJ,EAAKG,SACjBX,IACHU,EAAmBA,EAAiBG,cACpCD,EAAaA,EAAWC,mBAWtBZ,EARAa,EACFJ,IAAqBE,IACnBT,GACAO,EAAiBK,WAAWH,IACmB,MAA/CF,EAAiBM,OAAOJ,EAAWK,QAEnCC,EAAcJ,EAAWf,OAAkBoB,EAI7ClB,EAD2B,mBAAlBC,EACGA,EAAc,CAAEY,SAAAA,I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AMuE,EAAQG,OAAOF,IAAW,CAACD,IAGrDhC,gBAACoC,UACCV,SAAUA,EACVC,SAAUA,EACV5C,SAAUlB,EAAMkB,SAChBsD,eAAgBxE,EAAMqE,OACtBI,UAAWN,kBAeV,gBAAoBN,SAAEA,EAAFC,SAAYA,EAAZC,OAAsBA,KAC3CC,EAAapE,WACS,MAAtBoE,EAAWC,UACbD,EAAWC,QAAUS,oBAAkB,CAAEX,OAAAA,SAGvCI,EAAUH,EAAWC,SACpBjE,EAAOoE,GAAYxE,WAAe,CACrCyE,OAAQF,EAAQE,OAChBnD,SAAUiD,EAAQjD,kBAGpBtB,mBAAsB,IAAMuE,EAAQG,OAAOF,IAAW,CAACD,IAGrDhC,gBAACoC,UACCV,SAAUA,EACVC,SAAUA,EACV5C,SAAUlB,EAAMkB,SAChBsD,eAAgBxE,EAAMqE,OACtBI,UAAWN,2FAmLV,SAAyBQ,OAa1BC,EAAyBhF,SAAamD,EAAmB4B,IAEzDzD,EAAWC,gBACX0D,EAAejF,WAAc,SAC3BiF,EAAe9B,EAAmB7B,EAAS4D,YAE1C,IAAItB,KAAOoB,EAAuBX,QAAQZ,OACxCwB,EAAaE,IAAIvB,IACpBoB,EAAuBX,QAAQe,OAAOxB,GAAKyB,SAAQxB,IACjDoB,EAAaK,OAAO1B,EAAKC,aAKxBoB,IACN,CAAC3D,EAAS4D,SAETzC,EAAWC,sBAWR,CAACuC,EAVcjF,eACpB,CACEuF,EACAC,KAEA/C,EAAS,IAAMU,EAAmBoC,GAAWC,KAE/C,CAAC/C"}
|
|
1
|
+
{"version":3,"file":"react-router-dom.production.min.js","sources":["../../../../packages/react-router-dom/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { BrowserHistory, HashHistory } from \"history\";\nimport { createBrowserHistory, createHashHistory, createPath } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n resolvePath,\n renderMatches,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n} from \"react-router\";\nimport type { To } from \"react-router\";\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// RE-EXPORTS\n////////////////////////////////////////////////////////////////////////////////\n\n// Note: Keep in sync with react-router exports!\nexport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n renderMatches,\n resolvePath,\n useHref,\n useInRouterContext,\n useLocation,\n useMatch,\n useNavigate,\n useNavigationType,\n useOutlet,\n useParams,\n useResolvedPath,\n useRoutes\n};\n\nexport type {\n Location,\n Path,\n To,\n NavigationType,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigator,\n OutletProps,\n Params,\n PathMatch,\n RouteMatch,\n RouteObject,\n RouteProps,\n PathRouteProps,\n LayoutRouteProps,\n IndexRouteProps,\n RouterProps,\n RoutesProps\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext\n} from \"react-router\";\n\n////////////////////////////////////////////////////////////////////////////////\n// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A <Router> for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nfunction isModifiedEvent(event: React.MouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n reloadDocument?: boolean;\n replace?: boolean;\n state?: any;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n { onClick, reloadDocument, replace = false, state, target, to, ...rest },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, { replace, state, target });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented && !reloadDocument) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps extends Omit<LinkProps, \"className\" | \"style\"> {\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: { isActive: boolean }) => React.CSSProperties);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n ...rest\n },\n ref\n ) {\n let location = useLocation();\n let path = useResolvedPath(to);\n\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive =\n locationPathname === toPathname ||\n (!end &&\n locationPathname.startsWith(toPathname) &&\n locationPathname.charAt(toPathname.length) === \"/\");\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\" ? styleProp({ isActive }) : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n />\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` components with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here.\n let replace =\n !!replaceProp || createPath(location) === createPath(path);\n\n navigate(to, { replace, state });\n }\n },\n [location, navigate, path, replaceProp, state, target, to]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n"],"names":["Link","React","ref","onClick","reloadDocument","replace","state","target","to","rest","href","useHref","internalOnClick","useLinkClickHandler","event","defaultPrevented","NavLink","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","location","useLocation","path","useResolvedPath","locationPathname","pathname","toPathname","toLowerCase","isActive","startsWith","charAt","length","ariaCurrent","undefined","filter","Boolean","join","React.createElement","replaceProp","navigate","useNavigate","button","metaKey","altKey","ctrlKey","shiftKey","isModifiedEvent","preventDefault","createPath","createSearchParams","init","URLSearchParams","Array","isArray","Object","keys","reduce","memo","key","value","concat","map","v","basename","children","window","historyRef","current","createBrowserHistory","history","setState","action","listen","Router","navigationType","navigator","createHashHistory","defaultInit","defaultSearchParamsRef","searchParams","search","has","getAll","forEach","append","nextInit","navigateOptions"],"mappings":";;;;;;;;;;yzBAmNaA,EAAOC,cAClB,WAEEC,OADAC,QAAEA,EAAFC,eAAWA,EAAXC,QAA2BA,GAAU,EAArCC,MAA4CA,EAA5CC,OAAmDA,EAAnDC,GAA2DA,KAAOC,SAG9DC,EAAOC,UAAQH,GACfI,EAAkBC,EAAoBL,EAAI,CAAEH,QAAAA,EAASC,MAAAA,EAAOC,OAAAA,oCAaxDE,GACJC,KAAMA,EACNP,iBAbFW,GAEIX,GAASA,EAAQW,GAChBA,EAAMC,kBAAqBX,GAC9BQ,EAAgBE,IAUhBZ,IAAKA,EACLK,OAAQA,QAsBHS,EAAUf,cACrB,WAUEC,sBARkBe,EAAkB,OADpCC,cAEEA,GAAgB,EAChBC,UAAWC,EAAgB,GAH7BC,IAIEA,GAAM,EACNC,MAAOC,EALTf,GAMEA,KACGC,SAIDe,EAAWC,gBACXC,EAAOC,kBAAgBnB,GAEvBoB,EAAmBJ,EAASK,SAC5BC,EAAaJ,EAAKG,SACjBX,IACHU,EAAmBA,EAAiBG,cACpCD,EAAaA,EAAWC,mBAWtBZ,EARAa,EACFJ,IAAqBE,IACnBT,GACAO,EAAiBK,WAAWH,IACmB,MAA/CF,EAAiBM,OAAOJ,EAAWK,QAEnCC,EAAcJ,EAAWf,OAAkBoB,EAI7ClB,EAD2B,mBAAlBC,EACGA,EAAc,CAAEY,SAAAA,IAOhB,CAACZ,EAAeY,EAAW,SAAW,MAC/CM,OAAOC,SACPC,KAAK,SAGNlB,EACmB,mBAAdC,EAA2BA,EAAU,CAAES,SAAAA,IAAcT,SAG5DkB,gBAAC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