@kitbag/router 0.19.0 → 0.20.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.
- package/dist/kitbag-router.d.ts +15 -8
- package/dist/kitbag-router.js +1495 -1355
- package/dist/kitbag-router.umd.cjs +3 -3
- package/package.json +13 -11
package/dist/kitbag-router.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { FunctionalComponent } from 'vue';
|
|
|
9
9
|
import { MaybeRefOrGetter } from 'vue';
|
|
10
10
|
import { PublicProps } from 'vue';
|
|
11
11
|
import { Ref } from 'vue';
|
|
12
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
12
13
|
import { UnwrapRef } from 'vue';
|
|
13
14
|
import { VNode } from 'vue';
|
|
14
15
|
|
|
@@ -252,9 +253,9 @@ export declare type CreatedRouteOptions = Omit<CreateRouteOptions, 'props'> & Wi
|
|
|
252
253
|
props?: unknown;
|
|
253
254
|
};
|
|
254
255
|
|
|
255
|
-
export declare function createExternalRoute<const
|
|
256
|
+
export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithHost & WithoutParent>(options: TOptions): ToRoute<TOptions, undefined>;
|
|
256
257
|
|
|
257
|
-
export declare function createExternalRoute<const
|
|
258
|
+
export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithoutHost & WithParent>(options: TOptions): ToRoute<TOptions, undefined>;
|
|
258
259
|
|
|
259
260
|
export declare function createParam<TParam extends ParamWithDefault>(param: TParam): TParam;
|
|
260
261
|
|
|
@@ -379,7 +380,7 @@ declare type ExtractParamName<TParam extends PropertyKey> = TParam extends strin
|
|
|
379
380
|
* @template TParam - The parameter type.
|
|
380
381
|
* @returns The extracted type, or 'string' as a fallback.
|
|
381
382
|
*/
|
|
382
|
-
declare type ExtractParamType<TParam extends Param> = TParam extends ParamGetSet<infer Type> ? Type : TParam extends ParamGetter ? ReturnType<TParam> : TParam extends
|
|
383
|
+
declare type ExtractParamType<TParam extends Param> = TParam extends ParamGetSet<infer Type> ? Type : TParam extends ParamGetter ? ReturnType<TParam> : TParam extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<TParam> : TParam extends LiteralParam ? TParam : string;
|
|
383
384
|
|
|
384
385
|
declare type ExtractParamTypes<TParams extends Record<string, Param>> = Identity<MakeOptional<{
|
|
385
386
|
[K in keyof TParams as ExtractParamName<K>]: ExtractParamType<TParams[K]>;
|
|
@@ -589,7 +590,7 @@ declare type OnlyRequiredProperties<T> = {
|
|
|
589
590
|
[K in keyof T as Extract<T[K], undefined> extends never ? K : never]: T[K];
|
|
590
591
|
};
|
|
591
592
|
|
|
592
|
-
export declare type Param = ParamGetter | ParamGetSet | RegExp | BooleanConstructor | NumberConstructor | StringConstructor | DateConstructor | JSON | ZodSchemaLike | LiteralParam;
|
|
593
|
+
export declare type Param = ParamGetter | ParamGetSet | RegExp | BooleanConstructor | NumberConstructor | StringConstructor | DateConstructor | JSON | ZodSchemaLike | ValibotSchemaLike | LiteralParam;
|
|
593
594
|
|
|
594
595
|
declare type ParamEnd = typeof paramEnd;
|
|
595
596
|
|
|
@@ -1203,7 +1204,9 @@ declare type ToName<T extends string | undefined> = T extends string ? T : '';
|
|
|
1203
1204
|
|
|
1204
1205
|
declare type ToRoute<TOptions extends CreateRouteOptions, TProps extends CreateRouteProps<TOptions> | undefined> = CreateRouteOptions extends TOptions ? Route : TOptions extends {
|
|
1205
1206
|
parent: infer TParent extends Route;
|
|
1206
|
-
} ? Route<ToName<TOptions['name']>,
|
|
1207
|
+
} ? Route<ToName<TOptions['name']>, ToWithParams<TParent['host']>, CombinePath<ToWithParams<TParent['path']>, ToWithParams<TOptions['path']>>, CombineQuery<ToWithParams<TParent['query']>, ToWithParams<TOptions['query']>>, CombineHash<ToWithParams<TParent['hash']>, ToWithParams<TOptions['hash']>>, CombineMeta<ToMeta<TParent['meta']>, ToMeta<TOptions['meta']>>, CombineState<ToState<TParent['state']>, ToState<TOptions['state']>>, ToMatches<TOptions, TProps>> : Route<ToName<TOptions['name']>, TOptions extends {
|
|
1208
|
+
host: string | WithParams;
|
|
1209
|
+
} ? ToWithParams<TOptions['host']> : WithParams<'', {}>, ToWithParams<TOptions['path']>, ToWithParams<TOptions['query']>, ToWithParams<TOptions['hash']>, ToMeta<TOptions['meta']>, ToState<TOptions['state']>, ToMatches<TOptions, TProps>>;
|
|
1207
1210
|
|
|
1208
1211
|
declare type ToState<TState extends Record<string, Param> | undefined> = TState extends undefined ? Record<string, Param> : unknown extends TState ? {} : TState;
|
|
1209
1212
|
|
|
@@ -1343,6 +1346,10 @@ export declare class UseRouteInvalidError extends Error {
|
|
|
1343
1346
|
*/
|
|
1344
1347
|
export declare function useRouter(): RegisteredRouter;
|
|
1345
1348
|
|
|
1349
|
+
declare interface ValibotSchemaLike extends StandardSchemaV1<any> {
|
|
1350
|
+
type: string;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1346
1353
|
export declare function withDefault<TParam extends Param>(param: TParam, defaultValue: ExtractParamType<TParam>): ParamWithDefault<TParam>;
|
|
1347
1354
|
|
|
1348
1355
|
/**
|
|
@@ -1393,9 +1400,9 @@ declare type WithParent<TParent extends Route = Route> = {
|
|
|
1393
1400
|
parent: TParent;
|
|
1394
1401
|
};
|
|
1395
1402
|
|
|
1396
|
-
declare
|
|
1397
|
-
parse: (input: any) =>
|
|
1398
|
-
}
|
|
1403
|
+
declare interface ZodSchemaLike extends StandardSchemaV1<any> {
|
|
1404
|
+
parse: (input: any) => any;
|
|
1405
|
+
}
|
|
1399
1406
|
|
|
1400
1407
|
export { }
|
|
1401
1408
|
|