From fe194dd5d812249bed5c15ad1d16551599b029dd Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 2 Dec 2018 16:12:52 -0500 Subject: [PATCH] build: build v2.5.18-beta.0 --- dist/vue.common.js | 889 +- dist/vue.esm.js | 889 +- dist/vue.js | 19573 ++++++++-------- dist/vue.min.js | 4 +- dist/vue.runtime.common.js | 757 +- dist/vue.runtime.esm.js | 757 +- dist/vue.runtime.js | 13947 +++++------ dist/vue.runtime.min.js | 4 +- packages/vue-server-renderer/basic.js | 14621 ++++++------ packages/vue-server-renderer/build.js | 793 +- packages/vue-server-renderer/client-plugin.js | 28 +- packages/vue-server-renderer/package.json | 2 +- packages/vue-server-renderer/server-plugin.js | 14 +- packages/vue-template-compiler/browser.js | 9574 ++++---- packages/vue-template-compiler/build.js | 426 +- packages/vue-template-compiler/package.json | 2 +- 16 files changed, 31255 insertions(+), 31025 deletions(-) diff --git a/dist/vue.common.js b/dist/vue.common.js index 0b8d12d2e5e..c0203d1b635 100644 --- a/dist/vue.common.js +++ b/dist/vue.common.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.5.17-beta.0 + * Vue.js v2.5.18-beta.0 * (c) 2014-2018 Evan You * Released under the MIT License. */ @@ -9,8 +9,8 @@ var emptyObject = Object.freeze({}); -// these helpers produces better vm code in JS engines due to their -// explicitness and function inlining +// These helpers produce better VM code in JS engines due to their +// explicitness and function inlining. function isUndef (v) { return v === undefined || v === null } @@ -28,7 +28,7 @@ function isFalse (v) { } /** - * Check if value is primitive + * Check if value is primitive. */ function isPrimitive (value) { return ( @@ -50,7 +50,7 @@ function isObject (obj) { } /** - * Get the raw type string of a value e.g. [object Object] + * Get the raw type string of a value, e.g., [object Object]. */ var _toString = Object.prototype.toString; @@ -90,7 +90,7 @@ function toString (val) { } /** - * Convert a input value to a number for persistence. + * Convert an input value to a number for persistence. * If the conversion fails, return original string. */ function toNumber (val) { @@ -122,12 +122,12 @@ function makeMap ( var isBuiltInTag = makeMap('slot,component', true); /** - * Check if a attribute is a reserved attribute. + * Check if an attribute is a reserved attribute. */ var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is'); /** - * Remove an item from an array + * Remove an item from an array. */ function remove (arr, item) { if (arr.length) { @@ -139,7 +139,7 @@ function remove (arr, item) { } /** - * Check whether the object has the property. + * Check whether an object has the property. */ var hasOwnProperty = Object.prototype.hasOwnProperty; function hasOwn (obj, key) { @@ -181,11 +181,11 @@ var hyphenate = cached(function (str) { }); /** - * Simple bind polyfill for environments that do not support it... e.g. - * PhantomJS 1.x. Technically we don't need this anymore since native bind is - * now more performant in most browsers, but removing it would be breaking for - * code that was able to run in PhantomJS 1.x, so this must be kept for - * backwards compatibility. + * Simple bind polyfill for environments that do not support it, + * e.g., PhantomJS 1.x. Technically, we don't need this anymore + * since native bind is now performant enough in most browsers. + * But removing it would mean breaking code that was able to run in + * PhantomJS 1.x, so this must be kept for backward compatibility. */ /* istanbul ignore next */ @@ -247,10 +247,12 @@ function toObject (arr) { return res } +/* eslint-disable no-unused-vars */ + /** * Perform no operation. * Stubbing args to make Flow happy without leaving useless transpiled code - * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/) + * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/). */ function noop (a, b, c) {} @@ -259,13 +261,15 @@ function noop (a, b, c) {} */ var no = function (a, b, c) { return false; }; +/* eslint-enable no-unused-vars */ + /** - * Return same value + * Return the same value. */ var identity = function (_) { return _; }; /** - * Generate a static keys string from compiler modules. + * Generate a string containing static keys from compiler modules. */ function genStaticKeys (modules) { return modules.reduce(function (keys, m) { @@ -289,6 +293,8 @@ function looseEqual (a, b) { return a.length === b.length && a.every(function (e, i) { return looseEqual(e, b[i]) }) + } else if (a instanceof Date && b instanceof Date) { + return a.getTime() === b.getTime() } else if (!isArrayA && !isArrayB) { var keysA = Object.keys(a); var keysB = Object.keys(b); @@ -310,6 +316,11 @@ function looseEqual (a, b) { } } +/** + * Return the first index at which a loosely equal value can be + * found in the array (if value is a plain object, the array must + * contain an object of the same shape), or -1 if it is not present. + */ function looseIndexOf (arr, val) { for (var i = 0; i < arr.length; i++) { if (looseEqual(arr[i], val)) { return i } @@ -354,6 +365,8 @@ var LIFECYCLE_HOOKS = [ /* */ + + var config = ({ /** * Option merge strategies (used in core/util/options) @@ -436,11 +449,17 @@ var config = ({ */ mustUseProp: no, + /** + * Perform updates asynchronously. Intended to be used by Vue Test Utils + * This will significantly reduce performance if set to false. + */ + async: true, + /** * Exposed for legacy reasons */ _lifecycleHooks: LIFECYCLE_HOOKS -}) +}); /* */ @@ -525,7 +544,7 @@ var isServerRendering = function () { if (!inBrowser && !inWeex && typeof global !== 'undefined') { // detect presence of vue-server-renderer and avoid // Webpack shimming the process - _isServer = global['process'].env.VUE_ENV === 'server'; + _isServer = global['process'] && global['process'].env.VUE_ENV === 'server'; } else { _isServer = false; } @@ -552,7 +571,7 @@ if (typeof Set !== 'undefined' && isNative(Set)) { _Set = Set; } else { // a non-standard Set polyfill that only works with primitive keys. - _Set = (function () { + _Set = /*@__PURE__*/(function () { function Set () { this.set = Object.create(null); } @@ -666,7 +685,6 @@ if (process.env.NODE_ENV !== 'production') { /* */ - var uid = 0; /** @@ -695,6 +713,12 @@ Dep.prototype.depend = function depend () { Dep.prototype.notify = function notify () { // stabilize the subscriber list first var subs = this.subs.slice(); + if (process.env.NODE_ENV !== 'production' && !config.async) { + // subs aren't sorted in scheduler if not running async + // we need to sort them now to make sure they fire in correct + // order + subs.sort(function (a, b) { return a.id - b.id; }); + } for (var i = 0, l = subs.length; i < l; i++) { subs[i].update(); } @@ -706,13 +730,14 @@ Dep.prototype.notify = function notify () { Dep.target = null; var targetStack = []; -function pushTarget (_target) { - if (Dep.target) { targetStack.push(Dep.target); } - Dep.target = _target; +function pushTarget (target) { + targetStack.push(target); + Dep.target = target; } function popTarget () { - Dep.target = targetStack.pop(); + targetStack.pop(); + Dep.target = targetStack[targetStack.length - 1]; } /* */ @@ -783,7 +808,10 @@ function cloneVNode (vnode) { var cloned = new VNode( vnode.tag, vnode.data, - vnode.children, + // #7975 + // clone children array to avoid mutating original in case of cloning + // a child. + vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, @@ -875,10 +903,11 @@ var Observer = function Observer (value) { this.vmCount = 0; def(value, '__ob__', this); if (Array.isArray(value)) { - var augment = hasProto - ? protoAugment - : copyAugment; - augment(value, arrayMethods, arrayKeys); + if (hasProto) { + protoAugment(value, arrayMethods); + } else { + copyAugment(value, arrayMethods, arrayKeys); + } this.observeArray(value); } else { this.walk(value); @@ -886,14 +915,14 @@ var Observer = function Observer (value) { }; /** - * Walk through each property and convert them into + * Walk through all properties and convert them into * getter/setters. This method should only be called when * value type is Object. */ Observer.prototype.walk = function walk (obj) { var keys = Object.keys(obj); for (var i = 0; i < keys.length; i++) { - defineReactive(obj, keys[i]); + defineReactive$$1(obj, keys[i]); } }; @@ -909,17 +938,17 @@ Observer.prototype.observeArray = function observeArray (items) { // helpers /** - * Augment an target Object or Array by intercepting + * Augment a target Object or Array by intercepting * the prototype chain using __proto__ */ -function protoAugment (target, src, keys) { +function protoAugment (target, src) { /* eslint-disable no-proto */ target.__proto__ = src; /* eslint-enable no-proto */ } /** - * Augment an target Object or Array by defining + * Augment a target Object or Array by defining * hidden properties. */ /* istanbul ignore next */ @@ -960,7 +989,7 @@ function observe (value, asRootData) { /** * Define a reactive property on an Object. */ -function defineReactive ( +function defineReactive$$1 ( obj, key, val, @@ -1008,6 +1037,8 @@ function defineReactive ( if (process.env.NODE_ENV !== 'production' && customSetter) { customSetter(); } + // #7981: for accessor properties without setter + if (getter && !setter) { return } if (setter) { setter.call(obj, newVal); } else { @@ -1051,7 +1082,7 @@ function set (target, key, val) { target[key] = val; return val } - defineReactive(ob.value, key, val); + defineReactive$$1(ob.value, key, val); ob.dep.notify(); return val } @@ -1138,7 +1169,11 @@ function mergeData (to, from) { fromVal = from[key]; if (!hasOwn(to, key)) { set(to, key, fromVal); - } else if (isPlainObject(toVal) && isPlainObject(fromVal)) { + } else if ( + toVal !== fromVal && + isPlainObject(toVal) && + isPlainObject(fromVal) + ) { mergeData(toVal, fromVal); } } @@ -1461,15 +1496,22 @@ function mergeOptions ( normalizeProps(child, vm); normalizeInject(child, vm); normalizeDirectives(child); - var extendsFrom = child.extends; - if (extendsFrom) { - parent = mergeOptions(parent, extendsFrom, vm); - } - if (child.mixins) { - for (var i = 0, l = child.mixins.length; i < l; i++) { - parent = mergeOptions(parent, child.mixins[i], vm); + + // Apply extends and mixins on the child options, + // but only if it is a raw options object that isn't + // the result of another mergeOptions call. + // Only merged options has the _base property. + if (!child._base) { + if (child.extends) { + parent = mergeOptions(parent, child.extends, vm); + } + if (child.mixins) { + for (var i = 0, l = child.mixins.length; i < l; i++) { + parent = mergeOptions(parent, child.mixins[i], vm); + } } } + var options = {}; var key; for (key in parent) { @@ -1522,6 +1564,8 @@ function resolveAsset ( /* */ + + function validateProp ( key, propOptions, @@ -1558,7 +1602,7 @@ function validateProp ( if ( process.env.NODE_ENV !== 'production' && // skip validation for weex recycle-list child component props - !(false && isObject(value) && ('@binding' in value)) + !(false) ) { assertProp(prop, key, value, vm, absent); } @@ -1631,11 +1675,10 @@ function assertProp ( valid = assertedType.valid; } } + if (!valid) { warn( - "Invalid prop: type check failed for prop \"" + name + "\"." + - " Expected " + (expectedTypes.map(capitalize).join(', ')) + - ", got " + (toRawType(value)) + ".", + getInvalidTypeMessage(name, value, expectedTypes), vm ); return @@ -1702,6 +1745,49 @@ function getTypeIndex (type, expectedTypes) { return -1 } +function getInvalidTypeMessage (name, value, expectedTypes) { + var message = "Invalid prop: type check failed for prop \"" + name + "\"." + + " 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; + } + message += ", got " + receivedType + " "; + // check if we need to specify received value + if (isExplicable(receivedType)) { + message += "with value " + receivedValue + "."; + } + return message +} + +function styleValue (value, type) { + if (type === 'String') { + return ("\"" + value + "\"") + } else if (type === 'Number') { + return ("" + (Number(value))) + } else { + return ("" + value) + } +} + +function isExplicable (value) { + var explicitTypes = ['string', 'number', 'boolean']; + return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; }) +} + +function isBoolean () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; }) +} + /* */ function handleError (err, vm, info) { @@ -1748,7 +1834,6 @@ function logError (err, vm, info) { } /* */ -/* globals MessageChannel */ var callbacks = []; var pending = false; @@ -1826,9 +1911,11 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) { function withMacroTask (fn) { return fn._withTask || (fn._withTask = function () { useMacroTask = true; - var res = fn.apply(null, arguments); - useMacroTask = false; - return res + try { + return fn.apply(null, arguments) + } finally { + useMacroTask = false; + } }) } @@ -1909,6 +1996,16 @@ if (process.env.NODE_ENV !== 'production') { ); }; + var warnReservedPrefix = function (target, key) { + 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' + + 'See: https://vuejs.org/v2/api/#data', + target + ); + }; + var hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy); @@ -1930,9 +2027,11 @@ if (process.env.NODE_ENV !== 'production') { var hasHandler = { has: function has (target, key) { var has = key in target; - var isAllowed = allowedGlobals(key) || (typeof key === 'string' && key.charAt(0) === '_'); + var isAllowed = allowedGlobals(key) || + (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data)); if (!has && !isAllowed) { - warnNonPresent(target, key); + if (key in target.$data) { warnReservedPrefix(target, key); } + else { warnNonPresent(target, key); } } return has || !isAllowed } @@ -1941,7 +2040,8 @@ if (process.env.NODE_ENV !== 'production') { var getHandler = { get: function get (target, key) { if (typeof key === 'string' && !(key in target)) { - warnNonPresent(target, key); + if (key in target.$data) { warnReservedPrefix(target, key); } + else { warnNonPresent(target, key); } } return target[key] } @@ -2039,14 +2139,14 @@ function updateListeners ( oldOn, add, remove$$1, + createOnceHandler, vm ) { - var name, def, cur, old, event; + var name, def$$1, cur, old, event; for (name in on) { - def = cur = on[name]; + def$$1 = cur = on[name]; old = oldOn[name]; event = normalizeEvent(name); - /* istanbul ignore if */ if (isUndef(cur)) { process.env.NODE_ENV !== 'production' && warn( "Invalid handler for event \"" + (event.name) + "\": got " + String(cur), @@ -2056,7 +2156,10 @@ function updateListeners ( if (isUndef(cur.fns)) { cur = on[name] = createFnInvoker(cur); } - add(event.name, cur, event.once, event.capture, event.passive, event.params); + if (isTrue(event.once)) { + cur = on[name] = createOnceHandler(event.name, cur, event.capture); + } + add(event.name, cur, event.capture, event.passive, event.params); } else if (cur !== old) { old.fns = cur; on[name] = old; @@ -2311,10 +2414,14 @@ function resolveAsyncComponent ( var contexts = factory.contexts = [context]; var sync = true; - var forceRender = function () { + var forceRender = function (renderCompleted) { for (var i = 0, l = contexts.length; i < l; i++) { contexts[i].$forceUpdate(); } + + if (renderCompleted) { + contexts.length = 0; + } }; var resolve = once(function (res) { @@ -2323,7 +2430,7 @@ function resolveAsyncComponent ( // invoke callbacks only if this is not a synchronous resolve // (async resolves are shimmed as synchronous during SSR) if (!sync) { - forceRender(); + forceRender(true); } }); @@ -2334,7 +2441,7 @@ function resolveAsyncComponent ( ); if (isDef(factory.errorComp)) { factory.error = true; - forceRender(); + forceRender(true); } }); @@ -2361,7 +2468,7 @@ function resolveAsyncComponent ( setTimeout(function () { if (isUndef(factory.resolved) && isUndef(factory.error)) { factory.loading = true; - forceRender(); + forceRender(false); } }, res.delay || 200); } @@ -2424,37 +2531,41 @@ function initEvents (vm) { var target; -function add (event, fn, once) { - if (once) { - target.$once(event, fn); - } else { - target.$on(event, fn); - } +function add (event, fn) { + target.$on(event, fn); } function remove$1 (event, fn) { target.$off(event, fn); } +function createOnceHandler (event, fn) { + var _target = target; + return function onceHandler () { + var res = fn.apply(null, arguments); + if (res !== null) { + _target.$off(event, onceHandler); + } + } +} + function updateComponentListeners ( vm, listeners, oldListeners ) { target = vm; - updateListeners(listeners, oldListeners || {}, add, remove$1, vm); + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); target = undefined; } function eventsMixin (Vue) { var hookRE = /^hook:/; Vue.prototype.$on = function (event, fn) { - var this$1 = this; - var vm = this; if (Array.isArray(event)) { for (var i = 0, l = event.length; i < l; i++) { - this$1.$on(event[i], fn); + vm.$on(event[i], fn); } } else { (vm._events[event] || (vm._events[event] = [])).push(fn); @@ -2479,8 +2590,6 @@ function eventsMixin (Vue) { }; Vue.prototype.$off = function (event, fn) { - var this$1 = this; - var vm = this; // all if (!arguments.length) { @@ -2490,7 +2599,7 @@ function eventsMixin (Vue) { // array of events if (Array.isArray(event)) { for (var i = 0, l = event.length; i < l; i++) { - this$1.$off(event[i], fn); + vm.$off(event[i], fn); } return vm } @@ -2931,7 +3040,6 @@ function callHook (vm, hook) { /* */ - var MAX_UPDATE_COUNT = 100; var queue = []; @@ -3020,7 +3128,7 @@ function callUpdatedHooks (queue) { while (i--) { var watcher = queue[i]; var vm = watcher.vm; - if (vm._watcher === watcher && vm._isMounted) { + if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { callHook(vm, 'updated'); } } @@ -3067,6 +3175,11 @@ function queueWatcher (watcher) { // queue the flush if (!waiting) { waiting = true; + + if (process.env.NODE_ENV !== 'production' && !config.async) { + flushSchedulerQueue(); + return + } nextTick(flushSchedulerQueue); } } @@ -3074,6 +3187,8 @@ function queueWatcher (watcher) { /* */ + + var uid$1 = 0; /** @@ -3097,16 +3212,16 @@ var Watcher = function Watcher ( if (options) { this.deep = !!options.deep; this.user = !!options.user; - this.computed = !!options.computed; + this.lazy = !!options.lazy; this.sync = !!options.sync; this.before = options.before; } else { - this.deep = this.user = this.computed = this.sync = false; + this.deep = this.user = this.lazy = this.sync = false; } this.cb = cb; this.id = ++uid$1; // uid for batching this.active = true; - this.dirty = this.computed; // for computed watchers + this.dirty = this.lazy; // for lazy watchers this.deps = []; this.newDeps = []; this.depIds = new _Set(); @@ -3120,7 +3235,7 @@ var Watcher = function Watcher ( } else { this.getter = parsePath(expOrFn); if (!this.getter) { - this.getter = function () {}; + this.getter = noop; process.env.NODE_ENV !== 'production' && warn( "Failed watching path: \"" + expOrFn + "\" " + 'Watcher only accepts simple dot-delimited paths. ' + @@ -3129,12 +3244,9 @@ var Watcher = function Watcher ( ); } } - if (this.computed) { - this.value = undefined; - this.dep = new Dep(); - } else { - this.value = this.get(); - } + this.value = this.lazy + ? undefined + : this.get(); }; /** @@ -3182,13 +3294,11 @@ Watcher.prototype.addDep = function addDep (dep) { * Clean up for dependency collection. */ Watcher.prototype.cleanupDeps = function cleanupDeps () { - var this$1 = this; - var i = this.deps.length; while (i--) { - var dep = this$1.deps[i]; - if (!this$1.newDepIds.has(dep.id)) { - dep.removeSub(this$1); + var dep = this.deps[i]; + if (!this.newDepIds.has(dep.id)) { + dep.removeSub(this); } } var tmp = this.depIds; @@ -3206,27 +3316,9 @@ Watcher.prototype.cleanupDeps = function cleanupDeps () { * Will be called when a dependency changes. */ Watcher.prototype.update = function update () { - var this$1 = this; - /* istanbul ignore else */ - if (this.computed) { - // A computed property watcher has two modes: lazy and activated. - // It initializes as lazy by default, and only becomes activated when - // it is depended on by at least one subscriber, which is typically - // another computed property or a component's render function. - if (this.dep.subs.length === 0) { - // In lazy mode, we don't want to perform computations until necessary, - // so we simply mark the watcher as dirty. The actual computation is - // performed just-in-time in this.evaluate() when the computed property - // is accessed. - this.dirty = true; - } else { - // In activated mode, we want to proactively perform the computation - // but only notify our subscribers when the value has indeed changed. - this.getAndInvoke(function () { - this$1.dep.notify(); - }); - } + if (this.lazy) { + this.dirty = true; } else if (this.sync) { this.run(); } else { @@ -3240,54 +3332,47 @@ Watcher.prototype.update = function update () { */ Watcher.prototype.run = function run () { if (this.active) { - this.getAndInvoke(this.cb); - } -}; - -Watcher.prototype.getAndInvoke = function getAndInvoke (cb) { - var value = this.get(); - if ( - value !== this.value || - // Deep watchers and watchers on Object/Arrays should fire even - // when the value is the same, because the value may - // have mutated. - isObject(value) || - this.deep - ) { - // set new value - var oldValue = this.value; - this.value = value; - this.dirty = false; - if (this.user) { - try { - cb.call(this.vm, value, oldValue); - } catch (e) { - handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); + var value = this.get(); + if ( + value !== this.value || + // Deep watchers and watchers on Object/Arrays should fire even + // when the value is the same, because the value may + // have mutated. + isObject(value) || + this.deep + ) { + // set new value + 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) + "\"")); + } + } else { + this.cb.call(this.vm, value, oldValue); } - } else { - cb.call(this.vm, value, oldValue); } } }; /** - * Evaluate and return the value of the watcher. - * This only gets called for computed property watchers. + * Evaluate the value of the watcher. + * This only gets called for lazy watchers. */ Watcher.prototype.evaluate = function evaluate () { - if (this.dirty) { - this.value = this.get(); - this.dirty = false; - } - return this.value + this.value = this.get(); + this.dirty = false; }; /** - * Depend on this watcher. Only for computed property watchers. + * Depend on all deps collected by this watcher. */ Watcher.prototype.depend = function depend () { - if (this.dep && Dep.target) { - this.dep.depend(); + var i = this.deps.length; + while (i--) { + this.deps[i].depend(); } }; @@ -3295,8 +3380,6 @@ Watcher.prototype.depend = function depend () { * Remove self from all dependencies' subscriber list. */ Watcher.prototype.teardown = function teardown () { - var this$1 = this; - if (this.active) { // remove self from vm's watcher list // this is a somewhat expensive operation so we skip it @@ -3306,7 +3389,7 @@ Watcher.prototype.teardown = function teardown () { } var i = this.deps.length; while (i--) { - this$1.deps[i].removeSub(this$1); + this.deps[i].removeSub(this); } this.active = false; } @@ -3371,8 +3454,8 @@ function initProps (vm, propsOptions) { vm ); } - defineReactive(props, key, value, function () { - if (vm.$parent && !isUpdatingChildComponent) { + defineReactive$$1(props, key, value, function () { + if (!isRoot && !isUpdatingChildComponent) { warn( "Avoid mutating a prop directly since the value will be " + "overwritten whenever the parent component re-renders. " + @@ -3383,7 +3466,7 @@ function initProps (vm, propsOptions) { } }); } else { - defineReactive(props, key, value); + defineReactive$$1(props, key, value); } // static props are already proxied on the component's prototype // during Vue.extend(). We only need to proxy props defined at @@ -3452,7 +3535,7 @@ function getData (data, vm) { } } -var computedWatcherOptions = { computed: true }; +var computedWatcherOptions = { lazy: true }; function initComputed (vm, computed) { // $flow-disable-line @@ -3504,17 +3587,15 @@ function defineComputed ( if (typeof userDef === 'function') { sharedPropertyDefinition.get = shouldCache ? createComputedGetter(key) - : userDef; + : createGetterInvoker(userDef); sharedPropertyDefinition.set = noop; } else { sharedPropertyDefinition.get = userDef.get ? shouldCache && userDef.cache !== false ? createComputedGetter(key) - : userDef.get - : noop; - sharedPropertyDefinition.set = userDef.set - ? userDef.set + : createGetterInvoker(userDef.get) : noop; + sharedPropertyDefinition.set = userDef.set || noop; } if (process.env.NODE_ENV !== 'production' && sharedPropertyDefinition.set === noop) { @@ -3532,19 +3613,30 @@ function createComputedGetter (key) { return function computedGetter () { var watcher = this._computedWatchers && this._computedWatchers[key]; if (watcher) { - watcher.depend(); - return watcher.evaluate() + if (watcher.dirty) { + watcher.evaluate(); + } + if (Dep.target) { + watcher.depend(); + } + return watcher.value } } } +function createGetterInvoker(fn) { + return function computedGetter () { + return fn.call(this, this) + } +} + function initMethods (vm, methods) { var props = vm.$options.props; for (var key in methods) { if (process.env.NODE_ENV !== 'production') { - if (methods[key] == null) { + if (typeof methods[key] !== 'function') { warn( - "Method \"" + key + "\" has an undefined value in the component definition. " + + "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + "Did you reference the function correctly?", vm ); @@ -3562,7 +3654,7 @@ function initMethods (vm, methods) { ); } } - vm[key] = methods[key] == null ? noop : bind(methods[key], vm); + vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); } } @@ -3604,7 +3696,7 @@ function stateMixin (Vue) { var propsDef = {}; propsDef.get = function () { return this._props }; if (process.env.NODE_ENV !== 'production') { - dataDef.set = function (newData) { + dataDef.set = function () { warn( 'Avoid replacing instance root $data. ' + 'Use nested data properties instead.', @@ -3634,7 +3726,11 @@ function stateMixin (Vue) { options.user = true; var watcher = new Watcher(vm, expOrFn, cb, options); if (options.immediate) { - cb.call(vm, watcher.value); + try { + cb.call(vm, watcher.value); + } catch (error) { + handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); + } } return function unwatchFn () { watcher.teardown(); @@ -3660,7 +3756,7 @@ function initInjections (vm) { Object.keys(result).forEach(function (key) { /* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') { - defineReactive(vm, key, result[key], function () { + defineReactive$$1(vm, key, result[key], function () { warn( "Avoid mutating an injected value directly since the changes will be " + "overwritten whenever the provided component re-renders. " + @@ -3669,7 +3765,7 @@ function initInjections (vm) { ); }); } else { - defineReactive(vm, key, result[key]); + defineReactive$$1(vm, key, result[key]); } }); toggleObserving(true); @@ -3773,19 +3869,7 @@ function renderSlot ( } nodes = scopedSlotFn(props) || fallback; } else { - var slotNodes = this.$slots[name]; - // warn duplicate slot usage - if (slotNodes) { - if (process.env.NODE_ENV !== 'production' && slotNodes._rendered) { - warn( - "Duplicate presence of slot \"" + name + "\" found in the same render tree " + - "- this will likely cause render errors.", - this - ); - } - slotNodes._rendered = true; - } - nodes = slotNodes || fallback; + nodes = this.$slots[name] || fallback; } var target = props && props.slot; @@ -3873,12 +3957,13 @@ function bindObjectProps ( ? data.domProps || (data.domProps = {}) : data.attrs || (data.attrs = {}); } - if (!(key in hash)) { + var camelizedKey = camelize(key); + if (!(key in hash) && !(camelizedKey in hash)) { hash[key] = value[key]; if (isSync) { var on = data.on || (data.on = {}); - on[("update:" + key)] = function ($event) { + on[("update:" + camelizedKey)] = function ($event) { value[key] = $event; }; } @@ -4084,24 +4169,27 @@ function createFunctionalComponent ( var vnode = options.render.call(null, renderContext._c, renderContext); if (vnode instanceof VNode) { - return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options) + return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) } else if (Array.isArray(vnode)) { var vnodes = normalizeChildren(vnode) || []; var res = new Array(vnodes.length); for (var i = 0; i < vnodes.length; i++) { - res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options); + res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); } return res } } -function cloneAndMarkFunctionalResult (vnode, data, contextVm, options) { +function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { // #7817 clone node before setting fnContext, otherwise if the node is reused // (e.g. it was from a cached normal slot) the fnContext causes named slots // that should not be matched to match. var clone = cloneVNode(vnode); clone.fnContext = contextVm; clone.fnOptions = options; + if (process.env.NODE_ENV !== 'production') { + (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; + } if (data.slot) { (clone.data || (clone.data = {})).slot = data.slot; } @@ -4116,21 +4204,8 @@ function mergeProps (to, from) { /* */ - - - -// Register the component hook to weex native render engine. -// The hook will be triggered by native, not javascript. - - -// Updates the state of the component to weex native render engine. - /* */ -// https://github.com/Hanks10100/weex-native-directive/tree/master/component - -// listening on native callback - /* */ /* */ @@ -4298,10 +4373,6 @@ function createComponent ( asyncFactory ); - // Weex specific: invoke recycle-list optimized @render function for - // extracting cell-slot template. - // https://github.com/Hanks10100/weex-native-directive/tree/master/component - /* istanbul ignore if */ return vnode } @@ -4349,12 +4420,21 @@ function mergeHook$1 (f1, f2) { // prop and event handler respectively. function transformModel (options, data) { var prop = (options.model && options.model.prop) || 'value'; - var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value; + var event = (options.model && options.model.event) || 'input' + ;(data.props || (data.props = {}))[prop] = data.model.value; var on = data.on || (data.on = {}); - if (isDef(on[event])) { - on[event] = [data.model.callback].concat(on[event]); + var existing = on[event]; + var callback = data.model.callback; + if (isDef(existing)) { + if ( + Array.isArray(existing) + ? existing.indexOf(callback) === -1 + : existing !== callback + ) { + on[event] = [callback].concat(existing); + } } else { - on[event] = data.model.callback; + on[event] = callback; } } @@ -4442,7 +4522,7 @@ function _createElement ( config.parsePlatformTagName(tag), data, children, undefined, undefined, context ); - } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { + } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { // component vnode = createComponent(Ctor, data, context, children, tag); } else { @@ -4524,15 +4604,15 @@ function initRender (vm) { /* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') { - defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { !isUpdatingChildComponent && warn("$attrs is readonly.", vm); }, true); - defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () { + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { !isUpdatingChildComponent && warn("$listeners is readonly.", vm); }, true); } else { - defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true); - defineReactive(vm, '$listeners', options._parentListeners || emptyObject, null, true); + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true); + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true); } } @@ -4550,14 +4630,6 @@ function renderMixin (Vue) { var render = ref.render; var _parentVnode = ref._parentVnode; - // reset _rendered flag on slots for duplicate slot check - if (process.env.NODE_ENV !== 'production') { - for (var key in vm.$slots) { - // $flow-disable-line - vm.$slots[key]._rendered = false; - } - } - if (_parentVnode) { vm.$scopedSlots = _parentVnode.data.scopedSlots || emptyObject; } @@ -4574,15 +4646,11 @@ function renderMixin (Vue) { // return error render result, // or previous vnode to prevent render error causing blank component /* istanbul ignore else */ - if (process.env.NODE_ENV !== 'production') { - if (vm.$options.renderError) { - try { - vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); - } catch (e) { - handleError(e, vm, "renderError"); - vnode = vm._vnode; - } - } else { + if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) { + try { + vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); + } catch (e) { + handleError(e, vm, "renderError"); vnode = vm._vnode; } } else { @@ -4917,6 +4985,8 @@ function initAssetRegisters (Vue) { /* */ + + function getComponentName (opts) { return opts && (opts.Ctor.options.name || opts.tag) } @@ -4980,10 +5050,8 @@ var KeepAlive = { }, destroyed: function destroyed () { - var this$1 = this; - - for (var key in this$1.cache) { - pruneCacheEntry(this$1.cache, key, this$1.keys); + for (var key in this.cache) { + pruneCacheEntry(this.cache, key, this.keys); } }, @@ -5043,11 +5111,11 @@ var KeepAlive = { } return vnode || (slot && slot[0]) } -} +}; var builtInComponents = { KeepAlive: KeepAlive -} +}; /* */ @@ -5071,7 +5139,7 @@ function initGlobalAPI (Vue) { warn: warn, extend: extend, mergeOptions: mergeOptions, - defineReactive: defineReactive + defineReactive: defineReactive$$1 }; Vue.set = set; @@ -5113,7 +5181,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', { value: FunctionalRenderContext }); -Vue.version = '2.5.17-beta.0'; +Vue.version = '2.5.18-beta.0'; /* */ @@ -5391,20 +5459,19 @@ function setStyleScope (node, scopeId) { node.setAttribute(scopeId, ''); } - -var nodeOps = Object.freeze({ - createElement: createElement$1, - createElementNS: createElementNS, - createTextNode: createTextNode, - createComment: createComment, - insertBefore: insertBefore, - removeChild: removeChild, - appendChild: appendChild, - parentNode: parentNode, - nextSibling: nextSibling, - tagName: tagName, - setTextContent: setTextContent, - setStyleScope: setStyleScope +var nodeOps = /*#__PURE__*/Object.freeze({ + createElement: createElement$1, + createElementNS: createElementNS, + createTextNode: createTextNode, + createComment: createComment, + insertBefore: insertBefore, + removeChild: removeChild, + appendChild: appendChild, + parentNode: parentNode, + nextSibling: nextSibling, + tagName: tagName, + setTextContent: setTextContent, + setStyleScope: setStyleScope }); /* */ @@ -5422,7 +5489,7 @@ var ref = { destroy: function destroy (vnode) { registerRef(vnode, true); } -} +}; function registerRef (vnode, isRemoval) { var key = vnode.data.ref; @@ -5467,6 +5534,12 @@ var emptyNode = new VNode('', {}, []); var hooks = ['create', 'activate', 'update', 'remove', 'destroy']; +function childrenIgnored (vnode) { + return vnode && vnode.data && vnode.data.domProps && ( + vnode.data.domProps.innerHTML || vnode.data.domProps.textContent + ) +} + function sameVnode (a, b) { return ( a.key === b.key && ( @@ -5474,6 +5547,7 @@ function sameVnode (a, b) { a.tag === b.tag && a.isComment === b.isComment && isDef(a.data) === isDef(b.data) && + !childrenIgnored(a) && !childrenIgnored(b) && sameInputType(a, b) ) || ( isTrue(a.isAsyncPlaceholder) && @@ -5523,13 +5597,13 @@ function createPatchFunction (backend) { } function createRmCb (childElm, listeners) { - function remove () { - if (--remove.listeners === 0) { + function remove$$1 () { + if (--remove$$1.listeners === 0) { removeNode(childElm); } } - remove.listeners = listeners; - return remove + remove$$1.listeners = listeners; + return remove$$1 } function removeNode (el) { @@ -5690,7 +5764,7 @@ function createPatchFunction (backend) { function insert (parent, elm, ref$$1) { if (isDef(parent)) { if (isDef(ref$$1)) { - if (ref$$1.parentNode === parent) { + if (nodeOps.parentNode(ref$$1) === parent) { nodeOps.insertBefore(parent, elm, ref$$1); } } else { @@ -5845,20 +5919,20 @@ function createPatchFunction (backend) { } else if (isUndef(oldEndVnode)) { oldEndVnode = oldCh[--oldEndIdx]; } else if (sameVnode(oldStartVnode, newStartVnode)) { - patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue); + patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); oldStartVnode = oldCh[++oldStartIdx]; newStartVnode = newCh[++newStartIdx]; } else if (sameVnode(oldEndVnode, newEndVnode)) { - patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue); + patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); oldEndVnode = oldCh[--oldEndIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right - patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue); + patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm)); oldStartVnode = oldCh[++oldStartIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left - patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue); + patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm); oldEndVnode = oldCh[--oldEndIdx]; newStartVnode = newCh[++newStartIdx]; @@ -5872,7 +5946,7 @@ function createPatchFunction (backend) { } else { vnodeToMove = oldCh[idxInOld]; if (sameVnode(vnodeToMove, newStartVnode)) { - patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue); + patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); oldCh[idxInOld] = undefined; canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm); } else { @@ -5916,11 +5990,23 @@ function createPatchFunction (backend) { } } - function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) { + function patchVnode ( + oldVnode, + vnode, + insertedVnodeQueue, + ownerArray, + index, + removeOnly + ) { if (oldVnode === vnode) { return } + if (isDef(vnode.elm) && isDef(ownerArray)) { + // clone reused vnode + vnode = ownerArray[index] = cloneVNode(vnode); + } + var elm = vnode.elm = oldVnode.elm; if (isTrue(oldVnode.isAsyncPlaceholder)) { @@ -5961,6 +6047,9 @@ function createPatchFunction (backend) { if (isDef(oldCh) && isDef(ch)) { if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); } } else if (isDef(ch)) { + if (process.env.NODE_ENV !== 'production') { + checkDuplicateKeys(ch); + } if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); } addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue); } else if (isDef(oldCh)) { @@ -6119,7 +6208,7 @@ function createPatchFunction (backend) { var isRealElement = isDef(oldVnode.nodeType); if (!isRealElement && sameVnode(oldVnode, vnode)) { // patch existing root node - patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly); + patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly); } else { if (isRealElement) { // mounting to a real element @@ -6215,7 +6304,7 @@ var directives = { destroy: function unbindDirectives (vnode) { updateDirectives(vnode, emptyNode); } -} +}; function updateDirectives (oldVnode, vnode) { if (oldVnode.data.directives || vnode.data.directives) { @@ -6326,7 +6415,7 @@ function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) { var baseModules = [ ref, directives -] +]; /* */ @@ -6410,7 +6499,7 @@ function baseSetAttr (el, key, value) { /* istanbul ignore if */ if ( isIE && !isIE9 && - el.tagName === 'TEXTAREA' && + (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') && key === 'placeholder' && !el.__ieph ) { var blocker = function (e) { @@ -6428,7 +6517,7 @@ function baseSetAttr (el, key, value) { var attrs = { create: updateAttrs, update: updateAttrs -} +}; /* */ @@ -6466,7 +6555,7 @@ function updateClass (oldVnode, vnode) { var klass = { create: updateClass, update: updateClass -} +}; /* */ @@ -6630,6 +6719,18 @@ function addHandler ( ); } + // normalize click.right and click.middle since they don't actually fire + // this is technically browser-specific, but at least for now browsers are + // the only target envs that have right/middle clicks. + if (name === 'click') { + if (modifiers.right) { + name = 'contextmenu'; + delete modifiers.right; + } else if (modifiers.middle) { + name = 'mouseup'; + } + } + // check capture modifier if (modifiers.capture) { delete modifiers.capture; @@ -6645,18 +6746,6 @@ function addHandler ( name = '&' + name; // mark the event as passive } - // normalize click.right and click.middle since they don't actually fire - // this is technically browser-specific, but at least for now browsers are - // the only target envs that have right/middle clicks. - if (name === 'click') { - if (modifiers.right) { - name = 'contextmenu'; - delete modifiers.right; - } else if (modifiers.middle) { - name = 'mouseup'; - } - } - var events; if (modifiers.native) { delete modifiers.native; @@ -6792,12 +6881,7 @@ function genAssignmentCode ( * */ -var len; -var str; -var chr; -var index$1; -var expressionPos; -var expressionEndPos; +var len, str, chr, index$1, expressionPos, expressionEndPos; @@ -7078,7 +7162,7 @@ function normalizeEvents (on) { var target$1; -function createOnceHandler (handler, event, capture) { +function createOnceHandler$1 (event, handler, capture) { var _target = target$1; // save current target element in closure return function onceHandler () { var res = handler.apply(null, arguments); @@ -7091,12 +7175,10 @@ function createOnceHandler (handler, event, capture) { function add$1 ( event, handler, - once$$1, capture, passive ) { handler = withMacroTask(handler); - if (once$$1) { handler = createOnceHandler(handler, event, capture); } target$1.addEventListener( event, handler, @@ -7127,14 +7209,14 @@ function updateDOMListeners (oldVnode, vnode) { var oldOn = oldVnode.data.on || {}; target$1 = vnode.elm; normalizeEvents(on); - updateListeners(on, oldOn, add$1, remove$2, vnode.context); + updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context); target$1 = undefined; } var events = { create: updateDOMListeners, update: updateDOMListeners -} +}; /* */ @@ -7228,7 +7310,7 @@ function isDirtyWithModifiers (elm, newVal) { var domProps = { create: updateDOMProps, update: updateDOMProps -} +}; /* */ @@ -7389,10 +7471,12 @@ function updateStyle (oldVnode, vnode) { var style = { create: updateStyle, update: updateStyle -} +}; /* */ +var whitespaceRE = /\s+/; + /** * Add class with compatibility for SVG since classList is not supported on * SVG elements in IE @@ -7406,7 +7490,7 @@ function addClass (el, cls) { /* istanbul ignore else */ if (el.classList) { if (cls.indexOf(' ') > -1) { - cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); }); + cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); }); } else { el.classList.add(cls); } @@ -7431,7 +7515,7 @@ function removeClass (el, cls) { /* istanbul ignore else */ if (el.classList) { if (cls.indexOf(' ') > -1) { - cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); }); + cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); }); } else { el.classList.remove(cls); } @@ -7455,20 +7539,20 @@ function removeClass (el, cls) { /* */ -function resolveTransition (def) { - if (!def) { +function resolveTransition (def$$1) { + if (!def$$1) { return } /* istanbul ignore else */ - if (typeof def === 'object') { + if (typeof def$$1 === 'object') { var res = {}; - if (def.css !== false) { - extend(res, autoCssTransition(def.name || 'v')); + if (def$$1.css !== false) { + extend(res, autoCssTransition(def$$1.name || 'v')); } - extend(res, def); + extend(res, def$$1); return res - } else if (typeof def === 'string') { - return autoCssTransition(def) + } else if (typeof def$$1 === 'string') { + return autoCssTransition(def$$1) } } @@ -7571,11 +7655,12 @@ var transformRE = /\b(transform|all)(,|$)/; function getTransitionInfo (el, expectedType) { var styles = window.getComputedStyle(el); - var transitionDelays = styles[transitionProp + 'Delay'].split(', '); - var transitionDurations = styles[transitionProp + 'Duration'].split(', '); + // JSDOM may return undefined for transition properties + var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', '); + var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', '); var transitionTimeout = getTimeout(transitionDelays, transitionDurations); - var animationDelays = styles[animationProp + 'Delay'].split(', '); - var animationDurations = styles[animationProp + 'Duration'].split(', '); + var animationDelays = (styles[animationProp + 'Delay'] || '').split(', '); + var animationDurations = (styles[animationProp + 'Duration'] || '').split(', '); var animationTimeout = getTimeout(animationDelays, animationDurations); var type; @@ -7629,8 +7714,12 @@ function getTimeout (delays, durations) { })) } +// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers +// in a locale-dependent way, using a comma instead of a dot. +// If comma is not replaced with a dot, the input will be rounded down (i.e. acting +// as a floor function) causing unexpected behaviors function toMs (s) { - return Number(s.slice(0, -1)) * 1000 + return Number(s.slice(0, -1).replace(',', '.')) * 1000 } /* */ @@ -7862,7 +7951,7 @@ function leave (vnode, rm) { return } // record leaving element - if (!vnode.data.show) { + if (!vnode.data.show && el.parentNode) { (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode; } beforeLeave && beforeLeave(el); @@ -7951,7 +8040,7 @@ var transition = inBrowser ? { rm(); } } -} : {} +} : {}; var platformModules = [ attrs, @@ -7960,7 +8049,7 @@ var platformModules = [ domProps, style, transition -] +]; /* */ @@ -8171,18 +8260,15 @@ var show = { el.style.display = el.__vOriginalDisplay; } } -} +}; var platformDirectives = { model: directive, show: show -} +}; /* */ -// Provides transition support for a single element/component. -// supports transition mode (out-in / in-out) - var transitionProps = { name: String, appear: Boolean, @@ -8248,6 +8334,10 @@ function isSameChild (child, oldChild) { return oldChild.key === child.key && oldChild.tag === child.tag } +var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); }; + +var isVShowDirective = function (d) { return d.name === 'show'; }; + var Transition = { name: 'transition', props: transitionProps, @@ -8262,7 +8352,7 @@ var Transition = { } // filter out text nodes (possible whitespaces) - children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); }); + children = children.filter(isNotTextNode); /* istanbul ignore if */ if (!children.length) { return @@ -8327,7 +8417,7 @@ var Transition = { // mark v-show // so that the transition module can hand over the control to the directive - if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) { + if (child.data.directives && child.data.directives.some(isVShowDirective)) { child.data.show = true; } @@ -8365,21 +8455,10 @@ var Transition = { return rawChild } -} +}; /* */ -// Provides transition support for list items. -// supports move transitions using the FLIP technique. - -// Because the vdom's children update algorithm is "unstable" - i.e. -// it doesn't guarantee the relative positioning of removed elements, -// we force transition-group to update its children into two passes: -// in the first pass, we remove all nodes that need to be removed, -// triggering their leaving transition; in the second pass, we insert/move -// into the final desired state. This way in the second pass removed -// nodes will remain where they should be. - var props = extend({ tag: String, moveClass: String @@ -8475,6 +8554,9 @@ var TransitionGroup = { addTransitionClass(el, moveClass); s.transform = s.WebkitTransform = s.transitionDuration = ''; el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) { + if (e && e.target !== el) { + return + } if (!e || /transform$/.test(e.propertyName)) { el.removeEventListener(transitionEndEvent, cb); el._moveCb = null; @@ -8512,7 +8594,7 @@ var TransitionGroup = { return (this._hasMove = info.hasTransform) } } -} +}; function callPendingCbs (c) { /* istanbul ignore if */ @@ -8545,7 +8627,7 @@ function applyTranslation (c) { var platformComponents = { Transition: Transition, TransitionGroup: TransitionGroup -} +}; /* */ @@ -8606,7 +8688,7 @@ if (inBrowser) { /* */ -var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g; +var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g; var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g; var buildRegex = cached(function (delimiters) { @@ -8692,7 +8774,7 @@ var klass$1 = { staticKeys: ['staticClass'], transformNode: transformNode, genData: genData -} +}; /* */ @@ -8736,7 +8818,7 @@ var style$1 = { staticKeys: ['staticStyle'], transformNode: transformNode$1, genData: genData$1 -} +}; /* */ @@ -8748,7 +8830,7 @@ var he = { decoder.innerHTML = html; return decoder.textContent } -} +}; /* */ @@ -8777,13 +8859,6 @@ var isNonPhrasingTag = makeMap( * Not type-checking this file because it's mostly vendor code. */ -/*! - * HTML Parser By John Resig (ejohn.org) - * Modified by Juriy "kangax" Zaytsev - * Original code by Erik Arvidsson, Mozilla Public License - * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js - */ - // Regular Expressions for parsing tags and attributes var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName @@ -8798,11 +8873,6 @@ var doctype = /^]+>/i; var comment = /^= 0; pos--) { if (stack[pos].lowerCasedTag === lowerCasedTagName) { break @@ -9085,7 +9146,7 @@ function parseHTML (html, options) { var onRE = /^@|^v-on:/; var dirRE = /^v-|^@|^:/; -var forAliasRE = /([^]*?)\s+(?:in|of)\s+([^]*)/; +var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; var stripParensRE = /^\(|\)$/g; @@ -9270,7 +9331,8 @@ function parse ( processIfConditions(element, currentParent); } else if (element.slotScope) { // scoped slot currentParent.plain = false; - var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element; + var name = element.slotTarget || '"default"' + ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element; } else { currentParent.children.push(element); element.parent = currentParent; @@ -9394,8 +9456,20 @@ function processElement (element, options) { function processKey (el) { var exp = getBindingAttr(el, 'key'); if (exp) { - if (process.env.NODE_ENV !== 'production' && el.tag === 'template') { - warn$2("