any-touch
Advanced tools
Comparing version 2.0.0-alpha.3 to 2.0.0-alpha.4
@@ -177,9 +177,19 @@ (function (global, factory) { | ||
var MOUSE_DOWN = MOUSE + DIRECTION_DOWN; | ||
var STATE; | ||
(function (STATE) { | ||
STATE[STATE["POSSIBLE"] = 0] = "POSSIBLE"; | ||
STATE[STATE["RECOGNIZED"] = 1] = "RECOGNIZED"; | ||
STATE[STATE["FAILED"] = 2] = "FAILED"; | ||
STATE[STATE["CANCELLED"] = 3] = "CANCELLED"; | ||
STATE[STATE["START"] = 4] = "START"; | ||
STATE[STATE["MOVE"] = 5] = "MOVE"; | ||
STATE[STATE["END"] = 1] = "END"; | ||
})(STATE || (STATE = {})); | ||
var _a; | ||
var STATUS_CODE_AND_NAME_MAP = (_a = {}, | ||
_a[4] = TYPE_START, | ||
_a[5] = TYPE_MOVE, | ||
_a[1] = TYPE_END, | ||
_a[3] = TYPE_CANCEL, | ||
_a[STATE.START] = TYPE_START, | ||
_a[STATE.MOVE] = TYPE_MOVE, | ||
_a[STATE.END] = TYPE_END, | ||
_a[STATE.CANCELLED] = TYPE_CANCEL, | ||
_a); | ||
@@ -193,27 +203,27 @@ function getStatusName(code) { | ||
1: (_a = {}, | ||
_a[0] = (_b = {}, | ||
_b[TYPE_MOVE] = 4, | ||
_a[STATE.POSSIBLE] = (_b = {}, | ||
_b[TYPE_MOVE] = STATE.START, | ||
_b), | ||
_a[4] = (_c = {}, | ||
_c[TYPE_MOVE] = 5, | ||
_c[TYPE_END] = 1, | ||
_c[TYPE_CANCEL] = 3, | ||
_a[STATE.START] = (_c = {}, | ||
_c[TYPE_MOVE] = STATE.MOVE, | ||
_c[TYPE_END] = STATE.END, | ||
_c[TYPE_CANCEL] = STATE.CANCELLED, | ||
_c), | ||
_a[5] = (_d = {}, | ||
_d[TYPE_MOVE] = 5, | ||
_d[TYPE_END] = 1, | ||
_d[TYPE_CANCEL] = 3, | ||
_a[STATE.MOVE] = (_d = {}, | ||
_d[TYPE_MOVE] = STATE.MOVE, | ||
_d[TYPE_END] = STATE.END, | ||
_d[TYPE_CANCEL] = STATE.CANCELLED, | ||
_d), | ||
_a), | ||
0: (_e = {}, | ||
_e[4] = (_f = {}, | ||
_f[TYPE_MOVE] = 2, | ||
_f[TYPE_END] = 1, | ||
_f[TYPE_CANCEL] = 3, | ||
_e[STATE.START] = (_f = {}, | ||
_f[TYPE_MOVE] = STATE.FAILED, | ||
_f[TYPE_END] = STATE.END, | ||
_f[TYPE_CANCEL] = STATE.CANCELLED, | ||
_f), | ||
_e[5] = (_g = {}, | ||
_g[TYPE_START] = 2, | ||
_g[TYPE_MOVE] = 2, | ||
_g[TYPE_END] = 1, | ||
_g[TYPE_CANCEL] = 3, | ||
_e[STATE.MOVE] = (_g = {}, | ||
_g[TYPE_START] = STATE.FAILED, | ||
_g[TYPE_MOVE] = STATE.FAILED, | ||
_g[TYPE_END] = STATE.END, | ||
_g[TYPE_CANCEL] = STATE.CANCELLED, | ||
_g), | ||
@@ -223,15 +233,15 @@ _e), | ||
var map = STATE_MAP[Number(isVaild)][lastStatus]; | ||
return (void 0 !== map && map[phase]) || 0; | ||
return (void 0 !== map && map[phase]) || STATE.POSSIBLE; | ||
} | ||
function resetState(context) { | ||
if ([1, 3, 2].includes(context.state)) { | ||
context.state = 0; | ||
if ([STATE.RECOGNIZED, STATE.CANCELLED, STATE.FAILED].includes(context.state)) { | ||
context.state = STATE.POSSIBLE; | ||
} | ||
} | ||
function isRecognized(state) { | ||
return [4, 5].includes(state); | ||
return [STATE.START, STATE.MOVE].includes(state); | ||
} | ||
function isDisabled(context) { | ||
if (context.disabled) { | ||
context.state = 0; | ||
context.state = STATE.POSSIBLE; | ||
return true; | ||
@@ -242,3 +252,3 @@ } | ||
function createPluginContext(defaultOptions, options) { | ||
return __assign(__assign(__assign({}, defaultOptions), options), { state: 0, disabled: false }); | ||
return __assign(__assign(__assign({}, defaultOptions), options), { state: STATE.POSSIBLE, disabled: false }); | ||
} | ||
@@ -546,2 +556,3 @@ | ||
this.emit(type, __assign(__assign({}, payload), { type: type })); | ||
this.emit('at:after', __assign(__assign({}, payload), { name: type })); | ||
var target = payload.target; | ||
@@ -551,2 +562,3 @@ var domEvents = this.__options.domEvents; | ||
dispatchDomEvent(type, target, payload, domEvents); | ||
dispatchDomEvent('at:after', target, __assign(__assign({}, payload), { name: type }), domEvents); | ||
} | ||
@@ -764,3 +776,3 @@ }; | ||
countDownToFailTimer = setTimeout(function () { | ||
context.state = 2; | ||
context.state = STATE.FAILED; | ||
reset(); | ||
@@ -798,3 +810,3 @@ }, context.waitNextTapTime); | ||
return; | ||
context.state = 0; | ||
context.state = STATE.POSSIBLE; | ||
if (test()) { | ||
@@ -809,3 +821,3 @@ clearTimeout(countDownToFailTimer); | ||
if (0 === tapCount % context.tapTimes) { | ||
context.state = 1; | ||
context.state = STATE.RECOGNIZED; | ||
at.emit2(context.name, computed, context); | ||
@@ -820,3 +832,3 @@ reset(); | ||
reset(); | ||
context.state = 2; | ||
context.state = STATE.FAILED; | ||
} | ||
@@ -846,5 +858,5 @@ function test() { | ||
if (isValid) { | ||
var name_1 = context.name; | ||
at.emit2(name_1, computed, context); | ||
at.emit2(name_1 + getStatusName(context.state), computed, context); | ||
var name = context.name; | ||
at.emit2(name, computed, context); | ||
at.emit2(name + getStatusName(context.state), computed, context); | ||
} | ||
@@ -872,10 +884,10 @@ function test() { | ||
at.compute([ComputeDistance, ComputeVAndDir, ComputeMaxLength], function (computed) { | ||
context.state = 0; | ||
context.state = STATE.POSSIBLE; | ||
if (context.disabled) | ||
return; | ||
if (test()) { | ||
var name_1 = context.name; | ||
context.state = 1; | ||
at.emit2(name_1, computed, context); | ||
at.emit2(name_1 + computed.direction, computed, context); | ||
var name = context.name; | ||
context.state = STATE.RECOGNIZED; | ||
at.emit2(name, computed, context); | ||
at.emit2(name + computed.direction, computed, context); | ||
} | ||
@@ -912,10 +924,10 @@ function test() { | ||
timeoutId = setTimeout(function () { | ||
context.state = 1; | ||
context.state = STATE.RECOGNIZED; | ||
at.emit2(context.name, computed, context); | ||
}, context.minPressTime); | ||
} | ||
else if (TYPE_END === phase && 1 === context.state) { | ||
else if (TYPE_END === phase && STATE.RECOGNIZED === context.state) { | ||
at.emit2("" + context.name + DIRECTION_UP, computed, context); | ||
} | ||
else if (1 !== context.state) { | ||
else if (STATE.RECOGNIZED !== context.state) { | ||
var deltaTime = computed.timestamp - startInput.timestamp; | ||
@@ -925,3 +937,3 @@ if (!test() || | ||
clearTimeout(timeoutId); | ||
context.state = 2; | ||
context.state = STATE.FAILED; | ||
} | ||
@@ -1011,10 +1023,10 @@ } | ||
} | ||
default_1.version = '2.0.0-alpha.2'; | ||
default_1.STATE_POSSIBLE = 0; | ||
default_1.STATE_START = 4; | ||
default_1.STATE_MOVE = 5; | ||
default_1.STATE_END = 1; | ||
default_1.STATE_CANCELLED = 3; | ||
default_1.STATE_FAILED = 2; | ||
default_1.STATE_RECOGNIZED = 1; | ||
default_1.version = '2.0.0-alpha.3'; | ||
default_1.STATE_POSSIBLE = STATE.POSSIBLE; | ||
default_1.STATE_START = STATE.START; | ||
default_1.STATE_MOVE = STATE.MOVE; | ||
default_1.STATE_END = STATE.END; | ||
default_1.STATE_CANCELLED = STATE.CANCELLED; | ||
default_1.STATE_FAILED = STATE.FAILED; | ||
default_1.STATE_RECOGNIZED = STATE.RECOGNIZED; | ||
default_1.tap = tap; | ||
@@ -1021,0 +1033,0 @@ default_1.pan = pan; |
@@ -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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function r(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var i=function(){function t(){this.__map={}}return t.prototype.beforeEach=function(t){this.__interceptor=t},t.prototype.on=function(t,e){var n,i,o=Array.isArray(t)?t:[t];try{for(var a=r(o),u=a.next();!u.done;u=a.next()){var c=u.value;this.__map[c]=this.__map[c]||[];var s=this.__map[c];s&&s.push(e)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return this},t.prototype.emit=function(t,e){var n=this;void 0!==this.__interceptor?this.__interceptor(this,(function(){n.__emit(t,e)})):this.__emit(t,e)},t.prototype.__emit=function(t,e){var n,i,o=this.__map[t];if(Array.isArray(o)&&(null==o?void 0:o.length))try{for(var a=r(o),u=a.next();!u.done;u=a.next()){(0,u.value)(e)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}this.event=e},t.prototype.off=function(t,e){var n=this.__map[t];if(void 0!==n)if(void 0===e)delete this.__map[t];else{var r=n.findIndex((function(t){return t===e}));n.splice(r,1)}},t.prototype.destroy=function(){this.__map={}},t}(),o=Object.prototype.toString;var a,u="cancel",c="end",s="touch"+c,p="touch"+u,v=((a={})[4]="start",a[5]="move",a[1]=c,a[3]=u,a);function f(t){return v[t]}function h(t,e,n){var r,i,o,a,s,p,v,f={1:(r={},r[0]=(i={},i.move=4,i),r[4]=(o={},o.move=5,o[c]=1,o[u]=3,o),r[5]=(a={},a.move=5,a[c]=1,a[u]=3,a),r),0:(s={},s[4]=(p={},p.move=2,p[c]=1,p[u]=3,p),s[5]=(v={},v.start=2,v.move=2,v[c]=1,v[u]=3,v),s)}[Number(t)][e];return void 0!==f&&f[n]||0}function l(t){[1,3,2].includes(t.state)&&(t.state=0)}function m(t){return[4,5].includes(t)}function d(t){if(t.disabled)return t.state=0,!0}function y(t,e){return n(n(n({},t),e),{state:0,disabled:!1})}function g(t){return Math.round(100*t)/100}function _(){var t,e,r,i,o=0;return function(a){if(t=e,void 0!==a){var s=function(t,e){var n=t.phase,r=t.points,i=t.changedPoints,o=t.nativeEvent,a=r.length,s="start"===n,p=c===n&&0===a||u===n,v=Date.now(),f=x(r)||x(i),h=f.x,l=f.y,m=o.currentTarget;return Object.assign(t,{id:e,x:h,y:l,timestamp:v,isStart:s,isEnd:p,pointLength:a,currentTarget:m,getOffset:function(t){void 0===t&&(t=m);var e=t.getBoundingClientRect();return{x:h-Math.round(e.left),y:l-Math.round(e.top)}}})}(a,o=Number.MAX_SAFE_INTEGER>o?++o:1);e=s;var p=s.isStart,v=s.pointLength;return p&&(r=s,t=void 0,i=1<v?s:void 0),n(n({},s),{prevInput:t,startMultiInput:i,startInput:r})}}}function x(t){var e=t.length;if(0<e){if(1===e){var n=t[0],r=n.clientX,i=n.clientY;return{x:Math.round(r),y:Math.round(i)}}var o=t.reduce((function(t,e){return t.x+=e.clientX,t.y+=e.clientY,t}),{x:0,y:0});return{x:Math.round(o.x/e),y:Math.round(o.y/e)}}}function E(t,e,n,r){n.target,n.currentTarget,n.type;var i,o=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(n,["target","currentTarget","type"]);return document.createEvent?(i=document.createEvent("HTMLEvents")).initEvent(t,null==r?void 0:r.bubbles,null==r?void 0:r.cancelable):i=new Event(t,r),Object.assign(i,o,{match:function(){return n.targets&&0<n.targets.length&&n.targets.every((function(t){return i.currentTarget.contains(t)}))}}),e.dispatchEvent(i)}function T(t,e){var n,r=e.preventDefault;return n=r,"[object Function]"===o.call(n)?r(t):!!r}var b=["touchstart","touchmove",s,p];var L={domEvents:{bubbles:!0,cancelable:!0},preventDefault:function(t){if(t.target&&"tagName"in t.target){var e=t.target.tagName;return!/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e)}return!1}},w=function(t){function i(e,r){var i,o=t.call(this)||this;o.__computeFunctionList=[],o.__computeFunctionCreatorList=[],o.__pluginContexts=[],o.el=e,o.__options=n(n({},L),r);var a,u,v,f,h=function(t){var e=_();return function(n){var r=[],i=[];Array.from(n.touches).forEach((function(e){var n=e.clientX,o=e.clientY,a=e.target;(null==t?void 0:t.contains(a))&&(r.push(a),i.push({clientX:n,clientY:o,target:a}))}));var o=Array.from(n.changedTouches).map((function(t){return{clientX:t.clientX,clientY:t.clientY,target:t.target}}));return e({phase:n.type.replace("touch",""),changedPoints:o,points:i,nativeEvent:n,target:n.target,targets:r})}}(o.el),l=(u=!1,v=null,f=_(),function(t){var e,n=t.clientX,r=t.clientY,i=t.type,o=t.button,s=t.target,p=[{clientX:n,clientY:r,target:s}];if("mousedown"===i&&0===o)v=s,u=!0,e="start";else{if(!u)return;"mousemove"===i?e="move":"mouseup"===i&&(p=[],e=c,u=!1)}var h=a||[{clientX:n,clientY:r,target:s}];if(a=[{clientX:n,clientY:r,target:s}],void 0!==e)return f({phase:e,changedPoints:h,points:p,target:v,targets:[v],nativeEvent:t})});if(o.__inputCreatorMap=((i={}).touchstart=h,i.touchmove=h,i[s]=h,i[p]=h,i.mousedown=l,i.mousemove=l,i.mouseup=l,i),void 0!==e){e.style.webkitTapHighlightColor="rgba(0,0,0,0)";var m=!1;try{var d={};Object.defineProperty(d,"passive",{get:function(){m=!0}}),window.addEventListener("_",(function(){}),d)}catch(t){}o.on("u",function(t,e,n){return b.forEach((function(r){t.addEventListener(r,e,n)})),t.addEventListener("mousedown",e,n),window.addEventListener("mousemove",e,n),window.addEventListener("mouseup",e,n),function(){b.forEach((function(n){t.removeEventListener(n,e)})),t.removeEventListener("mousedown",e,n),window.removeEventListener("mousemove",e,n),window.removeEventListener("mouseup",e,n)}}(e,o.catchEvent.bind(o),!(!1!==o.__options.preventDefault||!m)&&{passive:!0}))}return o}return e(i,t),i.prototype.use=function(t,e){this.__pluginContexts.push(t(this,e))},i.prototype.catchEvent=function(t){var e=this.__inputCreatorMap[t.type](t);if(void 0!==e){var r=function(){return t.preventDefault()};T(t,this.__options)&&r(),this.emit("input",e),this.emit2("at:"+e.phase,e,{});var i={};this.__computeFunctionList.forEach((function(t){var n=t(e,i);if(void 0!==n)for(var r in n)i[r]=n[r]})),this.emit("computed",n(n(n({},e),i),{stopPropagation:function(){return t.stopPropagation()},stopImmediatePropagation:function(){return t.stopImmediatePropagation()},preventDefault:r}))}},i.prototype.compute=function(t,e){var n,i;try{for(var o=r(t),a=o.next();!a.done;a=o.next()){var u=a.value;this.__computeFunctionCreatorList.includes(u)||(this.__computeFunctionCreatorList.push(u),this.__computeFunctionList.push(u()))}}catch(t){n={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.on("computed",e)},i.prototype.beforeEach=function(e){var r=this;t.prototype.beforeEach.call(this,(function(t,i){var o;void 0===(null===(o=t.c)||void 0===o?void 0:o.name)?i():e(n(n({},t.c),{event:r.event}),i)}))},i.prototype.get=function(t){return this.__pluginContexts.find((function(e){return t===e.name}))},i.prototype.set=function(t){this.__options=n(n({},this.__options),t)},i.prototype.emit2=function(t,e,r){this.c=r,this.emit(t,n(n({},e),{type:t}));var i=e.target,o=this.__options.domEvents;o&&void 0!==this.el&&i&&E(t,i,e,o)},i.prototype.destroy=function(){this.emit("u"),t.prototype.destroy.call(this)},i}(i),M=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},O=function(t){return t/Math.PI*180},P=function(t,e){var n=function(t,e){var n=M(t)*M(e);if(0===n)return 0;var r=function(t,e){return t.x*e.x+t.y*e.y}(t,e)/n;return r>1&&(r=1),Math.acos(r)}(t,e);return function(t,e){return t.x*e.y-e.x*t.y}(t,e)>0&&(n*=-1),O(n)},A=function(t,e){return Math.abs(t)>=Math.abs(e)?0<t?"right":"left":0<e?"down":"up"};function S(){var t=0,e=0;return function(n,r){var i=r.prevVecotr,o=r.startVecotr,a=r.activeVecotr;return a&&(e=Math.round(P(a,i)),t=Math.round(P(a,o))),{angle:t,deltaAngle:e}}}function X(){return function(t){var e=t.prevInput,n=0,r=0,i=0;if(void 0!==e&&(n=t.x-e.x,r=t.y-e.y,0!==n||0!==r)){var o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));i=Math.round(O(Math.acos(Math.abs(n)/o)))}return{deltaX:n,deltaY:r,deltaXYAngle:i}}}function Y(){var t,e=0,n=0,r=0,i=0,o=0;return function(a){var u=a.phase,c=a.startInput;return"start"===u?(e=0,n=0,r=0,i=0,o=0):"move"===u&&(e=Math.round(a.points[0].clientX-c.points[0].clientX),n=Math.round(a.points[0].clientY-c.points[0].clientY),r=Math.abs(e),i=Math.abs(n),o=Math.round(M({x:r,y:i})),t=A(e,n)),{displacementX:e,displacementY:n,distanceX:r,distanceY:i,distance:o,overallDirection:t}}}function I(){var t=1,e=1;return function(n,r){var i=r.prevVecotr,o=r.startVecotr,a=r.activeVecotr;return a&&(t=g(M(a)/M(i)),e=g(M(a)/M(o))),{scale:e,deltaScale:t}}}function D(){var t,e,n=0,r=0,i=0,o=0;return function(a){if(void 0!==a){e=e||a.startInput;var u=a.timestamp-e.timestamp;if(16<u){var c=a.x-e.x,s=a.y-e.y;i=Math.round(c/u*100)/100,o=Math.round(s/u*100)/100,n=Math.abs(i),r=Math.abs(o),t=A(c,s)||t,e=a}}return{velocityX:n,velocityY:r,speedX:i,speedY:o,direction:t}}}function j(){var t=0;return function(e){return"start"===e.phase&&(t=e.pointLength),{maxPointLength:t}}}function C(t){return{x:t.points[1].clientX-t.points[0].clientX,y:t.points[1].clientY-t.points[0].clientY}}function N(){var t,e,n;return function(r){var i=r.prevInput,o=r.startMultiInput;return void 0!==o&&void 0!==i&&r.id!==o.id&&1<i.pointLength&&1<r.pointLength&&(t=C(o),e=C(i),n=C(r)),{startVecotr:t,prevVecotr:e,activeVecotr:n}}}var F={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function V(t,e){var n,r,i,o=y(F,e),a=0;function u(){a=0,n=void 0,r=void 0}return t.compute([Y,j],(function(e){if(!d(o)){var s,p,v,f,h=e.phase,l=e.x,m=e.y;if(c===h)o.state=0,s=e.startInput,p=e.pointLength,v=e.timestamp-s.timestamp,f=e.distance,e.maxPointLength===o.pointLength&&0===p&&o.maxDistance>=f&&o.maxPressTime>v?(clearTimeout(i),function(t,e){if(void 0!==n){var r=M({x:t.x-n.x,y:t.y-n.y});return n=t,e.maxDistanceFromPrevTap>=r}return n=t,!0}({x:l,y:m},o)&&function(t){var e=performance.now();if(void 0===r)return r=e,!0;var n=e-r;return r=e,n<t}(o.waitNextTapTime)?a++:a=1,0==a%o.tapTimes?(o.state=1,t.emit2(o.name,e,o),u()):i=setTimeout((function(){o.state=2,u()}),o.waitNextTapTime)):(u(),o.state=2)}})),o}var R={name:"pan",threshold:10,pointLength:1};function B(t,e){var n=y(R,e);return t.compute([D,Y,X],(function(e){if(l(n),!d(n)){var r,i,o,a,u,s=(r=e.pointLength,i=e.distance,o=e.direction,a=e.phase,(m(u=n.state)||n.threshold<=i)&&n.pointLength===r&&void 0!==o||m(u)&&c===a);if(n.state=h(s,n.state,e.phase),s){var p=n.name;t.emit2(p,e,n),t.emit2(p+f(n.state),e,n)}}})),n}var q={name:"swipe",threshold:10,velocity:.3,pointLength:1};function G(t,e){var n=y(q,e);return t.compute([Y,D,j],(function(e){if(n.state=0,!n.disabled&&function(){if(c!==e.phase)return!1;var t=e.velocityX,r=e.velocityY,i=e.distance;return e.maxPointLength===n.pointLength&&0===e.points.length&&n.threshold<i&&n.velocity<Math.max(t,r)}()){var r=n.name;n.state=1,t.emit2(r,e,n),t.emit2(r+e.direction,e,n)}})),n}var H={name:"press",pointLength:1,maxDistance:9,minPressTime:251};function U(t,e){var n=y(H,e),r=0;return t.compute([Y],(function(e){if(!d(n)){var i,o=e.phase,a=e.startInput,s=e.pointLength;if("start"===o&&n.pointLength===s)l(n),clearTimeout(r),r=setTimeout((function(){n.state=1,t.emit2(n.name,e,n)}),n.minPressTime);else if(c===o&&1===n.state)t.emit2(n.name+"up",e,n);else if(1!==n.state){var p=e.timestamp-a.timestamp;(!((i=e.distance)&&n.maxDistance>i)||n.minPressTime>p&&[c,u].includes(o))&&(clearTimeout(r),n.state=2)}}})),n}var k={name:"pinch",threshold:0,pointLength:2};function Z(t,e){var n=y(k,e);return t.compute([N,I],(function(e){if(l(n),!d(n)){var r,i,o,a,s=(r=e.pointLength,i=e.scale,o=e.deltaScale,a=e.phase,n.pointLength===r&&(void 0!==i&&void 0!==o&&n.threshold<Math.abs(i-1)||m(n.state))||m(n.state)&&[c,u].includes(a));n.state=h(s,n.state,e.phase);var p=n.name;s&&t.emit2(p,e,n);var v=f(n.state);v&&t.emit2(p+v,e,n)}})),n}var $={name:"rotate",threshold:0,pointLength:2};function z(t,e){var n=y($,e);return t.compute([N,S],(function(e){if(!d(n)){l(n);var r,i,o,a=(r=e.pointLength,i=e.angle,o=e.phase,n.pointLength===r&&(n.threshold<Math.abs(i)||m(n.state))||m(n.state)&&[c,u].includes(o));n.state=h(a,n.state,e.phase);var s=n.name;a&&t.emit2(s,e,n);var p=f(n.state);p&&t.emit2(s+p,e,n)}})),n}return function(t){function n(e,n){var r=t.call(this,e,n)||this;return r.use(V),r.use(B),r.use(G),r.use(U),r.use(Z),r.use(z),r}return e(n,t),n.version="2.0.0-alpha.2",n.STATE_POSSIBLE=0,n.STATE_START=4,n.STATE_MOVE=5,n.STATE_END=1,n.STATE_CANCELLED=3,n.STATE_FAILED=2,n.STATE_RECOGNIZED=1,n.tap=V,n.pan=B,n.swipe=G,n.press=U,n.rotate=z,n.pinch=Z,n}(w)})); | ||
!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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function r(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var i=function(){function t(){this.__map={}}return t.prototype.beforeEach=function(t){this.__interceptor=t},t.prototype.on=function(t,e){var n,i,o=Array.isArray(t)?t:[t];try{for(var a=r(o),u=a.next();!u.done;u=a.next()){var c=u.value;this.__map[c]=this.__map[c]||[];var s=this.__map[c];s&&s.push(e)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return this},t.prototype.emit=function(t,e){var n=this;void 0!==this.__interceptor?this.__interceptor(this,(function(){n.__emit(t,e)})):this.__emit(t,e)},t.prototype.__emit=function(t,e){var n,i,o=this.__map[t];if(Array.isArray(o)&&(null==o?void 0:o.length))try{for(var a=r(o),u=a.next();!u.done;u=a.next()){(0,u.value)(e)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}this.event=e},t.prototype.off=function(t,e){var n=this.__map[t];if(void 0!==n)if(void 0===e)delete this.__map[t];else{var r=n.findIndex((function(t){return t===e}));n.splice(r,1)}},t.prototype.destroy=function(){this.__map={}},t}(),o=Object.prototype.toString;var a,u,c="cancel",s="end",p="touch"+s,v="touch"+c;!function(t){t[t.POSSIBLE=0]="POSSIBLE",t[t.RECOGNIZED=1]="RECOGNIZED",t[t.FAILED=2]="FAILED",t[t.CANCELLED=3]="CANCELLED",t[t.START=4]="START",t[t.MOVE=5]="MOVE",t[t.END=1]="END"}(a||(a={}));var f=((u={})[a.START]="start",u[a.MOVE]="move",u[a.END]=s,u[a.CANCELLED]=c,u);function h(t){return f[t]}function l(t,e,n){var r,i,o,u,p,v,f,h={1:(r={},r[a.POSSIBLE]=(i={},i.move=a.START,i),r[a.START]=(o={},o.move=a.MOVE,o[s]=a.END,o[c]=a.CANCELLED,o),r[a.MOVE]=(u={},u.move=a.MOVE,u[s]=a.END,u[c]=a.CANCELLED,u),r),0:(p={},p[a.START]=(v={},v.move=a.FAILED,v[s]=a.END,v[c]=a.CANCELLED,v),p[a.MOVE]=(f={},f.start=a.FAILED,f.move=a.FAILED,f[s]=a.END,f[c]=a.CANCELLED,f),p)}[Number(t)][e];return void 0!==h&&h[n]||a.POSSIBLE}function m(t){[a.RECOGNIZED,a.CANCELLED,a.FAILED].includes(t.state)&&(t.state=a.POSSIBLE)}function d(t){return[a.START,a.MOVE].includes(t)}function E(t){if(t.disabled)return t.state=a.POSSIBLE,!0}function y(t,e){return n(n(n({},t),e),{state:a.POSSIBLE,disabled:!1})}function g(t){return Math.round(100*t)/100}function L(){var t,e,r,i,o=0;return function(a){if(t=e,void 0!==a){var u=function(t,e){var n=t.phase,r=t.points,i=t.changedPoints,o=t.nativeEvent,a=r.length,u="start"===n,p=s===n&&0===a||c===n,v=Date.now(),f=_(r)||_(i),h=f.x,l=f.y,m=o.currentTarget;return Object.assign(t,{id:e,x:h,y:l,timestamp:v,isStart:u,isEnd:p,pointLength:a,currentTarget:m,getOffset:function(t){void 0===t&&(t=m);var e=t.getBoundingClientRect();return{x:h-Math.round(e.left),y:l-Math.round(e.top)}}})}(a,o=Number.MAX_SAFE_INTEGER>o?++o:1);e=u;var p=u.isStart,v=u.pointLength;return p&&(r=u,t=void 0,i=1<v?u:void 0),n(n({},u),{prevInput:t,startMultiInput:i,startInput:r})}}}function _(t){var e=t.length;if(0<e){if(1===e){var n=t[0],r=n.clientX,i=n.clientY;return{x:Math.round(r),y:Math.round(i)}}var o=t.reduce((function(t,e){return t.x+=e.clientX,t.y+=e.clientY,t}),{x:0,y:0});return{x:Math.round(o.x/e),y:Math.round(o.y/e)}}}function T(t,e,n,r){n.target,n.currentTarget,n.type;var i,o=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(n,["target","currentTarget","type"]);return document.createEvent?(i=document.createEvent("HTMLEvents")).initEvent(t,null==r?void 0:r.bubbles,null==r?void 0:r.cancelable):i=new Event(t,r),Object.assign(i,o,{match:function(){return n.targets&&0<n.targets.length&&n.targets.every((function(t){return i.currentTarget.contains(t)}))}}),e.dispatchEvent(i)}function x(t,e){var n,r=e.preventDefault;return n=r,"[object Function]"===o.call(n)?r(t):!!r}var O=["touchstart","touchmove",p,v];var b={domEvents:{bubbles:!0,cancelable:!0},preventDefault:function(t){if(t.target&&"tagName"in t.target){var e=t.target.tagName;return!/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e)}return!1}},D=function(t){function i(e,r){var i,o=t.call(this)||this;o.__computeFunctionList=[],o.__computeFunctionCreatorList=[],o.__pluginContexts=[],o.el=e,o.__options=n(n({},b),r);var a,u,c,f,h=function(t){var e=L();return function(n){var r=[],i=[];Array.from(n.touches).forEach((function(e){var n=e.clientX,o=e.clientY,a=e.target;(null==t?void 0:t.contains(a))&&(r.push(a),i.push({clientX:n,clientY:o,target:a}))}));var o=Array.from(n.changedTouches).map((function(t){return{clientX:t.clientX,clientY:t.clientY,target:t.target}}));return e({phase:n.type.replace("touch",""),changedPoints:o,points:i,nativeEvent:n,target:n.target,targets:r})}}(o.el),l=(u=!1,c=null,f=L(),function(t){var e,n=t.clientX,r=t.clientY,i=t.type,o=t.button,p=t.target,v=[{clientX:n,clientY:r,target:p}];if("mousedown"===i&&0===o)c=p,u=!0,e="start";else{if(!u)return;"mousemove"===i?e="move":"mouseup"===i&&(v=[],e=s,u=!1)}var h=a||[{clientX:n,clientY:r,target:p}];if(a=[{clientX:n,clientY:r,target:p}],void 0!==e)return f({phase:e,changedPoints:h,points:v,target:c,targets:[c],nativeEvent:t})});if(o.__inputCreatorMap=((i={}).touchstart=h,i.touchmove=h,i[p]=h,i[v]=h,i.mousedown=l,i.mousemove=l,i.mouseup=l,i),void 0!==e){e.style.webkitTapHighlightColor="rgba(0,0,0,0)";var m=!1;try{var d={};Object.defineProperty(d,"passive",{get:function(){m=!0}}),window.addEventListener("_",(function(){}),d)}catch(t){}o.on("u",function(t,e,n){return O.forEach((function(r){t.addEventListener(r,e,n)})),t.addEventListener("mousedown",e,n),window.addEventListener("mousemove",e,n),window.addEventListener("mouseup",e,n),function(){O.forEach((function(n){t.removeEventListener(n,e)})),t.removeEventListener("mousedown",e,n),window.removeEventListener("mousemove",e,n),window.removeEventListener("mouseup",e,n)}}(e,o.catchEvent.bind(o),!(!1!==o.__options.preventDefault||!m)&&{passive:!0}))}return o}return e(i,t),i.prototype.use=function(t,e){this.__pluginContexts.push(t(this,e))},i.prototype.catchEvent=function(t){var e=this.__inputCreatorMap[t.type](t);if(void 0!==e){var r=function(){return t.preventDefault()};x(t,this.__options)&&r(),this.emit("input",e),this.emit2("at:"+e.phase,e,{});var i={};this.__computeFunctionList.forEach((function(t){var n=t(e,i);if(void 0!==n)for(var r in n)i[r]=n[r]})),this.emit("computed",n(n(n({},e),i),{stopPropagation:function(){return t.stopPropagation()},stopImmediatePropagation:function(){return t.stopImmediatePropagation()},preventDefault:r}))}},i.prototype.compute=function(t,e){var n,i;try{for(var o=r(t),a=o.next();!a.done;a=o.next()){var u=a.value;this.__computeFunctionCreatorList.includes(u)||(this.__computeFunctionCreatorList.push(u),this.__computeFunctionList.push(u()))}}catch(t){n={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.on("computed",e)},i.prototype.beforeEach=function(e){var r=this;t.prototype.beforeEach.call(this,(function(t,i){var o;void 0===(null===(o=t.c)||void 0===o?void 0:o.name)?i():e(n(n({},t.c),{event:r.event}),i)}))},i.prototype.get=function(t){return this.__pluginContexts.find((function(e){return t===e.name}))},i.prototype.set=function(t){this.__options=n(n({},this.__options),t)},i.prototype.emit2=function(t,e,r){this.c=r,this.emit(t,n(n({},e),{type:t})),this.emit("at:after",n(n({},e),{name:t}));var i=e.target,o=this.__options.domEvents;o&&void 0!==this.el&&i&&(T(t,i,e,o),T("at:after",i,n(n({},e),{name:t}),o))},i.prototype.destroy=function(){this.emit("u"),t.prototype.destroy.call(this)},i}(i),A=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},S=function(t){return t/Math.PI*180},I=function(t,e){var n=function(t,e){var n=A(t)*A(e);if(0===n)return 0;var r=function(t,e){return t.x*e.x+t.y*e.y}(t,e)/n;return r>1&&(r=1),Math.acos(r)}(t,e);return function(t,e){return t.x*e.y-e.x*t.y}(t,e)>0&&(n*=-1),S(n)},M=function(t,e){return Math.abs(t)>=Math.abs(e)?0<t?"right":"left":0<e?"down":"up"};function C(){var t=0,e=0;return function(n,r){var i=r.prevVecotr,o=r.startVecotr,a=r.activeVecotr;return a&&(e=Math.round(I(a,i)),t=Math.round(I(a,o))),{angle:t,deltaAngle:e}}}function w(){return function(t){var e=t.prevInput,n=0,r=0,i=0;if(void 0!==e&&(n=t.x-e.x,r=t.y-e.y,0!==n||0!==r)){var o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));i=Math.round(S(Math.acos(Math.abs(n)/o)))}return{deltaX:n,deltaY:r,deltaXYAngle:i}}}function N(){var t,e=0,n=0,r=0,i=0,o=0;return function(a){var u=a.phase,c=a.startInput;return"start"===u?(e=0,n=0,r=0,i=0,o=0):"move"===u&&(e=Math.round(a.points[0].clientX-c.points[0].clientX),n=Math.round(a.points[0].clientY-c.points[0].clientY),r=Math.abs(e),i=Math.abs(n),o=Math.round(A({x:r,y:i})),t=M(e,n)),{displacementX:e,displacementY:n,distanceX:r,distanceY:i,distance:o,overallDirection:t}}}function P(){var t=1,e=1;return function(n,r){var i=r.prevVecotr,o=r.startVecotr,a=r.activeVecotr;return a&&(t=g(A(a)/A(i)),e=g(A(a)/A(o))),{scale:e,deltaScale:t}}}function X(){var t,e,n=0,r=0,i=0,o=0;return function(a){if(void 0!==a){e=e||a.startInput;var u=a.timestamp-e.timestamp;if(16<u){var c=a.x-e.x,s=a.y-e.y;i=Math.round(c/u*100)/100,o=Math.round(s/u*100)/100,n=Math.abs(i),r=Math.abs(o),t=M(c,s)||t,e=a}}return{velocityX:n,velocityY:r,speedX:i,speedY:o,direction:t}}}function R(){var t=0;return function(e){return"start"===e.phase&&(t=e.pointLength),{maxPointLength:t}}}function F(t){return{x:t.points[1].clientX-t.points[0].clientX,y:t.points[1].clientY-t.points[0].clientY}}function Y(){var t,e,n;return function(r){var i=r.prevInput,o=r.startMultiInput;return void 0!==o&&void 0!==i&&r.id!==o.id&&1<i.pointLength&&1<r.pointLength&&(t=F(o),e=F(i),n=F(r)),{startVecotr:t,prevVecotr:e,activeVecotr:n}}}var V={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function j(t,e){var n,r,i,o=y(V,e),u=0;function c(){u=0,n=void 0,r=void 0}return t.compute([N,R],(function(e){if(!E(o)){var p,v,f,h,l=e.phase,m=e.x,d=e.y;if(s===l)o.state=a.POSSIBLE,p=e.startInput,v=e.pointLength,f=e.timestamp-p.timestamp,h=e.distance,e.maxPointLength===o.pointLength&&0===v&&o.maxDistance>=h&&o.maxPressTime>f?(clearTimeout(i),function(t,e){if(void 0!==n){var r=A({x:t.x-n.x,y:t.y-n.y});return n=t,e.maxDistanceFromPrevTap>=r}return n=t,!0}({x:m,y:d},o)&&function(t){var e=performance.now();if(void 0===r)return r=e,!0;var n=e-r;return r=e,n<t}(o.waitNextTapTime)?u++:u=1,0==u%o.tapTimes?(o.state=a.RECOGNIZED,t.emit2(o.name,e,o),c()):i=setTimeout((function(){o.state=a.FAILED,c()}),o.waitNextTapTime)):(c(),o.state=a.FAILED)}})),o}var B={name:"pan",threshold:10,pointLength:1};function G(t,e){var n=y(B,e);return t.compute([X,N,w],(function(e){if(m(n),!E(n)){var r,i,o,a,u,c=(r=e.pointLength,i=e.distance,o=e.direction,a=e.phase,(d(u=n.state)||n.threshold<=i)&&n.pointLength===r&&void 0!==o||d(u)&&s===a);if(n.state=l(c,n.state,e.phase),c){var p=n.name;t.emit2(p,e,n),t.emit2(p+h(n.state),e,n)}}})),n}var Z={name:"swipe",threshold:10,velocity:.3,pointLength:1};function q(t,e){var n=y(Z,e);return t.compute([N,X,R],(function(e){if(n.state=a.POSSIBLE,!n.disabled&&function(){if(s!==e.phase)return!1;var t=e.velocityX,r=e.velocityY,i=e.distance;return e.maxPointLength===n.pointLength&&0===e.points.length&&n.threshold<i&&n.velocity<Math.max(t,r)}()){var r=n.name;n.state=a.RECOGNIZED,t.emit2(r,e,n),t.emit2(r+e.direction,e,n)}})),n}var H={name:"press",pointLength:1,maxDistance:9,minPressTime:251};function U(t,e){var n=y(H,e),r=0;return t.compute([N],(function(e){if(!E(n)){var i,o=e.phase,u=e.startInput,p=e.pointLength;if("start"===o&&n.pointLength===p)m(n),clearTimeout(r),r=setTimeout((function(){n.state=a.RECOGNIZED,t.emit2(n.name,e,n)}),n.minPressTime);else if(s===o&&a.RECOGNIZED===n.state)t.emit2(n.name+"up",e,n);else if(a.RECOGNIZED!==n.state){var v=e.timestamp-u.timestamp;(!((i=e.distance)&&n.maxDistance>i)||n.minPressTime>v&&[s,c].includes(o))&&(clearTimeout(r),n.state=a.FAILED)}}})),n}var k={name:"pinch",threshold:0,pointLength:2};function $(t,e){var n=y(k,e);return t.compute([Y,P],(function(e){if(m(n),!E(n)){var r,i,o,a,u=(r=e.pointLength,i=e.scale,o=e.deltaScale,a=e.phase,n.pointLength===r&&(void 0!==i&&void 0!==o&&n.threshold<Math.abs(i-1)||d(n.state))||d(n.state)&&[s,c].includes(a));n.state=l(u,n.state,e.phase);var p=n.name;u&&t.emit2(p,e,n);var v=h(n.state);v&&t.emit2(p+v,e,n)}})),n}var z={name:"rotate",threshold:0,pointLength:2};function J(t,e){var n=y(z,e);return t.compute([Y,C],(function(e){if(!E(n)){m(n);var r,i,o,a=(r=e.pointLength,i=e.angle,o=e.phase,n.pointLength===r&&(n.threshold<Math.abs(i)||d(n.state))||d(n.state)&&[s,c].includes(o));n.state=l(a,n.state,e.phase);var u=n.name;a&&t.emit2(u,e,n);var p=h(n.state);p&&t.emit2(u+p,e,n)}})),n}return function(t){function n(e,n){var r=t.call(this,e,n)||this;return r.use(j),r.use(G),r.use(q),r.use(U),r.use($),r.use(J),r}return e(n,t),n.version="2.0.0-alpha.3",n.STATE_POSSIBLE=a.POSSIBLE,n.STATE_START=a.START,n.STATE_MOVE=a.MOVE,n.STATE_END=a.END,n.STATE_CANCELLED=a.CANCELLED,n.STATE_FAILED=a.FAILED,n.STATE_RECOGNIZED=a.RECOGNIZED,n.tap=j,n.pan=G,n.swipe=q,n.press=U,n.rotate=J,n.pinch=$,n}(D)})); |
@@ -1,1 +0,2 @@ | ||
import{__extends as o}from"tslib";import t from"@any-touch/core";import r from"@any-touch/tap";import p from"@any-touch/pan";import a from"@any-touch/swipe";import e from"@any-touch/press";import i from"@any-touch/pinch";import n from"@any-touch/rotate";var u=function(t){function u(o,u){var m=t.call(this,o,u)||this;return m.use(r),m.use(p),m.use(a),m.use(e),m.use(i),m.use(n),m}return o(u,t),u.version="2.0.0-alpha.2",u.STATE_POSSIBLE=0,u.STATE_START=4,u.STATE_MOVE=5,u.STATE_END=1,u.STATE_CANCELLED=3,u.STATE_FAILED=2,u.STATE_RECOGNIZED=1,u.tap=r,u.pan=p,u.swipe=a,u.press=e,u.rotate=n,u.pinch=i,u}(t);export default u; | ||
import{__extends as o}from"tslib";import r from"@any-touch/core";import t from"@any-touch/tap";import E from"@any-touch/pan";import a from"@any-touch/swipe";import p from"@any-touch/press";import e from"@any-touch/pinch";import i from"@any-touch/rotate";import{STATE as n}from"@any-touch/shared";var u=function(r){function u(o,n){var u=r.call(this,o,n)||this;return u.use(t),u.use(E),u.use(a),u.use(p),u.use(e),u.use(i),u}return o(u,r),u.version="2.0.0-alpha.3",u.STATE_POSSIBLE=n.POSSIBLE,u.STATE_START=n.START,u.STATE_MOVE=n.MOVE,u.STATE_END=n.END,u.STATE_CANCELLED=n.CANCELLED,u.STATE_FAILED=n.FAILED,u.STATE_RECOGNIZED=n.RECOGNIZED,u.tap=t,u.pan=E,u.swipe=a,u.press=p,u.rotate=i,u.pinch=e,u}(r);export default u; | ||
//# sourceMappingURL=index.es.js.map |
@@ -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 r=require("tslib"),t=e(require("@any-touch/core")),u=e(require("@any-touch/tap")),n=e(require("@any-touch/pan")),a=e(require("@any-touch/swipe")),i=e(require("@any-touch/press")),s=e(require("@any-touch/pinch")),o=e(require("@any-touch/rotate")),c=function(e){function t(r,t){var c=e.call(this,r,t)||this;return c.use(u),c.use(n),c.use(a),c.use(i),c.use(s),c.use(o),c}return r.__extends(t,e),t.version="2.0.0-alpha.2",t.STATE_POSSIBLE=0,t.STATE_START=4,t.STATE_MOVE=5,t.STATE_END=1,t.STATE_CANCELLED=3,t.STATE_FAILED=2,t.STATE_RECOGNIZED=1,t.tap=u,t.pan=n,t.swipe=a,t.press=i,t.rotate=o,t.pinch=s,t}(t);exports.default=c; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=e(require("@any-touch/core")),u=e(require("@any-touch/tap")),T=e(require("@any-touch/pan")),E=e(require("@any-touch/swipe")),n=e(require("@any-touch/press")),a=e(require("@any-touch/pinch")),i=e(require("@any-touch/rotate")),s=require("@any-touch/shared"),o=function(e){function t(r,t){var s=e.call(this,r,t)||this;return s.use(u),s.use(T),s.use(E),s.use(n),s.use(a),s.use(i),s}return r.__extends(t,e),t.version="2.0.0-alpha.3",t.STATE_POSSIBLE=s.STATE.POSSIBLE,t.STATE_START=s.STATE.START,t.STATE_MOVE=s.STATE.MOVE,t.STATE_END=s.STATE.END,t.STATE_CANCELLED=s.STATE.CANCELLED,t.STATE_FAILED=s.STATE.FAILED,t.STATE_RECOGNIZED=s.STATE.RECOGNIZED,t.tap=u,t.pan=T,t.swipe=E,t.press=n,t.rotate=i,t.pinch=a,t}(t);exports.default=o; |
{ | ||
"name": "any-touch", | ||
"version": "2.0.0-alpha.3", | ||
"version": "2.0.0-alpha.4", | ||
"description": "一个小巧的手势库", | ||
@@ -25,10 +25,10 @@ "unpkg": "dist/any-touch.umd.min.js", | ||
"dependencies": { | ||
"@any-touch/core": "^2.0.0-alpha.3", | ||
"@any-touch/pan": "^2.0.0-alpha.3", | ||
"@any-touch/pinch": "^2.0.0-alpha.3", | ||
"@any-touch/press": "^2.0.0-alpha.3", | ||
"@any-touch/rotate": "^2.0.0-alpha.3", | ||
"@any-touch/swipe": "^2.0.0-alpha.3", | ||
"@any-touch/tap": "^2.0.0-alpha.3", | ||
"any-event": "^2.0.0-alpha.3", | ||
"@any-touch/core": "^2.0.0-alpha.4", | ||
"@any-touch/pan": "^2.0.0-alpha.4", | ||
"@any-touch/pinch": "^2.0.0-alpha.4", | ||
"@any-touch/press": "^2.0.0-alpha.4", | ||
"@any-touch/rotate": "^2.0.0-alpha.4", | ||
"@any-touch/swipe": "^2.0.0-alpha.4", | ||
"@any-touch/tap": "^2.0.0-alpha.4", | ||
"any-event": "^2.0.0-alpha.4", | ||
"tslib": "^2.3.1" | ||
@@ -42,3 +42,3 @@ }, | ||
"sideEffects": false, | ||
"gitHead": "090c02977d2540520f72ff80db445aaff91fd1bf" | ||
"gitHead": "0104cf40d492a3f7927d7f7d07e7ca66cf96f455" | ||
} |
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
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
65631
9
1073