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.23 to 1.10.24

2

base.d.ts

@@ -7,3 +7,3 @@ import type { Eventable } from '@interactjs/core/Eventable';

import { PointerEvent } from './PointerEvent';
export declare type EventTargetList = Array<{
export type EventTargetList = Array<{
node: Node;

@@ -10,0 +10,0 @@ eventable: Eventable;

@@ -50,3 +50,2 @@ import * as domUtils from "../utils/domUtils.js";

};
function fire(arg, scope) {

@@ -74,6 +73,4 @@ const {

};
for (let i = 0; i < targets.length; i++) {
const target = targets[i];
for (const prop in target.props || {}) {

@@ -83,13 +80,8 @@ ;

}
const origin = getOriginXY(target.eventable, target.node);
pointerEvent._subtractOrigin(origin);
pointerEvent.eventable = target.eventable;
pointerEvent.currentTarget = target.node;
target.eventable.fire(pointerEvent);
pointerEvent._addOrigin(origin);
if (pointerEvent.immediatePropagationStopped || pointerEvent.propagationStopped && i + 1 < targets.length && targets[i + 1].node !== pointerEvent.currentTarget) {

@@ -99,5 +91,3 @@ break;

}
scope.fire('pointerEvents:fired', signalArg);
if (type === 'tap') {

@@ -116,6 +106,4 @@ // if pointerEvent should make a double tap, create and fire a doubletap

}
return pointerEvent;
}
function collectEventTargets({

@@ -129,9 +117,10 @@ interaction,

const pointerIndex = interaction.getPointerIndex(pointer);
const pointerInfo = interaction.pointers[pointerIndex]; // do not fire a tap event if the pointer was moved before being lifted
const pointerInfo = interaction.pointers[pointerIndex];
if (type === 'tap' && (interaction.pointerWasMoved || // or if the pointerup target is different to the pointerdown target
// do not fire a tap event if the pointer was moved before being lifted
if (type === 'tap' && (interaction.pointerWasMoved ||
// or if the pointerup target is different to the pointerdown target
!(pointerInfo && pointerInfo.downTarget === eventTarget))) {
return [];
}
const path = domUtils.getPath(eventTarget);

@@ -148,3 +137,2 @@ const signalArg = {

};
for (const node of path) {

@@ -154,14 +142,10 @@ signalArg.node = node;

}
if (type === 'hold') {
signalArg.targets = signalArg.targets.filter(target => {
var _interaction$pointers, _interaction$pointers2;
return target.eventable.options.holdDuration === ((_interaction$pointers = interaction.pointers[pointerIndex]) == null ? void 0 : (_interaction$pointers2 = _interaction$pointers.hold) == null ? void 0 : _interaction$pointers2.duration);
});
}
return signalArg.targets;
}
function addInteractionProps({

@@ -171,6 +155,4 @@ interaction

interaction.prevTap = null; // the most recent tap event on this interaction
interaction.tapTime = 0; // time of the most recent tap event
}
function addHoldInfo({

@@ -183,3 +165,2 @@ down,

}
pointerInfo.hold = {

@@ -190,3 +171,2 @@ duration: Infinity,

}
function clearHold({

@@ -197,3 +177,2 @@ interaction,

const hold = interaction.pointers[pointerIndex].hold;
if (hold && hold.timeout) {

@@ -204,3 +183,2 @@ clearTimeout(hold.timeout);

}
function moveAndClearHold(arg, scope) {

@@ -214,3 +192,2 @@ const {

} = arg;
if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) {

@@ -220,3 +197,2 @@ if (interaction.pointerIsDown) {

}
fire({

@@ -231,3 +207,2 @@ interaction,

}
function downAndStartHold({

@@ -252,3 +227,2 @@ interaction,

};
for (const node of path) {

@@ -258,9 +232,6 @@ signalArg.node = node;

}
if (!signalArg.targets.length) return;
let minDuration = Infinity;
for (const target of signalArg.targets) {
const holdDuration = target.eventable.options.holdDuration;
if (holdDuration < minDuration) {

@@ -270,3 +241,2 @@ minDuration = holdDuration;

}
timer.duration = minDuration;

@@ -283,3 +253,2 @@ timer.timeout = setTimeout(() => {

}
function tapAfterUp({

@@ -301,3 +270,2 @@ interaction,

}
function install(scope) {

@@ -308,4 +276,3 @@ scope.pointerEvents = pointerEvents;

}
export default pointerEvents;
//# sourceMappingURL=base.js.map

@@ -10,8 +10,8 @@ /* eslint-disable import/no-duplicates -- for typescript module augmentations */

pointerEvents
} = scope; // don't repeat by default
} = scope;
// don't repeat by default
pointerEvents.defaults.holdRepeatInterval = 0;
pointerEvents.types.holdrepeat = scope.actions.phaselessTypes.holdrepeat = true;
}
function onNew({

@@ -23,3 +23,2 @@ pointerEvent

}
function onFired({

@@ -31,8 +30,11 @@ interaction,

}, scope) {
if (pointerEvent.type !== 'hold' || !targets.length) return; // get the repeat interval from the first eventable
if (pointerEvent.type !== 'hold' || !targets.length) return;
const interval = targets[0].eventable.options.holdRepeatInterval; // don't repeat if the interval is 0 or less
// get the repeat interval from the first eventable
const interval = targets[0].eventable.options.holdRepeatInterval;
if (interval <= 0) return; // set a timeout to fire the holdrepeat event
// don't repeat if the interval is 0 or less
if (interval <= 0) return;
// set a timeout to fire the holdrepeat event
interaction.holdIntervalHandle = setTimeout(() => {

@@ -48,3 +50,2 @@ scope.pointerEvents.fire({

}
function endHoldRepeat({

@@ -60,3 +61,2 @@ interaction

}
const holdRepeat = {

@@ -63,0 +63,0 @@ id: 'pointer-events/holdRepeat',

@@ -1,11 +0,9 @@

import type { Interactable } from '@interactjs/core/Interactable';
import type { Plugin } from '@interactjs/core/scope';
import type { PointerEventOptions } from '@interactjs/pointer-events/base';
declare module '@interactjs/core/Interactable' {
interface Interactable {
pointerEvents: typeof pointerEventsMethod;
__backCompatOption: (optionName: string, newValue: any) => any;
pointerEvents(options: Partial<PointerEventOptions>): this;
}
}
declare function pointerEventsMethod(this: Interactable, options: any): Interactable;
declare const plugin: Plugin;
export default plugin;
import extend from "../utils/extend.js";
function install(scope) {

@@ -7,21 +6,15 @@ const {

} = scope;
Interactable.prototype.pointerEvents = pointerEventsMethod;
Interactable.prototype.pointerEvents = function (options) {
extend(this.events.options, options);
return this;
};
const __backCompatOption = Interactable.prototype._backCompatOption;
Interactable.prototype._backCompatOption = function (optionName, newValue) {
const ret = __backCompatOption.call(this, optionName, newValue);
if (ret === this) {
this.events.options[optionName] = newValue;
}
return ret;
};
}
function pointerEventsMethod(options) {
extend(this.events.options, options);
return this;
}
const plugin = {

@@ -40,3 +33,2 @@ id: 'pointer-events/interactableTargets',

const options = eventable.options;
if (eventable.types[type] && eventable.types[type].length && interactable.testIgnoreAllow(options, node, eventTarget)) {

@@ -43,0 +35,0 @@ targets.push({

@@ -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 t from"../utils/extend.prod.js";const e={id:"pointer-events/interactableTargets",install(e){const{Interactable:n}=e;n.prototype.pointerEvents=function(e){return t(this.events.options,e),this};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 e;
//# sourceMappingURL=interactableTargets.prod.js.map
{
"name": "@interactjs/pointer-events",
"version": "1.10.23",
"version": "1.10.24",
"main": "index",

@@ -13,7 +13,7 @@ "module": "index",

"peerDependencies": {
"@interactjs/core": "1.10.23",
"@interactjs/utils": "1.10.23"
"@interactjs/core": "1.10.24",
"@interactjs/utils": "1.10.24"
},
"optionalDependencies": {
"@interactjs/interact": "1.10.23"
"@interactjs/interact": "1.10.24"
},

@@ -28,3 +28,3 @@ "publishConfig": {

"license": "MIT",
"gitHead": "9ba48631"
"gitHead": "86c64a3f"
}

@@ -12,3 +12,2 @@ /* eslint-disable import/no-duplicates -- for typescript module augmentations */

id: 'pointer-events',
install(scope) {

@@ -19,5 +18,4 @@ scope.usePlugin(pointerEvents);

}
};
export default plugin;
//# sourceMappingURL=plugin.js.map
import { BaseEvent } from '@interactjs/core/BaseEvent';
import type Interaction from '@interactjs/core/Interaction';
import type { PointerEventType, PointerType, Point } from '@interactjs/core/types';
export default class PointerEvent<T extends string = any> extends BaseEvent<never> {
export declare class PointerEvent<T extends string = any> extends BaseEvent<never> {
type: T;

@@ -17,3 +17,2 @@ originalEvent: PointerEventType;

[key: string]: any;
/** */
constructor(type: T, pointer: PointerType | PointerEvent<any>, event: PointerEventType, eventTarget: Node, interaction: Interaction<never>, timeStamp: number);

@@ -27,2 +26,1 @@ _subtractOrigin({ x: originX, y: originY }: Point): this;

}
export { PointerEvent };
import { BaseEvent } from "../core/BaseEvent.js";
import * as pointerUtils from "../utils/pointerUtils.js";
export default class PointerEvent extends BaseEvent {
/** */
export class PointerEvent extends BaseEvent {
constructor(type, pointer, event, eventTarget, interaction, timeStamp) {
super(interaction);
pointerUtils.pointerExtend(this, event);
if (event !== pointer) {
pointerUtils.pointerExtend(this, pointer);
}
this.timeStamp = timeStamp;

@@ -20,3 +17,2 @@ this.originalEvent = event;

this.currentTarget = null;
if (type === 'tap') {

@@ -32,3 +28,2 @@ const pointerIndex = interaction.getPointerIndex(pointer);

}
_subtractOrigin({

@@ -44,3 +39,2 @@ x: originX,

}
_addOrigin({

@@ -56,13 +50,10 @@ x: originX,

}
/**
* Prevent the default behaviour of the original Event
*/
preventDefault() {
this.originalEvent.preventDefault();
}
}
export { PointerEvent };
//# sourceMappingURL=PointerEvent.js.map

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

import{BaseEvent as t}from"../core/BaseEvent.prod.js";import*as e from"../utils/pointerUtils.prod.js";export default class i extends t{constructor(t,i,s,r,p,n){if(super(p),e.pointerExtend(this,s),s!==i&&e.pointerExtend(this,i),this.timeStamp=n,this.originalEvent=s,this.type=t,this.pointerId=e.getPointerId(i),this.pointerType=e.getPointerType(i),this.target=r,this.currentTarget=null,"tap"===t){const t=p.getPointerIndex(i);this.dt=this.timeStamp-p.pointers[t].downTime;const e=this.timeStamp-p.tapTime;this.double=!!p.prevTap&&"doubletap"!==p.prevTap.type&&p.prevTap.target===this.target&&e<500}else"doubletap"===t&&(this.dt=i.timeStamp-p.tapTime,this.double=!0)}_subtractOrigin({x:t,y:e}){return this.pageX-=t,this.pageY-=e,this.clientX-=t,this.clientY-=e,this}_addOrigin({x:t,y:e}){return this.pageX+=t,this.pageY+=e,this.clientX+=t,this.clientY+=e,this}preventDefault(){this.originalEvent.preventDefault()}}export{i as PointerEvent};
import{BaseEvent as t}from"../core/BaseEvent.prod.js";import*as e from"../utils/pointerUtils.prod.js";export class PointerEvent extends t{constructor(t,i,s,r,p,n){if(super(p),e.pointerExtend(this,s),s!==i&&e.pointerExtend(this,i),this.timeStamp=n,this.originalEvent=s,this.type=t,this.pointerId=e.getPointerId(i),this.pointerType=e.getPointerType(i),this.target=r,this.currentTarget=null,"tap"===t){const t=p.getPointerIndex(i);this.dt=this.timeStamp-p.pointers[t].downTime;const e=this.timeStamp-p.tapTime;this.double=!!p.prevTap&&"doubletap"!==p.prevTap.type&&p.prevTap.target===this.target&&e<500}else"doubletap"===t&&(this.dt=i.timeStamp-p.tapTime,this.double=!0)}_subtractOrigin({x:t,y:e}){return this.pageX-=t,this.pageY-=e,this.clientX-=t,this.clientY-=e,this}_addOrigin({x:t,y:e}){return this.pageX+=t,this.pageY+=e,this.clientX+=t,this.clientY+=e,this}preventDefault(){this.originalEvent.preventDefault()}}
//# sourceMappingURL=PointerEvent.prod.js.map

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

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