From 6cf5d2d0d3537e8f572d647c77b3413f826117d5 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 13 Mar 2017 23:08:08 +0800 Subject: [PATCH] [build] 2.2.4 --- dist/vue.common.js | 15 +- dist/vue.esm.js | 15 +- dist/vue.js | 15 +- dist/vue.min.js | 4 +- dist/vue.runtime.common.js | 15 +- dist/vue.runtime.esm.js | 15 +- dist/vue.runtime.js | 15 +- dist/vue.runtime.min.js | 4 +- packages/vue-server-renderer/build.js | 6 +- packages/vue-server-renderer/package.json | 2 +- packages/vue-template-compiler/build.js | 6 +- packages/vue-template-compiler/package.json | 2 +- packages/weex-template-compiler/build.js | 87 +++--- packages/weex-vue-framework/factory.js | 301 +++++++++++--------- 14 files changed, 283 insertions(+), 219 deletions(-) diff --git a/dist/vue.common.js b/dist/vue.common.js index 391b20b50ad..34a09dfbabe 100644 --- a/dist/vue.common.js +++ b/dist/vue.common.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.2.3 + * Vue.js v2.2.4 * (c) 2014-2017 Evan You * Released under the MIT License. */ @@ -2122,8 +2122,9 @@ function mountComponent ( if (process.env.NODE_ENV !== 'production' && config.performance && mark) { updateComponent = function () { var name = vm._name; - var startTag = "start " + name; - var endTag = "end " + name; + var id = vm._uid; + var startTag = "vue-perf-start:" + id; + var endTag = "vue-perf-end:" + id; mark(startTag); var vnode = vm._render(); @@ -3662,7 +3663,7 @@ function initMixin (Vue) { Vue.prototype._init = function (options) { /* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && config.performance && mark) { - mark('init'); + mark('vue-perf-init'); } var vm = this; @@ -3703,8 +3704,8 @@ function initMixin (Vue) { /* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && config.performance && mark) { vm._name = formatComponentName(vm, false); - mark('init end'); - measure(((vm._name) + " init"), 'init', 'init end'); + mark('vue-perf-init-end'); + measure(((vm._name) + " init"), 'vue-perf-init', 'vue-perf-init-end'); } if (vm.$options.el) { @@ -4116,7 +4117,7 @@ Object.defineProperty(Vue$3.prototype, '$isServer', { get: isServerRendering }); -Vue$3.version = '2.2.3'; +Vue$3.version = '2.2.4'; /* */ diff --git a/dist/vue.esm.js b/dist/vue.esm.js index d9488f4d3c8..1c674052cb0 100644 --- a/dist/vue.esm.js +++ b/dist/vue.esm.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.2.3 + * Vue.js v2.2.4 * (c) 2014-2017 Evan You * Released under the MIT License. */ @@ -2120,8 +2120,9 @@ function mountComponent ( if (process.env.NODE_ENV !== 'production' && config.performance && mark) { updateComponent = function () { var name = vm._name; - var startTag = "start " + name; - var endTag = "end " + name; + var id = vm._uid; + var startTag = "vue-perf-start:" + id; + var endTag = "vue-perf-end:" + id; mark(startTag); var vnode = vm._render(); @@ -3660,7 +3661,7 @@ function initMixin (Vue) { Vue.prototype._init = function (options) { /* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && config.performance && mark) { - mark('init'); + mark('vue-perf-init'); } var vm = this; @@ -3701,8 +3702,8 @@ function initMixin (Vue) { /* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && config.performance && mark) { vm._name = formatComponentName(vm, false); - mark('init end'); - measure(((vm._name) + " init"), 'init', 'init end'); + mark('vue-perf-init-end'); + measure(((vm._name) + " init"), 'vue-perf-init', 'vue-perf-init-end'); } if (vm.$options.el) { @@ -4114,7 +4115,7 @@ Object.defineProperty(Vue$3.prototype, '$isServer', { get: isServerRendering }); -Vue$3.version = '2.2.3'; +Vue$3.version = '2.2.4'; /* */ diff --git a/dist/vue.js b/dist/vue.js index 51739a549e0..c9fa6ca5dc4 100644 --- a/dist/vue.js +++ b/dist/vue.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.2.3 + * Vue.js v2.2.4 * (c) 2014-2017 Evan You * Released under the MIT License. */ @@ -2126,8 +2126,9 @@ function mountComponent ( if ("development" !== 'production' && config.performance && mark) { updateComponent = function () { var name = vm._name; - var startTag = "start " + name; - var endTag = "end " + name; + var id = vm._uid; + var startTag = "vue-perf-start:" + id; + var endTag = "vue-perf-end:" + id; mark(startTag); var vnode = vm._render(); @@ -3660,7 +3661,7 @@ function initMixin (Vue) { Vue.prototype._init = function (options) { /* istanbul ignore if */ if ("development" !== 'production' && config.performance && mark) { - mark('init'); + mark('vue-perf-init'); } var vm = this; @@ -3699,8 +3700,8 @@ function initMixin (Vue) { /* istanbul ignore if */ if ("development" !== 'production' && config.performance && mark) { vm._name = formatComponentName(vm, false); - mark('init end'); - measure(((vm._name) + " init"), 'init', 'init end'); + mark('vue-perf-init-end'); + measure(((vm._name) + " init"), 'vue-perf-init', 'vue-perf-init-end'); } if (vm.$options.el) { @@ -4112,7 +4113,7 @@ Object.defineProperty(Vue$3.prototype, '$isServer', { get: isServerRendering }); -Vue$3.version = '2.2.3'; +Vue$3.version = '2.2.4'; /* */ diff --git a/dist/vue.min.js b/dist/vue.min.js index 0bfc5c8ebf6..8316aa7a4d2 100644 --- a/dist/vue.min.js +++ b/dist/vue.min.js @@ -1,8 +1,8 @@ /*! - * Vue.js v2.2.3 + * Vue.js v2.2.4 * (c) 2014-2017 Evan You * Released under the MIT License. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Vue=t()}(this,function(){"use strict";function e(e){return null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function t(e){var t=parseFloat(e);return isNaN(t)?e:t}function n(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}function i(e,t){return Si.call(e,t)}function o(e){return"string"==typeof e||"number"==typeof e}function a(e){var t=Object.create(null);return function(n){var r=t[n];return r||(t[n]=e(n))}}function s(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n}function c(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function u(e,t){for(var n in t)e[n]=t[n];return e}function l(e){return null!==e&&"object"==typeof e}function f(e){return Li.call(e)===Di}function p(e){for(var t={},n=0;n1?c(n):n;for(var r=c(arguments,1),i=0,o=n.length;i=0&&yo[n].id>e.id;)n--;yo.splice(Math.max(n,wo)+1,0,e)}else yo.push(e);bo||(bo=!0,Xi(me))}}function ye(e){ko.clear(),_e(e,ko)}function _e(e,t){var n,r,i=Array.isArray(e);if((i||l(e))&&Object.isExtensible(e)){if(e.__ob__){var o=e.__ob__.dep.id;if(t.has(o))return;t.add(o)}if(i)for(n=e.length;n--;)_e(e[n],t);else for(r=Object.keys(e),n=r.length;n--;)_e(e[r[n]],t)}}function be(e,t,n){Ao.get=function(){return this[t][n]},Ao.set=function(e){this[t][n]=e},Object.defineProperty(e,n,Ao)}function $e(e){e._watchers=[];var t=e.$options;t.props&&we(e,t.props),t.methods&&Oe(e,t.methods),t.data?xe(e):A(e._data={},!0),t.computed&&Ce(e,t.computed),t.watch&&Se(e,t.watch)}function we(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[],o=!e.$parent;so.shouldConvert=o;var a=function(o){i.push(o);var a=R(o,t,n,e);O(r,o,a),o in e||be(e,"_props",o)};for(var s in t)a(s);so.shouldConvert=!0}function xe(e){var t=e.$options.data;t=e._data="function"==typeof t?t.call(e):t||{},f(t)||(t={});for(var n=Object.keys(t),r=e.$options.props,o=n.length;o--;)r&&i(r,n[o])||y(n[o])||be(e,"_data",n[o]);A(t,!0)}function Ce(e,t){var n=e._computedWatchers=Object.create(null);for(var r in t){var i=t[r],o="function"==typeof i?i:i.get;n[r]=new Co(e,o,d,Oo),r in e||ke(e,r,i)}}function ke(e,t,n){"function"==typeof n?(Ao.get=Ae(t),Ao.set=d):(Ao.get=n.get?n.cache!==!1?Ae(t):n.get:d,Ao.set=n.set?n.set:d),Object.defineProperty(e,t,Ao)}function Ae(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),no.target&&t.depend(),t.value}}function Oe(e,t){e.$options.props;for(var n in t)e[n]=null==t[n]?d:s(t[n],e)}function Se(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i-1:e instanceof RegExp&&e.test(t)}function mt(e,t){for(var n in e){var r=e[n];if(r){var i=vt(r.componentOptions);i&&!t(i)&&(gt(r),e[n]=null)}}}function gt(e){e&&(e.componentInstance._inactive||ve(e.componentInstance,"deactivated"),e.componentInstance.$destroy())}function yt(e){var t={};t.get=function(){return Ri},Object.defineProperty(e,"config",t),e.util={warn:eo,extend:u,mergeOptions:M,defineReactive:O},e.set=S,e.delete=T,e.nextTick=Xi,e.options=Object.create(null),Ri._assetTypes.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,u(e.options.components,Do),ct(e),ut(e),lt(e),dt(e)}function _t(e){for(var t=e.data,n=e,r=e;r.componentInstance;)r=r.componentInstance._vnode,r.data&&(t=bt(r.data,t));for(;n=n.parent;)n.data&&(t=bt(t,n.data));return $t(t)}function bt(e,t){return{staticClass:wt(e.staticClass,t.staticClass),class:e.class?[e.class,t.class]:t.class}}function $t(e){var t=e.class,n=e.staticClass;return n||t?wt(n,xt(t)):""}function wt(e,t){return e?t?e+" "+t:e:t||""}function xt(e){var t="";if(!e)return t;if("string"==typeof e)return e;if(Array.isArray(e)){for(var n,r=0,i=e.length;r-1?ia[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:ia[e]=/HTMLUnknownElement/.test(t.toString())}function At(e){if("string"==typeof e){var t=document.querySelector(e);return t?t:document.createElement("div")}return e}function Ot(e,t){var n=document.createElement(e);return"select"!==e?n:(t.data&&t.data.attrs&&void 0!==t.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)}function St(e,t){return document.createElementNS(Xo[e],t)}function Tt(e){return document.createTextNode(e)}function Et(e){return document.createComment(e)}function jt(e,t,n){e.insertBefore(t,n)}function Nt(e,t){e.removeChild(t)}function It(e,t){e.appendChild(t)}function Lt(e){return e.parentNode}function Dt(e){return e.nextSibling}function Mt(e){return e.tagName}function Pt(e,t){e.textContent=t}function Rt(e,t,n){e.setAttribute(t,n)}function Ft(e,t){var n=e.data.ref;if(n){var i=e.context,o=e.componentInstance||e.elm,a=i.$refs;t?Array.isArray(a[n])?r(a[n],o):a[n]===o&&(a[n]=void 0):e.data.refInFor?Array.isArray(a[n])&&a[n].indexOf(o)<0?a[n].push(o):a[n]=[o]:a[n]=o}}function Ht(e){return null==e}function Ut(e){return null!=e}function Bt(e,t){return e.key===t.key&&e.tag===t.tag&&e.isComment===t.isComment&&!e.data==!t.data}function Vt(e,t,n){var r,i,o={};for(r=t;r<=n;++r)i=e[r].key,Ut(i)&&(o[i]=r);return o}function zt(e){function t(e){return new fo(O.tagName(e).toLowerCase(),{},[],void 0,e)}function r(e,t){function n(){0===--n.listeners&&i(e)}return n.listeners=t,n}function i(e){var t=O.parentNode(e);t&&O.removeChild(t,e)}function a(e,t,n,r,i){if(e.isRootInsert=!i,!s(e,t,n,r)){var o=e.data,a=e.children,c=e.tag;Ut(c)?(e.elm=e.ns?O.createElementNS(e.ns,c):O.createElement(c,e),v(e),f(e,a,t),Ut(o)&&d(e,t),l(n,e.elm,r)):e.isComment?(e.elm=O.createComment(e.text),l(n,e.elm,r)):(e.elm=O.createTextNode(e.text),l(n,e.elm,r))}}function s(e,t,n,r){var i=e.data;if(Ut(i)){var o=Ut(e.componentInstance)&&i.keepAlive;if(Ut(i=i.hook)&&Ut(i=i.init)&&i(e,!1,n,r),Ut(e.componentInstance))return c(e,t),o&&u(e,t,n,r),!0}}function c(e,t){e.data.pendingInsert&&t.push.apply(t,e.data.pendingInsert),e.elm=e.componentInstance.$el,p(e)?(d(e,t),v(e)):(Ft(e),t.push(e))}function u(e,t,n,r){for(var i,o=e;o.componentInstance;)if(o=o.componentInstance._vnode,Ut(i=o.data)&&Ut(i=i.transition)){for(i=0;ip?(u=Ht(n[m+1])?null:n[m+1].elm,h(e,u,n,f,m,r)):f>m&&g(e,t,l,p)}function b(e,t,n,r){if(e!==t){if(t.isStatic&&e.isStatic&&t.key===e.key&&(t.isCloned||t.isOnce))return t.elm=e.elm,void(t.componentInstance=e.componentInstance);var i,o=t.data,a=Ut(o);a&&Ut(i=o.hook)&&Ut(i=i.prepatch)&&i(e,t);var s=t.elm=e.elm,c=e.children,u=t.children;if(a&&p(t)){for(i=0;i=0&&(m=e.charAt(h)," "===m);h--);m&&va.test(m)||(l=!0)}}else void 0===o?(v=i+1,o=e.slice(0,i).trim()):t();if(void 0===o?o=e.slice(0,i).trim():0!==v&&t(),a)for(i=0;i=Mo}function hn(e){return 34===e||39===e}function mn(e){var t=1;for(Ho=Fo;!vn();)if(e=dn(),hn(e))gn(e);else if(91===e&&t++,93===e&&t--,0===t){Uo=Fo;break}}function gn(e){for(var t=e;!vn()&&(e=dn(),e!==t););}function yn(e,t,n){Bo=n;var r=t.value,i=t.modifiers,o=e.tag,a=e.attrsMap.type;if("select"===o)$n(e,r,i);else if("input"===o&&"checkbox"===a)_n(e,r,i);else if("input"===o&&"radio"===a)bn(e,r,i);else if("input"===o||"textarea"===o)wn(e,r,i);else if(!Ri.isReservedTag(o))return ln(e,r,i),!1;return!0}function _n(e,t,n){var r=n&&n.number,i=cn(e,"value")||"null",o=cn(e,"true-value")||"true",a=cn(e,"false-value")||"false";rn(e,"checked","Array.isArray("+t+")?_i("+t+","+i+")>-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),sn(e,ma,"var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$c){$$i<0&&("+t+"=$$a.concat($$v))}else{$$i>-1&&("+t+"=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{"+t+"=$$c}",null,!0)}function bn(e,t,n){var r=n&&n.number,i=cn(e,"value")||"null";i=r?"_n("+i+")":i,rn(e,"checked","_q("+t+","+i+")"),sn(e,ma,fn(t,i),null,!0)}function $n(e,t,n){var r=n&&n.number,i='Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(r?"_n(val)":"val")+"})",o="$event.target.multiple ? $$selectedVal : $$selectedVal[0]",a="var $$selectedVal = "+i+";";a=a+" "+fn(t,o),sn(e,"change",a,null,!0)}function wn(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?ha:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=fn(t,l);c&&(f="if($event.target.composing)return;"+f),rn(e,"value","("+t+")"),sn(e,u,f,null,!0),(s||a||"number"===r)&&sn(e,"blur","$forceUpdate()")}function xn(e){var t;e[ha]&&(t=zi?"change":"input",e[t]=[].concat(e[ha],e[t]||[]),delete e[ha]),e[ma]&&(t=Zi?"click":"change",e[t]=[].concat(e[ma],e[t]||[]),delete e[ma])}function Cn(e,t,n,r){if(n){var i=t,o=Vo;t=function(n){var a=1===arguments.length?i(n):i.apply(null,arguments);null!==a&&kn(e,t,r,o)}}Vo.addEventListener(e,t,r)}function kn(e,t,n,r){(r||Vo).removeEventListener(e,t,n)}function An(e,t){if(e.data.on||t.data.on){var n=t.data.on||{},r=e.data.on||{};Vo=t.elm,xn(n),q(n,r,Cn,kn,t.context)}}function On(e,t){if(e.data.domProps||t.data.domProps){var n,r,i=t.elm,o=e.data.domProps||{},a=t.data.domProps||{};a.__ob__&&(a=t.data.domProps=u({},a));for(n in o)null==a[n]&&(i[n]="");for(n in a)if(r=a[n],"textContent"!==n&&"innerHTML"!==n||(t.children&&(t.children.length=0),r!==o[n]))if("value"===n){i._value=r;var s=null==r?"":String(r);Sn(i,t,s)&&(i.value=s)}else i[n]=r}}function Sn(e,t,n){return!e.composing&&("option"===t.tag||Tn(e,n)||En(e,n))}function Tn(e,t){return document.activeElement!==e&&e.value!==t}function En(e,n){var r=e.value,i=e._vModifiers;return i&&i.number||"number"===e.type?t(r)!==t(n):i&&i.trim?r.trim()!==n.trim():r!==n}function jn(e){var t=Nn(e.style);return e.staticStyle?u(e.staticStyle,t):t}function Nn(e){return Array.isArray(e)?p(e):"string"==typeof e?_a(e):e}function In(e,t){var n,r={};if(t)for(var i=e;i.componentInstance;)i=i.componentInstance._vnode,i.data&&(n=jn(i.data))&&u(r,n);(n=jn(e.data))&&u(r,n);for(var o=e;o=o.parent;)o.data&&(n=jn(o.data))&&u(r,n);return r}function Ln(e,t){var n=t.data,r=e.data;if(n.staticStyle||n.style||r.staticStyle||r.style){var i,o,a=t.elm,s=e.data.staticStyle,c=e.data.style||{},l=s||c,f=Nn(t.data.style)||{};t.data.style=f.__ob__?u({},f):f;var p=In(t,!0);for(o in l)null==p[o]&&wa(a,o,"");for(o in p)i=p[o],i!==l[o]&&wa(a,o,null==i?"":i)}}function Dn(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function Mn(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t);else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");e.setAttribute("class",n.trim())}}function Pn(e){if(e){if("object"==typeof e){var t={};return e.css!==!1&&u(t,Aa(e.name||"v")),u(t,e),t}return"string"==typeof e?Aa(e):void 0}}function Rn(e){La(function(){La(e)})}function Fn(e,t){(e._transitionClasses||(e._transitionClasses=[])).push(t),Dn(e,t)}function Hn(e,t){e._transitionClasses&&r(e._transitionClasses,t),Mn(e,t)}function Un(e,t,n){var r=Bn(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===Sa?ja:Ia,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=Sa,l=a,f=o.length):t===Ta?u>0&&(n=Ta,l=u,f=c.length):(l=Math.max(a,u),n=l>0?a>u?Sa:Ta:null,f=n?n===Sa?o.length:c.length:0);var p=n===Sa&&Da.test(r[Ea+"Property"]);return{type:n,timeout:l,propCount:f,hasTransform:p}}function Vn(e,t){for(;e.length1}function Zn(e,t){t.data.show||Jn(t)}function Gn(e,t,n){var r=t.value,i=e.multiple;if(!i||Array.isArray(r)){for(var o,a,s=0,c=e.options.length;s-1,a.selected!==o&&(a.selected=o);else if(h(Qn(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Yn(e,t){for(var n=0,r=t.length;n',n.innerHTML.indexOf(t)>0}function pr(e){return Wa=Wa||document.createElement("div"),Wa.innerHTML=e,Wa.textContent}function dr(e,t){var n=t?Ls:Is;return e.replace(n,function(e){return Ns[e]})}function vr(e,t){function n(t){f+=t,e=e.substring(t)}function r(){var t=e.match(os);if(t){var r={tagName:t[1],attrs:[],start:f};n(t[0].length);for(var i,o;!(i=e.match(as))&&(o=e.match(ns));)n(o[0].length),r.attrs.push(o);if(i)return r.unarySlash=i[1],n(i[0].length),r.end=f,r}}function i(e){var n=e.tagName,r=e.unarySlash;u&&("p"===s&&Qa(n)&&o(s),Ya(n)&&s===n&&o(n));for(var i=l(n)||"html"===n&&"head"===s||!!r,a=e.attrs.length,f=new Array(a),p=0;p=0&&c[i].lowerCasedTag!==o;i--);else i=0;if(i>=0){for(var a=c.length-1;a>=i;a--)t.end&&t.end(c[a].tag,n,r);c.length=i,s=i&&c[i-1].tag}else"br"===o?t.start&&t.start(e,[],!0,n,r):"p"===o&&(t.start&&t.start(e,[],!1,n,r),t.end&&t.end(e,n,r))}for(var a,s,c=[],u=t.expectHTML,l=t.isUnaryTag||Mi,f=0;e;){if(a=e,s&&Es(s)){var p=s.toLowerCase(),d=js[p]||(js[p]=new RegExp("([\\s\\S]*?)(]*>)","i")),v=0,h=e.replace(d,function(e,n,r){return v=r.length,Es(p)||"noscript"===p||(n=n.replace(//g,"$1").replace(//g,"$1")),t.chars&&t.chars(n),""});f+=e.length-h.length,e=h,o(p,f-v,f)}else{var m=e.indexOf("<");if(0===m){if(us.test(e)){var g=e.indexOf("-->");if(g>=0){n(g+3);continue}}if(ls.test(e)){var y=e.indexOf("]>");if(y>=0){n(y+2);continue}}var _=e.match(cs);if(_){n(_[0].length);continue}var b=e.match(ss);if(b){var $=f;n(b[0].length),o(b[1],$,f);continue}var w=r();if(w){i(w);continue}}var x=void 0,C=void 0,k=void 0;if(m>=0){for(C=e.slice(m);!(ss.test(C)||os.test(C)||us.test(C)||ls.test(C)||(k=C.indexOf("<",1),k<0));)m+=k,C=e.slice(m);x=e.substring(0,m),n(m)}m<0&&(x=e,e=""),t.chars&&x&&t.chars(x)}if(e===a){t.chars&&t.chars(e);break}}o()}function hr(e,t){var n=t?Ps(t):Ds;if(n.test(e)){for(var r,i,o=[],a=n.lastIndex=0;r=n.exec(e);){i=r.index,i>a&&o.push(JSON.stringify(e.slice(a,i)));var s=Xt(r[1].trim());o.push("_s("+s+")"),a=i+r[0].length}return a0,Ki=Vi&&Vi.indexOf("edge/")>0,qi=Vi&&Vi.indexOf("android")>0,Wi=Vi&&/iphone|ipad|ipod|ios/.test(Vi),Zi=Vi&&/chrome\/\d+/.test(Vi)&&!Ki,Gi=function(){return void 0===ki&&(ki=!Bi&&"undefined"!=typeof global&&"server"===global.process.env.VUE_ENV),ki},Yi=Bi&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,Qi="undefined"!=typeof Symbol&&$(Symbol)&&"undefined"!=typeof Reflect&&$(Reflect.ownKeys),Xi=function(){function e(){r=!1;var e=n.slice(0);n.length=0;for(var t=0;t1&&(t[n[0].trim()]=n[1].trim())}}),t}),ba=/^--/,$a=/\s*!important$/,wa=function(e,t,n){ba.test(t)?e.style.setProperty(t,n):$a.test(n)?e.style.setProperty(t,n.replace($a,""),"important"):e.style[Ca(t)]=n},xa=["Webkit","Moz","ms"],Ca=a(function(e){if(zo=zo||document.createElement("div"),e=Ei(e),"filter"!==e&&e in zo.style)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=0;n\/=]+)/,es=/(?:=)/,ts=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^\s"'=<>`]+)/.source],ns=new RegExp("^\\s*"+Xa.source+"(?:\\s*("+es.source+")\\s*(?:"+ts.join("|")+"))?"),rs="[a-zA-Z_][\\w\\-\\.]*",is="((?:"+rs+"\\:)?"+rs+")",os=new RegExp("^<"+is),as=/^\s*(\/?)>/,ss=new RegExp("^<\\/"+is+"[^>]*>"),cs=/^]+>/i,us=/^/g, '$1') .replace(//g, '$1'); @@ -866,25 +866,26 @@ function getAndRemoveAttr (el, name) { /* */ -var dirRE = /^v-|^@|^:/; var onRE = /^@|^v-on:/; +var dirRE = /^v-|^@|^:/; var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/; var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/; -var bindRE = /^:|^v-bind:/; + var argRE = /:(.*)$/; +var bindRE = /^:|^v-bind:/; var modifierRE = /\.[^.]+/g; var decodeHTMLCached = cached(he.decode); // configurable state var warn; -var platformGetTagNamespace; -var platformMustUseProp; -var platformIsPreTag; -var preTransforms; +var delimiters; var transforms; +var preTransforms; var postTransforms; -var delimiters; +var platformIsPreTag; +var platformMustUseProp; +var platformGetTagNamespace; /** * Convert HTML string to AST. @@ -910,6 +911,13 @@ function parse ( var inPre = false; var warned = false; + function warnOnce (msg) { + if (!warned) { + warned = true; + warn(msg); + } + } + function endPre (element) { // check pre state if (element.pre) { @@ -993,17 +1001,15 @@ function parse ( } function checkRootConstraints (el) { - if (process.env.NODE_ENV !== 'production' && !warned) { + if (process.env.NODE_ENV !== 'production') { if (el.tag === 'slot' || el.tag === 'template') { - warned = true; - warn( + warnOnce( "Cannot use <" + (el.tag) + "> as component root element because it may " + 'contain multiple nodes.' ); } if (el.attrsMap.hasOwnProperty('v-for')) { - warned = true; - warn( + warnOnce( 'Cannot use v-for on stateful component root element because ' + 'it renders multiple elements.' ); @@ -1023,9 +1029,8 @@ function parse ( exp: element.elseif, block: element }); - } else if (process.env.NODE_ENV !== 'production' && !warned) { - warned = true; - warn( + } else if (process.env.NODE_ENV !== 'production') { + warnOnce( "Component template should contain exactly one root element. " + "If you are using v-if on multiple elements, " + "use v-else-if to chain them instead." @@ -1070,11 +1075,16 @@ function parse ( chars: function chars (text) { if (!currentParent) { - if (process.env.NODE_ENV !== 'production' && !warned && text === template) { - warned = true; - warn( - 'Component template requires a root element, rather than just text.' - ); + if (process.env.NODE_ENV !== 'production') { + if (text === template) { + warnOnce( + 'Component template requires a root element, rather than just text.' + ); + } else if ((text = text.trim())) { + warnOnce( + ("text \"" + text + "\" outside root element will be ignored.") + ); + } } return } @@ -1273,7 +1283,7 @@ function processComponent (el) { function processAttrs (el) { var list = el.attrsList; - var i, l, name, rawName, value, arg, modifiers, isProp; + var i, l, name, rawName, value, modifiers, isProp; for (i = 0, l = list.length; i < l; i++) { name = rawName = list[i].name; value = list[i].value; @@ -1311,7 +1321,8 @@ function processAttrs (el) { name = name.replace(dirRE, ''); // parse arg var argMatch = name.match(argRE); - if (argMatch && (arg = argMatch[1])) { + var arg = argMatch && argMatch[1]; + if (arg) { name = name.slice(0, -(arg.length + 1)); } addDirective(el, name, rawName, value, arg, modifiers); @@ -1597,10 +1608,11 @@ function genHandler ( : ("function($event){" + (handler.value) + "}") // inline statement } else { var code = ''; + var genModifierCode = ''; var keys = []; for (var key in handler.modifiers) { if (modifierCode[key]) { - code += modifierCode[key]; + genModifierCode += modifierCode[key]; // left/right if (keyCodes[key]) { keys.push(key); @@ -1612,6 +1624,10 @@ function genHandler ( if (keys.length) { code += genKeyFilter(keys); } + // Make sure modifiers like prevent and stop get executed after key filtering + if (genModifierCode) { + code += genModifierCode; + } var handlerCode = isMethodPath ? handler.value + '($event)' : isFunctionExpression @@ -2025,17 +2041,22 @@ function transformSpecialNewlines (text) { /* */ -// operators like typeof, instanceof and in are allowed +// these keywords should not appear inside expressions, but operators like +// typeof, instanceof and in are allowed var prohibitedKeywordRE = new RegExp('\\b' + ( 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' + 'super,throw,while,yield,delete,export,import,return,switch,default,' + 'extends,finally,continue,debugger,function,arguments' ).split(',').join('\\b|\\b') + '\\b'); + +// these unary operators should not be used as property/method names var unaryOperatorsRE = new RegExp('\\b' + ( 'delete,typeof,void' ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)'); + // check valid identifier for v-for var identRE = /[A-Za-z_$][\w$]*/; + // strip strings in expressions var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; @@ -2140,7 +2161,7 @@ var config = { /** * Whether to record perf */ - performance: process.env.NODE_ENV !== 'production', + performance: false, /** * Error handler for watcher errors @@ -2247,9 +2268,11 @@ if (process.env.NODE_ENV !== 'production') { if (vm.$root === vm) { return '' } - var name = vm._isVue - ? vm.$options.name || vm.$options._componentTag - : vm.name; + var name = typeof vm === 'function' && vm.options + ? vm.options.name + : vm._isVue + ? vm.$options.name || vm.$options._componentTag + : vm.name; var file = vm._isVue && vm.$options.__file; if (!name && file) { diff --git a/packages/weex-vue-framework/factory.js b/packages/weex-vue-framework/factory.js index d4ba422d643..24f171e8925 100644 --- a/packages/weex-vue-framework/factory.js +++ b/packages/weex-vue-framework/factory.js @@ -270,7 +270,7 @@ var config = { /** * Whether to record perf */ - performance: process.env.NODE_ENV !== 'production', + performance: false, /** * Error handler for watcher errors @@ -346,6 +346,48 @@ var config = { _maxUpdateCount: 100 }; +/* */ + +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 + } + 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 */ @@ -495,57 +537,6 @@ if (typeof Set !== 'undefined' && isNative(Set)) { }()); } -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 - } - 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; @@ -577,9 +568,11 @@ if (process.env.NODE_ENV !== 'production') { if (vm.$root === vm) { return '' } - var name = vm._isVue - ? vm.$options.name || vm.$options._componentTag - : vm.name; + var name = typeof vm === 'function' && vm.options + ? vm.options.name + : vm._isVue + ? vm.$options.name || vm.$options._componentTag + : vm.name; var file = vm._isVue && vm.$options.__file; if (!name && file) { @@ -1525,6 +1518,29 @@ if (process.env.NODE_ENV !== 'production') { }; } +var mark; +var measure; + +if (process.env.NODE_ENV !== 'production') { + var perf = inBrowser && window.performance; + /* istanbul ignore if */ + if ( + perf && + perf.mark && + perf.measure && + perf.clearMarks && + perf.clearMeasures + ) { + mark = function (tag) { return perf.mark(tag); }; + measure = function (name, startTag, endTag) { + perf.measure(name, startTag, endTag); + perf.clearMarks(startTag); + perf.clearMarks(endTag); + perf.clearMeasures(name); + }; + } +} + /* */ var VNode = function VNode ( @@ -2096,19 +2112,21 @@ function mountComponent ( var updateComponent; /* istanbul ignore if */ - if (process.env.NODE_ENV !== 'production' && config.performance && perf) { + if (process.env.NODE_ENV !== 'production' && config.performance && mark) { updateComponent = function () { var name = vm._name; var startTag = "start " + name; var endTag = "end " + name; - perf.mark(startTag); + + mark(startTag); var vnode = vm._render(); - perf.mark(endTag); - perf.measure((name + " render"), startTag, endTag); - perf.mark(startTag); + mark(endTag); + measure((name + " render"), startTag, endTag); + + mark(startTag); vm._update(vnode, hydrating); - perf.mark(endTag); - perf.measure((name + " patch"), startTag, endTag); + mark(endTag); + measure((name + " patch"), startTag, endTag); }; } else { updateComponent = function () { @@ -2850,8 +2868,63 @@ function stateMixin (Vue) { /* */ -var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy }; -var hooksToMerge = Object.keys(hooks); +// hooks to be invoked on component VNodes during patch +var componentVNodeHooks = { + init: 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 + componentVNodeHooks.prepatch(mountedNode, mountedNode); + } + }, + + prepatch: 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 + ); + }, + + insert: function insert (vnode) { + if (!vnode.componentInstance._isMounted) { + vnode.componentInstance._isMounted = true; + callHook(vnode.componentInstance, 'mounted'); + } + if (vnode.data.keepAlive) { + activateChildComponent(vnode.componentInstance, true /* direct */); + } + }, + + destroy: function destroy (vnode) { + if (!vnode.componentInstance._isDestroyed) { + if (!vnode.data.keepAlive) { + vnode.componentInstance.$destroy(); + } else { + deactivateChildComponent(vnode.componentInstance, true /* direct */); + } + } + } +}; + +var hooksToMerge = Object.keys(componentVNodeHooks); function createComponent ( Ctor, @@ -2999,62 +3072,6 @@ function createComponentInstanceForVnode ( 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, @@ -3118,6 +3135,21 @@ function extractProps (data, Ctor) { if (attrs || props || domProps) { for (var key in propOptions) { var altKey = hyphenate(key); + if (process.env.NODE_ENV !== 'production') { + var keyInLowerCase = key.toLowerCase(); + if ( + key !== keyInLowerCase && + attrs && attrs.hasOwnProperty(keyInLowerCase) + ) { + warn( + "Prop \"" + keyInLowerCase + "\" is not declared in component " + + (formatComponentName(Ctor)) + ". Note that HTML attributes are " + + "case-insensitive and camelCased props need to use their kebab-case " + + "equivalents when using in-DOM templates. You should probably use " + + "\"" + altKey + "\" instead of \"" + key + "\"." + ); + } + } checkProp(res, props, key, altKey, true) || checkProp(res, attrs, key, altKey) || checkProp(res, domProps, key, altKey); @@ -3158,7 +3190,7 @@ function mergeHooks (data) { for (var i = 0; i < hooksToMerge.length; i++) { var key = hooksToMerge[i]; var fromParent = data.hook[key]; - var ours = hooks[key]; + var ours = componentVNodeHooks[key]; data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours; } } @@ -3400,14 +3432,17 @@ function bindObjectProps ( if (Array.isArray(value)) { value = toObject(value); } + var hash; for (var key in value) { if (key === 'class' || key === 'style') { - data[key] = value[key]; + hash = data; } else { var type = data.attrs && data.attrs.type; - var hash = asProp || config.mustUseProp(tag, type, key) + hash = asProp || config.mustUseProp(tag, type, key) ? data.domProps || (data.domProps = {}) : data.attrs || (data.attrs = {}); + } + if (!(key in hash)) { hash[key] = value[key]; } } @@ -3619,8 +3654,8 @@ var uid = 0; function initMixin (Vue) { Vue.prototype._init = function (options) { /* istanbul ignore if */ - if (process.env.NODE_ENV !== 'production' && config.performance && perf) { - perf.mark('init'); + if (process.env.NODE_ENV !== 'production' && config.performance && mark) { + mark('init'); } var vm = this; @@ -3659,10 +3694,10 @@ function initMixin (Vue) { callHook(vm, 'created'); /* istanbul ignore if */ - if (process.env.NODE_ENV !== 'production' && config.performance && perf) { + if (process.env.NODE_ENV !== 'production' && config.performance && mark) { vm._name = formatComponentName(vm, false); - perf.mark('init end'); - perf.measure(((vm._name) + " init"), 'init', 'init end'); + mark('init end'); + measure(((vm._name) + " init"), 'init', 'init end'); } if (vm.$options.el) { @@ -4074,7 +4109,7 @@ Object.defineProperty(Vue$2.prototype, '$isServer', { get: isServerRendering }); -Vue$2.version = '2.2.1'; +Vue$2.version = '2.2.3'; /* globals renderer */ // renderer is injected by weex factory wrapper @@ -4232,7 +4267,7 @@ function registerRef (vnode, isRemoval) { var emptyNode = new VNode('', {}, []); -var hooks$1 = ['create', 'activate', 'update', 'remove', 'destroy']; +var hooks = ['create', 'activate', 'update', 'remove', 'destroy']; function isUndef (s) { return s == null @@ -4268,10 +4303,10 @@ function createPatchFunction (backend) { var modules = backend.modules; var nodeOps = backend.nodeOps; - for (i = 0; i < hooks$1.length; ++i) { - cbs[hooks$1[i]] = []; + for (i = 0; i < hooks.length; ++i) { + cbs[hooks[i]] = []; for (j = 0; j < modules.length; ++j) { - if (modules[j][hooks$1[i]] !== undefined) { cbs[hooks$1[i]].push(modules[j][hooks$1[i]]); } + if (modules[j][hooks[i]] !== undefined) { cbs[hooks[i]].push(modules[j][hooks[i]]); } } }