@kitbag/router 0.4.2 → 0.5.1

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.
@@ -55,13 +55,6 @@ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
55
55
  */
56
56
  export declare type AddAfterRouteHook = (hook: AfterRouteHook) => RouteHookRemove;
57
57
 
58
- /**
59
- * Adds a hook that is called after a route change. Returns a function to remove the hook.
60
- * @param hook - {@link AfterRouteHook} The hook function to add.
61
- * @returns {RouteHookRemove} A function that removes the added hook.
62
- */
63
- declare type AddAfterRouteHook_2 = (hook: AfterRouteHook_2) => RouteHookRemove_2
64
-
65
58
  /**
66
59
  * Adds a hook that is called before a route change. Returns a function to remove the hook.
67
60
  * @param hook - {@link BeforeRouteHook} The hook function to add.
@@ -69,13 +62,6 @@ declare type AddAfterRouteHook_2 = (hook: AfterRouteHook_2) => RouteHookRemove_2
69
62
  */
70
63
  export declare type AddBeforeRouteHook = (hook: BeforeRouteHook) => RouteHookRemove;
71
64
 
72
- /**
73
- * Adds a hook that is called before a route change. Returns a function to remove the hook.
74
- * @param hook - {@link BeforeRouteHook} The hook function to add.
75
- * @returns {RouteHookRemove} A function that removes the added hook.
76
- */
77
- declare type AddBeforeRouteHook_2 = (hook: BeforeRouteHook_2) => RouteHookRemove_2
78
-
79
65
  /**
80
66
  * Represents a function called after a route change has occurred.
81
67
  * @param to - {@link ResolvedRoute} The resolved route the router has navigated to.
@@ -84,24 +70,11 @@ declare type AddBeforeRouteHook_2 = (hook: BeforeRouteHook_2) => RouteHookRemove
84
70
  */
85
71
  export declare type AfterRouteHook = (to: ResolvedRoute, context: AfterRouteHookContext) => MaybePromise<void>;
86
72
 
87
- /**
88
- * Represents a function called after a route change has occurred.
89
- * @param to - {@link ResolvedRoute} The resolved route the router has navigated to.
90
- * @param context - {@link AfterRouteHookContext} The context providing functions and state for the routing operation.
91
- * @returns Possibly a promise that resolves when the hook's logic has completed.
92
- */
93
- declare type AfterRouteHook_2 = (to: ResolvedRoute_2, context: AfterRouteHookContext_2) => MaybePromise_2<void>
94
-
95
73
  /**
96
74
  * Context provided to route hooks, containing context of previous route and functions for triggering rejections and push/replace to another route.
97
75
  */
98
76
  declare type AfterRouteHookContext = RouteHookContext;
99
77
 
100
- /**
101
- * Context provided to route hooks, containing context of previous route and functions for triggering rejections and push/replace to another route.
102
- */
103
- declare type AfterRouteHookContext_2 = RouteHookContext_2
104
-
105
78
  /**
106
79
  * Enumerates the lifecycle events for after route hooks.
107
80
  */
@@ -115,34 +88,6 @@ export declare type AfterRouteHookResponse<TRoutes extends Routes> = RouteHookSu
115
88
 
116
89
  declare type AllPropertiesAreOptional<T> = Record<string, unknown> extends T ? true : IsEmptyObject<OnlyRequiredProperties<T>>;
117
90
 
118
- declare type AllPropertiesAreOptional_2<T> = Record<string, unknown> extends T
119
- ? true
120
- : IsEmptyObject_2<OnlyRequiredProperties_2<T>>
121
-
122
- declare type BaseResolvedRoute = Route & {
123
- path: {
124
- params: Record<string, unknown>;
125
- };
126
- query: {
127
- params: Record<string, unknown>;
128
- };
129
- };
130
-
131
- declare type BaseResolvedRoute_2 = Route_2 & { path: { params: Record<string, unknown> }, query: { params: Record<string, unknown> } }
132
-
133
- declare type BaseRoute = {
134
- key: string;
135
- disabled: false;
136
- path: {
137
- params: Record<string, unknown>;
138
- };
139
- query: {
140
- params: Record<string, unknown>;
141
- };
142
- };
143
-
144
- declare type BaseRoute_2 = { key: string, disabled: false, path: { params: Record<string, unknown> }, query: { params: Record<string, unknown> } }
145
-
146
91
  /**
147
92
  * Represents a function called before a route change, potentially altering the routing operation.
148
93
  * @param to - {@link ResolvedRoute} The resolved route the router is navigating to.
@@ -151,14 +96,6 @@ declare type BaseRoute_2 = { key: string, disabled: false, path: { params: Recor
151
96
  */
152
97
  export declare type BeforeRouteHook = (to: ResolvedRoute, context: BeforeRouteHookContext) => MaybePromise<void>;
153
98
 
154
- /**
155
- * Represents a function called before a route change, potentially altering the routing operation.
156
- * @param to - {@link ResolvedRoute} The resolved route the router is navigating to.
157
- * @param context - {@link BeforeRouteHookContext} The context providing functions and state for the routing operation.
158
- * @returns Possibly a promise that resolves when the hook's logic has completed.
159
- */
160
- declare type BeforeRouteHook_2 = (to: ResolvedRoute_2, context: BeforeRouteHookContext_2) => MaybePromise_2<void>
161
-
162
99
  /**
163
100
  * Context provided to route hooks, containing context of previous route and functions for triggering rejections, push/replace to another route,
164
101
  * as well as aborting current route change.
@@ -167,14 +104,6 @@ declare type BeforeRouteHookContext = RouteHookContext & {
167
104
  abort: RouteHookAbort;
168
105
  };
169
106
 
170
- /**
171
- * Context provided to route hooks, containing context of previous route and functions for triggering rejections, push/replace to another route,
172
- * as well as aborting current route change.
173
- */
174
- declare type BeforeRouteHookContext_2 = RouteHookContext_2 & {
175
- abort: RouteHookAbort_2,
176
- }
177
-
178
107
  /**
179
108
  * Enumerates the lifecycle events for before route hooks.
180
109
  */
@@ -188,12 +117,8 @@ export declare type BeforeRouteHookResponse<TRoutes extends Routes> = RouteHookS
188
117
 
189
118
  declare const builtInRejections: ['NotFound'];
190
119
 
191
- declare const builtInRejections_2: ['NotFound'] = ['NotFound'];
192
-
193
120
  declare type BuiltInRejectionType = typeof builtInRejections[number];
194
121
 
195
- declare type BuiltInRejectionType_2 = typeof builtInRejections_2[number]
196
-
197
122
  /**
198
123
  * Represents properties for child routes, including required component, name, and path.
199
124
  */
@@ -220,33 +145,7 @@ export declare type ChildRouteProps = (WithComponent | WithComponents) & WithHoo
220
145
  meta?: RouteMeta;
221
146
  };
222
147
 
223
- /**
224
- * Represents properties for child routes, including required component, name, and path.
225
- */
226
- declare type ChildRouteProps_2 = (WithComponent_2 | WithComponents_2) & WithHooks_2 & {
227
- /**
228
- * Name for route, used to create route keys and in navigation.
229
- */
230
- name: string,
231
- /**
232
- * Children routes, expected type comes from `createRoutes()`
233
- */
234
- disabled?: boolean,
235
- /**
236
- * Path part of URL.
237
- */
238
- path: string | Path_2,
239
- /**
240
- * Query (aka search) part of URL.
241
- */
242
- query?: string | Query_2,
243
- /**
244
- * Represents additional metadata associated with a route, customizable via declaration merging.
245
- */
246
- meta?: RouteMeta_2,
247
- }
248
-
249
- declare type CombineName<TParentName extends string | undefined, TChildName extends string | undefined> = TParentName extends string ? TChildName extends string ? `${TParentName}.${TChildName}` : TParentName : TChildName extends string ? TChildName : '';
148
+ declare type CombineName<TParentName extends string | undefined, TChildName extends string | undefined> = StringHasValue<TParentName> extends true ? StringHasValue<TChildName> extends true ? `${TParentName}.${TChildName}` : TParentName : StringHasValue<TChildName> extends true ? TChildName : '';
250
149
 
251
150
  declare type CombinePath<TParent extends Path, TChild extends Path> = ToPath<TParent> extends {
252
151
  path: infer TParentPath extends string;
@@ -290,6 +189,8 @@ export declare function component<TComponent extends Component>(component: TComp
290
189
 
291
190
  declare type Constructor = new (...args: any) => any;
292
191
 
192
+ export declare function createExternalRoutes<const TRoutes extends ExternalRouteProps[]>(routes: TRoutes): FlattenRoutes<TRoutes>;
193
+
293
194
  export declare function createParam<TParam extends ParamWithDefault>(param: TParam): TParam;
294
195
 
295
196
  export declare function createParam<TParam extends Param>(param: TParam): ParamGetSet<ExtractParamType<TParam>>;
@@ -321,6 +222,8 @@ export declare function createParam<TParam extends Param>(param: TParam, default
321
222
  */
322
223
  export declare function createRouter<const T extends Routes>(routes: T, options?: RouterOptions): Router<T>;
323
224
 
225
+ export declare function createRouter<const T extends Routes>(arrayOfRoutes: T[], options?: RouterOptions): Router<T>;
226
+
324
227
  /**
325
228
  * Creates an array of routes from a defined set of route properties, handling hierarchical route combinations.
326
229
  * This function also validates for duplicate parameter keys across the combined routes.
@@ -328,7 +231,7 @@ export declare function createRouter<const T extends Routes>(routes: T, options?
328
231
  * @param routesProps - An array of route properties used to configure and create routes.
329
232
  * @returns An array of fully configured Route instances.
330
233
  */
331
- export declare function createRoutes<const TRoutes extends Readonly<RouteProps[]>>(routes: TRoutes): FlattenRoutes<TRoutes>;
234
+ export declare function createRoutes<const TRoutes extends RouteProps[]>(routes: TRoutes): FlattenRoutes<TRoutes>;
332
235
 
333
236
  /**
334
237
  * An error thrown when duplicate parameters are detected in a route when creating a router.
@@ -343,62 +246,82 @@ export declare class DuplicateParamsError extends Error {
343
246
  constructor(paramName: string);
344
247
  }
345
248
 
346
- /**
347
- * Extracts the parameter name from a string, handling optional parameters denoted by a leading '?'.
348
- * @template TParam - The string from which to extract the parameter name.
349
- * @returns The extracted parameter name, or never if the parameter string is empty.
350
- */
351
- export declare type ExtractParamName<TParam extends string> = TParam extends `?${infer Param}` ? Param extends '' ? never : Param : TParam extends '' ? never : TParam;
249
+ declare type ExternalRouteChildProps = {
250
+ /**
251
+ * Represents the host for this route. Used for external routes.
252
+ */
253
+ host?: string;
254
+ /**
255
+ * Name for route, used to create route keys and in navigation.
256
+ */
257
+ name: string;
258
+ /**
259
+ * Children routes, expected type comes from `createRoutes()`
260
+ */
261
+ disabled?: boolean;
262
+ /**
263
+ * Path part of URL.
264
+ */
265
+ path: string | Path;
266
+ /**
267
+ * Query (aka search) part of URL.
268
+ */
269
+ query?: string | Query;
270
+ /**
271
+ * Children routes, cannot have a value for a child route.
272
+ */
273
+ children?: never;
274
+ };
275
+
276
+ declare type ExternalRouteParentProps = {
277
+ /**
278
+ * Represents the host for this route. Used for external routes.
279
+ */
280
+ host?: string;
281
+ /**
282
+ * Name for route, used to create route keys and in navigation.
283
+ */
284
+ name?: string;
285
+ /**
286
+ * Disabled routes will not ever match but can still provide physical structure, nested children behave normally.
287
+ */
288
+ disabled?: boolean;
289
+ /**
290
+ * Path part of URL.
291
+ */
292
+ path: string | Path;
293
+ /**
294
+ * Query (aka search) part of URL.
295
+ */
296
+ query?: string | Query;
297
+ /**
298
+ * Children routes, expected type comes from `createExternalRoutes()`
299
+ */
300
+ children: ExternalRoutes;
301
+ };
302
+
303
+ declare type ExternalRouteProps = ExternalRouteParentProps | ExternalRouteChildProps;
304
+
305
+ declare type ExternalRoutes = Route<string, '', Path, Query, boolean>[];
352
306
 
353
307
  /**
354
308
  * Extracts the parameter name from a string, handling optional parameters denoted by a leading '?'.
355
309
  * @template TParam - The string from which to extract the parameter name.
356
310
  * @returns The extracted parameter name, or never if the parameter string is empty.
357
311
  */
358
- declare type ExtractParamName_2<
359
- TParam extends string
360
- > = TParam extends `?${infer Param}`
361
- ? Param extends ''
362
- ? never
363
- : Param
364
- : TParam extends ''
365
- ? never
366
- : TParam
312
+ export declare type ExtractParamName<TParam extends PropertyKey> = TParam extends `?${infer Param}` ? Param extends '' ? never : Param : TParam extends '' ? never : TParam;
367
313
 
368
314
  declare type ExtractParamsFromPathString<TPath extends string, TParams extends Record<string, Param | undefined> = Record<never, never>> = TPath extends `${string}${ParamStart}${infer Param}${ParamEnd}${infer Rest}` ? MergeParams<{
369
- [P in ExtractParamName<Param>]: ExtractPathParamType<Param, TParams>;
315
+ [P in Param]: ExtractPathParamType<Param, TParams>;
370
316
  }, ExtractParamsFromPathString<Rest, TParams>> : Record<never, never>;
371
317
 
372
- declare type ExtractParamsFromPathString_2<
373
- TPath extends string,
374
- TParams extends Record<string, Param_2 | undefined> = Record<never, never>
375
- > = TPath extends `${string}${ParamStart_2}${infer Param}${ParamEnd_2}${infer Rest}`
376
- ? MergeParams_2<{ [P in ExtractParamName_2<Param>]: ExtractPathParamType_2<Param, TParams> }, ExtractParamsFromPathString_2<Rest, TParams>>
377
- : Record<never, never>
378
-
379
- /**
380
- * Extracts the actual type from a parameter type, handling getters, setters, and potential undefined values.
381
- * This type also is responsible for narrowing possibly undefined values when the param has a default value.
382
- * @template TParam - The parameter type.
383
- * @returns The extracted type, or 'string' as a fallback.
384
- */
385
- export declare type ExtractParamType<TParam extends Param> = TParam extends ParamGetSet<infer Type> ? TParam extends IsOptionalParam ? TParam extends ParamWithDefault ? Type : Type | undefined : Type : TParam extends ParamGetter ? ReturnType<TParam> : string;
386
-
387
318
  /**
388
319
  * Extracts the actual type from a parameter type, handling getters, setters, and potential undefined values.
389
320
  * This type also is responsible for narrowing possibly undefined values when the param has a default value.
390
321
  * @template TParam - The parameter type.
391
322
  * @returns The extracted type, or 'string' as a fallback.
392
323
  */
393
- declare type ExtractParamType_2<TParam extends Param_2> = TParam extends ParamGetSet_2<infer Type>
394
- ? TParam extends IsOptionalParam_2
395
- ? TParam extends ParamWithDefault_2
396
- ? Type
397
- : Type | undefined
398
- : Type
399
- : TParam extends ParamGetter_2
400
- ? ReturnType<TParam>
401
- : string
324
+ export declare type ExtractParamType<TParam extends Param, TParamKey extends PropertyKey = string> = TParam extends ParamGetSet<infer Type> ? TParamKey extends `?${string}` ? TParam extends ParamWithDefault ? Type : Type | undefined : Type : TParam extends ParamGetter ? TParamKey extends `?${string}` ? ReturnType<TParam> | undefined : ReturnType<TParam> : TParamKey extends `?${string}` ? string | undefined : string;
402
325
 
403
326
  /**
404
327
  * Transforms a record of parameter types into a type with optional properties where the original type allows undefined.
@@ -406,43 +329,14 @@ declare type ExtractParamType_2<TParam extends Param_2> = TParam extends ParamGe
406
329
  * @returns A new type with the appropriate properties marked as optional.
407
330
  */
408
331
  export declare type ExtractParamTypes<TParams extends Record<string, Param>> = Identity<MakeOptional<{
409
- [K in keyof TParams]: ExtractParamType<TParams[K]>;
332
+ [K in keyof TParams as ExtractParamName<K>]: ExtractParamType<TParams[K], K>;
410
333
  }>>;
411
334
 
412
- /**
413
- * Transforms a record of parameter types into a type with optional properties where the original type allows undefined.
414
- * @template TParams - The record of parameter types, possibly including undefined.
415
- * @returns A new type with the appropriate properties marked as optional.
416
- */
417
- declare type ExtractParamTypes_2<TParams extends Record<string, Param_2>> = Identity_2<MakeOptional_2<{
418
- [K in keyof TParams]: ExtractParamType_2<TParams[K]>
419
- }>>
420
-
421
335
  declare type ExtractParamTypesWithoutLosingOptional<TParams extends Record<string, Param>> = Identity<MakeOptional<{
422
- [K in keyof TParams]: ExtractParamTypeWithoutLosingOptional<TParams[K]>;
336
+ [K in keyof TParams as ExtractParamName<K>]: ExtractParamTypeWithoutLosingOptional<TParams[K], K>;
423
337
  }>>;
424
338
 
425
- declare type ExtractParamTypesWithoutLosingOptional_2<TParams extends Record<string, Param_2>> = Identity_2<MakeOptional_2<{
426
- [K in keyof TParams]: ExtractParamTypeWithoutLosingOptional_2<TParams[K]>
427
- }>>
428
-
429
- declare type ExtractParamTypeWithoutLosingOptional<TParam extends Param> = TParam extends ParamGetSet<infer Type> ? TParam extends IsOptionalParam ? Type | undefined : Type : TParam extends ParamGetter ? ReturnType<TParam> : string;
430
-
431
- declare type ExtractParamTypeWithoutLosingOptional_2<TParam extends Param_2> = TParam extends ParamGetSet_2<infer Type>
432
- ? TParam extends IsOptionalParam_2
433
- ? Type | undefined
434
- : Type
435
- : TParam extends ParamGetter_2
436
- ? ReturnType<TParam>
437
- : string
438
-
439
- /**
440
- * Determines the type of a path parameter from a record of parameter types, considering optional parameters.
441
- * @template TParam - The parameter name string.
442
- * @template TParams - The record object mapping parameter names to their types.
443
- * @returns The type associated with the parameter, or StringConstructor if unspecified; may be undefined for optional parameters.
444
- */
445
- export declare type ExtractPathParamType<TParam extends string, TParams extends Record<string, Param | undefined>> = TParam extends `?${infer OptionalParam}` ? OptionalParam extends keyof TParams ? TParams[OptionalParam] extends Param ? OptionalParamGetSet<TParams[OptionalParam]> : OptionalParamGetSet<StringConstructor> : OptionalParamGetSet<StringConstructor> : TParam extends keyof TParams ? TParams[TParam] : StringConstructor;
339
+ declare type ExtractParamTypeWithoutLosingOptional<TParam extends Param, TParamKey extends PropertyKey> = TParam extends ParamGetSet<infer Type> ? TParamKey extends `?${string}` ? Type | undefined : Type : TParam extends ParamGetter ? TParamKey extends `?${string}` ? ReturnType<TParam> | undefined : ReturnType<TParam> : TParamKey extends `?${string}` ? string | undefined : string;
446
340
 
447
341
  /**
448
342
  * Determines the type of a path parameter from a record of parameter types, considering optional parameters.
@@ -450,31 +344,13 @@ export declare type ExtractPathParamType<TParam extends string, TParams extends
450
344
  * @template TParams - The record object mapping parameter names to their types.
451
345
  * @returns The type associated with the parameter, or StringConstructor if unspecified; may be undefined for optional parameters.
452
346
  */
453
- declare type ExtractPathParamType_2<
454
- TParam extends string,
455
- TParams extends Record<string, Param_2 | undefined>
456
- > = TParam extends `?${infer OptionalParam}`
457
- ? OptionalParam extends keyof TParams
458
- ? TParams[OptionalParam] extends Param_2
459
- ? OptionalParamGetSet_2<TParams[OptionalParam]>
460
- : OptionalParamGetSet_2<StringConstructor>
461
- : OptionalParamGetSet_2<StringConstructor>
462
- : TParam extends keyof TParams
463
- ? TParams[TParam]
464
- : StringConstructor
347
+ export declare type ExtractPathParamType<TParam extends string, TParams extends Record<string, Param | undefined>> = TParam extends `?${infer OptionalParam}` ? OptionalParam extends keyof TParams ? TParams[OptionalParam] : StringConstructor : TParam extends keyof TParams ? TParams[TParam] : StringConstructor;
465
348
 
466
349
  declare type ExtractQueryParamsFromQueryString<TQuery extends string, TParams extends Record<string, Param | undefined> = Record<never, never>> = TQuery extends `${string}=${ParamStart}${infer Param}${ParamEnd}${infer Rest}` ? MergeParams<{
467
- [P in ExtractParamName<Param>]: ExtractPathParamType<Param, TParams>;
350
+ [P in Param]: ExtractPathParamType<Param, TParams>;
468
351
  }, ExtractQueryParamsFromQueryString<Rest, TParams>> : Record<never, never>;
469
352
 
470
- declare type ExtractQueryParamsFromQueryString_2<
471
- TQuery extends string,
472
- TParams extends Record<string, Param_2 | undefined> = Record<never, never>
473
- > = TQuery extends `${string}=${ParamStart_2}${infer Param}${ParamEnd_2}${infer Rest}`
474
- ? MergeParams_2<{ [P in ExtractParamName_2<Param>]: ExtractPathParamType_2<Param, TParams> }, ExtractQueryParamsFromQueryString_2<Rest, TParams>>
475
- : Record<never, never>
476
-
477
- declare type ExtractRouteChildren<TRoute extends RouteProps> = TRoute extends ParentRouteProps ? TRoute['children'] extends Route[] ? TRoute['children'] : [] : [];
353
+ declare type ExtractRouteChildren<TRoute extends RouteProps | ExternalRouteProps> = TRoute extends ParentRouteProps ? TRoute['children'] extends Route[] ? TRoute['children'] : [] : [];
478
354
 
479
355
  /**
480
356
  * Extracts combined types of path and query parameters for a given route, creating a unified parameter object.
@@ -489,20 +365,7 @@ export declare type ExtractRouteParamTypes<TRoute> = TRoute extends {
489
365
  query: {
490
366
  params: infer QueryParams extends Record<string, Param>;
491
367
  };
492
- } ? ExtractParamTypes<MergeParams<PathParams, QueryParams>> : Record<string, unknown>;
493
-
494
- /**
495
- * Extracts combined types of path and query parameters for a given route, creating a unified parameter object.
496
- * This parameter object type represents the expected type when accessing params from router.route or useRoute.
497
- * @template TRoute - The route type from which to extract and merge parameter types.
498
- * @returns A record of parameter names to their respective types, extracted and merged from both path and query parameters.
499
- */
500
- declare type ExtractRouteParamTypes_2<TRoute> = TRoute extends {
501
- path: { params: infer PathParams extends Record<string, Param_2> },
502
- query: { params: infer QueryParams extends Record<string, Param_2> },
503
- }
504
- ? ExtractParamTypes_2<MergeParams_2<PathParams, QueryParams>>
505
- : Record<string, unknown>
368
+ } ? ExtractParamTypes<MergeParams<PathParams, QueryParams>> : {};
506
369
 
507
370
  declare type ExtractRouteParamTypesWithoutLosingOptional<TRoute> = TRoute extends {
508
371
  path: {
@@ -513,23 +376,20 @@ declare type ExtractRouteParamTypesWithoutLosingOptional<TRoute> = TRoute extend
513
376
  };
514
377
  } ? ExtractParamTypesWithoutLosingOptional<MergeParams<PathParams, QueryParams>> : Record<string, unknown>;
515
378
 
516
- declare type ExtractRouteParamTypesWithoutLosingOptional_2<TRoute> = TRoute extends {
517
- path: { params: infer PathParams extends Record<string, Param_2> },
518
- query: { params: infer QueryParams extends Record<string, Param_2> },
519
- }
520
- ? ExtractParamTypesWithoutLosingOptional_2<MergeParams_2<PathParams, QueryParams>>
521
- : Record<string, unknown>
522
-
523
379
  declare type Flatten<T extends any[]> = T extends [infer First, ...infer Rest] ? First extends unknown[] ? Flatten<[...First, ...Flatten<Rest>]> : [First, ...Flatten<Rest>] : [];
524
380
 
525
- declare type FlattenRoute<TRoute extends RouteProps, TKey extends string = string & TRoute['name'], TPath extends Path = ToPath<TRoute['path']>, TQuery extends Query = ToQuery<TRoute['query']>, TDisabled extends boolean = TRoute['disabled'] extends boolean ? TRoute['disabled'] : false, TChildren extends Route[] = ExtractRouteChildren<TRoute>> = [
526
- Route<TKey, TPath, TQuery, TDisabled>,
381
+ declare type FlattenRoute<TRoute extends RouteProps | ExternalRouteProps, TKey extends string = TRoute extends {
382
+ name: infer T extends string;
383
+ } ? T : '', THost extends string = TRoute extends {
384
+ host: infer T extends string;
385
+ } ? T : '', TPath extends Path = ToPath<TRoute['path']>, TQuery extends Query = ToQuery<TRoute['query']>, TDisabled extends boolean = TRoute['disabled'] extends boolean ? TRoute['disabled'] : false, TChildren extends Route[] = ExtractRouteChildren<TRoute>> = [
386
+ Route<TKey, THost, TPath, TQuery, TDisabled>,
527
387
  ...{
528
- [K in keyof TChildren]: Route<CombineName<TKey, TChildren[K]['key']>, CombinePath<TPath, TChildren[K]['path']>, CombineQuery<TQuery, TChildren[K]['query']>, TChildren[K]['disabled']>;
388
+ [K in keyof TChildren]: Route<CombineName<TKey, TChildren[K]['key']>, THost, CombinePath<TPath, TChildren[K]['path']>, CombineQuery<TQuery, TChildren[K]['query']>, TChildren[K]['disabled']>;
529
389
  }
530
390
  ];
531
391
 
532
- declare type FlattenRoutes<TRoutes extends Readonly<RouteProps[]>> = Flatten<[
392
+ declare type FlattenRoutes<TRoutes extends Readonly<RouteProps[] | ExternalRouteProps[]>> = Flatten<[
533
393
  ...{
534
394
  [K in keyof TRoutes]: FlattenRoute<TRoutes[K]>;
535
395
  }
@@ -539,22 +399,8 @@ declare type Identity<T> = T extends object ? {} & {
539
399
  [P in keyof T as T[P] extends never ? never : P]: T[P];
540
400
  } : T;
541
401
 
542
- declare type Identity_2<T> = T extends object ? {} & {
543
- [P in keyof T as T[P] extends never ? never : P]: T[P]
544
- } : T
545
-
546
402
  declare type IsEmptyObject<T> = T extends Record<string, never> ? (keyof T extends never ? true : false) : false;
547
403
 
548
- declare type IsEmptyObject_2<T> = T extends Record<string, never> ? (keyof T extends never ? true : false) : false
549
-
550
- declare type IsOptionalParam = {
551
- [optionalParamKey]: true;
552
- };
553
-
554
- declare type IsOptionalParam_2 = {
555
- [optionalParamKey_2]: true,
556
- }
557
-
558
404
  /**
559
405
  * Type guard to check if a value conforms to the ParamGetSet type.
560
406
  * @param value - The value to check.
@@ -582,12 +428,38 @@ export declare function isParentRouteWithoutComponent(value: RouteProps): value
582
428
 
583
429
  export declare function isRoute(route: unknown): route is RouterRoute;
584
430
 
585
- export declare function isRoute<TRouteKey extends RegisteredRoutesKey>(route: unknown, routeKey: TRouteKey, options?: IsRouteOptions): route is RouterRoute<ResolvedRoute<RegisteredRouteMap[TRouteKey]>>;
431
+ export declare function isRoute<TRoute extends RouterRoute, TRouteKey extends TRoute['key']>(route: TRoute, routeKey: TRouteKey, options: IsRouteOptions & {
432
+ exact: true;
433
+ }): route is TRoute & {
434
+ key: TRouteKey;
435
+ };
436
+
437
+ export declare function isRoute<TRoute extends RouterRoute, TRouteKey extends TRoute['key']>(route: TRoute, routeKey: TRouteKey, options?: IsRouteOptions): route is TRoute & {
438
+ key: `${TRouteKey}${string}`;
439
+ };
440
+
441
+ export declare function isRoute<TRouteKey extends RegisteredRoutesKey>(route: unknown, routeKey: TRouteKey, options: IsRouteOptions & {
442
+ exact: true;
443
+ }): route is RegisteredRouterRoute & {
444
+ key: TRouteKey;
445
+ };
446
+
447
+ export declare function isRoute<TRouteKey extends RegisteredRoutesKey>(route: unknown, routeKey: TRouteKey, options?: IsRouteOptions): route is RegisteredRouterRoute & {
448
+ key: `${TRouteKey}${string}`;
449
+ };
450
+
451
+ export declare function isRoute(route: unknown, routeKey?: string, options?: IsRouteOptions): boolean;
452
+
453
+ declare type IsRouteDisabled<T extends Route> = T extends {
454
+ disabled: true;
455
+ } ? true : false;
586
456
 
587
457
  declare type IsRouteOptions = {
588
458
  exact?: boolean;
589
459
  };
590
460
 
461
+ declare type IsRouteUnnamed<T extends Route> = StringHasValue<T['key']> extends true ? false : true;
462
+
591
463
  export declare function isRouteWithComponent(value: RouteProps): value is RouteProps & WithComponent;
592
464
 
593
465
  export declare function isRouteWithComponent(value: Readonly<RouteProps>): value is Readonly<RouteProps & WithComponent>;
@@ -602,20 +474,10 @@ declare type MakeOptional<T> = {
602
474
  [P in Exclude<keyof T, WithOptionalProperties<T>>]: T[P];
603
475
  };
604
476
 
605
- declare type MakeOptional_2<T> = {
606
- [P in WithOptionalProperties_2<T>]?: T[P];
607
- } & {
608
- [P in Exclude<keyof T, WithOptionalProperties_2<T>>]: T[P];
609
- }
610
-
611
477
  declare type MaybeArray<T> = T | T[];
612
478
 
613
- declare type MaybeArray_2<T> = T | T[]
614
-
615
479
  declare type MaybePromise<T> = T | Promise<T>;
616
480
 
617
- declare type MaybePromise_2<T> = T | Promise<T>
618
-
619
481
  /**
620
482
  * Merges two parameter type records, ensuring no overlap in properties.
621
483
  * @template TAlpha - The first record type.
@@ -626,29 +488,6 @@ export declare type MergeParams<TAlpha extends Record<string, unknown>, TBeta ex
626
488
  [K in keyof TAlpha | keyof TBeta]: K extends keyof TAlpha & keyof TBeta ? never : K extends keyof TAlpha ? TAlpha[K] : K extends keyof TBeta ? TBeta[K] : never;
627
489
  };
628
490
 
629
- /**
630
- * Merges two parameter type records, ensuring no overlap in properties.
631
- * @template TAlpha - The first record type.
632
- * @template TBeta - The second record type.
633
- * @returns A new record type combining properties from both inputs without overlaps.
634
- */
635
- declare type MergeParams_2<
636
- TAlpha extends Record<string, unknown>,
637
- TBeta extends Record<string, unknown>
638
- > = {
639
- [K in keyof TAlpha | keyof TBeta]: K extends keyof TAlpha & keyof TBeta
640
- ? never
641
- : K extends keyof TAlpha
642
- ? TAlpha[K]
643
- : K extends keyof TBeta
644
- ? TBeta[K]
645
- : never
646
- }
647
-
648
- declare type NamedNotDisabled<T> = T extends BaseRoute ? T : never;
649
-
650
- declare type NamedNotDisabled_2<T> = T extends BaseRoute_2 ? T : never
651
-
652
491
  /**
653
492
  * Registers a hook that is called after a route has been entered. Must be called during setup.
654
493
  * This allows performing actions right after the component becomes active, such as fetching data or setting up event listeners.
@@ -698,72 +537,32 @@ declare type OnlyRequiredProperties<T> = {
698
537
  [K in keyof T as Extract<T[K], undefined> extends never ? K : never]: T[K];
699
538
  };
700
539
 
701
- declare type OnlyRequiredProperties_2<T> = {
702
- [K in keyof T as Extract<T[K], undefined> extends never ? K : never]: T[K]
703
- }
704
-
705
- declare type OptionalParamGetSet<TParam extends Param> = TParam extends ParamGetSet ? TParam & IsOptionalParam : ParamGetSet<ExtractParamType<TParam>> & IsOptionalParam;
706
-
707
- declare type OptionalParamGetSet_2<TParam extends Param_2> = TParam extends ParamGetSet_2
708
- ? TParam & IsOptionalParam_2
709
- : ParamGetSet_2<ExtractParamType_2<TParam>> & IsOptionalParam_2
710
-
711
- declare const optionalParamKey: unique symbol;
712
-
713
- declare const optionalParamKey_2 = Symbol();
714
-
715
540
  export declare type Param = ParamGetter | ParamGetSet | RegExp | BooleanConstructor | NumberConstructor | StringConstructor | DateConstructor | JSON;
716
541
 
717
- declare type Param_2 = ParamGetter_2 | ParamGetSet_2 | RegExp | BooleanConstructor | NumberConstructor | StringConstructor | DateConstructor | JSON
718
-
719
542
  export declare type ParamEnd = typeof paramEnd;
720
543
 
721
544
  export declare const paramEnd = "]";
722
545
 
723
- declare type ParamEnd_2 = typeof paramEnd_2
724
-
725
- declare const paramEnd_2 = ']';
726
-
727
546
  export declare type ParamExtras = {
728
547
  invalid: (message?: string) => never;
729
548
  };
730
549
 
731
- declare type ParamExtras_2 = {
732
- invalid: (message?: string) => never,
733
- }
734
-
735
550
  export declare type ParamGetSet<T = any> = {
736
551
  get: ParamGetter<T>;
737
552
  set: ParamSetter<T>;
738
553
  defaultValue?: T;
739
554
  };
740
555
 
741
- declare type ParamGetSet_2<T = any> = {
742
- get: ParamGetter_2<T>,
743
- set: ParamSetter_2<T>,
744
- defaultValue?: T,
745
- }
746
-
747
556
  export declare type ParamGetter<T = any> = (value: string, extras: ParamExtras) => T;
748
557
 
749
- declare type ParamGetter_2<T = any> = (value: string, extras: ParamExtras_2) => T
750
-
751
558
  export declare type ParamSetter<T = any> = (value: T, extras: ParamExtras) => string;
752
559
 
753
- declare type ParamSetter_2<T = any> = (value: T, extras: ParamExtras_2) => string
754
-
755
560
  export declare type ParamStart = typeof paramStart;
756
561
 
757
562
  export declare const paramStart = "[";
758
563
 
759
- declare type ParamStart_2 = typeof paramStart_2
760
-
761
- declare const paramStart_2 = '[';
762
-
763
564
  export declare type ParamWithDefault<TParam extends Param = Param> = Required<ParamGetSet<ExtractParamType<TParam>>>;
764
565
 
765
- declare type ParamWithDefault_2<TParam extends Param_2 = Param_2> = Required<ParamGetSet_2<ExtractParamType_2<TParam>>>
766
-
767
566
  /**
768
567
  * Represents properties common to parent routes in a route configuration, including hooks, path, and optional query parameters.
769
568
  */
@@ -794,37 +593,7 @@ export declare type ParentRouteProps = Partial<WithComponent | WithComponents> &
794
593
  meta?: RouteMeta;
795
594
  };
796
595
 
797
- /**
798
- * Represents properties common to parent routes in a route configuration, including hooks, path, and optional query parameters.
799
- */
800
- declare type ParentRouteProps_2 = Partial<WithComponent_2 | WithComponents_2> & WithHooks_2 & {
801
- /**
802
- * Name for route, used to create route keys and in navigation.
803
- */
804
- name?: string,
805
- /**
806
- * Path part of URL.
807
- */
808
- path: string | Path_2,
809
- /**
810
- * Query (aka search) part of URL.
811
- */
812
- query?: string | Query_2,
813
- /**
814
- * Disabled routes will not ever match but can still provide physical structure, nested children behave normally.
815
- */
816
- disabled?: boolean,
817
- /**
818
- * Children routes, expected type comes from `createRoutes()`
819
- */
820
- children: Routes_2,
821
- /**
822
- * Represents additional metadata associated with a route, customizable via declaration merging.
823
- */
824
- meta?: RouteMeta_2,
825
- }
826
-
827
- declare type Path<TPath extends string = string, TParams extends PathParams<TPath> = Record<string, Param | undefined>> = {
596
+ declare type Path<TPath extends string = string, TParams extends PathParamsWithParamNameExtracted<TPath> = Record<string, Param | undefined>> = {
828
597
  path: TPath;
829
598
  params: string extends TPath ? Record<string, Param> : Identity<ExtractParamsFromPathString<TPath, TParams>>;
830
599
  toString: () => string;
@@ -853,30 +622,21 @@ declare type Path<TPath extends string = string, TParams extends PathParams<TPat
853
622
  * ])
854
623
  * ```
855
624
  */
856
- export declare function path<TPath extends string, TParams extends PathParams<TPath>>(path: TPath, params: Identity<TParams>): Path<TPath, TParams>;
857
-
858
- declare type Path_2<
859
- TPath extends string = string,
860
- TParams extends PathParams_2<TPath> = Record<string, Param_2 | undefined>
861
- > = {
862
- path: TPath,
863
- params: string extends TPath ? Record<string, Param_2> : Identity_2<ExtractParamsFromPathString_2<TPath, TParams>>,
864
- toString: () => string,
865
- }
625
+ export declare function path<TPath extends string, TParams extends PathParamsWithParamNameExtracted<TPath>>(path: TPath, params: Identity<TParams>): Path<TPath, TParams>;
866
626
 
867
627
  declare type PathParams<TPath extends string> = {
868
628
  [K in keyof ExtractParamsFromPathString<TPath>]?: Param;
869
629
  };
870
630
 
871
- declare type PathParams_2<TPath extends string> = {
872
- [K in keyof ExtractParamsFromPathString_2<TPath>]?: Param_2
873
- }
631
+ declare type PathParamsWithParamNameExtracted<TPath extends string> = {
632
+ [K in keyof ExtractParamsFromPathString<TPath> as ExtractParamName<K>]?: Param;
633
+ };
874
634
 
875
635
  declare type Props<TComponent extends Component> = TComponent extends Constructor ? InstanceType<TComponent>['$props'] : TComponent extends AsyncComponentLoader<infer T extends Component> ? Props<T> : TComponent extends FunctionalComponent<infer T> ? T : never;
876
636
 
877
637
  declare type PropsGetter<TComponent extends Component> = () => MaybePromise<Props<TComponent>>;
878
638
 
879
- declare type Query<TQuery extends string = string, TQueryParams extends QueryParams<TQuery> = Record<string, Param | undefined>> = {
639
+ declare type Query<TQuery extends string = string, TQueryParams extends QueryParamsWithParamNameExtracted<TQuery> = Record<string, Param | undefined>> = {
880
640
  query: TQuery;
881
641
  params: string extends TQuery ? Record<string, Param> : Identity<ExtractQueryParamsFromQueryString<TQuery, TQueryParams>>;
882
642
  toString: () => string;
@@ -905,24 +665,15 @@ declare type Query<TQuery extends string = string, TQueryParams extends QueryPar
905
665
  * ])
906
666
  * ```
907
667
  */
908
- export declare function query<TQuery extends string, TParams extends QueryParams<TQuery>>(query: TQuery, params: Identity<TParams>): Query<TQuery, TParams>;
909
-
910
- declare type Query_2<
911
- TQuery extends string = string,
912
- TQueryParams extends QueryParams_2<TQuery> = Record<string, Param_2 | undefined>
913
- > = {
914
- query: TQuery,
915
- params: string extends TQuery ? Record<string, Param_2> : Identity_2<ExtractQueryParamsFromQueryString_2<TQuery, TQueryParams>>,
916
- toString: () => string,
917
- }
668
+ export declare function query<TQuery extends string, TParams extends QueryParamsWithParamNameExtracted<TQuery>>(query: TQuery, params: Identity<TParams>): Query<TQuery, TParams>;
918
669
 
919
670
  declare type QueryParams<T extends string> = {
920
671
  [K in keyof ExtractQueryParamsFromQueryString<T>]?: Param;
921
672
  };
922
673
 
923
- declare type QueryParams_2<T extends string> = {
924
- [K in keyof ExtractQueryParamsFromQueryString_2<T>]?: Param_2
925
- }
674
+ declare type QueryParamsWithParamNameExtracted<T extends string> = {
675
+ [K in keyof ExtractQueryParamsFromQueryString<T> as ExtractParamName<K>]?: Param;
676
+ };
926
677
 
927
678
  /**
928
679
  * Represents the state of currently registered router, and rejections. Used to provide correct type context for
@@ -940,21 +691,6 @@ declare type QueryParams_2<T extends string> = {
940
691
  export declare interface Register {
941
692
  }
942
693
 
943
- /**
944
- * Represents the state of currently registered router, and rejections. Used to provide correct type context for
945
- * components like `RouterLink`, as well as for composables like `useRouter`, `useRoute`, and hooks.
946
- *
947
- * @example
948
- * ```ts
949
- * declare module '@kitbag/router' {
950
- * interface Register {
951
- * router: typeof router
952
- * }
953
- * }
954
- * ```
955
- */
956
- declare interface Register_2 {}
957
-
958
694
  /**
959
695
  * Represents the possible Rejections registered within {@link Register}
960
696
  */
@@ -962,13 +698,6 @@ export declare type RegisteredRejectionType = Register extends {
962
698
  rejections: infer TRejections extends string[];
963
699
  } ? TRejections[number] : never;
964
700
 
965
- /**
966
- * Represents the possible Rejections registered within {@link Register}
967
- */
968
- declare type RegisteredRejectionType_2 = Register_2 extends { rejections: infer TRejections extends string[] }
969
- ? TRejections[number]
970
- : never
971
-
972
701
  /**
973
702
  * Represents the a map of all possible RouteKeys with corresponding Route registered within {@link Register}
974
703
  */
@@ -986,20 +715,15 @@ export declare type RegisteredRouter = Register extends {
986
715
  */
987
716
  export declare type RegisteredRouterPush = RouterPush<RegisteredRoutes>;
988
717
 
989
- /**
990
- * Represents the type for router `push`, with types for routes registered within {@link Register}
991
- */
992
- declare type RegisteredRouterPush_2 = RouterPush_2<RegisteredRoutes_2>
993
-
994
718
  /**
995
719
  * Represents the type for router `replace`, with types for routes registered within {@link Register}
996
720
  */
997
721
  export declare type RegisteredRouterReplace = RouterReplace<RegisteredRoutes>;
998
722
 
999
723
  /**
1000
- * Represents the type for router `replace`, with types for routes registered within {@link Register}
724
+ * Represents the Router property within {@link Register}
1001
725
  */
1002
- declare type RegisteredRouterReplace_2 = RouterReplace_2<RegisteredRoutes_2>
726
+ export declare type RegisteredRouterRoute = RegisteredRouter['route'];
1003
727
 
1004
728
  /**
1005
729
  * Represents the State property registered within {@link Register}
@@ -1013,14 +737,7 @@ export declare type RegisteredRouterState = Register extends {
1013
737
  */
1014
738
  export declare type RegisteredRoutes = Register extends {
1015
739
  router: Router<infer TRoutes extends Routes>;
1016
- } ? TRoutes : Route<string, Path<'', {}>, Query<'', {}>, false>[];
1017
-
1018
- /**
1019
- * Represents the Router routes property within {@link Register}
1020
- */
1021
- declare type RegisteredRoutes_2 = Register_2 extends { router: Router_2<infer TRoutes extends Routes_2> }
1022
- ? TRoutes
1023
- : Route_2<string, Path_2<'', {}>, Query_2<'', {}>, false>[]
740
+ } ? TRoutes : Route<string, '', Path<'', {}>, Query<'', {}>, false>[];
1024
741
 
1025
742
  /**
1026
743
  * Represents the union of all possible RouteKeys registered within {@link Register}
@@ -1031,7 +748,7 @@ export declare type RegisteredRoutesKey = RoutesKey<RegisteredRoutes>;
1031
748
  * Represents a route that the router has matched to current browser location.
1032
749
  * @template TRoute - Underlying Route that has been resolved.
1033
750
  */
1034
- declare type ResolvedRoute<TRoute extends Route = BaseResolvedRoute> = Readonly<{
751
+ declare type ResolvedRoute<TRoute extends Route = Route> = Readonly<{
1035
752
  /**
1036
753
  * The specific route properties that were matched in the current route.
1037
754
  */
@@ -1052,47 +769,14 @@ declare type ResolvedRoute<TRoute extends Route = BaseResolvedRoute> = Readonly<
1052
769
  /**
1053
770
  * Key value pair for route params, values will be the user provided value from current browser location.
1054
771
  */
1055
- params: BaseResolvedRoute extends TRoute ? Record<string, unknown> : ExtractRouteParamTypes<TRoute>;
772
+ params: ExtractRouteParamTypes<TRoute>;
1056
773
  }>;
1057
774
 
1058
- /**
1059
- * Represents a route that the router has matched to current browser location.
1060
- * @template TRoute - Underlying Route that has been resolved.
1061
- */
1062
- declare type ResolvedRoute_2<TRoute extends Route_2 = BaseResolvedRoute_2> = Readonly<{
1063
- /**
1064
- * The specific route properties that were matched in the current route.
1065
- */
1066
- matched: TRoute['matched'],
1067
- /**
1068
- * The specific route properties that were matched in the current route, including any ancestors.
1069
- * Order of routes will be from greatest ancestor to narrowest matched.
1070
- */
1071
- matches: TRoute['matches'],
1072
- /**
1073
- * Unique identifier for the route, generated by joining route `name` by period. Key is used for routing and for matching.
1074
- */
1075
- key: TRoute['key'],
1076
- /**
1077
- * Accessor for query string values from user in the current browser location.
1078
- */
1079
- query: ResolvedRouteQuery_2,
1080
- /**
1081
- * Key value pair for route params, values will be the user provided value from current browser location.
1082
- */
1083
- params: BaseResolvedRoute_2 extends TRoute ? Record<string, unknown> : ExtractRouteParamTypes_2<TRoute>,
1084
- }>
1085
-
1086
775
  declare type ResolvedRouteQuery = {
1087
776
  get: (key: string) => string | null;
1088
777
  getAll: (key: string) => string[];
1089
778
  };
1090
779
 
1091
- declare type ResolvedRouteQuery_2 = {
1092
- get: (key: string) => string | null,
1093
- getAll: (key: string) => string[],
1094
- }
1095
-
1096
780
  /**
1097
781
  * Represents the structure of a route within the application. Return value of `createRoutes`
1098
782
  * @template TKey - Represents the unique key identifying the route, typically a string.
@@ -1100,7 +784,7 @@ declare type ResolvedRouteQuery_2 = {
1100
784
  * @template TQuery - The type or structure of the query parameters associated with the route.
1101
785
  * @template TDisabled - Indicates whether the route is disabled, which could affect routing logic.
1102
786
  */
1103
- export declare type Route<TKey extends string = string, TPath extends string | Path = Path, TQuery extends string | Query = Query, TDisabled extends boolean = boolean> = {
787
+ export declare type Route<TKey extends string = string, THost extends string = string, TPath extends Path = Path, TQuery extends Query = Query, TDisabled extends boolean = boolean> = {
1104
788
  /**
1105
789
  * The specific route properties that were matched in the current route.
1106
790
  */
@@ -1115,65 +799,26 @@ export declare type Route<TKey extends string = string, TPath extends string | P
1115
799
  */
1116
800
  key: TKey;
1117
801
  /**
1118
- * Represents the structured path of the route, including path params.
802
+ * Represents the host for this route. Used for external routes.
1119
803
  */
1120
- path: ToPath<TPath>;
1121
- /**
1122
- * Represents the structured query of the route, including query params.
1123
- */
1124
- query: ToQuery<TQuery>;
1125
- depth: number;
1126
- /**
1127
- * Indicates if the route is disabled.
1128
- */
1129
- disabled: TDisabled extends boolean ? TDisabled : false;
1130
- };
1131
-
1132
- /**
1133
- * Represents the structure of a route within the application. Return value of `createRoutes`
1134
- * @template TKey - Represents the unique key identifying the route, typically a string.
1135
- * @template TPath - The type or structure of the route's path.
1136
- * @template TQuery - The type or structure of the query parameters associated with the route.
1137
- * @template TDisabled - Indicates whether the route is disabled, which could affect routing logic.
1138
- */
1139
- declare type Route_2<
1140
- TKey extends string = string,
1141
- TPath extends string | Path_2 = Path_2,
1142
- TQuery extends string | Query_2 = Query_2,
1143
- TDisabled extends boolean = boolean
1144
- > = {
1145
- /**
1146
- * The specific route properties that were matched in the current route.
1147
- */
1148
- matched: RoutePropsWithMeta_2,
1149
- /**
1150
- * The specific route properties that were matched in the current route, including any ancestors.
1151
- * Order of routes will be from greatest ancestor to narrowest matched.
1152
- */
1153
- matches: RoutePropsWithMeta_2[],
1154
- /**
1155
- * Unique identifier for the route, generated by joining route `name` by period. Key is used for routing and for matching.
1156
- */
1157
- key: TKey,
804
+ host: THost;
1158
805
  /**
1159
806
  * Represents the structured path of the route, including path params.
1160
807
  */
1161
- path: ToPath_2<TPath>,
808
+ path: TPath;
1162
809
  /**
1163
810
  * Represents the structured query of the route, including query params.
1164
811
  */
1165
- query: ToQuery_2<TQuery>,
1166
- depth: number,
812
+ query: TQuery;
813
+ depth: number;
1167
814
  /**
1168
815
  * Indicates if the route is disabled.
1169
816
  */
1170
- disabled: TDisabled extends boolean ? TDisabled : false,
1171
- }
817
+ disabled: TDisabled;
818
+ };
1172
819
 
1173
820
  declare type RouteGetByKey<TRoutes extends Routes, TKey extends RoutesKey<TRoutes>> = RoutesMap<TRoutes>[TKey];
1174
821
 
1175
- declare type RouteGetByKey_2<TRoutes extends Routes_2, TKey extends RoutesKey_2<TRoutes>> = RoutesMap_2<TRoutes>[TKey]
1176
-
1177
822
  /**
1178
823
  * Generic type representing a route hook, which can be either before or after a route change.
1179
824
  */
@@ -1184,11 +829,6 @@ export declare type RouteHook = BeforeRouteHook | AfterRouteHook;
1184
829
  */
1185
830
  export declare type RouteHookAbort = () => void;
1186
831
 
1187
- /**
1188
- * A function that can be called to abort a routing operation.
1189
- */
1190
- declare type RouteHookAbort_2 = () => void
1191
-
1192
832
  /**
1193
833
  * Defines the structure of an aborted route hook response.
1194
834
  */
@@ -1206,16 +846,6 @@ declare type RouteHookContext = {
1206
846
  replace: RegisteredRouterReplace;
1207
847
  };
1208
848
 
1209
- /**
1210
- * Context provided to route hooks, containing context of previous route and functions for triggering rejections and push/replace to another route.
1211
- */
1212
- declare type RouteHookContext_2 = {
1213
- from: ResolvedRoute_2 | null,
1214
- reject: RouterReject_2,
1215
- push: RegisteredRouterPush_2,
1216
- replace: RegisteredRouterReplace_2,
1217
- }
1218
-
1219
849
  /**
1220
850
  * Union type for all route hook lifecycle events.
1221
851
  */
@@ -1243,11 +873,6 @@ declare type RouteHookRejectResponse = {
1243
873
  */
1244
874
  export declare type RouteHookRemove = () => void;
1245
875
 
1246
- /**
1247
- * A function to remove a previously registered route hook.
1248
- */
1249
- declare type RouteHookRemove_2 = () => void
1250
-
1251
876
  /**
1252
877
  * Union type for all possible route hook responses, covering both before and after scenarios.
1253
878
  * @template TRoutes - The type of the routes configuration.
@@ -1261,6 +886,8 @@ declare type RouteHookSuccessResponse = {
1261
886
  status: 'SUCCESS';
1262
887
  };
1263
888
 
889
+ declare type RouteIsNamedAndNotDisabled<T extends Route> = IsRouteDisabled<T> extends true ? never : IsRouteUnnamed<T> extends true ? never : T;
890
+
1264
891
  /**
1265
892
  * Represents additional metadata associated with a route, customizable via declaration merging.
1266
893
  * @example
@@ -1275,36 +902,13 @@ declare type RouteHookSuccessResponse = {
1275
902
  export declare interface RouteMeta extends Record<string, unknown> {
1276
903
  }
1277
904
 
1278
- /**
1279
- * Represents additional metadata associated with a route, customizable via declaration merging.
1280
- * @example
1281
- * ```ts
1282
- * declare module '@kitbag/router' {
1283
- * interface RouteMeta {
1284
- * pageTitle?: string
1285
- * }
1286
- * }
1287
- * ```
1288
- */
1289
- declare interface RouteMeta_2 extends Record<string, unknown> {}
1290
-
1291
905
  declare type RouteParamsByKey<TRoutes extends Routes, TKey extends string> = ExtractRouteParamTypesWithoutLosingOptional<RouteGetByKey<TRoutes, TKey>>;
1292
906
 
1293
- declare type RouteParamsByKey_2<
1294
- TRoutes extends Routes_2,
1295
- TKey extends string
1296
- > = ExtractRouteParamTypesWithoutLosingOptional_2<RouteGetByKey_2<TRoutes, TKey>>
1297
-
1298
907
  /**
1299
908
  * Unifies the properties of both parent and child routes, ensuring type safety and consistency across route configurations.
1300
909
  */
1301
910
  export declare type RouteProps = Readonly<ParentRouteProps | ChildRouteProps>;
1302
911
 
1303
- /**
1304
- * Unifies the properties of both parent and child routes, ensuring type safety and consistency across route configurations.
1305
- */
1306
- declare type RouteProps_2 = Readonly<ParentRouteProps_2 | ChildRouteProps_2>
1307
-
1308
912
  /**
1309
913
  * The Route properties originally provided to `createRoutes`. The only change is normalizing meta to always default to an empty object.
1310
914
  */
@@ -1312,16 +916,11 @@ export declare type RoutePropsWithMeta = RouteProps & {
1312
916
  meta: RouteMeta;
1313
917
  };
1314
918
 
1315
- /**
1316
- * The Route properties originally provided to `createRoutes`. The only change is normalizing meta to always default to an empty object.
1317
- */
1318
- declare type RoutePropsWithMeta_2 = RouteProps_2 & { meta: RouteMeta_2 }
1319
-
1320
919
  export declare type Router<TRoutes extends Routes = any> = Plugin_2 & {
1321
920
  /**
1322
921
  * Manages the current route state.
1323
922
  */
1324
- route: RouterRoute;
923
+ route: RouterRoutes<TRoutes>;
1325
924
  /**
1326
925
  * Resolves a URL to a route object.
1327
926
  */
@@ -1386,103 +985,19 @@ export declare type Router<TRoutes extends Routes = any> = Plugin_2 & {
1386
985
  * A promise that resolves when the router is fully initialized.
1387
986
  */
1388
987
  initialized: Promise<void>;
1389
- };
1390
-
1391
- declare type Router_2<
1392
- TRoutes extends Routes_2 = any
1393
- > = Plugin_2 & {
1394
- /**
1395
- * Manages the current route state.
1396
- */
1397
- route: RouterRoute_2,
1398
- /**
1399
- * Resolves a URL to a route object.
1400
- */
1401
- resolve: RouterResolve_2<TRoutes>,
1402
- /**
1403
- * Navigates to a specified path or route object in the history stack, adding a new entry.
1404
- */
1405
- push: RouterPush_2<TRoutes>,
1406
- /**
1407
- * Replaces the current entry in the history stack with a new one.
1408
- */
1409
- replace: RouterReplace_2<TRoutes>,
1410
- /**
1411
- * Finds a route object based on the provided lookup parameters.
1412
- */
1413
- find: RouterFind_2<TRoutes>,
1414
988
  /**
1415
- * Handles route rejection based on a specified rejection type.
1416
- */
1417
- reject: RouterReject_2,
1418
- /**
1419
- * Forces the router to re-evaluate the current route.
1420
- */
1421
- refresh: () => void,
1422
- /**
1423
- * Navigates to the previous entry in the browser's history stack.
989
+ * Given a URL, returns true if host does not match host stored on router instance
1424
990
  */
1425
- back: () => void,
1426
- /**
1427
- * Navigates to the next entry in the browser's history stack.
1428
- */
1429
- forward: () => void,
1430
- /**
1431
- * Moves the current history entry to a specific point in the history stack.
1432
- */
1433
- go: (delta: number) => void,
1434
- /**
1435
- * Registers a hook to be called before a route is entered.
1436
- */
1437
- onBeforeRouteEnter: AddBeforeRouteHook_2,
1438
- /**
1439
- * Registers a hook to be called before a route is left.
1440
- */
1441
- onBeforeRouteLeave: AddBeforeRouteHook_2,
1442
- /**
1443
- * Registers a hook to be called before a route is updated.
1444
- */
1445
- onBeforeRouteUpdate: AddBeforeRouteHook_2,
1446
- /**
1447
- * Registers a hook to be called after a route is entered.
1448
- */
1449
- onAfterRouteEnter: AddAfterRouteHook_2,
1450
- /**
1451
- * Registers a hook to be called after a route is left.
1452
- */
1453
- onAfterRouteLeave: AddAfterRouteHook_2,
1454
- /**
1455
- * Registers a hook to be called after a route is updated.
1456
- */
1457
- onAfterRouteUpdate: AddAfterRouteHook_2,
1458
- /**
1459
- * A promise that resolves when the router is fully initialized.
1460
- */
1461
- initialized: Promise<void>,
1462
- }
991
+ isExternal: (url: string) => boolean;
992
+ };
1463
993
 
1464
994
  declare type RouterFind<TRoutes extends Routes> = {
1465
995
  <TSource extends RoutesKey<TRoutes>>(source: TSource, ...args: RouterFindArgs<TRoutes, TSource>): ResolvedRoute | undefined;
1466
996
  (source: Url): ResolvedRoute | undefined;
1467
997
  };
1468
998
 
1469
- declare type RouterFind_2<
1470
- TRoutes extends Routes_2
1471
- > = {
1472
- <TSource extends RoutesKey_2<TRoutes>>(source: TSource, ...args: RouterFindArgs_2<TRoutes, TSource>): ResolvedRoute_2 | undefined,
1473
- (source: Url_2): ResolvedRoute_2 | undefined,
1474
- }
1475
-
1476
999
  declare type RouterFindArgs<TRoutes extends Routes, TSource extends RoutesKey<TRoutes>, TParams = RouteParamsByKey<TRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: TParams] : [params: TParams];
1477
1000
 
1478
- declare type RouterFindArgs_2<
1479
- TRoutes extends Routes_2,
1480
- TSource extends RoutesKey_2<TRoutes>,
1481
- TParams = RouteParamsByKey_2<TRoutes, TSource>
1482
- > = AllPropertiesAreOptional_2<TParams> extends true
1483
- ? [params?: TParams]
1484
- : [params: TParams]
1485
-
1486
1001
  declare type RouterHistoryMode = 'auto' | 'browser' | 'memory' | 'hash';
1487
1002
 
1488
1003
  export declare const routerInjectionKey: InjectionKey<RegisteredRouter>;
@@ -1519,7 +1034,7 @@ export declare class RouterNotInstalledError extends Error {
1519
1034
  */
1520
1035
  export declare type RouterOptions = {
1521
1036
  /**
1522
- * Initial URL for the router to use. Required if using Node environment.
1037
+ * Initial URL for the router to use. Required if using Node environment. Defaults to window.location when using browser.
1523
1038
  *
1524
1039
  * @default window.location.toString()
1525
1040
  */
@@ -1535,37 +1050,15 @@ declare type RouterPush<TRoutes extends Routes = any> = {
1535
1050
  (source: Url, options?: RouterPushOptions): Promise<void>;
1536
1051
  };
1537
1052
 
1538
- declare type RouterPush_2<
1539
- TRoutes extends Routes_2 = any
1540
- > = {
1541
- <TSource extends RoutesKey_2<TRoutes>>(source: TSource, ...args: RouterPushArgs_2<TRoutes, TSource>): Promise<void>,
1542
- (source: Url_2, options?: RouterPushOptions_2): Promise<void>,
1543
- }
1544
-
1545
1053
  declare type RouterPushArgs<TRoutes extends Routes, TSource extends RoutesKey<TRoutes>, TParams = RouteParamsByKey<TRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: TParams, options?: RouterPushOptions] : [params: TParams, options?: RouterPushOptions];
1546
1054
 
1547
- declare type RouterPushArgs_2<
1548
- TRoutes extends Routes_2,
1549
- TSource extends RoutesKey_2<TRoutes>,
1550
- TParams = RouteParamsByKey_2<TRoutes, TSource>
1551
- > = AllPropertiesAreOptional_2<TParams> extends true
1552
- ? [params?: TParams, options?: RouterPushOptions_2]
1553
- : [params: TParams, options?: RouterPushOptions_2]
1554
-
1555
1055
  declare type RouterPushOptions = {
1556
1056
  query?: Record<string, string>;
1557
1057
  replace?: boolean;
1558
1058
  };
1559
1059
 
1560
- declare type RouterPushOptions_2 = {
1561
- query?: Record<string, string>,
1562
- replace?: boolean,
1563
- }
1564
-
1565
1060
  export declare type RouterReject = (type: RouterRejectionType) => void;
1566
1061
 
1567
- declare type RouterReject_2 = (type: RouterRejectionType_2) => void
1568
-
1569
1062
  declare type RouterRejection = Ref<null | {
1570
1063
  type: RouterRejectionType;
1571
1064
  component: Component;
@@ -1579,64 +1072,26 @@ export declare const routerRejectionKey: InjectionKey<RouterRejection>;
1579
1072
 
1580
1073
  declare type RouterRejectionType = BuiltInRejectionType | RegisteredRejectionType;
1581
1074
 
1582
- declare type RouterRejectionType_2 = BuiltInRejectionType_2 | RegisteredRejectionType_2
1583
-
1584
1075
  declare type RouterReplace<TRoutes extends Routes> = {
1585
1076
  <TSource extends RoutesKey<TRoutes>>(source: TSource, ...args: RouterReplaceArgs<TRoutes, TSource>): Promise<void>;
1586
1077
  (source: Url, options?: RouterReplaceOptions): Promise<void>;
1587
1078
  };
1588
1079
 
1589
- declare type RouterReplace_2<
1590
- TRoutes extends Routes_2
1591
- > = {
1592
- <TSource extends RoutesKey_2<TRoutes>>(source: TSource, ...args: RouterReplaceArgs_2<TRoutes, TSource>): Promise<void>,
1593
- (source: Url_2, options?: RouterReplaceOptions_2): Promise<void>,
1594
- }
1595
-
1596
1080
  declare type RouterReplaceArgs<TRoutes extends Routes, TSource extends RoutesKey<TRoutes>, TParams = RouteParamsByKey<TRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: TParams, options?: RouterReplaceOptions] : [params: TParams, options?: RouterReplaceOptions];
1597
1081
 
1598
- declare type RouterReplaceArgs_2<
1599
- TRoutes extends Routes_2,
1600
- TSource extends RoutesKey_2<TRoutes>,
1601
- TParams = RouteParamsByKey_2<TRoutes, TSource>
1602
- > = AllPropertiesAreOptional_2<TParams> extends true
1603
- ? [params?: TParams, options?: RouterReplaceOptions_2]
1604
- : [params: TParams, options?: RouterReplaceOptions_2]
1605
-
1606
1082
  declare type RouterReplaceOptions = Omit<RouterPushOptions, 'replace'>;
1607
1083
 
1608
- declare type RouterReplaceOptions_2 = Omit<RouterPushOptions_2, 'replace'>
1609
-
1610
1084
  declare type RouterResolve<TRoutes extends Routes> = {
1611
1085
  <TSource extends RoutesKey<TRoutes>>(source: TSource, ...args: RouterResolveArgs<TRoutes, TSource>): string;
1612
1086
  (source: Url, options?: RouterResolveOptions): string;
1613
1087
  };
1614
1088
 
1615
- declare type RouterResolve_2<
1616
- TRoutes extends Routes_2
1617
- > = {
1618
- <TSource extends RoutesKey_2<TRoutes>>(source: TSource, ...args: RouterResolveArgs_2<TRoutes, TSource>): string,
1619
- (source: Url_2, options?: RouterResolveOptions_2): string,
1620
- }
1621
-
1622
1089
  declare type RouterResolveArgs<TRoutes extends Routes, TSource extends RoutesKey<TRoutes>, TParams = RouteParamsByKey<TRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: TParams, options?: RouterResolveOptions] : [params: TParams, options?: RouterResolveOptions];
1623
1090
 
1624
- declare type RouterResolveArgs_2<
1625
- TRoutes extends Routes_2,
1626
- TSource extends RoutesKey_2<TRoutes>,
1627
- TParams = RouteParamsByKey_2<TRoutes, TSource>
1628
- > = AllPropertiesAreOptional_2<TParams> extends true
1629
- ? [params?: TParams, options?: RouterResolveOptions_2]
1630
- : [params: TParams, options?: RouterResolveOptions_2]
1631
-
1632
1091
  declare type RouterResolveOptions = {
1633
1092
  query?: Record<string, string>;
1634
1093
  };
1635
1094
 
1636
- declare type RouterResolveOptions_2 = {
1637
- query?: Record<string, string>,
1638
- }
1639
-
1640
1095
  declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = Readonly<{
1641
1096
  key: TRoute['key'];
1642
1097
  matched: TRoute['matched'];
@@ -1646,14 +1101,12 @@ declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = Readonl
1646
1101
  update: RouteUpdate<TRoute>;
1647
1102
  }>;
1648
1103
 
1649
- declare type RouterRoute_2<TRoute extends ResolvedRoute_2 = ResolvedRoute_2> = Readonly<{
1650
- key: TRoute['key'],
1651
- matched: TRoute['matched'],
1652
- matches: TRoute['matches'],
1653
- query: ResolvedRouteQuery_2,
1654
- params: Writable_2<TRoute['params']>,
1655
- update: RouteUpdate_2<TRoute>,
1656
- }>
1104
+ /**
1105
+ * This type is the same as `RouterRoute<ResolvedRoute<TRoutes[number]>>` while remaining distributive
1106
+ */
1107
+ export declare type RouterRoutes<TRoutes extends Routes> = {
1108
+ [K in keyof TRoutes]: RouterRoute<ResolvedRoute<TRoutes[K]>>;
1109
+ }[number];
1657
1110
 
1658
1111
  export declare const RouterView: __VLS_WithTemplateSlots<DefineComponent<__VLS_TypePropsToRuntimeProps<{
1659
1112
  name?: string | undefined;
@@ -1666,14 +1119,11 @@ name?: string | undefined;
1666
1119
  matched: RoutePropsWithMeta;
1667
1120
  matches: RoutePropsWithMeta[];
1668
1121
  query: ResolvedRouteQuery;
1669
- params: Writable<Record<string, unknown>>;
1670
- update: RouteUpdate<Readonly<{
1671
- matched: RoutePropsWithMeta_2;
1672
- matches: RoutePropsWithMeta_2[];
1673
- key: string;
1674
- query: ResolvedRouteQuery_2;
1675
- params: Record<string, unknown>;
1676
- }>>;
1122
+ params: Writable< {}>;
1123
+ update: {
1124
+ (key: string, value: unknown, options?: RouterPushOptions | undefined): Promise<void>;
1125
+ (params: Partial<{}>, options?: RouterPushOptions | undefined): Promise<void>;
1126
+ };
1677
1127
  }>;
1678
1128
  component: Component;
1679
1129
  rejection: {
@@ -1690,14 +1140,11 @@ name?: string | undefined;
1690
1140
  matched: RoutePropsWithMeta;
1691
1141
  matches: RoutePropsWithMeta[];
1692
1142
  query: ResolvedRouteQuery;
1693
- params: Writable<Record<string, unknown>>;
1694
- update: RouteUpdate<Readonly<{
1695
- matched: RoutePropsWithMeta_2;
1696
- matches: RoutePropsWithMeta_2[];
1697
- key: string;
1698
- query: ResolvedRouteQuery_2;
1699
- params: Record<string, unknown>;
1700
- }>>;
1143
+ params: Writable< {}>;
1144
+ update: {
1145
+ (key: string, value: unknown, options?: RouterPushOptions | undefined): Promise<void>;
1146
+ (params: Partial<{}>, options?: RouterPushOptions | undefined): Promise<void>;
1147
+ };
1701
1148
  }>;
1702
1149
  component: Component;
1703
1150
  rejection: {
@@ -1714,57 +1161,32 @@ name?: string | undefined;
1714
1161
  */
1715
1162
  export declare type Routes = Readonly<Route[]>;
1716
1163
 
1717
- /**
1718
- * Represents an immutable array of Route instances. Return value of `createRoutes`, expected param for `createRouter`.
1719
- */
1720
- declare type Routes_2 = Readonly<Route_2[]>
1721
-
1722
1164
  declare type RoutesKey<TRoutes extends Routes> = string & keyof RoutesMap<TRoutes>;
1723
1165
 
1724
- declare type RoutesKey_2<TRoutes extends Routes_2> = string & keyof RoutesMap_2<TRoutes>
1725
-
1726
1166
  declare type RoutesMap<TRoutes extends Routes = []> = {
1727
- [K in TRoutes[number] as NamedNotDisabled<K> extends {
1728
- key: string;
1729
- } ? NamedNotDisabled<K>['key'] : never]: NamedNotDisabled<K>;
1167
+ [K in TRoutes[number] as RouteIsNamedAndNotDisabled<K>['key']]: RouteIsNamedAndNotDisabled<K>;
1730
1168
  };
1731
1169
 
1732
- declare type RoutesMap_2<TRoutes extends Routes_2 = []> = {
1733
- [K in TRoutes[number] as NamedNotDisabled_2<K> extends { key: string } ? NamedNotDisabled_2<K>['key']: never]: NamedNotDisabled_2<K>
1734
- }
1735
-
1736
- declare type RouteUpdate<TRoute extends ResolvedRoute = ResolvedRoute> = {
1170
+ declare type RouteUpdate<TRoute extends ResolvedRoute = ResolvedRoute> = ResolvedRoute extends TRoute ? {
1171
+ (key: string, value: unknown, options?: RouterPushOptions): Promise<void>;
1172
+ (params: Partial<TRoute['params']>, options?: RouterPushOptions): Promise<void>;
1173
+ } : {
1737
1174
  <TKey extends keyof TRoute['params']>(key: TKey, value: TRoute['params'][TKey], options?: RouterPushOptions): Promise<void>;
1738
1175
  (params: Partial<TRoute['params']>, options?: RouterPushOptions): Promise<void>;
1739
1176
  };
1740
1177
 
1741
- declare type RouteUpdate_2<TRoute extends ResolvedRoute_2 = ResolvedRoute_2> = {
1742
- <TKey extends keyof TRoute['params']>(key: TKey, value: TRoute['params'][TKey], options?: RouterPushOptions_2): Promise<void>,
1743
- (params: Partial<TRoute['params']>, options?: RouterPushOptions_2): Promise<void>,
1744
- }
1178
+ declare type StringHasValue<T> = string extends T ? true : '' extends T ? false : T extends string ? true : false;
1745
1179
 
1746
- declare type StringHasValue<T extends string | undefined> = T extends undefined ? false : '' extends T ? false : true;
1180
+ export declare function throwIfDuplicateParamsAreFound(routes: Route[]): void;
1747
1181
 
1748
1182
  declare type ToCallback = (resolve: RegisteredRouter['resolve']) => string;
1749
1183
 
1750
1184
  declare type ToPath<T extends string | Path> = T extends string ? Path<T, {}> : T;
1751
1185
 
1752
- declare type ToPath_2<T extends string | Path_2> = T extends string ? Path_2<T, {}> : T
1753
-
1754
1186
  declare type ToQuery<T extends string | Query | undefined> = T extends string ? Query<T, {}> : T extends undefined ? Query<'', {}> : unknown extends T ? Query<'', {}> : T;
1755
1187
 
1756
- declare type ToQuery_2<T extends string | Query_2 | undefined> = T extends string
1757
- ? Query_2<T, {}>
1758
- : T extends undefined
1759
- ? Query_2<'', {}>
1760
- : unknown extends T
1761
- ? Query_2<'', {}>
1762
- : T
1763
-
1764
1188
  declare type Url = `http://${string}` | `https://${string}` | `/${string}` | '/';
1765
1189
 
1766
- declare type Url_2 = `http://${string}` | `https://${string}` | `/${string}` | '/'
1767
-
1768
1190
  export declare type UseLink = {
1769
1191
  /**
1770
1192
  * ResolvedRoute if matched. Same value as `router.find`
@@ -1833,9 +1255,17 @@ export declare function useRejection(): RouterRejection;
1833
1255
  * The function also sets up a reactive watcher on the route object from the router to continually check the validity of the route key
1834
1256
  * if provided, throwing an error if the validation fails at any point during the component's lifecycle.
1835
1257
  */
1836
- export declare function useRoute<TRouteKey extends string & keyof RegisteredRouteMap>(routeKey: TRouteKey, options?: UseRouteOptions): RouterRoute<ResolvedRoute<RegisteredRouteMap[TRouteKey]>>;
1258
+ export declare function useRoute(): RegisteredRouterRoute;
1837
1259
 
1838
- export declare function useRoute(): RouterRoute;
1260
+ export declare function useRoute<TRouteKey extends RegisteredRoutesKey>(routeKey: TRouteKey, options: IsRouteOptions & {
1261
+ exact: true;
1262
+ }): RegisteredRouterRoute & {
1263
+ key: TRouteKey;
1264
+ };
1265
+
1266
+ export declare function useRoute<TRouteKey extends RegisteredRoutesKey>(routeKey: TRouteKey, options?: IsRouteOptions): RegisteredRouterRoute & {
1267
+ key: `${TRouteKey}${string}`;
1268
+ };
1839
1269
 
1840
1270
  /**
1841
1271
  * An error thrown when there is a mismatch between an expected route and the one actually used.
@@ -1850,10 +1280,6 @@ export declare class UseRouteInvalidError extends Error {
1850
1280
  constructor(routeName: string, actualRouteName: string);
1851
1281
  }
1852
1282
 
1853
- export declare type UseRouteOptions = {
1854
- exact?: boolean;
1855
- };
1856
-
1857
1283
  /**
1858
1284
  * A composition to access the registered router instance within a Vue component.
1859
1285
  *
@@ -1870,13 +1296,6 @@ declare type WithComponent = {
1870
1296
  component: Component;
1871
1297
  };
1872
1298
 
1873
- declare type WithComponent_2 = {
1874
- /**
1875
- * A Vue component, which can be either synchronous or asynchronous components.
1876
- */
1877
- component: Component,
1878
- }
1879
-
1880
1299
  declare type WithComponents = {
1881
1300
  /**
1882
1301
  * Multiple components for named views, which can be either synchronous or asynchronous components.
@@ -1884,13 +1303,6 @@ declare type WithComponents = {
1884
1303
  components: Record<string, Component>;
1885
1304
  };
1886
1305
 
1887
- declare type WithComponents_2 = {
1888
- /**
1889
- * Multiple components for named views, which can be either synchronous or asynchronous components.
1890
- */
1891
- components: Record<string, Component>,
1892
- }
1893
-
1894
1306
  export declare function withDefault<TParam extends Param>(param: TParam, defaultValue: ExtractParamType<TParam>): ParamWithDefault<TParam>;
1895
1307
 
1896
1308
  /**
@@ -1905,32 +1317,14 @@ declare type WithHooks = {
1905
1317
  onAfterRouteLeave?: MaybeArray<AfterRouteHook>;
1906
1318
  };
1907
1319
 
1908
- /**
1909
- * Defines route hooks that can be applied before entering, updating, or leaving a route, as well as after these events.
1910
- */
1911
- declare type WithHooks_2 = {
1912
- onBeforeRouteEnter?: MaybeArray_2<BeforeRouteHook_2>,
1913
- onBeforeRouteUpdate?: MaybeArray_2<BeforeRouteHook_2>,
1914
- onBeforeRouteLeave?: MaybeArray_2<BeforeRouteHook_2>,
1915
- onAfterRouteEnter?: MaybeArray_2<AfterRouteHook_2>,
1916
- onAfterRouteUpdate?: MaybeArray_2<AfterRouteHook_2>,
1917
- onAfterRouteLeave?: MaybeArray_2<AfterRouteHook_2>,
1918
- }
1919
-
1920
1320
  declare type WithOptionalProperties<T> = {
1921
1321
  [P in keyof T]-?: undefined extends T[P] ? P : never;
1922
1322
  }[keyof T];
1923
1323
 
1924
- declare type WithOptionalProperties_2<T> = {
1925
- [P in keyof T]-?: undefined extends T[P] ? P : never
1926
- }[keyof T]
1927
-
1928
1324
  declare type Writable<T> = {
1929
1325
  -readonly [P in keyof T]: T[P];
1930
1326
  };
1931
1327
 
1932
- declare type Writable_2<T> = { -readonly [P in keyof T]: T[P] }
1933
-
1934
1328
  export { }
1935
1329
 
1936
1330