From 7953e1447947e610873886d9cded9a80279c7e4b Mon Sep 17 00:00:00 2001 From: Jakub Juszczak Date: Wed, 1 Mar 2017 14:49:03 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=8E=20Release=20new=20version=202.3.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/vue-chartjs.js | 4251 ++++++++++++++++++++++++------------------- 1 file changed, 2369 insertions(+), 1882 deletions(-) diff --git a/dist/vue-chartjs.js b/dist/vue-chartjs.js index 66393509..add0f16c 100644 --- a/dist/vue-chartjs.js +++ b/dist/vue-chartjs.js @@ -212,7 +212,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process, global) {/*! - * Vue.js v2.1.10 + * Vue.js v2.2.1 * (c) 2014-2017 Evan You * Released under the MIT License. */ @@ -266,7 +266,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * Remove an item from an array */ - function remove$1 (arr, item) { + function remove (arr, item) { if (arr.length) { var index = arr.indexOf(item); if (index > -1) { @@ -330,7 +330,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * Simple bind, faster than native */ - function bind$1 (fn, ctx) { + function bind (fn, ctx) { function boundFn (a) { var l = arguments.length; return l @@ -417,11 +417,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * Generate a static keys string from compiler modules. */ - function genStaticKeys (modules) { - return modules.reduce(function (keys, m) { - return keys.concat(m.staticKeys || []) - }, []).join(',') - } + /** * Check if two values are loosely equal - that is, @@ -446,6 +442,19 @@ return /******/ (function(modules) { // webpackBootstrap return -1 } + /** + * Ensure a function is called only once. + */ + function once (fn) { + var called = false; + return function () { + if (!called) { + called = true; + fn(); + } + } + } + /* */ var config = { @@ -459,11 +468,21 @@ return /******/ (function(modules) { // webpackBootstrap */ silent: false, + /** + * Show production mode tip message on boot? + */ + productionTip: process.env.NODE_ENV !== 'production', + /** * Whether to enable devtools */ devtools: process.env.NODE_ENV !== 'production', + /** + * Whether to record perf + */ + performance: process.env.NODE_ENV !== 'production', + /** * Error handler for watcher errors */ @@ -538,47 +557,6 @@ return /******/ (function(modules) { // webpackBootstrap _maxUpdateCount: 100 }; - /* */ - - /** - * Check if a string starts with $ or _ - */ - function isReserved (str) { - var c = (str + '').charCodeAt(0); - return c === 0x24 || c === 0x5F - } - - /** - * Define a property. - */ - function def (obj, key, val, enumerable) { - Object.defineProperty(obj, key, { - value: val, - enumerable: !!enumerable, - writable: true, - configurable: true - }); - } - - /** - * Parse simple path. - */ - var bailRE = /[^\w.$]/; - function parsePath (path) { - if (bailRE.test(path)) { - return - } else { - var segments = path.split('.'); - return function (obj) { - for (var i = 0; i < segments.length; i++) { - if (!obj) { return } - obj = obj[segments[i]]; - } - return obj - } - } - } - /* */ /* globals MutationObserver */ @@ -593,6 +571,7 @@ return /******/ (function(modules) { // webpackBootstrap var isEdge = UA && UA.indexOf('edge/') > 0; var isAndroid = UA && UA.indexOf('android') > 0; var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA); + var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; // this needs to be lazy-evaled because vue may be required before // vue-server-renderer can set VUE_ENV @@ -619,6 +598,10 @@ return /******/ (function(modules) { // webpackBootstrap return /native code/.test(Ctor.toString()) } + var hasSymbol = + typeof Symbol !== 'undefined' && isNative(Symbol) && + typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys); + /** * Defer a task to execute it asynchronously. */ @@ -723,11 +706,68 @@ return /******/ (function(modules) { // webpackBootstrap }()); } + var perf; + + if (process.env.NODE_ENV !== 'production') { + perf = inBrowser && window.performance; + if (perf && (!perf.mark || !perf.measure)) { + perf = undefined; + } + } + + /* */ + + var emptyObject = Object.freeze({}); + + /** + * Check if a string starts with $ or _ + */ + function isReserved (str) { + var c = (str + '').charCodeAt(0); + return c === 0x24 || c === 0x5F + } + + /** + * Define a property. + */ + function def (obj, key, val, enumerable) { + Object.defineProperty(obj, key, { + value: val, + enumerable: !!enumerable, + writable: true, + configurable: true + }); + } + + /** + * Parse simple path. + */ + var bailRE = /[^\w.$]/; + function parsePath (path) { + if (bailRE.test(path)) { + return + } else { + var segments = path.split('.'); + return function (obj) { + for (var i = 0; i < segments.length; i++) { + if (!obj) { return } + obj = obj[segments[i]]; + } + return obj + } + } + } + var warn = noop; + var tip = noop; var formatComponentName; if (process.env.NODE_ENV !== 'production') { var hasConsole = typeof console !== 'undefined'; + var classifyRE = /(?:^|[-_])(\w)/g; + var classify = function (str) { return str + .replace(classifyRE, function (c) { return c.toUpperCase(); }) + .replace(/[-_]/g, ''); }; warn = function (msg, vm) { if (hasConsole && (!config.silent)) { @@ -737,21 +777,36 @@ return /******/ (function(modules) { // webpackBootstrap } }; - formatComponentName = function (vm) { + tip = function (msg, vm) { + if (hasConsole && (!config.silent)) { + console.warn("[Vue tip]: " + msg + " " + ( + vm ? formatLocation(formatComponentName(vm)) : '' + )); + } + }; + + formatComponentName = function (vm, includeFile) { if (vm.$root === vm) { - return 'root instance' + return '' } var name = vm._isVue ? vm.$options.name || vm.$options._componentTag : vm.name; + + var file = vm._isVue && vm.$options.__file; + if (!name && file) { + var match = file.match(/([^/\\]+)\.vue$/); + name = match && match[1]; + } + return ( - (name ? ("component <" + name + ">") : "anonymous component") + - (vm._isVue && vm.$options.__file ? (" at " + (vm.$options.__file)) : '') + (name ? ("<" + (classify(name)) + ">") : "") + + (file && includeFile !== false ? (" at " + file) : '') ) }; var formatLocation = function (str) { - if (str === 'anonymous component') { + if (str === "") { str += " - use the \"name\" option for better debugging messages."; } return ("\n(found in " + str + ")") @@ -777,7 +832,7 @@ return /******/ (function(modules) { // webpackBootstrap }; Dep.prototype.removeSub = function removeSub (sub) { - remove$1(this.subs, sub); + remove(this.subs, sub); }; Dep.prototype.depend = function depend () { @@ -1030,7 +1085,7 @@ return /******/ (function(modules) { // webpackBootstrap * triggers change notification if the property doesn't * already exist. */ - function set$1 (obj, key, val) { + function set (obj, key, val) { if (Array.isArray(obj)) { obj.length = Math.max(obj.length, key); obj.splice(key, 1, val); @@ -1061,6 +1116,10 @@ return /******/ (function(modules) { // webpackBootstrap * Delete a property and trigger change if necessary. */ function del (obj, key) { + if (Array.isArray(obj)) { + obj.splice(key, 1); + return + } var ob = obj.__ob__; if (obj._isVue || (ob && ob.vmCount)) { process.env.NODE_ENV !== 'production' && warn( @@ -1129,7 +1188,7 @@ return /******/ (function(modules) { // webpackBootstrap toVal = to[key]; fromVal = from[key]; if (!hasOwn(to, key)) { - set$1(to, key, fromVal); + set(to, key, fromVal); } else if (isPlainObject(toVal) && isPlainObject(fromVal)) { mergeData(toVal, fromVal); } @@ -1192,7 +1251,7 @@ return /******/ (function(modules) { // webpackBootstrap }; /** - * Hooks and param attributes are merged as arrays. + * Hooks and props are merged as arrays. */ function mergeHook ( parentVal, @@ -1237,7 +1296,7 @@ return /******/ (function(modules) { // webpackBootstrap */ strats.watch = function (parentVal, childVal) { /* istanbul ignore if */ - if (!childVal) { return parentVal } + if (!childVal) { return Object.create(parentVal || null) } if (!parentVal) { return childVal } var ret = {}; extend(ret, parentVal); @@ -1260,7 +1319,7 @@ return /******/ (function(modules) { // webpackBootstrap strats.props = strats.methods = strats.computed = function (parentVal, childVal) { - if (!childVal) { return parentVal } + if (!childVal) { return Object.create(parentVal || null) } if (!parentVal) { return childVal } var ret = Object.create(null); extend(ret, parentVal); @@ -1463,8 +1522,8 @@ return /******/ (function(modules) { // webpackBootstrap } var def = prop.default; // warn against non-factory defaults for Object & Array - if (isObject(def)) { - process.env.NODE_ENV !== 'production' && warn( + if (process.env.NODE_ENV !== 'production' && isObject(def)) { + warn( 'Invalid default value for prop "' + key + '": ' + 'Props with type Object/Array must use a factory function ' + 'to return the default value.', @@ -1475,11 +1534,12 @@ return /******/ (function(modules) { // webpackBootstrap // return previous default value to avoid unnecessary watcher trigger if (vm && vm.$options.propsData && vm.$options.propsData[key] === undefined && - vm[key] !== undefined) { - return vm[key] + vm._props[key] !== undefined) { + return vm._props[key] } // call factory function for non-Function types - return typeof def === 'function' && prop.type !== Function + // a value is Function if its prototype is function even across different execution context + return typeof def === 'function' && getType(prop.type) !== 'Function' ? def.call(vm) : def } @@ -1587,54 +1647,21 @@ return /******/ (function(modules) { // webpackBootstrap return false } - - - var util = Object.freeze({ - defineReactive: defineReactive$$1, - _toString: _toString, - toNumber: toNumber, - makeMap: makeMap, - isBuiltInTag: isBuiltInTag, - remove: remove$1, - hasOwn: hasOwn, - isPrimitive: isPrimitive, - cached: cached, - camelize: camelize, - capitalize: capitalize, - hyphenate: hyphenate, - bind: bind$1, - toArray: toArray, - extend: extend, - isObject: isObject, - isPlainObject: isPlainObject, - toObject: toObject, - noop: noop, - no: no, - identity: identity, - genStaticKeys: genStaticKeys, - looseEqual: looseEqual, - looseIndexOf: looseIndexOf, - isReserved: isReserved, - def: def, - parsePath: parsePath, - hasProto: hasProto, - inBrowser: inBrowser, - UA: UA, - isIE: isIE, - isIE9: isIE9, - isEdge: isEdge, - isAndroid: isAndroid, - isIOS: isIOS, - isServerRendering: isServerRendering, - devtools: devtools, - nextTick: nextTick, - get _Set () { return _Set; }, - mergeOptions: mergeOptions, - resolveAsset: resolveAsset, - get warn () { return warn; }, - get formatComponentName () { return formatComponentName; }, - validateProp: validateProp - }); + function handleError (err, vm, type) { + if (config.errorHandler) { + config.errorHandler.call(null, err, vm, type); + } else { + if (process.env.NODE_ENV !== 'production') { + warn(("Error in " + type + ":"), vm); + } + /* istanbul ignore else */ + if (inBrowser && typeof console !== 'undefined') { + console.error(err); + } else { + throw err + } + } + } /* not type checking this file because flow doesn't play well with Proxy */ @@ -1793,372 +1820,34 @@ return /******/ (function(modules) { // webpackBootstrap /* */ - var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy$1 }; - var hooksToMerge = Object.keys(hooks); - - function createComponent ( - Ctor, - data, - context, - children, - tag - ) { - if (!Ctor) { - return - } - - var baseCtor = context.$options._base; - if (isObject(Ctor)) { - Ctor = baseCtor.extend(Ctor); - } - - if (typeof Ctor !== 'function') { - if (process.env.NODE_ENV !== 'production') { - warn(("Invalid Component definition: " + (String(Ctor))), context); - } - return - } - - // async component - if (!Ctor.cid) { - if (Ctor.resolved) { - Ctor = Ctor.resolved; - } else { - Ctor = resolveAsyncComponent(Ctor, baseCtor, function () { - // it's ok to queue this on every render because - // $forceUpdate is buffered by the scheduler. - context.$forceUpdate(); - }); - if (!Ctor) { - // return nothing if this is indeed an async component - // wait for the callback to trigger parent update. - return - } - } - } - - // resolve constructor options in case global mixins are applied after - // component constructor creation - resolveConstructorOptions(Ctor); - - data = data || {}; - - // extract props - var propsData = extractProps(data, Ctor); - - // functional component - if (Ctor.options.functional) { - return createFunctionalComponent(Ctor, propsData, data, context, children) - } - - // extract listeners, since these needs to be treated as - // child component listeners instead of DOM listeners - var listeners = data.on; - // replace with listeners with .native modifier - data.on = data.nativeOn; - - if (Ctor.options.abstract) { - // abstract components do not keep anything - // other than props & listeners - data = {}; - } - - // merge component management hooks onto the placeholder node - mergeHooks(data); - - // return a placeholder vnode - var name = Ctor.options.name || tag; - var vnode = new VNode( - ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), - data, undefined, undefined, undefined, context, - { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children } - ); - return vnode - } - - function createFunctionalComponent ( - Ctor, - propsData, - data, - context, - children - ) { - var props = {}; - var propOptions = Ctor.options.props; - if (propOptions) { - for (var key in propOptions) { - props[key] = validateProp(key, propOptions, propsData); - } - } - // ensure the createElement function in functional components - // gets a unique context - this is necessary for correct named slot check - var _context = Object.create(context); - var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); }; - var vnode = Ctor.options.render.call(null, h, { - props: props, - data: data, - parent: context, - children: children, - slots: function () { return resolveSlots(children, context); } - }); - if (vnode instanceof VNode) { - vnode.functionalContext = context; - if (data.slot) { - (vnode.data || (vnode.data = {})).slot = data.slot; - } - } - return vnode - } - - function createComponentInstanceForVnode ( - vnode, // we know it's MountedComponentVNode but flow doesn't - parent, // activeInstance in lifecycle state - parentElm, - refElm - ) { - var vnodeComponentOptions = vnode.componentOptions; - var options = { - _isComponent: true, - parent: parent, - propsData: vnodeComponentOptions.propsData, - _componentTag: vnodeComponentOptions.tag, - _parentVnode: vnode, - _parentListeners: vnodeComponentOptions.listeners, - _renderChildren: vnodeComponentOptions.children, - _parentElm: parentElm || null, - _refElm: refElm || null - }; - // check inline-template render functions - var inlineTemplate = vnode.data.inlineTemplate; - if (inlineTemplate) { - options.render = inlineTemplate.render; - options.staticRenderFns = inlineTemplate.staticRenderFns; - } - return new vnodeComponentOptions.Ctor(options) - } - - function init ( - vnode, - hydrating, - parentElm, - refElm - ) { - if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) { - var child = vnode.componentInstance = createComponentInstanceForVnode( - vnode, - activeInstance, - parentElm, - refElm - ); - child.$mount(hydrating ? vnode.elm : undefined, hydrating); - } else if (vnode.data.keepAlive) { - // kept-alive components, treat as a patch - var mountedNode = vnode; // work around flow - prepatch(mountedNode, mountedNode); - } - } - - function prepatch ( - oldVnode, - vnode - ) { - var options = vnode.componentOptions; - var child = vnode.componentInstance = oldVnode.componentInstance; - child._updateFromParent( - options.propsData, // updated props - options.listeners, // updated listeners - vnode, // new parent vnode - options.children // new children - ); - } - - function insert (vnode) { - if (!vnode.componentInstance._isMounted) { - vnode.componentInstance._isMounted = true; - callHook(vnode.componentInstance, 'mounted'); - } - if (vnode.data.keepAlive) { - vnode.componentInstance._inactive = false; - callHook(vnode.componentInstance, 'activated'); - } - } - - function destroy$1 (vnode) { - if (!vnode.componentInstance._isDestroyed) { - if (!vnode.data.keepAlive) { - vnode.componentInstance.$destroy(); - } else { - vnode.componentInstance._inactive = true; - callHook(vnode.componentInstance, 'deactivated'); - } - } - } - - function resolveAsyncComponent ( - factory, - baseCtor, - cb - ) { - if (factory.requested) { - // pool callbacks - factory.pendingCallbacks.push(cb); - } else { - factory.requested = true; - var cbs = factory.pendingCallbacks = [cb]; - var sync = true; - - var resolve = function (res) { - if (isObject(res)) { - res = baseCtor.extend(res); - } - // cache resolved - factory.resolved = res; - // invoke callbacks only if this is not a synchronous resolve - // (async resolves are shimmed as synchronous during SSR) - if (!sync) { - for (var i = 0, l = cbs.length; i < l; i++) { - cbs[i](res); - } - } - }; - - var reject = function (reason) { - process.env.NODE_ENV !== 'production' && warn( - "Failed to resolve async component: " + (String(factory)) + - (reason ? ("\nReason: " + reason) : '') - ); - }; - - var res = factory(resolve, reject); - - // handle promise - if (res && typeof res.then === 'function' && !factory.resolved) { - res.then(resolve, reject); - } - - sync = false; - // return in case resolved synchronously - return factory.resolved - } - } - - function extractProps (data, Ctor) { - // we are only extracting raw values here. - // validation and default values are handled in the child - // component itself. - var propOptions = Ctor.options.props; - if (!propOptions) { - return - } - var res = {}; - var attrs = data.attrs; - var props = data.props; - var domProps = data.domProps; - if (attrs || props || domProps) { - for (var key in propOptions) { - var altKey = hyphenate(key); - checkProp(res, props, key, altKey, true) || - checkProp(res, attrs, key, altKey) || - checkProp(res, domProps, key, altKey); - } - } - return res - } - - function checkProp ( - res, - hash, - key, - altKey, - preserve - ) { - if (hash) { - if (hasOwn(hash, key)) { - res[key] = hash[key]; - if (!preserve) { - delete hash[key]; - } - return true - } else if (hasOwn(hash, altKey)) { - res[key] = hash[altKey]; - if (!preserve) { - delete hash[altKey]; - } - return true - } - } - return false - } - - function mergeHooks (data) { - if (!data.hook) { - data.hook = {}; - } - for (var i = 0; i < hooksToMerge.length; i++) { - var key = hooksToMerge[i]; - var fromParent = data.hook[key]; - var ours = hooks[key]; - data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours; - } - } - - function mergeHook$1 (one, two) { - return function (a, b, c, d) { - one(a, b, c, d); - two(a, b, c, d); - } - } - - /* */ - - function mergeVNodeHook (def, hookKey, hook, key) { - key = key + hookKey; - var injectedHash = def.__injected || (def.__injected = {}); - if (!injectedHash[key]) { - injectedHash[key] = true; - var oldHook = def[hookKey]; - if (oldHook) { - def[hookKey] = function () { - oldHook.apply(this, arguments); - hook.apply(this, arguments); - }; - } else { - def[hookKey] = hook; - } - } - } - - /* */ - var normalizeEvent = cached(function (name) { - var once = name.charAt(0) === '~'; // Prefixed last, checked first - name = once ? name.slice(1) : name; + var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first + name = once$$1 ? name.slice(1) : name; var capture = name.charAt(0) === '!'; name = capture ? name.slice(1) : name; return { name: name, - once: once, + once: once$$1, capture: capture } }); - function createEventHandle (fn) { - var handle = { - fn: fn, - invoker: function () { - var arguments$1 = arguments; + function createFnInvoker (fns) { + function invoker () { + var arguments$1 = arguments; - var fn = handle.fn; - if (Array.isArray(fn)) { - for (var i = 0; i < fn.length; i++) { - fn[i].apply(null, arguments$1); - } - } else { - fn.apply(null, arguments); + var fns = invoker.fns; + if (Array.isArray(fns)) { + for (var i = 0; i < fns.length; i++) { + fns[i].apply(null, arguments$1); } + } else { + // return handler return value for single handlers + return fns.apply(null, arguments) } - }; - return handle + } + invoker.fns = fns; + return invoker } function updateListeners ( @@ -2179,25 +1868,57 @@ return /******/ (function(modules) { // webpackBootstrap vm ); } else if (!old) { - if (!cur.invoker) { - cur = on[name] = createEventHandle(cur); + if (!cur.fns) { + cur = on[name] = createFnInvoker(cur); } - add(event.name, cur.invoker, event.once, event.capture); + add(event.name, cur, event.once, event.capture); } else if (cur !== old) { - old.fn = cur; + old.fns = cur; on[name] = old; } } for (name in oldOn) { if (!on[name]) { event = normalizeEvent(name); - remove$$1(event.name, oldOn[name].invoker, event.capture); + remove$$1(event.name, oldOn[name], event.capture); } } } /* */ + function mergeVNodeHook (def, hookKey, hook) { + var invoker; + var oldHook = def[hookKey]; + + function wrappedHook () { + hook.apply(this, arguments); + // important: remove merged hook to ensure it's called only once + // and prevent memory leak + remove(invoker.fns, wrappedHook); + } + + if (!oldHook) { + // no existing hook + invoker = createFnInvoker([wrappedHook]); + } else { + /* istanbul ignore if */ + if (oldHook.fns && oldHook.merged) { + // already a merged invoker + invoker = oldHook; + invoker.fns.push(wrappedHook); + } else { + // existing plain hook + invoker = createFnInvoker([oldHook, wrappedHook]); + } + } + + invoker.merged = true; + def[hookKey] = invoker; + } + + /* */ + // The template compiler attempts to minimize the need for normalization by // statically analyzing the template at compile time. // @@ -2207,7 +1928,7 @@ return /******/ (function(modules) { // webpackBootstrap // 1. When the children contains components - because a functional component // may return an Array instead of a single root. In this case, just a simple - // nomralization is needed - if any child is an Array, we flatten the whole + // normalization is needed - if any child is an Array, we flatten the whole // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep // because functional components already normalize their own children. function simpleNormalizeChildren (children) { @@ -2271,398 +1992,6 @@ return /******/ (function(modules) { // webpackBootstrap /* */ - var SIMPLE_NORMALIZE = 1; - var ALWAYS_NORMALIZE = 2; - - // wrapper function for providing a more flexible interface - // without getting yelled at by flow - function createElement ( - context, - tag, - data, - children, - normalizationType, - alwaysNormalize - ) { - if (Array.isArray(data) || isPrimitive(data)) { - normalizationType = children; - children = data; - data = undefined; - } - if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; } - return _createElement(context, tag, data, children, normalizationType) - } - - function _createElement ( - context, - tag, - data, - children, - normalizationType - ) { - if (data && data.__ob__) { - process.env.NODE_ENV !== 'production' && warn( - "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + - 'Always create fresh vnode data objects in each render!', - context - ); - return createEmptyVNode() - } - if (!tag) { - // in case of component :is set to falsy value - return createEmptyVNode() - } - // support single function children as default scoped slot - if (Array.isArray(children) && - typeof children[0] === 'function') { - data = data || {}; - data.scopedSlots = { default: children[0] }; - children.length = 0; - } - if (normalizationType === ALWAYS_NORMALIZE) { - children = normalizeChildren(children); - } else if (normalizationType === SIMPLE_NORMALIZE) { - children = simpleNormalizeChildren(children); - } - var vnode, ns; - if (typeof tag === 'string') { - var Ctor; - ns = config.getTagNamespace(tag); - if (config.isReservedTag(tag)) { - // platform built-in elements - vnode = new VNode( - config.parsePlatformTagName(tag), data, children, - undefined, undefined, context - ); - } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) { - // component - vnode = createComponent(Ctor, data, context, children, tag); - } else { - // unknown or unlisted namespaced elements - // check at runtime because it may get assigned a namespace when its - // parent normalizes children - vnode = new VNode( - tag, data, children, - undefined, undefined, context - ); - } - } else { - // direct component options / constructor - vnode = createComponent(tag, data, context, children); - } - if (vnode) { - if (ns) { applyNS(vnode, ns); } - return vnode - } else { - return createEmptyVNode() - } - } - - function applyNS (vnode, ns) { - vnode.ns = ns; - if (vnode.tag === 'foreignObject') { - // use default namespace inside foreignObject - return - } - if (vnode.children) { - for (var i = 0, l = vnode.children.length; i < l; i++) { - var child = vnode.children[i]; - if (child.tag && !child.ns) { - applyNS(child, ns); - } - } - } - } - - /* */ - - function initRender (vm) { - vm.$vnode = null; // the placeholder node in parent tree - vm._vnode = null; // the root of the child tree - vm._staticTrees = null; - var parentVnode = vm.$options._parentVnode; - var renderContext = parentVnode && parentVnode.context; - vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext); - vm.$scopedSlots = {}; - // bind the createElement fn to this instance - // so that we get proper render context inside it. - // args order: tag, data, children, normalizationType, alwaysNormalize - // internal version is used by render functions compiled from templates - vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; - // normalization is always applied for the public version, used in - // user-written render functions. - vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; - } - - function renderMixin (Vue) { - Vue.prototype.$nextTick = function (fn) { - return nextTick(fn, this) - }; - - Vue.prototype._render = function () { - var vm = this; - var ref = vm.$options; - var render = ref.render; - var staticRenderFns = ref.staticRenderFns; - var _parentVnode = ref._parentVnode; - - if (vm._isMounted) { - // clone slot nodes on re-renders - for (var key in vm.$slots) { - vm.$slots[key] = cloneVNodes(vm.$slots[key]); - } - } - - if (_parentVnode && _parentVnode.data.scopedSlots) { - vm.$scopedSlots = _parentVnode.data.scopedSlots; - } - - if (staticRenderFns && !vm._staticTrees) { - vm._staticTrees = []; - } - // set parent vnode. this allows render functions to have access - // to the data on the placeholder node. - vm.$vnode = _parentVnode; - // render self - var vnode; - try { - vnode = render.call(vm._renderProxy, vm.$createElement); - } catch (e) { - /* istanbul ignore else */ - if (config.errorHandler) { - config.errorHandler.call(null, e, vm); - } else { - if (process.env.NODE_ENV !== 'production') { - warn(("Error when rendering " + (formatComponentName(vm)) + ":")); - } - throw e - } - // return previous vnode to prevent render error causing blank component - vnode = vm._vnode; - } - // return empty vnode in case the render function errored out - if (!(vnode instanceof VNode)) { - if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) { - warn( - 'Multiple root nodes returned from render function. Render function ' + - 'should return a single root node.', - vm - ); - } - vnode = createEmptyVNode(); - } - // set parent - vnode.parent = _parentVnode; - return vnode - }; - - // toString for mustaches - Vue.prototype._s = _toString; - // convert text to vnode - Vue.prototype._v = createTextVNode; - // number conversion - Vue.prototype._n = toNumber; - // empty vnode - Vue.prototype._e = createEmptyVNode; - // loose equal - Vue.prototype._q = looseEqual; - // loose indexOf - Vue.prototype._i = looseIndexOf; - - // render static tree by index - Vue.prototype._m = function renderStatic ( - index, - isInFor - ) { - var tree = this._staticTrees[index]; - // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree by doing a shallow clone. - if (tree && !isInFor) { - return Array.isArray(tree) - ? cloneVNodes(tree) - : cloneVNode(tree) - } - // otherwise, render a fresh tree. - tree = this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy); - markStatic(tree, ("__static__" + index), false); - return tree - }; - - // mark node as static (v-once) - Vue.prototype._o = function markOnce ( - tree, - index, - key - ) { - markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); - return tree - }; - - function markStatic (tree, key, isOnce) { - if (Array.isArray(tree)) { - for (var i = 0; i < tree.length; i++) { - if (tree[i] && typeof tree[i] !== 'string') { - markStaticNode(tree[i], (key + "_" + i), isOnce); - } - } - } else { - markStaticNode(tree, key, isOnce); - } - } - - function markStaticNode (node, key, isOnce) { - node.isStatic = true; - node.key = key; - node.isOnce = isOnce; - } - - // filter resolution helper - Vue.prototype._f = function resolveFilter (id) { - return resolveAsset(this.$options, 'filters', id, true) || identity - }; - - // render v-for - Vue.prototype._l = function renderList ( - val, - render - ) { - var ret, i, l, keys, key; - if (Array.isArray(val) || typeof val === 'string') { - ret = new Array(val.length); - for (i = 0, l = val.length; i < l; i++) { - ret[i] = render(val[i], i); - } - } else if (typeof val === 'number') { - ret = new Array(val); - for (i = 0; i < val; i++) { - ret[i] = render(i + 1, i); - } - } else if (isObject(val)) { - keys = Object.keys(val); - ret = new Array(keys.length); - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - ret[i] = render(val[key], key, i); - } - } - return ret - }; - - // renderSlot - Vue.prototype._t = function ( - name, - fallback, - props, - bindObject - ) { - var scopedSlotFn = this.$scopedSlots[name]; - if (scopedSlotFn) { // scoped slot - props = props || {}; - if (bindObject) { - extend(props, bindObject); - } - return scopedSlotFn(props) || fallback - } else { - var slotNodes = this.$slots[name]; - // warn duplicate slot usage - if (slotNodes && 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; - } - return slotNodes || fallback - } - }; - - // apply v-bind object - Vue.prototype._b = function bindProps ( - data, - tag, - value, - asProp - ) { - if (value) { - if (!isObject(value)) { - process.env.NODE_ENV !== 'production' && warn( - 'v-bind without argument expects an Object or Array value', - this - ); - } else { - if (Array.isArray(value)) { - value = toObject(value); - } - for (var key in value) { - if (key === 'class' || key === 'style') { - data[key] = value[key]; - } else { - var type = data.attrs && data.attrs.type; - var hash = asProp || config.mustUseProp(tag, type, key) - ? data.domProps || (data.domProps = {}) - : data.attrs || (data.attrs = {}); - hash[key] = value[key]; - } - } - } - } - return data - }; - - // check v-on keyCodes - Vue.prototype._k = function checkKeyCodes ( - eventKeyCode, - key, - builtInAlias - ) { - var keyCodes = config.keyCodes[key] || builtInAlias; - if (Array.isArray(keyCodes)) { - return keyCodes.indexOf(eventKeyCode) === -1 - } else { - return keyCodes !== eventKeyCode - } - }; - } - - function resolveSlots ( - children, - context - ) { - var slots = {}; - if (!children) { - return slots - } - var defaultSlot = []; - var name, child; - for (var i = 0, l = children.length; i < l; i++) { - child = children[i]; - // named slots should only be respected if the vnode was rendered in the - // same context. - if ((child.context === context || child.functionalContext === context) && - child.data && (name = child.data.slot)) { - var slot = (slots[name] || (slots[name] = [])); - if (child.tag === 'template') { - slot.push.apply(slot, child.children); - } else { - slot.push(child); - } - } else { - defaultSlot.push(child); - } - } - // ignore single whitespace - if (defaultSlot.length && !( - defaultSlot.length === 1 && - (defaultSlot[0].text === ' ' || defaultSlot[0].isComment) - )) { - slots.default = defaultSlot; - } - return slots - } - - /* */ - function initEvents (vm) { vm._events = Object.create(null); vm._hasHookEvent = false; @@ -2675,15 +2004,15 @@ return /******/ (function(modules) { // webpackBootstrap var target; - function add$1 (event, fn, once) { - if (once) { + function add (event, fn, once$$1) { + if (once$$1) { target.$once(event, fn); } else { target.$on(event, fn); } } - function remove$2 (event, fn) { + function remove$1 (event, fn) { target.$off(event, fn); } @@ -2693,17 +2022,26 @@ return /******/ (function(modules) { // webpackBootstrap oldListeners ) { target = vm; - updateListeners(listeners, oldListeners || {}, add$1, remove$2, vm); + updateListeners(listeners, oldListeners || {}, add, remove$1, vm); } function eventsMixin (Vue) { var hookRE = /^hook:/; Vue.prototype.$on = function (event, fn) { - var vm = this;(vm._events[event] || (vm._events[event] = [])).push(fn); - // optimize hook:event cost by using a boolean flag marked at registration - // instead of a hash lookup - if (hookRE.test(event)) { - vm._hasHookEvent = true; + 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); + } + } else { + (vm._events[event] || (vm._events[event] = [])).push(fn); + // optimize hook:event cost by using a boolean flag marked at registration + // instead of a hash lookup + if (hookRE.test(event)) { + vm._hasHookEvent = true; + } } return vm }; @@ -2764,6 +2102,57 @@ return /******/ (function(modules) { // webpackBootstrap /* */ + /** + * Runtime helper for resolving raw children VNodes into a slot object. + */ + function resolveSlots ( + children, + context + ) { + var slots = {}; + if (!children) { + return slots + } + var defaultSlot = []; + var name, child; + for (var i = 0, l = children.length; i < l; i++) { + child = children[i]; + // named slots should only be respected if the vnode was rendered in the + // same context. + if ((child.context === context || child.functionalContext === context) && + child.data && (name = child.data.slot)) { + var slot = (slots[name] || (slots[name] = [])); + if (child.tag === 'template') { + slot.push.apply(slot, child.children); + } else { + slot.push(child); + } + } else { + defaultSlot.push(child); + } + } + // ignore single whitespace + if (defaultSlot.length && !( + defaultSlot.length === 1 && + (defaultSlot[0].text === ' ' || defaultSlot[0].isComment) + )) { + slots.default = defaultSlot; + } + return slots + } + + function resolveScopedSlots ( + fns + ) { + var res = {}; + for (var i = 0; i < fns.length; i++) { + res[fns[i][0]] = fns[i][1]; + } + return res + } + + /* */ + var activeInstance = null; function initLifecycle (vm) { @@ -2785,52 +2174,14 @@ return /******/ (function(modules) { // webpackBootstrap vm.$refs = {}; vm._watcher = null; - vm._inactive = false; + vm._inactive = null; + vm._directInactive = false; vm._isMounted = false; vm._isDestroyed = false; vm._isBeingDestroyed = false; } function lifecycleMixin (Vue) { - Vue.prototype._mount = function ( - el, - hydrating - ) { - var vm = this; - vm.$el = el; - if (!vm.$options.render) { - vm.$options.render = createEmptyVNode; - if (process.env.NODE_ENV !== 'production') { - /* istanbul ignore if */ - if (vm.$options.template && vm.$options.template.charAt(0) !== '#') { - warn( - 'You are using the runtime-only build of Vue where the template ' + - 'option is not available. Either pre-compile the templates into ' + - 'render functions, or use the compiler-included build.', - vm - ); - } else { - warn( - 'Failed to mount component: template or render function not defined.', - vm - ); - } - } - } - callHook(vm, 'beforeMount'); - vm._watcher = new Watcher(vm, function updateComponent () { - vm._update(vm._render(), hydrating); - }, noop); - hydrating = false; - // manually mounted instance, call mounted on self - // mounted is called for render-created child components in its inserted hook - if (vm.$vnode == null) { - vm._isMounted = true; - callHook(vm, 'mounted'); - } - return vm - }; - Vue.prototype._update = function (vnode, hydrating) { var vm = this; if (vm._isMounted) { @@ -2870,50 +2221,6 @@ return /******/ (function(modules) { // webpackBootstrap // updated in a parent's updated hook. }; - Vue.prototype._updateFromParent = function ( - propsData, - listeners, - parentVnode, - renderChildren - ) { - var vm = this; - var hasChildren = !!(vm.$options._renderChildren || renderChildren); - vm.$options._parentVnode = parentVnode; - vm.$vnode = parentVnode; // update vm's placeholder node without re-render - if (vm._vnode) { // update child tree's parent - vm._vnode.parent = parentVnode; - } - vm.$options._renderChildren = renderChildren; - // update props - if (propsData && vm.$options.props) { - observerState.shouldConvert = false; - if (process.env.NODE_ENV !== 'production') { - observerState.isSettingProps = true; - } - var propKeys = vm.$options._propKeys || []; - for (var i = 0; i < propKeys.length; i++) { - var key = propKeys[i]; - vm[key] = validateProp(key, vm.$options.props, propsData, vm); - } - observerState.shouldConvert = true; - if (process.env.NODE_ENV !== 'production') { - observerState.isSettingProps = false; - } - vm.$options.propsData = propsData; - } - // update listeners - if (listeners) { - var oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); - } - // resolve slots + force update if has children - if (hasChildren) { - vm.$slots = resolveSlots(renderChildren, parentVnode.context); - vm.$forceUpdate(); - } - }; - Vue.prototype.$forceUpdate = function () { var vm = this; if (vm._watcher) { @@ -2931,7 +2238,7 @@ return /******/ (function(modules) { // webpackBootstrap // remove self from parent var parent = vm.$parent; if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { - remove$1(parent.$children, vm); + remove(parent.$children, vm); } // teardown watchers if (vm._watcher) { @@ -2960,11 +2267,172 @@ return /******/ (function(modules) { // webpackBootstrap }; } + function mountComponent ( + vm, + el, + hydrating + ) { + vm.$el = el; + if (!vm.$options.render) { + vm.$options.render = createEmptyVNode; + if (process.env.NODE_ENV !== 'production') { + /* istanbul ignore if */ + if (vm.$options.template && vm.$options.template.charAt(0) !== '#') { + warn( + 'You are using the runtime-only build of Vue where the template ' + + 'option is not available. Either pre-compile the templates into ' + + 'render functions, or use the compiler-included build.', + vm + ); + } else { + warn( + 'Failed to mount component: template or render function not defined.', + vm + ); + } + } + } + callHook(vm, 'beforeMount'); + + var updateComponent; + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && config.performance && perf) { + updateComponent = function () { + var name = vm._name; + var startTag = "start " + name; + var endTag = "end " + name; + perf.mark(startTag); + var vnode = vm._render(); + perf.mark(endTag); + perf.measure((name + " render"), startTag, endTag); + perf.mark(startTag); + vm._update(vnode, hydrating); + perf.mark(endTag); + perf.measure((name + " patch"), startTag, endTag); + }; + } else { + updateComponent = function () { + vm._update(vm._render(), hydrating); + }; + } + + vm._watcher = new Watcher(vm, updateComponent, noop); + hydrating = false; + + // manually mounted instance, call mounted on self + // mounted is called for render-created child components in its inserted hook + if (vm.$vnode == null) { + vm._isMounted = true; + callHook(vm, 'mounted'); + } + return vm + } + + function updateChildComponent ( + vm, + propsData, + listeners, + parentVnode, + renderChildren + ) { + // determine whether component has slot children + // we need to do this before overwriting $options._renderChildren + var hasChildren = !!( + renderChildren || // has new static slots + vm.$options._renderChildren || // has old static slots + parentVnode.data.scopedSlots || // has new scoped slots + vm.$scopedSlots !== emptyObject // has old scoped slots + ); + + vm.$options._parentVnode = parentVnode; + vm.$vnode = parentVnode; // update vm's placeholder node without re-render + if (vm._vnode) { // update child tree's parent + vm._vnode.parent = parentVnode; + } + vm.$options._renderChildren = renderChildren; + + // update props + if (propsData && vm.$options.props) { + observerState.shouldConvert = false; + if (process.env.NODE_ENV !== 'production') { + observerState.isSettingProps = true; + } + var props = vm._props; + var propKeys = vm.$options._propKeys || []; + for (var i = 0; i < propKeys.length; i++) { + var key = propKeys[i]; + props[key] = validateProp(key, vm.$options.props, propsData, vm); + } + observerState.shouldConvert = true; + if (process.env.NODE_ENV !== 'production') { + observerState.isSettingProps = false; + } + // keep a copy of raw propsData + vm.$options.propsData = propsData; + } + // update listeners + if (listeners) { + var oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); + } + // resolve slots + force update if has children + if (hasChildren) { + vm.$slots = resolveSlots(renderChildren, parentVnode.context); + vm.$forceUpdate(); + } + } + + function isInInactiveTree (vm) { + while (vm && (vm = vm.$parent)) { + if (vm._inactive) { return true } + } + return false + } + + function activateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = false; + if (isInInactiveTree(vm)) { + return + } + } else if (vm._directInactive) { + return + } + if (vm._inactive || vm._inactive == null) { + vm._inactive = false; + for (var i = 0; i < vm.$children.length; i++) { + activateChildComponent(vm.$children[i]); + } + callHook(vm, 'activated'); + } + } + + function deactivateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = true; + if (isInInactiveTree(vm)) { + return + } + } + if (!vm._inactive) { + vm._inactive = true; + for (var i = 0; i < vm.$children.length; i++) { + deactivateChildComponent(vm.$children[i]); + } + callHook(vm, 'deactivated'); + } + } + function callHook (vm, hook) { var handlers = vm.$options[hook]; if (handlers) { for (var i = 0, j = handlers.length; i < j; i++) { - handlers[i].call(vm); + try { + handlers[i].call(vm); + } catch (e) { + handleError(e, vm, (hook + " hook")); + } } } if (vm._hasHookEvent) { @@ -2976,7 +2444,7 @@ return /******/ (function(modules) { // webpackBootstrap var queue = []; - var has$1 = {}; + var has = {}; var circular = {}; var waiting = false; var flushing = false; @@ -2987,7 +2455,7 @@ return /******/ (function(modules) { // webpackBootstrap */ function resetSchedulerState () { queue.length = 0; - has$1 = {}; + has = {}; if (process.env.NODE_ENV !== 'production') { circular = {}; } @@ -3016,10 +2484,10 @@ return /******/ (function(modules) { // webpackBootstrap for (index = 0; index < queue.length; index++) { watcher = queue[index]; id = watcher.id; - has$1[id] = null; + has[id] = null; watcher.run(); // in dev build, check and stop circular updates. - if (process.env.NODE_ENV !== 'production' && has$1[id] != null) { + if (process.env.NODE_ENV !== 'production' && has[id] != null) { circular[id] = (circular[id] || 0) + 1; if (circular[id] > config._maxUpdateCount) { warn( @@ -3061,8 +2529,8 @@ return /******/ (function(modules) { // webpackBootstrap */ function queueWatcher (watcher) { var id = watcher.id; - if (has$1[id] == null) { - has$1[id] = true; + if (has[id] == null) { + has[id] = true; if (!flushing) { queue.push(watcher); } else { @@ -3072,483 +2540,1272 @@ return /******/ (function(modules) { // webpackBootstrap while (i >= 0 && queue[i].id > watcher.id) { i--; } - queue.splice(Math.max(i, index) + 1, 0, watcher); - } - // queue the flush - if (!waiting) { - waiting = true; - nextTick(flushSchedulerQueue); + queue.splice(Math.max(i, index) + 1, 0, watcher); + } + // queue the flush + if (!waiting) { + waiting = true; + nextTick(flushSchedulerQueue); + } + } + } + + /* */ + + var uid$2 = 0; + + /** + * A watcher parses an expression, collects dependencies, + * and fires callback when the expression value changes. + * This is used for both the $watch() api and directives. + */ + var Watcher = function Watcher ( + vm, + expOrFn, + cb, + options + ) { + this.vm = vm; + vm._watchers.push(this); + // options + if (options) { + this.deep = !!options.deep; + this.user = !!options.user; + this.lazy = !!options.lazy; + this.sync = !!options.sync; + } else { + this.deep = this.user = this.lazy = this.sync = false; + } + this.cb = cb; + this.id = ++uid$2; // uid for batching + this.active = true; + this.dirty = this.lazy; // for lazy watchers + this.deps = []; + this.newDeps = []; + this.depIds = new _Set(); + this.newDepIds = new _Set(); + this.expression = process.env.NODE_ENV !== 'production' + ? expOrFn.toString() + : ''; + // parse expression for getter + if (typeof expOrFn === 'function') { + this.getter = expOrFn; + } else { + this.getter = parsePath(expOrFn); + if (!this.getter) { + this.getter = function () {}; + process.env.NODE_ENV !== 'production' && warn( + "Failed watching path: \"" + expOrFn + "\" " + + 'Watcher only accepts simple dot-delimited paths. ' + + 'For full control, use a function instead.', + vm + ); + } + } + this.value = this.lazy + ? undefined + : this.get(); + }; + + /** + * Evaluate the getter, and re-collect dependencies. + */ + Watcher.prototype.get = function get () { + pushTarget(this); + var value; + var vm = this.vm; + if (this.user) { + try { + value = this.getter.call(vm, vm); + } catch (e) { + handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); + } + } else { + value = this.getter.call(vm, vm); + } + // "touch" every property so they are all tracked as + // dependencies for deep watching + if (this.deep) { + traverse(value); + } + popTarget(); + this.cleanupDeps(); + return value + }; + + /** + * Add a dependency to this directive. + */ + Watcher.prototype.addDep = function addDep (dep) { + var id = dep.id; + if (!this.newDepIds.has(id)) { + this.newDepIds.add(id); + this.newDeps.push(dep); + if (!this.depIds.has(id)) { + dep.addSub(this); + } + } + }; + + /** + * 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 tmp = this.depIds; + this.depIds = this.newDepIds; + this.newDepIds = tmp; + this.newDepIds.clear(); + tmp = this.deps; + this.deps = this.newDeps; + this.newDeps = tmp; + this.newDeps.length = 0; + }; + + /** + * Subscriber interface. + * Will be called when a dependency changes. + */ + Watcher.prototype.update = function update () { + /* istanbul ignore else */ + if (this.lazy) { + this.dirty = true; + } else if (this.sync) { + this.run(); + } else { + queueWatcher(this); + } + }; + + /** + * Scheduler job interface. + * Will be called by the scheduler. + */ + Watcher.prototype.run = function run () { + if (this.active) { + 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); + } + } + } + }; + + /** + * Evaluate the value of the watcher. + * This only gets called for lazy watchers. + */ + Watcher.prototype.evaluate = function evaluate () { + this.value = this.get(); + this.dirty = false; + }; + + /** + * Depend on all deps collected by this watcher. + */ + Watcher.prototype.depend = function depend () { + var this$1 = this; + + var i = this.deps.length; + while (i--) { + this$1.deps[i].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 + // if the vm is being destroyed. + if (!this.vm._isBeingDestroyed) { + remove(this.vm._watchers, this); + } + var i = this.deps.length; + while (i--) { + this$1.deps[i].removeSub(this$1); + } + this.active = false; + } + }; + + /** + * Recursively traverse an object to evoke all converted + * getters, so that every nested property inside the object + * is collected as a "deep" dependency. + */ + var seenObjects = new _Set(); + function traverse (val) { + seenObjects.clear(); + _traverse(val, seenObjects); + } + + function _traverse (val, seen) { + var i, keys; + var isA = Array.isArray(val); + if ((!isA && !isObject(val)) || !Object.isExtensible(val)) { + return + } + if (val.__ob__) { + var depId = val.__ob__.dep.id; + if (seen.has(depId)) { + return + } + seen.add(depId); + } + if (isA) { + i = val.length; + while (i--) { _traverse(val[i], seen); } + } else { + keys = Object.keys(val); + i = keys.length; + while (i--) { _traverse(val[keys[i]], seen); } + } + } + + /* */ + + var sharedPropertyDefinition = { + enumerable: true, + configurable: true, + get: noop, + set: noop + }; + + function proxy (target, sourceKey, key) { + sharedPropertyDefinition.get = function proxyGetter () { + return this[sourceKey][key] + }; + sharedPropertyDefinition.set = function proxySetter (val) { + this[sourceKey][key] = val; + }; + Object.defineProperty(target, key, sharedPropertyDefinition); + } + + function initState (vm) { + vm._watchers = []; + var opts = vm.$options; + if (opts.props) { initProps(vm, opts.props); } + if (opts.methods) { initMethods(vm, opts.methods); } + if (opts.data) { + initData(vm); + } else { + observe(vm._data = {}, true /* asRootData */); + } + if (opts.computed) { initComputed(vm, opts.computed); } + if (opts.watch) { initWatch(vm, opts.watch); } + } + + var isReservedProp = { key: 1, ref: 1, slot: 1 }; + + function initProps (vm, propsOptions) { + var propsData = vm.$options.propsData || {}; + var props = vm._props = {}; + // cache prop keys so that future props updates can iterate using Array + // instead of dynamic object key enumeration. + var keys = vm.$options._propKeys = []; + var isRoot = !vm.$parent; + // root instance props should be converted + observerState.shouldConvert = isRoot; + var loop = function ( key ) { + keys.push(key); + var value = validateProp(key, propsOptions, propsData, vm); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') { + if (isReservedProp[key]) { + warn( + ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."), + vm + ); + } + defineReactive$$1(props, key, value, function () { + if (vm.$parent && !observerState.isSettingProps) { + warn( + "Avoid mutating a prop directly since the value will be " + + "overwritten whenever the parent component re-renders. " + + "Instead, use a data or computed property based on the prop's " + + "value. Prop being mutated: \"" + key + "\"", + vm + ); + } + }); + } else { + 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 + // instantiation here. + if (!(key in vm)) { + proxy(vm, "_props", key); + } + }; + + for (var key in propsOptions) loop( key ); + observerState.shouldConvert = true; + } + + function initData (vm) { + var data = vm.$options.data; + data = vm._data = typeof data === 'function' + ? data.call(vm) + : data || {}; + if (!isPlainObject(data)) { + data = {}; + process.env.NODE_ENV !== 'production' && warn( + 'data functions should return an object:\n' + + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', + vm + ); + } + // proxy data on instance + var keys = Object.keys(data); + var props = vm.$options.props; + var i = keys.length; + while (i--) { + if (props && hasOwn(props, keys[i])) { + process.env.NODE_ENV !== 'production' && warn( + "The data property \"" + (keys[i]) + "\" is already declared as a prop. " + + "Use prop default value instead.", + vm + ); + } else if (!isReserved(keys[i])) { + proxy(vm, "_data", keys[i]); + } + } + // observe data + observe(data, true /* asRootData */); + } + + var computedWatcherOptions = { lazy: true }; + + function initComputed (vm, computed) { + var watchers = vm._computedWatchers = Object.create(null); + + for (var key in computed) { + var userDef = computed[key]; + var getter = typeof userDef === 'function' ? userDef : userDef.get; + // create internal watcher for the computed property. + watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions); + + // component-defined computed properties are already defined on the + // component prototype. We only need to define computed properties defined + // at instantiation here. + if (!(key in vm)) { + defineComputed(vm, key, userDef); + } + } + } + + function defineComputed (target, key, userDef) { + if (typeof userDef === 'function') { + sharedPropertyDefinition.get = createComputedGetter(key); + sharedPropertyDefinition.set = noop; + } else { + sharedPropertyDefinition.get = userDef.get + ? userDef.cache !== false + ? createComputedGetter(key) + : userDef.get + : noop; + sharedPropertyDefinition.set = userDef.set + ? userDef.set + : noop; + } + Object.defineProperty(target, key, sharedPropertyDefinition); + } + + function createComputedGetter (key) { + return function computedGetter () { + var watcher = this._computedWatchers && this._computedWatchers[key]; + if (watcher) { + if (watcher.dirty) { + watcher.evaluate(); + } + if (Dep.target) { + watcher.depend(); + } + return watcher.value + } + } + } + + function initMethods (vm, methods) { + var props = vm.$options.props; + for (var key in methods) { + vm[key] = methods[key] == null ? noop : bind(methods[key], vm); + if (process.env.NODE_ENV !== 'production') { + if (methods[key] == null) { + warn( + "method \"" + key + "\" has an undefined value in the component definition. " + + "Did you reference the function correctly?", + vm + ); + } + if (props && hasOwn(props, key)) { + warn( + ("method \"" + key + "\" has already been defined as a prop."), + vm + ); + } + } + } + } + + function initWatch (vm, watch) { + for (var key in watch) { + var handler = watch[key]; + if (Array.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + createWatcher(vm, key, handler[i]); + } + } else { + createWatcher(vm, key, handler); + } + } + } + + function createWatcher (vm, key, handler) { + var options; + if (isPlainObject(handler)) { + options = handler; + handler = handler.handler; + } + if (typeof handler === 'string') { + handler = vm[handler]; + } + vm.$watch(key, handler, options); + } + + function stateMixin (Vue) { + // flow somehow has problems with directly declared definition object + // when using Object.defineProperty, so we have to procedurally build up + // the object here. + var dataDef = {}; + dataDef.get = function () { return this._data }; + var propsDef = {}; + propsDef.get = function () { return this._props }; + if (process.env.NODE_ENV !== 'production') { + dataDef.set = function (newData) { + warn( + 'Avoid replacing instance root $data. ' + + 'Use nested data properties instead.', + this + ); + }; + propsDef.set = function () { + warn("$props is readonly.", this); + }; + } + Object.defineProperty(Vue.prototype, '$data', dataDef); + Object.defineProperty(Vue.prototype, '$props', propsDef); + + Vue.prototype.$set = set; + Vue.prototype.$delete = del; + + Vue.prototype.$watch = function ( + expOrFn, + cb, + options + ) { + var vm = this; + options = options || {}; + options.user = true; + var watcher = new Watcher(vm, expOrFn, cb, options); + if (options.immediate) { + cb.call(vm, watcher.value); + } + return function unwatchFn () { + watcher.teardown(); + } + }; + } + + /* */ + + var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy }; + var hooksToMerge = Object.keys(hooks); + + function createComponent ( + Ctor, + data, + context, + children, + tag + ) { + if (!Ctor) { + return + } + + var baseCtor = context.$options._base; + if (isObject(Ctor)) { + Ctor = baseCtor.extend(Ctor); + } + + if (typeof Ctor !== 'function') { + if (process.env.NODE_ENV !== 'production') { + warn(("Invalid Component definition: " + (String(Ctor))), context); + } + return + } + + // async component + if (!Ctor.cid) { + if (Ctor.resolved) { + Ctor = Ctor.resolved; + } else { + Ctor = resolveAsyncComponent(Ctor, baseCtor, function () { + // it's ok to queue this on every render because + // $forceUpdate is buffered by the scheduler. + context.$forceUpdate(); + }); + if (!Ctor) { + // return nothing if this is indeed an async component + // wait for the callback to trigger parent update. + return + } + } + } + + // resolve constructor options in case global mixins are applied after + // component constructor creation + resolveConstructorOptions(Ctor); + + data = data || {}; + + // transform component v-model data into props & events + if (data.model) { + transformModel(Ctor.options, data); + } + + // extract props + var propsData = extractProps(data, Ctor); + + // functional component + if (Ctor.options.functional) { + return createFunctionalComponent(Ctor, propsData, data, context, children) + } + + // extract listeners, since these needs to be treated as + // child component listeners instead of DOM listeners + var listeners = data.on; + // replace with listeners with .native modifier + data.on = data.nativeOn; + + if (Ctor.options.abstract) { + // abstract components do not keep anything + // other than props & listeners + data = {}; + } + + // merge component management hooks onto the placeholder node + mergeHooks(data); + + // return a placeholder vnode + var name = Ctor.options.name || tag; + var vnode = new VNode( + ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), + data, undefined, undefined, undefined, context, + { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children } + ); + return vnode + } + + function createFunctionalComponent ( + Ctor, + propsData, + data, + context, + children + ) { + var props = {}; + var propOptions = Ctor.options.props; + if (propOptions) { + for (var key in propOptions) { + props[key] = validateProp(key, propOptions, propsData); + } + } + // ensure the createElement function in functional components + // gets a unique context - this is necessary for correct named slot check + var _context = Object.create(context); + var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); }; + var vnode = Ctor.options.render.call(null, h, { + props: props, + data: data, + parent: context, + children: children, + slots: function () { return resolveSlots(children, context); } + }); + if (vnode instanceof VNode) { + vnode.functionalContext = context; + if (data.slot) { + (vnode.data || (vnode.data = {})).slot = data.slot; + } + } + return vnode + } + + function createComponentInstanceForVnode ( + vnode, // we know it's MountedComponentVNode but flow doesn't + parent, // activeInstance in lifecycle state + parentElm, + refElm + ) { + var vnodeComponentOptions = vnode.componentOptions; + var options = { + _isComponent: true, + parent: parent, + propsData: vnodeComponentOptions.propsData, + _componentTag: vnodeComponentOptions.tag, + _parentVnode: vnode, + _parentListeners: vnodeComponentOptions.listeners, + _renderChildren: vnodeComponentOptions.children, + _parentElm: parentElm || null, + _refElm: refElm || null + }; + // check inline-template render functions + var inlineTemplate = vnode.data.inlineTemplate; + if (inlineTemplate) { + options.render = inlineTemplate.render; + options.staticRenderFns = inlineTemplate.staticRenderFns; + } + return new vnodeComponentOptions.Ctor(options) + } + + function init ( + vnode, + hydrating, + parentElm, + refElm + ) { + if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) { + var child = vnode.componentInstance = createComponentInstanceForVnode( + vnode, + activeInstance, + parentElm, + refElm + ); + child.$mount(hydrating ? vnode.elm : undefined, hydrating); + } else if (vnode.data.keepAlive) { + // kept-alive components, treat as a patch + var mountedNode = vnode; // work around flow + prepatch(mountedNode, mountedNode); + } + } + + function prepatch ( + oldVnode, + vnode + ) { + var options = vnode.componentOptions; + var child = vnode.componentInstance = oldVnode.componentInstance; + updateChildComponent( + child, + options.propsData, // updated props + options.listeners, // updated listeners + vnode, // new parent vnode + options.children // new children + ); + } + + function insert (vnode) { + if (!vnode.componentInstance._isMounted) { + vnode.componentInstance._isMounted = true; + callHook(vnode.componentInstance, 'mounted'); + } + if (vnode.data.keepAlive) { + activateChildComponent(vnode.componentInstance, true /* direct */); + } + } + + function destroy (vnode) { + if (!vnode.componentInstance._isDestroyed) { + if (!vnode.data.keepAlive) { + vnode.componentInstance.$destroy(); + } else { + deactivateChildComponent(vnode.componentInstance, true /* direct */); + } + } + } + + function resolveAsyncComponent ( + factory, + baseCtor, + cb + ) { + if (factory.requested) { + // pool callbacks + factory.pendingCallbacks.push(cb); + } else { + factory.requested = true; + var cbs = factory.pendingCallbacks = [cb]; + var sync = true; + + var resolve = function (res) { + if (isObject(res)) { + res = baseCtor.extend(res); + } + // cache resolved + factory.resolved = res; + // invoke callbacks only if this is not a synchronous resolve + // (async resolves are shimmed as synchronous during SSR) + if (!sync) { + for (var i = 0, l = cbs.length; i < l; i++) { + cbs[i](res); + } + } + }; + + var reject = function (reason) { + process.env.NODE_ENV !== 'production' && warn( + "Failed to resolve async component: " + (String(factory)) + + (reason ? ("\nReason: " + reason) : '') + ); + }; + + var res = factory(resolve, reject); + + // handle promise + if (res && typeof res.then === 'function' && !factory.resolved) { + res.then(resolve, reject); + } + + sync = false; + // return in case resolved synchronously + return factory.resolved + } + } + + function extractProps (data, Ctor) { + // we are only extracting raw values here. + // validation and default values are handled in the child + // component itself. + var propOptions = Ctor.options.props; + if (!propOptions) { + return + } + var res = {}; + var attrs = data.attrs; + var props = data.props; + var domProps = data.domProps; + if (attrs || props || domProps) { + for (var key in propOptions) { + var altKey = hyphenate(key); + checkProp(res, props, key, altKey, true) || + checkProp(res, attrs, key, altKey) || + checkProp(res, domProps, key, altKey); + } + } + return res + } + + function checkProp ( + res, + hash, + key, + altKey, + preserve + ) { + if (hash) { + if (hasOwn(hash, key)) { + res[key] = hash[key]; + if (!preserve) { + delete hash[key]; + } + return true + } else if (hasOwn(hash, altKey)) { + res[key] = hash[altKey]; + if (!preserve) { + delete hash[altKey]; + } + return true + } + } + return false + } + + function mergeHooks (data) { + if (!data.hook) { + data.hook = {}; + } + for (var i = 0; i < hooksToMerge.length; i++) { + var key = hooksToMerge[i]; + var fromParent = data.hook[key]; + var ours = hooks[key]; + data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours; + } + } + + function mergeHook$1 (one, two) { + return function (a, b, c, d) { + one(a, b, c, d); + two(a, b, c, d); + } + } + + // transform component v-model info (value and callback) into + // 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 on = data.on || (data.on = {}); + if (on[event]) { + on[event] = [data.model.callback].concat(on[event]); + } else { + on[event] = data.model.callback; + } + } + + /* */ + + var SIMPLE_NORMALIZE = 1; + var ALWAYS_NORMALIZE = 2; + + // wrapper function for providing a more flexible interface + // without getting yelled at by flow + function createElement ( + context, + tag, + data, + children, + normalizationType, + alwaysNormalize + ) { + if (Array.isArray(data) || isPrimitive(data)) { + normalizationType = children; + children = data; + data = undefined; + } + if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; } + return _createElement(context, tag, data, children, normalizationType) + } + + function _createElement ( + context, + tag, + data, + children, + normalizationType + ) { + if (data && data.__ob__) { + process.env.NODE_ENV !== 'production' && warn( + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + + 'Always create fresh vnode data objects in each render!', + context + ); + return createEmptyVNode() + } + if (!tag) { + // in case of component :is set to falsy value + return createEmptyVNode() + } + // support single function children as default scoped slot + if (Array.isArray(children) && + typeof children[0] === 'function') { + data = data || {}; + data.scopedSlots = { default: children[0] }; + children.length = 0; + } + if (normalizationType === ALWAYS_NORMALIZE) { + children = normalizeChildren(children); + } else if (normalizationType === SIMPLE_NORMALIZE) { + children = simpleNormalizeChildren(children); + } + var vnode, ns; + if (typeof tag === 'string') { + var Ctor; + ns = config.getTagNamespace(tag); + if (config.isReservedTag(tag)) { + // platform built-in elements + vnode = new VNode( + config.parsePlatformTagName(tag), data, children, + undefined, undefined, context + ); + } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) { + // component + vnode = createComponent(Ctor, data, context, children, tag); + } else { + // unknown or unlisted namespaced elements + // check at runtime because it may get assigned a namespace when its + // parent normalizes children + vnode = new VNode( + tag, data, children, + undefined, undefined, context + ); + } + } else { + // direct component options / constructor + vnode = createComponent(tag, data, context, children); + } + if (vnode) { + if (ns) { applyNS(vnode, ns); } + return vnode + } else { + return createEmptyVNode() + } + } + + function applyNS (vnode, ns) { + vnode.ns = ns; + if (vnode.tag === 'foreignObject') { + // use default namespace inside foreignObject + return + } + if (vnode.children) { + for (var i = 0, l = vnode.children.length; i < l; i++) { + var child = vnode.children[i]; + if (child.tag && !child.ns) { + applyNS(child, ns); + } } } } /* */ - var uid$2 = 0; - /** - * A watcher parses an expression, collects dependencies, - * and fires callback when the expression value changes. - * This is used for both the $watch() api and directives. + * Runtime helper for rendering v-for lists. */ - var Watcher = function Watcher ( - vm, - expOrFn, - cb, - options + function renderList ( + val, + render ) { - this.vm = vm; - vm._watchers.push(this); - // options - if (options) { - this.deep = !!options.deep; - this.user = !!options.user; - this.lazy = !!options.lazy; - this.sync = !!options.sync; - } else { - this.deep = this.user = this.lazy = this.sync = false; - } - this.cb = cb; - this.id = ++uid$2; // uid for batching - this.active = true; - this.dirty = this.lazy; // for lazy watchers - this.deps = []; - this.newDeps = []; - this.depIds = new _Set(); - this.newDepIds = new _Set(); - this.expression = process.env.NODE_ENV !== 'production' - ? expOrFn.toString() - : ''; - // parse expression for getter - if (typeof expOrFn === 'function') { - this.getter = expOrFn; - } else { - this.getter = parsePath(expOrFn); - if (!this.getter) { - this.getter = function () {}; - process.env.NODE_ENV !== 'production' && warn( - "Failed watching path: \"" + expOrFn + "\" " + - 'Watcher only accepts simple dot-delimited paths. ' + - 'For full control, use a function instead.', - vm - ); + var ret, i, l, keys, key; + if (Array.isArray(val) || typeof val === 'string') { + ret = new Array(val.length); + for (i = 0, l = val.length; i < l; i++) { + ret[i] = render(val[i], i); + } + } else if (typeof val === 'number') { + ret = new Array(val); + for (i = 0; i < val; i++) { + ret[i] = render(i + 1, i); + } + } else if (isObject(val)) { + keys = Object.keys(val); + ret = new Array(keys.length); + for (i = 0, l = keys.length; i < l; i++) { + key = keys[i]; + ret[i] = render(val[key], key, i); } } - this.value = this.lazy - ? undefined - : this.get(); - }; + return ret + } - /** - * Evaluate the getter, and re-collect dependencies. - */ - Watcher.prototype.get = function get () { - pushTarget(this); - var value = this.getter.call(this.vm, this.vm); - // "touch" every property so they are all tracked as - // dependencies for deep watching - if (this.deep) { - traverse(value); - } - popTarget(); - this.cleanupDeps(); - return value - }; + /* */ /** - * Add a dependency to this directive. + * Runtime helper for rendering */ - Watcher.prototype.addDep = function addDep (dep) { - var id = dep.id; - if (!this.newDepIds.has(id)) { - this.newDepIds.add(id); - this.newDeps.push(dep); - if (!this.depIds.has(id)) { - dep.addSub(this); + function renderSlot ( + name, + fallback, + props, + bindObject + ) { + var scopedSlotFn = this.$scopedSlots[name]; + if (scopedSlotFn) { // scoped slot + props = props || {}; + if (bindObject) { + extend(props, bindObject); + } + return scopedSlotFn(props) || fallback + } else { + var slotNodes = this.$slots[name]; + // warn duplicate slot usage + if (slotNodes && 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; } + return slotNodes || fallback } - }; + } + + /* */ /** - * Clean up for dependency collection. + * Runtime helper for resolving filters */ - Watcher.prototype.cleanupDeps = function cleanupDeps () { - var this$1 = this; + function resolveFilter (id) { + return resolveAsset(this.$options, 'filters', id, true) || identity + } - 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 tmp = this.depIds; - this.depIds = this.newDepIds; - this.newDepIds = tmp; - this.newDepIds.clear(); - tmp = this.deps; - this.deps = this.newDeps; - this.newDeps = tmp; - this.newDeps.length = 0; - }; + /* */ /** - * Subscriber interface. - * Will be called when a dependency changes. + * Runtime helper for checking keyCodes from config. */ - Watcher.prototype.update = function update () { - /* istanbul ignore else */ - if (this.lazy) { - this.dirty = true; - } else if (this.sync) { - this.run(); + function checkKeyCodes ( + eventKeyCode, + key, + builtInAlias + ) { + var keyCodes = config.keyCodes[key] || builtInAlias; + if (Array.isArray(keyCodes)) { + return keyCodes.indexOf(eventKeyCode) === -1 } else { - queueWatcher(this); + return keyCodes !== eventKeyCode } - }; + } + + /* */ /** - * Scheduler job interface. - * Will be called by the scheduler. + * Runtime helper for merging v-bind="object" into a VNode's data. */ - Watcher.prototype.run = function run () { - if (this.active) { - 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) { - /* istanbul ignore else */ - if (config.errorHandler) { - config.errorHandler.call(null, e, this.vm); - } else { - process.env.NODE_ENV !== 'production' && warn( - ("Error in watcher \"" + (this.expression) + "\""), - this.vm - ); - throw e - } + function bindObjectProps ( + data, + tag, + value, + asProp + ) { + if (value) { + if (!isObject(value)) { + process.env.NODE_ENV !== 'production' && warn( + 'v-bind without argument expects an Object or Array value', + this + ); + } else { + if (Array.isArray(value)) { + value = toObject(value); + } + for (var key in value) { + if (key === 'class' || key === 'style') { + data[key] = value[key]; + } else { + var type = data.attrs && data.attrs.type; + var hash = asProp || config.mustUseProp(tag, type, key) + ? data.domProps || (data.domProps = {}) + : data.attrs || (data.attrs = {}); + hash[key] = value[key]; } - } else { - this.cb.call(this.vm, value, oldValue); } } } - }; - - /** - * Evaluate the value of the watcher. - * This only gets called for lazy watchers. - */ - Watcher.prototype.evaluate = function evaluate () { - this.value = this.get(); - this.dirty = false; - }; - - /** - * Depend on all deps collected by this watcher. - */ - Watcher.prototype.depend = function depend () { - var this$1 = this; + return data + } - var i = this.deps.length; - while (i--) { - this$1.deps[i].depend(); - } - }; + /* */ /** - * Remove self from all dependencies' subscriber list. + * Runtime helper for rendering static trees. */ - 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 - // if the vm is being destroyed. - if (!this.vm._isBeingDestroyed) { - remove$1(this.vm._watchers, this); - } - var i = this.deps.length; - while (i--) { - this$1.deps[i].removeSub(this$1); - } - this.active = false; + function renderStatic ( + index, + isInFor + ) { + var tree = this._staticTrees[index]; + // if has already-rendered static tree and not inside v-for, + // we can reuse the same tree by doing a shallow clone. + if (tree && !isInFor) { + return Array.isArray(tree) + ? cloneVNodes(tree) + : cloneVNode(tree) } - }; + // otherwise, render a fresh tree. + tree = this._staticTrees[index] = + this.$options.staticRenderFns[index].call(this._renderProxy); + markStatic(tree, ("__static__" + index), false); + return tree + } /** - * Recursively traverse an object to evoke all converted - * getters, so that every nested property inside the object - * is collected as a "deep" dependency. + * Runtime helper for v-once. + * Effectively it means marking the node as static with a unique key. */ - var seenObjects = new _Set(); - function traverse (val) { - seenObjects.clear(); - _traverse(val, seenObjects); + function markOnce ( + tree, + index, + key + ) { + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); + return tree } - function _traverse (val, seen) { - var i, keys; - var isA = Array.isArray(val); - if ((!isA && !isObject(val)) || !Object.isExtensible(val)) { - return - } - if (val.__ob__) { - var depId = val.__ob__.dep.id; - if (seen.has(depId)) { - return + function markStatic ( + tree, + key, + isOnce + ) { + if (Array.isArray(tree)) { + for (var i = 0; i < tree.length; i++) { + if (tree[i] && typeof tree[i] !== 'string') { + markStaticNode(tree[i], (key + "_" + i), isOnce); + } } - seen.add(depId); - } - if (isA) { - i = val.length; - while (i--) { _traverse(val[i], seen); } } else { - keys = Object.keys(val); - i = keys.length; - while (i--) { _traverse(val[keys[i]], seen); } + markStaticNode(tree, key, isOnce); } } + function markStaticNode (node, key, isOnce) { + node.isStatic = true; + node.key = key; + node.isOnce = isOnce; + } + /* */ - function initState (vm) { - vm._watchers = []; - var opts = vm.$options; - if (opts.props) { initProps(vm, opts.props); } - if (opts.methods) { initMethods(vm, opts.methods); } - if (opts.data) { - initData(vm); - } else { - observe(vm._data = {}, true /* asRootData */); - } - if (opts.computed) { initComputed(vm, opts.computed); } - if (opts.watch) { initWatch(vm, opts.watch); } + function initRender (vm) { + vm.$vnode = null; // the placeholder node in parent tree + vm._vnode = null; // the root of the child tree + vm._staticTrees = null; + var parentVnode = vm.$options._parentVnode; + var renderContext = parentVnode && parentVnode.context; + vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext); + vm.$scopedSlots = emptyObject; + // bind the createElement fn to this instance + // so that we get proper render context inside it. + // args order: tag, data, children, normalizationType, alwaysNormalize + // internal version is used by render functions compiled from templates + vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; + // normalization is always applied for the public version, used in + // user-written render functions. + vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; } - var isReservedProp = { key: 1, ref: 1, slot: 1 }; - - function initProps (vm, props) { - var propsData = vm.$options.propsData || {}; - var keys = vm.$options._propKeys = Object.keys(props); - var isRoot = !vm.$parent; - // root instance props should be converted - observerState.shouldConvert = isRoot; - var loop = function ( i ) { - var key = keys[i]; - /* istanbul ignore else */ - if (process.env.NODE_ENV !== 'production') { - if (isReservedProp[key]) { - warn( - ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."), - vm - ); - } - defineReactive$$1(vm, key, validateProp(key, props, propsData, vm), function () { - if (vm.$parent && !observerState.isSettingProps) { - warn( - "Avoid mutating a prop directly since the value will be " + - "overwritten whenever the parent component re-renders. " + - "Instead, use a data or computed property based on the prop's " + - "value. Prop being mutated: \"" + key + "\"", - vm - ); - } - }); - } else { - defineReactive$$1(vm, key, validateProp(key, props, propsData, vm)); - } + function renderMixin (Vue) { + Vue.prototype.$nextTick = function (fn) { + return nextTick(fn, this) }; - for (var i = 0; i < keys.length; i++) loop( i ); - observerState.shouldConvert = true; - } + Vue.prototype._render = function () { + var vm = this; + var ref = vm.$options; + var render = ref.render; + var staticRenderFns = ref.staticRenderFns; + var _parentVnode = ref._parentVnode; - function initData (vm) { - var data = vm.$options.data; - data = vm._data = typeof data === 'function' - ? data.call(vm) - : data || {}; - if (!isPlainObject(data)) { - data = {}; - process.env.NODE_ENV !== 'production' && warn( - 'data functions should return an object:\n' + - 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', - vm - ); - } - // proxy data on instance - var keys = Object.keys(data); - var props = vm.$options.props; - var i = keys.length; - while (i--) { - if (props && hasOwn(props, keys[i])) { - process.env.NODE_ENV !== 'production' && warn( - "The data property \"" + (keys[i]) + "\" is already declared as a prop. " + - "Use prop default value instead.", - vm - ); - } else { - proxy(vm, keys[i]); + if (vm._isMounted) { + // clone slot nodes on re-renders + for (var key in vm.$slots) { + vm.$slots[key] = cloneVNodes(vm.$slots[key]); + } } - } - // observe data - observe(data, true /* asRootData */); - } - - var computedSharedDefinition = { - enumerable: true, - configurable: true, - get: noop, - set: noop - }; - function initComputed (vm, computed) { - for (var key in computed) { - /* istanbul ignore if */ - if (process.env.NODE_ENV !== 'production' && key in vm) { - warn( - "existing instance property \"" + key + "\" will be " + - "overwritten by a computed property with the same name.", - vm - ); - } - var userDef = computed[key]; - if (typeof userDef === 'function') { - computedSharedDefinition.get = makeComputedGetter(userDef, vm); - computedSharedDefinition.set = noop; - } else { - computedSharedDefinition.get = userDef.get - ? userDef.cache !== false - ? makeComputedGetter(userDef.get, vm) - : bind$1(userDef.get, vm) - : noop; - computedSharedDefinition.set = userDef.set - ? bind$1(userDef.set, vm) - : noop; - } - Object.defineProperty(vm, key, computedSharedDefinition); - } - } + vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject; - function makeComputedGetter (getter, owner) { - var watcher = new Watcher(owner, getter, noop, { - lazy: true - }); - return function computedGetter () { - if (watcher.dirty) { - watcher.evaluate(); - } - if (Dep.target) { - watcher.depend(); + if (staticRenderFns && !vm._staticTrees) { + vm._staticTrees = []; } - return watcher.value - } - } - - function initMethods (vm, methods) { - for (var key in methods) { - vm[key] = methods[key] == null ? noop : bind$1(methods[key], vm); - if (process.env.NODE_ENV !== 'production' && methods[key] == null) { - warn( - "method \"" + key + "\" has an undefined value in the component definition. " + - "Did you reference the function correctly?", - vm - ); + // set parent vnode. this allows render functions to have access + // to the data on the placeholder node. + vm.$vnode = _parentVnode; + // render self + var vnode; + try { + vnode = render.call(vm._renderProxy, vm.$createElement); + } catch (e) { + handleError(e, vm, "render function"); + // return error render result, + // or previous vnode to prevent render error causing blank component + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') { + vnode = vm.$options.renderError + ? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e) + : vm._vnode; + } else { + vnode = vm._vnode; + } } - } - } - - function initWatch (vm, watch) { - for (var key in watch) { - var handler = watch[key]; - if (Array.isArray(handler)) { - for (var i = 0; i < handler.length; i++) { - createWatcher(vm, key, handler[i]); + // return empty vnode in case the render function errored out + if (!(vnode instanceof VNode)) { + if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) { + warn( + 'Multiple root nodes returned from render function. Render function ' + + 'should return a single root node.', + vm + ); } - } else { - createWatcher(vm, key, handler); + vnode = createEmptyVNode(); } - } - } - - function createWatcher (vm, key, handler) { - var options; - if (isPlainObject(handler)) { - options = handler; - handler = handler.handler; - } - if (typeof handler === 'string') { - handler = vm[handler]; - } - vm.$watch(key, handler, options); - } - - function stateMixin (Vue) { - // flow somehow has problems with directly declared definition object - // when using Object.defineProperty, so we have to procedurally build up - // the object here. - var dataDef = {}; - dataDef.get = function () { - return this._data + // set parent + vnode.parent = _parentVnode; + return vnode }; - if (process.env.NODE_ENV !== 'production') { - dataDef.set = function (newData) { - warn( - 'Avoid replacing instance root $data. ' + - 'Use nested data properties instead.', - this - ); - }; - } - Object.defineProperty(Vue.prototype, '$data', dataDef); - - Vue.prototype.$set = set$1; - Vue.prototype.$delete = del; - Vue.prototype.$watch = function ( - expOrFn, - cb, - options - ) { - var vm = this; - options = options || {}; - options.user = true; - var watcher = new Watcher(vm, expOrFn, cb, options); - if (options.immediate) { - cb.call(vm, watcher.value); - } - return function unwatchFn () { - watcher.teardown(); - } - }; + // internal render helpers. + // these are exposed on the instance prototype to reduce generated render + // code size. + Vue.prototype._o = markOnce; + Vue.prototype._n = toNumber; + Vue.prototype._s = _toString; + Vue.prototype._l = renderList; + Vue.prototype._t = renderSlot; + Vue.prototype._q = looseEqual; + Vue.prototype._i = looseIndexOf; + Vue.prototype._m = renderStatic; + Vue.prototype._f = resolveFilter; + Vue.prototype._k = checkKeyCodes; + Vue.prototype._b = bindObjectProps; + Vue.prototype._v = createTextVNode; + Vue.prototype._e = createEmptyVNode; + Vue.prototype._u = resolveScopedSlots; } - function proxy (vm, key) { - if (!isReserved(key)) { - Object.defineProperty(vm, key, { - configurable: true, - enumerable: true, - get: function proxyGetter () { - return vm._data[key] - }, - set: function proxySetter (val) { - vm._data[key] = val; + /* */ + + function initInjections (vm) { + var provide = vm.$options.provide; + var inject = vm.$options.inject; + if (provide) { + vm._provided = typeof provide === 'function' + ? provide.call(vm) + : provide; + } + if (inject) { + // inject is :any because flow is not smart enough to figure out cached + // isArray here + var isArray = Array.isArray(inject); + var keys = isArray + ? inject + : hasSymbol + ? Reflect.ownKeys(inject) + : Object.keys(inject); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var provideKey = isArray ? key : inject[key]; + var source = vm; + while (source) { + if (source._provided && source._provided[provideKey]) { + vm[key] = source._provided[provideKey]; + break + } + source = source.$parent; } - }); + } } } @@ -3558,6 +3815,11 @@ return /******/ (function(modules) { // webpackBootstrap function initMixin (Vue) { Vue.prototype._init = function (options) { + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && config.performance && perf) { + perf.mark('init'); + } + var vm = this; // a uid vm._uid = uid++; @@ -3589,7 +3851,16 @@ return /******/ (function(modules) { // webpackBootstrap initRender(vm); callHook(vm, 'beforeCreate'); initState(vm); + initInjections(vm); callHook(vm, 'created'); + + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && config.performance && perf) { + vm._name = formatComponentName(vm, false); + perf.mark('init end'); + perf.measure(((vm._name) + " init"), 'init', 'init end'); + } + if (vm.$options.el) { vm.$mount(vm.$options.el); } @@ -3616,16 +3887,19 @@ return /******/ (function(modules) { // webpackBootstrap function resolveConstructorOptions (Ctor) { var options = Ctor.options; if (Ctor.super) { - var superOptions = Ctor.super.options; + var superOptions = resolveConstructorOptions(Ctor.super); var cachedSuperOptions = Ctor.superOptions; - var extendOptions = Ctor.extendOptions; if (superOptions !== cachedSuperOptions) { - // super option changed + // super option changed, + // need to resolve new options. Ctor.superOptions = superOptions; - extendOptions.render = options.render; - extendOptions.staticRenderFns = options.staticRenderFns; - extendOptions._scopeId = options._scopeId; - options = Ctor.options = mergeOptions(superOptions, extendOptions); + // check if there are any late-modified/attached options (#4976) + var modifiedOptions = resolveModifiedOptions(Ctor); + // update base extend options + if (modifiedOptions) { + extend(Ctor.extendOptions, modifiedOptions); + } + options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions); if (options.name) { options.components[options.name] = Ctor; } @@ -3634,6 +3908,36 @@ return /******/ (function(modules) { // webpackBootstrap return options } + function resolveModifiedOptions (Ctor) { + var modified; + var latest = Ctor.options; + var sealed = Ctor.sealedOptions; + for (var key in latest) { + if (latest[key] !== sealed[key]) { + if (!modified) { modified = {}; } + modified[key] = dedupe(latest[key], sealed[key]); + } + } + return modified + } + + function dedupe (latest, sealed) { + // compare latest and sealed to ensure lifecycle hooks won't be duplicated + // between merges + if (Array.isArray(latest)) { + var res = []; + sealed = Array.isArray(sealed) ? sealed : [sealed]; + for (var i = 0; i < latest.length; i++) { + if (sealed.indexOf(latest[i]) < 0) { + res.push(latest[i]); + } + } + return res + } else { + return latest + } + } + function Vue$2 (options) { if (process.env.NODE_ENV !== 'production' && !(this instanceof Vue$2)) { @@ -3661,7 +3965,7 @@ return /******/ (function(modules) { // webpackBootstrap args.unshift(this); if (typeof plugin.install === 'function') { plugin.install.apply(plugin, args); - } else { + } else if (typeof plugin === 'function') { plugin.apply(null, args); } plugin.installed = true; @@ -3699,6 +4003,7 @@ return /******/ (function(modules) { // webpackBootstrap if (cachedCtors[SuperId]) { return cachedCtors[SuperId] } + var name = extendOptions.name || Super.options.name; if (process.env.NODE_ENV !== 'production') { if (!/^[a-zA-Z][\w-]*$/.test(name)) { @@ -3709,6 +4014,7 @@ return /******/ (function(modules) { // webpackBootstrap ); } } + var Sub = function VueComponent (options) { this._init(options); }; @@ -3720,10 +4026,22 @@ return /******/ (function(modules) { // webpackBootstrap extendOptions ); Sub['super'] = Super; + + // For props and computed properties, we define the proxy getters on + // the Vue instances at extension time, on the extended prototype. This + // avoids Object.defineProperty calls for each instance created. + if (Sub.options.props) { + initProps$1(Sub); + } + if (Sub.options.computed) { + initComputed$1(Sub); + } + // allow further extension/mixin/plugin usage Sub.extend = Super.extend; Sub.mixin = Super.mixin; Sub.use = Super.use; + // create asset registers, so extended classes // can have their private assets too. config._assetTypes.forEach(function (type) { @@ -3733,17 +4051,34 @@ return /******/ (function(modules) { // webpackBootstrap if (name) { Sub.options.components[name] = Sub; } + // keep a reference to the super options at extension time. // later at instantiation we can check if Super's options have // been updated. Sub.superOptions = Super.options; Sub.extendOptions = extendOptions; + Sub.sealedOptions = extend({}, Sub.options); + // cache constructor cachedCtors[SuperId] = Sub; return Sub }; } + function initProps$1 (Comp) { + var props = Comp.options.props; + for (var key in props) { + proxy(Comp.prototype, "_props", key); + } + } + + function initComputed$1 (Comp) { + var computed = Comp.options.computed; + for (var key in computed) { + defineComputed(Comp.prototype, key, computed[key]); + } + } + /* */ function initAssetRegisters (Vue) { @@ -3792,9 +4127,11 @@ return /******/ (function(modules) { // webpackBootstrap function matches (pattern, name) { if (typeof pattern === 'string') { return pattern.split(',').indexOf(name) > -1 - } else { + } else if (pattern instanceof RegExp) { return pattern.test(name) } + /* istanbul ignore next */ + return false } function pruneCache (cache, filter) { @@ -3835,7 +4172,7 @@ return /******/ (function(modules) { // webpackBootstrap destroyed: function destroyed () { var this$1 = this; - for (var key in this.cache) { + for (var key in this$1.cache) { pruneCacheEntry(this$1.cache[key]); } }, @@ -3895,8 +4232,18 @@ return /******/ (function(modules) { // webpackBootstrap }; } Object.defineProperty(Vue, 'config', configDef); - Vue.util = util; - Vue.set = set$1; + + // exposed util methods. + // NOTE: these are not considered part of the public API - avoid relying on + // them unless you are aware of the risk. + Vue.util = { + warn: warn, + extend: extend, + mergeOptions: mergeOptions, + defineReactive: defineReactive$$1 + }; + + Vue.set = set; Vue.delete = del; Vue.nextTick = nextTick; @@ -3923,7 +4270,7 @@ return /******/ (function(modules) { // webpackBootstrap get: isServerRendering }); - Vue$2.version = '2.1.10'; + Vue$2.version = '2.2.1'; /* */ @@ -4059,8 +4406,8 @@ return /******/ (function(modules) { // webpackBootstrap // this map is intentionally selective, only covering SVG elements that may // contain child elements. var isSVG = makeMap( - 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,' + - 'font-face,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + + 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + + 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true ); @@ -4115,16 +4462,17 @@ return /******/ (function(modules) { // webpackBootstrap */ function query (el) { if (typeof el === 'string') { - var selector = el; - el = document.querySelector(el); - if (!el) { + var selected = document.querySelector(el); + if (!selected) { process.env.NODE_ENV !== 'production' && warn( - 'Cannot find element: ' + selector + 'Cannot find element: ' + el ); return document.createElement('div') } + return selected + } else { + return el } - return el } /* */ @@ -4134,7 +4482,8 @@ return /******/ (function(modules) { // webpackBootstrap if (tagName !== 'select') { return elm } - if (vnode.data && vnode.data.attrs && 'multiple' in vnode.data.attrs) { + // false or null will remove the attribute but undefined will not + if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) { elm.setAttribute('multiple', 'multiple'); } return elm @@ -4226,7 +4575,7 @@ return /******/ (function(modules) { // webpackBootstrap var refs = vm.$refs; if (isRemoval) { if (Array.isArray(refs[key])) { - remove$1(refs[key], ref); + remove(refs[key], ref); } else if (refs[key] === ref) { refs[key] = undefined; } @@ -4482,9 +4831,14 @@ return /******/ (function(modules) { // webpackBootstrap // of going through the normal attribute patching process. function setScope (vnode) { var i; - if (isDef(i = vnode.context) && isDef(i = i.$options._scopeId)) { - nodeOps.setAttribute(vnode.elm, i, ''); + var ancestor = vnode; + while (ancestor) { + if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) { + nodeOps.setAttribute(vnode.elm, i, ''); + } + ancestor = ancestor.parent; } + // for slot content they should also get the scopeId from the host instance. if (isDef(i = activeInstance) && i !== vnode.context && isDef(i = i.$options._scopeId)) { @@ -4905,7 +5259,7 @@ return /******/ (function(modules) { // webpackBootstrap } }; if (isCreate) { - mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert, 'dir-insert'); + mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert); } else { callInsert(); } @@ -4916,7 +5270,7 @@ return /******/ (function(modules) { // webpackBootstrap for (var i = 0; i < dirsWithPostpatch.length; i++) { callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode); } - }, 'dir-postpatch'); + }); } if (!isCreate) { @@ -5069,9 +5423,86 @@ return /******/ (function(modules) { // webpackBootstrap /* */ + var validDivisionCharRE = /[\w).+\-_$\]]/; + + + + function wrapFilter (exp, filter) { + var i = filter.indexOf('('); + if (i < 0) { + // _f: resolveFilter + return ("_f(\"" + filter + "\")(" + exp + ")") + } else { + var name = filter.slice(0, i); + var args = filter.slice(i + 1); + return ("_f(\"" + name + "\")(" + exp + "," + args) + } + } + + /* */ + + /* */ + + /** + * Cross-platform code generation for component v-model + */ + + + /** + * Cross-platform codegen helper for generating v-model value assignment code. + */ + + + /** + * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val) + * + * for loop possible cases: + * + * - test + * - test[idx] + * - test[test1[idx]] + * - test["a"][idx] + * - xxx.test[a[a].test1[idx]] + * - test.xxx.a["asa"][test1[idx]] + * + */ + + var str; + var index$1; + + /* */ + + // in some cases, the event used has to be determined at runtime + // so we used some reserved tokens during compile. + var RANGE_TOKEN = '__r'; + var CHECKBOX_RADIO_TOKEN = '__c'; + + /* */ + + // normalize v-model event tokens that can only be determined at runtime. + // it's important to place the event as the first in the array because + // the whole point is ensuring the v-model callback gets called before + // user-attached handlers. + function normalizeEvents (on) { + var event; + /* istanbul ignore if */ + if (on[RANGE_TOKEN]) { + // IE input[type=range] only supports `change` event + event = isIE ? 'change' : 'input'; + on[event] = [].concat(on[RANGE_TOKEN], on[event] || []); + delete on[RANGE_TOKEN]; + } + if (on[CHECKBOX_RADIO_TOKEN]) { + // Chrome fires microtasks in between click/change, leads to #4521 + event = isChrome ? 'click' : 'change'; + on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []); + delete on[CHECKBOX_RADIO_TOKEN]; + } + } + var target$1; - function add$2 ( + function add$1 ( event, handler, once, @@ -5081,16 +5512,18 @@ return /******/ (function(modules) { // webpackBootstrap var oldHandler = handler; var _target = target$1; // save current target element in closure handler = function (ev) { - remove$3(event, handler, capture, _target); - arguments.length === 1 + var res = arguments.length === 1 ? oldHandler(ev) : oldHandler.apply(null, arguments); + if (res !== null) { + remove$2(event, handler, capture, _target); + } }; } target$1.addEventListener(event, handler, capture); } - function remove$3 ( + function remove$2 ( event, handler, capture, @@ -5106,7 +5539,8 @@ return /******/ (function(modules) { // webpackBootstrap var on = vnode.data.on || {}; var oldOn = oldVnode.data.on || {}; target$1 = vnode.elm; - updateListeners(on, oldOn, add$2, remove$3, vnode.context); + normalizeEvents(on); + updateListeners(on, oldOn, add$1, remove$2, vnode.context); } var events = { @@ -5170,7 +5604,7 @@ return /******/ (function(modules) { // webpackBootstrap return (!elm.composing && ( vnode.tag === 'option' || isDirty(elm, checkVal) || - isInputChanged(vnode, checkVal) + isInputChanged(elm, checkVal) )) } @@ -5179,10 +5613,10 @@ return /******/ (function(modules) { // webpackBootstrap return document.activeElement !== elm && elm.value !== checkVal } - function isInputChanged (vnode, newVal) { - var value = vnode.elm.value; - var modifiers = vnode.elm._vModifiers; // injected by v-model runtime - if ((modifiers && modifiers.number) || vnode.elm.type === 'number') { + function isInputChanged (elm, newVal) { + var value = elm.value; + var modifiers = elm._vModifiers; // injected by v-model runtime + if ((modifiers && modifiers.number) || elm.type === 'number') { return toNumber(value) !== toNumber(newVal) } if (modifiers && modifiers.trim) { @@ -5346,7 +5780,7 @@ return /******/ (function(modules) { // webpackBootstrap */ function addClass (el, cls) { /* istanbul ignore if */ - if (!cls || !cls.trim()) { + if (!cls || !(cls = cls.trim())) { return } @@ -5358,7 +5792,7 @@ return /******/ (function(modules) { // webpackBootstrap el.classList.add(cls); } } else { - var cur = ' ' + el.getAttribute('class') + ' '; + var cur = " " + (el.getAttribute('class') || '') + " "; if (cur.indexOf(' ' + cls + ' ') < 0) { el.setAttribute('class', (cur + cls).trim()); } @@ -5371,7 +5805,7 @@ return /******/ (function(modules) { // webpackBootstrap */ function removeClass (el, cls) { /* istanbul ignore if */ - if (!cls || !cls.trim()) { + if (!cls || !(cls = cls.trim())) { return } @@ -5383,7 +5817,7 @@ return /******/ (function(modules) { // webpackBootstrap el.classList.remove(cls); } } else { - var cur = ' ' + el.getAttribute('class') + ' '; + var cur = " " + (el.getAttribute('class') || '') + " "; var tar = ' ' + cls + ' '; while (cur.indexOf(tar) >= 0) { cur = cur.replace(tar, ' '); @@ -5394,364 +5828,6 @@ return /******/ (function(modules) { // webpackBootstrap /* */ - var hasTransition = inBrowser && !isIE9; - var TRANSITION = 'transition'; - var ANIMATION = 'animation'; - - // Transition property/event sniffing - var transitionProp = 'transition'; - var transitionEndEvent = 'transitionend'; - var animationProp = 'animation'; - var animationEndEvent = 'animationend'; - if (hasTransition) { - /* istanbul ignore if */ - if (window.ontransitionend === undefined && - window.onwebkittransitionend !== undefined) { - transitionProp = 'WebkitTransition'; - transitionEndEvent = 'webkitTransitionEnd'; - } - if (window.onanimationend === undefined && - window.onwebkitanimationend !== undefined) { - animationProp = 'WebkitAnimation'; - animationEndEvent = 'webkitAnimationEnd'; - } - } - - // binding to window is necessary to make hot reload work in IE in strict mode - var raf = inBrowser && window.requestAnimationFrame - ? window.requestAnimationFrame.bind(window) - : setTimeout; - - function nextFrame (fn) { - raf(function () { - raf(fn); - }); - } - - function addTransitionClass (el, cls) { - (el._transitionClasses || (el._transitionClasses = [])).push(cls); - addClass(el, cls); - } - - function removeTransitionClass (el, cls) { - if (el._transitionClasses) { - remove$1(el._transitionClasses, cls); - } - removeClass(el, cls); - } - - function whenTransitionEnds ( - el, - expectedType, - cb - ) { - var ref = getTransitionInfo(el, expectedType); - var type = ref.type; - var timeout = ref.timeout; - var propCount = ref.propCount; - if (!type) { return cb() } - var event = type === TRANSITION ? transitionEndEvent : animationEndEvent; - var ended = 0; - var end = function () { - el.removeEventListener(event, onEnd); - cb(); - }; - var onEnd = function (e) { - if (e.target === el) { - if (++ended >= propCount) { - end(); - } - } - }; - setTimeout(function () { - if (ended < propCount) { - end(); - } - }, timeout + 1); - el.addEventListener(event, onEnd); - } - - var transformRE = /\b(transform|all)(,|$)/; - - function getTransitionInfo (el, expectedType) { - var styles = window.getComputedStyle(el); - var transitioneDelays = styles[transitionProp + 'Delay'].split(', '); - var transitionDurations = styles[transitionProp + 'Duration'].split(', '); - var transitionTimeout = getTimeout(transitioneDelays, transitionDurations); - var animationDelays = styles[animationProp + 'Delay'].split(', '); - var animationDurations = styles[animationProp + 'Duration'].split(', '); - var animationTimeout = getTimeout(animationDelays, animationDurations); - - var type; - var timeout = 0; - var propCount = 0; - /* istanbul ignore if */ - if (expectedType === TRANSITION) { - if (transitionTimeout > 0) { - type = TRANSITION; - timeout = transitionTimeout; - propCount = transitionDurations.length; - } - } else if (expectedType === ANIMATION) { - if (animationTimeout > 0) { - type = ANIMATION; - timeout = animationTimeout; - propCount = animationDurations.length; - } - } else { - timeout = Math.max(transitionTimeout, animationTimeout); - type = timeout > 0 - ? transitionTimeout > animationTimeout - ? TRANSITION - : ANIMATION - : null; - propCount = type - ? type === TRANSITION - ? transitionDurations.length - : animationDurations.length - : 0; - } - var hasTransform = - type === TRANSITION && - transformRE.test(styles[transitionProp + 'Property']); - return { - type: type, - timeout: timeout, - propCount: propCount, - hasTransform: hasTransform - } - } - - function getTimeout (delays, durations) { - /* istanbul ignore next */ - while (delays.length < durations.length) { - delays = delays.concat(delays); - } - - return Math.max.apply(null, durations.map(function (d, i) { - return toMs(d) + toMs(delays[i]) - })) - } - - function toMs (s) { - return Number(s.slice(0, -1)) * 1000 - } - - /* */ - - function enter (vnode, toggleDisplay) { - var el = vnode.elm; - - // call leave callback now - if (el._leaveCb) { - el._leaveCb.cancelled = true; - el._leaveCb(); - } - - var data = resolveTransition(vnode.data.transition); - if (!data) { - return - } - - /* istanbul ignore if */ - if (el._enterCb || el.nodeType !== 1) { - return - } - - var css = data.css; - var type = data.type; - var enterClass = data.enterClass; - var enterToClass = data.enterToClass; - var enterActiveClass = data.enterActiveClass; - var appearClass = data.appearClass; - var appearToClass = data.appearToClass; - var appearActiveClass = data.appearActiveClass; - var beforeEnter = data.beforeEnter; - var enter = data.enter; - var afterEnter = data.afterEnter; - var enterCancelled = data.enterCancelled; - var beforeAppear = data.beforeAppear; - var appear = data.appear; - var afterAppear = data.afterAppear; - var appearCancelled = data.appearCancelled; - - // activeInstance will always be the component managing this - // transition. One edge case to check is when the is placed - // as the root node of a child component. In that case we need to check - // 's parent for appear check. - var context = activeInstance; - var transitionNode = activeInstance.$vnode; - while (transitionNode && transitionNode.parent) { - transitionNode = transitionNode.parent; - context = transitionNode.context; - } - - var isAppear = !context._isMounted || !vnode.isRootInsert; - - if (isAppear && !appear && appear !== '') { - return - } - - var startClass = isAppear ? appearClass : enterClass; - var activeClass = isAppear ? appearActiveClass : enterActiveClass; - var toClass = isAppear ? appearToClass : enterToClass; - var beforeEnterHook = isAppear ? (beforeAppear || beforeEnter) : beforeEnter; - var enterHook = isAppear ? (typeof appear === 'function' ? appear : enter) : enter; - var afterEnterHook = isAppear ? (afterAppear || afterEnter) : afterEnter; - var enterCancelledHook = isAppear ? (appearCancelled || enterCancelled) : enterCancelled; - - var expectsCSS = css !== false && !isIE9; - var userWantsControl = - enterHook && - // enterHook may be a bound method which exposes - // the length of original fn as _length - (enterHook._length || enterHook.length) > 1; - - var cb = el._enterCb = once(function () { - if (expectsCSS) { - removeTransitionClass(el, toClass); - removeTransitionClass(el, activeClass); - } - if (cb.cancelled) { - if (expectsCSS) { - removeTransitionClass(el, startClass); - } - enterCancelledHook && enterCancelledHook(el); - } else { - afterEnterHook && afterEnterHook(el); - } - el._enterCb = null; - }); - - if (!vnode.data.show) { - // remove pending leave element on enter by injecting an insert hook - mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () { - var parent = el.parentNode; - var pendingNode = parent && parent._pending && parent._pending[vnode.key]; - if (pendingNode && - pendingNode.tag === vnode.tag && - pendingNode.elm._leaveCb) { - pendingNode.elm._leaveCb(); - } - enterHook && enterHook(el, cb); - }, 'transition-insert'); - } - - // start enter transition - beforeEnterHook && beforeEnterHook(el); - if (expectsCSS) { - addTransitionClass(el, startClass); - addTransitionClass(el, activeClass); - nextFrame(function () { - addTransitionClass(el, toClass); - removeTransitionClass(el, startClass); - if (!cb.cancelled && !userWantsControl) { - whenTransitionEnds(el, type, cb); - } - }); - } - - if (vnode.data.show) { - toggleDisplay && toggleDisplay(); - enterHook && enterHook(el, cb); - } - - if (!expectsCSS && !userWantsControl) { - cb(); - } - } - - function leave (vnode, rm) { - var el = vnode.elm; - - // call enter callback now - if (el._enterCb) { - el._enterCb.cancelled = true; - el._enterCb(); - } - - var data = resolveTransition(vnode.data.transition); - if (!data) { - return rm() - } - - /* istanbul ignore if */ - if (el._leaveCb || el.nodeType !== 1) { - return - } - - var css = data.css; - var type = data.type; - var leaveClass = data.leaveClass; - var leaveToClass = data.leaveToClass; - var leaveActiveClass = data.leaveActiveClass; - var beforeLeave = data.beforeLeave; - var leave = data.leave; - var afterLeave = data.afterLeave; - var leaveCancelled = data.leaveCancelled; - var delayLeave = data.delayLeave; - - var expectsCSS = css !== false && !isIE9; - var userWantsControl = - leave && - // leave hook may be a bound method which exposes - // the length of original fn as _length - (leave._length || leave.length) > 1; - - var cb = el._leaveCb = once(function () { - if (el.parentNode && el.parentNode._pending) { - el.parentNode._pending[vnode.key] = null; - } - if (expectsCSS) { - removeTransitionClass(el, leaveToClass); - removeTransitionClass(el, leaveActiveClass); - } - if (cb.cancelled) { - if (expectsCSS) { - removeTransitionClass(el, leaveClass); - } - leaveCancelled && leaveCancelled(el); - } else { - rm(); - afterLeave && afterLeave(el); - } - el._leaveCb = null; - }); - - if (delayLeave) { - delayLeave(performLeave); - } else { - performLeave(); - } - - function performLeave () { - // the delayed leave may have already been cancelled - if (cb.cancelled) { - return - } - // record leaving element - if (!vnode.data.show) { - (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode; - } - beforeLeave && beforeLeave(el); - if (expectsCSS) { - addTransitionClass(el, leaveClass); - addTransitionClass(el, leaveActiveClass); - nextFrame(function () { - addTransitionClass(el, leaveToClass); - removeTransitionClass(el, leaveClass); - if (!cb.cancelled && !userWantsControl) { - whenTransitionEnds(el, type, cb); - } - }); - } - leave && leave(el, cb); - if (!expectsCSS && !userWantsControl) { - cb(); - } - } - } - function resolveTransition (def$$1) { if (!def$$1) { return @@ -5772,24 +5848,448 @@ return /******/ (function(modules) { // webpackBootstrap var autoCssTransition = cached(function (name) { return { enterClass: (name + "-enter"), - leaveClass: (name + "-leave"), - appearClass: (name + "-enter"), enterToClass: (name + "-enter-to"), - leaveToClass: (name + "-leave-to"), - appearToClass: (name + "-enter-to"), enterActiveClass: (name + "-enter-active"), - leaveActiveClass: (name + "-leave-active"), - appearActiveClass: (name + "-enter-active") + leaveClass: (name + "-leave"), + leaveToClass: (name + "-leave-to"), + leaveActiveClass: (name + "-leave-active") } }); - function once (fn) { - var called = false; - return function () { - if (!called) { - called = true; - fn(); + var hasTransition = inBrowser && !isIE9; + var TRANSITION = 'transition'; + var ANIMATION = 'animation'; + + // Transition property/event sniffing + var transitionProp = 'transition'; + var transitionEndEvent = 'transitionend'; + var animationProp = 'animation'; + var animationEndEvent = 'animationend'; + if (hasTransition) { + /* istanbul ignore if */ + if (window.ontransitionend === undefined && + window.onwebkittransitionend !== undefined) { + transitionProp = 'WebkitTransition'; + transitionEndEvent = 'webkitTransitionEnd'; + } + if (window.onanimationend === undefined && + window.onwebkitanimationend !== undefined) { + animationProp = 'WebkitAnimation'; + animationEndEvent = 'webkitAnimationEnd'; + } + } + + // binding to window is necessary to make hot reload work in IE in strict mode + var raf = inBrowser && window.requestAnimationFrame + ? window.requestAnimationFrame.bind(window) + : setTimeout; + + function nextFrame (fn) { + raf(function () { + raf(fn); + }); + } + + function addTransitionClass (el, cls) { + (el._transitionClasses || (el._transitionClasses = [])).push(cls); + addClass(el, cls); + } + + function removeTransitionClass (el, cls) { + if (el._transitionClasses) { + remove(el._transitionClasses, cls); + } + removeClass(el, cls); + } + + function whenTransitionEnds ( + el, + expectedType, + cb + ) { + var ref = getTransitionInfo(el, expectedType); + var type = ref.type; + var timeout = ref.timeout; + var propCount = ref.propCount; + if (!type) { return cb() } + var event = type === TRANSITION ? transitionEndEvent : animationEndEvent; + var ended = 0; + var end = function () { + el.removeEventListener(event, onEnd); + cb(); + }; + var onEnd = function (e) { + if (e.target === el) { + if (++ended >= propCount) { + end(); + } + } + }; + setTimeout(function () { + if (ended < propCount) { + end(); + } + }, timeout + 1); + el.addEventListener(event, onEnd); + } + + var transformRE = /\b(transform|all)(,|$)/; + + function getTransitionInfo (el, expectedType) { + var styles = window.getComputedStyle(el); + var transitioneDelays = styles[transitionProp + 'Delay'].split(', '); + var transitionDurations = styles[transitionProp + 'Duration'].split(', '); + var transitionTimeout = getTimeout(transitioneDelays, transitionDurations); + var animationDelays = styles[animationProp + 'Delay'].split(', '); + var animationDurations = styles[animationProp + 'Duration'].split(', '); + var animationTimeout = getTimeout(animationDelays, animationDurations); + + var type; + var timeout = 0; + var propCount = 0; + /* istanbul ignore if */ + if (expectedType === TRANSITION) { + if (transitionTimeout > 0) { + type = TRANSITION; + timeout = transitionTimeout; + propCount = transitionDurations.length; + } + } else if (expectedType === ANIMATION) { + if (animationTimeout > 0) { + type = ANIMATION; + timeout = animationTimeout; + propCount = animationDurations.length; + } + } else { + timeout = Math.max(transitionTimeout, animationTimeout); + type = timeout > 0 + ? transitionTimeout > animationTimeout + ? TRANSITION + : ANIMATION + : null; + propCount = type + ? type === TRANSITION + ? transitionDurations.length + : animationDurations.length + : 0; + } + var hasTransform = + type === TRANSITION && + transformRE.test(styles[transitionProp + 'Property']); + return { + type: type, + timeout: timeout, + propCount: propCount, + hasTransform: hasTransform + } + } + + function getTimeout (delays, durations) { + /* istanbul ignore next */ + while (delays.length < durations.length) { + delays = delays.concat(delays); + } + + return Math.max.apply(null, durations.map(function (d, i) { + return toMs(d) + toMs(delays[i]) + })) + } + + function toMs (s) { + return Number(s.slice(0, -1)) * 1000 + } + + /* */ + + function enter (vnode, toggleDisplay) { + var el = vnode.elm; + + // call leave callback now + if (el._leaveCb) { + el._leaveCb.cancelled = true; + el._leaveCb(); + } + + var data = resolveTransition(vnode.data.transition); + if (!data) { + return + } + + /* istanbul ignore if */ + if (el._enterCb || el.nodeType !== 1) { + return + } + + var css = data.css; + var type = data.type; + var enterClass = data.enterClass; + var enterToClass = data.enterToClass; + var enterActiveClass = data.enterActiveClass; + var appearClass = data.appearClass; + var appearToClass = data.appearToClass; + var appearActiveClass = data.appearActiveClass; + var beforeEnter = data.beforeEnter; + var enter = data.enter; + var afterEnter = data.afterEnter; + var enterCancelled = data.enterCancelled; + var beforeAppear = data.beforeAppear; + var appear = data.appear; + var afterAppear = data.afterAppear; + var appearCancelled = data.appearCancelled; + var duration = data.duration; + + // activeInstance will always be the component managing this + // transition. One edge case to check is when the is placed + // as the root node of a child component. In that case we need to check + // 's parent for appear check. + var context = activeInstance; + var transitionNode = activeInstance.$vnode; + while (transitionNode && transitionNode.parent) { + transitionNode = transitionNode.parent; + context = transitionNode.context; + } + + var isAppear = !context._isMounted || !vnode.isRootInsert; + + if (isAppear && !appear && appear !== '') { + return + } + + var startClass = isAppear && appearClass + ? appearClass + : enterClass; + var activeClass = isAppear && appearActiveClass + ? appearActiveClass + : enterActiveClass; + var toClass = isAppear && appearToClass + ? appearToClass + : enterToClass; + + var beforeEnterHook = isAppear + ? (beforeAppear || beforeEnter) + : beforeEnter; + var enterHook = isAppear + ? (typeof appear === 'function' ? appear : enter) + : enter; + var afterEnterHook = isAppear + ? (afterAppear || afterEnter) + : afterEnter; + var enterCancelledHook = isAppear + ? (appearCancelled || enterCancelled) + : enterCancelled; + + var explicitEnterDuration = toNumber( + isObject(duration) + ? duration.enter + : duration + ); + + if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) { + checkDuration(explicitEnterDuration, 'enter', vnode); + } + + var expectsCSS = css !== false && !isIE9; + var userWantsControl = getHookAgumentsLength(enterHook); + + var cb = el._enterCb = once(function () { + if (expectsCSS) { + removeTransitionClass(el, toClass); + removeTransitionClass(el, activeClass); + } + if (cb.cancelled) { + if (expectsCSS) { + removeTransitionClass(el, startClass); + } + enterCancelledHook && enterCancelledHook(el); + } else { + afterEnterHook && afterEnterHook(el); + } + el._enterCb = null; + }); + + if (!vnode.data.show) { + // remove pending leave element on enter by injecting an insert hook + mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () { + var parent = el.parentNode; + var pendingNode = parent && parent._pending && parent._pending[vnode.key]; + if (pendingNode && + pendingNode.tag === vnode.tag && + pendingNode.elm._leaveCb) { + pendingNode.elm._leaveCb(); + } + enterHook && enterHook(el, cb); + }); + } + + // start enter transition + beforeEnterHook && beforeEnterHook(el); + if (expectsCSS) { + addTransitionClass(el, startClass); + addTransitionClass(el, activeClass); + nextFrame(function () { + addTransitionClass(el, toClass); + removeTransitionClass(el, startClass); + if (!cb.cancelled && !userWantsControl) { + if (isValidDuration(explicitEnterDuration)) { + setTimeout(cb, explicitEnterDuration); + } else { + whenTransitionEnds(el, type, cb); + } + } + }); + } + + if (vnode.data.show) { + toggleDisplay && toggleDisplay(); + enterHook && enterHook(el, cb); + } + + if (!expectsCSS && !userWantsControl) { + cb(); + } + } + + function leave (vnode, rm) { + var el = vnode.elm; + + // call enter callback now + if (el._enterCb) { + el._enterCb.cancelled = true; + el._enterCb(); + } + + var data = resolveTransition(vnode.data.transition); + if (!data) { + return rm() + } + + /* istanbul ignore if */ + if (el._leaveCb || el.nodeType !== 1) { + return + } + + var css = data.css; + var type = data.type; + var leaveClass = data.leaveClass; + var leaveToClass = data.leaveToClass; + var leaveActiveClass = data.leaveActiveClass; + var beforeLeave = data.beforeLeave; + var leave = data.leave; + var afterLeave = data.afterLeave; + var leaveCancelled = data.leaveCancelled; + var delayLeave = data.delayLeave; + var duration = data.duration; + + var expectsCSS = css !== false && !isIE9; + var userWantsControl = getHookAgumentsLength(leave); + + var explicitLeaveDuration = toNumber( + isObject(duration) + ? duration.leave + : duration + ); + + if (process.env.NODE_ENV !== 'production' && explicitLeaveDuration != null) { + checkDuration(explicitLeaveDuration, 'leave', vnode); + } + + var cb = el._leaveCb = once(function () { + if (el.parentNode && el.parentNode._pending) { + el.parentNode._pending[vnode.key] = null; + } + if (expectsCSS) { + removeTransitionClass(el, leaveToClass); + removeTransitionClass(el, leaveActiveClass); + } + if (cb.cancelled) { + if (expectsCSS) { + removeTransitionClass(el, leaveClass); + } + leaveCancelled && leaveCancelled(el); + } else { + rm(); + afterLeave && afterLeave(el); } + el._leaveCb = null; + }); + + if (delayLeave) { + delayLeave(performLeave); + } else { + performLeave(); + } + + function performLeave () { + // the delayed leave may have already been cancelled + if (cb.cancelled) { + return + } + // record leaving element + if (!vnode.data.show) { + (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode; + } + beforeLeave && beforeLeave(el); + if (expectsCSS) { + addTransitionClass(el, leaveClass); + addTransitionClass(el, leaveActiveClass); + nextFrame(function () { + addTransitionClass(el, leaveToClass); + removeTransitionClass(el, leaveClass); + if (!cb.cancelled && !userWantsControl) { + if (isValidDuration(explicitLeaveDuration)) { + setTimeout(cb, explicitLeaveDuration); + } else { + whenTransitionEnds(el, type, cb); + } + } + }); + } + leave && leave(el, cb); + if (!expectsCSS && !userWantsControl) { + cb(); + } + } + } + + // only used in dev mode + function checkDuration (val, name, vnode) { + if (typeof val !== 'number') { + warn( + " explicit " + name + " duration is not a valid number - " + + "got " + (JSON.stringify(val)) + ".", + vnode.context + ); + } else if (isNaN(val)) { + warn( + " explicit " + name + " duration is NaN - " + + 'the duration expression might be incorrect.', + vnode.context + ); + } + } + + function isValidDuration (val) { + return typeof val === 'number' && !isNaN(val) + } + + /** + * Normalize a transition hook's argument length. The hook may be: + * - a merged hook (invoker) with the original in .fns + * - a wrapped component method (check ._length) + * - a plain function (.length) + */ + function getHookAgumentsLength (fn) { + if (!fn) { return false } + var invokerFns = fn.fns; + if (invokerFns) { + // invoker + return getHookAgumentsLength( + Array.isArray(invokerFns) + ? invokerFns[0] + : invokerFns + ) + } else { + return (fn._length || fn.length) > 1 } } @@ -5802,7 +6302,7 @@ return /******/ (function(modules) { // webpackBootstrap var transition = inBrowser ? { create: _enter, activate: _enter, - remove: function remove (vnode, rm) { + remove: function remove$$1 (vnode, rm) { /* istanbul ignore else */ if (!vnode.data.show) { leave(vnode, rm); @@ -5827,15 +6327,13 @@ return /******/ (function(modules) { // webpackBootstrap // built-in modules have been applied. var modules = platformModules.concat(baseModules); - var patch$1 = createPatchFunction({ nodeOps: nodeOps, modules: modules }); + var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules }); /** * Not type checking this file because flow doesn't like attaching * properties to Elements. */ - var modelableTagRE = /^input|select|textarea|vue-component-[0-9]+(-[0-9a-zA-Z_-]*)?$/; - /* istanbul ignore if */ if (isIE9) { // http://www.matts411.com/post/internet-explorer-9-oninput/ @@ -5847,18 +6345,8 @@ return /******/ (function(modules) { // webpackBootstrap }); } - var model = { + var model$1 = { inserted: function inserted (el, binding, vnode) { - if (process.env.NODE_ENV !== 'production') { - if (!modelableTagRE.test(vnode.tag)) { - warn( - "v-model is not supported on element type: <" + (vnode.tag) + ">. " + - 'If you are working with contenteditable, it\'s recommended to ' + - 'wrap a library dedicated for that purpose inside a custom component.', - vnode.context - ); - } - } if (vnode.tag === 'select') { var cb = function () { setSelected(el, binding, vnode.context); @@ -6027,7 +6515,7 @@ return /******/ (function(modules) { // webpackBootstrap }; var platformDirectives = { - model: model, + model: model$1, show: show }; @@ -6050,7 +6538,8 @@ return /******/ (function(modules) { // webpackBootstrap leaveActiveClass: String, appearClass: String, appearActiveClass: String, - appearToClass: String + appearToClass: String, + duration: [Number, String, Object] }; // in case the child is also an abstract component, e.g. @@ -6075,7 +6564,7 @@ return /******/ (function(modules) { // webpackBootstrap // extract listeners and pass them directly to the transition methods var listeners = options._parentListeners; for (var key$1 in listeners) { - data[camelize(key$1)] = listeners[key$1].fn; + data[camelize(key$1)] = listeners[key$1]; } return data } @@ -6162,11 +6651,12 @@ return /******/ (function(modules) { // webpackBootstrap // component instance. This key will be used to remove pending leaving nodes // during entering. var id = "__transition-" + (this._uid) + "-"; - var key = child.key = child.key == null + child.key = child.key == null ? id + child.tag : isPrimitive(child.key) ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key) : child.key; + var data = (child.data || (child.data = {})).transition = extractTransitionData(this); var oldRawChild = this._vnode; var oldChild = getRealChild(oldRawChild); @@ -6188,16 +6678,14 @@ return /******/ (function(modules) { // webpackBootstrap mergeVNodeHook(oldData, 'afterLeave', function () { this$1._leaving = false; this$1.$forceUpdate(); - }, key); + }); return placeholder(h, rawChild) } else if (mode === 'in-out') { var delayedLeave; var performLeave = function () { delayedLeave(); }; - mergeVNodeHook(data, 'afterEnter', performLeave, key); - mergeVNodeHook(data, 'enterCancelled', performLeave, key); - mergeVNodeHook(oldData, 'delayLeave', function (leave) { - delayedLeave = leave; - }, key); + mergeVNodeHook(data, 'afterEnter', performLeave); + mergeVNodeHook(data, 'enterCancelled', performLeave); + mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; }); } } @@ -6245,9 +6733,7 @@ return /******/ (function(modules) { // webpackBootstrap ;(c.data || (c.data = {})).transition = transitionData; } else if (process.env.NODE_ENV !== 'production') { var opts = c.componentOptions; - var name = opts - ? (opts.Ctor.options.name || opts.tag) - : c.tag; + var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag; warn((" children must be keyed: <" + name + ">")); } } @@ -6298,7 +6784,8 @@ return /******/ (function(modules) { // webpackBootstrap children.forEach(applyTranslation); // force reflow to put everything in position - var f = document.body.offsetHeight; // eslint-disable-line + var body = document.body; + var f = body.offsetHeight; // eslint-disable-line children.forEach(function (c) { if (c.data.moved) { @@ -6326,9 +6813,20 @@ return /******/ (function(modules) { // webpackBootstrap if (this._hasMove != null) { return this._hasMove } - addTransitionClass(el, moveClass); - var info = getTransitionInfo(el); - removeTransitionClass(el, moveClass); + // Detect whether an element with the move class applied has + // CSS transitions. Since the element may be inside an entering + // transition at this very moment, we make a clone of it and remove + // all other transition classes applied to ensure only the move class + // is applied. + var clone = el.cloneNode(); + if (el._transitionClasses) { + el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); }); + } + addClass(clone, moveClass); + clone.style.display = 'none'; + this.$el.appendChild(clone); + var info = getTransitionInfo(clone); + this.$el.removeChild(clone); return (this._hasMove = info.hasTransform) } } @@ -6370,52 +6868,49 @@ return /******/ (function(modules) { // webpackBootstrap /* */ // install platform specific utils - Vue$2.config.isUnknownElement = isUnknownElement; + Vue$2.config.mustUseProp = mustUseProp; Vue$2.config.isReservedTag = isReservedTag; Vue$2.config.getTagNamespace = getTagNamespace; - Vue$2.config.mustUseProp = mustUseProp; + Vue$2.config.isUnknownElement = isUnknownElement; // install platform runtime directives & components extend(Vue$2.options.directives, platformDirectives); extend(Vue$2.options.components, platformComponents); // install platform patch function - Vue$2.prototype.__patch__ = inBrowser ? patch$1 : noop; + Vue$2.prototype.__patch__ = inBrowser ? patch : noop; - // wrap mount + // public mount method Vue$2.prototype.$mount = function ( el, hydrating ) { el = el && inBrowser ? query(el) : undefined; - return this._mount(el, hydrating) + return mountComponent(this, el, hydrating) }; - if (process.env.NODE_ENV !== 'production' && - inBrowser && typeof console !== 'undefined') { - console[console.info ? 'info' : 'log']( - "You are running Vue in development mode.\n" + - "Make sure to turn on production mode when deploying for production.\n" + - "See more tips at https://vuejs.org/guide/deployment.html" - ); - } - // devtools global hook /* istanbul ignore next */ setTimeout(function () { if (config.devtools) { if (devtools) { devtools.emit('init', Vue$2); - } else if ( - process.env.NODE_ENV !== 'production' && - inBrowser && !isEdge && /Chrome\/\d+/.test(window.navigator.userAgent) - ) { + } else if (process.env.NODE_ENV !== 'production' && isChrome) { console[console.info ? 'info' : 'log']( 'Download the Vue Devtools extension for a better development experience:\n' + 'https://github.com/vuejs/vue-devtools' ); } } + if (process.env.NODE_ENV !== 'production' && + config.productionTip !== false && + inBrowser && typeof console !== 'undefined') { + console[console.info ? 'info' : 'log']( + "You are running Vue in development mode.\n" + + "Make sure to turn on production mode when deploying for production.\n" + + "See more tips at https://vuejs.org/guide/deployment.html" + ); + } }, 0); module.exports = Vue$2; @@ -42978,35 +43473,31 @@ return /******/ (function(modules) { // webpackBootstrap watch: { 'chartData': { handler: function handler(newData, oldData) { - var _this = this; - if (oldData) { - (function () { - var chart = _this._chart; + var chart = this._chart; - var newDatasetLabels = newData.datasets.map(function (dataset) { - return dataset.label; - }); + var newDatasetLabels = newData.datasets.map(function (dataset) { + return dataset.label; + }); - var oldDatasetLabels = oldData.datasets.map(function (dataset) { - return dataset.label; - }); + var oldDatasetLabels = oldData.datasets.map(function (dataset) { + return dataset.label; + }); - var oldLabels = (0, _stringify2.default)(oldDatasetLabels); - var newLabels = (0, _stringify2.default)(newDatasetLabels); + var oldLabels = (0, _stringify2.default)(oldDatasetLabels); + var newLabels = (0, _stringify2.default)(newDatasetLabels); - if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) { - newData.datasets.forEach(function (dataset, i) { - chart.data.datasets[i] = dataset; - }); + if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) { + newData.datasets.forEach(function (dataset, i) { + chart.data.datasets[i] = dataset; + }); - chart.data.labels = newData.labels; - chart.update(); - } else { - chart.destroy(); - _this.renderChart(_this.chartData, _this.options); - } - })(); + chart.data.labels = newData.labels; + chart.update(); + } else { + chart.destroy(); + this.renderChart(this.chartData, this.options); + } } } } @@ -43058,35 +43549,31 @@ return /******/ (function(modules) { // webpackBootstrap watch: { 'chartData': { handler: function handler(newData, oldData) { - var _this = this; - if (oldData) { - (function () { - var chart = _this._chart; + var chart = this._chart; - var newDatasetLabels = newData.datasets.map(function (dataset) { - return dataset.label; - }); + var newDatasetLabels = newData.datasets.map(function (dataset) { + return dataset.label; + }); - var oldDatasetLabels = oldData.datasets.map(function (dataset) { - return dataset.label; - }); + var oldDatasetLabels = oldData.datasets.map(function (dataset) { + return dataset.label; + }); - var oldLabels = (0, _stringify2.default)(oldDatasetLabels); - var newLabels = (0, _stringify2.default)(newDatasetLabels); + var oldLabels = (0, _stringify2.default)(oldDatasetLabels); + var newLabels = (0, _stringify2.default)(newDatasetLabels); - if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) { - newData.datasets.forEach(function (dataset, i) { - chart.data.datasets[i] = dataset; - }); + if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) { + newData.datasets.forEach(function (dataset, i) { + chart.data.datasets[i] = dataset; + }); - chart.data.labels = newData.labels; - chart.update(); - } else { - chart.destroy(); - _this.renderChart(_this.chartData, _this.options); - } - })(); + chart.data.labels = newData.labels; + chart.update(); + } else { + chart.destroy(); + this.renderChart(this.chartData, this.options); + } } } }