@cabloy/vue-runtime-core 3.4.48 → 3.5.6
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/runtime-core.cjs.js +3526 -3410
- package/dist/runtime-core.cjs.prod.js +2880 -2767
- package/dist/runtime-core.d.ts +600 -450
- package/dist/runtime-core.esm-bundler.js +3540 -3430
- package/package.json +3 -3
package/dist/runtime-core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { computed as computed$1, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions,
|
|
2
|
-
export { ComputedGetter, ComputedRef, ComputedSetter, CustomRefFactory, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, EffectScheduler, EffectScope, MaybeRef, MaybeRefOrGetter, Raw, Reactive, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags, Ref, ShallowReactive, ShallowRef, ShallowUnwrapRef, ToRef, ToRefs, TrackOpTypes, TriggerOpTypes, UnwrapNestedRefs, UnwrapRef, WritableComputedOptions, WritableComputedRef, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
|
|
3
|
-
import { IfAny, Prettify,
|
|
1
|
+
import { computed as computed$1, Ref, OnCleanup, WatchStopHandle, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions, WatchCallback, ReactiveEffect, DebuggerOptions, WatchEffect, WatchHandle, WatchSource, ReactiveMarker, ShallowRef, WatchErrorCodes, reactive } from '@vue/reactivity';
|
|
2
|
+
export { ComputedGetter, ComputedRef, ComputedSetter, CustomRefFactory, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, EffectScheduler, EffectScope, MaybeRef, MaybeRefOrGetter, Raw, Reactive, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags, Ref, ShallowReactive, ShallowRef, ShallowUnwrapRef, ToRef, ToRefs, TrackOpTypes, TriggerOpTypes, UnwrapNestedRefs, UnwrapRef, WatchCallback, WatchEffect, WatchHandle, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, customRef, effect, effectScope, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, onWatcherCleanup, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
|
|
3
|
+
import { IfAny, Prettify, LooseRequired, UnionToIntersection, OverloadParameters } from '@vue/shared';
|
|
4
4
|
export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
|
|
5
5
|
|
|
6
6
|
export declare const computed: typeof computed$1;
|
|
@@ -23,11 +23,9 @@ type RawSlots = {
|
|
|
23
23
|
$stable?: boolean;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
active?: boolean;
|
|
30
|
-
computed?: boolean;
|
|
26
|
+
declare enum SchedulerJobFlags {
|
|
27
|
+
QUEUED = 1,
|
|
28
|
+
PRE = 2,
|
|
31
29
|
/**
|
|
32
30
|
* Indicates whether the effect is allowed to recursively trigger itself
|
|
33
31
|
* when managed by the scheduler.
|
|
@@ -43,7 +41,16 @@ interface SchedulerJob extends Function {
|
|
|
43
41
|
* responsibility to perform recursive state mutation that eventually
|
|
44
42
|
* stabilizes (#1727).
|
|
45
43
|
*/
|
|
46
|
-
|
|
44
|
+
ALLOW_RECURSE = 4,
|
|
45
|
+
DISPOSED = 8
|
|
46
|
+
}
|
|
47
|
+
interface SchedulerJob extends Function {
|
|
48
|
+
id?: number;
|
|
49
|
+
/**
|
|
50
|
+
* flags can technically be undefined, but it can still be used in bitwise
|
|
51
|
+
* operations just like 0.
|
|
52
|
+
*/
|
|
53
|
+
flags?: SchedulerJobFlags;
|
|
47
54
|
/**
|
|
48
55
|
* Attached by renderer.ts when setting up a component's render effect
|
|
49
56
|
* Used to obtain component information when reporting max recursive updates.
|
|
@@ -54,20 +61,368 @@ type SchedulerJobs = SchedulerJob | SchedulerJob[];
|
|
|
54
61
|
export declare function nextTick<T = void, R = void>(this: T, fn?: (this: T) => R): Promise<Awaited<R>>;
|
|
55
62
|
export declare function queuePostFlushCb(cb: SchedulerJobs): void;
|
|
56
63
|
|
|
64
|
+
export type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
|
|
65
|
+
export type ComponentObjectPropsOptions<P = Data> = {
|
|
66
|
+
[K in keyof P]: Prop<P[K]> | null;
|
|
67
|
+
};
|
|
68
|
+
export type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
|
|
69
|
+
type DefaultFactory<T> = (props: Data) => T | null | undefined;
|
|
70
|
+
interface PropOptions<T = any, D = T> {
|
|
71
|
+
type?: PropType<T> | true | null;
|
|
72
|
+
required?: boolean;
|
|
73
|
+
default?: D | DefaultFactory<D> | null | undefined | object;
|
|
74
|
+
validator?(value: unknown, props: Data): boolean;
|
|
75
|
+
}
|
|
76
|
+
export type PropType<T> = PropConstructor<T> | (PropConstructor<T> | null)[];
|
|
77
|
+
type PropConstructor<T = any> = {
|
|
78
|
+
new (...args: any[]): T & {};
|
|
79
|
+
} | {
|
|
80
|
+
(): T;
|
|
81
|
+
} | PropMethod<T>;
|
|
82
|
+
type PropMethod<T, TConstructor = any> = [T] extends [
|
|
83
|
+
((...args: any) => any) | undefined
|
|
84
|
+
] ? {
|
|
85
|
+
new (): TConstructor;
|
|
86
|
+
(): T;
|
|
87
|
+
readonly prototype: TConstructor;
|
|
88
|
+
} : never;
|
|
89
|
+
type RequiredKeys<T> = {
|
|
90
|
+
[K in keyof T]: T[K] extends {
|
|
91
|
+
required: true;
|
|
92
|
+
} | {
|
|
93
|
+
default: any;
|
|
94
|
+
} | BooleanConstructor | {
|
|
95
|
+
type: BooleanConstructor;
|
|
96
|
+
} ? T[K] extends {
|
|
97
|
+
default: undefined | (() => undefined);
|
|
98
|
+
} ? never : K : never;
|
|
99
|
+
}[keyof T];
|
|
100
|
+
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
|
101
|
+
type DefaultKeys<T> = {
|
|
102
|
+
[K in keyof T]: T[K] extends {
|
|
103
|
+
default: any;
|
|
104
|
+
} | BooleanConstructor | {
|
|
105
|
+
type: BooleanConstructor;
|
|
106
|
+
} ? T[K] extends {
|
|
107
|
+
type: BooleanConstructor;
|
|
108
|
+
required: true;
|
|
109
|
+
} ? never : K : never;
|
|
110
|
+
}[keyof T];
|
|
111
|
+
type InferPropType<T, NullAsAny = true> = [T] extends [null] ? NullAsAny extends true ? any : null : [T] extends [{
|
|
112
|
+
type: null | true;
|
|
113
|
+
}] ? any : [T] extends [ObjectConstructor | {
|
|
114
|
+
type: ObjectConstructor;
|
|
115
|
+
}] ? Record<string, any> : [T] extends [BooleanConstructor | {
|
|
116
|
+
type: BooleanConstructor;
|
|
117
|
+
}] ? boolean : [T] extends [DateConstructor | {
|
|
118
|
+
type: DateConstructor;
|
|
119
|
+
}] ? Date : [T] extends [(infer U)[] | {
|
|
120
|
+
type: (infer U)[];
|
|
121
|
+
}] ? U extends DateConstructor ? Date | InferPropType<U, false> : InferPropType<U, false> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
|
|
122
|
+
/**
|
|
123
|
+
* Extract prop types from a runtime props options object.
|
|
124
|
+
* The extracted types are **internal** - i.e. the resolved props received by
|
|
125
|
+
* the component.
|
|
126
|
+
* - Boolean props are always present
|
|
127
|
+
* - Props with default values are always present
|
|
128
|
+
*
|
|
129
|
+
* To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
|
|
130
|
+
*/
|
|
131
|
+
export type ExtractPropTypes<O> = {
|
|
132
|
+
[K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
|
|
133
|
+
} & {
|
|
134
|
+
[K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
135
|
+
};
|
|
136
|
+
type PublicRequiredKeys<T> = {
|
|
137
|
+
[K in keyof T]: T[K] extends {
|
|
138
|
+
required: true;
|
|
139
|
+
} ? K : never;
|
|
140
|
+
}[keyof T];
|
|
141
|
+
type PublicOptionalKeys<T> = Exclude<keyof T, PublicRequiredKeys<T>>;
|
|
142
|
+
/**
|
|
143
|
+
* Extract prop types from a runtime props options object.
|
|
144
|
+
* The extracted types are **public** - i.e. the expected props that can be
|
|
145
|
+
* passed to component.
|
|
146
|
+
*/
|
|
147
|
+
export type ExtractPublicPropTypes<O> = {
|
|
148
|
+
[K in keyof Pick<O, PublicRequiredKeys<O>>]: InferPropType<O[K]>;
|
|
149
|
+
} & {
|
|
150
|
+
[K in keyof Pick<O, PublicOptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
151
|
+
};
|
|
152
|
+
export type ExtractDefaultPropTypes<O> = O extends object ? {
|
|
153
|
+
[K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
|
|
154
|
+
} : {};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Vue `<script setup>` compiler macro for declaring component props. The
|
|
158
|
+
* expected argument is the same as the component `props` option.
|
|
159
|
+
*
|
|
160
|
+
* Example runtime declaration:
|
|
161
|
+
* ```js
|
|
162
|
+
* // using Array syntax
|
|
163
|
+
* const props = defineProps(['foo', 'bar'])
|
|
164
|
+
* // using Object syntax
|
|
165
|
+
* const props = defineProps({
|
|
166
|
+
* foo: String,
|
|
167
|
+
* bar: {
|
|
168
|
+
* type: Number,
|
|
169
|
+
* required: true
|
|
170
|
+
* }
|
|
171
|
+
* })
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* Equivalent type-based declaration:
|
|
175
|
+
* ```ts
|
|
176
|
+
* // will be compiled into equivalent runtime declarations
|
|
177
|
+
* const props = defineProps<{
|
|
178
|
+
* foo?: string
|
|
179
|
+
* bar: number
|
|
180
|
+
* }>()
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
184
|
+
*
|
|
185
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
186
|
+
* output and should **not** be actually called at runtime.
|
|
187
|
+
*/
|
|
188
|
+
export declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
|
|
189
|
+
[key in PropNames]?: any;
|
|
190
|
+
}>>;
|
|
191
|
+
export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
|
|
192
|
+
export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
|
|
193
|
+
export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
|
|
194
|
+
readonly [K in BKeys]-?: boolean;
|
|
195
|
+
};
|
|
196
|
+
type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
|
|
197
|
+
/**
|
|
198
|
+
* Vue `<script setup>` compiler macro for declaring a component's emitted
|
|
199
|
+
* events. The expected argument is the same as the component `emits` option.
|
|
200
|
+
*
|
|
201
|
+
* Example runtime declaration:
|
|
202
|
+
* ```js
|
|
203
|
+
* const emit = defineEmits(['change', 'update'])
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* Example type-based declaration:
|
|
207
|
+
* ```ts
|
|
208
|
+
* const emit = defineEmits<{
|
|
209
|
+
* // <eventName>: <expected arguments>
|
|
210
|
+
* change: []
|
|
211
|
+
* update: [value: number] // named tuple syntax
|
|
212
|
+
* }>()
|
|
213
|
+
*
|
|
214
|
+
* emit('change')
|
|
215
|
+
* emit('update', 1)
|
|
216
|
+
* ```
|
|
217
|
+
*
|
|
218
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
219
|
+
* output and should **not** be actually called at runtime.
|
|
220
|
+
*
|
|
221
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
222
|
+
*/
|
|
223
|
+
export declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
|
|
224
|
+
export declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
|
|
225
|
+
export declare function defineEmits<T extends ComponentTypeEmits>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
|
|
226
|
+
export type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any[]>;
|
|
227
|
+
type RecordToUnion<T extends Record<string, any>> = T[keyof T];
|
|
228
|
+
type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
|
|
229
|
+
[K in keyof T]: (evt: K, ...args: T[K]) => void;
|
|
230
|
+
}>>;
|
|
231
|
+
/**
|
|
232
|
+
* Vue `<script setup>` compiler macro for declaring a component's exposed
|
|
233
|
+
* instance properties when it is accessed by a parent component via template
|
|
234
|
+
* refs.
|
|
235
|
+
*
|
|
236
|
+
* `<script setup>` components are closed by default - i.e. variables inside
|
|
237
|
+
* the `<script setup>` scope is not exposed to parent unless explicitly exposed
|
|
238
|
+
* via `defineExpose`.
|
|
239
|
+
*
|
|
240
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
241
|
+
* output and should **not** be actually called at runtime.
|
|
242
|
+
*
|
|
243
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
|
|
244
|
+
*/
|
|
245
|
+
export declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
|
|
246
|
+
/**
|
|
247
|
+
* Vue `<script setup>` compiler macro for declaring a component's additional
|
|
248
|
+
* options. This should be used only for options that cannot be expressed via
|
|
249
|
+
* Composition API - e.g. `inheritAttrs`.
|
|
250
|
+
*
|
|
251
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
|
|
252
|
+
*/
|
|
253
|
+
export declare function defineOptions<RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin>(options?: ComponentOptionsBase<{}, RawBindings, D, C, M, Mixin, Extends, {}> & {
|
|
254
|
+
/**
|
|
255
|
+
* props should be defined via defineProps().
|
|
256
|
+
*/
|
|
257
|
+
props?: never;
|
|
258
|
+
/**
|
|
259
|
+
* emits should be defined via defineEmits().
|
|
260
|
+
*/
|
|
261
|
+
emits?: never;
|
|
262
|
+
/**
|
|
263
|
+
* expose should be defined via defineExpose().
|
|
264
|
+
*/
|
|
265
|
+
expose?: never;
|
|
266
|
+
/**
|
|
267
|
+
* slots should be defined via defineSlots().
|
|
268
|
+
*/
|
|
269
|
+
slots?: never;
|
|
270
|
+
}): void;
|
|
271
|
+
export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
|
|
272
|
+
export type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<G, S> & [
|
|
273
|
+
ModelRef<T, M, G, S>,
|
|
274
|
+
Record<M, true | undefined>
|
|
275
|
+
];
|
|
276
|
+
type DefineModelOptions<T = any, G = T, S = T> = {
|
|
277
|
+
get?: (v: T) => G;
|
|
278
|
+
set?: (v: S) => any;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Vue `<script setup>` compiler macro for declaring a
|
|
282
|
+
* two-way binding prop that can be consumed via `v-model` from the parent
|
|
283
|
+
* component. This will declare a prop with the same name and a corresponding
|
|
284
|
+
* `update:propName` event.
|
|
285
|
+
*
|
|
286
|
+
* If the first argument is a string, it will be used as the prop name;
|
|
287
|
+
* Otherwise the prop name will default to "modelValue". In both cases, you
|
|
288
|
+
* can also pass an additional object which will be used as the prop's options.
|
|
289
|
+
*
|
|
290
|
+
* The returned ref behaves differently depending on whether the parent
|
|
291
|
+
* provided the corresponding v-model props or not:
|
|
292
|
+
* - If yes, the returned ref's value will always be in sync with the parent
|
|
293
|
+
* prop.
|
|
294
|
+
* - If not, the returned ref will behave like a normal local ref.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```ts
|
|
298
|
+
* // default model (consumed via `v-model`)
|
|
299
|
+
* const modelValue = defineModel<string>()
|
|
300
|
+
* modelValue.value = "hello"
|
|
301
|
+
*
|
|
302
|
+
* // default model with options
|
|
303
|
+
* const modelValue = defineModel<string>({ required: true })
|
|
304
|
+
*
|
|
305
|
+
* // with specified name (consumed via `v-model:count`)
|
|
306
|
+
* const count = defineModel<number>('count')
|
|
307
|
+
* count.value++
|
|
308
|
+
*
|
|
309
|
+
* // with specified name and default value
|
|
310
|
+
* const count = defineModel<number>('count', { default: 0 })
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
export declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(options: ({
|
|
314
|
+
default: any;
|
|
315
|
+
} | {
|
|
316
|
+
required: true;
|
|
317
|
+
}) & PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T, M, G, S>;
|
|
318
|
+
export declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(options?: PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
|
|
319
|
+
export declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(name: string, options: ({
|
|
320
|
+
default: any;
|
|
321
|
+
} | {
|
|
322
|
+
required: true;
|
|
323
|
+
}) & PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T, M, G, S>;
|
|
324
|
+
export declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(name: string, options?: PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
|
|
325
|
+
type NotUndefined<T> = T extends undefined ? never : T;
|
|
326
|
+
type MappedOmit<T, K extends keyof any> = {
|
|
327
|
+
[P in keyof T as P extends K ? never : P]: T[P];
|
|
328
|
+
};
|
|
329
|
+
type InferDefaults<T> = {
|
|
330
|
+
[K in keyof T]?: InferDefault<T, T[K]>;
|
|
331
|
+
};
|
|
332
|
+
type NativeType = null | number | string | boolean | symbol | Function;
|
|
333
|
+
type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
|
|
334
|
+
type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<MappedOmit<T, keyof Defaults>> & {
|
|
335
|
+
readonly [K in keyof Defaults as K extends keyof T ? K : never]-?: K extends keyof T ? Defaults[K] extends undefined ? IfAny<Defaults[K], NotUndefined<T[K]>, T[K]> : NotUndefined<T[K]> : never;
|
|
336
|
+
} & {
|
|
337
|
+
readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Vue `<script setup>` compiler macro for providing props default values when
|
|
341
|
+
* using type-based `defineProps` declaration.
|
|
342
|
+
*
|
|
343
|
+
* Example usage:
|
|
344
|
+
* ```ts
|
|
345
|
+
* withDefaults(defineProps<{
|
|
346
|
+
* size?: number
|
|
347
|
+
* labels?: string[]
|
|
348
|
+
* }>(), {
|
|
349
|
+
* size: 3,
|
|
350
|
+
* labels: () => ['default label']
|
|
351
|
+
* })
|
|
352
|
+
* ```
|
|
353
|
+
*
|
|
354
|
+
* This is only usable inside `<script setup>`, is compiled away in the output
|
|
355
|
+
* and should **not** be actually called at runtime.
|
|
356
|
+
*
|
|
357
|
+
* @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
|
|
358
|
+
*/
|
|
359
|
+
export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
|
|
360
|
+
export declare function useSlots(): SetupContext['slots'];
|
|
361
|
+
export declare function useAttrs(): SetupContext['attrs'];
|
|
362
|
+
|
|
57
363
|
export type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
|
|
58
364
|
export type EmitsOptions = ObjectEmitsOptions | string[];
|
|
59
|
-
type EmitsToProps<T extends EmitsOptions> = T extends string[] ? {
|
|
365
|
+
export type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? {
|
|
60
366
|
[K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
|
|
61
367
|
} : T extends ObjectEmitsOptions ? {
|
|
62
|
-
[K in
|
|
368
|
+
[K in string & keyof T as `on${Capitalize<K>}`]?: (...args: T[K] extends (...args: infer P) => any ? P : T[K] extends null ? any[] : never) => any;
|
|
63
369
|
} : {};
|
|
64
|
-
type
|
|
370
|
+
type TypeEmitsToOptions<T extends ComponentTypeEmits> = {
|
|
371
|
+
[K in keyof T & string]: T[K] extends [...args: infer Args] ? (...args: Args) => any : () => any;
|
|
372
|
+
} & (T extends (...args: any[]) => any ? ParametersToFns<OverloadParameters<T>> : {});
|
|
373
|
+
type ParametersToFns<T extends any[]> = {
|
|
374
|
+
[K in T[0]]: K extends `${infer C}` ? (...args: T extends [C, ...infer Args] ? Args : never) => any : never;
|
|
375
|
+
};
|
|
376
|
+
export type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
|
|
65
377
|
[K in keyof E]: (...args: E[K]) => any;
|
|
66
378
|
} : E;
|
|
67
|
-
type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{
|
|
379
|
+
export type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{
|
|
68
380
|
[key in Event]: Options[key] extends (...args: infer Args) => any ? (event: key, ...args: Args) => void : Options[key] extends any[] ? (event: key, ...args: Options[key]) => void : (event: key, ...args: any[]) => void;
|
|
69
381
|
}[Event]>;
|
|
70
382
|
|
|
383
|
+
/**
|
|
384
|
+
Runtime helper for applying directives to a vnode. Example usage:
|
|
385
|
+
|
|
386
|
+
const comp = resolveComponent('comp')
|
|
387
|
+
const foo = resolveDirective('foo')
|
|
388
|
+
const bar = resolveDirective('bar')
|
|
389
|
+
|
|
390
|
+
return withDirectives(h(comp), [
|
|
391
|
+
[foo, this.x],
|
|
392
|
+
[bar, this.y]
|
|
393
|
+
])
|
|
394
|
+
*/
|
|
395
|
+
|
|
396
|
+
export interface DirectiveBinding<Value = any, Modifiers extends string = string, Arg extends string = string> {
|
|
397
|
+
instance: ComponentPublicInstance | Record<string, any> | null;
|
|
398
|
+
value: Value;
|
|
399
|
+
oldValue: Value | null;
|
|
400
|
+
arg?: Arg;
|
|
401
|
+
modifiers: DirectiveModifiers<Modifiers>;
|
|
402
|
+
dir: ObjectDirective<any, Value>;
|
|
403
|
+
}
|
|
404
|
+
export type DirectiveHook<HostElement = any, Prev = VNode<any, HostElement> | null, Value = any, Modifiers extends string = string, Arg extends string = string> = (el: HostElement, binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode<any, HostElement>, prevVNode: Prev) => void;
|
|
405
|
+
type SSRDirectiveHook<Value = any, Modifiers extends string = string, Arg extends string = string> = (binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode) => Data | undefined;
|
|
406
|
+
export interface ObjectDirective<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string> {
|
|
407
|
+
created?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
408
|
+
beforeMount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
409
|
+
mounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
410
|
+
beforeUpdate?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
|
|
411
|
+
updated?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
|
|
412
|
+
beforeUnmount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
413
|
+
unmounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
414
|
+
getSSRProps?: SSRDirectiveHook<Value, Modifiers, Arg>;
|
|
415
|
+
deep?: boolean;
|
|
416
|
+
}
|
|
417
|
+
export type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg extends string = string> = DirectiveHook<HostElement, any, V, Modifiers, Arg>;
|
|
418
|
+
export type Directive<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string> = ObjectDirective<HostElement, Value, Modifiers, Arg> | FunctionDirective<HostElement, Value, Modifiers, Arg>;
|
|
419
|
+
type DirectiveModifiers<K extends string = string> = Record<K, boolean>;
|
|
420
|
+
export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string | undefined, DirectiveModifiers]>;
|
|
421
|
+
/**
|
|
422
|
+
* Adds directives to a VNode.
|
|
423
|
+
*/
|
|
424
|
+
export declare function withDirectives<T extends VNode>(vnode: T, directives: DirectiveArguments): T;
|
|
425
|
+
|
|
71
426
|
/**
|
|
72
427
|
* Custom properties added to component instances in any way and can be accessed through `this`
|
|
73
428
|
*
|
|
@@ -77,7 +432,7 @@ type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Op
|
|
|
77
432
|
* import { createApp } from 'vue'
|
|
78
433
|
* import { Router, createRouter } from 'vue-router'
|
|
79
434
|
*
|
|
80
|
-
* declare module '
|
|
435
|
+
* declare module 'vue' {
|
|
81
436
|
* interface ComponentCustomProperties {
|
|
82
437
|
* $router: Router
|
|
83
438
|
* }
|
|
@@ -96,7 +451,7 @@ type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Op
|
|
|
96
451
|
export interface ComponentCustomProperties {
|
|
97
452
|
}
|
|
98
453
|
type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin ? ComponentOptionsMixin extends T ? true : false : false;
|
|
99
|
-
type MixinToOptionTypes<T> = T extends ComponentOptionsBase<infer P, infer B, infer D, infer C, infer M, infer Mixin, infer Extends, any, any, infer Defaults, any, any, any> ? OptionTypesType<P & {}, B & {}, D & {}, C & {}, M & {}, Defaults & {}> & IntersectionMixin<Mixin> & IntersectionMixin<Extends> : never;
|
|
454
|
+
type MixinToOptionTypes<T> = T extends ComponentOptionsBase<infer P, infer B, infer D, infer C, infer M, infer Mixin, infer Extends, any, any, infer Defaults, any, any, any, any, any, any, any> ? OptionTypesType<P & {}, B & {}, D & {}, C & {}, M & {}, Defaults & {}> & IntersectionMixin<Mixin> & IntersectionMixin<Extends> : never;
|
|
100
455
|
type ExtractMixin<T> = {
|
|
101
456
|
Mixin: MixinToOptionTypes<T>;
|
|
102
457
|
}[T extends ComponentOptionsMixin ? 'Mixin' : never];
|
|
@@ -109,26 +464,40 @@ type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props,
|
|
|
109
464
|
__isSuspense?: never;
|
|
110
465
|
new (...args: any[]): T;
|
|
111
466
|
};
|
|
467
|
+
/**
|
|
468
|
+
* @deprecated This is no longer used internally, but exported and relied on by
|
|
469
|
+
* existing library types generated by vue-tsc.
|
|
470
|
+
*/
|
|
112
471
|
export type CreateComponentPublicInstance<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S>, I, S>;
|
|
472
|
+
/**
|
|
473
|
+
* This is the same as `CreateComponentPublicInstance` but adds local components,
|
|
474
|
+
* global directives, exposed, and provide inference.
|
|
475
|
+
* It changes the arguments order so that we don't need to repeat mixin
|
|
476
|
+
* inference everywhere internally, but it has to be a new type to avoid
|
|
477
|
+
* breaking types that relies on previous arguments order (#10842)
|
|
478
|
+
*/
|
|
479
|
+
export type CreateComponentPublicInstanceWithMixins<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, TypeRefs extends Data = {}, TypeEl extends Element = any, Provide extends ComponentProvideOptions = ComponentProvideOptions, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S, LC, Directives, Exposed, Provide>, I, S, Exposed, TypeRefs, TypeEl>;
|
|
480
|
+
type ExposedKeys<T, Exposed extends string & keyof T> = '' extends Exposed ? T : Pick<T, Exposed>;
|
|
113
481
|
export type ComponentPublicInstance<P = {}, // props type extracted from props option
|
|
114
482
|
B = {}, // raw bindings returned from setup()
|
|
115
483
|
D = {}, // return from data()
|
|
116
|
-
C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps =
|
|
484
|
+
C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = {}, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, Exposed extends string = '', TypeRefs extends Data = {}, TypeEl extends Element = any> = {
|
|
117
485
|
$: ComponentInternalInstance;
|
|
118
486
|
$data: D;
|
|
119
487
|
$props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
|
|
120
488
|
$attrs: Data;
|
|
121
|
-
$refs: Data;
|
|
489
|
+
$refs: Data & TypeRefs;
|
|
122
490
|
$slots: UnwrapSlotsType<S>;
|
|
123
491
|
$root: ComponentPublicInstance | null;
|
|
124
492
|
$parent: ComponentPublicInstance | null;
|
|
493
|
+
$host: Element | null;
|
|
125
494
|
$emit: EmitFn<E>;
|
|
126
|
-
$el:
|
|
495
|
+
$el: TypeEl;
|
|
127
496
|
$options: Options & MergedComponentOptionsOverride;
|
|
128
497
|
$forceUpdate: () => void;
|
|
129
498
|
$nextTick: typeof nextTick;
|
|
130
499
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, OnCleanup]) => any : (...args: [any, any, OnCleanup]) => any, options?: WatchOptions): WatchStopHandle;
|
|
131
|
-
} & IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B
|
|
500
|
+
} & ExposedKeys<IfAny<P, P, Readonly<Defaults> & Omit<P, keyof ShallowUnwrapRef<B> | keyof Defaults>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>, Exposed>;
|
|
132
501
|
|
|
133
502
|
declare enum LifecycleHooks {
|
|
134
503
|
BEFORE_CREATE = "bc",
|
|
@@ -167,6 +536,7 @@ declare const SuspenseImpl: {
|
|
|
167
536
|
normalize: typeof normalizeSuspenseChildren;
|
|
168
537
|
};
|
|
169
538
|
export declare const Suspense: {
|
|
539
|
+
__isSuspense: true;
|
|
170
540
|
new (): {
|
|
171
541
|
$props: VNodeProps & SuspenseProps;
|
|
172
542
|
$slots: {
|
|
@@ -174,7 +544,6 @@ export declare const Suspense: {
|
|
|
174
544
|
fallback(): VNode[];
|
|
175
545
|
};
|
|
176
546
|
};
|
|
177
|
-
__isSuspense: true;
|
|
178
547
|
};
|
|
179
548
|
export interface SuspenseBoundary {
|
|
180
549
|
vnode: VNode<RendererNode, RendererElement, SuspenseProps>;
|
|
@@ -242,27 +611,13 @@ export interface TransitionState {
|
|
|
242
611
|
leavingVNodes: Map<any, Record<string, VNode>>;
|
|
243
612
|
}
|
|
244
613
|
export declare function useTransitionState(): TransitionState;
|
|
245
|
-
export declare const BaseTransitionPropsValidators:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
onEnterCancelled: (ArrayConstructor | FunctionConstructor)[];
|
|
253
|
-
onBeforeLeave: (ArrayConstructor | FunctionConstructor)[];
|
|
254
|
-
onLeave: (ArrayConstructor | FunctionConstructor)[];
|
|
255
|
-
onAfterLeave: (ArrayConstructor | FunctionConstructor)[];
|
|
256
|
-
onLeaveCancelled: (ArrayConstructor | FunctionConstructor)[];
|
|
257
|
-
onBeforeAppear: (ArrayConstructor | FunctionConstructor)[];
|
|
258
|
-
onAppear: (ArrayConstructor | FunctionConstructor)[];
|
|
259
|
-
onAfterAppear: (ArrayConstructor | FunctionConstructor)[];
|
|
260
|
-
onAppearCancelled: (ArrayConstructor | FunctionConstructor)[];
|
|
261
|
-
};
|
|
262
|
-
export declare const BaseTransition: new () => {
|
|
263
|
-
$props: BaseTransitionProps<any>;
|
|
264
|
-
$slots: {
|
|
265
|
-
default(): VNode[];
|
|
614
|
+
export declare const BaseTransitionPropsValidators: Record<string, any>;
|
|
615
|
+
export declare const BaseTransition: {
|
|
616
|
+
new (): {
|
|
617
|
+
$props: BaseTransitionProps<any>;
|
|
618
|
+
$slots: {
|
|
619
|
+
default(): VNode[];
|
|
620
|
+
};
|
|
266
621
|
};
|
|
267
622
|
};
|
|
268
623
|
export declare function resolveTransitionHooks(vnode: VNode, props: BaseTransitionProps<any>, state: TransitionState, instance: ComponentInternalInstance, postClone?: (hooks: TransitionHooks) => void): TransitionHooks;
|
|
@@ -354,164 +709,30 @@ export interface KeepAliveProps {
|
|
|
354
709
|
max?: number | string;
|
|
355
710
|
}
|
|
356
711
|
export declare const KeepAlive: {
|
|
712
|
+
__isKeepAlive: true;
|
|
357
713
|
new (): {
|
|
358
714
|
$props: VNodeProps & KeepAliveProps;
|
|
359
715
|
$slots: {
|
|
360
716
|
default(): VNode[];
|
|
361
717
|
};
|
|
362
718
|
};
|
|
363
|
-
__isKeepAlive: true;
|
|
364
719
|
};
|
|
365
720
|
export declare function onActivated(hook: Function, target?: ComponentInternalInstance | null): void;
|
|
366
721
|
export declare function onDeactivated(hook: Function, target?: ComponentInternalInstance | null): void;
|
|
367
722
|
|
|
368
|
-
|
|
369
|
-
export declare const
|
|
370
|
-
export declare const
|
|
371
|
-
export declare const
|
|
372
|
-
export declare const
|
|
373
|
-
export declare const
|
|
374
|
-
export declare const
|
|
723
|
+
type CreateHook<T = any> = (hook: T, target?: ComponentInternalInstance | null) => void;
|
|
724
|
+
export declare const onBeforeMount: CreateHook;
|
|
725
|
+
export declare const onMounted: CreateHook;
|
|
726
|
+
export declare const onBeforeUpdate: CreateHook;
|
|
727
|
+
export declare const onUpdated: CreateHook;
|
|
728
|
+
export declare const onBeforeUnmount: CreateHook;
|
|
729
|
+
export declare const onUnmounted: CreateHook;
|
|
730
|
+
export declare const onServerPrefetch: CreateHook;
|
|
375
731
|
type DebuggerHook = (e: DebuggerEvent) => void;
|
|
376
|
-
export declare const onRenderTriggered:
|
|
377
|
-
export declare const onRenderTracked:
|
|
732
|
+
export declare const onRenderTriggered: CreateHook<DebuggerHook>;
|
|
733
|
+
export declare const onRenderTracked: CreateHook<DebuggerHook>;
|
|
378
734
|
type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
|
|
379
|
-
export declare function onErrorCaptured<TError = Error>(hook: ErrorCapturedHook<TError>, target?: ComponentInternalInstance | null): void;
|
|
380
|
-
|
|
381
|
-
export type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
|
|
382
|
-
export type ComponentObjectPropsOptions<P = Data> = {
|
|
383
|
-
[K in keyof P]: Prop<P[K]> | null;
|
|
384
|
-
};
|
|
385
|
-
export type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
|
|
386
|
-
type DefaultFactory<T> = (props: Data) => T | null | undefined;
|
|
387
|
-
interface PropOptions<T = any, D = T> {
|
|
388
|
-
type?: PropType<T> | true | null;
|
|
389
|
-
required?: boolean;
|
|
390
|
-
default?: D | DefaultFactory<D> | null | undefined | object;
|
|
391
|
-
validator?(value: unknown, props: Data): boolean;
|
|
392
|
-
}
|
|
393
|
-
export type PropType<T> = PropConstructor<T> | PropConstructor<T>[];
|
|
394
|
-
type PropConstructor<T = any> = {
|
|
395
|
-
new (...args: any[]): T & {};
|
|
396
|
-
} | {
|
|
397
|
-
(): T;
|
|
398
|
-
} | PropMethod<T>;
|
|
399
|
-
type PropMethod<T, TConstructor = any> = [T] extends [
|
|
400
|
-
((...args: any) => any) | undefined
|
|
401
|
-
] ? {
|
|
402
|
-
new (): TConstructor;
|
|
403
|
-
(): T;
|
|
404
|
-
readonly prototype: TConstructor;
|
|
405
|
-
} : never;
|
|
406
|
-
type RequiredKeys<T> = {
|
|
407
|
-
[K in keyof T]: T[K] extends {
|
|
408
|
-
required: true;
|
|
409
|
-
} | {
|
|
410
|
-
default: any;
|
|
411
|
-
} | BooleanConstructor | {
|
|
412
|
-
type: BooleanConstructor;
|
|
413
|
-
} ? T[K] extends {
|
|
414
|
-
default: undefined | (() => undefined);
|
|
415
|
-
} ? never : K : never;
|
|
416
|
-
}[keyof T];
|
|
417
|
-
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
|
418
|
-
type DefaultKeys<T> = {
|
|
419
|
-
[K in keyof T]: T[K] extends {
|
|
420
|
-
default: any;
|
|
421
|
-
} | BooleanConstructor | {
|
|
422
|
-
type: BooleanConstructor;
|
|
423
|
-
} ? T[K] extends {
|
|
424
|
-
type: BooleanConstructor;
|
|
425
|
-
required: true;
|
|
426
|
-
} ? never : K : never;
|
|
427
|
-
}[keyof T];
|
|
428
|
-
type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
|
|
429
|
-
type: null | true;
|
|
430
|
-
}] ? any : [T] extends [ObjectConstructor | {
|
|
431
|
-
type: ObjectConstructor;
|
|
432
|
-
}] ? Record<string, any> : [T] extends [BooleanConstructor | {
|
|
433
|
-
type: BooleanConstructor;
|
|
434
|
-
}] ? boolean : [T] extends [DateConstructor | {
|
|
435
|
-
type: DateConstructor;
|
|
436
|
-
}] ? Date : [T] extends [(infer U)[] | {
|
|
437
|
-
type: (infer U)[];
|
|
438
|
-
}] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
|
|
439
|
-
/**
|
|
440
|
-
* Extract prop types from a runtime props options object.
|
|
441
|
-
* The extracted types are **internal** - i.e. the resolved props received by
|
|
442
|
-
* the component.
|
|
443
|
-
* - Boolean props are always present
|
|
444
|
-
* - Props with default values are always present
|
|
445
|
-
*
|
|
446
|
-
* To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
|
|
447
|
-
*/
|
|
448
|
-
export type ExtractPropTypes<O> = {
|
|
449
|
-
[K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
|
|
450
|
-
} & {
|
|
451
|
-
[K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
452
|
-
};
|
|
453
|
-
type PublicRequiredKeys<T> = {
|
|
454
|
-
[K in keyof T]: T[K] extends {
|
|
455
|
-
required: true;
|
|
456
|
-
} ? K : never;
|
|
457
|
-
}[keyof T];
|
|
458
|
-
type PublicOptionalKeys<T> = Exclude<keyof T, PublicRequiredKeys<T>>;
|
|
459
|
-
/**
|
|
460
|
-
* Extract prop types from a runtime props options object.
|
|
461
|
-
* The extracted types are **public** - i.e. the expected props that can be
|
|
462
|
-
* passed to component.
|
|
463
|
-
*/
|
|
464
|
-
export type ExtractPublicPropTypes<O> = {
|
|
465
|
-
[K in keyof Pick<O, PublicRequiredKeys<O>>]: InferPropType<O[K]>;
|
|
466
|
-
} & {
|
|
467
|
-
[K in keyof Pick<O, PublicOptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
468
|
-
};
|
|
469
|
-
export type ExtractDefaultPropTypes<O> = O extends object ? {
|
|
470
|
-
[K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
|
|
471
|
-
} : {};
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
Runtime helper for applying directives to a vnode. Example usage:
|
|
475
|
-
|
|
476
|
-
const comp = resolveComponent('comp')
|
|
477
|
-
const foo = resolveDirective('foo')
|
|
478
|
-
const bar = resolveDirective('bar')
|
|
479
|
-
|
|
480
|
-
return withDirectives(h(comp), [
|
|
481
|
-
[foo, this.x],
|
|
482
|
-
[bar, this.y]
|
|
483
|
-
])
|
|
484
|
-
*/
|
|
485
|
-
|
|
486
|
-
export interface DirectiveBinding<V = any> {
|
|
487
|
-
instance: ComponentPublicInstance | Record<string, any> | null;
|
|
488
|
-
value: V;
|
|
489
|
-
oldValue: V | null;
|
|
490
|
-
arg?: string;
|
|
491
|
-
modifiers: DirectiveModifiers;
|
|
492
|
-
dir: ObjectDirective<any, V>;
|
|
493
|
-
}
|
|
494
|
-
export type DirectiveHook<T = any, Prev = VNode<any, T> | null, V = any> = (el: T, binding: DirectiveBinding<V>, vnode: VNode<any, T>, prevVNode: Prev) => void;
|
|
495
|
-
type SSRDirectiveHook<V> = (binding: DirectiveBinding<V>, vnode: VNode) => Data | undefined;
|
|
496
|
-
export interface ObjectDirective<T = any, V = any> {
|
|
497
|
-
created?: DirectiveHook<T, null, V>;
|
|
498
|
-
beforeMount?: DirectiveHook<T, null, V>;
|
|
499
|
-
mounted?: DirectiveHook<T, null, V>;
|
|
500
|
-
beforeUpdate?: DirectiveHook<T, VNode<any, T>, V>;
|
|
501
|
-
updated?: DirectiveHook<T, VNode<any, T>, V>;
|
|
502
|
-
beforeUnmount?: DirectiveHook<T, null, V>;
|
|
503
|
-
unmounted?: DirectiveHook<T, null, V>;
|
|
504
|
-
getSSRProps?: SSRDirectiveHook<V>;
|
|
505
|
-
deep?: boolean;
|
|
506
|
-
}
|
|
507
|
-
export type FunctionDirective<T = any, V = any> = DirectiveHook<T, any, V>;
|
|
508
|
-
export type Directive<T = any, V = any> = ObjectDirective<T, V> | FunctionDirective<T, V>;
|
|
509
|
-
type DirectiveModifiers = Record<string, boolean>;
|
|
510
|
-
export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string | undefined, DirectiveModifiers]>;
|
|
511
|
-
/**
|
|
512
|
-
* Adds directives to a VNode.
|
|
513
|
-
*/
|
|
514
|
-
export declare function withDirectives<T extends VNode>(vnode: T, directives: DirectiveArguments): T;
|
|
735
|
+
export declare function onErrorCaptured<TError = Error>(hook: ErrorCapturedHook<TError>, target?: ComponentInternalInstance | null): void;
|
|
515
736
|
|
|
516
737
|
declare enum DeprecationTypes$1 {
|
|
517
738
|
GLOBAL_MOUNT = "GLOBAL_MOUNT",
|
|
@@ -567,7 +788,7 @@ declare function configureCompat(config: CompatConfig): void;
|
|
|
567
788
|
*
|
|
568
789
|
* @example
|
|
569
790
|
* ```ts
|
|
570
|
-
* declare module '
|
|
791
|
+
* declare module 'vue' {
|
|
571
792
|
* interface ComponentCustomOptions {
|
|
572
793
|
* beforeRouteUpdate?(
|
|
573
794
|
* to: Route,
|
|
@@ -581,17 +802,17 @@ declare function configureCompat(config: CompatConfig): void;
|
|
|
581
802
|
export interface ComponentCustomOptions {
|
|
582
803
|
}
|
|
583
804
|
export type RenderFunction = () => VNodeChild;
|
|
584
|
-
export interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II>, ComponentInternalOptions, ComponentCustomOptions {
|
|
805
|
+
export interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II, Provide>, ComponentInternalOptions, ComponentCustomOptions {
|
|
585
806
|
setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, 'P'>>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
|
|
586
807
|
name?: string;
|
|
587
808
|
template?: string | object;
|
|
588
809
|
render?: Function;
|
|
589
|
-
components?: Record<string, Component>;
|
|
590
|
-
directives?: Record<string, Directive>;
|
|
810
|
+
components?: LC & Record<string, Component>;
|
|
811
|
+
directives?: Directives & Record<string, Directive>;
|
|
591
812
|
inheritAttrs?: boolean;
|
|
592
813
|
emits?: (E | EE[]) & ThisType<void>;
|
|
593
814
|
slots?: S;
|
|
594
|
-
expose?:
|
|
815
|
+
expose?: Exposed[];
|
|
595
816
|
serverPrefetch?(): void | Promise<any>;
|
|
596
817
|
compilerOptions?: RuntimeCompilerOptions;
|
|
597
818
|
call?: (this: unknown, ...args: unknown[]) => never;
|
|
@@ -609,19 +830,8 @@ export interface RuntimeCompilerOptions {
|
|
|
609
830
|
comments?: boolean;
|
|
610
831
|
delimiters?: [string, string];
|
|
611
832
|
}
|
|
612
|
-
export type
|
|
613
|
-
|
|
614
|
-
} & ThisType<CreateComponentPublicInstance<PE, RawBindings, D, C, M, Mixin, Extends, E, PE, {}, false, I, S>>;
|
|
615
|
-
export type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, Props = Prettify<Readonly<{
|
|
616
|
-
[key in PropNames]?: any;
|
|
617
|
-
} & EmitsToProps<E>>>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S> & {
|
|
618
|
-
props: PropNames[];
|
|
619
|
-
} & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, {}, false, I, S>>;
|
|
620
|
-
export type ComponentOptionsWithObjectProps<PropsOptions = ComponentObjectPropsOptions, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, Props = Prettify<Readonly<ExtractPropTypes<PropsOptions> & EmitsToProps<E>>>, Defaults = ExtractDefaultPropTypes<PropsOptions>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S> & {
|
|
621
|
-
props: PropsOptions & ThisType<void>;
|
|
622
|
-
} & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, Defaults, false, I, S>>;
|
|
623
|
-
export type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any, S extends SlotsType = any> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, string, S> & ThisType<CreateComponentPublicInstance<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>>>;
|
|
624
|
-
export type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any>;
|
|
833
|
+
export type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S, LC, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>, Defaults, false, I, S, LC, Directives>>;
|
|
834
|
+
export type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
625
835
|
export type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
|
|
626
836
|
export interface MethodOptions {
|
|
627
837
|
[key: string]: Function;
|
|
@@ -649,14 +859,14 @@ type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? {
|
|
|
649
859
|
} : T extends ObjectInjectOptions ? {
|
|
650
860
|
[K in keyof T]?: unknown;
|
|
651
861
|
} : never;
|
|
652
|
-
interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string> {
|
|
862
|
+
interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string, Provide extends ComponentProvideOptions = ComponentProvideOptions> {
|
|
653
863
|
compatConfig?: CompatConfig;
|
|
654
864
|
[key: string]: any;
|
|
655
|
-
data?: (this:
|
|
865
|
+
data?: (this: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
|
|
656
866
|
computed?: C;
|
|
657
867
|
methods?: M;
|
|
658
868
|
watch?: ComponentWatchOptions;
|
|
659
|
-
provide?:
|
|
869
|
+
provide?: Provide;
|
|
660
870
|
inject?: I | II[];
|
|
661
871
|
filters?: Record<string, Function>;
|
|
662
872
|
mixins?: Mixin[];
|
|
@@ -722,9 +932,38 @@ type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M e
|
|
|
722
932
|
M: M;
|
|
723
933
|
Defaults: Defaults;
|
|
724
934
|
};
|
|
935
|
+
/**
|
|
936
|
+
* @deprecated
|
|
937
|
+
*/
|
|
938
|
+
export type ComponentOptionsWithoutProps<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, TE extends ComponentTypeEmits = {}, ResolvedEmits extends EmitsOptions = {} extends E ? TypeEmitsToOptions<TE> : E, PE = Props & EmitsToProps<ResolvedEmits>> = ComponentOptionsBase<PE, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S, LC, Directives, Exposed, Provide> & {
|
|
939
|
+
props?: never;
|
|
940
|
+
/**
|
|
941
|
+
* @private for language-tools use only
|
|
942
|
+
*/
|
|
943
|
+
__typeProps?: Props;
|
|
944
|
+
/**
|
|
945
|
+
* @private for language-tools use only
|
|
946
|
+
*/
|
|
947
|
+
__typeEmits?: TE;
|
|
948
|
+
} & ThisType<CreateComponentPublicInstanceWithMixins<PE, RawBindings, D, C, M, Mixin, Extends, ResolvedEmits, EE, {}, false, I, S, LC, Directives, Exposed>>;
|
|
949
|
+
/**
|
|
950
|
+
* @deprecated
|
|
951
|
+
*/
|
|
952
|
+
export type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Props = Prettify<Readonly<{
|
|
953
|
+
[key in PropNames]?: any;
|
|
954
|
+
} & EmitsToProps<E>>>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S, LC, Directives, Exposed, Provide> & {
|
|
955
|
+
props: PropNames[];
|
|
956
|
+
} & ThisType<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, {}, false, I, S, LC, Directives, Exposed>>;
|
|
957
|
+
/**
|
|
958
|
+
* @deprecated
|
|
959
|
+
*/
|
|
960
|
+
export type ComponentOptionsWithObjectProps<PropsOptions = ComponentObjectPropsOptions, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Props = Prettify<Readonly<ExtractPropTypes<PropsOptions>> & Readonly<EmitsToProps<E>>>, Defaults = ExtractDefaultPropTypes<PropsOptions>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S, LC, Directives, Exposed, Provide> & {
|
|
961
|
+
props: PropsOptions & ThisType<void>;
|
|
962
|
+
} & ThisType<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, Defaults, false, I, S, LC, Directives>>;
|
|
725
963
|
|
|
726
|
-
|
|
964
|
+
interface InjectionConstraint<T> {
|
|
727
965
|
}
|
|
966
|
+
export type InjectionKey<T> = symbol & InjectionConstraint<T>;
|
|
728
967
|
export declare function provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): void;
|
|
729
968
|
export declare function inject<T>(key: InjectionKey<T> | string): T | undefined;
|
|
730
969
|
export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T, treatDefaultAsFactory?: false): T;
|
|
@@ -738,8 +977,9 @@ export declare function hasInjectionContext(): boolean;
|
|
|
738
977
|
|
|
739
978
|
export type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
740
979
|
type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
|
|
741
|
-
export type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}> = ComponentPublicInstanceConstructor<
|
|
742
|
-
export type DefineSetupFnComponent<P extends Record<string, any>, E extends EmitsOptions = {}, S extends SlotsType = SlotsType, Props = P & EmitsToProps<E>, PP = PublicProps> = new (props: Props & PP) =>
|
|
980
|
+
export type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, MakeDefaultsOptional extends boolean = true, TypeRefs extends Record<string, unknown> = {}, TypeEl extends Element = any> = ComponentPublicInstanceConstructor<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, MakeDefaultsOptional, {}, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, TypeRefs, TypeEl>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, Provide> & PP;
|
|
981
|
+
export type DefineSetupFnComponent<P extends Record<string, any>, E extends EmitsOptions = {}, S extends SlotsType = SlotsType, Props = P & EmitsToProps<E>, PP = PublicProps> = new (props: Props & PP) => CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, E, PP, {}, false, {}, S>;
|
|
982
|
+
type ToResolvedProps<Props, Emits extends EmitsOptions> = Readonly<Props> & Readonly<EmitsToProps<Emits>>;
|
|
743
983
|
export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & {
|
|
744
984
|
props?: (keyof Props)[];
|
|
745
985
|
emits?: E | EE[];
|
|
@@ -750,11 +990,28 @@ export declare function defineComponent<Props extends Record<string, any>, E ext
|
|
|
750
990
|
emits?: E | EE[];
|
|
751
991
|
slots?: S;
|
|
752
992
|
}): DefineSetupFnComponent<Props, E, S>;
|
|
753
|
-
export declare function defineComponent<
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
993
|
+
export declare function defineComponent<TypeProps, RuntimePropsOptions extends ComponentObjectPropsOptions = ComponentObjectPropsOptions, RuntimePropsKeys extends string = string, TypeEmits extends ComponentTypeEmits = {}, RuntimeEmitsOptions extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Data = {}, SetupBindings = {}, Computed extends ComputedOptions = {}, Methods extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, InjectOptions extends ComponentInjectOptions = {}, InjectKeys extends string = string, Slots extends SlotsType = {}, LocalComponents extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, ResolvedEmits extends EmitsOptions = {} extends RuntimeEmitsOptions ? TypeEmitsToOptions<TypeEmits> : RuntimeEmitsOptions, InferredProps = unknown extends TypeProps ? string extends RuntimePropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : {
|
|
994
|
+
[key in RuntimePropsKeys]?: any;
|
|
995
|
+
} : TypeProps, TypeRefs extends Record<string, unknown> = {}, TypeEl extends Element = any>(options: {
|
|
996
|
+
props?: (RuntimePropsOptions & ThisType<void>) | RuntimePropsKeys[];
|
|
997
|
+
/**
|
|
998
|
+
* @private for language-tools use only
|
|
999
|
+
*/
|
|
1000
|
+
__typeProps?: TypeProps;
|
|
1001
|
+
/**
|
|
1002
|
+
* @private for language-tools use only
|
|
1003
|
+
*/
|
|
1004
|
+
__typeEmits?: TypeEmits;
|
|
1005
|
+
/**
|
|
1006
|
+
* @private for language-tools use only
|
|
1007
|
+
*/
|
|
1008
|
+
__typeRefs?: TypeRefs;
|
|
1009
|
+
/**
|
|
1010
|
+
* @private for language-tools use only
|
|
1011
|
+
*/
|
|
1012
|
+
__typeEl?: TypeEl;
|
|
1013
|
+
} & ComponentOptionsBase<ToResolvedProps<InferredProps, ResolvedEmits>, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, RuntimeEmitsKeys, {}, // Defaults
|
|
1014
|
+
InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<ToResolvedProps<InferredProps, ResolvedEmits>, SetupBindings, Data, Computed, Methods, Mixin, Extends, ResolvedEmits, RuntimeEmitsKeys, {}, false, InjectOptions, Slots, LocalComponents, Directives, Exposed>>): DefineComponent<InferredProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, ResolvedEmits, RuntimeEmitsKeys, PublicProps, ToResolvedProps<InferredProps, ResolvedEmits>, ExtractDefaultPropTypes<RuntimePropsOptions>, Slots, LocalComponents, Directives, Exposed, Provide, unknown extends TypeProps ? true : false, TypeRefs, TypeEl>;
|
|
758
1015
|
|
|
759
1016
|
export interface App<HostElement = any> {
|
|
760
1017
|
version: string;
|
|
@@ -763,11 +1020,24 @@ export interface App<HostElement = any> {
|
|
|
763
1020
|
use<Options>(plugin: Plugin<Options>, options: Options): this;
|
|
764
1021
|
mixin(mixin: ComponentOptions): this;
|
|
765
1022
|
component(name: string): Component | undefined;
|
|
766
|
-
component(name: string, component:
|
|
767
|
-
directive<
|
|
768
|
-
directive<
|
|
769
|
-
mount(rootContainer: HostElement | string,
|
|
1023
|
+
component<T extends Component | DefineComponent>(name: string, component: T): this;
|
|
1024
|
+
directive<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string>(name: string): Directive<HostElement, Value, Modifiers, Arg> | undefined;
|
|
1025
|
+
directive<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string>(name: string, directive: Directive<HostElement, Value, Modifiers, Arg>): this;
|
|
1026
|
+
mount(rootContainer: HostElement | string,
|
|
1027
|
+
/**
|
|
1028
|
+
* @internal
|
|
1029
|
+
*/
|
|
1030
|
+
isHydrate?: boolean,
|
|
1031
|
+
/**
|
|
1032
|
+
* @internal
|
|
1033
|
+
*/
|
|
1034
|
+
namespace?: boolean | ElementNamespace,
|
|
1035
|
+
/**
|
|
1036
|
+
* @internal
|
|
1037
|
+
*/
|
|
1038
|
+
vnode?: VNode): ComponentPublicInstance;
|
|
770
1039
|
unmount(): void;
|
|
1040
|
+
onUnmount(cb: () => void): void;
|
|
771
1041
|
provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): this;
|
|
772
1042
|
/**
|
|
773
1043
|
* Runs a function with the app as active instance. This allows using of `inject()` within the function to get access
|
|
@@ -810,6 +1080,16 @@ export interface AppConfig {
|
|
|
810
1080
|
* Enable warnings for computed getters that recursively trigger itself.
|
|
811
1081
|
*/
|
|
812
1082
|
warnRecursiveComputed?: boolean;
|
|
1083
|
+
/**
|
|
1084
|
+
* Whether to throw unhandled errors in production.
|
|
1085
|
+
* Default is `false` to avoid crashing on any error (and only logs it)
|
|
1086
|
+
* But in some cases, e.g. SSR, throwing might be more desirable.
|
|
1087
|
+
*/
|
|
1088
|
+
throwUnhandledErrorInProduction?: boolean;
|
|
1089
|
+
/**
|
|
1090
|
+
* Prefix for all useId() calls within this app
|
|
1091
|
+
*/
|
|
1092
|
+
idPrefix?: string;
|
|
813
1093
|
}
|
|
814
1094
|
export interface AppContext {
|
|
815
1095
|
app: App;
|
|
@@ -831,6 +1111,7 @@ type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
|
|
|
831
1111
|
export interface TeleportProps {
|
|
832
1112
|
to: string | RendererElement | null | undefined;
|
|
833
1113
|
disabled?: boolean;
|
|
1114
|
+
defer?: boolean;
|
|
834
1115
|
}
|
|
835
1116
|
declare const TeleportImpl: {
|
|
836
1117
|
name: string;
|
|
@@ -848,13 +1129,13 @@ declare enum TeleportMoveTypes {
|
|
|
848
1129
|
declare function moveTeleport(vnode: VNode, container: RendererElement, parentAnchor: RendererNode | null, { o: { insert }, m: move }: RendererInternals, moveType?: TeleportMoveTypes): void;
|
|
849
1130
|
declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector, insert, createText }, }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
|
|
850
1131
|
export declare const Teleport: {
|
|
1132
|
+
__isTeleport: true;
|
|
851
1133
|
new (): {
|
|
852
1134
|
$props: VNodeProps & TeleportProps;
|
|
853
1135
|
$slots: {
|
|
854
1136
|
default(): VNode[];
|
|
855
1137
|
};
|
|
856
1138
|
};
|
|
857
|
-
__isTeleport: true;
|
|
858
1139
|
};
|
|
859
1140
|
|
|
860
1141
|
/**
|
|
@@ -872,10 +1153,10 @@ export declare function resolveDynamicComponent(component: unknown): VNodeTypes;
|
|
|
872
1153
|
export declare function resolveDirective(name: string): Directive | undefined;
|
|
873
1154
|
|
|
874
1155
|
export declare const Fragment: {
|
|
1156
|
+
__isFragment: true;
|
|
875
1157
|
new (): {
|
|
876
1158
|
$props: VNodeProps;
|
|
877
1159
|
};
|
|
878
|
-
__isFragment: true;
|
|
879
1160
|
};
|
|
880
1161
|
export declare const Text: unique symbol;
|
|
881
1162
|
export declare const Comment: unique symbol;
|
|
@@ -982,9 +1263,7 @@ export declare function setBlockTracking(value: number): void;
|
|
|
982
1263
|
/**
|
|
983
1264
|
* @private
|
|
984
1265
|
*/
|
|
985
|
-
export declare function createElementBlock(type: string | typeof Fragment, props?: Record<string, any> | null, children?: any, patchFlag?: number, dynamicProps?: string[], shapeFlag?: number): VNode
|
|
986
|
-
[key: string]: any;
|
|
987
|
-
}>;
|
|
1266
|
+
export declare function createElementBlock(type: string | typeof Fragment, props?: Record<string, any> | null, children?: any, patchFlag?: number, dynamicProps?: string[], shapeFlag?: number): VNode;
|
|
988
1267
|
/**
|
|
989
1268
|
* Create a block root vnode. Takes the same exact arguments as `createVNode`.
|
|
990
1269
|
* A block root keeps track of dynamic nodes within the block in the
|
|
@@ -1002,9 +1281,7 @@ declare let vnodeArgsTransformer: ((args: Parameters<typeof _createVNode>, insta
|
|
|
1002
1281
|
* typings
|
|
1003
1282
|
*/
|
|
1004
1283
|
export declare function transformVNodeArgs(transformer?: typeof vnodeArgsTransformer): void;
|
|
1005
|
-
export declare function createBaseVNode(type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT, props?: (Data & VNodeProps) | null, children?: unknown, patchFlag?: number, dynamicProps?: string[] | null, shapeFlag?: number, isBlockNode?: boolean, needFullChildrenNormalization?: boolean): VNode
|
|
1006
|
-
[key: string]: any;
|
|
1007
|
-
}>;
|
|
1284
|
+
export declare function createBaseVNode(type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT, props?: (Data & VNodeProps) | null, children?: unknown, patchFlag?: number, dynamicProps?: string[] | null, shapeFlag?: number, isBlockNode?: boolean, needFullChildrenNormalization?: boolean): VNode;
|
|
1008
1285
|
|
|
1009
1286
|
export declare const createVNode: typeof _createVNode;
|
|
1010
1287
|
declare function _createVNode(type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT, props?: (Data & VNodeProps) | null, children?: unknown, patchFlag?: number, dynamicProps?: string[] | null, isBlockNode?: boolean): VNode;
|
|
@@ -1045,6 +1322,44 @@ export type ComponentInstance<T> = T extends {
|
|
|
1045
1322
|
*/
|
|
1046
1323
|
export interface ComponentCustomProps {
|
|
1047
1324
|
}
|
|
1325
|
+
/**
|
|
1326
|
+
* For globally defined Directives
|
|
1327
|
+
* Here is an example of adding a directive `VTooltip` as global directive:
|
|
1328
|
+
*
|
|
1329
|
+
* @example
|
|
1330
|
+
* ```ts
|
|
1331
|
+
* import VTooltip from 'v-tooltip'
|
|
1332
|
+
*
|
|
1333
|
+
* declare module '@vue/runtime-core' {
|
|
1334
|
+
* interface GlobalDirectives {
|
|
1335
|
+
* VTooltip
|
|
1336
|
+
* }
|
|
1337
|
+
* }
|
|
1338
|
+
* ```
|
|
1339
|
+
*/
|
|
1340
|
+
export interface GlobalDirectives {
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* For globally defined Components
|
|
1344
|
+
* Here is an example of adding a component `RouterView` as global component:
|
|
1345
|
+
*
|
|
1346
|
+
* @example
|
|
1347
|
+
* ```ts
|
|
1348
|
+
* import { RouterView } from 'vue-router'
|
|
1349
|
+
*
|
|
1350
|
+
* declare module '@vue/runtime-core' {
|
|
1351
|
+
* interface GlobalComponents {
|
|
1352
|
+
* RouterView
|
|
1353
|
+
* }
|
|
1354
|
+
* }
|
|
1355
|
+
* ```
|
|
1356
|
+
*/
|
|
1357
|
+
export interface GlobalComponents {
|
|
1358
|
+
Teleport: DefineComponent<TeleportProps>;
|
|
1359
|
+
Suspense: DefineComponent<SuspenseProps>;
|
|
1360
|
+
KeepAlive: DefineComponent<KeepAliveProps>;
|
|
1361
|
+
BaseTransition: DefineComponent<BaseTransitionProps>;
|
|
1362
|
+
}
|
|
1048
1363
|
/**
|
|
1049
1364
|
* Default allowed non-declared props on component in TSX
|
|
1050
1365
|
*/
|
|
@@ -1121,9 +1436,13 @@ export interface ComponentInternalInstance {
|
|
|
1121
1436
|
*/
|
|
1122
1437
|
effect: ReactiveEffect;
|
|
1123
1438
|
/**
|
|
1124
|
-
*
|
|
1439
|
+
* Force update render effect
|
|
1125
1440
|
*/
|
|
1126
|
-
update:
|
|
1441
|
+
update: () => void;
|
|
1442
|
+
/**
|
|
1443
|
+
* Render effect job to be passed to scheduler (checks if dirty)
|
|
1444
|
+
*/
|
|
1445
|
+
job: SchedulerJob;
|
|
1127
1446
|
proxy: ComponentPublicInstance | null;
|
|
1128
1447
|
exposed: Record<string, any> | null;
|
|
1129
1448
|
exposeProxy: Record<string, any> | null;
|
|
@@ -1145,32 +1464,45 @@ export declare const setCurrentInstance: (instance: ComponentInternalInstance) =
|
|
|
1145
1464
|
*/
|
|
1146
1465
|
export declare function registerRuntimeCompiler(_compile: any): void;
|
|
1147
1466
|
export declare const isRuntimeOnly: () => boolean;
|
|
1467
|
+
export interface ComponentCustomElementInterface {
|
|
1468
|
+
}
|
|
1148
1469
|
|
|
1149
|
-
export type WatchEffect = (onCleanup: OnCleanup) => void;
|
|
1150
|
-
export type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
|
|
1151
|
-
export type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
|
|
1152
1470
|
type MaybeUndefined<T, I> = I extends true ? T | undefined : T;
|
|
1153
1471
|
type MapSources<T, Immediate> = {
|
|
1154
1472
|
[K in keyof T]: T[K] extends WatchSource<infer V> ? MaybeUndefined<V, Immediate> : T[K] extends object ? MaybeUndefined<T[K], Immediate> : never;
|
|
1155
1473
|
};
|
|
1156
|
-
|
|
1157
|
-
export interface WatchOptionsBase extends DebuggerOptions {
|
|
1474
|
+
export interface WatchEffectOptions extends DebuggerOptions {
|
|
1158
1475
|
flush?: 'pre' | 'post' | 'sync';
|
|
1159
1476
|
}
|
|
1160
|
-
export interface WatchOptions<Immediate = boolean> extends
|
|
1477
|
+
export interface WatchOptions<Immediate = boolean> extends WatchEffectOptions {
|
|
1161
1478
|
immediate?: Immediate;
|
|
1162
|
-
deep?: boolean;
|
|
1479
|
+
deep?: boolean | number;
|
|
1163
1480
|
once?: boolean;
|
|
1164
1481
|
}
|
|
1165
|
-
export
|
|
1166
|
-
export declare function
|
|
1167
|
-
export declare function
|
|
1168
|
-
export
|
|
1169
|
-
|
|
1170
|
-
export declare function watch<T
|
|
1171
|
-
export declare function watch<T extends
|
|
1172
|
-
export declare function watch<T extends
|
|
1173
|
-
|
|
1482
|
+
export declare function watchEffect(effect: WatchEffect, options?: WatchEffectOptions): WatchHandle;
|
|
1483
|
+
export declare function watchPostEffect(effect: WatchEffect, options?: DebuggerOptions): WatchHandle;
|
|
1484
|
+
export declare function watchSyncEffect(effect: WatchEffect, options?: DebuggerOptions): WatchHandle;
|
|
1485
|
+
export type MultiWatchSources = (WatchSource<unknown> | object)[];
|
|
1486
|
+
export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
|
|
1487
|
+
export declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(sources: readonly [...T] | T, cb: [T] extends [ReactiveMarker] ? WatchCallback<T, MaybeUndefined<T, Immediate>> : WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
|
|
1488
|
+
export declare function watch<T extends MultiWatchSources, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
|
|
1489
|
+
export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* A lazy hydration strategy for async components.
|
|
1493
|
+
* @param hydrate - call this to perform the actual hydration.
|
|
1494
|
+
* @param forEachElement - iterate through the root elements of the component's
|
|
1495
|
+
* non-hydrated DOM, accounting for possible fragments.
|
|
1496
|
+
* @returns a teardown function to be called if the async component is unmounted
|
|
1497
|
+
* before it is hydrated. This can be used to e.g. remove DOM event
|
|
1498
|
+
* listeners.
|
|
1499
|
+
*/
|
|
1500
|
+
export type HydrationStrategy = (hydrate: () => void, forEachElement: (cb: (el: Element) => any) => void) => (() => void) | void;
|
|
1501
|
+
export type HydrationStrategyFactory<Options> = (options?: Options) => HydrationStrategy;
|
|
1502
|
+
export declare const hydrateOnIdle: HydrationStrategyFactory<number>;
|
|
1503
|
+
export declare const hydrateOnVisible: HydrationStrategyFactory<IntersectionObserverInit>;
|
|
1504
|
+
export declare const hydrateOnMediaQuery: HydrationStrategyFactory<string>;
|
|
1505
|
+
export declare const hydrateOnInteraction: HydrationStrategyFactory<keyof HTMLElementEventMap | Array<keyof HTMLElementEventMap>>;
|
|
1174
1506
|
|
|
1175
1507
|
type AsyncComponentResolveResult<T = Component> = T | {
|
|
1176
1508
|
default: T;
|
|
@@ -1183,6 +1515,7 @@ export interface AsyncComponentOptions<T = any> {
|
|
|
1183
1515
|
delay?: number;
|
|
1184
1516
|
timeout?: number;
|
|
1185
1517
|
suspensible?: boolean;
|
|
1518
|
+
hydrate?: HydrationStrategy;
|
|
1186
1519
|
onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => any;
|
|
1187
1520
|
}
|
|
1188
1521
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
@@ -1190,202 +1523,11 @@ export declare function defineAsyncComponent<T extends Component = {
|
|
|
1190
1523
|
new (): ComponentPublicInstance;
|
|
1191
1524
|
}>(source: AsyncComponentLoader<T> | AsyncComponentOptions<T>): T;
|
|
1192
1525
|
|
|
1193
|
-
|
|
1194
|
-
* Vue `<script setup>` compiler macro for declaring component props. The
|
|
1195
|
-
* expected argument is the same as the component `props` option.
|
|
1196
|
-
*
|
|
1197
|
-
* Example runtime declaration:
|
|
1198
|
-
* ```js
|
|
1199
|
-
* // using Array syntax
|
|
1200
|
-
* const props = defineProps(['foo', 'bar'])
|
|
1201
|
-
* // using Object syntax
|
|
1202
|
-
* const props = defineProps({
|
|
1203
|
-
* foo: String,
|
|
1204
|
-
* bar: {
|
|
1205
|
-
* type: Number,
|
|
1206
|
-
* required: true
|
|
1207
|
-
* }
|
|
1208
|
-
* })
|
|
1209
|
-
* ```
|
|
1210
|
-
*
|
|
1211
|
-
* Equivalent type-based declaration:
|
|
1212
|
-
* ```ts
|
|
1213
|
-
* // will be compiled into equivalent runtime declarations
|
|
1214
|
-
* const props = defineProps<{
|
|
1215
|
-
* foo?: string
|
|
1216
|
-
* bar: number
|
|
1217
|
-
* }>()
|
|
1218
|
-
* ```
|
|
1219
|
-
*
|
|
1220
|
-
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
1221
|
-
*
|
|
1222
|
-
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1223
|
-
* output and should **not** be actually called at runtime.
|
|
1224
|
-
*/
|
|
1225
|
-
export declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
|
|
1226
|
-
[key in PropNames]?: any;
|
|
1227
|
-
}>>;
|
|
1228
|
-
export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
|
|
1229
|
-
export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
|
|
1230
|
-
export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
|
|
1231
|
-
readonly [K in BKeys]-?: boolean;
|
|
1232
|
-
};
|
|
1233
|
-
type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
|
|
1234
|
-
/**
|
|
1235
|
-
* Vue `<script setup>` compiler macro for declaring a component's emitted
|
|
1236
|
-
* events. The expected argument is the same as the component `emits` option.
|
|
1237
|
-
*
|
|
1238
|
-
* Example runtime declaration:
|
|
1239
|
-
* ```js
|
|
1240
|
-
* const emit = defineEmits(['change', 'update'])
|
|
1241
|
-
* ```
|
|
1242
|
-
*
|
|
1243
|
-
* Example type-based declaration:
|
|
1244
|
-
* ```ts
|
|
1245
|
-
* const emit = defineEmits<{
|
|
1246
|
-
* // <eventName>: <expected arguments>
|
|
1247
|
-
* change: []
|
|
1248
|
-
* update: [value: number] // named tuple syntax
|
|
1249
|
-
* }>()
|
|
1250
|
-
*
|
|
1251
|
-
* emit('change')
|
|
1252
|
-
* emit('update', 1)
|
|
1253
|
-
* ```
|
|
1254
|
-
*
|
|
1255
|
-
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1256
|
-
* output and should **not** be actually called at runtime.
|
|
1257
|
-
*
|
|
1258
|
-
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
1259
|
-
*/
|
|
1260
|
-
export declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
|
|
1261
|
-
export declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
|
|
1262
|
-
export declare function defineEmits<T extends ((...args: any[]) => any) | Record<string, any[]>>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
|
|
1263
|
-
type RecordToUnion<T extends Record<string, any>> = T[keyof T];
|
|
1264
|
-
type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
|
|
1265
|
-
[K in keyof T]: (evt: K, ...args: T[K]) => void;
|
|
1266
|
-
}>>;
|
|
1267
|
-
/**
|
|
1268
|
-
* Vue `<script setup>` compiler macro for declaring a component's exposed
|
|
1269
|
-
* instance properties when it is accessed by a parent component via template
|
|
1270
|
-
* refs.
|
|
1271
|
-
*
|
|
1272
|
-
* `<script setup>` components are closed by default - i.e. variables inside
|
|
1273
|
-
* the `<script setup>` scope is not exposed to parent unless explicitly exposed
|
|
1274
|
-
* via `defineExpose`.
|
|
1275
|
-
*
|
|
1276
|
-
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1277
|
-
* output and should **not** be actually called at runtime.
|
|
1278
|
-
*
|
|
1279
|
-
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
|
|
1280
|
-
*/
|
|
1281
|
-
export declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
|
|
1282
|
-
/**
|
|
1283
|
-
* Vue `<script setup>` compiler macro for declaring a component's additional
|
|
1284
|
-
* options. This should be used only for options that cannot be expressed via
|
|
1285
|
-
* Composition API - e.g. `inheritAttrs`.
|
|
1286
|
-
*
|
|
1287
|
-
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
|
|
1288
|
-
*/
|
|
1289
|
-
export declare function defineOptions<RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin>(options?: ComponentOptionsWithoutProps<{}, RawBindings, D, C, M, Mixin, Extends> & {
|
|
1290
|
-
emits?: undefined;
|
|
1291
|
-
expose?: undefined;
|
|
1292
|
-
slots?: undefined;
|
|
1293
|
-
}): void;
|
|
1294
|
-
export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
|
|
1295
|
-
export type ModelRef<T, M extends PropertyKey = string> = Ref<T> & [
|
|
1296
|
-
ModelRef<T, M>,
|
|
1297
|
-
Record<M, true | undefined>
|
|
1298
|
-
];
|
|
1299
|
-
type DefineModelOptions<T = any> = {
|
|
1300
|
-
get?: (v: T) => any;
|
|
1301
|
-
set?: (v: T) => any;
|
|
1302
|
-
};
|
|
1303
|
-
/**
|
|
1304
|
-
* Vue `<script setup>` compiler macro for declaring a
|
|
1305
|
-
* two-way binding prop that can be consumed via `v-model` from the parent
|
|
1306
|
-
* component. This will declare a prop with the same name and a corresponding
|
|
1307
|
-
* `update:propName` event.
|
|
1308
|
-
*
|
|
1309
|
-
* If the first argument is a string, it will be used as the prop name;
|
|
1310
|
-
* Otherwise the prop name will default to "modelValue". In both cases, you
|
|
1311
|
-
* can also pass an additional object which will be used as the prop's options.
|
|
1312
|
-
*
|
|
1313
|
-
* The returned ref behaves differently depending on whether the parent
|
|
1314
|
-
* provided the corresponding v-model props or not:
|
|
1315
|
-
* - If yes, the returned ref's value will always be in sync with the parent
|
|
1316
|
-
* prop.
|
|
1317
|
-
* - If not, the returned ref will behave like a normal local ref.
|
|
1318
|
-
*
|
|
1319
|
-
* @example
|
|
1320
|
-
* ```ts
|
|
1321
|
-
* // default model (consumed via `v-model`)
|
|
1322
|
-
* const modelValue = defineModel<string>()
|
|
1323
|
-
* modelValue.value = "hello"
|
|
1324
|
-
*
|
|
1325
|
-
* // default model with options
|
|
1326
|
-
* const modelValue = defineModel<string>({ required: true })
|
|
1327
|
-
*
|
|
1328
|
-
* // with specified name (consumed via `v-model:count`)
|
|
1329
|
-
* const count = defineModel<number>('count')
|
|
1330
|
-
* count.value++
|
|
1331
|
-
*
|
|
1332
|
-
* // with specified name and default value
|
|
1333
|
-
* const count = defineModel<number>('count', { default: 0 })
|
|
1334
|
-
* ```
|
|
1335
|
-
*/
|
|
1336
|
-
export declare function defineModel<T, M extends PropertyKey = string>(options: {
|
|
1337
|
-
required: true;
|
|
1338
|
-
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1339
|
-
export declare function defineModel<T, M extends PropertyKey = string>(options: {
|
|
1340
|
-
default: any;
|
|
1341
|
-
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1342
|
-
export declare function defineModel<T, M extends PropertyKey = string>(options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1343
|
-
export declare function defineModel<T, M extends PropertyKey = string>(name: string, options: {
|
|
1344
|
-
required: true;
|
|
1345
|
-
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1346
|
-
export declare function defineModel<T, M extends PropertyKey = string>(name: string, options: {
|
|
1347
|
-
default: any;
|
|
1348
|
-
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1349
|
-
export declare function defineModel<T, M extends PropertyKey = string>(name: string, options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1350
|
-
type NotUndefined<T> = T extends undefined ? never : T;
|
|
1351
|
-
type MappedOmit<T, K extends keyof any> = {
|
|
1352
|
-
[P in keyof T as P extends K ? never : P]: T[P];
|
|
1353
|
-
};
|
|
1354
|
-
type InferDefaults<T> = {
|
|
1355
|
-
[K in keyof T]?: InferDefault<T, T[K]>;
|
|
1356
|
-
};
|
|
1357
|
-
type NativeType = null | number | string | boolean | symbol | Function;
|
|
1358
|
-
type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
|
|
1359
|
-
type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<MappedOmit<T, keyof Defaults>> & {
|
|
1360
|
-
readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? IfAny<Defaults[K], NotUndefined<T[K]>, T[K]> : NotUndefined<T[K]> : never;
|
|
1361
|
-
} & {
|
|
1362
|
-
readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
|
|
1363
|
-
};
|
|
1364
|
-
/**
|
|
1365
|
-
* Vue `<script setup>` compiler macro for providing props default values when
|
|
1366
|
-
* using type-based `defineProps` declaration.
|
|
1367
|
-
*
|
|
1368
|
-
* Example usage:
|
|
1369
|
-
* ```ts
|
|
1370
|
-
* withDefaults(defineProps<{
|
|
1371
|
-
* size?: number
|
|
1372
|
-
* labels?: string[]
|
|
1373
|
-
* }>(), {
|
|
1374
|
-
* size: 3,
|
|
1375
|
-
* labels: () => ['default label']
|
|
1376
|
-
* })
|
|
1377
|
-
* ```
|
|
1378
|
-
*
|
|
1379
|
-
* This is only usable inside `<script setup>`, is compiled away in the output
|
|
1380
|
-
* and should **not** be actually called at runtime.
|
|
1381
|
-
*
|
|
1382
|
-
* @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
|
|
1383
|
-
*/
|
|
1384
|
-
export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
|
|
1385
|
-
export declare function useSlots(): SetupContext['slots'];
|
|
1386
|
-
export declare function useAttrs(): SetupContext['attrs'];
|
|
1526
|
+
export declare function useModel<M extends PropertyKey, T extends Record<string, any>, K extends keyof T, G = T[K], S = T[K]>(props: T, name: K, options?: DefineModelOptions<T[K], G, S>): ModelRef<T[K], M, G, S>;
|
|
1387
1527
|
|
|
1388
|
-
export declare function
|
|
1528
|
+
export declare function useTemplateRef<T = unknown, Keys extends string = string>(key: Keys): Readonly<ShallowRef<T | null>>;
|
|
1529
|
+
|
|
1530
|
+
export declare function useId(): string | undefined;
|
|
1389
1531
|
|
|
1390
1532
|
type RawProps = VNodeProps & {
|
|
1391
1533
|
__v_isVNode?: never;
|
|
@@ -1435,9 +1577,6 @@ declare function warn$1(msg: string, ...args: any[]): void;
|
|
|
1435
1577
|
export declare enum ErrorCodes {
|
|
1436
1578
|
SETUP_FUNCTION = 0,
|
|
1437
1579
|
RENDER_FUNCTION = 1,
|
|
1438
|
-
WATCH_GETTER = 2,
|
|
1439
|
-
WATCH_CALLBACK = 3,
|
|
1440
|
-
WATCH_CLEANUP = 4,
|
|
1441
1580
|
NATIVE_EVENT_HANDLER = 5,
|
|
1442
1581
|
COMPONENT_EVENT_HANDLER = 6,
|
|
1443
1582
|
VNODE_HOOK = 7,
|
|
@@ -1448,9 +1587,10 @@ export declare enum ErrorCodes {
|
|
|
1448
1587
|
FUNCTION_REF = 12,
|
|
1449
1588
|
ASYNC_COMPONENT_LOADER = 13,
|
|
1450
1589
|
SCHEDULER = 14,
|
|
1451
|
-
COMPONENT_UPDATE = 15
|
|
1590
|
+
COMPONENT_UPDATE = 15,
|
|
1591
|
+
APP_UNMOUNT_CLEANUP = 16
|
|
1452
1592
|
}
|
|
1453
|
-
type ErrorTypes = LifecycleHooks | ErrorCodes;
|
|
1593
|
+
type ErrorTypes = LifecycleHooks | ErrorCodes | WatchErrorCodes;
|
|
1454
1594
|
export declare function callWithErrorHandling(fn: Function, instance: ComponentInternalInstance | null | undefined, type: ErrorTypes, args?: unknown[]): any;
|
|
1455
1595
|
export declare function callWithAsyncErrorHandling(fn: Function | Function[], instance: ComponentInternalInstance | null, type: ErrorTypes, args?: unknown[]): any;
|
|
1456
1596
|
export declare function handleError(err: unknown, instance: ComponentInternalInstance | null | undefined, type: ErrorTypes, throwInDev?: boolean): void;
|
|
@@ -1556,9 +1696,7 @@ interface CompiledSlotDescriptor {
|
|
|
1556
1696
|
*/
|
|
1557
1697
|
export declare function createSlots(slots: Record<string, SSRSlot>, dynamicSlots: (CompiledSlotDescriptor | CompiledSlotDescriptor[] | undefined)[]): Record<string, SSRSlot>;
|
|
1558
1698
|
|
|
1559
|
-
export declare function withMemo(memo: any[], render: () => VNode<any, any>, cache: any[], index: number): VNode<any, any
|
|
1560
|
-
[key: string]: any;
|
|
1561
|
-
}>;
|
|
1699
|
+
export declare function withMemo(memo: any[], render: () => VNode<any, any>, cache: any[], index: number): VNode<any, any>;
|
|
1562
1700
|
export declare function isMemoSame(cached: VNode, memo: any[]): boolean;
|
|
1563
1701
|
|
|
1564
1702
|
export type LegacyConfig = {
|
|
@@ -1660,7 +1798,19 @@ declare module '@vue/reactivity' {
|
|
|
1660
1798
|
|
|
1661
1799
|
export declare const DeprecationTypes: typeof DeprecationTypes$1;
|
|
1662
1800
|
|
|
1663
|
-
export { createBaseVNode as createElementVNode, };
|
|
1801
|
+
export { type WatchEffectOptions as WatchOptionsBase, createBaseVNode as createElementVNode, };
|
|
1802
|
+
// Note: this file is auto concatenated to the end of the bundled d.ts during
|
|
1803
|
+
// build.
|
|
1804
|
+
|
|
1805
|
+
declare module '@vue/runtime-core' {
|
|
1806
|
+
export interface GlobalComponents {
|
|
1807
|
+
Teleport: DefineComponent<TeleportProps>
|
|
1808
|
+
Suspense: DefineComponent<SuspenseProps>
|
|
1809
|
+
KeepAlive: DefineComponent<KeepAliveProps>
|
|
1810
|
+
BaseTransition: DefineComponent<BaseTransitionProps>
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1664
1814
|
// Note: this file is auto concatenated to the end of the bundled d.ts during
|
|
1665
1815
|
// build.
|
|
1666
1816
|
type _defineProps = typeof defineProps
|