vue 2.6.8 → 2.6.12
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 +61 -81
- package/dist/README.md +3 -5
- package/dist/vue.common.dev.js +97 -44
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +97 -44
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +97 -44
- package/dist/vue.js +97 -44
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +73 -35
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +73 -35
- package/dist/vue.runtime.js +73 -35
- package/dist/vue.runtime.min.js +3 -3
- package/package.json +4 -4
- package/src/compiler/codegen/events.js +1 -1
- package/src/compiler/error-detector.js +18 -3
- package/src/compiler/parser/html-parser.js +2 -2
- package/src/compiler/parser/index.js +5 -5
- package/src/core/instance/proxy.js +1 -1
- package/src/core/instance/render-helpers/bind-dynamic-keys.js +2 -2
- 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/next-tick.js +1 -1
- 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 +16 -4
- 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 +3 -2
- package/src/platforms/web/runtime/modules/events.js +4 -2
- package/src/platforms/web/runtime/modules/transition.js +1 -1
- package/src/platforms/web/server/util.js +4 -4
- package/src/server/template-renderer/create-async-file-mapper.js +2 -2
- 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 +1 -1
- package/types/vue.d.ts +1 -1
|
@@ -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)
|
|
@@ -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
|
|
@@ -53,7 +53,7 @@ export function resolveAsyncComponent (
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const owner = currentRenderingInstance
|
|
56
|
-
if (isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
|
56
|
+
if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
|
57
57
|
// already pending
|
|
58
58
|
factory.owners.push(owner)
|
|
59
59
|
}
|
|
@@ -62,9 +62,11 @@ export function resolveAsyncComponent (
|
|
|
62
62
|
return factory.loadingComp
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
if (!isDef(factory.owners)) {
|
|
65
|
+
if (owner && !isDef(factory.owners)) {
|
|
66
66
|
const owners = factory.owners = [owner]
|
|
67
67
|
let sync = true
|
|
68
|
+
let timerLoading = null
|
|
69
|
+
let timerTimeout = null
|
|
68
70
|
|
|
69
71
|
;(owner: any).$on('hook:destroyed', () => remove(owners, owner))
|
|
70
72
|
|
|
@@ -75,6 +77,14 @@ export function resolveAsyncComponent (
|
|
|
75
77
|
|
|
76
78
|
if (renderCompleted) {
|
|
77
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
|
+
}
|
|
78
88
|
}
|
|
79
89
|
}
|
|
80
90
|
|
|
@@ -121,7 +131,8 @@ export function resolveAsyncComponent (
|
|
|
121
131
|
if (res.delay === 0) {
|
|
122
132
|
factory.loading = true
|
|
123
133
|
} else {
|
|
124
|
-
setTimeout(() => {
|
|
134
|
+
timerLoading = setTimeout(() => {
|
|
135
|
+
timerLoading = null
|
|
125
136
|
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
|
126
137
|
factory.loading = true
|
|
127
138
|
forceRender(false)
|
|
@@ -131,7 +142,8 @@ export function resolveAsyncComponent (
|
|
|
131
142
|
}
|
|
132
143
|
|
|
133
144
|
if (isDef(res.timeout)) {
|
|
134
|
-
setTimeout(() => {
|
|
145
|
+
timerTimeout = setTimeout(() => {
|
|
146
|
+
timerTimeout = null
|
|
135
147
|
if (isUndef(factory.resolved)) {
|
|
136
148
|
reject(
|
|
137
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,
|
|
@@ -62,7 +63,7 @@ function updateDOMProps (oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
|
|
62
63
|
// skip the update if old and new VDOM state is the same.
|
|
63
64
|
// `value` is handled separately because the DOM value may be temporarily
|
|
64
65
|
// out of sync with VDOM state due to focus, composition and modifiers.
|
|
65
|
-
// This #4521 by skipping the
|
|
66
|
+
// This #4521 by skipping the unnecessary `checked` update.
|
|
66
67
|
cur !== oldProps[key]
|
|
67
68
|
) {
|
|
68
69
|
// some property updates can throw
|
|
@@ -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
|
|
@@ -5,9 +5,9 @@ import { makeMap } from 'shared/util'
|
|
|
5
5
|
const isAttr = makeMap(
|
|
6
6
|
'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
|
|
7
7
|
'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
|
|
8
|
-
'checked,cite,class,code,codebase,color,cols,colspan,content,
|
|
9
|
-
'
|
|
10
|
-
'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,
|
|
8
|
+
'checked,cite,class,code,codebase,color,cols,colspan,content,' +
|
|
9
|
+
'contenteditable,contextmenu,controls,coords,data,datetime,default,' +
|
|
10
|
+
'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,for,' +
|
|
11
11
|
'form,formaction,headers,height,hidden,high,href,hreflang,http-equiv,' +
|
|
12
12
|
'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' +
|
|
13
13
|
'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' +
|
|
@@ -15,7 +15,7 @@ const isAttr = makeMap(
|
|
|
15
15
|
'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' +
|
|
16
16
|
'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' +
|
|
17
17
|
'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' +
|
|
18
|
-
'target,title,
|
|
18
|
+
'target,title,usemap,value,width,wrap'
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/ // eslint-disable-line no-control-regex
|
|
@@ -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/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 backward 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
|
@@ -48,7 +48,7 @@ export interface VNodeData {
|
|
|
48
48
|
staticClass?: string;
|
|
49
49
|
class?: any;
|
|
50
50
|
staticStyle?: { [key: string]: any };
|
|
51
|
-
style?: object[] | object;
|
|
51
|
+
style?: string | object[] | object;
|
|
52
52
|
props?: { [key: string]: any };
|
|
53
53
|
attrs?: { [key: string]: any };
|
|
54
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 {
|