@kitbag/router 0.18.2 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kitbag-router.d.ts +24 -9
- package/dist/kitbag-router.js +1659 -1505
- package/dist/kitbag-router.umd.cjs +3 -3
- package/package.json +12 -11
package/dist/kitbag-router.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
2
|
import { AsyncComponentLoader } from 'vue';
|
|
3
|
+
import { BaseIssue } from 'valibot';
|
|
4
|
+
import { BaseSchema } from 'valibot';
|
|
3
5
|
import { Component } from 'vue';
|
|
4
6
|
import { ComponentOptionsMixin } from 'vue';
|
|
5
7
|
import { ComponentProvideOptions } from 'vue';
|
|
@@ -9,7 +11,10 @@ import { FunctionalComponent } from 'vue';
|
|
|
9
11
|
import { MaybeRefOrGetter } from 'vue';
|
|
10
12
|
import { PublicProps } from 'vue';
|
|
11
13
|
import { Ref } from 'vue';
|
|
14
|
+
import { UnionOptions } from 'valibot';
|
|
15
|
+
import { UnionSchema } from 'valibot';
|
|
12
16
|
import { UnwrapRef } from 'vue';
|
|
17
|
+
import { VariantSchema } from 'valibot';
|
|
13
18
|
import { VNode } from 'vue';
|
|
14
19
|
|
|
15
20
|
declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
@@ -74,7 +79,6 @@ export declare type AddGlobalRouteHooks = (hooks: RouteHooks) => void;
|
|
|
74
79
|
export declare type AfterHookContext = {
|
|
75
80
|
to: ResolvedRoute;
|
|
76
81
|
from: ResolvedRoute | null;
|
|
77
|
-
app: App | null;
|
|
78
82
|
};
|
|
79
83
|
|
|
80
84
|
/**
|
|
@@ -109,7 +113,11 @@ export declare type AfterRouteHookResponse = CallbackSuccessResponse | CallbackP
|
|
|
109
113
|
|
|
110
114
|
declare type AllPropertiesAreOptional<T> = Record<string, unknown> extends T ? true : IsEmptyObject<OnlyRequiredProperties<T>>;
|
|
111
115
|
|
|
112
|
-
export declare function arrayOf<const T extends Param[]>(
|
|
116
|
+
export declare function arrayOf<const T extends Param[]>(params: T, options?: ArrayOfOptions): ParamGetSet<ExtractParamType<T[number]>[]>;
|
|
117
|
+
|
|
118
|
+
declare type ArrayOfOptions = {
|
|
119
|
+
separator?: string;
|
|
120
|
+
};
|
|
113
121
|
|
|
114
122
|
declare type AsNamedRoute<T extends Route> = IsRouteUnnamed<T> extends true ? never : T;
|
|
115
123
|
|
|
@@ -130,7 +138,6 @@ export declare function asUrl(value: string): Url;
|
|
|
130
138
|
export declare type BeforeHookContext = {
|
|
131
139
|
to: ResolvedRoute;
|
|
132
140
|
from: ResolvedRoute | null;
|
|
133
|
-
app: App | null;
|
|
134
141
|
};
|
|
135
142
|
|
|
136
143
|
/**
|
|
@@ -250,9 +257,9 @@ export declare type CreatedRouteOptions = Omit<CreateRouteOptions, 'props'> & Wi
|
|
|
250
257
|
props?: unknown;
|
|
251
258
|
};
|
|
252
259
|
|
|
253
|
-
export declare function createExternalRoute<const
|
|
260
|
+
export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithHost & WithoutParent>(options: TOptions): ToRoute<TOptions, undefined>;
|
|
254
261
|
|
|
255
|
-
export declare function createExternalRoute<const
|
|
262
|
+
export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithoutHost & WithParent>(options: TOptions): ToRoute<TOptions, undefined>;
|
|
256
263
|
|
|
257
264
|
export declare function createParam<TParam extends ParamWithDefault>(param: TParam): TParam;
|
|
258
265
|
|
|
@@ -587,7 +594,7 @@ declare type OnlyRequiredProperties<T> = {
|
|
|
587
594
|
[K in keyof T as Extract<T[K], undefined> extends never ? K : never]: T[K];
|
|
588
595
|
};
|
|
589
596
|
|
|
590
|
-
export declare type Param = ParamGetter | ParamGetSet | RegExp | BooleanConstructor | NumberConstructor | StringConstructor | DateConstructor | JSON | ZodSchemaLike | LiteralParam;
|
|
597
|
+
export declare type Param = ParamGetter | ParamGetSet | RegExp | BooleanConstructor | NumberConstructor | StringConstructor | DateConstructor | JSON | ZodSchemaLike | ValibotSchemaLike | LiteralParam;
|
|
591
598
|
|
|
592
599
|
declare type ParamEnd = typeof paramEnd;
|
|
593
600
|
|
|
@@ -1201,7 +1208,9 @@ declare type ToName<T extends string | undefined> = T extends string ? T : '';
|
|
|
1201
1208
|
|
|
1202
1209
|
declare type ToRoute<TOptions extends CreateRouteOptions, TProps extends CreateRouteProps<TOptions> | undefined> = CreateRouteOptions extends TOptions ? Route : TOptions extends {
|
|
1203
1210
|
parent: infer TParent extends Route;
|
|
1204
|
-
} ? Route<ToName<TOptions['name']>,
|
|
1211
|
+
} ? 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 {
|
|
1212
|
+
host: string | WithParams;
|
|
1213
|
+
} ? ToWithParams<TOptions['host']> : WithParams<'', {}>, ToWithParams<TOptions['path']>, ToWithParams<TOptions['query']>, ToWithParams<TOptions['hash']>, ToMeta<TOptions['meta']>, ToState<TOptions['state']>, ToMatches<TOptions, TProps>>;
|
|
1205
1214
|
|
|
1206
1215
|
declare type ToState<TState extends Record<string, Param> | undefined> = TState extends undefined ? Record<string, Param> : unknown extends TState ? {} : TState;
|
|
1207
1216
|
|
|
@@ -1211,9 +1220,13 @@ declare type TupleOf<T extends Param[]> = {
|
|
|
1211
1220
|
[K in keyof T]: ExtractParamType<T[K]>;
|
|
1212
1221
|
};
|
|
1213
1222
|
|
|
1214
|
-
export declare function tupleOf<const T extends Param[]>(
|
|
1223
|
+
export declare function tupleOf<const T extends Param[]>(params: T, options?: TupleOfOptions): ParamGetSet<TupleOf<T>>;
|
|
1215
1224
|
|
|
1216
|
-
|
|
1225
|
+
declare type TupleOfOptions = {
|
|
1226
|
+
separator?: string;
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1229
|
+
export declare function unionOf<const T extends Param[]>(params: T): ParamGetSet<ExtractParamType<T[number]>>;
|
|
1217
1230
|
|
|
1218
1231
|
export declare type Url = `http://${string}` | `https://${string}` | `/${string}`;
|
|
1219
1232
|
|
|
@@ -1337,6 +1350,8 @@ export declare class UseRouteInvalidError extends Error {
|
|
|
1337
1350
|
*/
|
|
1338
1351
|
export declare function useRouter(): RegisteredRouter;
|
|
1339
1352
|
|
|
1353
|
+
declare type ValibotSchemaLike = BaseSchema<unknown, unknown, BaseIssue<unknown>> | UnionSchema<UnionOptions, any> | VariantSchema<any, any, any>;
|
|
1354
|
+
|
|
1340
1355
|
export declare function withDefault<TParam extends Param>(param: TParam, defaultValue: ExtractParamType<TParam>): ParamWithDefault<TParam>;
|
|
1341
1356
|
|
|
1342
1357
|
/**
|