@regle/schemas 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-schemas.d.ts +1506 -70
- package/package.json +3 -3
package/dist/regle-schemas.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
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, Raw, Ref, ShallowRef, UnwrapNestedRefs, UnwrapRef, VNode, VNodeProps } from "vue";
|
|
3
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
|
|
5
5
|
//#region ../core/dist/regle-core.d.ts
|
|
6
6
|
//#region src/types/utils/misc.types.d.ts
|
|
7
|
-
type Prettify<T> = T extends infer R ? { [K in keyof R]: R[K] } & {} : never;
|
|
8
|
-
type Maybe<T = any> = T | null | undefined;
|
|
9
|
-
type MaybeInput<T = any> = T | null | undefined;
|
|
10
|
-
type MaybeOutput<T = any> = T | undefined;
|
|
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 ExtractFromGetter<T extends MaybeGetter<any, any, any>> = T extends ((value: Ref<any>, index: number) => infer U extends Record<string, any>) ? U : T;
|
|
16
|
-
type ExtendOnlyRealRecord<T extends unknown> = NonNullable<T> extends File | Date ? false : NonNullable<T> extends Record<string, any> ? true : false;
|
|
17
|
-
type OmitByType<T extends Record<string, any>, U$1> = { [K in keyof T as T[K] extends U$1 ? never : K]: T[K] };
|
|
18
|
-
type DeepMaybeRef<T extends Record<string, any>> = { [K in keyof T]: MaybeRef<T[K]> };
|
|
19
|
-
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] };
|
|
7
|
+
type Prettify<T$1> = T$1 extends infer R ? { [K in keyof R]: R[K] } & {} : never;
|
|
8
|
+
type Maybe<T$1 = any> = T$1 | null | undefined;
|
|
9
|
+
type MaybeInput<T$1 = any> = T$1 | null | undefined;
|
|
10
|
+
type MaybeOutput<T$1 = any> = T$1 | undefined;
|
|
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 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;
|
|
16
|
+
type ExtendOnlyRealRecord<T$1 extends unknown> = NonNullable<T$1> extends File | Date ? false : NonNullable<T$1> extends Record<string, any> ? true : false;
|
|
17
|
+
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] };
|
|
18
|
+
type DeepMaybeRef<T$1 extends Record<string, any>> = { [K in keyof T$1]: MaybeRef<T$1[K]> };
|
|
19
|
+
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] };
|
|
20
20
|
type PrimitiveTypes = string | number | boolean | bigint | Date | File;
|
|
21
|
-
type isRecordLiteral<T extends unknown> = NonNullable<T> extends Date | File ? false : NonNullable<T> extends Record<string, any> ? true : false;
|
|
21
|
+
type isRecordLiteral<T$1 extends unknown> = NonNullable<T$1> extends Date | File ? false : NonNullable<T$1> extends Record<string, any> ? true : false;
|
|
22
22
|
type NoInferLegacy<A$1 extends any> = [A$1][A$1 extends any ? 0 : never];
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/types/utils/Array.types.d.ts
|
|
25
|
-
type ArrayElement<T> = T extends Array<infer U> ? U : never;
|
|
25
|
+
type ArrayElement<T$1> = T$1 extends Array<infer U> ? U : never;
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/primitive.d.ts
|
|
28
28
|
/**
|
|
@@ -141,7 +141,7 @@ type Fail = IsEmptyObject<null>; //=> false
|
|
|
141
141
|
@see {@link EmptyObject}
|
|
142
142
|
@category Object
|
|
143
143
|
*/
|
|
144
|
-
type IsEmptyObject<T> = T extends EmptyObject$1 ? true : false;
|
|
144
|
+
type IsEmptyObject<T$1> = T$1 extends EmptyObject$1 ? true : false;
|
|
145
145
|
//#endregion
|
|
146
146
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-any.d.ts
|
|
147
147
|
/**
|
|
@@ -172,7 +172,7 @@ const anyA = get(anyObject, 'a');
|
|
|
172
172
|
@category Type Guard
|
|
173
173
|
@category Utilities
|
|
174
174
|
*/
|
|
175
|
-
type IsAny$1<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
175
|
+
type IsAny$1<T$1> = 0 extends 1 & NoInfer<T$1> ? true : false;
|
|
176
176
|
//#endregion
|
|
177
177
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
178
178
|
/**
|
|
@@ -325,7 +325,7 @@ endIfEqual('abc', '123');
|
|
|
325
325
|
@category Type Guard
|
|
326
326
|
@category Utilities
|
|
327
327
|
*/
|
|
328
|
-
type IsNever$1<T> = [T] extends [never] ? true : false;
|
|
328
|
+
type IsNever$1<T$1> = [T$1] extends [never] ? true : false;
|
|
329
329
|
//#endregion
|
|
330
330
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/if.d.ts
|
|
331
331
|
/**
|
|
@@ -435,7 +435,7 @@ Needed to handle the case of a single call signature with properties.
|
|
|
435
435
|
Multiple call signatures cannot currently be supported due to a TypeScript limitation.
|
|
436
436
|
@see https://github.com/microsoft/TypeScript/issues/29732
|
|
437
437
|
*/
|
|
438
|
-
type HasMultipleCallSignatures$1<T extends (...arguments_: any[]) => unknown> = T extends {
|
|
438
|
+
type HasMultipleCallSignatures$1<T$1 extends (...arguments_: any[]) => unknown> = T$1 extends {
|
|
439
439
|
(...arguments_: infer A): unknown;
|
|
440
440
|
(...arguments_: infer B): unknown;
|
|
441
441
|
} ? B extends A ? A extends B ? false : true : true : false;
|
|
@@ -483,7 +483,7 @@ type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
|
|
|
483
483
|
//=> ''
|
|
484
484
|
```
|
|
485
485
|
*/
|
|
486
|
-
type IfNotAnyOrNever<T, IfNotAnyOrNever$1, IfAny = any, IfNever = never> = If$1<IsAny$1<T>, IfAny, If$1<IsNever$1<T>, IfNever, IfNotAnyOrNever$1>>;
|
|
486
|
+
type IfNotAnyOrNever<T$1, IfNotAnyOrNever$1, IfAny = any, IfNever = never> = If$1<IsAny$1<T$1>, IfAny, If$1<IsNever$1<T$1>, IfNever, IfNotAnyOrNever$1>>;
|
|
487
487
|
//#endregion
|
|
488
488
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-null.d.ts
|
|
489
489
|
/**
|
|
@@ -505,7 +505,7 @@ type Example2 = NonNullFallback<number, string>;
|
|
|
505
505
|
@category Type Guard
|
|
506
506
|
@category Utilities
|
|
507
507
|
*/
|
|
508
|
-
type IsNull<T> = [T] extends [null] ? true : false;
|
|
508
|
+
type IsNull<T$1> = [T$1] extends [null] ? true : false;
|
|
509
509
|
//#endregion
|
|
510
510
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-unknown.d.ts
|
|
511
511
|
/**
|
|
@@ -551,8 +551,8 @@ store.execute((state, payload) => ({value: state.value + payload}), someExternal
|
|
|
551
551
|
|
|
552
552
|
@category Utilities
|
|
553
553
|
*/
|
|
554
|
-
type IsUnknown<T> = (unknown extends T // `T` can be `unknown` or `any`
|
|
555
|
-
? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be
|
|
554
|
+
type IsUnknown<T$1> = (unknown extends T$1 // `T` can be `unknown` or `any`
|
|
555
|
+
? IsNull<T$1> extends false // `any` can be `null`, but `unknown` can't be
|
|
556
556
|
? true : false : false);
|
|
557
557
|
//#endregion
|
|
558
558
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/keys.d.ts
|
|
@@ -619,7 +619,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
619
619
|
@see {@link SimplifyDeep}
|
|
620
620
|
@category Object
|
|
621
621
|
*/
|
|
622
|
-
type Simplify$1<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
622
|
+
type Simplify$1<T$1> = { [KeyType in keyof T$1]: T$1[KeyType] } & {};
|
|
623
623
|
//#endregion
|
|
624
624
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
625
625
|
/**
|
|
@@ -1109,14 +1109,14 @@ partialShape.dimensions = [15]; // OK
|
|
|
1109
1109
|
@category Set
|
|
1110
1110
|
@category Map
|
|
1111
1111
|
*/
|
|
1112
|
-
type PartialDeep$1<T, Options extends PartialDeepOptions$1 = {}> = _PartialDeep$1<T, ApplyDefaultOptions$1<PartialDeepOptions$1, DefaultPartialDeepOptions$1, Options>>;
|
|
1113
|
-
type _PartialDeep$1<T, Options extends Required<PartialDeepOptions$1>> = T extends BuiltIns$1 | ((new (...arguments_: any[]) => unknown)) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep$1<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep$1<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep$1<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep$1<ItemType, Options> : T extends ((...arguments_: any[]) => unknown) ? IsNever$1<keyof T> extends true ? T // For functions with no properties
|
|
1114
|
-
: HasMultipleCallSignatures$1<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep$1<T, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
|
|
1115
|
-
? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
|
|
1116
|
-
? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
|
|
1117
|
-
? ReadonlyArray<_PartialDeep$1<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep$1<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep$1<T, Options> // Tuples behave properly
|
|
1118
|
-
: T // If they don't opt into array testing, just use the original type
|
|
1119
|
-
: PartialObjectDeep$1<T, Options> : unknown;
|
|
1112
|
+
type PartialDeep$1<T$1, Options extends PartialDeepOptions$1 = {}> = _PartialDeep$1<T$1, ApplyDefaultOptions$1<PartialDeepOptions$1, DefaultPartialDeepOptions$1, Options>>;
|
|
1113
|
+
type _PartialDeep$1<T$1, Options extends Required<PartialDeepOptions$1>> = T$1 extends BuiltIns$1 | ((new (...arguments_: any[]) => unknown)) ? T$1 : T$1 extends Map<infer KeyType, infer ValueType> ? PartialMapDeep$1<KeyType, ValueType, Options> : T$1 extends Set<infer ItemType> ? PartialSetDeep$1<ItemType, Options> : T$1 extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep$1<KeyType, ValueType, Options> : T$1 extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep$1<ItemType, Options> : T$1 extends ((...arguments_: any[]) => unknown) ? IsNever$1<keyof T$1> extends true ? T$1 // For functions with no properties
|
|
1114
|
+
: HasMultipleCallSignatures$1<T$1> extends true ? T$1 : ((...arguments_: Parameters<T$1>) => ReturnType<T$1>) & PartialObjectDeep$1<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
|
|
1115
|
+
? Options['recurseIntoArrays'] extends true ? ItemType[] extends T$1 // Test for arrays (non-tuples) specifically
|
|
1116
|
+
? readonly ItemType[] extends T$1 // Differentiate readonly and mutable arrays
|
|
1117
|
+
? ReadonlyArray<_PartialDeep$1<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep$1<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep$1<T$1, Options> // Tuples behave properly
|
|
1118
|
+
: T$1 // If they don't opt into array testing, just use the original type
|
|
1119
|
+
: PartialObjectDeep$1<T$1, Options> : unknown;
|
|
1120
1120
|
|
|
1121
1121
|
/**
|
|
1122
1122
|
Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
|
|
@@ -1126,7 +1126,7 @@ type PartialMapDeep$1<KeyType$1, ValueType$1, Options extends Required<PartialDe
|
|
|
1126
1126
|
/**
|
|
1127
1127
|
Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
|
|
1128
1128
|
*/
|
|
1129
|
-
type PartialSetDeep$1<T, Options extends Required<PartialDeepOptions$1>> = {} & Set<_PartialDeep$1<T, Options>>;
|
|
1129
|
+
type PartialSetDeep$1<T$1, Options extends Required<PartialDeepOptions$1>> = {} & Set<_PartialDeep$1<T$1, Options>>;
|
|
1130
1130
|
|
|
1131
1131
|
/**
|
|
1132
1132
|
Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
|
|
@@ -1136,7 +1136,7 @@ type PartialReadonlyMapDeep$1<KeyType$1, ValueType$1, Options extends Required<P
|
|
|
1136
1136
|
/**
|
|
1137
1137
|
Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
|
|
1138
1138
|
*/
|
|
1139
|
-
type PartialReadonlySetDeep$1<T, Options extends Required<PartialDeepOptions$1>> = {} & ReadonlySet<_PartialDeep$1<T, Options>>;
|
|
1139
|
+
type PartialReadonlySetDeep$1<T$1, Options extends Required<PartialDeepOptions$1>> = {} & ReadonlySet<_PartialDeep$1<T$1, Options>>;
|
|
1140
1140
|
|
|
1141
1141
|
/**
|
|
1142
1142
|
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
|
@@ -1197,7 +1197,7 @@ type Last = LastOfUnion<1 | 2 | 3>;
|
|
|
1197
1197
|
//=> 3
|
|
1198
1198
|
```
|
|
1199
1199
|
*/
|
|
1200
|
-
type LastOfUnion<T> = UnionToIntersection<T extends any ? () => T : never> extends (() => (infer R)) ? R : never;
|
|
1200
|
+
type LastOfUnion<T$1> = UnionToIntersection<T$1 extends any ? () => T$1 : never> extends (() => (infer R)) ? R : never;
|
|
1201
1201
|
|
|
1202
1202
|
/**
|
|
1203
1203
|
Convert a union type into an unordered tuple type of its elements.
|
|
@@ -1234,7 +1234,7 @@ const petList = Object.keys(pets) as UnionToTuple<Pet>;
|
|
|
1234
1234
|
|
|
1235
1235
|
@category Array
|
|
1236
1236
|
*/
|
|
1237
|
-
type UnionToTuple<T, L = LastOfUnion<T>> = IsNever$1<T> extends false ? [...UnionToTuple<Exclude<T, L>>, L] : [];
|
|
1237
|
+
type UnionToTuple<T$1, L = LastOfUnion<T$1>> = IsNever$1<T$1> extends false ? [...UnionToTuple<Exclude<T$1, L>>, L] : [];
|
|
1238
1238
|
//#endregion
|
|
1239
1239
|
//#region src/types/core/modifiers.types.d.ts
|
|
1240
1240
|
interface RegleBehaviourOptions {
|
|
@@ -1272,6 +1272,11 @@ interface RegleBehaviourOptions {
|
|
|
1272
1272
|
*
|
|
1273
1273
|
*/
|
|
1274
1274
|
clearExternalErrorsOnChange?: boolean | undefined;
|
|
1275
|
+
/**
|
|
1276
|
+
* A unique identifier for the Regle instance in the devtools.
|
|
1277
|
+
* @default undefined
|
|
1278
|
+
*/
|
|
1279
|
+
id?: string | undefined;
|
|
1275
1280
|
}
|
|
1276
1281
|
interface LocalRegleBehaviourOptions<TState$1 extends Record<string, any>, TRules$1 extends ReglePartialRuleTree<TState$1, CustomRulesDeclarationTree>, TValidationGroups extends Record<string, RegleValidationGroupEntry[]> = {}> {
|
|
1277
1282
|
externalErrors?: Ref<RegleExternalErrorTree<Unwrap<TState$1>> | Record<string, string[]>>;
|
|
@@ -1303,8 +1308,8 @@ type CollectionRegleBehaviourOptions = FieldRegleBehaviourOptions & {
|
|
|
1303
1308
|
* */
|
|
1304
1309
|
$deepCompare?: boolean;
|
|
1305
1310
|
};
|
|
1306
|
-
type ShortcutCommonFn<T extends Record<string, any>> = {
|
|
1307
|
-
[x: string]: (element: Omit<OmitByType<T, Function>, '~standard'>) => unknown;
|
|
1311
|
+
type ShortcutCommonFn<T$1 extends Record<string, any>> = {
|
|
1312
|
+
[x: string]: (element: Omit<OmitByType<T$1, Function>, '~standard'>) => unknown;
|
|
1308
1313
|
};
|
|
1309
1314
|
type RegleShortcutDefinition<TCustomRules extends Record<string, any> = {}> = {
|
|
1310
1315
|
/**
|
|
@@ -1320,7 +1325,7 @@ type RegleShortcutDefinition<TCustomRules extends Record<string, any> = {}> = {
|
|
|
1320
1325
|
*/
|
|
1321
1326
|
collections?: ShortcutCommonFn<RegleCollectionStatus<any[], Partial<TCustomRules> & Partial<DefaultValidators>>>;
|
|
1322
1327
|
};
|
|
1323
|
-
type AddDollarToOptions<T extends Record<string, any>> = { [K in keyof T as `$${string & K}`]: T[K] };
|
|
1328
|
+
type AddDollarToOptions<T$1 extends Record<string, any>> = { [K in keyof T$1 as `$${string & K}`]: T$1[K] };
|
|
1324
1329
|
//#endregion
|
|
1325
1330
|
//#region src/types/core/useRegle.types.d.ts
|
|
1326
1331
|
/**
|
|
@@ -1357,7 +1362,7 @@ type RegleSingleField<TState$1 extends Maybe<PrimitiveTypes> = any, TRules$1 ext
|
|
|
1357
1362
|
*/
|
|
1358
1363
|
r$: Raw<RegleFieldStatus<TState$1, TRules$1, TShortcuts>>;
|
|
1359
1364
|
} & TAdditionalReturnProperties;
|
|
1360
|
-
type DeepReactiveState<T extends Record<string, any> | unknown | undefined> = ExtendOnlyRealRecord<T> extends true ? { [K in keyof T]: InferDeepReactiveState<T[K]> } : never;
|
|
1365
|
+
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;
|
|
1361
1366
|
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>;
|
|
1362
1367
|
//#endregion
|
|
1363
1368
|
//#region src/types/core/reset.types.d.ts
|
|
@@ -1461,11 +1466,11 @@ type SafeFieldProperty<TState$1, TRule extends RegleFormPropertyType<any, any> |
|
|
|
1461
1466
|
/**
|
|
1462
1467
|
* Negates a boolean type.
|
|
1463
1468
|
*/
|
|
1464
|
-
type Not<T extends boolean> = T extends true ? false : true;
|
|
1469
|
+
type Not<T$1 extends boolean> = T$1 extends true ? false : true;
|
|
1465
1470
|
/**
|
|
1466
1471
|
* Checks if the given type is `never`.
|
|
1467
1472
|
*/
|
|
1468
|
-
type IsNever$2<T> = [T] extends [never] ? true : false;
|
|
1473
|
+
type IsNever$2<T$1> = [T$1] extends [never] ? true : false;
|
|
1469
1474
|
/**
|
|
1470
1475
|
* Checks if one type extends another. Note: this is not quite the same as `Left extends Right` because:
|
|
1471
1476
|
* 1. If either type is `never`, the result is `true` iff the other type is also `never`.
|
|
@@ -1493,7 +1498,7 @@ type TuplifyUnion<Union, LastElement = LastOf<Union>> = IsNever$2<Union> extends
|
|
|
1493
1498
|
* Convert a union like `1 | 2 | 3` to a tuple like `[1, 2, 3]`.
|
|
1494
1499
|
*/
|
|
1495
1500
|
type UnionToTuple$1<Union> = TuplifyUnion<Union>;
|
|
1496
|
-
type IsUnion<T> = Not<Extends<UnionToTuple$1<T>['length'], 1>>;
|
|
1501
|
+
type IsUnion<T$1> = Not<Extends<UnionToTuple$1<T$1>['length'], 1>>;
|
|
1497
1502
|
//#endregion
|
|
1498
1503
|
//#region src/types/core/variants.types.d.ts
|
|
1499
1504
|
|
|
@@ -1547,10 +1552,10 @@ type ExactObject<TInfer, TTree> = { [K in keyof TTree]: NonNullable<TTree[K]> ex
|
|
|
1547
1552
|
type TypeError<Msg> = {
|
|
1548
1553
|
[' TypeError']: Msg;
|
|
1549
1554
|
};
|
|
1550
|
-
type Coerce<T> = `${T & string}`;
|
|
1555
|
+
type Coerce<T$1> = `${T$1 & string}`;
|
|
1551
1556
|
//#endregion
|
|
1552
1557
|
//#region src/types/utils/object.types.d.ts
|
|
1553
|
-
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>] : [];
|
|
1558
|
+
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>] : [];
|
|
1554
1559
|
/**
|
|
1555
1560
|
* Restore the optional properties (with ?) of a generated mapped object type
|
|
1556
1561
|
*/
|
|
@@ -1567,11 +1572,11 @@ type GetMaybeObjectValue<O extends Record<string, any>, K$1 extends string> = K$
|
|
|
1567
1572
|
/**
|
|
1568
1573
|
* Combine all union values to be able to get even the normally "never" values, act as an intersection type
|
|
1569
1574
|
*/
|
|
1570
|
-
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>] : [];
|
|
1575
|
+
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>] : [];
|
|
1571
1576
|
/**
|
|
1572
1577
|
* Get all possible keys from a union, even the ones present only on one union
|
|
1573
1578
|
*/
|
|
1574
|
-
type RetrieveUnionUnknownKeysOf<T extends readonly any[]> = T extends [infer F, ...infer R] ? [keyof F, ...RetrieveUnionUnknownKeysOf<R>] : [];
|
|
1579
|
+
type RetrieveUnionUnknownKeysOf<T$1 extends readonly any[]> = T$1 extends [infer F, ...infer R] ? [keyof F, ...RetrieveUnionUnknownKeysOf<R>] : [];
|
|
1575
1580
|
/**
|
|
1576
1581
|
* Transforms a union and apply undefined values to non-present keys to support intersection
|
|
1577
1582
|
*/
|
|
@@ -1585,23 +1590,23 @@ type EnumLike = {
|
|
|
1585
1590
|
[k: string]: string | number;
|
|
1586
1591
|
[nu: number]: string;
|
|
1587
1592
|
};
|
|
1588
|
-
type UnwrapMaybeRef<T extends MaybeRef<any> | DeepReactiveState<any>> = T extends Ref<any> ? UnwrapRef<T> : UnwrapNestedRefs<T>;
|
|
1589
|
-
type TupleToPlainObj<T> = { [I in keyof T & `${number}`]: T[I] };
|
|
1590
|
-
type HasNamedKeys<T> = IsUnion<T> extends true ? ProcessHasNamedKeys<LazyJoinDiscriminatedUnions<T>> : ProcessHasNamedKeys<T>;
|
|
1591
|
-
type ProcessHasNamedKeys<T> = { [K in keyof NonNullable<T>]: K extends string ? (string extends K ? never : K) : never }[keyof NonNullable<T>] extends never ? false : true;
|
|
1593
|
+
type UnwrapMaybeRef<T$1 extends MaybeRef<any> | DeepReactiveState<any>> = T$1 extends Ref<any> ? UnwrapRef<T$1> : UnwrapNestedRefs<T$1>;
|
|
1594
|
+
type TupleToPlainObj<T$1> = { [I in keyof T$1 & `${number}`]: T$1[I] };
|
|
1595
|
+
type HasNamedKeys<T$1> = IsUnion<T$1> extends true ? ProcessHasNamedKeys<LazyJoinDiscriminatedUnions<T$1>> : ProcessHasNamedKeys<T$1>;
|
|
1596
|
+
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;
|
|
1592
1597
|
//#endregion
|
|
1593
1598
|
//#region src/types/utils/infer.types.d.ts
|
|
1594
1599
|
|
|
1595
1600
|
//#endregion
|
|
1596
1601
|
//#region src/types/rules/rule.params.types.d.ts
|
|
1597
|
-
type CreateFn<T extends any[]> = (...args: T) => any;
|
|
1602
|
+
type CreateFn<T$1 extends any[]> = (...args: T$1) => any;
|
|
1598
1603
|
/**
|
|
1599
1604
|
* Transform normal parameters tuple declaration to a rich tuple declaration
|
|
1600
1605
|
*
|
|
1601
1606
|
* [foo: string, bar?: number] => [foo: MaybeRef<string> | (() => string), bar?: MaybeRef<number | undefined> | (() => number) | undefined]
|
|
1602
1607
|
*/
|
|
1603
|
-
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>;
|
|
1604
|
-
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>;
|
|
1608
|
+
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>;
|
|
1609
|
+
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>;
|
|
1605
1610
|
//#endregion
|
|
1606
1611
|
//#region src/types/rules/rule.internal.types.d.ts
|
|
1607
1612
|
/**
|
|
@@ -1621,7 +1626,7 @@ type RegleInternalRuleDefs<TValue$1 extends any = any, TParams$1 extends any[] =
|
|
|
1621
1626
|
}>;
|
|
1622
1627
|
//#endregion
|
|
1623
1628
|
//#region src/types/rules/rule.definition.type.d.ts
|
|
1624
|
-
type IsLiteral<T> = string extends T ? false : true;
|
|
1629
|
+
type IsLiteral<T$1> = string extends T$1 ? false : true;
|
|
1625
1630
|
/**
|
|
1626
1631
|
* Returned typed of rules created with `createRule`
|
|
1627
1632
|
* */
|
|
@@ -2167,6 +2172,7 @@ type SuperCompatibleRegleStatus = {
|
|
|
2167
2172
|
readonly $silentErrors: Record<string, RegleValidationErrors<any, false>>;
|
|
2168
2173
|
$extractDirtyFields: (filterNullishValues?: boolean) => Record<string, any>;
|
|
2169
2174
|
$validate?: () => Promise<SuperCompatibleRegleResult>;
|
|
2175
|
+
$reset: (options?: ResetOptions<unknown>) => void;
|
|
2170
2176
|
[x: string]: any;
|
|
2171
2177
|
};
|
|
2172
2178
|
//#endregion
|
|
@@ -2260,6 +2266,1436 @@ type CreateScopedUseRegleOptions<TCustomRegle extends useRegleFn<any, any>, TAsR
|
|
|
2260
2266
|
asRecord?: TAsRecord;
|
|
2261
2267
|
};
|
|
2262
2268
|
//#endregion
|
|
2269
|
+
//#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
|
|
2270
|
+
//#region src/query.d.ts
|
|
2271
|
+
|
|
2272
|
+
/**
|
|
2273
|
+
* Possible values in normalized {@link LocationQuery}. `null` renders the query
|
|
2274
|
+
* param but without an `=`.
|
|
2275
|
+
*
|
|
2276
|
+
* @example
|
|
2277
|
+
* ```
|
|
2278
|
+
* ?isNull&isEmpty=&other=other
|
|
2279
|
+
* gives
|
|
2280
|
+
* `{ isNull: null, isEmpty: '', other: 'other' }`.
|
|
2281
|
+
* ```
|
|
2282
|
+
*
|
|
2283
|
+
* @internal
|
|
2284
|
+
*/
|
|
2285
|
+
type LocationQueryValue = string | null;
|
|
2286
|
+
/**
|
|
2287
|
+
* Possible values when defining a query. `undefined` allows to remove a value.
|
|
2288
|
+
*
|
|
2289
|
+
* @internal
|
|
2290
|
+
*/
|
|
2291
|
+
type LocationQueryValueRaw = LocationQueryValue | number | undefined;
|
|
2292
|
+
/**
|
|
2293
|
+
* Normalized query object that appears in {@link RouteLocationNormalized}
|
|
2294
|
+
*
|
|
2295
|
+
* @public
|
|
2296
|
+
*/
|
|
2297
|
+
type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
|
|
2298
|
+
/**
|
|
2299
|
+
* Loose {@link LocationQuery} object that can be passed to functions like
|
|
2300
|
+
* {@link Router.push} and {@link Router.replace} or anywhere when creating a
|
|
2301
|
+
* {@link RouteLocationRaw}
|
|
2302
|
+
*
|
|
2303
|
+
* @public
|
|
2304
|
+
*/
|
|
2305
|
+
type LocationQueryRaw = Record<string | number, LocationQueryValueRaw | LocationQueryValueRaw[]>;
|
|
2306
|
+
/**
|
|
2307
|
+
* Transforms a queryString into a {@link LocationQuery} object. Accept both, a
|
|
2308
|
+
* version with the leading `?` and without Should work as URLSearchParams
|
|
2309
|
+
|
|
2310
|
+
* @internal
|
|
2311
|
+
*
|
|
2312
|
+
* @param search - search string to parse
|
|
2313
|
+
* @returns a query object
|
|
2314
|
+
*/
|
|
2315
|
+
declare function parseQuery(search: string): LocationQuery;
|
|
2316
|
+
/**
|
|
2317
|
+
* Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
|
|
2318
|
+
* doesn't prepend a `?`
|
|
2319
|
+
*
|
|
2320
|
+
* @internal
|
|
2321
|
+
*
|
|
2322
|
+
* @param query - query object to stringify
|
|
2323
|
+
* @returns string version of the query without the leading `?`
|
|
2324
|
+
*/
|
|
2325
|
+
declare function stringifyQuery(query: LocationQueryRaw | undefined): string;
|
|
2326
|
+
//#endregion
|
|
2327
|
+
//#region src/config.d.ts
|
|
2328
|
+
/**
|
|
2329
|
+
* Allows customizing existing types of the router that are used globally like `$router`, `<RouterLink>`, etc. **ONLY FOR INTERNAL USAGE**.
|
|
2330
|
+
*
|
|
2331
|
+
* - `$router` - the router instance
|
|
2332
|
+
* - `$route` - the current route location
|
|
2333
|
+
* - `beforeRouteEnter` - Page component option
|
|
2334
|
+
* - `beforeRouteUpdate` - Page component option
|
|
2335
|
+
* - `beforeRouteLeave` - Page component option
|
|
2336
|
+
* - `RouterLink` - RouterLink Component
|
|
2337
|
+
* - `RouterView` - RouterView Component
|
|
2338
|
+
*
|
|
2339
|
+
* @internal
|
|
2340
|
+
*/
|
|
2341
|
+
interface TypesConfig {}
|
|
2342
|
+
//#endregion
|
|
2343
|
+
//#region src/typed-routes/route-map.d.ts
|
|
2344
|
+
/**
|
|
2345
|
+
* Helper type to define a Typed `RouteRecord`
|
|
2346
|
+
* @see {@link RouteRecord}
|
|
2347
|
+
*/
|
|
2348
|
+
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> {
|
|
2349
|
+
name: Name;
|
|
2350
|
+
path: Path;
|
|
2351
|
+
paramsRaw: ParamsRaw;
|
|
2352
|
+
params: Params$1;
|
|
2353
|
+
childrenNames: ChildrenNames;
|
|
2354
|
+
}
|
|
2355
|
+
type RouteRecordInfoGeneric = RouteRecordInfo<string | symbol, string, RouteParamsRawGeneric, RouteParamsGeneric, string | symbol>;
|
|
2356
|
+
/**
|
|
2357
|
+
* 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.
|
|
2358
|
+
*/
|
|
2359
|
+
type RouteMap = TypesConfig extends Record<'RouteNamedMap', infer RouteNamedMap> ? RouteNamedMap : RouteMapGeneric;
|
|
2360
|
+
/**
|
|
2361
|
+
* Generic version of the `RouteMap`.
|
|
2362
|
+
*/
|
|
2363
|
+
type RouteMapGeneric = Record<string | symbol, RouteRecordInfoGeneric>;
|
|
2364
|
+
//#endregion
|
|
2365
|
+
//#region src/types/utils.d.ts
|
|
2366
|
+
/**
|
|
2367
|
+
* Creates a union type that still allows autocompletion for strings.
|
|
2368
|
+
* @internal
|
|
2369
|
+
*/
|
|
2370
|
+
type _LiteralUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>);
|
|
2371
|
+
/**
|
|
2372
|
+
* Maybe a promise maybe not
|
|
2373
|
+
* @internal
|
|
2374
|
+
*/
|
|
2375
|
+
type _Awaitable<T$1> = T$1 | PromiseLike<T$1>;
|
|
2376
|
+
/**
|
|
2377
|
+
* @internal
|
|
2378
|
+
*/
|
|
2379
|
+
|
|
2380
|
+
//#endregion
|
|
2381
|
+
//#region src/typed-routes/route-records.d.ts
|
|
2382
|
+
/**
|
|
2383
|
+
* @internal
|
|
2384
|
+
*/
|
|
2385
|
+
type RouteRecordRedirectOption = RouteLocationRaw | ((to: RouteLocation, from: RouteLocationNormalizedLoaded) => RouteLocationRaw);
|
|
2386
|
+
/**
|
|
2387
|
+
* Generic version of {@link RouteRecordName}.
|
|
2388
|
+
*/
|
|
2389
|
+
type RouteRecordNameGeneric = string | symbol | undefined;
|
|
2390
|
+
/**
|
|
2391
|
+
* Possible values for a route record **after normalization**
|
|
2392
|
+
*
|
|
2393
|
+
* 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`}
|
|
2394
|
+
*/
|
|
2395
|
+
|
|
2396
|
+
/**
|
|
2397
|
+
* @internal
|
|
2398
|
+
*/
|
|
2399
|
+
type _RouteRecordProps<Name extends keyof RouteMap = keyof RouteMap> = boolean | Record<string, any> | ((to: RouteLocationNormalized<Name>) => Record<string, any>);
|
|
2400
|
+
//#endregion
|
|
2401
|
+
//#region src/typed-routes/route-location.d.ts
|
|
2402
|
+
/**
|
|
2403
|
+
* Generic version of {@link RouteLocation}. It is used when no {@link RouteMap} is provided.
|
|
2404
|
+
*/
|
|
2405
|
+
interface RouteLocationGeneric extends _RouteLocationBase, RouteLocationOptions {
|
|
2406
|
+
/**
|
|
2407
|
+
* Array of {@link RouteRecord} containing components as they were
|
|
2408
|
+
* passed when adding records. It can also contain redirect records. This
|
|
2409
|
+
* can't be used directly. **This property is non-enumerable**.
|
|
2410
|
+
*/
|
|
2411
|
+
matched: RouteRecord[];
|
|
2412
|
+
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Helper to generate a type safe version of the {@link RouteLocation} type.
|
|
2415
|
+
*/
|
|
2416
|
+
interface RouteLocationTyped<RouteMap$1 extends RouteMapGeneric, Name extends keyof RouteMap$1> extends RouteLocationGeneric {
|
|
2417
|
+
name: Extract<Name, string | symbol>;
|
|
2418
|
+
params: RouteMap$1[Name]['params'];
|
|
2419
|
+
}
|
|
2420
|
+
/**
|
|
2421
|
+
* List of all possible {@link RouteLocation} indexed by the route name.
|
|
2422
|
+
* @internal
|
|
2423
|
+
*/
|
|
2424
|
+
type RouteLocationTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationTyped<RouteMap$1, N> };
|
|
2425
|
+
/**
|
|
2426
|
+
* Generic version of {@link RouteLocationNormalized} that is used when no {@link RouteMap} is provided.
|
|
2427
|
+
*/
|
|
2428
|
+
interface RouteLocationNormalizedGeneric extends _RouteLocationBase {
|
|
2429
|
+
name: RouteRecordNameGeneric;
|
|
2430
|
+
/**
|
|
2431
|
+
* Array of {@link RouteRecordNormalized}
|
|
2432
|
+
*/
|
|
2433
|
+
matched: RouteRecordNormalized[];
|
|
2434
|
+
}
|
|
2435
|
+
/**
|
|
2436
|
+
* Helper to generate a type safe version of the {@link RouteLocationNormalized} type.
|
|
2437
|
+
*/
|
|
2438
|
+
interface RouteLocationNormalizedTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationNormalizedGeneric {
|
|
2439
|
+
name: Extract<Name, string | symbol>;
|
|
2440
|
+
params: RouteMap$1[Name]['params'];
|
|
2441
|
+
/**
|
|
2442
|
+
* Array of {@link RouteRecordNormalized}
|
|
2443
|
+
*/
|
|
2444
|
+
matched: RouteRecordNormalized[];
|
|
2445
|
+
}
|
|
2446
|
+
/**
|
|
2447
|
+
* List of all possible {@link RouteLocationNormalized} indexed by the route name.
|
|
2448
|
+
* @internal
|
|
2449
|
+
*/
|
|
2450
|
+
type RouteLocationNormalizedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationNormalizedTyped<RouteMap$1, N> };
|
|
2451
|
+
/**
|
|
2452
|
+
* Generic version of {@link RouteLocationNormalizedLoaded} that is used when no {@link RouteMap} is provided.
|
|
2453
|
+
*/
|
|
2454
|
+
interface RouteLocationNormalizedLoadedGeneric extends RouteLocationNormalizedGeneric {
|
|
2455
|
+
/**
|
|
2456
|
+
* Array of {@link RouteLocationMatched} containing only plain components (any
|
|
2457
|
+
* lazy-loaded components have been loaded and were replaced inside the
|
|
2458
|
+
* `components` object) so it can be directly used to display routes. It
|
|
2459
|
+
* cannot contain redirect records either. **This property is non-enumerable**.
|
|
2460
|
+
*/
|
|
2461
|
+
matched: RouteLocationMatched[];
|
|
2462
|
+
}
|
|
2463
|
+
/**
|
|
2464
|
+
* Helper to generate a type safe version of the {@link RouteLocationNormalizedLoaded} type.
|
|
2465
|
+
*/
|
|
2466
|
+
interface RouteLocationNormalizedLoadedTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationNormalizedLoadedGeneric {
|
|
2467
|
+
name: Extract<Name, string | symbol>;
|
|
2468
|
+
params: RouteMap$1[Name]['params'];
|
|
2469
|
+
}
|
|
2470
|
+
/**
|
|
2471
|
+
* List of all possible {@link RouteLocationNormalizedLoaded} indexed by the route name.
|
|
2472
|
+
* @internal
|
|
2473
|
+
*/
|
|
2474
|
+
type RouteLocationNormalizedLoadedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationNormalizedLoadedTyped<RouteMap$1, N> };
|
|
2475
|
+
/**
|
|
2476
|
+
* Generic version of {@link RouteLocationAsRelative}. It is used when no {@link RouteMap} is provided.
|
|
2477
|
+
*/
|
|
2478
|
+
interface RouteLocationAsRelativeGeneric extends RouteQueryAndHash, RouteLocationOptions {
|
|
2479
|
+
name?: RouteRecordNameGeneric;
|
|
2480
|
+
params?: RouteParamsRawGeneric;
|
|
2481
|
+
/**
|
|
2482
|
+
* A relative path to the current location. This property should be removed
|
|
2483
|
+
*/
|
|
2484
|
+
path?: undefined;
|
|
2485
|
+
}
|
|
2486
|
+
/**
|
|
2487
|
+
* Helper to generate a type safe version of the {@link RouteLocationAsRelative} type.
|
|
2488
|
+
*/
|
|
2489
|
+
interface RouteLocationAsRelativeTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationAsRelativeGeneric {
|
|
2490
|
+
name?: Extract<Name, string | symbol>;
|
|
2491
|
+
params?: RouteMap$1[Name]['paramsRaw'];
|
|
2492
|
+
}
|
|
2493
|
+
/**
|
|
2494
|
+
* List of all possible {@link RouteLocationAsRelative} indexed by the route name.
|
|
2495
|
+
* @internal
|
|
2496
|
+
*/
|
|
2497
|
+
type RouteLocationAsRelativeTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsRelativeTyped<RouteMap$1, N> };
|
|
2498
|
+
/**
|
|
2499
|
+
* Generic version of {@link RouteLocationAsPath}. It is used when no {@link RouteMap} is provided.
|
|
2500
|
+
*/
|
|
2501
|
+
interface RouteLocationAsPathGeneric extends RouteQueryAndHash, RouteLocationOptions {
|
|
2502
|
+
/**
|
|
2503
|
+
* Percentage encoded pathname section of the URL.
|
|
2504
|
+
*/
|
|
2505
|
+
path: string;
|
|
2506
|
+
}
|
|
2507
|
+
/**
|
|
2508
|
+
* Helper to generate a type safe version of the {@link RouteLocationAsPath} type.
|
|
2509
|
+
*/
|
|
2510
|
+
interface RouteLocationAsPathTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationAsPathGeneric {
|
|
2511
|
+
path: _LiteralUnion<RouteMap$1[Name]['path']>;
|
|
2512
|
+
}
|
|
2513
|
+
/**
|
|
2514
|
+
* List of all possible {@link RouteLocationAsPath} indexed by the route name.
|
|
2515
|
+
* @internal
|
|
2516
|
+
*/
|
|
2517
|
+
type RouteLocationAsPathTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsPathTyped<RouteMap$1, N> };
|
|
2518
|
+
/**
|
|
2519
|
+
* Helper to generate a type safe version of the {@link RouteLocationAsString} type.
|
|
2520
|
+
*/
|
|
2521
|
+
type RouteLocationAsStringTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> = RouteMap$1[Name]['path'];
|
|
2522
|
+
/**
|
|
2523
|
+
* List of all possible {@link RouteLocationAsString} indexed by the route name.
|
|
2524
|
+
* @internal
|
|
2525
|
+
*/
|
|
2526
|
+
type RouteLocationAsStringTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsStringTyped<RouteMap$1, N> };
|
|
2527
|
+
/**
|
|
2528
|
+
* Generic version of {@link RouteLocationResolved}. It is used when no {@link RouteMap} is provided.
|
|
2529
|
+
*/
|
|
2530
|
+
interface RouteLocationResolvedGeneric extends RouteLocationGeneric {
|
|
2531
|
+
/**
|
|
2532
|
+
* Resolved `href` for the route location that will be set on the `<a href="...">`.
|
|
2533
|
+
*/
|
|
2534
|
+
href: string;
|
|
2535
|
+
}
|
|
2536
|
+
/**
|
|
2537
|
+
* Helper to generate a type safe version of the {@link RouteLocationResolved} type.
|
|
2538
|
+
*/
|
|
2539
|
+
interface RouteLocationResolvedTyped<RouteMap$1 extends RouteMapGeneric, Name extends keyof RouteMap$1> extends RouteLocationTyped<RouteMap$1, Name> {
|
|
2540
|
+
/**
|
|
2541
|
+
* Resolved `href` for the route location that will be set on the `<a href="...">`.
|
|
2542
|
+
*/
|
|
2543
|
+
href: string;
|
|
2544
|
+
}
|
|
2545
|
+
/**
|
|
2546
|
+
* List of all possible {@link RouteLocationResolved} indexed by the route name.
|
|
2547
|
+
* @internal
|
|
2548
|
+
*/
|
|
2549
|
+
type RouteLocationResolvedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationResolvedTyped<RouteMap$1, N> };
|
|
2550
|
+
/**
|
|
2551
|
+
* 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.
|
|
2552
|
+
*/
|
|
2553
|
+
/**
|
|
2554
|
+
* {@link RouteLocationRaw} resolved using the matcher
|
|
2555
|
+
*/
|
|
2556
|
+
type RouteLocation<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationGeneric : RouteLocationTypedList<RouteMap>[Name];
|
|
2557
|
+
/**
|
|
2558
|
+
* Similar to {@link RouteLocation} but its
|
|
2559
|
+
* {@link RouteLocationNormalizedTyped.matched | `matched` property} cannot contain redirect records
|
|
2560
|
+
*/
|
|
2561
|
+
type RouteLocationNormalized<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedGeneric : RouteLocationNormalizedTypedList<RouteMap>[Name];
|
|
2562
|
+
/**
|
|
2563
|
+
* Similar to {@link RouteLocationNormalized} but its `components` do not contain any function to lazy load components.
|
|
2564
|
+
* In other words, it's ready to be rendered by `<RouterView>`.
|
|
2565
|
+
*/
|
|
2566
|
+
type RouteLocationNormalizedLoaded<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedLoadedGeneric : RouteLocationNormalizedLoadedTypedList<RouteMap>[Name];
|
|
2567
|
+
/**
|
|
2568
|
+
* Route location relative to the current location. It accepts other properties than `path` like `params`, `query` and
|
|
2569
|
+
* `hash` to conveniently change them.
|
|
2570
|
+
*/
|
|
2571
|
+
type RouteLocationAsRelative<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsRelativeGeneric : RouteLocationAsRelativeTypedList<RouteMap>[Name];
|
|
2572
|
+
/**
|
|
2573
|
+
* Route location resolved with {@link Router | `router.resolve()`}.
|
|
2574
|
+
*/
|
|
2575
|
+
type RouteLocationResolved<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationResolvedGeneric : RouteLocationResolvedTypedList<RouteMap>[Name];
|
|
2576
|
+
/**
|
|
2577
|
+
* Same as {@link RouteLocationAsPath} but as a string literal.
|
|
2578
|
+
*/
|
|
2579
|
+
type RouteLocationAsString<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? string : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string>;
|
|
2580
|
+
/**
|
|
2581
|
+
* Route location as an object with a `path` property.
|
|
2582
|
+
*/
|
|
2583
|
+
type RouteLocationAsPath<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsPathGeneric : RouteLocationAsPathTypedList<RouteMap>[Name];
|
|
2584
|
+
/**
|
|
2585
|
+
* Route location that can be passed to `router.push()` and other user-facing APIs.
|
|
2586
|
+
*/
|
|
2587
|
+
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];
|
|
2588
|
+
//#endregion
|
|
2589
|
+
//#region src/typed-routes/navigation-guards.d.ts
|
|
2590
|
+
/**
|
|
2591
|
+
* Return types for a Navigation Guard. Based on `TypesConfig`
|
|
2592
|
+
*
|
|
2593
|
+
* @see {@link TypesConfig}
|
|
2594
|
+
*/
|
|
2595
|
+
type NavigationGuardReturn = void | Error | boolean | RouteLocationRaw;
|
|
2596
|
+
/**
|
|
2597
|
+
* Navigation Guard with a type parameter for `this`.
|
|
2598
|
+
* @see {@link TypesConfig}
|
|
2599
|
+
*/
|
|
2600
|
+
interface NavigationGuardWithThis<T$1> {
|
|
2601
|
+
(this: T$1, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
|
|
2602
|
+
}
|
|
2603
|
+
/**
|
|
2604
|
+
* Navigation Guard.
|
|
2605
|
+
*/
|
|
2606
|
+
interface NavigationGuard {
|
|
2607
|
+
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
|
|
2608
|
+
}
|
|
2609
|
+
/**
|
|
2610
|
+
* Navigation hook triggered after a navigation is settled.
|
|
2611
|
+
*/
|
|
2612
|
+
interface NavigationHookAfter {
|
|
2613
|
+
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, failure?: NavigationFailure | void): unknown;
|
|
2614
|
+
}
|
|
2615
|
+
/**
|
|
2616
|
+
* `next()` callback passed to navigation guards.
|
|
2617
|
+
*/
|
|
2618
|
+
interface NavigationGuardNext {
|
|
2619
|
+
(): void;
|
|
2620
|
+
(error: Error): void;
|
|
2621
|
+
(location: RouteLocationRaw): void;
|
|
2622
|
+
(valid: boolean | undefined): void;
|
|
2623
|
+
(cb: NavigationGuardNextCallback): void;
|
|
2624
|
+
}
|
|
2625
|
+
/**
|
|
2626
|
+
* Callback that can be passed to `next()` in `beforeRouteEnter()` guards.
|
|
2627
|
+
*/
|
|
2628
|
+
type NavigationGuardNextCallback = (vm: ComponentPublicInstance) => unknown;
|
|
2629
|
+
//#endregion
|
|
2630
|
+
//#region src/matcher/types.d.ts
|
|
2631
|
+
/**
|
|
2632
|
+
* Normalized version of a {@link RouteRecord | route record}.
|
|
2633
|
+
*/
|
|
2634
|
+
interface RouteRecordNormalized {
|
|
2635
|
+
/**
|
|
2636
|
+
* {@inheritDoc _RouteRecordBase.path}
|
|
2637
|
+
*/
|
|
2638
|
+
path: _RouteRecordBase['path'];
|
|
2639
|
+
/**
|
|
2640
|
+
* {@inheritDoc _RouteRecordBase.redirect}
|
|
2641
|
+
*/
|
|
2642
|
+
redirect: _RouteRecordBase['redirect'] | undefined;
|
|
2643
|
+
/**
|
|
2644
|
+
* {@inheritDoc _RouteRecordBase.name}
|
|
2645
|
+
*/
|
|
2646
|
+
name: _RouteRecordBase['name'];
|
|
2647
|
+
/**
|
|
2648
|
+
* {@inheritDoc RouteRecordMultipleViews.components}
|
|
2649
|
+
*/
|
|
2650
|
+
components: RouteRecordMultipleViews['components'] | null | undefined;
|
|
2651
|
+
/**
|
|
2652
|
+
* Contains the original modules for lazy loaded components.
|
|
2653
|
+
* @internal
|
|
2654
|
+
*/
|
|
2655
|
+
mods: Record<string, unknown>;
|
|
2656
|
+
/**
|
|
2657
|
+
* Nested route records.
|
|
2658
|
+
*/
|
|
2659
|
+
children: RouteRecordRaw[];
|
|
2660
|
+
/**
|
|
2661
|
+
* {@inheritDoc _RouteRecordBase.meta}
|
|
2662
|
+
*/
|
|
2663
|
+
meta: Exclude<_RouteRecordBase['meta'], void>;
|
|
2664
|
+
/**
|
|
2665
|
+
* {@inheritDoc RouteRecordMultipleViews.props}
|
|
2666
|
+
*/
|
|
2667
|
+
props: Record<string, _RouteRecordProps>;
|
|
2668
|
+
/**
|
|
2669
|
+
* Registered beforeEnter guards
|
|
2670
|
+
*/
|
|
2671
|
+
beforeEnter: _RouteRecordBase['beforeEnter'];
|
|
2672
|
+
/**
|
|
2673
|
+
* Registered leave guards
|
|
2674
|
+
*
|
|
2675
|
+
* @internal
|
|
2676
|
+
*/
|
|
2677
|
+
leaveGuards: Set<NavigationGuard>;
|
|
2678
|
+
/**
|
|
2679
|
+
* Registered update guards
|
|
2680
|
+
*
|
|
2681
|
+
* @internal
|
|
2682
|
+
*/
|
|
2683
|
+
updateGuards: Set<NavigationGuard>;
|
|
2684
|
+
/**
|
|
2685
|
+
* Registered beforeRouteEnter callbacks passed to `next` or returned in guards
|
|
2686
|
+
*
|
|
2687
|
+
* @internal
|
|
2688
|
+
*/
|
|
2689
|
+
enterCallbacks: Record<string, NavigationGuardNextCallback[]>;
|
|
2690
|
+
/**
|
|
2691
|
+
* Mounted route component instances
|
|
2692
|
+
* Having the instances on the record mean beforeRouteUpdate and
|
|
2693
|
+
* beforeRouteLeave guards can only be invoked with the latest mounted app
|
|
2694
|
+
* instance if there are multiple application instances rendering the same
|
|
2695
|
+
* view, basically duplicating the content on the page, which shouldn't happen
|
|
2696
|
+
* in practice. It will work if multiple apps are rendering different named
|
|
2697
|
+
* views.
|
|
2698
|
+
*/
|
|
2699
|
+
instances: Record<string, ComponentPublicInstance | undefined | null>;
|
|
2700
|
+
/**
|
|
2701
|
+
* Defines if this record is the alias of another one. This property is
|
|
2702
|
+
* `undefined` if the record is the original one.
|
|
2703
|
+
*/
|
|
2704
|
+
aliasOf: RouteRecordNormalized | undefined;
|
|
2705
|
+
}
|
|
2706
|
+
/**
|
|
2707
|
+
* {@inheritDoc RouteRecordNormalized}
|
|
2708
|
+
*/
|
|
2709
|
+
type RouteRecord = RouteRecordNormalized;
|
|
2710
|
+
//#endregion
|
|
2711
|
+
//#region src/matcher/pathParserRanker.d.ts
|
|
2712
|
+
|
|
2713
|
+
/**
|
|
2714
|
+
* @internal
|
|
2715
|
+
*/
|
|
2716
|
+
interface _PathParserOptions {
|
|
2717
|
+
/**
|
|
2718
|
+
* Makes the RegExp case-sensitive.
|
|
2719
|
+
*
|
|
2720
|
+
* @defaultValue `false`
|
|
2721
|
+
*/
|
|
2722
|
+
sensitive?: boolean;
|
|
2723
|
+
/**
|
|
2724
|
+
* Whether to disallow a trailing slash or not.
|
|
2725
|
+
*
|
|
2726
|
+
* @defaultValue `false`
|
|
2727
|
+
*/
|
|
2728
|
+
strict?: boolean;
|
|
2729
|
+
/**
|
|
2730
|
+
* Should the RegExp match from the beginning by prepending a `^` to it.
|
|
2731
|
+
* @internal
|
|
2732
|
+
*
|
|
2733
|
+
* @defaultValue `true`
|
|
2734
|
+
*/
|
|
2735
|
+
start?: boolean;
|
|
2736
|
+
/**
|
|
2737
|
+
* Should the RegExp match until the end by appending a `$` to it.
|
|
2738
|
+
*
|
|
2739
|
+
* @deprecated this option will alsways be `true` in the future. Open a discussion in vuejs/router if you need this to be `false`
|
|
2740
|
+
*
|
|
2741
|
+
* @defaultValue `true`
|
|
2742
|
+
*/
|
|
2743
|
+
end?: boolean;
|
|
2744
|
+
}
|
|
2745
|
+
type PathParserOptions = Pick<_PathParserOptions, 'end' | 'sensitive' | 'strict'>;
|
|
2746
|
+
//#endregion
|
|
2747
|
+
//#region src/matcher/pathMatcher.d.ts
|
|
2748
|
+
|
|
2749
|
+
//#endregion
|
|
2750
|
+
//#region src/history/common.d.ts
|
|
2751
|
+
type HistoryLocation = string;
|
|
2752
|
+
/**
|
|
2753
|
+
* Allowed variables in HTML5 history state. Note that pushState clones the state
|
|
2754
|
+
* passed and does not accept everything: e.g.: it doesn't accept symbols, nor
|
|
2755
|
+
* functions as values. It also ignores Symbols as keys.
|
|
2756
|
+
*
|
|
2757
|
+
* @internal
|
|
2758
|
+
*/
|
|
2759
|
+
type HistoryStateValue = string | number | boolean | null | undefined | HistoryState | HistoryStateArray;
|
|
2760
|
+
/**
|
|
2761
|
+
* Allowed HTML history.state
|
|
2762
|
+
*/
|
|
2763
|
+
interface HistoryState {
|
|
2764
|
+
[x: number]: HistoryStateValue;
|
|
2765
|
+
[x: string]: HistoryStateValue;
|
|
2766
|
+
}
|
|
2767
|
+
/**
|
|
2768
|
+
* Allowed arrays for history.state.
|
|
2769
|
+
*
|
|
2770
|
+
* @internal
|
|
2771
|
+
*/
|
|
2772
|
+
interface HistoryStateArray extends Array<HistoryStateValue> {}
|
|
2773
|
+
declare enum NavigationType {
|
|
2774
|
+
pop = "pop",
|
|
2775
|
+
push = "push",
|
|
2776
|
+
}
|
|
2777
|
+
declare enum NavigationDirection {
|
|
2778
|
+
back = "back",
|
|
2779
|
+
forward = "forward",
|
|
2780
|
+
unknown = "",
|
|
2781
|
+
}
|
|
2782
|
+
interface NavigationInformation {
|
|
2783
|
+
type: NavigationType;
|
|
2784
|
+
direction: NavigationDirection;
|
|
2785
|
+
delta: number;
|
|
2786
|
+
}
|
|
2787
|
+
interface NavigationCallback {
|
|
2788
|
+
(to: HistoryLocation, from: HistoryLocation, information: NavigationInformation): void;
|
|
2789
|
+
}
|
|
2790
|
+
/**
|
|
2791
|
+
* Interface implemented by History implementations that can be passed to the
|
|
2792
|
+
* router as {@link Router.history}
|
|
2793
|
+
*
|
|
2794
|
+
* @alpha
|
|
2795
|
+
*/
|
|
2796
|
+
interface RouterHistory {
|
|
2797
|
+
/**
|
|
2798
|
+
* Base path that is prepended to every url. This allows hosting an SPA at a
|
|
2799
|
+
* sub-folder of a domain like `example.com/sub-folder` by having a `base` of
|
|
2800
|
+
* `/sub-folder`
|
|
2801
|
+
*/
|
|
2802
|
+
readonly base: string;
|
|
2803
|
+
/**
|
|
2804
|
+
* Current History location
|
|
2805
|
+
*/
|
|
2806
|
+
readonly location: HistoryLocation;
|
|
2807
|
+
/**
|
|
2808
|
+
* Current History state
|
|
2809
|
+
*/
|
|
2810
|
+
readonly state: HistoryState;
|
|
2811
|
+
/**
|
|
2812
|
+
* Navigates to a location. In the case of an HTML5 History implementation,
|
|
2813
|
+
* this will call `history.pushState` to effectively change the URL.
|
|
2814
|
+
*
|
|
2815
|
+
* @param to - location to push
|
|
2816
|
+
* @param data - optional {@link HistoryState} to be associated with the
|
|
2817
|
+
* navigation entry
|
|
2818
|
+
*/
|
|
2819
|
+
push(to: HistoryLocation, data?: HistoryState): void;
|
|
2820
|
+
/**
|
|
2821
|
+
* Same as {@link RouterHistory.push} but performs a `history.replaceState`
|
|
2822
|
+
* instead of `history.pushState`
|
|
2823
|
+
*
|
|
2824
|
+
* @param to - location to set
|
|
2825
|
+
* @param data - optional {@link HistoryState} to be associated with the
|
|
2826
|
+
* navigation entry
|
|
2827
|
+
*/
|
|
2828
|
+
replace(to: HistoryLocation, data?: HistoryState): void;
|
|
2829
|
+
/**
|
|
2830
|
+
* Traverses history in a given direction.
|
|
2831
|
+
*
|
|
2832
|
+
* @example
|
|
2833
|
+
* ```js
|
|
2834
|
+
* myHistory.go(-1) // equivalent to window.history.back()
|
|
2835
|
+
* myHistory.go(1) // equivalent to window.history.forward()
|
|
2836
|
+
* ```
|
|
2837
|
+
*
|
|
2838
|
+
* @param delta - distance to travel. If delta is \< 0, it will go back,
|
|
2839
|
+
* if it's \> 0, it will go forward by that amount of entries.
|
|
2840
|
+
* @param triggerListeners - whether this should trigger listeners attached to
|
|
2841
|
+
* the history
|
|
2842
|
+
*/
|
|
2843
|
+
go(delta: number, triggerListeners?: boolean): void;
|
|
2844
|
+
/**
|
|
2845
|
+
* Attach a listener to the History implementation that is triggered when the
|
|
2846
|
+
* navigation is triggered from outside (like the Browser back and forward
|
|
2847
|
+
* buttons) or when passing `true` to {@link RouterHistory.back} and
|
|
2848
|
+
* {@link RouterHistory.forward}
|
|
2849
|
+
*
|
|
2850
|
+
* @param callback - listener to attach
|
|
2851
|
+
* @returns a callback to remove the listener
|
|
2852
|
+
*/
|
|
2853
|
+
listen(callback: NavigationCallback): () => void;
|
|
2854
|
+
/**
|
|
2855
|
+
* Generates the corresponding href to be used in an anchor tag.
|
|
2856
|
+
*
|
|
2857
|
+
* @param location - history location that should create an href
|
|
2858
|
+
*/
|
|
2859
|
+
createHref(location: HistoryLocation): string;
|
|
2860
|
+
/**
|
|
2861
|
+
* Clears any event listener attached by the history implementation.
|
|
2862
|
+
*/
|
|
2863
|
+
destroy(): void;
|
|
2864
|
+
}
|
|
2865
|
+
//#endregion
|
|
2866
|
+
//#region src/types/index.d.ts
|
|
2867
|
+
type Lazy<T$1> = () => Promise<T$1>;
|
|
2868
|
+
/**
|
|
2869
|
+
* @internal
|
|
2870
|
+
*/
|
|
2871
|
+
type RouteParamValue = string;
|
|
2872
|
+
/**
|
|
2873
|
+
* @internal
|
|
2874
|
+
*/
|
|
2875
|
+
type RouteParamValueRaw = RouteParamValue | number | null | undefined;
|
|
2876
|
+
type RouteParamsGeneric = Record<string, RouteParamValue | RouteParamValue[]>;
|
|
2877
|
+
type RouteParamsRawGeneric = Record<string, RouteParamValueRaw | Exclude<RouteParamValueRaw, null | undefined>[]>;
|
|
2878
|
+
/**
|
|
2879
|
+
* @internal
|
|
2880
|
+
*/
|
|
2881
|
+
interface RouteQueryAndHash {
|
|
2882
|
+
query?: LocationQueryRaw;
|
|
2883
|
+
hash?: string;
|
|
2884
|
+
}
|
|
2885
|
+
/**
|
|
2886
|
+
* @internal
|
|
2887
|
+
*/
|
|
2888
|
+
|
|
2889
|
+
/**
|
|
2890
|
+
* Common options for all navigation methods.
|
|
2891
|
+
*/
|
|
2892
|
+
interface RouteLocationOptions {
|
|
2893
|
+
/**
|
|
2894
|
+
* Replace the entry in the history instead of pushing a new entry
|
|
2895
|
+
*/
|
|
2896
|
+
replace?: boolean;
|
|
2897
|
+
/**
|
|
2898
|
+
* Triggers the navigation even if the location is the same as the current one.
|
|
2899
|
+
* Note this will also add a new entry to the history unless `replace: true`
|
|
2900
|
+
* is passed.
|
|
2901
|
+
*/
|
|
2902
|
+
force?: boolean;
|
|
2903
|
+
/**
|
|
2904
|
+
* State to save using the History API. This cannot contain any reactive
|
|
2905
|
+
* values and some primitives like Symbols are forbidden. More info at
|
|
2906
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/History/state
|
|
2907
|
+
*/
|
|
2908
|
+
state?: HistoryState;
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Route Location that can infer the necessary params based on the name.
|
|
2912
|
+
*
|
|
2913
|
+
* @internal
|
|
2914
|
+
*/
|
|
2915
|
+
|
|
2916
|
+
interface RouteLocationMatched extends RouteRecordNormalized {
|
|
2917
|
+
components: Record<string, RouteComponent> | null | undefined;
|
|
2918
|
+
}
|
|
2919
|
+
/**
|
|
2920
|
+
* Base properties for a normalized route location.
|
|
2921
|
+
*
|
|
2922
|
+
* @internal
|
|
2923
|
+
*/
|
|
2924
|
+
interface _RouteLocationBase extends Pick<MatcherLocation, 'name' | 'path' | 'params' | 'meta'> {
|
|
2925
|
+
/**
|
|
2926
|
+
* The whole location including the `search` and `hash`. This string is
|
|
2927
|
+
* percentage encoded.
|
|
2928
|
+
*/
|
|
2929
|
+
fullPath: string;
|
|
2930
|
+
/**
|
|
2931
|
+
* Object representation of the `search` property of the current location.
|
|
2932
|
+
*/
|
|
2933
|
+
query: LocationQuery;
|
|
2934
|
+
/**
|
|
2935
|
+
* Hash of the current location. If present, starts with a `#`.
|
|
2936
|
+
*/
|
|
2937
|
+
hash: string;
|
|
2938
|
+
/**
|
|
2939
|
+
* Contains the location we were initially trying to access before ending up
|
|
2940
|
+
* on the current location.
|
|
2941
|
+
*/
|
|
2942
|
+
redirectedFrom: RouteLocation | undefined;
|
|
2943
|
+
}
|
|
2944
|
+
/**
|
|
2945
|
+
* Allowed Component in {@link RouteLocationMatched}
|
|
2946
|
+
*/
|
|
2947
|
+
type RouteComponent = Component$1 | DefineComponent;
|
|
2948
|
+
/**
|
|
2949
|
+
* Allowed Component definitions in route records provided by the user
|
|
2950
|
+
*/
|
|
2951
|
+
type RawRouteComponent = RouteComponent | Lazy<RouteComponent>;
|
|
2952
|
+
/**
|
|
2953
|
+
* Internal type for common properties among all kind of {@link RouteRecordRaw}.
|
|
2954
|
+
*/
|
|
2955
|
+
interface _RouteRecordBase extends PathParserOptions {
|
|
2956
|
+
/**
|
|
2957
|
+
* Path of the record. Should start with `/` unless the record is the child of
|
|
2958
|
+
* another record.
|
|
2959
|
+
*
|
|
2960
|
+
* @example `/users/:id` matches `/users/1` as well as `/users/posva`.
|
|
2961
|
+
*/
|
|
2962
|
+
path: string;
|
|
2963
|
+
/**
|
|
2964
|
+
* Where to redirect if the route is directly matched. The redirection happens
|
|
2965
|
+
* before any navigation guard and triggers a new navigation with the new
|
|
2966
|
+
* target location.
|
|
2967
|
+
*/
|
|
2968
|
+
redirect?: RouteRecordRedirectOption;
|
|
2969
|
+
/**
|
|
2970
|
+
* Aliases for the record. Allows defining extra paths that will behave like a
|
|
2971
|
+
* copy of the record. Allows having paths shorthands like `/users/:id` and
|
|
2972
|
+
* `/u/:id`. All `alias` and `path` values must share the same params.
|
|
2973
|
+
*/
|
|
2974
|
+
alias?: string | string[];
|
|
2975
|
+
/**
|
|
2976
|
+
* Name for the route record. Must be unique.
|
|
2977
|
+
*/
|
|
2978
|
+
name?: RouteRecordNameGeneric;
|
|
2979
|
+
/**
|
|
2980
|
+
* Before Enter guard specific to this record. Note `beforeEnter` has no
|
|
2981
|
+
* effect if the record has a `redirect` property.
|
|
2982
|
+
*/
|
|
2983
|
+
beforeEnter?: NavigationGuardWithThis<undefined> | NavigationGuardWithThis<undefined>[];
|
|
2984
|
+
/**
|
|
2985
|
+
* Arbitrary data attached to the record.
|
|
2986
|
+
*/
|
|
2987
|
+
meta?: RouteMeta;
|
|
2988
|
+
/**
|
|
2989
|
+
* Array of nested routes.
|
|
2990
|
+
*/
|
|
2991
|
+
children?: RouteRecordRaw[];
|
|
2992
|
+
/**
|
|
2993
|
+
* Allow passing down params as props to the component rendered by `router-view`.
|
|
2994
|
+
*/
|
|
2995
|
+
props?: _RouteRecordProps | Record<string, _RouteRecordProps>;
|
|
2996
|
+
}
|
|
2997
|
+
/**
|
|
2998
|
+
* Interface to type `meta` fields in route records.
|
|
2999
|
+
*
|
|
3000
|
+
* @example
|
|
3001
|
+
*
|
|
3002
|
+
* ```ts
|
|
3003
|
+
* // typings.d.ts or router.ts
|
|
3004
|
+
* import 'vue-router';
|
|
3005
|
+
*
|
|
3006
|
+
* declare module 'vue-router' {
|
|
3007
|
+
* interface RouteMeta {
|
|
3008
|
+
* requiresAuth?: boolean
|
|
3009
|
+
* }
|
|
3010
|
+
* }
|
|
3011
|
+
* ```
|
|
3012
|
+
*/
|
|
3013
|
+
interface RouteMeta extends Record<PropertyKey, unknown> {}
|
|
3014
|
+
/**
|
|
3015
|
+
* Route Record defining one single component with the `component` option.
|
|
3016
|
+
*/
|
|
3017
|
+
interface RouteRecordSingleView extends _RouteRecordBase {
|
|
3018
|
+
/**
|
|
3019
|
+
* Component to display when the URL matches this route.
|
|
3020
|
+
*/
|
|
3021
|
+
component: RawRouteComponent;
|
|
3022
|
+
components?: never;
|
|
3023
|
+
children?: never;
|
|
3024
|
+
redirect?: never;
|
|
3025
|
+
/**
|
|
3026
|
+
* Allow passing down params as props to the component rendered by `router-view`.
|
|
3027
|
+
*/
|
|
3028
|
+
props?: _RouteRecordProps;
|
|
3029
|
+
}
|
|
3030
|
+
/**
|
|
3031
|
+
* Route Record defining one single component with a nested view. Differently
|
|
3032
|
+
* from {@link RouteRecordSingleView}, this record has children and allows a
|
|
3033
|
+
* `redirect` option.
|
|
3034
|
+
*/
|
|
3035
|
+
interface RouteRecordSingleViewWithChildren extends _RouteRecordBase {
|
|
3036
|
+
/**
|
|
3037
|
+
* Component to display when the URL matches this route.
|
|
3038
|
+
*/
|
|
3039
|
+
component?: RawRouteComponent | null | undefined;
|
|
3040
|
+
components?: never;
|
|
3041
|
+
children: RouteRecordRaw[];
|
|
3042
|
+
/**
|
|
3043
|
+
* Allow passing down params as props to the component rendered by `router-view`.
|
|
3044
|
+
*/
|
|
3045
|
+
props?: _RouteRecordProps;
|
|
3046
|
+
}
|
|
3047
|
+
/**
|
|
3048
|
+
* Route Record defining multiple named components with the `components` option.
|
|
3049
|
+
*/
|
|
3050
|
+
interface RouteRecordMultipleViews extends _RouteRecordBase {
|
|
3051
|
+
/**
|
|
3052
|
+
* Components to display when the URL matches this route. Allow using named views.
|
|
3053
|
+
*/
|
|
3054
|
+
components: Record<string, RawRouteComponent>;
|
|
3055
|
+
component?: never;
|
|
3056
|
+
children?: never;
|
|
3057
|
+
redirect?: never;
|
|
3058
|
+
/**
|
|
3059
|
+
* Allow passing down params as props to the component rendered by
|
|
3060
|
+
* `router-view`. Should be an object with the same keys as `components` or a
|
|
3061
|
+
* boolean to be applied to every component.
|
|
3062
|
+
*/
|
|
3063
|
+
props?: Record<string, _RouteRecordProps> | boolean;
|
|
3064
|
+
}
|
|
3065
|
+
/**
|
|
3066
|
+
* Route Record defining multiple named components with the `components` option and children.
|
|
3067
|
+
*/
|
|
3068
|
+
interface RouteRecordMultipleViewsWithChildren extends _RouteRecordBase {
|
|
3069
|
+
/**
|
|
3070
|
+
* Components to display when the URL matches this route. Allow using named views.
|
|
3071
|
+
*/
|
|
3072
|
+
components?: Record<string, RawRouteComponent> | null | undefined;
|
|
3073
|
+
component?: never;
|
|
3074
|
+
children: RouteRecordRaw[];
|
|
3075
|
+
/**
|
|
3076
|
+
* Allow passing down params as props to the component rendered by
|
|
3077
|
+
* `router-view`. Should be an object with the same keys as `components` or a
|
|
3078
|
+
* boolean to be applied to every component.
|
|
3079
|
+
*/
|
|
3080
|
+
props?: Record<string, _RouteRecordProps> | boolean;
|
|
3081
|
+
}
|
|
3082
|
+
/**
|
|
3083
|
+
* Route Record that defines a redirect. Cannot have `component` or `components`
|
|
3084
|
+
* as it is never rendered.
|
|
3085
|
+
*/
|
|
3086
|
+
interface RouteRecordRedirect extends _RouteRecordBase {
|
|
3087
|
+
redirect: RouteRecordRedirectOption;
|
|
3088
|
+
component?: never;
|
|
3089
|
+
components?: never;
|
|
3090
|
+
props?: never;
|
|
3091
|
+
}
|
|
3092
|
+
type RouteRecordRaw = RouteRecordSingleView | RouteRecordSingleViewWithChildren | RouteRecordMultipleViews | RouteRecordMultipleViewsWithChildren | RouteRecordRedirect;
|
|
3093
|
+
/**
|
|
3094
|
+
* Route location that can be passed to the matcher.
|
|
3095
|
+
*/
|
|
3096
|
+
|
|
3097
|
+
/**
|
|
3098
|
+
* Normalized/resolved Route location that returned by the matcher.
|
|
3099
|
+
*/
|
|
3100
|
+
interface MatcherLocation {
|
|
3101
|
+
/**
|
|
3102
|
+
* Name of the matched record
|
|
3103
|
+
*/
|
|
3104
|
+
name: RouteRecordNameGeneric | null | undefined;
|
|
3105
|
+
/**
|
|
3106
|
+
* Percentage encoded pathname section of the URL.
|
|
3107
|
+
*/
|
|
3108
|
+
path: string;
|
|
3109
|
+
/**
|
|
3110
|
+
* Object of decoded params extracted from the `path`.
|
|
3111
|
+
*/
|
|
3112
|
+
params: RouteParamsGeneric;
|
|
3113
|
+
/**
|
|
3114
|
+
* Merged `meta` properties from all the matched route records.
|
|
3115
|
+
*/
|
|
3116
|
+
meta: RouteMeta;
|
|
3117
|
+
/**
|
|
3118
|
+
* Array of {@link RouteRecord} containing components as they were
|
|
3119
|
+
* passed when adding records. It can also contain redirect records. This
|
|
3120
|
+
* can't be used directly
|
|
3121
|
+
*/
|
|
3122
|
+
matched: RouteRecord[];
|
|
3123
|
+
}
|
|
3124
|
+
//#endregion
|
|
3125
|
+
//#region src/errors.d.ts
|
|
3126
|
+
/**
|
|
3127
|
+
* Flags so we can combine them when checking for multiple errors. This is the internal version of
|
|
3128
|
+
* {@link NavigationFailureType}.
|
|
3129
|
+
*
|
|
3130
|
+
* @internal
|
|
3131
|
+
*/
|
|
3132
|
+
declare const enum ErrorTypes {
|
|
3133
|
+
MATCHER_NOT_FOUND = 1,
|
|
3134
|
+
NAVIGATION_GUARD_REDIRECT = 2,
|
|
3135
|
+
NAVIGATION_ABORTED = 4,
|
|
3136
|
+
NAVIGATION_CANCELLED = 8,
|
|
3137
|
+
NAVIGATION_DUPLICATED = 16,
|
|
3138
|
+
}
|
|
3139
|
+
/**
|
|
3140
|
+
* Enumeration with all possible types for navigation failures. Can be passed to
|
|
3141
|
+
* {@link isNavigationFailure} to check for specific failures.
|
|
3142
|
+
*/
|
|
3143
|
+
|
|
3144
|
+
/**
|
|
3145
|
+
* Extended Error that contains extra information regarding a failed navigation.
|
|
3146
|
+
*/
|
|
3147
|
+
interface NavigationFailure extends Error {
|
|
3148
|
+
/**
|
|
3149
|
+
* Type of the navigation. One of {@link NavigationFailureType}
|
|
3150
|
+
*/
|
|
3151
|
+
type: ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED;
|
|
3152
|
+
/**
|
|
3153
|
+
* Route location we were navigating from
|
|
3154
|
+
*/
|
|
3155
|
+
from: RouteLocationNormalized;
|
|
3156
|
+
/**
|
|
3157
|
+
* Route location we were navigating to
|
|
3158
|
+
*/
|
|
3159
|
+
to: RouteLocationNormalized;
|
|
3160
|
+
}
|
|
3161
|
+
/**
|
|
3162
|
+
* Internal error used to detect a redirection.
|
|
3163
|
+
*
|
|
3164
|
+
* @internal
|
|
3165
|
+
*/
|
|
3166
|
+
|
|
3167
|
+
/**
|
|
3168
|
+
* Internal type to define an ErrorHandler
|
|
3169
|
+
*
|
|
3170
|
+
* @param error - error thrown
|
|
3171
|
+
* @param to - location we were navigating to when the error happened
|
|
3172
|
+
* @param from - location we were navigating from when the error happened
|
|
3173
|
+
* @internal
|
|
3174
|
+
*/
|
|
3175
|
+
interface _ErrorListener {
|
|
3176
|
+
(error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;
|
|
3177
|
+
}
|
|
3178
|
+
//#endregion
|
|
3179
|
+
//#region src/scrollBehavior.d.ts
|
|
3180
|
+
/**
|
|
3181
|
+
* Scroll position similar to
|
|
3182
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions | `ScrollToOptions`}.
|
|
3183
|
+
* Note that not all browsers support `behavior`.
|
|
3184
|
+
*/
|
|
3185
|
+
type ScrollPositionCoordinates = {
|
|
3186
|
+
behavior?: ScrollOptions['behavior'];
|
|
3187
|
+
left?: number;
|
|
3188
|
+
top?: number;
|
|
3189
|
+
};
|
|
3190
|
+
/**
|
|
3191
|
+
* Internal normalized version of {@link ScrollPositionCoordinates} that always
|
|
3192
|
+
* has `left` and `top` coordinates. Must be a type to be assignable to HistoryStateValue.
|
|
3193
|
+
*
|
|
3194
|
+
* @internal
|
|
3195
|
+
*/
|
|
3196
|
+
type _ScrollPositionNormalized = {
|
|
3197
|
+
behavior?: ScrollOptions['behavior'];
|
|
3198
|
+
left: number;
|
|
3199
|
+
top: number;
|
|
3200
|
+
};
|
|
3201
|
+
/**
|
|
3202
|
+
* Type of the `scrollBehavior` option that can be passed to `createRouter`.
|
|
3203
|
+
*/
|
|
3204
|
+
interface RouterScrollBehavior {
|
|
3205
|
+
/**
|
|
3206
|
+
* @param to - Route location where we are navigating to
|
|
3207
|
+
* @param from - Route location where we are navigating from
|
|
3208
|
+
* @param savedPosition - saved position if it exists, `null` otherwise
|
|
3209
|
+
*/
|
|
3210
|
+
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, savedPosition: _ScrollPositionNormalized | null): Awaitable<ScrollPosition | false | void>;
|
|
3211
|
+
}
|
|
3212
|
+
interface ScrollPositionElement extends ScrollToOptions {
|
|
3213
|
+
/**
|
|
3214
|
+
* A valid CSS selector. Note some characters must be escaped in id selectors (https://mathiasbynens.be/notes/css-escapes).
|
|
3215
|
+
* @example
|
|
3216
|
+
* Here are a few examples:
|
|
3217
|
+
*
|
|
3218
|
+
* - `.title`
|
|
3219
|
+
* - `.content:first-child`
|
|
3220
|
+
* - `#marker`
|
|
3221
|
+
* - `#marker\~with\~symbols`
|
|
3222
|
+
* - `#marker.with.dot`: selects `class="with dot" id="marker"`, not `id="marker.with.dot"`
|
|
3223
|
+
*
|
|
3224
|
+
*/
|
|
3225
|
+
el: string | Element;
|
|
3226
|
+
}
|
|
3227
|
+
type ScrollPosition = ScrollPositionCoordinates | ScrollPositionElement;
|
|
3228
|
+
type Awaitable<T$1> = T$1 | PromiseLike<T$1>;
|
|
3229
|
+
//#endregion
|
|
3230
|
+
//#region src/experimental/route-resolver/matchers/param-parsers/types.d.ts
|
|
3231
|
+
/**
|
|
3232
|
+
* Defines a parser that can read a param from the url (string-based) and
|
|
3233
|
+
* transform it into a more complex type, or vice versa.
|
|
3234
|
+
*
|
|
3235
|
+
* @see MatcherPattern
|
|
3236
|
+
*/
|
|
3237
|
+
|
|
3238
|
+
//#endregion
|
|
3239
|
+
//#region src/experimental/router.d.ts
|
|
3240
|
+
/**
|
|
3241
|
+
* Options to initialize a {@link Router} instance.
|
|
3242
|
+
*/
|
|
3243
|
+
interface EXPERIMENTAL_RouterOptions_Base extends PathParserOptions {
|
|
3244
|
+
/**
|
|
3245
|
+
* History implementation used by the router. Most web applications should use
|
|
3246
|
+
* `createWebHistory` but it requires the server to be properly configured.
|
|
3247
|
+
* You can also use a _hash_ based history with `createWebHashHistory` that
|
|
3248
|
+
* does not require any configuration on the server but isn't handled at all
|
|
3249
|
+
* by search engines and does poorly on SEO.
|
|
3250
|
+
*
|
|
3251
|
+
* @example
|
|
3252
|
+
* ```js
|
|
3253
|
+
* createRouter({
|
|
3254
|
+
* history: createWebHistory(),
|
|
3255
|
+
* // other options...
|
|
3256
|
+
* })
|
|
3257
|
+
* ```
|
|
3258
|
+
*/
|
|
3259
|
+
history: RouterHistory;
|
|
3260
|
+
/**
|
|
3261
|
+
* Function to control scrolling when navigating between pages. Can return a
|
|
3262
|
+
* Promise to delay scrolling.
|
|
3263
|
+
*
|
|
3264
|
+
* @see {@link RouterScrollBehavior}.
|
|
3265
|
+
*
|
|
3266
|
+
* @example
|
|
3267
|
+
* ```js
|
|
3268
|
+
* function scrollBehavior(to, from, savedPosition) {
|
|
3269
|
+
* // `to` and `from` are both route locations
|
|
3270
|
+
* // `savedPosition` can be null if there isn't one
|
|
3271
|
+
* }
|
|
3272
|
+
* ```
|
|
3273
|
+
*/
|
|
3274
|
+
scrollBehavior?: RouterScrollBehavior;
|
|
3275
|
+
/**
|
|
3276
|
+
* Custom implementation to parse a query. See its counterpart,
|
|
3277
|
+
* {@link EXPERIMENTAL_RouterOptions_Base.stringifyQuery}.
|
|
3278
|
+
*
|
|
3279
|
+
* @example
|
|
3280
|
+
* Let's say you want to use the [qs package](https://github.com/ljharb/qs)
|
|
3281
|
+
* to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
|
|
3282
|
+
* ```js
|
|
3283
|
+
* import qs from 'qs'
|
|
3284
|
+
*
|
|
3285
|
+
* createRouter({
|
|
3286
|
+
* // other options...
|
|
3287
|
+
* parseQuery: qs.parse,
|
|
3288
|
+
* stringifyQuery: qs.stringify,
|
|
3289
|
+
* })
|
|
3290
|
+
* ```
|
|
3291
|
+
*/
|
|
3292
|
+
parseQuery?: typeof parseQuery;
|
|
3293
|
+
/**
|
|
3294
|
+
* Custom implementation to stringify a query object. Should not prepend a leading `?`.
|
|
3295
|
+
* {@link parseQuery} counterpart to handle query parsing.
|
|
3296
|
+
*/
|
|
3297
|
+
stringifyQuery?: typeof stringifyQuery;
|
|
3298
|
+
/**
|
|
3299
|
+
* Default class applied to active {@link RouterLink}. If none is provided,
|
|
3300
|
+
* `router-link-active` will be applied.
|
|
3301
|
+
*/
|
|
3302
|
+
linkActiveClass?: string;
|
|
3303
|
+
/**
|
|
3304
|
+
* Default class applied to exact active {@link RouterLink}. If none is provided,
|
|
3305
|
+
* `router-link-exact-active` will be applied.
|
|
3306
|
+
*/
|
|
3307
|
+
linkExactActiveClass?: string;
|
|
3308
|
+
}
|
|
3309
|
+
/**
|
|
3310
|
+
* Internal type for common properties among all kind of {@link RouteRecordRaw}.
|
|
3311
|
+
*/
|
|
3312
|
+
|
|
3313
|
+
/**
|
|
3314
|
+
* Router base instance.
|
|
3315
|
+
*
|
|
3316
|
+
* @experimental This version is not stable, it's meant to replace {@link Router} in the future.
|
|
3317
|
+
*/
|
|
3318
|
+
interface EXPERIMENTAL_Router_Base<TRecord> {
|
|
3319
|
+
/**
|
|
3320
|
+
* Current {@link RouteLocationNormalized}
|
|
3321
|
+
*/
|
|
3322
|
+
readonly currentRoute: ShallowRef<RouteLocationNormalizedLoaded>;
|
|
3323
|
+
/**
|
|
3324
|
+
* Allows turning off the listening of history events. This is a low level api for micro-frontend.
|
|
3325
|
+
*/
|
|
3326
|
+
listening: boolean;
|
|
3327
|
+
/**
|
|
3328
|
+
* Checks if a route with a given name exists
|
|
3329
|
+
*
|
|
3330
|
+
* @param name - Name of the route to check
|
|
3331
|
+
*/
|
|
3332
|
+
hasRoute(name: NonNullable<RouteRecordNameGeneric>): boolean;
|
|
3333
|
+
/**
|
|
3334
|
+
* Get a full list of all the {@link RouteRecord | route records}.
|
|
3335
|
+
*/
|
|
3336
|
+
getRoutes(): TRecord[];
|
|
3337
|
+
/**
|
|
3338
|
+
* Returns the {@link RouteLocation | normalized version} of a
|
|
3339
|
+
* {@link RouteLocationRaw | route location}. Also includes an `href` property
|
|
3340
|
+
* that includes any existing `base`. By default, the `currentLocation` used is
|
|
3341
|
+
* `router.currentRoute` and should only be overridden in advanced use cases.
|
|
3342
|
+
*
|
|
3343
|
+
* @param to - Raw route location to resolve
|
|
3344
|
+
* @param currentLocation - Optional current location to resolve against
|
|
3345
|
+
*/
|
|
3346
|
+
resolve<Name extends keyof RouteMap = keyof RouteMap>(to: RouteLocationAsRelativeTyped<RouteMap, Name>, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved<Name>;
|
|
3347
|
+
resolve(to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved;
|
|
3348
|
+
/**
|
|
3349
|
+
* Programmatically navigate to a new URL by pushing an entry in the history
|
|
3350
|
+
* stack.
|
|
3351
|
+
*
|
|
3352
|
+
* @param to - Route location to navigate to
|
|
3353
|
+
*/
|
|
3354
|
+
push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
3355
|
+
/**
|
|
3356
|
+
* Programmatically navigate to a new URL by replacing the current entry in
|
|
3357
|
+
* the history stack.
|
|
3358
|
+
*
|
|
3359
|
+
* @param to - Route location to navigate to
|
|
3360
|
+
*/
|
|
3361
|
+
replace(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
3362
|
+
/**
|
|
3363
|
+
* Go back in history if possible by calling `history.back()`. Equivalent to
|
|
3364
|
+
* `router.go(-1)`.
|
|
3365
|
+
*/
|
|
3366
|
+
back(): void;
|
|
3367
|
+
/**
|
|
3368
|
+
* Go forward in history if possible by calling `history.forward()`.
|
|
3369
|
+
* Equivalent to `router.go(1)`.
|
|
3370
|
+
*/
|
|
3371
|
+
forward(): void;
|
|
3372
|
+
/**
|
|
3373
|
+
* Allows you to move forward or backward through the history. Calls
|
|
3374
|
+
* `history.go()`.
|
|
3375
|
+
*
|
|
3376
|
+
* @param delta - The position in the history to which you want to move,
|
|
3377
|
+
* relative to the current page
|
|
3378
|
+
*/
|
|
3379
|
+
go(delta: number): void;
|
|
3380
|
+
/**
|
|
3381
|
+
* Add a navigation guard that executes before any navigation. Returns a
|
|
3382
|
+
* function that removes the registered guard.
|
|
3383
|
+
*
|
|
3384
|
+
* @param guard - navigation guard to add
|
|
3385
|
+
*/
|
|
3386
|
+
beforeEach(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
3387
|
+
/**
|
|
3388
|
+
* Add a navigation guard that executes before navigation is about to be
|
|
3389
|
+
* resolved. At this state all component have been fetched and other
|
|
3390
|
+
* navigation guards have been successful. Returns a function that removes the
|
|
3391
|
+
* registered guard.
|
|
3392
|
+
*
|
|
3393
|
+
* @param guard - navigation guard to add
|
|
3394
|
+
* @returns a function that removes the registered guard
|
|
3395
|
+
*
|
|
3396
|
+
* @example
|
|
3397
|
+
* ```js
|
|
3398
|
+
* router.beforeResolve(to => {
|
|
3399
|
+
* if (to.meta.requiresAuth && !isAuthenticated) return false
|
|
3400
|
+
* })
|
|
3401
|
+
* ```
|
|
3402
|
+
*
|
|
3403
|
+
*/
|
|
3404
|
+
beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
3405
|
+
/**
|
|
3406
|
+
* Add a navigation hook that is executed after every navigation. Returns a
|
|
3407
|
+
* function that removes the registered hook.
|
|
3408
|
+
*
|
|
3409
|
+
* @param guard - navigation hook to add
|
|
3410
|
+
* @returns a function that removes the registered hook
|
|
3411
|
+
*
|
|
3412
|
+
* @example
|
|
3413
|
+
* ```js
|
|
3414
|
+
* router.afterEach((to, from, failure) => {
|
|
3415
|
+
* if (isNavigationFailure(failure)) {
|
|
3416
|
+
* console.log('failed navigation', failure)
|
|
3417
|
+
* }
|
|
3418
|
+
* })
|
|
3419
|
+
* ```
|
|
3420
|
+
*/
|
|
3421
|
+
afterEach(guard: NavigationHookAfter): () => void;
|
|
3422
|
+
/**
|
|
3423
|
+
* Adds an error handler that is called every time a non caught error happens
|
|
3424
|
+
* during navigation. This includes errors thrown synchronously and
|
|
3425
|
+
* asynchronously, errors returned or passed to `next` in any navigation
|
|
3426
|
+
* guard, and errors occurred when trying to resolve an async component that
|
|
3427
|
+
* is required to render a route.
|
|
3428
|
+
*
|
|
3429
|
+
* @param handler - error handler to register
|
|
3430
|
+
*/
|
|
3431
|
+
onError(handler: _ErrorListener): () => void;
|
|
3432
|
+
/**
|
|
3433
|
+
* Returns a Promise that resolves when the router has completed the initial
|
|
3434
|
+
* navigation, which means it has resolved all async enter hooks and async
|
|
3435
|
+
* components that are associated with the initial route. If the initial
|
|
3436
|
+
* navigation already happened, the promise resolves immediately.
|
|
3437
|
+
*
|
|
3438
|
+
* This is useful in server-side rendering to ensure consistent output on both
|
|
3439
|
+
* the server and the client. Note that on server side, you need to manually
|
|
3440
|
+
* push the initial location while on client side, the router automatically
|
|
3441
|
+
* picks it up from the URL.
|
|
3442
|
+
*/
|
|
3443
|
+
isReady(): Promise<void>;
|
|
3444
|
+
/**
|
|
3445
|
+
* Called automatically by `app.use(router)`. Should not be called manually by
|
|
3446
|
+
* the user. This will trigger the initial navigation when on client side.
|
|
3447
|
+
*
|
|
3448
|
+
* @internal
|
|
3449
|
+
* @param app - Application that uses the router
|
|
3450
|
+
*/
|
|
3451
|
+
install(app: App): void;
|
|
3452
|
+
}
|
|
3453
|
+
//#endregion
|
|
3454
|
+
//#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
|
|
3455
|
+
//#endregion
|
|
3456
|
+
//#region src/router.d.ts
|
|
3457
|
+
/**
|
|
3458
|
+
* Options to initialize a {@link Router} instance.
|
|
3459
|
+
*/
|
|
3460
|
+
interface RouterOptions extends EXPERIMENTAL_RouterOptions_Base {
|
|
3461
|
+
/**
|
|
3462
|
+
* Initial list of routes that should be added to the router.
|
|
3463
|
+
*/
|
|
3464
|
+
routes: Readonly<RouteRecordRaw[]>;
|
|
3465
|
+
}
|
|
3466
|
+
/**
|
|
3467
|
+
* Router instance.
|
|
3468
|
+
*/
|
|
3469
|
+
interface Router extends EXPERIMENTAL_Router_Base<RouteRecordNormalized> {
|
|
3470
|
+
/**
|
|
3471
|
+
* Original options object passed to create the Router
|
|
3472
|
+
*/
|
|
3473
|
+
readonly options: RouterOptions;
|
|
3474
|
+
/**
|
|
3475
|
+
* Add a new {@link RouteRecordRaw | route record} as the child of an existing route.
|
|
3476
|
+
*
|
|
3477
|
+
* @param parentName - Parent Route Record where `route` should be appended at
|
|
3478
|
+
* @param route - Route Record to add
|
|
3479
|
+
*/
|
|
3480
|
+
addRoute(parentName: NonNullable<RouteRecordNameGeneric>, route: RouteRecordRaw): () => void;
|
|
3481
|
+
/**
|
|
3482
|
+
* Add a new {@link RouteRecordRaw | route record} to the router.
|
|
3483
|
+
*
|
|
3484
|
+
* @param route - Route Record to add
|
|
3485
|
+
*/
|
|
3486
|
+
addRoute(route: RouteRecordRaw): () => void;
|
|
3487
|
+
/**
|
|
3488
|
+
* Remove an existing route by its name.
|
|
3489
|
+
*
|
|
3490
|
+
* @param name - Name of the route to remove
|
|
3491
|
+
*/
|
|
3492
|
+
removeRoute(name: NonNullable<RouteRecordNameGeneric>): void;
|
|
3493
|
+
/**
|
|
3494
|
+
* Delete all routes from the router.
|
|
3495
|
+
*/
|
|
3496
|
+
clearRoutes(): void;
|
|
3497
|
+
}
|
|
3498
|
+
/**
|
|
3499
|
+
* Creates a Router instance that can be used by a Vue app.
|
|
3500
|
+
*
|
|
3501
|
+
* @param options - {@link RouterOptions}
|
|
3502
|
+
*/
|
|
3503
|
+
|
|
3504
|
+
//#endregion
|
|
3505
|
+
//#region src/RouterLink.d.ts
|
|
3506
|
+
interface RouterLinkOptions {
|
|
3507
|
+
/**
|
|
3508
|
+
* Route Location the link should navigate to when clicked on.
|
|
3509
|
+
*/
|
|
3510
|
+
to: RouteLocationRaw;
|
|
3511
|
+
/**
|
|
3512
|
+
* Calls `router.replace` instead of `router.push`.
|
|
3513
|
+
*/
|
|
3514
|
+
replace?: boolean;
|
|
3515
|
+
}
|
|
3516
|
+
interface RouterLinkProps extends RouterLinkOptions {
|
|
3517
|
+
/**
|
|
3518
|
+
* Whether RouterLink should not wrap its content in an `a` tag. Useful when
|
|
3519
|
+
* using `v-slot` to create a custom RouterLink
|
|
3520
|
+
*/
|
|
3521
|
+
custom?: boolean;
|
|
3522
|
+
/**
|
|
3523
|
+
* Class to apply when the link is active
|
|
3524
|
+
*/
|
|
3525
|
+
activeClass?: string;
|
|
3526
|
+
/**
|
|
3527
|
+
* Class to apply when the link is exact active
|
|
3528
|
+
*/
|
|
3529
|
+
exactActiveClass?: string;
|
|
3530
|
+
/**
|
|
3531
|
+
* Value passed to the attribute `aria-current` when the link is exact active.
|
|
3532
|
+
*
|
|
3533
|
+
* @defaultValue `'page'`
|
|
3534
|
+
*/
|
|
3535
|
+
ariaCurrentValue?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
|
|
3536
|
+
/**
|
|
3537
|
+
* Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
|
|
3538
|
+
*/
|
|
3539
|
+
viewTransition?: boolean;
|
|
3540
|
+
}
|
|
3541
|
+
/**
|
|
3542
|
+
* Options passed to {@link useLink}.
|
|
3543
|
+
*/
|
|
3544
|
+
interface UseLinkOptions<Name extends keyof RouteMap = keyof RouteMap> {
|
|
3545
|
+
to: MaybeRef<RouteLocationAsString | RouteLocationAsRelativeTyped<RouteMap, Name> | RouteLocationAsPath | RouteLocationRaw>;
|
|
3546
|
+
replace?: MaybeRef<boolean | undefined>;
|
|
3547
|
+
/**
|
|
3548
|
+
* Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
|
|
3549
|
+
*/
|
|
3550
|
+
viewTransition?: boolean;
|
|
3551
|
+
}
|
|
3552
|
+
/**
|
|
3553
|
+
* Return type of {@link useLink}.
|
|
3554
|
+
* @internal
|
|
3555
|
+
*/
|
|
3556
|
+
interface UseLinkReturn<Name extends keyof RouteMap = keyof RouteMap> {
|
|
3557
|
+
route: ComputedRef<RouteLocationResolved<Name>>;
|
|
3558
|
+
href: ComputedRef<string>;
|
|
3559
|
+
isActive: ComputedRef<boolean>;
|
|
3560
|
+
isExactActive: ComputedRef<boolean>;
|
|
3561
|
+
navigate(e?: MouseEvent): Promise<void | NavigationFailure>;
|
|
3562
|
+
}
|
|
3563
|
+
/**
|
|
3564
|
+
* Returns the internal behavior of a {@link RouterLink} without the rendering part.
|
|
3565
|
+
*
|
|
3566
|
+
* @param props - a `to` location and an optional `replace` flag
|
|
3567
|
+
*/
|
|
3568
|
+
declare function useLink<Name extends keyof RouteMap = keyof RouteMap>(props: UseLinkOptions<Name>): UseLinkReturn<Name>;
|
|
3569
|
+
/**
|
|
3570
|
+
* Component to render a link that triggers a navigation on click.
|
|
3571
|
+
*/
|
|
3572
|
+
declare const RouterLink: _RouterLinkI;
|
|
3573
|
+
/**
|
|
3574
|
+
* @internal
|
|
3575
|
+
*/
|
|
3576
|
+
type _RouterLinkPropsTypedBase = AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterLinkProps;
|
|
3577
|
+
/**
|
|
3578
|
+
* @internal
|
|
3579
|
+
*/
|
|
3580
|
+
type RouterLinkPropsTyped<Custom extends boolean | undefined> = Custom extends true ? _RouterLinkPropsTypedBase & {
|
|
3581
|
+
custom: true;
|
|
3582
|
+
} : _RouterLinkPropsTypedBase & {
|
|
3583
|
+
custom?: false | undefined;
|
|
3584
|
+
} & Omit<AnchorHTMLAttributes, 'href'>;
|
|
3585
|
+
/**
|
|
3586
|
+
* Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
|
|
3587
|
+
* automatically for JSX.
|
|
3588
|
+
*
|
|
3589
|
+
* @internal
|
|
3590
|
+
*/
|
|
3591
|
+
interface _RouterLinkI {
|
|
3592
|
+
new <Custom extends boolean | undefined = boolean | undefined>(): {
|
|
3593
|
+
$props: RouterLinkPropsTyped<Custom>;
|
|
3594
|
+
$slots: {
|
|
3595
|
+
default?: ({
|
|
3596
|
+
route,
|
|
3597
|
+
href,
|
|
3598
|
+
isActive,
|
|
3599
|
+
isExactActive,
|
|
3600
|
+
navigate
|
|
3601
|
+
}: UnwrapRef<UseLinkReturn>) => VNode[];
|
|
3602
|
+
};
|
|
3603
|
+
};
|
|
3604
|
+
/**
|
|
3605
|
+
* Access to `useLink()` without depending on using vue-router
|
|
3606
|
+
*
|
|
3607
|
+
* @internal
|
|
3608
|
+
*/
|
|
3609
|
+
useLink: typeof useLink;
|
|
3610
|
+
}
|
|
3611
|
+
//#endregion
|
|
3612
|
+
//#region src/RouterView.d.ts
|
|
3613
|
+
interface RouterViewProps {
|
|
3614
|
+
name?: string;
|
|
3615
|
+
route?: RouteLocationNormalized;
|
|
3616
|
+
}
|
|
3617
|
+
/**
|
|
3618
|
+
* Component to display the current route the user is at.
|
|
3619
|
+
*/
|
|
3620
|
+
declare const RouterView: {
|
|
3621
|
+
new (): {
|
|
3622
|
+
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterViewProps;
|
|
3623
|
+
$slots: {
|
|
3624
|
+
default?: ({
|
|
3625
|
+
Component,
|
|
3626
|
+
route
|
|
3627
|
+
}: {
|
|
3628
|
+
Component: VNode;
|
|
3629
|
+
route: RouteLocationNormalizedLoaded;
|
|
3630
|
+
}) => VNode[];
|
|
3631
|
+
};
|
|
3632
|
+
};
|
|
3633
|
+
};
|
|
3634
|
+
//#endregion
|
|
3635
|
+
//#region src/useApi.d.ts
|
|
3636
|
+
/**
|
|
3637
|
+
* Returns the router instance. Equivalent to using `$router` inside
|
|
3638
|
+
* templates.
|
|
3639
|
+
*/
|
|
3640
|
+
|
|
3641
|
+
//#endregion
|
|
3642
|
+
//#region src/index.d.ts
|
|
3643
|
+
declare module 'vue' {
|
|
3644
|
+
interface ComponentCustomOptions {
|
|
3645
|
+
/**
|
|
3646
|
+
* Guard called when the router is navigating to the route that is rendering
|
|
3647
|
+
* this component from a different route. Differently from `beforeRouteUpdate`
|
|
3648
|
+
* and `beforeRouteLeave`, `beforeRouteEnter` does not have access to the
|
|
3649
|
+
* component instance through `this` because it triggers before the component
|
|
3650
|
+
* is even mounted.
|
|
3651
|
+
*
|
|
3652
|
+
* @param to - RouteLocationRaw we are navigating to
|
|
3653
|
+
* @param from - RouteLocationRaw we are navigating from
|
|
3654
|
+
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
3655
|
+
* navigation
|
|
3656
|
+
*/
|
|
3657
|
+
beforeRouteEnter?: TypesConfig extends Record<'beforeRouteEnter', infer T> ? T : NavigationGuardWithThis<undefined>;
|
|
3658
|
+
/**
|
|
3659
|
+
* Guard called whenever the route that renders this component has changed, but
|
|
3660
|
+
* it is reused for the new route. This allows you to guard for changes in
|
|
3661
|
+
* params, the query or the hash.
|
|
3662
|
+
*
|
|
3663
|
+
* @param to - RouteLocationRaw we are navigating to
|
|
3664
|
+
* @param from - RouteLocationRaw we are navigating from
|
|
3665
|
+
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
3666
|
+
* navigation
|
|
3667
|
+
*/
|
|
3668
|
+
beforeRouteUpdate?: TypesConfig extends Record<'beforeRouteUpdate', infer T> ? T : NavigationGuard;
|
|
3669
|
+
/**
|
|
3670
|
+
* Guard called when the router is navigating away from the current route that
|
|
3671
|
+
* is rendering this component.
|
|
3672
|
+
*
|
|
3673
|
+
* @param to - RouteLocationRaw we are navigating to
|
|
3674
|
+
* @param from - RouteLocationRaw we are navigating from
|
|
3675
|
+
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
3676
|
+
* navigation
|
|
3677
|
+
*/
|
|
3678
|
+
beforeRouteLeave?: TypesConfig extends Record<'beforeRouteLeave', infer T> ? T : NavigationGuard;
|
|
3679
|
+
}
|
|
3680
|
+
interface ComponentCustomProperties {
|
|
3681
|
+
/**
|
|
3682
|
+
* Normalized current location. See {@link RouteLocationNormalizedLoaded}.
|
|
3683
|
+
*/
|
|
3684
|
+
$route: TypesConfig extends Record<'$route', infer T> ? T : RouteLocationNormalizedLoaded;
|
|
3685
|
+
/**
|
|
3686
|
+
* {@link Router} instance used by the application.
|
|
3687
|
+
*/
|
|
3688
|
+
$router: TypesConfig extends Record<'$router', infer T> ? T : Router;
|
|
3689
|
+
}
|
|
3690
|
+
interface GlobalComponents {
|
|
3691
|
+
RouterView: TypesConfig extends Record<'RouterView', infer T> ? T : typeof RouterView;
|
|
3692
|
+
RouterLink: TypesConfig extends Record<'RouterLink', infer T> ? T : typeof RouterLink;
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3695
|
+
//#endregion
|
|
3696
|
+
//#endregion
|
|
3697
|
+
//#region src/devtools/registry.d.ts
|
|
3698
|
+
//#endregion
|
|
2263
3699
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/primitive.d.ts
|
|
2264
3700
|
/**
|
|
2265
3701
|
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
@@ -2330,7 +3766,7 @@ const anyA = get(anyObject, 'a');
|
|
|
2330
3766
|
@category Type Guard
|
|
2331
3767
|
@category Utilities
|
|
2332
3768
|
*/
|
|
2333
|
-
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
3769
|
+
type IsAny<T$1> = 0 extends 1 & NoInfer<T$1> ? true : false;
|
|
2334
3770
|
//#endregion
|
|
2335
3771
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
2336
3772
|
/**
|
|
@@ -2483,7 +3919,7 @@ endIfEqual('abc', '123');
|
|
|
2483
3919
|
@category Type Guard
|
|
2484
3920
|
@category Utilities
|
|
2485
3921
|
*/
|
|
2486
|
-
type IsNever<T> = [T] extends [never] ? true : false;
|
|
3922
|
+
type IsNever<T$1> = [T$1] extends [never] ? true : false;
|
|
2487
3923
|
//#endregion
|
|
2488
3924
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/if.d.ts
|
|
2489
3925
|
/**
|
|
@@ -2593,7 +4029,7 @@ Needed to handle the case of a single call signature with properties.
|
|
|
2593
4029
|
Multiple call signatures cannot currently be supported due to a TypeScript limitation.
|
|
2594
4030
|
@see https://github.com/microsoft/TypeScript/issues/29732
|
|
2595
4031
|
*/
|
|
2596
|
-
type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
|
|
4032
|
+
type HasMultipleCallSignatures<T$1 extends (...arguments_: any[]) => unknown> = T$1 extends {
|
|
2597
4033
|
(...arguments_: infer A): unknown;
|
|
2598
4034
|
(...arguments_: infer B): unknown;
|
|
2599
4035
|
} ? B extends A ? A extends B ? false : true : true : false;
|
|
@@ -2656,7 +4092,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
2656
4092
|
@see {@link SimplifyDeep}
|
|
2657
4093
|
@category Object
|
|
2658
4094
|
*/
|
|
2659
|
-
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
4095
|
+
type Simplify<T$1> = { [KeyType in keyof T$1]: T$1[KeyType] } & {};
|
|
2660
4096
|
//#endregion
|
|
2661
4097
|
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
2662
4098
|
/**
|
|
@@ -2979,14 +4415,14 @@ partialShape.dimensions = [15]; // OK
|
|
|
2979
4415
|
@category Set
|
|
2980
4416
|
@category Map
|
|
2981
4417
|
*/
|
|
2982
|
-
type PartialDeep<T, Options extends PartialDeepOptions = {}> = _PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
|
|
2983
|
-
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<keyof T> extends true ? T // For functions with no properties
|
|
2984
|
-
: 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
|
|
2985
|
-
? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
|
|
2986
|
-
? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
|
|
2987
|
-
? 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
|
|
2988
|
-
: T // If they don't opt into array testing, just use the original type
|
|
2989
|
-
: PartialObjectDeep<T, Options> : unknown;
|
|
4418
|
+
type PartialDeep<T$1, Options extends PartialDeepOptions = {}> = _PartialDeep<T$1, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
|
|
4419
|
+
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<keyof T$1> extends true ? T$1 // For functions with no properties
|
|
4420
|
+
: 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
|
|
4421
|
+
? Options['recurseIntoArrays'] extends true ? ItemType[] extends T$1 // Test for arrays (non-tuples) specifically
|
|
4422
|
+
? readonly ItemType[] extends T$1 // Differentiate readonly and mutable arrays
|
|
4423
|
+
? 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
|
|
4424
|
+
: T$1 // If they don't opt into array testing, just use the original type
|
|
4425
|
+
: PartialObjectDeep<T$1, Options> : unknown;
|
|
2990
4426
|
|
|
2991
4427
|
/**
|
|
2992
4428
|
Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
|
|
@@ -2996,7 +4432,7 @@ type PartialMapDeep<KeyType$1, ValueType$1, Options extends Required<PartialDeep
|
|
|
2996
4432
|
/**
|
|
2997
4433
|
Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
|
|
2998
4434
|
*/
|
|
2999
|
-
type PartialSetDeep<T, Options extends Required<PartialDeepOptions>> = {} & Set<_PartialDeep<T, Options>>;
|
|
4435
|
+
type PartialSetDeep<T$1, Options extends Required<PartialDeepOptions>> = {} & Set<_PartialDeep<T$1, Options>>;
|
|
3000
4436
|
|
|
3001
4437
|
/**
|
|
3002
4438
|
Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
|
|
@@ -3006,7 +4442,7 @@ type PartialReadonlyMapDeep<KeyType$1, ValueType$1, Options extends Required<Par
|
|
|
3006
4442
|
/**
|
|
3007
4443
|
Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
|
|
3008
4444
|
*/
|
|
3009
|
-
type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {} & ReadonlySet<_PartialDeep<T, Options>>;
|
|
4445
|
+
type PartialReadonlySetDeep<T$1, Options extends Required<PartialDeepOptions>> = {} & ReadonlySet<_PartialDeep<T$1, Options>>;
|
|
3010
4446
|
|
|
3011
4447
|
/**
|
|
3012
4448
|
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|