@tanstack/router-core 0.0.1-beta.150 → 0.0.1-beta.152

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.
@@ -96,6 +96,84 @@ declare function replaceEqualDeep<T>(prev: any, _next: T): T;
96
96
  declare function isPlainObject(o: any): boolean;
97
97
  declare function partialDeepEqual(a: any, b: any): boolean;
98
98
 
99
+ interface AnyRoutesInfo {
100
+ routeTree: AnyRoute;
101
+ routeUnion: AnyRoute;
102
+ routesById: Record<string, AnyRoute>;
103
+ routesByFullPath: Record<string, AnyRoute>;
104
+ routeIds: any;
105
+ routePaths: any;
106
+ routeIntersection: AnyRoute;
107
+ fullSearchSchema: Record<string, any>;
108
+ allParams: Record<string, any>;
109
+ }
110
+ interface DefaultRoutesInfo {
111
+ routeTree: AnyRoute;
112
+ routeUnion: AnyRoute;
113
+ routesById: Record<string, Route>;
114
+ routesByFullPath: Record<string, Route>;
115
+ routeIds: string;
116
+ routePaths: string;
117
+ routeIntersection: AnyRoute;
118
+ fullSearchSchema: AnySearchSchema;
119
+ allParams: AnyPathParams;
120
+ }
121
+ interface RoutesInfo<TRouteTree extends AnyRoute = Route> extends RoutesInfoInner<TRouteTree, ParseRoute<TRouteTree>> {
122
+ }
123
+ interface RoutesInfoInner<TRouteTree extends AnyRoute, TRouteUnion extends AnyRoute = Route, TRoutesById = {
124
+ '/': TRouteUnion;
125
+ } & {
126
+ [TRoute in TRouteUnion as TRoute['id']]: TRoute;
127
+ }, TRoutesByFullPath = {
128
+ '/': TRouteUnion;
129
+ } & {
130
+ [TRoute in TRouteUnion as TRoute['fullPath'] extends RootRouteId ? never : string extends TRoute['fullPath'] ? never : `${TRoute['fullPath']}/` extends keyof TRoutesById ? never : TRoute['fullPath'] extends `${infer Trimmed}/` ? Trimmed : TRoute['fullPath']]: TRoute;
131
+ }> {
132
+ routeTree: TRouteTree;
133
+ routeUnion: TRouteUnion;
134
+ routesById: TRoutesById;
135
+ routesByFullPath: TRoutesByFullPath;
136
+ routeIds: keyof TRoutesById;
137
+ routePaths: keyof TRoutesByFullPath;
138
+ routeIntersection: Route<TRouteUnion['__types']['parentRoute'], // TParentRoute,
139
+ TRouteUnion['__types']['path'], // TPath,
140
+ TRouteUnion['__types']['fullPath'], // TFullPath,
141
+ TRouteUnion['__types']['customId'], // TCustomId,
142
+ TRouteUnion['__types']['id'], // TId,
143
+ TRouteUnion['__types']['loader'], // TId,
144
+ // TId,
145
+ MergeUnion<TRouteUnion['__types']['searchSchema']> & {}, // TSearchSchema,
146
+ // TSearchSchema,
147
+ MergeUnion<TRouteUnion['__types']['fullSearchSchema']> & {}, // TFullSearchSchema,
148
+ MergeUnion<TRouteUnion['__types']['params']>, // TParams,
149
+ MergeUnion<TRouteUnion['__types']['allParams']>, // TAllParams,
150
+ MergeUnion<TRouteUnion['__types']['parentContext']>, // TParentContext,
151
+ MergeUnion<TRouteUnion['__types']['allParentContext']>, // TAllParentContext,
152
+ // TAllParentContext,
153
+ MergeUnion<TRouteUnion['__types']['routeContext']> & {}, // TRouteContext,
154
+ // TRouteContext,
155
+ MergeUnion<TRouteUnion['__types']['context']> & {}, // TContext,
156
+ // TContext,
157
+ MergeUnion<TRouteUnion['__types']['routerContext']> & {}, // TRouterContext,
158
+ TRouteUnion['__types']['children'], // TChildren,
159
+ TRouteUnion['__types']['routesInfo']>;
160
+ fullSearchSchema: Partial<MergeUnion<TRouteUnion['__types']['fullSearchSchema']>>;
161
+ allParams: Partial<MergeUnion<TRouteUnion['__types']['allParams']>>;
162
+ }
163
+ type ParseRoute<TRouteTree> = TRouteTree extends AnyRoute ? TRouteTree | ParseRouteChildren<TRouteTree> : never;
164
+ type ParseRouteChildren<TRouteTree> = TRouteTree extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, infer TChildren, any> ? unknown extends TChildren ? never : TChildren extends AnyRoute[] ? Values<{
165
+ [TId in TChildren[number]['id']]: ParseRouteChild<TChildren[number], TId>;
166
+ }> : never : never;
167
+ type ParseRouteChild<TRoute, TId> = TRoute extends AnyRoute ? ParseRoute<TRoute> : never;
168
+ type RoutesById<TRoutesInfo extends AnyRoutesInfo> = {
169
+ [K in keyof TRoutesInfo['routesById']]: TRoutesInfo['routesById'][K];
170
+ };
171
+ type RouteById<TRoutesInfo extends AnyRoutesInfo, TId> = TId extends keyof TRoutesInfo['routesById'] ? IsAny<TRoutesInfo['routesById'][TId]['id'], Route, TRoutesInfo['routesById'][TId]> : never;
172
+ type RoutesByPath<TRoutesInfo extends AnyRoutesInfo> = {
173
+ [K in keyof TRoutesInfo['routesByFullPath']]: TRoutesInfo['routesByFullPath'][K];
174
+ };
175
+ type RouteByPath<TRoutesInfo extends AnyRoutesInfo, TPath> = TPath extends keyof TRoutesInfo['routesByFullPath'] ? IsAny<TRoutesInfo['routesByFullPath'][TPath]['id'], Route, TRoutesInfo['routesByFullPath'][TPath]> : never;
176
+
99
177
  declare global {
100
178
  interface Window {
101
179
  __TSR_DEHYDRATED__?: HydrationCtx;
@@ -374,9 +452,10 @@ type RouteProps<TLoader = unknown, TFullSearchSchema extends AnySearchSchema = A
374
452
  select?: (context: TDefaultSelected) => TSelected;
375
453
  }) => TSelected;
376
454
  };
377
- type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TLoader = unknown, TParentSearchSchema extends AnySearchSchema = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = AnyPathParams, TParams extends AnyPathParams = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = TParams, TParentContext extends AnyContext = AnyContext, TAllParentContext extends IsAny<TParentRoute['__types']['allParams'], TParentContext, TParentRoute['__types']['allParams'] & TParentContext> = IsAny<TParentRoute['__types']['allParams'], TParentContext, TParentRoute['__types']['allParams'] & TParentContext>, TRouteContext extends RouteContext = RouteContext, TContext extends MergeParamsFromParent<TAllParentContext, TRouteContext> = MergeParamsFromParent<TAllParentContext, TRouteContext>> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TLoader, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext> & UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>;
455
+ type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TLoader = unknown, TParentSearchSchema extends AnySearchSchema = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParams extends AnyPathParams = AnyPathParams, TAllParams extends AnyPathParams = TParams, TParentContext extends AnyContext = AnyContext, TAllParentContext extends AnyContext = AnyContext, TRouteContext extends RouteContext = RouteContext, TContext extends AnyContext = AnyContext> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TLoader, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext> & UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>;
378
456
  type ParamsFallback<TPath extends string, TParams> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams;
379
- type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TLoader = unknown, TParentSearchSchema extends AnySearchSchema = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = AnyPathParams, TParams = unknown, TAllParams = ParamsFallback<TPath, TParams>, TParentContext extends AnyContext = AnyContext, TAllParentContext extends IsAny<TParentRoute['__types']['allParams'], TParentContext, TParentRoute['__types']['allParams'] & TParentContext> = IsAny<TParentRoute['__types']['allParams'], TParentContext, TParentRoute['__types']['allParams'] & TParentContext>, TRouteContext extends RouteContext = RouteContext, TContext extends MergeParamsFromParent<TAllParentContext, TRouteContext> = MergeParamsFromParent<TAllParentContext, TRouteContext>> = RoutePathOptions<TCustomId, TPath> & {
457
+ type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TLoader = unknown, TParentSearchSchema extends AnySearchSchema = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParams = unknown, TAllParams = ParamsFallback<TPath, TParams>, TParentContext extends AnyContext = AnyContext, TAllParentContext extends AnyContext = AnyContext, TRouteContext extends RouteContext = RouteContext, TContext extends AnyContext = AnyContext> = RoutePathOptions<TCustomId, TPath> & {
458
+ layoutLimit?: string;
380
459
  getParentRoute: () => TParentRoute;
381
460
  validateSearch?: SearchSchemaValidator<TSearchSchema, TParentSearchSchema>;
382
461
  loader?: LoaderFn<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, NoInfer<TRouteContext>, TContext>;
@@ -496,7 +575,25 @@ type StreamedPromise<T> = {
496
575
  data: T;
497
576
  resolve: (value: T) => void;
498
577
  };
499
- declare class Route<TParentRoute extends AnyRoute = AnyRoute, TPath extends string = '/', TFullPath extends ResolveFullPath<TParentRoute, TPath> = ResolveFullPath<TParentRoute, TPath>, TCustomId extends string = string, TId extends ResolveId<TParentRoute, TCustomId, TPath> = ResolveId<TParentRoute, TCustomId, TPath>, TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends Record<ParsePathParams<TPath>, any> = Record<ParsePathParams<TPath>, string>, TAllParams extends MergeParamsFromParent<TParentRoute['__types']['allParams'], TParams> = MergeParamsFromParent<TParentRoute['__types']['allParams'], TParams>, TParentContext extends TParentRoute['__types']['routeContext'] = TParentRoute['__types']['routeContext'], TAllParentContext extends TParentRoute['__types']['context'] = TParentRoute['__types']['context'], TRouteContext extends RouteContext = RouteContext, TContext extends MergeParamsFromParent<TParentRoute['__types']['context'], TRouteContext> = MergeParamsFromParent<TParentRoute['__types']['context'], TRouteContext>, TRouterContext extends AnyContext = AnyContext, TChildren extends unknown = unknown, TRoutesInfo extends DefaultRoutesInfo = DefaultRoutesInfo> {
578
+ type RouteConstraints = {
579
+ TParentRoute: AnyRoute;
580
+ TPath: string;
581
+ TFullPath: string;
582
+ TCustomId: string;
583
+ TId: string;
584
+ TSearchSchema: AnySearchSchema;
585
+ TFullSearchSchema: AnySearchSchema;
586
+ TParams: Record<string, any>;
587
+ TAllParams: Record<string, any>;
588
+ TParentContext: AnyContext;
589
+ TAllParentContext: AnyContext;
590
+ TRouteContext: RouteContext;
591
+ TContext: AnyContext;
592
+ TRouterContext: AnyContext;
593
+ TChildren: unknown;
594
+ TRoutesInfo: DefaultRoutesInfo;
595
+ };
596
+ declare class Route<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TLoader = unknown, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends RouteConstraints['TParams'] = Record<ParsePathParams<TPath>, string>, TAllParams extends RouteConstraints['TAllParams'] = MergeParamsFromParent<TParentRoute['__types']['allParams'], TParams>, TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['__types']['routeContext'], TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['__types']['context'], TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TContext extends RouteConstraints['TContext'] = MergeParamsFromParent<TParentRoute['__types']['context'], TRouteContext>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TChildren extends RouteConstraints['TChildren'] = unknown, TRoutesInfo extends RouteConstraints['TRoutesInfo'] = DefaultRoutesInfo> {
500
597
  __types: {
501
598
  parentRoute: TParentRoute;
502
599
  path: TPath;
@@ -518,7 +615,7 @@ declare class Route<TParentRoute extends AnyRoute = AnyRoute, TPath extends stri
518
615
  routerContext: TRouterContext;
519
616
  };
520
617
  isRoot: TParentRoute extends Route<any> ? true : false;
521
- options: RouteOptions<TParentRoute, TCustomId, TPath, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParentRoute['__types']['allParams'], TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext> & UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>;
618
+ options: RouteOptions<TParentRoute, TCustomId, TPath, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext> & UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>;
522
619
  parentRoute: TParentRoute;
523
620
  id: TId;
524
621
  path: TPath;
@@ -528,7 +625,7 @@ declare class Route<TParentRoute extends AnyRoute = AnyRoute, TPath extends stri
528
625
  originalIndex?: number;
529
626
  router?: Router<TRoutesInfo['routeTree'], TRoutesInfo>;
530
627
  rank: number;
531
- constructor(options: RouteOptions<TParentRoute, TCustomId, TPath, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParentRoute['__types']['allParams'], TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext> & UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>);
628
+ constructor(options: RouteOptions<TParentRoute, TCustomId, TPath, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext> & UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>);
532
629
  init: (opts: {
533
630
  originalIndex: number;
534
631
  router: AnyRouter;
@@ -540,94 +637,63 @@ declare class Route<TParentRoute extends AnyRoute = AnyRoute, TPath extends stri
540
637
  type AnyRootRoute = RootRoute<any, any, any, any>;
541
638
  declare class RouterContext<TRouterContext extends {}> {
542
639
  constructor();
543
- createRootRoute: <TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TContext extends RouteContext = RouteContext>(options?: Omit<RouteOptions<AnyRoute, "__root__", "", {}, TSearchSchema, {}, {}, AnyPathParams, Record<never, string>, Record<never, string>, AnyContext, AnyContext, RouteContext, RouteContext>, "caseSensitive" | "path" | "getParentRoute" | "stringifyParams" | "parseParams" | "id"> | undefined) => RootRoute<TLoader, TSearchSchema, TContext, TRouterContext>;
640
+ createRootRoute: <TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TContext extends RouteContext = RouteContext>(options?: Omit<RouteOptions<AnyRoute, "__root__", "", {}, TSearchSchema, {}, {}, AnyPathParams, AnyPathParams, AnyContext, AnyContext, RouteContext, AnyContext>, "caseSensitive" | "path" | "getParentRoute" | "stringifyParams" | "parseParams" | "id"> | undefined) => RootRoute<TLoader, TSearchSchema, TContext, TRouterContext>;
544
641
  }
545
642
  declare class RootRoute<TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TContext extends RouteContext = RouteContext, TRouterContext extends {} = {}> extends Route<any, '/', '/', string, RootRouteId, TLoader, TSearchSchema, TSearchSchema, {}, {}, TRouterContext, TRouterContext, MergeParamsFromParent<TRouterContext, TContext>, MergeParamsFromParent<TRouterContext, TContext>, TRouterContext, any, any> {
546
- constructor(options?: Omit<RouteOptions<AnyRoute, RootRouteId, '', TLoader, TSearchSchema, {}, {}>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams'>);
643
+ constructor(options?: Omit<RouteOptions<AnyRoute, RootRouteId, '', TLoader, TSearchSchema, {}>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams'>);
547
644
  }
548
- type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed extends RoutePrefix<TParentRoute['fullPath'], TPath> = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : TPrefixed;
645
+ type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : TPrefixed;
549
646
  type RoutePrefix<TPrefix extends string, TPath extends string> = string extends TPath ? RootRouteId : TPath extends string ? TPrefix extends RootRouteId ? TPath extends '/' ? '/' : `/${TrimPath<TPath>}` : `${TPrefix}/${TPath}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}` : never;
550
647
  type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
551
648
  type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft<U> : T extends `/${infer U}` ? TrimPathLeft<U> : T;
552
649
  type TrimPathRight<T extends string> = T extends '/' ? '/' : T extends `${infer U}/` ? TrimPathRight<U> : T;
553
650
 
554
- interface AnyRoutesInfo {
555
- routeTree: AnyRoute;
556
- routeUnion: AnyRoute;
557
- routesById: Record<string, AnyRoute>;
558
- routesByFullPath: Record<string, AnyRoute>;
559
- routeIds: any;
560
- routePaths: any;
561
- routeIntersection: AnyRoute;
562
- fullSearchSchema: Record<string, any>;
563
- allParams: Record<string, any>;
564
- }
565
- interface DefaultRoutesInfo {
566
- routeTree: AnyRoute;
567
- routeUnion: AnyRoute;
568
- routesById: Record<string, Route>;
569
- routesByFullPath: Record<string, Route>;
570
- routeIds: string;
571
- routePaths: string;
572
- routeIntersection: AnyRoute;
573
- fullSearchSchema: AnySearchSchema;
574
- allParams: AnyPathParams;
575
- }
576
- interface RoutesInfo<TRouteTree extends AnyRoute = Route> extends RoutesInfoInner<TRouteTree, ParseRoute<TRouteTree>> {
651
+ interface FileRoutesByPath {
577
652
  }
578
- interface RoutesInfoInner<TRouteTree extends AnyRoute, TRouteUnion extends AnyRoute = Route, TRoutesById = {
579
- '/': TRouteUnion;
580
- } & {
581
- [TRoute in TRouteUnion as TRoute['id']]: TRoute;
582
- }, TRoutesByFullPath = {
583
- '/': TRouteUnion;
584
- } & {
585
- [TRoute in TRouteUnion as TRoute['fullPath'] extends RootRouteId ? never : string extends TRoute['fullPath'] ? never : `${TRoute['fullPath']}/` extends keyof TRoutesById ? never : TRoute['fullPath'] extends `${infer Trimmed}/` ? Trimmed : TRoute['fullPath']]: TRoute;
586
- }> {
587
- routeTree: TRouteTree;
588
- routeUnion: TRouteUnion;
589
- routesById: TRoutesById;
590
- routesByFullPath: TRoutesByFullPath;
591
- routeIds: keyof TRoutesById;
592
- routePaths: keyof TRoutesByFullPath;
593
- routeIntersection: Route<TRouteUnion['__types']['parentRoute'], // TParentRoute,
594
- TRouteUnion['__types']['path'], // TPath,
595
- TRouteUnion['__types']['fullPath'], // TFullPath,
596
- TRouteUnion['__types']['customId'], // TCustomId,
597
- TRouteUnion['__types']['id'], // TId,
598
- TRouteUnion['__types']['loader'], // TId,
599
- // TId,
600
- MergeUnion<TRouteUnion['__types']['searchSchema']> & {}, // TSearchSchema,
601
- // TSearchSchema,
602
- MergeUnion<TRouteUnion['__types']['fullSearchSchema']> & {}, // TFullSearchSchema,
603
- MergeUnion<TRouteUnion['__types']['params']>, // TParams,
604
- MergeUnion<TRouteUnion['__types']['allParams']>, // TAllParams,
605
- MergeUnion<TRouteUnion['__types']['parentContext']>, // TParentContext,
606
- MergeUnion<TRouteUnion['__types']['allParentContext']>, // TAllParentContext,
607
- // TAllParentContext,
608
- MergeUnion<TRouteUnion['__types']['routeContext']> & {}, // TRouteContext,
609
- // TRouteContext,
610
- MergeUnion<TRouteUnion['__types']['context']> & {}, // TContext,
611
- // TContext,
612
- MergeUnion<TRouteUnion['__types']['routerContext']> & {}, // TRouterContext,
613
- TRouteUnion['__types']['children'], // TChildren,
614
- TRouteUnion['__types']['routesInfo']>;
615
- fullSearchSchema: Partial<MergeUnion<TRouteUnion['__types']['fullSearchSchema']>>;
616
- allParams: Partial<MergeUnion<TRouteUnion['__types']['allParams']>>;
653
+ type Replace<S extends string, From extends string, To extends string> = S extends `${infer Start}${From}${infer Rest}` ? `${Start}${To}${Replace<Rest, From, To>}` : S;
654
+ type TrimLeft<T extends string, S extends string> = T extends `${S}${infer U}` ? U : T;
655
+ type TrimRight<T extends string, S extends string> = T extends `${infer U}${S}` ? U : T;
656
+ type Trim<T extends string, S extends string> = TrimLeft<TrimRight<T, S>, S>;
657
+ type ResolveFilePath<TParentRoute extends AnyRoute, TFilePath extends string> = TParentRoute['id'] extends RootRouteId ? TrimPathLeft<TFilePath> : Replace<TrimPathLeft<TFilePath>, TrimPathLeft<TParentRoute['__types']['customId']>, ''>;
658
+ type FileRoutePath<TParentRoute extends AnyRoute, TFilePath extends string> = ResolveFilePath<TParentRoute, TFilePath> extends `_${infer _}` ? string : ResolveFilePath<TParentRoute, TFilePath>;
659
+ declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends string = TFilePath, TPath extends string = FileRoutePath<TParentRoute, TFilePath>, TFullPath extends string = ResolveFullPath<TParentRoute, TPath>> {
660
+ path: TFilePath;
661
+ constructor(path: TFilePath);
662
+ createRoute: <TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends (TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> extends infer T_1 ? T_1 extends TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> ? T_1 extends `$${infer L}` ? L : never : never : never) extends never ? AnyPathParams : Record<TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> extends infer T_1 ? T_1 extends TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> ? T_1 extends `$${infer L}` ? L : never : never : never, any> = (TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> extends infer T_1 ? T_1 extends TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> ? T_1 extends `$${infer L}` ? L : never : never : never) extends never ? AnyPathParams : Record<TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> extends infer T_1 ? T_1 extends TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> ? T_1 extends `$${infer L}` ? L : never : never : never, string>, TAllParams extends IsAny<TParentRoute["__types"]["allParams"], TParams, TParentRoute["__types"]["allParams"] & TParams> = IsAny<TParentRoute["__types"]["allParams"], TParams, TParentRoute["__types"]["allParams"] & TParams>, TParentContext extends TParentRoute["__types"]["routeContext"] = TParentRoute["__types"]["routeContext"], TAllParentContext extends TParentRoute["__types"]["context"] = TParentRoute["__types"]["context"], TRouteContext extends RouteContext = RouteContext, TContext extends IsAny<TParentRoute["__types"]["context"], TRouteContext, TParentRoute["__types"]["context"] & TRouteContext> = IsAny<TParentRoute["__types"]["context"], TRouteContext, TParentRoute["__types"]["context"] & TRouteContext>, TRouterContext extends AnyContext = AnyContext, TChildren extends unknown = unknown, TRoutesInfo extends DefaultRoutesInfo = DefaultRoutesInfo>(options: Omit<RouteOptions<TParentRoute, string, string, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext>, "path" | "getParentRoute" | "id"> & {
663
+ meta?: RouteMeta | undefined;
664
+ } & {
665
+ key?: false | GetKeyFn<TFullSearchSchema, TAllParams> | null | undefined;
666
+ caseSensitive?: boolean | undefined;
667
+ wrapInSuspense?: boolean | undefined;
668
+ component?: ((props: RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>) => unknown) | undefined;
669
+ errorComponent?: ((props: {
670
+ error: unknown;
671
+ } & Partial<RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>>) => unknown) | undefined;
672
+ pendingComponent?: ((props: RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>) => unknown) | undefined;
673
+ preSearchFilters?: SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
674
+ postSearchFilters?: SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
675
+ preloadMaxAge?: number | undefined;
676
+ maxAge?: number | undefined;
677
+ gcMaxAge?: number | undefined;
678
+ beforeLoad?: ((opts: LoaderContext<TSearchSchema, TFullSearchSchema, TAllParams, NoInfer<TRouteContext>, TContext>) => void | Promise<void>) | undefined;
679
+ onBeforeLoadError?: ((err: any) => void) | undefined;
680
+ onValidateSearchError?: ((err: any) => void) | undefined;
681
+ onParseParamsError?: ((err: any) => void) | undefined;
682
+ onLoadError?: ((err: any) => void) | undefined;
683
+ onError?: ((err: any) => void) | undefined;
684
+ onLoaded?: ((matchContext: {
685
+ params: TAllParams;
686
+ search: TFullSearchSchema;
687
+ }) => void | ((match: {
688
+ params: TAllParams;
689
+ search: TFullSearchSchema;
690
+ }) => void) | undefined) | undefined;
691
+ onTransition?: ((match: {
692
+ params: TAllParams;
693
+ search: TFullSearchSchema;
694
+ }) => void) | undefined;
695
+ }) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext, TRouterContext, TChildren, TRoutesInfo>;
617
696
  }
618
- type ParseRoute<TRouteTree> = TRouteTree extends AnyRoute ? TRouteTree | ParseRouteChildren<TRouteTree> : never;
619
- type ParseRouteChildren<TRouteTree> = TRouteTree extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, infer TChildren, any> ? unknown extends TChildren ? never : TChildren extends AnyRoute[] ? Values<{
620
- [TId in TChildren[number]['id']]: ParseRouteChild<TChildren[number], TId>;
621
- }> : never : never;
622
- type ParseRouteChild<TRoute, TId> = TRoute extends AnyRoute ? ParseRoute<TRoute> : never;
623
- type RoutesById<TRoutesInfo extends AnyRoutesInfo> = {
624
- [K in keyof TRoutesInfo['routesById']]: TRoutesInfo['routesById'][K];
625
- };
626
- type RouteById<TRoutesInfo extends AnyRoutesInfo, TId> = TId extends keyof TRoutesInfo['routesById'] ? IsAny<TRoutesInfo['routesById'][TId]['id'], Route, TRoutesInfo['routesById'][TId]> : never;
627
- type RoutesByPath<TRoutesInfo extends AnyRoutesInfo> = {
628
- [K in keyof TRoutesInfo['routesByFullPath']]: TRoutesInfo['routesByFullPath'][K];
629
- };
630
- type RouteByPath<TRoutesInfo extends AnyRoutesInfo, TPath> = TPath extends keyof TRoutesInfo['routesByFullPath'] ? IsAny<TRoutesInfo['routesByFullPath'][TPath]['id'], Route, TRoutesInfo['routesByFullPath'][TPath]> : never;
631
697
 
632
698
  type LinkInfo = {
633
699
  type: 'external';
@@ -645,7 +711,9 @@ type LinkInfo = {
645
711
  };
646
712
  type CleanPath<T extends string> = T extends `${infer L}//${infer R}` ? CleanPath<`${CleanPath<L>}/${CleanPath<R>}`> : T extends `${infer L}//` ? `${CleanPath<L>}/` : T extends `//${infer L}` ? `/${CleanPath<L>}` : T;
647
713
  type Split<S, TIncludeTrailingSlash = true> = S extends unknown ? string extends S ? string[] : S extends string ? CleanPath<S> extends '' ? [] : TIncludeTrailingSlash extends true ? CleanPath<S> extends `${infer T}/` ? [...Split<T>, '/'] : CleanPath<S> extends `/${infer U}` ? Split<U> : CleanPath<S> extends `${infer T}/${infer U}` ? [...Split<T>, ...Split<U>] : [S] : CleanPath<S> extends `${infer T}/${infer U}` ? [...Split<T>, ...Split<U>] : S extends string ? [S] : never : never : never;
648
- type ParsePathParams<T extends string> = Split<T>[number] extends infer U ? U extends `$${infer V}` ? V : never : never;
714
+ type ParsePathParams<T extends string> = keyof {
715
+ [K in Trim<Split<T>[number], '_'> as K extends `$${infer L}` ? L : never]: K;
716
+ };
649
717
  type Join<T, Delimiter extends string = '/'> = T extends [] ? '' : T extends [infer L extends string] ? L : T extends [infer L extends string, ...infer Tail extends [...string[]]] ? CleanPath<`${L}${Delimiter}${Join<Tail>}`> : never;
650
718
  type Last<T extends any[]> = T extends [...infer _, infer L] ? L : never;
651
719
  type RelativeToPathAutoComplete<AllPaths extends string, TFrom extends string, TTo extends string, SplitPaths extends string[] = Split<AllPaths, false>> = TTo extends `..${infer _}` ? SplitPaths extends [
@@ -731,50 +799,9 @@ declare function matchByPath(basepath: string, from: string, matchLocation: Pick
731
799
  declare function encode(obj: any, pfx?: string): string;
732
800
  declare function decode(str: any): {};
733
801
 
734
- interface FileRoutesByPath {
735
- }
736
- declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TPath extends string = Last<Split<TFilePath>>, TCustomId extends string = TPath extends `_${infer T}` ? T : string> {
737
- path: TFilePath;
738
- constructor(path: TFilePath);
739
- createRoute: <TFullPath extends ResolveFullPath<TParentRoute, TPath, string extends TPath ? "__root__" : TPath extends string ? TParentRoute["fullPath"] extends infer T ? T extends TParentRoute["fullPath"] ? T extends "__root__" ? TPath extends "/" ? "/" : `/${TrimPath<TPath>}` : `${T}/${TPath}` extends "/" ? "/" : `/${TrimPathLeft<`${TrimPathRight<T>}/${TrimPath<TPath>}`>}` : never : never : never> = ResolveFullPath<TParentRoute, TPath, string extends TPath ? "__root__" : TPath extends string ? TParentRoute["fullPath"] extends infer T ? T extends TParentRoute["fullPath"] ? T extends "__root__" ? TPath extends "/" ? "/" : `/${TrimPath<TPath>}` : `${T}/${TPath}` extends "/" ? "/" : `/${TrimPathLeft<`${TrimPathRight<T>}/${TrimPath<TPath>}`>}` : never : never : never>, TId extends ResolveId<TParentRoute, TCustomId, TPath> = ResolveId<TParentRoute, TCustomId, TPath>, TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends Record<ParsePathParams<TPath>, any> = Record<ParsePathParams<TPath>, string>, TAllParams extends IsAny<TParentRoute["__types"]["allParams"], TParams, TParentRoute["__types"]["allParams"] & TParams> = IsAny<TParentRoute["__types"]["allParams"], TParams, TParentRoute["__types"]["allParams"] & TParams>, TParentContext extends TParentRoute["__types"]["routeContext"] = TParentRoute["__types"]["routeContext"], TAllParentContext extends TParentRoute["__types"]["context"] = TParentRoute["__types"]["context"], TRouteContext extends RouteContext = RouteContext, TContext extends IsAny<TParentRoute["__types"]["context"], TRouteContext, TParentRoute["__types"]["context"] & TRouteContext> = IsAny<TParentRoute["__types"]["context"], TRouteContext, TParentRoute["__types"]["context"] & TRouteContext>, TRouterContext extends AnyContext = AnyContext, TChildren extends unknown = unknown, TRoutesInfo extends DefaultRoutesInfo = DefaultRoutesInfo>(options: Omit<RouteOptions<TParentRoute, TCustomId, TPath, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParentRoute["__types"]["allParams"], TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext>, "path" | "getParentRoute" | "id"> & {
740
- meta?: RouteMeta | undefined;
741
- } & {
742
- key?: false | GetKeyFn<TFullSearchSchema, TAllParams> | null | undefined;
743
- caseSensitive?: boolean | undefined;
744
- wrapInSuspense?: boolean | undefined;
745
- component?: ((props: RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>) => unknown) | undefined;
746
- errorComponent?: ((props: {
747
- error: unknown;
748
- } & Partial<RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>>) => unknown) | undefined;
749
- pendingComponent?: ((props: RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>) => unknown) | undefined;
750
- preSearchFilters?: SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
751
- postSearchFilters?: SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
752
- preloadMaxAge?: number | undefined;
753
- maxAge?: number | undefined;
754
- gcMaxAge?: number | undefined;
755
- beforeLoad?: ((opts: LoaderContext<TSearchSchema, TFullSearchSchema, TAllParams, NoInfer<TRouteContext>, TContext>) => void | Promise<void>) | undefined;
756
- onBeforeLoadError?: ((err: any) => void) | undefined;
757
- onValidateSearchError?: ((err: any) => void) | undefined;
758
- onParseParamsError?: ((err: any) => void) | undefined;
759
- onLoadError?: ((err: any) => void) | undefined;
760
- onError?: ((err: any) => void) | undefined;
761
- onLoaded?: ((matchContext: {
762
- params: TAllParams;
763
- search: TFullSearchSchema;
764
- }) => void | ((match: {
765
- params: TAllParams;
766
- search: TFullSearchSchema;
767
- }) => void) | undefined) | undefined;
768
- onTransition?: ((match: {
769
- params: TAllParams;
770
- search: TFullSearchSchema;
771
- }) => void) | undefined;
772
- }) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext, TRouterContext, TChildren, TRoutesInfo>;
773
- }
774
-
775
802
  declare const defaultParseSearch: (searchStr: string) => AnySearchSchema;
776
803
  declare const defaultStringifySearch: (search: Record<string, any>) => string;
777
804
  declare function parseSearchWith(parser: (str: string) => any): (searchStr: string) => AnySearchSchema;
778
805
  declare function stringifySearchWith(stringify: (search: any) => string): (search: Record<string, any>) => string;
779
806
 
780
- export { ActiveOptions, AnyContext, AnyPathParams, AnyRedirect, AnyRootRoute, AnyRoute, AnyRouteMatch, AnyRouteProps, AnyRouteWithRouterContext, AnyRouter, AnyRoutesInfo, AnySearchSchema, BaseRouteOptions, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, ComponentFromRoute, ComponentPropsFromRoute, DeepAwaited, DefaultRoutesInfo, DefinedPathParamWarning, DehydratedRouter, DehydratedRouterState, Expand, FileRoute, FileRoutesByPath, FromLocation, GetKeyFn, HydrationCtx, InferFullSearchSchema, IsAny, IsAnyBoolean, IsKnown, Join, Last, LinkInfo, LinkOptions, ListenerFn, LoaderContext, LoaderFn, LocationState, MatchLocation, MatchRouteOptions, MergeParamsFromParent, MergeUnion, MetaOptions, NavigateOptions, NoInfer, ParamsFallback, ParentParams, ParseParamsFn, ParseParamsObj, ParseParamsOption, ParsePathParams, ParseRoute, ParseRouteChild, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamError, PathParamMask, PathParamOptions, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, PreloadableObj, Redirect, Register, RegisterRouteComponent, RegisterRouteErrorComponent, RegisteredRouteComponent, RegisteredRouteErrorComponent, RegisteredRouter, RegisteredRouterPair, RegisteredRoutesInfo, RelativeToPathAutoComplete, ResolveFullPath, ResolveFullSearchSchema, ResolveId, ResolveRelativePath, RootRoute, RootRouteId, Route, RouteById, RouteByPath, RouteContext, RouteLoaderFromRoute, RouteMatch, RouteMeta, RouteOptions, RoutePathOptions, RoutePathOptionsIntersection, RouteProps, Router, RouterConstructorOptions, RouterContext, RouterContextOptions, RouterHistory, RouterLocation, RouterOptions, RouterState, RoutesById, RoutesByPath, RoutesInfo, RoutesInfoInner, SearchFilter, SearchParamError, SearchParamOptions, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, StreamedPromise, Timeout, ToIdOption, ToOptions, ToPathOption, TrimPath, TrimPathLeft, TrimPathRight, UnionToIntersection, UnloaderFn, UpdatableRouteOptions, Updater, UseLoaderResult, UseLoaderResultPromise, ValueKeys, Values, cleanPath, componentTypes, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, isPlainObject, isRedirect, joinPaths, last, lazyFn, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight };
807
+ export { ActiveOptions, AnyContext, AnyPathParams, AnyRedirect, AnyRootRoute, AnyRoute, AnyRouteMatch, AnyRouteProps, AnyRouteWithRouterContext, AnyRouter, AnyRoutesInfo, AnySearchSchema, BaseRouteOptions, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, CleanPath, ComponentFromRoute, ComponentPropsFromRoute, DeepAwaited, DefaultRoutesInfo, DefinedPathParamWarning, DehydratedRouter, DehydratedRouterState, Expand, FileRoute, FileRoutePath, FileRoutesByPath, FromLocation, GetKeyFn, HydrationCtx, InferFullSearchSchema, IsAny, IsAnyBoolean, IsKnown, Join, Last, LinkInfo, LinkOptions, ListenerFn, LoaderContext, LoaderFn, LocationState, MatchLocation, MatchRouteOptions, MergeParamsFromParent, MergeUnion, MetaOptions, NavigateOptions, NoInfer, ParamsFallback, ParentParams, ParseParamsFn, ParseParamsObj, ParseParamsOption, ParsePathParams, ParseRoute, ParseRouteChild, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamError, PathParamMask, PathParamOptions, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, PreloadableObj, Redirect, Register, RegisterRouteComponent, RegisterRouteErrorComponent, RegisteredRouteComponent, RegisteredRouteErrorComponent, RegisteredRouter, RegisteredRouterPair, RegisteredRoutesInfo, RelativeToPathAutoComplete, ResolveFilePath, ResolveFullPath, ResolveFullSearchSchema, ResolveId, ResolveRelativePath, RootRoute, RootRouteId, Route, RouteById, RouteByPath, RouteConstraints, RouteContext, RouteLoaderFromRoute, RouteMatch, RouteMeta, RouteOptions, RoutePathOptions, RoutePathOptionsIntersection, RouteProps, Router, RouterConstructorOptions, RouterContext, RouterContextOptions, RouterHistory, RouterLocation, RouterOptions, RouterState, RoutesById, RoutesByPath, RoutesInfo, RoutesInfoInner, SearchFilter, SearchParamError, SearchParamOptions, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, StreamedPromise, Timeout, ToIdOption, ToOptions, ToPathOption, Trim, TrimLeft, TrimPath, TrimPathLeft, TrimPathRight, TrimRight, UnionToIntersection, UnloaderFn, UpdatableRouteOptions, Updater, UseLoaderResult, UseLoaderResultPromise, ValueKeys, Values, cleanPath, componentTypes, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, isPlainObject, isRedirect, joinPaths, last, lazyFn, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight };
@@ -1038,6 +1038,7 @@
1038
1038
  });
1039
1039
  let routeCursor = foundRoute || this.routesById['__root__'];
1040
1040
  let matchedRoutes = [routeCursor];
1041
+ // let includingLayouts = true
1041
1042
  while (routeCursor?.parentRoute) {
1042
1043
  routeCursor = routeCursor.parentRoute;
1043
1044
  if (routeCursor) matchedRoutes.unshift(routeCursor);