vue 2.6.13 → 2.7.0-alpha.2
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/README.md +17 -295
- package/compiler-sfc/index.d.ts +1 -0
- package/compiler-sfc/index.js +1 -0
- package/compiler-sfc/index.mjs +1 -0
- package/compiler-sfc/package.json +5 -0
- package/dist/vue.common.dev.js +11481 -11946
- package/dist/vue.common.prod.js +8 -3
- package/dist/vue.esm.browser.js +11321 -12011
- package/dist/vue.esm.browser.min.js +8 -3
- package/dist/vue.esm.js +11476 -11984
- package/dist/vue.js +11484 -11949
- package/dist/vue.min.js +8 -3
- package/dist/vue.runtime.common.dev.js +8427 -8421
- package/dist/vue.runtime.common.prod.js +8 -3
- package/dist/vue.runtime.esm.js +8436 -8454
- package/dist/vue.runtime.js +8430 -8424
- package/dist/vue.runtime.min.js +8 -3
- package/package.json +88 -111
- package/packages/compiler-sfc/dist/compiler-sfc.js +7 -0
- package/packages/compiler-sfc/node_modules/.bin/parser +17 -0
- package/packages/compiler-sfc/node_modules/.bin/sass +17 -0
- package/packages/compiler-sfc/package.json +30 -0
- package/src/compiler/{codeframe.js → codeframe.ts} +9 -7
- package/src/compiler/codegen/{events.js → events.ts} +21 -41
- package/src/compiler/codegen/{index.js → index.ts} +146 -136
- package/src/compiler/{create-compiler.js → create-compiler.ts} +26 -18
- package/src/compiler/directives/bind.ts +9 -0
- package/src/compiler/directives/{index.js → index.ts} +0 -2
- package/src/compiler/directives/{model.js → model.ts} +15 -18
- package/src/compiler/directives/{on.js → on.ts} +3 -4
- package/src/compiler/{error-detector.js → error-detector.ts} +61 -31
- package/src/compiler/{helpers.js → helpers.ts} +73 -61
- package/src/compiler/{index.js → index.ts} +2 -3
- package/src/compiler/{optimizer.js → optimizer.ts} +30 -23
- package/src/compiler/parser/{entity-decoder.js → entity-decoder.ts} +1 -3
- package/src/compiler/parser/{filter-parser.js → filter-parser.ts} +43 -24
- package/src/compiler/parser/{html-parser.js → html-parser.ts} +50 -29
- package/src/compiler/parser/{index.js → index.ts} +190 -172
- package/src/compiler/parser/{text-parser.js → text-parser.ts} +8 -9
- package/src/compiler/{to-function.js → to-function.ts} +27 -22
- package/src/core/components/{index.js → index.ts} +0 -0
- package/src/core/components/{keep-alive.js → keep-alive.ts} +42 -30
- package/src/core/{config.js → config.ts} +28 -30
- package/src/core/global-api/{assets.js → assets.ts} +8 -7
- package/src/core/global-api/{extend.js → extend.ts} +10 -13
- package/src/core/global-api/{index.js → index.ts} +4 -5
- package/src/core/global-api/{mixin.js → mixin.ts} +2 -3
- package/src/core/global-api/use.ts +23 -0
- package/src/core/{index.js → index.ts} +1 -1
- package/src/core/instance/{events.js → events.ts} +41 -24
- package/src/core/instance/{index.js → index.ts} +9 -5
- package/src/core/instance/{init.js → init.ts} +26 -15
- package/src/core/instance/inject.ts +72 -0
- package/src/core/instance/{lifecycle.js → lifecycle.ts} +86 -44
- package/src/core/instance/{proxy.js → proxy.ts} +29 -24
- package/src/core/instance/render-helpers/{bind-dynamic-keys.js → bind-dynamic-keys.ts} +6 -5
- package/src/core/instance/render-helpers/{bind-object-listeners.js → bind-object-listeners.ts} +4 -8
- package/src/core/instance/render-helpers/{bind-object-props.js → bind-object-props.ts} +12 -17
- package/src/core/instance/render-helpers/{check-keycodes.js → check-keycodes.ts} +5 -7
- package/src/core/instance/render-helpers/{index.js → index.ts} +1 -3
- package/src/core/instance/render-helpers/{render-list.js → render-list.ts} +12 -13
- package/src/core/instance/render-helpers/{render-slot.js → render-slot.ts} +10 -11
- package/src/core/instance/render-helpers/{render-static.js → render-static.ts} +7 -10
- package/src/core/instance/render-helpers/{resolve-filter.js → resolve-filter.ts} +1 -3
- package/src/core/instance/render-helpers/{resolve-scoped-slots.js → resolve-scoped-slots.ts} +11 -8
- package/src/core/instance/render-helpers/{resolve-slots.js → resolve-slots.ts} +12 -11
- package/src/core/instance/{render.js → render.ts} +66 -29
- package/src/core/instance/{state.js → state.ts} +100 -83
- package/src/core/observer/{array.js → array.ts} +11 -2
- package/src/core/observer/{dep.js → dep.ts} +37 -15
- package/src/core/observer/{index.js → index.ts} +137 -71
- package/src/core/observer/{scheduler.js → scheduler.ts} +42 -43
- package/src/core/observer/{traverse.js → traverse.ts} +10 -7
- package/src/core/observer/{watcher.js → watcher.ts} +88 -60
- package/src/core/util/{debug.js → debug.ts} +38 -34
- package/src/core/util/{env.js → env.ts} +27 -30
- package/src/core/util/{error.js → error.ts} +12 -14
- package/src/core/util/{index.js → index.ts} +0 -2
- package/src/core/util/{lang.js → lang.ts} +6 -7
- package/src/core/util/{next-tick.js → next-tick.ts} +16 -10
- package/src/core/util/{options.js → options.ts} +119 -114
- package/src/core/util/{perf.js → perf.ts} +5 -1
- package/src/core/util/{props.js → props.ts} +54 -50
- package/src/core/vdom/{create-component.js → create-component.ts} +51 -50
- package/src/core/vdom/{create-element.js → create-element.ts} +49 -43
- package/src/core/vdom/{create-functional-component.js → create-functional-component.ts} +52 -27
- package/src/core/vdom/helpers/{extract-props.js → extract-props.ts} +18 -18
- package/src/core/vdom/helpers/{get-first-component-child.js → get-first-component-child.ts} +6 -5
- package/src/core/vdom/helpers/{index.js → index.ts} +0 -2
- package/src/core/vdom/helpers/is-async-placeholder.ts +6 -0
- package/src/core/vdom/helpers/{merge-hook.js → merge-hook.ts} +7 -5
- package/src/core/vdom/helpers/{normalize-children.js → normalize-children.ts} +26 -16
- package/src/core/vdom/helpers/{normalize-scoped-slots.js → normalize-scoped-slots.ts} +23 -17
- package/src/core/vdom/helpers/{resolve-async-component.js → resolve-async-component.ts} +29 -37
- package/src/core/vdom/helpers/update-listeners.ts +101 -0
- package/src/core/vdom/modules/{directives.js → directives.ts} +20 -14
- package/src/core/vdom/modules/index.ts +4 -0
- package/src/core/vdom/modules/template-ref.ts +96 -0
- package/src/core/vdom/{patch.js → patch.ts} +239 -138
- package/src/core/vdom/{vnode.js → vnode.ts} +36 -31
- package/src/global.d.ts +15 -0
- package/src/platforms/web/compiler/directives/html.ts +8 -0
- package/src/platforms/web/compiler/directives/{index.js → index.ts} +0 -0
- package/src/platforms/web/compiler/directives/{model.js → model.ts} +47 -41
- package/src/platforms/web/compiler/directives/{text.js → text.ts} +2 -3
- package/src/platforms/web/compiler/{index.js → index.ts} +0 -2
- package/src/platforms/web/compiler/modules/{class.js → class.ts} +10 -15
- package/src/platforms/web/compiler/modules/{index.js → index.ts} +1 -5
- package/src/platforms/web/compiler/modules/{model.js → model.ts} +6 -11
- package/src/platforms/web/compiler/modules/{style.js → style.ts} +9 -14
- package/src/platforms/web/compiler/{options.js → options.ts} +1 -2
- package/src/platforms/web/compiler/{util.js → util.ts} +5 -7
- package/src/platforms/web/entry-compiler-sfc.ts +1 -0
- package/src/platforms/web/{entry-compiler.js → entry-compiler.ts} +1 -3
- package/src/platforms/web/{entry-runtime.js → entry-runtime-esm.ts} +2 -2
- package/src/platforms/web/entry-runtime-with-compiler-esm.ts +5 -0
- package/src/platforms/web/entry-runtime-with-compiler.ts +10 -0
- package/src/platforms/web/entry-runtime.ts +7 -0
- package/src/platforms/web/runtime/{class-util.js → class-util.ts} +2 -4
- package/src/platforms/web/runtime/components/{index.js → index.ts} +0 -0
- package/src/platforms/web/runtime/components/{transition-group.js → transition-group.ts} +59 -46
- package/src/platforms/web/runtime/components/{transition.js → transition.ts} +43 -36
- package/src/platforms/web/runtime/directives/{index.js → index.ts} +0 -0
- package/src/platforms/web/runtime/directives/{model.js → model.ts} +22 -21
- package/src/platforms/web/runtime/directives/{show.js → show.ts} +11 -10
- package/src/platforms/web/runtime/{index.js → index.ts} +9 -10
- package/src/platforms/web/runtime/modules/{attrs.js → attrs.ts} +12 -16
- package/src/platforms/web/runtime/modules/{class.js → class.ts} +7 -18
- package/src/platforms/web/runtime/modules/{dom-props.js → dom-props.ts} +24 -17
- package/src/platforms/web/runtime/modules/{events.js → events.ts} +22 -15
- package/src/platforms/web/runtime/modules/{index.js → index.ts} +1 -8
- package/src/platforms/web/runtime/modules/{style.js → style.ts} +24 -13
- package/src/platforms/web/runtime/modules/{transition.js → transition.ts} +61 -63
- package/src/platforms/web/runtime/node-ops.ts +66 -0
- package/src/platforms/web/runtime/{patch.js → patch.ts} +0 -2
- package/src/platforms/web/runtime/{transition-util.js → transition-util.ts} +63 -38
- package/src/platforms/web/{entry-runtime-with-compiler.js → runtime-with-compiler.ts} +28 -19
- package/src/platforms/web/util/{attrs.js → attrs.ts} +18 -14
- package/src/platforms/web/util/{class.js → class.ts} +23 -21
- package/src/platforms/web/util/{compat.js → compat.ts} +4 -4
- package/src/platforms/web/util/{element.js → element.ts} +21 -22
- package/src/platforms/web/util/{index.js → index.ts} +2 -6
- package/src/platforms/web/util/{style.js → style.ts} +12 -12
- package/src/sfc/{parser.js → parser.ts} +18 -15
- package/src/shared/{constants.js → constants.ts} +2 -6
- package/src/shared/{util.js → util.ts} +78 -55
- package/src/types/compiler.ts +224 -0
- package/src/types/component.ts +209 -0
- package/src/types/global-api.ts +37 -0
- package/src/types/modules.d.ts +15 -0
- package/src/types/options.ts +120 -0
- package/src/types/ssr.ts +27 -0
- package/src/types/utils.ts +3 -0
- package/src/types/vnode.ts +127 -0
- package/src/v3/apiInject.ts +66 -0
- package/src/v3/apiLifecycle.ts +53 -0
- package/src/v3/apiSetup.ts +161 -0
- package/src/v3/apiWatch.ts +355 -0
- package/src/v3/currentInstance.ts +23 -0
- package/src/v3/debug.ts +21 -0
- package/src/v3/h.ts +18 -0
- package/src/v3/index.ts +77 -0
- package/src/v3/reactivity/computed.ts +100 -0
- package/src/v3/reactivity/effect.ts +20 -0
- package/src/v3/reactivity/effectScope.ts +134 -0
- package/src/v3/reactivity/operations.ts +14 -0
- package/src/v3/reactivity/reactive.ts +123 -0
- package/src/v3/reactivity/readonly.ts +121 -0
- package/src/v3/reactivity/ref.ts +249 -0
- package/types/index.d.ts +10 -13
- package/types/options.d.ts +265 -132
- package/types/plugin.d.ts +4 -4
- package/types/umd.d.ts +47 -27
- package/types/v3-generated.d.ts +389 -0
- package/types/v3.d.ts +16 -0
- package/types/vnode.d.ts +70 -57
- package/types/vue.d.ts +292 -88
- package/dist/README.md +0 -122
- package/src/compiler/directives/bind.js +0 -11
- package/src/core/global-api/use.js +0 -23
- package/src/core/instance/inject.js +0 -73
- package/src/core/vdom/helpers/is-async-placeholder.js +0 -5
- package/src/core/vdom/helpers/update-listeners.js +0 -95
- package/src/core/vdom/modules/index.js +0 -7
- package/src/core/vdom/modules/ref.js +0 -45
- package/src/platforms/web/compiler/directives/html.js +0 -9
- package/src/platforms/web/entry-server-basic-renderer.js +0 -13
- package/src/platforms/web/entry-server-renderer.js +0 -27
- package/src/platforms/web/runtime/node-ops.js +0 -59
- package/src/platforms/web/server/compiler.js +0 -11
- package/src/platforms/web/server/directives/index.js +0 -7
- package/src/platforms/web/server/directives/model.js +0 -44
- package/src/platforms/web/server/directives/show.js +0 -12
- package/src/platforms/web/server/modules/attrs.js +0 -67
- package/src/platforms/web/server/modules/class.js +0 -11
- package/src/platforms/web/server/modules/dom-props.js +0 -50
- package/src/platforms/web/server/modules/index.js +0 -11
- package/src/platforms/web/server/modules/style.js +0 -41
- package/src/platforms/web/server/util.js +0 -101
- package/src/platforms/weex/compiler/directives/index.js +0 -5
- package/src/platforms/weex/compiler/directives/model.js +0 -33
- package/src/platforms/weex/compiler/index.js +0 -52
- package/src/platforms/weex/compiler/modules/append.js +0 -27
- package/src/platforms/weex/compiler/modules/class.js +0 -74
- package/src/platforms/weex/compiler/modules/index.js +0 -13
- package/src/platforms/weex/compiler/modules/props.js +0 -37
- package/src/platforms/weex/compiler/modules/recycle-list/component-root.js +0 -13
- package/src/platforms/weex/compiler/modules/recycle-list/component.js +0 -16
- package/src/platforms/weex/compiler/modules/recycle-list/index.js +0 -60
- package/src/platforms/weex/compiler/modules/recycle-list/recycle-list.js +0 -50
- package/src/platforms/weex/compiler/modules/recycle-list/text.js +0 -23
- package/src/platforms/weex/compiler/modules/recycle-list/v-bind.js +0 -21
- package/src/platforms/weex/compiler/modules/recycle-list/v-for.js +0 -33
- package/src/platforms/weex/compiler/modules/recycle-list/v-if.js +0 -63
- package/src/platforms/weex/compiler/modules/recycle-list/v-on.js +0 -25
- package/src/platforms/weex/compiler/modules/recycle-list/v-once.js +0 -19
- package/src/platforms/weex/compiler/modules/style.js +0 -87
- package/src/platforms/weex/entry-compiler.js +0 -2
- package/src/platforms/weex/entry-framework.js +0 -187
- package/src/platforms/weex/entry-runtime-factory.js +0 -6
- package/src/platforms/weex/runtime/components/index.js +0 -9
- package/src/platforms/weex/runtime/components/richtext.js +0 -82
- package/src/platforms/weex/runtime/components/transition-group.js +0 -148
- package/src/platforms/weex/runtime/components/transition.js +0 -9
- package/src/platforms/weex/runtime/directives/index.js +0 -2
- package/src/platforms/weex/runtime/index.js +0 -42
- package/src/platforms/weex/runtime/modules/attrs.js +0 -44
- package/src/platforms/weex/runtime/modules/class.js +0 -76
- package/src/platforms/weex/runtime/modules/events.js +0 -54
- package/src/platforms/weex/runtime/modules/index.js +0 -13
- package/src/platforms/weex/runtime/modules/style.js +0 -84
- package/src/platforms/weex/runtime/modules/transition.js +0 -270
- package/src/platforms/weex/runtime/node-ops.js +0 -91
- package/src/platforms/weex/runtime/patch.js +0 -16
- package/src/platforms/weex/runtime/recycle-list/render-component-template.js +0 -34
- package/src/platforms/weex/runtime/recycle-list/virtual-component.js +0 -136
- package/src/platforms/weex/runtime/text-node.js +0 -9
- package/src/platforms/weex/util/element.js +0 -52
- package/src/platforms/weex/util/index.js +0 -40
- package/src/platforms/weex/util/parser.js +0 -60
- package/src/server/bundle-renderer/create-bundle-renderer.js +0 -151
- package/src/server/bundle-renderer/create-bundle-runner.js +0 -150
- package/src/server/bundle-renderer/source-map-support.js +0 -45
- package/src/server/create-basic-renderer.js +0 -37
- package/src/server/create-renderer.js +0 -152
- package/src/server/optimizing-compiler/codegen.js +0 -264
- package/src/server/optimizing-compiler/index.js +0 -20
- package/src/server/optimizing-compiler/modules.js +0 -124
- package/src/server/optimizing-compiler/optimizer.js +0 -141
- package/src/server/optimizing-compiler/runtime-helpers.js +0 -150
- package/src/server/render-context.js +0 -130
- package/src/server/render-stream.js +0 -95
- package/src/server/render.js +0 -437
- package/src/server/template-renderer/create-async-file-mapper.js +0 -57
- package/src/server/template-renderer/index.js +0 -277
- package/src/server/template-renderer/parse-template.js +0 -42
- package/src/server/template-renderer/template-stream.js +0 -82
- package/src/server/util.js +0 -18
- package/src/server/webpack-plugin/client.js +0 -65
- package/src/server/webpack-plugin/server.js +0 -66
- package/src/server/webpack-plugin/util.js +0 -34
- package/src/server/write.js +0 -50
package/types/options.d.ts
CHANGED
|
@@ -1,36 +1,73 @@
|
|
|
1
|
-
import { Vue, CreateElement, CombinedVueInstance } from
|
|
2
|
-
import { VNode, VNodeData, VNodeDirective, NormalizedScopedSlot } from
|
|
1
|
+
import { Vue, CreateElement, CombinedVueInstance } from './vue'
|
|
2
|
+
import { VNode, VNodeData, VNodeDirective, NormalizedScopedSlot } from './vnode'
|
|
3
|
+
import { SetupContext } from './v3'
|
|
3
4
|
|
|
4
5
|
type Constructor = {
|
|
5
|
-
new (...args: any[]): any
|
|
6
|
+
new (...args: any[]): any
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
// we don't support infer props in async component
|
|
9
10
|
// N.B. ComponentOptions<V> is contravariant, the default generic should be bottom type
|
|
10
|
-
export type Component<
|
|
11
|
+
export type Component<
|
|
12
|
+
Data = DefaultData<never>,
|
|
13
|
+
Methods = DefaultMethods<never>,
|
|
14
|
+
Computed = DefaultComputed,
|
|
15
|
+
Props = DefaultProps,
|
|
16
|
+
SetupBindings = {}
|
|
17
|
+
> =
|
|
11
18
|
| typeof Vue
|
|
12
19
|
| FunctionalComponentOptions<Props>
|
|
13
|
-
| ComponentOptions<never, Data, Methods, Computed, Props>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
=
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
| ComponentOptions<never, Data, Methods, Computed, Props, SetupBindings>
|
|
21
|
+
|
|
22
|
+
type EsModule<T> = T | { default: T }
|
|
23
|
+
|
|
24
|
+
type ImportedComponent<
|
|
25
|
+
Data = DefaultData<never>,
|
|
26
|
+
Methods = DefaultMethods<never>,
|
|
27
|
+
Computed = DefaultComputed,
|
|
28
|
+
Props = DefaultProps,
|
|
29
|
+
SetupBindings = {}
|
|
30
|
+
> = EsModule<Component<Data, Methods, Computed, Props, SetupBindings>>
|
|
31
|
+
|
|
32
|
+
export type AsyncComponent<
|
|
33
|
+
Data = DefaultData<never>,
|
|
34
|
+
Methods = DefaultMethods<never>,
|
|
35
|
+
Computed = DefaultComputed,
|
|
36
|
+
Props = DefaultProps,
|
|
37
|
+
SetupBindings = {}
|
|
38
|
+
> =
|
|
39
|
+
| AsyncComponentPromise<Data, Methods, Computed, Props, SetupBindings>
|
|
40
|
+
| AsyncComponentFactory<Data, Methods, Computed, Props, SetupBindings>
|
|
41
|
+
|
|
42
|
+
export type AsyncComponentPromise<
|
|
43
|
+
Data = DefaultData<never>,
|
|
44
|
+
Methods = DefaultMethods<never>,
|
|
45
|
+
Computed = DefaultComputed,
|
|
46
|
+
Props = DefaultProps,
|
|
47
|
+
SetupBindings = {}
|
|
48
|
+
> = (
|
|
49
|
+
resolve: (
|
|
50
|
+
component: Component<Data, Methods, Computed, Props, SetupBindings>
|
|
51
|
+
) => void,
|
|
25
52
|
reject: (reason?: any) => void
|
|
26
|
-
) => Promise<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
53
|
+
) => Promise<
|
|
54
|
+
ImportedComponent<Data, Methods, Computed, Props, SetupBindings>
|
|
55
|
+
> | void
|
|
56
|
+
|
|
57
|
+
export type AsyncComponentFactory<
|
|
58
|
+
Data = DefaultData<never>,
|
|
59
|
+
Methods = DefaultMethods<never>,
|
|
60
|
+
Computed = DefaultComputed,
|
|
61
|
+
Props = DefaultProps,
|
|
62
|
+
SetupBindings = {}
|
|
63
|
+
> = () => {
|
|
64
|
+
component: Promise<
|
|
65
|
+
ImportedComponent<Data, Methods, Computed, Props, SetupBindings>
|
|
66
|
+
>
|
|
67
|
+
loading?: ImportedComponent
|
|
68
|
+
error?: ImportedComponent
|
|
69
|
+
delay?: number
|
|
70
|
+
timeout?: number
|
|
34
71
|
}
|
|
35
72
|
|
|
36
73
|
/**
|
|
@@ -47,141 +84,214 @@ type DataDef<Data, Props, V> = Data | ((this: Readonly<Props> & V) => Data)
|
|
|
47
84
|
/**
|
|
48
85
|
* This type should be used when an array of strings is used for a component's `props` value.
|
|
49
86
|
*/
|
|
50
|
-
export type ThisTypedComponentOptionsWithArrayProps<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
87
|
+
export type ThisTypedComponentOptionsWithArrayProps<
|
|
88
|
+
V extends Vue,
|
|
89
|
+
Data,
|
|
90
|
+
Methods,
|
|
91
|
+
Computed,
|
|
92
|
+
PropNames extends string,
|
|
93
|
+
SetupBindings
|
|
94
|
+
> = object &
|
|
95
|
+
ComponentOptions<
|
|
96
|
+
V,
|
|
97
|
+
DataDef<Data, Record<PropNames, any>, V>,
|
|
98
|
+
Methods,
|
|
99
|
+
Computed,
|
|
100
|
+
PropNames[],
|
|
101
|
+
Record<PropNames, any>,
|
|
102
|
+
SetupBindings
|
|
103
|
+
> &
|
|
104
|
+
ThisType<
|
|
105
|
+
CombinedVueInstance<
|
|
106
|
+
V,
|
|
107
|
+
Data,
|
|
108
|
+
Methods,
|
|
109
|
+
Computed,
|
|
110
|
+
Readonly<Record<PropNames, any>>,
|
|
111
|
+
SetupBindings
|
|
112
|
+
>
|
|
113
|
+
>
|
|
54
114
|
|
|
55
115
|
/**
|
|
56
116
|
* This type should be used when an object mapped to `PropOptions` is used for a component's `props` value.
|
|
57
117
|
*/
|
|
58
|
-
export type ThisTypedComponentOptionsWithRecordProps<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
118
|
+
export type ThisTypedComponentOptionsWithRecordProps<
|
|
119
|
+
V extends Vue,
|
|
120
|
+
Data,
|
|
121
|
+
Methods,
|
|
122
|
+
Computed,
|
|
123
|
+
Props,
|
|
124
|
+
SetupBindings
|
|
125
|
+
> = object &
|
|
126
|
+
ComponentOptions<
|
|
127
|
+
V,
|
|
128
|
+
DataDef<Data, Props, V>,
|
|
129
|
+
Methods,
|
|
130
|
+
Computed,
|
|
131
|
+
RecordPropsDefinition<Props>,
|
|
132
|
+
Props,
|
|
133
|
+
SetupBindings
|
|
134
|
+
> &
|
|
135
|
+
ThisType<
|
|
136
|
+
CombinedVueInstance<
|
|
137
|
+
V,
|
|
138
|
+
Data,
|
|
139
|
+
Methods,
|
|
140
|
+
Computed,
|
|
141
|
+
Readonly<Props>,
|
|
142
|
+
SetupBindings
|
|
143
|
+
>
|
|
144
|
+
>
|
|
145
|
+
|
|
146
|
+
type DefaultData<V> = object | ((this: V) => object)
|
|
147
|
+
type DefaultProps = Record<string, any>
|
|
148
|
+
type DefaultMethods<V> = { [key: string]: (this: V, ...args: any[]) => any }
|
|
149
|
+
type DefaultComputed = { [key: string]: any }
|
|
150
|
+
|
|
67
151
|
export interface ComponentOptions<
|
|
68
152
|
V extends Vue,
|
|
69
|
-
Data=DefaultData<V>,
|
|
70
|
-
Methods=DefaultMethods<V>,
|
|
71
|
-
Computed=DefaultComputed,
|
|
72
|
-
PropsDef=PropsDefinition<DefaultProps>,
|
|
73
|
-
Props=DefaultProps
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
153
|
+
Data = DefaultData<V>,
|
|
154
|
+
Methods = DefaultMethods<V>,
|
|
155
|
+
Computed = DefaultComputed,
|
|
156
|
+
PropsDef = PropsDefinition<DefaultProps>,
|
|
157
|
+
Props = DefaultProps,
|
|
158
|
+
RawBindings = {}
|
|
159
|
+
> {
|
|
160
|
+
data?: Data
|
|
161
|
+
props?: PropsDef
|
|
162
|
+
propsData?: object
|
|
163
|
+
computed?: Accessors<Computed>
|
|
164
|
+
methods?: Methods
|
|
165
|
+
watch?: Record<string, WatchOptionsWithHandler<any> | WatchHandler<any>>
|
|
166
|
+
|
|
167
|
+
setup?: (
|
|
168
|
+
this: void,
|
|
169
|
+
props: Props,
|
|
170
|
+
ctx: SetupContext
|
|
171
|
+
) => Promise<RawBindings> | RawBindings | ((h: CreateElement) => VNode) | void
|
|
172
|
+
|
|
173
|
+
el?: Element | string
|
|
174
|
+
template?: string
|
|
83
175
|
// hack is for functional component type inference, should not be used in user code
|
|
84
|
-
render?(createElement: CreateElement, hack: RenderContext<Props>): VNode
|
|
85
|
-
renderError?(createElement: CreateElement, err: Error): VNode
|
|
86
|
-
staticRenderFns?: ((createElement: CreateElement) => VNode)[]
|
|
87
|
-
|
|
88
|
-
beforeCreate?(this: V): void
|
|
89
|
-
created?(): void
|
|
90
|
-
beforeDestroy?(): void
|
|
91
|
-
destroyed?(): void
|
|
92
|
-
beforeMount?(): void
|
|
93
|
-
mounted?(): void
|
|
94
|
-
beforeUpdate?(): void
|
|
95
|
-
updated?(): void
|
|
96
|
-
activated?(): void
|
|
97
|
-
deactivated?(): void
|
|
98
|
-
errorCaptured?(err: Error, vm: Vue, info: string): boolean | void
|
|
99
|
-
serverPrefetch?(this: V): Promise<void
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
176
|
+
render?(createElement: CreateElement, hack: RenderContext<Props>): VNode
|
|
177
|
+
renderError?(createElement: CreateElement, err: Error): VNode
|
|
178
|
+
staticRenderFns?: ((createElement: CreateElement) => VNode)[]
|
|
179
|
+
|
|
180
|
+
beforeCreate?(this: V): void
|
|
181
|
+
created?(): void
|
|
182
|
+
beforeDestroy?(): void
|
|
183
|
+
destroyed?(): void
|
|
184
|
+
beforeMount?(): void
|
|
185
|
+
mounted?(): void
|
|
186
|
+
beforeUpdate?(): void
|
|
187
|
+
updated?(): void
|
|
188
|
+
activated?(): void
|
|
189
|
+
deactivated?(): void
|
|
190
|
+
errorCaptured?(err: Error, vm: Vue, info: string): boolean | void
|
|
191
|
+
serverPrefetch?(this: V): Promise<void>
|
|
192
|
+
renderTracked?(e: DebuggerEvent): void
|
|
193
|
+
renderTriggerd?(e: DebuggerEvent): void
|
|
194
|
+
|
|
195
|
+
directives?: { [key: string]: DirectiveFunction | DirectiveOptions }
|
|
196
|
+
components?: {
|
|
197
|
+
[key: string]:
|
|
198
|
+
| Component<any, any, any, any>
|
|
199
|
+
| AsyncComponent<any, any, any, any>
|
|
200
|
+
}
|
|
201
|
+
transitions?: { [key: string]: object }
|
|
202
|
+
filters?: { [key: string]: Function }
|
|
203
|
+
|
|
204
|
+
provide?: object | (() => object)
|
|
205
|
+
inject?: InjectOptions
|
|
108
206
|
|
|
109
207
|
model?: {
|
|
110
|
-
prop?: string
|
|
111
|
-
event?: string
|
|
112
|
-
}
|
|
208
|
+
prop?: string
|
|
209
|
+
event?: string
|
|
210
|
+
}
|
|
113
211
|
|
|
114
|
-
parent?: Vue
|
|
115
|
-
mixins?: (ComponentOptions<Vue> | typeof Vue)[]
|
|
116
|
-
name?: string
|
|
212
|
+
parent?: Vue
|
|
213
|
+
mixins?: (ComponentOptions<Vue> | typeof Vue)[]
|
|
214
|
+
name?: string
|
|
117
215
|
// TODO: support properly inferred 'extends'
|
|
118
|
-
extends?: ComponentOptions<Vue> | typeof Vue
|
|
119
|
-
delimiters?: [string, string]
|
|
120
|
-
comments?: boolean
|
|
121
|
-
inheritAttrs?: boolean
|
|
216
|
+
extends?: ComponentOptions<Vue> | typeof Vue
|
|
217
|
+
delimiters?: [string, string]
|
|
218
|
+
comments?: boolean
|
|
219
|
+
inheritAttrs?: boolean
|
|
122
220
|
}
|
|
123
221
|
|
|
124
|
-
export interface FunctionalComponentOptions<
|
|
125
|
-
|
|
126
|
-
|
|
222
|
+
export interface FunctionalComponentOptions<
|
|
223
|
+
Props = DefaultProps,
|
|
224
|
+
PropDefs = PropsDefinition<Props>
|
|
225
|
+
> {
|
|
226
|
+
name?: string
|
|
227
|
+
props?: PropDefs
|
|
127
228
|
model?: {
|
|
128
|
-
prop?: string
|
|
129
|
-
event?: string
|
|
130
|
-
}
|
|
131
|
-
inject?: InjectOptions
|
|
132
|
-
functional: boolean
|
|
133
|
-
render?(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
229
|
+
prop?: string
|
|
230
|
+
event?: string
|
|
231
|
+
}
|
|
232
|
+
inject?: InjectOptions
|
|
233
|
+
functional: boolean
|
|
234
|
+
render?(
|
|
235
|
+
this: undefined,
|
|
236
|
+
createElement: CreateElement,
|
|
237
|
+
context: RenderContext<Props>
|
|
238
|
+
): VNode | VNode[]
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface RenderContext<Props = DefaultProps> {
|
|
242
|
+
props: Props
|
|
243
|
+
children: VNode[]
|
|
244
|
+
slots(): any
|
|
245
|
+
data: VNodeData
|
|
246
|
+
parent: Vue
|
|
247
|
+
listeners: { [key: string]: Function | Function[] }
|
|
248
|
+
scopedSlots: { [key: string]: NormalizedScopedSlot }
|
|
144
249
|
injections: any
|
|
145
250
|
}
|
|
146
251
|
|
|
147
|
-
export type Prop<T> =
|
|
252
|
+
export type Prop<T> =
|
|
253
|
+
| { (): T }
|
|
254
|
+
| { new (...args: never[]): T & object }
|
|
255
|
+
| { new (...args: string[]): Function }
|
|
148
256
|
|
|
149
|
-
export type PropType<T> = Prop<T> | Prop<T>[]
|
|
257
|
+
export type PropType<T> = Prop<T> | Prop<T>[]
|
|
150
258
|
|
|
151
|
-
export type PropValidator<T> = PropOptions<T> | PropType<T
|
|
259
|
+
export type PropValidator<T> = PropOptions<T> | PropType<T>
|
|
152
260
|
|
|
153
|
-
export interface PropOptions<T=any> {
|
|
154
|
-
type?: PropType<T
|
|
155
|
-
required?: boolean
|
|
156
|
-
default?: T | null | undefined | (() => T | null | undefined)
|
|
157
|
-
validator?(value: T): boolean
|
|
261
|
+
export interface PropOptions<T = any> {
|
|
262
|
+
type?: PropType<T>
|
|
263
|
+
required?: boolean
|
|
264
|
+
default?: T | null | undefined | (() => T | null | undefined)
|
|
265
|
+
validator?(value: T): boolean
|
|
158
266
|
}
|
|
159
267
|
|
|
160
268
|
export type RecordPropsDefinition<T> = {
|
|
161
269
|
[K in keyof T]: PropValidator<T[K]>
|
|
162
270
|
}
|
|
163
|
-
export type ArrayPropsDefinition<T> = (keyof T)[]
|
|
164
|
-
export type PropsDefinition<T> =
|
|
271
|
+
export type ArrayPropsDefinition<T> = (keyof T)[]
|
|
272
|
+
export type PropsDefinition<T> =
|
|
273
|
+
| ArrayPropsDefinition<T>
|
|
274
|
+
| RecordPropsDefinition<T>
|
|
165
275
|
|
|
166
276
|
export interface ComputedOptions<T> {
|
|
167
|
-
get?(): T
|
|
168
|
-
set?(value: T): void
|
|
169
|
-
cache?: boolean
|
|
277
|
+
get?(): T
|
|
278
|
+
set?(value: T): void
|
|
279
|
+
cache?: boolean
|
|
170
280
|
}
|
|
171
281
|
|
|
172
|
-
export type WatchHandler<T> = string | ((val: T, oldVal: T) => void)
|
|
282
|
+
export type WatchHandler<T> = string | ((val: T, oldVal: T) => void)
|
|
173
283
|
|
|
174
284
|
export interface WatchOptions {
|
|
175
|
-
deep?: boolean
|
|
176
|
-
immediate?: boolean
|
|
285
|
+
deep?: boolean
|
|
286
|
+
immediate?: boolean
|
|
177
287
|
}
|
|
178
288
|
|
|
179
289
|
export interface WatchOptionsWithHandler<T> extends WatchOptions {
|
|
180
|
-
handler: WatchHandler<T
|
|
290
|
+
handler: WatchHandler<T>
|
|
181
291
|
}
|
|
182
292
|
|
|
183
293
|
export interface DirectiveBinding extends Readonly<VNodeDirective> {
|
|
184
|
-
readonly modifiers: { [key: string]: boolean }
|
|
294
|
+
readonly modifiers: { [key: string]: boolean }
|
|
185
295
|
}
|
|
186
296
|
|
|
187
297
|
export type DirectiveFunction = (
|
|
@@ -189,18 +299,41 @@ export type DirectiveFunction = (
|
|
|
189
299
|
binding: DirectiveBinding,
|
|
190
300
|
vnode: VNode,
|
|
191
301
|
oldVnode: VNode
|
|
192
|
-
) => void
|
|
302
|
+
) => void
|
|
193
303
|
|
|
194
304
|
export interface DirectiveOptions {
|
|
195
|
-
bind?: DirectiveFunction
|
|
196
|
-
inserted?: DirectiveFunction
|
|
197
|
-
update?: DirectiveFunction
|
|
198
|
-
componentUpdated?: DirectiveFunction
|
|
199
|
-
unbind?: DirectiveFunction
|
|
305
|
+
bind?: DirectiveFunction
|
|
306
|
+
inserted?: DirectiveFunction
|
|
307
|
+
update?: DirectiveFunction
|
|
308
|
+
componentUpdated?: DirectiveFunction
|
|
309
|
+
unbind?: DirectiveFunction
|
|
200
310
|
}
|
|
201
311
|
|
|
202
|
-
export type InjectKey = string | symbol
|
|
312
|
+
export type InjectKey = string | symbol
|
|
313
|
+
|
|
314
|
+
export type InjectOptions =
|
|
315
|
+
| {
|
|
316
|
+
[key: string]: InjectKey | { from?: InjectKey; default?: any }
|
|
317
|
+
}
|
|
318
|
+
| string[]
|
|
319
|
+
|
|
320
|
+
export type DebuggerEvent = {
|
|
321
|
+
target: object
|
|
322
|
+
type: TrackOpTypes | TriggerOpTypes
|
|
323
|
+
key?: any
|
|
324
|
+
newValue?: any
|
|
325
|
+
oldValue?: any
|
|
326
|
+
oldTarget?: Map<any, any> | Set<any>
|
|
327
|
+
}
|
|
203
328
|
|
|
204
|
-
export
|
|
205
|
-
|
|
206
|
-
|
|
329
|
+
export const enum TrackOpTypes {
|
|
330
|
+
GET = 'get',
|
|
331
|
+
TOUCH = 'touch'
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export const enum TriggerOpTypes {
|
|
335
|
+
SET = 'set',
|
|
336
|
+
ADD = 'add',
|
|
337
|
+
DELETE = 'delete',
|
|
338
|
+
ARRAY_MUTATION = 'array mutation'
|
|
339
|
+
}
|
package/types/plugin.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Vue as _Vue } from
|
|
1
|
+
import { Vue as _Vue } from './vue'
|
|
2
2
|
|
|
3
|
-
export type PluginFunction<T> = (Vue: typeof _Vue, options?: T) => void
|
|
3
|
+
export type PluginFunction<T> = (Vue: typeof _Vue, options?: T) => void
|
|
4
4
|
|
|
5
5
|
export interface PluginObject<T> {
|
|
6
|
-
install: PluginFunction<T
|
|
7
|
-
[key: string]: any
|
|
6
|
+
install: PluginFunction<T>
|
|
7
|
+
[key: string]: any
|
|
8
8
|
}
|
package/types/umd.d.ts
CHANGED
|
@@ -1,48 +1,68 @@
|
|
|
1
|
-
import * as V from
|
|
1
|
+
import * as V from './index'
|
|
2
2
|
import {
|
|
3
3
|
DefaultData,
|
|
4
4
|
DefaultProps,
|
|
5
5
|
DefaultMethods,
|
|
6
6
|
DefaultComputed,
|
|
7
7
|
PropsDefinition
|
|
8
|
-
} from
|
|
8
|
+
} from './options'
|
|
9
9
|
|
|
10
10
|
// Expose some types for backward compatibility...
|
|
11
11
|
declare namespace Vue {
|
|
12
12
|
// vue.d.ts
|
|
13
|
-
export type CreateElement = V.CreateElement
|
|
14
|
-
export type VueConstructor<V extends Vue = Vue> = V.VueConstructor<V
|
|
13
|
+
export type CreateElement = V.CreateElement
|
|
14
|
+
export type VueConstructor<V extends Vue = Vue> = V.VueConstructor<V>
|
|
15
15
|
|
|
16
16
|
// options.d.ts
|
|
17
|
-
export type Component<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export type
|
|
17
|
+
export type Component<
|
|
18
|
+
Data = DefaultData<never>,
|
|
19
|
+
Methods = DefaultMethods<never>,
|
|
20
|
+
Computed = DefaultComputed,
|
|
21
|
+
Props = DefaultProps
|
|
22
|
+
> = V.Component<Data, Methods, Computed, Props>
|
|
23
|
+
export type AsyncComponent<
|
|
24
|
+
Data = DefaultData<never>,
|
|
25
|
+
Methods = DefaultMethods<never>,
|
|
26
|
+
Computed = DefaultComputed,
|
|
27
|
+
Props = DefaultProps
|
|
28
|
+
> = V.AsyncComponent<Data, Methods, Computed, Props>
|
|
29
|
+
export type ComponentOptions<
|
|
30
|
+
V extends Vue,
|
|
31
|
+
Data = DefaultData<V>,
|
|
32
|
+
Methods = DefaultMethods<V>,
|
|
33
|
+
Computed = DefaultComputed,
|
|
34
|
+
PropsDef = PropsDefinition<DefaultProps>,
|
|
35
|
+
Props = DefaultProps
|
|
36
|
+
> = V.ComponentOptions<V, Data, Methods, Computed, PropsDef, Props>
|
|
37
|
+
export type FunctionalComponentOptions<
|
|
38
|
+
Props = DefaultProps,
|
|
39
|
+
PropDefs = PropsDefinition<Props>
|
|
40
|
+
> = V.FunctionalComponentOptions<Props, PropDefs>
|
|
41
|
+
export type RenderContext<Props = DefaultProps> = V.RenderContext<Props>
|
|
42
|
+
export type PropType<T> = V.PropType<T>
|
|
43
|
+
export type PropOptions<T = any> = V.PropOptions<T>
|
|
44
|
+
export type ComputedOptions<T> = V.ComputedOptions<T>
|
|
45
|
+
export type WatchHandler<T> = V.WatchHandler<T>
|
|
46
|
+
export type WatchOptions = V.WatchOptions
|
|
47
|
+
export type WatchOptionsWithHandler<T> = V.WatchOptionsWithHandler<T>
|
|
48
|
+
export type DirectiveFunction = V.DirectiveFunction
|
|
49
|
+
export type DirectiveOptions = V.DirectiveOptions
|
|
30
50
|
|
|
31
51
|
// plugin.d.ts
|
|
32
|
-
export type PluginFunction<T> = V.PluginFunction<T
|
|
33
|
-
export type PluginObject<T> = V.PluginObject<T
|
|
52
|
+
export type PluginFunction<T> = V.PluginFunction<T>
|
|
53
|
+
export type PluginObject<T> = V.PluginObject<T>
|
|
34
54
|
|
|
35
55
|
// vnode.d.ts
|
|
36
|
-
export type VNodeChildren = V.VNodeChildren
|
|
37
|
-
export type VNodeChildrenArrayContents = V.VNodeChildrenArrayContents
|
|
38
|
-
export type VNode = V.VNode
|
|
39
|
-
export type VNodeComponentOptions = V.VNodeComponentOptions
|
|
40
|
-
export type VNodeData = V.VNodeData
|
|
41
|
-
export type VNodeDirective = V.VNodeDirective
|
|
56
|
+
export type VNodeChildren = V.VNodeChildren
|
|
57
|
+
export type VNodeChildrenArrayContents = V.VNodeChildrenArrayContents
|
|
58
|
+
export type VNode = V.VNode
|
|
59
|
+
export type VNodeComponentOptions = V.VNodeComponentOptions
|
|
60
|
+
export type VNodeData = V.VNodeData
|
|
61
|
+
export type VNodeDirective = V.VNodeDirective
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
declare class Vue extends V.default {}
|
|
45
65
|
|
|
46
|
-
export = Vue
|
|
66
|
+
export = Vue
|
|
47
67
|
|
|
48
|
-
export as namespace Vue
|
|
68
|
+
export as namespace Vue
|