@vue/runtime-core 3.4.26 → 3.5.0-alpha.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/runtime-core.cjs.js +123 -94
- package/dist/runtime-core.cjs.prod.js +110 -80
- package/dist/runtime-core.d.ts +478 -399
- package/dist/runtime-core.esm-bundler.js +126 -97
- 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,
|
|
1
|
+
import { computed as computed$1, Ref, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions, ReactiveEffect, ComputedRef, DebuggerOptions, reactive } from '@vue/reactivity';
|
|
2
2
|
export { ComputedGetter, ComputedRef, ComputedSetter, CustomRefFactory, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, EffectScheduler, EffectScope, MaybeRef, MaybeRefOrGetter, Raw, 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, Awaited, UnionToIntersection,
|
|
3
|
+
import { IfAny, Prettify, Awaited, 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.
|
|
@@ -55,13 +62,320 @@ type SchedulerJobs = SchedulerJob | SchedulerJob[];
|
|
|
55
62
|
export declare function nextTick<T = void, R = void>(this: T, fn?: (this: T) => R): Promise<Awaited<R>>;
|
|
56
63
|
export declare function queuePostFlushCb(cb: SchedulerJobs): void;
|
|
57
64
|
|
|
65
|
+
export type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
|
|
66
|
+
export type ComponentObjectPropsOptions<P = Data> = {
|
|
67
|
+
[K in keyof P]: Prop<P[K]> | null;
|
|
68
|
+
};
|
|
69
|
+
export type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
|
|
70
|
+
type DefaultFactory<T> = (props: Data) => T | null | undefined;
|
|
71
|
+
interface PropOptions<T = any, D = T> {
|
|
72
|
+
type?: PropType<T> | true | null;
|
|
73
|
+
required?: boolean;
|
|
74
|
+
default?: D | DefaultFactory<D> | null | undefined | object;
|
|
75
|
+
validator?(value: unknown, props: Data): boolean;
|
|
76
|
+
}
|
|
77
|
+
export type PropType<T> = PropConstructor<T> | (PropConstructor<T> | null)[];
|
|
78
|
+
type PropConstructor<T = any> = {
|
|
79
|
+
new (...args: any[]): T & {};
|
|
80
|
+
} | {
|
|
81
|
+
(): T;
|
|
82
|
+
} | PropMethod<T>;
|
|
83
|
+
type PropMethod<T, TConstructor = any> = [T] extends [
|
|
84
|
+
((...args: any) => any) | undefined
|
|
85
|
+
] ? {
|
|
86
|
+
new (): TConstructor;
|
|
87
|
+
(): T;
|
|
88
|
+
readonly prototype: TConstructor;
|
|
89
|
+
} : never;
|
|
90
|
+
type RequiredKeys<T> = {
|
|
91
|
+
[K in keyof T]: T[K] extends {
|
|
92
|
+
required: true;
|
|
93
|
+
} | {
|
|
94
|
+
default: any;
|
|
95
|
+
} | BooleanConstructor | {
|
|
96
|
+
type: BooleanConstructor;
|
|
97
|
+
} ? T[K] extends {
|
|
98
|
+
default: undefined | (() => undefined);
|
|
99
|
+
} ? never : K : never;
|
|
100
|
+
}[keyof T];
|
|
101
|
+
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
|
102
|
+
type DefaultKeys<T> = {
|
|
103
|
+
[K in keyof T]: T[K] extends {
|
|
104
|
+
default: any;
|
|
105
|
+
} | BooleanConstructor | {
|
|
106
|
+
type: BooleanConstructor;
|
|
107
|
+
} ? T[K] extends {
|
|
108
|
+
type: BooleanConstructor;
|
|
109
|
+
required: true;
|
|
110
|
+
} ? never : K : never;
|
|
111
|
+
}[keyof T];
|
|
112
|
+
type InferPropType<T, NullAsAny = true> = [T] extends [null] ? NullAsAny extends true ? any : null : [T] extends [{
|
|
113
|
+
type: null | true;
|
|
114
|
+
}] ? any : [T] extends [ObjectConstructor | {
|
|
115
|
+
type: ObjectConstructor;
|
|
116
|
+
}] ? Record<string, any> : [T] extends [BooleanConstructor | {
|
|
117
|
+
type: BooleanConstructor;
|
|
118
|
+
}] ? boolean : [T] extends [DateConstructor | {
|
|
119
|
+
type: DateConstructor;
|
|
120
|
+
}] ? Date : [T] extends [(infer U)[] | {
|
|
121
|
+
type: (infer U)[];
|
|
122
|
+
}] ? 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;
|
|
123
|
+
/**
|
|
124
|
+
* Extract prop types from a runtime props options object.
|
|
125
|
+
* The extracted types are **internal** - i.e. the resolved props received by
|
|
126
|
+
* the component.
|
|
127
|
+
* - Boolean props are always present
|
|
128
|
+
* - Props with default values are always present
|
|
129
|
+
*
|
|
130
|
+
* To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
|
|
131
|
+
*/
|
|
132
|
+
export type ExtractPropTypes<O> = {
|
|
133
|
+
[K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
|
|
134
|
+
} & {
|
|
135
|
+
[K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
136
|
+
};
|
|
137
|
+
type PublicRequiredKeys<T> = {
|
|
138
|
+
[K in keyof T]: T[K] extends {
|
|
139
|
+
required: true;
|
|
140
|
+
} ? K : never;
|
|
141
|
+
}[keyof T];
|
|
142
|
+
type PublicOptionalKeys<T> = Exclude<keyof T, PublicRequiredKeys<T>>;
|
|
143
|
+
/**
|
|
144
|
+
* Extract prop types from a runtime props options object.
|
|
145
|
+
* The extracted types are **public** - i.e. the expected props that can be
|
|
146
|
+
* passed to component.
|
|
147
|
+
*/
|
|
148
|
+
export type ExtractPublicPropTypes<O> = {
|
|
149
|
+
[K in keyof Pick<O, PublicRequiredKeys<O>>]: InferPropType<O[K]>;
|
|
150
|
+
} & {
|
|
151
|
+
[K in keyof Pick<O, PublicOptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
152
|
+
};
|
|
153
|
+
export type ExtractDefaultPropTypes<O> = O extends object ? {
|
|
154
|
+
[K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
|
|
155
|
+
} : {};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Vue `<script setup>` compiler macro for declaring component props. The
|
|
159
|
+
* expected argument is the same as the component `props` option.
|
|
160
|
+
*
|
|
161
|
+
* Example runtime declaration:
|
|
162
|
+
* ```js
|
|
163
|
+
* // using Array syntax
|
|
164
|
+
* const props = defineProps(['foo', 'bar'])
|
|
165
|
+
* // using Object syntax
|
|
166
|
+
* const props = defineProps({
|
|
167
|
+
* foo: String,
|
|
168
|
+
* bar: {
|
|
169
|
+
* type: Number,
|
|
170
|
+
* required: true
|
|
171
|
+
* }
|
|
172
|
+
* })
|
|
173
|
+
* ```
|
|
174
|
+
*
|
|
175
|
+
* Equivalent type-based declaration:
|
|
176
|
+
* ```ts
|
|
177
|
+
* // will be compiled into equivalent runtime declarations
|
|
178
|
+
* const props = defineProps<{
|
|
179
|
+
* foo?: string
|
|
180
|
+
* bar: number
|
|
181
|
+
* }>()
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
184
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
185
|
+
*
|
|
186
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
187
|
+
* output and should **not** be actually called at runtime.
|
|
188
|
+
*/
|
|
189
|
+
export declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
|
|
190
|
+
[key in PropNames]?: any;
|
|
191
|
+
}>>;
|
|
192
|
+
export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
|
|
193
|
+
export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
|
|
194
|
+
export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
|
|
195
|
+
readonly [K in BKeys]-?: boolean;
|
|
196
|
+
};
|
|
197
|
+
type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
|
|
198
|
+
/**
|
|
199
|
+
* Vue `<script setup>` compiler macro for declaring a component's emitted
|
|
200
|
+
* events. The expected argument is the same as the component `emits` option.
|
|
201
|
+
*
|
|
202
|
+
* Example runtime declaration:
|
|
203
|
+
* ```js
|
|
204
|
+
* const emit = defineEmits(['change', 'update'])
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* Example type-based declaration:
|
|
208
|
+
* ```ts
|
|
209
|
+
* const emit = defineEmits<{
|
|
210
|
+
* // <eventName>: <expected arguments>
|
|
211
|
+
* change: []
|
|
212
|
+
* update: [value: string] // named tuple syntax
|
|
213
|
+
* }>()
|
|
214
|
+
*
|
|
215
|
+
* emit('change')
|
|
216
|
+
* emit('update', 1)
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
220
|
+
* output and should **not** be actually called at runtime.
|
|
221
|
+
*
|
|
222
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
223
|
+
*/
|
|
224
|
+
export declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
|
|
225
|
+
export declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
|
|
226
|
+
export declare function defineEmits<T extends ComponentTypeEmits>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
|
|
227
|
+
export type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any[]>;
|
|
228
|
+
type RecordToUnion<T extends Record<string, any>> = T[keyof T];
|
|
229
|
+
type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
|
|
230
|
+
[K in keyof T]: (evt: K, ...args: T[K]) => void;
|
|
231
|
+
}>>;
|
|
232
|
+
/**
|
|
233
|
+
* Vue `<script setup>` compiler macro for declaring a component's exposed
|
|
234
|
+
* instance properties when it is accessed by a parent component via template
|
|
235
|
+
* refs.
|
|
236
|
+
*
|
|
237
|
+
* `<script setup>` components are closed by default - i.e. variables inside
|
|
238
|
+
* the `<script setup>` scope is not exposed to parent unless explicitly exposed
|
|
239
|
+
* via `defineExpose`.
|
|
240
|
+
*
|
|
241
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
242
|
+
* output and should **not** be actually called at runtime.
|
|
243
|
+
*
|
|
244
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
|
|
245
|
+
*/
|
|
246
|
+
export declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
|
|
247
|
+
/**
|
|
248
|
+
* Vue `<script setup>` compiler macro for declaring a component's additional
|
|
249
|
+
* options. This should be used only for options that cannot be expressed via
|
|
250
|
+
* Composition API - e.g. `inheritAttrs`.
|
|
251
|
+
*
|
|
252
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
|
|
253
|
+
*/
|
|
254
|
+
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, {}> & {
|
|
255
|
+
/**
|
|
256
|
+
* props should be defined via defineProps().
|
|
257
|
+
*/
|
|
258
|
+
props: never;
|
|
259
|
+
/**
|
|
260
|
+
* emits should be defined via defineEmits().
|
|
261
|
+
*/
|
|
262
|
+
emits?: never;
|
|
263
|
+
/**
|
|
264
|
+
* expose should be defined via defineExpose().
|
|
265
|
+
*/
|
|
266
|
+
expose?: never;
|
|
267
|
+
/**
|
|
268
|
+
* slots should be defined via defineSlots().
|
|
269
|
+
*/
|
|
270
|
+
slots?: never;
|
|
271
|
+
}): void;
|
|
272
|
+
export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
|
|
273
|
+
export type ModelRef<T, M extends string | number | symbol = string> = Ref<T> & [
|
|
274
|
+
ModelRef<T, M>,
|
|
275
|
+
Record<M, true | undefined>
|
|
276
|
+
];
|
|
277
|
+
type DefineModelOptions<T = any> = {
|
|
278
|
+
get?: (v: T) => any;
|
|
279
|
+
set?: (v: T) => any;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Vue `<script setup>` compiler macro for declaring a
|
|
283
|
+
* two-way binding prop that can be consumed via `v-model` from the parent
|
|
284
|
+
* component. This will declare a prop with the same name and a corresponding
|
|
285
|
+
* `update:propName` event.
|
|
286
|
+
*
|
|
287
|
+
* If the first argument is a string, it will be used as the prop name;
|
|
288
|
+
* Otherwise the prop name will default to "modelValue". In both cases, you
|
|
289
|
+
* can also pass an additional object which will be used as the prop's options.
|
|
290
|
+
*
|
|
291
|
+
* The returned ref behaves differently depending on whether the parent
|
|
292
|
+
* provided the corresponding v-model props or not:
|
|
293
|
+
* - If yes, the returned ref's value will always be in sync with the parent
|
|
294
|
+
* prop.
|
|
295
|
+
* - If not, the returned ref will behave like a normal local ref.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* // default model (consumed via `v-model`)
|
|
300
|
+
* const modelValue = defineModel<string>()
|
|
301
|
+
* modelValue.value = "hello"
|
|
302
|
+
*
|
|
303
|
+
* // default model with options
|
|
304
|
+
* const modelValue = defineModel<string>({ required: true })
|
|
305
|
+
*
|
|
306
|
+
* // with specified name (consumed via `v-model:count`)
|
|
307
|
+
* const count = defineModel<number>('count')
|
|
308
|
+
* count.value++
|
|
309
|
+
*
|
|
310
|
+
* // with specified name and default value
|
|
311
|
+
* const count = defineModel<number>('count', { default: 0 })
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
315
|
+
required: true;
|
|
316
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
317
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
318
|
+
default: any;
|
|
319
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
320
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
321
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
322
|
+
required: true;
|
|
323
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
324
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
325
|
+
default: any;
|
|
326
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
327
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
328
|
+
type NotUndefined<T> = T extends undefined ? never : T;
|
|
329
|
+
type MappedOmit<T, K extends keyof any> = {
|
|
330
|
+
[P in keyof T as P extends K ? never : P]: T[P];
|
|
331
|
+
};
|
|
332
|
+
type InferDefaults<T> = {
|
|
333
|
+
[K in keyof T]?: InferDefault<T, T[K]>;
|
|
334
|
+
};
|
|
335
|
+
type NativeType = null | number | string | boolean | symbol | Function;
|
|
336
|
+
type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
|
|
337
|
+
type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<MappedOmit<T, keyof Defaults>> & {
|
|
338
|
+
readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
|
|
339
|
+
} & {
|
|
340
|
+
readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
|
|
341
|
+
};
|
|
342
|
+
/**
|
|
343
|
+
* Vue `<script setup>` compiler macro for providing props default values when
|
|
344
|
+
* using type-based `defineProps` declaration.
|
|
345
|
+
*
|
|
346
|
+
* Example usage:
|
|
347
|
+
* ```ts
|
|
348
|
+
* withDefaults(defineProps<{
|
|
349
|
+
* size?: number
|
|
350
|
+
* labels?: string[]
|
|
351
|
+
* }>(), {
|
|
352
|
+
* size: 3,
|
|
353
|
+
* labels: () => ['default label']
|
|
354
|
+
* })
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
357
|
+
* This is only usable inside `<script setup>`, is compiled away in the output
|
|
358
|
+
* and should **not** be actually called at runtime.
|
|
359
|
+
*
|
|
360
|
+
* @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
|
|
361
|
+
*/
|
|
362
|
+
export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
|
|
363
|
+
export declare function useSlots(): SetupContext['slots'];
|
|
364
|
+
export declare function useAttrs(): SetupContext['attrs'];
|
|
365
|
+
|
|
58
366
|
export type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
|
|
59
367
|
export type EmitsOptions = ObjectEmitsOptions | string[];
|
|
60
|
-
type EmitsToProps<T extends EmitsOptions> = T extends string[] ? {
|
|
368
|
+
export type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? {
|
|
61
369
|
[K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
|
|
62
370
|
} : T extends ObjectEmitsOptions ? {
|
|
63
371
|
[K in `on${Capitalize<string & keyof T>}`]?: K extends `on${infer C}` ? (...args: T[Uncapitalize<C>] extends (...args: infer P) => any ? P : T[Uncapitalize<C>] extends null ? any[] : never) => any : never;
|
|
64
372
|
} : {};
|
|
373
|
+
type TypeEmitsToOptions<T extends ComponentTypeEmits> = T extends Record<string, any[]> ? {
|
|
374
|
+
[K in keyof T]: T[K] extends [...args: infer Args] ? (...args: Args) => any : () => any;
|
|
375
|
+
} : T extends (...args: any[]) => any ? ParametersToFns<OverloadParameters<T>> : {};
|
|
376
|
+
type ParametersToFns<T extends any[]> = {
|
|
377
|
+
[K in T[0]]: K extends `${infer C}` ? (...args: T extends [C, ...infer Args] ? Args : never) => any : never;
|
|
378
|
+
};
|
|
65
379
|
type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
|
|
66
380
|
[K in keyof E]: (...args: E[K]) => any;
|
|
67
381
|
} : E;
|
|
@@ -69,6 +383,49 @@ type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Op
|
|
|
69
383
|
[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;
|
|
70
384
|
}[Event]>;
|
|
71
385
|
|
|
386
|
+
/**
|
|
387
|
+
Runtime helper for applying directives to a vnode. Example usage:
|
|
388
|
+
|
|
389
|
+
const comp = resolveComponent('comp')
|
|
390
|
+
const foo = resolveDirective('foo')
|
|
391
|
+
const bar = resolveDirective('bar')
|
|
392
|
+
|
|
393
|
+
return withDirectives(h(comp), [
|
|
394
|
+
[foo, this.x],
|
|
395
|
+
[bar, this.y]
|
|
396
|
+
])
|
|
397
|
+
*/
|
|
398
|
+
|
|
399
|
+
export interface DirectiveBinding<Value = any, Modifiers extends string = string, Arg extends string = string> {
|
|
400
|
+
instance: ComponentPublicInstance | null;
|
|
401
|
+
value: Value;
|
|
402
|
+
oldValue: Value | null;
|
|
403
|
+
arg?: Arg;
|
|
404
|
+
modifiers: DirectiveModifiers<Modifiers>;
|
|
405
|
+
dir: ObjectDirective<any, Value>;
|
|
406
|
+
}
|
|
407
|
+
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;
|
|
408
|
+
type SSRDirectiveHook = (binding: DirectiveBinding, vnode: VNode) => Data | undefined;
|
|
409
|
+
export interface ObjectDirective<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string> {
|
|
410
|
+
created?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
411
|
+
beforeMount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
412
|
+
mounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
413
|
+
beforeUpdate?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
|
|
414
|
+
updated?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
|
|
415
|
+
beforeUnmount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
416
|
+
unmounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
417
|
+
getSSRProps?: SSRDirectiveHook;
|
|
418
|
+
deep?: boolean;
|
|
419
|
+
}
|
|
420
|
+
export type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg extends string = string> = DirectiveHook<HostElement, any, V, Modifiers, Arg>;
|
|
421
|
+
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>;
|
|
422
|
+
type DirectiveModifiers<K extends string = string> = Record<K, boolean>;
|
|
423
|
+
export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string, DirectiveModifiers]>;
|
|
424
|
+
/**
|
|
425
|
+
* Adds directives to a VNode.
|
|
426
|
+
*/
|
|
427
|
+
export declare function withDirectives<T extends VNode>(vnode: T, directives: DirectiveArguments): T;
|
|
428
|
+
|
|
72
429
|
/**
|
|
73
430
|
* Custom properties added to component instances in any way and can be accessed through `this`
|
|
74
431
|
*
|
|
@@ -97,7 +454,7 @@ type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Op
|
|
|
97
454
|
export interface ComponentCustomProperties {
|
|
98
455
|
}
|
|
99
456
|
type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin ? ComponentOptionsMixin extends T ? true : false : false;
|
|
100
|
-
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;
|
|
457
|
+
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;
|
|
101
458
|
type ExtractMixin<T> = {
|
|
102
459
|
Mixin: MixinToOptionTypes<T>;
|
|
103
460
|
}[T extends ComponentOptionsMixin ? 'Mixin' : never];
|
|
@@ -110,11 +467,12 @@ type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props,
|
|
|
110
467
|
__isSuspense?: never;
|
|
111
468
|
new (...args: any[]): T;
|
|
112
469
|
};
|
|
113
|
-
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
|
|
470
|
+
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 = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, 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>, Provide extends ComponentProvideOptions = ComponentProvideOptions> = 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>;
|
|
471
|
+
type ExposedKeys<T, Exposed extends string & keyof T> = '' extends Exposed ? T : Pick<T, Exposed>;
|
|
114
472
|
export type ComponentPublicInstance<P = {}, // props type extracted from props option
|
|
115
473
|
B = {}, // raw bindings returned from setup()
|
|
116
474
|
D = {}, // return from data()
|
|
117
|
-
C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}> = {
|
|
475
|
+
C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = P, 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 = ''> = {
|
|
118
476
|
$: ComponentInternalInstance;
|
|
119
477
|
$data: D;
|
|
120
478
|
$props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
|
|
@@ -129,7 +487,7 @@ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOpt
|
|
|
129
487
|
$forceUpdate: () => void;
|
|
130
488
|
$nextTick: typeof nextTick;
|
|
131
489
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R]) => any : (...args: any) => any, options?: WatchOptions): WatchStopHandle;
|
|
132
|
-
} & IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>;
|
|
490
|
+
} & ExposedKeys<IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>, Exposed>;
|
|
133
491
|
|
|
134
492
|
declare enum LifecycleHooks {
|
|
135
493
|
BEFORE_CREATE = "bc",
|
|
@@ -354,168 +712,33 @@ export declare function createHydrationRenderer(options: RendererOptions<Node, E
|
|
|
354
712
|
type MatchPattern = string | RegExp | (string | RegExp)[];
|
|
355
713
|
export interface KeepAliveProps {
|
|
356
714
|
include?: MatchPattern;
|
|
357
|
-
exclude?: MatchPattern;
|
|
358
|
-
max?: number | string;
|
|
359
|
-
}
|
|
360
|
-
export declare const KeepAlive: {
|
|
361
|
-
new (): {
|
|
362
|
-
$props: VNodeProps & KeepAliveProps;
|
|
363
|
-
$slots: {
|
|
364
|
-
default(): VNode[];
|
|
365
|
-
};
|
|
366
|
-
};
|
|
367
|
-
__isKeepAlive: true;
|
|
368
|
-
};
|
|
369
|
-
export declare function onActivated(hook: Function, target?: ComponentInternalInstance | null): void;
|
|
370
|
-
export declare function onDeactivated(hook: Function, target?: ComponentInternalInstance | null): void;
|
|
371
|
-
|
|
372
|
-
export declare const onBeforeMount: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
373
|
-
export declare const onMounted: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
374
|
-
export declare const onBeforeUpdate: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
375
|
-
export declare const onUpdated: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
376
|
-
export declare const onBeforeUnmount: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
377
|
-
export declare const onUnmounted: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
378
|
-
export declare const onServerPrefetch: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
379
|
-
type DebuggerHook = (e: DebuggerEvent) => void;
|
|
380
|
-
export declare const onRenderTriggered: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
381
|
-
export declare const onRenderTracked: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
382
|
-
type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
|
|
383
|
-
export declare function onErrorCaptured<TError = Error>(hook: ErrorCapturedHook<TError>, target?: ComponentInternalInstance | null): void;
|
|
384
|
-
|
|
385
|
-
export type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
|
|
386
|
-
export type ComponentObjectPropsOptions<P = Data> = {
|
|
387
|
-
[K in keyof P]: Prop<P[K]> | null;
|
|
388
|
-
};
|
|
389
|
-
export type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
|
|
390
|
-
type DefaultFactory<T> = (props: Data) => T | null | undefined;
|
|
391
|
-
interface PropOptions<T = any, D = T> {
|
|
392
|
-
type?: PropType<T> | true | null;
|
|
393
|
-
required?: boolean;
|
|
394
|
-
default?: D | DefaultFactory<D> | null | undefined | object;
|
|
395
|
-
validator?(value: unknown, props: Data): boolean;
|
|
396
|
-
}
|
|
397
|
-
export type PropType<T> = PropConstructor<T> | PropConstructor<T>[];
|
|
398
|
-
type PropConstructor<T = any> = {
|
|
399
|
-
new (...args: any[]): T & {};
|
|
400
|
-
} | {
|
|
401
|
-
(): T;
|
|
402
|
-
} | PropMethod<T>;
|
|
403
|
-
type PropMethod<T, TConstructor = any> = [T] extends [
|
|
404
|
-
((...args: any) => any) | undefined
|
|
405
|
-
] ? {
|
|
406
|
-
new (): TConstructor;
|
|
407
|
-
(): T;
|
|
408
|
-
readonly prototype: TConstructor;
|
|
409
|
-
} : never;
|
|
410
|
-
type RequiredKeys<T> = {
|
|
411
|
-
[K in keyof T]: T[K] extends {
|
|
412
|
-
required: true;
|
|
413
|
-
} | {
|
|
414
|
-
default: any;
|
|
415
|
-
} | BooleanConstructor | {
|
|
416
|
-
type: BooleanConstructor;
|
|
417
|
-
} ? T[K] extends {
|
|
418
|
-
default: undefined | (() => undefined);
|
|
419
|
-
} ? never : K : never;
|
|
420
|
-
}[keyof T];
|
|
421
|
-
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
|
422
|
-
type DefaultKeys<T> = {
|
|
423
|
-
[K in keyof T]: T[K] extends {
|
|
424
|
-
default: any;
|
|
425
|
-
} | BooleanConstructor | {
|
|
426
|
-
type: BooleanConstructor;
|
|
427
|
-
} ? T[K] extends {
|
|
428
|
-
type: BooleanConstructor;
|
|
429
|
-
required: true;
|
|
430
|
-
} ? never : K : never;
|
|
431
|
-
}[keyof T];
|
|
432
|
-
type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
|
|
433
|
-
type: null | true;
|
|
434
|
-
}] ? any : [T] extends [ObjectConstructor | {
|
|
435
|
-
type: ObjectConstructor;
|
|
436
|
-
}] ? Record<string, any> : [T] extends [BooleanConstructor | {
|
|
437
|
-
type: BooleanConstructor;
|
|
438
|
-
}] ? boolean : [T] extends [DateConstructor | {
|
|
439
|
-
type: DateConstructor;
|
|
440
|
-
}] ? Date : [T] extends [(infer U)[] | {
|
|
441
|
-
type: (infer U)[];
|
|
442
|
-
}] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
|
|
443
|
-
/**
|
|
444
|
-
* Extract prop types from a runtime props options object.
|
|
445
|
-
* The extracted types are **internal** - i.e. the resolved props received by
|
|
446
|
-
* the component.
|
|
447
|
-
* - Boolean props are always present
|
|
448
|
-
* - Props with default values are always present
|
|
449
|
-
*
|
|
450
|
-
* To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
|
|
451
|
-
*/
|
|
452
|
-
export type ExtractPropTypes<O> = {
|
|
453
|
-
[K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
|
|
454
|
-
} & {
|
|
455
|
-
[K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
456
|
-
};
|
|
457
|
-
type PublicRequiredKeys<T> = {
|
|
458
|
-
[K in keyof T]: T[K] extends {
|
|
459
|
-
required: true;
|
|
460
|
-
} ? K : never;
|
|
461
|
-
}[keyof T];
|
|
462
|
-
type PublicOptionalKeys<T> = Exclude<keyof T, PublicRequiredKeys<T>>;
|
|
463
|
-
/**
|
|
464
|
-
* Extract prop types from a runtime props options object.
|
|
465
|
-
* The extracted types are **public** - i.e. the expected props that can be
|
|
466
|
-
* passed to component.
|
|
467
|
-
*/
|
|
468
|
-
export type ExtractPublicPropTypes<O> = {
|
|
469
|
-
[K in keyof Pick<O, PublicRequiredKeys<O>>]: InferPropType<O[K]>;
|
|
470
|
-
} & {
|
|
471
|
-
[K in keyof Pick<O, PublicOptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
472
|
-
};
|
|
473
|
-
export type ExtractDefaultPropTypes<O> = O extends object ? {
|
|
474
|
-
[K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
|
|
475
|
-
} : {};
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
Runtime helper for applying directives to a vnode. Example usage:
|
|
479
|
-
|
|
480
|
-
const comp = resolveComponent('comp')
|
|
481
|
-
const foo = resolveDirective('foo')
|
|
482
|
-
const bar = resolveDirective('bar')
|
|
483
|
-
|
|
484
|
-
return withDirectives(h(comp), [
|
|
485
|
-
[foo, this.x],
|
|
486
|
-
[bar, this.y]
|
|
487
|
-
])
|
|
488
|
-
*/
|
|
489
|
-
|
|
490
|
-
export interface DirectiveBinding<V = any> {
|
|
491
|
-
instance: ComponentPublicInstance | null;
|
|
492
|
-
value: V;
|
|
493
|
-
oldValue: V | null;
|
|
494
|
-
arg?: string;
|
|
495
|
-
modifiers: DirectiveModifiers;
|
|
496
|
-
dir: ObjectDirective<any, V>;
|
|
497
|
-
}
|
|
498
|
-
export type DirectiveHook<T = any, Prev = VNode<any, T> | null, V = any> = (el: T, binding: DirectiveBinding<V>, vnode: VNode<any, T>, prevVNode: Prev) => void;
|
|
499
|
-
type SSRDirectiveHook = (binding: DirectiveBinding, vnode: VNode) => Data | undefined;
|
|
500
|
-
export interface ObjectDirective<T = any, V = any> {
|
|
501
|
-
created?: DirectiveHook<T, null, V>;
|
|
502
|
-
beforeMount?: DirectiveHook<T, null, V>;
|
|
503
|
-
mounted?: DirectiveHook<T, null, V>;
|
|
504
|
-
beforeUpdate?: DirectiveHook<T, VNode<any, T>, V>;
|
|
505
|
-
updated?: DirectiveHook<T, VNode<any, T>, V>;
|
|
506
|
-
beforeUnmount?: DirectiveHook<T, null, V>;
|
|
507
|
-
unmounted?: DirectiveHook<T, null, V>;
|
|
508
|
-
getSSRProps?: SSRDirectiveHook;
|
|
509
|
-
deep?: boolean;
|
|
715
|
+
exclude?: MatchPattern;
|
|
716
|
+
max?: number | string;
|
|
510
717
|
}
|
|
511
|
-
export
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
718
|
+
export declare const KeepAlive: {
|
|
719
|
+
new (): {
|
|
720
|
+
$props: VNodeProps & KeepAliveProps;
|
|
721
|
+
$slots: {
|
|
722
|
+
default(): VNode[];
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
__isKeepAlive: true;
|
|
726
|
+
};
|
|
727
|
+
export declare function onActivated(hook: Function, target?: ComponentInternalInstance | null): void;
|
|
728
|
+
export declare function onDeactivated(hook: Function, target?: ComponentInternalInstance | null): void;
|
|
729
|
+
|
|
730
|
+
export declare const onBeforeMount: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
731
|
+
export declare const onMounted: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
732
|
+
export declare const onBeforeUpdate: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
733
|
+
export declare const onUpdated: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
734
|
+
export declare const onBeforeUnmount: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
735
|
+
export declare const onUnmounted: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
736
|
+
export declare const onServerPrefetch: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
737
|
+
type DebuggerHook = (e: DebuggerEvent) => void;
|
|
738
|
+
export declare const onRenderTriggered: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
739
|
+
export declare const onRenderTracked: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => false | Function | undefined;
|
|
740
|
+
type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
|
|
741
|
+
export declare function onErrorCaptured<TError = Error>(hook: ErrorCapturedHook<TError>, target?: ComponentInternalInstance | null): void;
|
|
519
742
|
|
|
520
743
|
declare enum DeprecationTypes$1 {
|
|
521
744
|
GLOBAL_MOUNT = "GLOBAL_MOUNT",
|
|
@@ -585,17 +808,17 @@ declare function configureCompat(config: CompatConfig): void;
|
|
|
585
808
|
export interface ComponentCustomOptions {
|
|
586
809
|
}
|
|
587
810
|
export type RenderFunction = () => VNodeChild;
|
|
588
|
-
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 {
|
|
811
|
+
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 {
|
|
589
812
|
setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, 'P'>>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
|
|
590
813
|
name?: string;
|
|
591
814
|
template?: string | object;
|
|
592
815
|
render?: Function;
|
|
593
|
-
components?: Record<string, Component>;
|
|
594
|
-
directives?: Record<string, Directive>;
|
|
816
|
+
components?: LC & Record<string, Component>;
|
|
817
|
+
directives?: Directives & Record<string, Directive>;
|
|
595
818
|
inheritAttrs?: boolean;
|
|
596
819
|
emits?: (E | EE[]) & ThisType<void>;
|
|
597
820
|
slots?: S;
|
|
598
|
-
expose?:
|
|
821
|
+
expose?: Exposed[];
|
|
599
822
|
serverPrefetch?(): void | Promise<any>;
|
|
600
823
|
compilerOptions?: RuntimeCompilerOptions;
|
|
601
824
|
call?: (this: unknown, ...args: unknown[]) => never;
|
|
@@ -613,19 +836,8 @@ export interface RuntimeCompilerOptions {
|
|
|
613
836
|
comments?: boolean;
|
|
614
837
|
delimiters?: [string, string];
|
|
615
838
|
}
|
|
616
|
-
export type
|
|
617
|
-
|
|
618
|
-
} & ThisType<CreateComponentPublicInstance<PE, RawBindings, D, C, M, Mixin, Extends, E, PE, {}, false, I, S>>;
|
|
619
|
-
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<{
|
|
620
|
-
[key in PropNames]?: any;
|
|
621
|
-
} & EmitsToProps<E>>>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S> & {
|
|
622
|
-
props: PropNames[];
|
|
623
|
-
} & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, {}, false, I, S>>;
|
|
624
|
-
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> & {
|
|
625
|
-
props: PropsOptions & ThisType<void>;
|
|
626
|
-
} & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, Defaults, false, I, S>>;
|
|
627
|
-
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>>>;
|
|
628
|
-
export type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any>;
|
|
839
|
+
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<CreateComponentPublicInstance<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>, Defaults, false, I, S, LC, Directives>>;
|
|
840
|
+
export type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
629
841
|
export type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
|
|
630
842
|
export interface MethodOptions {
|
|
631
843
|
[key: string]: Function;
|
|
@@ -653,14 +865,14 @@ type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? {
|
|
|
653
865
|
} : T extends ObjectInjectOptions ? {
|
|
654
866
|
[K in keyof T]?: unknown;
|
|
655
867
|
} : never;
|
|
656
|
-
interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string> {
|
|
868
|
+
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> {
|
|
657
869
|
compatConfig?: CompatConfig;
|
|
658
870
|
[key: string]: any;
|
|
659
871
|
data?: (this: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
|
|
660
872
|
computed?: C;
|
|
661
873
|
methods?: M;
|
|
662
874
|
watch?: ComponentWatchOptions;
|
|
663
|
-
provide?:
|
|
875
|
+
provide?: Provide;
|
|
664
876
|
inject?: I | II[];
|
|
665
877
|
filters?: Record<string, Function>;
|
|
666
878
|
mixins?: Mixin[];
|
|
@@ -742,7 +954,7 @@ export declare function hasInjectionContext(): boolean;
|
|
|
742
954
|
|
|
743
955
|
export type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
744
956
|
type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
|
|
745
|
-
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<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults,
|
|
957
|
+
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> = ComponentPublicInstanceConstructor<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, MakeDefaultsOptional, {}, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, Provide> & PP;
|
|
746
958
|
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) => CreateComponentPublicInstance<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, E, PP, {}, false, {}, S>;
|
|
747
959
|
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'> & {
|
|
748
960
|
props?: (keyof Props)[];
|
|
@@ -754,11 +966,20 @@ export declare function defineComponent<Props extends Record<string, any>, E ext
|
|
|
754
966
|
emits?: E | EE[];
|
|
755
967
|
slots?: S;
|
|
756
968
|
}): DefineSetupFnComponent<Props, E, S>;
|
|
757
|
-
export declare function defineComponent<
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
969
|
+
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> : {
|
|
970
|
+
[key in RuntimePropsKeys]?: any;
|
|
971
|
+
} : TypeProps, ResolvedProps = Readonly<InferredProps & EmitsToProps<ResolvedEmits>>>(options: {
|
|
972
|
+
props?: (RuntimePropsOptions & ThisType<void>) | RuntimePropsKeys[];
|
|
973
|
+
/**
|
|
974
|
+
* @private for language-tools use only
|
|
975
|
+
*/
|
|
976
|
+
__typeProps?: TypeProps;
|
|
977
|
+
/**
|
|
978
|
+
* @private for language-tools use only
|
|
979
|
+
*/
|
|
980
|
+
__typeEmits?: TypeEmits;
|
|
981
|
+
} & ComponentOptionsBase<ResolvedProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, RuntimeEmitsKeys, {}, // Defaults
|
|
982
|
+
InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstance<ResolvedProps, 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, ResolvedProps, ExtractDefaultPropTypes<RuntimePropsOptions>, Slots, LocalComponents, Directives, Exposed, Provide, unknown extends TypeProps ? true : false>;
|
|
762
983
|
|
|
763
984
|
export interface App<HostElement = any> {
|
|
764
985
|
version: string;
|
|
@@ -1000,7 +1221,7 @@ export declare function createBaseVNode(type: VNodeTypes | ClassComponent | type
|
|
|
1000
1221
|
export declare const createVNode: typeof _createVNode;
|
|
1001
1222
|
declare function _createVNode(type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT, props?: (Data & VNodeProps) | null, children?: unknown, patchFlag?: number, dynamicProps?: string[] | null, isBlockNode?: boolean): VNode;
|
|
1002
1223
|
export declare function guardReactiveProps(props: (Data & VNodeProps) | null): (Data & VNodeProps) | null;
|
|
1003
|
-
export declare function cloneVNode<T, U>(vnode: VNode<T, U>, extraProps?: (Data & VNodeProps) | null, mergeRef?: boolean
|
|
1224
|
+
export declare function cloneVNode<T, U>(vnode: VNode<T, U>, extraProps?: (Data & VNodeProps) | null, mergeRef?: boolean): VNode<T, U>;
|
|
1004
1225
|
/**
|
|
1005
1226
|
* @private
|
|
1006
1227
|
*/
|
|
@@ -1036,6 +1257,44 @@ export type ComponentInstance<T> = T extends {
|
|
|
1036
1257
|
*/
|
|
1037
1258
|
export interface ComponentCustomProps {
|
|
1038
1259
|
}
|
|
1260
|
+
/**
|
|
1261
|
+
* For globally defined Directives
|
|
1262
|
+
* Here is an example of adding a directive `VTooltip` as global directive:
|
|
1263
|
+
*
|
|
1264
|
+
* @example
|
|
1265
|
+
* ```ts
|
|
1266
|
+
* import VTooltip from 'v-tooltip'
|
|
1267
|
+
*
|
|
1268
|
+
* declare module '@vue/runtime-core' {
|
|
1269
|
+
* interface GlobalDirectives {
|
|
1270
|
+
* VTooltip
|
|
1271
|
+
* }
|
|
1272
|
+
* }
|
|
1273
|
+
* ```
|
|
1274
|
+
*/
|
|
1275
|
+
export interface GlobalDirectives extends Record<string, Directive> {
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* For globally defined Components
|
|
1279
|
+
* Here is an example of adding a component `RouterView` as global component:
|
|
1280
|
+
*
|
|
1281
|
+
* @example
|
|
1282
|
+
* ```ts
|
|
1283
|
+
* import { RouterView } from 'vue-router'
|
|
1284
|
+
*
|
|
1285
|
+
* declare module '@vue/runtime-core' {
|
|
1286
|
+
* interface GlobalComponents {
|
|
1287
|
+
* RouterView
|
|
1288
|
+
* }
|
|
1289
|
+
* }
|
|
1290
|
+
* ```
|
|
1291
|
+
*/
|
|
1292
|
+
export interface GlobalComponents extends Record<string, Component> {
|
|
1293
|
+
Teleport: DefineComponent<TeleportProps>;
|
|
1294
|
+
Suspense: DefineComponent<SuspenseProps>;
|
|
1295
|
+
KeepAlive: DefineComponent<KeepAliveProps>;
|
|
1296
|
+
BaseTransition: DefineComponent<BaseTransitionProps>;
|
|
1297
|
+
}
|
|
1039
1298
|
/**
|
|
1040
1299
|
* Default allowed non-declared props on component in TSX
|
|
1041
1300
|
*/
|
|
@@ -1112,9 +1371,13 @@ export interface ComponentInternalInstance {
|
|
|
1112
1371
|
*/
|
|
1113
1372
|
effect: ReactiveEffect;
|
|
1114
1373
|
/**
|
|
1115
|
-
*
|
|
1374
|
+
* Force update render effect
|
|
1375
|
+
*/
|
|
1376
|
+
update: () => void;
|
|
1377
|
+
/**
|
|
1378
|
+
* Render effect job to be passed to scheduler (checks if dirty)
|
|
1116
1379
|
*/
|
|
1117
|
-
|
|
1380
|
+
job: SchedulerJob;
|
|
1118
1381
|
proxy: ComponentPublicInstance | null;
|
|
1119
1382
|
exposed: Record<string, any> | null;
|
|
1120
1383
|
exposeProxy: Record<string, any> | null;
|
|
@@ -1181,201 +1444,6 @@ export declare function defineAsyncComponent<T extends Component = {
|
|
|
1181
1444
|
new (): ComponentPublicInstance;
|
|
1182
1445
|
}>(source: AsyncComponentLoader<T> | AsyncComponentOptions<T>): T;
|
|
1183
1446
|
|
|
1184
|
-
/**
|
|
1185
|
-
* Vue `<script setup>` compiler macro for declaring component props. The
|
|
1186
|
-
* expected argument is the same as the component `props` option.
|
|
1187
|
-
*
|
|
1188
|
-
* Example runtime declaration:
|
|
1189
|
-
* ```js
|
|
1190
|
-
* // using Array syntax
|
|
1191
|
-
* const props = defineProps(['foo', 'bar'])
|
|
1192
|
-
* // using Object syntax
|
|
1193
|
-
* const props = defineProps({
|
|
1194
|
-
* foo: String,
|
|
1195
|
-
* bar: {
|
|
1196
|
-
* type: Number,
|
|
1197
|
-
* required: true
|
|
1198
|
-
* }
|
|
1199
|
-
* })
|
|
1200
|
-
* ```
|
|
1201
|
-
*
|
|
1202
|
-
* Equivalent type-based declaration:
|
|
1203
|
-
* ```ts
|
|
1204
|
-
* // will be compiled into equivalent runtime declarations
|
|
1205
|
-
* const props = defineProps<{
|
|
1206
|
-
* foo?: string
|
|
1207
|
-
* bar: number
|
|
1208
|
-
* }>()
|
|
1209
|
-
* ```
|
|
1210
|
-
*
|
|
1211
|
-
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
1212
|
-
*
|
|
1213
|
-
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1214
|
-
* output and should **not** be actually called at runtime.
|
|
1215
|
-
*/
|
|
1216
|
-
export declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
|
|
1217
|
-
[key in PropNames]?: any;
|
|
1218
|
-
}>>;
|
|
1219
|
-
export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
|
|
1220
|
-
export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
|
|
1221
|
-
export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
|
|
1222
|
-
readonly [K in BKeys]-?: boolean;
|
|
1223
|
-
};
|
|
1224
|
-
type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
|
|
1225
|
-
/**
|
|
1226
|
-
* Vue `<script setup>` compiler macro for declaring a component's emitted
|
|
1227
|
-
* events. The expected argument is the same as the component `emits` option.
|
|
1228
|
-
*
|
|
1229
|
-
* Example runtime declaration:
|
|
1230
|
-
* ```js
|
|
1231
|
-
* const emit = defineEmits(['change', 'update'])
|
|
1232
|
-
* ```
|
|
1233
|
-
*
|
|
1234
|
-
* Example type-based declaration:
|
|
1235
|
-
* ```ts
|
|
1236
|
-
* const emit = defineEmits<{
|
|
1237
|
-
* // <eventName>: <expected arguments>
|
|
1238
|
-
* change: []
|
|
1239
|
-
* update: [value: string] // named tuple syntax
|
|
1240
|
-
* }>()
|
|
1241
|
-
*
|
|
1242
|
-
* emit('change')
|
|
1243
|
-
* emit('update', 1)
|
|
1244
|
-
* ```
|
|
1245
|
-
*
|
|
1246
|
-
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1247
|
-
* output and should **not** be actually called at runtime.
|
|
1248
|
-
*
|
|
1249
|
-
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
1250
|
-
*/
|
|
1251
|
-
export declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
|
|
1252
|
-
export declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
|
|
1253
|
-
export declare function defineEmits<T extends ((...args: any[]) => any) | Record<string, any[]>>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
|
|
1254
|
-
type RecordToUnion<T extends Record<string, any>> = T[keyof T];
|
|
1255
|
-
type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
|
|
1256
|
-
[K in keyof T]: (evt: K, ...args: T[K]) => void;
|
|
1257
|
-
}>>;
|
|
1258
|
-
/**
|
|
1259
|
-
* Vue `<script setup>` compiler macro for declaring a component's exposed
|
|
1260
|
-
* instance properties when it is accessed by a parent component via template
|
|
1261
|
-
* refs.
|
|
1262
|
-
*
|
|
1263
|
-
* `<script setup>` components are closed by default - i.e. variables inside
|
|
1264
|
-
* the `<script setup>` scope is not exposed to parent unless explicitly exposed
|
|
1265
|
-
* via `defineExpose`.
|
|
1266
|
-
*
|
|
1267
|
-
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1268
|
-
* output and should **not** be actually called at runtime.
|
|
1269
|
-
*
|
|
1270
|
-
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
|
|
1271
|
-
*/
|
|
1272
|
-
export declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
|
|
1273
|
-
/**
|
|
1274
|
-
* Vue `<script setup>` compiler macro for declaring a component's additional
|
|
1275
|
-
* options. This should be used only for options that cannot be expressed via
|
|
1276
|
-
* Composition API - e.g. `inheritAttrs`.
|
|
1277
|
-
*
|
|
1278
|
-
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
|
|
1279
|
-
*/
|
|
1280
|
-
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> & {
|
|
1281
|
-
emits?: undefined;
|
|
1282
|
-
expose?: undefined;
|
|
1283
|
-
slots?: undefined;
|
|
1284
|
-
}): void;
|
|
1285
|
-
export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
|
|
1286
|
-
export type ModelRef<T, M extends string | number | symbol = string> = Ref<T> & [
|
|
1287
|
-
ModelRef<T, M>,
|
|
1288
|
-
Record<M, true | undefined>
|
|
1289
|
-
];
|
|
1290
|
-
type DefineModelOptions<T = any> = {
|
|
1291
|
-
get?: (v: T) => any;
|
|
1292
|
-
set?: (v: T) => any;
|
|
1293
|
-
};
|
|
1294
|
-
/**
|
|
1295
|
-
* Vue `<script setup>` compiler macro for declaring a
|
|
1296
|
-
* two-way binding prop that can be consumed via `v-model` from the parent
|
|
1297
|
-
* component. This will declare a prop with the same name and a corresponding
|
|
1298
|
-
* `update:propName` event.
|
|
1299
|
-
*
|
|
1300
|
-
* If the first argument is a string, it will be used as the prop name;
|
|
1301
|
-
* Otherwise the prop name will default to "modelValue". In both cases, you
|
|
1302
|
-
* can also pass an additional object which will be used as the prop's options.
|
|
1303
|
-
*
|
|
1304
|
-
* The returned ref behaves differently depending on whether the parent
|
|
1305
|
-
* provided the corresponding v-model props or not:
|
|
1306
|
-
* - If yes, the returned ref's value will always be in sync with the parent
|
|
1307
|
-
* prop.
|
|
1308
|
-
* - If not, the returned ref will behave like a normal local ref.
|
|
1309
|
-
*
|
|
1310
|
-
* @example
|
|
1311
|
-
* ```ts
|
|
1312
|
-
* // default model (consumed via `v-model`)
|
|
1313
|
-
* const modelValue = defineModel<string>()
|
|
1314
|
-
* modelValue.value = "hello"
|
|
1315
|
-
*
|
|
1316
|
-
* // default model with options
|
|
1317
|
-
* const modelValue = defineModel<string>({ required: true })
|
|
1318
|
-
*
|
|
1319
|
-
* // with specified name (consumed via `v-model:count`)
|
|
1320
|
-
* const count = defineModel<number>('count')
|
|
1321
|
-
* count.value++
|
|
1322
|
-
*
|
|
1323
|
-
* // with specified name and default value
|
|
1324
|
-
* const count = defineModel<number>('count', { default: 0 })
|
|
1325
|
-
* ```
|
|
1326
|
-
*/
|
|
1327
|
-
export declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
1328
|
-
required: true;
|
|
1329
|
-
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1330
|
-
export declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
1331
|
-
default: any;
|
|
1332
|
-
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1333
|
-
export declare function defineModel<T, M extends string | number | symbol = string>(options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1334
|
-
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
1335
|
-
required: true;
|
|
1336
|
-
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1337
|
-
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
1338
|
-
default: any;
|
|
1339
|
-
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1340
|
-
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1341
|
-
type NotUndefined<T> = T extends undefined ? never : T;
|
|
1342
|
-
type MappedOmit<T, K extends keyof any> = {
|
|
1343
|
-
[P in keyof T as P extends K ? never : P]: T[P];
|
|
1344
|
-
};
|
|
1345
|
-
type InferDefaults<T> = {
|
|
1346
|
-
[K in keyof T]?: InferDefault<T, T[K]>;
|
|
1347
|
-
};
|
|
1348
|
-
type NativeType = null | number | string | boolean | symbol | Function;
|
|
1349
|
-
type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
|
|
1350
|
-
type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<MappedOmit<T, keyof Defaults>> & {
|
|
1351
|
-
readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
|
|
1352
|
-
} & {
|
|
1353
|
-
readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
|
|
1354
|
-
};
|
|
1355
|
-
/**
|
|
1356
|
-
* Vue `<script setup>` compiler macro for providing props default values when
|
|
1357
|
-
* using type-based `defineProps` declaration.
|
|
1358
|
-
*
|
|
1359
|
-
* Example usage:
|
|
1360
|
-
* ```ts
|
|
1361
|
-
* withDefaults(defineProps<{
|
|
1362
|
-
* size?: number
|
|
1363
|
-
* labels?: string[]
|
|
1364
|
-
* }>(), {
|
|
1365
|
-
* size: 3,
|
|
1366
|
-
* labels: () => ['default label']
|
|
1367
|
-
* })
|
|
1368
|
-
* ```
|
|
1369
|
-
*
|
|
1370
|
-
* This is only usable inside `<script setup>`, is compiled away in the output
|
|
1371
|
-
* and should **not** be actually called at runtime.
|
|
1372
|
-
*
|
|
1373
|
-
* @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
|
|
1374
|
-
*/
|
|
1375
|
-
export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
|
|
1376
|
-
export declare function useSlots(): SetupContext['slots'];
|
|
1377
|
-
export declare function useAttrs(): SetupContext['attrs'];
|
|
1378
|
-
|
|
1379
1447
|
export declare function useModel<M extends string | number | symbol, T extends Record<string, any>, K extends keyof T>(props: T, name: K, options?: DefineModelOptions<T[K]>): ModelRef<T[K], M>;
|
|
1380
1448
|
|
|
1381
1449
|
type RawProps = VNodeProps & {
|
|
@@ -1603,8 +1671,7 @@ export type CompatVue = Pick<App, 'version' | 'component' | 'directive'> & {
|
|
|
1603
1671
|
version: string;
|
|
1604
1672
|
config: AppConfig & LegacyConfig;
|
|
1605
1673
|
nextTick: typeof nextTick;
|
|
1606
|
-
use
|
|
1607
|
-
use<Options>(plugin: Plugin<Options>, options: Options): CompatVue;
|
|
1674
|
+
use(plugin: Plugin, ...options: any[]): CompatVue;
|
|
1608
1675
|
mixin(mixin: ComponentOptions): CompatVue;
|
|
1609
1676
|
component(name: string): Component | undefined;
|
|
1610
1677
|
component(name: string, component: Component): CompatVue;
|
|
@@ -1651,6 +1718,18 @@ declare module '@vue/reactivity' {
|
|
|
1651
1718
|
export declare const DeprecationTypes: typeof DeprecationTypes$1;
|
|
1652
1719
|
|
|
1653
1720
|
export { createBaseVNode as createElementVNode, };
|
|
1721
|
+
// Note: this file is auto concatenated to the end of the bundled d.ts during
|
|
1722
|
+
// build.
|
|
1723
|
+
|
|
1724
|
+
declare module '@vue/runtime-core' {
|
|
1725
|
+
export interface GlobalComponents {
|
|
1726
|
+
Teleport: DefineComponent<TeleportProps>
|
|
1727
|
+
Suspense: DefineComponent<SuspenseProps>
|
|
1728
|
+
KeepAlive: DefineComponent<KeepAliveProps>
|
|
1729
|
+
BaseTransition: DefineComponent<BaseTransitionProps>
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1654
1733
|
// Note: this file is auto concatenated to the end of the bundled d.ts during
|
|
1655
1734
|
// build.
|
|
1656
1735
|
type _defineProps = typeof defineProps
|