@remix-run/router 1.5.0 → 1.6.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.
package/dist/router.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { History, Location, Path, To } from "./history";
2
2
  import { Action as HistoryAction } from "./history";
3
- import type { DeferredData, AgnosticDataRouteMatch, AgnosticDataRouteObject, FormEncType, FormMethod, DetectErrorBoundaryFunction, RouteData, AgnosticRouteObject, AgnosticRouteMatch, V7_FormMethod, HTMLFormMethod } from "./utils";
3
+ import type { DeferredData, AgnosticDataRouteMatch, AgnosticDataRouteObject, FormEncType, FormMethod, DetectErrorBoundaryFunction, RouteData, AgnosticRouteObject, AgnosticRouteMatch, V7_FormMethod, HTMLFormMethod, MapRoutePropertiesFunction } from "./utils";
4
4
  /**
5
5
  * A Router instance manages all navigation and data loading/mutations
6
6
  */
@@ -69,7 +69,7 @@ export interface Router {
69
69
  * @param to Path to navigate to
70
70
  * @param opts Navigation options (method, submission, etc.)
71
71
  */
72
- navigate(to: To, opts?: RouterNavigateOptions): Promise<void>;
72
+ navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
73
73
  /**
74
74
  * @internal
75
75
  * PRIVATE - DO NOT USE
@@ -81,7 +81,7 @@ export interface Router {
81
81
  * @param href href to fetch
82
82
  * @param opts Fetcher options, (method, submission, etc.)
83
83
  */
84
- fetch(key: string, routeId: string, href: string, opts?: RouterNavigateOptions): void;
84
+ fetch(key: string, routeId: string, href: string | null, opts?: RouterNavigateOptions): void;
85
85
  /**
86
86
  * @internal
87
87
  * PRIVATE - DO NOT USE
@@ -240,6 +240,7 @@ export declare type HydrationState = Partial<Pick<RouterState, "loaderData" | "a
240
240
  */
241
241
  export interface FutureConfig {
242
242
  v7_normalizeFormMethod: boolean;
243
+ v7_prependBasename: boolean;
243
244
  }
244
245
  /**
245
246
  * Initialization options for createRouter
@@ -248,8 +249,12 @@ export interface RouterInit {
248
249
  routes: AgnosticRouteObject[];
249
250
  history: History;
250
251
  basename?: string;
252
+ /**
253
+ * @deprecated Use `mapRouteProperties` instead
254
+ */
251
255
  detectErrorBoundary?: DetectErrorBoundaryFunction;
252
- future?: FutureConfig;
256
+ mapRouteProperties?: MapRoutePropertiesFunction;
257
+ future?: Partial<FutureConfig>;
253
258
  hydrationData?: HydrationState;
254
259
  }
255
260
  /**
@@ -307,21 +312,22 @@ export interface GetScrollRestorationKeyFunction {
307
312
  export interface GetScrollPositionFunction {
308
313
  (): number;
309
314
  }
310
- /**
311
- * Options for a navigate() call for a Link navigation
312
- */
313
- declare type LinkNavigateOptions = {
315
+ export declare type RelativeRoutingType = "route" | "path";
316
+ declare type BaseNavigateOptions = {
314
317
  replace?: boolean;
315
318
  state?: any;
316
319
  preventScrollReset?: boolean;
320
+ relative?: RelativeRoutingType;
321
+ fromRouteId?: string;
317
322
  };
323
+ /**
324
+ * Options for a navigate() call for a Link navigation
325
+ */
326
+ declare type LinkNavigateOptions = BaseNavigateOptions;
318
327
  /**
319
328
  * Options for a navigate() call for a Form navigation
320
329
  */
321
- declare type SubmissionNavigateOptions = {
322
- replace?: boolean;
323
- state?: any;
324
- preventScrollReset?: boolean;
330
+ declare type SubmissionNavigateOptions = BaseNavigateOptions & {
325
331
  formMethod?: HTMLFormMethod;
326
332
  formEncType?: FormEncType;
327
333
  formData: FormData;
@@ -432,7 +438,11 @@ export declare function createRouter(init: RouterInit): Router;
432
438
  export declare const UNSAFE_DEFERRED_SYMBOL: unique symbol;
433
439
  export interface CreateStaticHandlerOptions {
434
440
  basename?: string;
441
+ /**
442
+ * @deprecated Use `mapRouteProperties` instead
443
+ */
435
444
  detectErrorBoundary?: DetectErrorBoundaryFunction;
445
+ mapRouteProperties?: MapRoutePropertiesFunction;
436
446
  }
437
447
  export declare function createStaticHandler(routes: AgnosticRouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
438
448
  /**