vue 2.7.1 → 2.7.4
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/vue.common.dev.js +133 -61
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +133 -62
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +135 -62
- package/dist/vue.js +135 -61
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +133 -61
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +135 -62
- package/dist/vue.runtime.js +135 -61
- package/dist/vue.runtime.min.js +3 -3
- package/dist/vue.runtime.mjs +72 -8604
- package/package.json +2 -2
- package/packages/compiler-sfc/dist/compiler-sfc.js +56 -55
- package/packages/compiler-sfc/package.json +1 -1
- package/packages/compiler-sfc/src/parseComponent.ts +9 -1
- package/packages/compiler-sfc/test/parseComponent.spec.ts +6 -7
- package/src/core/instance/render-helpers/render-static.ts +1 -1
- package/src/core/observer/index.ts +54 -55
- package/src/core/util/next-tick.ts +2 -1
- package/src/core/vdom/modules/directives.ts +2 -2
- package/src/shared/constants.ts +3 -1
- package/src/v3/apiAsyncComponent.ts +117 -0
- package/src/v3/apiWatch.ts +2 -2
- package/src/v3/index.ts +6 -0
- package/src/v3/reactivity/reactive.ts +13 -2
- package/src/v3/reactivity/ref.ts +6 -2
- package/types/common.d.ts +6 -0
- package/types/index.d.ts +7 -4
- package/types/jsx.d.ts +16 -2
- package/types/options.d.ts +8 -2
- package/types/v3-component-options.d.ts +162 -33
- package/types/v3-component-props.d.ts +19 -20
- package/types/v3-component-public-instance.d.ts +234 -0
- package/types/v3-define-async-component.d.ts +26 -0
- package/types/v3-define-component.d.ts +94 -12
- package/types/v3-generated.d.ts +26 -1
- package/types/v3-setup-context.d.ts +0 -6
- package/types/vnode.d.ts +15 -0
- package/types/vue.d.ts +17 -10
- package/types/v3-component-proxy.d.ts +0 -189
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DebuggerEvent,
|
|
3
|
+
ShallowUnwrapRef,
|
|
4
|
+
UnwrapNestedRefs
|
|
5
|
+
} from './v3-generated'
|
|
6
|
+
import { UnionToIntersection } from './common'
|
|
7
|
+
|
|
8
|
+
import { Vue, Vue2Instance, VueConstructor } from './vue'
|
|
9
|
+
import {
|
|
10
|
+
ComputedOptions,
|
|
11
|
+
MethodOptions,
|
|
12
|
+
ExtractComputedReturns,
|
|
13
|
+
ComponentOptionsMixin,
|
|
14
|
+
ComponentOptionsBase
|
|
15
|
+
} from './v3-component-options'
|
|
16
|
+
import { EmitFn, EmitsOptions, Slots } from './v3-setup-context'
|
|
17
|
+
import { VNode } from './vnode'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Custom properties added to component instances in any way and can be accessed through `this`
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { Router } from 'vue-router'
|
|
25
|
+
*
|
|
26
|
+
* declare module 'vue' {
|
|
27
|
+
* interface ComponentCustomProperties {
|
|
28
|
+
* $router: Router
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export interface ComponentCustomProperties {}
|
|
34
|
+
|
|
35
|
+
export type ComponentInstance = InstanceType<VueConstructor>
|
|
36
|
+
|
|
37
|
+
export type OptionTypesKeys = 'P' | 'B' | 'D' | 'C' | 'M' | 'Defaults'
|
|
38
|
+
|
|
39
|
+
export type OptionTypesType<
|
|
40
|
+
P = {},
|
|
41
|
+
B = {},
|
|
42
|
+
D = {},
|
|
43
|
+
C extends ComputedOptions = {},
|
|
44
|
+
M extends MethodOptions = {},
|
|
45
|
+
Defaults = {}
|
|
46
|
+
> = {
|
|
47
|
+
P: P
|
|
48
|
+
B: B
|
|
49
|
+
D: D
|
|
50
|
+
C: C
|
|
51
|
+
M: M
|
|
52
|
+
Defaults: Defaults
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin
|
|
56
|
+
? ComponentOptionsMixin extends T
|
|
57
|
+
? true
|
|
58
|
+
: false
|
|
59
|
+
: false
|
|
60
|
+
|
|
61
|
+
type MixinToOptionTypes<T> = T extends ComponentOptionsBase<
|
|
62
|
+
infer P,
|
|
63
|
+
infer B,
|
|
64
|
+
infer D,
|
|
65
|
+
infer C,
|
|
66
|
+
infer M,
|
|
67
|
+
infer Mixin,
|
|
68
|
+
infer Extends,
|
|
69
|
+
any,
|
|
70
|
+
any,
|
|
71
|
+
infer Defaults
|
|
72
|
+
>
|
|
73
|
+
? OptionTypesType<P & {}, B & {}, D & {}, C & {}, M & {}, Defaults & {}> &
|
|
74
|
+
IntersectionMixin<Mixin> &
|
|
75
|
+
IntersectionMixin<Extends>
|
|
76
|
+
: never
|
|
77
|
+
|
|
78
|
+
// ExtractMixin(map type) is used to resolve circularly references
|
|
79
|
+
type ExtractMixin<T> = {
|
|
80
|
+
Mixin: MixinToOptionTypes<T>
|
|
81
|
+
}[T extends ComponentOptionsMixin ? 'Mixin' : never]
|
|
82
|
+
|
|
83
|
+
type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true
|
|
84
|
+
? OptionTypesType<{}, {}, {}, {}, {}, {}>
|
|
85
|
+
: UnionToIntersection<ExtractMixin<T>>
|
|
86
|
+
|
|
87
|
+
type UnwrapMixinsType<
|
|
88
|
+
T,
|
|
89
|
+
Type extends OptionTypesKeys
|
|
90
|
+
> = T extends OptionTypesType ? T[Type] : never
|
|
91
|
+
|
|
92
|
+
type EnsureNonVoid<T> = T extends void ? {} : T
|
|
93
|
+
|
|
94
|
+
export type CreateComponentPublicInstance<
|
|
95
|
+
P = {},
|
|
96
|
+
B = {},
|
|
97
|
+
D = {},
|
|
98
|
+
C extends ComputedOptions = {},
|
|
99
|
+
M extends MethodOptions = {},
|
|
100
|
+
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
|
101
|
+
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
|
102
|
+
E extends EmitsOptions = {},
|
|
103
|
+
PublicProps = P,
|
|
104
|
+
Defaults = {},
|
|
105
|
+
MakeDefaultsOptional extends boolean = false,
|
|
106
|
+
PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>,
|
|
107
|
+
PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>,
|
|
108
|
+
PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>,
|
|
109
|
+
PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>,
|
|
110
|
+
PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> &
|
|
111
|
+
EnsureNonVoid<C>,
|
|
112
|
+
PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> &
|
|
113
|
+
EnsureNonVoid<M>,
|
|
114
|
+
PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> &
|
|
115
|
+
EnsureNonVoid<Defaults>
|
|
116
|
+
> = ComponentPublicInstance<
|
|
117
|
+
PublicP,
|
|
118
|
+
PublicB,
|
|
119
|
+
PublicD,
|
|
120
|
+
PublicC,
|
|
121
|
+
PublicM,
|
|
122
|
+
E,
|
|
123
|
+
PublicProps,
|
|
124
|
+
PublicDefaults,
|
|
125
|
+
MakeDefaultsOptional
|
|
126
|
+
>
|
|
127
|
+
|
|
128
|
+
// public properties exposed on the proxy, which is used as the render context
|
|
129
|
+
// in templates (as `this` in the render option)
|
|
130
|
+
export type ComponentPublicInstance<
|
|
131
|
+
P = {}, // props type extracted from props option
|
|
132
|
+
B = {}, // raw bindings returned from setup()
|
|
133
|
+
D = {}, // return from data()
|
|
134
|
+
C extends ComputedOptions = {},
|
|
135
|
+
M extends MethodOptions = {},
|
|
136
|
+
E extends EmitsOptions = {},
|
|
137
|
+
PublicProps = P,
|
|
138
|
+
Defaults = {},
|
|
139
|
+
MakeDefaultsOptional extends boolean = false,
|
|
140
|
+
Options = ComponentOptionsBase<
|
|
141
|
+
any,
|
|
142
|
+
any,
|
|
143
|
+
any,
|
|
144
|
+
any,
|
|
145
|
+
any,
|
|
146
|
+
any,
|
|
147
|
+
any,
|
|
148
|
+
any,
|
|
149
|
+
any,
|
|
150
|
+
any
|
|
151
|
+
>
|
|
152
|
+
> = Vue3Instance<
|
|
153
|
+
D,
|
|
154
|
+
P,
|
|
155
|
+
PublicProps,
|
|
156
|
+
E,
|
|
157
|
+
Defaults,
|
|
158
|
+
MakeDefaultsOptional,
|
|
159
|
+
Options
|
|
160
|
+
> &
|
|
161
|
+
Readonly<P> &
|
|
162
|
+
ShallowUnwrapRef<B> &
|
|
163
|
+
UnwrapNestedRefs<D> &
|
|
164
|
+
ExtractComputedReturns<C> &
|
|
165
|
+
M &
|
|
166
|
+
ComponentCustomProperties
|
|
167
|
+
|
|
168
|
+
interface Vue3Instance<
|
|
169
|
+
D,
|
|
170
|
+
P,
|
|
171
|
+
PublicProps,
|
|
172
|
+
E,
|
|
173
|
+
Defaults,
|
|
174
|
+
MakeDefaultsOptional,
|
|
175
|
+
Options
|
|
176
|
+
> extends Vue2Instance {
|
|
177
|
+
$data: D
|
|
178
|
+
readonly $props: Readonly<
|
|
179
|
+
MakeDefaultsOptional extends true
|
|
180
|
+
? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults>
|
|
181
|
+
: P & PublicProps
|
|
182
|
+
>
|
|
183
|
+
readonly $root: ComponentPublicInstance | null
|
|
184
|
+
readonly $parent: ComponentPublicInstance | null
|
|
185
|
+
readonly $emit: EmitFn<E>
|
|
186
|
+
readonly $options: Options & MergedComponentOptionsOverride
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type MergedHook<T = () => void> = T | T[]
|
|
190
|
+
|
|
191
|
+
export type MergedComponentOptionsOverride = {
|
|
192
|
+
beforeCreate?: MergedHook
|
|
193
|
+
created?: MergedHook
|
|
194
|
+
beforeMount?: MergedHook
|
|
195
|
+
mounted?: MergedHook
|
|
196
|
+
beforeUpdate?: MergedHook
|
|
197
|
+
updated?: MergedHook
|
|
198
|
+
activated?: MergedHook
|
|
199
|
+
deactivated?: MergedHook
|
|
200
|
+
/** @deprecated use `beforeUnmount` instead */
|
|
201
|
+
beforeDestroy?: MergedHook
|
|
202
|
+
beforeUnmount?: MergedHook
|
|
203
|
+
/** @deprecated use `unmounted` instead */
|
|
204
|
+
destroyed?: MergedHook
|
|
205
|
+
unmounted?: MergedHook
|
|
206
|
+
renderTracked?: MergedHook<DebuggerHook>
|
|
207
|
+
renderTriggered?: MergedHook<DebuggerHook>
|
|
208
|
+
errorCaptured?: MergedHook<ErrorCapturedHook>
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export type DebuggerHook = (e: DebuggerEvent) => void
|
|
212
|
+
|
|
213
|
+
export type ErrorCapturedHook<TError = unknown> = (
|
|
214
|
+
err: TError,
|
|
215
|
+
instance: ComponentPublicInstance | null,
|
|
216
|
+
info: string
|
|
217
|
+
) => boolean | void
|
|
218
|
+
|
|
219
|
+
export type ComponentPublicInstanceConstructor<
|
|
220
|
+
T extends ComponentPublicInstance<
|
|
221
|
+
Props,
|
|
222
|
+
RawBindings,
|
|
223
|
+
D,
|
|
224
|
+
C,
|
|
225
|
+
M
|
|
226
|
+
> = ComponentPublicInstance<any, any, any>,
|
|
227
|
+
Props = any,
|
|
228
|
+
RawBindings = any,
|
|
229
|
+
D = any,
|
|
230
|
+
C extends ComputedOptions = ComputedOptions,
|
|
231
|
+
M extends MethodOptions = MethodOptions
|
|
232
|
+
> = {
|
|
233
|
+
new (...args: any[]): T
|
|
234
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AsyncComponent, Component } from './options'
|
|
2
|
+
|
|
3
|
+
export type AsyncComponentResolveResult<T = Component> = T | { default: T } // es modules
|
|
4
|
+
|
|
5
|
+
export type AsyncComponentLoader<T = any> = () => Promise<
|
|
6
|
+
AsyncComponentResolveResult<T>
|
|
7
|
+
>
|
|
8
|
+
|
|
9
|
+
export interface AsyncComponentOptions {
|
|
10
|
+
loader: AsyncComponentLoader
|
|
11
|
+
loadingComponent?: Component
|
|
12
|
+
errorComponent?: Component
|
|
13
|
+
delay?: number
|
|
14
|
+
timeout?: number
|
|
15
|
+
// suspensible?: boolean
|
|
16
|
+
onError?: (
|
|
17
|
+
error: Error,
|
|
18
|
+
retry: () => void,
|
|
19
|
+
fail: () => void,
|
|
20
|
+
attempts: number
|
|
21
|
+
) => any
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function defineAsyncComponent(
|
|
25
|
+
source: AsyncComponentLoader | AsyncComponentOptions
|
|
26
|
+
): AsyncComponent
|
|
@@ -1,14 +1,95 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ComponentPropsOptions,
|
|
3
|
+
ExtractDefaultPropTypes,
|
|
4
|
+
ExtractPropTypes
|
|
5
|
+
} from './v3-component-props'
|
|
2
6
|
import {
|
|
3
7
|
MethodOptions,
|
|
4
8
|
ComputedOptions,
|
|
5
9
|
ComponentOptionsWithoutProps,
|
|
6
10
|
ComponentOptionsWithArrayProps,
|
|
7
|
-
ComponentOptionsWithProps
|
|
11
|
+
ComponentOptionsWithProps,
|
|
12
|
+
ComponentOptionsMixin,
|
|
13
|
+
ComponentOptionsBase
|
|
8
14
|
} from './v3-component-options'
|
|
9
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
ComponentPublicInstanceConstructor,
|
|
17
|
+
CreateComponentPublicInstance
|
|
18
|
+
} from './v3-component-public-instance'
|
|
10
19
|
import { Data, HasDefined } from './common'
|
|
11
20
|
import { EmitsOptions } from './v3-setup-context'
|
|
21
|
+
import { CreateElement, RenderContext } from './umd'
|
|
22
|
+
|
|
23
|
+
type DefineComponent<
|
|
24
|
+
PropsOrPropOptions = {},
|
|
25
|
+
RawBindings = {},
|
|
26
|
+
D = {},
|
|
27
|
+
C extends ComputedOptions = ComputedOptions,
|
|
28
|
+
M extends MethodOptions = MethodOptions,
|
|
29
|
+
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
|
30
|
+
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
|
31
|
+
E extends EmitsOptions = {},
|
|
32
|
+
EE extends string = string,
|
|
33
|
+
Props = Readonly<
|
|
34
|
+
PropsOrPropOptions extends ComponentPropsOptions
|
|
35
|
+
? ExtractPropTypes<PropsOrPropOptions>
|
|
36
|
+
: PropsOrPropOptions
|
|
37
|
+
>,
|
|
38
|
+
Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>
|
|
39
|
+
> = ComponentPublicInstanceConstructor<
|
|
40
|
+
CreateComponentPublicInstance<
|
|
41
|
+
Props,
|
|
42
|
+
RawBindings,
|
|
43
|
+
D,
|
|
44
|
+
C,
|
|
45
|
+
M,
|
|
46
|
+
Mixin,
|
|
47
|
+
Extends,
|
|
48
|
+
E,
|
|
49
|
+
Props,
|
|
50
|
+
Defaults,
|
|
51
|
+
true
|
|
52
|
+
> &
|
|
53
|
+
Props
|
|
54
|
+
> &
|
|
55
|
+
ComponentOptionsBase<
|
|
56
|
+
Props,
|
|
57
|
+
RawBindings,
|
|
58
|
+
D,
|
|
59
|
+
C,
|
|
60
|
+
M,
|
|
61
|
+
Mixin,
|
|
62
|
+
Extends,
|
|
63
|
+
E,
|
|
64
|
+
EE,
|
|
65
|
+
Defaults
|
|
66
|
+
> & {
|
|
67
|
+
props: PropsOrPropOptions
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* overload 0.0: functional component with array props
|
|
72
|
+
*/
|
|
73
|
+
export function defineComponent<
|
|
74
|
+
PropNames extends string,
|
|
75
|
+
Props = Readonly<{ [key in PropNames]?: any }>
|
|
76
|
+
>(options: {
|
|
77
|
+
functional: true
|
|
78
|
+
props?: PropNames[]
|
|
79
|
+
render?: (h: CreateElement, context: RenderContext<Props>) => any
|
|
80
|
+
}): DefineComponent<Props>
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* overload 0.1: functional component with object props
|
|
84
|
+
*/
|
|
85
|
+
export function defineComponent<
|
|
86
|
+
PropsOptions extends ComponentPropsOptions = ComponentPropsOptions,
|
|
87
|
+
Props = ExtractPropTypes<PropsOptions>
|
|
88
|
+
>(options: {
|
|
89
|
+
functional: true
|
|
90
|
+
props?: PropsOptions
|
|
91
|
+
render?: (h: CreateElement, context: RenderContext<Props>) => any
|
|
92
|
+
}): DefineComponent<PropsOptions>
|
|
12
93
|
|
|
13
94
|
/**
|
|
14
95
|
* overload 1: object format with no props
|
|
@@ -18,8 +99,8 @@ export function defineComponent<
|
|
|
18
99
|
D = Data,
|
|
19
100
|
C extends ComputedOptions = {},
|
|
20
101
|
M extends MethodOptions = {},
|
|
21
|
-
Mixin =
|
|
22
|
-
Extends =
|
|
102
|
+
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
|
103
|
+
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
|
23
104
|
Emits extends EmitsOptions = {},
|
|
24
105
|
EmitsNames extends string = string
|
|
25
106
|
>(
|
|
@@ -34,7 +115,8 @@ export function defineComponent<
|
|
|
34
115
|
Emits,
|
|
35
116
|
EmitsNames
|
|
36
117
|
>
|
|
37
|
-
):
|
|
118
|
+
): DefineComponent<{}, RawBindings, D, C, M, Mixin, Extends, Emits>
|
|
119
|
+
|
|
38
120
|
/**
|
|
39
121
|
* overload 2: object format with array props declaration
|
|
40
122
|
* props inferred as `{ [key in PropNames]?: any }`
|
|
@@ -47,8 +129,8 @@ export function defineComponent<
|
|
|
47
129
|
D = Data,
|
|
48
130
|
C extends ComputedOptions = {},
|
|
49
131
|
M extends MethodOptions = {},
|
|
50
|
-
Mixin =
|
|
51
|
-
Extends =
|
|
132
|
+
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
|
133
|
+
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
|
52
134
|
Emits extends EmitsOptions = {},
|
|
53
135
|
EmitsNames extends string = string,
|
|
54
136
|
PropsOptions extends ComponentPropsOptions = ComponentPropsOptions
|
|
@@ -64,7 +146,7 @@ export function defineComponent<
|
|
|
64
146
|
Emits,
|
|
65
147
|
EmitsNames
|
|
66
148
|
>
|
|
67
|
-
):
|
|
149
|
+
): DefineComponent<
|
|
68
150
|
Readonly<{ [key in PropNames]?: any }>,
|
|
69
151
|
RawBindings,
|
|
70
152
|
D,
|
|
@@ -86,8 +168,8 @@ export function defineComponent<
|
|
|
86
168
|
D = Data,
|
|
87
169
|
C extends ComputedOptions = {},
|
|
88
170
|
M extends MethodOptions = {},
|
|
89
|
-
Mixin =
|
|
90
|
-
Extends =
|
|
171
|
+
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
|
172
|
+
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
|
91
173
|
Emits extends EmitsOptions = {},
|
|
92
174
|
EmitsNames extends string = string,
|
|
93
175
|
PropsOptions extends ComponentPropsOptions = ComponentPropsOptions
|
|
@@ -116,4 +198,4 @@ export function defineComponent<
|
|
|
116
198
|
Emits,
|
|
117
199
|
EmitsNames
|
|
118
200
|
>
|
|
119
|
-
):
|
|
201
|
+
): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, Emits>
|
package/types/v3-generated.d.ts
CHANGED
|
@@ -2,6 +2,24 @@ declare type ASTModifiers = {
|
|
|
2
2
|
[key: string]: boolean;
|
|
3
3
|
};
|
|
4
4
|
|
|
5
|
+
declare type AsyncComponentFactory = () => {
|
|
6
|
+
component: Promise<any>;
|
|
7
|
+
loading?: any;
|
|
8
|
+
error?: any;
|
|
9
|
+
delay?: number;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
declare interface AsyncComponentOptions {
|
|
14
|
+
loader: Function;
|
|
15
|
+
loadingComponent?: any;
|
|
16
|
+
errorComponent?: any;
|
|
17
|
+
delay?: number;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
suspensible?: boolean;
|
|
20
|
+
onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => any;
|
|
21
|
+
}
|
|
22
|
+
|
|
5
23
|
declare type BaseTypes = string | number | boolean;
|
|
6
24
|
|
|
7
25
|
declare type Builtin = Primitive | Function | Date | Error | RegExp;
|
|
@@ -57,6 +75,8 @@ export declare type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infe
|
|
|
57
75
|
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
58
76
|
} : Readonly<T>;
|
|
59
77
|
|
|
78
|
+
/* Excluded from this release type: defineAsyncComponent */
|
|
79
|
+
|
|
60
80
|
/* Excluded from this release type: defineComponent */
|
|
61
81
|
|
|
62
82
|
/**
|
|
@@ -133,7 +153,9 @@ declare type MultiWatchSources = (WatchSource<unknown> | object)[];
|
|
|
133
153
|
|
|
134
154
|
export declare function nextTick(): Promise<void>;
|
|
135
155
|
|
|
136
|
-
export declare function nextTick(cb: (...args: any[]) => any
|
|
156
|
+
export declare function nextTick<T>(this: T, cb: (this: T, ...args: any[]) => any): void;
|
|
157
|
+
|
|
158
|
+
export declare function nextTick<T>(cb: (this: T, ...args: any[]) => any, ctx: T): void;
|
|
137
159
|
|
|
138
160
|
export declare const onActivated: (fn: () => void, target?: any) => void;
|
|
139
161
|
|
|
@@ -344,6 +366,9 @@ export declare function useCssVars(getter: (vm: Record<string, any>, setupProxy:
|
|
|
344
366
|
|
|
345
367
|
/* Excluded from this release type: useSlots */
|
|
346
368
|
|
|
369
|
+
/**
|
|
370
|
+
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
371
|
+
*/
|
|
347
372
|
export declare const version: string;
|
|
348
373
|
|
|
349
374
|
/* Excluded from this release type: VNode */
|
|
@@ -29,12 +29,6 @@ export type EmitFn<
|
|
|
29
29
|
}[Event]
|
|
30
30
|
>
|
|
31
31
|
|
|
32
|
-
export type ComponentRenderEmitFn<
|
|
33
|
-
Options = ObjectEmitsOptions,
|
|
34
|
-
Event extends keyof Options = keyof Options,
|
|
35
|
-
T extends Vue | void = void
|
|
36
|
-
> = EmitFn<Options, Event, T>
|
|
37
|
-
|
|
38
32
|
export interface SetupContext<E extends EmitsOptions = {}> {
|
|
39
33
|
attrs: Data
|
|
40
34
|
slots: Slots
|
package/types/vnode.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { Vue } from './vue'
|
|
2
|
+
import { DirectiveFunction, DirectiveOptions } from './options'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* For extending allowed non-declared props on components in TSX
|
|
6
|
+
*/
|
|
7
|
+
export interface ComponentCustomProps {}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Default allowed non-declared props on component in TSX
|
|
11
|
+
*/
|
|
12
|
+
export interface AllowedComponentProps {
|
|
13
|
+
class?: unknown
|
|
14
|
+
style?: unknown
|
|
15
|
+
}
|
|
2
16
|
|
|
3
17
|
export type ScopedSlot = (props: any) => ScopedSlotReturnValue
|
|
4
18
|
type ScopedSlotReturnValue =
|
|
@@ -86,4 +100,5 @@ export interface VNodeDirective {
|
|
|
86
100
|
arg?: string
|
|
87
101
|
oldArg?: string
|
|
88
102
|
modifiers?: { [key: string]: boolean }
|
|
103
|
+
def?: DirectiveFunction | DirectiveOptions
|
|
89
104
|
}
|
package/types/vue.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ import {
|
|
|
3
3
|
AsyncComponent,
|
|
4
4
|
ComponentOptions,
|
|
5
5
|
FunctionalComponentOptions,
|
|
6
|
-
WatchOptionsWithHandler,
|
|
7
|
-
WatchHandler,
|
|
8
6
|
DirectiveOptions,
|
|
9
7
|
DirectiveFunction,
|
|
10
8
|
RecordPropsDefinition,
|
|
@@ -14,6 +12,8 @@ import {
|
|
|
14
12
|
} from './options'
|
|
15
13
|
import { VNode, VNodeData, VNodeChildren, NormalizedScopedSlot } from './vnode'
|
|
16
14
|
import { PluginFunction, PluginObject } from './plugin'
|
|
15
|
+
import { DefineComponent } from './v3-define-component'
|
|
16
|
+
import { nextTick } from './v3-generated'
|
|
17
17
|
|
|
18
18
|
export interface CreateElement {
|
|
19
19
|
(
|
|
@@ -35,20 +35,25 @@ export interface CreateElement {
|
|
|
35
35
|
): VNode
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export interface Vue {
|
|
39
|
-
readonly $
|
|
40
|
-
readonly $
|
|
38
|
+
export interface Vue extends Vue2Instance {
|
|
39
|
+
readonly $data: Record<string, any>
|
|
40
|
+
readonly $props: Record<string, any>
|
|
41
41
|
readonly $parent: Vue
|
|
42
42
|
readonly $root: Vue
|
|
43
43
|
readonly $children: Vue[]
|
|
44
|
+
readonly $options: ComponentOptions<Vue>
|
|
45
|
+
$emit(event: string, ...args: any[]): this
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface Vue2Instance {
|
|
49
|
+
readonly $el: Element
|
|
44
50
|
readonly $refs: {
|
|
45
51
|
[key: string]: Vue | Element | (Vue | Element)[] | undefined
|
|
46
52
|
}
|
|
47
53
|
readonly $slots: { [key: string]: VNode[] | undefined }
|
|
48
54
|
readonly $scopedSlots: { [key: string]: NormalizedScopedSlot | undefined }
|
|
49
55
|
readonly $isServer: boolean
|
|
50
|
-
|
|
51
|
-
readonly $props: Record<string, any>
|
|
56
|
+
|
|
52
57
|
readonly $ssrContext: any
|
|
53
58
|
readonly $vnode: VNode
|
|
54
59
|
readonly $attrs: Record<string, string>
|
|
@@ -72,9 +77,7 @@ export interface Vue {
|
|
|
72
77
|
$on(event: string | string[], callback: Function): this
|
|
73
78
|
$once(event: string | string[], callback: Function): this
|
|
74
79
|
$off(event?: string | string[], callback?: Function): this
|
|
75
|
-
$
|
|
76
|
-
$nextTick(callback: (this: this) => void): void
|
|
77
|
-
$nextTick(): Promise<void>
|
|
80
|
+
$nextTick: typeof nextTick
|
|
78
81
|
$createElement: CreateElement
|
|
79
82
|
}
|
|
80
83
|
|
|
@@ -313,6 +316,10 @@ export interface VueConstructor<V extends Vue = Vue> {
|
|
|
313
316
|
id: string,
|
|
314
317
|
definition?: ComponentOptions<V>
|
|
315
318
|
): ExtendedVue<V, {}, {}, {}, {}, {}>
|
|
319
|
+
component<T extends DefineComponent<any, any, any, any, any, any, any, any>>(
|
|
320
|
+
id: string,
|
|
321
|
+
definition?: T
|
|
322
|
+
): T
|
|
316
323
|
|
|
317
324
|
use<T>(
|
|
318
325
|
plugin: PluginObject<T> | PluginFunction<T>,
|