react-router 0.0.0-experimental-compat.6 → 0.0.0-experimental-48058118

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/LICENSE.md +1 -1
  3. package/dist/index.d.ts +21 -0
  4. package/dist/index.js +1397 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/components.d.ts +148 -0
  7. package/dist/lib/context.d.ts +90 -0
  8. package/dist/lib/hooks.d.ts +179 -0
  9. package/dist/lib/use-sync-external-store-shim/index.d.ts +7 -0
  10. package/dist/lib/use-sync-external-store-shim/useSyncExternalStoreShimClient.d.ts +7 -0
  11. package/dist/lib/use-sync-external-store-shim/useSyncExternalStoreShimServer.d.ts +9 -0
  12. package/{main.js → dist/main.js} +1 -1
  13. package/dist/react-router.development.js +1354 -0
  14. package/dist/react-router.development.js.map +1 -0
  15. package/dist/react-router.production.min.js +12 -0
  16. package/dist/react-router.production.min.js.map +1 -0
  17. package/dist/umd/react-router.development.js +1513 -0
  18. package/dist/umd/react-router.development.js.map +1 -0
  19. package/dist/umd/react-router.production.min.js +12 -0
  20. package/dist/umd/react-router.production.min.js.map +1 -0
  21. package/package.json +31 -19
  22. package/index.d.ts +0 -14
  23. package/index.js +0 -941
  24. package/index.js.map +0 -1
  25. package/lib/components.d.ts +0 -110
  26. package/lib/context.d.ts +0 -31
  27. package/lib/hooks.d.ts +0 -99
  28. package/lib/router.d.ts +0 -120
  29. package/react-router.development.js +0 -895
  30. package/react-router.development.js.map +0 -1
  31. package/react-router.production.min.js +0 -12
  32. package/react-router.production.min.js.map +0 -1
  33. package/umd/react-router.development.js +0 -990
  34. package/umd/react-router.development.js.map +0 -1
  35. package/umd/react-router.production.min.js +0 -12
  36. package/umd/react-router.production.min.js.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,170 @@
1
+ # `react-router`
2
+
3
+ ## 6.8.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies:
8
+ - `@remix-run/router@1.3.1`
9
+
10
+ ## 6.7.1-pre.0
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies:
15
+ - `@remix-run/router@1.3.1-pre.0`
16
+
17
+ ## 6.7.0
18
+
19
+ ### Minor Changes
20
+
21
+ - Add `unstable_useBlocker` hook for blocking navigations within the app's location origin ([#9709](https://github.com/remix-run/react-router/pull/9709))
22
+
23
+ ### Patch Changes
24
+
25
+ - Fix `generatePath` when optional params are present ([#9764](https://github.com/remix-run/react-router/pull/9764))
26
+ - Update `<Await>` to accept `ReactNode` as children function return result ([#9896](https://github.com/remix-run/react-router/pull/9896))
27
+ - Updated dependencies:
28
+ - `@remix-run/router@1.3.0`
29
+
30
+ ## 6.6.2
31
+
32
+ ### Patch Changes
33
+
34
+ - Ensure `useId` consistency during SSR ([#9805](https://github.com/remix-run/react-router/pull/9805))
35
+
36
+ ## 6.6.1
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies:
41
+ - `@remix-run/router@1.2.1`
42
+
43
+ ## 6.6.0
44
+
45
+ ### Patch Changes
46
+
47
+ - Prevent `useLoaderData` usage in `errorElement` ([#9735](https://github.com/remix-run/react-router/pull/9735))
48
+ - Updated dependencies:
49
+ - `@remix-run/router@1.2.0`
50
+
51
+ ## 6.5.0
52
+
53
+ This release introduces support for [Optional Route Segments](https://github.com/remix-run/react-router/issues/9546). Now, adding a `?` to the end of any path segment will make that entire segment optional. This works for both static segments and dynamic parameters.
54
+
55
+ **Optional Params Examples**
56
+
57
+ - `<Route path=":lang?/about>` will match:
58
+ - `/:lang/about`
59
+ - `/about`
60
+ - `<Route path="/multistep/:widget1?/widget2?/widget3?">` will match:
61
+ - `/multistep`
62
+ - `/multistep/:widget1`
63
+ - `/multistep/:widget1/:widget2`
64
+ - `/multistep/:widget1/:widget2/:widget3`
65
+
66
+ **Optional Static Segment Example**
67
+
68
+ - `<Route path="/home?">` will match:
69
+ - `/`
70
+ - `/home`
71
+ - `<Route path="/fr?/about">` will match:
72
+ - `/about`
73
+ - `/fr/about`
74
+
75
+ ### Minor Changes
76
+
77
+ - Allows optional routes and optional static segments ([#9650](https://github.com/remix-run/react-router/pull/9650))
78
+
79
+ ### Patch Changes
80
+
81
+ - Stop incorrectly matching on partial named parameters, i.e. `<Route path="prefix-:param">`, to align with how splat parameters work. If you were previously relying on this behavior then it's recommended to extract the static portion of the path at the `useParams` call site: ([#9506](https://github.com/remix-run/react-router/pull/9506))
82
+
83
+ ```jsx
84
+ // Old behavior at URL /prefix-123
85
+ <Route path="prefix-:id" element={<Comp /> }>
86
+
87
+ function Comp() {
88
+ let params = useParams(); // { id: '123' }
89
+ let id = params.id; // "123"
90
+ ...
91
+ }
92
+
93
+ // New behavior at URL /prefix-123
94
+ <Route path=":id" element={<Comp /> }>
95
+
96
+ function Comp() {
97
+ let params = useParams(); // { id: 'prefix-123' }
98
+ let id = params.id.replace(/^prefix-/, ''); // "123"
99
+ ...
100
+ }
101
+ ```
102
+
103
+ - Updated dependencies:
104
+ - `@remix-run/router@1.1.0`
105
+
106
+ ## 6.4.5
107
+
108
+ ### Patch Changes
109
+
110
+ - Updated dependencies:
111
+ - `@remix-run/router@1.0.5`
112
+
113
+ ## 6.4.4
114
+
115
+ ### Patch Changes
116
+
117
+ - Updated dependencies:
118
+ - `@remix-run/router@1.0.4`
119
+
120
+ ## 6.4.3
121
+
122
+ ### Patch Changes
123
+
124
+ - `useRoutes` should be able to return `null` when passing `locationArg` ([#9485](https://github.com/remix-run/react-router/pull/9485))
125
+ - fix `initialEntries` type in `createMemoryRouter` ([#9498](https://github.com/remix-run/react-router/pull/9498))
126
+ - Updated dependencies:
127
+ - `@remix-run/router@1.0.3`
128
+
129
+ ## 6.4.2
130
+
131
+ ### Patch Changes
132
+
133
+ - Fix `IndexRouteObject` and `NonIndexRouteObject` types to make `hasErrorElement` optional ([#9394](https://github.com/remix-run/react-router/pull/9394))
134
+ - Enhance console error messages for invalid usage of data router hooks ([#9311](https://github.com/remix-run/react-router/pull/9311))
135
+ - If an index route has children, it will result in a runtime error. We have strengthened our `RouteObject`/`RouteProps` types to surface the error in TypeScript. ([#9366](https://github.com/remix-run/react-router/pull/9366))
136
+ - Updated dependencies:
137
+ - `@remix-run/router@1.0.2`
138
+
139
+ ## 6.4.1
140
+
141
+ ### Patch Changes
142
+
143
+ - Preserve state from `initialEntries` ([#9288](https://github.com/remix-run/react-router/pull/9288))
144
+ - Updated dependencies:
145
+ - `@remix-run/router@1.0.1`
146
+
147
+ ## 6.4.0
148
+
149
+ Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs][rr-docs], especially the [feature overview][rr-feature-overview] and the [tutorial][rr-tutorial].
150
+
151
+ **New APIs**
152
+
153
+ - Create your router with `createMemoryRouter`
154
+ - Render your router with `<RouterProvider>`
155
+ - Load data with a Route `loader` and mutate with a Route `action`
156
+ - Handle errors with Route `errorElement`
157
+ - Defer non-critical data with `defer` and `Await`
158
+
159
+ **Bug Fixes**
160
+
161
+ - Path resolution is now trailing slash agnostic (#8861)
162
+ - `useLocation` returns the scoped location inside a `<Routes location>` component (#9094)
163
+
164
+ **Updated Dependencies**
165
+
166
+ - `@remix-run/router@1.0.0`
167
+
168
+ [rr-docs]: https://reactrouter.com
169
+ [rr-feature-overview]: https://reactrouter.com/start/overview
170
+ [rr-tutorial]: https://reactrouter.com/start/tutorial
package/LICENSE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  MIT License
2
2
 
3
3
  Copyright (c) React Training 2015-2019
4
- Copyright (c) Remix Software 2020-2021
4
+ Copyright (c) Remix Software 2020-2022
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,21 @@
1
+ import type { ActionFunction, ActionFunctionArgs, ActionFunctionWithMiddleware, ActionFunctionArgsWithMiddleware, Blocker, BlockerFunction, Fetcher, FutureConfig, HydrationState, JsonFunction, LoaderFunction, LoaderFunctionArgs, LoaderFunctionWithMiddleware, LoaderFunctionArgsWithMiddleware, Location, MiddlewareContext, MiddlewareFunction, MiddlewareFunctionArgs, Navigation, Params, ParamParseKey, Path, PathMatch, PathPattern, RedirectFunction, Router as RemixRouter, ShouldRevalidateFunction, To, InitialEntry } from "@remix-run/router";
2
+ import { AbortedDeferredError, Action as NavigationType, createMiddlewareContext, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, resolvePath } from "@remix-run/router";
3
+ import type { AwaitProps, MemoryRouterProps, NavigateProps, OutletProps, RouteProps, PathRouteProps, LayoutRouteProps, IndexRouteProps, RouterProps, RoutesProps, RouterProviderProps } from "./lib/components";
4
+ import { enhanceManualRouteObjects, createRoutesFromChildren, renderMatches, Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes } from "./lib/components";
5
+ import type { DataRouteMatch, DataRouteObject, IndexRouteObject, Navigator, NavigateOptions, NonIndexRouteObject, RouteMatch, RouteObject, RelativeRoutingType } from "./lib/context";
6
+ import { DataRouterContext, DataRouterStateContext, LocationContext, NavigationContext, RouteContext } from "./lib/context";
7
+ import type { NavigateFunction } from "./lib/hooks";
8
+ import { useBlocker, useHref, useInRouterContext, useLocation, useMatch, useNavigationType, useNavigate, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useActionData, useAsyncError, useAsyncValue, useLoaderData, useMatches, useNavigation, useRevalidator, useRouteError, useRouteLoaderData } from "./lib/hooks";
9
+ declare type Hash = string;
10
+ declare type Pathname = string;
11
+ declare type Search = string;
12
+ export type { ActionFunction, ActionFunctionArgs, ActionFunctionWithMiddleware, ActionFunctionArgsWithMiddleware, AwaitProps, Blocker as unstable_Blocker, BlockerFunction as unstable_BlockerFunction, DataRouteMatch, DataRouteObject, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, LoaderFunctionWithMiddleware, LoaderFunctionArgsWithMiddleware, Location, MemoryRouterProps, MiddlewareContext, MiddlewareFunction, MiddlewareFunctionArgs, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, To, };
13
+ export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createMiddlewareContext, createPath, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker as unstable_useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, };
14
+ export declare function createMemoryRouter(routes: RouteObject[], opts?: {
15
+ basename?: string;
16
+ hydrationData?: HydrationState;
17
+ initialEntries?: InitialEntry[];
18
+ initialIndex?: number;
19
+ }): RemixRouter;
20
+ /** @internal */
21
+ export { NavigationContext as UNSAFE_NavigationContext, LocationContext as UNSAFE_LocationContext, RouteContext as UNSAFE_RouteContext, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, enhanceManualRouteObjects as UNSAFE_enhanceManualRouteObjects, };