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

@interactjs/core

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/core - npm Package Compare versions

Comparing version 1.9.2 to 1.9.3

2

Eventable.min.js

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

import*as t from"../utils/arr.min.js";import o from"../utils/extend.min.js";import i from"../utils/normalizeListeners.min.js";function s(t,o){for(const i of o){if(t.immediatePropagationStopped)break;i(t)}}export default class Eventable{constructor(t){this.options=void 0,this.types={},this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.global=void 0,this.options=o({},t||{})}fire(t){let o;const i=this.global;(o=this.types[t.type])&&s(t,o),!t.propagationStopped&&i&&(o=i[t.type])&&s(t,o)}on(o,s){const e=i(o,s);for(o in e)this.types[o]=t.merge(this.types[o]||[],e[o])}off(t,o){const s=i(t,o);for(t in s){const o=this.types[t];if(o&&o.length)for(const i of s[t]){const t=o.indexOf(i);-1!==t&&o.splice(t,1)}}}getRect(t){return null}}
import*as t from"../utils/arr.min.js";import o from"../utils/extend.min.js";import i from"../utils/normalizeListeners.min.js";function s(t,o){for(const i of o){if(t.immediatePropagationStopped)break;i(t)}}export default class{constructor(t){this.options=void 0,this.types={},this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.global=void 0,this.options=o({},t||{})}fire(t){let o;const i=this.global;(o=this.types[t.type])&&s(t,o),!t.propagationStopped&&i&&(o=i[t.type])&&s(t,o)}on(o,s){const e=i(o,s);for(o in e)this.types[o]=t.merge(this.types[o]||[],e[o])}off(t,o){const s=i(t,o);for(t in s){const o=this.types[t];if(o&&o.length)for(const i of s[t]){const t=o.indexOf(i);-1!==t&&o.splice(t,1)}}}getRect(t){return null}}
//# sourceMappingURL=Eventable.min.js.map

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

import*as t from"../utils/arr.min.js";import*as e from"../utils/domUtils.min.js";import s from"../utils/extend.min.js";import*as i from"../utils/is.min.js";export default class InteractableSet{constructor(t){this.scope=t,this.list=[],this.selectorMap={},t.addListeners({"interactable:unset":({interactable:t})=>{const{target:e,_context:s}=t,n=i.string(e)?this.selectorMap[e]:e[this.scope.id],o=n.findIndex(t=>t.context===s);n[o]&&(n[o].context=null,n[o].interactable=null),n.splice(o,1)}})}new(t,e){e=s(e||{},{actions:this.scope.actions});const n=new this.scope.Interactable(t,e,this.scope.document),o={context:n._context,interactable:n};return this.scope.addDocument(n._doc),this.list.push(n),i.string(t)?(this.selectorMap[t]||(this.selectorMap[t]=[]),this.selectorMap[t].push(o)):(n.target[this.scope.id]||Object.defineProperty(t,this.scope.id,{value:[],configurable:!0}),t[this.scope.id].push(o)),this.scope.fire("interactable:new",{target:t,options:e,interactable:n,win:this.scope._win}),n}get(e,s){const n=s&&s.context||this.scope.document,o=i.string(e),c=o?this.selectorMap[e]:e[this.scope.id];if(!c)return null;const r=t.find(c,t=>t.context===n&&(o||t.interactable.inContext(e)));return r&&r.interactable}forEachMatch(t,s){for(const n of this.list){let o;if((i.string(n.target)?i.element(t)&&e.matchesSelector(t,n.target):t===n.target)&&n.inContext(t)&&(o=s(n)),void 0!==o)return o}}}
import*as t from"../utils/arr.min.js";import*as e from"../utils/domUtils.min.js";import s from"../utils/extend.min.js";import*as i from"../utils/is.min.js";export default class n{constructor(t){this.scope=t,this.list=[],this.selectorMap={},t.addListeners({"interactable:unset":({interactable:t})=>{const{target:e,_context:s}=t,n=i.string(e)?this.selectorMap[e]:e[this.scope.id],o=n.findIndex(t=>t.context===s);n[o]&&(n[o].context=null,n[o].interactable=null),n.splice(o,1)}})}new(t,e){e=s(e||{},{actions:this.scope.actions});const n=new this.scope.Interactable(t,e,this.scope.document),o={context:n._context,interactable:n};return this.scope.addDocument(n._doc),this.list.push(n),i.string(t)?(this.selectorMap[t]||(this.selectorMap[t]=[]),this.selectorMap[t].push(o)):(n.target[this.scope.id]||Object.defineProperty(t,this.scope.id,{value:[],configurable:!0}),t[this.scope.id].push(o)),this.scope.fire("interactable:new",{target:t,options:e,interactable:n,win:this.scope._win}),n}get(e,s){const n=s&&s.context||this.scope.document,o=i.string(e),c=o?this.selectorMap[e]:e[this.scope.id];if(!c)return null;const r=t.find(c,t=>t.context===n&&(o||t.interactable.inContext(e)));return r&&r.interactable}forEachMatch(t,s){for(const n of this.list){let o;if((i.string(n.target)?i.element(t)&&e.matchesSelector(t,n.target):t===n.target)&&n.inContext(t)&&(o=s(n)),void 0!==o)return o}}}
//# sourceMappingURL=InteractableSet.min.js.map

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

import*as t from"../utils/index.min.js";import e from"./InteractEvent.min.js";import i from"./PointerInfo.min.js";export let _ProxyValues;!function(t){t.interactable="",t.element="",t.prepared="",t.pointerIsDown="",t.pointerWasMoved="",t._proxy=""}(_ProxyValues||(_ProxyValues={}));export let _ProxyMethods;!function(t){t.start="",t.move="",t.end="",t.stop="",t.interacting=""}(_ProxyMethods||(_ProxyMethods={}));let n=0;export class Interaction{get pointerMoveTolerance(){return 1}constructor({pointerType:e,scopeFire:i}){this.interactable=null,this.element=null,this.rect=void 0,this._rects=void 0,this.edges=void 0,this._scopeFire=void 0,this.prepared={name:null,axis:null,edges:null},this.pointerType=void 0,this.pointers=[],this.downEvent=null,this.downPointer={},this._latestPointer={pointer:null,event:null,eventTarget:null},this.prevEvent=null,this.pointerIsDown=!1,this.pointerWasMoved=!1,this._interacting=!1,this._ending=!1,this._stopped=!0,this._proxy=null,this.simulation=null,this.doMove=t.warnOnce((function(t){this.move(t)}),"The interaction.doMove() method has been renamed to interaction.move()"),this.coords={start:t.pointer.newCoords(),prev:t.pointer.newCoords(),cur:t.pointer.newCoords(),delta:t.pointer.newCoords(),velocity:t.pointer.newCoords()},this._id=n++,this._scopeFire=i,this.pointerType=e;const o=this;this._proxy={};for(const t in _ProxyValues)Object.defineProperty(this._proxy,t,{get:()=>o[t]});for(const t in _ProxyMethods)Object.defineProperty(this._proxy,t,{value:(...e)=>o[t](...e)});this._scopeFire("interactions:new",{interaction:this})}pointerDown(t,e,i){const n=this.updatePointer(t,e,i,!0),o=this.pointers[n];this._scopeFire("interactions:down",{pointer:t,event:e,eventTarget:i,pointerIndex:n,pointerInfo:o,type:"down",interaction:this})}start(e,i,n){return!(this.interacting()||!this.pointerIsDown||this.pointers.length<("gesture"===e.name?2:1)||!i.options[e.name].enabled)&&(t.copyAction(this.prepared,e),this.interactable=i,this.element=n,this.rect=i.getRect(n),this.edges=this.prepared.edges?t.extend({},this.prepared.edges):{left:!0,right:!0,top:!0,bottom:!0},this._stopped=!1,this._interacting=this._doPhase({interaction:this,event:this.downEvent,phase:"start"})&&!this._stopped,this._interacting)}pointerMove(e,i,n){this.simulation||this.modification&&this.modification.endResult||this.updatePointer(e,i,n,!1);const o=this.coords.cur.page.x===this.coords.prev.page.x&&this.coords.cur.page.y===this.coords.prev.page.y&&this.coords.cur.client.x===this.coords.prev.client.x&&this.coords.cur.client.y===this.coords.prev.client.y;let r,s;this.pointerIsDown&&!this.pointerWasMoved&&(r=this.coords.cur.client.x-this.coords.start.client.x,s=this.coords.cur.client.y-this.coords.start.client.y,this.pointerWasMoved=t.hypot(r,s)>this.pointerMoveTolerance);const h=this.getPointerIndex(e),p={pointer:e,pointerIndex:h,pointerInfo:this.pointers[h],event:i,type:"move",eventTarget:n,dx:r,dy:s,duplicate:o,interaction:this};o||t.pointer.setCoordVelocity(this.coords.velocity,this.coords.delta),this._scopeFire("interactions:move",p),o||this.simulation||(this.interacting()&&(p.type=null,this.move(p)),this.pointerWasMoved&&t.pointer.copyCoords(this.coords.prev,this.coords.cur))}move(e){e&&e.event||t.pointer.setZeroCoords(this.coords.delta),(e=t.extend({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},e||{})).phase="move",this._doPhase(e)}pointerUp(t,e,i,n){let o=this.getPointerIndex(t);-1===o&&(o=this.updatePointer(t,e,i,!1));const r=/cancel$/i.test(e.type)?"cancel":"up";this._scopeFire(`interactions:${r}`,{pointer:t,pointerIndex:o,pointerInfo:this.pointers[o],event:e,eventTarget:i,type:r,curEventTarget:n,interaction:this}),this.simulation||this.end(e),this.pointerIsDown=!1,this.removePointer(t,e)}documentBlur(t){this.end(t),this._scopeFire("interactions:blur",{event:t,type:"blur",interaction:this})}end(t){let e;this._ending=!0,t=t||this._latestPointer.event,this.interacting()&&(e=this._doPhase({event:t,interaction:this,phase:"end"})),this._ending=!1,!0===e&&this.stop()}currentAction(){return this._interacting?this.prepared.name:null}interacting(){return this._interacting}stop(){this._scopeFire("interactions:stop",{interaction:this}),this.interactable=this.element=null,this._interacting=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}getPointerIndex(e){const i=t.pointer.getPointerId(e);return"mouse"===this.pointerType||"pen"===this.pointerType?this.pointers.length-1:t.arr.findIndex(this.pointers,t=>t.id===i)}getPointerInfo(t){return this.pointers[this.getPointerIndex(t)]}updatePointer(e,n,o,r){const s=t.pointer.getPointerId(e);let h=this.getPointerIndex(e),p=this.pointers[h];return r=!1!==r&&(r||/(down|start)$/i.test(n.type)),p?p.pointer=e:(p=new i(s,e,n,null,null),h=this.pointers.length,this.pointers.push(p)),t.pointer.setCoords(this.coords.cur,this.pointers.map(t=>t.pointer),this._now()),t.pointer.setCoordDeltas(this.coords.delta,this.coords.prev,this.coords.cur),r&&(this.pointerIsDown=!0,p.downTime=this.coords.cur.timeStamp,p.downTarget=o,t.pointer.pointerExtend(this.downPointer,e),this.interacting()||(t.pointer.copyCoords(this.coords.start,this.coords.cur),t.pointer.copyCoords(this.coords.prev,this.coords.cur),this.downEvent=n,this.pointerWasMoved=!1)),this._updateLatestPointer(e,n,o),this._scopeFire("interactions:update-pointer",{pointer:e,event:n,eventTarget:o,down:r,pointerInfo:p,pointerIndex:h,interaction:this}),h}removePointer(t,e){const i=this.getPointerIndex(t);if(-1===i)return;const n=this.pointers[i];this._scopeFire("interactions:remove-pointer",{pointer:t,event:e,eventTarget:null,pointerIndex:i,pointerInfo:n,interaction:this}),this.pointers.splice(i,1)}_updateLatestPointer(t,e,i){this._latestPointer.pointer=t,this._latestPointer.event=e,this._latestPointer.eventTarget=i}destroy(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}_createPreparedEvent(t,i,n,o){return new e(this,t,this.prepared.name,i,this.element,n,o)}_fireEvent(t){this.interactable.fire(t),(!this.prevEvent||t.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=t)}_doPhase(e){const{event:i,phase:n,preEnd:o,type:r}=e,{rect:s}=this;if(s&&"move"===n&&(t.rect.addEdges(this.edges,s,this.coords.delta[this.interactable.options.deltaSource]),s.width=s.right-s.left,s.height=s.bottom-s.top),!1===this._scopeFire(`interactions:before-action-${n}`,e))return!1;const h=e.iEvent=this._createPreparedEvent(i,n,o,r);return this._scopeFire(`interactions:action-${n}`,e),"start"===n&&(this.prevEvent=h),this._fireEvent(h),this._scopeFire(`interactions:after-action-${n}`,e),!0}_now(){return Date.now()}}export default Interaction;export{i as PointerInfo};
import*as t from"../utils/index.min.js";import e from"./InteractEvent.min.js";import i from"./PointerInfo.min.js";export let _ProxyValues;(t=>{t.interactable="",t.element="",t.prepared="",t.pointerIsDown="",t.pointerWasMoved="",t._proxy=""})(_ProxyValues||(_ProxyValues={}));export let _ProxyMethods;(t=>{t.start="",t.move="",t.end="",t.stop="",t.interacting=""})(_ProxyMethods||(_ProxyMethods={}));let n=0;export class Interaction{get pointerMoveTolerance(){return 1}constructor({pointerType:e,scopeFire:i}){this.interactable=null,this.element=null,this.rect=void 0,this._rects=void 0,this.edges=void 0,this._scopeFire=void 0,this.prepared={name:null,axis:null,edges:null},this.pointerType=void 0,this.pointers=[],this.downEvent=null,this.downPointer={},this._latestPointer={pointer:null,event:null,eventTarget:null},this.prevEvent=null,this.pointerIsDown=!1,this.pointerWasMoved=!1,this._interacting=!1,this._ending=!1,this._stopped=!0,this._proxy=null,this.simulation=null,this.doMove=t.warnOnce((function(t){this.move(t)}),"The interaction.doMove() method has been renamed to interaction.move()"),this.coords={start:t.pointer.newCoords(),prev:t.pointer.newCoords(),cur:t.pointer.newCoords(),delta:t.pointer.newCoords(),velocity:t.pointer.newCoords()},this._id=n++,this._scopeFire=i,this.pointerType=e;const o=this;this._proxy={};for(const t in _ProxyValues)Object.defineProperty(this._proxy,t,{get:()=>o[t]});for(const t in _ProxyMethods)Object.defineProperty(this._proxy,t,{value(...e){return o[t](...e)}});this._scopeFire("interactions:new",{interaction:this})}pointerDown(t,e,i){const n=this.updatePointer(t,e,i,!0),o=this.pointers[n];this._scopeFire("interactions:down",{pointer:t,event:e,eventTarget:i,pointerIndex:n,pointerInfo:o,type:"down",interaction:this})}start(e,i,n){return!(this.interacting()||!this.pointerIsDown||this.pointers.length<("gesture"===e.name?2:1)||!i.options[e.name].enabled)&&(t.copyAction(this.prepared,e),this.interactable=i,this.element=n,this.rect=i.getRect(n),this.edges=this.prepared.edges?t.extend({},this.prepared.edges):{left:!0,right:!0,top:!0,bottom:!0},this._stopped=!1,this._interacting=this._doPhase({interaction:this,event:this.downEvent,phase:"start"})&&!this._stopped,this._interacting)}pointerMove(e,i,n){this.simulation||this.modification&&this.modification.endResult||this.updatePointer(e,i,n,!1);const o=this.coords.cur.page.x===this.coords.prev.page.x&&this.coords.cur.page.y===this.coords.prev.page.y&&this.coords.cur.client.x===this.coords.prev.client.x&&this.coords.cur.client.y===this.coords.prev.client.y;let r,s;this.pointerIsDown&&!this.pointerWasMoved&&(r=this.coords.cur.client.x-this.coords.start.client.x,s=this.coords.cur.client.y-this.coords.start.client.y,this.pointerWasMoved=t.hypot(r,s)>this.pointerMoveTolerance);const h=this.getPointerIndex(e),p={pointer:e,pointerIndex:h,pointerInfo:this.pointers[h],event:i,type:"move",eventTarget:n,dx:r,dy:s,duplicate:o,interaction:this};o||t.pointer.setCoordVelocity(this.coords.velocity,this.coords.delta),this._scopeFire("interactions:move",p),o||this.simulation||(this.interacting()&&(p.type=null,this.move(p)),this.pointerWasMoved&&t.pointer.copyCoords(this.coords.prev,this.coords.cur))}move(e){e&&e.event||t.pointer.setZeroCoords(this.coords.delta),(e=t.extend({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},e||{})).phase="move",this._doPhase(e)}pointerUp(t,e,i,n){let o=this.getPointerIndex(t);-1===o&&(o=this.updatePointer(t,e,i,!1));const r=/cancel$/i.test(e.type)?"cancel":"up";this._scopeFire(`interactions:${r}`,{pointer:t,pointerIndex:o,pointerInfo:this.pointers[o],event:e,eventTarget:i,type:r,curEventTarget:n,interaction:this}),this.simulation||this.end(e),this.pointerIsDown=!1,this.removePointer(t,e)}documentBlur(t){this.end(t),this._scopeFire("interactions:blur",{event:t,type:"blur",interaction:this})}end(t){let e;this._ending=!0,t=t||this._latestPointer.event,this.interacting()&&(e=this._doPhase({event:t,interaction:this,phase:"end"})),this._ending=!1,!0===e&&this.stop()}currentAction(){return this._interacting?this.prepared.name:null}interacting(){return this._interacting}stop(){this._scopeFire("interactions:stop",{interaction:this}),this.interactable=this.element=null,this._interacting=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}getPointerIndex(e){const i=t.pointer.getPointerId(e);return"mouse"===this.pointerType||"pen"===this.pointerType?this.pointers.length-1:t.arr.findIndex(this.pointers,t=>t.id===i)}getPointerInfo(t){return this.pointers[this.getPointerIndex(t)]}updatePointer(e,n,o,r){const s=t.pointer.getPointerId(e);let h=this.getPointerIndex(e),p=this.pointers[h];return r=!1!==r&&(r||/(down|start)$/i.test(n.type)),p?p.pointer=e:(p=new i(s,e,n,null,null),h=this.pointers.length,this.pointers.push(p)),t.pointer.setCoords(this.coords.cur,this.pointers.map(t=>t.pointer),this._now()),t.pointer.setCoordDeltas(this.coords.delta,this.coords.prev,this.coords.cur),r&&(this.pointerIsDown=!0,p.downTime=this.coords.cur.timeStamp,p.downTarget=o,t.pointer.pointerExtend(this.downPointer,e),this.interacting()||(t.pointer.copyCoords(this.coords.start,this.coords.cur),t.pointer.copyCoords(this.coords.prev,this.coords.cur),this.downEvent=n,this.pointerWasMoved=!1)),this._updateLatestPointer(e,n,o),this._scopeFire("interactions:update-pointer",{pointer:e,event:n,eventTarget:o,down:r,pointerInfo:p,pointerIndex:h,interaction:this}),h}removePointer(t,e){const i=this.getPointerIndex(t);if(-1===i)return;const n=this.pointers[i];this._scopeFire("interactions:remove-pointer",{pointer:t,event:e,eventTarget:null,pointerIndex:i,pointerInfo:n,interaction:this}),this.pointers.splice(i,1)}_updateLatestPointer(t,e,i){this._latestPointer.pointer=t,this._latestPointer.event=e,this._latestPointer.eventTarget=i}destroy(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}_createPreparedEvent(t,i,n,o){return new e(this,t,this.prepared.name,i,this.element,n,o)}_fireEvent(t){this.interactable.fire(t),(!this.prevEvent||t.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=t)}_doPhase(e){const{event:i,phase:n,preEnd:o,type:r}=e,{rect:s}=this;if(s&&"move"===n&&(t.rect.addEdges(this.edges,s,this.coords.delta[this.interactable.options.deltaSource]),s.width=s.right-s.left,s.height=s.bottom-s.top),!1===this._scopeFire(`interactions:before-action-${n}`,e))return!1;const h=e.iEvent=this._createPreparedEvent(i,n,o,r);return this._scopeFire(`interactions:action-${n}`,e),"start"===n&&(this.prevEvent=h),this._fireEvent(h),this._scopeFire(`interactions:after-action-${n}`,e),!0}_now(){return Date.now()}}export default Interaction;export{i as PointerInfo};
//# sourceMappingURL=Interaction.min.js.map

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

import e from"../utils/browser.min.js";import t from"../utils/domObjects.min.js";import{nodeContains as n}from"../utils/domUtils.min.js";import o from"../utils/events.min.js";import*as r from"../utils/pointerUtils.min.js";import i from"./Interaction.min.js";import s from"./interactionFinder.min.js";import{Scope as p}from"./scope.min.js";import c from"./interactablePreventDefault.min.js";const a=["pointerDown","pointerMove","pointerUp","updatePointer","removePointer","windowBlur"];function l(t,n){return function(o){const i=n.interactions.list,s=r.getPointerType(o),[p,c]=r.getEventTargets(o),a=[];if(/^touch/.test(o.type)){n.prevTouchTime=n.now();for(const e of o.changedTouches){const t=e,i={pointer:t,pointerId:r.getPointerId(t),pointerType:s,eventType:o.type,eventTarget:p,curEventTarget:c,scope:n},l=u(i);a.push([i.pointer,i.eventTarget,i.curEventTarget,l])}}else{let t=!1;if(!e.supportsPointerEvent&&/mouse/.test(o.type)){for(let e=0;e<i.length&&!t;e++)t="mouse"!==i[e].pointerType&&i[e].pointerIsDown;t=t||n.now()-n.prevTouchTime<500||0===o.timeStamp}if(!t){const e={pointer:o,pointerId:r.getPointerId(o),pointerType:s,eventType:o.type,curEventTarget:c,eventTarget:p,scope:n},t=u(e);a.push([e.pointer,e.eventTarget,e.curEventTarget,t])}}for(const[e,n,r,i]of a)i[t](e,o,n,r)}}function u(e){const{pointerType:t,scope:n}=e,o={interaction:s.search(e),searchDetails:e};return n.fire("interactions:find",o),o.interaction||n.interactions.new({pointerType:t})}function m({doc:e,scope:t,options:n},r){const{docEvents:i}=t.interactions,s=o[r];t.browser.isIOS&&!n.events&&(n.events={passive:!1});for(const t in o.delegatedEvents)s(e,t,o.delegateListener),s(e,t,o.delegateUseCapture,!0);const p=n&&n.events;for(const{type:t,listener:n}of i)s(e,t,n,p)}const v={id:"core/interactions",install:function(o){const r={};for(const e of a)r[e]=l(e,o);const s=e.pEventTypes;let p;function u(){for(const e of o.interactions.list)if(e.pointerIsDown&&"touch"===e.pointerType&&!e._interacting)for(const t of e.pointers)o.documents.some(({doc:e})=>n(e,t.downTarget))||e.removePointer(t.pointer,t.event)}p=t.PointerEvent?[{type:s.down,listener:u},{type:s.down,listener:r.pointerDown},{type:s.move,listener:r.pointerMove},{type:s.up,listener:r.pointerUp},{type:s.cancel,listener:r.pointerUp}]:[{type:"mousedown",listener:r.pointerDown},{type:"mousemove",listener:r.pointerMove},{type:"mouseup",listener:r.pointerUp},{type:"touchstart",listener:u},{type:"touchstart",listener:r.pointerDown},{type:"touchmove",listener:r.pointerMove},{type:"touchend",listener:r.pointerUp},{type:"touchcancel",listener:r.pointerUp}],p.push({type:"blur",listener(e){for(const t of o.interactions.list)t.documentBlur(e)}}),o.prevTouchTime=0,o.Interaction=class extends i{get pointerMoveTolerance(){return o.interactions.pointerMoveTolerance}set pointerMoveTolerance(e){o.interactions.pointerMoveTolerance=e}_now(){return o.now()}},o.interactions={list:[],new(e){e.scopeFire=(e,t)=>o.fire(e,t);const t=new o.Interaction(e);return o.interactions.list.push(t),t},listeners:r,docEvents:p,pointerMoveTolerance:1},o.usePlugin(c)},listeners:{"scope:add-document":e=>m(e,"add"),"scope:remove-document":e=>m(e,"remove"),"interactable:unset":({interactable:e},t)=>{for(let n=t.interactions.list.length-1;n>=0;n--){const o=t.interactions.list[n];o.interactable===e&&(o.stop(),t.fire("interactions:destroy",{interaction:o}),o.destroy(),t.interactions.list.length>2&&t.interactions.list.splice(n,1))}}},onDocSignal:m,doOnInteractions:l,methodNames:a};export default v;
import e from"../utils/browser.min.js";import t from"../utils/domObjects.min.js";import{nodeContains as n}from"../utils/domUtils.min.js";import o from"../utils/events.min.js";import*as r from"../utils/pointerUtils.min.js";import i from"./Interaction.min.js";import s from"./interactionFinder.min.js";import{Scope as p}from"./scope.min.js";import c from"./interactablePreventDefault.min.js";const a=["pointerDown","pointerMove","pointerUp","updatePointer","removePointer","windowBlur"];function l(t,n){return o=>{const i=n.interactions.list,s=r.getPointerType(o),[p,c]=r.getEventTargets(o),a=[];if(/^touch/.test(o.type)){n.prevTouchTime=n.now();for(const e of o.changedTouches){const t=e,i={pointer:t,pointerId:r.getPointerId(t),pointerType:s,eventType:o.type,eventTarget:p,curEventTarget:c,scope:n},l=u(i);a.push([i.pointer,i.eventTarget,i.curEventTarget,l])}}else{let t=!1;if(!e.supportsPointerEvent&&/mouse/.test(o.type)){for(let e=0;e<i.length&&!t;e++)t="mouse"!==i[e].pointerType&&i[e].pointerIsDown;t=t||n.now()-n.prevTouchTime<500||0===o.timeStamp}if(!t){const e={pointer:o,pointerId:r.getPointerId(o),pointerType:s,eventType:o.type,curEventTarget:c,eventTarget:p,scope:n},t=u(e);a.push([e.pointer,e.eventTarget,e.curEventTarget,t])}}for(const[e,n,r,i]of a)i[t](e,o,n,r)}}function u(e){const{pointerType:t,scope:n}=e,o={interaction:s.search(e),searchDetails:e};return n.fire("interactions:find",o),o.interaction||n.interactions.new({pointerType:t})}function m({doc:e,scope:t,options:n},r){const{docEvents:i}=t.interactions,s=o[r];t.browser.isIOS&&!n.events&&(n.events={passive:!1});for(const t in o.delegatedEvents)s(e,t,o.delegateListener),s(e,t,o.delegateUseCapture,!0);const p=n&&n.events;for(const{type:t,listener:n}of i)s(e,t,n,p)}const v={id:"core/interactions",install(o){const r={};for(const e of a)r[e]=l(e,o);const s=e.pEventTypes;let p;function u(){for(const e of o.interactions.list)if(e.pointerIsDown&&"touch"===e.pointerType&&!e._interacting)for(const t of e.pointers)o.documents.some(({doc:e})=>n(e,t.downTarget))||e.removePointer(t.pointer,t.event)}p=t.PointerEvent?[{type:s.down,listener:u},{type:s.down,listener:r.pointerDown},{type:s.move,listener:r.pointerMove},{type:s.up,listener:r.pointerUp},{type:s.cancel,listener:r.pointerUp}]:[{type:"mousedown",listener:r.pointerDown},{type:"mousemove",listener:r.pointerMove},{type:"mouseup",listener:r.pointerUp},{type:"touchstart",listener:u},{type:"touchstart",listener:r.pointerDown},{type:"touchmove",listener:r.pointerMove},{type:"touchend",listener:r.pointerUp},{type:"touchcancel",listener:r.pointerUp}],p.push({type:"blur",listener(e){for(const t of o.interactions.list)t.documentBlur(e)}}),o.prevTouchTime=0,o.Interaction=class extends i{get pointerMoveTolerance(){return o.interactions.pointerMoveTolerance}set pointerMoveTolerance(e){o.interactions.pointerMoveTolerance=e}_now(){return o.now()}},o.interactions={list:[],new(e){e.scopeFire=(e,t)=>o.fire(e,t);const t=new o.Interaction(e);return o.interactions.list.push(t),t},listeners:r,docEvents:p,pointerMoveTolerance:1},o.usePlugin(c)},listeners:{"scope:add-document"(e){return m(e,"add")},"scope:remove-document"(e){return m(e,"remove")},"interactable:unset"({interactable:e},t){for(let n=t.interactions.list.length-1;n>=0;n--){const o=t.interactions.list[n];o.interactable===e&&(o.stop(),t.fire("interactions:destroy",{interaction:o}),o.destroy(),t.interactions.list.length>2&&t.interactions.list.splice(n,1))}}},onDocSignal:m,doOnInteractions:l,methodNames:a};export default v;
//# sourceMappingURL=interactions.min.js.map
{
"name": "@interactjs/core",
"version": "1.9.2",
"version": "1.9.3",
"license": "MIT",
"peerDependencies": {
"@interactjs/dev-tools": "1.9.2",
"@interactjs/utils": "1.9.2"
"@interactjs/dev-tools": "1.9.3",
"@interactjs/utils": "1.9.3"
},
"devDependencies": {
"@interactjs/_dev": "1.9.2",
"@interactjs/actions": "1.9.2",
"@interactjs/auto-start": "1.9.2"
"@interactjs/_dev": "1.9.3",
"@interactjs/actions": "1.9.3",
"@interactjs/auto-start": "1.9.3"
},

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

},
"gitHead": "77b581be"
"gitHead": "2032dde4"
}

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