ru.Bee 1.3.3 → 1.4.0

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 (180) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rubee +36 -4
  3. data/lib/app/views/app.tsx +27 -0
  4. data/lib/app/views/index.html +47 -0
  5. data/lib/app/views/layout.erb +3 -3
  6. data/lib/app/views/utils/redirectToBackend.tsx +9 -0
  7. data/lib/app/views/welcome_show.erb +1 -1
  8. data/lib/config/base_configuration.rb +9 -0
  9. data/lib/config/routes.rb +1 -0
  10. data/lib/esbuild.config.js +33 -0
  11. data/lib/js/app.js +13 -0
  12. data/lib/js/app.js.map +7 -0
  13. data/lib/js/bundle.js +26157 -0
  14. data/lib/js/bundle.js.map +7 -0
  15. data/lib/node_modules/@types/cookie/LICENSE +21 -0
  16. data/lib/node_modules/@types/cookie/README.md +15 -0
  17. data/lib/node_modules/@types/cookie/index.d.ts +154 -0
  18. data/lib/node_modules/@types/cookie/package.json +30 -0
  19. data/lib/node_modules/cookie/LICENSE +24 -0
  20. data/lib/node_modules/cookie/README.md +248 -0
  21. data/lib/node_modules/cookie/dist/index.d.ts +114 -0
  22. data/lib/node_modules/cookie/dist/index.js +239 -0
  23. data/lib/node_modules/cookie/dist/index.js.map +1 -0
  24. data/lib/node_modules/cookie/package.json +42 -0
  25. data/lib/node_modules/js-tokens/CHANGELOG.md +151 -0
  26. data/lib/node_modules/js-tokens/LICENSE +21 -0
  27. data/lib/node_modules/js-tokens/README.md +240 -0
  28. data/lib/node_modules/js-tokens/index.js +23 -0
  29. data/lib/node_modules/js-tokens/package.json +30 -0
  30. data/lib/node_modules/loose-envify/LICENSE +21 -0
  31. data/lib/node_modules/loose-envify/README.md +45 -0
  32. data/lib/node_modules/loose-envify/cli.js +16 -0
  33. data/lib/node_modules/loose-envify/custom.js +4 -0
  34. data/lib/node_modules/loose-envify/index.js +3 -0
  35. data/lib/node_modules/loose-envify/loose-envify.js +36 -0
  36. data/lib/node_modules/loose-envify/package.json +36 -0
  37. data/lib/node_modules/loose-envify/replace.js +65 -0
  38. data/lib/node_modules/react/LICENSE +21 -0
  39. data/lib/node_modules/react/README.md +37 -0
  40. data/lib/node_modules/react/cjs/react-jsx-dev-runtime.development.js +1315 -0
  41. data/lib/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +10 -0
  42. data/lib/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js +10 -0
  43. data/lib/node_modules/react/cjs/react-jsx-runtime.development.js +1333 -0
  44. data/lib/node_modules/react/cjs/react-jsx-runtime.production.min.js +11 -0
  45. data/lib/node_modules/react/cjs/react-jsx-runtime.profiling.min.js +11 -0
  46. data/lib/node_modules/react/cjs/react.development.js +2740 -0
  47. data/lib/node_modules/react/cjs/react.production.min.js +26 -0
  48. data/lib/node_modules/react/cjs/react.shared-subset.development.js +20 -0
  49. data/lib/node_modules/react/cjs/react.shared-subset.production.min.js +10 -0
  50. data/lib/node_modules/react/index.js +7 -0
  51. data/lib/node_modules/react/jsx-dev-runtime.js +7 -0
  52. data/lib/node_modules/react/jsx-runtime.js +7 -0
  53. data/lib/node_modules/react/package.json +47 -0
  54. data/lib/node_modules/react/react.shared-subset.js +7 -0
  55. data/lib/node_modules/react/umd/react.development.js +3343 -0
  56. data/lib/node_modules/react/umd/react.production.min.js +31 -0
  57. data/lib/node_modules/react/umd/react.profiling.min.js +31 -0
  58. data/lib/node_modules/react-dom/LICENSE +21 -0
  59. data/lib/node_modules/react-dom/README.md +60 -0
  60. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +7029 -0
  61. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +93 -0
  62. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js +7093 -0
  63. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js +101 -0
  64. data/lib/node_modules/react-dom/cjs/react-dom-server.browser.development.js +7014 -0
  65. data/lib/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +96 -0
  66. data/lib/node_modules/react-dom/cjs/react-dom-server.node.development.js +7070 -0
  67. data/lib/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +102 -0
  68. data/lib/node_modules/react-dom/cjs/react-dom-test-utils.development.js +1763 -0
  69. data/lib/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js +40 -0
  70. data/lib/node_modules/react-dom/cjs/react-dom.development.js +29923 -0
  71. data/lib/node_modules/react-dom/cjs/react-dom.production.min.js +322 -0
  72. data/lib/node_modules/react-dom/cjs/react-dom.profiling.min.js +366 -0
  73. data/lib/node_modules/react-dom/client.js +25 -0
  74. data/lib/node_modules/react-dom/index.js +38 -0
  75. data/lib/node_modules/react-dom/package.json +62 -0
  76. data/lib/node_modules/react-dom/profiling.js +38 -0
  77. data/lib/node_modules/react-dom/server.browser.js +17 -0
  78. data/lib/node_modules/react-dom/server.js +3 -0
  79. data/lib/node_modules/react-dom/server.node.js +17 -0
  80. data/lib/node_modules/react-dom/test-utils.js +7 -0
  81. data/lib/node_modules/react-dom/umd/react-dom-server-legacy.browser.development.js +7026 -0
  82. data/lib/node_modules/react-dom/umd/react-dom-server-legacy.browser.production.min.js +75 -0
  83. data/lib/node_modules/react-dom/umd/react-dom-server.browser.development.js +7011 -0
  84. data/lib/node_modules/react-dom/umd/react-dom-server.browser.production.min.js +76 -0
  85. data/lib/node_modules/react-dom/umd/react-dom-test-utils.development.js +1759 -0
  86. data/lib/node_modules/react-dom/umd/react-dom-test-utils.production.min.js +33 -0
  87. data/lib/node_modules/react-dom/umd/react-dom.development.js +29924 -0
  88. data/lib/node_modules/react-dom/umd/react-dom.production.min.js +267 -0
  89. data/lib/node_modules/react-dom/umd/react-dom.profiling.min.js +285 -0
  90. data/lib/node_modules/react-router/CHANGELOG.md +1526 -0
  91. data/lib/node_modules/react-router/LICENSE.md +23 -0
  92. data/lib/node_modules/react-router/README.md +7 -0
  93. data/lib/node_modules/react-router/dist/development/chunk-KNED5TY2.mjs +10476 -0
  94. data/lib/node_modules/react-router/dist/development/dom-export.d.mts +23 -0
  95. data/lib/node_modules/react-router/dist/development/dom-export.d.ts +23 -0
  96. data/lib/node_modules/react-router/dist/development/dom-export.js +6111 -0
  97. data/lib/node_modules/react-router/dist/development/dom-export.mjs +234 -0
  98. data/lib/node_modules/react-router/dist/development/fog-of-war-1hWhK5ey.d.mts +1690 -0
  99. data/lib/node_modules/react-router/dist/development/fog-of-war-oa9CGk10.d.ts +1690 -0
  100. data/lib/node_modules/react-router/dist/development/future-ldDp5FKH.d.mts +21 -0
  101. data/lib/node_modules/react-router/dist/development/future-ldDp5FKH.d.ts +21 -0
  102. data/lib/node_modules/react-router/dist/development/index.d.mts +841 -0
  103. data/lib/node_modules/react-router/dist/development/index.d.ts +841 -0
  104. data/lib/node_modules/react-router/dist/development/index.js +10624 -0
  105. data/lib/node_modules/react-router/dist/development/index.mjs +242 -0
  106. data/lib/node_modules/react-router/dist/development/lib/types/route-module.d.mts +209 -0
  107. data/lib/node_modules/react-router/dist/development/lib/types/route-module.d.ts +209 -0
  108. data/lib/node_modules/react-router/dist/development/lib/types/route-module.js +28 -0
  109. data/lib/node_modules/react-router/dist/development/lib/types/route-module.mjs +10 -0
  110. data/lib/node_modules/react-router/dist/development/route-data-5OzAzQtT.d.mts +1716 -0
  111. data/lib/node_modules/react-router/dist/development/route-data-5OzAzQtT.d.ts +1716 -0
  112. data/lib/node_modules/react-router/dist/production/chunk-ZIM7OIE3.mjs +10476 -0
  113. data/lib/node_modules/react-router/dist/production/dom-export.d.mts +23 -0
  114. data/lib/node_modules/react-router/dist/production/dom-export.d.ts +23 -0
  115. data/lib/node_modules/react-router/dist/production/dom-export.js +6111 -0
  116. data/lib/node_modules/react-router/dist/production/dom-export.mjs +234 -0
  117. data/lib/node_modules/react-router/dist/production/fog-of-war-1hWhK5ey.d.mts +1690 -0
  118. data/lib/node_modules/react-router/dist/production/fog-of-war-oa9CGk10.d.ts +1690 -0
  119. data/lib/node_modules/react-router/dist/production/future-ldDp5FKH.d.mts +21 -0
  120. data/lib/node_modules/react-router/dist/production/future-ldDp5FKH.d.ts +21 -0
  121. data/lib/node_modules/react-router/dist/production/index.d.mts +841 -0
  122. data/lib/node_modules/react-router/dist/production/index.d.ts +841 -0
  123. data/lib/node_modules/react-router/dist/production/index.js +10624 -0
  124. data/lib/node_modules/react-router/dist/production/index.mjs +242 -0
  125. data/lib/node_modules/react-router/dist/production/lib/types/route-module.d.mts +209 -0
  126. data/lib/node_modules/react-router/dist/production/lib/types/route-module.d.ts +209 -0
  127. data/lib/node_modules/react-router/dist/production/lib/types/route-module.js +28 -0
  128. data/lib/node_modules/react-router/dist/production/lib/types/route-module.mjs +10 -0
  129. data/lib/node_modules/react-router/dist/production/route-data-5OzAzQtT.d.mts +1716 -0
  130. data/lib/node_modules/react-router/dist/production/route-data-5OzAzQtT.d.ts +1716 -0
  131. data/lib/node_modules/react-router/package.json +116 -0
  132. data/lib/node_modules/react-router-dom/LICENSE.md +23 -0
  133. data/lib/node_modules/react-router-dom/README.md +6 -0
  134. data/lib/node_modules/react-router-dom/dist/index.d.mts +2 -0
  135. data/lib/node_modules/react-router-dom/dist/index.d.ts +2 -0
  136. data/lib/node_modules/react-router-dom/dist/index.js +45 -0
  137. data/lib/node_modules/react-router-dom/dist/index.mjs +18 -0
  138. data/lib/node_modules/react-router-dom/package.json +82 -0
  139. data/lib/node_modules/scheduler/LICENSE +21 -0
  140. data/lib/node_modules/scheduler/README.md +9 -0
  141. data/lib/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +700 -0
  142. data/lib/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +20 -0
  143. data/lib/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js +207 -0
  144. data/lib/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.min.js +14 -0
  145. data/lib/node_modules/scheduler/cjs/scheduler.development.js +634 -0
  146. data/lib/node_modules/scheduler/cjs/scheduler.production.min.js +19 -0
  147. data/lib/node_modules/scheduler/index.js +7 -0
  148. data/lib/node_modules/scheduler/package.json +36 -0
  149. data/lib/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +699 -0
  150. data/lib/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +19 -0
  151. data/lib/node_modules/scheduler/umd/scheduler.development.js +152 -0
  152. data/lib/node_modules/scheduler/umd/scheduler.production.min.js +146 -0
  153. data/lib/node_modules/scheduler/umd/scheduler.profiling.min.js +146 -0
  154. data/lib/node_modules/scheduler/unstable_mock.js +7 -0
  155. data/lib/node_modules/scheduler/unstable_post_task.js +7 -0
  156. data/lib/node_modules/set-cookie-parser/LICENSE +21 -0
  157. data/lib/node_modules/set-cookie-parser/README.md +202 -0
  158. data/lib/node_modules/set-cookie-parser/lib/set-cookie.js +224 -0
  159. data/lib/node_modules/set-cookie-parser/package.json +45 -0
  160. data/lib/node_modules/turbo-stream/LICENSE +7 -0
  161. data/lib/node_modules/turbo-stream/README.md +31 -0
  162. data/lib/node_modules/turbo-stream/dist/flatten.d.ts +2 -0
  163. data/lib/node_modules/turbo-stream/dist/flatten.js +203 -0
  164. data/lib/node_modules/turbo-stream/dist/turbo-stream.d.ts +13 -0
  165. data/lib/node_modules/turbo-stream/dist/turbo-stream.js +207 -0
  166. data/lib/node_modules/turbo-stream/dist/turbo-stream.mjs +673 -0
  167. data/lib/node_modules/turbo-stream/dist/unflatten.d.ts +2 -0
  168. data/lib/node_modules/turbo-stream/dist/unflatten.js +243 -0
  169. data/lib/node_modules/turbo-stream/dist/utils.d.ts +44 -0
  170. data/lib/node_modules/turbo-stream/dist/utils.js +55 -0
  171. data/lib/node_modules/turbo-stream/package.json +50 -0
  172. data/lib/package-lock.json +133 -0
  173. data/lib/package.json +12 -0
  174. data/lib/rubee/controllers/base_controller.rb +14 -0
  175. data/lib/rubee.rb +58 -19
  176. data/lib/tests/rubeeapp_test.rb +17 -0
  177. data/lib/tests/test.db +0 -0
  178. data/lib/tests/user_model_test.rb +1 -0
  179. data/readme.md +104 -2
  180. metadata +170 -3
@@ -0,0 +1,1716 @@
1
+ import * as React from 'react';
2
+ import { ComponentType, ReactElement } from 'react';
3
+
4
+ /**
5
+ * Actions represent the type of change to a location value.
6
+ */
7
+ declare enum Action {
8
+ /**
9
+ * A POP indicates a change to an arbitrary index in the history stack, such
10
+ * as a back or forward navigation. It does not describe the direction of the
11
+ * navigation, only that the current index changed.
12
+ *
13
+ * Note: This is the default action for newly created history objects.
14
+ */
15
+ Pop = "POP",
16
+ /**
17
+ * A PUSH indicates a new entry being added to the history stack, such as when
18
+ * a link is clicked and a new page loads. When this happens, all subsequent
19
+ * entries in the stack are lost.
20
+ */
21
+ Push = "PUSH",
22
+ /**
23
+ * A REPLACE indicates the entry at the current index in the history stack
24
+ * being replaced by a new one.
25
+ */
26
+ Replace = "REPLACE"
27
+ }
28
+ /**
29
+ * The pathname, search, and hash values of a URL.
30
+ */
31
+ interface Path {
32
+ /**
33
+ * A URL pathname, beginning with a /.
34
+ */
35
+ pathname: string;
36
+ /**
37
+ * A URL search string, beginning with a ?.
38
+ */
39
+ search: string;
40
+ /**
41
+ * A URL fragment identifier, beginning with a #.
42
+ */
43
+ hash: string;
44
+ }
45
+ /**
46
+ * An entry in a history stack. A location contains information about the
47
+ * URL path, as well as possibly some arbitrary state and a key.
48
+ */
49
+ interface Location<State = any> extends Path {
50
+ /**
51
+ * A value of arbitrary data associated with this location.
52
+ */
53
+ state: State;
54
+ /**
55
+ * A unique string associated with this location. May be used to safely store
56
+ * and retrieve data in some other storage API, like `localStorage`.
57
+ *
58
+ * Note: This value is always "default" on the initial location.
59
+ */
60
+ key: string;
61
+ }
62
+ /**
63
+ * A change to the current location.
64
+ */
65
+ interface Update {
66
+ /**
67
+ * The action that triggered the change.
68
+ */
69
+ action: Action;
70
+ /**
71
+ * The new location.
72
+ */
73
+ location: Location;
74
+ /**
75
+ * The delta between this location and the former location in the history stack
76
+ */
77
+ delta: number | null;
78
+ }
79
+ /**
80
+ * A function that receives notifications about location changes.
81
+ */
82
+ interface Listener {
83
+ (update: Update): void;
84
+ }
85
+ /**
86
+ * Describes a location that is the destination of some navigation used in
87
+ * {@link Link}, {@link useNavigate}, etc.
88
+ */
89
+ type To = string | Partial<Path>;
90
+ /**
91
+ * A history is an interface to the navigation stack. The history serves as the
92
+ * source of truth for the current location, as well as provides a set of
93
+ * methods that may be used to change it.
94
+ *
95
+ * It is similar to the DOM's `window.history` object, but with a smaller, more
96
+ * focused API.
97
+ */
98
+ interface History {
99
+ /**
100
+ * The last action that modified the current location. This will always be
101
+ * Action.Pop when a history instance is first created. This value is mutable.
102
+ */
103
+ readonly action: Action;
104
+ /**
105
+ * The current location. This value is mutable.
106
+ */
107
+ readonly location: Location;
108
+ /**
109
+ * Returns a valid href for the given `to` value that may be used as
110
+ * the value of an <a href> attribute.
111
+ *
112
+ * @param to - The destination URL
113
+ */
114
+ createHref(to: To): string;
115
+ /**
116
+ * Returns a URL for the given `to` value
117
+ *
118
+ * @param to - The destination URL
119
+ */
120
+ createURL(to: To): URL;
121
+ /**
122
+ * Encode a location the same way window.history would do (no-op for memory
123
+ * history) so we ensure our PUSH/REPLACE navigations for data routers
124
+ * behave the same as POP
125
+ *
126
+ * @param to Unencoded path
127
+ */
128
+ encodeLocation(to: To): Path;
129
+ /**
130
+ * Pushes a new location onto the history stack, increasing its length by one.
131
+ * If there were any entries in the stack after the current one, they are
132
+ * lost.
133
+ *
134
+ * @param to - The new URL
135
+ * @param state - Data to associate with the new location
136
+ */
137
+ push(to: To, state?: any): void;
138
+ /**
139
+ * Replaces the current location in the history stack with a new one. The
140
+ * location that was replaced will no longer be available.
141
+ *
142
+ * @param to - The new URL
143
+ * @param state - Data to associate with the new location
144
+ */
145
+ replace(to: To, state?: any): void;
146
+ /**
147
+ * Navigates `n` entries backward/forward in the history stack relative to the
148
+ * current index. For example, a "back" navigation would use go(-1).
149
+ *
150
+ * @param delta - The delta in the stack index
151
+ */
152
+ go(delta: number): void;
153
+ /**
154
+ * Sets up a listener that will be called whenever the current location
155
+ * changes.
156
+ *
157
+ * @param listener - A function that will be called when the location changes
158
+ * @returns unlisten - A function that may be used to stop listening
159
+ */
160
+ listen(listener: Listener): () => void;
161
+ }
162
+ /**
163
+ * A user-supplied object that describes a location. Used when providing
164
+ * entries to `createMemoryHistory` via its `initialEntries` option.
165
+ */
166
+ type InitialEntry = string | Partial<Location>;
167
+ /**
168
+ * A browser history stores the current location in regular URLs in a web
169
+ * browser environment. This is the standard for most web apps and provides the
170
+ * cleanest URLs the browser's address bar.
171
+ *
172
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#browserhistory
173
+ */
174
+ interface BrowserHistory extends UrlHistory {
175
+ }
176
+ type BrowserHistoryOptions = UrlHistoryOptions;
177
+ /**
178
+ * Browser history stores the location in regular URLs. This is the standard for
179
+ * most web apps, but it requires some configuration on the server to ensure you
180
+ * serve the same app at multiple URLs.
181
+ *
182
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
183
+ */
184
+ declare function createBrowserHistory(options?: BrowserHistoryOptions): BrowserHistory;
185
+ /**
186
+ * @private
187
+ */
188
+ declare function invariant(value: boolean, message?: string): asserts value;
189
+ declare function invariant<T>(value: T | null | undefined, message?: string): asserts value is T;
190
+ /**
191
+ * Creates a string URL path from the given pathname, search, and hash components.
192
+ *
193
+ * @category Utils
194
+ */
195
+ declare function createPath({ pathname, search, hash, }: Partial<Path>): string;
196
+ /**
197
+ * Parses a string URL path into its separate pathname, search, and hash components.
198
+ *
199
+ * @category Utils
200
+ */
201
+ declare function parsePath(path: string): Partial<Path>;
202
+ interface UrlHistory extends History {
203
+ }
204
+ type UrlHistoryOptions = {
205
+ window?: Window;
206
+ v5Compat?: boolean;
207
+ };
208
+
209
+ type MaybePromise<T> = T | Promise<T>;
210
+ /**
211
+ * Map of routeId -> data returned from a loader/action/error
212
+ */
213
+ interface RouteData {
214
+ [routeId: string]: any;
215
+ }
216
+ type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";
217
+ type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;
218
+ /**
219
+ * Users can specify either lowercase or uppercase form methods on `<Form>`,
220
+ * useSubmit(), `<fetcher.Form>`, etc.
221
+ */
222
+ type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod;
223
+ /**
224
+ * Active navigation/fetcher form methods are exposed in uppercase on the
225
+ * RouterState. This is to align with the normalization done via fetch().
226
+ */
227
+ type FormMethod = UpperCaseFormMethod;
228
+ type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "application/json" | "text/plain";
229
+ type JsonObject = {
230
+ [Key in string]: JsonValue;
231
+ } & {
232
+ [Key in string]?: JsonValue | undefined;
233
+ };
234
+ type JsonArray = JsonValue[] | readonly JsonValue[];
235
+ type JsonPrimitive = string | number | boolean | null;
236
+ type JsonValue = JsonPrimitive | JsonObject | JsonArray;
237
+ /**
238
+ * @private
239
+ * Internal interface to pass around for action submissions, not intended for
240
+ * external consumption
241
+ */
242
+ type Submission = {
243
+ formMethod: FormMethod;
244
+ formAction: string;
245
+ formEncType: FormEncType;
246
+ formData: FormData;
247
+ json: undefined;
248
+ text: undefined;
249
+ } | {
250
+ formMethod: FormMethod;
251
+ formAction: string;
252
+ formEncType: FormEncType;
253
+ formData: undefined;
254
+ json: JsonValue;
255
+ text: undefined;
256
+ } | {
257
+ formMethod: FormMethod;
258
+ formAction: string;
259
+ formEncType: FormEncType;
260
+ formData: undefined;
261
+ json: undefined;
262
+ text: string;
263
+ };
264
+ interface unstable_RouterContext<T = unknown> {
265
+ defaultValue?: T;
266
+ }
267
+ /**
268
+ * Creates a context object that may be used to store and retrieve arbitrary values.
269
+ *
270
+ * If a `defaultValue` is provided, it will be returned from `context.get()` when no value has been
271
+ * set for the context. Otherwise reading this context when no value has been set will throw an
272
+ * error.
273
+ *
274
+ * @param defaultValue The default value for the context
275
+ * @returns A context object
276
+ */
277
+ declare function unstable_createContext<T>(defaultValue?: T): unstable_RouterContext<T>;
278
+ /**
279
+ * A Map of RouterContext objects to their initial values - used to populate a
280
+ * fresh `context` value per request/navigation/fetch
281
+ */
282
+ type unstable_InitialContext = Map<unstable_RouterContext, unknown>;
283
+ /**
284
+ * Provides methods for writing/reading values in application context in a typesafe way.
285
+ */
286
+ declare class unstable_RouterContextProvider {
287
+ #private;
288
+ constructor(init?: unstable_InitialContext);
289
+ get<T>(context: unstable_RouterContext<T>): T;
290
+ set<C extends unstable_RouterContext>(context: C, value: C extends unstable_RouterContext<infer T> ? T : never): void;
291
+ }
292
+ /**
293
+ * @private
294
+ * Arguments passed to route loader/action functions. Same for now but we keep
295
+ * this as a private implementation detail in case they diverge in the future.
296
+ */
297
+ interface DataFunctionArgs<Context> {
298
+ /** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
299
+ request: Request;
300
+ /**
301
+ * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
302
+ * @example
303
+ * // app/routes.ts
304
+ * route("teams/:teamId", "./team.tsx"),
305
+ *
306
+ * // app/team.tsx
307
+ * export function loader({
308
+ * params,
309
+ * }: Route.LoaderArgs) {
310
+ * params.teamId;
311
+ * // ^ string
312
+ * }
313
+ **/
314
+ params: Params;
315
+ /**
316
+ * This is the context passed in to your server adapter's getLoadContext() function.
317
+ * It's a way to bridge the gap between the adapter's request/response API with your React Router app.
318
+ * It is only applicable if you are using a custom server adapter.
319
+ */
320
+ context: Context;
321
+ }
322
+ /**
323
+ * Route middleware `next` function to call downstream handlers and then complete
324
+ * middlewares from the bottom-up
325
+ */
326
+ interface unstable_MiddlewareNextFunction<Result = unknown> {
327
+ (): MaybePromise<Result>;
328
+ }
329
+ /**
330
+ * Route middleware function signature. Receives the same "data" arguments as a
331
+ * `loader`/`action` (`request`, `params`, `context`) as the first parameter and
332
+ * a `next` function as the second parameter which will call downstream handlers
333
+ * and then complete middlewares from the bottom-up
334
+ */
335
+ type unstable_MiddlewareFunction<Result = unknown> = (args: DataFunctionArgs<unstable_RouterContextProvider>, next: unstable_MiddlewareNextFunction<Result>) => MaybePromise<Result | void>;
336
+ /**
337
+ * Arguments passed to loader functions
338
+ */
339
+ interface LoaderFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
340
+ }
341
+ /**
342
+ * Arguments passed to action functions
343
+ */
344
+ interface ActionFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
345
+ }
346
+ /**
347
+ * Loaders and actions can return anything
348
+ */
349
+ type DataFunctionValue = unknown;
350
+ type DataFunctionReturnValue = MaybePromise<DataFunctionValue>;
351
+ /**
352
+ * Route loader function signature
353
+ */
354
+ type LoaderFunction<Context = any> = {
355
+ (args: LoaderFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
356
+ } & {
357
+ hydrate?: boolean;
358
+ };
359
+ /**
360
+ * Route action function signature
361
+ */
362
+ interface ActionFunction<Context = any> {
363
+ (args: ActionFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
364
+ }
365
+ /**
366
+ * Arguments passed to shouldRevalidate function
367
+ */
368
+ interface ShouldRevalidateFunctionArgs {
369
+ /** This is the url the navigation started from. You can compare it with `nextUrl` to decide if you need to revalidate this route's data. */
370
+ currentUrl: URL;
371
+ /** These are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the URL that can be compared to the `nextParams` to decide if you need to reload or not. Perhaps you're using only a partial piece of the param for data loading, you don't need to revalidate if a superfluous part of the param changed. */
372
+ currentParams: AgnosticDataRouteMatch["params"];
373
+ /** In the case of navigation, this the URL the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentUrl. */
374
+ nextUrl: URL;
375
+ /** In the case of navigation, these are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the next location the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentParams. */
376
+ nextParams: AgnosticDataRouteMatch["params"];
377
+ /** The method (probably `"GET"` or `"POST"`) used in the form submission that triggered the revalidation. */
378
+ formMethod?: Submission["formMethod"];
379
+ /** The form action (`<Form action="/somewhere">`) that triggered the revalidation. */
380
+ formAction?: Submission["formAction"];
381
+ /** The form encType (`<Form encType="application/x-www-form-urlencoded">) used in the form submission that triggered the revalidation*/
382
+ formEncType?: Submission["formEncType"];
383
+ /** The form submission data when the form's encType is `text/plain` */
384
+ text?: Submission["text"];
385
+ /** The form submission data when the form's encType is `application/x-www-form-urlencoded` or `multipart/form-data` */
386
+ formData?: Submission["formData"];
387
+ /** The form submission data when the form's encType is `application/json` */
388
+ json?: Submission["json"];
389
+ /** The status code of the action response */
390
+ actionStatus?: number;
391
+ /**
392
+ * When a submission causes the revalidation this will be the result of the action—either action data or an error if the action failed. It's common to include some information in the action result to instruct shouldRevalidate to revalidate or not.
393
+ *
394
+ * @example
395
+ * export async function action() {
396
+ * await saveSomeStuff();
397
+ * return { ok: true };
398
+ * }
399
+ *
400
+ * export function shouldRevalidate({
401
+ * actionResult,
402
+ * }) {
403
+ * if (actionResult?.ok) {
404
+ * return false;
405
+ * }
406
+ * return true;
407
+ * }
408
+ */
409
+ actionResult?: any;
410
+ /**
411
+ * By default, React Router doesn't call every loader all the time. There are reliable optimizations it can make by default. For example, only loaders with changing params are called. Consider navigating from the following URL to the one below it:
412
+ *
413
+ * /projects/123/tasks/abc
414
+ * /projects/123/tasks/def
415
+ * React Router will only call the loader for tasks/def because the param for projects/123 didn't change.
416
+ *
417
+ * It's safest to always return defaultShouldRevalidate after you've done your specific optimizations that return false, otherwise your UI might get out of sync with your data on the server.
418
+ */
419
+ defaultShouldRevalidate: boolean;
420
+ }
421
+ /**
422
+ * Route shouldRevalidate function signature. This runs after any submission
423
+ * (navigation or fetcher), so we flatten the navigation/fetcher submission
424
+ * onto the arguments. It shouldn't matter whether it came from a navigation
425
+ * or a fetcher, what really matters is the URLs and the formData since loaders
426
+ * have to re-run based on the data models that were potentially mutated.
427
+ */
428
+ interface ShouldRevalidateFunction {
429
+ (args: ShouldRevalidateFunctionArgs): boolean;
430
+ }
431
+ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
432
+ shouldLoad: boolean;
433
+ resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
434
+ }
435
+ interface DataStrategyFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
436
+ matches: DataStrategyMatch[];
437
+ fetcherKey: string | null;
438
+ }
439
+ /**
440
+ * Result from a loader or action called via dataStrategy
441
+ */
442
+ interface DataStrategyResult {
443
+ type: "data" | "error";
444
+ result: unknown;
445
+ }
446
+ interface DataStrategyFunction<Context = any> {
447
+ (args: DataStrategyFunctionArgs<Context>): Promise<Record<string, DataStrategyResult>>;
448
+ }
449
+ type AgnosticPatchRoutesOnNavigationFunctionArgs<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = {
450
+ signal: AbortSignal;
451
+ path: string;
452
+ matches: M[];
453
+ fetcherKey: string | undefined;
454
+ patch: (routeId: string | null, children: O[]) => void;
455
+ };
456
+ type AgnosticPatchRoutesOnNavigationFunction<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = (opts: AgnosticPatchRoutesOnNavigationFunctionArgs<O, M>) => MaybePromise<void>;
457
+ /**
458
+ * Function provided by the framework-aware layers to set any framework-specific
459
+ * properties from framework-agnostic properties
460
+ */
461
+ interface MapRoutePropertiesFunction {
462
+ (route: AgnosticRouteObject): {
463
+ hasErrorBoundary: boolean;
464
+ } & Record<string, any>;
465
+ }
466
+ /**
467
+ * Keys we cannot change from within a lazy object. We spread all other keys
468
+ * onto the route. Either they're meaningful to the router, or they'll get
469
+ * ignored.
470
+ */
471
+ type UnsupportedLazyRouteObjectKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children";
472
+ /**
473
+ * Keys we cannot change from within a lazy() function. We spread all other keys
474
+ * onto the route. Either they're meaningful to the router, or they'll get
475
+ * ignored.
476
+ */
477
+ type UnsupportedLazyRouteFunctionKey = UnsupportedLazyRouteObjectKey | "unstable_middleware";
478
+ /**
479
+ * lazy object to load route properties, which can add non-matching
480
+ * related properties to a route
481
+ */
482
+ type LazyRouteObject<R extends AgnosticRouteObject> = {
483
+ [K in keyof R as K extends UnsupportedLazyRouteObjectKey ? never : K]?: () => Promise<R[K] | null | undefined>;
484
+ };
485
+ /**
486
+ * lazy() function to load a route definition, which can add non-matching
487
+ * related properties to a route
488
+ */
489
+ interface LazyRouteFunction<R extends AgnosticRouteObject> {
490
+ (): Promise<Omit<R, UnsupportedLazyRouteFunctionKey> & Partial<Record<UnsupportedLazyRouteFunctionKey, never>>>;
491
+ }
492
+ type LazyRouteDefinition<R extends AgnosticRouteObject> = LazyRouteObject<R> | LazyRouteFunction<R>;
493
+ /**
494
+ * Base RouteObject with common props shared by all types of routes
495
+ */
496
+ type AgnosticBaseRouteObject = {
497
+ caseSensitive?: boolean;
498
+ path?: string;
499
+ id?: string;
500
+ unstable_middleware?: unstable_MiddlewareFunction[];
501
+ loader?: LoaderFunction | boolean;
502
+ action?: ActionFunction | boolean;
503
+ hasErrorBoundary?: boolean;
504
+ shouldRevalidate?: ShouldRevalidateFunction;
505
+ handle?: any;
506
+ lazy?: LazyRouteDefinition<AgnosticBaseRouteObject>;
507
+ };
508
+ /**
509
+ * Index routes must not have children
510
+ */
511
+ type AgnosticIndexRouteObject = AgnosticBaseRouteObject & {
512
+ children?: undefined;
513
+ index: true;
514
+ };
515
+ /**
516
+ * Non-index routes may have children, but cannot have index
517
+ */
518
+ type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & {
519
+ children?: AgnosticRouteObject[];
520
+ index?: false;
521
+ };
522
+ /**
523
+ * A route object represents a logical route, with (optionally) its child
524
+ * routes organized in a tree-like structure.
525
+ */
526
+ type AgnosticRouteObject = AgnosticIndexRouteObject | AgnosticNonIndexRouteObject;
527
+ type AgnosticDataIndexRouteObject = AgnosticIndexRouteObject & {
528
+ id: string;
529
+ };
530
+ type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {
531
+ children?: AgnosticDataRouteObject[];
532
+ id: string;
533
+ };
534
+ /**
535
+ * A data route object, which is just a RouteObject with a required unique ID
536
+ */
537
+ type AgnosticDataRouteObject = AgnosticDataIndexRouteObject | AgnosticDataNonIndexRouteObject;
538
+ type RouteManifest<R = AgnosticDataRouteObject> = Record<string, R | undefined>;
539
+ type Regex_az = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
540
+ type Regez_AZ = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z";
541
+ type Regex_09 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
542
+ type Regex_w = Regex_az | Regez_AZ | Regex_09 | "_";
543
+ type ParamChar = Regex_w | "-";
544
+ type RegexMatchPlus<CharPattern extends string, T extends string> = T extends `${infer First}${infer Rest}` ? First extends CharPattern ? RegexMatchPlus<CharPattern, Rest> extends never ? First : `${First}${RegexMatchPlus<CharPattern, Rest>}` : never : never;
545
+ type _PathParam<Path extends string> = Path extends `${infer L}/${infer R}` ? _PathParam<L> | _PathParam<R> : Path extends `:${infer Param}` ? Param extends `${infer Optional}?${string}` ? RegexMatchPlus<ParamChar, Optional> : RegexMatchPlus<ParamChar, Param> : never;
546
+ type PathParam<Path extends string> = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _PathParam<Rest> : _PathParam<Path>;
547
+ type ParamParseKey<Segment extends string> = [
548
+ PathParam<Segment>
549
+ ] extends [never] ? string : PathParam<Segment>;
550
+ /**
551
+ * The parameters that were parsed from the URL path.
552
+ */
553
+ type Params<Key extends string = string> = {
554
+ readonly [key in Key]: string | undefined;
555
+ };
556
+ /**
557
+ * A RouteMatch contains info about how a route matched a URL.
558
+ */
559
+ interface AgnosticRouteMatch<ParamKey extends string = string, RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject> {
560
+ /**
561
+ * The names and values of dynamic parameters in the URL.
562
+ */
563
+ params: Params<ParamKey>;
564
+ /**
565
+ * The portion of the URL pathname that was matched.
566
+ */
567
+ pathname: string;
568
+ /**
569
+ * The portion of the URL pathname that was matched before child routes.
570
+ */
571
+ pathnameBase: string;
572
+ /**
573
+ * The route object that was used to match.
574
+ */
575
+ route: RouteObjectType;
576
+ }
577
+ interface AgnosticDataRouteMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
578
+ }
579
+ /**
580
+ * Matches the given routes to a location and returns the match data.
581
+ *
582
+ * @category Utils
583
+ */
584
+ declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): AgnosticRouteMatch<string, RouteObjectType>[] | null;
585
+ interface UIMatch<Data = unknown, Handle = unknown> {
586
+ id: string;
587
+ pathname: string;
588
+ /**
589
+ * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
590
+ **/
591
+ params: AgnosticRouteMatch["params"];
592
+ /** The return value from the matched route's loader or clientLoader */
593
+ data: Data;
594
+ /** The {@link https://reactrouter.com/start/framework/route-module#handle handle object} exported from the matched route module */
595
+ handle: Handle;
596
+ }
597
+ /**
598
+ * Returns a path with params interpolated.
599
+ *
600
+ * @category Utils
601
+ */
602
+ declare function generatePath<Path extends string>(originalPath: Path, params?: {
603
+ [key in PathParam<Path>]: string | null;
604
+ }): string;
605
+ /**
606
+ * A PathPattern is used to match on some portion of a URL pathname.
607
+ */
608
+ interface PathPattern<Path extends string = string> {
609
+ /**
610
+ * A string to match against a URL pathname. May contain `:id`-style segments
611
+ * to indicate placeholders for dynamic parameters. May also end with `/*` to
612
+ * indicate matching the rest of the URL pathname.
613
+ */
614
+ path: Path;
615
+ /**
616
+ * Should be `true` if the static portions of the `path` should be matched in
617
+ * the same case.
618
+ */
619
+ caseSensitive?: boolean;
620
+ /**
621
+ * Should be `true` if this pattern should match the entire URL pathname.
622
+ */
623
+ end?: boolean;
624
+ }
625
+ /**
626
+ * A PathMatch contains info about how a PathPattern matched on a URL pathname.
627
+ */
628
+ interface PathMatch<ParamKey extends string = string> {
629
+ /**
630
+ * The names and values of dynamic parameters in the URL.
631
+ */
632
+ params: Params<ParamKey>;
633
+ /**
634
+ * The portion of the URL pathname that was matched.
635
+ */
636
+ pathname: string;
637
+ /**
638
+ * The portion of the URL pathname that was matched before child routes.
639
+ */
640
+ pathnameBase: string;
641
+ /**
642
+ * The pattern that was used to match.
643
+ */
644
+ pattern: PathPattern;
645
+ }
646
+ /**
647
+ * Performs pattern matching on a URL pathname and returns information about
648
+ * the match.
649
+ *
650
+ * @category Utils
651
+ */
652
+ declare function matchPath<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamKey> | null;
653
+ /**
654
+ * Returns a resolved path object relative to the given pathname.
655
+ *
656
+ * @category Utils
657
+ */
658
+ declare function resolvePath(to: To, fromPathname?: string): Path;
659
+ declare class DataWithResponseInit<D> {
660
+ type: string;
661
+ data: D;
662
+ init: ResponseInit | null;
663
+ constructor(data: D, init?: ResponseInit);
664
+ }
665
+ /**
666
+ * Create "responses" that contain `status`/`headers` without forcing
667
+ * serialization into an actual `Response` - used by Remix single fetch
668
+ *
669
+ * @category Utils
670
+ */
671
+ declare function data<D>(data: D, init?: number | ResponseInit): DataWithResponseInit<D>;
672
+ type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
673
+ /**
674
+ * A redirect response. Sets the status code and the `Location` header.
675
+ * Defaults to "302 Found".
676
+ *
677
+ * @category Utils
678
+ */
679
+ declare const redirect: RedirectFunction;
680
+ /**
681
+ * A redirect response that will force a document reload to the new location.
682
+ * Sets the status code and the `Location` header.
683
+ * Defaults to "302 Found".
684
+ *
685
+ * @category Utils
686
+ */
687
+ declare const redirectDocument: RedirectFunction;
688
+ /**
689
+ * A redirect response that will perform a `history.replaceState` instead of a
690
+ * `history.pushState` for client-side navigation redirects.
691
+ * Sets the status code and the `Location` header.
692
+ * Defaults to "302 Found".
693
+ *
694
+ * @category Utils
695
+ */
696
+ declare const replace: RedirectFunction;
697
+ type ErrorResponse = {
698
+ status: number;
699
+ statusText: string;
700
+ data: any;
701
+ };
702
+ /**
703
+ * @private
704
+ * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies
705
+ *
706
+ * We don't export the class for public use since it's an implementation
707
+ * detail, but we export the interface above so folks can build their own
708
+ * abstractions around instances via isRouteErrorResponse()
709
+ */
710
+ declare class ErrorResponseImpl implements ErrorResponse {
711
+ status: number;
712
+ statusText: string;
713
+ data: any;
714
+ private error?;
715
+ private internal;
716
+ constructor(status: number, statusText: string | undefined, data: any, internal?: boolean);
717
+ }
718
+ /**
719
+ * Check if the given error is an ErrorResponse generated from a 4xx/5xx
720
+ * Response thrown from an action/loader
721
+ *
722
+ * @category Utils
723
+ */
724
+ declare function isRouteErrorResponse(error: any): error is ErrorResponse;
725
+
726
+ /**
727
+ * A Router instance manages all navigation and data loading/mutations
728
+ */
729
+ interface Router {
730
+ /**
731
+ * @private
732
+ * PRIVATE - DO NOT USE
733
+ *
734
+ * Return the basename for the router
735
+ */
736
+ get basename(): RouterInit["basename"];
737
+ /**
738
+ * @private
739
+ * PRIVATE - DO NOT USE
740
+ *
741
+ * Return the future config for the router
742
+ */
743
+ get future(): FutureConfig;
744
+ /**
745
+ * @private
746
+ * PRIVATE - DO NOT USE
747
+ *
748
+ * Return the current state of the router
749
+ */
750
+ get state(): RouterState;
751
+ /**
752
+ * @private
753
+ * PRIVATE - DO NOT USE
754
+ *
755
+ * Return the routes for this router instance
756
+ */
757
+ get routes(): AgnosticDataRouteObject[];
758
+ /**
759
+ * @private
760
+ * PRIVATE - DO NOT USE
761
+ *
762
+ * Return the window associated with the router
763
+ */
764
+ get window(): RouterInit["window"];
765
+ /**
766
+ * @private
767
+ * PRIVATE - DO NOT USE
768
+ *
769
+ * Initialize the router, including adding history listeners and kicking off
770
+ * initial data fetches. Returns a function to cleanup listeners and abort
771
+ * any in-progress loads
772
+ */
773
+ initialize(): Router;
774
+ /**
775
+ * @private
776
+ * PRIVATE - DO NOT USE
777
+ *
778
+ * Subscribe to router.state updates
779
+ *
780
+ * @param fn function to call with the new state
781
+ */
782
+ subscribe(fn: RouterSubscriber): () => void;
783
+ /**
784
+ * @private
785
+ * PRIVATE - DO NOT USE
786
+ *
787
+ * Enable scroll restoration behavior in the router
788
+ *
789
+ * @param savedScrollPositions Object that will manage positions, in case
790
+ * it's being restored from sessionStorage
791
+ * @param getScrollPosition Function to get the active Y scroll position
792
+ * @param getKey Function to get the key to use for restoration
793
+ */
794
+ enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void;
795
+ /**
796
+ * @private
797
+ * PRIVATE - DO NOT USE
798
+ *
799
+ * Navigate forward/backward in the history stack
800
+ * @param to Delta to move in the history stack
801
+ */
802
+ navigate(to: number): Promise<void>;
803
+ /**
804
+ * Navigate to the given path
805
+ * @param to Path to navigate to
806
+ * @param opts Navigation options (method, submission, etc.)
807
+ */
808
+ navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
809
+ /**
810
+ * @private
811
+ * PRIVATE - DO NOT USE
812
+ *
813
+ * Trigger a fetcher load/submission
814
+ *
815
+ * @param key Fetcher key
816
+ * @param routeId Route that owns the fetcher
817
+ * @param href href to fetch
818
+ * @param opts Fetcher options, (method, submission, etc.)
819
+ */
820
+ fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>;
821
+ /**
822
+ * @private
823
+ * PRIVATE - DO NOT USE
824
+ *
825
+ * Trigger a revalidation of all current route loaders and fetcher loads
826
+ */
827
+ revalidate(): Promise<void>;
828
+ /**
829
+ * @private
830
+ * PRIVATE - DO NOT USE
831
+ *
832
+ * Utility function to create an href for the given location
833
+ * @param location
834
+ */
835
+ createHref(location: Location | URL): string;
836
+ /**
837
+ * @private
838
+ * PRIVATE - DO NOT USE
839
+ *
840
+ * Utility function to URL encode a destination path according to the internal
841
+ * history implementation
842
+ * @param to
843
+ */
844
+ encodeLocation(to: To): Path;
845
+ /**
846
+ * @private
847
+ * PRIVATE - DO NOT USE
848
+ *
849
+ * Get/create a fetcher for the given key
850
+ * @param key
851
+ */
852
+ getFetcher<TData = any>(key: string): Fetcher<TData>;
853
+ /**
854
+ * @private
855
+ * PRIVATE - DO NOT USE
856
+ *
857
+ * Delete the fetcher for a given key
858
+ * @param key
859
+ */
860
+ deleteFetcher(key: string): void;
861
+ /**
862
+ * @private
863
+ * PRIVATE - DO NOT USE
864
+ *
865
+ * Cleanup listeners and abort any in-progress loads
866
+ */
867
+ dispose(): void;
868
+ /**
869
+ * @private
870
+ * PRIVATE - DO NOT USE
871
+ *
872
+ * Get a navigation blocker
873
+ * @param key The identifier for the blocker
874
+ * @param fn The blocker function implementation
875
+ */
876
+ getBlocker(key: string, fn: BlockerFunction): Blocker;
877
+ /**
878
+ * @private
879
+ * PRIVATE - DO NOT USE
880
+ *
881
+ * Delete a navigation blocker
882
+ * @param key The identifier for the blocker
883
+ */
884
+ deleteBlocker(key: string): void;
885
+ /**
886
+ * @private
887
+ * PRIVATE DO NOT USE
888
+ *
889
+ * Patch additional children routes into an existing parent route
890
+ * @param routeId The parent route id or a callback function accepting `patch`
891
+ * to perform batch patching
892
+ * @param children The additional children routes
893
+ */
894
+ patchRoutes(routeId: string | null, children: AgnosticRouteObject[]): void;
895
+ /**
896
+ * @private
897
+ * PRIVATE - DO NOT USE
898
+ *
899
+ * HMR needs to pass in-flight route updates to React Router
900
+ * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
901
+ */
902
+ _internalSetRoutes(routes: AgnosticRouteObject[]): void;
903
+ /**
904
+ * @private
905
+ * PRIVATE - DO NOT USE
906
+ *
907
+ * Internal fetch AbortControllers accessed by unit tests
908
+ */
909
+ _internalFetchControllers: Map<string, AbortController>;
910
+ }
911
+ /**
912
+ * State maintained internally by the router. During a navigation, all states
913
+ * reflect the "old" location unless otherwise noted.
914
+ */
915
+ interface RouterState {
916
+ /**
917
+ * The action of the most recent navigation
918
+ */
919
+ historyAction: Action;
920
+ /**
921
+ * The current location reflected by the router
922
+ */
923
+ location: Location;
924
+ /**
925
+ * The current set of route matches
926
+ */
927
+ matches: AgnosticDataRouteMatch[];
928
+ /**
929
+ * Tracks whether we've completed our initial data load
930
+ */
931
+ initialized: boolean;
932
+ /**
933
+ * Current scroll position we should start at for a new view
934
+ * - number -> scroll position to restore to
935
+ * - false -> do not restore scroll at all (used during submissions)
936
+ * - null -> don't have a saved position, scroll to hash or top of page
937
+ */
938
+ restoreScrollPosition: number | false | null;
939
+ /**
940
+ * Indicate whether this navigation should skip resetting the scroll position
941
+ * if we are unable to restore the scroll position
942
+ */
943
+ preventScrollReset: boolean;
944
+ /**
945
+ * Tracks the state of the current navigation
946
+ */
947
+ navigation: Navigation;
948
+ /**
949
+ * Tracks any in-progress revalidations
950
+ */
951
+ revalidation: RevalidationState;
952
+ /**
953
+ * Data from the loaders for the current matches
954
+ */
955
+ loaderData: RouteData;
956
+ /**
957
+ * Data from the action for the current matches
958
+ */
959
+ actionData: RouteData | null;
960
+ /**
961
+ * Errors caught from loaders for the current matches
962
+ */
963
+ errors: RouteData | null;
964
+ /**
965
+ * Map of current fetchers
966
+ */
967
+ fetchers: Map<string, Fetcher>;
968
+ /**
969
+ * Map of current blockers
970
+ */
971
+ blockers: Map<string, Blocker>;
972
+ }
973
+ /**
974
+ * Data that can be passed into hydrate a Router from SSR
975
+ */
976
+ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
977
+ /**
978
+ * Future flags to toggle new feature behavior
979
+ */
980
+ interface FutureConfig {
981
+ unstable_middleware: boolean;
982
+ }
983
+ /**
984
+ * Initialization options for createRouter
985
+ */
986
+ interface RouterInit {
987
+ routes: AgnosticRouteObject[];
988
+ history: History;
989
+ basename?: string;
990
+ unstable_getContext?: () => MaybePromise<unstable_InitialContext>;
991
+ mapRouteProperties?: MapRoutePropertiesFunction;
992
+ future?: Partial<FutureConfig>;
993
+ hydrationData?: HydrationState;
994
+ window?: Window;
995
+ dataStrategy?: DataStrategyFunction;
996
+ patchRoutesOnNavigation?: AgnosticPatchRoutesOnNavigationFunction;
997
+ }
998
+ /**
999
+ * State returned from a server-side query() call
1000
+ */
1001
+ interface StaticHandlerContext {
1002
+ basename: Router["basename"];
1003
+ location: RouterState["location"];
1004
+ matches: RouterState["matches"];
1005
+ loaderData: RouterState["loaderData"];
1006
+ actionData: RouterState["actionData"];
1007
+ errors: RouterState["errors"];
1008
+ statusCode: number;
1009
+ loaderHeaders: Record<string, Headers>;
1010
+ actionHeaders: Record<string, Headers>;
1011
+ _deepestRenderedBoundaryId?: string | null;
1012
+ }
1013
+ /**
1014
+ * A StaticHandler instance manages a singular SSR navigation/fetch event
1015
+ */
1016
+ interface StaticHandler {
1017
+ dataRoutes: AgnosticDataRouteObject[];
1018
+ query(request: Request, opts?: {
1019
+ requestContext?: unknown;
1020
+ filterMatchesToLoad?: (match: AgnosticDataRouteMatch) => boolean;
1021
+ skipLoaderErrorBubbling?: boolean;
1022
+ skipRevalidation?: boolean;
1023
+ dataStrategy?: DataStrategyFunction<unknown>;
1024
+ unstable_respond?: (staticContext: StaticHandlerContext) => MaybePromise<Response>;
1025
+ }): Promise<StaticHandlerContext | Response>;
1026
+ queryRoute(request: Request, opts?: {
1027
+ routeId?: string;
1028
+ requestContext?: unknown;
1029
+ dataStrategy?: DataStrategyFunction<unknown>;
1030
+ unstable_respond?: (res: Response) => MaybePromise<Response>;
1031
+ }): Promise<any>;
1032
+ }
1033
+ type ViewTransitionOpts = {
1034
+ currentLocation: Location;
1035
+ nextLocation: Location;
1036
+ };
1037
+ /**
1038
+ * Subscriber function signature for changes to router state
1039
+ */
1040
+ interface RouterSubscriber {
1041
+ (state: RouterState, opts: {
1042
+ deletedFetchers: string[];
1043
+ viewTransitionOpts?: ViewTransitionOpts;
1044
+ flushSync: boolean;
1045
+ }): void;
1046
+ }
1047
+ /**
1048
+ * Function signature for determining the key to be used in scroll restoration
1049
+ * for a given location
1050
+ */
1051
+ interface GetScrollRestorationKeyFunction {
1052
+ (location: Location, matches: UIMatch[]): string | null;
1053
+ }
1054
+ /**
1055
+ * Function signature for determining the current scroll position
1056
+ */
1057
+ interface GetScrollPositionFunction {
1058
+ (): number;
1059
+ }
1060
+ /**
1061
+ - "route": relative to the route hierarchy so `..` means remove all segments of the current route even if it has many. For example, a `route("posts/:id")` would have both `:id` and `posts` removed from the url.
1062
+ - "path": relative to the pathname so `..` means remove one segment of the pathname. For example, a `route("posts/:id")` would have only `:id` removed from the url.
1063
+ */
1064
+ type RelativeRoutingType = "route" | "path";
1065
+ type BaseNavigateOrFetchOptions = {
1066
+ preventScrollReset?: boolean;
1067
+ relative?: RelativeRoutingType;
1068
+ flushSync?: boolean;
1069
+ };
1070
+ type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
1071
+ replace?: boolean;
1072
+ state?: any;
1073
+ fromRouteId?: string;
1074
+ viewTransition?: boolean;
1075
+ };
1076
+ type BaseSubmissionOptions = {
1077
+ formMethod?: HTMLFormMethod;
1078
+ formEncType?: FormEncType;
1079
+ } & ({
1080
+ formData: FormData;
1081
+ body?: undefined;
1082
+ } | {
1083
+ formData?: undefined;
1084
+ body: any;
1085
+ });
1086
+ /**
1087
+ * Options for a navigate() call for a normal (non-submission) navigation
1088
+ */
1089
+ type LinkNavigateOptions = BaseNavigateOptions;
1090
+ /**
1091
+ * Options for a navigate() call for a submission navigation
1092
+ */
1093
+ type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions;
1094
+ /**
1095
+ * Options to pass to navigate() for a navigation
1096
+ */
1097
+ type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions;
1098
+ /**
1099
+ * Options for a fetch() load
1100
+ */
1101
+ type LoadFetchOptions = BaseNavigateOrFetchOptions;
1102
+ /**
1103
+ * Options for a fetch() submission
1104
+ */
1105
+ type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions;
1106
+ /**
1107
+ * Options to pass to fetch()
1108
+ */
1109
+ type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions;
1110
+ /**
1111
+ * Potential states for state.navigation
1112
+ */
1113
+ type NavigationStates = {
1114
+ Idle: {
1115
+ state: "idle";
1116
+ location: undefined;
1117
+ formMethod: undefined;
1118
+ formAction: undefined;
1119
+ formEncType: undefined;
1120
+ formData: undefined;
1121
+ json: undefined;
1122
+ text: undefined;
1123
+ };
1124
+ Loading: {
1125
+ state: "loading";
1126
+ location: Location;
1127
+ formMethod: Submission["formMethod"] | undefined;
1128
+ formAction: Submission["formAction"] | undefined;
1129
+ formEncType: Submission["formEncType"] | undefined;
1130
+ formData: Submission["formData"] | undefined;
1131
+ json: Submission["json"] | undefined;
1132
+ text: Submission["text"] | undefined;
1133
+ };
1134
+ Submitting: {
1135
+ state: "submitting";
1136
+ location: Location;
1137
+ formMethod: Submission["formMethod"];
1138
+ formAction: Submission["formAction"];
1139
+ formEncType: Submission["formEncType"];
1140
+ formData: Submission["formData"];
1141
+ json: Submission["json"];
1142
+ text: Submission["text"];
1143
+ };
1144
+ };
1145
+ type Navigation = NavigationStates[keyof NavigationStates];
1146
+ type RevalidationState = "idle" | "loading";
1147
+ /**
1148
+ * Potential states for fetchers
1149
+ */
1150
+ type FetcherStates<TData = any> = {
1151
+ /**
1152
+ * The fetcher is not calling a loader or action
1153
+ *
1154
+ * ```tsx
1155
+ * fetcher.state === "idle"
1156
+ * ```
1157
+ */
1158
+ Idle: {
1159
+ state: "idle";
1160
+ formMethod: undefined;
1161
+ formAction: undefined;
1162
+ formEncType: undefined;
1163
+ text: undefined;
1164
+ formData: undefined;
1165
+ json: undefined;
1166
+ /**
1167
+ * If the fetcher has never been called, this will be undefined.
1168
+ */
1169
+ data: TData | undefined;
1170
+ };
1171
+ /**
1172
+ * The fetcher is loading data from a {@link LoaderFunction | loader} from a
1173
+ * call to {@link FetcherWithComponents.load | `fetcher.load`}.
1174
+ *
1175
+ * ```tsx
1176
+ * // somewhere
1177
+ * <button onClick={() => fetcher.load("/some/route") }>Load</button>
1178
+ *
1179
+ * // the state will update
1180
+ * fetcher.state === "loading"
1181
+ * ```
1182
+ */
1183
+ Loading: {
1184
+ state: "loading";
1185
+ formMethod: Submission["formMethod"] | undefined;
1186
+ formAction: Submission["formAction"] | undefined;
1187
+ formEncType: Submission["formEncType"] | undefined;
1188
+ text: Submission["text"] | undefined;
1189
+ formData: Submission["formData"] | undefined;
1190
+ json: Submission["json"] | undefined;
1191
+ data: TData | undefined;
1192
+ };
1193
+ /**
1194
+ The fetcher is submitting to a {@link LoaderFunction} (GET) or {@link ActionFunction} (POST) from a {@link FetcherWithComponents.Form | `fetcher.Form`} or {@link FetcherWithComponents.submit | `fetcher.submit`}.
1195
+
1196
+ ```tsx
1197
+ // somewhere
1198
+ <input
1199
+ onChange={e => {
1200
+ fetcher.submit(event.currentTarget.form, { method: "post" });
1201
+ }}
1202
+ />
1203
+
1204
+ // the state will update
1205
+ fetcher.state === "submitting"
1206
+
1207
+ // and formData will be available
1208
+ fetcher.formData
1209
+ ```
1210
+ */
1211
+ Submitting: {
1212
+ state: "submitting";
1213
+ formMethod: Submission["formMethod"];
1214
+ formAction: Submission["formAction"];
1215
+ formEncType: Submission["formEncType"];
1216
+ text: Submission["text"];
1217
+ formData: Submission["formData"];
1218
+ json: Submission["json"];
1219
+ data: TData | undefined;
1220
+ };
1221
+ };
1222
+ type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
1223
+ interface BlockerBlocked {
1224
+ state: "blocked";
1225
+ reset(): void;
1226
+ proceed(): void;
1227
+ location: Location;
1228
+ }
1229
+ interface BlockerUnblocked {
1230
+ state: "unblocked";
1231
+ reset: undefined;
1232
+ proceed: undefined;
1233
+ location: undefined;
1234
+ }
1235
+ interface BlockerProceeding {
1236
+ state: "proceeding";
1237
+ reset: undefined;
1238
+ proceed: undefined;
1239
+ location: Location;
1240
+ }
1241
+ type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
1242
+ type BlockerFunction = (args: {
1243
+ currentLocation: Location;
1244
+ nextLocation: Location;
1245
+ historyAction: Action;
1246
+ }) => boolean;
1247
+ declare const IDLE_NAVIGATION: NavigationStates["Idle"];
1248
+ declare const IDLE_FETCHER: FetcherStates["Idle"];
1249
+ declare const IDLE_BLOCKER: BlockerUnblocked;
1250
+ /**
1251
+ * Create a router and listen to history POP navigations
1252
+ */
1253
+ declare function createRouter(init: RouterInit): Router;
1254
+ interface CreateStaticHandlerOptions {
1255
+ basename?: string;
1256
+ mapRouteProperties?: MapRoutePropertiesFunction;
1257
+ future?: {};
1258
+ }
1259
+
1260
+ interface IndexRouteObject {
1261
+ caseSensitive?: AgnosticIndexRouteObject["caseSensitive"];
1262
+ path?: AgnosticIndexRouteObject["path"];
1263
+ id?: AgnosticIndexRouteObject["id"];
1264
+ unstable_middleware?: AgnosticIndexRouteObject["unstable_middleware"];
1265
+ loader?: AgnosticIndexRouteObject["loader"];
1266
+ action?: AgnosticIndexRouteObject["action"];
1267
+ hasErrorBoundary?: AgnosticIndexRouteObject["hasErrorBoundary"];
1268
+ shouldRevalidate?: AgnosticIndexRouteObject["shouldRevalidate"];
1269
+ handle?: AgnosticIndexRouteObject["handle"];
1270
+ index: true;
1271
+ children?: undefined;
1272
+ element?: React.ReactNode | null;
1273
+ hydrateFallbackElement?: React.ReactNode | null;
1274
+ errorElement?: React.ReactNode | null;
1275
+ Component?: React.ComponentType | null;
1276
+ HydrateFallback?: React.ComponentType | null;
1277
+ ErrorBoundary?: React.ComponentType | null;
1278
+ lazy?: LazyRouteDefinition<RouteObject>;
1279
+ }
1280
+ interface NonIndexRouteObject {
1281
+ caseSensitive?: AgnosticNonIndexRouteObject["caseSensitive"];
1282
+ path?: AgnosticNonIndexRouteObject["path"];
1283
+ id?: AgnosticNonIndexRouteObject["id"];
1284
+ unstable_middleware?: AgnosticNonIndexRouteObject["unstable_middleware"];
1285
+ loader?: AgnosticNonIndexRouteObject["loader"];
1286
+ action?: AgnosticNonIndexRouteObject["action"];
1287
+ hasErrorBoundary?: AgnosticNonIndexRouteObject["hasErrorBoundary"];
1288
+ shouldRevalidate?: AgnosticNonIndexRouteObject["shouldRevalidate"];
1289
+ handle?: AgnosticNonIndexRouteObject["handle"];
1290
+ index?: false;
1291
+ children?: RouteObject[];
1292
+ element?: React.ReactNode | null;
1293
+ hydrateFallbackElement?: React.ReactNode | null;
1294
+ errorElement?: React.ReactNode | null;
1295
+ Component?: React.ComponentType | null;
1296
+ HydrateFallback?: React.ComponentType | null;
1297
+ ErrorBoundary?: React.ComponentType | null;
1298
+ lazy?: LazyRouteDefinition<RouteObject>;
1299
+ }
1300
+ type RouteObject = IndexRouteObject | NonIndexRouteObject;
1301
+ type DataRouteObject = RouteObject & {
1302
+ children?: DataRouteObject[];
1303
+ id: string;
1304
+ };
1305
+ interface RouteMatch<ParamKey extends string = string, RouteObjectType extends RouteObject = RouteObject> extends AgnosticRouteMatch<ParamKey, RouteObjectType> {
1306
+ }
1307
+ interface DataRouteMatch extends RouteMatch<string, DataRouteObject> {
1308
+ }
1309
+ type PatchRoutesOnNavigationFunctionArgs = AgnosticPatchRoutesOnNavigationFunctionArgs<RouteObject, RouteMatch>;
1310
+ type PatchRoutesOnNavigationFunction = AgnosticPatchRoutesOnNavigationFunction<RouteObject, RouteMatch>;
1311
+ interface DataRouterContextObject extends Omit<NavigationContextObject, "future"> {
1312
+ router: Router;
1313
+ staticContext?: StaticHandlerContext;
1314
+ }
1315
+ declare const DataRouterContext: React.Context<DataRouterContextObject | null>;
1316
+ declare const DataRouterStateContext: React.Context<RouterState | null>;
1317
+ type ViewTransitionContextObject = {
1318
+ isTransitioning: false;
1319
+ } | {
1320
+ isTransitioning: true;
1321
+ flushSync: boolean;
1322
+ currentLocation: Location;
1323
+ nextLocation: Location;
1324
+ };
1325
+ declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>;
1326
+ type FetchersContextObject = Map<string, any>;
1327
+ declare const FetchersContext: React.Context<FetchersContextObject>;
1328
+ interface NavigateOptions {
1329
+ /** Replace the current entry in the history stack instead of pushing a new one */
1330
+ replace?: boolean;
1331
+ /** Adds persistent client side routing state to the next location */
1332
+ state?: any;
1333
+ /** If you are using {@link https://api.reactrouter.com/v7/functions/react_router.ScrollRestoration.html <ScrollRestoration>}, prevent the scroll position from being reset to the top of the window when navigating */
1334
+ preventScrollReset?: boolean;
1335
+ /** Defines the relative path behavior for the link. "route" will use the route hierarchy so ".." will remove all URL segments of the current route pattern while "path" will use the URL path so ".." will remove one URL segment. */
1336
+ relative?: RelativeRoutingType;
1337
+ /** Wraps the initial state update for this navigation in a {@link https://react.dev/reference/react-dom/flushSync ReactDOM.flushSync} call instead of the default {@link https://react.dev/reference/react/startTransition React.startTransition} */
1338
+ flushSync?: boolean;
1339
+ /** Enables a {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API View Transition} for this navigation by wrapping the final state update in `document.startViewTransition()`. If you need to apply specific styles for this view transition, you will also need to leverage the {@link https://api.reactrouter.com/v7/functions/react_router.useViewTransitionState.html useViewTransitionState()} hook. */
1340
+ viewTransition?: boolean;
1341
+ }
1342
+ /**
1343
+ * A Navigator is a "location changer"; it's how you get to different locations.
1344
+ *
1345
+ * Every history instance conforms to the Navigator interface, but the
1346
+ * distinction is useful primarily when it comes to the low-level `<Router>` API
1347
+ * where both the location and a navigator must be provided separately in order
1348
+ * to avoid "tearing" that may occur in a suspense-enabled app if the action
1349
+ * and/or location were to be read directly from the history instance.
1350
+ */
1351
+ interface Navigator {
1352
+ createHref: History["createHref"];
1353
+ encodeLocation?: History["encodeLocation"];
1354
+ go: History["go"];
1355
+ push(to: To, state?: any, opts?: NavigateOptions): void;
1356
+ replace(to: To, state?: any, opts?: NavigateOptions): void;
1357
+ }
1358
+ interface NavigationContextObject {
1359
+ basename: string;
1360
+ navigator: Navigator;
1361
+ static: boolean;
1362
+ future: {};
1363
+ }
1364
+ declare const NavigationContext: React.Context<NavigationContextObject>;
1365
+ interface LocationContextObject {
1366
+ location: Location;
1367
+ navigationType: Action;
1368
+ }
1369
+ declare const LocationContext: React.Context<LocationContextObject>;
1370
+ interface RouteContextObject {
1371
+ outlet: React.ReactElement | null;
1372
+ matches: RouteMatch[];
1373
+ isDataRoute: boolean;
1374
+ }
1375
+ declare const RouteContext: React.Context<RouteContextObject>;
1376
+
1377
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
1378
+ type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
1379
+ interface HtmlLinkProps {
1380
+ /**
1381
+ * Address of the hyperlink
1382
+ */
1383
+ href?: string;
1384
+ /**
1385
+ * How the element handles crossorigin requests
1386
+ */
1387
+ crossOrigin?: "anonymous" | "use-credentials";
1388
+ /**
1389
+ * Relationship between the document containing the hyperlink and the destination resource
1390
+ */
1391
+ rel: LiteralUnion<"alternate" | "dns-prefetch" | "icon" | "manifest" | "modulepreload" | "next" | "pingback" | "preconnect" | "prefetch" | "preload" | "prerender" | "search" | "stylesheet", string>;
1392
+ /**
1393
+ * Applicable media: "screen", "print", "(max-width: 764px)"
1394
+ */
1395
+ media?: string;
1396
+ /**
1397
+ * Integrity metadata used in Subresource Integrity checks
1398
+ */
1399
+ integrity?: string;
1400
+ /**
1401
+ * Language of the linked resource
1402
+ */
1403
+ hrefLang?: string;
1404
+ /**
1405
+ * Hint for the type of the referenced resource
1406
+ */
1407
+ type?: string;
1408
+ /**
1409
+ * Referrer policy for fetches initiated by the element
1410
+ */
1411
+ referrerPolicy?: "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
1412
+ /**
1413
+ * Sizes of the icons (for rel="icon")
1414
+ */
1415
+ sizes?: string;
1416
+ /**
1417
+ * Potential destination for a preload request (for rel="preload" and rel="modulepreload")
1418
+ */
1419
+ as?: LiteralUnion<"audio" | "audioworklet" | "document" | "embed" | "fetch" | "font" | "frame" | "iframe" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "serviceworker" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt", string>;
1420
+ /**
1421
+ * Color to use when customizing a site's icon (for rel="mask-icon")
1422
+ */
1423
+ color?: string;
1424
+ /**
1425
+ * Whether the link is disabled
1426
+ */
1427
+ disabled?: boolean;
1428
+ /**
1429
+ * The title attribute has special semantics on this element: Title of the link; CSS style sheet set name.
1430
+ */
1431
+ title?: string;
1432
+ /**
1433
+ * Images to use in different situations, e.g., high-resolution displays,
1434
+ * small monitors, etc. (for rel="preload")
1435
+ */
1436
+ imageSrcSet?: string;
1437
+ /**
1438
+ * Image sizes for different page layouts (for rel="preload")
1439
+ */
1440
+ imageSizes?: string;
1441
+ }
1442
+ interface HtmlLinkPreloadImage extends HtmlLinkProps {
1443
+ /**
1444
+ * Relationship between the document containing the hyperlink and the destination resource
1445
+ */
1446
+ rel: "preload";
1447
+ /**
1448
+ * Potential destination for a preload request (for rel="preload" and rel="modulepreload")
1449
+ */
1450
+ as: "image";
1451
+ /**
1452
+ * Address of the hyperlink
1453
+ */
1454
+ href?: string;
1455
+ /**
1456
+ * Images to use in different situations, e.g., high-resolution displays,
1457
+ * small monitors, etc. (for rel="preload")
1458
+ */
1459
+ imageSrcSet: string;
1460
+ /**
1461
+ * Image sizes for different page layouts (for rel="preload")
1462
+ */
1463
+ imageSizes?: string;
1464
+ }
1465
+ /**
1466
+ * Represents a `<link>` element.
1467
+ *
1468
+ * WHATWG Specification: https://html.spec.whatwg.org/multipage/semantics.html#the-link-element
1469
+ */
1470
+ type HtmlLinkDescriptor = (HtmlLinkProps & Pick<Required<HtmlLinkProps>, "href">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "imageSizes">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "href"> & {
1471
+ imageSizes?: never;
1472
+ });
1473
+ interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "type" | "sizes" | "imageSrcSet" | "imageSizes" | "as" | "color" | "title"> {
1474
+ /**
1475
+ * The absolute path of the page to prefetch.
1476
+ */
1477
+ page: string;
1478
+ }
1479
+ type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
1480
+
1481
+ interface RouteModules {
1482
+ [routeId: string]: RouteModule | undefined;
1483
+ }
1484
+ /**
1485
+ * The shape of a route module shipped to the client
1486
+ */
1487
+ interface RouteModule {
1488
+ clientAction?: ClientActionFunction;
1489
+ clientLoader?: ClientLoaderFunction;
1490
+ unstable_clientMiddleware?: unstable_MiddlewareFunction<undefined>[];
1491
+ ErrorBoundary?: ErrorBoundaryComponent;
1492
+ HydrateFallback?: HydrateFallbackComponent;
1493
+ Layout?: LayoutComponent;
1494
+ default: RouteComponent;
1495
+ handle?: RouteHandle;
1496
+ links?: LinksFunction;
1497
+ meta?: MetaFunction;
1498
+ shouldRevalidate?: ShouldRevalidateFunction;
1499
+ }
1500
+ /**
1501
+ * The shape of a route module on the server
1502
+ */
1503
+ interface ServerRouteModule extends RouteModule {
1504
+ action?: ActionFunction;
1505
+ headers?: HeadersFunction | {
1506
+ [name: string]: string;
1507
+ };
1508
+ loader?: LoaderFunction;
1509
+ unstable_middleware?: unstable_MiddlewareFunction<Response>[];
1510
+ }
1511
+ /**
1512
+ * A function that handles data mutations for a route on the client
1513
+ */
1514
+ type ClientActionFunction = (args: ClientActionFunctionArgs) => ReturnType<ActionFunction>;
1515
+ /**
1516
+ * Arguments passed to a route `clientAction` function
1517
+ */
1518
+ type ClientActionFunctionArgs = ActionFunctionArgs & {
1519
+ serverAction: <T = unknown>() => Promise<SerializeFrom<T>>;
1520
+ };
1521
+ /**
1522
+ * A function that loads data for a route on the client
1523
+ */
1524
+ type ClientLoaderFunction = ((args: ClientLoaderFunctionArgs) => ReturnType<LoaderFunction>) & {
1525
+ hydrate?: boolean;
1526
+ };
1527
+ /**
1528
+ * Arguments passed to a route `clientLoader` function
1529
+ */
1530
+ type ClientLoaderFunctionArgs = LoaderFunctionArgs & {
1531
+ serverLoader: <T = unknown>() => Promise<SerializeFrom<T>>;
1532
+ };
1533
+ /**
1534
+ * ErrorBoundary to display for this route
1535
+ */
1536
+ type ErrorBoundaryComponent = ComponentType;
1537
+ type HeadersArgs = {
1538
+ loaderHeaders: Headers;
1539
+ parentHeaders: Headers;
1540
+ actionHeaders: Headers;
1541
+ errorHeaders: Headers | undefined;
1542
+ };
1543
+ /**
1544
+ * A function that returns HTTP headers to be used for a route. These headers
1545
+ * will be merged with (and take precedence over) headers from parent routes.
1546
+ */
1547
+ interface HeadersFunction {
1548
+ (args: HeadersArgs): Headers | HeadersInit;
1549
+ }
1550
+ /**
1551
+ * `<Route HydrateFallback>` component to render on initial loads
1552
+ * when client loaders are present
1553
+ */
1554
+ type HydrateFallbackComponent = ComponentType;
1555
+ /**
1556
+ * Optional, root-only `<Route Layout>` component to wrap the root content in.
1557
+ * Useful for defining the <html>/<head>/<body> document shell shared by the
1558
+ * Component, HydrateFallback, and ErrorBoundary
1559
+ */
1560
+ type LayoutComponent = ComponentType<{
1561
+ children: ReactElement<unknown, ErrorBoundaryComponent | HydrateFallbackComponent | RouteComponent>;
1562
+ }>;
1563
+ /**
1564
+ * A function that defines `<link>` tags to be inserted into the `<head>` of
1565
+ * the document on route transitions.
1566
+ *
1567
+ * @see https://remix.run/route/meta
1568
+ */
1569
+ interface LinksFunction {
1570
+ (): LinkDescriptor[];
1571
+ }
1572
+ interface MetaMatch<RouteId extends string = string, Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown> {
1573
+ id: RouteId;
1574
+ pathname: DataRouteMatch["pathname"];
1575
+ data: Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown;
1576
+ handle?: RouteHandle;
1577
+ params: DataRouteMatch["params"];
1578
+ meta: MetaDescriptor[];
1579
+ error?: unknown;
1580
+ }
1581
+ type MetaMatches<MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> = Array<{
1582
+ [K in keyof MatchLoaders]: MetaMatch<Exclude<K, number | symbol>, MatchLoaders[K]>;
1583
+ }[keyof MatchLoaders]>;
1584
+ interface MetaArgs<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
1585
+ data: (Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown) | undefined;
1586
+ params: Params;
1587
+ location: Location;
1588
+ matches: MetaMatches<MatchLoaders>;
1589
+ error?: unknown;
1590
+ }
1591
+ /**
1592
+ * A function that returns an array of data objects to use for rendering
1593
+ * metadata HTML tags in a route. These tags are not rendered on descendant
1594
+ * routes in the route hierarchy. In other words, they will only be rendered on
1595
+ * the route in which they are exported.
1596
+ *
1597
+ * @param Loader - The type of the current route's loader function
1598
+ * @param MatchLoaders - Mapping from a parent route's filepath to its loader
1599
+ * function type
1600
+ *
1601
+ * Note that parent route filepaths are relative to the `app/` directory.
1602
+ *
1603
+ * For example, if this meta function is for `/sales/customers/$customerId`:
1604
+ *
1605
+ * ```ts
1606
+ * // app/root.tsx
1607
+ * const loader = () => ({ hello: "world" })
1608
+ * export type Loader = typeof loader
1609
+ *
1610
+ * // app/routes/sales.tsx
1611
+ * const loader = () => ({ salesCount: 1074 })
1612
+ * export type Loader = typeof loader
1613
+ *
1614
+ * // app/routes/sales/customers.tsx
1615
+ * const loader = () => ({ customerCount: 74 })
1616
+ * export type Loader = typeof loader
1617
+ *
1618
+ * // app/routes/sales/customers/$customersId.tsx
1619
+ * import type { Loader as RootLoader } from "../../../root"
1620
+ * import type { Loader as SalesLoader } from "../../sales"
1621
+ * import type { Loader as CustomersLoader } from "../../sales/customers"
1622
+ *
1623
+ * const loader = () => ({ name: "Customer name" })
1624
+ *
1625
+ * const meta: MetaFunction<typeof loader, {
1626
+ * "root": RootLoader,
1627
+ * "routes/sales": SalesLoader,
1628
+ * "routes/sales/customers": CustomersLoader,
1629
+ * }> = ({ data, matches }) => {
1630
+ * const { name } = data
1631
+ * // ^? string
1632
+ * const { customerCount } = matches.find((match) => match.id === "routes/sales/customers").data
1633
+ * // ^? number
1634
+ * const { salesCount } = matches.find((match) => match.id === "routes/sales").data
1635
+ * // ^? number
1636
+ * const { hello } = matches.find((match) => match.id === "root").data
1637
+ * // ^? "world"
1638
+ * }
1639
+ * ```
1640
+ */
1641
+ interface MetaFunction<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
1642
+ (args: MetaArgs<Loader, MatchLoaders>): MetaDescriptor[] | undefined;
1643
+ }
1644
+ type MetaDescriptor = {
1645
+ charSet: "utf-8";
1646
+ } | {
1647
+ title: string;
1648
+ } | {
1649
+ name: string;
1650
+ content: string;
1651
+ } | {
1652
+ property: string;
1653
+ content: string;
1654
+ } | {
1655
+ httpEquiv: string;
1656
+ content: string;
1657
+ } | {
1658
+ "script:ld+json": LdJsonObject;
1659
+ } | {
1660
+ tagName: "meta" | "link";
1661
+ [name: string]: string;
1662
+ } | {
1663
+ [name: string]: unknown;
1664
+ };
1665
+ type LdJsonObject = {
1666
+ [Key in string]: LdJsonValue;
1667
+ } & {
1668
+ [Key in string]?: LdJsonValue | undefined;
1669
+ };
1670
+ type LdJsonArray = LdJsonValue[] | readonly LdJsonValue[];
1671
+ type LdJsonPrimitive = string | number | boolean | null;
1672
+ type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
1673
+ /**
1674
+ * A React component that is rendered for a route.
1675
+ */
1676
+ type RouteComponent = ComponentType<{}>;
1677
+ /**
1678
+ * An arbitrary object that is associated with a route.
1679
+ *
1680
+ * @see https://remix.run/route/handle
1681
+ */
1682
+ type RouteHandle = unknown;
1683
+
1684
+ type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
1685
+ [key: PropertyKey]: Serializable;
1686
+ } | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
1687
+
1688
+ /**
1689
+ * A brand that can be applied to a type to indicate that it will serialize
1690
+ * to a specific type when transported to the client from a loader.
1691
+ * Only use this if you have additional serialization/deserialization logic
1692
+ * in your application.
1693
+ */
1694
+ type unstable_SerializesTo<T> = {
1695
+ unstable__ReactRouter_SerializesTo: [T];
1696
+ };
1697
+
1698
+ type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
1699
+ type IsAny<T> = 0 extends 1 & T ? true : false;
1700
+ type Func = (...args: any[]) => unknown;
1701
+ type Pretty<T> = {
1702
+ [K in keyof T]: T[K];
1703
+ } & {};
1704
+
1705
+ type Serialize<T> = T extends unstable_SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
1706
+ [K in keyof T]: Serialize<T[K]>;
1707
+ } : undefined;
1708
+ type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
1709
+ type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Func ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined;
1710
+ type ClientData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? U : T;
1711
+ type ServerData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
1712
+ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1713
+ type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1714
+ type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1715
+
1716
+ export { type FormEncType as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type Fetcher as J, type NavigationStates as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type RouterSubscriber as O, type ParamParseKey as P, type RouterNavigateOptions as Q, type RouterInit as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type RouterFetchOptions as V, type DataStrategyFunctionArgs as W, type DataStrategyMatch as X, type DataStrategyResult as Y, DataWithResponseInit as Z, type ErrorResponse as _, type RouteModules as a, type FormMethod as a0, type HTMLFormMethod as a1, type LazyRouteFunction as a2, type unstable_MiddlewareFunction as a3, type PathParam as a4, type RedirectFunction as a5, type unstable_RouterContext as a6, type ShouldRevalidateFunction as a7, type ShouldRevalidateFunctionArgs as a8, unstable_createContext as a9, type MetaArgs as aA, type MetaDescriptor as aB, type PageLinkDescriptor as aC, type HtmlLinkDescriptor as aD, type LinkDescriptor as aE, type unstable_SerializesTo as aF, createBrowserHistory as aG, invariant as aH, createRouter as aI, ErrorResponseImpl as aJ, DataRouterContext as aK, DataRouterStateContext as aL, FetchersContext as aM, LocationContext as aN, NavigationContext as aO, RouteContext as aP, ViewTransitionContext as aQ, type RouteModule as aR, type History as aS, type ServerDataFrom as aT, type ClientDataFrom as aU, type Func as aV, type unstable_MiddlewareNextFunction as aW, type Pretty as aX, createPath as aa, parsePath as ab, IDLE_NAVIGATION as ac, IDLE_FETCHER as ad, IDLE_BLOCKER as ae, data as af, generatePath as ag, isRouteErrorResponse as ah, matchPath as ai, matchRoutes as aj, redirect as ak, redirectDocument as al, replace as am, resolvePath as an, type DataRouteMatch as ao, type DataRouteObject as ap, type Navigator as aq, type PatchRoutesOnNavigationFunction as ar, type PatchRoutesOnNavigationFunctionArgs as as, type RouteMatch as at, type ClientActionFunction as au, type ClientActionFunctionArgs as av, type ClientLoaderFunction as aw, type ClientLoaderFunctionArgs as ax, type HeadersArgs as ay, type HeadersFunction as az, type Router as b, type RouteManifest as c, type RelativeRoutingType as d, type Location as e, Action as f, type Path as g, type PathPattern as h, type PathMatch as i, type Params as j, type RouteObject as k, type Navigation as l, type RevalidationState as m, type SerializeFrom as n, type Blocker as o, type StaticHandlerContext as p, type StaticHandler as q, type unstable_InitialContext as r, type IndexRouteObject as s, type LoaderFunction as t, unstable_RouterContextProvider as u, type ActionFunction as v, type LinksFunction as w, type NonIndexRouteObject as x, type RouterState as y, type GetScrollRestorationKeyFunction as z };