react-router-dom-v5-compat 0.0.0-experimental-compat.1

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/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) React Training 2015-2019
4
+ Copyright (c) Remix Software 2020-2021
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # React Router DOM Compat v5
2
+
3
+ TODO
package/index.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Welcome future Michael and Ryan 👋, or anybody else reading this. We're doing
3
+ * weird stuff here to help folks to migrate their React Router v5 apps to v6.
4
+ *
5
+ * So WTFlip is going on here?
6
+ *
7
+ * - We need to be able to run react-router-dom@v5 in parallel with
8
+ * react-router-dom@v6
9
+ *
10
+ * - npm/node/whoever doesn't let an app depend on two versions of the same
11
+ * package
12
+ *
13
+ * - Not only do we need to run two versions of the same package, we also need
14
+ * this `CompatRouter` to *itself* depend on both versions 😬
15
+ *
16
+ * - When this package depends on "history" and "react-router-dom", those need
17
+ * to be the `peerDependencies` that the application package.json declares.
18
+ *
19
+ * - That means this package can't depend on "react-router-dom" v6, but it needs to,
20
+ * therefore it must ~become~ react-router-dom v6 👻
21
+ *
22
+ * - We could import from "../../react-router-dom" and get rollup to bundle it as part
23
+ * of this package instead BUT ...
24
+ *
25
+ * - TSC needs to generate the types, and it has to derive the output paths from
26
+ * the import paths. If we have a weird require *outside of this package* to
27
+ * "../../react-router-dom" it's going to generate types from the common root
28
+ * of all module paths (Which makes sense becuase what else would it do? It
29
+ * needs to write the type files next to the source files so that typescript
30
+ * can resolve the types for tooling in the same location as the modules).
31
+ * Because tsc isn't as flexible as rollup, we have no control over this
32
+ * behavior.
33
+ *
34
+ * - Therefore, we simply copy the v6 modules into this package at build time.
35
+ * TSC won't come across any weird require paths (requiring outside of this
36
+ * package with "../../") and everybody puts the files where everybody else
37
+ * expects them to be.
38
+ *
39
+ * - The v6 `StaticRouter` found in `react-router-dom/server.ts` has a funny
40
+ * require to *itself* ("react-router-dom") so we had to duplicate it in this
41
+ * package because "react-router-dom" will point to the app's v5 version. We
42
+ * can't change that require to a normal internal require ("../index") because
43
+ * we generate two bundles (one for "react-router-dom" and one for
44
+ * "react-router-dom/server"). If it were an internal require then SSR router
45
+ * apps would have two copies of "react-router-dom", two contexts, and stuff
46
+ * would break. We could stop doing two bundles in v6 "react-router-dom" and
47
+ * deprecate the deep require if we wanted to avoid the duplication here.
48
+ */
49
+ export type { Hash, Location, Path, To, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigator, OutletProps, Params, PathMatch, RouteMatch, RouteObject, RouteProps, PathRouteProps, LayoutRouteProps, IndexRouteProps, RouterProps, Pathname, Search, RoutesProps, } from "./react-router-dom";
50
+ export { BrowserRouter, HashRouter, Link, MemoryRouter, NavLink, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, createSearchParams, generatePath, matchPath, matchRoutes, parsePath, renderMatches, resolvePath, unstable_HistoryRouter, useHref, useInRouterContext, useLinkClickHandler, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams, } from "./react-router-dom";
51
+ export type { StaticRouterProps } from "./lib/components";
52
+ export { CompatRouter, StaticRouter } from "./lib/components";
package/index.js ADDED
@@ -0,0 +1,455 @@
1
+ /**
2
+ * React Router DOM v5 Compat v0.0.0-experimental-compat.1
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ import { useRef, useState, useLayoutEffect, createElement, forwardRef, useCallback, useMemo, useEffect } from 'react';
12
+ import { createBrowserHistory, createHashHistory, parsePath, Action, createPath as createPath$1 } from 'history';
13
+ import { Router, useHref, createPath, useLocation, useResolvedPath, useNavigate, Routes, Route } from 'react-router';
14
+ export { MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, generatePath, matchPath, matchRoutes, parsePath, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes } from 'react-router';
15
+ import { useHistory } from 'react-router-dom';
16
+
17
+ function _extends() {
18
+ _extends = Object.assign || function (target) {
19
+ for (var i = 1; i < arguments.length; i++) {
20
+ var source = arguments[i];
21
+
22
+ for (var key in source) {
23
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
24
+ target[key] = source[key];
25
+ }
26
+ }
27
+ }
28
+
29
+ return target;
30
+ };
31
+
32
+ return _extends.apply(this, arguments);
33
+ }
34
+
35
+ function _objectWithoutPropertiesLoose(source, excluded) {
36
+ if (source == null) return {};
37
+ var target = {};
38
+ var sourceKeys = Object.keys(source);
39
+ var key, i;
40
+
41
+ for (i = 0; i < sourceKeys.length; i++) {
42
+ key = sourceKeys[i];
43
+ if (excluded.indexOf(key) >= 0) continue;
44
+ target[key] = source[key];
45
+ }
46
+
47
+ return target;
48
+ }
49
+
50
+ const _excluded = ["onClick", "reloadDocument", "replace", "state", "target", "to"],
51
+ _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"];
52
+
53
+ function warning(cond, message) {
54
+ if (!cond) {
55
+ // eslint-disable-next-line no-console
56
+ if (typeof console !== "undefined") console.warn(message);
57
+
58
+ try {
59
+ // Welcome to debugging React Router!
60
+ //
61
+ // This error is thrown as a convenience so you can more easily
62
+ // find the source for a warning that appears in the console by
63
+ // enabling "pause on exceptions" in your JavaScript debugger.
64
+ throw new Error(message); // eslint-disable-next-line no-empty
65
+ } catch (e) {}
66
+ }
67
+ } ////////////////////////////////////////////////////////////////////////////////
68
+ // COMPONENTS
69
+ ////////////////////////////////////////////////////////////////////////////////
70
+
71
+ /**
72
+ * A `<Router>` for use in web browsers. Provides the cleanest URLs.
73
+ */
74
+ function BrowserRouter(_ref) {
75
+ let {
76
+ basename,
77
+ children,
78
+ window
79
+ } = _ref;
80
+ let historyRef = useRef();
81
+
82
+ if (historyRef.current == null) {
83
+ historyRef.current = createBrowserHistory({
84
+ window
85
+ });
86
+ }
87
+
88
+ let history = historyRef.current;
89
+ let [state, setState] = useState({
90
+ action: history.action,
91
+ location: history.location
92
+ });
93
+ useLayoutEffect(() => history.listen(setState), [history]);
94
+ return /*#__PURE__*/createElement(Router, {
95
+ basename: basename,
96
+ children: children,
97
+ location: state.location,
98
+ navigationType: state.action,
99
+ navigator: history
100
+ });
101
+ }
102
+
103
+ /**
104
+ * A `<Router>` for use in web browsers. Stores the location in the hash
105
+ * portion of the URL so it is not sent to the server.
106
+ */
107
+ function HashRouter(_ref2) {
108
+ let {
109
+ basename,
110
+ children,
111
+ window
112
+ } = _ref2;
113
+ let historyRef = useRef();
114
+
115
+ if (historyRef.current == null) {
116
+ historyRef.current = createHashHistory({
117
+ window
118
+ });
119
+ }
120
+
121
+ let history = historyRef.current;
122
+ let [state, setState] = useState({
123
+ action: history.action,
124
+ location: history.location
125
+ });
126
+ useLayoutEffect(() => history.listen(setState), [history]);
127
+ return /*#__PURE__*/createElement(Router, {
128
+ basename: basename,
129
+ children: children,
130
+ location: state.location,
131
+ navigationType: state.action,
132
+ navigator: history
133
+ });
134
+ }
135
+
136
+ /**
137
+ * A `<Router>` that accepts a pre-instantiated history object. It's important
138
+ * to note that using your own history object is highly discouraged and may add
139
+ * two versions of the history library to your bundles unless you use the same
140
+ * version of the history library that React Router uses internally.
141
+ */
142
+ function HistoryRouter(_ref3) {
143
+ let {
144
+ basename,
145
+ children,
146
+ history
147
+ } = _ref3;
148
+ const [state, setState] = useState({
149
+ action: history.action,
150
+ location: history.location
151
+ });
152
+ useLayoutEffect(() => history.listen(setState), [history]);
153
+ return /*#__PURE__*/createElement(Router, {
154
+ basename: basename,
155
+ children: children,
156
+ location: state.location,
157
+ navigationType: state.action,
158
+ navigator: history
159
+ });
160
+ }
161
+
162
+ if (process.env.NODE_ENV !== "production") {
163
+ HistoryRouter.displayName = "unstable_HistoryRouter";
164
+ }
165
+
166
+ function isModifiedEvent(event) {
167
+ return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
168
+ }
169
+
170
+ /**
171
+ * The public API for rendering a history-aware <a>.
172
+ */
173
+ const Link = /*#__PURE__*/forwardRef(function LinkWithRef(_ref4, ref) {
174
+ let {
175
+ onClick,
176
+ reloadDocument,
177
+ replace = false,
178
+ state,
179
+ target,
180
+ to
181
+ } = _ref4,
182
+ rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
183
+
184
+ let href = useHref(to);
185
+ let internalOnClick = useLinkClickHandler(to, {
186
+ replace,
187
+ state,
188
+ target
189
+ });
190
+
191
+ function handleClick(event) {
192
+ if (onClick) onClick(event);
193
+
194
+ if (!event.defaultPrevented && !reloadDocument) {
195
+ internalOnClick(event);
196
+ }
197
+ }
198
+
199
+ return (
200
+ /*#__PURE__*/
201
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
202
+ createElement("a", _extends({}, rest, {
203
+ href: href,
204
+ onClick: handleClick,
205
+ ref: ref,
206
+ target: target
207
+ }))
208
+ );
209
+ });
210
+
211
+ if (process.env.NODE_ENV !== "production") {
212
+ Link.displayName = "Link";
213
+ }
214
+
215
+ /**
216
+ * A <Link> wrapper that knows if it's "active" or not.
217
+ */
218
+ const NavLink = /*#__PURE__*/forwardRef(function NavLinkWithRef(_ref5, ref) {
219
+ let {
220
+ "aria-current": ariaCurrentProp = "page",
221
+ caseSensitive = false,
222
+ className: classNameProp = "",
223
+ end = false,
224
+ style: styleProp,
225
+ to,
226
+ children
227
+ } = _ref5,
228
+ rest = _objectWithoutPropertiesLoose(_ref5, _excluded2);
229
+
230
+ let location = useLocation();
231
+ let path = useResolvedPath(to);
232
+ let locationPathname = location.pathname;
233
+ let toPathname = path.pathname;
234
+
235
+ if (!caseSensitive) {
236
+ locationPathname = locationPathname.toLowerCase();
237
+ toPathname = toPathname.toLowerCase();
238
+ }
239
+
240
+ let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/";
241
+ let ariaCurrent = isActive ? ariaCurrentProp : undefined;
242
+ let className;
243
+
244
+ if (typeof classNameProp === "function") {
245
+ className = classNameProp({
246
+ isActive
247
+ });
248
+ } else {
249
+ // If the className prop is not a function, we use a default `active`
250
+ // class for <NavLink />s that are active. In v5 `active` was the default
251
+ // value for `activeClassName`, but we are removing that API and can still
252
+ // use the old default behavior for a cleaner upgrade path and keep the
253
+ // simple styling rules working as they currently do.
254
+ className = [classNameProp, isActive ? "active" : null].filter(Boolean).join(" ");
255
+ }
256
+
257
+ let style = typeof styleProp === "function" ? styleProp({
258
+ isActive
259
+ }) : styleProp;
260
+ return /*#__PURE__*/createElement(Link, _extends({}, rest, {
261
+ "aria-current": ariaCurrent,
262
+ className: className,
263
+ ref: ref,
264
+ style: style,
265
+ to: to
266
+ }), typeof children === "function" ? children({
267
+ isActive
268
+ }) : children);
269
+ });
270
+
271
+ if (process.env.NODE_ENV !== "production") {
272
+ NavLink.displayName = "NavLink";
273
+ } ////////////////////////////////////////////////////////////////////////////////
274
+ // HOOKS
275
+ ////////////////////////////////////////////////////////////////////////////////
276
+
277
+ /**
278
+ * Handles the click behavior for router `<Link>` components. This is useful if
279
+ * you need to create custom `<Link>` components with the same click behavior we
280
+ * use in our exported `<Link>`.
281
+ */
282
+
283
+
284
+ function useLinkClickHandler(to, _temp) {
285
+ let {
286
+ target,
287
+ replace: replaceProp,
288
+ state
289
+ } = _temp === void 0 ? {} : _temp;
290
+ let navigate = useNavigate();
291
+ let location = useLocation();
292
+ let path = useResolvedPath(to);
293
+ return useCallback(event => {
294
+ if (event.button === 0 && ( // Ignore everything but left clicks
295
+ !target || target === "_self") && // Let browser handle "target=_blank" etc.
296
+ !isModifiedEvent(event) // Ignore clicks with modifier keys
297
+ ) {
298
+ event.preventDefault(); // If the URL hasn't changed, a regular <a> will do a replace instead of
299
+ // a push, so do the same here.
300
+
301
+ let replace = !!replaceProp || createPath(location) === createPath(path);
302
+ navigate(to, {
303
+ replace,
304
+ state
305
+ });
306
+ }
307
+ }, [location, navigate, path, replaceProp, state, target, to]);
308
+ }
309
+ /**
310
+ * A convenient wrapper for reading and writing search parameters via the
311
+ * URLSearchParams interface.
312
+ */
313
+
314
+ function useSearchParams(defaultInit) {
315
+ process.env.NODE_ENV !== "production" ? warning(typeof URLSearchParams !== "undefined", "You cannot use the `useSearchParams` hook in a browser that does not " + "support the URLSearchParams API. If you need to support Internet " + "Explorer 11, we recommend you load a polyfill such as " + "https://github.com/ungap/url-search-params\n\n" + "If you're unsure how to load polyfills, we recommend you check out " + "https://polyfill.io/v3/ which provides some recommendations about how " + "to load polyfills only for users that need them, instead of for every " + "user.") : void 0;
316
+ let defaultSearchParamsRef = useRef(createSearchParams(defaultInit));
317
+ let location = useLocation();
318
+ let searchParams = useMemo(() => {
319
+ let searchParams = createSearchParams(location.search);
320
+
321
+ for (let key of defaultSearchParamsRef.current.keys()) {
322
+ if (!searchParams.has(key)) {
323
+ defaultSearchParamsRef.current.getAll(key).forEach(value => {
324
+ searchParams.append(key, value);
325
+ });
326
+ }
327
+ }
328
+
329
+ return searchParams;
330
+ }, [location.search]);
331
+ let navigate = useNavigate();
332
+ let setSearchParams = useCallback((nextInit, navigateOptions) => {
333
+ navigate("?" + createSearchParams(nextInit), navigateOptions);
334
+ }, [navigate]);
335
+ return [searchParams, setSearchParams];
336
+ }
337
+
338
+ /**
339
+ * Creates a URLSearchParams object using the given initializer.
340
+ *
341
+ * This is identical to `new URLSearchParams(init)` except it also
342
+ * supports arrays as values in the object form of the initializer
343
+ * instead of just strings. This is convenient when you need multiple
344
+ * values for a given key, but don't want to use an array initializer.
345
+ *
346
+ * For example, instead of:
347
+ *
348
+ * let searchParams = new URLSearchParams([
349
+ * ['sort', 'name'],
350
+ * ['sort', 'price']
351
+ * ]);
352
+ *
353
+ * you can do:
354
+ *
355
+ * let searchParams = createSearchParams({
356
+ * sort: ['name', 'price']
357
+ * });
358
+ */
359
+ function createSearchParams(init) {
360
+ if (init === void 0) {
361
+ init = "";
362
+ }
363
+
364
+ return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
365
+ let value = init[key];
366
+ return memo.concat(Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]);
367
+ }, []));
368
+ }
369
+
370
+ function CompatRouter(_ref) {
371
+ let {
372
+ children
373
+ } = _ref;
374
+ let history = useHistory();
375
+ let [state, setState] = useState(() => ({
376
+ location: history.location,
377
+ action: history.action
378
+ }));
379
+ useEffect(() => {
380
+ history.listen((location, action) => setState({
381
+ location,
382
+ action
383
+ }));
384
+ }, [history]);
385
+ return /*#__PURE__*/createElement(Router, {
386
+ navigationType: state.action,
387
+ location: state.location,
388
+ navigator: history
389
+ }, /*#__PURE__*/createElement(Routes, null, /*#__PURE__*/createElement(Route, {
390
+ path: "*",
391
+ element: children
392
+ })));
393
+ }
394
+
395
+ /**
396
+ * A <Router> that may not transition to any other location. This is useful
397
+ * on the server where there is no stateful UI.
398
+ */
399
+ function StaticRouter(_ref2) {
400
+ let {
401
+ basename,
402
+ children,
403
+ location: locationProp = "/"
404
+ } = _ref2;
405
+
406
+ if (typeof locationProp === "string") {
407
+ locationProp = parsePath(locationProp);
408
+ }
409
+
410
+ let action = Action.Pop;
411
+ let location = {
412
+ pathname: locationProp.pathname || "/",
413
+ search: locationProp.search || "",
414
+ hash: locationProp.hash || "",
415
+ state: locationProp.state || null,
416
+ key: locationProp.key || "default"
417
+ };
418
+ let staticNavigator = {
419
+ createHref(to) {
420
+ return typeof to === "string" ? to : createPath$1(to);
421
+ },
422
+
423
+ push(to) {
424
+ throw new Error("You cannot use navigator.push() on the server because it is a stateless " + "environment. This error was probably triggered when you did a " + ("`navigate(" + JSON.stringify(to) + ")` somewhere in your app."));
425
+ },
426
+
427
+ replace(to) {
428
+ throw new Error("You cannot use navigator.replace() on the server because it is a stateless " + "environment. This error was probably triggered when you did a " + ("`navigate(" + JSON.stringify(to) + ", { replace: true })` somewhere ") + "in your app.");
429
+ },
430
+
431
+ go(delta) {
432
+ throw new Error("You cannot use navigator.go() on the server because it is a stateless " + "environment. This error was probably triggered when you did a " + ("`navigate(" + delta + ")` somewhere in your app."));
433
+ },
434
+
435
+ back() {
436
+ throw new Error("You cannot use navigator.back() on the server because it is a stateless " + "environment.");
437
+ },
438
+
439
+ forward() {
440
+ throw new Error("You cannot use navigator.forward() on the server because it is a stateless " + "environment.");
441
+ }
442
+
443
+ };
444
+ return /*#__PURE__*/createElement(Router, {
445
+ basename: basename,
446
+ children: children,
447
+ location: location,
448
+ navigationType: action,
449
+ navigator: staticNavigator,
450
+ static: true
451
+ });
452
+ }
453
+
454
+ export { BrowserRouter, CompatRouter, HashRouter, Link, NavLink, StaticRouter, createSearchParams, HistoryRouter as unstable_HistoryRouter, useLinkClickHandler, useSearchParams };
455
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../packages/react-router-dom-v5-compat/react-router-dom/index.tsx","../../../packages/react-router-dom-v5-compat/lib/components.tsx"],"sourcesContent":["/**\n * NOTE: If you refactor this to split up the modules into separate files,\n * you'll need to update the rollup config for react-router-dom-v5-compat.\n */\nimport * as React from \"react\";\nimport type { BrowserHistory, HashHistory, History } from \"history\";\nimport { createBrowserHistory, createHashHistory } from \"history\";\nimport {\n MemoryRouter,\n Navigate,\n Outlet,\n Route,\n Router,\n Routes,\n createRoutesFromChildren,\n generatePath,\n matchRoutes,\n matchPath,\n createPath,\n parsePath,\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 useOutletContext,\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 createPath,\n parsePath,\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 useOutletContext,\n};\n\nexport { NavigationType } from \"react-router\";\nexport type {\n Hash,\n Location,\n Path,\n To,\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 Pathname,\n Search,\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\nexport interface HistoryRouterProps {\n basename?: string;\n children?: React.ReactNode;\n history: History;\n}\n\n/**\n * A `<Router>` that accepts a pre-instantiated history object. It's important\n * to note that using your own history object is highly discouraged and may add\n * two versions of the history library to your bundles unless you use the same\n * version of the history library that React Router uses internally.\n */\nfunction HistoryRouter({ basename, children, history }: HistoryRouterProps) {\n const [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\nif (__DEV__) {\n HistoryRouter.displayName = \"unstable_HistoryRouter\";\n}\n\nexport { HistoryRouter as unstable_HistoryRouter };\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\n extends Omit<LinkProps, \"className\" | \"style\" | \"children\"> {\n children:\n | React.ReactNode\n | ((props: { isActive: boolean }) => React.ReactNode);\n caseSensitive?: boolean;\n className?: string | ((props: { isActive: boolean }) => string | undefined);\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 children,\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 | undefined;\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 {typeof children === \"function\" ? children({ isActive }) : children}\n </Link>\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","import * as React from \"react\";\nimport type { Location, To } from \"history\";\nimport { Action, createPath, parsePath } from \"history\";\n\n// Get useHistory from react-router-dom v5 (peer dep).\n// @ts-expect-error\nimport { useHistory } from \"react-router-dom\";\n\n// We are a wrapper around react-router-dom v6, so bring it in\n// and bundle it because an app can't have two versions of\n// react-router-dom in its package.json.\nimport { Router, Routes, Route } from \"../react-router-dom\";\n\nexport function CompatRouter({ children }: { children: React.ReactNode }) {\n let history = useHistory();\n let [state, setState] = React.useState(() => ({\n location: history.location,\n action: history.action,\n }));\n\n React.useEffect(() => {\n history.listen((location: Location, action: Action) =>\n setState({ location, action })\n );\n }, [history]);\n\n return (\n <Router\n navigationType={state.action}\n location={state.location}\n navigator={history}\n >\n <Routes>\n <Route path=\"*\" element={children} />\n </Routes>\n </Router>\n );\n}\n\nexport interface StaticRouterProps {\n basename?: string;\n children?: React.ReactNode;\n location: Partial<Location> | string;\n}\n\n/**\n * A <Router> that may not transition to any other location. This is useful\n * on the server where there is no stateful UI.\n */\nexport function StaticRouter({\n basename,\n children,\n location: locationProp = \"/\",\n}: StaticRouterProps) {\n if (typeof locationProp === \"string\") {\n locationProp = parsePath(locationProp);\n }\n\n let action = Action.Pop;\n let location: Location = {\n pathname: locationProp.pathname || \"/\",\n search: locationProp.search || \"\",\n hash: locationProp.hash || \"\",\n state: locationProp.state || null,\n key: locationProp.key || \"default\",\n };\n\n let staticNavigator = {\n createHref(to: To) {\n return typeof to === \"string\" ? to : createPath(to);\n },\n push(to: To) {\n throw new Error(\n `You cannot use navigator.push() on the server because it is a stateless ` +\n `environment. This error was probably triggered when you did a ` +\n `\\`navigate(${JSON.stringify(to)})\\` somewhere in your app.`\n );\n },\n replace(to: To) {\n throw new Error(\n `You cannot use navigator.replace() on the server because it is a stateless ` +\n `environment. This error was probably triggered when you did a ` +\n `\\`navigate(${JSON.stringify(to)}, { replace: true })\\` somewhere ` +\n `in your app.`\n );\n },\n go(delta: number) {\n throw new Error(\n `You cannot use navigator.go() on the server because it is a stateless ` +\n `environment. This error was probably triggered when you did a ` +\n `\\`navigate(${delta})\\` somewhere in your app.`\n );\n },\n back() {\n throw new Error(\n `You cannot use navigator.back() on the server because it is a stateless ` +\n `environment.`\n );\n },\n forward() {\n throw new Error(\n `You cannot use navigator.forward() on the server because it is a stateless ` +\n `environment.`\n );\n },\n };\n\n return (\n <Router\n basename={basename}\n children={children}\n location={location}\n navigationType={action}\n navigator={staticNavigator}\n static={true}\n />\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","HistoryRouter","displayName","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","Link","LinkWithRef","ref","onClick","reloadDocument","replace","target","to","rest","href","useHref","internalOnClick","useLinkClickHandler","handleClick","defaultPrevented","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","CompatRouter","useHistory","StaticRouter","locationProp","parsePath","Action","Pop","hash","staticNavigator","createHref","push","JSON","stringify","go","delta","back","forward"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,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;AAkFD;AACA;;AAQA;AACA;AACA;AACO,SAASC,aAAT,OAIgB;AAAA,MAJO;AAC5BC,IAAAA,QAD4B;AAE5BC,IAAAA,QAF4B;AAG5BC,IAAAA;AAH4B,GAIP;AACrB,MAAIC,U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0BpBC,IAAAA,IAAI,GAAG;AACL,YAAM,IAAIlH,KAAJ,CACJ,2FADI,CAAN;AAID,KA/BmB;;AAgCpBmH,IAAAA,OAAO,GAAG;AACR,YAAM,IAAInH,KAAJ,CACJ,8FADI,CAAN;AAID;;AArCmB,GAAtB;AAwCA,sBACEgB,cAAC,MAAD;AACE,IAAA,QAAQ,EAAEb,QADZ;AAEE,IAAA,QAAQ,EAAEC,QAFZ;AAGE,IAAA,QAAQ,EAAEU,QAHZ;AAIE,IAAA,cAAc,EAAED,MAJlB;AAKE,IAAA,SAAS,EAAE8F,eALb;AAME,IAAA,MAAM,EAAE;AANV,IADF;AAUD;;;;"}
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ import type { Location } from "history";
3
+ export declare function CompatRouter({ children }: {
4
+ children: React.ReactNode;
5
+ }): JSX.Element;
6
+ export interface StaticRouterProps {
7
+ basename?: string;
8
+ children?: React.ReactNode;
9
+ location: Partial<Location> | string;
10
+ }
11
+ /**
12
+ * A <Router> that may not transition to any other location. This is useful
13
+ * on the server where there is no stateful UI.
14
+ */
15
+ export declare function StaticRouter({ basename, children, location: locationProp, }: StaticRouterProps): JSX.Element;
package/main.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * React Router DOM v5 Compat v0.0.0-experimental-compat.1
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ /* eslint-env node */
14
+
15
+ if (process.env.NODE_ENV === "production") {
16
+ module.exports = require("./umd/react-router-dom-v5-compat.production.min.js");
17
+ } else {
18
+ module.exports = require("./umd/react-router-dom-v5-compat.development.js");
19
+ }