wevu 1.1.4 → 1.2.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.
@@ -1,1320 +0,0 @@
1
- type Prettify<T> = {
2
- [K in keyof T]: T[K];
3
- } & {};
4
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
5
- type LooseRequired<T> = {
6
- [P in keyof (T & Required<T>)]: T[P];
7
- };
8
- type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
9
-
10
- declare enum TrackOpTypes {
11
- GET = "get",
12
- HAS = "has",
13
- ITERATE = "iterate"
14
- }
15
- declare enum TriggerOpTypes {
16
- SET = "set",
17
- ADD = "add",
18
- DELETE = "delete",
19
- CLEAR = "clear"
20
- }
21
-
22
- type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
23
- declare const ShallowReactiveMarker: unique symbol;
24
- type Primitive = string | number | boolean | bigint | symbol | undefined | null;
25
- type Builtin = Primitive | Function | Date | Error | RegExp;
26
-
27
- type EffectScheduler = (...args: any[]) => any;
28
- type DebuggerEvent = {
29
- effect: Subscriber;
30
- } & DebuggerEventExtraInfo;
31
- type DebuggerEventExtraInfo = {
32
- target: object;
33
- type: TrackOpTypes | TriggerOpTypes;
34
- key: any;
35
- newValue?: any;
36
- oldValue?: any;
37
- oldTarget?: Map<any, any> | Set<any>;
38
- };
39
- interface DebuggerOptions {
40
- onTrack?: (event: DebuggerEvent) => void;
41
- onTrigger?: (event: DebuggerEvent) => void;
42
- }
43
- interface ReactiveEffectOptions extends DebuggerOptions {
44
- scheduler?: EffectScheduler;
45
- allowRecurse?: boolean;
46
- onStop?: () => void;
47
- }
48
- /**
49
- * Subscriber is a type that tracks (or subscribes to) a list of deps.
50
- */
51
- interface Subscriber extends DebuggerOptions {
52
- }
53
- declare class ReactiveEffect<T = any> implements Subscriber, ReactiveEffectOptions {
54
- fn: () => T;
55
- scheduler?: EffectScheduler;
56
- onStop?: () => void;
57
- onTrack?: (event: DebuggerEvent) => void;
58
- onTrigger?: (event: DebuggerEvent) => void;
59
- constructor(fn: () => T);
60
- pause(): void;
61
- resume(): void;
62
- run(): T;
63
- stop(): void;
64
- trigger(): void;
65
- get dirty(): boolean;
66
- }
67
- type ComputedGetter<T> = (oldValue?: T) => T;
68
- type ComputedSetter<T> = (newValue: T) => void;
69
- interface WritableComputedOptions<T, S = T> {
70
- get: ComputedGetter<T>;
71
- set: ComputedSetter<S>;
72
- }
73
-
74
- declare const RefSymbol: unique symbol;
75
- declare const RawSymbol: unique symbol;
76
- interface Ref<T = any, S = T> {
77
- get value(): T;
78
- set value(_: S);
79
- /**
80
- * Type differentiator only.
81
- * We need this to be in public d.ts but don't want it to show up in IDE
82
- * autocomplete, so we use a private Symbol instead.
83
- */
84
- [RefSymbol]: true;
85
- }
86
- declare const ShallowRefMarker: unique symbol;
87
- type ShallowRef<T = any, S = T> = Ref<T, S> & {
88
- [ShallowRefMarker]?: true;
89
- };
90
- /**
91
- * This is a special exported interface for other packages to declare
92
- * additional types that should bail out for ref unwrapping. For example
93
- * \@vue/runtime-dom can declare it like so in its d.ts:
94
- *
95
- * ``` ts
96
- * declare module './reactivity' {
97
- * export interface RefUnwrapBailTypes {
98
- * runtimeDOMBailTypes: Node | Window
99
- * }
100
- * }
101
- * ```
102
- */
103
- interface RefUnwrapBailTypes {
104
- }
105
- type ShallowUnwrapRef<T> = {
106
- [K in keyof T]: DistributeRef<T[K]>;
107
- };
108
- type DistributeRef<T> = T extends Ref<infer V, unknown> ? V : T;
109
- type UnwrapRef<T> = T extends ShallowRef<infer V, unknown> ? V : T extends Ref<infer V, unknown> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
110
- type UnwrapRefSimple<T> = T extends Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
111
- [RawSymbol]?: true;
112
- } ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? {
113
- [K in keyof T]: UnwrapRefSimple<T[K]>;
114
- } : T extends object & {
115
- [ShallowReactiveMarker]?: never;
116
- } ? {
117
- [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
118
- } : T;
119
- type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
120
- type OnCleanup = (cleanupFn: () => void) => void;
121
- type WatchStopHandle = () => void;
122
-
123
- type Slot<T extends any = any> = (...args: IfAny<T, any[], [T] | (T extends undefined ? [] : never)>) => VNode[];
124
- type InternalSlots = {
125
- [name: string]: Slot | undefined;
126
- };
127
- type Slots = Readonly<InternalSlots>;
128
- declare const SlotSymbol: unique symbol;
129
- type SlotsType<T extends Record<string, any> = Record<string, any>> = {
130
- [SlotSymbol]?: T;
131
- };
132
- type StrictUnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<T> & T;
133
- type UnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<Prettify<{
134
- [K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? T[K] : Slot<T[K]>;
135
- }>>;
136
- type RawSlots = {
137
- [name: string]: unknown;
138
- $stable?: boolean;
139
- };
140
-
141
- declare enum SchedulerJobFlags {
142
- QUEUED = 1,
143
- PRE = 2,
144
- /**
145
- * Indicates whether the effect is allowed to recursively trigger itself
146
- * when managed by the scheduler.
147
- *
148
- * By default, a job cannot trigger itself because some built-in method calls,
149
- * e.g. Array.prototype.push actually performs reads as well (#1740) which
150
- * can lead to confusing infinite loops.
151
- * The allowed cases are component update functions and watch callbacks.
152
- * Component update functions may update child component props, which in turn
153
- * trigger flush: "pre" watch callbacks that mutates state that the parent
154
- * relies on (#1801). Watch callbacks doesn't track its dependencies so if it
155
- * triggers itself again, it's likely intentional and it is the user's
156
- * responsibility to perform recursive state mutation that eventually
157
- * stabilizes (#1727).
158
- */
159
- ALLOW_RECURSE = 4,
160
- DISPOSED = 8
161
- }
162
- interface SchedulerJob extends Function {
163
- id?: number;
164
- /**
165
- * flags can technically be undefined, but it can still be used in bitwise
166
- * operations just like 0.
167
- */
168
- flags?: SchedulerJobFlags;
169
- /**
170
- * Attached by renderer.ts when setting up a component's render effect
171
- * Used to obtain component information when reporting max recursive updates.
172
- */
173
- i?: ComponentInternalInstance;
174
- }
175
- declare function nextTick(): Promise<void>;
176
- declare function nextTick<T, R>(this: T, fn: (this: T) => R | Promise<R>): Promise<R>;
177
-
178
- type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
179
- type ComponentObjectPropsOptions<P = Data> = {
180
- [K in keyof P]: Prop<P[K]> | null;
181
- };
182
- type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
183
- type DefaultFactory<T> = (props: Data) => T | null | undefined;
184
- interface PropOptions<T = any, D = T> {
185
- type?: PropType<T> | true | null;
186
- required?: boolean;
187
- default?: D | DefaultFactory<D> | null | undefined | object;
188
- validator?(value: unknown, props: Data): boolean;
189
- }
190
- type PropType<T> = PropConstructor<T> | (PropConstructor<T> | null)[];
191
- type PropConstructor<T = any> = {
192
- new (...args: any[]): T & {};
193
- } | {
194
- (): T;
195
- } | PropMethod<T>;
196
- type PropMethod<T, TConstructor = any> = [T] extends [
197
- ((...args: any) => any) | undefined
198
- ] ? {
199
- new (): TConstructor;
200
- (): T;
201
- readonly prototype: TConstructor;
202
- } : never;
203
- type RequiredKeys<T> = {
204
- [K in keyof T]: T[K] extends {
205
- required: true;
206
- } | {
207
- default: any;
208
- } | BooleanConstructor | {
209
- type: BooleanConstructor;
210
- } ? T[K] extends {
211
- default: undefined | (() => undefined);
212
- } ? never : K : never;
213
- }[keyof T];
214
- type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
215
- type DefaultKeys<T> = {
216
- [K in keyof T]: T[K] extends {
217
- default: any;
218
- } | BooleanConstructor | {
219
- type: BooleanConstructor;
220
- } ? T[K] extends {
221
- type: BooleanConstructor;
222
- required: true;
223
- } ? never : K : never;
224
- }[keyof T];
225
- type InferPropType<T, NullAsAny = true> = [T] extends [null] ? NullAsAny extends true ? any : null : [T] extends [{
226
- type: null | true;
227
- }] ? any : [T] extends [ObjectConstructor | {
228
- type: ObjectConstructor;
229
- }] ? Record<string, any> : [T] extends [BooleanConstructor | {
230
- type: BooleanConstructor;
231
- }] ? boolean : [T] extends [DateConstructor | {
232
- type: DateConstructor;
233
- }] ? Date : [T] extends [(infer U)[] | {
234
- type: (infer U)[];
235
- }] ? U extends DateConstructor ? Date | InferPropType<U, false> : InferPropType<U, false> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? IfAny<V, V, D> : V : V : T;
236
- /**
237
- * Extract prop types from a runtime props options object.
238
- * The extracted types are **internal** - i.e. the resolved props received by
239
- * the component.
240
- * - Boolean props are always present
241
- * - Props with default values are always present
242
- *
243
- * To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
244
- */
245
- type ExtractPropTypes<O> = {
246
- [K in keyof Pick<O, RequiredKeys<O>>]: O[K] extends {
247
- default: any;
248
- } ? Exclude<InferPropType<O[K]>, undefined> : InferPropType<O[K]>;
249
- } & {
250
- [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
251
- };
252
- type ExtractDefaultPropTypes<O> = O extends object ? {
253
- [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
254
- } : {};
255
-
256
- /**
257
- * Vue `<script setup>` compiler macro for declaring component props. The
258
- * expected argument is the same as the component `props` option.
259
- *
260
- * Example runtime declaration:
261
- * ```js
262
- * // using Array syntax
263
- * const props = defineProps(['foo', 'bar'])
264
- * // using Object syntax
265
- * const props = defineProps({
266
- * foo: String,
267
- * bar: {
268
- * type: Number,
269
- * required: true
270
- * }
271
- * })
272
- * ```
273
- *
274
- * Equivalent type-based declaration:
275
- * ```ts
276
- * // will be compiled into equivalent runtime declarations
277
- * const props = defineProps<{
278
- * foo?: string
279
- * bar: number
280
- * }>()
281
- * ```
282
- *
283
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
284
- *
285
- * This is only usable inside `<script setup>`, is compiled away in the
286
- * output and should **not** be actually called at runtime.
287
- */
288
- declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
289
- [key in PropNames]?: any;
290
- }>>;
291
- declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
292
- declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
293
- type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
294
- readonly [K in BKeys]-?: boolean;
295
- };
296
- type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? T[K] extends boolean | undefined ? T[K] extends never | undefined ? never : K : never : never;
297
- /**
298
- * Vue `<script setup>` compiler macro for declaring a component's emitted
299
- * events. The expected argument is the same as the component `emits` option.
300
- *
301
- * Example runtime declaration:
302
- * ```js
303
- * const emit = defineEmits(['change', 'update'])
304
- * ```
305
- *
306
- * Example type-based declaration:
307
- * ```ts
308
- * const emit = defineEmits<{
309
- * // <eventName>: <expected arguments>
310
- * change: []
311
- * update: [value: number] // named tuple syntax
312
- * }>()
313
- *
314
- * emit('change')
315
- * emit('update', 1)
316
- * ```
317
- *
318
- * This is only usable inside `<script setup>`, is compiled away in the
319
- * output and should **not** be actually called at runtime.
320
- *
321
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
322
- */
323
- declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
324
- declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
325
- declare function defineEmits<T extends ComponentTypeEmits>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
326
- type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any>;
327
- type RecordToUnion<T extends Record<string, any>> = T[keyof T];
328
- type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
329
- [K in keyof T]: (evt: K, ...args: T[K]) => void;
330
- }>>;
331
- /**
332
- * Vue `<script setup>` compiler macro for declaring a component's exposed
333
- * instance properties when it is accessed by a parent component via template
334
- * refs.
335
- *
336
- * `<script setup>` components are closed by default - i.e. variables inside
337
- * the `<script setup>` scope is not exposed to parent unless explicitly exposed
338
- * via `defineExpose`.
339
- *
340
- * This is only usable inside `<script setup>`, is compiled away in the
341
- * output and should **not** be actually called at runtime.
342
- *
343
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
344
- */
345
- declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
346
- /**
347
- * Vue `<script setup>` compiler macro for declaring a component's additional
348
- * options. This should be used only for options that cannot be expressed via
349
- * Composition API - e.g. `inheritAttrs`.
350
- *
351
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
352
- */
353
- 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, {}> & {
354
- /**
355
- * props should be defined via defineProps().
356
- */
357
- props?: never;
358
- /**
359
- * emits should be defined via defineEmits().
360
- */
361
- emits?: never;
362
- /**
363
- * expose should be defined via defineExpose().
364
- */
365
- expose?: never;
366
- /**
367
- * slots should be defined via defineSlots().
368
- */
369
- slots?: never;
370
- }): void;
371
- declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
372
- type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<G, S> & [
373
- ModelRef<T, M, G, S>,
374
- Record<M, true | undefined>
375
- ];
376
- type DefineModelOptions<T = any, G = T, S = T> = {
377
- get?: (v: T) => G;
378
- set?: (v: S) => any;
379
- };
380
- /**
381
- * Vue `<script setup>` compiler macro for declaring a
382
- * two-way binding prop that can be consumed via `v-model` from the parent
383
- * component. This will declare a prop with the same name and a corresponding
384
- * `update:propName` event.
385
- *
386
- * If the first argument is a string, it will be used as the prop name;
387
- * Otherwise the prop name will default to "modelValue". In both cases, you
388
- * can also pass an additional object which will be used as the prop's options.
389
- *
390
- * The returned ref behaves differently depending on whether the parent
391
- * provided the corresponding v-model props or not:
392
- * - If yes, the returned ref's value will always be in sync with the parent
393
- * prop.
394
- * - If not, the returned ref will behave like a normal local ref.
395
- *
396
- * @example
397
- * ```ts
398
- * // default model (consumed via `v-model`)
399
- * const modelValue = defineModel<string>()
400
- * modelValue.value = "hello"
401
- *
402
- * // default model with options
403
- * const modelValue = defineModel<string>({ required: true })
404
- *
405
- * // with specified name (consumed via `v-model:count`)
406
- * const count = defineModel<number>('count')
407
- * count.value++
408
- *
409
- * // with specified name and default value
410
- * const count = defineModel<number>('count', { default: 0 })
411
- * ```
412
- */
413
- declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(options: ({
414
- default: any;
415
- } | {
416
- required: true;
417
- }) & PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T, M, G, S>;
418
- 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>;
419
- declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(name: string, options: ({
420
- default: any;
421
- } | {
422
- required: true;
423
- }) & PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T, M, G, S>;
424
- 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>;
425
- type NotUndefined<T> = T extends undefined ? never : T;
426
- type MappedOmit<T, K extends keyof any> = {
427
- [P in keyof T as P extends K ? never : P]: T[P];
428
- };
429
- type InferDefaults<T> = {
430
- [K in keyof T]?: InferDefault<T, T[K]>;
431
- };
432
- type NativeType = null | undefined | number | string | boolean | symbol | Function;
433
- type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
434
- type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = T extends unknown ? Readonly<MappedOmit<T, keyof Defaults>> & {
435
- 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;
436
- } & {
437
- readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
438
- } : never;
439
- /**
440
- * Vue `<script setup>` compiler macro for providing props default values when
441
- * using type-based `defineProps` declaration.
442
- *
443
- * Example usage:
444
- * ```ts
445
- * withDefaults(defineProps<{
446
- * size?: number
447
- * labels?: string[]
448
- * }>(), {
449
- * size: 3,
450
- * labels: () => ['default label']
451
- * })
452
- * ```
453
- *
454
- * This is only usable inside `<script setup>`, is compiled away in the output
455
- * and should **not** be actually called at runtime.
456
- *
457
- * @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
458
- */
459
- declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
460
-
461
- type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
462
- type EmitsOptions = ObjectEmitsOptions | string[];
463
- type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? {
464
- [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
465
- } : T extends ObjectEmitsOptions ? {
466
- [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;
467
- } : {};
468
- type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
469
- [K in keyof E]: (...args: E[K]) => any;
470
- } : E;
471
- 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<{
472
- [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;
473
- }[Event]>;
474
-
475
- /**
476
- Runtime helper for applying directives to a vnode. Example usage:
477
-
478
- const comp = resolveComponent('comp')
479
- const foo = resolveDirective('foo')
480
- const bar = resolveDirective('bar')
481
-
482
- return withDirectives(h(comp), [
483
- [foo, this.x],
484
- [bar, this.y]
485
- ])
486
- */
487
-
488
- interface DirectiveBinding<Value = any, Modifiers extends string = string, Arg = any> {
489
- instance: ComponentPublicInstance | Record<string, any> | null;
490
- value: Value;
491
- oldValue: Value | null;
492
- arg?: Arg;
493
- modifiers: DirectiveModifiers<Modifiers>;
494
- dir: ObjectDirective<any, Value, Modifiers, Arg>;
495
- }
496
- type DirectiveHook<HostElement = any, Prev = VNode<any, HostElement> | null, Value = any, Modifiers extends string = string, Arg = any> = (el: HostElement, binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode<any, HostElement>, prevVNode: Prev) => void;
497
- type SSRDirectiveHook<Value = any, Modifiers extends string = string, Arg = any> = (binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode) => Data | undefined;
498
- interface ObjectDirective<HostElement = any, Value = any, Modifiers extends string = string, Arg = any> {
499
- created?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
500
- beforeMount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
501
- mounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
502
- beforeUpdate?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
503
- updated?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
504
- beforeUnmount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
505
- unmounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
506
- getSSRProps?: SSRDirectiveHook<Value, Modifiers, Arg>;
507
- deep?: boolean;
508
- }
509
- type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg = any> = DirectiveHook<HostElement, any, V, Modifiers, Arg>;
510
- type Directive<HostElement = any, Value = any, Modifiers extends string = string, Arg = any> = ObjectDirective<HostElement, Value, Modifiers, Arg> | FunctionDirective<HostElement, Value, Modifiers, Arg>;
511
- type DirectiveModifiers<K extends string = string> = Partial<Record<K, boolean>>;
512
-
513
- /**
514
- * Custom properties added to component instances in any way and can be accessed through `this`
515
- *
516
- * @example
517
- * Here is an example of adding a property `$router` to every component instance:
518
- * ```ts
519
- * import { createApp } from 'vue'
520
- * import { Router, createRouter } from 'vue-router'
521
- *
522
- * declare module 'vue' {
523
- * interface ComponentCustomProperties {
524
- * $router: Router
525
- * }
526
- * }
527
- *
528
- * // effectively adding the router to every component instance
529
- * const app = createApp({})
530
- * const router = createRouter()
531
- * app.config.globalProperties.$router = router
532
- *
533
- * const vm = app.mount('#app')
534
- * // we can access the router from the instance
535
- * vm.$router.push('/')
536
- * ```
537
- */
538
- interface ComponentCustomProperties {
539
- }
540
- type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin ? ComponentOptionsMixin extends T ? true : false : false;
541
- 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;
542
- type ExtractMixin<T> = {
543
- Mixin: MixinToOptionTypes<T>;
544
- }[T extends ComponentOptionsMixin ? 'Mixin' : never];
545
- type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true ? OptionTypesType : UnionToIntersection<ExtractMixin<T>>;
546
- type UnwrapMixinsType<T, Type extends OptionTypesKeys> = T extends OptionTypesType ? T[Type] : never;
547
- type EnsureNonVoid<T> = T extends void ? {} : T;
548
- type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props, RawBindings, D, C, M> = ComponentPublicInstance<any>, Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = {
549
- __isFragment?: never;
550
- __isTeleport?: never;
551
- __isSuspense?: never;
552
- new (...args: any[]): T;
553
- };
554
- /**
555
- * This is the same as `CreateComponentPublicInstance` but adds local components,
556
- * global directives, exposed, and provide inference.
557
- * It changes the arguments order so that we don't need to repeat mixin
558
- * inference everywhere internally, but it has to be a new type to avoid
559
- * breaking types that relies on previous arguments order (#10842)
560
- */
561
- 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>;
562
- type ExposedKeys<T, Exposed extends string & keyof T> = '' extends Exposed ? T : Pick<T, Exposed>;
563
- type ComponentPublicInstance<P = {}, // props type extracted from props option
564
- B = {}, // raw bindings returned from setup()
565
- D = {}, // return from data()
566
- 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> = {
567
- $: ComponentInternalInstance;
568
- $data: D;
569
- $props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
570
- $attrs: Data;
571
- $refs: Data & TypeRefs;
572
- $slots: UnwrapSlotsType<S>;
573
- $root: ComponentPublicInstance | null;
574
- $parent: ComponentPublicInstance | null;
575
- $host: Element | null;
576
- $emit: EmitFn<E>;
577
- $el: TypeEl;
578
- $options: Options & MergedComponentOptionsOverride;
579
- $forceUpdate: () => void;
580
- $nextTick: typeof nextTick;
581
- $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;
582
- } & ExposedKeys<IfAny<P, P, Readonly<Defaults> & Omit<P, keyof ShallowUnwrapRef<B> | keyof Defaults>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>, Exposed>;
583
-
584
- interface SuspenseProps {
585
- onResolve?: () => void;
586
- onPending?: () => void;
587
- onFallback?: () => void;
588
- timeout?: string | number;
589
- /**
590
- * Allow suspense to be captured by parent suspense
591
- *
592
- * @default false
593
- */
594
- suspensible?: boolean;
595
- }
596
- declare const SuspenseImpl: {
597
- name: string;
598
- __isSuspense: boolean;
599
- process(n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals): void;
600
- hydrate: typeof hydrateSuspense;
601
- normalize: typeof normalizeSuspenseChildren;
602
- };
603
- declare const Suspense: {
604
- __isSuspense: true;
605
- new (): {
606
- $props: VNodeProps & SuspenseProps;
607
- $slots: {
608
- default(): VNode[];
609
- fallback(): VNode[];
610
- };
611
- };
612
- };
613
- interface SuspenseBoundary {
614
- vnode: VNode<RendererNode, RendererElement, SuspenseProps>;
615
- parent: SuspenseBoundary | null;
616
- parentComponent: ComponentInternalInstance | null;
617
- namespace: ElementNamespace;
618
- container: RendererElement;
619
- hiddenContainer: RendererElement;
620
- activeBranch: VNode | null;
621
- pendingBranch: VNode | null;
622
- deps: number;
623
- pendingId: number;
624
- timeout: number;
625
- isInFallback: boolean;
626
- isHydrating: boolean;
627
- isUnmounted: boolean;
628
- effects: Function[];
629
- resolve(force?: boolean, sync?: boolean): void;
630
- fallback(fallbackVNode: VNode): void;
631
- move(container: RendererElement, anchor: RendererNode | null, type: MoveType): void;
632
- next(): RendererNode | null;
633
- registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn, optimized: boolean): void;
634
- unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void;
635
- }
636
- declare function hydrateSuspense(node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, hydrateNode: (node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
637
- declare function normalizeSuspenseChildren(vnode: VNode): void;
638
-
639
- type Hook<T = () => void> = T | T[];
640
- interface BaseTransitionProps<HostElement = RendererElement> {
641
- mode?: 'in-out' | 'out-in' | 'default';
642
- appear?: boolean;
643
- persisted?: boolean;
644
- onBeforeEnter?: Hook<(el: HostElement) => void>;
645
- onEnter?: Hook<(el: HostElement, done: () => void) => void>;
646
- onAfterEnter?: Hook<(el: HostElement) => void>;
647
- onEnterCancelled?: Hook<(el: HostElement) => void>;
648
- onBeforeLeave?: Hook<(el: HostElement) => void>;
649
- onLeave?: Hook<(el: HostElement, done: () => void) => void>;
650
- onAfterLeave?: Hook<(el: HostElement) => void>;
651
- onLeaveCancelled?: Hook<(el: HostElement) => void>;
652
- onBeforeAppear?: Hook<(el: HostElement) => void>;
653
- onAppear?: Hook<(el: HostElement, done: () => void) => void>;
654
- onAfterAppear?: Hook<(el: HostElement) => void>;
655
- onAppearCancelled?: Hook<(el: HostElement) => void>;
656
- }
657
- interface TransitionHooks<HostElement = RendererElement> {
658
- mode: BaseTransitionProps['mode'];
659
- persisted: boolean;
660
- beforeEnter(el: HostElement): void;
661
- enter(el: HostElement): void;
662
- leave(el: HostElement, remove: () => void): void;
663
- clone(vnode: VNode): TransitionHooks<HostElement>;
664
- afterLeave?(): void;
665
- delayLeave?(el: HostElement, earlyRemove: () => void, delayedLeave: () => void): void;
666
- delayedLeave?(): void;
667
- }
668
- type ElementNamespace = 'svg' | 'mathml' | undefined;
669
- interface RendererOptions<HostNode = RendererNode, HostElement = RendererElement> {
670
- patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, namespace?: ElementNamespace, parentComponent?: ComponentInternalInstance | null): void;
671
- insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void;
672
- remove(el: HostNode): void;
673
- createElement(type: string, namespace?: ElementNamespace, isCustomizedBuiltIn?: string, vnodeProps?: (VNodeProps & {
674
- [key: string]: any;
675
- }) | null): HostElement;
676
- createText(text: string): HostNode;
677
- createComment(text: string): HostNode;
678
- setText(node: HostNode, text: string): void;
679
- setElementText(node: HostElement, text: string): void;
680
- parentNode(node: HostNode): HostElement | null;
681
- nextSibling(node: HostNode): HostNode | null;
682
- querySelector?(selector: string): HostElement | null;
683
- setScopeId?(el: HostElement, id: string): void;
684
- cloneNode?(node: HostNode): HostNode;
685
- insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, namespace: ElementNamespace, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
686
- }
687
- interface RendererNode {
688
- [key: string | symbol]: any;
689
- }
690
- interface RendererElement extends RendererNode {
691
- }
692
- interface RendererInternals<HostNode = RendererNode, HostElement = RendererElement> {
693
- p: PatchFn;
694
- um: UnmountFn;
695
- r: RemoveFn;
696
- m: MoveFn;
697
- mt: MountComponentFn;
698
- mc: MountChildrenFn;
699
- pc: PatchChildrenFn;
700
- pbc: PatchBlockChildrenFn;
701
- n: NextFn;
702
- o: RendererOptions<HostNode, HostElement>;
703
- }
704
- type PatchFn = (n1: VNode | null, // null means this is a mount
705
- n2: VNode, container: RendererElement, anchor?: RendererNode | null, parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, namespace?: ElementNamespace, slotScopeIds?: string[] | null, optimized?: boolean) => void;
706
- type MountChildrenFn = (children: VNodeArrayChildren, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, start?: number) => void;
707
- type PatchChildrenFn = (n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean) => void;
708
- type PatchBlockChildrenFn = (oldChildren: VNode[], newChildren: VNode[], fallbackContainer: RendererElement, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null) => void;
709
- type MoveFn = (vnode: VNode, container: RendererElement, anchor: RendererNode | null, type: MoveType, parentSuspense?: SuspenseBoundary | null) => void;
710
- type NextFn = (vnode: VNode) => RendererNode | null;
711
- type UnmountFn = (vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean) => void;
712
- type RemoveFn = (vnode: VNode) => void;
713
- type MountComponentFn = (initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
714
- type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
715
- declare enum MoveType {
716
- ENTER = 0,
717
- LEAVE = 1,
718
- REORDER = 2
719
- }
720
-
721
- type MatchPattern = string | RegExp | (string | RegExp)[];
722
- interface KeepAliveProps {
723
- include?: MatchPattern;
724
- exclude?: MatchPattern;
725
- max?: number | string;
726
- }
727
- type DebuggerHook = (e: DebuggerEvent) => void;
728
- type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
729
-
730
- declare enum DeprecationTypes$1 {
731
- GLOBAL_MOUNT = "GLOBAL_MOUNT",
732
- GLOBAL_MOUNT_CONTAINER = "GLOBAL_MOUNT_CONTAINER",
733
- GLOBAL_EXTEND = "GLOBAL_EXTEND",
734
- GLOBAL_PROTOTYPE = "GLOBAL_PROTOTYPE",
735
- GLOBAL_SET = "GLOBAL_SET",
736
- GLOBAL_DELETE = "GLOBAL_DELETE",
737
- GLOBAL_OBSERVABLE = "GLOBAL_OBSERVABLE",
738
- GLOBAL_PRIVATE_UTIL = "GLOBAL_PRIVATE_UTIL",
739
- CONFIG_SILENT = "CONFIG_SILENT",
740
- CONFIG_DEVTOOLS = "CONFIG_DEVTOOLS",
741
- CONFIG_KEY_CODES = "CONFIG_KEY_CODES",
742
- CONFIG_PRODUCTION_TIP = "CONFIG_PRODUCTION_TIP",
743
- CONFIG_IGNORED_ELEMENTS = "CONFIG_IGNORED_ELEMENTS",
744
- CONFIG_WHITESPACE = "CONFIG_WHITESPACE",
745
- CONFIG_OPTION_MERGE_STRATS = "CONFIG_OPTION_MERGE_STRATS",
746
- INSTANCE_SET = "INSTANCE_SET",
747
- INSTANCE_DELETE = "INSTANCE_DELETE",
748
- INSTANCE_DESTROY = "INSTANCE_DESTROY",
749
- INSTANCE_EVENT_EMITTER = "INSTANCE_EVENT_EMITTER",
750
- INSTANCE_EVENT_HOOKS = "INSTANCE_EVENT_HOOKS",
751
- INSTANCE_CHILDREN = "INSTANCE_CHILDREN",
752
- INSTANCE_LISTENERS = "INSTANCE_LISTENERS",
753
- INSTANCE_SCOPED_SLOTS = "INSTANCE_SCOPED_SLOTS",
754
- INSTANCE_ATTRS_CLASS_STYLE = "INSTANCE_ATTRS_CLASS_STYLE",
755
- OPTIONS_DATA_FN = "OPTIONS_DATA_FN",
756
- OPTIONS_DATA_MERGE = "OPTIONS_DATA_MERGE",
757
- OPTIONS_BEFORE_DESTROY = "OPTIONS_BEFORE_DESTROY",
758
- OPTIONS_DESTROYED = "OPTIONS_DESTROYED",
759
- WATCH_ARRAY = "WATCH_ARRAY",
760
- PROPS_DEFAULT_THIS = "PROPS_DEFAULT_THIS",
761
- V_ON_KEYCODE_MODIFIER = "V_ON_KEYCODE_MODIFIER",
762
- CUSTOM_DIR = "CUSTOM_DIR",
763
- ATTR_FALSE_VALUE = "ATTR_FALSE_VALUE",
764
- ATTR_ENUMERATED_COERCION = "ATTR_ENUMERATED_COERCION",
765
- TRANSITION_CLASSES = "TRANSITION_CLASSES",
766
- TRANSITION_GROUP_ROOT = "TRANSITION_GROUP_ROOT",
767
- COMPONENT_ASYNC = "COMPONENT_ASYNC",
768
- COMPONENT_FUNCTIONAL = "COMPONENT_FUNCTIONAL",
769
- COMPONENT_V_MODEL = "COMPONENT_V_MODEL",
770
- RENDER_FUNCTION = "RENDER_FUNCTION",
771
- FILTERS = "FILTERS",
772
- PRIVATE_APIS = "PRIVATE_APIS"
773
- }
774
- type CompatConfig = Partial<Record<DeprecationTypes$1, boolean | 'suppress-warning'>> & {
775
- MODE?: 2 | 3 | ((comp: Component | null) => 2 | 3);
776
- };
777
-
778
- /**
779
- * Interface for declaring custom options.
780
- *
781
- * @example
782
- * ```ts
783
- * declare module 'vue' {
784
- * interface ComponentCustomOptions {
785
- * beforeRouteUpdate?(
786
- * to: Route,
787
- * from: Route,
788
- * next: () => void
789
- * ): void
790
- * }
791
- * }
792
- * ```
793
- */
794
- interface ComponentCustomOptions {
795
- }
796
- type RenderFunction = () => VNodeChild;
797
- 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 {
798
- setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, 'P'>>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
799
- name?: string;
800
- template?: string | object;
801
- render?: Function;
802
- components?: LC & Record<string, Component>;
803
- directives?: Directives & Record<string, Directive>;
804
- inheritAttrs?: boolean;
805
- emits?: (E | EE[]) & ThisType<void>;
806
- slots?: S;
807
- expose?: Exposed[];
808
- serverPrefetch?(): void | Promise<any>;
809
- compilerOptions?: RuntimeCompilerOptions;
810
- call?: (this: unknown, ...args: unknown[]) => never;
811
- __isFragment?: never;
812
- __isTeleport?: never;
813
- __isSuspense?: never;
814
- __defaults?: Defaults;
815
- }
816
- /**
817
- * Subset of compiler options that makes sense for the runtime.
818
- */
819
- interface RuntimeCompilerOptions {
820
- isCustomElement?: (tag: string) => boolean;
821
- whitespace?: 'preserve' | 'condense';
822
- comments?: boolean;
823
- delimiters?: [string, string];
824
- }
825
- 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>>;
826
- type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
827
- type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
828
- interface MethodOptions {
829
- [key: string]: Function;
830
- }
831
- type ExtractComputedReturns<T extends any> = {
832
- [key in keyof T]: T[key] extends {
833
- get: (...args: any[]) => infer TReturn;
834
- } ? TReturn : T[key] extends (...args: any[]) => infer TReturn ? TReturn : never;
835
- };
836
- type ObjectWatchOptionItem = {
837
- handler: WatchCallback | string;
838
- } & WatchOptions;
839
- type WatchOptionItem = string | WatchCallback | ObjectWatchOptionItem;
840
- type ComponentWatchOptionItem = WatchOptionItem | WatchOptionItem[];
841
- type ComponentWatchOptions = Record<string, ComponentWatchOptionItem>;
842
- type ComponentProvideOptions = ObjectProvideOptions | Function;
843
- type ObjectProvideOptions = Record<string | symbol, unknown>;
844
- type ComponentInjectOptions = string[] | ObjectInjectOptions;
845
- type ObjectInjectOptions = Record<string | symbol, string | symbol | {
846
- from?: string | symbol;
847
- default?: unknown;
848
- }>;
849
- type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? {
850
- [K in T[number]]?: unknown;
851
- } : T extends ObjectInjectOptions ? {
852
- [K in keyof T]?: unknown;
853
- } : never;
854
- 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> {
855
- compatConfig?: CompatConfig;
856
- [key: string]: any;
857
- data?: (this: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
858
- computed?: C;
859
- methods?: M;
860
- watch?: ComponentWatchOptions;
861
- provide?: Provide;
862
- inject?: I | II[];
863
- filters?: Record<string, Function>;
864
- mixins?: Mixin[];
865
- extends?: Extends;
866
- beforeCreate?(): any;
867
- created?(): any;
868
- beforeMount?(): any;
869
- mounted?(): any;
870
- beforeUpdate?(): any;
871
- updated?(): any;
872
- activated?(): any;
873
- deactivated?(): any;
874
- /** @deprecated use `beforeUnmount` instead */
875
- beforeDestroy?(): any;
876
- beforeUnmount?(): any;
877
- /** @deprecated use `unmounted` instead */
878
- destroyed?(): any;
879
- unmounted?(): any;
880
- renderTracked?: DebuggerHook;
881
- renderTriggered?: DebuggerHook;
882
- errorCaptured?: ErrorCapturedHook;
883
- /**
884
- * runtime compile only
885
- * @deprecated use `compilerOptions.delimiters` instead.
886
- */
887
- delimiters?: [string, string];
888
- /**
889
- * #3468
890
- *
891
- * type-only, used to assist Mixin's type inference,
892
- * TypeScript will try to simplify the inferred `Mixin` type,
893
- * with the `__differentiator`, TypeScript won't be able to combine different mixins,
894
- * because the `__differentiator` will be different
895
- */
896
- __differentiator?: keyof D | keyof C | keyof M;
897
- }
898
- type MergedHook<T = () => void> = T | T[];
899
- type MergedComponentOptionsOverride = {
900
- beforeCreate?: MergedHook;
901
- created?: MergedHook;
902
- beforeMount?: MergedHook;
903
- mounted?: MergedHook;
904
- beforeUpdate?: MergedHook;
905
- updated?: MergedHook;
906
- activated?: MergedHook;
907
- deactivated?: MergedHook;
908
- /** @deprecated use `beforeUnmount` instead */
909
- beforeDestroy?: MergedHook;
910
- beforeUnmount?: MergedHook;
911
- /** @deprecated use `unmounted` instead */
912
- destroyed?: MergedHook;
913
- unmounted?: MergedHook;
914
- renderTracked?: MergedHook<DebuggerHook>;
915
- renderTriggered?: MergedHook<DebuggerHook>;
916
- errorCaptured?: MergedHook<ErrorCapturedHook>;
917
- };
918
- type OptionTypesKeys = 'P' | 'B' | 'D' | 'C' | 'M' | 'Defaults';
919
- type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Defaults = {}> = {
920
- P: P;
921
- B: B;
922
- D: D;
923
- C: C;
924
- M: M;
925
- Defaults: Defaults;
926
- };
927
-
928
- interface InjectionConstraint<T> {
929
- }
930
- type InjectionKey<T> = symbol & InjectionConstraint<T>;
931
-
932
- type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
933
- type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
934
- 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, 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;
935
-
936
- interface App<HostElement = any> {
937
- version: string;
938
- config: AppConfig;
939
- use<Options extends unknown[]>(plugin: Plugin<Options>, ...options: NoInfer<Options>): this;
940
- use<Options>(plugin: Plugin<Options>, options: NoInfer<Options>): this;
941
- mixin(mixin: ComponentOptions): this;
942
- component(name: string): Component | undefined;
943
- component<T extends Component | DefineComponent>(name: string, component: T): this;
944
- directive<HostElement = any, Value = any, Modifiers extends string = string, Arg = any>(name: string): Directive<HostElement, Value, Modifiers, Arg> | undefined;
945
- directive<HostElement = any, Value = any, Modifiers extends string = string, Arg = any>(name: string, directive: Directive<HostElement, Value, Modifiers, Arg>): this;
946
- mount(rootContainer: HostElement | string,
947
- /**
948
- * @internal
949
- */
950
- isHydrate?: boolean,
951
- /**
952
- * @internal
953
- */
954
- namespace?: boolean | ElementNamespace,
955
- /**
956
- * @internal
957
- */
958
- vnode?: VNode): ComponentPublicInstance;
959
- unmount(): void;
960
- onUnmount(cb: () => void): void;
961
- provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): this;
962
- /**
963
- * Runs a function with the app as active instance. This allows using of `inject()` within the function to get access
964
- * to variables provided via `app.provide()`.
965
- *
966
- * @param fn - function to run with the app as active instance
967
- */
968
- runWithContext<T>(fn: () => T): T;
969
- _uid: number;
970
- _component: ConcreteComponent;
971
- _props: Data | null;
972
- _container: HostElement | null;
973
- _context: AppContext;
974
- _instance: ComponentInternalInstance | null;
975
- /**
976
- * v2 compat only
977
- */
978
- filter?(name: string): Function | undefined;
979
- filter?(name: string, filter: Function): this;
980
- }
981
- type OptionMergeFunction = (to: unknown, from: unknown) => any;
982
- interface AppConfig {
983
- readonly isNativeTag: (tag: string) => boolean;
984
- performance: boolean;
985
- optionMergeStrategies: Record<string, OptionMergeFunction>;
986
- globalProperties: ComponentCustomProperties & Record<string, any>;
987
- errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void;
988
- warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void;
989
- /**
990
- * Options to pass to `@vue/compiler-dom`.
991
- * Only supported in runtime compiler build.
992
- */
993
- compilerOptions: RuntimeCompilerOptions;
994
- /**
995
- * @deprecated use config.compilerOptions.isCustomElement
996
- */
997
- isCustomElement?: (tag: string) => boolean;
998
- /**
999
- * TODO document for 3.5
1000
- * Enable warnings for computed getters that recursively trigger itself.
1001
- */
1002
- warnRecursiveComputed?: boolean;
1003
- /**
1004
- * Whether to throw unhandled errors in production.
1005
- * Default is `false` to avoid crashing on any error (and only logs it)
1006
- * But in some cases, e.g. SSR, throwing might be more desirable.
1007
- */
1008
- throwUnhandledErrorInProduction?: boolean;
1009
- /**
1010
- * Prefix for all useId() calls within this app
1011
- */
1012
- idPrefix?: string;
1013
- }
1014
- interface AppContext {
1015
- app: App;
1016
- config: AppConfig;
1017
- mixins: ComponentOptions[];
1018
- components: Record<string, Component>;
1019
- directives: Record<string, Directive>;
1020
- provides: Record<string | symbol, any>;
1021
- }
1022
- type PluginInstallFunction<Options = any[]> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any;
1023
- type ObjectPlugin<Options = any[]> = {
1024
- install: PluginInstallFunction<Options>;
1025
- };
1026
- type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>;
1027
- type Plugin<Options = any[], P extends unknown[] = Options extends unknown[] ? Options : [Options]> = FunctionPlugin<P> | ObjectPlugin<P>;
1028
-
1029
- type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
1030
- interface TeleportProps {
1031
- to: string | RendererElement | null | undefined;
1032
- disabled?: boolean;
1033
- defer?: boolean;
1034
- }
1035
- declare const TeleportImpl: {
1036
- name: string;
1037
- __isTeleport: boolean;
1038
- process(n1: TeleportVNode | null, n2: TeleportVNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, internals: RendererInternals): void;
1039
- remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void;
1040
- move: typeof moveTeleport;
1041
- hydrate: typeof hydrateTeleport;
1042
- };
1043
- declare enum TeleportMoveTypes {
1044
- TARGET_CHANGE = 0,
1045
- TOGGLE = 1,// enable / disable
1046
- REORDER = 2
1047
- }
1048
- declare function moveTeleport(vnode: VNode, container: RendererElement, parentAnchor: RendererNode | null, { o: { insert }, m: move }: RendererInternals, moveType?: TeleportMoveTypes): void;
1049
- 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;
1050
- declare const Teleport: {
1051
- __isTeleport: true;
1052
- new (): {
1053
- $props: VNodeProps & TeleportProps;
1054
- $slots: {
1055
- default(): VNode[];
1056
- };
1057
- };
1058
- };
1059
-
1060
- declare const Fragment: {
1061
- __isFragment: true;
1062
- new (): {
1063
- $props: VNodeProps;
1064
- };
1065
- };
1066
- declare const Text: unique symbol;
1067
- declare const Comment: unique symbol;
1068
- declare const Static: unique symbol;
1069
- type VNodeTypes = string | VNode | Component | typeof Text | typeof Static | typeof Comment | typeof Fragment | typeof Teleport | typeof TeleportImpl | typeof Suspense | typeof SuspenseImpl;
1070
- type VNodeRef = string | Ref | ((ref: Element | ComponentPublicInstance | null, refs: Record<string, any>) => void);
1071
- type VNodeNormalizedRefAtom = {
1072
- /**
1073
- * component instance
1074
- */
1075
- i: ComponentInternalInstance;
1076
- /**
1077
- * Actual ref
1078
- */
1079
- r: VNodeRef;
1080
- /**
1081
- * setup ref key
1082
- */
1083
- k?: string;
1084
- /**
1085
- * refInFor marker
1086
- */
1087
- f?: boolean;
1088
- };
1089
- type VNodeNormalizedRef = VNodeNormalizedRefAtom | VNodeNormalizedRefAtom[];
1090
- type VNodeMountHook = (vnode: VNode) => void;
1091
- type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void;
1092
- type VNodeProps = {
1093
- key?: PropertyKey;
1094
- ref?: VNodeRef;
1095
- ref_for?: boolean;
1096
- ref_key?: string;
1097
- onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[];
1098
- onVnodeMounted?: VNodeMountHook | VNodeMountHook[];
1099
- onVnodeBeforeUpdate?: VNodeUpdateHook | VNodeUpdateHook[];
1100
- onVnodeUpdated?: VNodeUpdateHook | VNodeUpdateHook[];
1101
- onVnodeBeforeUnmount?: VNodeMountHook | VNodeMountHook[];
1102
- onVnodeUnmounted?: VNodeMountHook | VNodeMountHook[];
1103
- };
1104
- type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void;
1105
- type VNodeArrayChildren = Array<VNodeArrayChildren | VNodeChildAtom>;
1106
- type VNodeChild = VNodeChildAtom | VNodeArrayChildren;
1107
- type VNodeNormalizedChildren = string | VNodeArrayChildren | RawSlots | null;
1108
- interface VNode<HostNode = RendererNode, HostElement = RendererElement, ExtraProps = {
1109
- [key: string]: any;
1110
- }> {
1111
- type: VNodeTypes;
1112
- props: (VNodeProps & ExtraProps) | null;
1113
- key: PropertyKey | null;
1114
- ref: VNodeNormalizedRef | null;
1115
- /**
1116
- * SFC only. This is assigned on vnode creation using currentScopeId
1117
- * which is set alongside currentRenderingInstance.
1118
- */
1119
- scopeId: string | null;
1120
- children: VNodeNormalizedChildren;
1121
- component: ComponentInternalInstance | null;
1122
- dirs: DirectiveBinding[] | null;
1123
- transition: TransitionHooks<HostElement> | null;
1124
- el: HostNode | null;
1125
- placeholder: HostNode | null;
1126
- anchor: HostNode | null;
1127
- target: HostElement | null;
1128
- targetStart: HostNode | null;
1129
- targetAnchor: HostNode | null;
1130
- suspense: SuspenseBoundary | null;
1131
- shapeFlag: number;
1132
- patchFlag: number;
1133
- appContext: AppContext | null;
1134
- }
1135
-
1136
- type Data = Record<string, unknown>;
1137
- /**
1138
- * For extending allowed non-declared props on components in TSX
1139
- */
1140
- interface ComponentCustomProps {
1141
- }
1142
- /**
1143
- * For globally defined Directives
1144
- * Here is an example of adding a directive `VTooltip` as global directive:
1145
- *
1146
- * @example
1147
- * ```ts
1148
- * import VTooltip from 'v-tooltip'
1149
- *
1150
- * declare module '@vue/runtime-core' {
1151
- * interface GlobalDirectives {
1152
- * VTooltip
1153
- * }
1154
- * }
1155
- * ```
1156
- */
1157
- interface GlobalDirectives {
1158
- }
1159
- /**
1160
- * For globally defined Components
1161
- * Here is an example of adding a component `RouterView` as global component:
1162
- *
1163
- * @example
1164
- * ```ts
1165
- * import { RouterView } from 'vue-router'
1166
- *
1167
- * declare module '@vue/runtime-core' {
1168
- * interface GlobalComponents {
1169
- * RouterView
1170
- * }
1171
- * }
1172
- * ```
1173
- */
1174
- interface GlobalComponents {
1175
- Teleport: DefineComponent<TeleportProps>;
1176
- Suspense: DefineComponent<SuspenseProps>;
1177
- KeepAlive: DefineComponent<KeepAliveProps>;
1178
- BaseTransition: DefineComponent<BaseTransitionProps>;
1179
- }
1180
- /**
1181
- * Default allowed non-declared props on component in TSX
1182
- */
1183
- interface AllowedComponentProps {
1184
- class?: unknown;
1185
- style?: unknown;
1186
- }
1187
- interface ComponentInternalOptions {
1188
- /**
1189
- * Compat build only, for bailing out of certain compatibility behavior
1190
- */
1191
- __isBuiltIn?: boolean;
1192
- /**
1193
- * This one should be exposed so that devtools can make use of it
1194
- */
1195
- __file?: string;
1196
- /**
1197
- * name inferred from filename
1198
- */
1199
- __name?: string;
1200
- }
1201
- interface FunctionalComponent<P = {}, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any, EE extends EmitsOptions = ShortEmitsToObject<E>> extends ComponentInternalOptions {
1202
- (props: P & EmitsToProps<EE>, ctx: Omit<SetupContext<EE, IfAny<S, {}, SlotsType<S>>>, 'expose'>): any;
1203
- props?: ComponentPropsOptions<P>;
1204
- emits?: EE | (keyof EE)[];
1205
- slots?: IfAny<S, Slots, SlotsType<S>>;
1206
- inheritAttrs?: boolean;
1207
- displayName?: string;
1208
- compatConfig?: CompatConfig;
1209
- }
1210
- /**
1211
- * Concrete component type matches its actual value: it's either an options
1212
- * object, or a function. Use this where the code expects to work with actual
1213
- * values, e.g. checking if its a function or not. This is mostly for internal
1214
- * implementation code.
1215
- */
1216
- type ConcreteComponent<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ComponentOptions<Props, RawBindings, D, C, M> | FunctionalComponent<Props, E, S>;
1217
- /**
1218
- * A type used in public APIs where a component type is expected.
1219
- * The constructor type is an artificial type returned by defineComponent().
1220
- */
1221
- type Component<PropsOrInstance = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ConcreteComponent<PropsOrInstance, RawBindings, D, C, M, E, S> | ComponentPublicInstanceConstructor<PropsOrInstance>;
1222
-
1223
- type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? {
1224
- attrs: Data;
1225
- slots: UnwrapSlotsType<S>;
1226
- emit: EmitFn<E>;
1227
- expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
1228
- } : never;
1229
- /**
1230
- * We expose a subset of properties on the internal instance as they are
1231
- * useful for advanced external libraries and tools.
1232
- */
1233
- interface ComponentInternalInstance {
1234
- uid: number;
1235
- type: ConcreteComponent;
1236
- parent: ComponentInternalInstance | null;
1237
- root: ComponentInternalInstance;
1238
- appContext: AppContext;
1239
- /**
1240
- * Vnode representing this component in its parent's vdom tree
1241
- */
1242
- vnode: VNode;
1243
- /**
1244
- * Root vnode of this component's own vdom tree
1245
- */
1246
- subTree: VNode;
1247
- /**
1248
- * Render effect instance
1249
- */
1250
- effect: ReactiveEffect;
1251
- /**
1252
- * Force update render effect
1253
- */
1254
- update: () => void;
1255
- /**
1256
- * Render effect job to be passed to scheduler (checks if dirty)
1257
- */
1258
- job: SchedulerJob;
1259
- proxy: ComponentPublicInstance | null;
1260
- exposed: Record<string, any> | null;
1261
- exposeProxy: Record<string, any> | null;
1262
- data: Data;
1263
- props: Data;
1264
- attrs: Data;
1265
- slots: InternalSlots;
1266
- refs: Data;
1267
- emit: EmitFn;
1268
- isMounted: boolean;
1269
- isUnmounted: boolean;
1270
- isDeactivated: boolean;
1271
- }
1272
- interface WatchEffectOptions extends DebuggerOptions {
1273
- flush?: 'pre' | 'post' | 'sync';
1274
- }
1275
- interface WatchOptions<Immediate = boolean> extends WatchEffectOptions {
1276
- immediate?: Immediate;
1277
- deep?: boolean | number;
1278
- once?: boolean;
1279
- }
1280
-
1281
- declare module "./vue-types.d.mts" {
1282
- interface RefUnwrapBailTypes {
1283
- runtimeCoreBailTypes: VNode | {
1284
- $: ComponentInternalInstance;
1285
- };
1286
- }
1287
- }
1288
- // Note: this file is auto concatenated to the end of the bundled d.ts during
1289
- // build.
1290
-
1291
- declare module '@vue/runtime-core' {
1292
- export interface GlobalComponents {
1293
- Teleport: DefineComponent<TeleportProps>
1294
- Suspense: DefineComponent<SuspenseProps>
1295
- KeepAlive: DefineComponent<KeepAliveProps>
1296
- BaseTransition: DefineComponent<BaseTransitionProps>
1297
- }
1298
- }
1299
-
1300
- // Note: this file is auto concatenated to the end of the bundled d.ts during
1301
- // build.
1302
- type _defineProps = typeof defineProps
1303
- type _defineEmits = typeof defineEmits
1304
- type _defineExpose = typeof defineExpose
1305
- type _defineOptions = typeof defineOptions
1306
- type _defineSlots = typeof defineSlots
1307
- type _defineModel = typeof defineModel
1308
- type _withDefaults = typeof withDefaults
1309
-
1310
- declare global {
1311
- const defineProps: _defineProps
1312
- const defineEmits: _defineEmits
1313
- const defineExpose: _defineExpose
1314
- const defineOptions: _defineOptions
1315
- const defineSlots: _defineSlots
1316
- const defineModel: _defineModel
1317
- const withDefaults: _withDefaults
1318
- }
1319
-
1320
- export type { AllowedComponentProps, ComponentCustomProps, ComponentOptionsMixin, DefineComponent, ObjectDirective, PublicProps, Ref, ShallowRef, ShallowUnwrapRef, VNode, VNodeProps };