vue 2.6.7 → 2.6.11
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 +72 -52
- package/dist/README.md +1 -1
- package/dist/vue.common.dev.js +109 -51
- package/dist/vue.common.prod.js +2 -2
- package/dist/vue.esm.browser.js +109 -51
- package/dist/vue.esm.browser.min.js +2 -2
- package/dist/vue.esm.js +109 -51
- package/dist/vue.js +109 -51
- package/dist/vue.min.js +2 -2
- package/dist/vue.runtime.common.dev.js +80 -38
- package/dist/vue.runtime.common.prod.js +2 -2
- package/dist/vue.runtime.esm.js +80 -38
- package/dist/vue.runtime.js +80 -38
- package/dist/vue.runtime.min.js +2 -2
- package/package.json +4 -4
- package/src/compiler/codegen/events.js +1 -1
- package/src/compiler/codegen/index.js +1 -1
- package/src/compiler/error-detector.js +18 -3
- package/src/compiler/parser/html-parser.js +5 -5
- package/src/compiler/parser/index.js +7 -6
- package/src/core/instance/proxy.js +1 -1
- package/src/core/instance/render-helpers/bind-dynamic-keys.js +1 -1
- package/src/core/instance/render-helpers/bind-object-props.js +5 -3
- package/src/core/instance/render.js +1 -1
- package/src/core/observer/scheduler.js +17 -6
- package/src/core/util/env.js +1 -2
- package/src/core/util/error.js +4 -3
- package/src/core/util/lang.js +2 -2
- package/src/core/util/next-tick.js +1 -1
- package/src/core/util/options.js +2 -2
- package/src/core/vdom/create-element.js +6 -0
- package/src/core/vdom/helpers/normalize-scoped-slots.js +9 -4
- package/src/core/vdom/helpers/resolve-async-component.js +25 -8
- package/src/core/vdom/patch.js +4 -4
- package/src/platforms/web/compiler/modules/model.js +1 -1
- package/src/platforms/web/runtime/modules/dom-props.js +2 -1
- package/src/platforms/web/runtime/modules/events.js +4 -2
- package/src/platforms/web/runtime/modules/transition.js +1 -1
- package/src/server/template-renderer/create-async-file-mapper.js +2 -2
- package/src/server/write.js +1 -1
- package/types/index.d.ts +1 -2
- package/types/options.d.ts +3 -3
- package/types/umd.d.ts +48 -0
- package/types/vnode.d.ts +6 -2
- package/types/vue.d.ts +3 -3
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
warn,
|
|
9
9
|
nextTick,
|
|
10
10
|
devtools,
|
|
11
|
-
inBrowser
|
|
11
|
+
inBrowser,
|
|
12
|
+
isIE
|
|
12
13
|
} from '../util/index'
|
|
13
14
|
|
|
14
15
|
export const MAX_UPDATE_COUNT = 100
|
|
@@ -47,11 +48,21 @@ let getNow: () => number = Date.now
|
|
|
47
48
|
// timestamp can either be hi-res (relative to page load) or low-res
|
|
48
49
|
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
49
50
|
// same timestamp type when saving the flush timestamp.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
// All IE versions use low-res event timestamps, and have problematic clock
|
|
52
|
+
// implementations (#9632)
|
|
53
|
+
if (inBrowser && !isIE) {
|
|
54
|
+
const performance = window.performance
|
|
55
|
+
if (
|
|
56
|
+
performance &&
|
|
57
|
+
typeof performance.now === 'function' &&
|
|
58
|
+
getNow() > document.createEvent('Event').timeStamp
|
|
59
|
+
) {
|
|
60
|
+
// if the event timestamp, although evaluated AFTER the Date.now(), is
|
|
61
|
+
// smaller than it, it means the event is using a hi-res timestamp,
|
|
62
|
+
// and we need to use the hi-res version for event listener timestamps as
|
|
63
|
+
// well.
|
|
64
|
+
getNow = () => performance.now()
|
|
65
|
+
}
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
/**
|
package/src/core/util/env.js
CHANGED
|
@@ -87,11 +87,10 @@ if (typeof Set !== 'undefined' && isNative(Set)) {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
interface SimpleSet {
|
|
90
|
+
export interface SimpleSet {
|
|
91
91
|
has(key: string | number): boolean;
|
|
92
92
|
add(key: string | number): mixed;
|
|
93
93
|
clear(): void;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export { _Set }
|
|
97
|
-
export type { SimpleSet }
|
package/src/core/util/error.js
CHANGED
|
@@ -43,10 +43,11 @@ export function invokeWithErrorHandling (
|
|
|
43
43
|
let res
|
|
44
44
|
try {
|
|
45
45
|
res = args ? handler.apply(context, args) : handler.call(context)
|
|
46
|
-
if (res && !res._isVue && isPromise(res)) {
|
|
46
|
+
if (res && !res._isVue && isPromise(res) && !res._handled) {
|
|
47
|
+
res.catch(e => handleError(e, vm, info + ` (Promise/async)`))
|
|
47
48
|
// issue #9511
|
|
48
|
-
//
|
|
49
|
-
res =
|
|
49
|
+
// avoid catch triggering multiple times when nested calls
|
|
50
|
+
res._handled = true
|
|
50
51
|
}
|
|
51
52
|
} catch (e) {
|
|
52
53
|
handleError(e, vm, info)
|
package/src/core/util/lang.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
|
|
6
6
|
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
|
|
7
7
|
*/
|
|
8
|
-
export const
|
|
8
|
+
export const unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Check if a string starts with $ or _
|
|
@@ -30,7 +30,7 @@ export function def (obj: Object, key: string, val: any, enumerable?: boolean) {
|
|
|
30
30
|
/**
|
|
31
31
|
* Parse simple path.
|
|
32
32
|
*/
|
|
33
|
-
const bailRE = new RegExp(`[^${
|
|
33
|
+
const bailRE = new RegExp(`[^${unicodeRegExp.source}.$_\\d]`)
|
|
34
34
|
export function parsePath (path: string): any {
|
|
35
35
|
if (bailRE.test(path)) {
|
|
36
36
|
return
|
|
@@ -72,7 +72,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
|
|
72
72
|
isUsingMicroTask = true
|
|
73
73
|
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
|
74
74
|
// Fallback to setImmediate.
|
|
75
|
-
//
|
|
75
|
+
// Technically it leverages the (macro) task queue,
|
|
76
76
|
// but it is still a better choice than setTimeout.
|
|
77
77
|
timerFunc = () => {
|
|
78
78
|
setImmediate(flushCallbacks)
|
package/src/core/util/options.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import config from '../config'
|
|
4
4
|
import { warn } from './debug'
|
|
5
5
|
import { set } from '../observer/index'
|
|
6
|
-
import {
|
|
6
|
+
import { unicodeRegExp } from './lang'
|
|
7
7
|
import { nativeWatch, hasSymbol } from './env'
|
|
8
8
|
|
|
9
9
|
import {
|
|
@@ -277,7 +277,7 @@ function checkComponents (options: Object) {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
export function validateComponentName (name: string) {
|
|
280
|
-
if (!new RegExp(`^[a-zA-Z][\\-\\.0-9_${
|
|
280
|
+
if (!new RegExp(`^[a-zA-Z][\\-\\.0-9_${unicodeRegExp.source}]*$`).test(name)) {
|
|
281
281
|
warn(
|
|
282
282
|
'Invalid component name: "' + name + '". Component names ' +
|
|
283
283
|
'should conform to valid custom element name in html5 specification.'
|
|
@@ -98,6 +98,12 @@ export function _createElement (
|
|
|
98
98
|
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag)
|
|
99
99
|
if (config.isReservedTag(tag)) {
|
|
100
100
|
// platform built-in elements
|
|
101
|
+
if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn)) {
|
|
102
|
+
warn(
|
|
103
|
+
`The .native modifier for v-on is only valid on components but it was used on <${tag}>.`,
|
|
104
|
+
context
|
|
105
|
+
)
|
|
106
|
+
}
|
|
101
107
|
vnode = new VNode(
|
|
102
108
|
config.parsePlatformTagName(tag), data, children,
|
|
103
109
|
undefined, undefined, context
|
|
@@ -10,7 +10,8 @@ export function normalizeScopedSlots (
|
|
|
10
10
|
prevSlots?: { [key: string]: Function } | void
|
|
11
11
|
): any {
|
|
12
12
|
let res
|
|
13
|
-
const
|
|
13
|
+
const hasNormalSlots = Object.keys(normalSlots).length > 0
|
|
14
|
+
const isStable = slots ? !!slots.$stable : !hasNormalSlots
|
|
14
15
|
const key = slots && slots.$key
|
|
15
16
|
if (!slots) {
|
|
16
17
|
res = {}
|
|
@@ -22,7 +23,8 @@ export function normalizeScopedSlots (
|
|
|
22
23
|
prevSlots &&
|
|
23
24
|
prevSlots !== emptyObject &&
|
|
24
25
|
key === prevSlots.$key &&
|
|
25
|
-
|
|
26
|
+
!hasNormalSlots &&
|
|
27
|
+
!prevSlots.$hasNormal
|
|
26
28
|
) {
|
|
27
29
|
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
|
28
30
|
// only need to normalize once
|
|
@@ -48,6 +50,7 @@ export function normalizeScopedSlots (
|
|
|
48
50
|
}
|
|
49
51
|
def(res, '$stable', isStable)
|
|
50
52
|
def(res, '$key', key)
|
|
53
|
+
def(res, '$hasNormal', hasNormalSlots)
|
|
51
54
|
return res
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -57,8 +60,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
|
|
|
57
60
|
res = res && typeof res === 'object' && !Array.isArray(res)
|
|
58
61
|
? [res] // single vnode
|
|
59
62
|
: normalizeChildren(res)
|
|
60
|
-
return res &&
|
|
61
|
-
|
|
63
|
+
return res && (
|
|
64
|
+
res.length === 0 ||
|
|
65
|
+
(res.length === 1 && res[0].isComment) // #9658
|
|
66
|
+
) ? undefined
|
|
62
67
|
: res
|
|
63
68
|
}
|
|
64
69
|
// this is a slot using the new v-slot syntax without scope. although it is
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
isTrue,
|
|
9
9
|
isObject,
|
|
10
10
|
hasSymbol,
|
|
11
|
-
isPromise
|
|
11
|
+
isPromise,
|
|
12
|
+
remove
|
|
12
13
|
} from 'core/util/index'
|
|
13
14
|
|
|
14
15
|
import { createEmptyVNode } from 'core/vdom/vnode'
|
|
@@ -51,17 +52,23 @@ export function resolveAsyncComponent (
|
|
|
51
52
|
return factory.resolved
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
const owner = currentRenderingInstance
|
|
56
|
+
if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
|
57
|
+
// already pending
|
|
58
|
+
factory.owners.push(owner)
|
|
59
|
+
}
|
|
60
|
+
|
|
54
61
|
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
|
55
62
|
return factory.loadingComp
|
|
56
63
|
}
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
if (isDef(factory.owners)) {
|
|
60
|
-
// already pending
|
|
61
|
-
factory.owners.push(owner)
|
|
62
|
-
} else {
|
|
65
|
+
if (owner && !isDef(factory.owners)) {
|
|
63
66
|
const owners = factory.owners = [owner]
|
|
64
67
|
let sync = true
|
|
68
|
+
let timerLoading = null
|
|
69
|
+
let timerTimeout = null
|
|
70
|
+
|
|
71
|
+
;(owner: any).$on('hook:destroyed', () => remove(owners, owner))
|
|
65
72
|
|
|
66
73
|
const forceRender = (renderCompleted: boolean) => {
|
|
67
74
|
for (let i = 0, l = owners.length; i < l; i++) {
|
|
@@ -70,6 +77,14 @@ export function resolveAsyncComponent (
|
|
|
70
77
|
|
|
71
78
|
if (renderCompleted) {
|
|
72
79
|
owners.length = 0
|
|
80
|
+
if (timerLoading !== null) {
|
|
81
|
+
clearTimeout(timerLoading)
|
|
82
|
+
timerLoading = null
|
|
83
|
+
}
|
|
84
|
+
if (timerTimeout !== null) {
|
|
85
|
+
clearTimeout(timerTimeout)
|
|
86
|
+
timerTimeout = null
|
|
87
|
+
}
|
|
73
88
|
}
|
|
74
89
|
}
|
|
75
90
|
|
|
@@ -116,7 +131,8 @@ export function resolveAsyncComponent (
|
|
|
116
131
|
if (res.delay === 0) {
|
|
117
132
|
factory.loading = true
|
|
118
133
|
} else {
|
|
119
|
-
setTimeout(() => {
|
|
134
|
+
timerLoading = setTimeout(() => {
|
|
135
|
+
timerLoading = null
|
|
120
136
|
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
|
121
137
|
factory.loading = true
|
|
122
138
|
forceRender(false)
|
|
@@ -126,7 +142,8 @@ export function resolveAsyncComponent (
|
|
|
126
142
|
}
|
|
127
143
|
|
|
128
144
|
if (isDef(res.timeout)) {
|
|
129
|
-
setTimeout(() => {
|
|
145
|
+
timerTimeout = setTimeout(() => {
|
|
146
|
+
timerTimeout = null
|
|
130
147
|
if (isUndef(factory.resolved)) {
|
|
131
148
|
reject(
|
|
132
149
|
process.env.NODE_ENV !== 'production'
|
package/src/core/vdom/patch.js
CHANGED
|
@@ -358,7 +358,7 @@ export function createPatchFunction (backend) {
|
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
function removeVnodes (
|
|
361
|
+
function removeVnodes (vnodes, startIdx, endIdx) {
|
|
362
362
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
363
363
|
const ch = vnodes[startIdx]
|
|
364
364
|
if (isDef(ch)) {
|
|
@@ -469,7 +469,7 @@ export function createPatchFunction (backend) {
|
|
|
469
469
|
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm
|
|
470
470
|
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue)
|
|
471
471
|
} else if (newStartIdx > newEndIdx) {
|
|
472
|
-
removeVnodes(
|
|
472
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx)
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
475
|
|
|
@@ -561,7 +561,7 @@ export function createPatchFunction (backend) {
|
|
|
561
561
|
if (isDef(oldVnode.text)) nodeOps.setTextContent(elm, '')
|
|
562
562
|
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue)
|
|
563
563
|
} else if (isDef(oldCh)) {
|
|
564
|
-
removeVnodes(
|
|
564
|
+
removeVnodes(oldCh, 0, oldCh.length - 1)
|
|
565
565
|
} else if (isDef(oldVnode.text)) {
|
|
566
566
|
nodeOps.setTextContent(elm, '')
|
|
567
567
|
}
|
|
@@ -790,7 +790,7 @@ export function createPatchFunction (backend) {
|
|
|
790
790
|
|
|
791
791
|
// destroy old node
|
|
792
792
|
if (isDef(parentElm)) {
|
|
793
|
-
removeVnodes(
|
|
793
|
+
removeVnodes([oldVnode], 0, 0)
|
|
794
794
|
} else if (isDef(oldVnode.tag)) {
|
|
795
795
|
invokeDestroyHook(oldVnode)
|
|
796
796
|
}
|
|
@@ -19,10 +19,11 @@ function updateDOMProps (oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
for (key in oldProps) {
|
|
22
|
-
if (
|
|
22
|
+
if (!(key in props)) {
|
|
23
23
|
elm[key] = ''
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
|
|
26
27
|
for (key in props) {
|
|
27
28
|
cur = props[key]
|
|
28
29
|
// ignore children if the node has textContent or innerHTML,
|
|
@@ -67,8 +67,10 @@ function add (
|
|
|
67
67
|
e.target === e.currentTarget ||
|
|
68
68
|
// event is fired after handler attachment
|
|
69
69
|
e.timeStamp >= attachedTimestamp ||
|
|
70
|
-
//
|
|
71
|
-
|
|
70
|
+
// bail for environments that have buggy event.timeStamp implementations
|
|
71
|
+
// #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
|
|
72
|
+
// #9681 QtWebEngine event.timeStamp is negative value
|
|
73
|
+
e.timeStamp <= 0 ||
|
|
72
74
|
// #9448 bail if event is fired in another document in a multi-page
|
|
73
75
|
// electron/nw.js app, since event.timeStamp will be using a different
|
|
74
76
|
// starting reference
|
|
@@ -66,8 +66,8 @@ export function enter (vnode: VNodeWithData, toggleDisplay: ?() => void) {
|
|
|
66
66
|
let context = activeInstance
|
|
67
67
|
let transitionNode = activeInstance.$vnode
|
|
68
68
|
while (transitionNode && transitionNode.parent) {
|
|
69
|
-
transitionNode = transitionNode.parent
|
|
70
69
|
context = transitionNode.context
|
|
70
|
+
transitionNode = transitionNode.parent
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const isAppear = !context._isMounted || !vnode.isRootInsert
|
|
@@ -43,8 +43,8 @@ function mapIdToFile (id, clientManifest) {
|
|
|
43
43
|
if (fileIndices) {
|
|
44
44
|
fileIndices.forEach(index => {
|
|
45
45
|
const file = clientManifest.all[index]
|
|
46
|
-
// only include async files or non-js assets
|
|
47
|
-
if (clientManifest.async.indexOf(file) > -1 || !(/\.js($|\?)/.test(file))) {
|
|
46
|
+
// only include async files or non-js, non-css assets
|
|
47
|
+
if (clientManifest.async.indexOf(file) > -1 || !(/\.(js|css)($|\?)/.test(file))) {
|
|
48
48
|
files.push(file)
|
|
49
49
|
}
|
|
50
50
|
})
|
package/src/server/write.js
CHANGED
package/types/index.d.ts
CHANGED
package/types/options.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Vue, CreateElement, CombinedVueInstance } from "./vue";
|
|
2
|
-
import { VNode, VNodeData, VNodeDirective,
|
|
2
|
+
import { VNode, VNodeData, VNodeDirective, NormalizedScopedSlot } from "./vnode";
|
|
3
3
|
|
|
4
4
|
type Constructor = {
|
|
5
5
|
new (...args: any[]): any;
|
|
@@ -140,11 +140,11 @@ export interface RenderContext<Props=DefaultProps> {
|
|
|
140
140
|
data: VNodeData;
|
|
141
141
|
parent: Vue;
|
|
142
142
|
listeners: { [key: string]: Function | Function[] };
|
|
143
|
-
scopedSlots: { [key: string]:
|
|
143
|
+
scopedSlots: { [key: string]: NormalizedScopedSlot };
|
|
144
144
|
injections: any
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
export type Prop<T> = { (): T } | { new(...args:
|
|
147
|
+
export type Prop<T> = { (): T } | { new(...args: never[]): T & object } | { new(...args: string[]): Function }
|
|
148
148
|
|
|
149
149
|
export type PropType<T> = Prop<T> | Prop<T>[];
|
|
150
150
|
|
package/types/umd.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as V from "./index";
|
|
2
|
+
import {
|
|
3
|
+
DefaultData,
|
|
4
|
+
DefaultProps,
|
|
5
|
+
DefaultMethods,
|
|
6
|
+
DefaultComputed,
|
|
7
|
+
PropsDefinition
|
|
8
|
+
} from "./options";
|
|
9
|
+
|
|
10
|
+
// Expose some types for backword compatibility...
|
|
11
|
+
declare namespace Vue {
|
|
12
|
+
// vue.d.ts
|
|
13
|
+
export type CreateElement = V.CreateElement;
|
|
14
|
+
export type VueConstructor<V extends Vue = Vue> = V.VueConstructor<V>;
|
|
15
|
+
|
|
16
|
+
// options.d.ts
|
|
17
|
+
export type Component<Data=DefaultData<never>, Methods=DefaultMethods<never>, Computed=DefaultComputed, Props=DefaultProps> = V.Component<Data, Methods, Computed, Props>;
|
|
18
|
+
export type AsyncComponent<Data=DefaultData<never>, Methods=DefaultMethods<never>, Computed=DefaultComputed, Props=DefaultProps> = V.AsyncComponent<Data, Methods, Computed, Props>;
|
|
19
|
+
export type ComponentOptions<V extends Vue, Data=DefaultData<V>, Methods=DefaultMethods<V>, Computed=DefaultComputed, PropsDef=PropsDefinition<DefaultProps>, Props=DefaultProps> = V.ComponentOptions<V, Data, Methods, Computed, PropsDef, Props>;
|
|
20
|
+
export type FunctionalComponentOptions<Props = DefaultProps, PropDefs = PropsDefinition<Props>> = V.FunctionalComponentOptions<Props, PropDefs>;
|
|
21
|
+
export type RenderContext<Props=DefaultProps> = V.RenderContext<Props>;
|
|
22
|
+
export type PropType<T> = V.PropType<T>;
|
|
23
|
+
export type PropOptions<T=any> = V.PropOptions<T>;
|
|
24
|
+
export type ComputedOptions<T> = V.ComputedOptions<T>;
|
|
25
|
+
export type WatchHandler<T> = V.WatchHandler<T>;
|
|
26
|
+
export type WatchOptions = V.WatchOptions;
|
|
27
|
+
export type WatchOptionsWithHandler<T> = V.WatchOptionsWithHandler<T>;
|
|
28
|
+
export type DirectiveFunction = V.DirectiveFunction;
|
|
29
|
+
export type DirectiveOptions = V.DirectiveOptions;
|
|
30
|
+
|
|
31
|
+
// plugin.d.ts
|
|
32
|
+
export type PluginFunction<T> = V.PluginFunction<T>;
|
|
33
|
+
export type PluginObject<T> = V.PluginObject<T>;
|
|
34
|
+
|
|
35
|
+
// 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;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare class Vue extends V.default {}
|
|
45
|
+
|
|
46
|
+
export = Vue;
|
|
47
|
+
|
|
48
|
+
export as namespace Vue;
|
package/types/vnode.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Vue } from "./vue";
|
|
2
2
|
|
|
3
|
+
export type ScopedSlot = (props: any) => ScopedSlotReturnValue;
|
|
4
|
+
type ScopedSlotReturnValue = VNode | string | boolean | null | undefined | ScopedSlotReturnArray;
|
|
5
|
+
interface ScopedSlotReturnArray extends Array<ScopedSlotReturnValue> {}
|
|
6
|
+
|
|
3
7
|
// Scoped slots are guaranteed to return Array of VNodes starting in 2.6
|
|
4
|
-
export type
|
|
8
|
+
export type NormalizedScopedSlot = (props: any) => ScopedSlotChildren;
|
|
5
9
|
export type ScopedSlotChildren = VNode[] | undefined;
|
|
6
10
|
|
|
7
11
|
// Relaxed type compatible with $createElement
|
|
@@ -44,7 +48,7 @@ export interface VNodeData {
|
|
|
44
48
|
staticClass?: string;
|
|
45
49
|
class?: any;
|
|
46
50
|
staticStyle?: { [key: string]: any };
|
|
47
|
-
style?: object[] | object;
|
|
51
|
+
style?: string | object[] | object;
|
|
48
52
|
props?: { [key: string]: any };
|
|
49
53
|
attrs?: { [key: string]: any };
|
|
50
54
|
domProps?: { [key: string]: any };
|
package/types/vue.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ThisTypedComponentOptionsWithRecordProps,
|
|
13
13
|
WatchOptions,
|
|
14
14
|
} from "./options";
|
|
15
|
-
import { VNode, VNodeData, VNodeChildren,
|
|
15
|
+
import { VNode, VNodeData, VNodeChildren, NormalizedScopedSlot } from "./vnode";
|
|
16
16
|
import { PluginFunction, PluginObject } from "./plugin";
|
|
17
17
|
|
|
18
18
|
export interface CreateElement {
|
|
@@ -28,7 +28,7 @@ export interface Vue {
|
|
|
28
28
|
readonly $children: Vue[];
|
|
29
29
|
readonly $refs: { [key: string]: Vue | Element | Vue[] | Element[] };
|
|
30
30
|
readonly $slots: { [key: string]: VNode[] | undefined };
|
|
31
|
-
readonly $scopedSlots: { [key: string]:
|
|
31
|
+
readonly $scopedSlots: { [key: string]: NormalizedScopedSlot | undefined };
|
|
32
32
|
readonly $isServer: boolean;
|
|
33
33
|
readonly $data: Record<string, any>;
|
|
34
34
|
readonly $props: Record<string, any>;
|
|
@@ -89,7 +89,7 @@ export interface VueConstructor<V extends Vue = Vue> {
|
|
|
89
89
|
extend<Props>(definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>): ExtendedVue<V, {}, {}, {}, Props>;
|
|
90
90
|
extend(options?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>;
|
|
91
91
|
|
|
92
|
-
nextTick(callback: () => void, context?:
|
|
92
|
+
nextTick<T>(callback: (this: T) => void, context?: T): void;
|
|
93
93
|
nextTick(): Promise<void>
|
|
94
94
|
set<T>(object: object, key: string | number, value: T): T;
|
|
95
95
|
set<T>(array: T[], key: number, value: T): T;
|