| 1 | import { e as RouteObject, f as History, g as MaybePromise, c as RouterContextProvider, h as MapRoutePropertiesFunction, i as Action, L as Location, D as DataRouteMatch, j as Submission, k as RouteData, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, U as UIMatch, T as To, o as HTMLFormMethod, F as FormEncType, p as Path, q as LoaderFunctionArgs, r as MiddlewareEnabled, s as AppLoadContext } from './routeModules-CM_clkdE.js';
|
| 2 |
|
| 3 | |
| 4 | |
| 5 |
|
| 6 | interface Router {
|
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 |
|
| 13 | get basename(): RouterInit["basename"];
|
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 |
|
| 20 | get future(): FutureConfig;
|
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 |
|
| 27 | get state(): RouterState;
|
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 |
|
| 34 | get routes(): DataRouteObject[];
|
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 |
|
| 41 | get window(): RouterInit["window"];
|
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 |
|
| 50 | initialize(): Router;
|
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 |
|
| 59 | subscribe(fn: RouterSubscriber): () => void;
|
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 |
|
| 71 | enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void;
|
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 |
|
| 79 | navigate(to: number): Promise<void>;
|
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 |
|
| 85 | navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
|
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 |
|
| 97 | fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>;
|
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 |
|
| 104 | revalidate(): Promise<void>;
|
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 |
|
| 112 | createHref(location: Location | URL): string;
|
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 |
|
| 121 | encodeLocation(to: To): Path;
|
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 |
|
| 129 | getFetcher<TData = any>(key: string): Fetcher<TData>;
|
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 |
|
| 137 | resetFetcher(key: string, opts?: {
|
| 138 | reason?: unknown;
|
| 139 | }): void;
|
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 |
|
| 147 | deleteFetcher(key: string): void;
|
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 |
|
| 154 | dispose(): void;
|
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 |
|
| 163 | getBlocker(key: string, fn: BlockerFunction): Blocker;
|
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 |
|
| 171 | deleteBlocker(key: string): void;
|
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 |
|
| 184 | patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void;
|
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 |
|
| 192 | _internalSetRoutes(routes: RouteObject[]): void;
|
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 |
|
| 199 | _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void;
|
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 |
|
| 206 | _internalFetchControllers: Map<string, AbortController>;
|
| 207 | }
|
| 208 | |
| 209 | |
| 210 | |
| 211 |
|
| 212 | interface RouterState {
|
| 213 | |
| 214 | |
| 215 |
|
| 216 | historyAction: Action;
|
| 217 | |
| 218 | |
| 219 |
|
| 220 | location: Location;
|
| 221 | |
| 222 | |
| 223 |
|
| 224 | matches: DataRouteMatch[];
|
| 225 | |
| 226 | |
| 227 |
|
| 228 | initialized: boolean;
|
| 229 | |
| 230 | |
| 231 |
|
| 232 | renderFallback: boolean;
|
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 |
|
| 239 | restoreScrollPosition: number | false | null;
|
| 240 | |
| 241 | |
| 242 | |
| 243 |
|
| 244 | preventScrollReset: boolean;
|
| 245 | |
| 246 | |
| 247 |
|
| 248 | navigation: Navigation;
|
| 249 | |
| 250 | |
| 251 |
|
| 252 | revalidation: RevalidationState;
|
| 253 | |
| 254 | |
| 255 |
|
| 256 | loaderData: RouteData;
|
| 257 | |
| 258 | |
| 259 |
|
| 260 | actionData: RouteData | null;
|
| 261 | |
| 262 | |
| 263 |
|
| 264 | errors: RouteData | null;
|
| 265 | |
| 266 | |
| 267 |
|
| 268 | fetchers: Map<string, Fetcher>;
|
| 269 | |
| 270 | |
| 271 |
|
| 272 | blockers: Map<string, Blocker>;
|
| 273 | }
|
| 274 | |
| 275 | |
| 276 |
|
| 277 | type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
|
| 278 | |
| 279 | |
| 280 |
|
| 281 | interface FutureConfig {
|
| 282 | unstable_passThroughRequests: boolean;
|
| 283 | }
|
| 284 | |
| 285 | |
| 286 |
|
| 287 | interface RouterInit {
|
| 288 | routes: RouteObject[];
|
| 289 | history: History;
|
| 290 | basename?: string;
|
| 291 | getContext?: () => MaybePromise<RouterContextProvider>;
|
| 292 | unstable_instrumentations?: unstable_ClientInstrumentation[];
|
| 293 | mapRouteProperties?: MapRoutePropertiesFunction;
|
| 294 | future?: Partial<FutureConfig>;
|
| 295 | hydrationRouteProperties?: string[];
|
| 296 | hydrationData?: HydrationState;
|
| 297 | window?: Window;
|
| 298 | dataStrategy?: DataStrategyFunction;
|
| 299 | patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
|
| 300 | }
|
| 301 | |
| 302 | |
| 303 |
|
| 304 | interface StaticHandlerContext {
|
| 305 | basename: Router["basename"];
|
| 306 | location: RouterState["location"];
|
| 307 | matches: RouterState["matches"];
|
| 308 | loaderData: RouterState["loaderData"];
|
| 309 | actionData: RouterState["actionData"];
|
| 310 | errors: RouterState["errors"];
|
| 311 | statusCode: number;
|
| 312 | loaderHeaders: Record<string, Headers>;
|
| 313 | actionHeaders: Record<string, Headers>;
|
| 314 | _deepestRenderedBoundaryId?: string | null;
|
| 315 | }
|
| 316 | |
| 317 | |
| 318 |
|
| 319 | interface StaticHandler {
|
| 320 | dataRoutes: DataRouteObject[];
|
| 321 | query(request: Request, opts?: {
|
| 322 | requestContext?: unknown;
|
| 323 | filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
| 324 | skipLoaderErrorBubbling?: boolean;
|
| 325 | skipRevalidation?: boolean;
|
| 326 | dataStrategy?: DataStrategyFunction<unknown>;
|
| 327 | generateMiddlewareResponse?: (query: (r: Request, args?: {
|
| 328 | filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
| 329 | }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
| 330 | unstable_normalizePath?: (request: Request) => Path;
|
| 331 | }): Promise<StaticHandlerContext | Response>;
|
| 332 | queryRoute(request: Request, opts?: {
|
| 333 | routeId?: string;
|
| 334 | requestContext?: unknown;
|
| 335 | dataStrategy?: DataStrategyFunction<unknown>;
|
| 336 | generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
| 337 | unstable_normalizePath?: (request: Request) => Path;
|
| 338 | }): Promise<any>;
|
| 339 | }
|
| 340 | type ViewTransitionOpts = {
|
| 341 | currentLocation: Location;
|
| 342 | nextLocation: Location;
|
| 343 | };
|
| 344 | |
| 345 | |
| 346 |
|
| 347 | interface RouterSubscriber {
|
| 348 | (state: RouterState, opts: {
|
| 349 | deletedFetchers: string[];
|
| 350 | newErrors: RouteData | null;
|
| 351 | viewTransitionOpts?: ViewTransitionOpts;
|
| 352 | flushSync: boolean;
|
| 353 | }): void;
|
| 354 | }
|
| 355 | |
| 356 | |
| 357 | |
| 358 |
|
| 359 | interface GetScrollRestorationKeyFunction {
|
| 360 | (location: Location, matches: UIMatch[]): string | null;
|
| 361 | }
|
| 362 | |
| 363 | |
| 364 |
|
| 365 | interface GetScrollPositionFunction {
|
| 366 | (): number;
|
| 367 | }
|
| 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 |
|
| 376 | type RelativeRoutingType = "route" | "path";
|
| 377 | type BaseNavigateOrFetchOptions = {
|
| 378 | preventScrollReset?: boolean;
|
| 379 | relative?: RelativeRoutingType;
|
| 380 | flushSync?: boolean;
|
| 381 | unstable_defaultShouldRevalidate?: boolean;
|
| 382 | };
|
| 383 | type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
| 384 | replace?: boolean;
|
| 385 | state?: any;
|
| 386 | fromRouteId?: string;
|
| 387 | viewTransition?: boolean;
|
| 388 | unstable_mask?: To;
|
| 389 | };
|
| 390 | type BaseSubmissionOptions = {
|
| 391 | formMethod?: HTMLFormMethod;
|
| 392 | formEncType?: FormEncType;
|
| 393 | } & ({
|
| 394 | formData: FormData;
|
| 395 | body?: undefined;
|
| 396 | } | {
|
| 397 | formData?: undefined;
|
| 398 | body: any;
|
| 399 | });
|
| 400 | |
| 401 | |
| 402 |
|
| 403 | type LinkNavigateOptions = BaseNavigateOptions;
|
| 404 | |
| 405 | |
| 406 |
|
| 407 | type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions;
|
| 408 | |
| 409 | |
| 410 |
|
| 411 | type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions;
|
| 412 | |
| 413 | |
| 414 |
|
| 415 | type LoadFetchOptions = BaseNavigateOrFetchOptions;
|
| 416 | |
| 417 | |
| 418 |
|
| 419 | type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions;
|
| 420 | |
| 421 | |
| 422 |
|
| 423 | type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions;
|
| 424 | |
| 425 | |
| 426 |
|
| 427 | type NavigationStates = {
|
| 428 | Idle: {
|
| 429 | state: "idle";
|
| 430 | location: undefined;
|
| 431 | formMethod: undefined;
|
| 432 | formAction: undefined;
|
| 433 | formEncType: undefined;
|
| 434 | formData: undefined;
|
| 435 | json: undefined;
|
| 436 | text: undefined;
|
| 437 | };
|
| 438 | Loading: {
|
| 439 | state: "loading";
|
| 440 | location: Location;
|
| 441 | formMethod: Submission["formMethod"] | undefined;
|
| 442 | formAction: Submission["formAction"] | undefined;
|
| 443 | formEncType: Submission["formEncType"] | undefined;
|
| 444 | formData: Submission["formData"] | undefined;
|
| 445 | json: Submission["json"] | undefined;
|
| 446 | text: Submission["text"] | undefined;
|
| 447 | };
|
| 448 | Submitting: {
|
| 449 | state: "submitting";
|
| 450 | location: Location;
|
| 451 | formMethod: Submission["formMethod"];
|
| 452 | formAction: Submission["formAction"];
|
| 453 | formEncType: Submission["formEncType"];
|
| 454 | formData: Submission["formData"];
|
| 455 | json: Submission["json"];
|
| 456 | text: Submission["text"];
|
| 457 | };
|
| 458 | };
|
| 459 | type Navigation = NavigationStates[keyof NavigationStates];
|
| 460 | type RevalidationState = "idle" | "loading";
|
| 461 | |
| 462 | |
| 463 |
|
| 464 | type FetcherStates<TData = any> = {
|
| 465 | |
| 466 | |
| 467 | |
| 468 | |
| 469 | |
| 470 | |
| 471 |
|
| 472 | Idle: {
|
| 473 | state: "idle";
|
| 474 | formMethod: undefined;
|
| 475 | formAction: undefined;
|
| 476 | formEncType: undefined;
|
| 477 | text: undefined;
|
| 478 | formData: undefined;
|
| 479 | json: undefined;
|
| 480 | |
| 481 | |
| 482 |
|
| 483 | data: TData | undefined;
|
| 484 | };
|
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | |
| 492 | |
| 493 | |
| 494 | |
| 495 | |
| 496 |
|
| 497 | Loading: {
|
| 498 | state: "loading";
|
| 499 | formMethod: Submission["formMethod"] | undefined;
|
| 500 | formAction: Submission["formAction"] | undefined;
|
| 501 | formEncType: Submission["formEncType"] | undefined;
|
| 502 | text: Submission["text"] | undefined;
|
| 503 | formData: Submission["formData"] | undefined;
|
| 504 | json: Submission["json"] | undefined;
|
| 505 | data: TData | undefined;
|
| 506 | };
|
| 507 | |
| 508 | |
| 509 | |
| 510 | |
| 511 | |
| 512 | |
| 513 | |
| 514 | |
| 515 | |
| 516 | |
| 517 | |
| 518 | |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | |
| 524 |
|
| 525 | Submitting: {
|
| 526 | state: "submitting";
|
| 527 | formMethod: Submission["formMethod"];
|
| 528 | formAction: Submission["formAction"];
|
| 529 | formEncType: Submission["formEncType"];
|
| 530 | text: Submission["text"];
|
| 531 | formData: Submission["formData"];
|
| 532 | json: Submission["json"];
|
| 533 | data: TData | undefined;
|
| 534 | };
|
| 535 | };
|
| 536 | type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
|
| 537 | interface BlockerBlocked {
|
| 538 | state: "blocked";
|
| 539 | reset: () => void;
|
| 540 | proceed: () => void;
|
| 541 | location: Location;
|
| 542 | }
|
| 543 | interface BlockerUnblocked {
|
| 544 | state: "unblocked";
|
| 545 | reset: undefined;
|
| 546 | proceed: undefined;
|
| 547 | location: undefined;
|
| 548 | }
|
| 549 | interface BlockerProceeding {
|
| 550 | state: "proceeding";
|
| 551 | reset: undefined;
|
| 552 | proceed: undefined;
|
| 553 | location: Location;
|
| 554 | }
|
| 555 | type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
|
| 556 | type BlockerFunction = (args: {
|
| 557 | currentLocation: Location;
|
| 558 | nextLocation: Location;
|
| 559 | historyAction: Action;
|
| 560 | }) => boolean;
|
| 561 | declare const IDLE_NAVIGATION: NavigationStates["Idle"];
|
| 562 | declare const IDLE_FETCHER: FetcherStates["Idle"];
|
| 563 | declare const IDLE_BLOCKER: BlockerUnblocked;
|
| 564 | |
| 565 | |
| 566 |
|
| 567 | declare function createRouter(init: RouterInit): Router;
|
| 568 | interface CreateStaticHandlerOptions {
|
| 569 | basename?: string;
|
| 570 | mapRouteProperties?: MapRoutePropertiesFunction;
|
| 571 | unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
| 572 | future?: Partial<FutureConfig>;
|
| 573 | }
|
| 574 |
|
| 575 | type unstable_ServerInstrumentation = {
|
| 576 | handler?: unstable_InstrumentRequestHandlerFunction;
|
| 577 | route?: unstable_InstrumentRouteFunction;
|
| 578 | };
|
| 579 | type unstable_ClientInstrumentation = {
|
| 580 | router?: unstable_InstrumentRouterFunction;
|
| 581 | route?: unstable_InstrumentRouteFunction;
|
| 582 | };
|
| 583 | type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
| 584 | type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
| 585 | type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
| 586 | type unstable_InstrumentationHandlerResult = {
|
| 587 | status: "success";
|
| 588 | error: undefined;
|
| 589 | } | {
|
| 590 | status: "error";
|
| 591 | error: Error;
|
| 592 | };
|
| 593 | type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
|
| 594 | type ReadonlyRequest = {
|
| 595 | method: string;
|
| 596 | url: string;
|
| 597 | headers: Pick<Headers, "get">;
|
| 598 | };
|
| 599 | type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>;
|
| 600 | type InstrumentableRoute = {
|
| 601 | id: string;
|
| 602 | index: boolean | undefined;
|
| 603 | path: string | undefined;
|
| 604 | instrument(instrumentations: RouteInstrumentations): void;
|
| 605 | };
|
| 606 | type RouteInstrumentations = {
|
| 607 | lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
| 608 | "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
| 609 | "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
| 610 | "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
| 611 | middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
| 612 | loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
| 613 | action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
| 614 | };
|
| 615 | type RouteLazyInstrumentationInfo = undefined;
|
| 616 | type RouteHandlerInstrumentationInfo = Readonly<{
|
| 617 | request: ReadonlyRequest;
|
| 618 | params: LoaderFunctionArgs["params"];
|
| 619 | unstable_pattern: string;
|
| 620 | context: ReadonlyContext;
|
| 621 | }>;
|
| 622 | type InstrumentableRouter = {
|
| 623 | instrument(instrumentations: RouterInstrumentations): void;
|
| 624 | };
|
| 625 | type RouterInstrumentations = {
|
| 626 | navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>;
|
| 627 | fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>;
|
| 628 | };
|
| 629 | type RouterNavigationInstrumentationInfo = Readonly<{
|
| 630 | to: string | number;
|
| 631 | currentUrl: string;
|
| 632 | formMethod?: HTMLFormMethod;
|
| 633 | formEncType?: FormEncType;
|
| 634 | formData?: FormData;
|
| 635 | body?: any;
|
| 636 | }>;
|
| 637 | type RouterFetchInstrumentationInfo = Readonly<{
|
| 638 | href: string;
|
| 639 | currentUrl: string;
|
| 640 | fetcherKey: string;
|
| 641 | formMethod?: HTMLFormMethod;
|
| 642 | formEncType?: FormEncType;
|
| 643 | formData?: FormData;
|
| 644 | body?: any;
|
| 645 | }>;
|
| 646 | type InstrumentableRequestHandler = {
|
| 647 | instrument(instrumentations: RequestHandlerInstrumentations): void;
|
| 648 | };
|
| 649 | type RequestHandlerInstrumentations = {
|
| 650 | request?: InstrumentFunction<RequestHandlerInstrumentationInfo>;
|
| 651 | };
|
| 652 | type RequestHandlerInstrumentationInfo = Readonly<{
|
| 653 | request: ReadonlyRequest;
|
| 654 | context: ReadonlyContext | undefined;
|
| 655 | }>;
|
| 656 |
|
| 657 | export { type BlockerFunction as B, type CreateStaticHandlerOptions as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, IDLE_NAVIGATION as I, type Navigation as N, type RouterInit as R, type StaticHandler as S, type Router as a, type Blocker as b, type RelativeRoutingType as c, type RouterState as d, type GetScrollRestorationKeyFunction as e, type StaticHandlerContext as f, type NavigationStates as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type unstable_ServerInstrumentation as l, type unstable_InstrumentRequestHandlerFunction as m, type unstable_InstrumentRouterFunction as n, type unstable_InstrumentRouteFunction as o, type unstable_InstrumentationHandlerResult as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type unstable_ClientInstrumentation as u };
|