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

@interactjs/pointer-events

Package Overview
Dependencies
Maintainers
2
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interactjs/pointer-events - npm Package Compare versions

Comparing version 1.10.1 to 1.10.2

2

base.js
import { Interaction } from "../core/Interaction.js";
import { Scope } from "../core/scope.js";
import { Scope, SignalArgs } from "../core/scope.js";
import * as domUtils from "../utils/domUtils.js";

@@ -4,0 +4,0 @@ import extend from "../utils/extend.js";

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

import{Interaction as t}from"../core/Interaction.prod.js";import{Scope as e}from"../core/scope.prod.js";import*as n from"../utils/domUtils.prod.js";import o from"../utils/extend.prod.js";import r from"../utils/getOriginXY.prod.js";import{PointerEvent as i}from"./PointerEvent.prod.js";const a={id:"pointer-events/base",before:["inertia","modifiers","auto-start","actions"],install(t){t.pointerEvents=a,t.defaults.actions.pointerEvents=a.defaults,o(t.actions.phaselessTypes,a.types)},listeners:{"interactions:new"({interaction:t}){t.prevTap=null,t.tapTime=0},"interactions:update-pointer"({down:t,pointerInfo:e}){!t&&e.hold||(e.hold={duration:1/0,timeout:null})},"interactions:move"(t,e){const{interaction:n,pointer:o,event:r,eventTarget:i,duplicate:a}=t;a||n.pointerIsDown&&!n.pointerWasMoved||(n.pointerIsDown&&l(t),p({interaction:n,pointer:o,event:r,eventTarget:i,type:"move"},e))},"interactions:down"(t,e){(({interaction:t,pointer:e,event:o,eventTarget:r,pointerIndex:i},a)=>{const s=t.pointers[i].hold,l=n.getPath(r),c={interaction:t,pointer:e,event:o,eventTarget:r,type:"hold",targets:[],path:l,node:null};for(const t of l)c.node=t,a.fire("pointerEvents:collect-targets",c);if(!c.targets.length)return;let d=1/0;for(const t of c.targets){const e=t.eventable.options.holdDuration;e<d&&(d=e)}s.duration=d,s.timeout=setTimeout(()=>{p({interaction:t,eventTarget:r,pointer:e,event:o,type:"hold"},a)},d)})(t,e),p(t,e)},"interactions:up"(t,e){l(t),p(t,e),(({interaction:t,pointer:e,event:n,eventTarget:o},r)=>{t.pointerWasMoved||p({interaction:t,eventTarget:o,pointer:e,event:n,type:"tap"},r)})(t,e)},"interactions:cancel"(t,e){l(t),p(t,e)}},PointerEvent:i,fire:p,collectEventTargets:s,defaults:{holdDuration:600,ignoreFrom:null,allowFrom:null,origin:{x:0,y:0}},types:{down:!0,move:!0,up:!0,cancel:!0,tap:!0,doubletap:!0,hold:!0}};function p(t,e){const{interaction:n,pointer:o,event:a,eventTarget:l,type:c,targets:d=s(t,e)}=t,v=new i(c,o,a,l,n,e.now());e.fire("pointerEvents:new",{pointerEvent:v});const u={interaction:n,pointer:o,event:a,eventTarget:l,targets:d,type:c,pointerEvent:v};for(let t=0;t<d.length;t++){const e=d[t];for(const t in e.props||{})v[t]=e.props[t];const n=r(e.eventable,e.node);if(v._subtractOrigin(n),v.eventable=e.eventable,v.currentTarget=e.node,e.eventable.fire(v),v._addOrigin(n),v.immediatePropagationStopped||v.propagationStopped&&t+1<d.length&&d[t+1].node!==v.currentTarget)break}if(e.fire("pointerEvents:fired",u),"tap"===c){const t=v.double?p({interaction:n,pointer:o,event:a,eventTarget:l,type:"doubletap"},e):v;n.prevTap=t,n.tapTime=t.timeStamp}return v}function s({interaction:t,pointer:e,event:o,eventTarget:r,type:i},a){const p=t.getPointerIndex(e),s=t.pointers[p];if("tap"===i&&(t.pointerWasMoved||!s||s.downTarget!==r))return[];const l=n.getPath(r),c={interaction:t,pointer:e,event:o,eventTarget:r,type:i,path:l,targets:[],node:null};for(const t of l)c.node=t,a.fire("pointerEvents:collect-targets",c);return"hold"===i&&(c.targets=c.targets.filter(e=>e.eventable.options.holdDuration===t.pointers[p].hold.duration)),c.targets}function l({interaction:t,pointerIndex:e}){const n=t.pointers[e].hold;n&&n.timeout&&(clearTimeout(n.timeout),n.timeout=null)}export default a;
import{Interaction as t}from"../core/Interaction.prod.js";import{Scope as e,SignalArgs as n}from"../core/scope.prod.js";import*as o from"../utils/domUtils.prod.js";import r from"../utils/extend.prod.js";import i from"../utils/getOriginXY.prod.js";import{PointerEvent as a}from"./PointerEvent.prod.js";const p={id:"pointer-events/base",before:["inertia","modifiers","auto-start","actions"],install(t){t.pointerEvents=p,t.defaults.actions.pointerEvents=p.defaults,r(t.actions.phaselessTypes,p.types)},listeners:{"interactions:new"({interaction:t}){t.prevTap=null,t.tapTime=0},"interactions:update-pointer"({down:t,pointerInfo:e}){!t&&e.hold||(e.hold={duration:1/0,timeout:null})},"interactions:move"(t,e){const{interaction:n,pointer:o,event:r,eventTarget:i,duplicate:a}=t;a||n.pointerIsDown&&!n.pointerWasMoved||(n.pointerIsDown&&c(t),s({interaction:n,pointer:o,event:r,eventTarget:i,type:"move"},e))},"interactions:down"(t,e){(({interaction:t,pointer:e,event:n,eventTarget:r,pointerIndex:i},a)=>{const p=t.pointers[i].hold,l=o.getPath(r),c={interaction:t,pointer:e,event:n,eventTarget:r,type:"hold",targets:[],path:l,node:null};for(const t of l)c.node=t,a.fire("pointerEvents:collect-targets",c);if(!c.targets.length)return;let d=1/0;for(const t of c.targets){const e=t.eventable.options.holdDuration;e<d&&(d=e)}p.duration=d,p.timeout=setTimeout((()=>{s({interaction:t,eventTarget:r,pointer:e,event:n,type:"hold"},a)}),d)})(t,e),s(t,e)},"interactions:up"(t,e){c(t),s(t,e),(({interaction:t,pointer:e,event:n,eventTarget:o},r)=>{t.pointerWasMoved||s({interaction:t,eventTarget:o,pointer:e,event:n,type:"tap"},r)})(t,e)},"interactions:cancel"(t,e){c(t),s(t,e)}},PointerEvent:a,fire:s,collectEventTargets:l,defaults:{holdDuration:600,ignoreFrom:null,allowFrom:null,origin:{x:0,y:0}},types:{down:!0,move:!0,up:!0,cancel:!0,tap:!0,doubletap:!0,hold:!0}};function s(t,e){const{interaction:n,pointer:o,event:r,eventTarget:p,type:c,targets:d=l(t,e)}=t,v=new a(c,o,r,p,n,e.now());e.fire("pointerEvents:new",{pointerEvent:v});const u={interaction:n,pointer:o,event:r,eventTarget:p,targets:d,type:c,pointerEvent:v};for(let t=0;t<d.length;t++){const e=d[t];for(const t in e.props||{})v[t]=e.props[t];const n=i(e.eventable,e.node);if(v._subtractOrigin(n),v.eventable=e.eventable,v.currentTarget=e.node,e.eventable.fire(v),v._addOrigin(n),v.immediatePropagationStopped||v.propagationStopped&&t+1<d.length&&d[t+1].node!==v.currentTarget)break}if(e.fire("pointerEvents:fired",u),"tap"===c){const t=v.double?s({interaction:n,pointer:o,event:r,eventTarget:p,type:"doubletap"},e):v;n.prevTap=t,n.tapTime=t.timeStamp}return v}function l({interaction:t,pointer:e,event:n,eventTarget:r,type:i},a){const p=t.getPointerIndex(e),s=t.pointers[p];if("tap"===i&&(t.pointerWasMoved||!s||s.downTarget!==r))return[];const l=o.getPath(r),c={interaction:t,pointer:e,event:n,eventTarget:r,type:i,path:l,targets:[],node:null};for(const t of l)c.node=t,a.fire("pointerEvents:collect-targets",c);return"hold"===i&&(c.targets=c.targets.filter((e=>e.eventable.options.holdDuration===t.pointers[p].hold.duration))),c.targets}function c({interaction:t,pointerIndex:e}){const n=t.pointers[e].hold;n&&n.timeout&&(clearTimeout(n.timeout),n.timeout=null)}export default p;
//# sourceMappingURL=base.prod.js.map

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

import Interaction from "../core/Interaction.js";
import PointerEvent from "./PointerEvent.js";

@@ -2,0 +3,0 @@ import basePlugin from "./base.js";

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

import e from"./PointerEvent.prod.js";import t from"./base.prod.js";function n({interaction:e}){e.holdIntervalHandle&&(clearInterval(e.holdIntervalHandle),e.holdIntervalHandle=null)}const o={id:"pointer-events/holdRepeat",install(e){e.usePlugin(t);const{pointerEvents:n}=e;n.defaults.holdRepeatInterval=0,n.types.holdrepeat=e.actions.phaselessTypes.holdrepeat=!0},listeners:["move","up","cancel","endall"].reduce((e,t)=>(e["pointerEvents:"+t]=n,e),{"pointerEvents:new"({pointerEvent:e}){"hold"===e.type&&(e.count=(e.count||0)+1)},"pointerEvents:fired"({interaction:e,pointerEvent:t,eventTarget:n,targets:o},r){if("hold"!==t.type||!o.length)return;const l=o[0].eventable.options.holdRepeatInterval;l<=0||(e.holdIntervalHandle=setTimeout(()=>{r.pointerEvents.fire({interaction:e,eventTarget:n,type:"hold",pointer:t,event:t},r)},l))}})};export default o;
import e from"../core/Interaction.prod.js";import t from"./PointerEvent.prod.js";import n from"./base.prod.js";function o({interaction:e}){e.holdIntervalHandle&&(clearInterval(e.holdIntervalHandle),e.holdIntervalHandle=null)}const r={id:"pointer-events/holdRepeat",install(e){e.usePlugin(n);const{pointerEvents:t}=e;t.defaults.holdRepeatInterval=0,t.types.holdrepeat=e.actions.phaselessTypes.holdrepeat=!0},listeners:["move","up","cancel","endall"].reduce(((e,t)=>(e["pointerEvents:"+t]=o,e)),{"pointerEvents:new"({pointerEvent:e}){"hold"===e.type&&(e.count=(e.count||0)+1)},"pointerEvents:fired"({interaction:e,pointerEvent:t,eventTarget:n,targets:o},r){if("hold"!==t.type||!o.length)return;const l=o[0].eventable.options.holdRepeatInterval;l<=0||(e.holdIntervalHandle=setTimeout((()=>{r.pointerEvents.fire({interaction:e,eventTarget:n,type:"hold",pointer:t,event:t},r)}),l))}})};export default r;
//# sourceMappingURL=holdRepeat.prod.js.map

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

import { Interactable } from "../core/Interactable.js";
import extend from "../utils/extend.js";

@@ -2,0 +3,0 @@

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

import t from"../utils/extend.prod.js";function e(e){return t(this.events.options,e),this}const n={id:"pointer-events/interactableTargets",install(t){const{Interactable:n}=t;n.prototype.pointerEvents=e;const o=n.prototype._backCompatOption;n.prototype._backCompatOption=function(t,e){const n=o.call(this,t,e);return n===this&&(this.events.options[t]=e),n}},listeners:{"pointerEvents:collect-targets"({targets:t,node:e,type:n,eventTarget:o},s){s.interactables.forEachMatch(e,s=>{const i=s.events,r=i.options;i.types[n]&&i.types[n].length&&s.testIgnoreAllow(r,e,o)&&t.push({node:e,eventable:i,props:{interactable:s}})})},"interactable:new"({interactable:t}){t.events.getRect=e=>t.getRect(e)},"interactable:set"({interactable:e,options:n},o){t(e.events.options,o.pointerEvents.defaults),t(e.events.options,n.pointerEvents||{})}}};export default n;
import{Interactable as t}from"../core/Interactable.prod.js";import e from"../utils/extend.prod.js";function n(t){return e(this.events.options,t),this}const o={id:"pointer-events/interactableTargets",install(t){const{Interactable:e}=t;e.prototype.pointerEvents=n;const o=e.prototype._backCompatOption;e.prototype._backCompatOption=function(t,e){const n=o.call(this,t,e);return n===this&&(this.events.options[t]=e),n}},listeners:{"pointerEvents:collect-targets"({targets:t,node:e,type:n,eventTarget:o},s){s.interactables.forEachMatch(e,(s=>{const r=s.events,a=r.options;r.types[n]&&r.types[n].length&&s.testIgnoreAllow(a,e,o)&&t.push({node:e,eventable:r,props:{interactable:s}})}))},"interactable:new"({interactable:t}){t.events.getRect=e=>t.getRect(e)},"interactable:set"({interactable:t,options:n},o){e(t.events.options,o.pointerEvents.defaults),e(t.events.options,n.pointerEvents||{})}}};export default o;
//# sourceMappingURL=interactableTargets.prod.js.map
{
"name": "@interactjs/pointer-events",
"version": "1.10.1",
"version": "1.10.2",
"license": "MIT",
"peerDependencies": {
"@interactjs/core": "1.10.1",
"@interactjs/utils": "1.10.1"
"@interactjs/core": "1.10.2",
"@interactjs/utils": "1.10.2"
},
"optionalDependencies": {
"@interactjs/interact": "1.10.1"
"@interactjs/interact": "1.10.2"
},

@@ -12,0 +12,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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