any-touch
Advanced tools
Comparing version 0.7.7 to 0.7.8
@@ -60,5 +60,5 @@ (function (global, factory) { | ||
function __values(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
return { | ||
next: function () { | ||
@@ -69,3 +69,2 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
} | ||
@@ -103,10 +102,24 @@ | ||
default_1.prototype.on = function (eventName, listener, _a) { | ||
var e_1, _b; | ||
var target = (_a === void 0 ? {} : _a).target; | ||
if (void 0 === this.listenersMap[eventName]) { | ||
this.listenersMap[eventName] = []; | ||
var eventNames = Array.isArray(eventName) ? eventName : [eventName]; | ||
try { | ||
for (var eventNames_1 = __values(eventNames), eventNames_1_1 = eventNames_1.next(); !eventNames_1_1.done; eventNames_1_1 = eventNames_1.next()) { | ||
var name = eventNames_1_1.value; | ||
if (void 0 === this.listenersMap[name]) { | ||
this.listenersMap[name] = []; | ||
} | ||
if (void 0 !== target) { | ||
listener.target = target; | ||
} | ||
this.listenersMap[name].push(listener); | ||
} | ||
} | ||
if (void 0 !== target) { | ||
listener.target = target; | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (eventNames_1_1 && !eventNames_1_1.done && (_b = eventNames_1.return)) _b.call(eventNames_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
this.listenersMap[eventName].push(listener); | ||
}; | ||
@@ -126,3 +139,3 @@ default_1.prototype.off = function (eventName, listener) { | ||
default_1.prototype.emit = function (eventName, payload, beforeHook) { | ||
var e_1, _a; | ||
var e_2, _a; | ||
if (beforeHook === void 0) { beforeHook = function () { return true; }; } | ||
@@ -140,3 +153,3 @@ var listeners = this.listenersMap[eventName]; | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
@@ -146,3 +159,3 @@ try { | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
@@ -385,4 +398,4 @@ } | ||
var TOUCH_EVENT_NAMES = [TOUCH_START, TOUCH_MOVE, TOUCH_END, TOUCH_CANCEL]; | ||
function bindElement (el, callback, options) { | ||
if (SUPPORT_TOUCH) { | ||
function bindElement (el, callback, options, device) { | ||
if (SUPPORT_TOUCH || 'Touch' === device) { | ||
TOUCH_EVENT_NAMES.forEach(function (eventName) { | ||
@@ -445,2 +458,3 @@ el.addEventListener(eventName, callback, options); | ||
var AT_AFTER = 'at:after'; | ||
function emit2(at, payload) { | ||
@@ -455,3 +469,2 @@ var type = payload.type, target = payload.target, targets = payload.targets; | ||
}); | ||
var AT_AFTER = 'at:after'; | ||
at.emit(AT_AFTER, payload); | ||
@@ -496,3 +509,3 @@ if (!!at.options.domEvents | ||
catch (_a) { } | ||
_this.on('unbind', bindElement(el, _this.catchEvent.bind(_this), !_this.options.isPreventDefault && supportsPassive_1 ? { passive: true } : false)); | ||
_this.on('unbind', bindElement(el, _this.catchEvent.bind(_this), !_this.options.isPreventDefault && supportsPassive_1 ? { passive: true } : false, _this.options.device)); | ||
} | ||
@@ -577,3 +590,3 @@ return _this; | ||
}; | ||
AnyTouch.version = '0.7.6'; | ||
AnyTouch.version = '0.7.7'; | ||
AnyTouch.recognizers = []; | ||
@@ -580,0 +593,0 @@ AnyTouch.recognizerMap = {}; |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).AnyTouch=e()}(this,(function(){"use strict";var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};function e(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function i(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,r=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}var r=function(){function t(){this.listenersMap={}}return t.prototype.target=function(t){var e=this;return{on:function(n,i){e.on(n,i,{target:t})}}},t.prototype.on=function(t,e,n){var i=(void 0===n?{}:n).target;void 0===this.listenersMap[t]&&(this.listenersMap[t]=[]),void 0!==i&&(e.target=i),this.listenersMap[t].push(e)},t.prototype.off=function(t,e){var n=this.listenersMap[t];if(void 0!==n)if(void 0===e)delete this.listenersMap[t];else{var i=n.findIndex((function(t){return t===e}));n.splice(i,1)}},t.prototype.emit=function(t,e,n){var o,r;void 0===n&&(n=function(){return!0});var s=this.listenersMap[t];if(void 0!==s&&0<s.length)try{for(var a=i(s),u=a.next();!u.done;u=a.next()){var c=u.value;n({target:c.target})&&c(e)}}catch(t){o={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}},t.prototype.destroy=function(){this.listenersMap={}},t}(),s=Object.prototype.toString;var a="cancel",u="end",c="touch"+u,p="touch"+a,h=window.wx||"ontouchstart"in window,l="start",v="move",f=u,d="r",m="f",y=a;function g(t){return Math.round(100*t)/100}var T=function(){},M=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.load=function(t,e){var n=[],i=[];Array.from(t.touches).forEach((function(t){var o=t.clientX,r=t.clientY,s=t.target;(null==e?void 0:e.contains(s))&&(n.push(s),i.push({clientX:o,clientY:r,target:s}))}));var o=Array.from(t.changedTouches).map((function(t){return{clientX:t.clientX,clientY:t.clientY,target:t.target}}));return{inputType:t.type.replace("touch",""),changedPoints:o,points:i,nativeEvent:t,target:t.target,targets:n}},n}(T),b=function(t){function n(){var e=t.call(this)||this;return e.target=null,e.isPressed=!1,e}return e(n,t),n.prototype.load=function(t){var e,n=t.clientX,i=t.clientY,o=t.type,r=t.button,s=t.target,a=[{clientX:n,clientY:i,target:s}];"mousedown"===o&&0===r?(this.target=s,this.isPressed=!0,e="start"):this.isPressed&&("mousemove"===o?e="move":"mouseup"===o&&(a=[],e=u,this.isPressed=!1));var c=this.prevPoints||[{clientX:n,clientY:i,target:s}];if(this.prevPoints=[{clientX:n,clientY:i,target:s}],void 0!==e)return{inputType:e,changedPoints:c,points:a,target:this.target,targets:[this.target],nativeEvent:t}},n}(T),x=function(){function t(t){var e=h?M:b;this.adapter=new e,this.id=0,this.el=t}return t.prototype.transform=function(t){this.prevInput=this.activeInput;var e=this.adapter.load(t,this.el);if(void 0!==e){var i=Number.MAX_SAFE_INTEGER>this.id?++this.id:1,o=function(t){var e=t.inputType,i=t.points,o=t.changedPoints,r=t.nativeEvent,s=i.length,c="start"===e,p=u===e&&0===s||a===e,h=performance.now(),l=E(i)||E(o),v=l.x,f=l.y,d=r.currentTarget;return n(n({},t),{x:v,y:f,timestamp:h,isStart:c,isEnd:p,pointLength:s,currentTarget:d,getOffset:function(t){void 0===t&&(t=d);var e=t.getBoundingClientRect();return{x:v-Math.round(e.left),y:f-Math.round(e.top)}}})}(n(n({},e),{id:i}));this.activeInput=o;var r=o.isStart,s=o.pointLength;return r&&(this.startInput=o,this.prevInput=void 0,this.startMultiInput=1<s?o:void 0),n(n({},o),{prevInput:this.prevInput,startMultiInput:this.startMultiInput,startInput:this.startInput})}},t}();function E(t){var e=t.length;if(0<e){if(1===e){var n=t[0],i=n.clientX,o=n.clientY;return{x:Math.round(i),y:Math.round(o)}}var r=t.reduce((function(t,e){return t.x+=e.clientX,t.y+=e.clientY,t}),{x:0,y:0});return{x:Math.round(r.x/e),y:Math.round(r.y/e)}}}function w(t,e,n){e.target,e.currentTarget;var i,o=e.type,r=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]])}return n}(e,["target","currentTarget","type"]);return document.createEvent?(i=document.createEvent("HTMLEvents")).initEvent(o,null==n?void 0:n.bubbles,null==n?void 0:n.cancelable):i=new Event(o,n),Object.assign(i,r,{match:function(){return e.targets.every((function(t){return i.currentTarget.contains(t)}))}}),t.dispatchEvent(i)}function P(t,e){if(!e.isPreventDefault)return!1;var n,i=!0;if(null!==t.target){var o=e.preventDefaultExclude;if(n=o,"[object RegExp]"===s.call(n)){if("tagName"in t.target){var r=t.target.tagName;i=!o.test(r)}}else(function(t){return"[object Function]"===s.call(t)})(o)&&(i=!o(t))}return i}var L=["touchstart","touchmove",c,p];function z(t,e,n){var i=null==n?void 0:n.name;if(void 0===i||void 0===t.recognizerMap[i]){var o=new e(n);t.recognizerMap[o.name]=o,o.recognizerMap=t.recognizerMap,t.recognizers.push(t.recognizerMap[o.name])}}function _(t,e){var n,r;if(void 0===e)t.recognizers=[],t.recognizerMap={};else try{for(var s=i(t.recognizers.entries()),a=s.next();!a.done;a=s.next()){var u=o(a.value,2),c=u[0];if(e===u[1].options.name){t.recognizers.splice(c,1),delete t.recognizerMap[e];break}}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}function I(t,e){var i=e.type,o=e.target,r=e.targets;t.emit(i,e,(function(t){if(void 0!==(null==t?void 0:t.target)){var e=t.target;return r.every((function(t){return e.contains(t)}))}return!0}));t.emit("at:after",e),t.options.domEvents&&void 0!==t.el&&null!==o&&(w(o,e,t.options.domEvents),w(o,n(n({},e),{_type:e.type,type:"at:after"}),t.options.domEvents))}var S={domEvents:{bubbles:!0,cancelable:!0},isPreventDefault:!0,preventDefaultExclude:/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/},O=function(t){function o(e,i){var r=t.call(this)||this;if(r.recognizerMap={},r.recognizers=[],r.cacheComputedFunctionGroup=Object.create(null),r.el=e,r.input=new x(e),r.options=n(n({},S),i),r.recognizerMap=o.recognizerMap,r.recognizers=o.recognizers,void 0!==e){e.style.webkitTapHighlightColor="rgba(0,0,0,0)";var s=!1;try{var a={};Object.defineProperty(a,"passive",{get:function(){s=!0}}),window.addEventListener("_",(function(){}),a)}catch(t){}r.on("unbind",function(t,e,n){return h?(L.forEach((function(i){t.addEventListener(i,e,n)})),function(){L.forEach((function(n){t.removeEventListener(n,e)}))}):(t.addEventListener("mousedown",e,n),window.addEventListener("mousemove",e,n),window.addEventListener("mouseup",e,n),function(){t.removeEventListener("mousedown",e),window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",e)})}(e,r.catchEvent.bind(r),!(r.options.isPreventDefault||!s)&&{passive:!0}))}return r}return e(o,t),o.prototype.use=function(t,e){z(this,t,e)},o.prototype.removeUse=function(t){_(this,t)},o.prototype.catchEvent=function(t){var e,o,r=this;P(t,this.options)&&t.preventDefault();var s=this.input.transform(t);if(void 0!==s){var a="at:touch"+s.inputType;this.emit("at:touch",s),this.emit(a,s);var u=this.options.domEvents;if(!1!==u){var c=t.target;null!==c&&(w(c,n(n({},s),{type:"at:touch"}),u),w(c,n(n({},s),{type:a}),u))}var p=Object.create(null),h=function(t){if(t.disabled)return"continue";t.computedGroup=p,t.computeFunctionMap=l.cacheComputedFunctionGroup,t.recognize(s,(function(e,i){var o=n(n(n({},s),i),{type:e,baseType:t.name});Object.freeze(o),void 0===r.beforeEachHook?I(r,o):r.beforeEachHook(t,(function(){I(r,o)}))})),p=t.computedGroup,l.cacheComputedFunctionGroup=t.computeFunctionMap},l=this;try{for(var v=i(this.recognizers),f=v.next();!f.done;f=v.next()){h(f.value)}}catch(t){e={error:t}}finally{try{f&&!f.done&&(o=v.return)&&o.call(v)}finally{if(e)throw e.error}}}},o.prototype.beforeEach=function(t){this.beforeEachHook=t},o.prototype.get=function(t){return this.recognizerMap[t]},o.prototype.set=function(t){this.options=n(n({},this.options),t)},o.prototype.destroy=function(){this.emit("unbind"),this.listenersMap={}},o.version="0.7.6",o.recognizers=[],o.recognizerMap={},o.use=function(t,e){z(o,t,e)},o.removeUse=function(t){_(o,t)},o}(r);function D(t){-1!==[f,y,d,m].indexOf(t.status)&&(t.status="p")}function X(t,e,n){var i=t.test(e);D(t);var o=e.inputType;t.status=function(t,e,n){var i,o,r,s,c,p,h,d={1:(i={},i.p=(o={},o.move=l,o),i[l]=(r={},r.move=v,r[u]=f,r[a]=y,r),i[v]=(s={},s.move=v,s[u]=f,s[a]=y,s),i),0:(c={},c[l]=(p={},p.move=y,p[u]=f,p[a]=y,p),c[v]=(h={},h.start=m,h.move=y,h[u]=f,h[a]=y,h),c)};return void 0!==d[Number(t)][e]&&d[Number(t)][e][n]||e}(i,t.status,o);var r=t.computed;t.isRecognized=[l,v].includes(t.status);var s=t.name,c=t.status,p=t.isRecognized;return p&&n(s,r),(p||[f,y].includes(t.status))&&n(s+c,r),i}var V=function(){function t(t){this.disabled=!1,this.status="p",this.isRecognized=!1,this.recognizerMap={},this.computedGroup={},this.computed={},this.computeFunctionMap={},this.options=t,this.name=this.options.name}return t.prototype.set=function(t){return void 0!==t&&(this.options=n(n({},this.options),t)),this},t.prototype.isValidPointLength=function(t){return 0===this.options.pointLength||this.options.pointLength===t},t.prototype.compute=function(t,e){var n,o,r=Object.create(null);try{for(var s=i(t),a=s.next();!a.done;a=s.next()){var u=a.value,c=u._id,p=this.computedGroup,h=this.computeFunctionMap;for(var l in void 0===h[c]&&(h[c]=u()),p[c]=p[c]||h[c](e),p[c])r[l]=p[c][l]}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return r},t}(),Y=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},A=function(t){return t/Math.PI*180},C=function(t,e){var n=function(t,e){var n=Y(t)*Y(e);if(0===n)return 0;var i=function(t,e){return t.x*e.x+t.y*e.y}(t,e)/n;return i>1&&(i=1),Math.acos(i)}(t,e);return function(t,e){return t.x*e.y-e.x*t.y}(t,e)>0&&(n*=-1),A(n)},F=function(t,e){return t===e?"none":Math.abs(t)>Math.abs(e)?0<t?"right":"left":0<e?"down":"up"};function j(){return function(t){var e=t.prevInput,n=0,i=0,o=0;if(void 0!==e&&(n=t.x-e.x,i=t.y-e.y,0!==n||0!==i)){var r=Math.sqrt(Math.pow(n,2)+Math.pow(i,2));o=Math.round(A(Math.acos(Math.abs(n)/r)))}return{deltaX:n,deltaY:i,deltaXYAngle:o}}}function N(){var t=0,e=0,n=0,i=0,o=0,r="none";return function(s){var a=s.inputType,u=s.startInput;return"start"===a?(t=0,e=0,n=0,i=0,o=0,r="none"):"move"===a&&(t=Math.round(s.points[0].clientX-u.points[0].clientX),e=Math.round(s.points[0].clientY-u.points[0].clientY),n=Math.abs(t),i=Math.abs(e),o=Math.round(Y({x:n,y:i})),r=F(t,e)),{displacementX:t,displacementY:e,distanceX:n,distanceY:i,distance:o,overallDirection:r}}}function R(){var t=0;return function(e){return"start"===e.inputType&&(t=e.pointLength),{maxPointLength:t}}}function U(){var t,e,n=0,i=0,o=0,r=0;return function(s){if(void 0!==s){var a=s.inputType;e=e||s.startInput;var u=s.timestamp-e.timestamp;if("move"===a&&16<u){var c=s.x-e.x,p=s.y-e.y;o=Math.round(c/u*100)/100,r=Math.round(p/u*100)/100,n=Math.abs(o),i=Math.abs(r),t=F(c,p)||t,e=s}}return{velocityX:n,velocityY:i,speedX:o,speedY:r,direction:t}}}function G(t){return{x:t.points[1].clientX-t.points[0].clientX,y:t.points[1].clientY-t.points[0].clientY}}function k(){return function(t){var e=t.prevInput,n=t.startMultiInput;if(void 0!==n&&void 0!==e&&t.id!==n.id&&1<e.pointLength&&1<t.pointLength)return{startV:G(n),prevV:G(e),activeV:G(t)}}}j._id="ComputeDeltaXY",N._id="computeDistance",R._id="computeMaxLength",U._id="ComputeVAndDir",k._id="ComputeVectorForMutli";var H={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250},B=function(t){function i(e){var i=t.call(this,n(n({},H),e))||this;return i.tapCount=0,i}return e(i,t),i.prototype._isValidDistanceFromPrevTap=function(t){if(void 0!==this.prevTapPoint){var e=Y({x:t.x-this.prevTapPoint.x,y:t.y-this.prevTapPoint.y});return this.prevTapPoint=t,this.options.maxDistanceFromPrevTap>=e}return this.prevTapPoint=t,!0},i.prototype._isValidInterval=function(){var t=performance.now();if(void 0===this.prevTapTime)return this.prevTapTime=t,!0;var e=t-this.prevTapTime;return this.prevTapTime=t,e<this.options.waitNextTapTime},i.prototype.recognize=function(t,e){var i=t.inputType,o=t.x,r=t.y;this.computed=this.compute([R,N],t),u===i&&(this.status="p",this.test(t)?(this.cancelCountDownToFail(),this._isValidDistanceFromPrevTap({x:o,y:r})&&this._isValidInterval()?this.tapCount++:this.tapCount=1,0==this.tapCount%this.options.tapTimes?(this.status=d,e(this.options.name,n(n({},this.computed),{tapCount:this.tapCount})),this.reset()):this.countDownToFail()):(this.reset(),this.status=m))},i.prototype.countDownToFail=function(){var t=this;this._countDownToFailTimer=setTimeout((function(){t.status=m,t.reset()}),this.options.waitNextTapTime)},i.prototype.cancelCountDownToFail=function(){clearTimeout(this._countDownToFailTimer)},i.prototype.reset=function(){this.tapCount=0,this.prevTapPoint=void 0,this.prevTapTime=void 0},i.prototype.test=function(t){var e=t.startInput,n=t.pointLength,i=t.timestamp-e.timestamp,o=this.computed,r=o.maxPointLength,s=o.distance;return r===this.options.pointLength&&0===n&&this.options.maxDistance>=s&&this.options.maxPressTime>i},i}(V),q={name:"pan",threshold:10,pointLength:1},Z=function(t){function i(e){return t.call(this,n(n({},q),e))||this}return e(i,t),i.prototype.test=function(t){var e=t.pointLength,n=this.computed.distance;return(this.isRecognized||this.options.threshold<=n)&&this.isValidPointLength(e)},i.prototype.recognize=function(t,e){this.computed=this.compute([U,N,j],t),void 0!==this.computed.direction&&X(this,t,e)&&e(this.options.name+this.computed.direction,this.computed)},i}(V),$={name:"swipe",threshold:10,velocity:.3,pointLength:1},J=function(t){function i(e){return t.call(this,n(n({},$),e))||this}return e(i,t),i.prototype.test=function(t){var e=t.inputType;if(u!==e)return!1;var n=this.computed,i=n.velocityX,o=n.velocityY,r=n.maxPointLength,s=n.distance;return this.options.pointLength===r&&this.options.threshold<s&&this.options.velocity<Math.max(i,o)},i.prototype.recognize=function(t,e){this.computed=this.compute([R,U,N],t),this.test(t)&&(e(this.options.name,this.computed),e(this.options.name+this.computed.direction,this.computed))},i}(V),K={name:"press",pointLength:1,maxDistance:9,minPressTime:251},Q=function(t){function i(e){return t.call(this,n(n({},K),e))||this}return e(i,t),i.prototype.recognize=function(t,e){var n=this,i=t.inputType,o=t.startInput,r=t.pointLength;if("start"===i&&this.isValidPointLength(r))D(this),this.cancel(),this._timeoutId=setTimeout((function(){n.status=d,e(n.options.name,t)}),this.options.minPressTime);else if(u===i&&d===this.status)e(this.options.name+"up",this.computed);else if(d!==this.status){var s=t.timestamp-o.timestamp;(!this.test(t)||this.options.minPressTime>s&&[u,a].includes(i))&&(this.cancel(),this.status=m)}},i.prototype.test=function(t){this.computed=this.compute([N],t);var e=this.computed.distance;return this.options.maxDistance>e},i.prototype.cancel=function(){clearTimeout(this._timeoutId)},i}(V),W={name:"pinch",threshold:0,pointLength:2},tt=function(t){function i(e){return t.call(this,n(n({},W),e))||this}return e(i,t),i.prototype.test=function(t){var e=t.pointLength,n=this.computed.scale;return this.isValidPointLength(e)&&void 0!==n&&(this.options.threshold<Math.abs(n-1)||this.isRecognized)},i.prototype.recognize=function(t,e){var i,o,r,s,a,u=this.compute([k],t);"activeV"in u&&(this.computed=n(n({},this.computed),(o=(i=u).startV,r=i.prevV,s=i.activeV,a=g(Y(s)/Y(r)),{scale:g(Y(s)/Y(o)),deltaScale:a}))),X(this,t,e)},i}(V),et={name:"rotate",threshold:0,pointLength:2},nt=function(t){function i(e){return t.call(this,n(n({},et),e))||this}return e(i,t),i.prototype.test=function(t){var e=t.pointLength,n=this.computed.angle;return this.isValidPointLength(e)&&(this.options.threshold<Math.abs(n)||this.isRecognized)},i.prototype.recognize=function(t,e){var i,o,r,s,a,u=this.compute([k],t);"activeV"in u&&(this.computed=n(n({},this.computed),(o=(i=u).startV,r=i.prevV,s=i.activeV,a=Math.round(C(s,r)),{angle:Math.round(C(s,o)),deltaAngle:a}))),X(this,t,e)},i}(V);return O.use(B),O.use(Z),O.use(J),O.use(Q),O.use(tt),O.use(nt),O.Tap=B,O.Pan=Z,O.Swipe=J,O.Press=Q,O.Pinch=tt,O.Rotate=nt,O.STATUS_POSSIBLE="p",O.STATUS_START=l,O.STATUS_MOVE=v,O.STATUS_END=f,O.STATUS_CANCELLED=y,O.STATUS_FAILED=m,O.STATUS_RECOGNIZED=d,O})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).AnyTouch=e()}(this,(function(){"use strict";var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};function e(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function i(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function o(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,r=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}var r=function(){function t(){this.listenersMap={}}return t.prototype.target=function(t){var e=this;return{on:function(n,i){e.on(n,i,{target:t})}}},t.prototype.on=function(t,e,n){var o,r,s=(void 0===n?{}:n).target,a=Array.isArray(t)?t:[t];try{for(var u=i(a),c=u.next();!c.done;c=u.next()){var p=c.value;void 0===this.listenersMap[p]&&(this.listenersMap[p]=[]),void 0!==s&&(e.target=s),this.listenersMap[p].push(e)}}catch(t){o={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(o)throw o.error}}},t.prototype.off=function(t,e){var n=this.listenersMap[t];if(void 0!==n)if(void 0===e)delete this.listenersMap[t];else{var i=n.findIndex((function(t){return t===e}));n.splice(i,1)}},t.prototype.emit=function(t,e,n){var o,r;void 0===n&&(n=function(){return!0});var s=this.listenersMap[t];if(void 0!==s&&0<s.length)try{for(var a=i(s),u=a.next();!u.done;u=a.next()){var c=u.value;n({target:c.target})&&c(e)}}catch(t){o={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}},t.prototype.destroy=function(){this.listenersMap={}},t}(),s=Object.prototype.toString;var a="cancel",u="end",c="touch"+u,p="touch"+a,h=window.wx||"ontouchstart"in window,l="start",v="move",f=u,d="r",m="f",y=a;function g(t){return Math.round(100*t)/100}var T=function(){},M=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.load=function(t,e){var n=[],i=[];Array.from(t.touches).forEach((function(t){var o=t.clientX,r=t.clientY,s=t.target;(null==e?void 0:e.contains(s))&&(n.push(s),i.push({clientX:o,clientY:r,target:s}))}));var o=Array.from(t.changedTouches).map((function(t){return{clientX:t.clientX,clientY:t.clientY,target:t.target}}));return{inputType:t.type.replace("touch",""),changedPoints:o,points:i,nativeEvent:t,target:t.target,targets:n}},n}(T),x=function(t){function n(){var e=t.call(this)||this;return e.target=null,e.isPressed=!1,e}return e(n,t),n.prototype.load=function(t){var e,n=t.clientX,i=t.clientY,o=t.type,r=t.button,s=t.target,a=[{clientX:n,clientY:i,target:s}];"mousedown"===o&&0===r?(this.target=s,this.isPressed=!0,e="start"):this.isPressed&&("mousemove"===o?e="move":"mouseup"===o&&(a=[],e=u,this.isPressed=!1));var c=this.prevPoints||[{clientX:n,clientY:i,target:s}];if(this.prevPoints=[{clientX:n,clientY:i,target:s}],void 0!==e)return{inputType:e,changedPoints:c,points:a,target:this.target,targets:[this.target],nativeEvent:t}},n}(T),b=function(){function t(t){var e=h?M:x;this.adapter=new e,this.id=0,this.el=t}return t.prototype.transform=function(t){this.prevInput=this.activeInput;var e=this.adapter.load(t,this.el);if(void 0!==e){var i=Number.MAX_SAFE_INTEGER>this.id?++this.id:1,o=function(t){var e=t.inputType,i=t.points,o=t.changedPoints,r=t.nativeEvent,s=i.length,c="start"===e,p=u===e&&0===s||a===e,h=performance.now(),l=E(i)||E(o),v=l.x,f=l.y,d=r.currentTarget;return n(n({},t),{x:v,y:f,timestamp:h,isStart:c,isEnd:p,pointLength:s,currentTarget:d,getOffset:function(t){void 0===t&&(t=d);var e=t.getBoundingClientRect();return{x:v-Math.round(e.left),y:f-Math.round(e.top)}}})}(n(n({},e),{id:i}));this.activeInput=o;var r=o.isStart,s=o.pointLength;return r&&(this.startInput=o,this.prevInput=void 0,this.startMultiInput=1<s?o:void 0),n(n({},o),{prevInput:this.prevInput,startMultiInput:this.startMultiInput,startInput:this.startInput})}},t}();function E(t){var e=t.length;if(0<e){if(1===e){var n=t[0],i=n.clientX,o=n.clientY;return{x:Math.round(i),y:Math.round(o)}}var r=t.reduce((function(t,e){return t.x+=e.clientX,t.y+=e.clientY,t}),{x:0,y:0});return{x:Math.round(r.x/e),y:Math.round(r.y/e)}}}function w(t,e,n){e.target,e.currentTarget;var i,o=e.type,r=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]])}return n}(e,["target","currentTarget","type"]);return document.createEvent?(i=document.createEvent("HTMLEvents")).initEvent(o,null==n?void 0:n.bubbles,null==n?void 0:n.cancelable):i=new Event(o,n),Object.assign(i,r,{match:function(){return e.targets.every((function(t){return i.currentTarget.contains(t)}))}}),t.dispatchEvent(i)}function P(t,e){if(!e.isPreventDefault)return!1;var n,i=!0;if(null!==t.target){var o=e.preventDefaultExclude;if(n=o,"[object RegExp]"===s.call(n)){if("tagName"in t.target){var r=t.target.tagName;i=!o.test(r)}}else(function(t){return"[object Function]"===s.call(t)})(o)&&(i=!o(t))}return i}var L=["touchstart","touchmove",c,p];function z(t,e,n){var i=null==n?void 0:n.name;if(void 0===i||void 0===t.recognizerMap[i]){var o=new e(n);t.recognizerMap[o.name]=o,o.recognizerMap=t.recognizerMap,t.recognizers.push(t.recognizerMap[o.name])}}function _(t,e){var n,r;if(void 0===e)t.recognizers=[],t.recognizerMap={};else try{for(var s=i(t.recognizers.entries()),a=s.next();!a.done;a=s.next()){var u=o(a.value,2),c=u[0];if(e===u[1].options.name){t.recognizers.splice(c,1),delete t.recognizerMap[e];break}}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}function I(t,e){var i=e.type,o=e.target,r=e.targets;t.emit(i,e,(function(t){if(void 0!==(null==t?void 0:t.target)){var e=t.target;return r.every((function(t){return e.contains(t)}))}return!0})),t.emit("at:after",e),t.options.domEvents&&void 0!==t.el&&null!==o&&(w(o,e,t.options.domEvents),w(o,n(n({},e),{_type:e.type,type:"at:after"}),t.options.domEvents))}var S={domEvents:{bubbles:!0,cancelable:!0},isPreventDefault:!0,preventDefaultExclude:/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/},O=function(t){function o(e,i){var r=t.call(this)||this;if(r.recognizerMap={},r.recognizers=[],r.cacheComputedFunctionGroup=Object.create(null),r.el=e,r.input=new b(e),r.options=n(n({},S),i),r.recognizerMap=o.recognizerMap,r.recognizers=o.recognizers,void 0!==e){e.style.webkitTapHighlightColor="rgba(0,0,0,0)";var s=!1;try{var a={};Object.defineProperty(a,"passive",{get:function(){s=!0}}),window.addEventListener("_",(function(){}),a)}catch(t){}r.on("unbind",function(t,e,n,i){return h||"Touch"===i?(L.forEach((function(i){t.addEventListener(i,e,n)})),function(){L.forEach((function(n){t.removeEventListener(n,e)}))}):(t.addEventListener("mousedown",e,n),window.addEventListener("mousemove",e,n),window.addEventListener("mouseup",e,n),function(){t.removeEventListener("mousedown",e),window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",e)})}(e,r.catchEvent.bind(r),!(r.options.isPreventDefault||!s)&&{passive:!0},r.options.device))}return r}return e(o,t),o.prototype.use=function(t,e){z(this,t,e)},o.prototype.removeUse=function(t){_(this,t)},o.prototype.catchEvent=function(t){var e,o,r=this;P(t,this.options)&&t.preventDefault();var s=this.input.transform(t);if(void 0!==s){var a="at:touch"+s.inputType;this.emit("at:touch",s),this.emit(a,s);var u=this.options.domEvents;if(!1!==u){var c=t.target;null!==c&&(w(c,n(n({},s),{type:"at:touch"}),u),w(c,n(n({},s),{type:a}),u))}var p=Object.create(null),h=function(t){if(t.disabled)return"continue";t.computedGroup=p,t.computeFunctionMap=l.cacheComputedFunctionGroup,t.recognize(s,(function(e,i){var o=n(n(n({},s),i),{type:e,baseType:t.name});Object.freeze(o),void 0===r.beforeEachHook?I(r,o):r.beforeEachHook(t,(function(){I(r,o)}))})),p=t.computedGroup,l.cacheComputedFunctionGroup=t.computeFunctionMap},l=this;try{for(var v=i(this.recognizers),f=v.next();!f.done;f=v.next()){h(f.value)}}catch(t){e={error:t}}finally{try{f&&!f.done&&(o=v.return)&&o.call(v)}finally{if(e)throw e.error}}}},o.prototype.beforeEach=function(t){this.beforeEachHook=t},o.prototype.get=function(t){return this.recognizerMap[t]},o.prototype.set=function(t){this.options=n(n({},this.options),t)},o.prototype.destroy=function(){this.emit("unbind"),this.listenersMap={}},o.version="0.7.7",o.recognizers=[],o.recognizerMap={},o.use=function(t,e){z(o,t,e)},o.removeUse=function(t){_(o,t)},o}(r);function D(t){-1!==[f,y,d,m].indexOf(t.status)&&(t.status="p")}function X(t,e,n){var i=t.test(e);D(t);var o=e.inputType;t.status=function(t,e,n){var i,o,r,s,c,p,h,d={1:(i={},i.p=(o={},o.move=l,o),i[l]=(r={},r.move=v,r[u]=f,r[a]=y,r),i[v]=(s={},s.move=v,s[u]=f,s[a]=y,s),i),0:(c={},c[l]=(p={},p.move=y,p[u]=f,p[a]=y,p),c[v]=(h={},h.start=m,h.move=y,h[u]=f,h[a]=y,h),c)};return void 0!==d[Number(t)][e]&&d[Number(t)][e][n]||e}(i,t.status,o);var r=t.computed;t.isRecognized=[l,v].includes(t.status);var s=t.name,c=t.status,p=t.isRecognized;return p&&n(s,r),(p||[f,y].includes(t.status))&&n(s+c,r),i}var A=function(){function t(t){this.disabled=!1,this.status="p",this.isRecognized=!1,this.recognizerMap={},this.computedGroup={},this.computed={},this.computeFunctionMap={},this.options=t,this.name=this.options.name}return t.prototype.set=function(t){return void 0!==t&&(this.options=n(n({},this.options),t)),this},t.prototype.isValidPointLength=function(t){return 0===this.options.pointLength||this.options.pointLength===t},t.prototype.compute=function(t,e){var n,o,r=Object.create(null);try{for(var s=i(t),a=s.next();!a.done;a=s.next()){var u=a.value,c=u._id,p=this.computedGroup,h=this.computeFunctionMap;for(var l in void 0===h[c]&&(h[c]=u()),p[c]=p[c]||h[c](e),p[c])r[l]=p[c][l]}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return r},t}(),V=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},Y=function(t){return t/Math.PI*180},C=function(t,e){var n=function(t,e){var n=V(t)*V(e);if(0===n)return 0;var i=function(t,e){return t.x*e.x+t.y*e.y}(t,e)/n;return i>1&&(i=1),Math.acos(i)}(t,e);return function(t,e){return t.x*e.y-e.x*t.y}(t,e)>0&&(n*=-1),Y(n)},F=function(t,e){return t===e?"none":Math.abs(t)>Math.abs(e)?0<t?"right":"left":0<e?"down":"up"};function j(){return function(t){var e=t.prevInput,n=0,i=0,o=0;if(void 0!==e&&(n=t.x-e.x,i=t.y-e.y,0!==n||0!==i)){var r=Math.sqrt(Math.pow(n,2)+Math.pow(i,2));o=Math.round(Y(Math.acos(Math.abs(n)/r)))}return{deltaX:n,deltaY:i,deltaXYAngle:o}}}function N(){var t=0,e=0,n=0,i=0,o=0,r="none";return function(s){var a=s.inputType,u=s.startInput;return"start"===a?(t=0,e=0,n=0,i=0,o=0,r="none"):"move"===a&&(t=Math.round(s.points[0].clientX-u.points[0].clientX),e=Math.round(s.points[0].clientY-u.points[0].clientY),n=Math.abs(t),i=Math.abs(e),o=Math.round(V({x:n,y:i})),r=F(t,e)),{displacementX:t,displacementY:e,distanceX:n,distanceY:i,distance:o,overallDirection:r}}}function R(){var t=0;return function(e){return"start"===e.inputType&&(t=e.pointLength),{maxPointLength:t}}}function U(){var t,e,n=0,i=0,o=0,r=0;return function(s){if(void 0!==s){var a=s.inputType;e=e||s.startInput;var u=s.timestamp-e.timestamp;if("move"===a&&16<u){var c=s.x-e.x,p=s.y-e.y;o=Math.round(c/u*100)/100,r=Math.round(p/u*100)/100,n=Math.abs(o),i=Math.abs(r),t=F(c,p)||t,e=s}}return{velocityX:n,velocityY:i,speedX:o,speedY:r,direction:t}}}function G(t){return{x:t.points[1].clientX-t.points[0].clientX,y:t.points[1].clientY-t.points[0].clientY}}function k(){return function(t){var e=t.prevInput,n=t.startMultiInput;if(void 0!==n&&void 0!==e&&t.id!==n.id&&1<e.pointLength&&1<t.pointLength)return{startV:G(n),prevV:G(e),activeV:G(t)}}}j._id="ComputeDeltaXY",N._id="computeDistance",R._id="computeMaxLength",U._id="ComputeVAndDir",k._id="ComputeVectorForMutli";var H={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250},B=function(t){function i(e){var i=t.call(this,n(n({},H),e))||this;return i.tapCount=0,i}return e(i,t),i.prototype._isValidDistanceFromPrevTap=function(t){if(void 0!==this.prevTapPoint){var e=V({x:t.x-this.prevTapPoint.x,y:t.y-this.prevTapPoint.y});return this.prevTapPoint=t,this.options.maxDistanceFromPrevTap>=e}return this.prevTapPoint=t,!0},i.prototype._isValidInterval=function(){var t=performance.now();if(void 0===this.prevTapTime)return this.prevTapTime=t,!0;var e=t-this.prevTapTime;return this.prevTapTime=t,e<this.options.waitNextTapTime},i.prototype.recognize=function(t,e){var i=t.inputType,o=t.x,r=t.y;this.computed=this.compute([R,N],t),u===i&&(this.status="p",this.test(t)?(this.cancelCountDownToFail(),this._isValidDistanceFromPrevTap({x:o,y:r})&&this._isValidInterval()?this.tapCount++:this.tapCount=1,0==this.tapCount%this.options.tapTimes?(this.status=d,e(this.options.name,n(n({},this.computed),{tapCount:this.tapCount})),this.reset()):this.countDownToFail()):(this.reset(),this.status=m))},i.prototype.countDownToFail=function(){var t=this;this._countDownToFailTimer=setTimeout((function(){t.status=m,t.reset()}),this.options.waitNextTapTime)},i.prototype.cancelCountDownToFail=function(){clearTimeout(this._countDownToFailTimer)},i.prototype.reset=function(){this.tapCount=0,this.prevTapPoint=void 0,this.prevTapTime=void 0},i.prototype.test=function(t){var e=t.startInput,n=t.pointLength,i=t.timestamp-e.timestamp,o=this.computed,r=o.maxPointLength,s=o.distance;return r===this.options.pointLength&&0===n&&this.options.maxDistance>=s&&this.options.maxPressTime>i},i}(A),q={name:"pan",threshold:10,pointLength:1},Z=function(t){function i(e){return t.call(this,n(n({},q),e))||this}return e(i,t),i.prototype.test=function(t){var e=t.pointLength,n=this.computed.distance;return(this.isRecognized||this.options.threshold<=n)&&this.isValidPointLength(e)},i.prototype.recognize=function(t,e){this.computed=this.compute([U,N,j],t),void 0!==this.computed.direction&&X(this,t,e)&&e(this.options.name+this.computed.direction,this.computed)},i}(A),$={name:"swipe",threshold:10,velocity:.3,pointLength:1},J=function(t){function i(e){return t.call(this,n(n({},$),e))||this}return e(i,t),i.prototype.test=function(t){var e=t.inputType;if(u!==e)return!1;var n=this.computed,i=n.velocityX,o=n.velocityY,r=n.maxPointLength,s=n.distance;return this.options.pointLength===r&&this.options.threshold<s&&this.options.velocity<Math.max(i,o)},i.prototype.recognize=function(t,e){this.computed=this.compute([R,U,N],t),this.test(t)&&(e(this.options.name,this.computed),e(this.options.name+this.computed.direction,this.computed))},i}(A),K={name:"press",pointLength:1,maxDistance:9,minPressTime:251},Q=function(t){function i(e){return t.call(this,n(n({},K),e))||this}return e(i,t),i.prototype.recognize=function(t,e){var n=this,i=t.inputType,o=t.startInput,r=t.pointLength;if("start"===i&&this.isValidPointLength(r))D(this),this.cancel(),this._timeoutId=setTimeout((function(){n.status=d,e(n.options.name,t)}),this.options.minPressTime);else if(u===i&&d===this.status)e(this.options.name+"up",this.computed);else if(d!==this.status){var s=t.timestamp-o.timestamp;(!this.test(t)||this.options.minPressTime>s&&[u,a].includes(i))&&(this.cancel(),this.status=m)}},i.prototype.test=function(t){this.computed=this.compute([N],t);var e=this.computed.distance;return this.options.maxDistance>e},i.prototype.cancel=function(){clearTimeout(this._timeoutId)},i}(A),W={name:"pinch",threshold:0,pointLength:2},tt=function(t){function i(e){return t.call(this,n(n({},W),e))||this}return e(i,t),i.prototype.test=function(t){var e=t.pointLength,n=this.computed.scale;return this.isValidPointLength(e)&&void 0!==n&&(this.options.threshold<Math.abs(n-1)||this.isRecognized)},i.prototype.recognize=function(t,e){var i,o,r,s,a,u=this.compute([k],t);"activeV"in u&&(this.computed=n(n({},this.computed),(o=(i=u).startV,r=i.prevV,s=i.activeV,a=g(V(s)/V(r)),{scale:g(V(s)/V(o)),deltaScale:a}))),X(this,t,e)},i}(A),et={name:"rotate",threshold:0,pointLength:2},nt=function(t){function i(e){return t.call(this,n(n({},et),e))||this}return e(i,t),i.prototype.test=function(t){var e=t.pointLength,n=this.computed.angle;return this.isValidPointLength(e)&&(this.options.threshold<Math.abs(n)||this.isRecognized)},i.prototype.recognize=function(t,e){var i,o,r,s,a,u=this.compute([k],t);"activeV"in u&&(this.computed=n(n({},this.computed),(o=(i=u).startV,r=i.prevV,s=i.activeV,a=Math.round(C(s,r)),{angle:Math.round(C(s,o)),deltaAngle:a}))),X(this,t,e)},i}(A);return O.use(B),O.use(Z),O.use(J),O.use(Q),O.use(tt),O.use(nt),O.Tap=B,O.Pan=Z,O.Swipe=J,O.Press=Q,O.Pinch=tt,O.Rotate=nt,O.STATUS_POSSIBLE="p",O.STATUS_START=l,O.STATUS_MOVE=v,O.STATUS_END=f,O.STATUS_CANCELLED=y,O.STATUS_FAILED=m,O.STATUS_RECOGNIZED=d,O})); |
@@ -1,1 +0,1 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var S=e(require("@any-touch/core")),T=e(require("@any-touch/tap")),u=e(require("@any-touch/pan")),r=e(require("@any-touch/swipe")),t=e(require("@any-touch/press")),a=e(require("@any-touch/pinch")),A=e(require("@any-touch/rotate")),o=require("@any-touch/shared");S.use(T),S.use(u),S.use(r),S.use(t),S.use(a),S.use(A),S.Tap=T,S.Pan=u,S.Swipe=r,S.Press=t,S.Pinch=a,S.Rotate=A,S.STATUS_POSSIBLE=o.STATUS_POSSIBLE,S.STATUS_START=o.STATUS_START,S.STATUS_MOVE=o.STATUS_MOVE,S.STATUS_END=o.STATUS_END,S.STATUS_CANCELLED=o.STATUS_CANCELLED,S.STATUS_FAILED=o.STATUS_FAILED,S.STATUS_RECOGNIZED=o.STATUS_RECOGNIZED,exports.default=S; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var AnyTouch=_interopDefault(require("@any-touch/core")),Tap=_interopDefault(require("@any-touch/tap")),Pan=_interopDefault(require("@any-touch/pan")),Swipe=_interopDefault(require("@any-touch/swipe")),Press=_interopDefault(require("@any-touch/press")),Pinch=_interopDefault(require("@any-touch/pinch")),Rotate=_interopDefault(require("@any-touch/rotate")),shared=require("@any-touch/shared");AnyTouch.use(Tap),AnyTouch.use(Pan),AnyTouch.use(Swipe),AnyTouch.use(Press),AnyTouch.use(Pinch),AnyTouch.use(Rotate),AnyTouch.Tap=Tap,AnyTouch.Pan=Pan,AnyTouch.Swipe=Swipe,AnyTouch.Press=Press,AnyTouch.Pinch=Pinch,AnyTouch.Rotate=Rotate,AnyTouch.STATUS_POSSIBLE=shared.STATUS_POSSIBLE,AnyTouch.STATUS_START=shared.STATUS_START,AnyTouch.STATUS_MOVE=shared.STATUS_MOVE,AnyTouch.STATUS_END=shared.STATUS_END,AnyTouch.STATUS_CANCELLED=shared.STATUS_CANCELLED,AnyTouch.STATUS_FAILED=shared.STATUS_FAILED,AnyTouch.STATUS_RECOGNIZED=shared.STATUS_RECOGNIZED,exports.default=AnyTouch; |
{ | ||
"name": "any-touch", | ||
"version": "0.7.7", | ||
"version": "0.7.8", | ||
"description": "一个小巧的手势库", | ||
@@ -25,10 +25,10 @@ "unpkg": "dist/any-touch.umd.min.js", | ||
"dependencies": { | ||
"@any-touch/core": "^0.7.7", | ||
"@any-touch/pan": "^0.7.7", | ||
"@any-touch/pinch": "^0.7.7", | ||
"@any-touch/press": "^0.7.7", | ||
"@any-touch/rotate": "^0.7.7", | ||
"@any-touch/swipe": "^0.7.7", | ||
"@any-touch/tap": "^0.7.7", | ||
"any-event": "^0.7.7", | ||
"@any-touch/core": "^0.7.8", | ||
"@any-touch/pan": "^0.7.8", | ||
"@any-touch/pinch": "^0.7.8", | ||
"@any-touch/press": "^0.7.8", | ||
"@any-touch/rotate": "^0.7.8", | ||
"@any-touch/swipe": "^0.7.8", | ||
"@any-touch/tap": "^0.7.8", | ||
"any-event": "^0.7.8", | ||
"tslib": "^1.9.3" | ||
@@ -42,3 +42,3 @@ }, | ||
"sideEffects": false, | ||
"gitHead": "4c1eb288b7a1f3bab7e1bebc3a225aff86b91e08" | ||
"gitHead": "14f864223c9a4df212561b9a53e93a5f89217b15" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
69450
1199
Updated@any-touch/core@^0.7.8
Updated@any-touch/pan@^0.7.8
Updated@any-touch/pinch@^0.7.8
Updated@any-touch/press@^0.7.8
Updated@any-touch/rotate@^0.7.8
Updated@any-touch/swipe@^0.7.8
Updated@any-touch/tap@^0.7.8
Updatedany-event@^0.7.8