Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@any-touch/recognizer

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@any-touch/recognizer - npm Package Compare versions

Comparing version 0.6.0-beta.30 to 0.6.1-beta.0

9

dist/index.dev.js

@@ -39,2 +39,3 @@ 'use strict';

_e[shared.STATUS_MOVE] = (_g = {},
_g[shared.INPUT_START] = shared.STATUS_FAILED,
_g[shared.INPUT_MOVE] = shared.STATUS_CANCELLED,

@@ -59,8 +60,8 @@ _g[shared.INPUT_END] = shared.STATUS_END,

var computed = recognizer.computed;
recognizer.isRecognized = -1 < [shared.STATUS_START, shared.STATUS_MOVE, shared.STATUS_END, shared.STATUS_CANCELLED, shared.STATUS_RECOGNIZED].indexOf(recognizer.status);
recognizer.isRecognized = [shared.STATUS_START, shared.STATUS_MOVE].includes(recognizer.status);
var name = recognizer.name, status = recognizer.status, isRecognized = recognizer.isRecognized;
if (isRecognized) {
if (shared.INPUT_END !== inputType) {
emit(name, computed);
}
emit(name, computed);
}
if (isRecognized || [shared.STATUS_END, shared.STATUS_CANCELLED].includes(recognizer.status)) {
emit(name + status, computed);

@@ -67,0 +68,0 @@ }

import { __assign, __values, __spread } from 'tslib';
import { STATUS_END, STATUS_CANCELLED, STATUS_RECOGNIZED, STATUS_FAILED, STATUS_POSSIBLE, STATUS_START, STATUS_MOVE, INPUT_END, INPUT_MOVE, INPUT_CANCEL } from '@any-touch/shared';
import { STATUS_END, STATUS_CANCELLED, STATUS_RECOGNIZED, STATUS_FAILED, STATUS_POSSIBLE, STATUS_START, STATUS_MOVE, INPUT_MOVE, INPUT_END, INPUT_CANCEL, INPUT_START } from '@any-touch/shared';

@@ -35,2 +35,3 @@ function resetStatus (recognizer) {

_e[STATUS_MOVE] = (_g = {},
_g[INPUT_START] = STATUS_FAILED,
_g[INPUT_MOVE] = STATUS_CANCELLED,

@@ -55,8 +56,8 @@ _g[INPUT_END] = STATUS_END,

var computed = recognizer.computed;
recognizer.isRecognized = -1 < [STATUS_START, STATUS_MOVE, STATUS_END, STATUS_CANCELLED, STATUS_RECOGNIZED].indexOf(recognizer.status);
recognizer.isRecognized = [STATUS_START, STATUS_MOVE].includes(recognizer.status);
var name = recognizer.name, status = recognizer.status, isRecognized = recognizer.isRecognized;
if (isRecognized) {
if (INPUT_END !== inputType) {
emit(name, computed);
}
emit(name, computed);
}
if (isRecognized || [STATUS_END, STATUS_CANCELLED].includes(recognizer.status)) {
emit(name + status, computed);

@@ -63,0 +64,0 @@ }

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib=require("tslib"),shared=require("@any-touch/shared");function resetStatus(e){-1!==[shared.STATUS_END,shared.STATUS_CANCELLED,shared.STATUS_RECOGNIZED,shared.STATUS_FAILED].indexOf(e.status)&&(e.status=shared.STATUS_POSSIBLE)}function flow(e,s,t){var r,a,T,i,o,d,S,h={1:(r={},r[shared.STATUS_POSSIBLE]=(a={},a[shared.INPUT_MOVE]=shared.STATUS_START,a),r[shared.STATUS_START]=(T={},T[shared.INPUT_MOVE]=shared.STATUS_MOVE,T[shared.INPUT_END]=shared.STATUS_END,T[shared.INPUT_CANCEL]=shared.STATUS_CANCELLED,T),r[shared.STATUS_MOVE]=(i={},i[shared.INPUT_MOVE]=shared.STATUS_MOVE,i[shared.INPUT_END]=shared.STATUS_END,i[shared.INPUT_CANCEL]=shared.STATUS_CANCELLED,i),r),0:(o={},o[shared.STATUS_START]=(d={},d[shared.INPUT_MOVE]=shared.STATUS_CANCELLED,d[shared.INPUT_END]=shared.STATUS_END,d[shared.INPUT_CANCEL]=shared.STATUS_CANCELLED,d),o[shared.STATUS_MOVE]=(S={},S[shared.INPUT_MOVE]=shared.STATUS_CANCELLED,S[shared.INPUT_END]=shared.STATUS_END,S[shared.INPUT_CANCEL]=shared.STATUS_CANCELLED,S),o)};return void 0!==h[Number(e)][s]&&h[Number(e)][s][t]||s}function recognizeForPressMoveLike(e,s,t){var r=e.test(s);resetStatus(e);var a=s.inputType;e.status=flow(r,e.status,a);var T=e.computed;e.isRecognized=-1<[shared.STATUS_START,shared.STATUS_MOVE,shared.STATUS_END,shared.STATUS_CANCELLED,shared.STATUS_RECOGNIZED].indexOf(e.status);var i=e.name,o=e.status;return e.isRecognized&&(shared.INPUT_END!==a&&t(i,T),t(i+o,T)),r}var default_1=function(){function e(e){this.options=e,this.name=this.options.name,this.disabled=!1,this.status=shared.STATUS_POSSIBLE,this.isRecognized=!1,this.computed={},this.computedGroup={},this.usedComputeFunctionMap={},this.recognizerMap={}}return e.prototype.set=function(e){return void 0!==e&&(this.options=tslib.__assign(tslib.__assign({},this.options),e)),this},e.prototype.isValidPointLength=function(e){return 0===this.options.pointLength||this.options.pointLength===e},e.prototype.compute=function(e){for(var s,t,r,a=[],T=1;T<arguments.length;T++)a[T-1]=arguments[T];var i=Object.create(null);try{for(var o=tslib.__values(e),d=o.next();!d.done;d=o.next()){var S=d.value,h=S._id,n=this,_=n.computedGroup,u=n.usedComputeFunctionMap;void 0===u[h]&&(u[h]=new S),_[h]=_[h]||(r=u[h]).compute.apply(r,tslib.__spread(a)),i=tslib.__assign(tslib.__assign({},i),_[h])}}catch(e){s={error:e}}finally{try{d&&!d.done&&(t=o.return)&&t.call(o)}finally{if(s)throw s.error}}return this.computed=i,i},e}();exports.default=default_1,exports.recognizeForPressMoveLike=recognizeForPressMoveLike,exports.resetStatusForPressMoveLike=resetStatus;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib=require("tslib"),shared=require("@any-touch/shared");function resetStatus(e){-1!==[shared.STATUS_END,shared.STATUS_CANCELLED,shared.STATUS_RECOGNIZED,shared.STATUS_FAILED].indexOf(e.status)&&(e.status=shared.STATUS_POSSIBLE)}function flow(e,s,t){var r,a,T,i,o,d,S,h={1:(r={},r[shared.STATUS_POSSIBLE]=(a={},a[shared.INPUT_MOVE]=shared.STATUS_START,a),r[shared.STATUS_START]=(T={},T[shared.INPUT_MOVE]=shared.STATUS_MOVE,T[shared.INPUT_END]=shared.STATUS_END,T[shared.INPUT_CANCEL]=shared.STATUS_CANCELLED,T),r[shared.STATUS_MOVE]=(i={},i[shared.INPUT_MOVE]=shared.STATUS_MOVE,i[shared.INPUT_END]=shared.STATUS_END,i[shared.INPUT_CANCEL]=shared.STATUS_CANCELLED,i),r),0:(o={},o[shared.STATUS_START]=(d={},d[shared.INPUT_MOVE]=shared.STATUS_CANCELLED,d[shared.INPUT_END]=shared.STATUS_END,d[shared.INPUT_CANCEL]=shared.STATUS_CANCELLED,d),o[shared.STATUS_MOVE]=(S={},S[shared.INPUT_START]=shared.STATUS_FAILED,S[shared.INPUT_MOVE]=shared.STATUS_CANCELLED,S[shared.INPUT_END]=shared.STATUS_END,S[shared.INPUT_CANCEL]=shared.STATUS_CANCELLED,S),o)};return void 0!==h[Number(e)][s]&&h[Number(e)][s][t]||s}function recognizeForPressMoveLike(e,s,t){var r=e.test(s);resetStatus(e);var a=s.inputType;e.status=flow(r,e.status,a);var T=e.computed;e.isRecognized=[shared.STATUS_START,shared.STATUS_MOVE].includes(e.status);var i=e.name,o=e.status,d=e.isRecognized;return d&&t(i,T),(d||[shared.STATUS_END,shared.STATUS_CANCELLED].includes(e.status))&&t(i+o,T),r}var default_1=function(){function e(e){this.options=e,this.name=this.options.name,this.disabled=!1,this.status=shared.STATUS_POSSIBLE,this.isRecognized=!1,this.computed={},this.computedGroup={},this.usedComputeFunctionMap={},this.recognizerMap={}}return e.prototype.set=function(e){return void 0!==e&&(this.options=tslib.__assign(tslib.__assign({},this.options),e)),this},e.prototype.isValidPointLength=function(e){return 0===this.options.pointLength||this.options.pointLength===e},e.prototype.compute=function(e){for(var s,t,r,a=[],T=1;T<arguments.length;T++)a[T-1]=arguments[T];var i=Object.create(null);try{for(var o=tslib.__values(e),d=o.next();!d.done;d=o.next()){var S=d.value,h=S._id,n=this,_=n.computedGroup,u=n.usedComputeFunctionMap;void 0===u[h]&&(u[h]=new S),_[h]=_[h]||(r=u[h]).compute.apply(r,tslib.__spread(a)),i=tslib.__assign(tslib.__assign({},i),_[h])}}catch(e){s={error:e}}finally{try{d&&!d.done&&(t=o.return)&&t.call(o)}finally{if(s)throw s.error}}return this.computed=i,i},e}();exports.default=default_1,exports.recognizeForPressMoveLike=recognizeForPressMoveLike,exports.resetStatusForPressMoveLike=resetStatus;
{
"name": "@any-touch/recognizer",
"version": "0.6.0-beta.30",
"version": "0.6.1-beta.0",
"description": "any-touch的识别器的基类.",

@@ -17,3 +17,3 @@ "main": "./dist/index",

"sideEffects": false,
"gitHead": "72c35289e4996e7a568625595c8b1fd05728eadb"
"gitHead": "a52710e715405ebc0e70c265f5db341bb427fb23"
}

@@ -1,2 +0,2 @@

import { CommonEmitFunction, Input } from '@any-touch/shared';
import { CommonEmitFunction, Input, STATUS_FAILED } from '@any-touch/shared';
import Recognizer from './index';

@@ -13,3 +13,3 @@ import {

STATUS_CANCELLED,
STATUS_RECOGNIZED
INPUT_START
} from '@any-touch/shared'

@@ -46,2 +46,3 @@ import resetStatus from './resetStatusForPressMoveLike';

[STATUS_START]: {
// [INPUT_START]: STATUS_FAILED,
[INPUT_MOVE]: STATUS_CANCELLED,

@@ -52,2 +53,3 @@ [INPUT_END]: STATUS_END,

[STATUS_MOVE]: {
[INPUT_START]: STATUS_FAILED,
[INPUT_MOVE]: STATUS_CANCELLED,

@@ -87,15 +89,11 @@ [INPUT_END]: STATUS_END,

// 是否已识别, 包含end
recognizer.isRecognized = -1 < [STATUS_START, STATUS_MOVE, STATUS_END,STATUS_CANCELLED, STATUS_RECOGNIZED].indexOf(recognizer.status);
recognizer.isRecognized = [STATUS_START, STATUS_MOVE].includes(recognizer.status);
const {name, status,isRecognized} = recognizer;
// console.log({status,inputType,isRecognized,isVaild})
const { name, status, isRecognized } = recognizer;
// if('pan' == name) console.warn(status,inputType,{isRecognized,isVaild},input.pointLength)
// 识别后触发的事件
if (isRecognized) {
// panend等
if(INPUT_END !== inputType){
emit(name, computed);
}
// console.log(recognizer.name)
emit(name, computed);
}
if (isRecognized || [STATUS_END, STATUS_CANCELLED].includes(recognizer.status)) {
emit(name + status, computed);

@@ -102,0 +100,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc