Socket
Socket
Sign inDemoInstall

@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.13 to 1.9.14

isNonNativeEvent.d.ts

5

Interactable.d.ts
import Eventable from './Eventable';
import { Options } from './defaultOptions';
import { Actions } from './scope';
import type { Options } from './defaultOptions';
declare type IgnoreValue = string | Interact.Element | boolean;

@@ -8,3 +7,3 @@ /** */

readonly options: Required<Options>;
readonly _actions: Actions;
readonly _actions: Interact.Actions;
readonly target: Interact.Target;

@@ -11,0 +10,0 @@ readonly events: Eventable;

2

Interactable.js

@@ -10,3 +10,3 @@ import * as arr from "../utils/arr.js";

import Eventable from "./Eventable.js";
import { isNonNativeEvent } from "./scope.js";
import isNonNativeEvent from "./isNonNativeEvent.js";

@@ -13,0 +13,0 @@ /** */

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

import*as t from"../utils/arr.min.js";import e from"../utils/browser.min.js";import s from"../utils/clone.min.js";import{getElementRect as i,matchesUpTo as n,nodeContains as o,trySelector as r}from"../utils/domUtils.min.js";import h from"../utils/extend.min.js";import c from"../utils/is.min.js";import a from"../utils/normalizeListeners.min.js";import{getWindow as l}from"../utils/window.min.js";import m from"./Eventable.min.js";import{isNonNativeEvent as u}from"./scope.min.js";export class Interactable{get _defaults(){return{base:{},perAction:{},actions:{}}}constructor(t,e,s,i){this.options=void 0,this._actions=void 0,this.target=void 0,this.events=new m,this._context=void 0,this._win=void 0,this._doc=void 0,this._scopeEvents=void 0,this._rectChecker=void 0,this._actions=e.actions,this.target=t,this._context=e.context||s,this._win=l(r(t)?this._context:t),this._doc=this._win.document,this._scopeEvents=i,this.set(e)}setOnEvents(t,e){return c.func(e.onstart)&&this.on(t+"start",e.onstart),c.func(e.onmove)&&this.on(t+"move",e.onmove),c.func(e.onend)&&this.on(t+"end",e.onend),c.func(e.oninertiastart)&&this.on(t+"inertiastart",e.oninertiastart),this}updatePerActionListeners(t,e,s){(c.array(e)||c.object(e))&&this.off(t,e),(c.array(s)||c.object(s))&&this.on(t,s)}setPerAction(e,i){const n=this._defaults;for(const o in i){const r=o,a=this.options[e],l=i[r];"listeners"===r&&this.updatePerActionListeners(e,a.listeners,l),c.array(l)?a[r]=t.from(l):c.plainObject(l)?(a[r]=h(a[r]||{},s(l)),c.object(n.perAction[r])&&"enabled"in n.perAction[r]&&(a[r].enabled=!1!==l.enabled)):c.bool(l)&&c.object(n.perAction[r])?a[r].enabled=l:a[r]=l}}getRect(t){return t=t||(c.element(this.target)?this.target:null),c.string(this.target)&&(t=t||this._context.querySelector(this.target)),i(t)}rectChecker(t){return c.func(t)?(this._rectChecker=t,this.getRect=t=>{const e=h({},this._rectChecker(t));return"width"in e||(e.width=e.right-e.left,e.height=e.bottom-e.top),e},this):null===t?(delete this.getRect,delete this._rectChecker,this):this.getRect}_backCompatOption(t,e){if(r(e)||c.object(e)){this.options[t]=e;for(const s in this._actions.map)this.options[s][t]=e;return this}return this.options[t]}origin(t){return this._backCompatOption("origin",t)}deltaSource(t){return"page"===t||"client"===t?(this.options.deltaSource=t,this):this.options.deltaSource}context(){return this._context}inContext(t){return this._context===t.ownerDocument||o(this._context,t)}testIgnoreAllow(t,e,s){return!this.testIgnore(t.ignoreFrom,e,s)&&this.testAllow(t.allowFrom,e,s)}testAllow(t,e,s){return!t||!!c.element(s)&&(c.string(t)?n(s,t,e):!!c.element(t)&&o(t,s))}testIgnore(t,e,s){return!(!t||!c.element(s))&&(c.string(t)?n(s,t,e):!!c.element(t)&&o(t,s))}fire(t){return this.events.fire(t),this}_onOff(t,s,i,n){c.object(s)&&!c.array(s)&&(n=i,i=null);const o="on"===t?"add":"remove",r=a(s,i);for(let s in r){"wheel"===s&&(s=e.wheelEvent);for(const e of r[s])u(s,this._actions)?this.events[t](s,e):c.string(this.target)?this._scopeEvents[o+"Delegate"](this.target,this._context,s,e,n):this._scopeEvents[o](this.target,s,e,n)}return this}on(t,e,s){return this._onOff("on",t,e,s)}off(t,e,s){return this._onOff("off",t,e,s)}set(t){const e=this._defaults;c.object(t)||(t={}),this.options=s(e.base);for(const s in this._actions.methodDict){const i=s,n=this._actions.methodDict[i];this.options[i]={},this.setPerAction(i,h(h({},e.perAction),e.actions[i])),this[n](t[i])}for(const e in t)c.func(this[e])&&this[e](t[e]);return this}unset(){if(c.string(this.target))for(const t in this._scopeEvents.delegatedEvents){const e=this._scopeEvents.delegatedEvents[t];for(let s=e.length-1;s>=0;s--){const{selector:i,context:n,listeners:o}=e[s];i===this.target&&n===this._context&&e.splice(s,1);for(let e=o.length-1;e>=0;e--)this._scopeEvents.removeDelegate(this.target,this._context,t,o[e][0],o[e][1])}}else this._scopeEvents.remove(this.target,"all")}}export default Interactable;
import*as t from"../utils/arr.min.js";import e from"../utils/browser.min.js";import s from"../utils/clone.min.js";import{getElementRect as i,matchesUpTo as n,nodeContains as o,trySelector as r}from"../utils/domUtils.min.js";import h from"../utils/extend.min.js";import c from"../utils/is.min.js";import a from"../utils/normalizeListeners.min.js";import{getWindow as l}from"../utils/window.min.js";import m from"./Eventable.min.js";import u from"./isNonNativeEvent.min.js";export class Interactable{get _defaults(){return{base:{},perAction:{},actions:{}}}constructor(t,e,s,i){this.options=void 0,this._actions=void 0,this.target=void 0,this.events=new m,this._context=void 0,this._win=void 0,this._doc=void 0,this._scopeEvents=void 0,this._rectChecker=void 0,this._actions=e.actions,this.target=t,this._context=e.context||s,this._win=l(r(t)?this._context:t),this._doc=this._win.document,this._scopeEvents=i,this.set(e)}setOnEvents(t,e){return c.func(e.onstart)&&this.on(t+"start",e.onstart),c.func(e.onmove)&&this.on(t+"move",e.onmove),c.func(e.onend)&&this.on(t+"end",e.onend),c.func(e.oninertiastart)&&this.on(t+"inertiastart",e.oninertiastart),this}updatePerActionListeners(t,e,s){(c.array(e)||c.object(e))&&this.off(t,e),(c.array(s)||c.object(s))&&this.on(t,s)}setPerAction(e,i){const n=this._defaults;for(const o in i){const r=o,a=this.options[e],l=i[r];"listeners"===r&&this.updatePerActionListeners(e,a.listeners,l),c.array(l)?a[r]=t.from(l):c.plainObject(l)?(a[r]=h(a[r]||{},s(l)),c.object(n.perAction[r])&&"enabled"in n.perAction[r]&&(a[r].enabled=!1!==l.enabled)):c.bool(l)&&c.object(n.perAction[r])?a[r].enabled=l:a[r]=l}}getRect(t){return t=t||(c.element(this.target)?this.target:null),c.string(this.target)&&(t=t||this._context.querySelector(this.target)),i(t)}rectChecker(t){return c.func(t)?(this._rectChecker=t,this.getRect=t=>{const e=h({},this._rectChecker(t));return"width"in e||(e.width=e.right-e.left,e.height=e.bottom-e.top),e},this):null===t?(delete this.getRect,delete this._rectChecker,this):this.getRect}_backCompatOption(t,e){if(r(e)||c.object(e)){this.options[t]=e;for(const s in this._actions.map)this.options[s][t]=e;return this}return this.options[t]}origin(t){return this._backCompatOption("origin",t)}deltaSource(t){return"page"===t||"client"===t?(this.options.deltaSource=t,this):this.options.deltaSource}context(){return this._context}inContext(t){return this._context===t.ownerDocument||o(this._context,t)}testIgnoreAllow(t,e,s){return!this.testIgnore(t.ignoreFrom,e,s)&&this.testAllow(t.allowFrom,e,s)}testAllow(t,e,s){return!t||!!c.element(s)&&(c.string(t)?n(s,t,e):!!c.element(t)&&o(t,s))}testIgnore(t,e,s){return!(!t||!c.element(s))&&(c.string(t)?n(s,t,e):!!c.element(t)&&o(t,s))}fire(t){return this.events.fire(t),this}_onOff(t,s,i,n){c.object(s)&&!c.array(s)&&(n=i,i=null);const o="on"===t?"add":"remove",r=a(s,i);for(let s in r){"wheel"===s&&(s=e.wheelEvent);for(const e of r[s])u(s,this._actions)?this.events[t](s,e):c.string(this.target)?this._scopeEvents[o+"Delegate"](this.target,this._context,s,e,n):this._scopeEvents[o](this.target,s,e,n)}return this}on(t,e,s){return this._onOff("on",t,e,s)}off(t,e,s){return this._onOff("off",t,e,s)}set(t){const e=this._defaults;c.object(t)||(t={}),this.options=s(e.base);for(const s in this._actions.methodDict){const i=s,n=this._actions.methodDict[i];this.options[i]={},this.setPerAction(i,h(h({},e.perAction),e.actions[i])),this[n](t[i])}for(const e in t)c.func(this[e])&&this[e](t[e]);return this}unset(){if(c.string(this.target))for(const t in this._scopeEvents.delegatedEvents){const e=this._scopeEvents.delegatedEvents[t];for(let s=e.length-1;s>=0;s--){const{selector:i,context:n,listeners:o}=e[s];i===this.target&&n===this._context&&e.splice(s,1);for(let e=o.length-1;e>=0;e--)this._scopeEvents.removeDelegate(this.target,this._context,t,o[e][0],o[e][1])}}else this._scopeEvents.remove(this.target,"all")}}export default Interactable;
//# sourceMappingURL=Interactable.min.js.map

@@ -8,3 +8,2 @@ import browser from "../utils/browser.js";

import finder from "./interactionFinder.js";
import Scope from "./scope.js";
const methodNames = ['pointerDown', 'pointerMove', 'pointerUp', 'updatePointer', 'removePointer', 'windowBlur'];

@@ -11,0 +10,0 @@

@@ -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*as o from"../utils/pointerUtils.min.js";import r from"./Interaction.min.js";import i from"./interactablePreventDefault.min.js";import s from"./interactionFinder.min.js";import p from"./scope.min.js";const c=["pointerDown","pointerMove","pointerUp","updatePointer","removePointer","windowBlur"];function a(t,n){return r=>{const i=n.interactions.list,s=o.getPointerType(r),[p,c]=o.getEventTargets(r),a=[];if(/^touch/.test(r.type)){n.prevTouchTime=n.now();for(const e of r.changedTouches){const t=e,i={pointer:t,pointerId:o.getPointerId(t),pointerType:s,eventType:r.type,eventTarget:p,curEventTarget:c,scope:n},u=l(i);a.push([i.pointer,i.eventTarget,i.curEventTarget,u])}}else{let t=!1;if(!e.supportsPointerEvent&&/mouse/.test(r.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===r.timeStamp}if(!t){const e={pointer:r,pointerId:o.getPointerId(r),pointerType:s,eventType:r.type,curEventTarget:c,eventTarget:p,scope:n},t=l(e);a.push([e.pointer,e.eventTarget,e.curEventTarget,t])}}for(const[e,n,o,i]of a)i[t](e,r,n,o)}}function l(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 u({doc:e,scope:t,options:n},o){const{interactions:{docEvents:r},events:i}=t,s=i[o];t.browser.isIOS&&!n.events&&(n.events={passive:!1});for(const t in i.delegatedEvents)s(e,t,i.delegateListener),s(e,t,i.delegateUseCapture,!0);const p=n&&n.events;for(const{type:t,listener:n}of r)s(e,t,n,p)}const m={id:"core/interactions",install(o){const s={};for(const e of c)s[e]=a(e,o);const p=e.pEventTypes;let l;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)}l=t.PointerEvent?[{type:p.down,listener:u},{type:p.down,listener:s.pointerDown},{type:p.move,listener:s.pointerMove},{type:p.up,listener:s.pointerUp},{type:p.cancel,listener:s.pointerUp}]:[{type:"mousedown",listener:s.pointerDown},{type:"mousemove",listener:s.pointerMove},{type:"mouseup",listener:s.pointerUp},{type:"touchstart",listener:u},{type:"touchstart",listener:s.pointerDown},{type:"touchmove",listener:s.pointerMove},{type:"touchend",listener:s.pointerUp},{type:"touchcancel",listener:s.pointerUp}],l.push({type:"blur",listener(e){for(const t of o.interactions.list)t.documentBlur(e)}}),o.prevTouchTime=0,o.Interaction=class extends r{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:s,docEvents:l,pointerMoveTolerance:1},o.usePlugin(i)},listeners:{"scope:add-document"(e){return u(e,"add")},"scope:remove-document"(e){return u(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:u,doOnInteractions:a,methodNames:c};export default m;
import e from"../utils/browser.min.js";import t from"../utils/domObjects.min.js";import{nodeContains as n}from"../utils/domUtils.min.js";import*as o from"../utils/pointerUtils.min.js";import r from"./Interaction.min.js";import i from"./interactablePreventDefault.min.js";import s from"./interactionFinder.min.js";const p=["pointerDown","pointerMove","pointerUp","updatePointer","removePointer","windowBlur"];function c(t,n){return r=>{const i=n.interactions.list,s=o.getPointerType(r),[p,c]=o.getEventTargets(r),l=[];if(/^touch/.test(r.type)){n.prevTouchTime=n.now();for(const e of r.changedTouches){const t=e,i={pointer:t,pointerId:o.getPointerId(t),pointerType:s,eventType:r.type,eventTarget:p,curEventTarget:c,scope:n},u=a(i);l.push([i.pointer,i.eventTarget,i.curEventTarget,u])}}else{let t=!1;if(!e.supportsPointerEvent&&/mouse/.test(r.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===r.timeStamp}if(!t){const e={pointer:r,pointerId:o.getPointerId(r),pointerType:s,eventType:r.type,curEventTarget:c,eventTarget:p,scope:n},t=a(e);l.push([e.pointer,e.eventTarget,e.curEventTarget,t])}}for(const[e,n,o,i]of l)i[t](e,r,n,o)}}function a(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 l({doc:e,scope:t,options:n},o){const{interactions:{docEvents:r},events:i}=t,s=i[o];t.browser.isIOS&&!n.events&&(n.events={passive:!1});for(const t in i.delegatedEvents)s(e,t,i.delegateListener),s(e,t,i.delegateUseCapture,!0);const p=n&&n.events;for(const{type:t,listener:n}of r)s(e,t,n,p)}const u={id:"core/interactions",install(o){const s={};for(const e of p)s[e]=c(e,o);const a=e.pEventTypes;let l;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)}l=t.PointerEvent?[{type:a.down,listener:u},{type:a.down,listener:s.pointerDown},{type:a.move,listener:s.pointerMove},{type:a.up,listener:s.pointerUp},{type:a.cancel,listener:s.pointerUp}]:[{type:"mousedown",listener:s.pointerDown},{type:"mousemove",listener:s.pointerMove},{type:"mouseup",listener:s.pointerUp},{type:"touchstart",listener:u},{type:"touchstart",listener:s.pointerDown},{type:"touchmove",listener:s.pointerMove},{type:"touchend",listener:s.pointerUp},{type:"touchcancel",listener:s.pointerUp}],l.push({type:"blur",listener(e){for(const t of o.interactions.list)t.documentBlur(e)}}),o.prevTouchTime=0,o.Interaction=class extends r{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:s,docEvents:l,pointerMoveTolerance:1},o.usePlugin(i)},listeners:{"scope:add-document"(e){return l(e,"add")},"scope:remove-document"(e){return l(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:l,doOnInteractions:c,methodNames:p};export default u;
//# sourceMappingURL=interactions.min.js.map

@@ -7,3 +7,3 @@ /** @module interact */

import * as pointerUtils from "../utils/pointerUtils.js";
import { isNonNativeEvent } from "./scope.js";
import isNonNativeEvent from "./isNonNativeEvent.js";
export class InteractStatic {

@@ -23,3 +23,3 @@ // expose the functions used to calculate multi-touch properties

this.dynamicDrop = void 0;
this.version = "1.9.13";
this.version = "1.9.14";
this.interact = void 0;

@@ -26,0 +26,0 @@ this.scope = void 0;

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

import t from"../utils/browser.min.js";import*as e from"../utils/domUtils.min.js";import s from"../utils/extend.min.js";import o from"../utils/is.min.js";import*as i from"../utils/pointerUtils.min.js";import{isNonNativeEvent as r}from"./scope.min.js";export class InteractStatic{constructor(t){this.getPointerAverage=i.pointerAverage,this.getTouchBBox=i.touchBBox,this.getTouchDistance=i.touchDistance,this.getTouchAngle=i.touchAngle,this.getElementRect=e.getElementRect,this.getElementClientRect=e.getElementClientRect,this.matchesSelector=e.matchesSelector,this.closest=e.closest,this.globalEvents={},this.dynamicDrop=void 0,this.version="1.9.13",this.interact=void 0,this.scope=void 0,this.scope=t;const{prototype:o}=this.constructor,r=(e,s)=>{let o=t.interactables.get(e,s);return o||(o=t.interactables.new(e,s),o.events.global=this.globalEvents),o};for(const t of Object.getOwnPropertyNames(this.constructor.prototype))r[t]=o[t];return s(r,this),r.constructor=this.constructor,this.interact=r,r}use(t,e){return this.scope.usePlugin(t,e),this}isSet(t,e){return!!this.scope.interactables.get(t,e&&e.context)}on(t,e,s){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.on(o,e,s);return this}if(o.object(t)){for(const s in t)this.on(s,t[s],e);return this}return r(t,this.scope.actions)?this.globalEvents[t]?this.globalEvents[t].push(e):this.globalEvents[t]=[e]:this.scope.events.add(this.scope.document,t,e,{options:s}),this}off(t,e,s){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.off(o,e,s);return this}if(o.object(t)){for(const s in t)this.off(s,t[s],e);return this}if(r(t,this.scope.actions)){let s;t in this.globalEvents&&-1!==(s=this.globalEvents[t].indexOf(e))&&this.globalEvents[t].splice(s,1)}else this.scope.events.remove(this.scope.document,t,e,s);return this}debug(){return this.scope}supportsTouch(){return t.supportsTouch}supportsPointerEvent(){return t.supportsPointerEvent}stop(){for(const t of this.scope.interactions.list)t.stop();return this}pointerMoveTolerance(t){return o.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance}addDocument(t,e){this.scope.addDocument(t,e)}removeDocument(t){this.scope.removeDocument(t)}}export default InteractStatic;
import t from"../utils/browser.min.js";import*as e from"../utils/domUtils.min.js";import s from"../utils/extend.min.js";import o from"../utils/is.min.js";import*as i from"../utils/pointerUtils.min.js";import r from"./isNonNativeEvent.min.js";export class InteractStatic{constructor(t){this.getPointerAverage=i.pointerAverage,this.getTouchBBox=i.touchBBox,this.getTouchDistance=i.touchDistance,this.getTouchAngle=i.touchAngle,this.getElementRect=e.getElementRect,this.getElementClientRect=e.getElementClientRect,this.matchesSelector=e.matchesSelector,this.closest=e.closest,this.globalEvents={},this.dynamicDrop=void 0,this.version="1.9.14",this.interact=void 0,this.scope=void 0,this.scope=t;const{prototype:o}=this.constructor,r=(e,s)=>{let o=t.interactables.get(e,s);return o||(o=t.interactables.new(e,s),o.events.global=this.globalEvents),o};for(const t of Object.getOwnPropertyNames(this.constructor.prototype))r[t]=o[t];return s(r,this),r.constructor=this.constructor,this.interact=r,r}use(t,e){return this.scope.usePlugin(t,e),this}isSet(t,e){return!!this.scope.interactables.get(t,e&&e.context)}on(t,e,s){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.on(o,e,s);return this}if(o.object(t)){for(const s in t)this.on(s,t[s],e);return this}return r(t,this.scope.actions)?this.globalEvents[t]?this.globalEvents[t].push(e):this.globalEvents[t]=[e]:this.scope.events.add(this.scope.document,t,e,{options:s}),this}off(t,e,s){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.off(o,e,s);return this}if(o.object(t)){for(const s in t)this.off(s,t[s],e);return this}if(r(t,this.scope.actions)){let s;t in this.globalEvents&&-1!==(s=this.globalEvents[t].indexOf(e))&&this.globalEvents[t].splice(s,1)}else this.scope.events.remove(this.scope.document,t,e,s);return this}debug(){return this.scope}supportsTouch(){return t.supportsTouch}supportsPointerEvent(){return t.supportsPointerEvent}stop(){for(const t of this.scope.interactions.list)t.stop();return this}pointerMoveTolerance(t){return o.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance}addDocument(t,e){this.scope.addDocument(t,e)}removeDocument(t){this.scope.removeDocument(t)}}export default InteractStatic;
//# sourceMappingURL=InteractStatic.min.js.map
{
"name": "@interactjs/core",
"version": "1.9.13",
"version": "1.9.14",
"license": "MIT",
"peerDependencies": {
"@interactjs/utils": "1.9.13"
"@interactjs/utils": "1.9.14"
},

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

},
"gitHead": "f678fd13"
"gitHead": "baf83fba"
}

@@ -112,4 +112,3 @@ import Eventable from './Eventable';

}
export declare function isNonNativeEvent(type: string, actions: Actions): boolean;
export declare function initScope(scope: Scope, window: Window): Scope;
export { Scope };

@@ -217,15 +217,2 @@ /* eslint-disable import/no-named-as-default-member */

}
export function isNonNativeEvent(type, actions) {
if (actions.phaselessTypes[type]) {
return true;
}
for (const name in actions.map) {
if (type.indexOf(name) === 0 && type.substr(name.length) in actions.phases) {
return true;
}
}
return false;
}
export function initScope(scope, window) {

@@ -232,0 +219,0 @@ scope.isInitialized = true;

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

import t from"../utils/browser.min.js";import i from"../utils/clone.min.js";import s from"../utils/domObjects.min.js";import e from"../utils/extend.min.js";import n from"../utils/raf.min.js";import o from"../utils/window.min.js";import r from"./Eventable.min.js";import a from"./InteractEvent.min.js";import l from"./InteractStatic.min.js";import d from"./Interactable.min.js";import h from"./InteractableSet.min.js";import m from"./defaultOptions.min.js";import u from"./events.min.js";import c from"./interactions.min.js";export default class p{constructor(){this.id="__interact_scope_"+Math.floor(100*Math.random()),this.isInitialized=!1,this.listenerMaps=[],this.browser=t,this.defaults=i(m),this.Eventable=r,this.actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}},this.interactStatic=new l(this),this.InteractEvent=a,this.Interactable=void 0,this.interactables=new h(this),this._win=void 0,this.document=void 0,this.window=void 0,this.documents=[],this._plugins={list:[],map:{}},this.onWindowUnload=t=>this.removeDocument(t.target);const s=this;this.Interactable=class extends d{get _defaults(){return s.defaults}set(t){return super.set(t),s.fire("interactable:set",{options:t,interactable:this}),this}unset(){super.unset(),s.interactables.list.splice(s.interactables.list.indexOf(this),1),s.fire("interactable:unset",{interactable:this})}}}addListeners(t,i){this.listenerMaps.push({id:i,map:t})}fire(t,i){for(const{map:{[t]:s}}of this.listenerMaps)if(s&&!1===s(i,this,t))return!1}init(t){return this.isInitialized?this:initScope(this,t)}pluginIsInstalled(t){return this._plugins.map[t.id]||-1!==this._plugins.list.indexOf(t)}usePlugin(t,i){if(!this.isInitialized)return this;if(this.pluginIsInstalled(t))return this;if(t.id&&(this._plugins.map[t.id]=t),this._plugins.list.push(t),t.install&&t.install(this,i),t.listeners&&t.before){let i=0;const s=this.listenerMaps.length,e=t.before.reduce((t,i)=>(t[i]=!0,t),{});for(;i<s;i++){if(e[this.listenerMaps[i].id])break}this.listenerMaps.splice(i,0,{id:t.id,map:t.listeners})}else t.listeners&&this.listenerMaps.push({id:t.id,map:t.listeners});return this}addDocument(t,i){if(-1!==this.getDocIndex(t))return!1;const s=o.getWindow(t);i=i?e({},i):{},this.documents.push({doc:t,options:i}),this.events.documents.push(t),t!==this.document&&this.events.add(s,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:t,window:s,scope:this,options:i})}removeDocument(t){const i=this.getDocIndex(t),s=o.getWindow(t),e=this.documents[i].options;this.events.remove(s,"unload",this.onWindowUnload),this.documents.splice(i,1),this.events.documents.splice(i,1),this.fire("scope:remove-document",{doc:t,window:s,scope:this,options:e})}getDocIndex(t){for(let i=0;i<this.documents.length;i++)if(this.documents[i].doc===t)return i;return-1}getDocOptions(t){const i=this.getDocIndex(t);return-1===i?null:this.documents[i].options}now(){return(this.window.Date||Date).now()}}export function isNonNativeEvent(t,i){if(i.phaselessTypes[t])return!0;for(const s in i.map)if(0===t.indexOf(s)&&t.substr(s.length)in i.phases)return!0;return!1}export function initScope(i,e){return i.isInitialized=!0,o.init(e),s.init(e),t.init(e),n.init(e),i.window=e,i.document=e.document,i.usePlugin(c),i.usePlugin(u),i}export{p as Scope};
import t from"../utils/browser.min.js";import i from"../utils/clone.min.js";import s from"../utils/domObjects.min.js";import e from"../utils/extend.min.js";import n from"../utils/raf.min.js";import o from"../utils/window.min.js";import r from"./Eventable.min.js";import a from"./InteractEvent.min.js";import l from"./InteractStatic.min.js";import d from"./Interactable.min.js";import h from"./InteractableSet.min.js";import m from"./defaultOptions.min.js";import c from"./events.min.js";import u from"./interactions.min.js";export default class p{constructor(){this.id="__interact_scope_"+Math.floor(100*Math.random()),this.isInitialized=!1,this.listenerMaps=[],this.browser=t,this.defaults=i(m),this.Eventable=r,this.actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}},this.interactStatic=new l(this),this.InteractEvent=a,this.Interactable=void 0,this.interactables=new h(this),this._win=void 0,this.document=void 0,this.window=void 0,this.documents=[],this._plugins={list:[],map:{}},this.onWindowUnload=t=>this.removeDocument(t.target);const s=this;this.Interactable=class extends d{get _defaults(){return s.defaults}set(t){return super.set(t),s.fire("interactable:set",{options:t,interactable:this}),this}unset(){super.unset(),s.interactables.list.splice(s.interactables.list.indexOf(this),1),s.fire("interactable:unset",{interactable:this})}}}addListeners(t,i){this.listenerMaps.push({id:i,map:t})}fire(t,i){for(const{map:{[t]:s}}of this.listenerMaps)if(s&&!1===s(i,this,t))return!1}init(t){return this.isInitialized?this:initScope(this,t)}pluginIsInstalled(t){return this._plugins.map[t.id]||-1!==this._plugins.list.indexOf(t)}usePlugin(t,i){if(!this.isInitialized)return this;if(this.pluginIsInstalled(t))return this;if(t.id&&(this._plugins.map[t.id]=t),this._plugins.list.push(t),t.install&&t.install(this,i),t.listeners&&t.before){let i=0;const s=this.listenerMaps.length,e=t.before.reduce((t,i)=>(t[i]=!0,t),{});for(;i<s;i++){if(e[this.listenerMaps[i].id])break}this.listenerMaps.splice(i,0,{id:t.id,map:t.listeners})}else t.listeners&&this.listenerMaps.push({id:t.id,map:t.listeners});return this}addDocument(t,i){if(-1!==this.getDocIndex(t))return!1;const s=o.getWindow(t);i=i?e({},i):{},this.documents.push({doc:t,options:i}),this.events.documents.push(t),t!==this.document&&this.events.add(s,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:t,window:s,scope:this,options:i})}removeDocument(t){const i=this.getDocIndex(t),s=o.getWindow(t),e=this.documents[i].options;this.events.remove(s,"unload",this.onWindowUnload),this.documents.splice(i,1),this.events.documents.splice(i,1),this.fire("scope:remove-document",{doc:t,window:s,scope:this,options:e})}getDocIndex(t){for(let i=0;i<this.documents.length;i++)if(this.documents[i].doc===t)return i;return-1}getDocOptions(t){const i=this.getDocIndex(t);return-1===i?null:this.documents[i].options}now(){return(this.window.Date||Date).now()}}export function initScope(i,e){return i.isInitialized=!0,o.init(e),s.init(e),t.init(e),n.init(e),i.window=e,i.document=e.document,i.usePlugin(u),i.usePlugin(c),i}export{p as Scope};
//# sourceMappingURL=scope.min.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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc