diff --git a/README.md b/README.md index 3fcff6cff..52b384df7 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,11 @@ On Android Platform , Weex code is executed in [weex_v8core](https://github.com/ See [SCRIPTS.md](./SCRIPTS.md) for more information. -## IDE Plugin & Syntax Highlight +## IDE Plugin & Syntax Highlight & DevTool -See [Weex Community](https://github.com/alibaba/weex/wiki/Weex-Community) Wiki page +See [Weex Community](https://github.com/alibaba/weex/wiki/Weex-Community) Wiki page + +Weex team have developed a [DevTool](https://github.com/weexteam/weex-devtool) to help you to improve `we file` debug efficiency. ## FAQ diff --git a/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java b/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java index 788e72857..a61d89a0d 100755 --- a/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java @@ -246,8 +246,8 @@ public static void setCurrentWxPageActivity(Activity activity) { @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); - Intent intent = new Intent("requestPermission"); - intent.putExtra("REQUEST_PERMISSION_CODE", requestCode); + Intent intent = new Intent("actionRequestPermissionsResult"); + intent.putExtra("requestCode", requestCode); intent.putExtra("permissions", permissions); intent.putExtra("grantResults", grantResults); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); diff --git a/android/playground/app/src/main/java/com/alibaba/weex/extend/module/GeolocationModule.java b/android/playground/app/src/main/java/com/alibaba/weex/extend/module/GeolocationModule.java index fd1395753..f461ea39a 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/extend/module/GeolocationModule.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/extend/module/GeolocationModule.java @@ -21,6 +21,7 @@ import java.util.Map; /** + * Created by lixinke on 16/9/10. */ public class GeolocationModule extends WXModule implements Destroyable { @@ -31,45 +32,44 @@ public GeolocationModule() { } /** - * Get current location information, the callback only once + * 获取当前位置信息,只回调一次。 * - * @param successCallback success callback function id. - * @param errorCallback error callback function id.(example:no persimmon) - * @param params JSON parameter(example:address). + * @param successCallback 成功回调function id. + * @param errorCallback 错误回调function id.(例如:没有权限) + * @param params JSON格式的参数(例如:准确度等). */ @WXModuleAnno public void getCurrentPosition(String successCallback, String errorCallback, String params) { mILocatable.setWXSDKInstance(mWXSDKInstance); - if (ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { + if (checkPermission()) { mILocatable.getCurrentPosition(successCallback, errorCallback, params); } else { - ActivityCompat.requestPermissions((Activity) mWXSDKInstance.getContext(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, ILocatable.REQUEST_CUR_PERMISSION_CODE); - LocalBroadcastManager.getInstance(mWXSDKInstance.getContext()).registerReceiver(new PerReceiver(mWXSDKInstance.getInstanceId(), mILocatable, successCallback, errorCallback, params), new IntentFilter("requestPermission")); + requestPermission(successCallback, errorCallback, params, ILocatable.REQUEST_CUR_PERMISSION_CODE); } } + /** - * register global location listener,if location change,you will be notify. + * 注册监听全局定位 * - * @param successCallback location success callback function id. - * @param errorCallback location error callback (example:no persimmon). - * @param params JSON parameter(example:address). + * @param successCallback 定位成功回调function id. + * @param errorCallback 错误回调(例如:没有权限等). + * @param params SON格式的参数(例如:准确度等). */ @WXModuleAnno public void watchPosition(String successCallback, String errorCallback, String params) { mILocatable.setWXSDKInstance(mWXSDKInstance); - if (ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { + if (checkPermission()) { mILocatable.watchPosition(successCallback, errorCallback, params); } else { - ActivityCompat.requestPermissions((Activity) mWXSDKInstance.getContext(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, ILocatable.REQUEST_WATCH_PERMISSION_CODE); - LocalBroadcastManager.getInstance(mWXSDKInstance.getContext()).registerReceiver(new PerReceiver(mWXSDKInstance.getInstanceId(), mILocatable, successCallback, errorCallback, params), new IntentFilter("requestPermission")); + requestPermission(successCallback, errorCallback, params, ILocatable.REQUEST_WATCH_PERMISSION_CODE); } } /** - * remove global location listener. + * 注销监听全局定位 * - * @param registerID register id,you can get from watchPosition method。 + * @param registerID 注册时返回的唯一ID。 */ @WXModuleAnno public void clearWatch(String registerID) { @@ -83,6 +83,18 @@ public void destroy() { mILocatable.destroy(); } + private void requestPermission(String successCallback, String errorCallback, String params, int requestCurPermissionCode) { + ActivityCompat.requestPermissions((Activity) mWXSDKInstance.getContext(), + new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, requestCurPermissionCode); + LocalBroadcastManager.getInstance(mWXSDKInstance.getContext()) + .registerReceiver(new PerReceiver(mWXSDKInstance.getInstanceId(), mILocatable, successCallback, errorCallback, params), new IntentFilter("actionRequestPermissionsResult")); + } + + private boolean checkPermission() { + return ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED + && ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED; + } + static class PerReceiver extends BroadcastReceiver { String mInstanceId; diff --git a/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/DefaultLocation.java b/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/DefaultLocation.java index 8188942f8..3cda2663d 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/DefaultLocation.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/DefaultLocation.java @@ -15,6 +15,7 @@ import android.support.v4.app.ActivityCompat; import android.text.TextUtils; +import com.taobao.weex.WXEnvironment; import com.taobao.weex.WXSDKInstance; import com.taobao.weex.WXSDKManager; import com.taobao.weex.utils.WXLogUtils; @@ -56,7 +57,9 @@ public void setWXSDKInstance(WXSDKInstance WXSDKInstance) { @Override public void getCurrentPosition(final String successCallback, final String errorCallback, final String params) { - WXLogUtils.d(TAG, "into--[getCurrentPosition] successCallback:" + successCallback + " \nerrorCallback:" + errorCallback + " \nparams:" + params); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "into--[getCurrentPosition] successCallback:" + successCallback + " \nerrorCallback:" + errorCallback + " \nparams:" + params); + } if (!TextUtils.isEmpty(params)) { try { org.json.JSONObject jsObj = new org.json.JSONObject(params); @@ -78,7 +81,7 @@ public void getCurrentPosition(final String successCallback, final String errorC } private WXLocationListener findLocation(String watchId, String sucCallback, String errorCallback, boolean enableHighAccuracy, boolean enableAddress) { - WXLogUtils.d(TAG, "into--[findLocation] mWatchId:" + watchId + "\nsuccessCallback:" + sucCallback + "\nerrorCallback:" + errorCallback + "\nenableHighAccuracy:" + enableHighAccuracy + "\nmEnableAddress:" + enableAddress); +// WXLogUtils.d(TAG, "into--[findLocation] mWatchId:" + watchId + "\nsuccessCallback:" + sucCallback + "\nerrorCallback:" + errorCallback + "\nenableHighAccuracy:" + enableHighAccuracy + "\nmEnableAddress:" + enableAddress); if (mLocationManager == null) { mLocationManager = (LocationManager) mWXSDKInstance.getContext().getSystemService(Context.LOCATION_SERVICE); @@ -202,7 +205,9 @@ private WXLocationListener(LocationManager locationManager, WXSDKInstance instan @Override public void onLocationChanged(Location location) { mHandler.removeMessages(TIME_OUT_WHAT); - WXLogUtils.d(TAG, "into--[onLocationChanged] location:" + location == null ? "Location is NULL!" : location.toString()); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "into--[onLocationChanged] location:" + location == null ? "Location is NULL!" : location.toString()); + } if (mWXSDKInstance == null || mWXSDKInstance.isDestroy()) { return; @@ -284,7 +289,9 @@ public void onProviderDisabled(String provider) { @Override public boolean handleMessage(Message msg) { if (msg.what == TIME_OUT_WHAT) { - WXLogUtils.d(TAG, "into--[handleMessage] Location Time Out!"); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "into--[handleMessage] Location Time Out!"); + } if (mWXSDKInstance == null || mWXSDKInstance.isDestroy() || mLocationManager == null) { return false; } @@ -307,7 +314,9 @@ public boolean handleMessage(Message msg) { * get address info */ private Address getAddress(double latitude, double longitude) { - WXLogUtils.d(TAG, "into--[getAddress] latitude:" + latitude + " longitude:" + longitude); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "into--[getAddress] latitude:" + latitude + " longitude:" + longitude); + } try { if (mWXSDKInstance == null || mWXSDKInstance.isDestroy()) { return null; diff --git a/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/ILocatable.java b/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/ILocatable.java index 08ba9d13e..cb8875008 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/ILocatable.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/ILocatable.java @@ -10,7 +10,7 @@ public interface ILocatable { int REQUEST_WATCH_PERMISSION_CODE = 0x13; - String REQUEST_PERMISSION_CODE = "REQUEST_PERMISSION_CODE"; + String REQUEST_PERMISSION_CODE = "requestCode"; String ERROR_CODE = "errorCode"; String ERROR_MSG = "errorMsg"; String COORDS = "coords"; diff --git a/android/sdk/assets/main.js b/android/sdk/assets/main.js index f25d16f4b..21ba42b2c 100644 --- a/android/sdk/assets/main.js +++ b/android/sdk/assets/main.js @@ -1,5 +1,7 @@ -(this.nativeLog||function(s){console.log(s)})("START JS FRAMEWORK: 0.15.8 Build 20160909");this.getJSFMVersion=function(){return"0.15.8"};(function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:false};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.loaded=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(0)})([function(module,exports,__webpack_require__){(function(global){"use strict";__webpack_require__(1);var methods=__webpack_require__(116);var _global=global;var registerMethods=_global.registerMethods;registerMethods(methods)}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){"use strict";__webpack_require__(2)},function(module,exports,__webpack_require__){(function(global){"use strict";__webpack_require__(3);var _runtime=__webpack_require__(77);var _runtime2=_interopRequireDefault(_runtime);var _package=__webpack_require__(114);var _methods=__webpack_require__(115);var methods=_interopRequireWildcard(_methods);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var native=_package.subversion.native;var transformer=_package.subversion.transformer;var _loop=function _loop(methodName){global[methodName]=function(){var ret=_runtime2.default[methodName].apply(_runtime2.default,arguments);if(ret instanceof Error){console.error(ret.toString())}return ret}};for(var methodName in _runtime2.default){_loop(methodName)}global.frameworkVersion=native;global.transformerVersion=transformer;global.registerMethods(methods)}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isPlainObject=exports.isObject=exports.toArray=exports.bind=exports.hasOwn=exports.remove=exports.def=exports.extend=undefined;var _utils=__webpack_require__(4);Object.defineProperty(exports,"extend",{enumerable:true,get:function get(){return _utils.extend}});Object.defineProperty(exports,"def",{enumerable:true,get:function get(){return _utils.def}});Object.defineProperty(exports,"remove",{enumerable:true,get:function get(){return _utils.remove}});Object.defineProperty(exports,"hasOwn",{enumerable:true,get:function get(){return _utils.hasOwn}});Object.defineProperty(exports,"bind",{enumerable:true,get:function get(){return _utils.bind}});Object.defineProperty(exports,"toArray",{enumerable:true,get:function get(){return _utils.toArray}});Object.defineProperty(exports,"isObject",{enumerable:true,get:function get(){return _utils.isObject}});Object.defineProperty(exports,"isPlainObject",{enumerable:true,get:function get(){return _utils.isPlainObject}});__webpack_require__(5);__webpack_require__(6);__webpack_require__(70);__webpack_require__(71)},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};exports.extend=extend;exports.def=def;exports.remove=remove;exports.hasOwn=hasOwn;exports.bind=bind;exports.toArray=toArray;exports.isObject=isObject;exports.isPlainObject=isPlainObject;function extend(target){for(var _len=arguments.length,src=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){src[_key-1]=arguments[_key]}if(typeof Object.assign==="function"){Object.assign.apply(Object,[target].concat(src))}else{var first=src.shift();for(var key in first){target[key]=first[key]}if(src.length){extend.apply(undefined,[target].concat(src))}}return target}function def(obj,key,val,enumerable){Object.defineProperty(obj,key,{value:val,enumerable:!!enumerable,writable:true,configurable:true})}function remove(arr,item){if(arr.length){var index=arr.indexOf(item);if(index>-1){return arr.splice(index,1)}}}var hasOwnProperty=Object.prototype.hasOwnProperty;function hasOwn(obj,key){return hasOwnProperty.call(obj,key)}function bind(fn,ctx){return function(a){var l=arguments.length;return l?l>1?fn.apply(ctx,arguments):fn.call(ctx,a):fn.call(ctx)}}function toArray(list,start){start=start||0;var i=list.length-start;var ret=new Array(i);while(i--){ret[i]=list[i+start]}return ret}function isObject(obj){return obj!==null&&(typeof obj==="undefined"?"undefined":_typeof(obj))==="object"}var toString=Object.prototype.toString;var OBJECT_STRING="[object Object]";function isPlainObject(obj){return toString.call(obj)===OBJECT_STRING}},function(module,exports){(function(global){"use strict";var _global=global;var setTimeout=_global.setTimeout;var setTimeoutNative=_global.setTimeoutNative;if(typeof setTimeout==="undefined"&&typeof setTimeoutNative==="function"){(function(){var timeoutMap={};var timeoutId=0;global.setTimeout=function(cb,time){timeoutMap[++timeoutId]=cb;setTimeoutNative(timeoutId.toString(),time)};global.setTimeoutCallback=function(id){if(typeof timeoutMap[id]==="function"){timeoutMap[id]();delete timeoutMap[id]}}})()}}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){(function(global){"use strict";var _global=global;var WXEnvironment=_global.WXEnvironment;if(WXEnvironment&&WXEnvironment.platform==="iOS"){global.Promise=null}__webpack_require__(7);__webpack_require__(27);__webpack_require__(53);__webpack_require__(57)}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){"use strict";var classof=__webpack_require__(8),test={};test[__webpack_require__(10)("toStringTag")]="z";if(test+""!="[object z]"){__webpack_require__(14)(Object.prototype,"toString",function toString(){return"[object "+classof(this)+"]"},true)}},function(module,exports,__webpack_require__){"use strict";var cof=__webpack_require__(9),TAG=__webpack_require__(10)("toStringTag"),ARG=cof(function(){return arguments}())=="Arguments";var tryGet=function tryGet(it,key){try{return it[key]}catch(e){}};module.exports=function(it){var O,T,B;return it===undefined?"Undefined":it===null?"Null":typeof(T=tryGet(O=Object(it),TAG))=="string"?T:ARG?cof(O):(B=cof(O))=="Object"&&typeof O.callee=="function"?"Arguments":B}},function(module,exports){"use strict";var toString={}.toString;module.exports=function(it){return toString.call(it).slice(8,-1)}},function(module,exports,__webpack_require__){"use strict";var store=__webpack_require__(11)("wks"),uid=__webpack_require__(13),_Symbol=__webpack_require__(12).Symbol,USE_SYMBOL=typeof _Symbol=="function";var $exports=module.exports=function(name){return store[name]||(store[name]=USE_SYMBOL&&_Symbol[name]||(USE_SYMBOL?_Symbol:uid)("Symbol."+name))};$exports.store=store},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(12),SHARED="__core-js_shared__",store=global[SHARED]||(global[SHARED]={});module.exports=function(key){return store[key]||(store[key]={})}},function(module,exports){"use strict";var global=module.exports=typeof window!="undefined"&&window.Math==Math?window:typeof self!="undefined"&&self.Math==Math?self:Function("return this")();if(typeof __g=="number")__g=global},function(module,exports){"use strict";var id=0,px=Math.random();module.exports=function(key){return"Symbol(".concat(key===undefined?"":key,")_",(++id+px).toString(36))}},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(12),hide=__webpack_require__(15),has=__webpack_require__(25),SRC=__webpack_require__(13)("src"),TO_STRING="toString",$toString=Function[TO_STRING],TPL=(""+$toString).split(TO_STRING);__webpack_require__(26).inspectSource=function(it){return $toString.call(it)};(module.exports=function(O,key,val,safe){var isFunction=typeof val=="function";if(isFunction)has(val,"name")||hide(val,"name",key);if(O[key]===val)return;if(isFunction)has(val,SRC)||hide(val,SRC,O[key]?""+O[key]:TPL.join(String(key)));if(O===global){O[key]=val}else{if(!safe){delete O[key];hide(O,key,val)}else{if(O[key])O[key]=val;else hide(O,key,val)}}})(Function.prototype,TO_STRING,function toString(){return typeof this=="function"&&this[SRC]||$toString.call(this)})},function(module,exports,__webpack_require__){"use strict";var dP=__webpack_require__(16),createDesc=__webpack_require__(24);module.exports=__webpack_require__(20)?function(object,key,value){return dP.f(object,key,createDesc(1,value))}:function(object,key,value){object[key]=value;return object}},function(module,exports,__webpack_require__){"use strict";var anObject=__webpack_require__(17),IE8_DOM_DEFINE=__webpack_require__(19),toPrimitive=__webpack_require__(23),dP=Object.defineProperty;exports.f=__webpack_require__(20)?Object.defineProperty:function defineProperty(O,P,Attributes){anObject(O);P=toPrimitive(P,true);anObject(Attributes);if(IE8_DOM_DEFINE)try{return dP(O,P,Attributes)}catch(e){}if("get"in Attributes||"set"in Attributes)throw TypeError("Accessors not supported!");if("value"in Attributes)O[P]=Attributes.value;return O}},function(module,exports,__webpack_require__){"use strict";var isObject=__webpack_require__(18);module.exports=function(it){if(!isObject(it))throw TypeError(it+" is not an object!");return it}},function(module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};module.exports=function(it){return(typeof it==="undefined"?"undefined":_typeof(it))==="object"?it!==null:typeof it==="function"}},function(module,exports,__webpack_require__){"use strict";module.exports=!__webpack_require__(20)&&!__webpack_require__(21)(function(){return Object.defineProperty(__webpack_require__(22)("div"),"a",{get:function get(){return 7}}).a!=7})},function(module,exports,__webpack_require__){"use strict";module.exports=!__webpack_require__(21)(function(){return Object.defineProperty({},"a",{get:function get(){return 7}}).a!=7})},function(module,exports){"use strict";module.exports=function(exec){try{return!!exec()}catch(e){return true}}},function(module,exports,__webpack_require__){"use strict";var isObject=__webpack_require__(18),document=__webpack_require__(12).document,is=isObject(document)&&isObject(document.createElement);module.exports=function(it){return is?document.createElement(it):{}}},function(module,exports,__webpack_require__){"use strict";var isObject=__webpack_require__(18);module.exports=function(it,S){if(!isObject(it))return it;var fn,val;if(S&&typeof(fn=it.toString)=="function"&&!isObject(val=fn.call(it)))return val;if(typeof(fn=it.valueOf)=="function"&&!isObject(val=fn.call(it)))return val;if(!S&&typeof(fn=it.toString)=="function"&&!isObject(val=fn.call(it)))return val;throw TypeError("Can't convert object to primitive value")}},function(module,exports){"use strict";module.exports=function(bitmap,value){return{enumerable:!(bitmap&1),configurable:!(bitmap&2),writable:!(bitmap&4),value:value}}},function(module,exports){"use strict";var hasOwnProperty={}.hasOwnProperty;module.exports=function(it,key){return hasOwnProperty.call(it,key)}},function(module,exports){"use strict";var core=module.exports={version:"2.4.0"};if(typeof __e=="number")__e=core},function(module,exports,__webpack_require__){"use strict";var $at=__webpack_require__(28)(true);__webpack_require__(31)(String,"String",function(iterated){this._t=String(iterated);this._i=0},function(){var O=this._t,index=this._i,point;if(index>=O.length)return{value:undefined,done:true};point=$at(O,index);this._i+=point.length;return{value:point,done:false}})},function(module,exports,__webpack_require__){"use strict";var toInteger=__webpack_require__(29),defined=__webpack_require__(30);module.exports=function(TO_STRING){return function(that,pos){var s=String(defined(that)),i=toInteger(pos),l=s.length,a,b;if(i<0||i>=l)return TO_STRING?"":undefined;a=s.charCodeAt(i);return a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?TO_STRING?s.charAt(i):a:TO_STRING?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536}}},function(module,exports){"use strict";var ceil=Math.ceil,floor=Math.floor;module.exports=function(it){return isNaN(it=+it)?0:(it>0?floor:ceil)(it)}},function(module,exports){"use strict";module.exports=function(it){if(it==undefined)throw TypeError("Can't call method on "+it);return it}},function(module,exports,__webpack_require__){"use strict";var LIBRARY=__webpack_require__(32),$export=__webpack_require__(33),redefine=__webpack_require__(14),hide=__webpack_require__(15),has=__webpack_require__(25),Iterators=__webpack_require__(36),$iterCreate=__webpack_require__(37),setToStringTag=__webpack_require__(50),getPrototypeOf=__webpack_require__(51),ITERATOR=__webpack_require__(10)("iterator"),BUGGY=!([].keys&&"next"in[].keys()),FF_ITERATOR="@@iterator",KEYS="keys",VALUES="values";var returnThis=function returnThis(){return this};module.exports=function(Base,NAME,Constructor,next,DEFAULT,IS_SET,FORCED){$iterCreate(Constructor,NAME,next);var getMethod=function getMethod(kind){if(!BUGGY&&kind in proto)return proto[kind];switch(kind){case KEYS:return function keys(){return new Constructor(this,kind)};case VALUES:return function values(){return new Constructor(this,kind)}}return function entries(){return new Constructor(this,kind)}};var TAG=NAME+" Iterator",DEF_VALUES=DEFAULT==VALUES,VALUES_BUG=false,proto=Base.prototype,$native=proto[ITERATOR]||proto[FF_ITERATOR]||DEFAULT&&proto[DEFAULT],$default=$native||getMethod(DEFAULT),$entries=DEFAULT?!DEF_VALUES?$default:getMethod("entries"):undefined,$anyNative=NAME=="Array"?proto.entries||$native:$native,methods,key,IteratorPrototype;if($anyNative){IteratorPrototype=getPrototypeOf($anyNative.call(new Base));if(IteratorPrototype!==Object.prototype){setToStringTag(IteratorPrototype,TAG,true);if(!LIBRARY&&!has(IteratorPrototype,ITERATOR))hide(IteratorPrototype,ITERATOR,returnThis)}}if(DEF_VALUES&&$native&&$native.name!==VALUES){VALUES_BUG=true;$default=function values(){return $native.call(this)}}if((!LIBRARY||FORCED)&&(BUGGY||VALUES_BUG||!proto[ITERATOR])){hide(proto,ITERATOR,$default)}Iterators[NAME]=$default;Iterators[TAG]=returnThis;if(DEFAULT){methods={values:DEF_VALUES?$default:getMethod(VALUES),keys:IS_SET?$default:getMethod(KEYS),entries:$entries};if(FORCED)for(key in methods){if(!(key in proto))redefine(proto,key,methods[key])}else $export($export.P+$export.F*(BUGGY||VALUES_BUG),NAME,methods)}return methods}},function(module,exports){"use strict";module.exports=false},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(12),core=__webpack_require__(26),hide=__webpack_require__(15),redefine=__webpack_require__(14),ctx=__webpack_require__(34),PROTOTYPE="prototype";var $export=function $export(type,name,source){var IS_FORCED=type&$export.F,IS_GLOBAL=type&$export.G,IS_STATIC=type&$export.S,IS_PROTO=type&$export.P,IS_BIND=type&$export.B,target=IS_GLOBAL?global:IS_STATIC?global[name]||(global[name]={}):(global[name]||{})[PROTOTYPE],exports=IS_GLOBAL?core:core[name]||(core[name]={}),expProto=exports[PROTOTYPE]||(exports[PROTOTYPE]={}),key,own,out,exp;if(IS_GLOBAL)source=name;for(key in source){own=!IS_FORCED&&target&&target[key]!==undefined;out=(own?target:source)[key];exp=IS_BIND&&own?ctx(out,global):IS_PROTO&&typeof out=="function"?ctx(Function.call,out):out;if(target)redefine(target,key,out,type&$export.U);if(exports[key]!=out)hide(exports,key,exp);if(IS_PROTO&&expProto[key]!=out)expProto[key]=out}};global.core=core;$export.F=1;$export.G=2;$export.S=4;$export.P=8;$export.B=16;$export.W=32;$export.U=64;$export.R=128;module.exports=$export},function(module,exports,__webpack_require__){"use strict";var aFunction=__webpack_require__(35);module.exports=function(fn,that,length){aFunction(fn);if(that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}},function(module,exports){"use strict";module.exports=function(it){if(typeof it!="function")throw TypeError(it+" is not a function!");return it}},function(module,exports){"use strict";module.exports={}},function(module,exports,__webpack_require__){"use strict";var create=__webpack_require__(38),descriptor=__webpack_require__(24),setToStringTag=__webpack_require__(50),IteratorPrototype={};__webpack_require__(15)(IteratorPrototype,__webpack_require__(10)("iterator"),function(){return this});module.exports=function(Constructor,NAME,next){Constructor.prototype=create(IteratorPrototype,{next:descriptor(1,next)});setToStringTag(Constructor,NAME+" Iterator")}},function(module,exports,__webpack_require__){"use strict";var anObject=__webpack_require__(17),dPs=__webpack_require__(39),enumBugKeys=__webpack_require__(48),IE_PROTO=__webpack_require__(47)("IE_PROTO"),Empty=function Empty(){},PROTOTYPE="prototype";var _createDict=function createDict(){var iframe=__webpack_require__(22)("iframe"),i=enumBugKeys.length,lt="<",gt=">",iframeDocument;iframe.style.display="none";__webpack_require__(49).appendChild(iframe);iframe.src="javascript:";iframeDocument=iframe.contentWindow.document;iframeDocument.open();iframeDocument.write(lt+"script"+gt+"document.F=Object"+lt+"/script"+gt);iframeDocument.close();_createDict=iframeDocument.F;while(i--){delete _createDict[PROTOTYPE][enumBugKeys[i]]}return _createDict()};module.exports=Object.create||function create(O,Properties){var result;if(O!==null){Empty[PROTOTYPE]=anObject(O);result=new Empty;Empty[PROTOTYPE]=null;result[IE_PROTO]=O}else result=_createDict();return Properties===undefined?result:dPs(result,Properties)}},function(module,exports,__webpack_require__){"use strict";var dP=__webpack_require__(16),anObject=__webpack_require__(17),getKeys=__webpack_require__(40);module.exports=__webpack_require__(20)?Object.defineProperties:function defineProperties(O,Properties){anObject(O);var keys=getKeys(Properties),length=keys.length,i=0,P;while(length>i){dP.f(O,P=keys[i++],Properties[P])}return O}},function(module,exports,__webpack_require__){"use strict";var $keys=__webpack_require__(41),enumBugKeys=__webpack_require__(48);module.exports=Object.keys||function keys(O){return $keys(O,enumBugKeys)}},function(module,exports,__webpack_require__){"use strict";var has=__webpack_require__(25),toIObject=__webpack_require__(42),arrayIndexOf=__webpack_require__(44)(false),IE_PROTO=__webpack_require__(47)("IE_PROTO");module.exports=function(object,names){var O=toIObject(object),i=0,result=[],key;for(key in O){if(key!=IE_PROTO)has(O,key)&&result.push(key)}while(names.length>i){if(has(O,key=names[i++])){~arrayIndexOf(result,key)||result.push(key)}}return result}},function(module,exports,__webpack_require__){"use strict";var IObject=__webpack_require__(43),defined=__webpack_require__(30);module.exports=function(it){return IObject(defined(it))}},function(module,exports,__webpack_require__){"use strict";var cof=__webpack_require__(9);module.exports=Object("z").propertyIsEnumerable(0)?Object:function(it){return cof(it)=="String"?it.split(""):Object(it)}},function(module,exports,__webpack_require__){"use strict";var toIObject=__webpack_require__(42),toLength=__webpack_require__(45),toIndex=__webpack_require__(46);module.exports=function(IS_INCLUDES){return function($this,el,fromIndex){var O=toIObject($this),length=toLength(O.length),index=toIndex(fromIndex,length),value;if(IS_INCLUDES&&el!=el)while(length>index){value=O[index++];if(value!=value)return true}else for(;length>index;index++){if(IS_INCLUDES||index in O){if(O[index]===el)return IS_INCLUDES||index||0}}return!IS_INCLUDES&&-1}}},function(module,exports,__webpack_require__){"use strict";var toInteger=__webpack_require__(29),min=Math.min;module.exports=function(it){return it>0?min(toInteger(it),9007199254740991):0}},function(module,exports,__webpack_require__){"use strict";var toInteger=__webpack_require__(29),max=Math.max,min=Math.min;module.exports=function(index,length){index=toInteger(index);return index<0?max(index+length,0):min(index,length)}},function(module,exports,__webpack_require__){"use strict";var shared=__webpack_require__(11)("keys"),uid=__webpack_require__(13);module.exports=function(key){return shared[key]||(shared[key]=uid(key))}},function(module,exports){"use strict";module.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(module,exports,__webpack_require__){"use strict";module.exports=__webpack_require__(12).document&&document.documentElement},function(module,exports,__webpack_require__){"use strict";var def=__webpack_require__(16).f,has=__webpack_require__(25),TAG=__webpack_require__(10)("toStringTag");module.exports=function(it,tag,stat){if(it&&!has(it=stat?it:it.prototype,TAG))def(it,TAG,{configurable:true,value:tag})}},function(module,exports,__webpack_require__){"use strict";var has=__webpack_require__(25),toObject=__webpack_require__(52),IE_PROTO=__webpack_require__(47)("IE_PROTO"),ObjectProto=Object.prototype;module.exports=Object.getPrototypeOf||function(O){O=toObject(O);if(has(O,IE_PROTO))return O[IE_PROTO];if(typeof O.constructor=="function"&&O instanceof O.constructor){return O.constructor.prototype}return O instanceof Object?ObjectProto:null}},function(module,exports,__webpack_require__){"use strict";var defined=__webpack_require__(30);module.exports=function(it){return Object(defined(it))}},function(module,exports,__webpack_require__){"use strict";var $iterators=__webpack_require__(54),redefine=__webpack_require__(14),global=__webpack_require__(12),hide=__webpack_require__(15),Iterators=__webpack_require__(36),wks=__webpack_require__(10),ITERATOR=wks("iterator"),TO_STRING_TAG=wks("toStringTag"),ArrayValues=Iterators.Array;for(var collections=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],i=0;i<5;i++){var NAME=collections[i],Collection=global[NAME],proto=Collection&&Collection.prototype,key;if(proto){if(!proto[ITERATOR])hide(proto,ITERATOR,ArrayValues);if(!proto[TO_STRING_TAG])hide(proto,TO_STRING_TAG,NAME);Iterators[NAME]=ArrayValues;for(key in $iterators){if(!proto[key])redefine(proto,key,$iterators[key],true)}}}},function(module,exports,__webpack_require__){"use strict";var addToUnscopables=__webpack_require__(55),step=__webpack_require__(56),Iterators=__webpack_require__(36),toIObject=__webpack_require__(42);module.exports=__webpack_require__(31)(Array,"Array",function(iterated,kind){this._t=toIObject(iterated);this._i=0;this._k=kind},function(){var O=this._t,kind=this._k,index=this._i++;if(!O||index>=O.length){this._t=undefined;return step(1)}if(kind=="keys")return step(0,index);if(kind=="values")return step(0,O[index]);return step(0,[index,O[index]])},"values");Iterators.Arguments=Iterators.Array;addToUnscopables("keys");addToUnscopables("values");addToUnscopables("entries")},function(module,exports,__webpack_require__){"use strict";var UNSCOPABLES=__webpack_require__(10)("unscopables"),ArrayProto=Array.prototype;if(ArrayProto[UNSCOPABLES]==undefined)__webpack_require__(15)(ArrayProto,UNSCOPABLES,{});module.exports=function(key){ArrayProto[UNSCOPABLES][key]=true}},function(module,exports){"use strict";module.exports=function(done,value){return{value:value,done:!!done}}},function(module,exports,__webpack_require__){"use strict";var LIBRARY=__webpack_require__(32),global=__webpack_require__(12),ctx=__webpack_require__(34),classof=__webpack_require__(8),$export=__webpack_require__(33),isObject=__webpack_require__(18),aFunction=__webpack_require__(35),anInstance=__webpack_require__(58),forOf=__webpack_require__(59),speciesConstructor=__webpack_require__(63),task=__webpack_require__(64).set,microtask=__webpack_require__(66)(),PROMISE="Promise",TypeError=global.TypeError,process=global.process,$Promise=global[PROMISE],process=global.process,isNode=classof(process)=="process",empty=function empty(){},Internal,GenericPromiseCapability,Wrapper;var USE_NATIVE=!!function(){try{var promise=$Promise.resolve(1),FakePromise=(promise.constructor={})[__webpack_require__(10)("species")]=function(exec){exec(empty,empty)};return(isNode||typeof PromiseRejectionEvent=="function")&&promise.then(empty)instanceof FakePromise}catch(e){}}();var sameConstructor=function sameConstructor(a,b){return a===b||a===$Promise&&b===Wrapper};var isThenable=function isThenable(it){var then;return isObject(it)&&typeof(then=it.then)=="function"?then:false};var newPromiseCapability=function newPromiseCapability(C){return sameConstructor($Promise,C)?new PromiseCapability(C):new GenericPromiseCapability(C)};var PromiseCapability=GenericPromiseCapability=function GenericPromiseCapability(C){var resolve,reject;this.promise=new C(function($$resolve,$$reject){if(resolve!==undefined||reject!==undefined)throw TypeError("Bad Promise constructor");resolve=$$resolve;reject=$$reject});this.resolve=aFunction(resolve);this.reject=aFunction(reject)};var perform=function perform(exec){try{exec()}catch(e){return{error:e}}};var notify=function notify(promise,isReject){if(promise._n)return;promise._n=true;var chain=promise._c;microtask(function(){var value=promise._v,ok=promise._s==1,i=0;var run=function run(reaction){var handler=ok?reaction.ok:reaction.fail,resolve=reaction.resolve,reject=reaction.reject,domain=reaction.domain,result,then;try{if(handler){if(!ok){if(promise._h==2)onHandleUnhandled(promise);promise._h=1}if(handler===true)result=value;else{if(domain)domain.enter();result=handler(value);if(domain)domain.exit()}if(result===reaction.promise){reject(TypeError("Promise-chain cycle"))}else if(then=isThenable(result)){then.call(result,resolve,reject)}else resolve(result)}else reject(value)}catch(e){reject(e)}};while(chain.length>i){run(chain[i++])}promise._c=[];promise._n=false;if(isReject&&!promise._h)onUnhandled(promise)})};var onUnhandled=function onUnhandled(promise){task.call(global,function(){var value=promise._v,abrupt,handler,console;if(isUnhandled(promise)){abrupt=perform(function(){if(isNode){process.emit("unhandledRejection",value,promise)}else if(handler=global.onunhandledrejection){handler({promise:promise,reason:value})}else if((console=global.console)&&console.error){console.error("Unhandled promise rejection",value)}});promise._h=isNode||isUnhandled(promise)?2:1}promise._a=undefined;if(abrupt)throw abrupt.error})};var isUnhandled=function isUnhandled(promise){if(promise._h==1)return false;var chain=promise._a||promise._c,i=0,reaction;while(chain.length>i){reaction=chain[i++];if(reaction.fail||!isUnhandled(reaction.promise))return false}return true};var onHandleUnhandled=function onHandleUnhandled(promise){task.call(global,function(){var handler;if(isNode){process.emit("rejectionHandled",promise)}else if(handler=global.onrejectionhandled){handler({promise:promise,reason:promise._v})}})};var $reject=function $reject(value){var promise=this;if(promise._d)return;promise._d=true;promise=promise._w||promise;promise._v=value;promise._s=2;if(!promise._a)promise._a=promise._c.slice();notify(promise,true)};var $resolve=function $resolve(value){var promise=this,then;if(promise._d)return;promise._d=true;promise=promise._w||promise;try{if(promise===value)throw TypeError("Promise can't be resolved itself");if(then=isThenable(value)){microtask(function(){var wrapper={_w:promise,_d:false};try{then.call(value,ctx($resolve,wrapper,1),ctx($reject,wrapper,1))}catch(e){$reject.call(wrapper,e)}})}else{promise._v=value;promise._s=1;notify(promise,false)}}catch(e){$reject.call({_w:promise,_d:false},e)}};if(!USE_NATIVE){$Promise=function Promise(executor){anInstance(this,$Promise,PROMISE,"_h");aFunction(executor);Internal.call(this);try{executor(ctx($resolve,this,1),ctx($reject,this,1))}catch(err){$reject.call(this,err)}};Internal=function Promise(executor){this._c=[];this._a=undefined;this._s=0;this._d=false;this._v=undefined;this._h=0;this._n=false};Internal.prototype=__webpack_require__(67)($Promise.prototype,{then:function then(onFulfilled,onRejected){var reaction=newPromiseCapability(speciesConstructor(this,$Promise));reaction.ok=typeof onFulfilled=="function"?onFulfilled:true;reaction.fail=typeof onRejected=="function"&&onRejected;reaction.domain=isNode?process.domain:undefined;this._c.push(reaction);if(this._a)this._a.push(reaction);if(this._s)notify(this,false);return reaction.promise},catch:function _catch(onRejected){return this.then(undefined,onRejected)}});PromiseCapability=function PromiseCapability(){var promise=new Internal;this.promise=promise;this.resolve=ctx($resolve,promise,1);this.reject=ctx($reject,promise,1)}}$export($export.G+$export.W+$export.F*!USE_NATIVE,{Promise:$Promise});__webpack_require__(50)($Promise,PROMISE);__webpack_require__(68)(PROMISE);Wrapper=__webpack_require__(26)[PROMISE];$export($export.S+$export.F*!USE_NATIVE,PROMISE,{reject:function reject(r){var capability=newPromiseCapability(this),$$reject=capability.reject;$$reject(r);return capability.promise}});$export($export.S+$export.F*(LIBRARY||!USE_NATIVE),PROMISE,{resolve:function resolve(x){if(x instanceof $Promise&&sameConstructor(x.constructor,this))return x;var capability=newPromiseCapability(this),$$resolve=capability.resolve;$$resolve(x);return capability.promise}});$export($export.S+$export.F*!(USE_NATIVE&&__webpack_require__(69)(function(iter){$Promise.all(iter)["catch"](empty)})),PROMISE,{all:function all(iterable){var C=this,capability=newPromiseCapability(C),resolve=capability.resolve,reject=capability.reject;var abrupt=perform(function(){var values=[],index=0,remaining=1;forOf(iterable,false,function(promise){var $index=index++,alreadyCalled=false;values.push(undefined);remaining++;C.resolve(promise).then(function(value){if(alreadyCalled)return;alreadyCalled=true;values[$index]=value;--remaining||resolve(values)},reject)});--remaining||resolve(values)});if(abrupt)reject(abrupt.error);return capability.promise},race:function race(iterable){var C=this,capability=newPromiseCapability(C),reject=capability.reject;var abrupt=perform(function(){forOf(iterable,false,function(promise){C.resolve(promise).then(capability.resolve,reject)})});if(abrupt)reject(abrupt.error);return capability.promise}})},function(module,exports){"use strict";module.exports=function(it,Constructor,name,forbiddenField){if(!(it instanceof Constructor)||forbiddenField!==undefined&&forbiddenField in it){throw TypeError(name+": incorrect invocation!")}return it}},function(module,exports,__webpack_require__){"use strict";var ctx=__webpack_require__(34),call=__webpack_require__(60),isArrayIter=__webpack_require__(61),anObject=__webpack_require__(17),toLength=__webpack_require__(45),getIterFn=__webpack_require__(62),BREAK={},RETURN={};var _exports=module.exports=function(iterable,entries,fn,that,ITERATOR){var iterFn=ITERATOR?function(){return iterable}:getIterFn(iterable),f=ctx(fn,that,entries?2:1),index=0,length,step,iterator,result;if(typeof iterFn!="function")throw TypeError(iterable+" is not iterable!");if(isArrayIter(iterFn))for(length=toLength(iterable.length);length>index;index++){result=entries?f(anObject(step=iterable[index])[0],step[1]):f(iterable[index]);if(result===BREAK||result===RETURN)return result}else for(iterator=iterFn.call(iterable);!(step=iterator.next()).done;){result=call(iterator,f,step.value,entries);if(result===BREAK||result===RETURN)return result}};_exports.BREAK=BREAK;_exports.RETURN=RETURN},function(module,exports,__webpack_require__){"use strict";var anObject=__webpack_require__(17); -module.exports=function(iterator,fn,value,entries){try{return entries?fn(anObject(value)[0],value[1]):fn(value)}catch(e){var ret=iterator["return"];if(ret!==undefined)anObject(ret.call(iterator));throw e}}},function(module,exports,__webpack_require__){"use strict";var Iterators=__webpack_require__(36),ITERATOR=__webpack_require__(10)("iterator"),ArrayProto=Array.prototype;module.exports=function(it){return it!==undefined&&(Iterators.Array===it||ArrayProto[ITERATOR]===it)}},function(module,exports,__webpack_require__){"use strict";var classof=__webpack_require__(8),ITERATOR=__webpack_require__(10)("iterator"),Iterators=__webpack_require__(36);module.exports=__webpack_require__(26).getIteratorMethod=function(it){if(it!=undefined)return it[ITERATOR]||it["@@iterator"]||Iterators[classof(it)]}},function(module,exports,__webpack_require__){"use strict";var anObject=__webpack_require__(17),aFunction=__webpack_require__(35),SPECIES=__webpack_require__(10)("species");module.exports=function(O,D){var C=anObject(O).constructor,S;return C===undefined||(S=anObject(C)[SPECIES])==undefined?D:aFunction(S)}},function(module,exports,__webpack_require__){"use strict";var ctx=__webpack_require__(34),invoke=__webpack_require__(65),html=__webpack_require__(49),cel=__webpack_require__(22),global=__webpack_require__(12),process=global.process,setTask=global.setImmediate,clearTask=global.clearImmediate,MessageChannel=global.MessageChannel,counter=0,queue={},ONREADYSTATECHANGE="onreadystatechange",defer,channel,port;var run=function run(){var id=+this;if(queue.hasOwnProperty(id)){var fn=queue[id];delete queue[id];fn()}};var listener=function listener(event){run.call(event.data)};if(!setTask||!clearTask){setTask=function setImmediate(fn){var args=[],i=1;while(arguments.length>i){args.push(arguments[i++])}queue[++counter]=function(){invoke(typeof fn=="function"?fn:Function(fn),args)};defer(counter);return counter};clearTask=function clearImmediate(id){delete queue[id]};if(__webpack_require__(9)(process)=="process"){defer=function defer(id){process.nextTick(ctx(run,id,1))}}else if(MessageChannel){channel=new MessageChannel;port=channel.port2;channel.port1.onmessage=listener;defer=ctx(port.postMessage,port,1)}else if(global.addEventListener&&typeof postMessage=="function"&&!global.importScripts){defer=function defer(id){global.postMessage(id+"","*")};global.addEventListener("message",listener,false)}else if(ONREADYSTATECHANGE in cel("script")){defer=function defer(id){html.appendChild(cel("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this);run.call(id)}}}else{defer=function defer(id){setTimeout(ctx(run,id,1),0)}}}module.exports={set:setTask,clear:clearTask}},function(module,exports){"use strict";module.exports=function(fn,args,that){var un=that===undefined;switch(args.length){case 0:return un?fn():fn.call(that);case 1:return un?fn(args[0]):fn.call(that,args[0]);case 2:return un?fn(args[0],args[1]):fn.call(that,args[0],args[1]);case 3:return un?fn(args[0],args[1],args[2]):fn.call(that,args[0],args[1],args[2]);case 4:return un?fn(args[0],args[1],args[2],args[3]):fn.call(that,args[0],args[1],args[2],args[3])}return fn.apply(that,args)}},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(12),macrotask=__webpack_require__(64).set,Observer=global.MutationObserver||global.WebKitMutationObserver,process=global.process,Promise=global.Promise,isNode=__webpack_require__(9)(process)=="process";module.exports=function(){var head,last,notify;var flush=function flush(){var parent,fn;if(isNode&&(parent=process.domain))parent.exit();while(head){fn=head.fn;head=head.next;try{fn()}catch(e){if(head)notify();else last=undefined;throw e}}last=undefined;if(parent)parent.enter()};if(isNode){notify=function notify(){process.nextTick(flush)}}else if(Observer){var toggle=true,node=document.createTextNode("");new Observer(flush).observe(node,{characterData:true});notify=function notify(){node.data=toggle=!toggle}}else if(Promise&&Promise.resolve){var promise=Promise.resolve();notify=function notify(){promise.then(flush)}}else{notify=function notify(){macrotask.call(global,flush)}}return function(fn){var task={fn:fn,next:undefined};if(last)last.next=task;if(!head){head=task;notify()}last=task}}},function(module,exports,__webpack_require__){"use strict";var redefine=__webpack_require__(14);module.exports=function(target,src,safe){for(var key in src){redefine(target,key,src[key],safe)}return target}},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(12),dP=__webpack_require__(16),DESCRIPTORS=__webpack_require__(20),SPECIES=__webpack_require__(10)("species");module.exports=function(KEY){var C=global[KEY];if(DESCRIPTORS&&C&&!C[SPECIES])dP.f(C,SPECIES,{configurable:true,get:function get(){return this}})}},function(module,exports,__webpack_require__){"use strict";var ITERATOR=__webpack_require__(10)("iterator"),SAFE_CLOSING=false;try{var riter=[7][ITERATOR]();riter["return"]=function(){SAFE_CLOSING=true};Array.from(riter,function(){throw 2})}catch(e){}module.exports=function(exec,skipClosing){if(!skipClosing&&!SAFE_CLOSING)return false;var safe=false;try{var arr=[7],iter=arr[ITERATOR]();iter.next=function(){return{done:safe=true}};arr[ITERATOR]=function(){return iter};exec(arr)}catch(e){}return safe}},function(module,exports){(function(global){"use strict";function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);iindex){var S=IObject(arguments[index++]),keys=getSymbols?getKeys(S).concat(getSymbols(S)):getKeys(S),length=keys.length,j=0,key;while(length>j){if(isEnum.call(S,key=keys[j++]))T[key]=S[key]}}return T}:$assign},function(module,exports){"use strict";exports.f=Object.getOwnPropertySymbols},function(module,exports){"use strict";exports.f={}.propertyIsEnumerable},function(module,exports,__webpack_require__){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _vdom=__webpack_require__(78);var _listener=__webpack_require__(79);var _listener2=_interopRequireDefault(_listener);var _config=__webpack_require__(80);var _config2=_interopRequireDefault(_config);var _init=__webpack_require__(113);var _init2=_interopRequireDefault(_init);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var config={Document:_vdom.Document,Element:_vdom.Element,Comment:_vdom.Comment,Listener:_listener2.default,frameworks:_config2.default,sendTasks:function sendTasks(){var _global;return(_global=global).callNative.apply(_global,arguments)}};var methods=(0,_init2.default)(config);exports.default=methods}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.instanceMap=undefined;var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"])_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr)){return arr}else if(Symbol.iterator in Object(arr)){return sliceIterator(arr,i)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();exports.Document=Document;exports.Node=Node;exports.Element=Element;exports.Comment=Comment;var _utils=__webpack_require__(4);var DEFAULT_TAG_NAME="div";var instanceMap=exports.instanceMap={};var nextNodeRef=1;function Document(id,url,handler,Listener){id=id?id.toString():"";this.id=id;this.URL=url;instanceMap[id]=this;this.nodeMap={};Listener&&(this.listener=new Listener(id,handler||genCallTasks(id)));this.createDocumentElement()}function genCallTasks(id){return function(tasks){if(!Array.isArray(tasks)){tasks=[tasks]}tasks.forEach(function(task){if(task.module==="dom"&&task.method==="addElement"){var _task$args=_slicedToArray(task.args,3);var ref=_task$args[0];var json=_task$args[1];var index=_task$args[2];callAddElement(id,ref,json,index,"-1")}else{callNative(id,[task],"-1")}})}}Document.prototype.destroy=function(){delete this.listener;delete this.nodeMap;delete instanceMap[this.id]};Document.prototype.open=function(){this.listener.batched=false};Document.prototype.close=function(){this.listener.batched=true};Document.prototype.createDocumentElement=function(){var _this=this;if(!this.documentElement){var el=new Element("document");el.docId=this.id;el.ownerDocument=this;el.role="documentElement";el.depth=0;el.ref="_documentElement";this.nodeMap._documentElement=el;this.documentElement=el;el.appendChild=function(node){appendBody(_this,node)};el.insertBefore=function(node,before){appendBody(_this,node,before)}}return this.documentElement};function appendBody(doc,node,before){var documentElement=doc.documentElement;if(documentElement.pureChildren.length>0||node.parentNode){return}var children=documentElement.children;var beforeIndex=children.indexOf(before);if(beforeIndex<0){children.push(node)}else{children.splice(beforeIndex,0,node)}if(node.nodeType===1){if(node.role==="body"){node.docId=doc.id;node.ownerDocument=doc;node.parentNode=documentElement}else{node.children.forEach(function(child){child.parentNode=node});setBody(doc,node);node.docId=doc.id;node.ownerDocument=doc;linkParent(node,documentElement);delete doc.nodeMap[node.nodeId]}documentElement.pureChildren.push(node);doc.listener.createBody(node)}else{node.parentNode=documentElement;doc.nodeMap[node.ref]=node}}function setBody(doc,el){el.role="body";el.depth=1;delete doc.nodeMap[el.nodeId];el.ref="_root";doc.nodeMap._root=el;doc.body=el}Document.prototype.createBody=function(type,props){if(!this.body){var el=new Element(type,props);setBody(this,el)}return this.body};Document.prototype.createElement=function(tagName,props){return new Element(tagName,props)};Document.prototype.createComment=function(text){return new Comment(text)};Document.prototype.fireEvent=function(el,type,e,domChanges){if(!el){return}e=e||{};e.type=type;e.target=el;e.timestamp=Date.now();if(domChanges){updateElement(el,domChanges)}return el.fireEvent(type,e)};Document.prototype.getRef=function(ref){return this.nodeMap[ref]};function updateElement(el,changes){var attrs=changes.attrs||{};for(var name in attrs){el.setAttr(name,attrs[name],true)}var style=changes.style||{};for(var _name in style){el.setStyle(_name,style[_name],true)}}function Node(){this.nodeId=(nextNodeRef++).toString();this.ref=this.nodeId;this.children=[];this.pureChildren=[];this.parentNode=null;this.nextSibling=null;this.previousSibling=null}Node.prototype.destroy=function(){var doc=instanceMap[this.docId];if(doc){delete this.docId;delete doc.nodeMap[this.nodeId]}this.children.forEach(function(child){child.destroy()})};function Element(){var type=arguments.length<=0||arguments[0]===undefined?DEFAULT_TAG_NAME:arguments[0];var props=arguments[1];props=props||{};this.nodeType=1;this.nodeId=(nextNodeRef++).toString();this.ref=this.nodeId;this.type=type;this.attr=props.attr||{};this.classStyle=props.classStyle||{};this.style=props.style||{};this.event={};this.children=[];this.pureChildren=[]}Element.prototype=new Node;Element.prototype.appendChild=function(node){if(node.parentNode&&node.parentNode!==this){return}if(!node.parentNode){linkParent(node,this);insertIndex(node,this.children,this.children.length,true);if(this.docId){registerNode(this.docId,node)}if(node.nodeType===1){insertIndex(node,this.pureChildren,this.pureChildren.length);if(this.docId){var listener=instanceMap[this.docId].listener;return listener.addElement(node,this.ref,-1)}}}else{moveIndex(node,this.children,this.children.length,true);if(node.nodeType===1){var index=moveIndex(node,this.pureChildren,this.pureChildren.length);if(this.docId&&index>=0){var _listener=instanceMap[this.docId].listener;return _listener.moveElement(node.ref,this.ref,index)}}}};Element.prototype.insertBefore=function(node,before){if(node.parentNode&&node.parentNode!==this){return}if(node===before||node.nextSibling===before){return}if(!node.parentNode){linkParent(node,this);insertIndex(node,this.children,this.children.indexOf(before),true);if(this.docId){registerNode(this.docId,node)}if(node.nodeType===1){var pureBefore=nextElement(before);var index=insertIndex(node,this.pureChildren,pureBefore?this.pureChildren.indexOf(pureBefore):this.pureChildren.length);if(this.docId){var listener=instanceMap[this.docId].listener;return listener.addElement(node,this.ref,index)}}}else{moveIndex(node,this.children,this.children.indexOf(before),true);if(node.nodeType===1){var _pureBefore=nextElement(before);var _index=moveIndex(node,this.pureChildren,_pureBefore?this.pureChildren.indexOf(_pureBefore):this.pureChildren.length);if(this.docId&&_index>=0){var _listener2=instanceMap[this.docId].listener;return _listener2.moveElement(node.ref,this.ref,_index)}}}};Element.prototype.insertAfter=function(node,after){if(node.parentNode&&node.parentNode!==this){return}if(node===after||node.previousSibling===after){return}if(!node.parentNode){linkParent(node,this);insertIndex(node,this.children,this.children.indexOf(after)+1,true);if(this.docId){registerNode(this.docId,node)}if(node.nodeType===1){var index=insertIndex(node,this.pureChildren,this.pureChildren.indexOf(previousElement(after))+1);if(this.docId){var listener=instanceMap[this.docId].listener;return listener.addElement(node,this.ref,index)}}}else{moveIndex(node,this.children,this.children.indexOf(after)+1,true);if(node.nodeType===1){var _index2=moveIndex(node,this.pureChildren,this.pureChildren.indexOf(previousElement(after))+1);if(this.docId&&_index2>=0){var _listener3=instanceMap[this.docId].listener;return _listener3.moveElement(node.ref,this.ref,_index2)}}}};Element.prototype.removeChild=function(node,preserved){if(node.parentNode){removeIndex(node,this.children,true);if(node.nodeType===1){removeIndex(node,this.pureChildren);if(this.docId){var listener=instanceMap[this.docId].listener;listener.removeElement(node.ref)}}}if(!preserved){node.destroy()}};Element.prototype.clear=function(){var _this2=this;if(this.docId){(function(){var listener=instanceMap[_this2.docId].listener;_this2.pureChildren.forEach(function(node){listener.removeElement(node.ref)})})()}this.children.forEach(function(node){node.destroy()});this.children.length=0;this.pureChildren.length=0};function nextElement(node){while(node){if(node.nodeType===1){return node}node=node.nextSibling}}function previousElement(node){while(node){if(node.nodeType===1){return node}node=node.previousSibling}}function linkParent(node,parent){node.parentNode=parent;if(parent.docId){node.docId=parent.docId;node.ownerDocument=parent.ownerDocument;node.ownerDocument.nodeMap[node.nodeId]=node;node.depth=parent.depth+1}node.children.forEach(function(child){linkParent(child,node)})}function registerNode(docId,node){var doc=instanceMap[docId];doc.nodeMap[node.nodeId]=node}function insertIndex(target,list,newIndex,changeSibling){if(newIndex<0){newIndex=0}var before=list[newIndex-1];var after=list[newIndex];list.splice(newIndex,0,target);if(changeSibling){before&&(before.nextSibling=target);target.previousSibling=before;target.nextSibling=after;after&&(after.previousSibling=target)}return newIndex}function moveIndex(target,list,newIndex,changeSibling){var index=list.indexOf(target);if(index<0){return-1}if(changeSibling){var before=list[index-1];var after=list[index+1];before&&(before.nextSibling=after);after&&(after.previousSibling=before)}list.splice(index,1);var newIndexAfter=newIndex;if(index<=newIndex){newIndexAfter=newIndex-1}var beforeNew=list[newIndexAfter-1];var afterNew=list[newIndexAfter];list.splice(newIndexAfter,0,target);if(changeSibling){beforeNew&&(beforeNew.nextSibling=target);target.previousSibling=beforeNew;target.nextSibling=afterNew;afterNew&&(afterNew.previousSibling=target)}if(index===newIndexAfter){return-1}return newIndex}function removeIndex(target,list,changeSibling){var index=list.indexOf(target);if(index<0){return}if(changeSibling){var before=list[index-1];var after=list[index+1];before&&(before.nextSibling=after);after&&(after.previousSibling=before)}list.splice(index,1)}Element.prototype.setAttr=function(key,value,silent){if(this.attr[key]===value){return}this.attr[key]=value;if(!silent&&this.docId){var listener=instanceMap[this.docId].listener;listener.setAttr(this.ref,key,value)}};Element.prototype.setStyle=function(key,value,silent){if(this.style[key]===value){return}this.style[key]=value;if(!silent&&this.docId){var listener=instanceMap[this.docId].listener;listener.setStyle(this.ref,key,value)}};Element.prototype.resetClassStyle=function(){for(var key in this.classStyle){this.classStyle[key]=""}};Element.prototype.setClassStyle=function(classStyle){this.resetClassStyle();(0,_utils.extend)(this.classStyle,classStyle);if(this.docId){var listener=instanceMap[this.docId].listener;listener.setStyles(this.ref,this.toStyle())}};Element.prototype.addEvent=function(type,handler){if(!this.event[type]){this.event[type]=handler;if(this.docId){var listener=instanceMap[this.docId].listener;listener.addEvent(this.ref,type)}}};Element.prototype.removeEvent=function(type){if(this.event[type]){delete this.event[type];if(this.docId){var listener=instanceMap[this.docId].listener;listener.removeEvent(this.ref,type)}}};Element.prototype.fireEvent=function(type,e){var handler=this.event[type];if(handler){return handler.call(this,e)}};Element.prototype.toStyle=function(){return(0,_utils.extend)({},this.classStyle,this.style)};Element.prototype.toJSON=function(){var result={ref:this.ref.toString(),type:this.type,attr:this.attr,style:this.toStyle()};var event=Object.keys(this.event);if(event.length){result.event=event}if(this.pureChildren.length){result.children=this.pureChildren.map(function(child){return child.toJSON()})}return result};Element.prototype.toString=function(){return"<"+this.type+" attr="+JSON.stringify(this.attr)+" style="+JSON.stringify(this.toStyle())+">"+this.pureChildren.map(function(child){return child.toString()}).join("")+""};function Comment(value){this.nodeType=8;this.nodeId=(nextNodeRef++).toString();this.ref=this.nodeId;this.type="comment";this.value=value;this.children=[];this.pureChildren=[]}Comment.prototype=new Node;Comment.prototype.toString=function(){return""}},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=Listener;exports.createAction=createAction;function Listener(id,handler){this.id=id;this.batched=false;this.updates=[];if(typeof handler==="function"){this.handler=handler}}Listener.prototype.createFinish=function(callback){var handler=this.handler;return handler([createAction("createFinish",[])],callback)};Listener.prototype.updateFinish=function(callback){var handler=this.handler;return handler([createAction("updateFinish",[])],callback)};Listener.prototype.refreshFinish=function(callback){var handler=this.handler;return handler([createAction("refreshFinish",[])],callback)};Listener.prototype.createBody=function(element){var body=element.toJSON();var children=body.children;delete body.children;var actions=[createAction("createBody",[body])];if(children){actions.push.apply(actions,children.map(function(child){return createAction("addElement",[body.ref,child,-1])}))}return this.addActions(actions)};Listener.prototype.addElement=function(element,ref,index){if(!(index>=0)){index=-1}return this.addActions(createAction("addElement",[ref,element.toJSON(),index]))};Listener.prototype.removeElement=function(ref){if(Array.isArray(ref)){var actions=ref.map(function(r){return createAction("removeElement",[r])});return this.addActions(actions)}return this.addActions(createAction("removeElement",[ref]))};Listener.prototype.moveElement=function(targetRef,parentRef,index){return this.addActions(createAction("moveElement",[targetRef,parentRef,index]))};Listener.prototype.setAttr=function(ref,key,value){var result={};result[key]=value;return this.addActions(createAction("updateAttrs",[ref,result]))};Listener.prototype.setStyle=function(ref,key,value){var result={};result[key]=value;return this.addActions(createAction("updateStyle",[ref,result]))};Listener.prototype.setStyles=function(ref,style){return this.addActions(createAction("updateStyle",[ref,style]))};Listener.prototype.addEvent=function(ref,type){return this.addActions(createAction("addEvent",[ref,type]))};Listener.prototype.removeEvent=function(ref,type){return this.addActions(createAction("removeEvent",[ref,type]))};Listener.prototype.handler=function(actions,cb){return cb&&cb()};Listener.prototype.addActions=function(actions){var updates=this.updates;var handler=this.handler;if(!Array.isArray(actions)){actions=[actions]}if(this.batched){updates.push.apply(updates,actions)}else{return handler(actions)}};function createAction(name,args){return{module:"dom",method:name,args:args}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _default=__webpack_require__(81);var Weex=_interopRequireWildcard(_default);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}exports.default={Weex:Weex}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _create=__webpack_require__(82);Object.defineProperty(exports,"createInstance",{enumerable:true,get:function get(){return _create.createInstance}});var _life=__webpack_require__(109);Object.defineProperty(exports,"init",{enumerable:true,get:function get(){return _life.init}});Object.defineProperty(exports,"refreshInstance",{enumerable:true,get:function get(){return _life.refreshInstance}});Object.defineProperty(exports,"destroyInstance",{enumerable:true,get:function get(){return _life.destroyInstance}});var _register=__webpack_require__(110);Object.defineProperty(exports,"registerComponents",{enumerable:true,get:function get(){return _register.registerComponents}});Object.defineProperty(exports,"registerModules",{enumerable:true,get:function get(){return _register.registerModules}});Object.defineProperty(exports,"registerMethods",{enumerable:true,get:function get(){return _register.registerMethods}});var _bridge=__webpack_require__(111);Object.defineProperty(exports,"receiveTasks",{enumerable:true,get:function get(){return _bridge.receiveTasks}});var _misc=__webpack_require__(112);Object.defineProperty(exports,"getRoot",{enumerable:true,get:function get(){return _misc.getRoot}})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.createInstance=createInstance;var _app=__webpack_require__(83);var _app2=_interopRequireDefault(_app);var _map=__webpack_require__(108);var _ctrl=__webpack_require__(85);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function createInstance(id,code,options,data){var instance=_map.instanceMap[id];options=options||{};var result=void 0;if(!instance){instance=new _app2.default(id,options);_map.instanceMap[id]=instance;result=(0,_ctrl.init)(instance,code,data)}else{result=new Error('invalid instance id "'+id+'"')}return result}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _register=__webpack_require__(84);var _ctrl=__webpack_require__(85);var _instance=__webpack_require__(106);var _instance2=_interopRequireDefault(_instance);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}_instance2.default.prototype.requireModule=function(name){return(0,_register.requireModule)(this,name)};_instance2.default.prototype.updateActions=function(){(0,_ctrl.updateActions)(this)};_instance2.default.prototype.callTasks=function(tasks){(0,_ctrl.callTasks)(this,tasks)};exports.default=_instance2.default},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getModule=getModule;exports.clearModules=clearModules;exports.initModules=initModules;exports.initMethods=initMethods;exports.requireModule=requireModule;exports.requireCustomComponent=requireCustomComponent;exports.registerCustomComponent=registerCustomComponent;var nativeModules={};function getModule(moduleName){return nativeModules[moduleName]}function clearModules(){nativeModules={}}function initModules(modules,ifReplace){var _loop=function _loop(moduleName){var methods=nativeModules[moduleName];if(!methods){methods={};nativeModules[moduleName]=methods}modules[moduleName].forEach(function(method){if(typeof method==="string"){method={name:method}}if(!methods[method.name]||ifReplace){methods[method.name]=method}})};for(var moduleName in modules){_loop(moduleName)}}function initMethods(Vm,apis){var p=Vm.prototype;for(var apiName in apis){if(!p.hasOwnProperty(apiName)){p[apiName]=apis[apiName]}}}function requireModule(app,name){var methods=nativeModules[name];var target={};var _loop2=function _loop2(methodName){target[methodName]=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}return app.callTasks({module:name,method:methodName,args:args})}};for(var methodName in methods){_loop2(methodName)}return target}function requireCustomComponent(app,name){var customComponentMap=app.customComponentMap;return customComponentMap[name]}function registerCustomComponent(app,name,def){var customComponentMap=app.customComponentMap;if(customComponentMap[name]){console.error("[JS Framework] define a component("+name+") that already exists");return}customComponentMap[name]=def}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _init=__webpack_require__(86);Object.defineProperty(exports,"init",{enumerable:true,get:function get(){return _init.init}});var _misc=__webpack_require__(105);Object.defineProperty(exports,"refresh",{enumerable:true,get:function get(){return _misc.refresh}});Object.defineProperty(exports,"destroy",{enumerable:true,get:function get(){return _misc.destroy}});Object.defineProperty(exports,"getRootElement",{enumerable:true,get:function get(){return _misc.getRootElement}});Object.defineProperty(exports,"fireEvent",{enumerable:true,get:function get(){return _misc.fireEvent}});Object.defineProperty(exports,"callback",{enumerable:true,get:function get(){return _misc.callback}});Object.defineProperty(exports,"updateActions",{enumerable:true,get:function get(){return _misc.updateActions}});Object.defineProperty(exports,"callTasks",{enumerable:true,get:function get(){return _misc.callTasks}})},function(module,exports,__webpack_require__){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.init=init;var _util=__webpack_require__(87);var _bundle=__webpack_require__(88);var _misc=__webpack_require__(105);function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i)?=?)";var XRANGEIDENTIFIERLOOSE=R++;src[XRANGEIDENTIFIERLOOSE]=src[NUMERICIDENTIFIERLOOSE]+"|x|X|\\*";var XRANGEIDENTIFIER=R++;src[XRANGEIDENTIFIER]=src[NUMERICIDENTIFIER]+"|x|X|\\*";var XRANGEPLAIN=R++;src[XRANGEPLAIN]="[v=\\s]*("+src[XRANGEIDENTIFIER]+")"+"(?:\\.("+src[XRANGEIDENTIFIER]+")"+"(?:\\.("+src[XRANGEIDENTIFIER]+")"+"(?:"+src[PRERELEASE]+")?"+src[BUILD]+"?"+")?)?";var XRANGEPLAINLOOSE=R++;src[XRANGEPLAINLOOSE]="[v=\\s]*("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:"+src[PRERELEASELOOSE]+")?"+src[BUILD]+"?"+")?)?";var XRANGE=R++;src[XRANGE]="^"+src[GTLT]+"\\s*"+src[XRANGEPLAIN]+"$";var XRANGELOOSE=R++;src[XRANGELOOSE]="^"+src[GTLT]+"\\s*"+src[XRANGEPLAINLOOSE]+"$";var LONETILDE=R++;src[LONETILDE]="(?:~>?)";var TILDETRIM=R++;src[TILDETRIM]="(\\s*)"+src[LONETILDE]+"\\s+";re[TILDETRIM]=new RegExp(src[TILDETRIM],"g");var tildeTrimReplace="$1~";var TILDE=R++;src[TILDE]="^"+src[LONETILDE]+src[XRANGEPLAIN]+"$";var TILDELOOSE=R++;src[TILDELOOSE]="^"+src[LONETILDE]+src[XRANGEPLAINLOOSE]+"$";var LONECARET=R++;src[LONECARET]="(?:\\^)";var CARETTRIM=R++;src[CARETTRIM]="(\\s*)"+src[LONECARET]+"\\s+";re[CARETTRIM]=new RegExp(src[CARETTRIM],"g");var caretTrimReplace="$1^";var CARET=R++;src[CARET]="^"+src[LONECARET]+src[XRANGEPLAIN]+"$";var CARETLOOSE=R++;src[CARETLOOSE]="^"+src[LONECARET]+src[XRANGEPLAINLOOSE]+"$";var COMPARATORLOOSE=R++;src[COMPARATORLOOSE]="^"+src[GTLT]+"\\s*("+LOOSEPLAIN+")$|^$";var COMPARATOR=R++;src[COMPARATOR]="^"+src[GTLT]+"\\s*("+FULLPLAIN+")$|^$";var COMPARATORTRIM=R++;src[COMPARATORTRIM]="(\\s*)"+src[GTLT]+"\\s*("+LOOSEPLAIN+"|"+src[XRANGEPLAIN]+")";re[COMPARATORTRIM]=new RegExp(src[COMPARATORTRIM],"g");var comparatorTrimReplace="$1$2$3";var HYPHENRANGE=R++;src[HYPHENRANGE]="^\\s*("+src[XRANGEPLAIN]+")"+"\\s+-\\s+"+"("+src[XRANGEPLAIN]+")"+"\\s*$";var HYPHENRANGELOOSE=R++;src[HYPHENRANGELOOSE]="^\\s*("+src[XRANGEPLAINLOOSE]+")"+"\\s+-\\s+"+"("+src[XRANGEPLAINLOOSE]+")"+"\\s*$";var STAR=R++;src[STAR]="(<|>)?=?\\s*\\*";for(var i=0;iMAX_LENGTH)return null;var r=loose?re[LOOSE]:re[FULL];if(!r.test(version))return null;try{return new SemVer(version,loose)}catch(er){return null}}exports.valid=valid;function valid(version,loose){var v=parse(version,loose);return v?v.version:null}exports.clean=clean;function clean(version,loose){var s=parse(version.trim().replace(/^[=v]+/,""),loose);return s?s.version:null}exports.SemVer=SemVer;function SemVer(version,loose){if(version instanceof SemVer){if(version.loose===loose)return version;else version=version.version}else if(typeof version!=="string"){throw new TypeError("Invalid Version: "+version)}if(version.length>MAX_LENGTH)throw new TypeError("version is longer than "+MAX_LENGTH+" characters");if(!(this instanceof SemVer))return new SemVer(version,loose);debug("SemVer",version,loose);this.loose=loose;var m=version.trim().match(loose?re[LOOSE]:re[FULL]);if(!m)throw new TypeError("Invalid Version: "+version);this.raw=version;this.major=+m[1];this.minor=+m[2];this.patch=+m[3];if(this.major>MAX_SAFE_INTEGER||this.major<0)throw new TypeError("Invalid major version");if(this.minor>MAX_SAFE_INTEGER||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>MAX_SAFE_INTEGER||this.patch<0)throw new TypeError("Invalid patch version");if(!m[4])this.prerelease=[];else this.prerelease=m[4].split(".").map(function(id){if(/^[0-9]+$/.test(id)){var num=+id;if(num>=0&&num=0){if(typeof this.prerelease[i]==="number"){this.prerelease[i]++;i=-2}}if(i===-1)this.prerelease.push(0)}if(identifier){if(this.prerelease[0]===identifier){if(isNaN(this.prerelease[1]))this.prerelease=[identifier,0]}else this.prerelease=[identifier,0]}break;default:throw new Error("invalid increment argument: "+release)}this.format();this.raw=this.version;return this};exports.inc=inc;function inc(version,release,loose,identifier){if(typeof loose==="string"){identifier=loose;loose=undefined}try{return new SemVer(version,loose).inc(release,identifier).version}catch(er){return null}}exports.diff=diff;function diff(version1,version2){if(eq(version1,version2)){return null}else{var v1=parse(version1);var v2=parse(version2);if(v1.prerelease.length||v2.prerelease.length){for(var key in v1){if(key==="major"||key==="minor"||key==="patch"){if(v1[key]!==v2[key]){return"pre"+key}}}return"prerelease"}for(var key in v1){if(key==="major"||key==="minor"||key==="patch"){if(v1[key]!==v2[key]){return key}}}}}exports.compareIdentifiers=compareIdentifiers;var numeric=/^[0-9]+$/;function compareIdentifiers(a,b){var anum=numeric.test(a);var bnum=numeric.test(b);if(anum&&bnum){a=+a;b=+b}return anum&&!bnum?-1:bnum&&!anum?1:ab?1:0}exports.rcompareIdentifiers=rcompareIdentifiers;function rcompareIdentifiers(a,b){return compareIdentifiers(b,a)}exports.major=major;function major(a,loose){return new SemVer(a,loose).major}exports.minor=minor;function minor(a,loose){return new SemVer(a,loose).minor}exports.patch=patch;function patch(a,loose){return new SemVer(a,loose).patch}exports.compare=compare;function compare(a,b,loose){return new SemVer(a,loose).compare(b)}exports.compareLoose=compareLoose;function compareLoose(a,b){return compare(a,b,true)}exports.rcompare=rcompare;function rcompare(a,b,loose){return compare(b,a,loose)}exports.sort=sort;function sort(list,loose){return list.sort(function(a,b){return exports.compare(a,b,loose)})}exports.rsort=rsort;function rsort(list,loose){return list.sort(function(a,b){return exports.rcompare(a,b,loose)})}exports.gt=gt;function gt(a,b,loose){return compare(a,b,loose)>0}exports.lt=lt;function lt(a,b,loose){return compare(a,b,loose)<0}exports.eq=eq;function eq(a,b,loose){return compare(a,b,loose)===0}exports.neq=neq;function neq(a,b,loose){return compare(a,b,loose)!==0}exports.gte=gte;function gte(a,b,loose){return compare(a,b,loose)>=0}exports.lte=lte;function lte(a,b,loose){return compare(a,b,loose)<=0}exports.cmp=cmp;function cmp(a,op,b,loose){var ret;switch(op){case"===":if((typeof a==="undefined"?"undefined":_typeof(a))==="object")a=a.version;if((typeof b==="undefined"?"undefined":_typeof(b))==="object")b=b.version;ret=a===b;break;case"!==":if((typeof a==="undefined"?"undefined":_typeof(a))==="object")a=a.version;if((typeof b==="undefined"?"undefined":_typeof(b))==="object")b=b.version;ret=a!==b;break;case"":case"=":case"==":ret=eq(a,b,loose);break;case"!=":ret=neq(a,b,loose);break;case">":ret=gt(a,b,loose);break;case">=":ret=gte(a,b,loose);break;case"<":ret=lt(a,b,loose);break;case"<=":ret=lte(a,b,loose);break;default:throw new TypeError("Invalid operator: "+op)}return ret}exports.Comparator=Comparator;function Comparator(comp,loose){if(comp instanceof Comparator){if(comp.loose===loose)return comp;else comp=comp.value}if(!(this instanceof Comparator))return new Comparator(comp,loose);debug("comparator",comp,loose);this.loose=loose;this.parse(comp);if(this.semver===ANY)this.value="";else this.value=this.operator+this.semver.version;debug("comp",this)}var ANY={};Comparator.prototype.parse=function(comp){var r=this.loose?re[COMPARATORLOOSE]:re[COMPARATOR];var m=comp.match(r);if(!m)throw new TypeError("Invalid comparator: "+comp);this.operator=m[1];if(this.operator==="=")this.operator="";if(!m[2])this.semver=ANY;else this.semver=new SemVer(m[2],this.loose)};Comparator.prototype.toString=function(){return this.value};Comparator.prototype.test=function(version){debug("Comparator.test",version,this.loose);if(this.semver===ANY)return true;if(typeof version==="string")version=new SemVer(version,this.loose);return cmp(version,this.operator,this.semver,this.loose)};exports.Range=Range;function Range(range,loose){if(range instanceof Range&&range.loose===loose)return range;if(!(this instanceof Range))return new Range(range,loose);this.loose=loose;this.raw=range;this.set=range.split(/\s*\|\|\s*/).map(function(range){return this.parseRange(range.trim())},this).filter(function(c){return c.length});if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+range)}this.format()}Range.prototype.format=function(){this.range=this.set.map(function(comps){return comps.join(" ").trim()}).join("||").trim();return this.range};Range.prototype.toString=function(){return this.range};Range.prototype.parseRange=function(range){var loose=this.loose;range=range.trim();debug("range",range,loose);var hr=loose?re[HYPHENRANGELOOSE]:re[HYPHENRANGE];range=range.replace(hr,hyphenReplace);debug("hyphen replace",range);range=range.replace(re[COMPARATORTRIM],comparatorTrimReplace);debug("comparator trim",range,re[COMPARATORTRIM]);range=range.replace(re[TILDETRIM],tildeTrimReplace);range=range.replace(re[CARETTRIM],caretTrimReplace);range=range.split(/\s+/).join(" ");var compRe=loose?re[COMPARATORLOOSE]:re[COMPARATOR];var set=range.split(" ").map(function(comp){return parseComparator(comp,loose)}).join(" ").split(/\s+/);if(this.loose){set=set.filter(function(comp){return!!comp.match(compRe)})}set=set.map(function(comp){return new Comparator(comp,loose)});return set};exports.toComparators=toComparators;function toComparators(range,loose){return new Range(range,loose).set.map(function(comp){return comp.map(function(c){return c.value}).join(" ").trim().split(" ")})}function parseComparator(comp,loose){debug("comp",comp);comp=replaceCarets(comp,loose);debug("caret",comp);comp=replaceTildes(comp,loose);debug("tildes",comp);comp=replaceXRanges(comp,loose);debug("xrange",comp);comp=replaceStars(comp,loose);debug("stars",comp);return comp}function isX(id){return!id||id.toLowerCase()==="x"||id==="*"}function replaceTildes(comp,loose){return comp.trim().split(/\s+/).map(function(comp){return replaceTilde(comp,loose)}).join(" ")}function replaceTilde(comp,loose){var r=loose?re[TILDELOOSE]:re[TILDE];return comp.replace(r,function(_,M,m,p,pr){debug("tilde",comp,_,M,m,p,pr);var ret;if(isX(M))ret="";else if(isX(m))ret=">="+M+".0.0 <"+(+M+1)+".0.0";else if(isX(p))ret=">="+M+"."+m+".0 <"+M+"."+(+m+1)+".0";else if(pr){debug("replaceTilde pr",pr);if(pr.charAt(0)!=="-")pr="-"+pr;ret=">="+M+"."+m+"."+p+pr+" <"+M+"."+(+m+1)+".0"}else ret=">="+M+"."+m+"."+p+" <"+M+"."+(+m+1)+".0";debug("tilde return",ret);return ret})}function replaceCarets(comp,loose){return comp.trim().split(/\s+/).map(function(comp){return replaceCaret(comp,loose)}).join(" ")}function replaceCaret(comp,loose){debug("caret",comp,loose);var r=loose?re[CARETLOOSE]:re[CARET];return comp.replace(r,function(_,M,m,p,pr){debug("caret",comp,_,M,m,p,pr);var ret;if(isX(M))ret="";else if(isX(m))ret=">="+M+".0.0 <"+(+M+1)+".0.0";else if(isX(p)){if(M==="0")ret=">="+M+"."+m+".0 <"+M+"."+(+m+1)+".0";else ret=">="+M+"."+m+".0 <"+(+M+1)+".0.0"}else if(pr){debug("replaceCaret pr",pr);if(pr.charAt(0)!=="-")pr="-"+pr;if(M==="0"){if(m==="0")ret=">="+M+"."+m+"."+p+pr+" <"+M+"."+m+"."+(+p+1);else ret=">="+M+"."+m+"."+p+pr+" <"+M+"."+(+m+1)+".0"}else ret=">="+M+"."+m+"."+p+pr+" <"+(+M+1)+".0.0"}else{debug("no pr");if(M==="0"){if(m==="0")ret=">="+M+"."+m+"."+p+" <"+M+"."+m+"."+(+p+1);else ret=">="+M+"."+m+"."+p+" <"+M+"."+(+m+1)+".0"}else ret=">="+M+"."+m+"."+p+" <"+(+M+1)+".0.0"}debug("caret return",ret);return ret})}function replaceXRanges(comp,loose){debug("replaceXRanges",comp,loose);return comp.split(/\s+/).map(function(comp){return replaceXRange(comp,loose)}).join(" ")}function replaceXRange(comp,loose){comp=comp.trim();var r=loose?re[XRANGELOOSE]:re[XRANGE];return comp.replace(r,function(ret,gtlt,M,m,p,pr){debug("xRange",comp,ret,gtlt,M,m,p,pr);var xM=isX(M);var xm=xM||isX(m);var xp=xm||isX(p);var anyX=xp;if(gtlt==="="&&anyX)gtlt="";if(xM){if(gtlt===">"||gtlt==="<"){ret="<0.0.0"}else{ret="*"}}else if(gtlt&&anyX){if(xm)m=0;if(xp)p=0;if(gtlt===">"){gtlt=">=";if(xm){M=+M+1;m=0;p=0}else if(xp){m=+m+1;p=0}}else if(gtlt==="<="){gtlt="<";if(xm)M=+M+1;else m=+m+1}ret=gtlt+M+"."+m+"."+p}else if(xm){ret=">="+M+".0.0 <"+(+M+1)+".0.0"}else if(xp){ret=">="+M+"."+m+".0 <"+M+"."+(+m+1)+".0"}debug("xRange return",ret);return ret})}function replaceStars(comp,loose){debug("replaceStars",comp,loose);return comp.trim().replace(re[STAR],"")}function hyphenReplace($0,from,fM,fm,fp,fpr,fb,to,tM,tm,tp,tpr,tb){if(isX(fM))from="";else if(isX(fm))from=">="+fM+".0.0";else if(isX(fp))from=">="+fM+"."+fm+".0";else from=">="+from;if(isX(tM))to="";else if(isX(tm))to="<"+(+tM+1)+".0.0";else if(isX(tp))to="<"+tM+"."+(+tm+1)+".0";else if(tpr)to="<="+tM+"."+tm+"."+tp+"-"+tpr;else to="<="+to;return(from+" "+to).trim()}Range.prototype.test=function(version){if(!version)return false;if(typeof version==="string")version=new SemVer(version,this.loose);for(var i=0;i0){var allowed=set[i].semver;if(allowed.major===version.major&&allowed.minor===version.minor&&allowed.patch===version.patch)return true}}return false}return true}exports.satisfies=satisfies;function satisfies(version,range,loose){try{range=new Range(range,loose)}catch(er){return false}return range.test(version)}exports.maxSatisfying=maxSatisfying;function maxSatisfying(versions,range,loose){return versions.filter(function(version){return satisfies(version,range,loose)}).sort(function(a,b){return rcompare(a,b,loose)})[0]||null}exports.minSatisfying=minSatisfying;function minSatisfying(versions,range,loose){return versions.filter(function(version){return satisfies(version,range,loose)}).sort(function(a,b){return compare(a,b,loose)})[0]||null}exports.validRange=validRange;function validRange(range,loose){try{return new Range(range,loose).range||"*"}catch(er){return null}}exports.ltr=ltr;function ltr(version,range,loose){return outside(version,range,"<",loose)}exports.gtr=gtr;function gtr(version,range,loose){return outside(version,range,">",loose)}exports.outside=outside;function outside(version,range,hilo,loose){version=new SemVer(version,loose);range=new Range(range,loose);var gtfn,ltefn,ltfn,comp,ecomp;switch(hilo){case">":gtfn=gt;ltefn=lte;ltfn=lt;comp=">";ecomp=">=";break;case"<":gtfn=lt;ltefn=gte;ltfn=gt;comp="<";ecomp="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies(version,range,loose)){return false}for(var i=0;i=0.0.0")}high=high||comparator;low=low||comparator;if(gtfn(comparator.semver,high.semver,loose)){high=comparator}else if(ltfn(comparator.semver,low.semver,loose)){low=comparator}});if(high.operator===comp||high.operator===ecomp){return false}if((!low.operator||low.operator===comp)&<efn(version,low.semver)){return false}else if(low.operator===ecomp&<fn(version,low.semver)){return false}}return true}exports.prerelease=prerelease;function prerelease(version,loose){var parsed=parse(version,loose);return parsed&&parsed.prerelease.length?parsed.prerelease:null}}).call(exports,__webpack_require__(91))},function(module,exports){"use strict";var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex1){for(var i=1;i-1||!(0,_util.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 unproxy(vm,key){if(!(0,_util.isReserved)(key)){delete vm[key]}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.arrayMethods=undefined;var _util=__webpack_require__(87);var arrayProto=Array.prototype;var arrayMethods=exports.arrayMethods=Object.create(arrayProto);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(method){var original=arrayProto[method];(0,_util.def)(arrayMethods,method,function mutator(){var i=arguments.length;var args=new Array(i);while(i--){args[i]=arguments[i]}var result=original.apply(this,args);var ob=this.__ob__;var inserted=void 0;switch(method){case"push":inserted=args;break;case"unshift":inserted=args;break;case"splice":inserted=args.slice(2);break}if(inserted)ob.observeArray(inserted);ob.dep.notify();return result})});(0,_util.def)(arrayProto,"$set",function $set(index,val){if(index>=this.length){this.length=index+1}return this.splice(index,1,val)[0]});(0,_util.def)(arrayProto,"$remove",function $remove(index){if(!this.length)return;if(typeof index!=="number"){index=this.indexOf(index)}if(index>-1){this.splice(index,1)}})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.build=build;var _util=__webpack_require__(87);var _state=__webpack_require__(93);var _directive=__webpack_require__(99);var _domHelper=__webpack_require__(101);function build(vm){var opt=vm._options||{};var template=opt.template||{};if(opt.replace){if(template.children&&template.children.length===1){compile(vm,template.children[0],vm._parentEl)}else{compile(vm,template.children,vm._parentEl)}}else{compile(vm,template,vm._parentEl)}console.debug('[JS Framework] "ready" lifecycle in Vm('+vm._type+")");vm.$emit("hook:ready");vm._ready=true}function compile(vm,target,dest,meta){var app=vm._app||{};if(app.lastSignal===-1){return}if(targetIsFragment(target)){compileFragment(vm,target,dest,meta);return}meta=meta||{};if(targetIsContent(target)){console.debug('[JS Framework] compile "content" block by',target);vm._content=(0,_domHelper.createBlock)(vm,dest);return}if(targetNeedCheckRepeat(target,meta)){console.debug('[JS Framework] compile "repeat" logic by',target);if(dest.type==="document"){console.warn("[JS Framework] The root element does't support `repeat` directive!")}else{compileRepeat(vm,target,dest)}return}if(targetNeedCheckShown(target,meta)){console.debug('[JS Framework] compile "if" logic by',target);if(dest.type==="document"){console.warn("[JS Framework] The root element does't support `if` directive!")}else{compileShown(vm,target,dest,meta)}return}var typeGetter=meta.type||target.type;if(targetNeedCheckType(typeGetter,meta)){compileType(vm,target,dest,typeGetter,meta);return}var type=typeGetter;var component=targetIsComposed(vm,target,type);if(component){console.debug("[JS Framework] compile composed component by",target);compileCustomComponent(vm,component,target,dest,type,meta);return}console.debug("[JS Framework] compile native component by",target);compileNativeComponent(vm,target,dest,type)}function targetIsFragment(target){return Array.isArray(target)}function targetIsContent(target){return target.type==="content"||target.type==="slot"}function targetNeedCheckRepeat(target,meta){return!meta.hasOwnProperty("repeat")&&target.repeat}function targetNeedCheckShown(target,meta){return!meta.hasOwnProperty("shown")&&target.shown}function targetNeedCheckType(typeGetter,meta){return typeof typeGetter==="function"&&!meta.hasOwnProperty("type")}function targetIsComposed(vm,target,type){var component=void 0;if(vm._app&&vm._app.customComponentMap){component=vm._app.customComponentMap[type]}if(vm._options&&vm._options.components){component=vm._options.components[type]}if(target.component){component=component||{}}return component}function compileFragment(vm,target,dest,meta){var fragBlock=(0,_domHelper.createBlock)(vm,dest);target.forEach(function(child){compile(vm,child,fragBlock,meta)})}function compileRepeat(vm,target,dest){var repeat=target.repeat;var oldStyle=typeof repeat==="function";var getter=repeat.getter||repeat.expression||repeat;if(typeof getter!=="function"){getter=function getter(){return[]}}var key=repeat.key||"$index";var value=repeat.value||"$value";var trackBy=repeat.trackBy||target.trackBy||target.attr&&target.attr.trackBy;var fragBlock=(0,_domHelper.createBlock)(vm,dest);fragBlock.children=[];fragBlock.data=[];fragBlock.vms=[];bindRepeat(vm,target,fragBlock,{getter:getter,key:key,value:value,trackBy:trackBy,oldStyle:oldStyle})}function compileShown(vm,target,dest,meta){var newMeta={shown:true};var fragBlock=(0,_domHelper.createBlock)(vm,dest);if(dest.element&&dest.children){dest.children.push(fragBlock)}if(meta.repeat){newMeta.repeat=meta.repeat}bindShown(vm,target,fragBlock,newMeta)}function compileType(vm,target,dest,typeGetter,meta){var type=typeGetter.call(vm);var newMeta=(0,_util.extend)({type:type},meta);var fragBlock=(0,_domHelper.createBlock)(vm,dest);if(dest.element&&dest.children){dest.children.push(fragBlock)}(0,_directive.watch)(vm,typeGetter,function(value){var newMeta=(0,_util.extend)({type:value},meta);(0,_domHelper.removeTarget)(vm,fragBlock,true);compile(vm,target,fragBlock,newMeta)});compile(vm,target,fragBlock,newMeta)}function compileCustomComponent(vm,component,target,dest,type,meta){var Ctor=vm.constructor;var subVm=new Ctor(type,component,vm,dest,undefined,{"hook:init":function hookInit(){(0,_directive.setId)(vm,null,target.id,this);this._externalBinding={parent:vm,template:target}},"hook:created":function hookCreated(){(0,_directive.bindSubVm)(vm,this,target,meta.repeat)},"hook:ready":function hookReady(){if(this._content){compileChildren(vm,target,this._content)}}});(0,_directive.bindSubVmAfterInitialized)(vm,subVm,target)}function compileNativeComponent(vm,template,dest,type){(0,_directive.applyNaitveComponentOptions)(template);var element=void 0;if(dest.ref==="_documentElement"){console.debug("[JS Framework] compile to create body for "+type);element=(0,_domHelper.createBody)(vm,type)}else{console.debug("[JS Framework] compile to create element for "+type);element=(0,_domHelper.createElement)(vm,type)}if(!vm._rootEl){vm._rootEl=element;var binding=vm._externalBinding||{};var target=binding.template;var parentVm=binding.parent;if(target&&target.events&&parentVm&&element){for(var _type in target.events){var handler=parentVm[target.events[_type]];if(handler){element.addEvent(_type,(0,_util.bind)(handler,parentVm))}}}}(0,_directive.bindElement)(vm,element,template);if(template.attr&&template.attr.append){template.append=template.attr.append}if(template.append){element.attr=element.attr||{};element.attr.append=template.append}var treeMode=template.append==="tree";var app=vm._app||{};if(app.lastSignal!==-1&&!treeMode){console.debug("[JS Framework] compile to append single node for",element);app.lastSignal=(0,_domHelper.attachTarget)(vm,element,dest)}if(app.lastSignal!==-1){compileChildren(vm,template,element)}if(app.lastSignal!==-1&&treeMode){console.debug("[JS Framework] compile to append whole tree for",element);app.lastSignal=(0,_domHelper.attachTarget)(vm,element,dest)}}function compileChildren(vm,template,dest){var app=vm._app||{};var children=template.children;if(children&&children.length){children.every(function(child){compile(vm,child,dest);return app.lastSignal!==-1})}}function bindRepeat(vm,target,fragBlock,info){var vms=fragBlock.vms;var children=fragBlock.children;var getter=info.getter;var trackBy=info.trackBy;var oldStyle=info.oldStyle;var keyName=info.key;var valueName=info.value;function compileItem(item,index,context){var mergedData=void 0;if(oldStyle){mergedData=item;if((0,_util.isObject)(item)){mergedData[keyName]=index;if(!mergedData.hasOwnProperty("INDEX")){Object.defineProperty(mergedData,"INDEX",{value:function value(){console.warn('[JS Framework] "INDEX" in repeat is deprecated, '+'please use "$index" instead')}})}}else{console.warn("[JS Framework] Each list item must be an object in old-style repeat, "+"please use `repeat={{v in list}}` instead.");mergedData={};mergedData[keyName]=index;mergedData[valueName]=item}}else{mergedData={};mergedData[keyName]=index;mergedData[valueName]=item}var newContext=mergeContext(context,mergedData);vms.push(newContext);compile(newContext,target,fragBlock,{repeat:item})}var list=watchBlock(vm,fragBlock,getter,"repeat",function(data){console.debug('[JS Framework] the "repeat" item has changed',data);if(!fragBlock||!data){return}var oldChildren=children.slice();var oldVms=vms.slice();var oldData=fragBlock.data.slice();var trackMap={};var reusedMap={};data.forEach(function(item,index){var key=trackBy?item[trackBy]:oldStyle?item[keyName]:index;if(key==null||key===""){return}trackMap[key]=item});var reusedList=[];oldData.forEach(function(item,index){var key=trackBy?item[trackBy]:oldStyle?item[keyName]:index;if(trackMap.hasOwnProperty(key)){reusedMap[key]={item:item,index:index,key:key,target:oldChildren[index],vm:oldVms[index]};reusedList.push(item)}else{(0,_domHelper.removeTarget)(vm,oldChildren[index])}});children.length=0;vms.length=0;fragBlock.data=data.slice();fragBlock.updateMark=fragBlock.start;data.forEach(function(item,index){var key=trackBy?item[trackBy]:oldStyle?item[keyName]:index;var reused=reusedMap[key];if(reused){if(reused.item===reusedList[0]){reusedList.shift()}else{reusedList.$remove(reused.item);(0,_domHelper.moveTarget)(vm,reused.target,fragBlock.updateMark,true)}children.push(reused.target);vms.push(reused.vm);if(oldStyle){reused.vm=item}else{reused.vm[valueName]=item}reused.vm[keyName]=index;fragBlock.updateMark=reused.target}else{compileItem(item,index,vm)}});delete fragBlock.updateMark});fragBlock.data=list.slice(0);list.forEach(function(item,index){compileItem(item,index,vm)})}function bindShown(vm,target,fragBlock,meta){var display=watchBlock(vm,fragBlock,target.shown,"shown",function(display){console.debug('[JS Framework] the "if" item was changed',display);if(!fragBlock||!!fragBlock.display===!!display){return}fragBlock.display=!!display;if(display){compile(vm,target,fragBlock,meta)}else{(0,_domHelper.removeTarget)(vm,fragBlock,true)}});fragBlock.display=!!display;if(display){compile(vm,target,fragBlock,meta)}}function watchBlock(vm,fragBlock,calc,type,handler){var differ=vm&&vm._app&&vm._app.differ;var config={};var depth=(fragBlock.element.depth||0)+1;return(0,_directive.watch)(vm,calc,function(value){config.latestValue=value;if(differ&&!config.recorded){differ.append(type,depth,fragBlock.blockId,function(){var latestValue=config.latestValue;handler(latestValue);config.recorded=false;config.latestValue=undefined})}config.recorded=true})}function mergeContext(context,mergedData){var newContext=Object.create(context);newContext._data=mergedData;(0,_state.initData)(newContext);(0,_state.initComputed)(newContext);newContext._realParent=context;return newContext}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};exports.applyNaitveComponentOptions=applyNaitveComponentOptions;exports.bindElement=bindElement;exports.bindSubVm=bindSubVm;exports.bindSubVmAfterInitialized=bindSubVmAfterInitialized;exports.setId=setId;exports.watch=watch;var _util=__webpack_require__(87);var _watcher=__webpack_require__(94);var _watcher2=_interopRequireDefault(_watcher);var _config=__webpack_require__(100);var _config2=_interopRequireDefault(_config);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var nativeComponentMap=_config2.default.nativeComponentMap;var SETTERS={attr:"setAttr",style:"setStyle",event:"addEvent"};function applyNaitveComponentOptions(template){var type=template.type;var options=nativeComponentMap[type];if((typeof options==="undefined"?"undefined":_typeof(options))==="object"){for(var key in options){if(template[key]==null){template[key]=options[key]}else if((0,_util.typof)(template[key])==="object"&&(0,_util.typof)(options[key])==="object"){for(var subkey in options[key]){if(template[key][subkey]==null){template[key][subkey]=options[key][subkey]}}}}}}function bindElement(vm,el,template){setId(vm,el,template.id,vm);setAttr(vm,el,template.attr);setClass(vm,el,template.classList);setStyle(vm,el,template.style);bindEvents(vm,el,template.events)}function bindSubVm(vm,subVm,template,repeatItem){subVm=subVm||{};template=template||{};var options=subVm._options||{};var props=options.props;if(Array.isArray(props)){props=props.reduce(function(result,value){result[value]=true;return result},{})}mergeProps(repeatItem,props,vm,subVm);mergeProps(template.attr,props,vm,subVm)}function bindSubVmAfterInitialized(vm,subVm,template){mergeClassStyle(template.classList,vm,subVm);mergeStyle(template.style,vm,subVm)}function mergeProps(target,props,vm,subVm){if(!target){return}var _loop=function _loop(key){if(!props||props[key]){var value=target[key];if(typeof value==="function"){var returnValue=watch(vm,value,function(v){subVm[key]=v});subVm[key]=returnValue}else{subVm[key]=value}}};for(var key in target){_loop(key)}}function mergeStyle(target,vm,subVm){var _loop2=function _loop2(key){var value=target[key];if(typeof value==="function"){var returnValue=watch(vm,value,function(v){if(subVm._rootEl){subVm._rootEl.setStyle(key,v)}});subVm._rootEl.setStyle(key,returnValue)}else{if(subVm._rootEl){subVm._rootEl.setStyle(key,value)}}};for(var key in target){_loop2(key)}}function mergeClassStyle(target,vm,subVm){var css=vm._options&&vm._options.style||{};if(!subVm._rootEl){return}var className="@originalRootEl";css[className]=subVm._rootEl.classStyle;function addClassName(list,name){if((0,_util.typof)(list)==="array"){list.unshift(name)}}if(typeof target==="function"){var _value=watch(vm,target,function(v){addClassName(v,className);setClassStyle(subVm._rootEl,css,v)});addClassName(_value,className);setClassStyle(subVm._rootEl,css,_value)}else if(target!=null){addClassName(target,className);setClassStyle(subVm._rootEl,css,target)}}function setId(vm,el,id,target){var map=Object.create(null);Object.defineProperties(map,{vm:{value:target,writable:false,configurable:false},el:{get:function get(){return el||target._rootEl},configurable:false}});if(typeof id==="function"){var handler=id;id=handler.call(vm);if(id){vm._ids[id]=map}watch(vm,handler,function(newId){if(newId){vm._ids[newId]=map}})}else if(id&&typeof id==="string"){vm._ids[id]=map}}function setAttr(vm,el,attr){bindDir(vm,el,"attr",attr)}function setClassStyle(el,css,classList){var classStyle={};var length=classList.length;for(var i=0;i=0){result.code=1001}else if(_key.indexOf("appversion")>=0){result.code=1002}else if(_key.indexOf("weexversion")>=0){result.code=1003}else if(_key.indexOf("devicemodel")>=0){result.code=1004}return result}function check(config,deviceInfo){deviceInfo=deviceInfo||global.WXEnvironment;deviceInfo=(0,_util.isPlainObject)(deviceInfo)?deviceInfo:{};var result={isDowngrade:false};if((0,_util.typof)(config)==="function"){var customDowngrade=config.call(this,deviceInfo,{semver:_semver2.default,normalizeVersion:this.normalizeVersion});customDowngrade=!!customDowngrade;result=customDowngrade?this.getError("custom","","custom params"):result}else{config=(0,_util.isPlainObject)(config)?config:{};var platform=deviceInfo.platform||"unknow";var dPlatform=platform.toLowerCase();var cObj=config[dPlatform]||{};for(var i in deviceInfo){var key=i;var keyLower=key.toLowerCase();var val=deviceInfo[i];var isVersion=keyLower.indexOf("version")>=0;var isDeviceModel=keyLower.indexOf("devicemodel")>=0;var criteria=cObj[i];if(criteria&&isVersion){var c=this.normalizeVersion(criteria);var d=this.normalizeVersion(deviceInfo[i]);if(_semver2.default.satisfies(d,c)){result=this.getError(key,val,criteria);break}}else if(isDeviceModel){var _criteria=(0,_util.typof)(criteria)==="array"?criteria:[criteria];if(_criteria.indexOf(val)>=0){result=this.getError(key,val,criteria);break}}}}return result}}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.defineFn=undefined;exports.clearCommonModules=clearCommonModules;exports.register=register;var _util=__webpack_require__(87);var _register=__webpack_require__(84);function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}var commonModules={};function clearCommonModules(){commonModules={}}var defineFn=exports.defineFn=function defineFn(app,name){console.debug("[JS Framework] define a component "+name);var factory=void 0,definition=void 0;if((arguments.length<=2?0:arguments.length-2)>1){definition=arguments.length<=3?undefined:arguments[3]}else{definition=arguments.length<=2?undefined:arguments[2]}if(typeof definition==="function"){factory=definition;definition=null}if(factory){var r=function r(name){if((0,_util.isWeexComponent)(name)){var cleanName=(0,_util.removeWeexPrefix)(name);return(0,_register.requireCustomComponent)(app,cleanName)}if((0,_util.isWeexModule)(name)){var _cleanName=(0,_util.removeWeexPrefix)(name);return app.requireModule(_cleanName)}if((0,_util.isNormalModule)(name)||(0,_util.isNpmModule)(name)){var _cleanName2=(0,_util.removeJSSurfix)(name);return commonModules[_cleanName2]}};var m={exports:{}};factory(r,m.exports,m);definition=m.exports}if((0,_util.isWeexComponent)(name)){var cleanName=(0,_util.removeWeexPrefix)(name);(0,_register.registerCustomComponent)(app,cleanName,definition)}else if((0,_util.isWeexModule)(name)){var _cleanName3=(0,_util.removeWeexPrefix)(name);(0,_register.initModules)(_defineProperty({},_cleanName3,definition))}else if((0,_util.isNormalModule)(name)){var _cleanName4=(0,_util.removeJSSurfix)(name);commonModules[_cleanName4]=definition}else if((0,_util.isNpmModule)(name)){var _cleanName5=(0,_util.removeJSSurfix)(name);if(definition.template||definition.style||definition.methods){(0,_register.registerCustomComponent)(app,_cleanName5,definition)}else{commonModules[_cleanName5]=definition}}};function register(app,type,options){console.warn("[JS Framework] Register is deprecated, please install lastest transformer.");(0,_register.registerCustomComponent)(app,type,options)}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.refresh=refresh;exports.destroy=destroy;exports.destroyVm=destroyVm;exports.getRootElement=getRootElement;exports.fireEvent=fireEvent;exports.callback=callback;exports.updateActions=updateActions;exports.callTasks=callTasks;var _util=__webpack_require__(87);var _config=__webpack_require__(100);var _config2=_interopRequireDefault(_config);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}return _ctrl.fireEvent.apply(undefined,[_map.instanceMap[id]].concat(args))},callback:function callback(id){for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2]}return _ctrl.callback.apply(undefined,[_map.instanceMap[id]].concat(args))}};function receiveTasks(id,tasks){var instance=_map.instanceMap[id];if(instance&&Array.isArray(tasks)){var _ret=function(){var results=[];tasks.forEach(function(task){var handler=jsHandlers[task.method];var args=[].concat(_toConsumableArray(task.args));if(typeof handler==="function"){args.unshift(id);results.push(handler.apply(undefined,_toConsumableArray(args)))}});return{v:results}}();if((typeof _ret==="undefined"?"undefined":_typeof(_ret))==="object")return _ret.v}return new Error('invalid instance id "'+id+'" or tasks')}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getRoot=getRoot;var _map=__webpack_require__(108);var _ctrl=__webpack_require__(85);function getRoot(id){var instance=_map.instanceMap[id];var result=void 0;if(instance){result=(0,_ctrl.getRootElement)(instance)}else{result=new Error('invalid instance id "'+id+'"')}return result}},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=init;var frameworks=void 0;var versionRegExp=/^\/\/ *(\{[^\}]*\}) *\r?\n/;function checkVersion(code){var info=void 0;var result=versionRegExp.exec(code);if(result){try{info=JSON.parse(result[1])}catch(e){}}return info}var instanceMap={};function createInstance(id,code,config,data){var info=instanceMap[id];if(!info){info=checkVersion(code)||{};if(!frameworks[info.framework]){info.framework="Weex"}instanceMap[id]=info;config=config||{};config.bundleVersion=info.version;console.debug("[JS Framework] create an "+info.framework+"@"+config.bundleVersion+" instance from "+config.bundleVersion);return frameworks[info.framework].createInstance(id,code,config,data)}return new Error('invalid instance id "'+id+'"')}var methods={createInstance:createInstance};function genInit(methodName){methods[methodName]=function(){for(var name in frameworks){var framework=frameworks[name];if(framework&&framework[methodName]){framework[methodName].apply(framework,arguments)}}}}function genInstance(methodName){methods[methodName]=function(){var id=arguments.length<=0?undefined:arguments[0];var info=instanceMap[id];if(info&&frameworks[info.framework]){var _frameworks$info$fram;return(_frameworks$info$fram=frameworks[info.framework])[methodName].apply(_frameworks$info$fram,arguments)}return new Error('invalid instance id "'+id+'"')}}function adaptInstance(methodName,nativeMethodName){methods[nativeMethodName]=function(){var id=arguments.length<=0?undefined:arguments[0];var info=instanceMap[id];if(info&&frameworks[info.framework]){var _frameworks$info$fram2;return(_frameworks$info$fram2=frameworks[info.framework])[methodName].apply(_frameworks$info$fram2,arguments)}return new Error('invalid instance id "'+id+'"')}}function init(config){frameworks=config.frameworks||{};for(var name in frameworks){var framework=frameworks[name];framework.init(config)}["registerComponents","registerModules","registerMethods"].forEach(genInit);["destroyInstance","refreshInstance","receiveTasks","getRoot"].forEach(genInstance);adaptInstance("receiveTasks","callJS");return methods}},function(module,exports){module.exports={name:"weex-js-framework",version:"0.15.8",subversion:{framework:"0.15.8",transformer:">=0.1.5 <0.4"},description:"Weex JS Framework",keywords:["weex","mvvm","javascript","html5"],homepage:"https://alibaba.github.io/weex",bugs:{url:"https://github.com/alibaba/weex/issues"},license:"Apache-2.0",author:"Jinjiang ",maintainers:["terrykingcha ","IskenHuang ","yuanyan "],main:"index.js",repository:{type:"git",url:"git@github.com:alibaba/weex.git"},scripts:{test:'echo "Error: no test specified" && exit 1'},dependencies:{"core-js":"^2.4.0",semver:"^5.1.0"}}},function(module,exports,__webpack_require__){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.$=$;exports.$el=$el;exports.$vm=$vm;exports.$renderThen=$renderThen;exports.$scrollTo=$scrollTo;exports.$transition=$transition;exports.$getConfig=$getConfig;exports.$sendHttp=$sendHttp;exports.$openURL=$openURL;exports.$setTitle=$setTitle;exports.$call=$call;var _util=__webpack_require__(87);function $(id){console.warn("[JS Framework] Vm#$ is deprecated, please use Vm#$vm instead");var info=this._ids[id];if(info){return info.vm}}function $el(id){var info=this._ids[id];if(info){return info.el}}function $vm(id){var info=this._ids[id];if(info){return info.vm}}function $renderThen(fn){var app=this._app;var differ=app.differ;return differ.then(function(){fn()})}function $scrollTo(id,offset){console.warn("[JS Framework] Vm#$scrollTo is deprecated, "+"please use \"require('@weex-module/dom')"+'.scrollTo(el, options)" instead');var el=this.$el(id);if(el){var dom=this._app.requireModule("dom");dom.scrollToElement(el.ref,{offset:offset})}}function $transition(id,options,callback){var _this=this;var el=this.$el(id);if(el&&options&&options.styles){var animation=this._app.requireModule("animation");animation.transition(el.ref,options,function(){_this._setStyle(el,options.styles);callback&&callback.apply(undefined,arguments)})}}function $getConfig(callback){var config=(0,_util.extend)({env:global.WXEnvironment||{}},this._app.options);if((0,_util.typof)(callback)==="function"){console.warn("[JS Framework] the callback of Vm#$getConfig(callback) is deprecated, "+"this api now can directly RETURN config info.");callback(config)}return config}function $sendHttp(params,callback){console.warn("[JS Framework] Vm#$sendHttp is deprecated, "+"please use \"require('@weex-module/stream')"+'.sendHttp(params, callback)" instead');var stream=this._app.requireModule("stream");stream.sendHttp(params,callback)}function $openURL(url){console.warn("[JS Framework] Vm#$openURL is deprecated, "+"please use \"require('@weex-module/event')"+'.openURL(url)" instead');var event=this._app.requireModule("event");event.openURL(url)}function $setTitle(title){console.warn("[JS Framework] Vm#$setTitle is deprecated, "+"please use \"require('@weex-module/pageInfo')"+'.setTitle(title)" instead');var pageInfo=this._app.requireModule("pageInfo");pageInfo.setTitle(title)}function $call(moduleName,methodName){console.warn("[JS Framework] Vm#$call is deprecated, "+"please use \"require('@weex-module/moduleName')\" instead");var module=this._app.requireModule(moduleName);if(module&&module[methodName]){for(var _len=arguments.length,args=Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key]}module[methodName].apply(module,args)}}}).call(exports,function(){return this}())},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.$userTrack=$userTrack;exports.$sendMtop=$sendMtop;exports.$callWindvane=$callWindvane;exports.$setSpm=$setSpm;exports.$getUserInfo=$getUserInfo;exports.$login=$login;exports.$logout=$logout;function $userTrack(type,name,comName,param){console.warn("[JS Framework] Vm#$userTrack is deprecated, "+"please use \"require('@weex-module/userTrack')"+'.commit(type, name, comName, param)" instead');var userTrack=this._app.requireModule("userTrack");userTrack.commit(type,name,comName,param)}function $sendMtop(params,callback){console.warn("[JS Framework] Vm#$sendMtop is deprecated, "+"please use \"require('@weex-module/stream')"+'.sendMtop(params, callback)" instead');if(typeof window==="undefined"){var windvane=this._app.requireModule("windvane");windvane.call({class:"MtopWVPlugin",method:"send",data:params},callback)}else{var stream=this._app.requireModule("stream");stream.sendMtop(params,callback)}}function $callWindvane(params,callback){console.warn("[JS Framework] Vm#$callWindvane is deprecated, "+"please use \"require('@weex-module/windvane')"+'.call(params, callback)" instead');var windvane=this._app.requireModule("windvane");windvane.call(params,callback)}function $setSpm(a,b){console.warn("[JS Framework] Vm#$setSpm is deprecated, "+"please use \"require('@weex-module/pageInfo')"+'.setSpm(a, b)" instead');var pageInfo=this._app.requireModule("pageInfo");pageInfo.setSpm(a,b)}function $getUserInfo(callback){console.warn("[JS Framework] Vm#$getUserInfo is deprecated, "+"please use \"require('@weex-module/user')"+'.getUserInfo(callback)" instead');var user=this._app.requireModule("user");user.getUserInfo(callback)}function $login(callback){console.warn("[JS Framework] Vm#$login is deprecated, "+"please use \"require('@weex-module/user')"+'.login(callback)" instead');var user=this._app.requireModule("user");user.login(callback)}function $logout(callback){console.warn("[JS Framework] Vm#$logout is deprecated, "+"please use \"require('@weex-module/user')"+'.logout(callback)" instead');var user=this._app.requireModule("user");user.logout(callback)}}]); \ No newline at end of file +(this.nativeLog||function(s){console.log(s)})("START JS FRAMEWORK: 0.16.14 Build 20161002");this.getJSFMVersion=function(){return"0.16.14"};(function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:false};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.loaded=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(0)})([function(module,exports,__webpack_require__){(function(global){"use strict";__webpack_require__(1);var methods=__webpack_require__(121);var _global=global;var registerMethods=_global.registerMethods;registerMethods(methods)}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){"use strict";__webpack_require__(2)},function(module,exports,__webpack_require__){(function(global){"use strict";__webpack_require__(3);var _runtime=__webpack_require__(79);var _runtime2=_interopRequireDefault(_runtime);var _package=__webpack_require__(119);var _methods=__webpack_require__(120);var methods=_interopRequireWildcard(_methods);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var native=_package.subversion.native;var transformer=_package.subversion.transformer;var _loop=function _loop(methodName){global[methodName]=function(){var ret=_runtime2.default[methodName].apply(_runtime2.default,arguments);if(ret instanceof Error){console.error(ret.toString())}return ret}};for(var methodName in _runtime2.default){_loop(methodName)}global.frameworkVersion=native;global.transformerVersion=transformer;global.registerMethods(methods)}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isPlainObject=exports.isObject=exports.toArray=exports.bind=exports.hasOwn=exports.remove=exports.def=exports.extend=undefined;var _utils=__webpack_require__(4);Object.defineProperty(exports,"extend",{enumerable:true,get:function get(){return _utils.extend}});Object.defineProperty(exports,"def",{enumerable:true,get:function get(){return _utils.def}});Object.defineProperty(exports,"remove",{enumerable:true,get:function get(){return _utils.remove}});Object.defineProperty(exports,"hasOwn",{enumerable:true,get:function get(){return _utils.hasOwn}});Object.defineProperty(exports,"bind",{enumerable:true,get:function get(){return _utils.bind}});Object.defineProperty(exports,"toArray",{enumerable:true,get:function get(){return _utils.toArray}});Object.defineProperty(exports,"isObject",{enumerable:true,get:function get(){return _utils.isObject}});Object.defineProperty(exports,"isPlainObject",{enumerable:true,get:function get(){return _utils.isPlainObject}});__webpack_require__(5);__webpack_require__(6);__webpack_require__(70);__webpack_require__(71);__webpack_require__(77);__webpack_require__(78)},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};exports.extend=extend;exports.def=def;exports.remove=remove;exports.hasOwn=hasOwn;exports.bind=bind;exports.toArray=toArray;exports.isObject=isObject;exports.isPlainObject=isPlainObject;function extend(target){for(var _len=arguments.length,src=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){src[_key-1]=arguments[_key]}if(typeof Object.assign==="function"){Object.assign.apply(Object,[target].concat(src))}else{var first=src.shift();for(var key in first){target[key]=first[key]}if(src.length){extend.apply(undefined,[target].concat(src))}}return target}function def(obj,key,val,enumerable){Object.defineProperty(obj,key,{value:val,enumerable:!!enumerable,writable:true,configurable:true})}function remove(arr,item){if(arr.length){var index=arr.indexOf(item);if(index>-1){return arr.splice(index,1)}}}var hasOwnProperty=Object.prototype.hasOwnProperty;function hasOwn(obj,key){return hasOwnProperty.call(obj,key)}function bind(fn,ctx){return function(a){var l=arguments.length;return l?l>1?fn.apply(ctx,arguments):fn.call(ctx,a):fn.call(ctx)}}function toArray(list,start){start=start||0;var i=list.length-start;var ret=new Array(i);while(i--){ret[i]=list[i+start]}return ret}function isObject(obj){return obj!==null&&(typeof obj==="undefined"?"undefined":_typeof(obj))==="object"}var toString=Object.prototype.toString;var OBJECT_STRING="[object Object]";function isPlainObject(obj){return toString.call(obj)===OBJECT_STRING}},function(module,exports){(function(global){"use strict";var _global=global;var setTimeout=_global.setTimeout;var setTimeoutNative=_global.setTimeoutNative;if(typeof setTimeout==="undefined"&&typeof setTimeoutNative==="function"){(function(){var timeoutMap={};var timeoutId=0;global.setTimeout=function(cb,time){timeoutMap[++timeoutId]=cb;setTimeoutNative(timeoutId.toString(),time)};global.setTimeoutCallback=function(id){if(typeof timeoutMap[id]==="function"){timeoutMap[id]();delete timeoutMap[id]}}})()}}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){(function(global){"use strict";var _global=global;var WXEnvironment=_global.WXEnvironment;if(WXEnvironment&&WXEnvironment.platform==="iOS"){global.Promise=null}__webpack_require__(7);__webpack_require__(27);__webpack_require__(53);__webpack_require__(57)}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){"use strict";var classof=__webpack_require__(8),test={};test[__webpack_require__(10)("toStringTag")]="z";if(test+""!="[object z]"){__webpack_require__(14)(Object.prototype,"toString",function toString(){return"[object "+classof(this)+"]"},true)}},function(module,exports,__webpack_require__){"use strict";var cof=__webpack_require__(9),TAG=__webpack_require__(10)("toStringTag"),ARG=cof(function(){return arguments}())=="Arguments";var tryGet=function tryGet(it,key){try{return it[key]}catch(e){}};module.exports=function(it){var O,T,B;return it===undefined?"Undefined":it===null?"Null":typeof(T=tryGet(O=Object(it),TAG))=="string"?T:ARG?cof(O):(B=cof(O))=="Object"&&typeof O.callee=="function"?"Arguments":B}},function(module,exports){"use strict";var toString={}.toString;module.exports=function(it){return toString.call(it).slice(8,-1)}},function(module,exports,__webpack_require__){"use strict";var store=__webpack_require__(11)("wks"),uid=__webpack_require__(13),_Symbol=__webpack_require__(12).Symbol,USE_SYMBOL=typeof _Symbol=="function";var $exports=module.exports=function(name){return store[name]||(store[name]=USE_SYMBOL&&_Symbol[name]||(USE_SYMBOL?_Symbol:uid)("Symbol."+name))};$exports.store=store},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(12),SHARED="__core-js_shared__",store=global[SHARED]||(global[SHARED]={});module.exports=function(key){return store[key]||(store[key]={})}},function(module,exports){"use strict";var global=module.exports=typeof window!="undefined"&&window.Math==Math?window:typeof self!="undefined"&&self.Math==Math?self:Function("return this")();if(typeof __g=="number")__g=global},function(module,exports){"use strict";var id=0,px=Math.random();module.exports=function(key){return"Symbol(".concat(key===undefined?"":key,")_",(++id+px).toString(36))}},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(12),hide=__webpack_require__(15),has=__webpack_require__(25),SRC=__webpack_require__(13)("src"),TO_STRING="toString",$toString=Function[TO_STRING],TPL=(""+$toString).split(TO_STRING);__webpack_require__(26).inspectSource=function(it){return $toString.call(it)};(module.exports=function(O,key,val,safe){var isFunction=typeof val=="function";if(isFunction)has(val,"name")||hide(val,"name",key);if(O[key]===val)return;if(isFunction)has(val,SRC)||hide(val,SRC,O[key]?""+O[key]:TPL.join(String(key)));if(O===global){O[key]=val}else{if(!safe){delete O[key];hide(O,key,val)}else{if(O[key])O[key]=val;else hide(O,key,val)}}})(Function.prototype,TO_STRING,function toString(){return typeof this=="function"&&this[SRC]||$toString.call(this)})},function(module,exports,__webpack_require__){"use strict";var dP=__webpack_require__(16),createDesc=__webpack_require__(24);module.exports=__webpack_require__(20)?function(object,key,value){return dP.f(object,key,createDesc(1,value))}:function(object,key,value){object[key]=value;return object}},function(module,exports,__webpack_require__){"use strict";var anObject=__webpack_require__(17),IE8_DOM_DEFINE=__webpack_require__(19),toPrimitive=__webpack_require__(23),dP=Object.defineProperty;exports.f=__webpack_require__(20)?Object.defineProperty:function defineProperty(O,P,Attributes){anObject(O);P=toPrimitive(P,true);anObject(Attributes);if(IE8_DOM_DEFINE)try{return dP(O,P,Attributes)}catch(e){}if("get"in Attributes||"set"in Attributes)throw TypeError("Accessors not supported!");if("value"in Attributes)O[P]=Attributes.value;return O}},function(module,exports,__webpack_require__){"use strict";var isObject=__webpack_require__(18);module.exports=function(it){if(!isObject(it))throw TypeError(it+" is not an object!");return it}},function(module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};module.exports=function(it){return(typeof it==="undefined"?"undefined":_typeof(it))==="object"?it!==null:typeof it==="function"}},function(module,exports,__webpack_require__){"use strict";module.exports=!__webpack_require__(20)&&!__webpack_require__(21)(function(){return Object.defineProperty(__webpack_require__(22)("div"),"a",{get:function get(){return 7}}).a!=7})},function(module,exports,__webpack_require__){"use strict";module.exports=!__webpack_require__(21)(function(){return Object.defineProperty({},"a",{get:function get(){return 7}}).a!=7})},function(module,exports){"use strict";module.exports=function(exec){try{return!!exec()}catch(e){return true}}},function(module,exports,__webpack_require__){"use strict";var isObject=__webpack_require__(18),document=__webpack_require__(12).document,is=isObject(document)&&isObject(document.createElement);module.exports=function(it){return is?document.createElement(it):{}}},function(module,exports,__webpack_require__){"use strict";var isObject=__webpack_require__(18);module.exports=function(it,S){if(!isObject(it))return it;var fn,val;if(S&&typeof(fn=it.toString)=="function"&&!isObject(val=fn.call(it)))return val;if(typeof(fn=it.valueOf)=="function"&&!isObject(val=fn.call(it)))return val;if(!S&&typeof(fn=it.toString)=="function"&&!isObject(val=fn.call(it)))return val;throw TypeError("Can't convert object to primitive value")}},function(module,exports){"use strict";module.exports=function(bitmap,value){return{enumerable:!(bitmap&1),configurable:!(bitmap&2),writable:!(bitmap&4),value:value}}},function(module,exports){"use strict";var hasOwnProperty={}.hasOwnProperty;module.exports=function(it,key){return hasOwnProperty.call(it,key)}},function(module,exports){"use strict";var core=module.exports={version:"2.4.0"};if(typeof __e=="number")__e=core},function(module,exports,__webpack_require__){"use strict";var $at=__webpack_require__(28)(true);__webpack_require__(31)(String,"String",function(iterated){this._t=String(iterated);this._i=0},function(){var O=this._t,index=this._i,point;if(index>=O.length)return{value:undefined,done:true};point=$at(O,index);this._i+=point.length;return{value:point,done:false}})},function(module,exports,__webpack_require__){"use strict";var toInteger=__webpack_require__(29),defined=__webpack_require__(30);module.exports=function(TO_STRING){return function(that,pos){var s=String(defined(that)),i=toInteger(pos),l=s.length,a,b;if(i<0||i>=l)return TO_STRING?"":undefined;a=s.charCodeAt(i);return a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?TO_STRING?s.charAt(i):a:TO_STRING?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536}}},function(module,exports){"use strict";var ceil=Math.ceil,floor=Math.floor;module.exports=function(it){return isNaN(it=+it)?0:(it>0?floor:ceil)(it)}},function(module,exports){"use strict";module.exports=function(it){if(it==undefined)throw TypeError("Can't call method on "+it);return it}},function(module,exports,__webpack_require__){"use strict";var LIBRARY=__webpack_require__(32),$export=__webpack_require__(33),redefine=__webpack_require__(14),hide=__webpack_require__(15),has=__webpack_require__(25),Iterators=__webpack_require__(36),$iterCreate=__webpack_require__(37),setToStringTag=__webpack_require__(50),getPrototypeOf=__webpack_require__(51),ITERATOR=__webpack_require__(10)("iterator"),BUGGY=!([].keys&&"next"in[].keys()),FF_ITERATOR="@@iterator",KEYS="keys",VALUES="values";var returnThis=function returnThis(){return this};module.exports=function(Base,NAME,Constructor,next,DEFAULT,IS_SET,FORCED){$iterCreate(Constructor,NAME,next);var getMethod=function getMethod(kind){if(!BUGGY&&kind in proto)return proto[kind];switch(kind){case KEYS:return function keys(){return new Constructor(this,kind)};case VALUES:return function values(){return new Constructor(this,kind)}}return function entries(){return new Constructor(this,kind)}};var TAG=NAME+" Iterator",DEF_VALUES=DEFAULT==VALUES,VALUES_BUG=false,proto=Base.prototype,$native=proto[ITERATOR]||proto[FF_ITERATOR]||DEFAULT&&proto[DEFAULT],$default=$native||getMethod(DEFAULT),$entries=DEFAULT?!DEF_VALUES?$default:getMethod("entries"):undefined,$anyNative=NAME=="Array"?proto.entries||$native:$native,methods,key,IteratorPrototype;if($anyNative){IteratorPrototype=getPrototypeOf($anyNative.call(new Base));if(IteratorPrototype!==Object.prototype){setToStringTag(IteratorPrototype,TAG,true);if(!LIBRARY&&!has(IteratorPrototype,ITERATOR))hide(IteratorPrototype,ITERATOR,returnThis)}}if(DEF_VALUES&&$native&&$native.name!==VALUES){VALUES_BUG=true;$default=function values(){return $native.call(this)}}if((!LIBRARY||FORCED)&&(BUGGY||VALUES_BUG||!proto[ITERATOR])){hide(proto,ITERATOR,$default)}Iterators[NAME]=$default;Iterators[TAG]=returnThis;if(DEFAULT){methods={values:DEF_VALUES?$default:getMethod(VALUES),keys:IS_SET?$default:getMethod(KEYS),entries:$entries};if(FORCED)for(key in methods){if(!(key in proto))redefine(proto,key,methods[key])}else $export($export.P+$export.F*(BUGGY||VALUES_BUG),NAME,methods)}return methods}},function(module,exports){"use strict";module.exports=false},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(12),core=__webpack_require__(26),hide=__webpack_require__(15),redefine=__webpack_require__(14),ctx=__webpack_require__(34),PROTOTYPE="prototype";var $export=function $export(type,name,source){var IS_FORCED=type&$export.F,IS_GLOBAL=type&$export.G,IS_STATIC=type&$export.S,IS_PROTO=type&$export.P,IS_BIND=type&$export.B,target=IS_GLOBAL?global:IS_STATIC?global[name]||(global[name]={}):(global[name]||{})[PROTOTYPE],exports=IS_GLOBAL?core:core[name]||(core[name]={}),expProto=exports[PROTOTYPE]||(exports[PROTOTYPE]={}),key,own,out,exp;if(IS_GLOBAL)source=name;for(key in source){own=!IS_FORCED&&target&&target[key]!==undefined;out=(own?target:source)[key];exp=IS_BIND&&own?ctx(out,global):IS_PROTO&&typeof out=="function"?ctx(Function.call,out):out;if(target)redefine(target,key,out,type&$export.U);if(exports[key]!=out)hide(exports,key,exp);if(IS_PROTO&&expProto[key]!=out)expProto[key]=out}};global.core=core;$export.F=1;$export.G=2;$export.S=4;$export.P=8;$export.B=16;$export.W=32;$export.U=64;$export.R=128;module.exports=$export},function(module,exports,__webpack_require__){"use strict";var aFunction=__webpack_require__(35);module.exports=function(fn,that,length){aFunction(fn);if(that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}},function(module,exports){"use strict";module.exports=function(it){if(typeof it!="function")throw TypeError(it+" is not a function!");return it}},function(module,exports){"use strict";module.exports={}},function(module,exports,__webpack_require__){"use strict";var create=__webpack_require__(38),descriptor=__webpack_require__(24),setToStringTag=__webpack_require__(50),IteratorPrototype={};__webpack_require__(15)(IteratorPrototype,__webpack_require__(10)("iterator"),function(){return this});module.exports=function(Constructor,NAME,next){Constructor.prototype=create(IteratorPrototype,{next:descriptor(1,next)});setToStringTag(Constructor,NAME+" Iterator")}},function(module,exports,__webpack_require__){"use strict";var anObject=__webpack_require__(17),dPs=__webpack_require__(39),enumBugKeys=__webpack_require__(48),IE_PROTO=__webpack_require__(47)("IE_PROTO"),Empty=function Empty(){},PROTOTYPE="prototype";var _createDict=function createDict(){var iframe=__webpack_require__(22)("iframe"),i=enumBugKeys.length,lt="<",gt=">",iframeDocument;iframe.style.display="none";__webpack_require__(49).appendChild(iframe);iframe.src="javascript:";iframeDocument=iframe.contentWindow.document;iframeDocument.open();iframeDocument.write(lt+"script"+gt+"document.F=Object"+lt+"/script"+gt);iframeDocument.close();_createDict=iframeDocument.F;while(i--){delete _createDict[PROTOTYPE][enumBugKeys[i]]}return _createDict()};module.exports=Object.create||function create(O,Properties){var result;if(O!==null){Empty[PROTOTYPE]=anObject(O);result=new Empty;Empty[PROTOTYPE]=null;result[IE_PROTO]=O}else result=_createDict();return Properties===undefined?result:dPs(result,Properties)}},function(module,exports,__webpack_require__){"use strict";var dP=__webpack_require__(16),anObject=__webpack_require__(17),getKeys=__webpack_require__(40);module.exports=__webpack_require__(20)?Object.defineProperties:function defineProperties(O,Properties){anObject(O);var keys=getKeys(Properties),length=keys.length,i=0,P;while(length>i){dP.f(O,P=keys[i++],Properties[P])}return O}},function(module,exports,__webpack_require__){"use strict";var $keys=__webpack_require__(41),enumBugKeys=__webpack_require__(48);module.exports=Object.keys||function keys(O){return $keys(O,enumBugKeys)}},function(module,exports,__webpack_require__){"use strict";var has=__webpack_require__(25),toIObject=__webpack_require__(42),arrayIndexOf=__webpack_require__(44)(false),IE_PROTO=__webpack_require__(47)("IE_PROTO");module.exports=function(object,names){var O=toIObject(object),i=0,result=[],key;for(key in O){if(key!=IE_PROTO)has(O,key)&&result.push(key)}while(names.length>i){if(has(O,key=names[i++])){~arrayIndexOf(result,key)||result.push(key)}}return result}},function(module,exports,__webpack_require__){"use strict";var IObject=__webpack_require__(43),defined=__webpack_require__(30);module.exports=function(it){return IObject(defined(it))}},function(module,exports,__webpack_require__){"use strict";var cof=__webpack_require__(9);module.exports=Object("z").propertyIsEnumerable(0)?Object:function(it){return cof(it)=="String"?it.split(""):Object(it)}},function(module,exports,__webpack_require__){"use strict";var toIObject=__webpack_require__(42),toLength=__webpack_require__(45),toIndex=__webpack_require__(46);module.exports=function(IS_INCLUDES){return function($this,el,fromIndex){var O=toIObject($this),length=toLength(O.length),index=toIndex(fromIndex,length),value;if(IS_INCLUDES&&el!=el)while(length>index){value=O[index++];if(value!=value)return true}else for(;length>index;index++){if(IS_INCLUDES||index in O){if(O[index]===el)return IS_INCLUDES||index||0}}return!IS_INCLUDES&&-1}}},function(module,exports,__webpack_require__){"use strict";var toInteger=__webpack_require__(29),min=Math.min;module.exports=function(it){return it>0?min(toInteger(it),9007199254740991):0}},function(module,exports,__webpack_require__){"use strict";var toInteger=__webpack_require__(29),max=Math.max,min=Math.min;module.exports=function(index,length){index=toInteger(index);return index<0?max(index+length,0):min(index,length)}},function(module,exports,__webpack_require__){"use strict";var shared=__webpack_require__(11)("keys"),uid=__webpack_require__(13);module.exports=function(key){return shared[key]||(shared[key]=uid(key))}},function(module,exports){"use strict";module.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(module,exports,__webpack_require__){"use strict";module.exports=__webpack_require__(12).document&&document.documentElement},function(module,exports,__webpack_require__){"use strict";var def=__webpack_require__(16).f,has=__webpack_require__(25),TAG=__webpack_require__(10)("toStringTag");module.exports=function(it,tag,stat){if(it&&!has(it=stat?it:it.prototype,TAG))def(it,TAG,{configurable:true,value:tag})}},function(module,exports,__webpack_require__){"use strict";var has=__webpack_require__(25),toObject=__webpack_require__(52),IE_PROTO=__webpack_require__(47)("IE_PROTO"),ObjectProto=Object.prototype;module.exports=Object.getPrototypeOf||function(O){O=toObject(O);if(has(O,IE_PROTO))return O[IE_PROTO];if(typeof O.constructor=="function"&&O instanceof O.constructor){return O.constructor.prototype}return O instanceof Object?ObjectProto:null}},function(module,exports,__webpack_require__){"use strict";var defined=__webpack_require__(30);module.exports=function(it){return Object(defined(it))}},function(module,exports,__webpack_require__){"use strict";var $iterators=__webpack_require__(54),redefine=__webpack_require__(14),global=__webpack_require__(12),hide=__webpack_require__(15),Iterators=__webpack_require__(36),wks=__webpack_require__(10),ITERATOR=wks("iterator"),TO_STRING_TAG=wks("toStringTag"),ArrayValues=Iterators.Array;for(var collections=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],i=0;i<5;i++){var NAME=collections[i],Collection=global[NAME],proto=Collection&&Collection.prototype,key;if(proto){if(!proto[ITERATOR])hide(proto,ITERATOR,ArrayValues);if(!proto[TO_STRING_TAG])hide(proto,TO_STRING_TAG,NAME);Iterators[NAME]=ArrayValues;for(key in $iterators){if(!proto[key])redefine(proto,key,$iterators[key],true)}}}},function(module,exports,__webpack_require__){"use strict";var addToUnscopables=__webpack_require__(55),step=__webpack_require__(56),Iterators=__webpack_require__(36),toIObject=__webpack_require__(42);module.exports=__webpack_require__(31)(Array,"Array",function(iterated,kind){this._t=toIObject(iterated);this._i=0;this._k=kind},function(){var O=this._t,kind=this._k,index=this._i++;if(!O||index>=O.length){this._t=undefined;return step(1)}if(kind=="keys")return step(0,index);if(kind=="values")return step(0,O[index]);return step(0,[index,O[index]])},"values");Iterators.Arguments=Iterators.Array;addToUnscopables("keys");addToUnscopables("values");addToUnscopables("entries")},function(module,exports,__webpack_require__){"use strict";var UNSCOPABLES=__webpack_require__(10)("unscopables"),ArrayProto=Array.prototype;if(ArrayProto[UNSCOPABLES]==undefined)__webpack_require__(15)(ArrayProto,UNSCOPABLES,{});module.exports=function(key){ArrayProto[UNSCOPABLES][key]=true}},function(module,exports){"use strict";module.exports=function(done,value){return{value:value,done:!!done}}},function(module,exports,__webpack_require__){"use strict";var LIBRARY=__webpack_require__(32),global=__webpack_require__(12),ctx=__webpack_require__(34),classof=__webpack_require__(8),$export=__webpack_require__(33),isObject=__webpack_require__(18),aFunction=__webpack_require__(35),anInstance=__webpack_require__(58),forOf=__webpack_require__(59),speciesConstructor=__webpack_require__(63),task=__webpack_require__(64).set,microtask=__webpack_require__(66)(),PROMISE="Promise",TypeError=global.TypeError,process=global.process,$Promise=global[PROMISE],process=global.process,isNode=classof(process)=="process",empty=function empty(){},Internal,GenericPromiseCapability,Wrapper;var USE_NATIVE=!!function(){try{var promise=$Promise.resolve(1),FakePromise=(promise.constructor={})[__webpack_require__(10)("species")]=function(exec){exec(empty,empty)};return(isNode||typeof PromiseRejectionEvent=="function")&&promise.then(empty)instanceof FakePromise}catch(e){}}();var sameConstructor=function sameConstructor(a,b){return a===b||a===$Promise&&b===Wrapper};var isThenable=function isThenable(it){var then;return isObject(it)&&typeof(then=it.then)=="function"?then:false};var newPromiseCapability=function newPromiseCapability(C){return sameConstructor($Promise,C)?new PromiseCapability(C):new GenericPromiseCapability(C)};var PromiseCapability=GenericPromiseCapability=function GenericPromiseCapability(C){var resolve,reject;this.promise=new C(function($$resolve,$$reject){if(resolve!==undefined||reject!==undefined)throw TypeError("Bad Promise constructor");resolve=$$resolve;reject=$$reject});this.resolve=aFunction(resolve);this.reject=aFunction(reject)};var perform=function perform(exec){try{exec()}catch(e){return{error:e}}};var notify=function notify(promise,isReject){if(promise._n)return;promise._n=true;var chain=promise._c;microtask(function(){var value=promise._v,ok=promise._s==1,i=0;var run=function run(reaction){var handler=ok?reaction.ok:reaction.fail,resolve=reaction.resolve,reject=reaction.reject,domain=reaction.domain,result,then;try{if(handler){if(!ok){if(promise._h==2)onHandleUnhandled(promise);promise._h=1}if(handler===true)result=value;else{if(domain)domain.enter();result=handler(value);if(domain)domain.exit()}if(result===reaction.promise){reject(TypeError("Promise-chain cycle"))}else if(then=isThenable(result)){then.call(result,resolve,reject)}else resolve(result)}else reject(value)}catch(e){reject(e)}};while(chain.length>i){run(chain[i++])}promise._c=[];promise._n=false;if(isReject&&!promise._h)onUnhandled(promise)})};var onUnhandled=function onUnhandled(promise){task.call(global,function(){var value=promise._v,abrupt,handler,console;if(isUnhandled(promise)){abrupt=perform(function(){if(isNode){process.emit("unhandledRejection",value,promise)}else if(handler=global.onunhandledrejection){handler({promise:promise,reason:value})}else if((console=global.console)&&console.error){console.error("Unhandled promise rejection",value)}});promise._h=isNode||isUnhandled(promise)?2:1}promise._a=undefined;if(abrupt)throw abrupt.error})};var isUnhandled=function isUnhandled(promise){if(promise._h==1)return false;var chain=promise._a||promise._c,i=0,reaction;while(chain.length>i){reaction=chain[i++];if(reaction.fail||!isUnhandled(reaction.promise))return false}return true};var onHandleUnhandled=function onHandleUnhandled(promise){task.call(global,function(){var handler;if(isNode){process.emit("rejectionHandled",promise)}else if(handler=global.onrejectionhandled){handler({promise:promise,reason:promise._v})}})};var $reject=function $reject(value){var promise=this;if(promise._d)return;promise._d=true;promise=promise._w||promise;promise._v=value;promise._s=2;if(!promise._a)promise._a=promise._c.slice();notify(promise,true)};var $resolve=function $resolve(value){var promise=this,then;if(promise._d)return;promise._d=true;promise=promise._w||promise;try{if(promise===value)throw TypeError("Promise can't be resolved itself");if(then=isThenable(value)){microtask(function(){var wrapper={_w:promise,_d:false};try{then.call(value,ctx($resolve,wrapper,1),ctx($reject,wrapper,1))}catch(e){$reject.call(wrapper,e)}})}else{promise._v=value;promise._s=1;notify(promise,false)}}catch(e){$reject.call({_w:promise,_d:false},e)}};if(!USE_NATIVE){$Promise=function Promise(executor){anInstance(this,$Promise,PROMISE,"_h");aFunction(executor);Internal.call(this);try{executor(ctx($resolve,this,1),ctx($reject,this,1))}catch(err){$reject.call(this,err)}};Internal=function Promise(executor){this._c=[];this._a=undefined;this._s=0;this._d=false;this._v=undefined;this._h=0;this._n=false};Internal.prototype=__webpack_require__(67)($Promise.prototype,{then:function then(onFulfilled,onRejected){var reaction=newPromiseCapability(speciesConstructor(this,$Promise));reaction.ok=typeof onFulfilled=="function"?onFulfilled:true;reaction.fail=typeof onRejected=="function"&&onRejected;reaction.domain=isNode?process.domain:undefined;this._c.push(reaction);if(this._a)this._a.push(reaction);if(this._s)notify(this,false);return reaction.promise},catch:function _catch(onRejected){return this.then(undefined,onRejected)}});PromiseCapability=function PromiseCapability(){var promise=new Internal;this.promise=promise;this.resolve=ctx($resolve,promise,1);this.reject=ctx($reject,promise,1)}}$export($export.G+$export.W+$export.F*!USE_NATIVE,{Promise:$Promise});__webpack_require__(50)($Promise,PROMISE);__webpack_require__(68)(PROMISE);Wrapper=__webpack_require__(26)[PROMISE];$export($export.S+$export.F*!USE_NATIVE,PROMISE,{reject:function reject(r){var capability=newPromiseCapability(this),$$reject=capability.reject;$$reject(r);return capability.promise}});$export($export.S+$export.F*(LIBRARY||!USE_NATIVE),PROMISE,{resolve:function resolve(x){if(x instanceof $Promise&&sameConstructor(x.constructor,this))return x;var capability=newPromiseCapability(this),$$resolve=capability.resolve;$$resolve(x);return capability.promise}});$export($export.S+$export.F*!(USE_NATIVE&&__webpack_require__(69)(function(iter){$Promise.all(iter)["catch"](empty)})),PROMISE,{all:function all(iterable){var C=this,capability=newPromiseCapability(C),resolve=capability.resolve,reject=capability.reject;var abrupt=perform(function(){var values=[],index=0,remaining=1;forOf(iterable,false,function(promise){var $index=index++,alreadyCalled=false;values.push(undefined);remaining++;C.resolve(promise).then(function(value){if(alreadyCalled)return;alreadyCalled=true;values[$index]=value;--remaining||resolve(values)},reject)});--remaining||resolve(values)});if(abrupt)reject(abrupt.error);return capability.promise},race:function race(iterable){var C=this,capability=newPromiseCapability(C),reject=capability.reject;var abrupt=perform(function(){forOf(iterable,false,function(promise){C.resolve(promise).then(capability.resolve,reject)})});if(abrupt)reject(abrupt.error);return capability.promise}})},function(module,exports){"use strict";module.exports=function(it,Constructor,name,forbiddenField){if(!(it instanceof Constructor)||forbiddenField!==undefined&&forbiddenField in it){throw TypeError(name+": incorrect invocation!")}return it}},function(module,exports,__webpack_require__){"use strict";var ctx=__webpack_require__(34),call=__webpack_require__(60),isArrayIter=__webpack_require__(61),anObject=__webpack_require__(17),toLength=__webpack_require__(45),getIterFn=__webpack_require__(62),BREAK={},RETURN={};var _exports=module.exports=function(iterable,entries,fn,that,ITERATOR){var iterFn=ITERATOR?function(){return iterable}:getIterFn(iterable),f=ctx(fn,that,entries?2:1),index=0,length,step,iterator,result;if(typeof iterFn!="function")throw TypeError(iterable+" is not iterable!");if(isArrayIter(iterFn))for(length=toLength(iterable.length);length>index;index++){result=entries?f(anObject(step=iterable[index])[0],step[1]):f(iterable[index]);if(result===BREAK||result===RETURN)return result}else for(iterator=iterFn.call(iterable);!(step=iterator.next()).done;){result=call(iterator,f,step.value,entries);if(result===BREAK||result===RETURN)return result}};_exports.BREAK=BREAK;_exports.RETURN=RETURN},function(module,exports,__webpack_require__){ +"use strict";var anObject=__webpack_require__(17);module.exports=function(iterator,fn,value,entries){try{return entries?fn(anObject(value)[0],value[1]):fn(value)}catch(e){var ret=iterator["return"];if(ret!==undefined)anObject(ret.call(iterator));throw e}}},function(module,exports,__webpack_require__){"use strict";var Iterators=__webpack_require__(36),ITERATOR=__webpack_require__(10)("iterator"),ArrayProto=Array.prototype;module.exports=function(it){return it!==undefined&&(Iterators.Array===it||ArrayProto[ITERATOR]===it)}},function(module,exports,__webpack_require__){"use strict";var classof=__webpack_require__(8),ITERATOR=__webpack_require__(10)("iterator"),Iterators=__webpack_require__(36);module.exports=__webpack_require__(26).getIteratorMethod=function(it){if(it!=undefined)return it[ITERATOR]||it["@@iterator"]||Iterators[classof(it)]}},function(module,exports,__webpack_require__){"use strict";var anObject=__webpack_require__(17),aFunction=__webpack_require__(35),SPECIES=__webpack_require__(10)("species");module.exports=function(O,D){var C=anObject(O).constructor,S;return C===undefined||(S=anObject(C)[SPECIES])==undefined?D:aFunction(S)}},function(module,exports,__webpack_require__){"use strict";var ctx=__webpack_require__(34),invoke=__webpack_require__(65),html=__webpack_require__(49),cel=__webpack_require__(22),global=__webpack_require__(12),process=global.process,setTask=global.setImmediate,clearTask=global.clearImmediate,MessageChannel=global.MessageChannel,counter=0,queue={},ONREADYSTATECHANGE="onreadystatechange",defer,channel,port;var run=function run(){var id=+this;if(queue.hasOwnProperty(id)){var fn=queue[id];delete queue[id];fn()}};var listener=function listener(event){run.call(event.data)};if(!setTask||!clearTask){setTask=function setImmediate(fn){var args=[],i=1;while(arguments.length>i){args.push(arguments[i++])}queue[++counter]=function(){invoke(typeof fn=="function"?fn:Function(fn),args)};defer(counter);return counter};clearTask=function clearImmediate(id){delete queue[id]};if(__webpack_require__(9)(process)=="process"){defer=function defer(id){process.nextTick(ctx(run,id,1))}}else if(MessageChannel){channel=new MessageChannel;port=channel.port2;channel.port1.onmessage=listener;defer=ctx(port.postMessage,port,1)}else if(global.addEventListener&&typeof postMessage=="function"&&!global.importScripts){defer=function defer(id){global.postMessage(id+"","*")};global.addEventListener("message",listener,false)}else if(ONREADYSTATECHANGE in cel("script")){defer=function defer(id){html.appendChild(cel("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this);run.call(id)}}}else{defer=function defer(id){setTimeout(ctx(run,id,1),0)}}}module.exports={set:setTask,clear:clearTask}},function(module,exports){"use strict";module.exports=function(fn,args,that){var un=that===undefined;switch(args.length){case 0:return un?fn():fn.call(that);case 1:return un?fn(args[0]):fn.call(that,args[0]);case 2:return un?fn(args[0],args[1]):fn.call(that,args[0],args[1]);case 3:return un?fn(args[0],args[1],args[2]):fn.call(that,args[0],args[1],args[2]);case 4:return un?fn(args[0],args[1],args[2],args[3]):fn.call(that,args[0],args[1],args[2],args[3])}return fn.apply(that,args)}},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(12),macrotask=__webpack_require__(64).set,Observer=global.MutationObserver||global.WebKitMutationObserver,process=global.process,Promise=global.Promise,isNode=__webpack_require__(9)(process)=="process";module.exports=function(){var head,last,notify;var flush=function flush(){var parent,fn;if(isNode&&(parent=process.domain))parent.exit();while(head){fn=head.fn;head=head.next;try{fn()}catch(e){if(head)notify();else last=undefined;throw e}}last=undefined;if(parent)parent.enter()};if(isNode){notify=function notify(){process.nextTick(flush)}}else if(Observer){var toggle=true,node=document.createTextNode("");new Observer(flush).observe(node,{characterData:true});notify=function notify(){node.data=toggle=!toggle}}else if(Promise&&Promise.resolve){var promise=Promise.resolve();notify=function notify(){promise.then(flush)}}else{notify=function notify(){macrotask.call(global,flush)}}return function(fn){var task={fn:fn,next:undefined};if(last)last.next=task;if(!head){head=task;notify()}last=task}}},function(module,exports,__webpack_require__){"use strict";var redefine=__webpack_require__(14);module.exports=function(target,src,safe){for(var key in src){redefine(target,key,src[key],safe)}return target}},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(12),dP=__webpack_require__(16),DESCRIPTORS=__webpack_require__(20),SPECIES=__webpack_require__(10)("species");module.exports=function(KEY){var C=global[KEY];if(DESCRIPTORS&&C&&!C[SPECIES])dP.f(C,SPECIES,{configurable:true,get:function get(){return this}})}},function(module,exports,__webpack_require__){"use strict";var ITERATOR=__webpack_require__(10)("iterator"),SAFE_CLOSING=false;try{var riter=[7][ITERATOR]();riter["return"]=function(){SAFE_CLOSING=true};Array.from(riter,function(){throw 2})}catch(e){}module.exports=function(exec,skipClosing){if(!skipClosing&&!SAFE_CLOSING)return false;var safe=false;try{var arr=[7],iter=arr[ITERATOR]();iter.next=function(){return{done:safe=true}};arr[ITERATOR]=function(){return iter};exec(arr)}catch(e){}return safe}},function(module,exports){(function(global){"use strict";function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);iindex){var S=IObject(arguments[index++]),keys=getSymbols?getKeys(S).concat(getSymbols(S)):getKeys(S),length=keys.length,j=0,key;while(length>j){if(isEnum.call(S,key=keys[j++]))T[key]=S[key]}}return T}:$assign},function(module,exports){"use strict";exports.f=Object.getOwnPropertySymbols},function(module,exports){"use strict";exports.f={}.propertyIsEnumerable},function(module,exports){"use strict";if(!Object.setPrototypeOf){Object.setPrototypeOf=function(Object,magic){var set;function setPrototypeOf(O,proto){set.call(O,proto);return O}try{set=Object.getOwnPropertyDescriptor(Object.prototype,magic).set;set.call({},null)}catch(e){if(Object.prototype!=={}[magic]||{__proto__:null}.__proto__===void 0){return}set=function set(proto){this[magic]=proto};setPrototypeOf.polyfill=setPrototypeOf(setPrototypeOf({},null),Object.prototype)instanceof Object}return setPrototypeOf}(Object,"__proto__")}},function(module,exports){"use strict";if(!Array.from){console.log("make polyfill");Array.from=function(){var toStr=Object.prototype.toString;var isCallable=function isCallable(fn){return typeof fn==="function"||toStr.call(fn)==="[object Function]"};var toInteger=function toInteger(value){var number=Number(value);if(isNaN(number)){return 0}if(number===0||!isFinite(number)){return number}return(number>0?1:-1)*Math.floor(Math.abs(number))};var maxSafeInteger=Math.pow(2,53)-1;var toLength=function toLength(value){var len=toInteger(value);return Math.min(Math.max(len,0),maxSafeInteger)};return function from(arrayLike){var C=this;var items=Object(arrayLike);if(arrayLike==null){throw new TypeError("Array.from requires an array-like object - not null or undefined")}var mapFn=arguments.length>1?arguments[1]:void undefined;var T;if(typeof mapFn!=="undefined"){if(!isCallable(mapFn)){throw new TypeError("Array.from: when provided, the second argument must be a function")}if(arguments.length>2){T=arguments[2]}}var len=toLength(items.length);var A=isCallable(C)?Object(new C(len)):new Array(len);var k=0;var kValue;while(k0||node.parentNode){return}var children=documentElement.children;var beforeIndex=children.indexOf(before);if(beforeIndex<0){children.push(node)}else{children.splice(beforeIndex,0,node)}if(node.nodeType===1){if(node.role==="body"){node.docId=doc.id;node.ownerDocument=doc;node.parentNode=documentElement;linkParent(node,documentElement)}else{node.children.forEach(function(child){child.parentNode=node});setBody(doc,node);node.docId=doc.id;node.ownerDocument=doc;linkParent(node,documentElement);delete doc.nodeMap[node.nodeId]}documentElement.pureChildren.push(node);doc.listener.createBody(node)}else{node.parentNode=documentElement;doc.nodeMap[node.ref]=node}}function setBody(doc,el){el.role="body";el.depth=1;delete doc.nodeMap[el.nodeId];el.ref="_root";doc.nodeMap._root=el;doc.body=el}Document.prototype.createBody=function(type,props){if(!this.body){var el=new Element(type,props);setBody(this,el)}return this.body};Document.prototype.createElement=function(tagName,props){return new Element(tagName,props)};Document.prototype.createComment=function(text){return new Comment(text)};Document.prototype.fireEvent=function(el,type,e,domChanges){if(!el){return}e=e||{};e.type=type;e.target=el;e.timestamp=Date.now();if(domChanges){updateElement(el,domChanges)}return el.fireEvent(type,e)};Document.prototype.getRef=function(ref){return this.nodeMap[ref]};function updateElement(el,changes){var attrs=changes.attrs||{};for(var name in attrs){el.setAttr(name,attrs[name],true)}var style=changes.style||{};for(var _name in style){el.setStyle(_name,style[_name],true)}}function Node(){this.nodeId=(nextNodeRef++).toString();this.ref=this.nodeId;this.children=[];this.pureChildren=[];this.parentNode=null;this.nextSibling=null;this.previousSibling=null}Node.prototype.destroy=function(){var doc=instanceMap[this.docId];if(doc){delete this.docId;delete doc.nodeMap[this.nodeId]}this.children.forEach(function(child){child.destroy()})};function Element(){var type=arguments.length<=0||arguments[0]===undefined?DEFAULT_TAG_NAME:arguments[0];var props=arguments[1];props=props||{};this.nodeType=1;this.nodeId=(nextNodeRef++).toString();this.ref=this.nodeId;this.type=type;this.attr=props.attr||{};this.classStyle=props.classStyle||{};this.style=props.style||{};this.event={};this.children=[];this.pureChildren=[]}Element.prototype=new Node;Element.prototype.appendChild=function(node){if(node.parentNode&&node.parentNode!==this){return}if(!node.parentNode){linkParent(node,this);insertIndex(node,this.children,this.children.length,true);if(this.docId){registerNode(this.docId,node)}if(node.nodeType===1){insertIndex(node,this.pureChildren,this.pureChildren.length);if(this.docId){var listener=instanceMap[this.docId].listener;return listener.addElement(node,this.ref,-1)}}}else{moveIndex(node,this.children,this.children.length,true);if(node.nodeType===1){var index=moveIndex(node,this.pureChildren,this.pureChildren.length);if(this.docId&&index>=0){var _listener=instanceMap[this.docId].listener;return _listener.moveElement(node.ref,this.ref,index)}}}};Element.prototype.insertBefore=function(node,before){if(node.parentNode&&node.parentNode!==this){return}if(node===before||node.nextSibling===before){return}if(!node.parentNode){linkParent(node,this);insertIndex(node,this.children,this.children.indexOf(before),true);if(this.docId){registerNode(this.docId,node)}if(node.nodeType===1){var pureBefore=nextElement(before);var index=insertIndex(node,this.pureChildren,pureBefore?this.pureChildren.indexOf(pureBefore):this.pureChildren.length);if(this.docId){var listener=instanceMap[this.docId].listener;return listener.addElement(node,this.ref,index)}}}else{moveIndex(node,this.children,this.children.indexOf(before),true);if(node.nodeType===1){var _pureBefore=nextElement(before);var _index=moveIndex(node,this.pureChildren,_pureBefore?this.pureChildren.indexOf(_pureBefore):this.pureChildren.length);if(this.docId&&_index>=0){var _listener2=instanceMap[this.docId].listener;return _listener2.moveElement(node.ref,this.ref,_index)}}}};Element.prototype.insertAfter=function(node,after){if(node.parentNode&&node.parentNode!==this){return}if(node===after||node.previousSibling===after){return}if(!node.parentNode){linkParent(node,this);insertIndex(node,this.children,this.children.indexOf(after)+1,true);if(this.docId){registerNode(this.docId,node)}if(node.nodeType===1){var index=insertIndex(node,this.pureChildren,this.pureChildren.indexOf(previousElement(after))+1);if(this.docId){var listener=instanceMap[this.docId].listener;return listener.addElement(node,this.ref,index)}}}else{moveIndex(node,this.children,this.children.indexOf(after)+1,true);if(node.nodeType===1){var _index2=moveIndex(node,this.pureChildren,this.pureChildren.indexOf(previousElement(after))+1);if(this.docId&&_index2>=0){var _listener3=instanceMap[this.docId].listener;return _listener3.moveElement(node.ref,this.ref,_index2)}}}};Element.prototype.removeChild=function(node,preserved){if(node.parentNode){removeIndex(node,this.children,true);if(node.nodeType===1){removeIndex(node,this.pureChildren);if(this.docId){var listener=instanceMap[this.docId].listener;listener.removeElement(node.ref)}}}if(!preserved){node.destroy()}};Element.prototype.clear=function(){var _this2=this;if(this.docId){(function(){var listener=instanceMap[_this2.docId].listener;_this2.pureChildren.forEach(function(node){listener.removeElement(node.ref)})})()}this.children.forEach(function(node){node.destroy()});this.children.length=0;this.pureChildren.length=0};function nextElement(node){while(node){if(node.nodeType===1){return node}node=node.nextSibling}}function previousElement(node){while(node){if(node.nodeType===1){return node}node=node.previousSibling}}function linkParent(node,parent){node.parentNode=parent;if(parent.docId){node.docId=parent.docId;node.ownerDocument=parent.ownerDocument;node.ownerDocument.nodeMap[node.nodeId]=node;node.depth=parent.depth+1}node.children.forEach(function(child){linkParent(child,node)})}function registerNode(docId,node){var doc=instanceMap[docId];doc.nodeMap[node.nodeId]=node}function insertIndex(target,list,newIndex,changeSibling){if(newIndex<0){newIndex=0}var before=list[newIndex-1];var after=list[newIndex];list.splice(newIndex,0,target);if(changeSibling){before&&(before.nextSibling=target);target.previousSibling=before;target.nextSibling=after;after&&(after.previousSibling=target)}return newIndex}function moveIndex(target,list,newIndex,changeSibling){var index=list.indexOf(target);if(index<0){return-1}if(changeSibling){var before=list[index-1];var after=list[index+1];before&&(before.nextSibling=after);after&&(after.previousSibling=before)}list.splice(index,1);var newIndexAfter=newIndex;if(index<=newIndex){newIndexAfter=newIndex-1}var beforeNew=list[newIndexAfter-1];var afterNew=list[newIndexAfter];list.splice(newIndexAfter,0,target);if(changeSibling){beforeNew&&(beforeNew.nextSibling=target);target.previousSibling=beforeNew;target.nextSibling=afterNew;afterNew&&(afterNew.previousSibling=target)}if(index===newIndexAfter){return-1}return newIndex}function removeIndex(target,list,changeSibling){var index=list.indexOf(target);if(index<0){return}if(changeSibling){var before=list[index-1];var after=list[index+1];before&&(before.nextSibling=after);after&&(after.previousSibling=before)}list.splice(index,1)}Element.prototype.setAttr=function(key,value,silent){if(this.attr[key]===value&&silent!==false){return}this.attr[key]=value;if(!silent&&this.docId){var listener=instanceMap[this.docId].listener;listener.setAttr(this.ref,key,value)}};Element.prototype.setStyle=function(key,value,silent){if(this.style[key]===value&&silent!==false){return}this.style[key]=value;if(!silent&&this.docId){var listener=instanceMap[this.docId].listener;listener.setStyle(this.ref,key,value)}};Element.prototype.resetClassStyle=function(){for(var key in this.classStyle){this.classStyle[key]=""}};Element.prototype.setClassStyle=function(classStyle){this.resetClassStyle();(0,_utils.extend)(this.classStyle,classStyle);if(this.docId){var listener=instanceMap[this.docId].listener;listener.setStyles(this.ref,this.toStyle())}};Element.prototype.addEvent=function(type,handler){if(!this.event[type]){this.event[type]=handler;if(this.docId){var listener=instanceMap[this.docId].listener;listener.addEvent(this.ref,type)}}};Element.prototype.removeEvent=function(type){if(this.event[type]){delete this.event[type];if(this.docId){var listener=instanceMap[this.docId].listener;listener.removeEvent(this.ref,type)}}};Element.prototype.fireEvent=function(type,e){var handler=this.event[type];if(handler){return handler.call(this,e)}};Element.prototype.toStyle=function(){return(0,_utils.extend)({},this.classStyle,this.style)};Element.prototype.toJSON=function(){var result={ref:this.ref.toString(),type:this.type,attr:this.attr,style:this.toStyle()};var event=Object.keys(this.event);if(event.length){result.event=event}if(this.pureChildren.length){result.children=this.pureChildren.map(function(child){return child.toJSON()})}return result};Element.prototype.toString=function(){return"<"+this.type+" attr="+JSON.stringify(this.attr)+" style="+JSON.stringify(this.toStyle())+">"+this.pureChildren.map(function(child){return child.toString()}).join("")+""};function Comment(value){this.nodeType=8;this.nodeId=(nextNodeRef++).toString();this.ref=this.nodeId;this.type="comment";this.value=value;this.children=[];this.pureChildren=[]}Comment.prototype=new Node;Comment.prototype.toString=function(){return""}},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=Listener;exports.createAction=createAction;function Listener(id,handler){this.id=id;this.batched=false;this.updates=[];if(typeof handler==="function"){this.handler=handler}}Listener.prototype.createFinish=function(callback){var handler=this.handler;return handler([createAction("createFinish",[])],callback)};Listener.prototype.updateFinish=function(callback){var handler=this.handler;return handler([createAction("updateFinish",[])],callback)};Listener.prototype.refreshFinish=function(callback){var handler=this.handler;return handler([createAction("refreshFinish",[])],callback)};Listener.prototype.createBody=function(element){var body=element.toJSON();var children=body.children;delete body.children;var actions=[createAction("createBody",[body])];if(children){actions.push.apply(actions,children.map(function(child){return createAction("addElement",[body.ref,child,-1])}))}return this.addActions(actions)};Listener.prototype.addElement=function(element,ref,index){if(!(index>=0)){index=-1}return this.addActions(createAction("addElement",[ref,element.toJSON(),index]))};Listener.prototype.removeElement=function(ref){if(Array.isArray(ref)){var actions=ref.map(function(r){return createAction("removeElement",[r])});return this.addActions(actions)}return this.addActions(createAction("removeElement",[ref]))};Listener.prototype.moveElement=function(targetRef,parentRef,index){return this.addActions(createAction("moveElement",[targetRef,parentRef,index]))};Listener.prototype.setAttr=function(ref,key,value){var result={};result[key]=value;return this.addActions(createAction("updateAttrs",[ref,result]))};Listener.prototype.setStyle=function(ref,key,value){var result={};result[key]=value;return this.addActions(createAction("updateStyle",[ref,result]))};Listener.prototype.setStyles=function(ref,style){return this.addActions(createAction("updateStyle",[ref,style]))};Listener.prototype.addEvent=function(ref,type){return this.addActions(createAction("addEvent",[ref,type]))};Listener.prototype.removeEvent=function(ref,type){return this.addActions(createAction("removeEvent",[ref,type]))};Listener.prototype.handler=function(actions,cb){return cb&&cb()};Listener.prototype.addActions=function(actions){var updates=this.updates;var handler=this.handler;if(!Array.isArray(actions)){actions=[actions]}if(this.batched){updates.push.apply(updates,actions)}else{return handler(actions)}};function createAction(name,args){return{module:"dom",method:name,args:args}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _weexRxFramework=__webpack_require__(83);var Rx=_interopRequireWildcard(_weexRxFramework);var _vanilla=__webpack_require__(85);var Vanilla=_interopRequireWildcard(_vanilla);var _default=__webpack_require__(86);var Weex=_interopRequireWildcard(_default);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}exports.default={Rx:Rx,Vanilla:Vanilla,Weex:Weex}},function(module,exports,__webpack_require__){(function(global){"use strict";var _typeof2=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"])_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr)){return arr}else if(Symbol.iterator in Object(arr)){return sliceIterator(arr,i)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();var _typeof=typeof Symbol==="function"&&_typeof2(Symbol.iterator)==="symbol"?function(obj){return typeof obj==="undefined"?"undefined":_typeof2(obj)}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj==="undefined"?"undefined":_typeof2(obj)};exports.getInstance=getInstance;exports.init=init;exports.registerComponents=registerComponents;exports.registerMethods=registerMethods;exports.registerModules=registerModules;exports.createInstance=createInstance;exports.refreshInstance=refreshInstance;exports.destroyInstance=destroyInstance;exports.getRoot=getRoot;exports.receiveTasks=receiveTasks;var _builtinModulesCode=__webpack_require__(84);var _builtinModulesCode2=_interopRequireDefault(_builtinModulesCode);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i2?a-2:0),d=2;d2?f-2:0),c=2;c=c,e.isDesktop=r=!/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent)),e.isWeex=o,e.isWeb=t,e.isWidescreen=i,e.isDesktop=r,e}(),i=function(e){"use strict";return e=t}(),o.exports=i});\ndefine("kg/rx-promise/index",["kg/rx-env/index"],function(e,t,n){var o,r,i,u=e("kg/rx-env/index");o=function(e){function t(){}function n(e,t){return function(){e.apply(t,arguments)}}function o(e){if("object"!==d(this))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(e,this)}function r(e,t){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(t):(e._handled=!0,void a(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null===n)return void(1===e._state?i:u)(t.promise,e._value);var o;try{o=n(e._value)}catch(r){return void u(t.promise,r)}i(t.promise,o)}))}function i(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"===("undefined"==typeof t?"undefined":d(t))||"function"==typeof t)){var r=t.then;if(t instanceof o)return e._state=3,e._value=t,void f(e);if("function"==typeof r)return void l(n(r,t),e)}e._state=1,e._value=t,f(e)}catch(i){u(e,i)}}function u(e,t){e._state=2,e._value=t,f(e)}function f(e){2===e._state&&0===e._deferreds.length&&a(function(){e._handled||p(e._value)});for(var t=0,n=e._deferreds.length;t-1?e:t}function p(t,e){e=e||{};var r=e.body;if(p.prototype.isPrototypeOf(t)){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new o(t.headers)),this.method=t.method,this.mode=t.mode,r||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=t;if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new o(e.headers)),this.method=c(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r,e)}function y(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\\+/g," "),o=r.join("=").replace(/\\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function m(t){var e=new o,r=t.getAllResponseHeaders().trim().split("\\n");return r.forEach(function(t){var r=t.trim().split(":"),n=r.shift().trim(),o=r.join(":").trim();e.append(n,o)}),e}function b(t,e){e||(e={}),this._initBody(t,e),this.type="default",this.status=e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText,this.headers=e.headers instanceof o?e.headers:new o(e.headers),this.url=e.url||""}t={},Object.defineProperty(t,"__esModule",{value:!0});var w=a,v=e(w),T=u,x="undefined"!=typeof x?x:"undefined"!=typeof global?global:"undefined"!=typeof window?window:{};o.prototype.append=function(t,e){t=r(t),e=n(e);var o=this.map[t];o||(o=[],this.map[t]=o),o.push(e)},o.prototype["delete"]=function(t){delete this.map[r(t)]},o.prototype.get=function(t){var e=this.map[r(t)];return e?e[0]:null},o.prototype.getAll=function(t){return this.map[r(t)]||[]},o.prototype.has=function(t){return this.map.hasOwnProperty(r(t))},o.prototype.set=function(t,e){this.map[r(t)]=[n(e)]},o.prototype.forEach=function(t,e){Object.getOwnPropertyNames(this.map).forEach(function(r){this.map[r].forEach(function(n){t.call(e,n,r,this)},this)},this)};var _={blob:"FileReader"in x&&"Blob"in x&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in x,arrayBuffer:"ArrayBuffer"in x},g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];p.prototype.clone=function(){return new p(this)},h.call(p.prototype),h.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new o(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];b.redirect=function(t,e){if(E.indexOf(e)===-1)throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})};var O=function(t,e){return new v["default"](function(r,n){var o;if(o=p.prototype.isPrototypeOf(t)&&!e?t:new p(t,e),T.isWeex){var s=d;if(s.fetch){var i={url:o.url,method:o.method,header:o.headers&&o.headers.originHeaders,body:o.body};i.type=e&&e.dataType?e.dataType:"json",s.fetch(i,function(t){try{"string"==typeof t&&(t=JSON.parse(t));var e="string"==typeof t.data?t.data:JSON.stringify(t.data),s=new b(e,{status:t.status,statusText:t.statusText,headers:t.headers,url:o.url});r(s)}catch(i){n(i)}},function(t){})}else s.sendHttp&&s.sendHttp({url:o.url,method:o.method,header:o.headers&&o.headers.originHeaders,body:o.body},function(t){r(new b(t,{status:200}))})}else{var a,u;!function(){var t=function(){return"responseURL"in a?a.responseURL:/^X-Request-URL:/m.test(a.getAllResponseHeaders())?a.getResponseHeader("X-Request-URL"):void 0},e=function(){if(4===a.readyState){var e=1223===a.status?204:a.status;if(e<100||e>599){if(u)return;return u=!0,void n(new TypeError("Network request failed"))}var o={status:e,statusText:a.statusText,headers:m(a),url:t()},s="response"in a?a.response:a.responseText;u||(u=!0,r(new b(s,o)))}};a=new XMLHttpRequest,u=!1,a.onreadystatechange=e,a.onload=e,a.onerror=function(){u||(u=!0,n(new TypeError("Network request failed")))},a.open(o.method,o.url,!0);try{"include"===o.credentials&&("withCredentials"in a?a.withCredentials=!0:console&&console.warn&&console.warn("withCredentials is not supported, you can ignore this warning"))}catch(s){console&&console.warn&&console.warn("set withCredentials error:"+s)}"responseType"in a&&_.blob&&(a.responseType="blob"),o.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),a.send("undefined"==typeof o._bodyInit?null:o._bodyInit)}()}})};return t["default"]=O,t=t["default"]}(),o=function(t){function e(t){return t&&t.__esModule?t:{"default":t}}function r(){return"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random())}function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function o(t){document.getElementsByTagName("head")[0].removeChild(t)}t={},Object.defineProperty(t,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},i=a,f=e(i),l=u,h={timeout:5e3,jsonpCallback:"callback"},c=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(!l.isWeex)return new f["default"](function(s,i){var a=null!=e.timeout?e.timeout:h.timeout,u=null!=e.jsonpCallback?e.jsonpCallback:h.jsonpCallback,d=void 0,l=e.jsonpCallbackFunctionName||r(),c=document.createElement("script");window[l]=function(t){s({ok:!0,json:function(){return f["default"].resolve(t)}}),d&&clearTimeout(d),o(c),n(l)},t+=t.indexOf("?")===-1?"?":"&",c.setAttribute("src",t+u+"="+l),document.getElementsByTagName("head")[0].appendChild(c),d=setTimeout(function(){i(new Error("JSONP request to "+t+" timed out")),n(l),o(c)},a)});var i=function(){var e=d;return e.fetch?{v:new f["default"](function(r,n){var o={url:t,method:"GET",type:"jsonp"};e.fetch(o,function(t){try{if("string"==typeof t&&(t=JSON.parse(t),t.data&&"string"==typeof t.data&&t.ok))try{t.data=JSON.parse(t.data)}catch(e){throw"the response.data in not valid json"}r({ok:t.ok,status:t.status,statusText:t.statusText,data:t.data,json:function(){return f["default"].resolve(t.data)}})}catch(e){n(e)}},function(t){})})}:e.sendHttp?{v:new f["default"](function(r,n){e.sendHttp({url:t,method:"GET"},function(t){"string"==typeof t&&(t=JSON.parse(t)),r({status:200,json:function(){return f["default"].resolve(t)}})})})}:{v:f["default"].reject("No fetch or sendhttp service")}}();return"object"===("undefined"==typeof i?"undefined":s(i))?i.v:void 0};return t["default"]=c,t=t["default"]}(),s=function(t){function e(t){return t&&t.__esModule?t:{"default":t}}t={},Object.defineProperty(t,"__esModule",{value:!0});var r=n,s=e(r),i=o,a=e(i),d=u,f=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=void 0;return 0===t.indexOf("//")&&console.error("Failed to parse URL from "+t+", URL scheme is must in Weex. "),r="jsonp"===e.mode?(0,a["default"])(t,e):d.isWeex?(0,s["default"])(t,e):"undefined"!=typeof fetch?fetch(t,e):(0,s["default"])(t,e)};return t["default"]=f,t=t["default"]}(),i=function(t){"use strict";return t=s}(),r.exports=i});\ndefine("kg/rx-downgrade/index",["@weex-module/instanceWrap"],function(e,r,n){var t,o,i,a=e("@weex-module/instanceWrap");t=function(e){e={},Object.defineProperty(e,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};return e["default"]={satisfies:function(e,n){var t=/(\\W+)?([\\d|.]+)/;if(("undefined"==typeof e?"undefined":r(e))+("undefined"==typeof n?"undefined":r(n))!="stringstring")return!1;if("*"==n)return!0;for(var o=n.match(t),i=e.split("."),a=o[2].split("."),f=Math.max(i.length,a.length),u=0,d=0;d0||parseInt(i[d])>parseInt(a[d])){u=1;break}if(a[d]&&!i[d]&&parseInt(a[d])>0||parseInt(i[d])":if(1===u)return!0;break;case">=":if(u!==-1)return!0;break;default:if(0===u)return!0}return!1}},e=e["default"]}(),o=function(e){function r(e){return e&&e.__esModule?e:{"default":e}}function n(e){if("*"==e)return e;e="string"==typeof e?e:"";for(var r=e.split("."),n=0,t=[];n<3;){var o="string"==typeof r[n]&&r[n]?r[n]:"0";t.push(o),n++}return t.join(".")}function o(e,r,n){var t={isDowngrade:!0,errorType:1,code:1e3},o=function(e,r,n){return"Downgrade["+e+"] :: deviceInfo "+r+" matched criteria "+n},i=e.toLowerCase();return i.indexOf("osversion")>=0?t.code=1001:i.indexOf("appversion")>=0?t.code=1002:i.indexOf("weexversion")>=0?t.code=1003:i.indexOf("devicemodel")>=0&&(t.code=1004),t.errorMessage=o(e,r,n),t}function i(e){var r={isDowngrade:!1};if(!d)return r;var t=WXEnvironment,i=t.platform||"unknow",a=i.toLowerCase(),f=e[a]||{};for(var s in t){var c=s,l=c.toLowerCase(),p=t[s],v=l.indexOf("version")>=0,y=l.indexOf("devicemodel")>=0,b=f[s];if(b&&v){var g=n(b),m=n(t[s]);if(u["default"].satisfies(m,g)){r=o(c,p,b);break}}else if(y){var w="array"==typeof b?b:[b];if(w.indexOf(p)>=0){r=o(c,p,b);break}}}return r}e={},Object.defineProperty(e,"__esModule",{value:!0});var f=t,u=r(f),d="undefined"!=typeof callNative;return e["default"]={setting:function(e){if(d){var r=i(e.downgrade);if(r.isDowngrade){var n=a;return n.error(r.errorType,r.code,r.errorMessage),!0}}return!1}},e=e["default"]}(),i=function(e){function r(e){return e&&e.__esModule?e:{"default":e}}e={},Object.defineProperty(e,"__esModule",{value:!0});var n=o,t=r(n);return e["default"]=t["default"],e=e["default"]}(),n.exports=i});\ndefine("kg/rx-animated/index",["kg/rx/index","kg/rx-components/index"],function(t,e,n){var r,i,o,a,u,s,c,l,f,h,p,_,y,v,d,b,m,g,w,k,O,j,V,P,x,E,T,C,A,R,F,M,S,I,U,L,q=t("kg/rx/index"),D=t("kg/rx-components/index");r=function(t){"use strict";var e=function(t,e,n,r,i,o,a,u){if(!t){var s;if(void 0===e)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,o,a,u],l=0;s=new Error(e.replace(/%s/g,function(){return c[l++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}};return t=e}(),i=function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(t,e){for(var n=0;n>>0===t&&t>=0&&t<=4294967295?t:null:(e=f.hex6.exec(t))?parseInt(e[1]+"ff",16)>>>0:h.hasOwnProperty(t)?h[t]:(e=f.rgb.exec(t))?(o(e[1])<<24|o(e[2])<<16|o(e[3])<<8|255)>>>0:(e=f.rgba.exec(t))?(o(e[1])<<24|o(e[2])<<16|o(e[3])<<8|u(e[4]))>>>0:(e=f.hex3.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=f.hex8.exec(t))?parseInt(e[1],16)>>>0:(e=f.hex4.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=f.hsl.exec(t))?(255|r(a(e[1]),s(e[2]),s(e[3])))>>>0:(e=f.hsla.exec(t))?(r(a(e[1]),s(e[2]),s(e[3]))|u(e[4]))>>>0:null}function n(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function r(t,e,r){var i=r<.5?r*(1+e):r+e-r*e,o=2*r-i,a=n(o,i,t+1/3),u=n(o,i,t),s=n(o,i,t-1/3);return Math.round(255*a)<<24|Math.round(255*u)<<16|Math.round(255*s)<<8}function i(){for(var t=arguments.length,e=Array(t),n=0;n255?255:e}function a(t){var e=parseFloat(t);return(e%360+360)%360/360}function u(t){var e=parseFloat(t);return e<0?0:e>1?255:Math.round(255*e)}function s(t){var e=parseFloat(t,10);return e<0?0:e>100?1:e/100}var c="[-+]?\\\\d*\\\\.?\\\\d+",l=c+"%",f={rgb:new RegExp("rgb"+i(c,c,c)),rgba:new RegExp("rgba"+i(c,c,c,c)),hsl:new RegExp("hsl"+i(c,l,l)),hsla:new RegExp("hsla"+i(c,l,l,c)),hex3:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex4:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#([0-9a-fA-F]{6})$/,hex8:/^#([0-9a-fA-F]{8})$/},h={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};return t=e}(),s=function(t){"use strict";var e=0;return t=function(){return String(e++)}}(),c=function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(t,e){for(var n=0;n0?n=u:e=u;while(Math.abs(a)>l&&++s=c?u(e,_,t,n):0===y?_:a(e,r,r+p,t,n)}if(!(0<=t&&t<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");var l=_?new Float32Array(h):new Array(h);if(t!==e||n!==r)for(var f=0;f18&&t<=44?c(t):l(t)}var h=i(t/1.7,0,20);h=o(h,0,.8);var p=i(r/1.7,0,20),_=o(p,.5,200),y=u(h,f(_),.01);return{tension:e(_),friction:n(y)}}return t={fromOrigamiTensionAndFriction:r,fromBouncinessAndSpeed:i}}(),b=function(t){function e(t){var e=Object.keys(t)[0],n="";return 0===e.indexOf("translate")&&(n="rem"),e+"("+t[e]+n+")"}function n(t){return t&&t.transform&&"string"!=typeof t.transform&&(t.transform=t.transform.map(e).join(" ")),t}return t={},Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,t=t["default"]}(),m=function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){if(!t)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)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:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;nn){if("identity"===u)return s;"clamp"===u&&(s=n)}return r===i?r:e===n?t<=e?r:i:(e===-(1/0)?s=-s:n===1/0?s-=e:s=(s-e)/(n-e),s=o(s),r===-(1/0)?s=-s:i===1/0?s+=r:s=s*(i-r)+r,s)}function i(t){var e=p(t);if(null===e)return t;e=e||0;var n=(4278190080&e)>>>24,r=(16711680&e)>>>16,i=(65280&e)>>>8,o=(255&e)/255;return"rgba("+n+", "+r+", "+i+", "+o+")"}function o(t){var e=t.outputRange;_(e.length>=2,"Bad output range"),e=e.map(i),a(e);var n=e[0].match(d).map(function(){return[]});e.forEach(function(t){t.match(d).forEach(function(t,e){n[e].push(+t)})});var r=e[0].match(d).map(function(e,r){return v.create(f({},t,{outputRange:n[r]}))}),o=/^rgb/.test(e[0]);return function(t){var n=0;return e[0].replace(d,function(){var e=r[n++](t);return String(o&&n<4?Math.round(e):e)})}}function a(t){for(var e=t[0].replace(d,""),n=1;n=t);++n);return n-1}function c(t){_(t.length>=2,"inputRange must have at least 2 elements");for(var e=1;e=t[e-1],"inputRange must be monotonically increasing "+t)}function l(t,e){_(e.length>=2,t+" must have at least 2 elements"),_(2!==e.length||e[0]!==-(1/0)||e[1]!==1/0,t+"cannot be ]-infinity;+infinity[ "+e)}var f=Object.assign||function(t){for(var e=1;e0?1:0}},{key:"step1",value:function(t){return t>=1?1:0}},{key:"linear",value:function(t){return t}},{key:"ease",value:function(t){return o(t)}},{key:"quad",value:function(t){return t*t}},{key:"cubic",value:function(t){return t*t*t}},{key:"poly",value:function(t){return function(e){return Math.pow(e,t)}}},{key:"sin",value:function(t){return 1-Math.cos(t*Math.PI/2)}},{key:"circle",value:function(t){return 1-Math.sqrt(1-t*t)}},{key:"exp",value:function(t){return Math.pow(2,10*(t-1))}},{key:"elastic",value:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],e=t*Math.PI;return function(t){return 1-Math.pow(Math.cos(t*Math.PI/2),3)*Math.cos(t*e)}}},{key:"back",value:function(t){return void 0===t&&(t=1.70158),function(e){return e*e*((t+1)*e-t)}}},{key:"bounce",value:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?(t-=1.5/2.75,7.5625*t*t+.75):t<2.5/2.75?(t-=2.25/2.75,7.5625*t*t+.9375):(t-=2.625/2.75,7.5625*t*t+.984375)}},{key:"bezier",value:function(t,e,n,i){return r(t,e,n,i)}},{key:"in",value:function(t){return t}},{key:"out",value:function(t){return function(e){return 1-t(1-e)}}},{key:"inOut",value:function(t){return function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}}}]),t}(),o=i.bezier(.42,0,1,1);return t=i}(),j=function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){if(!t)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)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:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=Object.assign||function(t){for(var e=1;e=this._startTime+this._duration?(0===this._duration?this._onUpdate(this._toValue):this._onUpdate(this._fromValue+this._easing(1)*(this._toValue-this._fromValue)),void this.__debouncedOnEnd({finished:!0})):(this._onUpdate(this._fromValue+this._easing((t-this._startTime)/this._duration)*(this._toValue-this._fromValue)),void(this.__active&&(this._animationFrame=u.current(this.onUpdate.bind(this)))))}},{key:"stop",value:function(){this.__active=!1,clearTimeout(this._timeout),s.current(this._animationFrame),this.__debouncedOnEnd({finished:!1})}}]),o}(o);return t=f}(),M=function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){if(!t)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)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:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function o(t,e){return void 0===t||null===t?e:t}var a=function(){function t(t,e){for(var n=0;nthis._lastTime+i&&(o=this._lastTime+i);for(var a=1,u=Math.floor((o-this._lastTime)/a),c=0;cthis._toValue:t1?e-1:0),r=1;rt&&(a+=r&&o?c.currentPageX:r&&!o?c.currentPageY:!r&&o?c.previousPageX:c.previousPageY,u=1);else for(var s in i){var p=i[s];if(null!==p&&void 0!==p&&p.touchActive&&p.currentTimeStamp>=t){var d;d=r&&o?p.currentPageX:r&&!o?p.currentPageY:!r&&o?p.previousPageX:p.previousPageY,a+=d,u++}}return u>0?a/u:n.noCentroid},currentCentroidXOfTouchesChangedAfter:function(e,t){return n.centroidDimension(e,t,!0,!0)},currentCentroidYOfTouchesChangedAfter:function(e,t){return n.centroidDimension(e,t,!1,!0)},previousCentroidXOfTouchesChangedAfter:function(e,t){return n.centroidDimension(e,t,!0,!1)},previousCentroidYOfTouchesChangedAfter:function(e,t){return n.centroidDimension(e,t,!1,!1)},currentCentroidX:function(e){return n.centroidDimension(e,0,!0,!0)},currentCentroidY:function(e){return n.centroidDimension(e,0,!1,!0)},noCentroid:-1};return e=n}(),r=function(e){"use strict";function n(e){return e&&Array.prototype.slice.call(e)||[]}function t(e,t){var o=t.timeStamp||t.timestamp;return n(e).map(function(e){return{clientX:e.clientX,clientY:e.clientY,force:e.force,pageX:e.pageX,pageY:e.pageY,radiusX:e.radiusX,radiusY:e.radiusY,rotationAngle:e.rotationAngle,screenX:e.screenX,screenY:e.screenY,target:e.target||t.target,timestamp:o,identifier:e.identifier||1}})}var o={touchBank:{},numberActiveTouches:0,indexOfSingleActiveTouch:-1,mostRecentTimeStamp:0},r=function(e){return{touchActive:!0,startTimeStamp:e.timestamp,startPageX:e.pageX,startPageY:e.pageY,currentPageX:e.pageX,currentPageY:e.pageY,currentTimeStamp:e.timestamp,previousPageX:e.pageX,previousPageY:e.pageY,previousTimeStamp:e.timestamp}},i=function(e,n){e.touchActive=!0,e.startTimeStamp=n.timestamp,e.startPageX=n.pageX,e.startPageY=n.pageY,e.currentPageX=n.pageX,e.currentPageY=n.pageY,e.currentTimeStamp=n.timestamp,e.previousPageX=n.pageX,e.previousPageY=n.pageY,e.previousTimeStamp=n.timestamp},a=function(e){var n=o.touchBank,t=e.identifier,a=n[t];a?i(a,e):n[e.identifier]=r(e),o.mostRecentTimeStamp=e.timestamp},u=function(e){var n=o.touchBank,t=n[e.identifier];t.touchActive=!0,t.previousPageX=t.currentPageX,t.previousPageY=t.currentPageY,t.previousTimeStamp=t.currentTimeStamp,t.currentPageX=e.pageX,t.currentPageY=e.pageY,t.currentTimeStamp=e.timestamp,o.mostRecentTimeStamp=e.timestamp},c=function(e){var n=o.touchBank,t=n[e.identifier];t.previousPageX=t.currentPageX,t.previousPageY=t.currentPageY,t.previousTimeStamp=t.currentTimeStamp,t.currentPageX=e.pageX,t.currentPageY=e.pageY,t.currentTimeStamp=e.timestamp,t.touchActive=!1,o.mostRecentTimeStamp=e.timestamp},s={recordTouchTrack:function(e,n){var r=o.touchBank,i=t(n.changedTouches||[n],n);if("move"===e)i.forEach(u);else if("start"===e)i.forEach(a),o.numberActiveTouches=i.length,1===o.numberActiveTouches&&(o.indexOfSingleActiveTouch=i[0].identifier);else if("end"===e&&(i.forEach(c),o.numberActiveTouches=i.length,1===o.numberActiveTouches))for(var s in r){var p=r[s];if(null!=p&&p.touchActive){o.indexOfSingleActiveTouch=s;break}}},touchHistory:o};return e=s}(),i=function(e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},t=o,i=r,a=t.currentCentroidXOfTouchesChangedAfter,u=t.currentCentroidYOfTouchesChangedAfter,c=t.previousCentroidXOfTouchesChangedAfter,s=t.previousCentroidYOfTouchesChangedAfter,p=t.currentCentroidX,d=t.currentCentroidY,m={_initializeGestureState:function(e){e.moveX=0,e.moveY=0,e.x0=0,e.y0=0,e.dx=0,e.dy=0,e.vx=0,e.vy=0,e.numberActiveTouches=0,e._accountsForMovesUpTo=0},_updateGestureStateOnMove:function(e,n){e.numberActiveTouches=n.numberActiveTouches,e.moveX=a(n,e._accountsForMovesUpTo),e.moveY=u(n,e._accountsForMovesUpTo);var t=e._accountsForMovesUpTo,o=c(n,t),r=a(n,t),i=s(n,t),p=u(n,t),d=e.dx+(r-o),m=e.dy+(p-i),v=n.mostRecentTimeStamp-e._accountsForMovesUpTo;e.vx=(d-e.dx)/v,e.vy=(m-e.dy)/v,e.dx=d,e.dy=m,e._accountsForMovesUpTo=n.mostRecentTimeStamp},create:function(e){var t={stateID:Math.random()};m._initializeGestureState(t);var o={onStartShouldSetResponder:function(n){return void 0!==e.onStartShouldSetPanResponder&&e.onStartShouldSetPanResponder(n,t)},onMoveShouldSetResponder:function(n){return void 0!==e.onMoveShouldSetPanResponder&&e.onMoveShouldSetPanResponder(n,t)},onStartShouldSetResponderCapture:function(n){return 1===n.nativeEvent.touches.length&&m._initializeGestureState(t),t.numberActiveTouches=i.touchHistory.numberActiveTouches,void 0!==e.onStartShouldSetPanResponderCapture&&e.onStartShouldSetPanResponderCapture(n,t)},onMoveShouldSetResponderCapture:function(n){var o=i.touchHistory;return t._accountsForMovesUpTo!==o.mostRecentTimeStamp&&(m._updateGestureStateOnMove(t,o),!!e.onMoveShouldSetPanResponderCapture&&e.onMoveShouldSetPanResponderCapture(n,t))}},r={onResponderGrant:function(n){return t.x0=p(i.touchHistory),t.y0=d(i.touchHistory),t.dx=0,t.dy=0,e.onPanResponderGrant&&e.onPanResponderGrant(n,t),void 0===e.onShouldBlockNativeResponder||e.onShouldBlockNativeResponder()},onResponderReject:function(n){e.onPanResponderReject&&e.onPanResponderReject(n,t)},onResponderRelease:function(n){e.onPanResponderRelease&&e.onPanResponderRelease(n,t),m._initializeGestureState(t)},onResponderTerminate:function(n){e.onPanResponderTerminate&&e.onPanResponderTerminate(n,t),m._initializeGestureState(t)},onResponderTerminationRequest:function(n){return void 0===e.onPanResponderTerminationRequest||e.onPanResponderTerminationRequest(n,t)}},a=!1,u={onPanStart:function(n){if(a=!0,i.recordTouchTrack("start",n),!o.onStartShouldSetResponder(n))return r.onResponderReject(n);r.onResponderGrant(n);var u=i.touchHistory;t.numberActiveTouches=u.numberActiveTouches,e.onPanResponderStart&&e.onPanResponderStart(n,t)},onPanMove:function(n){if(a&&(i.recordTouchTrack("move",n),o.onMoveShouldSetResponder(n))){var r=i.touchHistory;t._accountsForMovesUpTo!==r.mostRecentTimeStamp&&(m._updateGestureStateOnMove(t,r),e.onPanResponderMove&&e.onPanResponderMove(n,t))}},onPanEnd:function(n){a=!1,i.recordTouchTrack("end",n);var o=i.touchHistory;t.numberActiveTouches=o.numberActiveTouches,e.onPanResponderEnd&&e.onPanResponderEnd(n,t),r.onResponderRelease(n)}};return"undefined"==typeof callNative&&"object"===("undefined"==typeof window?"undefined":n(window))&&(u="ontouchstart"in window?{onTouchStart:u.onPanStart,onTouchMove:u.onPanMove,onTouchEnd:u.onPanEnd}:{onMouseDown:u.onPanStart,onMouseMove:u.onPanMove,onMouseUp:u.onPanEnd}),{panHandlers:u}}};return e=m}(),a=function(e){"use strict";return e=i}(),t.exports=a});\ndefine("kg/rx-toast/index",["kg/rx-env/index","@weex-module/modal"],function(e,t,n){var o,i,r=e("kg/rx-env/index"),a=e("@weex-module/modal");o=function(e){function t(e){if(!f){f=document.createElement("div");for(var t in m.container)f.style[t]=m.container[t];document.body.appendChild(f)}f.style.transform="translateX(-50%)",f.style.webkitTransform="translateX(-50%)",f.innerHTML=e}function n(){f&&setTimeout(function(){f.style.transform="translateX(-50%) scale(0.8)",f.style.webkitTransform="translateX(-50%) scale(0.8)"},0)}e={},Object.defineProperty(e,"__esModule",{value:!0});var o=r,i=3500,s=2e3,l=[],u=!1,f=void 0,d={push:function(e,t){l.push({message:e,duration:t}),this.show()},show:function(){var e=this;if(!l.length)return f&&f.parentNode.removeChild(f),void(f=null);if(!u){u=!0;var o=l.shift();t(o.message),setTimeout(function(){n(),u=!1,setTimeout(function(){return e.show()},600)},o.duration)}}},c={SHORT:s,LONG:i,show:function(e){var t=arguments.length<=1||void 0===arguments[1]?s:arguments[1];if(o.isWeex){var n=a;n.toast&&n.toast({message:e,duration:Number(t)/1e3})}else d.push(e,t)}},m={container:{backgroundColor:"rgba(0, 0, 0, 0.6)",boxSizing:"border-box",maxWidth:"80%",color:"#ffffff",padding:"8px 16px",position:"fixed",left:"50%",bottom:"50%",fontSize:"16px",lineHeight:"32px",fontWeight:"600",borderRadius:"4px",textAlign:"center",transition:"all 0.4s ease-in-out",webkitTransition:"all 0.4s ease-in-out",transform:"translateX(-50%)",webkitTransform:"translateX(-50%)",zIndex:9999}};return e["default"]=c,e=e["default"]}(),i=function(e){"use strict";return e=o}(),n.exports=i});\ndefine("kg/rx-alert/index",["@weex-module/modal"],function(n,t,e){var o,r,i=n("@weex-module/modal");o=function(n){function t(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}n={},Object.defineProperty(n,"__esModule",{value:!0});var e=function(){function n(n,t){for(var e=0;e-1?t&&t(e):o&&o(e)})}else if("undefined"!=typeof lib&&lib.mtop)return lib.mtop.request(e,t,o)},config:function(e,i){n||"undefined"!=typeof lib&&lib.mtop&&("string"==typeof e?lib.mtop.config[e]=i:lib.mtop.config=t({},lib.mtop.config,conf))},RESPONSE_TYPE:i},e=e["default"]}(),o=function(e){"use strict";return e=i}(),n.exports=o});\ndefine("kg/rx-user/index",["@weex-module/user"],function(i,e,n){var o,l,t=i("@weex-module/user");o=function(i){i={},Object.defineProperty(i,"__esModule",{value:!0});var e="undefined"!=typeof callNative;return i["default"]={getUserInfo:function(i){if(e){var n=t;n.getUserInfo&&n.getUserInfo(function(e){"string"==typeof e&&(e=JSON.parse(e)),i(e)})}else"undefined"!=typeof lib&&lib.login&&lib.login.isLogin(function(e,n){var o=n?n.data||{}:{};i({isLogin:e,info:{userId:o.userNumId,nick:o.nick}})})},login:function(i){if(e){var n=t;n.login&&n.login(i)}else"undefined"!=typeof lib&&lib.login&&(lib.login.isLogin()?i&&i():lib.login.goLogin())},logout:function(i){if(e){var n=t;n.logout&&n.logout(i)}else"undefined"!=typeof lib&&lib.login&&(lib.login.isLogin()?lib.login.goLogout():i&&i())}},i=i["default"]}(),l=function(i){"use strict";return i=o}(),n.exports=l});\ndefine("kg/rx-windvane/index",["@weex-module/windvane"],function(e,n,a){var i,l,d=e("@weex-module/windvane");i=function(e){e={},Object.defineProperty(e,"__esModule",{value:!0});var n="undefined"!=typeof callNative,a="undefined"!=typeof WindVane,i={};return i.call=function(e,l,t,u,f){if(n){var r=d;r.call&&r.call({"class":e,method:l,data:t},u)}else a&&WindVane.isAvailable?(i.isAvailable=WindVane.isAvailable,WindVane.call(e,l,t,u,f)):f&&f({msg:"\\u6d4f\\u89c8\\u5668\\u4e0d\\u652f\\u6301 windvane",ret:["HY_NOT_SUPPORT_DEVICE"]})},e["default"]=i,e=e["default"]}(),l=function(e){"use strict";return e=i}(),a.exports=l});\ndefine("kg/rx-spm/index",["@weex-module/pageInfo"],function(e,n,t){var o,g,i=e("@weex-module/pageInfo");o=function(e){e={},Object.defineProperty(e,"__esModule",{value:!0});var n="undefined"!=typeof callNative,t=("undefined"!=typeof WindVane,"undefined"!=typeof window),o=["0","0"];return e["default"]={getPageSPM:function(){return n||t&&window.goldlog&&(o=goldlog.spm_ab||o),o},getSPM:function(e,n){return[].concat(this.getPageSPM(),e||0,n||0)},getSPMQueryString:function(e,n){return"spm="+this.getSPM(e,n).join(".")},setPageSPM:function(e,g){if(o[0]=e,o[1]=g,n){var d=i;d.setSpm&&d.setSpm(e,g)}else t&&window.goldlog&&goldlog.setPageSPM&&goldlog.setPageSPM(e,g)}},e=e["default"]}(),g=function(e){"use strict";return e=o}(),t.exports=g});\ndefine("kg/rx-goldlog/index",["kg/rx-env/index","kg/rx-spm/index","@weex-module/userTrack"],function(e,n,r){var t,o,i=e("kg/rx-env/index"),l=e("kg/rx-spm/index"),u=e("@weex-module/userTrack");t=function(e){function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){e="string"==typeof e?e:"";for(var n={},r=e.split("&"),t=0;t=t?r():l=setTimeout(r,t-e)),i}}e={},Object.defineProperty(e,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;ti.lastScrollDistance,l=t!=i.lastScrollContentSize;n&&o&&l&&(i.lastScrollContentSize=t,i.props.onEndReached(e)),i.lastScrollDistance=r}},i.resetScroll=function(e){s.isWeb&&(i.lastScrollContentSize=0,i.lastScrollDistance=0)},i.scrollTo=function(e){var t=parseInt(e.x),r=parseInt(e.y);if(s.isWeex){var n=O,o=(0,c.findDOMNode)(i.refs.contentContainer);n.scrollToElement(o.ref,{offset:t||r||0})}else{var l=document.documentElement.clientWidth/b;t>=0&&((0,c.findDOMNode)(i.refs.scroller).scrollLeft=l*t),r>=0&&((0,c.findDOMNode)(i.refs.scroller).scrollTop=l*r)}},l=n,o(i,l)}return i(t,e),u(t,[{key:"render",value:function(){var e=this,t=this.props,r=t.id,n=(t.style,t.scrollEventThrottle),o=t.showsHorizontalScrollIndicator,i=t.showsVerticalScrollIndicator,u=t.onEndReached,f=t.onEndReachedThreshold;f=parseInt(f,10);var d=[this.props.horizontal&&v.contentContainerHorizontal,this.props.contentContainerStyle];if(s.isWeex||this.props.horizontal||d.push(v.containerWebStyle),this.props.style){var h=["alignItems","justifyContent"].filter(function(t){return void 0!==e.props.style[t]});0!==h.length&&console.warn("ScrollView child layout ("+JSON.stringify(h)+") must be applied through the contentContainerStyle prop.")}var b=(0,c.createElement)(p["default"],{ref:"contentContainer",style:d},this.props.children),y=this.props.horizontal?v.baseHorizontal:v.baseVertical,m=a({},y,this.props.style),w=this.props.horizontal?o:i;if(s.isWeex)return(0,c.createElement)("scroller",{id:r,style:m,showScrollbar:w,onLoadmore:u,loadmoreoffset:f,scrollDirection:this.props.horizontal?"horizontal":"vertical"},b);var O=this.handleScroll;if(n&&(O=l(O,n)),!w&&!document.getElementById("rx-scrollview-style")){var _=document.createElement("style");_.id="rx-scrollview-style",document.head.appendChild(_),_.innerHTML="."+this.props.className+"::-webkit-scrollbar{display: none;}"}return m.webkitOverflowScrolling="touch",m.overflow="scroll",(0,c.createElement)(p["default"],a({},this.props,{ref:"scroller",style:m,onScroll:O}),b)}}]),t}(c.Component);y.defaultProps={scrollEventThrottle:h,onEndReachedThreshold:d,showsHorizontalScrollIndicator:!0,showsVerticalScrollIndicator:!0,className:"rx-scrollview"};var v={baseVertical:{flex:1,flexDirection:"column"},baseHorizontal:{flex:1,flexDirection:"row"},contentContainerHorizontal:{flexDirection:"row"},containerWebStyle:{display:"block"}};return e["default"]=y,e=e["default"]}(),p=function(e){function t(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e={},Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function e(e,t){for(var r=0;r1){for(var i=1;i-1||!(0,_util.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 unproxy(vm,key){if(!(0,_util.isReserved)(key)){delete vm[key]}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.arrayMethods=undefined;var _util=__webpack_require__(93);var arrayProto=Array.prototype;var arrayMethods=exports.arrayMethods=Object.create(arrayProto);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(method){var original=arrayProto[method];(0,_util.def)(arrayMethods,method,function mutator(){var i=arguments.length;var args=new Array(i);while(i--){args[i]=arguments[i]}var result=original.apply(this,args);var ob=this.__ob__;var inserted=void 0;switch(method){case"push":inserted=args;break;case"unshift":inserted=args;break;case"splice":inserted=args.slice(2);break}if(inserted)ob.observeArray(inserted);ob.dep.notify();return result})});(0,_util.def)(arrayProto,"$set",function $set(index,val){if(index>=this.length){this.length=index+1}return this.splice(index,1,val)[0]});(0,_util.def)(arrayProto,"$remove",function $remove(index){if(!this.length)return;if(typeof index!=="number"){index=this.indexOf(index)}if(index>-1){this.splice(index,1)}})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.build=build;var _util=__webpack_require__(93);var _state=__webpack_require__(94);var _directive=__webpack_require__(101);var _domHelper=__webpack_require__(103);function build(vm){var opt=vm._options||{};var template=opt.template||{};if(opt.replace){if(template.children&&template.children.length===1){compile(vm,template.children[0],vm._parentEl)}else{compile(vm,template.children,vm._parentEl)}}else{compile(vm,template,vm._parentEl)}console.debug('[JS Framework] "ready" lifecycle in Vm('+vm._type+")");vm.$emit("hook:ready");vm._ready=true}function compile(vm,target,dest,meta){var app=vm._app||{};if(app.lastSignal===-1){return}if(target.attr&&target.attr.hasOwnProperty("static")){vm._static=true}if(targetIsFragment(target)){compileFragment(vm,target,dest,meta);return}meta=meta||{};if(targetIsContent(target)){console.debug('[JS Framework] compile "content" block by',target);vm._content=(0,_domHelper.createBlock)(vm,dest);return}if(targetNeedCheckRepeat(target,meta)){console.debug('[JS Framework] compile "repeat" logic by',target);if(dest.type==="document"){console.warn("[JS Framework] The root element does't support `repeat` directive!")}else{compileRepeat(vm,target,dest)}return}if(targetNeedCheckShown(target,meta)){console.debug('[JS Framework] compile "if" logic by',target);if(dest.type==="document"){console.warn("[JS Framework] The root element does't support `if` directive!")}else{compileShown(vm,target,dest,meta)}return}var typeGetter=meta.type||target.type;if(targetNeedCheckType(typeGetter,meta)){compileType(vm,target,dest,typeGetter,meta);return}var type=typeGetter;var component=targetIsComposed(vm,target,type);if(component){console.debug("[JS Framework] compile composed component by",target);compileCustomComponent(vm,component,target,dest,type,meta);return}console.debug("[JS Framework] compile native component by",target);compileNativeComponent(vm,target,dest,type)}function targetIsFragment(target){return Array.isArray(target)}function targetIsContent(target){return target.type==="content"||target.type==="slot"}function targetNeedCheckRepeat(target,meta){return!meta.hasOwnProperty("repeat")&&target.repeat; +}function targetNeedCheckShown(target,meta){return!meta.hasOwnProperty("shown")&&target.shown}function targetNeedCheckType(typeGetter,meta){return typeof typeGetter==="function"&&!meta.hasOwnProperty("type")}function targetIsComposed(vm,target,type){var component=void 0;if(vm._app&&vm._app.customComponentMap){component=vm._app.customComponentMap[type]}if(vm._options&&vm._options.components){component=vm._options.components[type]}if(target.component){component=component||{}}return component}function compileFragment(vm,target,dest,meta){var fragBlock=(0,_domHelper.createBlock)(vm,dest);target.forEach(function(child){compile(vm,child,fragBlock,meta)})}function compileRepeat(vm,target,dest){var repeat=target.repeat;var oldStyle=typeof repeat==="function";var getter=repeat.getter||repeat.expression||repeat;if(typeof getter!=="function"){getter=function getter(){return[]}}var key=repeat.key||"$index";var value=repeat.value||"$value";var trackBy=repeat.trackBy||target.trackBy||target.attr&&target.attr.trackBy;var fragBlock=(0,_domHelper.createBlock)(vm,dest);fragBlock.children=[];fragBlock.data=[];fragBlock.vms=[];bindRepeat(vm,target,fragBlock,{getter:getter,key:key,value:value,trackBy:trackBy,oldStyle:oldStyle})}function compileShown(vm,target,dest,meta){var newMeta={shown:true};var fragBlock=(0,_domHelper.createBlock)(vm,dest);if(dest.element&&dest.children){dest.children.push(fragBlock)}if(meta.repeat){newMeta.repeat=meta.repeat}bindShown(vm,target,fragBlock,newMeta)}function compileType(vm,target,dest,typeGetter,meta){var type=typeGetter.call(vm);var newMeta=(0,_util.extend)({type:type},meta);var fragBlock=(0,_domHelper.createBlock)(vm,dest);if(dest.element&&dest.children){dest.children.push(fragBlock)}(0,_directive.watch)(vm,typeGetter,function(value){var newMeta=(0,_util.extend)({type:value},meta);(0,_domHelper.removeTarget)(vm,fragBlock,true);compile(vm,target,fragBlock,newMeta)});compile(vm,target,fragBlock,newMeta)}function compileCustomComponent(vm,component,target,dest,type,meta){var Ctor=vm.constructor;var subVm=new Ctor(type,component,vm,dest,undefined,{"hook:init":function hookInit(){if(vm._static){this._static=vm._static}(0,_directive.setId)(vm,null,target.id,this);this._externalBinding={parent:vm,template:target}},"hook:created":function hookCreated(){(0,_directive.bindSubVm)(vm,this,target,meta.repeat)},"hook:ready":function hookReady(){if(this._content){compileChildren(vm,target,this._content)}}});(0,_directive.bindSubVmAfterInitialized)(vm,subVm,target,dest)}function compileNativeComponent(vm,template,dest,type){(0,_directive.applyNaitveComponentOptions)(template);var element=void 0;if(dest.ref==="_documentElement"){console.debug("[JS Framework] compile to create body for "+type);element=(0,_domHelper.createBody)(vm,type)}else{console.debug("[JS Framework] compile to create element for "+type);element=(0,_domHelper.createElement)(vm,type)}if(!vm._rootEl){vm._rootEl=element;var binding=vm._externalBinding||{};var target=binding.template;var parentVm=binding.parent;if(target&&target.events&&parentVm&&element){for(var _type in target.events){var handler=parentVm[target.events[_type]];if(handler){element.addEvent(_type,(0,_util.bind)(handler,parentVm))}}}}(0,_directive.bindElement)(vm,element,template);if(template.attr&&template.attr.append){template.append=template.attr.append}if(template.append){element.attr=element.attr||{};element.attr.append=template.append}var treeMode=template.append==="tree";var app=vm._app||{};if(app.lastSignal!==-1&&!treeMode){console.debug("[JS Framework] compile to append single node for",element);app.lastSignal=(0,_domHelper.attachTarget)(vm,element,dest)}if(app.lastSignal!==-1){compileChildren(vm,template,element)}if(app.lastSignal!==-1&&treeMode){console.debug("[JS Framework] compile to append whole tree for",element);app.lastSignal=(0,_domHelper.attachTarget)(vm,element,dest)}}function compileChildren(vm,template,dest){var app=vm._app||{};var children=template.children;if(children&&children.length){children.every(function(child){compile(vm,child,dest);return app.lastSignal!==-1})}}function bindRepeat(vm,target,fragBlock,info){var vms=fragBlock.vms;var children=fragBlock.children;var getter=info.getter;var trackBy=info.trackBy;var oldStyle=info.oldStyle;var keyName=info.key;var valueName=info.value;function compileItem(item,index,context){var mergedData=void 0;if(oldStyle){mergedData=item;if((0,_util.isObject)(item)){mergedData[keyName]=index;if(!mergedData.hasOwnProperty("INDEX")){Object.defineProperty(mergedData,"INDEX",{value:function value(){console.warn('[JS Framework] "INDEX" in repeat is deprecated, '+'please use "$index" instead')}})}}else{console.warn("[JS Framework] Each list item must be an object in old-style repeat, "+"please use `repeat={{v in list}}` instead.");mergedData={};mergedData[keyName]=index;mergedData[valueName]=item}}else{mergedData={};mergedData[keyName]=index;mergedData[valueName]=item}var newContext=mergeContext(context,mergedData);vms.push(newContext);compile(newContext,target,fragBlock,{repeat:item})}var list=watchBlock(vm,fragBlock,getter,"repeat",function(data){console.debug('[JS Framework] the "repeat" item has changed',data);if(!fragBlock||!data){return}var oldChildren=children.slice();var oldVms=vms.slice();var oldData=fragBlock.data.slice();var trackMap={};var reusedMap={};data.forEach(function(item,index){var key=trackBy?item[trackBy]:oldStyle?item[keyName]:index;if(key==null||key===""){return}trackMap[key]=item});var reusedList=[];oldData.forEach(function(item,index){var key=trackBy?item[trackBy]:oldStyle?item[keyName]:index;if(trackMap.hasOwnProperty(key)){reusedMap[key]={item:item,index:index,key:key,target:oldChildren[index],vm:oldVms[index]};reusedList.push(item)}else{(0,_domHelper.removeTarget)(vm,oldChildren[index])}});children.length=0;vms.length=0;fragBlock.data=data.slice();fragBlock.updateMark=fragBlock.start;data.forEach(function(item,index){var key=trackBy?item[trackBy]:oldStyle?item[keyName]:index;var reused=reusedMap[key];if(reused){if(reused.item===reusedList[0]){reusedList.shift()}else{reusedList.$remove(reused.item);(0,_domHelper.moveTarget)(vm,reused.target,fragBlock.updateMark,true)}children.push(reused.target);vms.push(reused.vm);if(oldStyle){reused.vm=item}else{reused.vm[valueName]=item}reused.vm[keyName]=index;fragBlock.updateMark=reused.target}else{compileItem(item,index,vm)}});delete fragBlock.updateMark});fragBlock.data=list.slice(0);list.forEach(function(item,index){compileItem(item,index,vm)})}function bindShown(vm,target,fragBlock,meta){var display=watchBlock(vm,fragBlock,target.shown,"shown",function(display){console.debug('[JS Framework] the "if" item was changed',display);if(!fragBlock||!!fragBlock.display===!!display){return}fragBlock.display=!!display;if(display){compile(vm,target,fragBlock,meta)}else{(0,_domHelper.removeTarget)(vm,fragBlock,true)}});fragBlock.display=!!display;if(display){compile(vm,target,fragBlock,meta)}}function watchBlock(vm,fragBlock,calc,type,handler){var differ=vm&&vm._app&&vm._app.differ;var config={};var depth=(fragBlock.element.depth||0)+1;return(0,_directive.watch)(vm,calc,function(value){config.latestValue=value;if(differ&&!config.recorded){differ.append(type,depth,fragBlock.blockId,function(){var latestValue=config.latestValue;handler(latestValue);config.recorded=false;config.latestValue=undefined})}config.recorded=true})}function mergeContext(context,mergedData){var newContext=Object.create(context);newContext._data=mergedData;(0,_state.initData)(newContext);(0,_state.initComputed)(newContext);newContext._realParent=context;if(context._static){newContext._static=context._static}return newContext}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};exports.applyNaitveComponentOptions=applyNaitveComponentOptions;exports.bindElement=bindElement;exports.bindSubVm=bindSubVm;exports.bindSubVmAfterInitialized=bindSubVmAfterInitialized;exports.setId=setId;exports.watch=watch;var _util=__webpack_require__(93);var _watcher=__webpack_require__(95);var _watcher2=_interopRequireDefault(_watcher);var _config=__webpack_require__(102);var _config2=_interopRequireDefault(_config);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var nativeComponentMap=_config2.default.nativeComponentMap;var SETTERS={attr:"setAttr",style:"setStyle",event:"addEvent"};function applyNaitveComponentOptions(template){var type=template.type;var options=nativeComponentMap[type];if((typeof options==="undefined"?"undefined":_typeof(options))==="object"){for(var key in options){if(template[key]==null){template[key]=options[key]}else if((0,_util.typof)(template[key])==="object"&&(0,_util.typof)(options[key])==="object"){for(var subkey in options[key]){if(template[key][subkey]==null){template[key][subkey]=options[key][subkey]}}}}}}function bindElement(vm,el,template){setId(vm,el,template.id,vm);setAttr(vm,el,template.attr);setClass(vm,el,template.classList);setStyle(vm,el,template.style);bindEvents(vm,el,template.events)}function bindSubVm(vm,subVm,template,repeatItem){subVm=subVm||{};template=template||{};var options=subVm._options||{};var props=options.props;if(Array.isArray(props)){props=props.reduce(function(result,value){result[value]=true;return result},{})}mergeProps(repeatItem,props,vm,subVm);mergeProps(template.attr,props,vm,subVm)}function bindSubVmAfterInitialized(vm,subVm,template){var target=arguments.length<=3||arguments[3]===undefined?{}:arguments[3];mergeClassStyle(template.classList,vm,subVm);mergeStyle(template.style,vm,subVm);if(target.children){target.children[target.children.length-1]._vm=subVm}else{target._vm=subVm}}function mergeProps(target,props,vm,subVm){if(!target){return}var _loop=function _loop(key){if(!props||props[key]){var value=target[key];if(typeof value==="function"){var returnValue=watch(vm,value,function(v){subVm[key]=v});subVm[key]=returnValue}else{subVm[key]=value}}};for(var key in target){_loop(key)}}function mergeStyle(target,vm,subVm){var _loop2=function _loop2(key){var value=target[key];if(typeof value==="function"){var returnValue=watch(vm,value,function(v){if(subVm._rootEl){subVm._rootEl.setStyle(key,v)}});subVm._rootEl.setStyle(key,returnValue)}else{if(subVm._rootEl){subVm._rootEl.setStyle(key,value)}}};for(var key in target){_loop2(key)}}function mergeClassStyle(target,vm,subVm){var css=vm._options&&vm._options.style||{};if(!subVm._rootEl){return}var className="@originalRootEl";css[className]=subVm._rootEl.classStyle;function addClassName(list,name){if((0,_util.typof)(list)==="array"){list.unshift(name)}}if(typeof target==="function"){var _value=watch(vm,target,function(v){addClassName(v,className);setClassStyle(subVm._rootEl,css,v)});addClassName(_value,className);setClassStyle(subVm._rootEl,css,_value)}else if(target!=null){addClassName(target,className);setClassStyle(subVm._rootEl,css,target)}}function setId(vm,el,id,target){var map=Object.create(null);Object.defineProperties(map,{vm:{value:target,writable:false,configurable:false},el:{get:function get(){return el||target._rootEl},configurable:false}});if(typeof id==="function"){var handler=id;id=handler.call(vm);if(id){vm._ids[id]=map}watch(vm,handler,function(newId){if(newId){vm._ids[newId]=map}})}else if(id&&typeof id==="string"){vm._ids[id]=map}}function setAttr(vm,el,attr){bindDir(vm,el,"attr",attr)}function setClassStyle(el,css,classList){var classStyle={};var length=classList.length;for(var i=0;i)?=?)";var XRANGEIDENTIFIERLOOSE=R++;src[XRANGEIDENTIFIERLOOSE]=src[NUMERICIDENTIFIERLOOSE]+"|x|X|\\*";var XRANGEIDENTIFIER=R++;src[XRANGEIDENTIFIER]=src[NUMERICIDENTIFIER]+"|x|X|\\*";var XRANGEPLAIN=R++;src[XRANGEPLAIN]="[v=\\s]*("+src[XRANGEIDENTIFIER]+")"+"(?:\\.("+src[XRANGEIDENTIFIER]+")"+"(?:\\.("+src[XRANGEIDENTIFIER]+")"+"(?:"+src[PRERELEASE]+")?"+src[BUILD]+"?"+")?)?";var XRANGEPLAINLOOSE=R++;src[XRANGEPLAINLOOSE]="[v=\\s]*("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:"+src[PRERELEASELOOSE]+")?"+src[BUILD]+"?"+")?)?";var XRANGE=R++;src[XRANGE]="^"+src[GTLT]+"\\s*"+src[XRANGEPLAIN]+"$";var XRANGELOOSE=R++;src[XRANGELOOSE]="^"+src[GTLT]+"\\s*"+src[XRANGEPLAINLOOSE]+"$";var LONETILDE=R++;src[LONETILDE]="(?:~>?)";var TILDETRIM=R++;src[TILDETRIM]="(\\s*)"+src[LONETILDE]+"\\s+";re[TILDETRIM]=new RegExp(src[TILDETRIM],"g");var tildeTrimReplace="$1~";var TILDE=R++;src[TILDE]="^"+src[LONETILDE]+src[XRANGEPLAIN]+"$";var TILDELOOSE=R++;src[TILDELOOSE]="^"+src[LONETILDE]+src[XRANGEPLAINLOOSE]+"$";var LONECARET=R++;src[LONECARET]="(?:\\^)";var CARETTRIM=R++;src[CARETTRIM]="(\\s*)"+src[LONECARET]+"\\s+";re[CARETTRIM]=new RegExp(src[CARETTRIM],"g");var caretTrimReplace="$1^";var CARET=R++;src[CARET]="^"+src[LONECARET]+src[XRANGEPLAIN]+"$";var CARETLOOSE=R++;src[CARETLOOSE]="^"+src[LONECARET]+src[XRANGEPLAINLOOSE]+"$";var COMPARATORLOOSE=R++;src[COMPARATORLOOSE]="^"+src[GTLT]+"\\s*("+LOOSEPLAIN+")$|^$";var COMPARATOR=R++;src[COMPARATOR]="^"+src[GTLT]+"\\s*("+FULLPLAIN+")$|^$";var COMPARATORTRIM=R++;src[COMPARATORTRIM]="(\\s*)"+src[GTLT]+"\\s*("+LOOSEPLAIN+"|"+src[XRANGEPLAIN]+")";re[COMPARATORTRIM]=new RegExp(src[COMPARATORTRIM],"g");var comparatorTrimReplace="$1$2$3";var HYPHENRANGE=R++;src[HYPHENRANGE]="^\\s*("+src[XRANGEPLAIN]+")"+"\\s+-\\s+"+"("+src[XRANGEPLAIN]+")"+"\\s*$";var HYPHENRANGELOOSE=R++;src[HYPHENRANGELOOSE]="^\\s*("+src[XRANGEPLAINLOOSE]+")"+"\\s+-\\s+"+"("+src[XRANGEPLAINLOOSE]+")"+"\\s*$";var STAR=R++;src[STAR]="(<|>)?=?\\s*\\*";for(var i=0;iMAX_LENGTH)return null;var r=loose?re[LOOSE]:re[FULL];if(!r.test(version))return null;try{return new SemVer(version,loose)}catch(er){return null}}exports.valid=valid;function valid(version,loose){var v=parse(version,loose);return v?v.version:null}exports.clean=clean;function clean(version,loose){var s=parse(version.trim().replace(/^[=v]+/,""),loose);return s?s.version:null}exports.SemVer=SemVer;function SemVer(version,loose){if(version instanceof SemVer){if(version.loose===loose)return version;else version=version.version}else if(typeof version!=="string"){throw new TypeError("Invalid Version: "+version)}if(version.length>MAX_LENGTH)throw new TypeError("version is longer than "+MAX_LENGTH+" characters");if(!(this instanceof SemVer))return new SemVer(version,loose);debug("SemVer",version,loose);this.loose=loose;var m=version.trim().match(loose?re[LOOSE]:re[FULL]);if(!m)throw new TypeError("Invalid Version: "+version);this.raw=version;this.major=+m[1];this.minor=+m[2];this.patch=+m[3];if(this.major>MAX_SAFE_INTEGER||this.major<0)throw new TypeError("Invalid major version");if(this.minor>MAX_SAFE_INTEGER||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>MAX_SAFE_INTEGER||this.patch<0)throw new TypeError("Invalid patch version");if(!m[4])this.prerelease=[];else this.prerelease=m[4].split(".").map(function(id){if(/^[0-9]+$/.test(id)){var num=+id;if(num>=0&&num=0){if(typeof this.prerelease[i]==="number"){this.prerelease[i]++;i=-2}}if(i===-1)this.prerelease.push(0)}if(identifier){if(this.prerelease[0]===identifier){if(isNaN(this.prerelease[1]))this.prerelease=[identifier,0]}else this.prerelease=[identifier,0]}break;default:throw new Error("invalid increment argument: "+release)}this.format();this.raw=this.version;return this};exports.inc=inc;function inc(version,release,loose,identifier){if(typeof loose==="string"){identifier=loose;loose=undefined}try{return new SemVer(version,loose).inc(release,identifier).version}catch(er){return null}}exports.diff=diff;function diff(version1,version2){if(eq(version1,version2)){return null}else{var v1=parse(version1);var v2=parse(version2);if(v1.prerelease.length||v2.prerelease.length){for(var key in v1){if(key==="major"||key==="minor"||key==="patch"){if(v1[key]!==v2[key]){return"pre"+key}}}return"prerelease"}for(var key in v1){if(key==="major"||key==="minor"||key==="patch"){if(v1[key]!==v2[key]){return key}}}}}exports.compareIdentifiers=compareIdentifiers;var numeric=/^[0-9]+$/;function compareIdentifiers(a,b){var anum=numeric.test(a);var bnum=numeric.test(b);if(anum&&bnum){a=+a;b=+b}return anum&&!bnum?-1:bnum&&!anum?1:ab?1:0}exports.rcompareIdentifiers=rcompareIdentifiers;function rcompareIdentifiers(a,b){return compareIdentifiers(b,a)}exports.major=major;function major(a,loose){return new SemVer(a,loose).major}exports.minor=minor;function minor(a,loose){return new SemVer(a,loose).minor}exports.patch=patch;function patch(a,loose){return new SemVer(a,loose).patch}exports.compare=compare;function compare(a,b,loose){return new SemVer(a,loose).compare(b)}exports.compareLoose=compareLoose;function compareLoose(a,b){return compare(a,b,true)}exports.rcompare=rcompare;function rcompare(a,b,loose){return compare(b,a,loose)}exports.sort=sort;function sort(list,loose){return list.sort(function(a,b){return exports.compare(a,b,loose)})}exports.rsort=rsort;function rsort(list,loose){return list.sort(function(a,b){return exports.rcompare(a,b,loose)})}exports.gt=gt;function gt(a,b,loose){ +return compare(a,b,loose)>0}exports.lt=lt;function lt(a,b,loose){return compare(a,b,loose)<0}exports.eq=eq;function eq(a,b,loose){return compare(a,b,loose)===0}exports.neq=neq;function neq(a,b,loose){return compare(a,b,loose)!==0}exports.gte=gte;function gte(a,b,loose){return compare(a,b,loose)>=0}exports.lte=lte;function lte(a,b,loose){return compare(a,b,loose)<=0}exports.cmp=cmp;function cmp(a,op,b,loose){var ret;switch(op){case"===":if((typeof a==="undefined"?"undefined":_typeof(a))==="object")a=a.version;if((typeof b==="undefined"?"undefined":_typeof(b))==="object")b=b.version;ret=a===b;break;case"!==":if((typeof a==="undefined"?"undefined":_typeof(a))==="object")a=a.version;if((typeof b==="undefined"?"undefined":_typeof(b))==="object")b=b.version;ret=a!==b;break;case"":case"=":case"==":ret=eq(a,b,loose);break;case"!=":ret=neq(a,b,loose);break;case">":ret=gt(a,b,loose);break;case">=":ret=gte(a,b,loose);break;case"<":ret=lt(a,b,loose);break;case"<=":ret=lte(a,b,loose);break;default:throw new TypeError("Invalid operator: "+op)}return ret}exports.Comparator=Comparator;function Comparator(comp,loose){if(comp instanceof Comparator){if(comp.loose===loose)return comp;else comp=comp.value}if(!(this instanceof Comparator))return new Comparator(comp,loose);debug("comparator",comp,loose);this.loose=loose;this.parse(comp);if(this.semver===ANY)this.value="";else this.value=this.operator+this.semver.version;debug("comp",this)}var ANY={};Comparator.prototype.parse=function(comp){var r=this.loose?re[COMPARATORLOOSE]:re[COMPARATOR];var m=comp.match(r);if(!m)throw new TypeError("Invalid comparator: "+comp);this.operator=m[1];if(this.operator==="=")this.operator="";if(!m[2])this.semver=ANY;else this.semver=new SemVer(m[2],this.loose)};Comparator.prototype.toString=function(){return this.value};Comparator.prototype.test=function(version){debug("Comparator.test",version,this.loose);if(this.semver===ANY)return true;if(typeof version==="string")version=new SemVer(version,this.loose);return cmp(version,this.operator,this.semver,this.loose)};exports.Range=Range;function Range(range,loose){if(range instanceof Range&&range.loose===loose)return range;if(!(this instanceof Range))return new Range(range,loose);this.loose=loose;this.raw=range;this.set=range.split(/\s*\|\|\s*/).map(function(range){return this.parseRange(range.trim())},this).filter(function(c){return c.length});if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+range)}this.format()}Range.prototype.format=function(){this.range=this.set.map(function(comps){return comps.join(" ").trim()}).join("||").trim();return this.range};Range.prototype.toString=function(){return this.range};Range.prototype.parseRange=function(range){var loose=this.loose;range=range.trim();debug("range",range,loose);var hr=loose?re[HYPHENRANGELOOSE]:re[HYPHENRANGE];range=range.replace(hr,hyphenReplace);debug("hyphen replace",range);range=range.replace(re[COMPARATORTRIM],comparatorTrimReplace);debug("comparator trim",range,re[COMPARATORTRIM]);range=range.replace(re[TILDETRIM],tildeTrimReplace);range=range.replace(re[CARETTRIM],caretTrimReplace);range=range.split(/\s+/).join(" ");var compRe=loose?re[COMPARATORLOOSE]:re[COMPARATOR];var set=range.split(" ").map(function(comp){return parseComparator(comp,loose)}).join(" ").split(/\s+/);if(this.loose){set=set.filter(function(comp){return!!comp.match(compRe)})}set=set.map(function(comp){return new Comparator(comp,loose)});return set};exports.toComparators=toComparators;function toComparators(range,loose){return new Range(range,loose).set.map(function(comp){return comp.map(function(c){return c.value}).join(" ").trim().split(" ")})}function parseComparator(comp,loose){debug("comp",comp);comp=replaceCarets(comp,loose);debug("caret",comp);comp=replaceTildes(comp,loose);debug("tildes",comp);comp=replaceXRanges(comp,loose);debug("xrange",comp);comp=replaceStars(comp,loose);debug("stars",comp);return comp}function isX(id){return!id||id.toLowerCase()==="x"||id==="*"}function replaceTildes(comp,loose){return comp.trim().split(/\s+/).map(function(comp){return replaceTilde(comp,loose)}).join(" ")}function replaceTilde(comp,loose){var r=loose?re[TILDELOOSE]:re[TILDE];return comp.replace(r,function(_,M,m,p,pr){debug("tilde",comp,_,M,m,p,pr);var ret;if(isX(M))ret="";else if(isX(m))ret=">="+M+".0.0 <"+(+M+1)+".0.0";else if(isX(p))ret=">="+M+"."+m+".0 <"+M+"."+(+m+1)+".0";else if(pr){debug("replaceTilde pr",pr);if(pr.charAt(0)!=="-")pr="-"+pr;ret=">="+M+"."+m+"."+p+pr+" <"+M+"."+(+m+1)+".0"}else ret=">="+M+"."+m+"."+p+" <"+M+"."+(+m+1)+".0";debug("tilde return",ret);return ret})}function replaceCarets(comp,loose){return comp.trim().split(/\s+/).map(function(comp){return replaceCaret(comp,loose)}).join(" ")}function replaceCaret(comp,loose){debug("caret",comp,loose);var r=loose?re[CARETLOOSE]:re[CARET];return comp.replace(r,function(_,M,m,p,pr){debug("caret",comp,_,M,m,p,pr);var ret;if(isX(M))ret="";else if(isX(m))ret=">="+M+".0.0 <"+(+M+1)+".0.0";else if(isX(p)){if(M==="0")ret=">="+M+"."+m+".0 <"+M+"."+(+m+1)+".0";else ret=">="+M+"."+m+".0 <"+(+M+1)+".0.0"}else if(pr){debug("replaceCaret pr",pr);if(pr.charAt(0)!=="-")pr="-"+pr;if(M==="0"){if(m==="0")ret=">="+M+"."+m+"."+p+pr+" <"+M+"."+m+"."+(+p+1);else ret=">="+M+"."+m+"."+p+pr+" <"+M+"."+(+m+1)+".0"}else ret=">="+M+"."+m+"."+p+pr+" <"+(+M+1)+".0.0"}else{debug("no pr");if(M==="0"){if(m==="0")ret=">="+M+"."+m+"."+p+" <"+M+"."+m+"."+(+p+1);else ret=">="+M+"."+m+"."+p+" <"+M+"."+(+m+1)+".0"}else ret=">="+M+"."+m+"."+p+" <"+(+M+1)+".0.0"}debug("caret return",ret);return ret})}function replaceXRanges(comp,loose){debug("replaceXRanges",comp,loose);return comp.split(/\s+/).map(function(comp){return replaceXRange(comp,loose)}).join(" ")}function replaceXRange(comp,loose){comp=comp.trim();var r=loose?re[XRANGELOOSE]:re[XRANGE];return comp.replace(r,function(ret,gtlt,M,m,p,pr){debug("xRange",comp,ret,gtlt,M,m,p,pr);var xM=isX(M);var xm=xM||isX(m);var xp=xm||isX(p);var anyX=xp;if(gtlt==="="&&anyX)gtlt="";if(xM){if(gtlt===">"||gtlt==="<"){ret="<0.0.0"}else{ret="*"}}else if(gtlt&&anyX){if(xm)m=0;if(xp)p=0;if(gtlt===">"){gtlt=">=";if(xm){M=+M+1;m=0;p=0}else if(xp){m=+m+1;p=0}}else if(gtlt==="<="){gtlt="<";if(xm)M=+M+1;else m=+m+1}ret=gtlt+M+"."+m+"."+p}else if(xm){ret=">="+M+".0.0 <"+(+M+1)+".0.0"}else if(xp){ret=">="+M+"."+m+".0 <"+M+"."+(+m+1)+".0"}debug("xRange return",ret);return ret})}function replaceStars(comp,loose){debug("replaceStars",comp,loose);return comp.trim().replace(re[STAR],"")}function hyphenReplace($0,from,fM,fm,fp,fpr,fb,to,tM,tm,tp,tpr,tb){if(isX(fM))from="";else if(isX(fm))from=">="+fM+".0.0";else if(isX(fp))from=">="+fM+"."+fm+".0";else from=">="+from;if(isX(tM))to="";else if(isX(tm))to="<"+(+tM+1)+".0.0";else if(isX(tp))to="<"+tM+"."+(+tm+1)+".0";else if(tpr)to="<="+tM+"."+tm+"."+tp+"-"+tpr;else to="<="+to;return(from+" "+to).trim()}Range.prototype.test=function(version){if(!version)return false;if(typeof version==="string")version=new SemVer(version,this.loose);for(var i=0;i0){var allowed=set[i].semver;if(allowed.major===version.major&&allowed.minor===version.minor&&allowed.patch===version.patch)return true}}return false}return true}exports.satisfies=satisfies;function satisfies(version,range,loose){try{range=new Range(range,loose)}catch(er){return false}return range.test(version)}exports.maxSatisfying=maxSatisfying;function maxSatisfying(versions,range,loose){return versions.filter(function(version){return satisfies(version,range,loose)}).sort(function(a,b){return rcompare(a,b,loose)})[0]||null}exports.minSatisfying=minSatisfying;function minSatisfying(versions,range,loose){return versions.filter(function(version){return satisfies(version,range,loose)}).sort(function(a,b){return compare(a,b,loose)})[0]||null}exports.validRange=validRange;function validRange(range,loose){try{return new Range(range,loose).range||"*"}catch(er){return null}}exports.ltr=ltr;function ltr(version,range,loose){return outside(version,range,"<",loose)}exports.gtr=gtr;function gtr(version,range,loose){return outside(version,range,">",loose)}exports.outside=outside;function outside(version,range,hilo,loose){version=new SemVer(version,loose);range=new Range(range,loose);var gtfn,ltefn,ltfn,comp,ecomp;switch(hilo){case">":gtfn=gt;ltefn=lte;ltfn=lt;comp=">";ecomp=">=";break;case"<":gtfn=lt;ltefn=gte;ltfn=gt;comp="<";ecomp="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies(version,range,loose)){return false}for(var i=0;i=0.0.0")}high=high||comparator;low=low||comparator;if(gtfn(comparator.semver,high.semver,loose)){high=comparator}else if(ltfn(comparator.semver,low.semver,loose)){low=comparator}});if(high.operator===comp||high.operator===ecomp){return false}if((!low.operator||low.operator===comp)&<efn(version,low.semver)){return false}else if(low.operator===ecomp&<fn(version,low.semver)){return false}}return true}exports.prerelease=prerelease;function prerelease(version,loose){var parsed=parse(version,loose);return parsed&&parsed.prerelease.length?parsed.prerelease:null}}).call(exports,__webpack_require__(96))},function(module,exports,__webpack_require__){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.normalizeVersion=normalizeVersion;exports.getError=getError;exports.check=check;var _semver=__webpack_require__(107);var _semver2=_interopRequireDefault(_semver);var _util=__webpack_require__(93);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function normalizeVersion(v){var isValid=_semver2.default.valid(v);if(isValid){return v}v=typeof v==="string"?v:"";var split=v.split(".");var i=0;var result=[];while(i<3){var s=typeof split[i]==="string"&&split[i]?split[i]:"0";result.push(s);i++}return result.join(".")}function getError(key,val,criteria){var result={isDowngrade:true,errorType:1,code:1e3};var getMsg=function getMsg(key,val,criteria){return"Downgrade["+key+"] :: deviceInfo "+val+" matched criteria "+criteria};var _key=key.toLowerCase();result.errorMessage=getMsg(key,val,criteria);if(_key.indexOf("osversion")>=0){result.code=1001}else if(_key.indexOf("appversion")>=0){result.code=1002}else if(_key.indexOf("weexversion")>=0){result.code=1003}else if(_key.indexOf("devicemodel")>=0){result.code=1004}return result}function check(config,deviceInfo){deviceInfo=deviceInfo||global.WXEnvironment;deviceInfo=(0,_util.isPlainObject)(deviceInfo)?deviceInfo:{};var result={isDowngrade:false};if((0,_util.typof)(config)==="function"){var customDowngrade=config.call(this,deviceInfo,{semver:_semver2.default,normalizeVersion:this.normalizeVersion});customDowngrade=!!customDowngrade;result=customDowngrade?this.getError("custom","","custom params"):result}else{config=(0,_util.isPlainObject)(config)?config:{};var platform=deviceInfo.platform||"unknow";var dPlatform=platform.toLowerCase();var cObj=config[dPlatform]||{};for(var i in deviceInfo){var key=i;var keyLower=key.toLowerCase();var val=deviceInfo[i];var isVersion=keyLower.indexOf("version")>=0;var isDeviceModel=keyLower.indexOf("devicemodel")>=0;var criteria=cObj[i];if(criteria&&isVersion){var c=this.normalizeVersion(criteria);var d=this.normalizeVersion(deviceInfo[i]);if(_semver2.default.satisfies(d,c)){result=this.getError(key,val,criteria);break}}else if(isDeviceModel){var _criteria=(0,_util.typof)(criteria)==="array"?criteria:[criteria];if(_criteria.indexOf(val)>=0){result=this.getError(key,val,criteria);break}}}}return result}}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.defineFn=undefined;exports.register=register;var _util=__webpack_require__(93);var _register=__webpack_require__(89);function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}var defineFn=exports.defineFn=function defineFn(app,name){console.debug("[JS Framework] define a component "+name);var factory=void 0,definition=void 0;if((arguments.length<=2?0:arguments.length-2)>1){definition=arguments.length<=3?undefined:arguments[3]}else{definition=arguments.length<=2?undefined:arguments[2]}if(typeof definition==="function"){factory=definition;definition=null}if(factory){var r=function r(name){if((0,_util.isWeexComponent)(name)){var cleanName=(0,_util.removeWeexPrefix)(name);return(0,_register.requireCustomComponent)(app,cleanName)}if((0,_util.isWeexModule)(name)){var _cleanName=(0,_util.removeWeexPrefix)(name);return app.requireModule(_cleanName)}if((0,_util.isNormalModule)(name)||(0,_util.isNpmModule)(name)){var _cleanName2=(0,_util.removeJSSurfix)(name);return app.commonModules[_cleanName2]}};var m={exports:{}};factory(r,m.exports,m);definition=m.exports}if((0,_util.isWeexComponent)(name)){var cleanName=(0,_util.removeWeexPrefix)(name);(0,_register.registerCustomComponent)(app,cleanName,definition)}else if((0,_util.isWeexModule)(name)){var _cleanName3=(0,_util.removeWeexPrefix)(name);(0,_register.initModules)(_defineProperty({},_cleanName3,definition))}else if((0,_util.isNormalModule)(name)){var _cleanName4=(0,_util.removeJSSurfix)(name);app.commonModules[_cleanName4]=definition}else if((0,_util.isNpmModule)(name)){var _cleanName5=(0,_util.removeJSSurfix)(name);if(definition.template||definition.style||definition.methods){(0,_register.registerCustomComponent)(app,_cleanName5,definition)}else{app.commonModules[_cleanName5]=definition}}};function register(app,type,options){console.warn("[JS Framework] Register is deprecated, please install lastest transformer.");(0,_register.registerCustomComponent)(app,type,options)}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.refresh=refresh;exports.destroy=destroy;exports.destroyVm=destroyVm;exports.getRootElement=getRootElement;exports.fireEvent=fireEvent;exports.callback=callback;exports.updateActions=updateActions;exports.callTasks=callTasks;var _util=__webpack_require__(93);var _config=__webpack_require__(102);var _config2=_interopRequireDefault(_config);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}return _ctrl.fireEvent.apply(undefined,[_map.instanceMap[id]].concat(args))},callback:function callback(id){for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2]}return _ctrl.callback.apply(undefined,[_map.instanceMap[id]].concat(args))}};function receiveTasks(id,tasks){var instance=_map.instanceMap[id];if(instance&&Array.isArray(tasks)){var _ret=function(){var results=[];tasks.forEach(function(task){var handler=jsHandlers[task.method];var args=[].concat(_toConsumableArray(task.args));if(typeof handler==="function"){args.unshift(id);results.push(handler.apply(undefined,_toConsumableArray(args)))}});return{v:results}}();if((typeof _ret==="undefined"?"undefined":_typeof(_ret))==="object")return _ret.v}return new Error('invalid instance id "'+id+'" or tasks')}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getRoot=getRoot;var _map=__webpack_require__(113);var _ctrl=__webpack_require__(90);function getRoot(id){var instance=_map.instanceMap[id];var result=void 0;if(instance){result=(0,_ctrl.getRootElement)(instance)}else{result=new Error('invalid instance id "'+id+'"')}return result}},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=init;var frameworks=void 0;var versionRegExp=/^\s*\/\/ *(\{[^\}]*\}) *\r?\n/;function checkVersion(code){var info=void 0;var result=versionRegExp.exec(code);if(result){try{info=JSON.parse(result[1])}catch(e){}}return info}var instanceMap={};function createInstance(id,code,config,data){var info=instanceMap[id];if(!info){info=checkVersion(code)||{};if(!frameworks[info.framework]){info.framework="Weex"}instanceMap[id]=info;config=config||{};config.bundleVersion=info.version;console.debug("[JS Framework] create an "+info.framework+"@"+config.bundleVersion+" instance from "+config.bundleVersion);return frameworks[info.framework].createInstance(id,code,config,data)}return new Error('invalid instance id "'+id+'"')}var methods={createInstance:createInstance};function genInit(methodName){methods[methodName]=function(){for(var name in frameworks){var framework=frameworks[name];if(framework&&framework[methodName]){framework[methodName].apply(framework,arguments)}}}}function genInstance(methodName){methods[methodName]=function(){var id=arguments.length<=0?undefined:arguments[0];var info=instanceMap[id];if(info&&frameworks[info.framework]){var _frameworks$info$fram;return(_frameworks$info$fram=frameworks[info.framework])[methodName].apply(_frameworks$info$fram,arguments)}return new Error('invalid instance id "'+id+'"')}}function adaptInstance(methodName,nativeMethodName){methods[nativeMethodName]=function(){var id=arguments.length<=0?undefined:arguments[0];var info=instanceMap[id];if(info&&frameworks[info.framework]){var _frameworks$info$fram2;return(_frameworks$info$fram2=frameworks[info.framework])[methodName].apply(_frameworks$info$fram2,arguments)}return new Error('invalid instance id "'+id+'"')}}function init(config){frameworks=config.frameworks||{};for(var name in frameworks){var framework=frameworks[name];framework.init(config)}["registerComponents","registerModules","registerMethods"].forEach(genInit);["destroyInstance","refreshInstance","receiveTasks","getRoot"].forEach(genInstance);adaptInstance("receiveTasks","callJS");return methods}},function(module,exports){module.exports={name:"weex-js-framework",version:"0.16.14",subversion:{framework:"0.16.14",transformer:">=0.1.5 <0.4"},description:"Weex JS Framework",keywords:["weex","mvvm","javascript","html5"],homepage:"https://alibaba.github.io/weex",bugs:{url:"https://github.com/alibaba/weex/issues"},license:"Apache-2.0",author:"Jinjiang ",maintainers:["terrykingcha ","IskenHuang ","yuanyan "],main:"index.js",repository:{type:"git",url:"git@github.com:alibaba/weex.git"},scripts:{test:'echo "Error: no test specified" && exit 1'},dependencies:{"core-js":"^2.4.0",semver:"^5.1.0","weex-rx-framework":"0.1.13"},_from:"weex-js-framework@0.16.14",_resolved:"http://registry.npm.taobao.org/weex-js-framework/download/weex-js-framework-0.16.14.tgz"}},function(module,exports,__webpack_require__){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.$=$;exports.$el=$el;exports.$vm=$vm;exports.$renderThen=$renderThen;exports.$scrollTo=$scrollTo;exports.$transition=$transition;exports.$getConfig=$getConfig;exports.$sendHttp=$sendHttp;exports.$openURL=$openURL;exports.$setTitle=$setTitle;exports.$call=$call;var _util=__webpack_require__(93);function $(id){console.warn("[JS Framework] Vm#$ is deprecated, please use Vm#$vm instead");var info=this._ids[id];if(info){return info.vm}}function $el(id){var info=this._ids[id];if(info){return info.el}}function $vm(id){var info=this._ids[id];if(info){return info.vm}}function $renderThen(fn){var app=this._app;var differ=app.differ;return differ.then(function(){fn()})}function $scrollTo(id,offset){console.warn("[JS Framework] Vm#$scrollTo is deprecated, "+"please use \"require('@weex-module/dom')"+'.scrollTo(el, options)" instead');var el=this.$el(id);if(el){var dom=this._app.requireModule("dom");dom.scrollToElement(el.ref,{offset:offset})}}function $transition(id,options,callback){var _this=this;var el=this.$el(id);if(el&&options&&options.styles){var animation=this._app.requireModule("animation");animation.transition(el.ref,options,function(){_this._setStyle(el,options.styles);callback&&callback.apply(undefined,arguments)})}}function $getConfig(callback){var config=(0,_util.extend)({env:global.WXEnvironment||{}},this._app.options);if((0,_util.typof)(callback)==="function"){console.warn("[JS Framework] the callback of Vm#$getConfig(callback) is deprecated, "+"this api now can directly RETURN config info.");callback(config)}return config}function $sendHttp(params,callback){console.warn("[JS Framework] Vm#$sendHttp is deprecated, "+"please use \"require('@weex-module/stream')"+'.sendHttp(params, callback)" instead');var stream=this._app.requireModule("stream");stream.sendHttp(params,callback)}function $openURL(url){console.warn("[JS Framework] Vm#$openURL is deprecated, "+"please use \"require('@weex-module/event')"+'.openURL(url)" instead');var event=this._app.requireModule("event");event.openURL(url)}function $setTitle(title){console.warn("[JS Framework] Vm#$setTitle is deprecated, "+"please use \"require('@weex-module/pageInfo')"+'.setTitle(title)" instead');var pageInfo=this._app.requireModule("pageInfo");pageInfo.setTitle(title)}function $call(moduleName,methodName){console.warn("[JS Framework] Vm#$call is deprecated, "+"please use \"require('@weex-module/moduleName')\" instead");var module=this._app.requireModule(moduleName);if(module&&module[methodName]){for(var _len=arguments.length,args=Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key]}module[methodName].apply(module,args)}}}).call(exports,function(){return this}())},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.$userTrack=$userTrack;exports.$sendMtop=$sendMtop;exports.$callWindvane=$callWindvane;exports.$setSpm=$setSpm;exports.$getUserInfo=$getUserInfo;exports.$login=$login;exports.$logout=$logout;function $userTrack(type,name,comName,param){console.warn("[JS Framework] Vm#$userTrack is deprecated, "+"please use \"require('@weex-module/userTrack')"+'.commit(type, name, comName, param)" instead');var userTrack=this._app.requireModule("userTrack");userTrack.commit(type,name,comName,param)}function $sendMtop(params,callback){console.warn("[JS Framework] Vm#$sendMtop is deprecated, "+"please use \"require('@weex-module/stream')"+'.sendMtop(params, callback)" instead'); +if(typeof window==="undefined"){var windvane=this._app.requireModule("windvane");windvane.call({class:"MtopWVPlugin",method:"send",data:params},callback)}else{var stream=this._app.requireModule("stream");stream.sendMtop(params,callback)}}function $callWindvane(params,callback){console.warn("[JS Framework] Vm#$callWindvane is deprecated, "+"please use \"require('@weex-module/windvane')"+'.call(params, callback)" instead');var windvane=this._app.requireModule("windvane");windvane.call(params,callback)}function $setSpm(a,b){console.warn("[JS Framework] Vm#$setSpm is deprecated, "+"please use \"require('@weex-module/pageInfo')"+'.setSpm(a, b)" instead');var pageInfo=this._app.requireModule("pageInfo");pageInfo.setSpm(a,b)}function $getUserInfo(callback){console.warn("[JS Framework] Vm#$getUserInfo is deprecated, "+"please use \"require('@weex-module/user')"+'.getUserInfo(callback)" instead');var user=this._app.requireModule("user");user.getUserInfo(callback)}function $login(callback){console.warn("[JS Framework] Vm#$login is deprecated, "+"please use \"require('@weex-module/user')"+'.login(callback)" instead');var user=this._app.requireModule("user");user.login(callback)}function $logout(callback){console.warn("[JS Framework] Vm#$logout is deprecated, "+"please use \"require('@weex-module/user')"+'.logout(callback)" instead');var user=this._app.requireModule("user");user.logout(callback)}}]); \ No newline at end of file diff --git a/android/sdk/libs/armeabi/libweexv8.so b/android/sdk/libs/armeabi/libweexv8.so index 62338e9ce..336041ef0 100755 Binary files a/android/sdk/libs/armeabi/libweexv8.so and b/android/sdk/libs/armeabi/libweexv8.so differ diff --git a/android/sdk/libs/x86/libweexv8.so b/android/sdk/libs/x86/libweexv8.so index 3da1385c3..3c97341b1 100755 Binary files a/android/sdk/libs/x86/libweexv8.so and b/android/sdk/libs/x86/libweexv8.so differ diff --git a/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java b/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java index 64fb83a73..81ba95939 100755 --- a/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java +++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java @@ -208,6 +208,7 @@ import android.net.Uri; import android.os.Message; import android.text.TextUtils; +import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.ScrollView; @@ -762,7 +763,9 @@ public void onRenderSuccess(final int width, final int height) { mWXPerformance.screenRenderTime = time; } mWXPerformance.componentCount = WXComponent.mComponentNum; - WXLogUtils.d(WXLogUtils.WEEX_PERF_TAG, "mComponentNum:" + WXComponent.mComponentNum); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(WXLogUtils.WEEX_PERF_TAG, "mComponentNum:" + WXComponent.mComponentNum); + } WXComponent.mComponentNum = 0; if (mRenderListener != null && mContext != null) { runOnUiThread(new Runnable() { @@ -783,6 +786,9 @@ public void run() { } }); } + if(!WXEnvironment.isApkDebugable()){ + Log.e("weex_perf",mWXPerformance.getPerfData()); + } } public void onRefreshSuccess(final int width, final int height) { @@ -902,7 +908,9 @@ public void run() { WXLogUtils.d(performance.toString()); } } - mUserTrackAdapter.commit(mContext, null, type, performance, null); + if( mUserTrackAdapter!= null) { + mUserTrackAdapter.commit(mContext, null, type, performance, null); + } } }); } diff --git a/android/sdk/src/main/java/com/taobao/weex/appfram/storage/DefaultWXStorage.java b/android/sdk/src/main/java/com/taobao/weex/appfram/storage/DefaultWXStorage.java index a1e6322a8..5100295c3 100644 --- a/android/sdk/src/main/java/com/taobao/weex/appfram/storage/DefaultWXStorage.java +++ b/android/sdk/src/main/java/com/taobao/weex/appfram/storage/DefaultWXStorage.java @@ -204,13 +204,16 @@ */ package com.taobao.weex.appfram.storage; +import android.content.ContentValues; import android.content.Context; import android.database.Cursor; +import android.database.sqlite.SQLiteFullException; import android.database.sqlite.SQLiteStatement; import com.taobao.weex.utils.WXLogUtils; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; @@ -239,7 +242,10 @@ public void setItem(final String key, final String value, final OnResultReceived execute(new Runnable() { @Override public void run() { - Map data = StorageResultHandler.setItemResult(performSetItem(key, value)); + Map data = StorageResultHandler.setItemResult(performSetItem(key, value, false, true)); + if(listener == null){ + return; + } listener.onReceived(data); } }); @@ -251,6 +257,9 @@ public void getItem(final String key, final OnResultReceivedListener listener) { @Override public void run() { Map data = StorageResultHandler.getItemResult(performGetItem(key)); + if(listener == null){ + return; + } listener.onReceived(data); } }); @@ -262,6 +271,9 @@ public void removeItem(final String key, final OnResultReceivedListener listener @Override public void run() { Map data = StorageResultHandler.removeItemResult(performRemoveItem(key)); + if(listener == null){ + return; + } listener.onReceived(data); } }); @@ -273,6 +285,9 @@ public void length(final OnResultReceivedListener listener) { @Override public void run() { Map data = StorageResultHandler.getLengthResult(performGetLength()); + if(listener == null){ + return; + } listener.onReceived(data); } }); @@ -284,6 +299,23 @@ public void getAllKeys(final OnResultReceivedListener listener) { @Override public void run() { Map data = StorageResultHandler.getAllkeysResult(performGetAllKeys()); + if(listener == null){ + return; + } + listener.onReceived(data); + } + }); + } + + @Override + public void setItemPersistent(final String key, final String value, final OnResultReceivedListener listener) { + execute(new Runnable() { + @Override + public void run() { + Map data = StorageResultHandler.setItemResult(performSetItem(key, value, true, true)); + if(listener == null){ + return; + } listener.onReceived(data); } }); @@ -294,24 +326,73 @@ public void close() { mDatabaseSupplier.closeDatabase(); } - - private boolean performSetItem(String key, String value) { - String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?);"; + private boolean performSetItem(String key, String value, boolean isPersistent, boolean allowRetryWhenFull) { + WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE,"set k-v to storage(key:"+ key + ",value:"+ value+",isPersistent:"+isPersistent+",allowRetry:"+allowRetryWhenFull+")"); + String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?,?,?);"; SQLiteStatement statement = mDatabaseSupplier.getDatabase().compileStatement(sql); + String timeStamp = WXSQLiteOpenHelper.sDateFormatter.format(new Date()); try { statement.clearBindings(); statement.bindString(1, key); statement.bindString(2, value); + statement.bindString(3, timeStamp); + statement.bindLong(4, isPersistent ? 1 : 0); statement.execute(); return true; } catch (Exception e) { - WXLogUtils.e("DefaultWXStorage", e.getMessage()); + WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE,"DefaultWXStorage occurred an exception when execute setItem :" + e.getMessage()); + if(e instanceof SQLiteFullException){ + if(allowRetryWhenFull && trimToSize()){ + //try again + //setItem/setItemPersistent method only allow try once when occurred a sqliteFullException. + WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE,"retry set k-v to storage(key:"+key+",value:"+value+")"); + return performSetItem(key,value,isPersistent,false); + } + } + return false; } finally { statement.close(); } } + /** + * remove 10% of total record(at most) ordered by timestamp. + * */ + private boolean trimToSize(){ + List toEvict = new ArrayList<>(); + int num = 0; + Cursor c = mDatabaseSupplier.getDatabase().query(WXSQLiteOpenHelper.TABLE_STORAGE, new String[]{WXSQLiteOpenHelper.COLUMN_KEY,WXSQLiteOpenHelper.COLUMN_PERSISTENT}, null, null, null, null, WXSQLiteOpenHelper.COLUMN_TIMESTAMP+" ASC"); + try { + int evictSize = c.getCount() / 10; + while (c.moveToNext()) { + String key = c.getString(c.getColumnIndex(WXSQLiteOpenHelper.COLUMN_KEY)); + boolean persistent = c.getInt(c.getColumnIndex(WXSQLiteOpenHelper.COLUMN_PERSISTENT)) == 1; + if(!persistent && key != null){ + num++; + toEvict.add(key); + if(num == evictSize){ + break; + } + } + } + } catch (Exception e) { + WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE,"DefaultWXStorage occurred an exception when execute trimToSize:"+e.getMessage()); + } finally { + c.close(); + } + + if(num <= 0){ + return false; + } + + for(String key : toEvict){ + performRemoveItem(key); + } + WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE,"remove "+ num +" items by lru"); + return true; + } + private String performGetItem(String key) { Cursor c = mDatabaseSupplier.getDatabase().query(WXSQLiteOpenHelper.TABLE_STORAGE, new String[]{WXSQLiteOpenHelper.COLUMN_VALUE}, @@ -320,12 +401,18 @@ private String performGetItem(String key) { null, null, null); try { if (c.moveToNext()) { + ContentValues values = new ContentValues(); + //update timestamp + values.put(WXSQLiteOpenHelper.COLUMN_TIMESTAMP,WXSQLiteOpenHelper.sDateFormatter.format(new Date())); + int updateResult = mDatabaseSupplier.getDatabase().update(WXSQLiteOpenHelper.TABLE_STORAGE,values,WXSQLiteOpenHelper.COLUMN_KEY+"= ?",new String[]{key}); + + WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE,"update timestamp "+ (updateResult == 1 ? "success" : "failed") + " for operation [getItem(key = "+key+")]" ); return c.getString(c.getColumnIndex(WXSQLiteOpenHelper.COLUMN_VALUE)); } else { return null; } } catch (Exception e) { - WXLogUtils.e("DefaultWXStorage", e.getMessage()); + WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE,"DefaultWXStorage occurred an exception when execute getItem:"+e.getMessage()); return null; } finally { c.close(); @@ -338,7 +425,9 @@ private boolean performRemoveItem(String key) { count = mDatabaseSupplier.getDatabase().delete(WXSQLiteOpenHelper.TABLE_STORAGE, WXSQLiteOpenHelper.COLUMN_KEY + "=?", new String[]{key}); - } finally { + } catch (Exception e) { + WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE,"DefaultWXStorage occurred an exception when execute removeItem:" + e.getMessage()); + return false; } return count == 1; } @@ -349,7 +438,7 @@ private long performGetLength() { try { return statement.simpleQueryForLong(); } catch (Exception e) { - WXLogUtils.e("DefaultWXStorage", e.getMessage()); + WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE,"DefaultWXStorage occurred an exception when execute getLength:"+e.getMessage()); return 0; } finally { statement.close(); @@ -365,12 +454,11 @@ private List performGetAllKeys() { } return result; } catch (Exception e) { - WXLogUtils.e("DefaultWXStorage", e.getMessage()); + WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE,"DefaultWXStorage occurred an exception when execute getAllKeys:"+e.getMessage()); return result; } finally { c.close(); } } - } diff --git a/android/sdk/src/main/java/com/taobao/weex/appfram/storage/IWXStorage.java b/android/sdk/src/main/java/com/taobao/weex/appfram/storage/IWXStorage.java index 138a3ed09..c2ca41953 100644 --- a/android/sdk/src/main/java/com/taobao/weex/appfram/storage/IWXStorage.java +++ b/android/sdk/src/main/java/com/taobao/weex/appfram/storage/IWXStorage.java @@ -214,5 +214,5 @@ interface IWXStorage { public void removeItem(String key,@Nullable JSCallback callback); public void length(@Nullable JSCallback callback); public void getAllKeys(@Nullable JSCallback callback); - + public void setItemPersistent(String key, String value, @Nullable JSCallback callback); } diff --git a/android/sdk/src/main/java/com/taobao/weex/appfram/storage/IWXStorageAdapter.java b/android/sdk/src/main/java/com/taobao/weex/appfram/storage/IWXStorageAdapter.java index 32a33ea47..be9eb5290 100644 --- a/android/sdk/src/main/java/com/taobao/weex/appfram/storage/IWXStorageAdapter.java +++ b/android/sdk/src/main/java/com/taobao/weex/appfram/storage/IWXStorageAdapter.java @@ -224,6 +224,8 @@ public interface IWXStorageAdapter { void getAllKeys(OnResultReceivedListener listener); + void setItemPersistent(String key, String value, OnResultReceivedListener listener); + void close(); /** diff --git a/android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXSQLiteOpenHelper.java b/android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXSQLiteOpenHelper.java index 97160c480..e1646c2cf 100644 --- a/android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXSQLiteOpenHelper.java +++ b/android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXSQLiteOpenHelper.java @@ -210,12 +210,19 @@ import com.taobao.weex.utils.WXLogUtils; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + public class WXSQLiteOpenHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "WXStorage"; - private static final int DATABASE_VERSION = 1; + private static final int DATABASE_VERSION = 2; + static final String TAG_STORAGE = "weex_storage"; + + private long mMaximumDatabaseSize = 5 * 10 * 1024 * 1024L;//50mb + static SimpleDateFormat sDateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); - private long mMaximumDatabaseSize = 5L * 1024L * 1024L; private static WXSQLiteOpenHelper sInstance; @@ -226,12 +233,19 @@ public class WXSQLiteOpenHelper extends SQLiteOpenHelper { static final String TABLE_STORAGE = "default_wx_storage"; static final String COLUMN_KEY = "key"; static final String COLUMN_VALUE = "value"; + static final String COLUMN_TIMESTAMP = "timestamp"; + static final String COLUMN_PERSISTENT = "persistent"; + private static final String STATEMENT_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_STORAGE + " (" + COLUMN_KEY + " TEXT PRIMARY KEY," + COLUMN_VALUE - + " TEXT NOT NULL" + + " TEXT NOT NULL," + + COLUMN_TIMESTAMP + + " TEXT NOT NULL," + + COLUMN_PERSISTENT + + " INTEGER DEFAULT 0" + ")"; @@ -242,7 +256,7 @@ private WXSQLiteOpenHelper(Context context) { public static WXSQLiteOpenHelper getInstance(Context context) { if (context == null) { - WXLogUtils.e("can not get context instance..."); + WXLogUtils.e(TAG_STORAGE,"can not get context instance..."); return null; } if (sInstance == null) { @@ -261,11 +275,63 @@ public void onCreate(SQLiteDatabase db) { db.execSQL(STATEMENT_CREATE_TABLE); } + + /** + * version 1: + * + * ---------------- + * | key | value | + * --------------- + * + * version 2: + * + * ---------------------------------------- + * | key | value | timestamp | persistent | + * ---------------------------------------- + **/ @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion != newVersion) { - deleteDB(); - onCreate(db); + if(newVersion == 2 && oldVersion == 1){ + WXLogUtils.d(TAG_STORAGE,"storage is updating from version "+oldVersion+" to version "+newVersion); + boolean updateResult = true; + try { + long start = System.currentTimeMillis(); + + db.beginTransaction(); + // update table structure + String SQL_ADD_COLUMN_TIMESTAMP = "ALTER TABLE "+TABLE_STORAGE+" ADD COLUMN "+COLUMN_TIMESTAMP+" TEXT;"; + WXLogUtils.d(TAG_STORAGE,"exec sql : "+ SQL_ADD_COLUMN_TIMESTAMP); + db.execSQL(SQL_ADD_COLUMN_TIMESTAMP); + + String SQL_ADD_COLUMN_PERSISTENT = "ALTER TABLE "+TABLE_STORAGE+" ADD COLUMN "+COLUMN_PERSISTENT+" INTEGER;"; + WXLogUtils.d(TAG_STORAGE,"exec sql : "+ SQL_ADD_COLUMN_PERSISTENT); + db.execSQL(SQL_ADD_COLUMN_PERSISTENT); + + // update timestamp & persistent + String SQL_UPDATE_TABLE = "UPDATE "+TABLE_STORAGE+" SET "+ COLUMN_TIMESTAMP+" = '"+sDateFormatter.format(new Date())+"' , "+ COLUMN_PERSISTENT +" = 0"; + WXLogUtils.d(TAG_STORAGE,"exec sql : "+ SQL_UPDATE_TABLE); + db.execSQL(SQL_UPDATE_TABLE); + + db.setTransactionSuccessful(); + long time = System.currentTimeMillis() - start; + WXLogUtils.d(TAG_STORAGE,"storage updated success ("+time+"ms)"); + }catch (Exception e){ + WXLogUtils.d(TAG_STORAGE,"storage updated failed from version "+oldVersion+" to version "+newVersion+","+e.getMessage()); + updateResult = false; + }finally { + db.endTransaction(); + } + //rollback + if(!updateResult){ + WXLogUtils.d(TAG_STORAGE,"storage is rollback,all data will be removed"); + deleteDB(); + onCreate(db); + } + }else{ + deleteDB(); + onCreate(db); + } } } diff --git a/android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXStorageModule.java b/android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXStorageModule.java index e59d4a3ed..bee43bab1 100644 --- a/android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXStorageModule.java +++ b/android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXStorageModule.java @@ -333,6 +333,28 @@ public void onReceived(Map data) { }); } + @Override + public void setItemPersistent(String key, String value, @Nullable final JSCallback callback) { + if (TextUtils.isEmpty(key) || TextUtils.isEmpty(value)) { + StorageResultHandler.handleInvalidParam(callback); + return; + } + + IWXStorageAdapter adapter = ability(); + if (adapter == null) { + StorageResultHandler.handleNoHandlerError(callback); + return; + } + adapter.setItemPersistent(key, value, new IWXStorageAdapter.OnResultReceivedListener() { + @Override + public void onReceived(Map data) { + if(callback != null){ + callback.invoke(data); + } + } + }); + } + @Override public void destroy() { IWXStorageAdapter adapter = ability(); diff --git a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridge.java b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridge.java index 1cbe51c8f..7b2cdb13f 100755 --- a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridge.java +++ b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridge.java @@ -244,6 +244,11 @@ class WXBridge implements IWXBridge { * @param tasks * @param callback */ + + public int callNative(String instanceId, byte [] tasks, String callback) { + return callNative(instanceId,new String(tasks),callback); + } + public int callNative(String instanceId, String tasks, String callback) { long start = System.currentTimeMillis(); WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(instanceId); @@ -257,7 +262,7 @@ public int callNative(String instanceId, String tasks, String callback) { //catch everything during call native. if(WXEnvironment.isApkDebugable()){ e.printStackTrace(); - WXLogUtils.e(TAG,"callNative throw expection:"+e.getMessage()); + WXLogUtils.e(TAG,"callNative throw exception:"+e.getMessage()); } } @@ -271,6 +276,11 @@ public int callNative(String instanceId, String tasks, String callback) { } return errorCode; } + public int callAddElement(String instanceId, String ref,byte[] dom,String index, String callback) { + + + return callAddElement(instanceId,ref, new String(dom),index,callback); + } public int callAddElement(String instanceId, String ref,String dom,String index, String callback) { diff --git a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java index c7e3f701e..f59ecb79c 100755 --- a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java +++ b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java @@ -284,7 +284,7 @@ public class WXBridgeManager implements Callback,BactchExecutor { public static final String KEY_METHOD = "method"; public static final String KEY_ARGS = "args"; - + // args public static final String MODULE = "module"; public static final String METHOD = "method"; @@ -427,9 +427,13 @@ public void post(Runnable r, Object token) { return; } - Message m = Message.obtain(mJSHandler, WXThread.secure(r)); - m.obj = token; - m.sendToTarget(); + if (isJSThread() && r != null) { + r.run(); + } else { + Message m = Message.obtain(mJSHandler, WXThread.secure(r)); + m.obj = token; + m.sendToTarget(); + } } void setTimeout(String callbackId, String time) { @@ -549,13 +553,8 @@ public int callAddElement(String instanceId, String ref,String dom,String index, } sDomModule = getDomModule(instanceId); sDomModule.addElement(ref, domObject, Integer.parseInt(index)); - - } - - - if (UNDEFINED.equals(callback)) { return IWXBridge.INSTANCE_RENDERING_ERROR; } @@ -982,11 +981,11 @@ private void invokeExecJS(String instanceId, String namespace, String function, mLodBuilder.setLength(0); } - if(mDestroyedInstanceId!=null && !mDestroyedInstanceId.contains(instanceId)) { +// if(mDestroyedInstanceId!=null && !mDestroyedInstanceId.contains(instanceId)) { mWXBridge.execJS(instanceId, namespace, function, args); - }else{ - WXLogUtils.w("invokeExecJS: instanceId: "+instanceId+"was destroy !! ExecJS abandon !!"); - } +// }else{ +// WXLogUtils.w("invokeExecJS: instanceId: "+instanceId+"was destroy !! ExecJS abandon !!"); +// } } private WXJSObject[] createTimerArgs(int instanceId, int funcId, boolean keepAlive) { @@ -1170,6 +1169,10 @@ public void run() { }, null); } + private boolean isJSThread() { + return mJSThread != null && mJSThread.getId() == Thread.currentThread().getId(); + } + private void invokeRegisterModules(Map modules) { if (modules == null || !isJSFrameworkInit()) { if (!isJSFrameworkInit()) { diff --git a/android/sdk/src/main/java/com/taobao/weex/common/TypeModuleFactory.java b/android/sdk/src/main/java/com/taobao/weex/common/TypeModuleFactory.java index ea1922894..6596674a7 100644 --- a/android/sdk/src/main/java/com/taobao/weex/common/TypeModuleFactory.java +++ b/android/sdk/src/main/java/com/taobao/weex/common/TypeModuleFactory.java @@ -204,11 +204,10 @@ */ package com.taobao.weex.common; +import com.taobao.weex.WXEnvironment; import com.taobao.weex.bridge.Invoker; import com.taobao.weex.bridge.MethodInvoker; import com.taobao.weex.bridge.ModuleFactory; -import com.taobao.weex.common.WXModule; -import com.taobao.weex.common.WXModuleAnno; import com.taobao.weex.utils.WXLogUtils; import java.lang.annotation.Annotation; @@ -232,7 +231,9 @@ public TypeModuleFactory(Class clz) { } private void generateMethodMap() { - WXLogUtils.d(TAG, "extractMethodNames:"+mClazz.getSimpleName()); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "extractMethodNames:" + mClazz.getSimpleName()); + } ArrayList methods = new ArrayList<>(); HashMap methodMap = new HashMap<>(); try { diff --git a/android/sdk/src/main/java/com/taobao/weex/common/WXModule.java b/android/sdk/src/main/java/com/taobao/weex/common/WXModule.java index c2703c131..2f68f1279 100755 --- a/android/sdk/src/main/java/com/taobao/weex/common/WXModule.java +++ b/android/sdk/src/main/java/com/taobao/weex/common/WXModule.java @@ -211,5 +211,13 @@ */ public abstract class WXModule implements IWXObject { + public static final String ACTION_ACTIVITY_RESULT = "actionActivityResult"; + public static final String ACTION_REQUEST_PERMISSIONS_RESULT = "actionRequestPermissionsResult"; + public static final String REQUEST_CODE = "requestCode"; + public static final String RESULT_CODE = "resultCode"; + public static final String PERMISSIONS = "permissions"; + public static final String GRANT_RESULTS = "grantResults"; + + public WXSDKInstance mWXSDKInstance; } diff --git a/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java b/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java index 16ddd21b3..b6e0af1bd 100755 --- a/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java +++ b/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java @@ -435,4 +435,14 @@ public String toString() { } return super.toString(); } + public String getPerfData(){ + return "networkTime:" + networkTime + + " actualNetworkTime:" + actualNetworkTime + + " connectionType:" + connectionType + + " requestType:" + requestType + + " firstScreenRenderTime:" + screenRenderTime + + " firstScreenJSFExecuteTime:" + firstScreenJSFExecuteTime + + " componentCount:" + componentCount + + " totalTime:" + totalTime; + } } \ No newline at end of file diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java index c2a152163..f243b183c 100755 --- a/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java +++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java @@ -204,20 +204,33 @@ */ package com.taobao.weex.dom; +import android.support.annotation.NonNull; + import com.taobao.weex.common.Constants; import com.taobao.weex.common.WXImageSharpen; import com.taobao.weex.utils.WXLogUtils; +import java.util.Collection; +import java.util.HashMap; import java.util.Map; +import java.util.Set; /** * store value of component attribute * */ -public class WXAttr extends SafePutConcurrentHashMap { +public class WXAttr implements Map,Cloneable { private static final long serialVersionUID = -2619357510079360946L; + private @NonNull final Map map; + + public WXAttr(){ + map=new HashMap<>(); + } + public WXAttr(@NonNull Map map) { + this.map=map; + } public static String getPrefix(Map attr) { if (attr == null) { return null; @@ -359,6 +372,18 @@ public String getLoadMoreOffset() { return src.toString(); } + public String optString(String key){ + if(containsKey(key)){ + Object value = get(key); + if (value instanceof String) { + return (String) value; + } else if (value != null) { + return String.valueOf(value); + } + } + return ""; + } + public boolean getIsRecycleImage() { Object obj = get(Constants.Name.RECYCLE_IMAGE); if (obj == null) { @@ -379,4 +404,82 @@ public String getScrollDirection() { } return scrollDirection.toString(); } + + @Override + public boolean equals(Object o) { + return map.equals(o); + } + + @Override + public int hashCode() { + return map.hashCode(); + } + + @Override + public void clear() { + map.clear(); + } + + @Override + public boolean containsKey(Object key) { + return map.containsKey(key); + } + + @Override + public boolean containsValue(Object value) { + return map.containsValue(value); + } + + @NonNull + @Override + public Set> entrySet() { + return map.entrySet(); + } + + @Override + public Object get(Object key) { + return map.get(key); + } + + @Override + public boolean isEmpty() { + return map.isEmpty(); + } + + @NonNull + @Override + public Set keySet() { + return map.keySet(); + } + + @Override + public Object put(String key, Object value) { + return map.put(key,value); + } + + @Override + public void putAll(Map map) { + this.map.putAll(map); + } + + @Override + public Object remove(Object key) { + return map.remove(key); + } + + @Override + public int size() { + return map.size(); + } + + @NonNull + @Override + public Collection values() { + return map.values(); + } + + @Override + protected WXAttr clone(){ + return new WXAttr(new HashMap<>(map)); + } } diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java index 94e0d4e79..18ee5a443 100755 --- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java +++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java @@ -292,6 +292,9 @@ public boolean handleMessage(Message msg) { case MsgType.WX_DOM_ADD_RULE: mWXDomManager.addRule((String) task.args.get(0), (JSONObject) task.args.get(1)); break; + case MsgType.WX_COMPONENT_SIZE: + mWXDomManager.getComponentSize(task.instanceId,(String) task.args.get(0),(String) task.args.get(1)); + break; default: break; } @@ -317,5 +320,7 @@ public static class MsgType { public static final int WX_DOM_ADD_RULE=0xd; public static final int WX_DOM_BATCH = 0xff; + + public static final int WX_COMPONENT_SIZE= 0xff1; } } diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java index 793e23482..4be61b22f 100755 --- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java +++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java @@ -221,7 +221,9 @@ import com.taobao.weex.utils.TypefaceUtil; import com.taobao.weex.utils.WXUtils; +import java.util.HashMap; import java.util.Iterator; +import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; @@ -235,7 +237,8 @@ public final class WXDomManager { private WXThread mDomThread; - /** package **/ Handler mDomHandler; + /** package **/ + Handler mDomHandler; private WXRenderManager mWXRenderManager; private ConcurrentHashMap mDomRegistries; @@ -576,4 +579,19 @@ private FontDO parseFontDO(JSONObject jsonObject) { String name = jsonObject.getString(Constants.Name.FONT_FAMILY); return new FontDO(name, src); } + + public void getComponentSize(String instanceId, String ref, String callback) { + if (!isDomThread()) { + throw new WXRuntimeException("getComponentSize operation must be done in dom thread"); + } + WXDomStatement statement = mDomRegistries.get(instanceId); + if (statement == null) { + Map options = new HashMap<>(); + options.put("result", false); + options.put("errMsg", "Component does not exist"); + WXSDKManager.getInstance().callback(instanceId, callback, options); + return; + } + statement.getComponentSize(ref, callback); + } } diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java index 607592555..2076edd45 100755 --- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java +++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java @@ -204,6 +204,7 @@ */ package com.taobao.weex.dom; +import android.graphics.Rect; import android.os.Message; import android.text.TextUtils; @@ -215,6 +216,8 @@ import com.taobao.weex.utils.WXLogUtils; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; /** @@ -245,6 +248,7 @@ public final class WXDomModule extends WXModule { static final String UPDATE_FINISH = "updateFinish"; static final String SCROLL_TO_ELEMENT = "scrollToElement"; static final String ADD_RULE = "addRule"; + static final String GET_COMPONENT_SIZE = "getComponentSize"; public static final String WXDOM = "dom"; @@ -254,7 +258,7 @@ public final class WXDomModule extends WXModule { */ public static final String[] METHODS = {CREATE_BODY, UPDATE_ATTRS, UPDATE_STYLE, REMOVE_ELEMENT, ADD_ELEMENT, MOVE_ELEMENT, ADD_EVENT, REMOVE_EVENT, CREATE_FINISH, - REFRESH_FINISH, UPDATE_FINISH, SCROLL_TO_ELEMENT, ADD_RULE}; + REFRESH_FINISH, UPDATE_FINISH, SCROLL_TO_ELEMENT, ADD_RULE,GET_COMPONENT_SIZE}; public void callDomMethod(JSONObject task) { if (task == null) { @@ -338,6 +342,11 @@ public void callDomMethod(JSONObject task) { return; } addRule((String) args.get(0), (JSONObject) args.get(1)); + case GET_COMPONENT_SIZE: + if(args == null){ + return; + } + getComponentSize((String) args.get(0),(String) args.get(1)); } } catch (IndexOutOfBoundsException e) { @@ -584,4 +593,51 @@ public void addRule(String type, JSONObject options) { msg.obj = task; WXSDKManager.getInstance().getWXDomManager().sendMessage(msg); } + + /** + * By ref the width and height of the component. + * + * @param ref the refer of component + * @param callback function id + */ + public void getComponentSize(String ref, String callback) { + if (TextUtils.isEmpty(ref) || TextUtils.isEmpty(callback)) { + Map options = new HashMap<>(); + options.put("result", false); + options.put("errMsg", "Illegal parameter"); + WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callback, options); + return; + } else if ("viewport".equalsIgnoreCase(ref)) { + if(mWXSDKInstance!=null && mWXSDKInstance.getRootView()!=null){ + Map options = new HashMap<>(); + Map sizes = new HashMap<>(); + Rect rect=new Rect(); + mWXSDKInstance.getRootView().getGlobalVisibleRect(rect); + sizes.put("width", String.valueOf(rect.width())); + sizes.put("height", String.valueOf(rect.height())); + sizes.put("bottom",String.valueOf(rect.bottom)); + sizes.put("left",String.valueOf(rect.left)); + sizes.put("right",String.valueOf(rect.right)); + sizes.put("top",String.valueOf(rect.top)); + options.put("size", sizes); + options.put("result", true); + WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callback, options); + }else{ + Map options = new HashMap<>(); + options.put("result", false); + options.put("errMsg", "Component does not exist"); + WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callback, options); + } + } else { + Message msg = Message.obtain(); + WXDomTask task = new WXDomTask(); + task.instanceId = mWXSDKInstance.getInstanceId(); + task.args = new ArrayList<>(); + task.args.add(ref); + task.args.add(callback); + msg.what = WXDomHandler.MsgType.WX_COMPONENT_SIZE; + msg.obj = task; + WXSDKManager.getInstance().getWXDomManager().sendMessage(msg); + } + } } diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java index 9993fb291..beff8a810 100755 --- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java +++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java @@ -210,11 +210,11 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.taobao.weex.WXEnvironment; +import com.taobao.weex.common.Constants; import com.taobao.weex.dom.flex.CSSLayoutContext; import com.taobao.weex.dom.flex.CSSNode; import com.taobao.weex.dom.flex.Spacing; import com.taobao.weex.ui.component.WXBasicComponentType; -import com.taobao.weex.utils.WXJsonUtils; import com.taobao.weex.utils.WXLogUtils; import com.taobao.weex.utils.WXViewUtils; @@ -337,8 +337,8 @@ protected final void copyFields(WXDomObject dest) { dest.setModifyWidth(isModifyWidth); dest.ref = ref; dest.type = type; - dest.style = style;//mStyles == null ? null : mStyles.clone(); - dest.attr = attr;//mAttrs == null ? null : mAttrs.clone(); + dest.style = style == null ? null : style.clone();//mStyles == null ? null : mStyles.clone(); + dest.attr = attr == null ? null : attr.clone();//mAttrs == null ? null : mAttrs.clone(); dest.event = event == null ? null : event.clone(); dest.csslayout.copy(this.csslayout); } @@ -357,14 +357,14 @@ public void parseFromJson(JSONObject map){ this.ref = (String) map.get("ref"); Object style = map.get("style"); if (style != null && style instanceof JSONObject) { - WXStyle styles = new WXStyle(); - WXJsonUtils.putAll(styles, (JSONObject) style); + WXStyle styles = new WXStyle((JSONObject) style); + //WXJsonUtils.putAll(styles, (JSONObject) style); this.style = styles; } Object attr = map.get("attr"); if (attr != null && attr instanceof JSONObject) { - WXAttr attrs = new WXAttr(); - WXJsonUtils.putAll(attrs, (JSONObject) attr); + WXAttr attrs = new WXAttr((JSONObject) attr); + //WXJsonUtils.putAll(attrs, (JSONObject) attr); this.attr = attrs; } Object event = map.get("event"); @@ -592,41 +592,106 @@ public void updateStyle(Map styles) { public void applyStyleToNode() { WXStyle stylesMap = getStyles(); if (!stylesMap.isEmpty()) { - setAlignItems(stylesMap.getAlignItems()); - setAlignSelf(stylesMap.getAlignSelf()); - setFlex(stylesMap.getFlex()); - setFlexDirection(stylesMap.getFlexDirection()); - setJustifyContent(stylesMap.getJustifyContent()); - setWrap(stylesMap.getCSSWrap()); - - setMinWidth(WXViewUtils.getRealPxByWidth(stylesMap.getMinWidth())); - setMaxWidth(WXViewUtils.getRealPxByWidth(stylesMap.getMaxWidth())); - setMinHeight(WXViewUtils.getRealPxByWidth(stylesMap.getMinHeight())); - setMaxHeight(WXViewUtils.getRealPxByWidth(stylesMap.getMaxHeight())); - - setMargin(Spacing.LEFT, WXViewUtils.getRealPxByWidth(stylesMap.getMarginLeft())); - setMargin(Spacing.TOP, WXViewUtils.getRealPxByWidth(stylesMap.getMarginTop())); - setMargin(Spacing.RIGHT, WXViewUtils.getRealPxByWidth(stylesMap.getMarginRight())); - setMargin(Spacing.BOTTOM, WXViewUtils.getRealPxByWidth(stylesMap.getMarginBottom())); - - setPadding(Spacing.LEFT, WXViewUtils.getRealPxByWidth(stylesMap.getPaddingLeft())); - setPadding(Spacing.TOP, WXViewUtils.getRealPxByWidth(stylesMap.getPaddingTop())); - setPadding(Spacing.RIGHT, WXViewUtils.getRealPxByWidth(stylesMap.getPaddingRight())); - setPadding(Spacing.BOTTOM, WXViewUtils.getRealPxByWidth(stylesMap.getPaddingBottom())); - - setPositionType(stylesMap.getPosition()); - setPositionLeft(WXViewUtils.getRealPxByWidth(stylesMap.getLeft())); - setPositionTop(WXViewUtils.getRealPxByWidth(stylesMap.getTop())); - setPositionRight(WXViewUtils.getRealPxByWidth(stylesMap.getRight())); - setPositionBottom(WXViewUtils.getRealPxByWidth(stylesMap.getBottom())); - - setBorder(Spacing.TOP, WXViewUtils.getRealPxByWidth(stylesMap.getBorderTopWidth())); - setBorder(Spacing.RIGHT, WXViewUtils.getRealPxByWidth(stylesMap.getBorderRightWidth())); - setBorder(Spacing.BOTTOM, WXViewUtils.getRealPxByWidth(stylesMap.getBorderBottomWidth())); - setBorder(Spacing.LEFT, WXViewUtils.getRealPxByWidth(stylesMap.getBorderLeftWidth())); - - setStyleHeight(WXViewUtils.getRealPxByWidth(stylesMap.getHeight())); - setStyleWidth(WXViewUtils.getRealPxByWidth(stylesMap.getWidth())); + for(Map.Entry item:stylesMap.entrySet()) { + switch (item.getKey()) { + case Constants.Name.ALIGN_ITEMS: + setAlignItems(stylesMap.getAlignItems()); + break; + case Constants.Name.ALIGN_SELF: + setAlignSelf(stylesMap.getAlignSelf()); + break; + case Constants.Name.FLEX: + setFlex(stylesMap.getFlex()); + break; + case Constants.Name.FLEX_DIRECTION: + setFlexDirection(stylesMap.getFlexDirection()); + break; + case Constants.Name.JUSTIFY_CONTENT: + setJustifyContent(stylesMap.getJustifyContent()); + break; + case Constants.Name.FLEX_WRAP: + setWrap(stylesMap.getCSSWrap()); + break; + case Constants.Name.MIN_WIDTH: + setMinWidth(WXViewUtils.getRealPxByWidth(stylesMap.getMinWidth())); + break; + case Constants.Name.MIN_HEIGHT: + setMinHeight(WXViewUtils.getRealPxByWidth(stylesMap.getMinHeight())); + break; + case Constants.Name.MAX_WIDTH: + setMaxWidth(WXViewUtils.getRealPxByWidth(stylesMap.getMaxWidth())); + break; + case Constants.Name.MAX_HEIGHT: + setMaxHeight(WXViewUtils.getRealPxByWidth(stylesMap.getMaxHeight())); + break; + case Constants.Name.HEIGHT: + setStyleHeight(WXViewUtils.getRealPxByWidth(stylesMap.getHeight())); + break; + case Constants.Name.WIDTH: + setStyleWidth(WXViewUtils.getRealPxByWidth(stylesMap.getWidth())); + break; + case Constants.Name.POSITION: + setPositionType(stylesMap.getPosition()); + break; + case Constants.Name.LEFT: + setPositionLeft(WXViewUtils.getRealPxByWidth(stylesMap.getLeft())); + break; + case Constants.Name.TOP: + setPositionTop(WXViewUtils.getRealPxByWidth(stylesMap.getTop())); + break; + case Constants.Name.RIGHT: + setPositionRight(WXViewUtils.getRealPxByWidth(stylesMap.getRight())); + break; + case Constants.Name.BOTTOM: + setPositionBottom(WXViewUtils.getRealPxByWidth(stylesMap.getBottom())); + break; + case Constants.Name.MARGIN: + setMargin(Spacing.ALL, WXViewUtils.getRealPxByWidth(stylesMap.getMargin())); + break; + case Constants.Name.MARGIN_LEFT: + setMargin(Spacing.LEFT, WXViewUtils.getRealPxByWidth(stylesMap.getMarginLeft())); + break; + case Constants.Name.MARGIN_TOP: + setMargin(Spacing.TOP, WXViewUtils.getRealPxByWidth(stylesMap.getMarginTop())); + break; + case Constants.Name.MARGIN_RIGHT: + setMargin(Spacing.RIGHT, WXViewUtils.getRealPxByWidth(stylesMap.getMarginRight())); + break; + case Constants.Name.MARGIN_BOTTOM: + setMargin(Spacing.BOTTOM, WXViewUtils.getRealPxByWidth(stylesMap.getMarginBottom())); + break; + case Constants.Name.BORDER_WIDTH: + setBorder(Spacing.ALL, WXViewUtils.getRealPxByWidth(stylesMap.getBorderWidth())); + break; + case Constants.Name.BORDER_TOP_WIDTH: + setBorder(Spacing.TOP, WXViewUtils.getRealPxByWidth(stylesMap.getBorderTopWidth())); + break; + case Constants.Name.BORDER_RIGHT_WIDTH: + setBorder(Spacing.RIGHT, WXViewUtils.getRealPxByWidth(stylesMap.getBorderRightWidth())); + break; + case Constants.Name.BORDER_BOTTOM_WIDTH: + setBorder(Spacing.BOTTOM, WXViewUtils.getRealPxByWidth(stylesMap.getBorderBottomWidth())); + break; + case Constants.Name.BORDER_LEFT_WIDTH: + setBorder(Spacing.LEFT, WXViewUtils.getRealPxByWidth(stylesMap.getBorderLeftWidth())); + break; + case Constants.Name.PADDING: + setPadding(Spacing.ALL, WXViewUtils.getRealPxByWidth(stylesMap.getPadding())); + break; + case Constants.Name.PADDING_LEFT: + setPadding(Spacing.LEFT, WXViewUtils.getRealPxByWidth(stylesMap.getPaddingLeft())); + break; + case Constants.Name.PADDING_TOP: + setPadding(Spacing.TOP, WXViewUtils.getRealPxByWidth(stylesMap.getPaddingTop())); + break; + case Constants.Name.PADDING_RIGHT: + setPadding(Spacing.RIGHT, WXViewUtils.getRealPxByWidth(stylesMap.getPaddingRight())); + break; + case Constants.Name.PADDING_BOTTOM: + setPadding(Spacing.BOTTOM, WXViewUtils.getRealPxByWidth(stylesMap.getPaddingBottom())); + break; + } + } } } diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomStatement.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomStatement.java index 0757bbd9b..7ab305d2e 100755 --- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomStatement.java +++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomStatement.java @@ -329,16 +329,20 @@ void rebuildingDomTree(WXDomObject root) { * in the queue. */ void batch() { - long start0 = System.currentTimeMillis(); if (!mDirty || mDestroy) { return; } WXDomObject rootDom = mRegistry.get(WXDomObject.ROOT); + layout(rootDom); + } + + void layout(WXDomObject rootDom) { if (rootDom == null) { return; } + long start0 = System.currentTimeMillis(); rebuildingDomTree(rootDom); @@ -349,7 +353,7 @@ void batch() { rootDom.calculateLayout(mLayoutContext); WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); - if(instance != null) { + if (instance != null) { instance.cssLayoutTime(System.currentTimeMillis() - start); } @@ -358,20 +362,17 @@ void batch() { start = System.currentTimeMillis(); applyUpdate(rootDom); - if(instance != null) { + if (instance != null) { instance.applyUpdateTime(System.currentTimeMillis() - start); } start = System.currentTimeMillis(); updateDomObj(); - if(instance != null) { + if (instance != null) { instance.updateDomObjTime(System.currentTimeMillis() - start); } - - WXLogUtils.d("Batch","animation size :" +animations.size()); parseAnimation(); - WXLogUtils.d("Batch","task size :" +mNormalTasks.size()); int count = mNormalTasks.size(); for (int i = 0; i < count && !mDestroy; ++i) { mWXRenderManager.runOnThread(mInstanceId, mNormalTasks.get(i)); @@ -380,10 +381,9 @@ void batch() { mAddDom.clear(); animations.clear(); mDirty = false; - if(instance != null) { + if (instance != null) { instance.batchTime(System.currentTimeMillis() - start0); } - } /** @@ -733,8 +733,8 @@ void moveDom(final String ref, final String parentRef, final int index) { } return; } - if(domObject.parent.equals(parentObject)){ - return ; + if (domObject.parent.equals(parentObject) && parentObject.index(domObject) == index) { + return; } domObject.parent.remove(domObject); parentObject.add(domObject, index); @@ -919,10 +919,12 @@ public String toString() { return "updateStyle"; } }); - if (update.containsKey("padding") || update.containsKey("paddingTop") || - update.containsKey("paddingLeft") || - update.containsKey("paddingRight") || - update.containsKey("paddingBottom") || update.containsKey("borderWidth")) { + if (update.containsKey(Constants.Name.PADDING) || + update.containsKey(Constants.Name.PADDING_TOP) || + update.containsKey(Constants.Name.PADDING_LEFT) || + update.containsKey(Constants.Name.PADDING_RIGHT) || + update.containsKey(Constants.Name.PADDING_BOTTOM) || + update.containsKey(Constants.Name.BORDER_WIDTH)) { mNormalTasks.add(new IWXRenderTask() { @Override @@ -1251,7 +1253,7 @@ private WXAnimationBean createAnimationBean(String ref,Map style * {@link WXDomObject} {@link com.taobao.weex.dom.flex.CSSNode#mChildren} and parsing style, * false for only parsing style. */ - private void transformStyle(WXDomObject dom, boolean isAdd) { + /** package **/ void transformStyle(WXDomObject dom, boolean isAdd) { if (dom == null) { return; } @@ -1287,6 +1289,30 @@ private void transformStyle(WXDomObject dom, boolean isAdd) { } } + public void getComponentSize(final String ref, final String callback) { + if (mDestroy) { + Map options = new HashMap<>(); + options.put("result", false); + options.put("errMsg", "Component does not exist"); + WXSDKManager.getInstance().callback(mInstanceId, callback, options); + return; + } + + mNormalTasks.add(new IWXRenderTask() { + + @Override + public void execute() { + mWXRenderManager.getComponentSize(mInstanceId, ref, callback); + } + + @Override + public String toString() { + return "getComponentSize"; + } + }); + + } + static class AddDomInfo { public WXComponent component; diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXLineHeightSpan.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXLineHeightSpan.java index f0c11c4b2..013dce63b 100644 --- a/android/sdk/src/main/java/com/taobao/weex/dom/WXLineHeightSpan.java +++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXLineHeightSpan.java @@ -207,6 +207,7 @@ import android.graphics.Paint; import android.text.style.LineHeightSpan; +import com.taobao.weex.WXEnvironment; import com.taobao.weex.utils.WXLogUtils; public class WXLineHeightSpan implements LineHeightSpan{ @@ -218,8 +219,10 @@ public WXLineHeightSpan(int lineHeight){ @Override public void chooseHeight(CharSequence text, int start, int end, int spanstartv, int v, Paint.FontMetricsInt fm) { - WXLogUtils.d("LineHeight", text+" ; start "+start+"; end "+end+"; spanstartv " - +spanstartv+"; v "+v+"; fm "+fm); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d("LineHeight", text + " ; start " + start + "; end " + end + "; spanstartv " + + spanstartv + "; v " + v + "; fm " + fm); + } int halfLeading=(lineHeight-(fm.descent-fm.ascent))/2; fm.top-=halfLeading; fm.bottom+=halfLeading; diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXStyle.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXStyle.java index 09f684430..11758e442 100755 --- a/android/sdk/src/main/java/com/taobao/weex/dom/WXStyle.java +++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXStyle.java @@ -204,6 +204,7 @@ */ package com.taobao.weex.dom; +import android.support.annotation.NonNull; import android.text.Layout; import android.text.TextUtils; @@ -218,16 +219,31 @@ import com.taobao.weex.utils.WXUtils; import com.taobao.weex.utils.WXViewUtils; +import java.util.Collection; +import java.util.HashMap; import java.util.Map; +import java.util.Set; /** * Store value of component style * */ -public class WXStyle extends SafePutConcurrentHashMap { +public class WXStyle implements Map,Cloneable { private static final long serialVersionUID = 611132641365274134L; public static final int UNSET = -1; + + private @NonNull final Map map; + + public WXStyle(){ + map = new HashMap<>(); + } + + public WXStyle(@NonNull Map map){ + this.map=map; + } + + /* * text-decoration **/ @@ -447,11 +463,7 @@ private float getBorderWidth(String key) { //TODO fix : only when set backgroundColor public float getBorderWidth() { - float temp = WXUtils.getFloat(get(Constants.Name.BORDER_WIDTH)); - if (WXUtils.isUndefined(temp)) { - return Float.NaN; - } - return temp; + return WXUtils.getFloat(get(Constants.Name.BORDER_WIDTH)); } public float getBorderRightWidth() { @@ -476,6 +488,14 @@ public String getBorderStyle() { return borderStyle == null ? null : borderStyle.toString(); } + public float getMargin(){ + return WXUtils.getFloat(get(Constants.Name.MARGIN)); + } + + public float getPadding(){ + return WXUtils.getFloat(get(Constants.Name.PADDING)); + } + /* * margin **/ @@ -618,4 +638,82 @@ public String getOverflow() { Object obj = get(Constants.Name.OVERFLOW); return obj == null ? Constants.Value.VISIBLE : obj.toString(); } + + @Override + public boolean equals(Object o) { + return map.equals(o); + } + + @Override + public int hashCode() { + return map.hashCode(); + } + + @Override + public void clear() { + map.clear(); + } + + @Override + public boolean containsKey(Object key) { + return map.containsKey(key); + } + + @Override + public boolean containsValue(Object value) { + return map.containsValue(value); + } + + @NonNull + @Override + public Set> entrySet() { + return map.entrySet(); + } + + @Override + public Object get(Object key) { + return map.get(key); + } + + @Override + public boolean isEmpty() { + return map.isEmpty(); + } + + @NonNull + @Override + public Set keySet() { + return map.keySet(); + } + + @Override + public Object put(String key, Object value) { + return map.put(key,value); + } + + @Override + public void putAll(Map map) { + this.map.putAll(map); + } + + @Override + public Object remove(Object key) { + return map.remove(key); + } + + @Override + public int size() { + return map.size(); + } + + @NonNull + @Override + public Collection values() { + return map.values(); + } + + @Override + protected WXStyle clone(){ + return new WXStyle(new HashMap<>(map)); + } } diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java index 10beebed7..5129d434d 100755 --- a/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java +++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java @@ -75,9 +75,9 @@ public void execute(Spannable sb) { * Object for calculating text's width and height. This class is an anonymous class of * implementing {@link com.taobao.weex.dom.flex.CSSNode.MeasureFunction} */ - private static final CSSNode.MeasureFunction TEXT_MEASURE_FUNCTION = new CSSNode.MeasureFunction() { + /** package **/ static final CSSNode.MeasureFunction TEXT_MEASURE_FUNCTION = new CSSNode.MeasureFunction() { @Override - public void measure(CSSNode node, float width, MeasureOutput measureOutput) { + public void measure(CSSNode node, float width, @NonNull MeasureOutput measureOutput) { WXTextDomObject textDomObject = (WXTextDomObject) node; if (CSSConstants.isUndefined(width)) { width = node.cssstyle.maxWidth; @@ -134,6 +134,10 @@ public WXTextDomObject() { setMeasureFunction(TEXT_MEASURE_FUNCTION); } + public TextPaint getTextPaint() { + return mTextPaint; + } + /** * Prepare the text {@link Spanned} for calculating text's size. This is done by setting * various text span to the text. @@ -360,7 +364,7 @@ Layout createLayout(float width, boolean forceWidth, @Nullable Layout previousLa * @return if forceToDesired is false, it will be the minimum value of the width of text and * outerWidth in case of outerWidth is defined, in other case, it will be outer width. */ - private float getTextWidth(TextPaint textPaint,float outerWidth, boolean forceToDesired) { + /** package **/ float getTextWidth(TextPaint textPaint,float outerWidth, boolean forceToDesired) { float textWidth; if (forceToDesired) { textWidth = outerWidth; diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/SimpleComponentHolder.java b/android/sdk/src/main/java/com/taobao/weex/ui/SimpleComponentHolder.java index 24ca9b878..1216a3b42 100644 --- a/android/sdk/src/main/java/com/taobao/weex/ui/SimpleComponentHolder.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/SimpleComponentHolder.java @@ -204,6 +204,7 @@ */ package com.taobao.weex.ui; +import com.taobao.weex.WXEnvironment; import com.taobao.weex.WXSDKInstance; import com.taobao.weex.bridge.Invoker; import com.taobao.weex.bridge.MethodInvoker; @@ -298,7 +299,9 @@ public void loadIfNonLazy() { } private synchronized void generate(){ - WXLogUtils.d(TAG,"Generate Component:"+mClz.getSimpleName()); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "Generate Component:" + mClz.getSimpleName()); + } mMethods = getMethods(mClz); } diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderManager.java b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderManager.java index d9167d4bd..af2110d48 100755 --- a/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderManager.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderManager.java @@ -209,6 +209,7 @@ import android.text.TextUtils; import com.taobao.weex.WXSDKInstance; +import com.taobao.weex.WXSDKManager; import com.taobao.weex.common.WXRuntimeException; import com.taobao.weex.common.WXThread; import com.taobao.weex.dom.WXDomObject; @@ -218,6 +219,7 @@ import com.taobao.weex.utils.WXUtils; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -463,4 +465,16 @@ public List getAllInstances() { } return instances; } + + public void getComponentSize(String instanceId, String ref, String callback) { + WXRenderStatement statement = mRegistries.get(instanceId); + if (statement == null) { + Map options = new HashMap<>(); + options.put("result", false); + options.put("errMsg", "Component does not exist"); + WXSDKManager.getInstance().callback(instanceId, callback, options); + return; + } + statement.getComponentSize(ref, callback); + } } diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderStatement.java b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderStatement.java index 9124993a9..fa3929289 100755 --- a/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderStatement.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderStatement.java @@ -205,6 +205,7 @@ package com.taobao.weex.ui; import android.graphics.Color; +import android.graphics.Rect; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.ViewGroup; @@ -215,13 +216,13 @@ import com.alibaba.fastjson.JSONObject; import com.taobao.weex.WXEnvironment; import com.taobao.weex.WXSDKInstance; +import com.taobao.weex.WXSDKManager; import com.taobao.weex.common.WXRenderStrategy; import com.taobao.weex.dom.WXDomObject; import com.taobao.weex.dom.flex.Spacing; import com.taobao.weex.ui.animation.WXAnimationBean; import com.taobao.weex.ui.animation.WXAnimationModule; import com.taobao.weex.ui.component.Scrollable; -import com.taobao.weex.ui.component.WXBasicComponentType; import com.taobao.weex.ui.component.WXComponent; import com.taobao.weex.ui.component.WXComponentFactory; import com.taobao.weex.ui.component.WXScroller; @@ -569,4 +570,24 @@ private WXComponent generateComponentTree(WXDomObject dom, WXVContainer parent) void startAnimation(@NonNull String ref, @NonNull WXAnimationBean animationBean, @Nullable String callBack) { WXAnimationModule.startAnimation(mWXSDKInstance, mRegistry.get(ref), animationBean, callBack); } + + public void getComponentSize(String ref, String callback) { + WXComponent component = mRegistry.get(ref); + Map options = new HashMap<>(); + if (component != null) { + Map size = new HashMap<>(); + Rect sizes = component.getComponentSize(); + size.put("width", String.valueOf(sizes.width())); + size.put("height", String.valueOf(sizes.height())); + size.put("bottom",String.valueOf(sizes.bottom)); + size.put("left",String.valueOf(sizes.left)); + size.put("right",String.valueOf(sizes.right)); + size.put("top",String.valueOf(sizes.top)); + options.put("size", size); + options.put("result", true); + } else { + options.put("errMsg", "Component does not exist"); + } + WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callback, options); + } } diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/AbstractEditComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/AbstractEditComponent.java index 0ddbc75a5..70097b14b 100644 --- a/android/sdk/src/main/java/com/taobao/weex/ui/component/AbstractEditComponent.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/AbstractEditComponent.java @@ -270,7 +270,7 @@ protected void appleStyleAfterCreated(WXEditText editText) { } editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, WXStyle.getFontSize(getDomObject().getStyles())); - editText.setText((String) getDomObject().getAttrs().get("value")); + editText.setText(getDomObject().getAttrs().optString(Constants.Name.VALUE)); } diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java index de1723c23..9c8374b6b 100755 --- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java @@ -130,6 +130,7 @@ import android.content.Context; import android.graphics.Color; import android.graphics.PointF; +import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.support.annotation.NonNull; @@ -137,7 +138,6 @@ import android.support.v4.view.ViewPager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; -import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -184,6 +184,11 @@ */ public abstract class WXComponent implements IWXObject, IWXActivityStateListener { + public static final String PROP_FIXED_SIZE = "fixedSize"; + public static final String PROP_FS_MATCH_PARENT = "m"; + public static final String PROP_FS_WRAP_CONTENT = "w"; + + private int mFixedProp = 0; public static int mComponentNum = 0; /** package **/ T mHost; @@ -229,6 +234,14 @@ public String getInstanceId() { return mInstance.getInstanceId(); } + public Rect getComponentSize() { + Rect size=new Rect(); + if(mHost!=null){ + mHost.getGlobalVisibleRect(size); + } + return size; + } + interface OnClickListener{ void onHostViewClick(); } @@ -538,8 +551,14 @@ public WXDomObject getDomObject() { */ protected MeasureOutput measure(int width, int height) { MeasureOutput measureOutput = new MeasureOutput(); - measureOutput.width = width; - measureOutput.height = height; + + if(mFixedProp != 0){ + measureOutput.width = mFixedProp; + measureOutput.height = mFixedProp; + }else { + measureOutput.width = width; + measureOutput.height = height; + } return measureOutput; } @@ -639,6 +658,10 @@ protected boolean setProperty(String key, Object param) { if (visibility != null) setVisibility(visibility); return true; + case PROP_FIXED_SIZE: + String fixedSize = WXUtils.getString(param, PROP_FS_MATCH_PARENT); + setFixedSize(fixedSize); + return true; case Constants.Name.WIDTH: case Constants.Name.MIN_WIDTH: case Constants.Name.MAX_WIDTH: @@ -671,6 +694,29 @@ protected boolean setProperty(String key, Object param) { } } + /** + * Avoid large size view fail in GPU-Animation. + * @param fixedSize + */ + private void setFixedSize(String fixedSize) { + if(PROP_FS_MATCH_PARENT.equals(fixedSize)){ + mFixedProp = ViewGroup.LayoutParams.MATCH_PARENT; + }else if(PROP_FS_WRAP_CONTENT.equals(fixedSize)){ + mFixedProp = ViewGroup.LayoutParams.WRAP_CONTENT; + }else{ + mFixedProp = 0; + return; + } + if(mHost != null){ + ViewGroup.LayoutParams layoutParams = mHost.getLayoutParams(); + if(layoutParams != null){ + layoutParams.height = mFixedProp; + layoutParams.width = mFixedProp; + mHost.setLayoutParams(layoutParams); + } + } + } + public void addEvent(String type) { if (TextUtils.isEmpty(type)) { return; @@ -933,6 +979,7 @@ public void setBackgroundColor(String color) { public void setOpacity(float opacity) { if (opacity >= 0 && opacity <= 1 && mHost.getAlpha() != opacity) { + mHost.setLayerType(View.LAYER_TYPE_HARDWARE, null); mHost.setAlpha(opacity); } } @@ -1092,6 +1139,9 @@ public void destroy() { if (WXEnvironment.isApkDebugable() && !WXUtils.isUiThread()) { throw new WXRuntimeException("[WXComponent] destroy can only be called in main thread"); } + if(mHost!= null && mHost.getLayerType()==View.LAYER_TYPE_HARDWARE) { + mHost.setLayerType(View.LAYER_TYPE_NONE, null); + } removeAllEvent(); removeStickyStyle(); if (mDomObj != null) { diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXEmbed.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXEmbed.java index 414955a4e..24d1141ab 100755 --- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXEmbed.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXEmbed.java @@ -354,8 +354,10 @@ public WXEmbed(WXSDKInstance instance, WXDomObject node, WXVContainer parent, bo mListener = new EmbedRenderListener(this); if(instance instanceof EmbedManager) { - String itemId = node.getAttrs().get(ITEM_ID).toString(); - ((EmbedManager) instance).putEmbed(itemId, this); + Object itemId = node.getAttrs().get(ITEM_ID); + if (itemId != null) { + ((EmbedManager) instance).putEmbed(itemId.toString(), this); + } } } diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXLoading.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXLoading.java index db27620c3..68b81ee21 100755 --- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXLoading.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXLoading.java @@ -225,6 +225,8 @@ @Component(lazyload = false) public class WXLoading extends WXBaseRefresh implements WXSwipeLayout.WXOnLoadingListener { + public static final String HIDE = "hide"; + public WXLoading(WXSDKInstance instance, WXDomObject node, WXVContainer parent, boolean lazy) { super(instance, node, parent, lazy); } @@ -256,7 +258,7 @@ protected boolean setProperty(String key, Object param) { @WXComponentProp(name = Constants.Name.DISPLAY) public void setDisplay(String display) { if (!TextUtils.isEmpty(display)) { - if (display.equals("hide")) { + if (display.equals(HIDE)) { if (getParent() instanceof WXListComponent || getParent() instanceof WXScroller) { if (((BaseBounceView)getParent().getHostView()).getSwipeLayout().isRefreshing()) { ((BaseBounceView) getParent().getHostView()).finishPullLoad(); diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXRefresh.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXRefresh.java index 1db35b5d6..9859cfe0c 100755 --- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXRefresh.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXRefresh.java @@ -228,6 +228,8 @@ @Component(lazyload = false) public class WXRefresh extends WXBaseRefresh implements WXSwipeLayout.WXOnRefreshListener{ + public static final String HIDE = "hide"; + @Deprecated public WXRefresh(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy) { this(instance,dom,parent,isLazy); @@ -275,7 +277,7 @@ protected boolean setProperty(String key, Object param) { @WXComponentProp(name = Constants.Name.DISPLAY) public void setDisplay(String display) { if (!TextUtils.isEmpty(display)) { - if (display.equals("hide")) { + if (display.equals(HIDE)) { if (getParent() instanceof WXListComponent || getParent() instanceof WXScroller) { if (((BaseBounceView)getParent().getHostView()).getSwipeLayout().isRefreshing()) { ((BaseBounceView) getParent().getHostView()).finishPullRefresh(); diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXSliderNeighbor.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXSliderNeighbor.java index 72d41f517..44dea5ad4 100644 --- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXSliderNeighbor.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXSliderNeighbor.java @@ -242,10 +242,6 @@ public class WXSliderNeighbor extends WXSlider { private static final float WX_DEFAULT_MAIN_NEIGHBOR_SCALE = 0.9f; - public WXSliderNeighbor(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy) { - super(instance, dom, parent, instanceId, isLazy); - } - public WXSliderNeighbor(WXSDKInstance instance, WXDomObject node, WXVContainer parent, boolean lazy) { super(instance, node, parent, lazy); } @@ -288,7 +284,7 @@ protected FrameLayout initComponentHostView(Context context) { mViewPager.addOnPageChangeListener(mPageChangeListener); // set animation - mViewPager.setPageTransformer(true, new ZoomTransformer()); + mViewPager.setPageTransformer(true, createTransformer()); mViewPager.setOverScrollMode(View.OVER_SCROLL_NEVER); view.setClipChildren(false); registerActivityStateListener(); @@ -296,6 +292,10 @@ protected FrameLayout initComponentHostView(Context context) { return view; } + ZoomTransformer createTransformer() { + return new ZoomTransformer(); + } + @Override protected void addSubView(View view, int index) { updateScaleAndAlpha(view, mNerghborAlpha, mNerghborScale); // we need to set neighbor view status when added. diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java index 3b4e253af..89d347873 100644 --- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java @@ -223,6 +223,9 @@ public class WXWeb extends WXComponent { + public static final String GO_BACK = "goBack"; + public static final String GO_FORWARD = "goForward"; + public static final String RELOAD = "reload"; protected IWebView mWebView; private String mUrl; @@ -322,11 +325,11 @@ public void setUrl(String url) { public void setAction(String action) { if (!TextUtils.isEmpty(action)) { - if (action.equals("goBack")) { + if (action.equals(GO_BACK)) { goBack(); - } else if (action.equals("goForward")) { + } else if (action.equals(GO_FORWARD)) { goForward(); - } else if (action.equals("reload")) { + } else if (action.equals(RELOAD)) { reload(); } } diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java index 8d3eb1e94..f2e6eb635 100755 --- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java @@ -965,7 +965,9 @@ public int getItemCount() { @Override public boolean onFailedToRecycleView(ListBaseViewHolder holder) { - WXLogUtils.d(TAG, "Failed to recycle " + holder); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "Failed to recycle " + holder); + } return false; } diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/WXImageView.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/WXImageView.java index 0721b330b..f0497f3c4 100755 --- a/android/sdk/src/main/java/com/taobao/weex/ui/view/WXImageView.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/WXImageView.java @@ -318,10 +318,13 @@ public void setImageResource(int resId) { setImageDrawable(drawable); } - @Override - public void setImageDrawable(Drawable drawable) { + public void setImageDrawable(Drawable drawable,boolean isGif) { if (drawable != null) { - super.setImageDrawable(new ImageClipDrawable(drawable)); + if(isGif){ + super.setImageDrawable(drawable); + }else{ + super.setImageDrawable(new ImageClipDrawable(drawable)); + } } else { super.setImageDrawable(null); } @@ -345,6 +348,11 @@ public void setImageDrawable(Drawable drawable) { } } + @Override + public void setImageDrawable(Drawable drawable) { + setImageDrawable(drawable,false); + } + @Override public void registerGestureListener(WXGesture wxGesture) { this.wxGesture = wxGesture; diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/border/BorderDrawable.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/border/BorderDrawable.java index fb16175c3..797b14812 100755 --- a/android/sdk/src/main/java/com/taobao/weex/ui/view/border/BorderDrawable.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/border/BorderDrawable.java @@ -305,23 +305,6 @@ protected void onBoundsChange(Rect bounds) { mNeedUpdatePath = true; } - public void setBorderWidth(int position, float width) { - if (mBorderWidth == null) { - mBorderWidth = new SparseArray<>(5); - mBorderWidth.put(Spacing.ALL, DEFAULT_BORDER_WIDTH); - } - if (!FloatUtil.floatsEqual(getBorderWidth(position), width)) { - updateSparseArray(mBorderWidth, position, width); - mBorderWidth.put(position, width); - mNeedUpdatePath = true; - invalidateSelf(); - } - } - - float getBorderWidth(int position) { - return fetchFromSparseArray(mBorderWidth, position, DEFAULT_BORDER_WIDTH); - } - @Override public void setAlpha(int alpha) { if (alpha != mAlpha) { @@ -330,20 +313,11 @@ public void setAlpha(int alpha) { } } - private void updateSparseArray(@NonNull SparseArray array, int position, T value) { - updateSparseArray(array, position, value, true); - } - @Override public int getAlpha() { return mAlpha; } - private T fetchFromSparseArray(@Nullable SparseArray array, int position, T fallback) { - return array == null ? fallback : - array.get(position, array.get(Spacing.ALL)); - } - /** * Do not support Color Filter */ @@ -352,34 +326,39 @@ public void setColorFilter(ColorFilter cf) { } - private void updateSparseArray(@NonNull SparseArray array, int position, T value, - boolean useSpacing) { - if (useSpacing) { - if (position == Spacing.ALL) { - array.put(Spacing.ALL, value); - array.put(Spacing.TOP, value); - array.put(Spacing.LEFT, value); - array.put(Spacing.RIGHT, value); - array.put(Spacing.BOTTOM, value); - } else { - array.put(position, value); - } - } else { - if (position == BORDER_RADIUS_ALL) { - array.put(BORDER_RADIUS_ALL, value); - array.put(BORDER_TOP_LEFT_RADIUS, value); - array.put(BORDER_TOP_RIGHT_RADIUS, value); - array.put(BORDER_BOTTOM_LEFT_RADIUS, value); - array.put(BORDER_BOTTOM_RIGHT_RADIUS, value); - } else { - array.put(position, value); + @Override + public int getOpacity() { + return WXViewUtils.getOpacityFromColor(WXViewUtils.multiplyColorAlpha(mColor, mAlpha)); + } + + /* Android's elevation implementation requires this to be implemented to know where to draw the + shadow. */ + @Override + public void getOutline(@NonNull Outline outline) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + if (mPathForBorderOutline == null) { + mNeedUpdatePath = true; } + updateBorderOutline(); + outline.setConvexPath(mPathForBorderOutline); } } - @Override - public int getOpacity() { - return WXViewUtils.getOpacityFromColor(WXViewUtils.multiplyColorAlpha(mColor, mAlpha)); + public void setBorderWidth(int position, float width) { + if (mBorderWidth == null) { + mBorderWidth = new SparseArray<>(5); + mBorderWidth.put(Spacing.ALL, DEFAULT_BORDER_WIDTH); + } + if (!FloatUtil.floatsEqual(getBorderWidth(position), width)) { + BorderUtil.updateSparseArray(mBorderWidth, position, width); + mBorderWidth.put(position, width); + mNeedUpdatePath = true; + invalidateSelf(); + } + } + + float getBorderWidth(int position) { + return BorderUtil.fetchFromSparseArray(mBorderWidth, position, DEFAULT_BORDER_WIDTH); } public void setBorderRadius(int position, float radius) { @@ -388,26 +367,14 @@ public void setBorderRadius(int position, float radius) { mBorderRadius.put(Spacing.ALL, DEFAULT_BORDER_RADIUS); } if (!FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, position), radius)) { - updateSparseArray(mBorderRadius, position, radius, false); + BorderUtil.updateSparseArray(mBorderRadius, position, radius, false); mNeedUpdatePath = true; invalidateSelf(); } - } /* Android's elevation implementation requires this to be implemented to know where to draw the - shadow. */ - - @Override - public void getOutline(@NonNull Outline outline) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - if (mPathForBorderOutline == null) { - mNeedUpdatePath = true; - } - updateBorderOutline(); - outline.setConvexPath(mPathForBorderOutline); - } } float getBorderRadius(@Nullable SparseArray borderRadius, int position) { - return fetchFromSparseArray(borderRadius, position, DEFAULT_BORDER_RADIUS); + return BorderUtil.fetchFromSparseArray(borderRadius, position, DEFAULT_BORDER_RADIUS); } public void setBorderColor(int position, int color) { @@ -416,13 +383,13 @@ public void setBorderColor(int position, int color) { mBorderColor.put(Spacing.ALL, DEFAULT_BORDER_COLOR); } if (getBorderColor(position) != color) { - updateSparseArray(mBorderColor, position, color); + BorderUtil.updateSparseArray(mBorderColor, position, color); invalidateSelf(); } } int getBorderColor(int position) { - return fetchFromSparseArray(mBorderColor, position, DEFAULT_BORDER_COLOR); + return BorderUtil.fetchFromSparseArray(mBorderColor, position, DEFAULT_BORDER_COLOR); } public void setBorderStyle(int position, @NonNull String style) { @@ -433,7 +400,7 @@ public void setBorderStyle(int position, @NonNull String style) { try { int borderStyle = BorderStyle.valueOf(style.toUpperCase(Locale.US)).ordinal(); if (getBorderStyle(position) != borderStyle) { - updateSparseArray(mBorderStyle, position, borderStyle); + BorderUtil.updateSparseArray(mBorderStyle, position, borderStyle); invalidateSelf(); } } catch (IllegalArgumentException e) { @@ -442,7 +409,18 @@ public void setBorderStyle(int position, @NonNull String style) { } int getBorderStyle(int position) { - return fetchFromSparseArray(mBorderStyle, position, BorderStyle.SOLID.ordinal()); + return BorderUtil.fetchFromSparseArray(mBorderStyle, position, BorderStyle.SOLID.ordinal()); + } + + /** + * This method is only used for Unit test, do not call this method, use + * {@link #getBorderRadius(SparseArray, int)} instead. + * @param position the index of the edge + * @return the radius considering border-overlapping of the corner. + */ + @Deprecated + float getBorderRadius(int position) { + return getBorderRadius(mOverlappingBorderRadius, position); } public int getColor() { @@ -461,46 +439,12 @@ Path getContentPath(int viewTopPadding, int viewBottomPadding, int viewLeftPadding, @NonNull RectF contentBox) { - RectF rectForBorderOutline = new RectF(); Path contentClip = new Path(); - rectForBorderOutline.set(contentBox); - if (mBorderRadius != null) { - prepareBorderRadius(); - float topLeftRadius = getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_LEFT_RADIUS); - float topRightRadius = getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_RIGHT_RADIUS); - float bottomRightRadius = getBorderRadius(mOverlappingBorderRadius, - BORDER_BOTTOM_RIGHT_RADIUS); - float bottomLeftRadius = getBorderRadius(mOverlappingBorderRadius, - BORDER_BOTTOM_LEFT_RADIUS); - contentClip.addRoundRect(rectForBorderOutline, - new float[]{ - topLeftRadius - viewLeftPadding, - topLeftRadius - viewTopPadding, - topRightRadius - viewRightPadding, - topRightRadius - viewTopPadding, - bottomRightRadius - viewRightPadding, - bottomRightRadius - viewBottomPadding, - bottomLeftRadius - viewLeftPadding, - bottomLeftRadius - viewBottomPadding - }, - Path.Direction.CW); - } else { - contentClip.addRect(rectForBorderOutline, Path.Direction.CW); - } + prepareBorderPath(viewTopPadding, viewRightPadding, viewBottomPadding, viewLeftPadding, + new RectF(contentBox), contentClip); return contentClip; } - /** - * This method is only used for Unit test, do not call this method, use - * {@link #getBorderRadius(SparseArray, int)} instead. - * @param position the index of the edge - * @return the radius considering border-overlapping of the corner. - */ - @Deprecated - float getBorderRadius(int position) { - return getBorderRadius(mOverlappingBorderRadius, position); - } - private void updateBorderOutline() { if (mNeedUpdatePath) { mNeedUpdatePath = false; @@ -508,63 +452,39 @@ private void updateBorderOutline() { mPathForBorderOutline = new Path(); } mPathForBorderOutline.reset(); - RectF mRectForBorderOutline = new RectF(); - mRectForBorderOutline.set(getBounds()); - - if (mBorderRadius != null) { - prepareBorderRadius(); - float topLeftRadius = getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_LEFT_RADIUS); - float topRightRadius = getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_RIGHT_RADIUS); - float bottomRightRadius = getBorderRadius(mOverlappingBorderRadius, - BORDER_BOTTOM_RIGHT_RADIUS); - float bottomLeftRadius = getBorderRadius(mOverlappingBorderRadius, - BORDER_BOTTOM_LEFT_RADIUS); - mPathForBorderOutline.addRoundRect( - mRectForBorderOutline, - new float[]{ - topLeftRadius, topLeftRadius, - topRightRadius, topRightRadius, - bottomRightRadius, bottomRightRadius, - bottomLeftRadius, bottomLeftRadius - }, - Path.Direction.CW); - } else { - mPathForBorderOutline.addRect(mRectForBorderOutline, Path.Direction.CW); - } + prepareBorderPath(0, 0, 0, 0, new RectF(getBounds()), mPathForBorderOutline); } } - private void drawBorders(Canvas canvas) { - if (mBorderWidth != null) { - RectF rectBounds = new RectF(getBounds()); - BorderCorner topLeft = new TopLeftCorner( - getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_LEFT_RADIUS), - getBorderWidth(Spacing.LEFT), - getBorderWidth(Spacing.TOP), - rectBounds); - BorderCorner topRight = new TopRightCorner( - getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_RIGHT_RADIUS), - getBorderWidth(Spacing.TOP), - getBorderWidth(Spacing.RIGHT), - rectBounds); - BorderCorner bottomRight = new BottomRightCorner( - getBorderRadius(mOverlappingBorderRadius, BORDER_BOTTOM_RIGHT_RADIUS), - getBorderWidth(Spacing.RIGHT), - getBorderWidth(Spacing.BOTTOM), - rectBounds); - BorderCorner bottomLeft = new BottomLeftCorner( - getBorderRadius(mOverlappingBorderRadius, BORDER_BOTTOM_LEFT_RADIUS), - getBorderWidth(Spacing.BOTTOM), - getBorderWidth(Spacing.LEFT), - rectBounds); - drawOneSide(canvas, new BorderEdge(topLeft, topRight, Spacing.TOP, - getBorderWidth(Spacing.TOP))); - drawOneSide(canvas, new BorderEdge(topRight, bottomRight, Spacing.RIGHT, - getBorderWidth(Spacing.RIGHT))); - drawOneSide(canvas, new BorderEdge(bottomRight, bottomLeft, Spacing.BOTTOM, - getBorderWidth(Spacing.BOTTOM))); - drawOneSide(canvas, new BorderEdge(bottomLeft, topLeft, Spacing.LEFT, - getBorderWidth(Spacing.LEFT))); + private void prepareBorderPath(int topPadding, + int rightPadding, + int bottomPadding, + int leftPadding, + @NonNull RectF rectF, + @NonNull Path path) { + if (mBorderRadius != null) { + prepareBorderRadius(); + float topLeftRadius = getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_LEFT_RADIUS); + float topRightRadius = getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_RIGHT_RADIUS); + float bottomRightRadius = getBorderRadius(mOverlappingBorderRadius, + BORDER_BOTTOM_RIGHT_RADIUS); + float bottomLeftRadius = getBorderRadius(mOverlappingBorderRadius, + BORDER_BOTTOM_LEFT_RADIUS); + path.addRoundRect( + rectF, + new float[]{ + topLeftRadius - leftPadding, + topLeftRadius - topPadding, + topRightRadius - rightPadding, + topRightRadius - topPadding, + bottomRightRadius - rightPadding, + bottomRightRadius - bottomPadding, + bottomLeftRadius - leftPadding, + bottomLeftRadius - bottomPadding + }, + Path.Direction.CW); + } else { + path.addRect(rectF, Path.Direction.CW); } } @@ -634,6 +554,38 @@ private void updateFactor(@NonNull List list, float numerator, float deno } } + private void drawBorders(Canvas canvas) { + RectF rectBounds = new RectF(getBounds()); + BorderCorner topLeft = new TopLeftCorner( + getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_LEFT_RADIUS), + getBorderWidth(Spacing.LEFT), + getBorderWidth(Spacing.TOP), + rectBounds); + BorderCorner topRight = new TopRightCorner( + getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_RIGHT_RADIUS), + getBorderWidth(Spacing.TOP), + getBorderWidth(Spacing.RIGHT), + rectBounds); + BorderCorner bottomRight = new BottomRightCorner( + getBorderRadius(mOverlappingBorderRadius, BORDER_BOTTOM_RIGHT_RADIUS), + getBorderWidth(Spacing.RIGHT), + getBorderWidth(Spacing.BOTTOM), + rectBounds); + BorderCorner bottomLeft = new BottomLeftCorner( + getBorderRadius(mOverlappingBorderRadius, BORDER_BOTTOM_LEFT_RADIUS), + getBorderWidth(Spacing.BOTTOM), + getBorderWidth(Spacing.LEFT), + rectBounds); + drawOneSide(canvas, new BorderEdge(topLeft, topRight, Spacing.TOP, + getBorderWidth(Spacing.TOP))); + drawOneSide(canvas, new BorderEdge(topRight, bottomRight, Spacing.RIGHT, + getBorderWidth(Spacing.RIGHT))); + drawOneSide(canvas, new BorderEdge(bottomRight, bottomLeft, Spacing.BOTTOM, + getBorderWidth(Spacing.BOTTOM))); + drawOneSide(canvas, new BorderEdge(bottomLeft, topLeft, Spacing.LEFT, + getBorderWidth(Spacing.LEFT))); + } + private void drawOneSide(Canvas canvas, @NonNull BorderEdge borderEdge) { if (!FloatUtil.floatsEqual(0, getBorderWidth(borderEdge.getEdge()))) { preparePaint(borderEdge.getEdge()); @@ -650,4 +602,4 @@ private void preparePaint(int side) { mPaint.setColor(color); mPaint.setStrokeWidth(borderWidth); } -} +} \ No newline at end of file diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/border/BorderUtil.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/border/BorderUtil.java new file mode 100644 index 000000000..e31aa7407 --- /dev/null +++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/border/BorderUtil.java @@ -0,0 +1,275 @@ +/* + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.taobao.weex.ui.view.border; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.util.SparseArray; + +import com.taobao.weex.dom.flex.Spacing; + +class BorderUtil { + + static T fetchFromSparseArray(@Nullable SparseArray array, int position, T fallback) { + return array == null ? fallback : + array.get(position, array.get(Spacing.ALL)); + } + + static void updateSparseArray(@NonNull SparseArray array, int position, T value) { + updateSparseArray(array, position, value, true); + } + + static void updateSparseArray(@NonNull SparseArray array, int position, T value, + boolean useSpacing) { + if (useSpacing) { + if (position == Spacing.ALL) { + array.put(Spacing.ALL, value); + array.put(Spacing.TOP, value); + array.put(Spacing.LEFT, value); + array.put(Spacing.RIGHT, value); + array.put(Spacing.BOTTOM, value); + } else { + array.put(position, value); + } + } else { + if (position == BorderDrawable.BORDER_RADIUS_ALL) { + array.put(BorderDrawable.BORDER_RADIUS_ALL, value); + array.put(BorderDrawable.BORDER_TOP_LEFT_RADIUS, value); + array.put(BorderDrawable.BORDER_TOP_RIGHT_RADIUS, value); + array.put(BorderDrawable.BORDER_BOTTOM_LEFT_RADIUS, value); + array.put(BorderDrawable.BORDER_BOTTOM_RIGHT_RADIUS, value); + } else { + array.put(position, value); + } + } + } + + static boolean areEdgesSame(float... numbers) { + if (numbers != null && numbers.length > 0) { + float init = numbers[0]; + for (float number : numbers) { + if (number != init) { + return false; + } + } + return true; + } + return false; + } + + static boolean areEdgesSame(int... numbers) { + if (numbers != null && numbers.length > 0) { + int init = numbers[0]; + for (int number : numbers) { + if (number != init) { + return false; + } + } + return true; + } + return false; + } +} \ No newline at end of file diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/FontDO.java b/android/sdk/src/main/java/com/taobao/weex/utils/FontDO.java index 94585308d..c71b06a7a 100644 --- a/android/sdk/src/main/java/com/taobao/weex/utils/FontDO.java +++ b/android/sdk/src/main/java/com/taobao/weex/utils/FontDO.java @@ -205,6 +205,8 @@ package com.taobao.weex.utils; import android.graphics.Typeface; + +import com.taobao.weex.WXEnvironment; import com.taobao.weex.common.Constants; import java.net.URI; @@ -267,7 +269,9 @@ private void parseSrc(String src) { mState = STATE_INVALID; } - WXLogUtils.d("TypefaceUtil", "src:" + src + ", mUrl:" + mUrl + ", mType:" + mType); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d("TypefaceUtil", "src:" + src + ", mUrl:" + mUrl + ", mType:" + mType); + } } public String getUrl() { diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/TypefaceUtil.java b/android/sdk/src/main/java/com/taobao/weex/utils/TypefaceUtil.java index 47476d59c..5ffbe1f30 100644 --- a/android/sdk/src/main/java/com/taobao/weex/utils/TypefaceUtil.java +++ b/android/sdk/src/main/java/com/taobao/weex/utils/TypefaceUtil.java @@ -206,9 +206,6 @@ import android.graphics.Paint; import android.graphics.Typeface; -import com.taobao.weex.dom.WXStyle; - -import java.util.HashMap; import android.text.TextUtils; import com.taobao.weex.WXEnvironment; @@ -216,8 +213,10 @@ import com.taobao.weex.adapter.IWXHttpAdapter; import com.taobao.weex.common.WXRequest; import com.taobao.weex.common.WXResponse; +import com.taobao.weex.dom.WXStyle; import java.io.File; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -287,7 +286,9 @@ public static void loadTypeface(final FontDO fontDo) { try { Typeface typeface = Typeface.createFromAsset(WXEnvironment.getApplication().getAssets(), fontDo.getUrl()); if (typeface != null) { - WXLogUtils.d(TAG, "load asset file success"); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "load asset file success"); + } fontDo.setState(FontDO.STATE_SUCCESS); fontDo.setTypeface(typeface); } else { @@ -325,7 +326,9 @@ private static void downloadFontByNetwork(final String url, final String fullPat adapter.sendRequest(request, new IWXHttpAdapter.OnHttpListener() { @Override public void onHttpStart() { - WXLogUtils.d(TAG, "downloadFontByNetwork begin url:" + url); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "downloadFontByNetwork begin url:" + url); + } } @Override @@ -360,7 +363,9 @@ public void onHttpFinish(WXResponse response) { if (result) { result = loadLocalFontFile(fullPath, fontFamily); } else { - WXLogUtils.d(TAG, "downloadFontByNetwork() onHttpFinish success, but save file failed."); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "downloadFontByNetwork() onHttpFinish success, but save file failed."); + } } } else { result = false; @@ -391,7 +396,9 @@ private static boolean loadLocalFontFile(String path, String fontFamily) { if (fontDo != null) { fontDo.setState(FontDO.STATE_SUCCESS); fontDo.setTypeface(typeface); - WXLogUtils.d(TAG, "load local font file success"); + if(WXEnvironment.isApkDebugable()) { + WXLogUtils.d(TAG, "load local font file success"); + } return true; } } else { diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java b/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java index 7cb7c65c8..025fd6762 100755 --- a/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java +++ b/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java @@ -195,6 +195,10 @@ public static void e(String msg) { e(WEEX_TAG,msg); } + public static void d(String tag, byte[] msg) { + d(tag,new String(msg)); + } + public static void d(String tag, String msg) { if (WXEnvironment.isApkDebugable() && !TextUtils.isEmpty(msg) && WXEnvironment.sLogLevel.compare(LogLevel.DEBUG) >= 0) { msg = getLineNumber() + msg; diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java b/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java index 0e87c0649..a5ef50d87 100755 --- a/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java +++ b/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java @@ -213,8 +213,6 @@ import com.taobao.weex.common.WXErrorCode; import com.taobao.weex.common.WXPerformance; -import dalvik.system.PathClassLoader; - import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -227,6 +225,8 @@ import java.util.zip.ZipException; import java.util.zip.ZipFile; +import dalvik.system.PathClassLoader; + /** * Utility class for managing so library, including load native library and version management. @@ -250,8 +250,8 @@ public class WXSoInstallMgrSdk { private final static String ARMEABI = "armeabi"; //default private final static String X86 = "x86"; private final static String MIPS = "mips"; - private final static int ARMEABI_Size = 3563340; - private final static int X86_Size = 4308128; + private final static int ARMEABI_Size = 3579724; + private final static int X86_Size = 4328576; static Context mContext = null; diff --git a/android/sdk/src/test/java/com/taobao/weex/WXSDKInstanceTest.java b/android/sdk/src/test/java/com/taobao/weex/WXSDKInstanceTest.java index 90f4dfdc2..1439f822f 100644 --- a/android/sdk/src/test/java/com/taobao/weex/WXSDKInstanceTest.java +++ b/android/sdk/src/test/java/com/taobao/weex/WXSDKInstanceTest.java @@ -205,6 +205,7 @@ package com.taobao.weex; import android.view.View; +import android.widget.FrameLayout; import com.taobao.weappplus_sdk.BuildConfig; import com.taobao.weex.bridge.WXBridgeManagerTest; import com.taobao.weex.common.WXPerformance; @@ -256,10 +257,11 @@ public class WXSDKInstanceTest { public static WXSDKInstance createInstance(){ WXSDKInstance instance = new WXSDKInstance(Robolectric.setupActivity(TestActivity.class)); + final FrameLayout container = new FrameLayout(instance.getContext()); instance.registerRenderListener(new IWXRenderListener() { @Override public void onViewCreated(WXSDKInstance instance, View view) { - + container.addView(view); } @Override @@ -284,6 +286,7 @@ public void onException(WXSDKInstance instance, String errCode, String msg) { } public static void setupRoot(WXSDKInstance instance){ + WXDomObject domObject = new WXDomObject(); WXDomObject.prepareGod(domObject); WXVContainer comp = (WXVContainer) WXComponentFactory.newInstance(instance, domObject, null); diff --git a/android/sdk/src/test/java/com/taobao/weex/appfram/clipboard/WXClipboardModuleTest.java b/android/sdk/src/test/java/com/taobao/weex/appfram/clipboard/WXClipboardModuleTest.java new file mode 100644 index 000000000..a97a11aba --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/appfram/clipboard/WXClipboardModuleTest.java @@ -0,0 +1,261 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.appfram.clipboard; + +import com.taobao.weappplus_sdk.BuildConfig; +import com.taobao.weex.WXSDKInstance; +import com.taobao.weex.WXSDKInstanceTest; +import com.taobao.weex.bridge.JSCallback; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.annotation.Config; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 27/09/2016. + */ +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +@PowerMockIgnore( {"org.mockito.*", "org.robolectric.*", "android.*"}) +public class WXClipboardModuleTest { + + WXClipboardModule module; + + @Before + public void setUp() throws Exception { + module = new WXClipboardModule(); + module.mWXSDKInstance = WXSDKInstanceTest.createInstance(); + } + + @After + public void tearDown() throws Exception { + + } + + @Test + public void testSetString() throws Exception { + module.setString("test"); + } + + @Test + public void testGetString() throws Exception { + + JSCallback mock = Mockito.mock(JSCallback.class); + module.getString(mock); + Mockito.verify(mock,Mockito.times(1)).invoke(Mockito.anyObject()); + + testSetString(); + + mock = Mockito.mock(JSCallback.class); + module.getString(mock); + Mockito.verify(mock,Mockito.times(1)).invoke(Mockito.anyObject()); + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/appfram/navigator/WXNavigatorModuleTest.java b/android/sdk/src/test/java/com/taobao/weex/appfram/navigator/WXNavigatorModuleTest.java index 5a39dffee..742dca368 100644 --- a/android/sdk/src/test/java/com/taobao/weex/appfram/navigator/WXNavigatorModuleTest.java +++ b/android/sdk/src/test/java/com/taobao/weex/appfram/navigator/WXNavigatorModuleTest.java @@ -208,11 +208,13 @@ import com.taobao.weex.WXSDKEngine; import com.taobao.weex.WXSDKInstance; import com.taobao.weex.WXSDKInstanceTest; +import com.taobao.weex.bridge.JSCallback; import com.taobao.weex.bridge.WXBridgeManager; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.rule.PowerMockRule; @@ -235,6 +237,7 @@ public class WXNavigatorModuleTest { WXNavigatorModule module; + JSCallback callback; @Rule public PowerMockRule rule = new PowerMockRule(); @@ -242,6 +245,7 @@ public class WXNavigatorModuleTest { @Before public void setUp() throws Exception { mockStatic(WXSDKEngine.class); + callback = Mockito.mock(JSCallback.class); module = new WXNavigatorModule(); @@ -299,58 +303,58 @@ public boolean setNavBarTitle(String param) { @Test public void testPush() throws Exception { - module.push("{}",""); - module.push("{'url':'kdkdkdkdkd'}",""); + module.push("{}",callback); + module.push("{'url':'kdkdkdkdkd'}",callback); mockSetter(); - module.push("{}",""); + module.push("{}",callback); } @Test public void testPop() throws Exception { mockSetter(); - module.pop("{}",""); + module.pop("{}",callback); } @Test public void testSetNavBarRightItem() throws Exception { mockSetter(); - module.setNavBarRightItem("{}",""); + module.setNavBarRightItem("{}",callback); } @Test public void testClearNavBarRightItem() throws Exception { mockSetter(); - module.clearNavBarRightItem("{}",""); + module.clearNavBarRightItem("{}",callback); } @Test public void testSetNavBarLeftItem() throws Exception { mockSetter(); - module.setNavBarLeftItem("{}",""); + module.setNavBarLeftItem("{}",callback); } @Test public void testClearNavBarLeftItem() throws Exception { mockSetter(); - module.clearNavBarLeftItem("{}",""); + module.clearNavBarLeftItem("{}",callback); } @Test public void testSetNavBarMoreItem() throws Exception { mockSetter(); - module.setNavBarMoreItem("{}",""); + module.setNavBarMoreItem("{}",callback); } @Test public void testClearNavBarMoreItem() throws Exception { mockSetter(); - module.clearNavBarMoreItem("{}",""); + module.clearNavBarMoreItem("{}",callback); } @Test public void testSetNavBarTitle() throws Exception { mockSetter(); - module.setNavBarTitle("{}",""); + module.setNavBarTitle("{}",callback); } } \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/appfram/storage/WXStorageModuleTest.java b/android/sdk/src/test/java/com/taobao/weex/appfram/storage/WXStorageModuleTest.java index f7230a7f1..55e753b08 100644 --- a/android/sdk/src/test/java/com/taobao/weex/appfram/storage/WXStorageModuleTest.java +++ b/android/sdk/src/test/java/com/taobao/weex/appfram/storage/WXStorageModuleTest.java @@ -208,13 +208,11 @@ import com.taobao.weex.WXSDKInstanceTest; import com.taobao.weex.bridge.JSCallback; import com.taobao.weex.bridge.WXBridgeManager; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import static org.mockito.Mockito.*; -import org.powermock.api.mockito.PowerMockito; -import static org.powermock.api.mockito.PowerMockito.*; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.robolectric.RobolectricGradleTestRunner; @@ -222,7 +220,9 @@ import java.util.Map; -import static org.junit.Assert.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; /** * Created by sospartan on 7/28/16. @@ -272,6 +272,11 @@ public void getAllKeys(OnResultReceivedListener listener) { listener.onReceived(data); } + @Override + public void setItemPersistent(String key, String value, OnResultReceivedListener listener) { + + } + @Override public void close() { diff --git a/android/sdk/src/test/java/com/taobao/weex/bridge/WXBridgeTest.java b/android/sdk/src/test/java/com/taobao/weex/bridge/WXBridgeTest.java new file mode 100644 index 000000000..e18ba9865 --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/bridge/WXBridgeTest.java @@ -0,0 +1,263 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.bridge; + +import com.taobao.weappplus_sdk.BuildConfig; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.annotation.Config; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 27/09/2016. + */ +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +@PowerMockIgnore( {"org.mockito.*", "org.robolectric.*", "android.*"}) +public class WXBridgeTest { + + WXBridge bridge; + + @Before + public void setUp() throws Exception { + bridge = new WXBridge(); + } + + @Test + public void testCallNative() throws Exception { + bridge.callNative("1","{}","100"); + } + + @Test + public void testCallAddElement() throws Exception { + bridge.callAddElement("1","1","{}","0","100"); + } + + + @After + public void tearDown() throws Exception { + + } + + @Test + public void testReportJSException() throws Exception { + bridge.reportJSException("1","test","some exception"); + } + + @Test + public void testSetTimeoutNative() throws Exception { + bridge.setTimeoutNative("100","1024"); + } + + @Test + public void testSetJSFrmVersion() throws Exception { + bridge.setJSFrmVersion("v0.1"); + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/dom/WXDomStatementTest.java b/android/sdk/src/test/java/com/taobao/weex/dom/WXDomStatementTest.java index 5e2c3f839..20b5e0201 100644 --- a/android/sdk/src/test/java/com/taobao/weex/dom/WXDomStatementTest.java +++ b/android/sdk/src/test/java/com/taobao/weex/dom/WXDomStatementTest.java @@ -212,6 +212,11 @@ import com.taobao.weex.WXSDKInstanceTest; import com.taobao.weex.bridge.WXBridgeManagerTest; import com.taobao.weex.ui.WXRenderManager; +import com.taobao.weex.ui.component.WXComponent; +import com.taobao.weex.ui.component.WXDivTest; +import com.taobao.weex.ui.component.WXScrollerTest; +import com.taobao.weex.ui.component.list.WXListComponent; +import com.taobao.weex.ui.component.list.WXListComponentTest; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -258,6 +263,18 @@ void createBody(){ stmt.createBody(body); } + @Test + public void testCustomDomObject() throws Exception { + WXDomObject root = new TestDomObject(); + root.add(new WXListDomObject(),0); + root.add(new WXScrollerDomObject(),0); + root.add(new WXTextDomObject(),0); + root.add(new WXSwitchDomObject(),0); + root.add(new TextAreaEditTextDomObject(),0); + stmt.layout(root); + stmt.transformStyle(root,false); + } + @Test public void testCreateBody() throws Exception { createBody(); diff --git a/android/sdk/src/test/java/com/taobao/weex/dom/WXTextDomObjectTest.java b/android/sdk/src/test/java/com/taobao/weex/dom/WXTextDomObjectTest.java new file mode 100644 index 000000000..611567d56 --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/dom/WXTextDomObjectTest.java @@ -0,0 +1,276 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.dom; + +import com.taobao.weappplus_sdk.BuildConfig; +import com.taobao.weex.common.Constants; +import static com.taobao.weex.common.Constants.Name.*; + +import com.taobao.weex.dom.flex.MeasureOutput; +import com.taobao.weex.ui.component.WXComponent; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.annotation.Config; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 26/09/2016. + */ + +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +public class WXTextDomObjectTest { + + WXTextDomObject dom; + + @Before + public void setUp() throws Exception { + dom = new WXTextDomObject(); + WXStyle styles = dom.getStyles(); + styles.put(LINES,10); + styles.put(FONT_SIZE,10); + + dom.getAttrs().put(VALUE,"test"); + } + + @Test + public void testLayoutBefore() throws Exception { + dom.layoutBefore(); + } + + @Test + public void testMeasure() throws Exception { + testLayoutBefore(); + MeasureOutput output = new MeasureOutput(); + WXTextDomObject mock = PowerMockito.spy(dom); + PowerMockito.when(mock,"getTextWidth",dom.getTextPaint(),100f,false).thenReturn(10f); + WXTextDomObject.TEXT_MEASURE_FUNCTION.measure(mock,100,output); + + assertEquals(output.width,10f,0.1f); + } + + @Test + public void testLayoutAfter() throws Exception { + dom.layoutAfter(); + } + + @Test + public void testClone() throws Exception { + WXTextDomObject cloneDom = dom.clone(); + + assertFalse(cloneDom == dom); + } + + @After + public void tearDown() throws Exception { + + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXComponentTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXComponentTest.java index 1cd102764..a7f5b3fca 100644 --- a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXComponentTest.java +++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXComponentTest.java @@ -236,17 +236,60 @@ public void setUp() throws Exception { @Test public void testSetProperty() throws Exception { - component.setProperty(Constants.Name.POSITION, Constants.Value.FIXED); - component.setProperty(Constants.Name.BORDER_RADIUS,0.5f); - component.setProperty(Constants.Name.BORDER_RADIUS,null); - component.setProperty(Constants.Name.BORDER_WIDTH,null); - component.setProperty(Constants.Name.BORDER_WIDTH,10); - component.setProperty(Constants.Name.BORDER_STYLE,null); - component.setProperty(Constants.Name.BORDER_STYLE, "SOLID"); - component.setProperty(Constants.Name.BORDER_COLOR,null); - component.setProperty(Constants.Name.BORDER_COLOR, "#ff0000"); - component.setProperty(Constants.Name.VISIBILITY,null); - component.setProperty(Constants.Name.VISIBILITY, Constants.Value.VISIBLE); + + assertTrue(component.setProperty(Constants.Name.VISIBILITY,null)); + assertTrue(component.setProperty(Constants.Name.VISIBILITY, Constants.Value.VISIBLE)); + + assertTrue(component.setProperty(Constants.Name.DISABLED,true)); + assertTrue(component.setProperty(Constants.Name.POSITION, Constants.Value.FIXED)); + assertTrue(component.setProperty(Constants.Name.BACKGROUND_COLOR, "#ffffff")); + assertTrue(component.setProperty(Constants.Name.OPACITY, 0.5f)); + assertTrue(component.setProperty(Constants.Name.BORDER_RADIUS,0.5f)); + assertTrue(component.setProperty(Constants.Name.BORDER_RADIUS,null)); + assertTrue(component.setProperty(Constants.Name.BORDER_WIDTH,null)); + assertTrue(component.setProperty(Constants.Name.BORDER_WIDTH,10)); + assertTrue(component.setProperty(Constants.Name.BORDER_STYLE,null)); + assertTrue(component.setProperty(Constants.Name.BORDER_STYLE, "SOLID")); + assertTrue(component.setProperty(Constants.Name.BORDER_COLOR,null)); + assertTrue(component.setProperty(Constants.Name.BORDER_COLOR, "#ff0000")); + + assertTrue(component.setProperty(Constants.Name.BORDER_TOP_LEFT_RADIUS, 1)); + assertTrue(component.setProperty(Constants.Name.BORDER_TOP_RIGHT_RADIUS, 1)); + assertTrue(component.setProperty(Constants.Name.BORDER_BOTTOM_LEFT_RADIUS, 1)); + assertTrue(component.setProperty(Constants.Name.BORDER_BOTTOM_RIGHT_RADIUS, 1)); + assertTrue(component.setProperty(Constants.Name.BORDER_TOP_WIDTH, 1)); + assertTrue(component.setProperty(Constants.Name.BORDER_LEFT_WIDTH, 1)); + assertTrue(component.setProperty(Constants.Name.BORDER_BOTTOM_WIDTH, 1)); + assertTrue(component.setProperty(Constants.Name.BORDER_RIGHT_WIDTH,1)); + + assertTrue(component.setProperty(Constants.Name.BORDER_TOP_COLOR, "#ff0000")); + assertTrue(component.setProperty(Constants.Name.BORDER_BOTTOM_COLOR, "#ff0000")); + assertTrue(component.setProperty(Constants.Name.BORDER_LEFT_COLOR, "#ff0000")); + assertTrue(component.setProperty(Constants.Name.BORDER_RIGHT_COLOR, "#ff0000")); + + assertTrue(component.setProperty(Constants.Name.WIDTH, null)); + assertTrue(component.setProperty(Constants.Name.MIN_WIDTH, null)); + assertTrue(component.setProperty(Constants.Name.MAX_WIDTH, null)); + assertTrue(component.setProperty(Constants.Name.HEIGHT, null)); + assertTrue(component.setProperty(Constants.Name.MIN_HEIGHT, null)); + assertTrue(component.setProperty(Constants.Name.MAX_HEIGHT, null)); + assertTrue(component.setProperty(Constants.Name.ALIGN_ITEMS, null)); + assertTrue(component.setProperty(Constants.Name.ALIGN_SELF, null)); + assertTrue(component.setProperty(Constants.Name.FLEX, null)); + assertTrue(component.setProperty(Constants.Name.FLEX_DIRECTION, null)); + assertTrue(component.setProperty(Constants.Name.JUSTIFY_CONTENT, null)); + assertTrue(component.setProperty(Constants.Name.FLEX_WRAP, null)); + assertTrue(component.setProperty(Constants.Name.MARGIN, null)); + assertTrue(component.setProperty(Constants.Name.MARGIN_TOP, null)); + assertTrue(component.setProperty(Constants.Name.MARGIN_LEFT, null)); + assertTrue(component.setProperty(Constants.Name.MARGIN_RIGHT, null)); + assertTrue(component.setProperty(Constants.Name.MARGIN_BOTTOM, null)); + assertTrue(component.setProperty(Constants.Name.PADDING, null)); + assertTrue(component.setProperty(Constants.Name.PADDING_TOP, null)); + assertTrue(component.setProperty(Constants.Name.PADDING_LEFT, null)); + assertTrue(component.setProperty(Constants.Name.PADDING_RIGHT, null)); + assertTrue(component.setProperty(Constants.Name.PADDING_BOTTOM, null)); + } diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXEmbedTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXEmbedTest.java new file mode 100644 index 000000000..da45ffadb --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXEmbedTest.java @@ -0,0 +1,259 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.ui.component; + +import com.taobao.weappplus_sdk.BuildConfig; +import com.taobao.weex.WXEnvironment; +import com.taobao.weex.WXSDKInstanceTest; +import com.taobao.weex.common.Constants; +import com.taobao.weex.dom.TestDomObject; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.Robolectric; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 26/09/2016. + */ +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +public class WXEmbedTest { + + WXEmbed component; + + @Before + public void setUp() throws Exception { + + WXEnvironment.sApplication = RuntimeEnvironment.application; + WXDiv div = WXDivTest.create(); + ComponentTest.create(div); + component = new WXEmbed(div.getInstance(),new TestDomObject(),div,false); + ComponentTest.create(component); + component.getDomObject().getStyles().put(Constants.Name.VISIBILITY, Constants.Value.VISIBLE); + } + + @Test + public void testSetProperty() throws Exception { + component.setProperty(Constants.Name.SRC,"http://www.taobao.com"); + } + + @Test + public void testSetVisibility() throws Exception { + component.setProperty(Constants.Name.VISIBILITY,Constants.Value.HIDDEN); + component.setProperty(Constants.Name.SRC,"http://www.taobao.com"); + component.setProperty(Constants.Name.VISIBILITY,Constants.Value.VISIBLE); + } + + @After + public void tearDown() throws Exception { + component.destroy(); + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXLoadingTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXLoadingTest.java new file mode 100644 index 000000000..9d7dbbf8d --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXLoadingTest.java @@ -0,0 +1,259 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.ui.component; + +import com.taobao.weappplus_sdk.BuildConfig; +import com.taobao.weex.WXSDKInstanceTest; +import com.taobao.weex.common.Constants; +import com.taobao.weex.dom.TestDomObject; +import com.taobao.weex.ui.SimpleComponentHolder; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.annotation.Config; + +import java.lang.reflect.InvocationTargetException; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 28/09/2016. + */ +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +@PowerMockIgnore( {"org.mockito.*", "org.robolectric.*", "android.*"}) +public class WXLoadingTest { + + public static WXLoading create() throws IllegalAccessException, InstantiationException, InvocationTargetException { + return (WXLoading) new SimpleComponentHolder(WXLoading.class).createInstance(WXSDKInstanceTest.createInstance(), new TestDomObject(), WXDivTest.create(), false); + } + + WXLoading component; + + @Before + public void setUp() throws Exception { + component = create(); + ComponentTest.create(component); + } + + @After + public void tearDown() throws Exception { + component.destroy(); + } + + @Test + public void testOnLoading() throws Exception { + component.onLoading(); + } + + + @Test + public void testSetProperty() throws Exception { + component.setProperty(Constants.Name.DISPLAY,WXLoading.HIDE); + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXRefreshTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXRefreshTest.java new file mode 100644 index 000000000..879d68535 --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXRefreshTest.java @@ -0,0 +1,264 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.ui.component; + +import com.taobao.weappplus_sdk.BuildConfig; +import com.taobao.weex.WXSDKInstanceTest; +import com.taobao.weex.common.Component; +import com.taobao.weex.common.Constants; +import com.taobao.weex.dom.TestDomObject; +import com.taobao.weex.ui.SimpleComponentHolder; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.annotation.Config; + +import java.lang.reflect.InvocationTargetException; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 28/09/2016. + */ +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +@PowerMockIgnore( {"org.mockito.*", "org.robolectric.*", "android.*"}) +public class WXRefreshTest { + + public static WXRefresh create() throws IllegalAccessException, InstantiationException, InvocationTargetException { + return (WXRefresh) new SimpleComponentHolder(WXRefresh.class).createInstance(WXSDKInstanceTest.createInstance(), new TestDomObject(), WXDivTest.create(), false); + } + + WXRefresh component; + + @Before + public void setUp() throws Exception { + component = create(); + ComponentTest.create(component); + } + + @After + public void tearDown() throws Exception { + component.destroy(); + } + + @Test + public void testOnRefresh() throws Exception { + component.onRefresh(); + } + + @Test + public void testOnPullingDown() throws Exception { + component.onPullingDown(10,100,100); + } + + @Test + public void testSetProperty() throws Exception { + component.setProperty(Constants.Name.DISPLAY,WXRefresh.HIDE); + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXScrollerTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXScrollerTest.java index 90cd2aa4f..0938d3772 100644 --- a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXScrollerTest.java +++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXScrollerTest.java @@ -208,6 +208,7 @@ import com.taobao.weappplus_sdk.BuildConfig; import com.taobao.weex.WXSDKInstanceTest; import com.taobao.weex.dom.TestDomObject; +import com.taobao.weex.dom.WXScrollerDomObject; import com.taobao.weex.ui.view.WXScrollView; import org.junit.After; import org.junit.Before; @@ -230,7 +231,7 @@ public class WXScrollerTest { public static WXScroller create(){ WXDiv div = WXDivTest.create(); ComponentTest.create(div); - WXScroller component = new WXScroller(WXSDKInstanceTest.createInstance(),new TestDomObject(),div,false); + WXScroller component = new WXScroller(WXSDKInstanceTest.createInstance(),new WXScrollerDomObject(),div,false); div.addChild(component); return component; } diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXSliderNeighborTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXSliderNeighborTest.java new file mode 100644 index 000000000..d85a7a7cb --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXSliderNeighborTest.java @@ -0,0 +1,288 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.ui.component; + +import com.taobao.weappplus_sdk.BuildConfig; +import com.taobao.weex.WXSDKInstanceTest; +import com.taobao.weex.dom.TestDomObject; +import com.taobao.weex.ui.SimpleComponentHolder; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.annotation.Config; + +import java.lang.reflect.InvocationTargetException; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 27/09/2016. + */ +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +@PowerMockIgnore( {"org.mockito.*", "org.robolectric.*", "android.*"}) +public class WXSliderNeighborTest { + + public static WXSliderNeighbor create() throws IllegalAccessException, InstantiationException, InvocationTargetException { + return (WXSliderNeighbor) new SimpleComponentHolder(WXSliderNeighbor.class).createInstance(WXSDKInstanceTest.createInstance(), new TestDomObject(), WXDivTest.create(), false); + } + + WXSliderNeighbor component; + + @Before + public void setUp() throws Exception { + component = create(); + ComponentTest.create(component); + } + + @Test + public void testPages() throws Exception { + component = create(); + component.addChild(ComponentTest.createComponent(new TestDomObject(),component,TestComponent.class)); + component.addChild(ComponentTest.createComponent(new TestDomObject(),component,TestComponent.class)); + component.addChild(ComponentTest.createComponent(new TestDomObject(),component,TestComponent.class)); + component.addChild(ComponentTest.createComponent(new TestDomObject(),component,TestComponent.class)); + component.addChild(ComponentTest.createComponent(new TestDomObject(),component,TestComponent.class)); + + WXIndicator indicator = new WXIndicator(component.getInstance(),new TestDomObject(),component,false); + ComponentTest.create(indicator); + component.addChild(indicator); + ComponentTest.create(component); + + assertEquals(5,component.mViewPager.getCirclePageAdapter().getRealCount()); + assertEquals(6,component.getChildCount()); + + component.mViewPager.setCurrentItem(0); + } + + @Test + public void testSetProperties() throws Exception { + component.setProperty(WXSliderNeighbor.NEIGHBOR_ALPHA,0.4f); + component.setProperty(WXSliderNeighbor.NEIGHBOR_SCALE,0.9f); + } + + @Test + public void testZoomTransformer() throws Exception { + component = create(); + TestComponent page = ComponentTest.createComponent(new TestDomObject(),component,TestComponent.class); + TestComponent pageChild = ComponentTest.createComponent(new TestDomObject(),component,TestComponent.class); + page.addChild(pageChild); + component.addChild(page); + + ComponentTest.create(component); +// ComponentTest.create(pageChild); +// ComponentTest.create(page); + WXSliderNeighbor.ZoomTransformer transformer = component.createTransformer(); + transformer.transformPage(page.getHostView(),0.2f); + } + + @After + public void tearDown() throws Exception { + component.destroy(); + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXSwitchTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXSwitchTest.java new file mode 100644 index 000000000..a6e48fc77 --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXSwitchTest.java @@ -0,0 +1,258 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.ui.component; + +import com.taobao.weappplus_sdk.BuildConfig; +import com.taobao.weex.WXSDKInstanceTest; +import com.taobao.weex.common.Constants; +import com.taobao.weex.dom.TestDomObject; +import com.taobao.weex.ui.SimpleComponentHolder; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.annotation.Config; + +import java.lang.reflect.InvocationTargetException; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 28/09/2016. + */ +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +@PowerMockIgnore( {"org.mockito.*", "org.robolectric.*", "android.*"}) +public class WXSwitchTest { + + public static WXSwitch create() throws IllegalAccessException, InstantiationException, InvocationTargetException { + return (WXSwitch) new SimpleComponentHolder(WXSwitch.class).createInstance(WXSDKInstanceTest.createInstance(), new TestDomObject(), WXDivTest.create(), false); + } + + WXSwitch component; + + @Before + public void setUp() throws Exception { + component = create(); + ComponentTest.create(component); + } + + @After + public void tearDown() throws Exception { + component.destroy(); + } + + @Test + public void testAddEvent() throws Exception { + component.addEvent(Constants.Event.CHANGE); + } + + @Test + public void testSetProperty() throws Exception { + component.setProperty(Constants.Name.CHECKED,true); + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXTextTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXTextTest.java index c8dc8a539..f62364456 100755 --- a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXTextTest.java +++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXTextTest.java @@ -213,6 +213,7 @@ import com.taobao.weex.dom.flex.Spacing; import com.taobao.weex.ui.SimpleComponentHolder; +import org.apache.tools.ant.taskdefs.EchoXML; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -269,6 +270,20 @@ public void setUp() throws Exception { assertNotNull(instance.getContext()); } + @Test + public void testSetProperties() throws Exception { + mWXText.setProperty(Constants.Name.LINES,null); + mWXText.setProperty(Constants.Name.FONT_SIZE,null); + mWXText.setProperty(Constants.Name.FONT_WEIGHT,null); + mWXText.setProperty(Constants.Name.FONT_STYLE,null); + mWXText.setProperty(Constants.Name.COLOR,null); + mWXText.setProperty(Constants.Name.TEXT_DECORATION,null); + mWXText.setProperty(Constants.Name.FONT_FAMILY,null); + mWXText.setProperty(Constants.Name.TEXT_ALIGN,null); + mWXText.setProperty(Constants.Name.TEXT_OVERFLOW,null); + mWXText.setProperty(Constants.Name.LINE_HEIGHT,null); + } + @Test public void testCreateView(){ mWXText.createView(mParent, -1); diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/WXWebTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXWebTest.java new file mode 100644 index 000000000..f0bd482a6 --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/WXWebTest.java @@ -0,0 +1,336 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.ui.component; + +import android.view.View; +import com.taobao.weappplus_sdk.BuildConfig; +import com.taobao.weex.WXSDKInstanceTest; +import com.taobao.weex.common.Constants; +import com.taobao.weex.dom.TestDomObject; +import com.taobao.weex.ui.SimpleComponentHolder; +import com.taobao.weex.ui.view.IWebView; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.annotation.Config; + +import java.lang.reflect.InvocationTargetException; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 28/09/2016. + */ +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +@PowerMockIgnore( {"org.mockito.*", "org.robolectric.*", "android.*"}) +public class WXWebTest { + + public static WXWeb create() throws IllegalAccessException, InstantiationException, InvocationTargetException { + return (WXWeb) new SimpleComponentHolder(WXWeb.class).createInstance(WXSDKInstanceTest.createInstance(), new TestDomObject(), WXDivTest.create(), false); + } + + WXWeb component; + ProxyWebView mWebView; + + static class ProxyWebView implements IWebView { + IWebView mIWebView; + OnPageListener mOnPageListener; + OnErrorListener mOnErrorListener; + + ProxyWebView(IWebView proxy){ + mIWebView = proxy; + } + + @Override + public View getView() { + return mIWebView.getView(); + } + + @Override + public void destroy() { + mIWebView.destroy(); + } + + @Override + public void loadUrl(String url) { + mIWebView.loadUrl(url); + } + + @Override + public void reload() { + mIWebView.reload(); + } + + @Override + public void goBack() { + mIWebView.goBack(); + } + + @Override + public void goForward() { + mIWebView.goForward(); + } + + @Override + public void setShowLoading(boolean shown) { + mIWebView.setShowLoading(shown); + } + + @Override + public void setOnErrorListener(OnErrorListener listener) { + mIWebView.setOnErrorListener(listener); + mOnErrorListener = listener; + } + + @Override + public void setOnPageListener(OnPageListener listener) { + mIWebView.setOnPageListener(listener); + mOnPageListener = listener; + } + } + + @Before + public void setUp() throws Exception { + component = create(); + mWebView = new ProxyWebView(component.mWebView); + component.mWebView = mWebView; + ComponentTest.create(component); + + } + + @After + public void tearDown() throws Exception { + component.destroy(); + } + + @Test + public void testSetProperty() throws Exception { + component.setProperty(Constants.Name.SHOW_LOADING,true); + component.setProperty(Constants.Name.SRC,"http://taobao.com"); + } + + @Test + public void testSetAction() throws Exception { + component.setAction(WXWeb.GO_BACK); + component.setAction(WXWeb.GO_FORWARD); + component.setAction(WXWeb.RELOAD); + } + + @Test + public void testListener() throws Exception { + component.addEvent(Constants.Event.RECEIVEDTITLE); + component.addEvent(Constants.Event.PAGESTART); + component.addEvent(Constants.Event.PAGEFINISH); + component.addEvent(Constants.Event.ERROR); + mWebView.mOnPageListener.onPageFinish("http://taobao.com",true,true); + mWebView.mOnPageListener.onReceivedTitle("test"); + mWebView.mOnPageListener.onPageStart("http://taobao.com"); + mWebView.mOnErrorListener.onError("test","error occurred"); + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/component/list/WXListComponentTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/component/list/WXListComponentTest.java index c82175c8f..ccc9e416e 100644 --- a/android/sdk/src/test/java/com/taobao/weex/ui/component/list/WXListComponentTest.java +++ b/android/sdk/src/test/java/com/taobao/weex/ui/component/list/WXListComponentTest.java @@ -208,6 +208,8 @@ import com.taobao.weex.WXSDKInstanceTest; import com.taobao.weex.common.Constants; import com.taobao.weex.dom.TestDomObject; +import com.taobao.weex.dom.WXDomObject; +import com.taobao.weex.dom.WXListDomObject; import com.taobao.weex.ui.SimpleComponentHolder; import com.taobao.weex.ui.component.*; import org.junit.After; @@ -232,9 +234,12 @@ public class WXListComponentTest { WXListComponent component; - public static WXListComponent create(WXVContainer parent) throws IllegalAccessException, InstantiationException, InvocationTargetException { - return (WXListComponent) new SimpleComponentHolder(WXListComponent.class).createInstance(WXSDKInstanceTest.createInstance(), new TestDomObject(), parent, false); + return create(parent,new WXListDomObject()); + } + + public static WXListComponent create(WXVContainer parent, WXDomObject dom) throws IllegalAccessException, InstantiationException, InvocationTargetException { + return (WXListComponent) new SimpleComponentHolder(WXListComponent.class).createInstance(WXSDKInstanceTest.createInstance(), dom, parent, false); } @Before @@ -243,7 +248,6 @@ public void setUp() throws Exception { ComponentTest.create(div); component = create(div); ComponentTest.create(component); - } @Test @@ -282,6 +286,17 @@ public void testAppear() throws Exception { component.notifyAppearStateChange(0,0,0,10); } + @Test + public void testParseTransforms() throws Exception { + WXDiv div = WXDivTest.create(); + ComponentTest.create(div); + + WXDomObject dom = new WXListDomObject(); + dom.getAttrs().put(WXListComponent.TRANSFORM,"scale(0.9,0.8);translate(10,20);opacity(0.5);rotate(100)"); + component = create(div,dom); + ComponentTest.create(component); + } + @After public void tearDown() throws Exception { component.destroy(); diff --git a/android/sdk/src/test/java/com/taobao/weex/ui/view/gesture/WXGestureTest.java b/android/sdk/src/test/java/com/taobao/weex/ui/view/gesture/WXGestureTest.java new file mode 100644 index 000000000..138391565 --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/ui/view/gesture/WXGestureTest.java @@ -0,0 +1,268 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.ui.view.gesture; + +import android.provider.Settings; +import android.view.MotionEvent; +import com.taobao.weappplus_sdk.BuildConfig; +import com.taobao.weex.TestActivity; +import com.taobao.weex.ui.component.ComponentTest; +import com.taobao.weex.ui.component.WXComponent; +import com.taobao.weex.ui.component.WXDiv; +import com.taobao.weex.ui.component.WXDivTest; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.robolectric.Robolectric; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 27/09/2016. + */ +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +@PowerMockIgnore( {"org.mockito.*", "org.robolectric.*", "android.*"}) +public class WXGestureTest { + + WXGesture mGesture; + WXComponent component; + @Before + public void setUp() throws Exception { + component = WXDivTest.create(); + ComponentTest.create(component); + + component.addEvent(WXGestureType.LowLevelGesture.ACTION_CANCEL.toString()); + component.addEvent(WXGestureType.LowLevelGesture.ACTION_DOWN.toString()); + component.addEvent(WXGestureType.LowLevelGesture.ACTION_MOVE.toString()); + component.addEvent(WXGestureType.LowLevelGesture.ACTION_UP.toString()); + + TestActivity activity = Robolectric.setupActivity(TestActivity.class); + mGesture = new WXGesture(component, activity); + + } + + @Test + public void testOnTouch() throws Exception { + MotionEvent event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_DOWN,0,0,0); + mGesture.onTouch(component.getHostView(),event); + + event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_MOVE,0,0,0); + mGesture.onTouch(component.getHostView(),event); + + event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_UP,0,0,0); + mGesture.onTouch(component.getHostView(),event); + + event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_POINTER_UP,0,0,0); + mGesture.onTouch(component.getHostView(),event); + + event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_CANCEL,0,0,0); + mGesture.onTouch(component.getHostView(),event); + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/utils/FunctionParserTest.java b/android/sdk/src/test/java/com/taobao/weex/utils/FunctionParserTest.java new file mode 100644 index 000000000..b61a0e321 --- /dev/null +++ b/android/sdk/src/test/java/com/taobao/weex/utils/FunctionParserTest.java @@ -0,0 +1,225 @@ +/** + * + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright 2016 Alibaba Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.taobao.weex.utils; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Created by sospartan on 27/09/2016. + */ +public class FunctionParserTest { + + @Test + public void testParse() throws Exception { + new SingleFunctionParser("transform(50 , 20)", new SingleFunctionParser.FlatMapper() { + @Override + public String map(String raw) { + return null; + } + }).parse("transform"); + } +} \ No newline at end of file diff --git a/android/sdk/src/test/java/com/taobao/weex/utils/WXUtilsTest.java b/android/sdk/src/test/java/com/taobao/weex/utils/WXUtilsTest.java index e5a4ed7b7..c8080e621 100755 --- a/android/sdk/src/test/java/com/taobao/weex/utils/WXUtilsTest.java +++ b/android/sdk/src/test/java/com/taobao/weex/utils/WXUtilsTest.java @@ -204,33 +204,50 @@ */ package com.taobao.weex.utils; +import com.taobao.weappplus_sdk.BuildConfig; import junit.framework.TestCase; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.annotation.Config; /** * Created by lixinke on 16/2/24. */ +@RunWith(RobolectricGradleTestRunner.class) +@Config(constants = BuildConfig.class, sdk = 19) +@PowerMockIgnore( {"org.mockito.*", "org.robolectric.*", "android.*"}) public class WXUtilsTest extends TestCase { + @Before public void setUp() throws Exception { super.setUp(); } + @Test public void testGetFloat() throws Exception { float test_float = WXUtils.getFloat("12324.9px"); assertEquals(12324.9, test_float, 0.9); + + assertEquals(WXUtils.fastGetFloat("1.2345",2),1.23f); } + @Test public void testGetInt() throws Exception { int test_int = WXUtils.getInt("23px"); assertEquals(23, test_int); } + @Test public void testGetLong() throws Exception { long test_long = WXUtils.getLong("8098px"); assertEquals(8098, test_long); } + @Test public void testGetDouble() throws Exception { double test_Double = WXUtils.getDouble("8098.8989px"); assertEquals(8098.8, test_Double, 0.89); diff --git a/android/sdk/unittest.sh b/android/sdk/unittest.sh index 04aacd98a..01db847b6 100644 --- a/android/sdk/unittest.sh +++ b/android/sdk/unittest.sh @@ -1,2 +1,3 @@ #! /bin/sh ./gradlew clean testDebugUnitTest jacocoTestReportDebug +osascript -e 'display notification "Test Done!" with title "Weex Unit Test"' diff --git a/doc/advanced/extend-to-android.md b/doc/advanced/extend-to-android.md index b73d39a32..c680434b2 100644 --- a/doc/advanced/extend-to-android.md +++ b/doc/advanced/extend-to-android.md @@ -3,7 +3,7 @@ cn ### Module extend -weex sdk support Moulde extend, +weex sdk support Module extend, Weex SDK provides only rendering capabilities, rather than have other capabilities, such as network, picture, and URL redirection. If you want the these features, you need to implement it. For example: If you want to implement an address jumping function, you can achieve a Module Follow the steps below. diff --git a/doc/demo/slider.md b/doc/demo/slider.md index d06d6b6fc..de7b5df7e 100644 --- a/doc/demo/slider.md +++ b/doc/demo/slider.md @@ -6,4 +6,4 @@ Weex Slider Demo ## weex code -See [slider example](https://github.com/alibaba/weex/tree/dev/examples/component/list/list-demo.we). +See [slider example](https://github.com/alibaba/weex/blob/dev/examples/component/slider/index.we). diff --git a/ios/playground/WeexDemo/Scanner/WXScannerVC.m b/ios/playground/WeexDemo/Scanner/WXScannerVC.m index e3a85b8cc..a3af11abd 100644 --- a/ios/playground/WeexDemo/Scanner/WXScannerVC.m +++ b/ios/playground/WeexDemo/Scanner/WXScannerVC.m @@ -102,12 +102,16 @@ - (void)openURL:(NSString*)URL controller.url = url; controller.source = @"scan"; - if ([url.port integerValue] == 8081) { - NSURL *socketURL = [NSURL URLWithString:[NSString stringWithFormat:@"ws://%@:8082", url.host]]; - controller.hotReloadSocket = [[SRWebSocket alloc] initWithURL:socketURL protocols:@[@"echo-protocol"]]; - controller.hotReloadSocket.delegate = controller; - [controller.hotReloadSocket open]; - } + NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO]; + NSArray *queryItems = [components queryItems]; + NSMutableDictionary *queryDict = [NSMutableDictionary new]; + for (NSURLQueryItem *item in queryItems) + [queryDict setObject:item.value forKey:item.name]; + NSString *wsport = queryDict[@"wsport"] ?: @"8082"; + NSURL *socketURL = [NSURL URLWithString:[NSString stringWithFormat:@"ws://%@:%@", url.host, wsport]]; + controller.hotReloadSocket = [[SRWebSocket alloc] initWithURL:socketURL protocols:@[@"echo-protocol"]]; + controller.hotReloadSocket.delegate = controller; + [controller.hotReloadSocket open]; [[self navigationController] pushViewController:controller animated:YES]; } diff --git a/ios/playground/WeexDemo/WXDemoViewController.m b/ios/playground/WeexDemo/WXDemoViewController.m index 0568a2ccf..6adac7a43 100644 --- a/ios/playground/WeexDemo/WXDemoViewController.m +++ b/ios/playground/WeexDemo/WXDemoViewController.m @@ -134,7 +134,7 @@ - (void)render return; } NSURL *URL = [self testURL: [self.url absoluteString]]; - NSString *randomURL = [NSString stringWithFormat:@"%@?random=%d",URL.absoluteString,arc4random()]; + NSString *randomURL = [NSString stringWithFormat:@"%@%@random=%d",URL.absoluteString,URL.query?@"&":@"?",arc4random()]; [_instance renderWithURL:[NSURL URLWithString:randomURL] options:@{@"bundleUrl":URL.absoluteString} data:nil]; } diff --git a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj index cf12fb0d2..c4fd3811f 100644 --- a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj +++ b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1C1A2BED1D91172800539AA1 /* WXConvertTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C1A2BEC1D91172800539AA1 /* WXConvertTests.m */; }; 1D3000F11D40B9AC004F3B4F /* WXClipboardModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D3000EF1D40B9AB004F3B4F /* WXClipboardModule.h */; }; 1D3000F21D40B9AC004F3B4F /* WXClipboardModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3000F01D40B9AB004F3B4F /* WXClipboardModule.m */; }; 2A1F57B71C75C6A600B58017 /* WXTextInputComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A1F57B51C75C6A600B58017 /* WXTextInputComponent.h */; }; @@ -217,6 +218,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 1C1A2BEC1D91172800539AA1 /* WXConvertTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXConvertTests.m; sourceTree = ""; }; 1D3000EF1D40B9AB004F3B4F /* WXClipboardModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXClipboardModule.h; sourceTree = ""; }; 1D3000F01D40B9AB004F3B4F /* WXClipboardModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXClipboardModule.m; sourceTree = ""; }; 2A1F57B51C75C6A600B58017 /* WXTextInputComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXTextInputComponent.h; sourceTree = ""; }; @@ -574,6 +576,7 @@ 598805AC1D52D8C800EDED2C /* WXStorageTests.m */, 596FDD671D3F9EFF0082CD5B /* TestSupportUtils.h */, 596FDD681D3F9EFF0082CD5B /* TestSupportUtils.m */, + 1C1A2BEC1D91172800539AA1 /* WXConvertTests.m */, ); path = WeexSDKTests; sourceTree = ""; @@ -1103,6 +1106,7 @@ 5996BD701D49EC0600C0FEA6 /* WXInstanceWrapTests.m in Sources */, 5996BD751D4D8A0E00C0FEA6 /* WXSDKEngineTests.m in Sources */, 596FDD691D3F9EFF0082CD5B /* TestSupportUtils.m in Sources */, + 1C1A2BED1D91172800539AA1 /* WXConvertTests.m in Sources */, 740938EC1D3D075700DBB801 /* SRWebSocket.m in Sources */, 740938F31D3D0D9300DBB801 /* WXComponentTests.m in Sources */, 596FDD661D3F52700082CD5B /* WXAnimationModuleTests.m in Sources */, diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m index 3c78f02b4..ad80586a0 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m +++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m @@ -261,24 +261,23 @@ - (NSAttributedString *)buildAttributeString } else if(_textDecoration == WXTextDecorationLineThrough){ [attributedString addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, string.length)]; } + + NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; if (_textAlign) { - NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; paragraphStyle.alignment = _textAlign; - [attributedString addAttribute:NSParagraphStyleAttributeName - value:paragraphStyle - range:(NSRange){0, attributedString.length}]; } if (_lineHeight) { - NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; paragraphStyle.maximumLineHeight = _lineHeight; paragraphStyle.minimumLineHeight = _lineHeight; + } + + if (_lineHeight || _textAlign) { [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:(NSRange){0, attributedString.length}]; } - return attributedString; } diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m index 8e4b0c0bf..1f4cd0e47 100644 --- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m +++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m @@ -18,9 +18,9 @@ + (type)type:(id)value {\ if([value respondsToSelector:@selector(op)]){\ return (type)[value op];\ } else {\ - WXLogError(@"Convert Error:%@ not respond selector:%@", value, @#op);\ + NSString * strval = [NSString stringWithFormat:@"%@",value];\ + return (type)[self uint64_t: strval];\ }\ - return 0;\ } WX_NUMBER_CONVERT(BOOL, boolValue) @@ -30,12 +30,20 @@ + (type)type:(id)value {\ WX_NUMBER_CONVERT(uint8_t, unsignedShortValue) WX_NUMBER_CONVERT(uint16_t, unsignedIntValue) WX_NUMBER_CONVERT(uint32_t, unsignedLongValue) -WX_NUMBER_CONVERT(uint64_t, unsignedLongLongValue) WX_NUMBER_CONVERT(float, floatValue) WX_NUMBER_CONVERT(double, doubleValue) WX_NUMBER_CONVERT(NSInteger, integerValue) WX_NUMBER_CONVERT(NSUInteger, unsignedIntegerValue) + + +//unsignedLongLongValue ++ (uint64_t)uint64_t:(id)value {\ + NSString * strval = [NSString stringWithFormat:@"%@",value]; + unsigned long long ullvalue = strtoull([strval UTF8String], NULL, 10); + return ullvalue; +} + + (CGFloat)CGFloat:(id)value { if ([value isKindOfClass:[NSString class]]) { diff --git a/ios/sdk/WeexSDKTests/WXConvertTests.m b/ios/sdk/WeexSDKTests/WXConvertTests.m new file mode 100644 index 000000000..7c960d67d --- /dev/null +++ b/ios/sdk/WeexSDKTests/WXConvertTests.m @@ -0,0 +1,73 @@ +// +// WXConvertTests.m +// WeexSDK +// +// Created by Keen Zhi on 16/9/20. +// Copyright © 2016年 taobao. All rights reserved. +// + +#import +#import "WXConvert.h" + +@interface WXConvertTests : XCTestCase + +@end + +@implementation WXConvertTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testBOOL { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + BOOL boolval = [WXConvert BOOL:@"-1"]; + XCTAssertTrue(boolval); + boolval = [WXConvert BOOL:@"true"]; + XCTAssertTrue(boolval); + + boolval = [WXConvert BOOL:@"false"]; + XCTAssertTrue(!boolval); + +} + +- (void) testNSUInteger{ + NSUInteger val= [WXConvert NSUInteger:@"x"]; + XCTAssertTrue(0==val); + + + val= [WXConvert NSUInteger:@"9"]; + XCTAssertTrue(9); + + //test max + NSString * unsignedIntMax = [NSString stringWithFormat:@"%lu", NSUIntegerMax ]; + val= [WXConvert NSUInteger:unsignedIntMax]; + XCTAssertTrue(val==NSUIntegerMax); + + + + //test overflow + unsigned long long uio = NSUIntegerMax; + uio++; + + NSString * ulval = [NSString stringWithFormat:@"%llu", uio ]; + val = [WXConvert NSUInteger:ulval]; + XCTAssertTrue(0==val);//overflowed + +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end