react-router 0.0.0-experimental-e56aa53bc → 0.0.0-experimental-e6fb6e074

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 (65) hide show
  1. package/CHANGELOG.md +18 -734
  2. package/README.md +14 -5
  3. package/dist/index.d.ts +30 -0
  4. package/dist/index.js +1501 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/components.d.ts +157 -0
  7. package/dist/lib/context.d.ts +102 -0
  8. package/dist/lib/deprecations.d.ts +4 -0
  9. package/dist/lib/hooks.d.ts +181 -0
  10. package/dist/main.js +19 -0
  11. package/dist/react-router.development.js +1397 -0
  12. package/dist/react-router.development.js.map +1 -0
  13. package/dist/react-router.production.min.js +12 -0
  14. package/dist/react-router.production.min.js.map +1 -0
  15. package/dist/umd/react-router.development.js +1624 -0
  16. package/dist/umd/react-router.development.js.map +1 -0
  17. package/dist/umd/react-router.production.min.js +12 -0
  18. package/dist/umd/react-router.production.min.js.map +1 -0
  19. package/package.json +9 -111
  20. package/dist/development/chunk-RMWJZNG5.mjs +0 -11505
  21. package/dist/development/data-CQbyyGzl.d.mts +0 -11
  22. package/dist/development/data-CQbyyGzl.d.ts +0 -11
  23. package/dist/development/dom-export.d.mts +0 -23
  24. package/dist/development/dom-export.d.ts +0 -23
  25. package/dist/development/dom-export.js +0 -6341
  26. package/dist/development/dom-export.mjs +0 -222
  27. package/dist/development/fog-of-war-C5L_Yd5M.d.mts +0 -1778
  28. package/dist/development/fog-of-war-DrUCUQQ-.d.ts +0 -1778
  29. package/dist/development/index.d.mts +0 -855
  30. package/dist/development/index.d.ts +0 -855
  31. package/dist/development/index.js +0 -11664
  32. package/dist/development/index.mjs +0 -263
  33. package/dist/development/lib/types/route-module.d.mts +0 -209
  34. package/dist/development/lib/types/route-module.d.ts +0 -209
  35. package/dist/development/lib/types/route-module.js +0 -28
  36. package/dist/development/lib/types/route-module.mjs +0 -10
  37. package/dist/development/route-data-BIYebJr3.d.mts +0 -1749
  38. package/dist/development/route-data-BIYebJr3.d.ts +0 -1749
  39. package/dist/development/rsc-export.d.mts +0 -1788
  40. package/dist/development/rsc-export.d.ts +0 -1788
  41. package/dist/development/rsc-export.js +0 -2778
  42. package/dist/development/rsc-export.mjs +0 -2743
  43. package/dist/production/chunk-BXBFRMFA.mjs +0 -11505
  44. package/dist/production/data-CQbyyGzl.d.mts +0 -11
  45. package/dist/production/data-CQbyyGzl.d.ts +0 -11
  46. package/dist/production/dom-export.d.mts +0 -23
  47. package/dist/production/dom-export.d.ts +0 -23
  48. package/dist/production/dom-export.js +0 -6341
  49. package/dist/production/dom-export.mjs +0 -222
  50. package/dist/production/fog-of-war-C5L_Yd5M.d.mts +0 -1778
  51. package/dist/production/fog-of-war-DrUCUQQ-.d.ts +0 -1778
  52. package/dist/production/index.d.mts +0 -855
  53. package/dist/production/index.d.ts +0 -855
  54. package/dist/production/index.js +0 -11664
  55. package/dist/production/index.mjs +0 -263
  56. package/dist/production/lib/types/route-module.d.mts +0 -209
  57. package/dist/production/lib/types/route-module.d.ts +0 -209
  58. package/dist/production/lib/types/route-module.js +0 -28
  59. package/dist/production/lib/types/route-module.mjs +0 -10
  60. package/dist/production/route-data-BIYebJr3.d.mts +0 -1749
  61. package/dist/production/route-data-BIYebJr3.d.ts +0 -1749
  62. package/dist/production/rsc-export.d.mts +0 -1788
  63. package/dist/production/rsc-export.d.ts +0 -1788
  64. package/dist/production/rsc-export.js +0 -2778
  65. package/dist/production/rsc-export.mjs +0 -2743
@@ -0,0 +1,181 @@
1
+ import * as React from "react";
2
+ import type { Blocker, BlockerFunction, Location, ParamParseKey, Params, Path, PathMatch, PathPattern, RelativeRoutingType, Router as RemixRouter, RevalidationState, To, UIMatch } from "@remix-run/router";
3
+ import { Action as NavigationType } from "@remix-run/router";
4
+ import type { NavigateOptions, RouteContextObject, RouteMatch, RouteObject } from "./context";
5
+ /**
6
+ * Returns the full href for the given "to" value. This is useful for building
7
+ * custom links that are also accessible and preserve right-click behavior.
8
+ *
9
+ * @see https://reactrouter.com/v6/hooks/use-href
10
+ */
11
+ export declare function useHref(to: To, { relative }?: {
12
+ relative?: RelativeRoutingType;
13
+ }): string;
14
+ /**
15
+ * Returns true if this component is a descendant of a `<Router>`.
16
+ *
17
+ * @see https://reactrouter.com/v6/hooks/use-in-router-context
18
+ */
19
+ export declare function useInRouterContext(): boolean;
20
+ /**
21
+ * Returns the current location object, which represents the current URL in web
22
+ * browsers.
23
+ *
24
+ * Note: If you're using this it may mean you're doing some of your own
25
+ * "routing" in your app, and we'd like to know what your use case is. We may
26
+ * be able to provide something higher-level to better suit your needs.
27
+ *
28
+ * @see https://reactrouter.com/v6/hooks/use-location
29
+ */
30
+ export declare function useLocation(): Location;
31
+ /**
32
+ * Returns the current navigation action which describes how the router came to
33
+ * the current location, either by a pop, push, or replace on the history stack.
34
+ *
35
+ * @see https://reactrouter.com/v6/hooks/use-navigation-type
36
+ */
37
+ export declare function useNavigationType(): NavigationType;
38
+ /**
39
+ * Returns a PathMatch object if the given pattern matches the current URL.
40
+ * This is useful for components that need to know "active" state, e.g.
41
+ * `<NavLink>`.
42
+ *
43
+ * @see https://reactrouter.com/v6/hooks/use-match
44
+ */
45
+ export declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null;
46
+ /**
47
+ * The interface for the navigate() function returned from useNavigate().
48
+ */
49
+ export interface NavigateFunction {
50
+ (to: To, options?: NavigateOptions): void;
51
+ (delta: number): void;
52
+ }
53
+ /**
54
+ * Returns an imperative method for changing the location. Used by `<Link>`s, but
55
+ * may also be used by other elements to change the location.
56
+ *
57
+ * @see https://reactrouter.com/v6/hooks/use-navigate
58
+ */
59
+ export declare function useNavigate(): NavigateFunction;
60
+ /**
61
+ * Returns the context (if provided) for the child route at this level of the route
62
+ * hierarchy.
63
+ * @see https://reactrouter.com/v6/hooks/use-outlet-context
64
+ */
65
+ export declare function useOutletContext<Context = unknown>(): Context;
66
+ /**
67
+ * Returns the element for the child route at this level of the route
68
+ * hierarchy. Used internally by `<Outlet>` to render child routes.
69
+ *
70
+ * @see https://reactrouter.com/v6/hooks/use-outlet
71
+ */
72
+ export declare function useOutlet(context?: unknown): React.ReactElement | null;
73
+ /**
74
+ * Returns an object of key/value pairs of the dynamic params from the current
75
+ * URL that were matched by the route path.
76
+ *
77
+ * @see https://reactrouter.com/v6/hooks/use-params
78
+ */
79
+ export declare function useParams<ParamsOrKey extends string | Record<string, string | undefined> = string>(): Readonly<[
80
+ ParamsOrKey
81
+ ] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>>;
82
+ /**
83
+ * Resolves the pathname of the given `to` value against the current location.
84
+ *
85
+ * @see https://reactrouter.com/v6/hooks/use-resolved-path
86
+ */
87
+ export declare function useResolvedPath(to: To, { relative }?: {
88
+ relative?: RelativeRoutingType;
89
+ }): Path;
90
+ /**
91
+ * Returns the element of the route that matched the current location, prepared
92
+ * with the correct context to render the remainder of the route tree. Route
93
+ * elements in the tree must render an `<Outlet>` to render their child route's
94
+ * element.
95
+ *
96
+ * @see https://reactrouter.com/v6/hooks/use-routes
97
+ */
98
+ export declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
99
+ export declare function useRoutesImpl(routes: RouteObject[], locationArg?: Partial<Location> | string, dataRouterState?: RemixRouter["state"], future?: RemixRouter["future"]): React.ReactElement | null;
100
+ type RenderErrorBoundaryProps = React.PropsWithChildren<{
101
+ location: Location;
102
+ revalidation: RevalidationState;
103
+ error: any;
104
+ component: React.ReactNode;
105
+ routeContext: RouteContextObject;
106
+ }>;
107
+ type RenderErrorBoundaryState = {
108
+ location: Location;
109
+ revalidation: RevalidationState;
110
+ error: any;
111
+ };
112
+ export declare class RenderErrorBoundary extends React.Component<RenderErrorBoundaryProps, RenderErrorBoundaryState> {
113
+ constructor(props: RenderErrorBoundaryProps);
114
+ static getDerivedStateFromError(error: any): {
115
+ error: any;
116
+ };
117
+ static getDerivedStateFromProps(props: RenderErrorBoundaryProps, state: RenderErrorBoundaryState): {
118
+ error: any;
119
+ location: Location<any>;
120
+ revalidation: RevalidationState;
121
+ };
122
+ componentDidCatch(error: any, errorInfo: any): void;
123
+ render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
124
+ }
125
+ export declare function _renderMatches(matches: RouteMatch[] | null, parentMatches?: RouteMatch[], dataRouterState?: RemixRouter["state"] | null, future?: RemixRouter["future"] | null): React.ReactElement | null;
126
+ /**
127
+ * Returns the ID for the nearest contextual route
128
+ */
129
+ export declare function useRouteId(): string;
130
+ /**
131
+ * Returns the current navigation, defaulting to an "idle" navigation when
132
+ * no navigation is in progress
133
+ */
134
+ export declare function useNavigation(): import("@remix-run/router").Navigation;
135
+ /**
136
+ * Returns a revalidate function for manually triggering revalidation, as well
137
+ * as the current state of any manual revalidations
138
+ */
139
+ export declare function useRevalidator(): {
140
+ revalidate: () => void;
141
+ state: RevalidationState;
142
+ };
143
+ /**
144
+ * Returns the active route matches, useful for accessing loaderData for
145
+ * parent/child routes or the route "handle" property
146
+ */
147
+ export declare function useMatches(): UIMatch[];
148
+ /**
149
+ * Returns the loader data for the nearest ancestor Route loader
150
+ */
151
+ export declare function useLoaderData(): unknown;
152
+ /**
153
+ * Returns the loaderData for the given routeId
154
+ */
155
+ export declare function useRouteLoaderData(routeId: string): unknown;
156
+ /**
157
+ * Returns the action data for the nearest ancestor Route action
158
+ */
159
+ export declare function useActionData(): unknown;
160
+ /**
161
+ * Returns the nearest ancestor Route error, which could be a loader/action
162
+ * error or a render error. This is intended to be called from your
163
+ * ErrorBoundary/errorElement to display a proper error message.
164
+ */
165
+ export declare function useRouteError(): unknown;
166
+ /**
167
+ * Returns the happy-path data from the nearest ancestor `<Await />` value
168
+ */
169
+ export declare function useAsyncValue(): unknown;
170
+ /**
171
+ * Returns the error from the nearest ancestor `<Await />` value
172
+ */
173
+ export declare function useAsyncError(): unknown;
174
+ /**
175
+ * Allow the application to block navigations within the SPA and present the
176
+ * user a confirmation dialog to confirm the navigation. Mostly used to avoid
177
+ * using half-filled form data. This does not handle hard-reloads or
178
+ * cross-origin navigations.
179
+ */
180
+ export declare function useBlocker(shouldBlock: boolean | BlockerFunction): Blocker;
181
+ export {};
package/dist/main.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * React Router v0.0.0-experimental-e6fb6e074
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.production.min.js");
17
+ } else {
18
+ module.exports = require("./umd/react-router.development.js");
19
+ }