diff --git a/.editorconfig b/.editorconfig index f1cc3ad329c..01a20f16fe3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -# http://editorconfig.org +# https://editorconfig.org root = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 3a2082ef646..5368b5481bc 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -124,14 +124,7 @@ The default test script will do the following: lint with ESLint -> type check wi ## Financial Contribution -As a pure community-driven project without major corporate backing, we also welcome financial contributions via Patreon and OpenCollective. - -- [Become a backer or sponsor on Patreon](https://www.patreon.com/evanyou) -- [Become a backer or sponsor on OpenCollective](https://opencollective.com/vuejs) - -### What's the difference between Patreon and OpenCollective funding? - -Funds donated via Patreon go directly to support Evan You's full-time work on Vue.js. Funds donated via OpenCollective are managed with transparent expenses and will be used for compensating work and expenses for core team members or sponsoring community events. Your name/logo will receive proper recognition and exposure by donating on either platform. +As a pure community-driven project without major corporate backing, we also welcome financial contributions via GitHub Sponsors and OpenCollective. Please consult the [Sponsor Page](https://vuejs.org/sponsor/) for more details. ## Credits diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index cb7f961992c..00000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000000..675eea91e7c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: false +contact_links: + - name: Create new issue + url: https://new-issue.vuejs.org/ + about: Please use the following link to create a new issue. + - name: Patreon + url: https://www.patreon.com/evanyou + about: Love Vue.js? Please consider supporting us via Patreon. + - name: Open Collective + url: https://opencollective.com/vuejs/donate + about: Love Vue.js? Please consider supporting us via Open Collective. diff --git a/BACKERS.md b/BACKERS.md index 97127265c4f..fa66d206698 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -1,473 +1,9 @@

Sponsors & Backers

-Vue.js is an MIT-licensed open source project. It's an independent project with its ongoing development made possible entirely thanks to the support by these awesome [backers](https://github.com/vuejs/vue/blob/dev/BACKERS.md). If you'd like to join them, please consider: - -- [Become a backer or sponsor on Patreon](https://www.patreon.com/evanyou). -- [Become a backer or sponsor on OpenCollective](https://opencollective.com/vuejs). -- [One-time donation via PayPal or crypto-currencies.](https://vuejs.org/support-vuejs/#One-time-Donations) - -#### What's the difference between Patreon and OpenCollective? - -Funds donated via Patreon go directly to support Evan You's full-time work on Vue.js. Funds donated via OpenCollective are managed with transparent expenses and will be used for compensating work and expenses for core team members or sponsoring community events. Your name/logo will receive proper recognition and exposure by donating on either platform. - -

- -

Special Sponsors

- - +Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of the awesome sponsors and backers listed in this file. If you'd like to join them, please consider [ sponsor Vue's development](https://vuejs.org/sponsor/).

- - + + sponsors

- - - -

Platinum via Patreon

- - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - -

Platinum Sponsors (China)

- - - - - - -
- - - -
- - -

Platinum via OpenCollective

- - - - -

Gold via Patreon

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - -

Gold via OpenCollective

- - - - - - - - - - - - - -

Silver via Patreon

- -- Matt Mullenweg - - - - - - - - - -
- - - - - - - -
- - -

Silver via OpenCollective

- - - - - -

Bronze via Patreon

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - -

Bronze via OpenCollective

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Generous Backers via Patreon ($50+)

- - -- Wasim Khamlichi -- errorrik -- Alex Balashov -- Konstantin Levinski -- Blaise Laflamme -- Sean Ferguson -- Johnny Ray Austin -- Daniel -- Manuel Guzman - - -

Backers via Patreon

- - -- Masahiro Tanaka -- Shawn Wildermuth -- Sean Washington -- Lars Andreas Ness -- Benjamin Listwon -- Keisuke Kita -- Kirk Lewis -- Victor Tolbert -- Wen-Tien Chang -- Stephen Michael Hartley -- Phan An -- Luiz -- James J. Ye -- Barbara Liau -- Matsumoto Takamasa -- Matt Jones -- Niannian Modisette -- Guy Gavergun -- Bernhard E. Reiter -- Zoran Knezevic -- Pierre Vanhulst -- Jon Hobbs-Smith -- Akiho Nagao -- Haim Yulzari -- Anthony Estebe -- Asaf Yishai -- Jim Raden -- Jeremy Tan -- IMGNRY -- Tyler -- Mickaël Andrieu -- Vivekanandhan Natarajan -- Guilherme S L de Souza -- Joe Gregory -- Jordan Oroshiba -- Marcos Moura -- Jessie Hernandez -- username -- Ivan Sieder -- Eric -- Romain Lienard -- Bohdan Kokotko -- Christo Crampton -- David Ang -- Donald Fischer -- Jere Sjöroos -- Wakana Seki -- Alexander Weiher -- Philip John Basile -- Oskar Lindgren -- Jaeyoung Lee -- David Kaplan -- Domenico Gaudioso -- Andy -- Matt Sencenbaugh -- Juan Bermudez -- Chris Calo -- Elon Hung -- Hannes Kochniß -- Soichiro Isshiki -- Garion Herman -- Ed Linklater -- Andrew Willis -- Yusuke Kawabata -- Princeyesuraj Edward -- Peter Matkovsky -- Nick Dandakis -- 龙腾道 -- Fabien GuySake Ungerer -- Nathan Mallison -- Kenneth Crawford -- Bill Condo -- Pierre Lebrun -- Ryan Brewer -- Martin Bastien -- Alfonso Herrera -- Bichinger Software & Consulting -- Riki Fridrich -- Nicolaas -- Afif Sohaili -- darkbluewalrus -- Diana Bergholz -- Tomasz Kleszczewski -- Allan McKernan -- Parham -- 琚致远 - - -

Backers via OpenCollective

- - diff --git a/README.md b/README.md index 0aa524d2093..ed68ab8bbbc 100644 --- a/README.md +++ b/README.md @@ -1,275 +1,27 @@

Vue logo

- Build Status - Coverage Status - Downloads - Version - License - Chat -
- Build Status + Build Status + Coverage Status + Downloads + Version + License + Chat

-

Supporting Vue.js

+## This repo is for Vue 2 -Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [backers](https://github.com/vuejs/vue/blob/dev/BACKERS.md). If you'd like to join them, please consider: +You are looking at the repository for Vue 2. The repo for Vue 3 is [vuejs/core](https://github.com/vuejs/core). -- [Become a backer or sponsor on Patreon](https://www.patreon.com/evanyou). -- [Become a backer or sponsor on Open Collective](https://opencollective.com/vuejs). -- [One-time donation via PayPal or crypto-currencies.](https://vuejs.org/support-vuejs/#One-time-Donations) +## Sponsors -#### What's the difference between Patreon and OpenCollective? - -Funds donated via Patreon go directly to support Evan You's full-time work on Vue.js. Funds donated via OpenCollective are managed with transparent expenses and will be used for compensating work and expenses for core team members or sponsoring community events. Your name/logo will receive proper recognition and exposure by donating on either platform. - -

Special Sponsors

- +Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [backers](https://github.com/vuejs/core/blob/main/BACKERS.md). If you'd like to join them, please consider [ sponsor Vue's development](https://vuejs.org/sponsor/).

- - + + sponsors

- - - -

Platinum Sponsors

- - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - -

Platinum Sponsors (China)

- - - - - - -
- - - -
- - -

Gold Sponsors

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - -

Sponsors via Open Collective

- -

Platinum

- - - - -

Gold

- - - - - - --- @@ -279,20 +31,20 @@ Vue (pronounced `/vjuː/`, like view) is a **progressive framework** for buildin #### Browser Compatibility -Vue.js supports all browsers that are [ES5-compliant](http://kangax.github.io/compat-table/es5/) (IE8 and below are not supported). +Vue.js supports all browsers that are [ES5-compliant](https://kangax.github.io/compat-table/es5/) (IE8 and below are not supported). ## Ecosystem -| Project | Status | Description | -|---------|--------|-------------| -| [vue-router] | [![vue-router-status]][vue-router-package] | Single-page application routing | -| [vuex] | [![vuex-status]][vuex-package] | Large-scale state management | -| [vue-cli] | [![vue-cli-status]][vue-cli-package] | Project scaffolding | -| [vue-loader] | [![vue-loader-status]][vue-loader-package] | Single File Component (`*.vue` file) loader for webpack | -| [vue-server-renderer] | [![vue-server-renderer-status]][vue-server-renderer-package] | Server-side rendering support | -| [vue-class-component] | [![vue-class-component-status]][vue-class-component-package] | TypeScript decorator for a class-based API | -| [vue-rx] | [![vue-rx-status]][vue-rx-package] | RxJS integration | -| [vue-devtools] | [![vue-devtools-status]][vue-devtools-package] | Browser DevTools extension | +| Project | Status | Description | +| --------------------- | ------------------------------------------------------------ | ------------------------------------------------------- | +| [vue-router] | [![vue-router-status]][vue-router-package] | Single-page application routing | +| [vuex] | [![vuex-status]][vuex-package] | Large-scale state management | +| [vue-cli] | [![vue-cli-status]][vue-cli-package] | Project scaffolding | +| [vue-loader] | [![vue-loader-status]][vue-loader-package] | Single File Component (`*.vue` file) loader for webpack | +| [vue-server-renderer] | [![vue-server-renderer-status]][vue-server-renderer-package] | Server-side rendering support | +| [vue-class-component] | [![vue-class-component-status]][vue-class-component-package] | TypeScript decorator for a class-based API | +| [vue-rx] | [![vue-rx-status]][vue-rx-package] | RxJS integration | +| [vue-devtools] | [![vue-devtools-status]][vue-devtools-package] | Browser DevTools extension | [vue-router]: https://github.com/vuejs/vue-router [vuex]: https://github.com/vuejs/vuex @@ -301,8 +53,7 @@ Vue.js supports all browsers that are [ES5-compliant](http://kangax.github.io/co [vue-server-renderer]: https://github.com/vuejs/vue/tree/dev/packages/vue-server-renderer [vue-class-component]: https://github.com/vuejs/vue-class-component [vue-rx]: https://github.com/vuejs/vue-rx -[vue-devtools]: https://github.com/vuejs/vue-devtools - +[vue-devtools]: https://github.com/vuejs/vue-devtools [vue-router-status]: https://img.shields.io/npm/v/vue-router.svg [vuex-status]: https://img.shields.io/npm/v/vuex.svg [vue-cli-status]: https://img.shields.io/npm/v/@vue/cli.svg @@ -311,7 +62,6 @@ Vue.js supports all browsers that are [ES5-compliant](http://kangax.github.io/co [vue-class-component-status]: https://img.shields.io/npm/v/vue-class-component.svg [vue-rx-status]: https://img.shields.io/npm/v/vue-rx.svg [vue-devtools-status]: https://img.shields.io/chrome-web-store/v/nhdogjmejiglipccpnnnanhbledajbpd.svg - [vue-router-package]: https://npmjs.com/package/vue-router [vuex-package]: https://npmjs.com/package/vuex [vue-cli-package]: https://npmjs.com/package/@vue/cli @@ -327,7 +77,7 @@ To check out [live examples](https://vuejs.org/v2/examples/) and docs, visit [vu ## Questions -For questions and support please use [the official forum](http://forum.vuejs.org) or [community chat](https://chat.vuejs.org/). The issue list of this repo is **exclusively** for bug reports and feature requests. +For questions and support please use [the official forum](https://forum.vuejs.org) or [community chat](https://chat.vuejs.org/). The issue list of this repo is **exclusively** for bug reports and feature requests. ## Issues @@ -351,9 +101,8 @@ Thank you to all the people who already contributed to Vue! - ## License -[MIT](http://opensource.org/licenses/MIT) +[MIT](https://opensource.org/licenses/MIT) Copyright (c) 2013-present, Yuxi (Evan) You diff --git a/dist/README.md b/dist/README.md index fc0e9ddf0f2..19386ecf311 100644 --- a/dist/README.md +++ b/dist/README.md @@ -9,7 +9,7 @@ ### Terms -- **Full**: builds that contains both the compiler and the runtime. +- **Full**: builds that contain both the compiler and the runtime. - **Compiler**: code that is responsible for compiling template strings into JavaScript render functions. @@ -90,9 +90,7 @@ module.exports = { plugins: [ // ... new webpack.DefinePlugin({ - 'process.env': { - NODE_ENV: JSON.stringify('production') - } + 'process.env.NODE_ENV': JSON.stringify('production') }) ] } diff --git a/dist/vue.common.dev.js b/dist/vue.common.dev.js index ef511fc906e..eb4648163b1 100644 --- a/dist/vue.common.dev.js +++ b/dist/vue.common.dev.js @@ -1,6 +1,6 @@ /*! - * Vue.js v2.6.10 - * (c) 2014-2019 Evan You + * Vue.js v2.6.14 + * (c) 2014-2021 Evan You * Released under the MIT License. */ 'use strict'; @@ -1700,13 +1700,14 @@ function assertProp ( type = [type]; } for (var i = 0; i < type.length && !valid; i++) { - var assertedType = assertType(value, type[i]); + var assertedType = assertType(value, type[i], vm); expectedTypes.push(assertedType.expectedType || ''); valid = assertedType.valid; } } - if (!valid) { + var haveExpectedTypes = expectedTypes.some(function (t) { return t; }); + if (!valid && haveExpectedTypes) { warn( getInvalidTypeMessage(name, value, expectedTypes), vm @@ -1724,9 +1725,9 @@ function assertProp ( } } -var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/; +var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/; -function assertType (value, type) { +function assertType (value, type, vm) { var valid; var expectedType = getType(type); if (simpleCheckRE.test(expectedType)) { @@ -1741,7 +1742,12 @@ function assertType (value, type) { } else if (expectedType === 'Array') { valid = Array.isArray(value); } else { - valid = value instanceof type; + try { + valid = value instanceof type; + } catch (e) { + warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm); + valid = false; + } } return { valid: valid, @@ -1749,13 +1755,15 @@ function assertType (value, type) { } } +var functionTypeCheckRE = /^\s*function (\w+)/; + /** * Use function string name to check built-in types, * because a simple equality check will fail when running * across different vms / iframes. */ function getType (fn) { - var match = fn && fn.toString().match(/^\s*function (\w+)/); + var match = fn && fn.toString().match(functionTypeCheckRE); return match ? match[1] : '' } @@ -1780,18 +1788,19 @@ function getInvalidTypeMessage (name, value, expectedTypes) { " Expected " + (expectedTypes.map(capitalize).join(', ')); var expectedType = expectedTypes[0]; var receivedType = toRawType(value); - var expectedValue = styleValue(value, expectedType); - var receivedValue = styleValue(value, receivedType); // check if we need to specify expected value - if (expectedTypes.length === 1 && - isExplicable(expectedType) && - !isBoolean(expectedType, receivedType)) { - message += " with value " + expectedValue; + if ( + expectedTypes.length === 1 && + isExplicable(expectedType) && + isExplicable(typeof value) && + !isBoolean(expectedType, receivedType) + ) { + message += " with value " + (styleValue(value, expectedType)); } message += ", got " + receivedType + " "; // check if we need to specify received value if (isExplicable(receivedType)) { - message += "with value " + receivedValue + "."; + message += "with value " + (styleValue(value, receivedType)) + "."; } return message } @@ -1806,9 +1815,9 @@ function styleValue (value, type) { } } +var EXPLICABLE_TYPES = ['string', 'number', 'boolean']; function isExplicable (value) { - var explicitTypes = ['string', 'number', 'boolean']; - return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; }) + return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; }) } function isBoolean () { @@ -1965,7 +1974,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) { isUsingMicroTask = true; } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) { // Fallback to setImmediate. - // Techinically it leverages the (macro) task queue, + // Technically it leverages the (macro) task queue, // but it is still a better choice than setTimeout. timerFunc = function () { setImmediate(flushCallbacks); @@ -2035,7 +2044,7 @@ var initProxy; var allowedGlobals = makeMap( 'Infinity,undefined,NaN,isFinite,isNaN,' + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + - 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' + 'require' // for Webpack/Browserify ); @@ -2054,7 +2063,7 @@ var initProxy; warn( "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " + 'properties starting with "$" or "_" are not proxied in the Vue instance to ' + - 'prevent conflicts with Vue internals' + + 'prevent conflicts with Vue internals. ' + 'See: https://vuejs.org/v2/api/#data', target ); @@ -2538,6 +2547,12 @@ function isWhitespace (node) { /* */ +function isAsyncPlaceholder (node) { + return node.isComment && node.asyncFactory +} + +/* */ + function normalizeScopedSlots ( slots, normalSlots, @@ -2594,9 +2609,10 @@ function normalizeScopedSlot(normalSlots, key, fn) { res = res && typeof res === 'object' && !Array.isArray(res) ? [res] // single vnode : normalizeChildren(res); + var vnode = res && res[0]; return res && ( - res.length === 0 || - (res.length === 1 && res[0].isComment) // #9658 + !vnode || + (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391 ) ? undefined : res }; @@ -2669,26 +2685,28 @@ function renderList ( */ function renderSlot ( name, - fallback, + fallbackRender, props, bindObject ) { var scopedSlotFn = this.$scopedSlots[name]; var nodes; - if (scopedSlotFn) { // scoped slot + if (scopedSlotFn) { + // scoped slot props = props || {}; if (bindObject) { if (!isObject(bindObject)) { - warn( - 'slot v-bind without argument expects an Object', - this - ); + warn('slot v-bind without argument expects an Object', this); } props = extend(extend({}, bindObject), props); } - nodes = scopedSlotFn(props) || fallback; + nodes = + scopedSlotFn(props) || + (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender); } else { - nodes = this.$slots[name] || fallback; + nodes = + this.$slots[name] || + (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender); } var target = props && props.slot; @@ -2738,6 +2756,7 @@ function checkKeyCodes ( } else if (eventKeyName) { return hyphenate(eventKeyName) !== key } + return eventKeyCode === undefined } /* */ @@ -2914,7 +2933,7 @@ function bindDynamicKeys (baseObj, values) { if (typeof key === 'string' && key) { baseObj[values[i]] = values[i + 1]; } else if (key !== '' && key !== null) { - // null is a speical value for explicitly removing a binding + // null is a special value for explicitly removing a binding warn( ("Invalid value for dynamic directive argument (expected string or null): " + key), this @@ -3269,8 +3288,10 @@ function createComponent ( } function createComponentInstanceForVnode ( - vnode, // we know it's MountedComponentVNode but flow doesn't - parent // activeInstance in lifecycle state + // we know it's MountedComponentVNode but flow doesn't + vnode, + // activeInstance in lifecycle state + parent ) { var options = { _isComponent: true, @@ -3409,6 +3430,12 @@ function _createElement ( ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); if (config.isReservedTag(tag)) { // platform built-in elements + if (isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') { + warn( + ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."), + context + ); + } vnode = new VNode( config.parsePlatformTagName(tag), data, children, undefined, undefined, context @@ -3534,7 +3561,7 @@ function renderMixin (Vue) { // render self var vnode; try { - // There's no need to maintain a stack becaues all render fns are called + // There's no need to maintain a stack because all render fns are called // separately from one another. Nested component's render fns are called // when parent component is patched. currentRenderingInstance = vm; @@ -3729,12 +3756,6 @@ function resolveAsyncComponent ( /* */ -function isAsyncPlaceholder (node) { - return node.isComment && node.asyncFactory -} - -/* */ - function getFirstComponentChild (children) { if (Array.isArray(children)) { for (var i = 0; i < children.length; i++) { @@ -4101,7 +4122,8 @@ function updateChildComponent ( var hasDynamicScopedSlot = !!( (newScopedSlots && !newScopedSlots.$stable) || (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) || - (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) + (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) || + (!newScopedSlots && vm.$scopedSlots.$key) ); // Any static slot children from the parent may have changed during parent's @@ -4553,11 +4575,8 @@ Watcher.prototype.run = function run () { var oldValue = this.value; this.value = value; if (this.user) { - try { - this.cb.call(this.vm, value, oldValue); - } catch (e) { - handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); - } + var info = "callback for watcher \"" + (this.expression) + "\""; + invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info); } else { this.cb.call(this.vm, value, oldValue); } @@ -4779,6 +4798,8 @@ function initComputed (vm, computed) { warn(("The computed property \"" + key + "\" is already defined in data."), vm); } else if (vm.$options.props && key in vm.$options.props) { warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); + } else if (vm.$options.methods && key in vm.$options.methods) { + warn(("The computed property \"" + key + "\" is already defined as a method."), vm); } } } @@ -4931,11 +4952,10 @@ function stateMixin (Vue) { options.user = true; var watcher = new Watcher(vm, expOrFn, cb, options); if (options.immediate) { - try { - cb.call(vm, watcher.value); - } catch (error) { - handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); - } + var info = "callback for immediate watcher \"" + (watcher.expression) + "\""; + pushTarget(); + invokeWithErrorHandling(cb, vm, [watcher.value], vm, info); + popTarget(); } return function unwatchFn () { watcher.teardown(); @@ -5233,6 +5253,8 @@ function initAssetRegisters (Vue) { + + function getComponentName (opts) { return opts && (opts.Ctor.options.name || opts.tag) } @@ -5254,9 +5276,9 @@ function pruneCache (keepAliveInstance, filter) { var keys = keepAliveInstance.keys; var _vnode = keepAliveInstance._vnode; for (var key in cache) { - var cachedNode = cache[key]; - if (cachedNode) { - var name = getComponentName(cachedNode.componentOptions); + var entry = cache[key]; + if (entry) { + var name = entry.name; if (name && !filter(name)) { pruneCacheEntry(cache, key, keys, _vnode); } @@ -5270,9 +5292,9 @@ function pruneCacheEntry ( keys, current ) { - var cached$$1 = cache[key]; - if (cached$$1 && (!current || cached$$1.tag !== current.tag)) { - cached$$1.componentInstance.$destroy(); + var entry = cache[key]; + if (entry && (!current || entry.tag !== current.tag)) { + entry.componentInstance.$destroy(); } cache[key] = null; remove(keys, key); @@ -5290,6 +5312,32 @@ var KeepAlive = { max: [String, Number] }, + methods: { + cacheVNode: function cacheVNode() { + var ref = this; + var cache = ref.cache; + var keys = ref.keys; + var vnodeToCache = ref.vnodeToCache; + var keyToCache = ref.keyToCache; + if (vnodeToCache) { + var tag = vnodeToCache.tag; + var componentInstance = vnodeToCache.componentInstance; + var componentOptions = vnodeToCache.componentOptions; + cache[keyToCache] = { + name: getComponentName(componentOptions), + tag: tag, + componentInstance: componentInstance, + }; + keys.push(keyToCache); + // prune oldest entry + if (this.max && keys.length > parseInt(this.max)) { + pruneCacheEntry(cache, keys[0], keys, this._vnode); + } + this.vnodeToCache = null; + } + } + }, + created: function created () { this.cache = Object.create(null); this.keys = []; @@ -5304,6 +5352,7 @@ var KeepAlive = { mounted: function mounted () { var this$1 = this; + this.cacheVNode(); this.$watch('include', function (val) { pruneCache(this$1, function (name) { return matches(val, name); }); }); @@ -5312,6 +5361,10 @@ var KeepAlive = { }); }, + updated: function updated () { + this.cacheVNode(); + }, + render: function render () { var slot = this.$slots.default; var vnode = getFirstComponentChild(slot); @@ -5345,12 +5398,9 @@ var KeepAlive = { remove(keys, key); keys.push(key); } else { - cache[key] = vnode; - keys.push(key); - // prune oldest entry - if (this.max && keys.length > parseInt(this.max)) { - pruneCacheEntry(cache, keys[0], keys, this._vnode); - } + // delay setting the cache until update + this.vnodeToCache = vnode; + this.keyToCache = key; } vnode.data.keepAlive = true; @@ -5433,7 +5483,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', { value: FunctionalRenderContext }); -Vue.version = '2.6.10'; +Vue.version = '2.6.14'; /* */ @@ -5470,7 +5520,7 @@ var isBooleanAttr = makeMap( 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' + 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' + - 'required,reversed,scoped,seamless,selected,sortable,translate,' + + 'required,reversed,scoped,seamless,selected,sortable,' + 'truespeed,typemustmatch,visible' ); @@ -5594,7 +5644,7 @@ var isHTMLTag = makeMap( // contain child elements. var isSVG = makeMap( 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + - 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + + 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true ); @@ -5799,7 +5849,8 @@ var hooks = ['create', 'activate', 'update', 'remove', 'destroy']; function sameVnode (a, b) { return ( - a.key === b.key && ( + a.key === b.key && + a.asyncFactory === b.asyncFactory && ( ( a.tag === b.tag && a.isComment === b.isComment && @@ -5807,7 +5858,6 @@ function sameVnode (a, b) { sameInputType(a, b) ) || ( isTrue(a.isAsyncPlaceholder) && - a.asyncFactory === b.asyncFactory && isUndef(b.asyncFactory.error) ) ) @@ -6106,7 +6156,7 @@ function createPatchFunction (backend) { } } - function removeVnodes (parentElm, vnodes, startIdx, endIdx) { + function removeVnodes (vnodes, startIdx, endIdx) { for (; startIdx <= endIdx; ++startIdx) { var ch = vnodes[startIdx]; if (isDef(ch)) { @@ -6217,7 +6267,7 @@ function createPatchFunction (backend) { refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm; addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue); } else if (newStartIdx > newEndIdx) { - removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx); + removeVnodes(oldCh, oldStartIdx, oldEndIdx); } } @@ -6309,7 +6359,7 @@ function createPatchFunction (backend) { if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); } addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue); } else if (isDef(oldCh)) { - removeVnodes(elm, oldCh, 0, oldCh.length - 1); + removeVnodes(oldCh, 0, oldCh.length - 1); } else if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); } @@ -6538,7 +6588,7 @@ function createPatchFunction (backend) { // destroy old node if (isDef(parentElm)) { - removeVnodes(parentElm, [oldVnode], 0, 0); + removeVnodes([oldVnode], 0, 0); } else if (isDef(oldVnode.tag)) { invokeDestroyHook(oldVnode); } @@ -6695,7 +6745,7 @@ function updateAttrs (oldVnode, vnode) { cur = attrs[key]; old = oldAttrs[key]; if (old !== cur) { - setAttr(elm, key, cur); + setAttr(elm, key, cur, vnode.data.pre); } } // #4391: in IE9, setting type can reset value for input[type=radio] @@ -6715,8 +6765,8 @@ function updateAttrs (oldVnode, vnode) { } } -function setAttr (el, key, value) { - if (el.tagName.indexOf('-') > -1) { +function setAttr (el, key, value, isInPre) { + if (isInPre || el.tagName.indexOf('-') > -1) { baseSetAttr(el, key, value); } else if (isBooleanAttr(key)) { // set attribute for blank value @@ -7639,7 +7689,7 @@ function updateDOMProps (oldVnode, vnode) { // skip the update if old and new VDOM state is the same. // `value` is handled separately because the DOM value may be temporarily // out of sync with VDOM state due to focus, composition and modifiers. - // This #4521 by skipping the unnecesarry `checked` update. + // This #4521 by skipping the unnecessary `checked` update. cur !== oldProps[key] ) { // some property updates can throw @@ -9237,14 +9287,14 @@ var isNonPhrasingTag = makeMap( // Regular Expressions for parsing tags and attributes var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; -var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; +var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*"; var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")"; var startTagOpen = new RegExp(("^<" + qnameCapture)); var startTagClose = /^\s*(\/?)>/; var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>")); var doctype = /^]+>/i; -// #7298: escape - to avoid being pased as HTML comment when inlined in page +// #7298: escape - to avoid being passed as HTML comment when inlined in page var comment = /^\/=]/; @@ -9590,8 +9640,12 @@ function parse ( platformMustUseProp = options.mustUseProp || no; platformGetTagNamespace = options.getTagNamespace || no; var isReservedTag = options.isReservedTag || no; - maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); }; - + maybeComponent = function (el) { return !!( + el.component || + el.attrsMap[':is'] || + el.attrsMap['v-bind:is'] || + !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)) + ); }; transforms = pluckModuleFunction(options.modules, 'transformNode'); preTransforms = pluckModuleFunction(options.modules, 'preTransformNode'); postTransforms = pluckModuleFunction(options.modules, 'postTransformNode'); @@ -9884,7 +9938,7 @@ function parse ( } }, comment: function comment (text, start, end) { - // adding anyting as a sibling to the root node is forbidden + // adding anything as a sibling to the root node is forbidden // comments should still be allowed, but ignored if (currentParent) { var child = { @@ -10153,7 +10207,7 @@ function processSlotContent (el) { if (el.parent && !maybeComponent(el.parent)) { warn$2( "