intact-vue
Advanced tools
Comparing version 0.5.9 to 0.5.10
@@ -113,2 +113,5 @@ 'use strict'; | ||
var VueVNode = _textVNode.constructor; | ||
var _testData = {}; | ||
var _vm = new Vue({ data: _testData }); | ||
var __ob__ = _testData.__ob__; | ||
@@ -199,3 +202,5 @@ // for scoped style | ||
vNode._isVue = true; // let vue don't observe it when it is used as property | ||
// let vue don't observe it when it is used as property, ksc-fe/kpc#500 | ||
// we can not use `vNode._isVue = true`, because it will affect vue-devtools. ksc-fe/kpc#512 | ||
vNode.__ob__ = __ob__; | ||
return vNode; | ||
@@ -1029,3 +1034,9 @@ } | ||
IntactVue.prototype.$off = function $off() {}; | ||
// for vue-devtools | ||
IntactVue.prototype.$set = function $set(obj, key, value) { | ||
this.set(key, value); | ||
}; | ||
return IntactVue; | ||
@@ -1032,0 +1043,0 @@ }(Intact); |
@@ -115,2 +115,5 @@ (function (global, factory) { | ||
var VueVNode = _textVNode.constructor; | ||
var _testData = {}; | ||
var _vm = new Vue({ data: _testData }); | ||
var __ob__ = _testData.__ob__; | ||
@@ -201,3 +204,5 @@ // for scoped style | ||
vNode._isVue = true; // let vue don't observe it when it is used as property | ||
// let vue don't observe it when it is used as property, ksc-fe/kpc#500 | ||
// we can not use `vNode._isVue = true`, because it will affect vue-devtools. ksc-fe/kpc#512 | ||
vNode.__ob__ = __ob__; | ||
return vNode; | ||
@@ -1031,3 +1036,9 @@ } | ||
IntactVue.prototype.$off = function $off() {}; | ||
// for vue-devtools | ||
IntactVue.prototype.$set = function $set(obj, key, value) { | ||
this.set(key, value); | ||
}; | ||
return IntactVue; | ||
@@ -1034,0 +1045,0 @@ }(Intact); |
@@ -1,1 +0,1 @@ | ||
(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?module.exports=e(require("vue"),require("intact/dist")):typeof define==="function"&&define.amd?define(["vue","intact/dist"],e):t.Intact=e(t.Vue,t.Intact)})(this,function(t,e){"use strict";t=t&&t.hasOwnProperty("default")?t["default"]:t;e=e&&e.hasOwnProperty("default")?e["default"]:e;var n=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol==="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var a=function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}};var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r){if(Object.prototype.hasOwnProperty.call(r,n)){t[n]=r[n]}}}return t};var r=function(t,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof e)}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:false,writable:true,configurable:true}});if(e)Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e};var u=function(t,e){var r={};for(var n in t){if(e.indexOf(n)>=0)continue;if(!Object.prototype.hasOwnProperty.call(t,n))continue;r[n]=t[n]}return r};var f=function(t,e){if(!t){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e&&(typeof e==="object"||typeof e==="function")?e:t};var i=e.Vdt.miss;var o=i.h;var l=i.hooks;var c=i.config;var v=e.utils;var p=v.get;var d=v.set;var I=v.extend;var S=v.isArray;var h=v.create;var A=v.hasOwn;var w=v.each;var y=t.prototype._v("");var _=y.constructor;if(l){l.beforeInsert=function(t){var e=t.dom;var r=t.parentVNode;var n=void 0;var i=void 0;while(r){if((n=r.tag)&&n.cid==="IntactVue"&&(n=r.children.$options)){if((n=i=n.parent)&&(n=n.$options)&&(n=n._scopeId)){e.setAttribute(n,"")}if(i){r=i.$parent;while(r){if((n=r.$options)&&(n=n._scopeId)){e.setAttribute(n,"")}r=r.$parent}}break}else{r=r.parentVNode}}}}if(c){c.disableDelegate=true}t.mixin({beforeCreate:function t(){if(!this.$parent&&this.$vnode){this.$parent=this.$vnode.context}}});function Q(t){var e=function e(t){if(S(t)){var r=[];t.forEach(function(t){if(S(t)){r.push.apply(r,e(t))}else{r.push(m(t))}});return r}return m(t)};var r=e(t);if(Array.isArray(r)){var n=r.length;return n===0?undefined:n===1?r[0]:r}return r}function m(t){if(t==null)return t;var e=typeof t==="undefined"?"undefined":n(t);if(e==="string"||e==="number")return t;if(t.type)return t;if(t.text!==undefined){return t.text}if(R(t)){var r=t.componentOptions;t=o(r.Ctor,g(t),null,null,t.key,t.ref)}else{t=o(k,{vueVNode:t},null,j(t),t.key)}t._isVue=true;return t}function g(t){var e=t.componentOptions;var r=t.data;var n=r.attrs;var i=e.Ctor.propTypes;var u={};if(n){for(var o in n){if(~["staticClass","class","style","staticStyle"].indexOf(o))continue;var a=n[o];if(i){var s=H(o);if(A.call(i,s)){o=s;var f=void 0;if(((f=i[o])===Boolean||f&&(S(f)&&f.indexOf(Boolean)>-1||f.type===Boolean||S(f.type)&&f.type.indexOf(Boolean)>-1))&&(a===""||a===o)){a=true}}}u[o]=a}}var l=j(t);if(l!==undefined){u.className=l}var c=E(t);if(c!==undefined){u.style=c}if(t.key){u.key=t.key}else if(r.key){u.key=r.key}var v=r.scopedSlots;if(v){var p=u._blocks?u._blocks:u._blocks={};var d=function t(i){p[i]=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return Q(v[i].apply(this,r))}};for(var h in v){d(h)}}var y=r.model;if(y){u.value=y.value;u["v-model"]=y.expression}if(r.directives){var _=r.directives;for(var m=0;m<_.length;m++){var g=_[m];if(g.name==="model"){u.value=g.value;u["v-model"]=g.expression;break}else if(g.name==="show"&&!g.value){if(u.style){u.style.display="none"}else{u.style={display:"none"}}}}}P(t,u);var b=e.listeners;if(b){var $=function t(e){var n=b[e];var r=n;var i=S(n);var o=function t(e,r){if(i){w(n,function(t){return t(r)})}else{n(r)}};if(e==="input"){e="$change:value";r=o}else if(e.substr(0,7)==="update:"){var a=e.substr(7);if(a.indexOf("-")>-1)return"continue";e="$change:"+a;r=o}var s="ev-"+H(e);if(u[s]){u[s]=[].concat(u[s],r)}else{u[s]=r}x=e};for(var x in b){var O=$(x);if(O==="continue")continue}}var k=t.slots||U(e.children);var N=M(k),V=N.children,C=N._blocks;u.children=V;if(u._blocks){I(u._blocks,C)}else{u._blocks=C}T(t,u);return u}function T(t,e){var n=t.context;e._context={data:{get:function t(e){if(e!=null){return p(n,e)}else{return n.$data}},set:function t(e,r){d(n,e,r)},$router:p(n,"_routerRoot._router")}}}function M(t){var e=t.default,r=u(t,["default"]);var n=void 0;if(r){n={};var i=function t(e){n[e]=function(){return Q(r[e])}};for(var o in r){i(o)}}return{children:Q(e),_blocks:n}}function b(t,e,r){var n={};var i={attrs:n};var o=e.props;for(var a in o){if(~["children","_context","className","style","ref","key"].indexOf(a))continue;n[a]=o[a]}if(e.ref){i.ref=r.data.ref}if(o.className){i.staticClass=o.className}if(e.props.style){i.staticStyle=o.style}if(e.key!=null){i.key=o.key}var s=o.children;if(s&&!Array.isArray(s)){s=[s]}return t(e.tag,i,s)}function $(o){function t(t){return o(t)}t.options={functional:true,render:function t(e,r){var n=g({componentOptions:{Ctor:o,listeners:r.listeners},data:r.data,slots:r.slots(),context:r.parent});var i=o(n,true);if(S(i)){return i.map(function(t){return b(e,t,r)})}return b(e,i,r)}};t.cid="IntactFunctionalComponent";return t}var x=/_ev[A-Z]/;var O=t.prototype.__patch__;var k=function(){function t(){a(this,t)}t.prototype.init=function t(e,r){this.destroyed=true;this._addProps(r);return O(null,r.props.vueVNode,false,false,this.parentDom)};t.prototype.update=function t(e,r){this._addProps(r);return O(e.props.vueVNode,r.props.vueVNode,false,false,this.parentDom)};t.prototype.destroy=function t(e){O(e.props.vueVNode,null)};t.prototype._addProps=function t(e){this.vdt={vNode:e};var r=e.props;var n=r.vueVNode;if(n.elm){n=W(n)}for(var i in r){if(i==="vueVNode")continue;if(x.test(i))continue;if(!n.data)n.data={};var o=n.data;var a=r[i];if(i==="className"){o.staticClass=a;delete o.class}else if(i==="style"){if(o.staticStyle){o.staticStyle=s({},o.staticStyle,a)}else{o.staticStyle=a}}else if(i.substr(0,3)==="ev-"){if(!o.on)o.on={};o.on[i.substr(3)]=a}else{if(!o.attrs)o.attrs={};o.attrs[i]=a}}e.props=s({},r,{vueVNode:n})};return t}();function P(n,t){var i=n.data.ref;if(i){var o=n.context.$refs;t.ref=function(t,e){if(!o)return;if(!e){if(n.data.refInFor){if(!S(o[i])){o[i]=[t]}else if(o[i].indexOf(t)<0){o[i].push(t)}}else{o[i]=t}}else{if(S(o[i])){var r=o[i].indexOf(t);if(~r){o[i].splice(r,1)}}else{o[i]=undefined}}};t.ref.key=i}}function j(t){var e=void 0;var r=t.data;if(r){if(r.staticClass){e=r.staticClass}if(r.class){if(!e){e=N(r.class)}else{e+=" "+N(r.class)}}}return e}function N(t){if(t==null)return"";if(S(t)){return V(t)}if((typeof t==="undefined"?"undefined":n(t))==="object"){return C(t)}if(typeof t==="string"){return t}return""}function V(t){var e="";var r=void 0;for(var n=0;n<t.length;n++){if((r=N(t[n]))!=null&&r!==""){if(e)e+=" ";e+=r}}return e}function C(t){var e="";for(var r in t){if(t[r]){if(e)e+=" ";e+=r}}return e}function E(t){var e=void 0;var r=t.data;if(r){e=F(r.style);if(r.staticStyle){return I(r.staticStyle,e)}}return e}function F(t){if(!t)return t;if(S(t)){return B(t)}if(typeof t==="string"){return D(t)}return t}function B(t){var e={};for(var r=0;r<t.length;r++){if(t[r]){I(e,t[r])}}return e}var q=h(null);function D(t){var e=q[t];if(e)return e;var r={};var n=/;(?![^(]*\))/g;var i=/:(.+)/;t.split(n).forEach(function(t){if(t){var e=t.split(i);e.length>1&&(r[e[0].trim()]=e[1].trim())}});q[t]=r;return r}function R(t){var e=t.data;return e&&(e=e.hook)&&(e=e.init)&&t.componentOptions.Ctor.cid==="IntactVue"}function U(t){var e={};if(!t){return e}for(var r=0,n=t.length;r<n;r++){var i=t[r];var o=i.data;if(o&&o.attrs&&o.attrs.slot){delete o.attrs.slot}if(o&&o.slot!=null){var a=o.slot;var s=e[a]||(e[a]=[]);if(i.tag==="template"){s.push.apply(s,i.children||[])}else{s.push(i)}}else{(e.default||(e.default=[])).push(i)}}for(var u in e){if(e[u].every(z)){delete e[u]}}return e}function z(t){return t.isComment&&!t.asyncFactory||t.text===" "}function W(t){var e=new _(t.tag,t.data?s({},t.data):t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);e.ns=t.ns;e.isStatic=t.isStatic;e.key=t.key;e.isComment=t.isComment;e.fnContext=t.fnContext;e.fnOptions=t.fnOptions;e.fnScopeId=t.fnScopeId;e.asyncMeta=t.asyncMeta;e.isCloned=true;return e}function Z(r){var n=Object.create(null);return function(t){var e=n[t];return e||(n[t]=r(t))}}var G=/-(\w)/g;var H=Z(function(t){return t.replace(G,function(t,e){return e?e.toUpperCase():""})});var J=t.prototype;var K=J.init;var L=J.$nextTick;var X=J._updateFromParent;var Y=e.utils.extend;var tt=void 0;var et=void 0;var rt=function(s){r(o,s);function o(t){a(this,o);var e=t&&t._parentVnode;if(e){var r=m(e);var n=f(this,s.call(this,r.props));t._renderChildren=true;n.$options=t;n.$vnode=e;n._isVue=true;n.$scopedSlots={$stable:true};n.vNode=r;r.children=n;var i=t.parent;if(i){n.$parent=i;n.$root=i.$root;i.$children.push(n)}n.$children=[];n._data=n.props;n.$refs={};n._uid=n.uniqueId;t.name=n.displayName||n.constructor.name}else{var n=f(this,s.call(this,t))}return f(n)}o.prototype.init=function t(r,n){var i=this;var t=function t(){i.__pushActiveInstance();var e=s.prototype.init.call(i,r,n);i.__popActiveInstance();return e};if(!this._isVue)return t();et=this.mountedQueue;var e=t();return e};o.prototype.update=function t(r,n,i){var o=this;var t=function t(){o.__pushActiveInstance();var e=s.prototype.update.call(o,r,n,i);o.__popActiveInstance();return e};if(!this._isVue)return t();var e=this._shouldTrigger;this.__initMountedQueue();var a=t();this.__triggerMountedQueue();this._shouldTrigger=e;this.$vnode.elm=a;return a};o.prototype.$mount=function t(e,r){var n=this;var i=this._shouldTrigger;this.__initMountedQueue();this.parentVNode=this.vNode.parentVNode=tt&&tt.vNode;this.inited=true;this.$el=this.init(null,this.vNode);this.vNode.dom=this.$el;this._vnode={};var o=this.$options;var a=o._refElm;var s=o._parentElm;if(s){if(a){s.insertBefore(this.$el,a)}else{s.appendChild(this.$el)}}this.$el.__vue__=this;this.mountedQueue.push(function(){n.mount()});this.__triggerMountedQueue();this._shouldTrigger=i};o.prototype.$forceUpdate=function t(){var e=this._shouldTrigger;this.__initMountedQueue();var r=m(this.$vnode);var n=this.vNode;r.children=this;this.vNode=r;this.parentVNode=this.vNode.parentVNode=tt&&tt.vNode;this.$vnode.elm=this.update(n,r);this.$options._renderChildren=true;var i=n.ref;var o=r.ref;if(i!==o&&!(i&&o&&i.key===o.key)){if(i){i(this,true)}if(o){o(this)}}this.__triggerMountedQueue();this._shouldTrigger=e};o.prototype.$destroy=function t(){delete this.$el.__vue__;var e=this.$parent;if(e){var r=e.$children;if(r.length){var n=r.indexOf(this);if(~n){r.splice(n,1)}}}this.destroy()};o.prototype.__initMountedQueue=function t(){this._shouldTrigger=false;if(!et||et.done){this._shouldTrigger=true;if(!this.mountedQueue||this.mountedQueue.done){this._initMountedQueue()}et=this.mountedQueue}else{this.mountedQueue=et}};o.prototype.__triggerMountedQueue=function t(){if(this._shouldTrigger){if(this.mounted){this._triggerMountedQueue()}else{this.$options.mounted=[this._triggerMountedQueue]}et=null;this._shouldTrigger=false}};o.prototype.__pushActiveInstance=function t(){this._prevActiveInstance=tt;tt=this};o.prototype.__popActiveInstance=function t(){tt=this._prevActiveInstance;this._prevActiveInstance=null};o.prototype.$on=function t(){};o.prototype.$off=function t(){};return o}(e);rt.cid="IntactVue";rt.options=Y({},t.options);rt.functionalWrapper=$;rt.normalize=Q;rt.prototype.$nextTick=L;rt.prototype._updateFromParent=X;if(!Object.setPrototypeOf){Y(rt,e);if(!rt.template){rt.template=e.template}}return rt}); | ||
(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?module.exports=e(require("vue"),require("intact/dist")):typeof define==="function"&&define.amd?define(["vue","intact/dist"],e):t.Intact=e(t.Vue,t.Intact)})(this,function(t,e){"use strict";t=t&&t.hasOwnProperty("default")?t["default"]:t;e=e&&e.hasOwnProperty("default")?e["default"]:e;var n=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol==="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var a=function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}};var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r){if(Object.prototype.hasOwnProperty.call(r,n)){t[n]=r[n]}}}return t};var r=function(t,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof e)}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:false,writable:true,configurable:true}});if(e)Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e};var u=function(t,e){var r={};for(var n in t){if(e.indexOf(n)>=0)continue;if(!Object.prototype.hasOwnProperty.call(t,n))continue;r[n]=t[n]}return r};var f=function(t,e){if(!t){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e&&(typeof e==="object"||typeof e==="function")?e:t};var i=e.Vdt.miss;var o=i.h;var l=i.hooks;var c=i.config;var v=e.utils;var p=v.get;var d=v.set;var I=v.extend;var S=v.isArray;var h=v.create;var w=v.hasOwn;var A=v.each;var y=t.prototype._v("");var _=y.constructor;var m={};var g=new t({data:m});var b=m.__ob__;if(l){l.beforeInsert=function(t){var e=t.dom;var r=t.parentVNode;var n=void 0;var i=void 0;while(r){if((n=r.tag)&&n.cid==="IntactVue"&&(n=r.children.$options)){if((n=i=n.parent)&&(n=n.$options)&&(n=n._scopeId)){e.setAttribute(n,"")}if(i){r=i.$parent;while(r){if((n=r.$options)&&(n=n._scopeId)){e.setAttribute(n,"")}r=r.$parent}}break}else{r=r.parentVNode}}}}if(c){c.disableDelegate=true}t.mixin({beforeCreate:function t(){if(!this.$parent&&this.$vnode){this.$parent=this.$vnode.context}}});function Q(t){var e=function e(t){if(S(t)){var r=[];t.forEach(function(t){if(S(t)){r.push.apply(r,e(t))}else{r.push($(t))}});return r}return $(t)};var r=e(t);if(Array.isArray(r)){var n=r.length;return n===0?undefined:n===1?r[0]:r}return r}function $(t){if(t==null)return t;var e=typeof t==="undefined"?"undefined":n(t);if(e==="string"||e==="number")return t;if(t.type)return t;if(t.text!==undefined){return t.text}if(W(t)){var r=t.componentOptions;t=o(r.Ctor,x(t),null,null,t.key,t.ref)}else{t=o(C,{vueVNode:t},null,j(t),t.key)}t.__ob__=b;return t}function x(t){var e=t.componentOptions;var r=t.data;var n=r.attrs;var i=e.Ctor.propTypes;var u={};if(n){for(var o in n){if(~["staticClass","class","style","staticStyle"].indexOf(o))continue;var a=n[o];if(i){var s=L(o);if(w.call(i,s)){o=s;var f=void 0;if(((f=i[o])===Boolean||f&&(S(f)&&f.indexOf(Boolean)>-1||f.type===Boolean||S(f.type)&&f.type.indexOf(Boolean)>-1))&&(a===""||a===o)){a=true}}}u[o]=a}}var l=j(t);if(l!==undefined){u.className=l}var c=q(t);if(c!==undefined){u.style=c}if(t.key){u.key=t.key}else if(r.key){u.key=r.key}var v=r.scopedSlots;if(v){var p=u._blocks?u._blocks:u._blocks={};var d=function t(i){p[i]=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return Q(v[i].apply(this,r))}};for(var h in v){d(h)}}var y=r.model;if(y){u.value=y.value;u["v-model"]=y.expression}if(r.directives){var _=r.directives;for(var m=0;m<_.length;m++){var g=_[m];if(g.name==="model"){u.value=g.value;u["v-model"]=g.expression;break}else if(g.name==="show"&&!g.value){if(u.style){u.style.display="none"}else{u.style={display:"none"}}}}}P(t,u);var b=e.listeners;if(b){var $=function t(e){var n=b[e];var r=n;var i=S(n);var o=function t(e,r){if(i){A(n,function(t){return t(r)})}else{n(r)}};if(e==="input"){e="$change:value";r=o}else if(e.substr(0,7)==="update:"){var a=e.substr(7);if(a.indexOf("-")>-1)return"continue";e="$change:"+a;r=o}var s="ev-"+L(e);if(u[s]){u[s]=[].concat(u[s],r)}else{u[s]=r}x=e};for(var x in b){var O=$(x);if(O==="continue")continue}}var k=t.slots||Z(e.children);var N=M(k),V=N.children,C=N._blocks;u.children=V;if(u._blocks){I(u._blocks,C)}else{u._blocks=C}T(t,u);return u}function T(t,e){var n=t.context;e._context={data:{get:function t(e){if(e!=null){return p(n,e)}else{return n.$data}},set:function t(e,r){d(n,e,r)},$router:p(n,"_routerRoot._router")}}}function M(t){var e=t.default,r=u(t,["default"]);var n=void 0;if(r){n={};var i=function t(e){n[e]=function(){return Q(r[e])}};for(var o in r){i(o)}}return{children:Q(e),_blocks:n}}function O(t,e,r){var n={};var i={attrs:n};var o=e.props;for(var a in o){if(~["children","_context","className","style","ref","key"].indexOf(a))continue;n[a]=o[a]}if(e.ref){i.ref=r.data.ref}if(o.className){i.staticClass=o.className}if(e.props.style){i.staticStyle=o.style}if(e.key!=null){i.key=o.key}var s=o.children;if(s&&!Array.isArray(s)){s=[s]}return t(e.tag,i,s)}function k(o){function t(t){return o(t)}t.options={functional:true,render:function t(e,r){var n=x({componentOptions:{Ctor:o,listeners:r.listeners},data:r.data,slots:r.slots(),context:r.parent});var i=o(n,true);if(S(i)){return i.map(function(t){return O(e,t,r)})}return O(e,i,r)}};t.cid="IntactFunctionalComponent";return t}var N=/_ev[A-Z]/;var V=t.prototype.__patch__;var C=function(){function t(){a(this,t)}t.prototype.init=function t(e,r){this.destroyed=true;this._addProps(r);return V(null,r.props.vueVNode,false,false,this.parentDom)};t.prototype.update=function t(e,r){this._addProps(r);return V(e.props.vueVNode,r.props.vueVNode,false,false,this.parentDom)};t.prototype.destroy=function t(e){V(e.props.vueVNode,null)};t.prototype._addProps=function t(e){this.vdt={vNode:e};var r=e.props;var n=r.vueVNode;if(n.elm){n=H(n)}for(var i in r){if(i==="vueVNode")continue;if(N.test(i))continue;if(!n.data)n.data={};var o=n.data;var a=r[i];if(i==="className"){o.staticClass=a;delete o.class}else if(i==="style"){if(o.staticStyle){o.staticStyle=s({},o.staticStyle,a)}else{o.staticStyle=a}}else if(i.substr(0,3)==="ev-"){if(!o.on)o.on={};o.on[i.substr(3)]=a}else{if(!o.attrs)o.attrs={};o.attrs[i]=a}}e.props=s({},r,{vueVNode:n})};return t}();function P(n,t){var i=n.data.ref;if(i){var o=n.context.$refs;t.ref=function(t,e){if(!o)return;if(!e){if(n.data.refInFor){if(!S(o[i])){o[i]=[t]}else if(o[i].indexOf(t)<0){o[i].push(t)}}else{o[i]=t}}else{if(S(o[i])){var r=o[i].indexOf(t);if(~r){o[i].splice(r,1)}}else{o[i]=undefined}}};t.ref.key=i}}function j(t){var e=void 0;var r=t.data;if(r){if(r.staticClass){e=r.staticClass}if(r.class){if(!e){e=E(r.class)}else{e+=" "+E(r.class)}}}return e}function E(t){if(t==null)return"";if(S(t)){return F(t)}if((typeof t==="undefined"?"undefined":n(t))==="object"){return B(t)}if(typeof t==="string"){return t}return""}function F(t){var e="";var r=void 0;for(var n=0;n<t.length;n++){if((r=E(t[n]))!=null&&r!==""){if(e)e+=" ";e+=r}}return e}function B(t){var e="";for(var r in t){if(t[r]){if(e)e+=" ";e+=r}}return e}function q(t){var e=void 0;var r=t.data;if(r){e=D(r.style);if(r.staticStyle){return I(r.staticStyle,e)}}return e}function D(t){if(!t)return t;if(S(t)){return R(t)}if(typeof t==="string"){return z(t)}return t}function R(t){var e={};for(var r=0;r<t.length;r++){if(t[r]){I(e,t[r])}}return e}var U=h(null);function z(t){var e=U[t];if(e)return e;var r={};var n=/;(?![^(]*\))/g;var i=/:(.+)/;t.split(n).forEach(function(t){if(t){var e=t.split(i);e.length>1&&(r[e[0].trim()]=e[1].trim())}});U[t]=r;return r}function W(t){var e=t.data;return e&&(e=e.hook)&&(e=e.init)&&t.componentOptions.Ctor.cid==="IntactVue"}function Z(t){var e={};if(!t){return e}for(var r=0,n=t.length;r<n;r++){var i=t[r];var o=i.data;if(o&&o.attrs&&o.attrs.slot){delete o.attrs.slot}if(o&&o.slot!=null){var a=o.slot;var s=e[a]||(e[a]=[]);if(i.tag==="template"){s.push.apply(s,i.children||[])}else{s.push(i)}}else{(e.default||(e.default=[])).push(i)}}for(var u in e){if(e[u].every(G)){delete e[u]}}return e}function G(t){return t.isComment&&!t.asyncFactory||t.text===" "}function H(t){var e=new _(t.tag,t.data?s({},t.data):t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);e.ns=t.ns;e.isStatic=t.isStatic;e.key=t.key;e.isComment=t.isComment;e.fnContext=t.fnContext;e.fnOptions=t.fnOptions;e.fnScopeId=t.fnScopeId;e.asyncMeta=t.asyncMeta;e.isCloned=true;return e}function J(r){var n=Object.create(null);return function(t){var e=n[t];return e||(n[t]=r(t))}}var K=/-(\w)/g;var L=J(function(t){return t.replace(K,function(t,e){return e?e.toUpperCase():""})});var X=t.prototype;var Y=X.init;var tt=X.$nextTick;var et=X._updateFromParent;var rt=e.utils.extend;var nt=void 0;var it=void 0;var ot=function(s){r(o,s);function o(t){a(this,o);var e=t&&t._parentVnode;if(e){var r=$(e);var n=f(this,s.call(this,r.props));t._renderChildren=true;n.$options=t;n.$vnode=e;n._isVue=true;n.$scopedSlots={$stable:true};n.vNode=r;r.children=n;var i=t.parent;if(i){n.$parent=i;n.$root=i.$root;i.$children.push(n)}n.$children=[];n._data=n.props;n.$refs={};n._uid=n.uniqueId;t.name=n.displayName||n.constructor.name}else{var n=f(this,s.call(this,t))}return f(n)}o.prototype.init=function t(r,n){var i=this;var t=function t(){i.__pushActiveInstance();var e=s.prototype.init.call(i,r,n);i.__popActiveInstance();return e};if(!this._isVue)return t();it=this.mountedQueue;var e=t();return e};o.prototype.update=function t(r,n,i){var o=this;var t=function t(){o.__pushActiveInstance();var e=s.prototype.update.call(o,r,n,i);o.__popActiveInstance();return e};if(!this._isVue)return t();var e=this._shouldTrigger;this.__initMountedQueue();var a=t();this.__triggerMountedQueue();this._shouldTrigger=e;this.$vnode.elm=a;return a};o.prototype.$mount=function t(e,r){var n=this;var i=this._shouldTrigger;this.__initMountedQueue();this.parentVNode=this.vNode.parentVNode=nt&&nt.vNode;this.inited=true;this.$el=this.init(null,this.vNode);this.vNode.dom=this.$el;this._vnode={};var o=this.$options;var a=o._refElm;var s=o._parentElm;if(s){if(a){s.insertBefore(this.$el,a)}else{s.appendChild(this.$el)}}this.$el.__vue__=this;this.mountedQueue.push(function(){n.mount()});this.__triggerMountedQueue();this._shouldTrigger=i};o.prototype.$forceUpdate=function t(){var e=this._shouldTrigger;this.__initMountedQueue();var r=$(this.$vnode);var n=this.vNode;r.children=this;this.vNode=r;this.parentVNode=this.vNode.parentVNode=nt&&nt.vNode;this.$vnode.elm=this.update(n,r);this.$options._renderChildren=true;var i=n.ref;var o=r.ref;if(i!==o&&!(i&&o&&i.key===o.key)){if(i){i(this,true)}if(o){o(this)}}this.__triggerMountedQueue();this._shouldTrigger=e};o.prototype.$destroy=function t(){delete this.$el.__vue__;var e=this.$parent;if(e){var r=e.$children;if(r.length){var n=r.indexOf(this);if(~n){r.splice(n,1)}}}this.destroy()};o.prototype.__initMountedQueue=function t(){this._shouldTrigger=false;if(!it||it.done){this._shouldTrigger=true;if(!this.mountedQueue||this.mountedQueue.done){this._initMountedQueue()}it=this.mountedQueue}else{this.mountedQueue=it}};o.prototype.__triggerMountedQueue=function t(){if(this._shouldTrigger){if(this.mounted){this._triggerMountedQueue()}else{this.$options.mounted=[this._triggerMountedQueue]}it=null;this._shouldTrigger=false}};o.prototype.__pushActiveInstance=function t(){this._prevActiveInstance=nt;nt=this};o.prototype.__popActiveInstance=function t(){nt=this._prevActiveInstance;this._prevActiveInstance=null};o.prototype.$on=function t(){};o.prototype.$off=function t(){};o.prototype.$set=function t(e,r,n){this.set(r,n)};return o}(e);ot.cid="IntactVue";ot.options=rt({},t.options);ot.functionalWrapper=k;ot.normalize=Q;ot.prototype.$nextTick=tt;ot.prototype._updateFromParent=et;if(!Object.setPrototypeOf){rt(ot,e);if(!ot.template){ot.template=e.template}}return ot}); |
{ | ||
"name": "intact-vue", | ||
"version": "0.5.9", | ||
"version": "0.5.10", | ||
"description": "A compatibility layer for running intact component in vue", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -253,2 +253,6 @@ import Vue from 'vue'; | ||
$off() {} | ||
// for vue-devtools | ||
$set(obj, key, value) { | ||
this.set(key, value); | ||
} | ||
} | ||
@@ -255,0 +259,0 @@ |
@@ -8,2 +8,5 @@ import Intact from 'intact/dist'; | ||
const VueVNode = _textVNode.constructor; | ||
const _testData = {}; | ||
const _vm = new Vue({data: _testData}); | ||
const __ob__ = _testData.__ob__; | ||
@@ -109,3 +112,5 @@ // for scoped style | ||
vNode._isVue = true; // let vue don't observe it when it is used as property | ||
// let vue don't observe it when it is used as property, ksc-fe/kpc#500 | ||
// we can not use `vNode._isVue = true`, because it will affect vue-devtools. ksc-fe/kpc#512 | ||
vNode.__ob__ = __ob__; | ||
return vNode; | ||
@@ -112,0 +117,0 @@ } |
104542
2596