@regle/core 1.10.1 → 1.11.0-beta.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/regle-core.d.ts +1519 -77
- package/dist/regle-core.js +612 -5
- package/dist/regle-core.min.js +1 -1
- package/package.json +4 -2
package/dist/regle-core.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import * as vue0 from "vue";
|
|
2
|
-
import { MaybeRef, MaybeRefOrGetter, Raw, Ref, UnwrapNestedRefs, UnwrapRef } from "vue";
|
|
2
|
+
import { AllowedComponentProps, AnchorHTMLAttributes, App, Component as Component$1, ComponentCustomProps, ComponentPublicInstance, ComputedRef, DefineComponent, MaybeRef, MaybeRefOrGetter, Plugin, Raw, Ref, ShallowRef, UnwrapNestedRefs, UnwrapRef, VNode, VNodeProps } from "vue";
|
|
3
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
|
|
5
5
|
//#region src/types/utils/misc.types.d.ts
|
|
6
|
-
type Prettify<T> = T extends infer R ? { [K in keyof R]: R[K] } & {} : never;
|
|
7
|
-
type Maybe<T = any> = T | null | undefined;
|
|
8
|
-
type MaybeInput<T = any> = T | null | undefined;
|
|
9
|
-
type MaybeOutput<T = any> = T | undefined;
|
|
10
|
-
type MaybeReadonly<T> = T | Readonly<T>;
|
|
11
|
-
type NonUndefined<T> = Exclude<T, undefined>;
|
|
12
|
-
type PromiseReturn<T> = T extends Promise<infer U> ? U : T;
|
|
13
|
-
type MaybeGetter<T, V$1 = any, TAdd extends Record<string, any> = {}> = T | ((value: Ref<V$1>, index: number) => T & TAdd);
|
|
14
|
-
type Unwrap<T extends MaybeRef<Record<string, any>>> = T extends Ref ? UnwrapRef<T> : UnwrapNestedRefs<T>;
|
|
15
|
-
type UnwrapSimple<T extends MaybeRef<Record<string, any>>> = T extends Ref ? UnwrapRef<T> : T extends ((...args: any[]) => infer U) ? U : T;
|
|
16
|
-
type ExtractFromGetter<T extends MaybeGetter<any, any, any>> = T extends ((value: Ref<any>, index: number) => infer U extends Record<string, any>) ? U : T;
|
|
17
|
-
type ExtendOnlyRealRecord<T extends unknown> = NonNullable<T> extends File | Date ? false : NonNullable<T> extends Record<string, any> ? true : false;
|
|
18
|
-
type OmitByType<T extends Record<string, any>, U$1> = { [K in keyof T as T[K] extends U$1 ? never : K]: T[K] };
|
|
19
|
-
type DeepMaybeRef<T extends Record<string, any>> = { [K in keyof T]: MaybeRef<T[K]> };
|
|
20
|
-
type ExcludeByType<T, U$1> = { [K in keyof T as T[K] extends U$1 ? never : K]: T[K] extends U$1 ? never : T[K] };
|
|
6
|
+
type Prettify<T$1> = T$1 extends infer R ? { [K in keyof R]: R[K] } & {} : never;
|
|
7
|
+
type Maybe<T$1 = any> = T$1 | null | undefined;
|
|
8
|
+
type MaybeInput<T$1 = any> = T$1 | null | undefined;
|
|
9
|
+
type MaybeOutput<T$1 = any> = T$1 | undefined;
|
|
10
|
+
type MaybeReadonly<T$1> = T$1 | Readonly<T$1>;
|
|
11
|
+
type NonUndefined<T$1> = Exclude<T$1, undefined>;
|
|
12
|
+
type PromiseReturn<T$1> = T$1 extends Promise<infer U> ? U : T$1;
|
|
13
|
+
type MaybeGetter<T$1, V$1 = any, TAdd extends Record<string, any> = {}> = T$1 | ((value: Ref<V$1>, index: number) => T$1 & TAdd);
|
|
14
|
+
type Unwrap<T$1 extends MaybeRef<Record<string, any>>> = T$1 extends Ref ? UnwrapRef<T$1> : UnwrapNestedRefs<T$1>;
|
|
15
|
+
type UnwrapSimple<T$1 extends MaybeRef<Record<string, any>>> = T$1 extends Ref ? UnwrapRef<T$1> : T$1 extends ((...args: any[]) => infer U) ? U : T$1;
|
|
16
|
+
type ExtractFromGetter<T$1 extends MaybeGetter<any, any, any>> = T$1 extends ((value: Ref<any>, index: number) => infer U extends Record<string, any>) ? U : T$1;
|
|
17
|
+
type ExtendOnlyRealRecord<T$1 extends unknown> = NonNullable<T$1> extends File | Date ? false : NonNullable<T$1> extends Record<string, any> ? true : false;
|
|
18
|
+
type OmitByType<T$1 extends Record<string, any>, U$1> = { [K in keyof T$1 as T$1[K] extends U$1 ? never : K]: T$1[K] };
|
|
19
|
+
type DeepMaybeRef<T$1 extends Record<string, any>> = { [K in keyof T$1]: MaybeRef<T$1[K]> };
|
|
20
|
+
type ExcludeByType<T$1, U$1> = { [K in keyof T$1 as T$1[K] extends U$1 ? never : K]: T$1[K] extends U$1 ? never : T$1[K] };
|
|
21
21
|
type PrimitiveTypes = string | number | boolean | bigint | Date | File;
|
|
22
|
-
type isRecordLiteral<T extends unknown> = NonNullable<T> extends Date | File ? false : NonNullable<T> extends Record<string, any> ? true : false;
|
|
22
|
+
type isRecordLiteral<T$1 extends unknown> = NonNullable<T$1> extends Date | File ? false : NonNullable<T$1> extends Record<string, any> ? true : false;
|
|
23
23
|
type NoInferLegacy<A$1 extends any> = [A$1][A$1 extends any ? 0 : never];
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/types/utils/Array.types.d.ts
|
|
26
|
-
type ArrayElement<T> = T extends Array<infer U> ? U : never;
|
|
27
|
-
type NonEmptyTuple<T> = [T, ...T[]] | T[];
|
|
26
|
+
type ArrayElement<T$1> = T$1 extends Array<infer U> ? U : never;
|
|
27
|
+
type NonEmptyTuple<T$1> = [T$1, ...T$1[]] | T$1[];
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/primitive.d.ts
|
|
30
30
|
/**
|
|
@@ -143,7 +143,7 @@ type Fail = IsEmptyObject<null>; //=> false
|
|
|
143
143
|
@see {@link EmptyObject}
|
|
144
144
|
@category Object
|
|
145
145
|
*/
|
|
146
|
-
type IsEmptyObject<T> = T extends EmptyObject ? true : false;
|
|
146
|
+
type IsEmptyObject<T$1> = T$1 extends EmptyObject ? true : false;
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-any.d.ts
|
|
149
149
|
/**
|
|
@@ -174,7 +174,7 @@ const anyA = get(anyObject, 'a');
|
|
|
174
174
|
@category Type Guard
|
|
175
175
|
@category Utilities
|
|
176
176
|
*/
|
|
177
|
-
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
177
|
+
type IsAny<T$1> = 0 extends 1 & NoInfer<T$1> ? true : false;
|
|
178
178
|
//#endregion
|
|
179
179
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
180
180
|
/**
|
|
@@ -327,7 +327,7 @@ endIfEqual('abc', '123');
|
|
|
327
327
|
@category Type Guard
|
|
328
328
|
@category Utilities
|
|
329
329
|
*/
|
|
330
|
-
type IsNever$1<T> = [T] extends [never] ? true : false;
|
|
330
|
+
type IsNever$1<T$1> = [T$1] extends [never] ? true : false;
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/if.d.ts
|
|
333
333
|
/**
|
|
@@ -437,7 +437,7 @@ Needed to handle the case of a single call signature with properties.
|
|
|
437
437
|
Multiple call signatures cannot currently be supported due to a TypeScript limitation.
|
|
438
438
|
@see https://github.com/microsoft/TypeScript/issues/29732
|
|
439
439
|
*/
|
|
440
|
-
type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
|
|
440
|
+
type HasMultipleCallSignatures<T$1 extends (...arguments_: any[]) => unknown> = T$1 extends {
|
|
441
441
|
(...arguments_: infer A): unknown;
|
|
442
442
|
(...arguments_: infer B): unknown;
|
|
443
443
|
} ? B extends A ? A extends B ? false : true : true : false;
|
|
@@ -485,7 +485,7 @@ type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
|
|
|
485
485
|
//=> ''
|
|
486
486
|
```
|
|
487
487
|
*/
|
|
488
|
-
type IfNotAnyOrNever<T, IfNotAnyOrNever$1, IfAny = any, IfNever = never> = If<IsAny<T>, IfAny, If<IsNever$1<T>, IfNever, IfNotAnyOrNever$1>>;
|
|
488
|
+
type IfNotAnyOrNever<T$1, IfNotAnyOrNever$1, IfAny = any, IfNever = never> = If<IsAny<T$1>, IfAny, If<IsNever$1<T$1>, IfNever, IfNotAnyOrNever$1>>;
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-null.d.ts
|
|
491
491
|
/**
|
|
@@ -507,7 +507,7 @@ type Example2 = NonNullFallback<number, string>;
|
|
|
507
507
|
@category Type Guard
|
|
508
508
|
@category Utilities
|
|
509
509
|
*/
|
|
510
|
-
type IsNull<T> = [T] extends [null] ? true : false;
|
|
510
|
+
type IsNull<T$1> = [T$1] extends [null] ? true : false;
|
|
511
511
|
//#endregion
|
|
512
512
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-unknown.d.ts
|
|
513
513
|
/**
|
|
@@ -553,8 +553,8 @@ store.execute((state, payload) => ({value: state.value + payload}), someExternal
|
|
|
553
553
|
|
|
554
554
|
@category Utilities
|
|
555
555
|
*/
|
|
556
|
-
type IsUnknown<T> = (unknown extends T // `T` can be `unknown` or `any`
|
|
557
|
-
? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be
|
|
556
|
+
type IsUnknown<T$1> = (unknown extends T$1 // `T` can be `unknown` or `any`
|
|
557
|
+
? IsNull<T$1> extends false // `any` can be `null`, but `unknown` can't be
|
|
558
558
|
? true : false : false);
|
|
559
559
|
//#endregion
|
|
560
560
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/keys.d.ts
|
|
@@ -621,7 +621,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
621
621
|
@see {@link SimplifyDeep}
|
|
622
622
|
@category Object
|
|
623
623
|
*/
|
|
624
|
-
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
624
|
+
type Simplify<T$1> = { [KeyType in keyof T$1]: T$1[KeyType] } & {};
|
|
625
625
|
//#endregion
|
|
626
626
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
627
627
|
/**
|
|
@@ -1023,11 +1023,11 @@ type B = IsUnion<string>;
|
|
|
1023
1023
|
//=> false
|
|
1024
1024
|
```
|
|
1025
1025
|
*/
|
|
1026
|
-
type IsUnion$1<T> = InternalIsUnion<T>;
|
|
1026
|
+
type IsUnion$1<T$1> = InternalIsUnion<T$1>;
|
|
1027
1027
|
/**
|
|
1028
1028
|
The actual implementation of `IsUnion`.
|
|
1029
1029
|
*/
|
|
1030
|
-
type InternalIsUnion<T, U$1 = T> = (IsNever$1<T> extends true ? false : T extends any ? [U$1] extends [T] ? false : true : never) extends infer Result
|
|
1030
|
+
type InternalIsUnion<T$1, U$1 = T$1> = (IsNever$1<T$1> extends true ? false : T$1 extends any ? [U$1] extends [T$1] ? false : true : never) extends infer Result
|
|
1031
1031
|
// In some cases `Result` will return `false | true` which is `boolean`,
|
|
1032
1032
|
// that means `T` has at least two types and it's a union type,
|
|
1033
1033
|
// so we will return `true` instead of `boolean`.
|
|
@@ -1118,14 +1118,14 @@ partialShape.dimensions = [15]; // OK
|
|
|
1118
1118
|
@category Set
|
|
1119
1119
|
@category Map
|
|
1120
1120
|
*/
|
|
1121
|
-
type PartialDeep<T, Options extends PartialDeepOptions = {}> = _PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
|
|
1122
|
-
type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends ((...arguments_: any[]) => unknown) ? IsNever$1<keyof T> extends true ? T // For functions with no properties
|
|
1123
|
-
: HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep<T, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
|
|
1124
|
-
? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
|
|
1125
|
-
? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
|
|
1126
|
-
? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep<T, Options> // Tuples behave properly
|
|
1127
|
-
: T // If they don't opt into array testing, just use the original type
|
|
1128
|
-
: PartialObjectDeep<T, Options> : unknown;
|
|
1121
|
+
type PartialDeep<T$1, Options extends PartialDeepOptions = {}> = _PartialDeep<T$1, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
|
|
1122
|
+
type _PartialDeep<T$1, Options extends Required<PartialDeepOptions>> = T$1 extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T$1 : T$1 extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T$1 extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T$1 extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T$1 extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T$1 extends ((...arguments_: any[]) => unknown) ? IsNever$1<keyof T$1> extends true ? T$1 // For functions with no properties
|
|
1123
|
+
: HasMultipleCallSignatures<T$1> extends true ? T$1 : ((...arguments_: Parameters<T$1>) => ReturnType<T$1>) & PartialObjectDeep<T$1, Options> : T$1 extends object ? T$1 extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
|
|
1124
|
+
? Options['recurseIntoArrays'] extends true ? ItemType[] extends T$1 // Test for arrays (non-tuples) specifically
|
|
1125
|
+
? readonly ItemType[] extends T$1 // Differentiate readonly and mutable arrays
|
|
1126
|
+
? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep<T$1, Options> // Tuples behave properly
|
|
1127
|
+
: T$1 // If they don't opt into array testing, just use the original type
|
|
1128
|
+
: PartialObjectDeep<T$1, Options> : unknown;
|
|
1129
1129
|
|
|
1130
1130
|
/**
|
|
1131
1131
|
Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
|
|
@@ -1135,7 +1135,7 @@ type PartialMapDeep<KeyType$1, ValueType$1, Options extends Required<PartialDeep
|
|
|
1135
1135
|
/**
|
|
1136
1136
|
Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
|
|
1137
1137
|
*/
|
|
1138
|
-
type PartialSetDeep<T, Options extends Required<PartialDeepOptions>> = {} & Set<_PartialDeep<T, Options>>;
|
|
1138
|
+
type PartialSetDeep<T$1, Options extends Required<PartialDeepOptions>> = {} & Set<_PartialDeep<T$1, Options>>;
|
|
1139
1139
|
|
|
1140
1140
|
/**
|
|
1141
1141
|
Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
|
|
@@ -1145,7 +1145,7 @@ type PartialReadonlyMapDeep<KeyType$1, ValueType$1, Options extends Required<Par
|
|
|
1145
1145
|
/**
|
|
1146
1146
|
Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
|
|
1147
1147
|
*/
|
|
1148
|
-
type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {} & ReadonlySet<_PartialDeep<T, Options>>;
|
|
1148
|
+
type PartialReadonlySetDeep<T$1, Options extends Required<PartialDeepOptions>> = {} & ReadonlySet<_PartialDeep<T$1, Options>>;
|
|
1149
1149
|
|
|
1150
1150
|
/**
|
|
1151
1151
|
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
|
@@ -1194,7 +1194,7 @@ Note that types containing overloaded functions are not made deeply required due
|
|
|
1194
1194
|
@category Set
|
|
1195
1195
|
@category Map
|
|
1196
1196
|
*/
|
|
1197
|
-
type RequiredDeep<T> = T extends BuiltIns ? T : T extends Map<infer KeyType, infer ValueType> ? Map<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T extends Set<infer ItemType> ? Set<RequiredDeep<ItemType>> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? ReadonlyMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T extends ReadonlySet<infer ItemType> ? ReadonlySet<RequiredDeep<ItemType>> : T extends WeakMap<infer KeyType, infer ValueType> ? WeakMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T extends WeakSet<infer ItemType> ? WeakSet<RequiredDeep<ItemType>> : T extends Promise<infer ValueType> ? Promise<RequiredDeep<ValueType>> : T extends ((...arguments_: any[]) => unknown) ? IsNever$1<keyof T> extends true ? T : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & RequiredObjectDeep<T> : T extends object ? RequiredObjectDeep<T> : unknown;
|
|
1197
|
+
type RequiredDeep<T$1> = T$1 extends BuiltIns ? T$1 : T$1 extends Map<infer KeyType, infer ValueType> ? Map<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T$1 extends Set<infer ItemType> ? Set<RequiredDeep<ItemType>> : T$1 extends ReadonlyMap<infer KeyType, infer ValueType> ? ReadonlyMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T$1 extends ReadonlySet<infer ItemType> ? ReadonlySet<RequiredDeep<ItemType>> : T$1 extends WeakMap<infer KeyType, infer ValueType> ? WeakMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T$1 extends WeakSet<infer ItemType> ? WeakSet<RequiredDeep<ItemType>> : T$1 extends Promise<infer ValueType> ? Promise<RequiredDeep<ValueType>> : T$1 extends ((...arguments_: any[]) => unknown) ? IsNever$1<keyof T$1> extends true ? T$1 : HasMultipleCallSignatures<T$1> extends true ? T$1 : ((...arguments_: Parameters<T$1>) => ReturnType<T$1>) & RequiredObjectDeep<T$1> : T$1 extends object ? RequiredObjectDeep<T$1> : unknown;
|
|
1198
1198
|
type RequiredObjectDeep<ObjectType extends object> = { [KeyType in keyof ObjectType]-?: RequiredDeep<ObjectType[KeyType]> };
|
|
1199
1199
|
//#endregion
|
|
1200
1200
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/union-to-tuple.d.ts
|
|
@@ -1207,7 +1207,7 @@ type Last = LastOfUnion<1 | 2 | 3>;
|
|
|
1207
1207
|
//=> 3
|
|
1208
1208
|
```
|
|
1209
1209
|
*/
|
|
1210
|
-
type LastOfUnion<T> = UnionToIntersection<T extends any ? () => T : never> extends (() => (infer R)) ? R : never;
|
|
1210
|
+
type LastOfUnion<T$1> = UnionToIntersection<T$1 extends any ? () => T$1 : never> extends (() => (infer R)) ? R : never;
|
|
1211
1211
|
|
|
1212
1212
|
/**
|
|
1213
1213
|
Convert a union type into an unordered tuple type of its elements.
|
|
@@ -1244,7 +1244,7 @@ const petList = Object.keys(pets) as UnionToTuple<Pet>;
|
|
|
1244
1244
|
|
|
1245
1245
|
@category Array
|
|
1246
1246
|
*/
|
|
1247
|
-
type UnionToTuple<T, L = LastOfUnion<T>> = IsNever$1<T> extends false ? [...UnionToTuple<Exclude<T, L>>, L] : [];
|
|
1247
|
+
type UnionToTuple<T$1, L = LastOfUnion<T$1>> = IsNever$1<T$1> extends false ? [...UnionToTuple<Exclude<T$1, L>>, L] : [];
|
|
1248
1248
|
//#endregion
|
|
1249
1249
|
//#region src/types/core/modifiers.types.d.ts
|
|
1250
1250
|
interface RegleBehaviourOptions {
|
|
@@ -1282,6 +1282,11 @@ interface RegleBehaviourOptions {
|
|
|
1282
1282
|
*
|
|
1283
1283
|
*/
|
|
1284
1284
|
clearExternalErrorsOnChange?: boolean | undefined;
|
|
1285
|
+
/**
|
|
1286
|
+
* A unique identifier for the Regle instance in the devtools.
|
|
1287
|
+
* @default undefined
|
|
1288
|
+
*/
|
|
1289
|
+
id?: string | undefined;
|
|
1285
1290
|
}
|
|
1286
1291
|
interface LocalRegleBehaviourOptions<TState$1 extends Record<string, any>, TRules$1 extends ReglePartialRuleTree<TState$1, CustomRulesDeclarationTree>, TValidationGroups extends Record<string, RegleValidationGroupEntry[]> = {}> {
|
|
1287
1292
|
externalErrors?: Ref<RegleExternalErrorTree<Unwrap<TState$1>> | Record<string, string[]>>;
|
|
@@ -1314,8 +1319,8 @@ type CollectionRegleBehaviourOptions = FieldRegleBehaviourOptions & {
|
|
|
1314
1319
|
$deepCompare?: boolean;
|
|
1315
1320
|
};
|
|
1316
1321
|
type ResolvedRegleBehaviourOptions = DeepMaybeRef<RequiredDeep<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<Record<string, any>, Record<string, any>, Record<string, any[]>>;
|
|
1317
|
-
type ShortcutCommonFn<T extends Record<string, any>> = {
|
|
1318
|
-
[x: string]: (element: Omit<OmitByType<T, Function>, '~standard'>) => unknown;
|
|
1322
|
+
type ShortcutCommonFn<T$1 extends Record<string, any>> = {
|
|
1323
|
+
[x: string]: (element: Omit<OmitByType<T$1, Function>, '~standard'>) => unknown;
|
|
1319
1324
|
};
|
|
1320
1325
|
type RegleShortcutDefinition<TCustomRules extends Record<string, any> = {}> = {
|
|
1321
1326
|
/**
|
|
@@ -1331,7 +1336,7 @@ type RegleShortcutDefinition<TCustomRules extends Record<string, any> = {}> = {
|
|
|
1331
1336
|
*/
|
|
1332
1337
|
collections?: ShortcutCommonFn<RegleCollectionStatus<any[], Partial<TCustomRules> & Partial<DefaultValidators>>>;
|
|
1333
1338
|
};
|
|
1334
|
-
type AddDollarToOptions<T extends Record<string, any>> = { [K in keyof T as `$${string & K}`]: T[K] };
|
|
1339
|
+
type AddDollarToOptions<T$1 extends Record<string, any>> = { [K in keyof T$1 as `$${string & K}`]: T$1[K] };
|
|
1335
1340
|
//#endregion
|
|
1336
1341
|
//#region src/types/core/useRegle.types.d.ts
|
|
1337
1342
|
/**
|
|
@@ -1368,7 +1373,7 @@ type RegleSingleField<TState$1 extends Maybe<PrimitiveTypes> = any, TRules$1 ext
|
|
|
1368
1373
|
*/
|
|
1369
1374
|
r$: Raw<RegleFieldStatus<TState$1, TRules$1, TShortcuts>>;
|
|
1370
1375
|
} & TAdditionalReturnProperties;
|
|
1371
|
-
type DeepReactiveState<T extends Record<string, any> | unknown | undefined> = ExtendOnlyRealRecord<T> extends true ? { [K in keyof T]: InferDeepReactiveState<T[K]> } : never;
|
|
1376
|
+
type DeepReactiveState<T$1 extends Record<string, any> | unknown | undefined> = ExtendOnlyRealRecord<T$1> extends true ? { [K in keyof T$1]: InferDeepReactiveState<T$1[K]> } : never;
|
|
1372
1377
|
type InferDeepReactiveState<TState$1> = NonNullable<TState$1> extends Array<infer U extends Record<string, any>> ? DeepReactiveState<U[]> : NonNullable<TState$1> extends Date | File ? MaybeRef<TState$1> : NonNullable<TState$1> extends Record<string, any> ? DeepReactiveState<TState$1> : MaybeRef<TState$1>;
|
|
1373
1378
|
//#endregion
|
|
1374
1379
|
//#region src/types/core/reset.types.d.ts
|
|
@@ -1472,11 +1477,11 @@ type SafeFieldProperty<TState$1, TRule extends RegleFormPropertyType<any, any> |
|
|
|
1472
1477
|
/**
|
|
1473
1478
|
* Negates a boolean type.
|
|
1474
1479
|
*/
|
|
1475
|
-
type Not<T extends boolean> = T extends true ? false : true;
|
|
1480
|
+
type Not<T$1 extends boolean> = T$1 extends true ? false : true;
|
|
1476
1481
|
/**
|
|
1477
1482
|
* Checks if the given type is `never`.
|
|
1478
1483
|
*/
|
|
1479
|
-
type IsNever<T> = [T] extends [never] ? true : false;
|
|
1484
|
+
type IsNever<T$1> = [T$1] extends [never] ? true : false;
|
|
1480
1485
|
/**
|
|
1481
1486
|
* Checks if one type extends another. Note: this is not quite the same as `Left extends Right` because:
|
|
1482
1487
|
* 1. If either type is `never`, the result is `true` iff the other type is also `never`.
|
|
@@ -1504,7 +1509,7 @@ type TuplifyUnion<Union, LastElement = LastOf<Union>> = IsNever<Union> extends t
|
|
|
1504
1509
|
* Convert a union like `1 | 2 | 3` to a tuple like `[1, 2, 3]`.
|
|
1505
1510
|
*/
|
|
1506
1511
|
type UnionToTuple$1<Union> = TuplifyUnion<Union>;
|
|
1507
|
-
type IsUnion<T> = Not<Extends<UnionToTuple$1<T>['length'], 1>>;
|
|
1512
|
+
type IsUnion<T$1> = Not<Extends<UnionToTuple$1<T$1>['length'], 1>>;
|
|
1508
1513
|
//#endregion
|
|
1509
1514
|
//#region src/types/core/variants.types.d.ts
|
|
1510
1515
|
type NarrowVariant<TRoot extends {
|
|
@@ -1522,15 +1527,15 @@ type MaybeVariantStatus<TState$1 extends Record<string, any> | undefined = Recor
|
|
|
1522
1527
|
} & (HasNamedKeys<TState$1> extends true ? ProcessChildrenFields<TState$1, TRules$1, TShortcuts>[keyof ProcessChildrenFields<TState$1, TRules$1, TShortcuts>] : {}) : RegleStatus<TState$1, TRules$1, TShortcuts>;
|
|
1523
1528
|
type ProcessChildrenFields<TState$1 extends Record<string, any> | undefined, TRules$1 extends ReglePartialRuleTree<NonNullable<TState$1>>, TShortcuts extends RegleShortcutDefinition = {}> = { [TIndex in keyof TupleToPlainObj<UnionToTuple<TState$1>>]: TIndex extends `${infer TIndexInt extends number}` ? { [TKey in keyof UnionToTuple<TState$1>[TIndexInt] as IsEmptyObject<FindCorrespondingVariant<UnionToTuple<TState$1>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState$1>[TIndexInt] : never, UnionToTuple<TRules$1>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject : EmptyObject> extends true ? TKey extends keyof TState$1 ? TState$1[TKey] extends NonNullable<TState$1[TKey]> ? TKey : never : never : TKey]-?: InferRegleStatusType<FindCorrespondingVariant<UnionToTuple<TState$1>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState$1>[TIndexInt] : never, UnionToTuple<TRules$1>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject : EmptyObject, NonNullable<UnionToTuple<TState$1>[TIndexInt]>, TKey, TShortcuts> } & { [TKey in keyof UnionToTuple<TState$1>[TIndexInt] as IsEmptyObject<FindCorrespondingVariant<UnionToTuple<TState$1>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState$1>[TIndexInt] : never, UnionToTuple<TRules$1>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject : EmptyObject> extends true ? TKey extends keyof TState$1 ? TState$1[TKey] extends NonNullable<TState$1[TKey]> ? never : TKey : TKey : never]?: InferRegleStatusType<FindCorrespondingVariant<UnionToTuple<TState$1>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState$1>[TIndexInt] : never, UnionToTuple<TRules$1>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject : EmptyObject, NonNullable<UnionToTuple<TState$1>[TIndexInt]>, TKey, TShortcuts> } : {} };
|
|
1524
1529
|
type FindCorrespondingVariant<TState$1 extends Record<string, any>, TRules$1 extends any[]> = TRules$1 extends [infer F, ...infer R] ? F extends ReglePartialRuleTree<TState$1> ? [F] : FindCorrespondingVariant<TState$1, R> : [];
|
|
1525
|
-
type PossibleLiteralTypes<T extends Record<string, any>, TKey$1 extends keyof T> = unknown extends T[TKey$1] ? {
|
|
1530
|
+
type PossibleLiteralTypes<T$1 extends Record<string, any>, TKey$1 extends keyof T$1> = unknown extends T$1[TKey$1] ? {
|
|
1526
1531
|
[x: string]: { [K in TKey$1]-?: Omit<RegleRuleDecl<any, Partial<AllRulesDeclarations>>, 'literal'> & {
|
|
1527
1532
|
literal?: RegleRuleDefinition<any, [literal: any], false, boolean, any, string | number>;
|
|
1528
1533
|
} };
|
|
1529
|
-
} : { [TVal in NonNullable<T[TKey$1]>]: { [K in TKey$1]-?: Omit<RegleRuleDecl<TVal, Partial<AllRulesDeclarations>>, 'literal'> & {
|
|
1534
|
+
} : { [TVal in NonNullable<T$1[TKey$1]>]: { [K in TKey$1]-?: Omit<RegleRuleDecl<TVal, Partial<AllRulesDeclarations>>, 'literal'> & {
|
|
1530
1535
|
literal?: RegleRuleDefinition<MaybeInput<TVal>, [literal: TVal], false, boolean, MaybeInput<TVal>, string | number>;
|
|
1531
1536
|
} } };
|
|
1532
|
-
type RequiredForm<T extends Record<string, any>, TKey$1 extends keyof T> = Omit<ReglePartialRuleTree<T>, TKey$1> & PossibleLiteralTypes<T, TKey$1>[keyof PossibleLiteralTypes<T, TKey$1>];
|
|
1533
|
-
type VariantTuple<T extends Record<string, any>, TKey$1 extends keyof T> = [RequiredForm<T, TKey$1>, ...RequiredForm<T, TKey$1>[]];
|
|
1537
|
+
type RequiredForm<T$1 extends Record<string, any>, TKey$1 extends keyof T$1> = Omit<ReglePartialRuleTree<T$1>, TKey$1> & PossibleLiteralTypes<T$1, TKey$1>[keyof PossibleLiteralTypes<T$1, TKey$1>];
|
|
1538
|
+
type VariantTuple<T$1 extends Record<string, any>, TKey$1 extends keyof T$1> = [RequiredForm<T$1, TKey$1>, ...RequiredForm<T$1, TKey$1>[]];
|
|
1534
1539
|
//#endregion
|
|
1535
1540
|
//#region src/core/useRegle/useRegle.d.ts
|
|
1536
1541
|
type useRegleFnOptions<TState$1 extends Record<string, any> | MaybeInput<PrimitiveTypes>, TRules$1 extends DeepExact<TRules$1, ReglePartialRuleTree<Unwrap<TState$1 extends Record<string, any> ? TState$1 : {}>, Partial<AllRulesDeclarations>>>, TAdditionalOptions extends Record<string, any>, TValidationGroups extends Record<string, RegleValidationGroupEntry[]>> = TState$1 extends MaybeInput<PrimitiveTypes> ? Partial<DeepMaybeRef<RegleBehaviourOptions>> & TAdditionalOptions : Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<JoinDiscriminatedUnions<TState$1 extends Record<string, any> ? Unwrap<TState$1> : {}>, TState$1 extends Record<string, any> ? (TRules$1 extends Record<string, any> ? TRules$1 : {}) : {}, TValidationGroups> & TAdditionalOptions;
|
|
@@ -1649,15 +1654,15 @@ declare const useRules: useRulesFn<Partial<AllRulesDeclarations>, RegleShortcutD
|
|
|
1649
1654
|
/**
|
|
1650
1655
|
* Infer type of the `r$` of any function returning a regle instance
|
|
1651
1656
|
*/
|
|
1652
|
-
type InferRegleRoot<T extends (...args: any[]) => SuperCompatibleRegle> = T extends ((...args: any[]) => infer U) ? U extends SuperCompatibleRegle ? U['r$'] : never : never;
|
|
1657
|
+
type InferRegleRoot<T$1 extends (...args: any[]) => SuperCompatibleRegle> = T$1 extends ((...args: any[]) => infer U) ? U extends SuperCompatibleRegle ? U['r$'] : never : never;
|
|
1653
1658
|
/**
|
|
1654
1659
|
* Infer custom rules declared in a global configuration
|
|
1655
1660
|
*/
|
|
1656
|
-
type InferRegleRules<T extends useRegleFn<any, any>> = T extends useRegleFn<infer U, any> ? UnwrapRuleTree<Partial<DefaultValidators>> & UnwrapRuleTree<Partial<U>> : {};
|
|
1661
|
+
type InferRegleRules<T$1 extends useRegleFn<any, any>> = T$1 extends useRegleFn<infer U, any> ? UnwrapRuleTree<Partial<DefaultValidators>> & UnwrapRuleTree<Partial<U>> : {};
|
|
1657
1662
|
/**
|
|
1658
1663
|
* Infer custom shortcuts declared in a global configuration
|
|
1659
1664
|
*/
|
|
1660
|
-
type InferRegleShortcuts<T extends useRegleFn<any, any>> = T extends useRegleFn<any, infer U> ? U : {};
|
|
1665
|
+
type InferRegleShortcuts<T$1 extends useRegleFn<any, any>> = T$1 extends useRegleFn<any, infer U> ? U : {};
|
|
1661
1666
|
/**
|
|
1662
1667
|
* Extract a set rules and setting them as required
|
|
1663
1668
|
*/
|
|
@@ -1666,11 +1671,11 @@ type RegleEnforceRequiredRules<TRules$1 extends keyof DefaultValidators> = Omit<
|
|
|
1666
1671
|
* Extract a set of custom rules from a global configuration and setting them as required
|
|
1667
1672
|
|
|
1668
1673
|
*/
|
|
1669
|
-
type RegleEnforceCustomRequiredRules<T extends useRegleFn<any, any>, TRules$1 extends keyof InferRegleRules<T>> = Omit<Partial<DefaultValidatorsTree>, TRules$1> & { [K in TRules$1]-?: T extends useRegleFn<any, any> ? K extends keyof InferRegleRules<T> ? NonNullable<UnwrapRuleWithParams<InferRegleRules<T>[K]>> : never : K extends keyof T ? NonNullable<T[K]> : never };
|
|
1674
|
+
type RegleEnforceCustomRequiredRules<T$1 extends useRegleFn<any, any>, TRules$1 extends keyof InferRegleRules<T$1>> = Omit<Partial<DefaultValidatorsTree>, TRules$1> & { [K in TRules$1]-?: T$1 extends useRegleFn<any, any> ? K extends keyof InferRegleRules<T$1> ? NonNullable<UnwrapRuleWithParams<InferRegleRules<T$1>[K]>> : never : K extends keyof T$1 ? NonNullable<T$1[K]> : never };
|
|
1670
1675
|
/**
|
|
1671
1676
|
* Extract custom rules and custom shortcuts and apply them to a RegleFieldStatus type
|
|
1672
1677
|
*/
|
|
1673
|
-
type RegleCustomFieldStatus<T extends useRegleFn<any, any>, TState$1 extends unknown = any, TRules$1 extends keyof InferRegleRules<T> = never> = RegleFieldStatus<TState$1, [TRules$1] extends [never] ? Partial<InferRegleRules<T>> : RegleEnforceCustomRequiredRules<T, TRules$1>, InferRegleShortcuts<T>>;
|
|
1678
|
+
type RegleCustomFieldStatus<T$1 extends useRegleFn<any, any>, TState$1 extends unknown = any, TRules$1 extends keyof InferRegleRules<T$1> = never> = RegleFieldStatus<TState$1, [TRules$1] extends [never] ? Partial<InferRegleRules<T$1>> : RegleEnforceCustomRequiredRules<T$1, TRules$1>, InferRegleShortcuts<T$1>>;
|
|
1674
1679
|
//#endregion
|
|
1675
1680
|
//#region src/types/utils/mismatch.types.d.ts
|
|
1676
1681
|
/**
|
|
@@ -1685,10 +1690,10 @@ type ExactObject<TInfer, TTree> = { [K in keyof TTree]: NonNullable<TTree[K]> ex
|
|
|
1685
1690
|
type TypeError<Msg> = {
|
|
1686
1691
|
[' TypeError']: Msg;
|
|
1687
1692
|
};
|
|
1688
|
-
type Coerce<T> = `${T & string}`;
|
|
1693
|
+
type Coerce<T$1> = `${T$1 & string}`;
|
|
1689
1694
|
//#endregion
|
|
1690
1695
|
//#region src/types/utils/object.types.d.ts
|
|
1691
|
-
type RemoveCommonKey<T extends readonly any[], K$1 extends PropertyKey> = T extends [infer F, ...infer R] ? [Prettify<Omit<F, K$1>>, ...RemoveCommonKey<R, K$1>] : [];
|
|
1696
|
+
type RemoveCommonKey<T$1 extends readonly any[], K$1 extends PropertyKey> = T$1 extends [infer F, ...infer R] ? [Prettify<Omit<F, K$1>>, ...RemoveCommonKey<R, K$1>] : [];
|
|
1692
1697
|
/**
|
|
1693
1698
|
* Restore the optional properties (with ?) of a generated mapped object type
|
|
1694
1699
|
*/
|
|
@@ -1705,11 +1710,11 @@ type GetMaybeObjectValue<O extends Record<string, any>, K$1 extends string> = K$
|
|
|
1705
1710
|
/**
|
|
1706
1711
|
* Combine all union values to be able to get even the normally "never" values, act as an intersection type
|
|
1707
1712
|
*/
|
|
1708
|
-
type RetrieveUnionUnknownValues<T extends readonly any[], TKeys extends string> = T extends [infer F extends Record<string, any>, ...infer R] ? [{ [K in TKeys as GetMaybeObjectValue<F, K> extends NonUndefined<GetMaybeObjectValue<F, K>> ? never : K]?: GetMaybeObjectValue<F, K> } & { [K in TKeys as GetMaybeObjectValue<F, K> extends NonUndefined<GetMaybeObjectValue<F, K>> ? K : never]: GetMaybeObjectValue<F, K> }, ...RetrieveUnionUnknownValues<R, TKeys>] : [];
|
|
1713
|
+
type RetrieveUnionUnknownValues<T$1 extends readonly any[], TKeys extends string> = T$1 extends [infer F extends Record<string, any>, ...infer R] ? [{ [K in TKeys as GetMaybeObjectValue<F, K> extends NonUndefined<GetMaybeObjectValue<F, K>> ? never : K]?: GetMaybeObjectValue<F, K> } & { [K in TKeys as GetMaybeObjectValue<F, K> extends NonUndefined<GetMaybeObjectValue<F, K>> ? K : never]: GetMaybeObjectValue<F, K> }, ...RetrieveUnionUnknownValues<R, TKeys>] : [];
|
|
1709
1714
|
/**
|
|
1710
1715
|
* Get all possible keys from a union, even the ones present only on one union
|
|
1711
1716
|
*/
|
|
1712
|
-
type RetrieveUnionUnknownKeysOf<T extends readonly any[]> = T extends [infer F, ...infer R] ? [keyof F, ...RetrieveUnionUnknownKeysOf<R>] : [];
|
|
1717
|
+
type RetrieveUnionUnknownKeysOf<T$1 extends readonly any[]> = T$1 extends [infer F, ...infer R] ? [keyof F, ...RetrieveUnionUnknownKeysOf<R>] : [];
|
|
1713
1718
|
/**
|
|
1714
1719
|
* Transforms a union and apply undefined values to non-present keys to support intersection
|
|
1715
1720
|
*/
|
|
@@ -1723,11 +1728,11 @@ type EnumLike = {
|
|
|
1723
1728
|
[k: string]: string | number;
|
|
1724
1729
|
[nu: number]: string;
|
|
1725
1730
|
};
|
|
1726
|
-
type enumType<T extends Record<string, unknown>> = T[keyof T];
|
|
1727
|
-
type UnwrapMaybeRef<T extends MaybeRef<any> | DeepReactiveState<any>> = T extends Ref<any> ? UnwrapRef<T> : UnwrapNestedRefs<T>;
|
|
1728
|
-
type TupleToPlainObj<T> = { [I in keyof T & `${number}`]: T[I] };
|
|
1729
|
-
type HasNamedKeys<T> = IsUnion<T> extends true ? ProcessHasNamedKeys<LazyJoinDiscriminatedUnions<T>> : ProcessHasNamedKeys<T>;
|
|
1730
|
-
type ProcessHasNamedKeys<T> = { [K in keyof NonNullable<T>]: K extends string ? (string extends K ? never : K) : never }[keyof NonNullable<T>] extends never ? false : true;
|
|
1731
|
+
type enumType<T$1 extends Record<string, unknown>> = T$1[keyof T$1];
|
|
1732
|
+
type UnwrapMaybeRef<T$1 extends MaybeRef<any> | DeepReactiveState<any>> = T$1 extends Ref<any> ? UnwrapRef<T$1> : UnwrapNestedRefs<T$1>;
|
|
1733
|
+
type TupleToPlainObj<T$1> = { [I in keyof T$1 & `${number}`]: T$1[I] };
|
|
1734
|
+
type HasNamedKeys<T$1> = IsUnion<T$1> extends true ? ProcessHasNamedKeys<LazyJoinDiscriminatedUnions<T$1>> : ProcessHasNamedKeys<T$1>;
|
|
1735
|
+
type ProcessHasNamedKeys<T$1> = { [K in keyof NonNullable<T$1>]: K extends string ? (string extends K ? never : K) : never }[keyof NonNullable<T$1>] extends never ? false : true;
|
|
1731
1736
|
//#endregion
|
|
1732
1737
|
//#region src/types/utils/infer.types.d.ts
|
|
1733
1738
|
type InferInput<TRules$1 extends MaybeRef<ReglePartialRuleTree<Record<string, any>, any>> | ((state: any) => ReglePartialRuleTree<Record<string, any>, any>) | MaybeRef<StandardSchemaV1<any>>, TMarkMaybe extends boolean = true> = TRules$1 extends MaybeRef<StandardSchemaV1<infer State>> ? State : IsUnion$1<UnwrapSimple<TRules$1>> extends true ? InferTupleUnionInput<UnionToTuple<UnwrapSimple<TRules$1>>>[number] : TMarkMaybe extends true ? Prettify<{ [K in keyof UnwrapSimple<TRules$1> as UnwrapSimple<TRules$1>[K] extends MaybeRef<RegleRuleDecl<any, any>> ? K : never]?: ProcessInputChildren<UnwrapSimple<TRules$1>[K], TMarkMaybe> } & { [K in keyof UnwrapSimple<TRules$1> as UnwrapSimple<TRules$1>[K] extends MaybeRef<RegleRuleDecl<any, any>> ? never : K]: ProcessInputChildren<UnwrapSimple<TRules$1>[K], TMarkMaybe> }> : Prettify<{ [K in keyof UnwrapSimple<TRules$1>]: ProcessInputChildren<UnwrapSimple<TRules$1>[K], TMarkMaybe> }>;
|
|
@@ -1739,17 +1744,17 @@ type ExtractTypeFromRules<TRules$1 extends RegleRuleDecl<any, any>> = FilterRule
|
|
|
1739
1744
|
} ? Input : [FilterRulesWithSingleType<TRules$1>[keyof FilterRulesWithSingleType<TRules$1>]] extends [never] ? FilterRulesWithInput<TRules$1>[keyof FilterRulesWithInput<TRules$1>] : FilterRulesWithSingleType<TRules$1>[keyof FilterRulesWithSingleType<TRules$1>];
|
|
1740
1745
|
type FilterRulesWithInput<TRules$1 extends RegleRuleDecl<any, any>> = { [K in keyof TRules$1 as TRules$1[K] extends RegleRuleDefinition<any, any, any, any, infer Input> ? unknown extends Input ? never : K : never]: TRules$1[K] extends RegleRuleDefinition<any, any, any, any, infer Input> ? Input : unknown };
|
|
1741
1746
|
type FilterRulesWithSingleType<TRules$1 extends RegleRuleDecl<any, any>> = { [K in keyof TRules$1 as TRules$1[K] extends RegleRuleDefinition<any, any, any, any, infer Input> ? unknown extends Input ? never : IsUnion$1<NonNullable<Input>> extends true ? never : K : never]: TRules$1[K] extends RegleRuleDefinition<any, any, any, any, infer Input> ? IsUnion$1<NonNullable<Input>> extends true ? unknown : Input : unknown };
|
|
1742
|
-
type InferTupleUnionInput<T extends any[]> = T extends [infer F extends ReglePartialRuleTree, ...infer R] ? [InferInput<F, true>, ...InferTupleUnionInput<R>] : [];
|
|
1747
|
+
type InferTupleUnionInput<T$1 extends any[]> = T$1 extends [infer F extends ReglePartialRuleTree, ...infer R] ? [InferInput<F, true>, ...InferTupleUnionInput<R>] : [];
|
|
1743
1748
|
//#endregion
|
|
1744
1749
|
//#region src/types/rules/rule.params.types.d.ts
|
|
1745
|
-
type CreateFn<T extends any[]> = (...args: T) => any;
|
|
1750
|
+
type CreateFn<T$1 extends any[]> = (...args: T$1) => any;
|
|
1746
1751
|
/**
|
|
1747
1752
|
* Transform normal parameters tuple declaration to a rich tuple declaration
|
|
1748
1753
|
*
|
|
1749
1754
|
* [foo: string, bar?: number] => [foo: MaybeRef<string> | (() => string), bar?: MaybeRef<number | undefined> | (() => number) | undefined]
|
|
1750
1755
|
*/
|
|
1751
|
-
type RegleUniversalParams<T extends any[] = [], F$1 = CreateFn<T>> = [T] extends [[]] ? [] : Parameters<F$1 extends ((...args: infer Args) => any) ? (...args: { [K in keyof Args]: MaybeRefOrGetter<Maybe<Args[K]>> }) => any : never>;
|
|
1752
|
-
type UnwrapRegleUniversalParams<T extends MaybeRefOrGetter[] = [], F$1 = CreateFn<T>> = [T] extends [[]] ? [] : Parameters<F$1 extends ((...args: infer Args) => any) ? (...args: { [K in keyof Args]: Args[K] extends MaybeRefOrGetter<Maybe<infer U>> ? U : Args[K] }) => any : never>;
|
|
1756
|
+
type RegleUniversalParams<T$1 extends any[] = [], F$1 = CreateFn<T$1>> = [T$1] extends [[]] ? [] : Parameters<F$1 extends ((...args: infer Args) => any) ? (...args: { [K in keyof Args]: MaybeRefOrGetter<Maybe<Args[K]>> }) => any : never>;
|
|
1757
|
+
type UnwrapRegleUniversalParams<T$1 extends MaybeRefOrGetter[] = [], F$1 = CreateFn<T$1>> = [T$1] extends [[]] ? [] : Parameters<F$1 extends ((...args: infer Args) => any) ? (...args: { [K in keyof Args]: Args[K] extends MaybeRefOrGetter<Maybe<infer U>> ? U : Args[K] }) => any : never>;
|
|
1753
1758
|
//#endregion
|
|
1754
1759
|
//#region src/types/rules/rule.internal.types.d.ts
|
|
1755
1760
|
/**
|
|
@@ -1774,7 +1779,7 @@ declare const InternalRuleType: {
|
|
|
1774
1779
|
type InternalRuleType = enumType<typeof InternalRuleType>;
|
|
1775
1780
|
//#endregion
|
|
1776
1781
|
//#region src/types/rules/rule.definition.type.d.ts
|
|
1777
|
-
type IsLiteral<T> = string extends T ? false : true;
|
|
1782
|
+
type IsLiteral<T$1> = string extends T$1 ? false : true;
|
|
1778
1783
|
/**
|
|
1779
1784
|
* Returned typed of rules created with `createRule`
|
|
1780
1785
|
* */
|
|
@@ -1802,10 +1807,10 @@ type RegleRuleMetadataExtended = {
|
|
|
1802
1807
|
$valid: boolean;
|
|
1803
1808
|
[x: string]: any;
|
|
1804
1809
|
};
|
|
1805
|
-
type UnwrapRuleTree<T extends {
|
|
1810
|
+
type UnwrapRuleTree<T$1 extends {
|
|
1806
1811
|
[x: string]: RegleRuleRawInput<any, any[], any, any> | undefined;
|
|
1807
|
-
}> = { [K in keyof T]: UnwrapRuleWithParams<T[K]> };
|
|
1808
|
-
type UnwrapRuleWithParams<T extends RegleRuleRawInput<any, any[], any, any> | undefined> = T extends RegleRuleWithParamsDefinition<infer TValue, infer TParams, infer TAsync, infer TMetadata> ? RegleRuleDefinition<TValue, TParams, TAsync, TMetadata> : T;
|
|
1812
|
+
}> = { [K in keyof T$1]: UnwrapRuleWithParams<T$1[K]> };
|
|
1813
|
+
type UnwrapRuleWithParams<T$1 extends RegleRuleRawInput<any, any[], any, any> | undefined> = T$1 extends RegleRuleWithParamsDefinition<infer TValue, infer TParams, infer TAsync, infer TMetadata> ? RegleRuleDefinition<TValue, TParams, TAsync, TMetadata> : T$1;
|
|
1809
1814
|
/**
|
|
1810
1815
|
* Define a rule Metadata definition
|
|
1811
1816
|
*/
|
|
@@ -2396,6 +2401,7 @@ type SuperCompatibleRegleStatus = {
|
|
|
2396
2401
|
readonly $silentErrors: Record<string, RegleValidationErrors<any, false>>;
|
|
2397
2402
|
$extractDirtyFields: (filterNullishValues?: boolean) => Record<string, any>;
|
|
2398
2403
|
$validate?: () => Promise<SuperCompatibleRegleResult>;
|
|
2404
|
+
$reset: (options?: ResetOptions<unknown>) => void;
|
|
2399
2405
|
[x: string]: any;
|
|
2400
2406
|
};
|
|
2401
2407
|
type SuperCompatibleRegleRuleStatus = Omit<$InternalRegleRuleStatus, '$haveAsync' | '$validating' | '$fieldDirty' | '$fieldInvalid' | '$fieldPending' | '$fieldCorrect' | '$fieldError' | '$unwatch' | '$watch' | '$maybePending'>;
|
|
@@ -2713,4 +2719,1440 @@ declare function defineRules<TRules$1 extends RegleUnknownRulesTree>(rules: TRul
|
|
|
2713
2719
|
*/
|
|
2714
2720
|
declare function refineRules<TRules$1 extends RegleUnknownRulesTree, TRefinement extends ReglePartialRuleTree<InferInput<TRules$1>> & RegleUnknownRulesTree>(rules: TRules$1, refinement: (state: Ref<InferInput<TRules$1>>) => TRefinement): (state: Ref<InferInput<TRules$1>>) => Merge<TRules$1, TRefinement>;
|
|
2715
2721
|
//#endregion
|
|
2716
|
-
|
|
2722
|
+
//#region src/devtools/plugin.d.ts
|
|
2723
|
+
declare const RegleVuePlugin: Plugin;
|
|
2724
|
+
//#endregion
|
|
2725
|
+
//#region ../../node_modules/.pnpm/vue-router@4.6.3_vue@3.5.22_typescript@5.9.3_/node_modules/vue-router/dist/router-BbqN7H95.d.mts
|
|
2726
|
+
//#region src/query.d.ts
|
|
2727
|
+
|
|
2728
|
+
/**
|
|
2729
|
+
* Possible values in normalized {@link LocationQuery}. `null` renders the query
|
|
2730
|
+
* param but without an `=`.
|
|
2731
|
+
*
|
|
2732
|
+
* @example
|
|
2733
|
+
* ```
|
|
2734
|
+
* ?isNull&isEmpty=&other=other
|
|
2735
|
+
* gives
|
|
2736
|
+
* `{ isNull: null, isEmpty: '', other: 'other' }`.
|
|
2737
|
+
* ```
|
|
2738
|
+
*
|
|
2739
|
+
* @internal
|
|
2740
|
+
*/
|
|
2741
|
+
type LocationQueryValue = string | null;
|
|
2742
|
+
/**
|
|
2743
|
+
* Possible values when defining a query. `undefined` allows to remove a value.
|
|
2744
|
+
*
|
|
2745
|
+
* @internal
|
|
2746
|
+
*/
|
|
2747
|
+
type LocationQueryValueRaw = LocationQueryValue | number | undefined;
|
|
2748
|
+
/**
|
|
2749
|
+
* Normalized query object that appears in {@link RouteLocationNormalized}
|
|
2750
|
+
*
|
|
2751
|
+
* @public
|
|
2752
|
+
*/
|
|
2753
|
+
type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
|
|
2754
|
+
/**
|
|
2755
|
+
* Loose {@link LocationQuery} object that can be passed to functions like
|
|
2756
|
+
* {@link Router.push} and {@link Router.replace} or anywhere when creating a
|
|
2757
|
+
* {@link RouteLocationRaw}
|
|
2758
|
+
*
|
|
2759
|
+
* @public
|
|
2760
|
+
*/
|
|
2761
|
+
type LocationQueryRaw = Record<string | number, LocationQueryValueRaw | LocationQueryValueRaw[]>;
|
|
2762
|
+
/**
|
|
2763
|
+
* Transforms a queryString into a {@link LocationQuery} object. Accept both, a
|
|
2764
|
+
* version with the leading `?` and without Should work as URLSearchParams
|
|
2765
|
+
|
|
2766
|
+
* @internal
|
|
2767
|
+
*
|
|
2768
|
+
* @param search - search string to parse
|
|
2769
|
+
* @returns a query object
|
|
2770
|
+
*/
|
|
2771
|
+
declare function parseQuery(search: string): LocationQuery;
|
|
2772
|
+
/**
|
|
2773
|
+
* Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
|
|
2774
|
+
* doesn't prepend a `?`
|
|
2775
|
+
*
|
|
2776
|
+
* @internal
|
|
2777
|
+
*
|
|
2778
|
+
* @param query - query object to stringify
|
|
2779
|
+
* @returns string version of the query without the leading `?`
|
|
2780
|
+
*/
|
|
2781
|
+
declare function stringifyQuery(query: LocationQueryRaw | undefined): string;
|
|
2782
|
+
//#endregion
|
|
2783
|
+
//#region src/config.d.ts
|
|
2784
|
+
/**
|
|
2785
|
+
* Allows customizing existing types of the router that are used globally like `$router`, `<RouterLink>`, etc. **ONLY FOR INTERNAL USAGE**.
|
|
2786
|
+
*
|
|
2787
|
+
* - `$router` - the router instance
|
|
2788
|
+
* - `$route` - the current route location
|
|
2789
|
+
* - `beforeRouteEnter` - Page component option
|
|
2790
|
+
* - `beforeRouteUpdate` - Page component option
|
|
2791
|
+
* - `beforeRouteLeave` - Page component option
|
|
2792
|
+
* - `RouterLink` - RouterLink Component
|
|
2793
|
+
* - `RouterView` - RouterView Component
|
|
2794
|
+
*
|
|
2795
|
+
* @internal
|
|
2796
|
+
*/
|
|
2797
|
+
interface TypesConfig {}
|
|
2798
|
+
//#endregion
|
|
2799
|
+
//#region src/typed-routes/route-map.d.ts
|
|
2800
|
+
/**
|
|
2801
|
+
* Helper type to define a Typed `RouteRecord`
|
|
2802
|
+
* @see {@link RouteRecord}
|
|
2803
|
+
*/
|
|
2804
|
+
interface RouteRecordInfo<Name extends string | symbol = string, Path extends string = string, ParamsRaw extends RouteParamsRawGeneric = RouteParamsRawGeneric, Params$1 extends RouteParamsGeneric = RouteParamsGeneric, ChildrenNames extends string | symbol = never> {
|
|
2805
|
+
name: Name;
|
|
2806
|
+
path: Path;
|
|
2807
|
+
paramsRaw: ParamsRaw;
|
|
2808
|
+
params: Params$1;
|
|
2809
|
+
childrenNames: ChildrenNames;
|
|
2810
|
+
}
|
|
2811
|
+
type RouteRecordInfoGeneric = RouteRecordInfo<string | symbol, string, RouteParamsRawGeneric, RouteParamsGeneric, string | symbol>;
|
|
2812
|
+
/**
|
|
2813
|
+
* Convenience type to get the typed RouteMap or a generic one if not provided. It is extracted from the {@link TypesConfig} if it exists, it becomes {@link RouteMapGeneric} otherwise.
|
|
2814
|
+
*/
|
|
2815
|
+
type RouteMap = TypesConfig extends Record<'RouteNamedMap', infer RouteNamedMap> ? RouteNamedMap : RouteMapGeneric;
|
|
2816
|
+
/**
|
|
2817
|
+
* Generic version of the `RouteMap`.
|
|
2818
|
+
*/
|
|
2819
|
+
type RouteMapGeneric = Record<string | symbol, RouteRecordInfoGeneric>;
|
|
2820
|
+
//#endregion
|
|
2821
|
+
//#region src/types/utils.d.ts
|
|
2822
|
+
/**
|
|
2823
|
+
* Creates a union type that still allows autocompletion for strings.
|
|
2824
|
+
* @internal
|
|
2825
|
+
*/
|
|
2826
|
+
type _LiteralUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>);
|
|
2827
|
+
/**
|
|
2828
|
+
* Maybe a promise maybe not
|
|
2829
|
+
* @internal
|
|
2830
|
+
*/
|
|
2831
|
+
type _Awaitable<T$1> = T$1 | PromiseLike<T$1>;
|
|
2832
|
+
/**
|
|
2833
|
+
* @internal
|
|
2834
|
+
*/
|
|
2835
|
+
|
|
2836
|
+
//#endregion
|
|
2837
|
+
//#region src/typed-routes/route-records.d.ts
|
|
2838
|
+
/**
|
|
2839
|
+
* @internal
|
|
2840
|
+
*/
|
|
2841
|
+
type RouteRecordRedirectOption = RouteLocationRaw | ((to: RouteLocation, from: RouteLocationNormalizedLoaded) => RouteLocationRaw);
|
|
2842
|
+
/**
|
|
2843
|
+
* Generic version of {@link RouteRecordName}.
|
|
2844
|
+
*/
|
|
2845
|
+
type RouteRecordNameGeneric = string | symbol | undefined;
|
|
2846
|
+
/**
|
|
2847
|
+
* Possible values for a route record **after normalization**
|
|
2848
|
+
*
|
|
2849
|
+
* NOTE: since `RouteRecordName` is a type, it evaluates too early and it's often the generic version {@link RouteRecordNameGeneric}. If you need a typed version of all of the names of routes, use {@link RouteMap | `keyof RouteMap`}
|
|
2850
|
+
*/
|
|
2851
|
+
|
|
2852
|
+
/**
|
|
2853
|
+
* @internal
|
|
2854
|
+
*/
|
|
2855
|
+
type _RouteRecordProps<Name extends keyof RouteMap = keyof RouteMap> = boolean | Record<string, any> | ((to: RouteLocationNormalized<Name>) => Record<string, any>);
|
|
2856
|
+
//#endregion
|
|
2857
|
+
//#region src/typed-routes/route-location.d.ts
|
|
2858
|
+
/**
|
|
2859
|
+
* Generic version of {@link RouteLocation}. It is used when no {@link RouteMap} is provided.
|
|
2860
|
+
*/
|
|
2861
|
+
interface RouteLocationGeneric extends _RouteLocationBase, RouteLocationOptions {
|
|
2862
|
+
/**
|
|
2863
|
+
* Array of {@link RouteRecord} containing components as they were
|
|
2864
|
+
* passed when adding records. It can also contain redirect records. This
|
|
2865
|
+
* can't be used directly. **This property is non-enumerable**.
|
|
2866
|
+
*/
|
|
2867
|
+
matched: RouteRecord[];
|
|
2868
|
+
}
|
|
2869
|
+
/**
|
|
2870
|
+
* Helper to generate a type safe version of the {@link RouteLocation} type.
|
|
2871
|
+
*/
|
|
2872
|
+
interface RouteLocationTyped<RouteMap$1 extends RouteMapGeneric, Name extends keyof RouteMap$1> extends RouteLocationGeneric {
|
|
2873
|
+
name: Extract<Name, string | symbol>;
|
|
2874
|
+
params: RouteMap$1[Name]['params'];
|
|
2875
|
+
}
|
|
2876
|
+
/**
|
|
2877
|
+
* List of all possible {@link RouteLocation} indexed by the route name.
|
|
2878
|
+
* @internal
|
|
2879
|
+
*/
|
|
2880
|
+
type RouteLocationTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationTyped<RouteMap$1, N> };
|
|
2881
|
+
/**
|
|
2882
|
+
* Generic version of {@link RouteLocationNormalized} that is used when no {@link RouteMap} is provided.
|
|
2883
|
+
*/
|
|
2884
|
+
interface RouteLocationNormalizedGeneric extends _RouteLocationBase {
|
|
2885
|
+
name: RouteRecordNameGeneric;
|
|
2886
|
+
/**
|
|
2887
|
+
* Array of {@link RouteRecordNormalized}
|
|
2888
|
+
*/
|
|
2889
|
+
matched: RouteRecordNormalized[];
|
|
2890
|
+
}
|
|
2891
|
+
/**
|
|
2892
|
+
* Helper to generate a type safe version of the {@link RouteLocationNormalized} type.
|
|
2893
|
+
*/
|
|
2894
|
+
interface RouteLocationNormalizedTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationNormalizedGeneric {
|
|
2895
|
+
name: Extract<Name, string | symbol>;
|
|
2896
|
+
params: RouteMap$1[Name]['params'];
|
|
2897
|
+
/**
|
|
2898
|
+
* Array of {@link RouteRecordNormalized}
|
|
2899
|
+
*/
|
|
2900
|
+
matched: RouteRecordNormalized[];
|
|
2901
|
+
}
|
|
2902
|
+
/**
|
|
2903
|
+
* List of all possible {@link RouteLocationNormalized} indexed by the route name.
|
|
2904
|
+
* @internal
|
|
2905
|
+
*/
|
|
2906
|
+
type RouteLocationNormalizedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationNormalizedTyped<RouteMap$1, N> };
|
|
2907
|
+
/**
|
|
2908
|
+
* Generic version of {@link RouteLocationNormalizedLoaded} that is used when no {@link RouteMap} is provided.
|
|
2909
|
+
*/
|
|
2910
|
+
interface RouteLocationNormalizedLoadedGeneric extends RouteLocationNormalizedGeneric {
|
|
2911
|
+
/**
|
|
2912
|
+
* Array of {@link RouteLocationMatched} containing only plain components (any
|
|
2913
|
+
* lazy-loaded components have been loaded and were replaced inside the
|
|
2914
|
+
* `components` object) so it can be directly used to display routes. It
|
|
2915
|
+
* cannot contain redirect records either. **This property is non-enumerable**.
|
|
2916
|
+
*/
|
|
2917
|
+
matched: RouteLocationMatched[];
|
|
2918
|
+
}
|
|
2919
|
+
/**
|
|
2920
|
+
* Helper to generate a type safe version of the {@link RouteLocationNormalizedLoaded} type.
|
|
2921
|
+
*/
|
|
2922
|
+
interface RouteLocationNormalizedLoadedTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationNormalizedLoadedGeneric {
|
|
2923
|
+
name: Extract<Name, string | symbol>;
|
|
2924
|
+
params: RouteMap$1[Name]['params'];
|
|
2925
|
+
}
|
|
2926
|
+
/**
|
|
2927
|
+
* List of all possible {@link RouteLocationNormalizedLoaded} indexed by the route name.
|
|
2928
|
+
* @internal
|
|
2929
|
+
*/
|
|
2930
|
+
type RouteLocationNormalizedLoadedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationNormalizedLoadedTyped<RouteMap$1, N> };
|
|
2931
|
+
/**
|
|
2932
|
+
* Generic version of {@link RouteLocationAsRelative}. It is used when no {@link RouteMap} is provided.
|
|
2933
|
+
*/
|
|
2934
|
+
interface RouteLocationAsRelativeGeneric extends RouteQueryAndHash, RouteLocationOptions {
|
|
2935
|
+
name?: RouteRecordNameGeneric;
|
|
2936
|
+
params?: RouteParamsRawGeneric;
|
|
2937
|
+
/**
|
|
2938
|
+
* A relative path to the current location. This property should be removed
|
|
2939
|
+
*/
|
|
2940
|
+
path?: undefined;
|
|
2941
|
+
}
|
|
2942
|
+
/**
|
|
2943
|
+
* Helper to generate a type safe version of the {@link RouteLocationAsRelative} type.
|
|
2944
|
+
*/
|
|
2945
|
+
interface RouteLocationAsRelativeTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationAsRelativeGeneric {
|
|
2946
|
+
name?: Extract<Name, string | symbol>;
|
|
2947
|
+
params?: RouteMap$1[Name]['paramsRaw'];
|
|
2948
|
+
}
|
|
2949
|
+
/**
|
|
2950
|
+
* List of all possible {@link RouteLocationAsRelative} indexed by the route name.
|
|
2951
|
+
* @internal
|
|
2952
|
+
*/
|
|
2953
|
+
type RouteLocationAsRelativeTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsRelativeTyped<RouteMap$1, N> };
|
|
2954
|
+
/**
|
|
2955
|
+
* Generic version of {@link RouteLocationAsPath}. It is used when no {@link RouteMap} is provided.
|
|
2956
|
+
*/
|
|
2957
|
+
interface RouteLocationAsPathGeneric extends RouteQueryAndHash, RouteLocationOptions {
|
|
2958
|
+
/**
|
|
2959
|
+
* Percentage encoded pathname section of the URL.
|
|
2960
|
+
*/
|
|
2961
|
+
path: string;
|
|
2962
|
+
}
|
|
2963
|
+
/**
|
|
2964
|
+
* Helper to generate a type safe version of the {@link RouteLocationAsPath} type.
|
|
2965
|
+
*/
|
|
2966
|
+
interface RouteLocationAsPathTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationAsPathGeneric {
|
|
2967
|
+
path: _LiteralUnion<RouteMap$1[Name]['path']>;
|
|
2968
|
+
}
|
|
2969
|
+
/**
|
|
2970
|
+
* List of all possible {@link RouteLocationAsPath} indexed by the route name.
|
|
2971
|
+
* @internal
|
|
2972
|
+
*/
|
|
2973
|
+
type RouteLocationAsPathTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsPathTyped<RouteMap$1, N> };
|
|
2974
|
+
/**
|
|
2975
|
+
* Helper to generate a type safe version of the {@link RouteLocationAsString} type.
|
|
2976
|
+
*/
|
|
2977
|
+
type RouteLocationAsStringTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> = RouteMap$1[Name]['path'];
|
|
2978
|
+
/**
|
|
2979
|
+
* List of all possible {@link RouteLocationAsString} indexed by the route name.
|
|
2980
|
+
* @internal
|
|
2981
|
+
*/
|
|
2982
|
+
type RouteLocationAsStringTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsStringTyped<RouteMap$1, N> };
|
|
2983
|
+
/**
|
|
2984
|
+
* Generic version of {@link RouteLocationResolved}. It is used when no {@link RouteMap} is provided.
|
|
2985
|
+
*/
|
|
2986
|
+
interface RouteLocationResolvedGeneric extends RouteLocationGeneric {
|
|
2987
|
+
/**
|
|
2988
|
+
* Resolved `href` for the route location that will be set on the `<a href="...">`.
|
|
2989
|
+
*/
|
|
2990
|
+
href: string;
|
|
2991
|
+
}
|
|
2992
|
+
/**
|
|
2993
|
+
* Helper to generate a type safe version of the {@link RouteLocationResolved} type.
|
|
2994
|
+
*/
|
|
2995
|
+
interface RouteLocationResolvedTyped<RouteMap$1 extends RouteMapGeneric, Name extends keyof RouteMap$1> extends RouteLocationTyped<RouteMap$1, Name> {
|
|
2996
|
+
/**
|
|
2997
|
+
* Resolved `href` for the route location that will be set on the `<a href="...">`.
|
|
2998
|
+
*/
|
|
2999
|
+
href: string;
|
|
3000
|
+
}
|
|
3001
|
+
/**
|
|
3002
|
+
* List of all possible {@link RouteLocationResolved} indexed by the route name.
|
|
3003
|
+
* @internal
|
|
3004
|
+
*/
|
|
3005
|
+
type RouteLocationResolvedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationResolvedTyped<RouteMap$1, N> };
|
|
3006
|
+
/**
|
|
3007
|
+
* Type safe versions of types that are exposed by vue-router. We have to use a generic check to allow for names to be `undefined` when no `RouteMap` is provided.
|
|
3008
|
+
*/
|
|
3009
|
+
/**
|
|
3010
|
+
* {@link RouteLocationRaw} resolved using the matcher
|
|
3011
|
+
*/
|
|
3012
|
+
type RouteLocation<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationGeneric : RouteLocationTypedList<RouteMap>[Name];
|
|
3013
|
+
/**
|
|
3014
|
+
* Similar to {@link RouteLocation} but its
|
|
3015
|
+
* {@link RouteLocationNormalizedTyped.matched | `matched` property} cannot contain redirect records
|
|
3016
|
+
*/
|
|
3017
|
+
type RouteLocationNormalized<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedGeneric : RouteLocationNormalizedTypedList<RouteMap>[Name];
|
|
3018
|
+
/**
|
|
3019
|
+
* Similar to {@link RouteLocationNormalized} but its `components` do not contain any function to lazy load components.
|
|
3020
|
+
* In other words, it's ready to be rendered by `<RouterView>`.
|
|
3021
|
+
*/
|
|
3022
|
+
type RouteLocationNormalizedLoaded<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedLoadedGeneric : RouteLocationNormalizedLoadedTypedList<RouteMap>[Name];
|
|
3023
|
+
/**
|
|
3024
|
+
* Route location relative to the current location. It accepts other properties than `path` like `params`, `query` and
|
|
3025
|
+
* `hash` to conveniently change them.
|
|
3026
|
+
*/
|
|
3027
|
+
type RouteLocationAsRelative<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsRelativeGeneric : RouteLocationAsRelativeTypedList<RouteMap>[Name];
|
|
3028
|
+
/**
|
|
3029
|
+
* Route location resolved with {@link Router | `router.resolve()`}.
|
|
3030
|
+
*/
|
|
3031
|
+
type RouteLocationResolved<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationResolvedGeneric : RouteLocationResolvedTypedList<RouteMap>[Name];
|
|
3032
|
+
/**
|
|
3033
|
+
* Same as {@link RouteLocationAsPath} but as a string literal.
|
|
3034
|
+
*/
|
|
3035
|
+
type RouteLocationAsString<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? string : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string>;
|
|
3036
|
+
/**
|
|
3037
|
+
* Route location as an object with a `path` property.
|
|
3038
|
+
*/
|
|
3039
|
+
type RouteLocationAsPath<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsPathGeneric : RouteLocationAsPathTypedList<RouteMap>[Name];
|
|
3040
|
+
/**
|
|
3041
|
+
* Route location that can be passed to `router.push()` and other user-facing APIs.
|
|
3042
|
+
*/
|
|
3043
|
+
type RouteLocationRaw<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsString | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string> | RouteLocationAsRelativeTypedList<RouteMap>[Name] | RouteLocationAsPathTypedList<RouteMap>[Name];
|
|
3044
|
+
//#endregion
|
|
3045
|
+
//#region src/typed-routes/navigation-guards.d.ts
|
|
3046
|
+
/**
|
|
3047
|
+
* Return types for a Navigation Guard. Based on `TypesConfig`
|
|
3048
|
+
*
|
|
3049
|
+
* @see {@link TypesConfig}
|
|
3050
|
+
*/
|
|
3051
|
+
type NavigationGuardReturn = void | Error | boolean | RouteLocationRaw;
|
|
3052
|
+
/**
|
|
3053
|
+
* Navigation Guard with a type parameter for `this`.
|
|
3054
|
+
* @see {@link TypesConfig}
|
|
3055
|
+
*/
|
|
3056
|
+
interface NavigationGuardWithThis<T$1> {
|
|
3057
|
+
(this: T$1, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
|
|
3058
|
+
}
|
|
3059
|
+
/**
|
|
3060
|
+
* Navigation Guard.
|
|
3061
|
+
*/
|
|
3062
|
+
interface NavigationGuard {
|
|
3063
|
+
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
|
|
3064
|
+
}
|
|
3065
|
+
/**
|
|
3066
|
+
* Navigation hook triggered after a navigation is settled.
|
|
3067
|
+
*/
|
|
3068
|
+
interface NavigationHookAfter {
|
|
3069
|
+
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, failure?: NavigationFailure | void): unknown;
|
|
3070
|
+
}
|
|
3071
|
+
/**
|
|
3072
|
+
* `next()` callback passed to navigation guards.
|
|
3073
|
+
*/
|
|
3074
|
+
interface NavigationGuardNext {
|
|
3075
|
+
(): void;
|
|
3076
|
+
(error: Error): void;
|
|
3077
|
+
(location: RouteLocationRaw): void;
|
|
3078
|
+
(valid: boolean | undefined): void;
|
|
3079
|
+
(cb: NavigationGuardNextCallback): void;
|
|
3080
|
+
}
|
|
3081
|
+
/**
|
|
3082
|
+
* Callback that can be passed to `next()` in `beforeRouteEnter()` guards.
|
|
3083
|
+
*/
|
|
3084
|
+
type NavigationGuardNextCallback = (vm: ComponentPublicInstance) => unknown;
|
|
3085
|
+
//#endregion
|
|
3086
|
+
//#region src/matcher/types.d.ts
|
|
3087
|
+
/**
|
|
3088
|
+
* Normalized version of a {@link RouteRecord | route record}.
|
|
3089
|
+
*/
|
|
3090
|
+
interface RouteRecordNormalized {
|
|
3091
|
+
/**
|
|
3092
|
+
* {@inheritDoc _RouteRecordBase.path}
|
|
3093
|
+
*/
|
|
3094
|
+
path: _RouteRecordBase['path'];
|
|
3095
|
+
/**
|
|
3096
|
+
* {@inheritDoc _RouteRecordBase.redirect}
|
|
3097
|
+
*/
|
|
3098
|
+
redirect: _RouteRecordBase['redirect'] | undefined;
|
|
3099
|
+
/**
|
|
3100
|
+
* {@inheritDoc _RouteRecordBase.name}
|
|
3101
|
+
*/
|
|
3102
|
+
name: _RouteRecordBase['name'];
|
|
3103
|
+
/**
|
|
3104
|
+
* {@inheritDoc RouteRecordMultipleViews.components}
|
|
3105
|
+
*/
|
|
3106
|
+
components: RouteRecordMultipleViews['components'] | null | undefined;
|
|
3107
|
+
/**
|
|
3108
|
+
* Contains the original modules for lazy loaded components.
|
|
3109
|
+
* @internal
|
|
3110
|
+
*/
|
|
3111
|
+
mods: Record<string, unknown>;
|
|
3112
|
+
/**
|
|
3113
|
+
* Nested route records.
|
|
3114
|
+
*/
|
|
3115
|
+
children: RouteRecordRaw[];
|
|
3116
|
+
/**
|
|
3117
|
+
* {@inheritDoc _RouteRecordBase.meta}
|
|
3118
|
+
*/
|
|
3119
|
+
meta: Exclude<_RouteRecordBase['meta'], void>;
|
|
3120
|
+
/**
|
|
3121
|
+
* {@inheritDoc RouteRecordMultipleViews.props}
|
|
3122
|
+
*/
|
|
3123
|
+
props: Record<string, _RouteRecordProps>;
|
|
3124
|
+
/**
|
|
3125
|
+
* Registered beforeEnter guards
|
|
3126
|
+
*/
|
|
3127
|
+
beforeEnter: _RouteRecordBase['beforeEnter'];
|
|
3128
|
+
/**
|
|
3129
|
+
* Registered leave guards
|
|
3130
|
+
*
|
|
3131
|
+
* @internal
|
|
3132
|
+
*/
|
|
3133
|
+
leaveGuards: Set<NavigationGuard>;
|
|
3134
|
+
/**
|
|
3135
|
+
* Registered update guards
|
|
3136
|
+
*
|
|
3137
|
+
* @internal
|
|
3138
|
+
*/
|
|
3139
|
+
updateGuards: Set<NavigationGuard>;
|
|
3140
|
+
/**
|
|
3141
|
+
* Registered beforeRouteEnter callbacks passed to `next` or returned in guards
|
|
3142
|
+
*
|
|
3143
|
+
* @internal
|
|
3144
|
+
*/
|
|
3145
|
+
enterCallbacks: Record<string, NavigationGuardNextCallback[]>;
|
|
3146
|
+
/**
|
|
3147
|
+
* Mounted route component instances
|
|
3148
|
+
* Having the instances on the record mean beforeRouteUpdate and
|
|
3149
|
+
* beforeRouteLeave guards can only be invoked with the latest mounted app
|
|
3150
|
+
* instance if there are multiple application instances rendering the same
|
|
3151
|
+
* view, basically duplicating the content on the page, which shouldn't happen
|
|
3152
|
+
* in practice. It will work if multiple apps are rendering different named
|
|
3153
|
+
* views.
|
|
3154
|
+
*/
|
|
3155
|
+
instances: Record<string, ComponentPublicInstance | undefined | null>;
|
|
3156
|
+
/**
|
|
3157
|
+
* Defines if this record is the alias of another one. This property is
|
|
3158
|
+
* `undefined` if the record is the original one.
|
|
3159
|
+
*/
|
|
3160
|
+
aliasOf: RouteRecordNormalized | undefined;
|
|
3161
|
+
}
|
|
3162
|
+
/**
|
|
3163
|
+
* {@inheritDoc RouteRecordNormalized}
|
|
3164
|
+
*/
|
|
3165
|
+
type RouteRecord = RouteRecordNormalized;
|
|
3166
|
+
//#endregion
|
|
3167
|
+
//#region src/matcher/pathParserRanker.d.ts
|
|
3168
|
+
|
|
3169
|
+
/**
|
|
3170
|
+
* @internal
|
|
3171
|
+
*/
|
|
3172
|
+
interface _PathParserOptions {
|
|
3173
|
+
/**
|
|
3174
|
+
* Makes the RegExp case-sensitive.
|
|
3175
|
+
*
|
|
3176
|
+
* @defaultValue `false`
|
|
3177
|
+
*/
|
|
3178
|
+
sensitive?: boolean;
|
|
3179
|
+
/**
|
|
3180
|
+
* Whether to disallow a trailing slash or not.
|
|
3181
|
+
*
|
|
3182
|
+
* @defaultValue `false`
|
|
3183
|
+
*/
|
|
3184
|
+
strict?: boolean;
|
|
3185
|
+
/**
|
|
3186
|
+
* Should the RegExp match from the beginning by prepending a `^` to it.
|
|
3187
|
+
* @internal
|
|
3188
|
+
*
|
|
3189
|
+
* @defaultValue `true`
|
|
3190
|
+
*/
|
|
3191
|
+
start?: boolean;
|
|
3192
|
+
/**
|
|
3193
|
+
* Should the RegExp match until the end by appending a `$` to it.
|
|
3194
|
+
*
|
|
3195
|
+
* @deprecated this option will alsways be `true` in the future. Open a discussion in vuejs/router if you need this to be `false`
|
|
3196
|
+
*
|
|
3197
|
+
* @defaultValue `true`
|
|
3198
|
+
*/
|
|
3199
|
+
end?: boolean;
|
|
3200
|
+
}
|
|
3201
|
+
type PathParserOptions = Pick<_PathParserOptions, 'end' | 'sensitive' | 'strict'>;
|
|
3202
|
+
//#endregion
|
|
3203
|
+
//#region src/matcher/pathMatcher.d.ts
|
|
3204
|
+
|
|
3205
|
+
//#endregion
|
|
3206
|
+
//#region src/history/common.d.ts
|
|
3207
|
+
type HistoryLocation = string;
|
|
3208
|
+
/**
|
|
3209
|
+
* Allowed variables in HTML5 history state. Note that pushState clones the state
|
|
3210
|
+
* passed and does not accept everything: e.g.: it doesn't accept symbols, nor
|
|
3211
|
+
* functions as values. It also ignores Symbols as keys.
|
|
3212
|
+
*
|
|
3213
|
+
* @internal
|
|
3214
|
+
*/
|
|
3215
|
+
type HistoryStateValue = string | number | boolean | null | undefined | HistoryState | HistoryStateArray;
|
|
3216
|
+
/**
|
|
3217
|
+
* Allowed HTML history.state
|
|
3218
|
+
*/
|
|
3219
|
+
interface HistoryState {
|
|
3220
|
+
[x: number]: HistoryStateValue;
|
|
3221
|
+
[x: string]: HistoryStateValue;
|
|
3222
|
+
}
|
|
3223
|
+
/**
|
|
3224
|
+
* Allowed arrays for history.state.
|
|
3225
|
+
*
|
|
3226
|
+
* @internal
|
|
3227
|
+
*/
|
|
3228
|
+
interface HistoryStateArray extends Array<HistoryStateValue> {}
|
|
3229
|
+
declare enum NavigationType {
|
|
3230
|
+
pop = "pop",
|
|
3231
|
+
push = "push",
|
|
3232
|
+
}
|
|
3233
|
+
declare enum NavigationDirection {
|
|
3234
|
+
back = "back",
|
|
3235
|
+
forward = "forward",
|
|
3236
|
+
unknown = "",
|
|
3237
|
+
}
|
|
3238
|
+
interface NavigationInformation {
|
|
3239
|
+
type: NavigationType;
|
|
3240
|
+
direction: NavigationDirection;
|
|
3241
|
+
delta: number;
|
|
3242
|
+
}
|
|
3243
|
+
interface NavigationCallback {
|
|
3244
|
+
(to: HistoryLocation, from: HistoryLocation, information: NavigationInformation): void;
|
|
3245
|
+
}
|
|
3246
|
+
/**
|
|
3247
|
+
* Interface implemented by History implementations that can be passed to the
|
|
3248
|
+
* router as {@link Router.history}
|
|
3249
|
+
*
|
|
3250
|
+
* @alpha
|
|
3251
|
+
*/
|
|
3252
|
+
interface RouterHistory {
|
|
3253
|
+
/**
|
|
3254
|
+
* Base path that is prepended to every url. This allows hosting an SPA at a
|
|
3255
|
+
* sub-folder of a domain like `example.com/sub-folder` by having a `base` of
|
|
3256
|
+
* `/sub-folder`
|
|
3257
|
+
*/
|
|
3258
|
+
readonly base: string;
|
|
3259
|
+
/**
|
|
3260
|
+
* Current History location
|
|
3261
|
+
*/
|
|
3262
|
+
readonly location: HistoryLocation;
|
|
3263
|
+
/**
|
|
3264
|
+
* Current History state
|
|
3265
|
+
*/
|
|
3266
|
+
readonly state: HistoryState;
|
|
3267
|
+
/**
|
|
3268
|
+
* Navigates to a location. In the case of an HTML5 History implementation,
|
|
3269
|
+
* this will call `history.pushState` to effectively change the URL.
|
|
3270
|
+
*
|
|
3271
|
+
* @param to - location to push
|
|
3272
|
+
* @param data - optional {@link HistoryState} to be associated with the
|
|
3273
|
+
* navigation entry
|
|
3274
|
+
*/
|
|
3275
|
+
push(to: HistoryLocation, data?: HistoryState): void;
|
|
3276
|
+
/**
|
|
3277
|
+
* Same as {@link RouterHistory.push} but performs a `history.replaceState`
|
|
3278
|
+
* instead of `history.pushState`
|
|
3279
|
+
*
|
|
3280
|
+
* @param to - location to set
|
|
3281
|
+
* @param data - optional {@link HistoryState} to be associated with the
|
|
3282
|
+
* navigation entry
|
|
3283
|
+
*/
|
|
3284
|
+
replace(to: HistoryLocation, data?: HistoryState): void;
|
|
3285
|
+
/**
|
|
3286
|
+
* Traverses history in a given direction.
|
|
3287
|
+
*
|
|
3288
|
+
* @example
|
|
3289
|
+
* ```js
|
|
3290
|
+
* myHistory.go(-1) // equivalent to window.history.back()
|
|
3291
|
+
* myHistory.go(1) // equivalent to window.history.forward()
|
|
3292
|
+
* ```
|
|
3293
|
+
*
|
|
3294
|
+
* @param delta - distance to travel. If delta is \< 0, it will go back,
|
|
3295
|
+
* if it's \> 0, it will go forward by that amount of entries.
|
|
3296
|
+
* @param triggerListeners - whether this should trigger listeners attached to
|
|
3297
|
+
* the history
|
|
3298
|
+
*/
|
|
3299
|
+
go(delta: number, triggerListeners?: boolean): void;
|
|
3300
|
+
/**
|
|
3301
|
+
* Attach a listener to the History implementation that is triggered when the
|
|
3302
|
+
* navigation is triggered from outside (like the Browser back and forward
|
|
3303
|
+
* buttons) or when passing `true` to {@link RouterHistory.back} and
|
|
3304
|
+
* {@link RouterHistory.forward}
|
|
3305
|
+
*
|
|
3306
|
+
* @param callback - listener to attach
|
|
3307
|
+
* @returns a callback to remove the listener
|
|
3308
|
+
*/
|
|
3309
|
+
listen(callback: NavigationCallback): () => void;
|
|
3310
|
+
/**
|
|
3311
|
+
* Generates the corresponding href to be used in an anchor tag.
|
|
3312
|
+
*
|
|
3313
|
+
* @param location - history location that should create an href
|
|
3314
|
+
*/
|
|
3315
|
+
createHref(location: HistoryLocation): string;
|
|
3316
|
+
/**
|
|
3317
|
+
* Clears any event listener attached by the history implementation.
|
|
3318
|
+
*/
|
|
3319
|
+
destroy(): void;
|
|
3320
|
+
}
|
|
3321
|
+
//#endregion
|
|
3322
|
+
//#region src/types/index.d.ts
|
|
3323
|
+
type Lazy<T$1> = () => Promise<T$1>;
|
|
3324
|
+
/**
|
|
3325
|
+
* @internal
|
|
3326
|
+
*/
|
|
3327
|
+
type RouteParamValue = string;
|
|
3328
|
+
/**
|
|
3329
|
+
* @internal
|
|
3330
|
+
*/
|
|
3331
|
+
type RouteParamValueRaw = RouteParamValue | number | null | undefined;
|
|
3332
|
+
type RouteParamsGeneric = Record<string, RouteParamValue | RouteParamValue[]>;
|
|
3333
|
+
type RouteParamsRawGeneric = Record<string, RouteParamValueRaw | Exclude<RouteParamValueRaw, null | undefined>[]>;
|
|
3334
|
+
/**
|
|
3335
|
+
* @internal
|
|
3336
|
+
*/
|
|
3337
|
+
interface RouteQueryAndHash {
|
|
3338
|
+
query?: LocationQueryRaw;
|
|
3339
|
+
hash?: string;
|
|
3340
|
+
}
|
|
3341
|
+
/**
|
|
3342
|
+
* @internal
|
|
3343
|
+
*/
|
|
3344
|
+
|
|
3345
|
+
/**
|
|
3346
|
+
* Common options for all navigation methods.
|
|
3347
|
+
*/
|
|
3348
|
+
interface RouteLocationOptions {
|
|
3349
|
+
/**
|
|
3350
|
+
* Replace the entry in the history instead of pushing a new entry
|
|
3351
|
+
*/
|
|
3352
|
+
replace?: boolean;
|
|
3353
|
+
/**
|
|
3354
|
+
* Triggers the navigation even if the location is the same as the current one.
|
|
3355
|
+
* Note this will also add a new entry to the history unless `replace: true`
|
|
3356
|
+
* is passed.
|
|
3357
|
+
*/
|
|
3358
|
+
force?: boolean;
|
|
3359
|
+
/**
|
|
3360
|
+
* State to save using the History API. This cannot contain any reactive
|
|
3361
|
+
* values and some primitives like Symbols are forbidden. More info at
|
|
3362
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/History/state
|
|
3363
|
+
*/
|
|
3364
|
+
state?: HistoryState;
|
|
3365
|
+
}
|
|
3366
|
+
/**
|
|
3367
|
+
* Route Location that can infer the necessary params based on the name.
|
|
3368
|
+
*
|
|
3369
|
+
* @internal
|
|
3370
|
+
*/
|
|
3371
|
+
|
|
3372
|
+
interface RouteLocationMatched extends RouteRecordNormalized {
|
|
3373
|
+
components: Record<string, RouteComponent> | null | undefined;
|
|
3374
|
+
}
|
|
3375
|
+
/**
|
|
3376
|
+
* Base properties for a normalized route location.
|
|
3377
|
+
*
|
|
3378
|
+
* @internal
|
|
3379
|
+
*/
|
|
3380
|
+
interface _RouteLocationBase extends Pick<MatcherLocation, 'name' | 'path' | 'params' | 'meta'> {
|
|
3381
|
+
/**
|
|
3382
|
+
* The whole location including the `search` and `hash`. This string is
|
|
3383
|
+
* percentage encoded.
|
|
3384
|
+
*/
|
|
3385
|
+
fullPath: string;
|
|
3386
|
+
/**
|
|
3387
|
+
* Object representation of the `search` property of the current location.
|
|
3388
|
+
*/
|
|
3389
|
+
query: LocationQuery;
|
|
3390
|
+
/**
|
|
3391
|
+
* Hash of the current location. If present, starts with a `#`.
|
|
3392
|
+
*/
|
|
3393
|
+
hash: string;
|
|
3394
|
+
/**
|
|
3395
|
+
* Contains the location we were initially trying to access before ending up
|
|
3396
|
+
* on the current location.
|
|
3397
|
+
*/
|
|
3398
|
+
redirectedFrom: RouteLocation | undefined;
|
|
3399
|
+
}
|
|
3400
|
+
/**
|
|
3401
|
+
* Allowed Component in {@link RouteLocationMatched}
|
|
3402
|
+
*/
|
|
3403
|
+
type RouteComponent = Component$1 | DefineComponent;
|
|
3404
|
+
/**
|
|
3405
|
+
* Allowed Component definitions in route records provided by the user
|
|
3406
|
+
*/
|
|
3407
|
+
type RawRouteComponent = RouteComponent | Lazy<RouteComponent>;
|
|
3408
|
+
/**
|
|
3409
|
+
* Internal type for common properties among all kind of {@link RouteRecordRaw}.
|
|
3410
|
+
*/
|
|
3411
|
+
interface _RouteRecordBase extends PathParserOptions {
|
|
3412
|
+
/**
|
|
3413
|
+
* Path of the record. Should start with `/` unless the record is the child of
|
|
3414
|
+
* another record.
|
|
3415
|
+
*
|
|
3416
|
+
* @example `/users/:id` matches `/users/1` as well as `/users/posva`.
|
|
3417
|
+
*/
|
|
3418
|
+
path: string;
|
|
3419
|
+
/**
|
|
3420
|
+
* Where to redirect if the route is directly matched. The redirection happens
|
|
3421
|
+
* before any navigation guard and triggers a new navigation with the new
|
|
3422
|
+
* target location.
|
|
3423
|
+
*/
|
|
3424
|
+
redirect?: RouteRecordRedirectOption;
|
|
3425
|
+
/**
|
|
3426
|
+
* Aliases for the record. Allows defining extra paths that will behave like a
|
|
3427
|
+
* copy of the record. Allows having paths shorthands like `/users/:id` and
|
|
3428
|
+
* `/u/:id`. All `alias` and `path` values must share the same params.
|
|
3429
|
+
*/
|
|
3430
|
+
alias?: string | string[];
|
|
3431
|
+
/**
|
|
3432
|
+
* Name for the route record. Must be unique.
|
|
3433
|
+
*/
|
|
3434
|
+
name?: RouteRecordNameGeneric;
|
|
3435
|
+
/**
|
|
3436
|
+
* Before Enter guard specific to this record. Note `beforeEnter` has no
|
|
3437
|
+
* effect if the record has a `redirect` property.
|
|
3438
|
+
*/
|
|
3439
|
+
beforeEnter?: NavigationGuardWithThis<undefined> | NavigationGuardWithThis<undefined>[];
|
|
3440
|
+
/**
|
|
3441
|
+
* Arbitrary data attached to the record.
|
|
3442
|
+
*/
|
|
3443
|
+
meta?: RouteMeta;
|
|
3444
|
+
/**
|
|
3445
|
+
* Array of nested routes.
|
|
3446
|
+
*/
|
|
3447
|
+
children?: RouteRecordRaw[];
|
|
3448
|
+
/**
|
|
3449
|
+
* Allow passing down params as props to the component rendered by `router-view`.
|
|
3450
|
+
*/
|
|
3451
|
+
props?: _RouteRecordProps | Record<string, _RouteRecordProps>;
|
|
3452
|
+
}
|
|
3453
|
+
/**
|
|
3454
|
+
* Interface to type `meta` fields in route records.
|
|
3455
|
+
*
|
|
3456
|
+
* @example
|
|
3457
|
+
*
|
|
3458
|
+
* ```ts
|
|
3459
|
+
* // typings.d.ts or router.ts
|
|
3460
|
+
* import 'vue-router';
|
|
3461
|
+
*
|
|
3462
|
+
* declare module 'vue-router' {
|
|
3463
|
+
* interface RouteMeta {
|
|
3464
|
+
* requiresAuth?: boolean
|
|
3465
|
+
* }
|
|
3466
|
+
* }
|
|
3467
|
+
* ```
|
|
3468
|
+
*/
|
|
3469
|
+
interface RouteMeta extends Record<PropertyKey, unknown> {}
|
|
3470
|
+
/**
|
|
3471
|
+
* Route Record defining one single component with the `component` option.
|
|
3472
|
+
*/
|
|
3473
|
+
interface RouteRecordSingleView extends _RouteRecordBase {
|
|
3474
|
+
/**
|
|
3475
|
+
* Component to display when the URL matches this route.
|
|
3476
|
+
*/
|
|
3477
|
+
component: RawRouteComponent;
|
|
3478
|
+
components?: never;
|
|
3479
|
+
children?: never;
|
|
3480
|
+
redirect?: never;
|
|
3481
|
+
/**
|
|
3482
|
+
* Allow passing down params as props to the component rendered by `router-view`.
|
|
3483
|
+
*/
|
|
3484
|
+
props?: _RouteRecordProps;
|
|
3485
|
+
}
|
|
3486
|
+
/**
|
|
3487
|
+
* Route Record defining one single component with a nested view. Differently
|
|
3488
|
+
* from {@link RouteRecordSingleView}, this record has children and allows a
|
|
3489
|
+
* `redirect` option.
|
|
3490
|
+
*/
|
|
3491
|
+
interface RouteRecordSingleViewWithChildren extends _RouteRecordBase {
|
|
3492
|
+
/**
|
|
3493
|
+
* Component to display when the URL matches this route.
|
|
3494
|
+
*/
|
|
3495
|
+
component?: RawRouteComponent | null | undefined;
|
|
3496
|
+
components?: never;
|
|
3497
|
+
children: RouteRecordRaw[];
|
|
3498
|
+
/**
|
|
3499
|
+
* Allow passing down params as props to the component rendered by `router-view`.
|
|
3500
|
+
*/
|
|
3501
|
+
props?: _RouteRecordProps;
|
|
3502
|
+
}
|
|
3503
|
+
/**
|
|
3504
|
+
* Route Record defining multiple named components with the `components` option.
|
|
3505
|
+
*/
|
|
3506
|
+
interface RouteRecordMultipleViews extends _RouteRecordBase {
|
|
3507
|
+
/**
|
|
3508
|
+
* Components to display when the URL matches this route. Allow using named views.
|
|
3509
|
+
*/
|
|
3510
|
+
components: Record<string, RawRouteComponent>;
|
|
3511
|
+
component?: never;
|
|
3512
|
+
children?: never;
|
|
3513
|
+
redirect?: never;
|
|
3514
|
+
/**
|
|
3515
|
+
* Allow passing down params as props to the component rendered by
|
|
3516
|
+
* `router-view`. Should be an object with the same keys as `components` or a
|
|
3517
|
+
* boolean to be applied to every component.
|
|
3518
|
+
*/
|
|
3519
|
+
props?: Record<string, _RouteRecordProps> | boolean;
|
|
3520
|
+
}
|
|
3521
|
+
/**
|
|
3522
|
+
* Route Record defining multiple named components with the `components` option and children.
|
|
3523
|
+
*/
|
|
3524
|
+
interface RouteRecordMultipleViewsWithChildren extends _RouteRecordBase {
|
|
3525
|
+
/**
|
|
3526
|
+
* Components to display when the URL matches this route. Allow using named views.
|
|
3527
|
+
*/
|
|
3528
|
+
components?: Record<string, RawRouteComponent> | null | undefined;
|
|
3529
|
+
component?: never;
|
|
3530
|
+
children: RouteRecordRaw[];
|
|
3531
|
+
/**
|
|
3532
|
+
* Allow passing down params as props to the component rendered by
|
|
3533
|
+
* `router-view`. Should be an object with the same keys as `components` or a
|
|
3534
|
+
* boolean to be applied to every component.
|
|
3535
|
+
*/
|
|
3536
|
+
props?: Record<string, _RouteRecordProps> | boolean;
|
|
3537
|
+
}
|
|
3538
|
+
/**
|
|
3539
|
+
* Route Record that defines a redirect. Cannot have `component` or `components`
|
|
3540
|
+
* as it is never rendered.
|
|
3541
|
+
*/
|
|
3542
|
+
interface RouteRecordRedirect extends _RouteRecordBase {
|
|
3543
|
+
redirect: RouteRecordRedirectOption;
|
|
3544
|
+
component?: never;
|
|
3545
|
+
components?: never;
|
|
3546
|
+
props?: never;
|
|
3547
|
+
}
|
|
3548
|
+
type RouteRecordRaw = RouteRecordSingleView | RouteRecordSingleViewWithChildren | RouteRecordMultipleViews | RouteRecordMultipleViewsWithChildren | RouteRecordRedirect;
|
|
3549
|
+
/**
|
|
3550
|
+
* Route location that can be passed to the matcher.
|
|
3551
|
+
*/
|
|
3552
|
+
|
|
3553
|
+
/**
|
|
3554
|
+
* Normalized/resolved Route location that returned by the matcher.
|
|
3555
|
+
*/
|
|
3556
|
+
interface MatcherLocation {
|
|
3557
|
+
/**
|
|
3558
|
+
* Name of the matched record
|
|
3559
|
+
*/
|
|
3560
|
+
name: RouteRecordNameGeneric | null | undefined;
|
|
3561
|
+
/**
|
|
3562
|
+
* Percentage encoded pathname section of the URL.
|
|
3563
|
+
*/
|
|
3564
|
+
path: string;
|
|
3565
|
+
/**
|
|
3566
|
+
* Object of decoded params extracted from the `path`.
|
|
3567
|
+
*/
|
|
3568
|
+
params: RouteParamsGeneric;
|
|
3569
|
+
/**
|
|
3570
|
+
* Merged `meta` properties from all the matched route records.
|
|
3571
|
+
*/
|
|
3572
|
+
meta: RouteMeta;
|
|
3573
|
+
/**
|
|
3574
|
+
* Array of {@link RouteRecord} containing components as they were
|
|
3575
|
+
* passed when adding records. It can also contain redirect records. This
|
|
3576
|
+
* can't be used directly
|
|
3577
|
+
*/
|
|
3578
|
+
matched: RouteRecord[];
|
|
3579
|
+
}
|
|
3580
|
+
//#endregion
|
|
3581
|
+
//#region src/errors.d.ts
|
|
3582
|
+
/**
|
|
3583
|
+
* Flags so we can combine them when checking for multiple errors. This is the internal version of
|
|
3584
|
+
* {@link NavigationFailureType}.
|
|
3585
|
+
*
|
|
3586
|
+
* @internal
|
|
3587
|
+
*/
|
|
3588
|
+
declare const enum ErrorTypes {
|
|
3589
|
+
MATCHER_NOT_FOUND = 1,
|
|
3590
|
+
NAVIGATION_GUARD_REDIRECT = 2,
|
|
3591
|
+
NAVIGATION_ABORTED = 4,
|
|
3592
|
+
NAVIGATION_CANCELLED = 8,
|
|
3593
|
+
NAVIGATION_DUPLICATED = 16,
|
|
3594
|
+
}
|
|
3595
|
+
/**
|
|
3596
|
+
* Enumeration with all possible types for navigation failures. Can be passed to
|
|
3597
|
+
* {@link isNavigationFailure} to check for specific failures.
|
|
3598
|
+
*/
|
|
3599
|
+
|
|
3600
|
+
/**
|
|
3601
|
+
* Extended Error that contains extra information regarding a failed navigation.
|
|
3602
|
+
*/
|
|
3603
|
+
interface NavigationFailure extends Error {
|
|
3604
|
+
/**
|
|
3605
|
+
* Type of the navigation. One of {@link NavigationFailureType}
|
|
3606
|
+
*/
|
|
3607
|
+
type: ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED;
|
|
3608
|
+
/**
|
|
3609
|
+
* Route location we were navigating from
|
|
3610
|
+
*/
|
|
3611
|
+
from: RouteLocationNormalized;
|
|
3612
|
+
/**
|
|
3613
|
+
* Route location we were navigating to
|
|
3614
|
+
*/
|
|
3615
|
+
to: RouteLocationNormalized;
|
|
3616
|
+
}
|
|
3617
|
+
/**
|
|
3618
|
+
* Internal error used to detect a redirection.
|
|
3619
|
+
*
|
|
3620
|
+
* @internal
|
|
3621
|
+
*/
|
|
3622
|
+
|
|
3623
|
+
/**
|
|
3624
|
+
* Internal type to define an ErrorHandler
|
|
3625
|
+
*
|
|
3626
|
+
* @param error - error thrown
|
|
3627
|
+
* @param to - location we were navigating to when the error happened
|
|
3628
|
+
* @param from - location we were navigating from when the error happened
|
|
3629
|
+
* @internal
|
|
3630
|
+
*/
|
|
3631
|
+
interface _ErrorListener {
|
|
3632
|
+
(error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;
|
|
3633
|
+
}
|
|
3634
|
+
//#endregion
|
|
3635
|
+
//#region src/scrollBehavior.d.ts
|
|
3636
|
+
/**
|
|
3637
|
+
* Scroll position similar to
|
|
3638
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions | `ScrollToOptions`}.
|
|
3639
|
+
* Note that not all browsers support `behavior`.
|
|
3640
|
+
*/
|
|
3641
|
+
type ScrollPositionCoordinates = {
|
|
3642
|
+
behavior?: ScrollOptions['behavior'];
|
|
3643
|
+
left?: number;
|
|
3644
|
+
top?: number;
|
|
3645
|
+
};
|
|
3646
|
+
/**
|
|
3647
|
+
* Internal normalized version of {@link ScrollPositionCoordinates} that always
|
|
3648
|
+
* has `left` and `top` coordinates. Must be a type to be assignable to HistoryStateValue.
|
|
3649
|
+
*
|
|
3650
|
+
* @internal
|
|
3651
|
+
*/
|
|
3652
|
+
type _ScrollPositionNormalized = {
|
|
3653
|
+
behavior?: ScrollOptions['behavior'];
|
|
3654
|
+
left: number;
|
|
3655
|
+
top: number;
|
|
3656
|
+
};
|
|
3657
|
+
/**
|
|
3658
|
+
* Type of the `scrollBehavior` option that can be passed to `createRouter`.
|
|
3659
|
+
*/
|
|
3660
|
+
interface RouterScrollBehavior {
|
|
3661
|
+
/**
|
|
3662
|
+
* @param to - Route location where we are navigating to
|
|
3663
|
+
* @param from - Route location where we are navigating from
|
|
3664
|
+
* @param savedPosition - saved position if it exists, `null` otherwise
|
|
3665
|
+
*/
|
|
3666
|
+
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, savedPosition: _ScrollPositionNormalized | null): Awaitable<ScrollPosition | false | void>;
|
|
3667
|
+
}
|
|
3668
|
+
interface ScrollPositionElement extends ScrollToOptions {
|
|
3669
|
+
/**
|
|
3670
|
+
* A valid CSS selector. Note some characters must be escaped in id selectors (https://mathiasbynens.be/notes/css-escapes).
|
|
3671
|
+
* @example
|
|
3672
|
+
* Here are a few examples:
|
|
3673
|
+
*
|
|
3674
|
+
* - `.title`
|
|
3675
|
+
* - `.content:first-child`
|
|
3676
|
+
* - `#marker`
|
|
3677
|
+
* - `#marker\~with\~symbols`
|
|
3678
|
+
* - `#marker.with.dot`: selects `class="with dot" id="marker"`, not `id="marker.with.dot"`
|
|
3679
|
+
*
|
|
3680
|
+
*/
|
|
3681
|
+
el: string | Element;
|
|
3682
|
+
}
|
|
3683
|
+
type ScrollPosition = ScrollPositionCoordinates | ScrollPositionElement;
|
|
3684
|
+
type Awaitable<T$1> = T$1 | PromiseLike<T$1>;
|
|
3685
|
+
//#endregion
|
|
3686
|
+
//#region src/experimental/route-resolver/matchers/param-parsers/types.d.ts
|
|
3687
|
+
/**
|
|
3688
|
+
* Defines a parser that can read a param from the url (string-based) and
|
|
3689
|
+
* transform it into a more complex type, or vice versa.
|
|
3690
|
+
*
|
|
3691
|
+
* @see MatcherPattern
|
|
3692
|
+
*/
|
|
3693
|
+
|
|
3694
|
+
//#endregion
|
|
3695
|
+
//#region src/experimental/router.d.ts
|
|
3696
|
+
/**
|
|
3697
|
+
* Options to initialize a {@link Router} instance.
|
|
3698
|
+
*/
|
|
3699
|
+
interface EXPERIMENTAL_RouterOptions_Base extends PathParserOptions {
|
|
3700
|
+
/**
|
|
3701
|
+
* History implementation used by the router. Most web applications should use
|
|
3702
|
+
* `createWebHistory` but it requires the server to be properly configured.
|
|
3703
|
+
* You can also use a _hash_ based history with `createWebHashHistory` that
|
|
3704
|
+
* does not require any configuration on the server but isn't handled at all
|
|
3705
|
+
* by search engines and does poorly on SEO.
|
|
3706
|
+
*
|
|
3707
|
+
* @example
|
|
3708
|
+
* ```js
|
|
3709
|
+
* createRouter({
|
|
3710
|
+
* history: createWebHistory(),
|
|
3711
|
+
* // other options...
|
|
3712
|
+
* })
|
|
3713
|
+
* ```
|
|
3714
|
+
*/
|
|
3715
|
+
history: RouterHistory;
|
|
3716
|
+
/**
|
|
3717
|
+
* Function to control scrolling when navigating between pages. Can return a
|
|
3718
|
+
* Promise to delay scrolling.
|
|
3719
|
+
*
|
|
3720
|
+
* @see {@link RouterScrollBehavior}.
|
|
3721
|
+
*
|
|
3722
|
+
* @example
|
|
3723
|
+
* ```js
|
|
3724
|
+
* function scrollBehavior(to, from, savedPosition) {
|
|
3725
|
+
* // `to` and `from` are both route locations
|
|
3726
|
+
* // `savedPosition` can be null if there isn't one
|
|
3727
|
+
* }
|
|
3728
|
+
* ```
|
|
3729
|
+
*/
|
|
3730
|
+
scrollBehavior?: RouterScrollBehavior;
|
|
3731
|
+
/**
|
|
3732
|
+
* Custom implementation to parse a query. See its counterpart,
|
|
3733
|
+
* {@link EXPERIMENTAL_RouterOptions_Base.stringifyQuery}.
|
|
3734
|
+
*
|
|
3735
|
+
* @example
|
|
3736
|
+
* Let's say you want to use the [qs package](https://github.com/ljharb/qs)
|
|
3737
|
+
* to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
|
|
3738
|
+
* ```js
|
|
3739
|
+
* import qs from 'qs'
|
|
3740
|
+
*
|
|
3741
|
+
* createRouter({
|
|
3742
|
+
* // other options...
|
|
3743
|
+
* parseQuery: qs.parse,
|
|
3744
|
+
* stringifyQuery: qs.stringify,
|
|
3745
|
+
* })
|
|
3746
|
+
* ```
|
|
3747
|
+
*/
|
|
3748
|
+
parseQuery?: typeof parseQuery;
|
|
3749
|
+
/**
|
|
3750
|
+
* Custom implementation to stringify a query object. Should not prepend a leading `?`.
|
|
3751
|
+
* {@link parseQuery} counterpart to handle query parsing.
|
|
3752
|
+
*/
|
|
3753
|
+
stringifyQuery?: typeof stringifyQuery;
|
|
3754
|
+
/**
|
|
3755
|
+
* Default class applied to active {@link RouterLink}. If none is provided,
|
|
3756
|
+
* `router-link-active` will be applied.
|
|
3757
|
+
*/
|
|
3758
|
+
linkActiveClass?: string;
|
|
3759
|
+
/**
|
|
3760
|
+
* Default class applied to exact active {@link RouterLink}. If none is provided,
|
|
3761
|
+
* `router-link-exact-active` will be applied.
|
|
3762
|
+
*/
|
|
3763
|
+
linkExactActiveClass?: string;
|
|
3764
|
+
}
|
|
3765
|
+
/**
|
|
3766
|
+
* Internal type for common properties among all kind of {@link RouteRecordRaw}.
|
|
3767
|
+
*/
|
|
3768
|
+
|
|
3769
|
+
/**
|
|
3770
|
+
* Router base instance.
|
|
3771
|
+
*
|
|
3772
|
+
* @experimental This version is not stable, it's meant to replace {@link Router} in the future.
|
|
3773
|
+
*/
|
|
3774
|
+
interface EXPERIMENTAL_Router_Base<TRecord> {
|
|
3775
|
+
/**
|
|
3776
|
+
* Current {@link RouteLocationNormalized}
|
|
3777
|
+
*/
|
|
3778
|
+
readonly currentRoute: ShallowRef<RouteLocationNormalizedLoaded>;
|
|
3779
|
+
/**
|
|
3780
|
+
* Allows turning off the listening of history events. This is a low level api for micro-frontend.
|
|
3781
|
+
*/
|
|
3782
|
+
listening: boolean;
|
|
3783
|
+
/**
|
|
3784
|
+
* Checks if a route with a given name exists
|
|
3785
|
+
*
|
|
3786
|
+
* @param name - Name of the route to check
|
|
3787
|
+
*/
|
|
3788
|
+
hasRoute(name: NonNullable<RouteRecordNameGeneric>): boolean;
|
|
3789
|
+
/**
|
|
3790
|
+
* Get a full list of all the {@link RouteRecord | route records}.
|
|
3791
|
+
*/
|
|
3792
|
+
getRoutes(): TRecord[];
|
|
3793
|
+
/**
|
|
3794
|
+
* Returns the {@link RouteLocation | normalized version} of a
|
|
3795
|
+
* {@link RouteLocationRaw | route location}. Also includes an `href` property
|
|
3796
|
+
* that includes any existing `base`. By default, the `currentLocation` used is
|
|
3797
|
+
* `router.currentRoute` and should only be overridden in advanced use cases.
|
|
3798
|
+
*
|
|
3799
|
+
* @param to - Raw route location to resolve
|
|
3800
|
+
* @param currentLocation - Optional current location to resolve against
|
|
3801
|
+
*/
|
|
3802
|
+
resolve<Name extends keyof RouteMap = keyof RouteMap>(to: RouteLocationAsRelativeTyped<RouteMap, Name>, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved<Name>;
|
|
3803
|
+
resolve(to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved;
|
|
3804
|
+
/**
|
|
3805
|
+
* Programmatically navigate to a new URL by pushing an entry in the history
|
|
3806
|
+
* stack.
|
|
3807
|
+
*
|
|
3808
|
+
* @param to - Route location to navigate to
|
|
3809
|
+
*/
|
|
3810
|
+
push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
3811
|
+
/**
|
|
3812
|
+
* Programmatically navigate to a new URL by replacing the current entry in
|
|
3813
|
+
* the history stack.
|
|
3814
|
+
*
|
|
3815
|
+
* @param to - Route location to navigate to
|
|
3816
|
+
*/
|
|
3817
|
+
replace(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
3818
|
+
/**
|
|
3819
|
+
* Go back in history if possible by calling `history.back()`. Equivalent to
|
|
3820
|
+
* `router.go(-1)`.
|
|
3821
|
+
*/
|
|
3822
|
+
back(): void;
|
|
3823
|
+
/**
|
|
3824
|
+
* Go forward in history if possible by calling `history.forward()`.
|
|
3825
|
+
* Equivalent to `router.go(1)`.
|
|
3826
|
+
*/
|
|
3827
|
+
forward(): void;
|
|
3828
|
+
/**
|
|
3829
|
+
* Allows you to move forward or backward through the history. Calls
|
|
3830
|
+
* `history.go()`.
|
|
3831
|
+
*
|
|
3832
|
+
* @param delta - The position in the history to which you want to move,
|
|
3833
|
+
* relative to the current page
|
|
3834
|
+
*/
|
|
3835
|
+
go(delta: number): void;
|
|
3836
|
+
/**
|
|
3837
|
+
* Add a navigation guard that executes before any navigation. Returns a
|
|
3838
|
+
* function that removes the registered guard.
|
|
3839
|
+
*
|
|
3840
|
+
* @param guard - navigation guard to add
|
|
3841
|
+
*/
|
|
3842
|
+
beforeEach(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
3843
|
+
/**
|
|
3844
|
+
* Add a navigation guard that executes before navigation is about to be
|
|
3845
|
+
* resolved. At this state all component have been fetched and other
|
|
3846
|
+
* navigation guards have been successful. Returns a function that removes the
|
|
3847
|
+
* registered guard.
|
|
3848
|
+
*
|
|
3849
|
+
* @param guard - navigation guard to add
|
|
3850
|
+
* @returns a function that removes the registered guard
|
|
3851
|
+
*
|
|
3852
|
+
* @example
|
|
3853
|
+
* ```js
|
|
3854
|
+
* router.beforeResolve(to => {
|
|
3855
|
+
* if (to.meta.requiresAuth && !isAuthenticated) return false
|
|
3856
|
+
* })
|
|
3857
|
+
* ```
|
|
3858
|
+
*
|
|
3859
|
+
*/
|
|
3860
|
+
beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
3861
|
+
/**
|
|
3862
|
+
* Add a navigation hook that is executed after every navigation. Returns a
|
|
3863
|
+
* function that removes the registered hook.
|
|
3864
|
+
*
|
|
3865
|
+
* @param guard - navigation hook to add
|
|
3866
|
+
* @returns a function that removes the registered hook
|
|
3867
|
+
*
|
|
3868
|
+
* @example
|
|
3869
|
+
* ```js
|
|
3870
|
+
* router.afterEach((to, from, failure) => {
|
|
3871
|
+
* if (isNavigationFailure(failure)) {
|
|
3872
|
+
* console.log('failed navigation', failure)
|
|
3873
|
+
* }
|
|
3874
|
+
* })
|
|
3875
|
+
* ```
|
|
3876
|
+
*/
|
|
3877
|
+
afterEach(guard: NavigationHookAfter): () => void;
|
|
3878
|
+
/**
|
|
3879
|
+
* Adds an error handler that is called every time a non caught error happens
|
|
3880
|
+
* during navigation. This includes errors thrown synchronously and
|
|
3881
|
+
* asynchronously, errors returned or passed to `next` in any navigation
|
|
3882
|
+
* guard, and errors occurred when trying to resolve an async component that
|
|
3883
|
+
* is required to render a route.
|
|
3884
|
+
*
|
|
3885
|
+
* @param handler - error handler to register
|
|
3886
|
+
*/
|
|
3887
|
+
onError(handler: _ErrorListener): () => void;
|
|
3888
|
+
/**
|
|
3889
|
+
* Returns a Promise that resolves when the router has completed the initial
|
|
3890
|
+
* navigation, which means it has resolved all async enter hooks and async
|
|
3891
|
+
* components that are associated with the initial route. If the initial
|
|
3892
|
+
* navigation already happened, the promise resolves immediately.
|
|
3893
|
+
*
|
|
3894
|
+
* This is useful in server-side rendering to ensure consistent output on both
|
|
3895
|
+
* the server and the client. Note that on server side, you need to manually
|
|
3896
|
+
* push the initial location while on client side, the router automatically
|
|
3897
|
+
* picks it up from the URL.
|
|
3898
|
+
*/
|
|
3899
|
+
isReady(): Promise<void>;
|
|
3900
|
+
/**
|
|
3901
|
+
* Called automatically by `app.use(router)`. Should not be called manually by
|
|
3902
|
+
* the user. This will trigger the initial navigation when on client side.
|
|
3903
|
+
*
|
|
3904
|
+
* @internal
|
|
3905
|
+
* @param app - Application that uses the router
|
|
3906
|
+
*/
|
|
3907
|
+
install(app: App): void;
|
|
3908
|
+
}
|
|
3909
|
+
//#endregion
|
|
3910
|
+
//#region ../../node_modules/.pnpm/vue-router@4.6.3_vue@3.5.22_typescript@5.9.3_/node_modules/vue-router/dist/vue-router.d.mts
|
|
3911
|
+
//#endregion
|
|
3912
|
+
//#region src/router.d.ts
|
|
3913
|
+
/**
|
|
3914
|
+
* Options to initialize a {@link Router} instance.
|
|
3915
|
+
*/
|
|
3916
|
+
interface RouterOptions extends EXPERIMENTAL_RouterOptions_Base {
|
|
3917
|
+
/**
|
|
3918
|
+
* Initial list of routes that should be added to the router.
|
|
3919
|
+
*/
|
|
3920
|
+
routes: Readonly<RouteRecordRaw[]>;
|
|
3921
|
+
}
|
|
3922
|
+
/**
|
|
3923
|
+
* Router instance.
|
|
3924
|
+
*/
|
|
3925
|
+
interface Router extends EXPERIMENTAL_Router_Base<RouteRecordNormalized> {
|
|
3926
|
+
/**
|
|
3927
|
+
* Original options object passed to create the Router
|
|
3928
|
+
*/
|
|
3929
|
+
readonly options: RouterOptions;
|
|
3930
|
+
/**
|
|
3931
|
+
* Add a new {@link RouteRecordRaw | route record} as the child of an existing route.
|
|
3932
|
+
*
|
|
3933
|
+
* @param parentName - Parent Route Record where `route` should be appended at
|
|
3934
|
+
* @param route - Route Record to add
|
|
3935
|
+
*/
|
|
3936
|
+
addRoute(parentName: NonNullable<RouteRecordNameGeneric>, route: RouteRecordRaw): () => void;
|
|
3937
|
+
/**
|
|
3938
|
+
* Add a new {@link RouteRecordRaw | route record} to the router.
|
|
3939
|
+
*
|
|
3940
|
+
* @param route - Route Record to add
|
|
3941
|
+
*/
|
|
3942
|
+
addRoute(route: RouteRecordRaw): () => void;
|
|
3943
|
+
/**
|
|
3944
|
+
* Remove an existing route by its name.
|
|
3945
|
+
*
|
|
3946
|
+
* @param name - Name of the route to remove
|
|
3947
|
+
*/
|
|
3948
|
+
removeRoute(name: NonNullable<RouteRecordNameGeneric>): void;
|
|
3949
|
+
/**
|
|
3950
|
+
* Delete all routes from the router.
|
|
3951
|
+
*/
|
|
3952
|
+
clearRoutes(): void;
|
|
3953
|
+
}
|
|
3954
|
+
/**
|
|
3955
|
+
* Creates a Router instance that can be used by a Vue app.
|
|
3956
|
+
*
|
|
3957
|
+
* @param options - {@link RouterOptions}
|
|
3958
|
+
*/
|
|
3959
|
+
|
|
3960
|
+
//#endregion
|
|
3961
|
+
//#region src/RouterLink.d.ts
|
|
3962
|
+
interface RouterLinkOptions {
|
|
3963
|
+
/**
|
|
3964
|
+
* Route Location the link should navigate to when clicked on.
|
|
3965
|
+
*/
|
|
3966
|
+
to: RouteLocationRaw;
|
|
3967
|
+
/**
|
|
3968
|
+
* Calls `router.replace` instead of `router.push`.
|
|
3969
|
+
*/
|
|
3970
|
+
replace?: boolean;
|
|
3971
|
+
}
|
|
3972
|
+
interface RouterLinkProps extends RouterLinkOptions {
|
|
3973
|
+
/**
|
|
3974
|
+
* Whether RouterLink should not wrap its content in an `a` tag. Useful when
|
|
3975
|
+
* using `v-slot` to create a custom RouterLink
|
|
3976
|
+
*/
|
|
3977
|
+
custom?: boolean;
|
|
3978
|
+
/**
|
|
3979
|
+
* Class to apply when the link is active
|
|
3980
|
+
*/
|
|
3981
|
+
activeClass?: string;
|
|
3982
|
+
/**
|
|
3983
|
+
* Class to apply when the link is exact active
|
|
3984
|
+
*/
|
|
3985
|
+
exactActiveClass?: string;
|
|
3986
|
+
/**
|
|
3987
|
+
* Value passed to the attribute `aria-current` when the link is exact active.
|
|
3988
|
+
*
|
|
3989
|
+
* @defaultValue `'page'`
|
|
3990
|
+
*/
|
|
3991
|
+
ariaCurrentValue?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
|
|
3992
|
+
/**
|
|
3993
|
+
* Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
|
|
3994
|
+
*/
|
|
3995
|
+
viewTransition?: boolean;
|
|
3996
|
+
}
|
|
3997
|
+
/**
|
|
3998
|
+
* Options passed to {@link useLink}.
|
|
3999
|
+
*/
|
|
4000
|
+
interface UseLinkOptions<Name extends keyof RouteMap = keyof RouteMap> {
|
|
4001
|
+
to: MaybeRef<RouteLocationAsString | RouteLocationAsRelativeTyped<RouteMap, Name> | RouteLocationAsPath | RouteLocationRaw>;
|
|
4002
|
+
replace?: MaybeRef<boolean | undefined>;
|
|
4003
|
+
/**
|
|
4004
|
+
* Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
|
|
4005
|
+
*/
|
|
4006
|
+
viewTransition?: boolean;
|
|
4007
|
+
}
|
|
4008
|
+
/**
|
|
4009
|
+
* Return type of {@link useLink}.
|
|
4010
|
+
* @internal
|
|
4011
|
+
*/
|
|
4012
|
+
interface UseLinkReturn<Name extends keyof RouteMap = keyof RouteMap> {
|
|
4013
|
+
route: ComputedRef<RouteLocationResolved<Name>>;
|
|
4014
|
+
href: ComputedRef<string>;
|
|
4015
|
+
isActive: ComputedRef<boolean>;
|
|
4016
|
+
isExactActive: ComputedRef<boolean>;
|
|
4017
|
+
navigate(e?: MouseEvent): Promise<void | NavigationFailure>;
|
|
4018
|
+
}
|
|
4019
|
+
/**
|
|
4020
|
+
* Returns the internal behavior of a {@link RouterLink} without the rendering part.
|
|
4021
|
+
*
|
|
4022
|
+
* @param props - a `to` location and an optional `replace` flag
|
|
4023
|
+
*/
|
|
4024
|
+
declare function useLink<Name extends keyof RouteMap = keyof RouteMap>(props: UseLinkOptions<Name>): UseLinkReturn<Name>;
|
|
4025
|
+
/**
|
|
4026
|
+
* Component to render a link that triggers a navigation on click.
|
|
4027
|
+
*/
|
|
4028
|
+
declare const RouterLink: _RouterLinkI;
|
|
4029
|
+
/**
|
|
4030
|
+
* @internal
|
|
4031
|
+
*/
|
|
4032
|
+
type _RouterLinkPropsTypedBase = AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterLinkProps;
|
|
4033
|
+
/**
|
|
4034
|
+
* @internal
|
|
4035
|
+
*/
|
|
4036
|
+
type RouterLinkPropsTyped<Custom extends boolean | undefined> = Custom extends true ? _RouterLinkPropsTypedBase & {
|
|
4037
|
+
custom: true;
|
|
4038
|
+
} : _RouterLinkPropsTypedBase & {
|
|
4039
|
+
custom?: false | undefined;
|
|
4040
|
+
} & Omit<AnchorHTMLAttributes, 'href'>;
|
|
4041
|
+
/**
|
|
4042
|
+
* Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
|
|
4043
|
+
* automatically for JSX.
|
|
4044
|
+
*
|
|
4045
|
+
* @internal
|
|
4046
|
+
*/
|
|
4047
|
+
interface _RouterLinkI {
|
|
4048
|
+
new <Custom extends boolean | undefined = boolean | undefined>(): {
|
|
4049
|
+
$props: RouterLinkPropsTyped<Custom>;
|
|
4050
|
+
$slots: {
|
|
4051
|
+
default?: ({
|
|
4052
|
+
route,
|
|
4053
|
+
href,
|
|
4054
|
+
isActive,
|
|
4055
|
+
isExactActive,
|
|
4056
|
+
navigate
|
|
4057
|
+
}: UnwrapRef<UseLinkReturn>) => VNode[];
|
|
4058
|
+
};
|
|
4059
|
+
};
|
|
4060
|
+
/**
|
|
4061
|
+
* Access to `useLink()` without depending on using vue-router
|
|
4062
|
+
*
|
|
4063
|
+
* @internal
|
|
4064
|
+
*/
|
|
4065
|
+
useLink: typeof useLink;
|
|
4066
|
+
}
|
|
4067
|
+
//#endregion
|
|
4068
|
+
//#region src/RouterView.d.ts
|
|
4069
|
+
interface RouterViewProps {
|
|
4070
|
+
name?: string;
|
|
4071
|
+
route?: RouteLocationNormalized;
|
|
4072
|
+
}
|
|
4073
|
+
/**
|
|
4074
|
+
* Component to display the current route the user is at.
|
|
4075
|
+
*/
|
|
4076
|
+
declare const RouterView: {
|
|
4077
|
+
new (): {
|
|
4078
|
+
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterViewProps;
|
|
4079
|
+
$slots: {
|
|
4080
|
+
default?: ({
|
|
4081
|
+
Component,
|
|
4082
|
+
route
|
|
4083
|
+
}: {
|
|
4084
|
+
Component: VNode;
|
|
4085
|
+
route: RouteLocationNormalizedLoaded;
|
|
4086
|
+
}) => VNode[];
|
|
4087
|
+
};
|
|
4088
|
+
};
|
|
4089
|
+
};
|
|
4090
|
+
//#endregion
|
|
4091
|
+
//#region src/useApi.d.ts
|
|
4092
|
+
/**
|
|
4093
|
+
* Returns the router instance. Equivalent to using `$router` inside
|
|
4094
|
+
* templates.
|
|
4095
|
+
*/
|
|
4096
|
+
|
|
4097
|
+
//#endregion
|
|
4098
|
+
//#region src/index.d.ts
|
|
4099
|
+
declare module 'vue' {
|
|
4100
|
+
interface ComponentCustomOptions {
|
|
4101
|
+
/**
|
|
4102
|
+
* Guard called when the router is navigating to the route that is rendering
|
|
4103
|
+
* this component from a different route. Differently from `beforeRouteUpdate`
|
|
4104
|
+
* and `beforeRouteLeave`, `beforeRouteEnter` does not have access to the
|
|
4105
|
+
* component instance through `this` because it triggers before the component
|
|
4106
|
+
* is even mounted.
|
|
4107
|
+
*
|
|
4108
|
+
* @param to - RouteLocationRaw we are navigating to
|
|
4109
|
+
* @param from - RouteLocationRaw we are navigating from
|
|
4110
|
+
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
4111
|
+
* navigation
|
|
4112
|
+
*/
|
|
4113
|
+
beforeRouteEnter?: TypesConfig extends Record<'beforeRouteEnter', infer T> ? T : NavigationGuardWithThis<undefined>;
|
|
4114
|
+
/**
|
|
4115
|
+
* Guard called whenever the route that renders this component has changed, but
|
|
4116
|
+
* it is reused for the new route. This allows you to guard for changes in
|
|
4117
|
+
* params, the query or the hash.
|
|
4118
|
+
*
|
|
4119
|
+
* @param to - RouteLocationRaw we are navigating to
|
|
4120
|
+
* @param from - RouteLocationRaw we are navigating from
|
|
4121
|
+
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
4122
|
+
* navigation
|
|
4123
|
+
*/
|
|
4124
|
+
beforeRouteUpdate?: TypesConfig extends Record<'beforeRouteUpdate', infer T> ? T : NavigationGuard;
|
|
4125
|
+
/**
|
|
4126
|
+
* Guard called when the router is navigating away from the current route that
|
|
4127
|
+
* is rendering this component.
|
|
4128
|
+
*
|
|
4129
|
+
* @param to - RouteLocationRaw we are navigating to
|
|
4130
|
+
* @param from - RouteLocationRaw we are navigating from
|
|
4131
|
+
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
4132
|
+
* navigation
|
|
4133
|
+
*/
|
|
4134
|
+
beforeRouteLeave?: TypesConfig extends Record<'beforeRouteLeave', infer T> ? T : NavigationGuard;
|
|
4135
|
+
}
|
|
4136
|
+
interface ComponentCustomProperties {
|
|
4137
|
+
/**
|
|
4138
|
+
* Normalized current location. See {@link RouteLocationNormalizedLoaded}.
|
|
4139
|
+
*/
|
|
4140
|
+
$route: TypesConfig extends Record<'$route', infer T> ? T : RouteLocationNormalizedLoaded;
|
|
4141
|
+
/**
|
|
4142
|
+
* {@link Router} instance used by the application.
|
|
4143
|
+
*/
|
|
4144
|
+
$router: TypesConfig extends Record<'$router', infer T> ? T : Router;
|
|
4145
|
+
}
|
|
4146
|
+
interface GlobalComponents {
|
|
4147
|
+
RouterView: TypesConfig extends Record<'RouterView', infer T> ? T : typeof RouterView;
|
|
4148
|
+
RouterLink: TypesConfig extends Record<'RouterLink', infer T> ? T : typeof RouterLink;
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4151
|
+
//#endregion
|
|
4152
|
+
//#endregion
|
|
4153
|
+
//#region src/devtools/registry.d.ts
|
|
4154
|
+
declare function registerRegleInstance(r$: SuperCompatibleRegleRoot, options?: {
|
|
4155
|
+
name?: string;
|
|
4156
|
+
}): void;
|
|
4157
|
+
//#endregion
|
|
4158
|
+
export { type $InternalRegleStatus, type AllRulesDeclarations, type ArrayElement, type CommonAlphaOptions, type CommonComparisonOptions, type CreateScopedUseRegleOptions, type DeepMaybeRef, type DeepReactiveState, type DefaultValidatorsTree, type FormRuleDeclaration, type HasNamedKeys, type HaveAnyRequiredProps, type InferInput, type InferRegleRoot, type InferRegleRule, type InferRegleRules, type InferRegleShortcuts, type InferRegleStatusType, type InferSafeOutput, type InlineRuleDeclaration, InternalRuleType, type JoinDiscriminatedUnions, type LocalRegleBehaviourOptions, type Maybe, type MaybeInput, type MaybeOutput, type MaybeReadonly, type MaybeVariantStatus, type MergedRegles, type MergedScopedRegles, type NarrowVariant, type NoInferLegacy, type NonEmptyTuple, type PrimitiveTypes, type Regle, type RegleBehaviourOptions, type RegleCollectionErrors, type RegleCollectionRuleDecl, type RegleCollectionRuleDefinition, type RegleCollectionStatus, type RegleCommonStatus, type RegleComputedRules, type RegleCustomFieldStatus, type RegleEnforceCustomRequiredRules, type RegleEnforceRequiredRules, type RegleErrorTree, type RegleExternalCollectionErrors, type RegleExternalErrorTree, type RegleExternalSchemaErrorTree, type RegleFieldIssue, type RegleFieldStatus, type RegleFormPropertyType, type RegleInternalRuleDefs, type RegleIssuesTree, type ReglePartialRuleTree, type RegleResult, type RegleRoot, type RegleRuleCore, type RegleRuleDecl, type RegleRuleDefinition, type RegleRuleDefinitionProcessor, type RegleRuleDefinitionWithMetadataProcessor, type RegleRuleInit, type RegleRuleMetadataConsumer, type RegleRuleMetadataDefinition, type RegleRuleMetadataExtended, type RegleRuleRaw, type RegleRuleStatus, type RegleRuleTypeReturn, type RegleRuleWithParamsDefinition, type RegleShortcutDefinition, type RegleSingleField, type RegleStatus, type RegleUniversalParams, type RegleUnknownRulesTree, type RegleValidationErrors, type RegleValidationGroupEntry, type RegleValidationGroupOutput, type RegleRuleTree as RegleValidationTree, RegleVuePlugin, type ResolvedRegleBehaviourOptions, type ScopedInstancesRecord, type ScopedInstancesRecordLike, type SuperCompatibleRegle, type SuperCompatibleRegleCollectionErrors, type SuperCompatibleRegleCollectionStatus, type SuperCompatibleRegleFieldStatus, type SuperCompatibleRegleResult, type SuperCompatibleRegleRoot, type SuperCompatibleRegleRuleStatus, type SuperCompatibleRegleStatus, type Unwrap, type UnwrapRegleUniversalParams, type UnwrapRuleWithParams, type UseScopedRegleOptions, createRule, createScopedUseRegle, createVariant, defineRegleConfig, defineRules, extendRegleConfig, flatErrors, inferRules, type inferRulesFn, mergeRegles, narrowVariant, refineRules, registerRegleInstance, unwrapRuleParameters, useCollectScope, type useCollectScopeFn, useRegle, type useRegleFn, useRootStorage, useRules, type useRulesFn, useScopedRegle, variantToRef };
|