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.10.11 to 1.10.12

11

BaseEvent.js
export class BaseEvent {
immediatePropagationStopped = false;
propagationStopped = false;
constructor(interaction) {
this.type = void 0;
this.target = void 0;
this.currentTarget = void 0;
this.interactable = void 0;
this._interaction = void 0;
this.timeStamp = void 0;
this.immediatePropagationStopped = false;
this.propagationStopped = false;
this._interaction = interaction;

@@ -12,0 +7,0 @@ }

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

export class BaseEvent{constructor(t){this.type=void 0,this.target=void 0,this.currentTarget=void 0,this.interactable=void 0,this._interaction=void 0,this.timeStamp=void 0,this.immediatePropagationStopped=!1,this.propagationStopped=!1,this._interaction=t}preventDefault(){}stopPropagation(){this.propagationStopped=!0}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}}Object.defineProperty(BaseEvent.prototype,"interaction",{get(){return this._interaction._proxy},set(){}});
export class BaseEvent{immediatePropagationStopped=!1;propagationStopped=!1;constructor(t){this._interaction=t}preventDefault(){}stopPropagation(){this.propagationStopped=!0}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}}Object.defineProperty(BaseEvent.prototype,"interaction",{get(){return this._interaction._proxy},set(){}});
//# sourceMappingURL=BaseEvent.prod.js.map

@@ -16,8 +16,9 @@ import * as arr from "../utils/arr.js";

export class Eventable {
options;
types = {};
propagationStopped = false;
immediatePropagationStopped = false;
global;
constructor(options) {
this.options = void 0;
this.types = {};
this.propagationStopped = false;
this.immediatePropagationStopped = false;
this.global = void 0;
this.options = extend({}, options || {});

@@ -24,0 +25,0 @@ }

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

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

@@ -233,6 +233,7 @@ import * as arr from "../utils/arr.js";

class FakeEvent {
currentTarget;
originalEvent;
type;
constructor(originalEvent) {
this.currentTarget = void 0;
this.originalEvent = void 0;
this.type = void 0;
this.originalEvent = originalEvent; // duplicate the event so that currentTarget can be changed

@@ -239,0 +240,0 @@

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

import*as e from"../utils/arr.prod.js";import*as t from"../utils/domUtils.prod.js";import s from"../utils/extend.prod.js";import n from"../utils/is.prod.js";import r from"../utils/pointerExtend.prod.js";import*as o from"../utils/pointerUtils.prod.js";class i{constructor(e){this.currentTarget=void 0,this.originalEvent=void 0,this.type=void 0,this.originalEvent=e,r(this,e)}preventOriginalDefault(){this.originalEvent.preventDefault()}stopPropagation(){this.originalEvent.stopPropagation()}stopImmediatePropagation(){this.originalEvent.stopImmediatePropagation()}}function a(e){if(!n.object(e))return{capture:!!e,passive:!1};const t=s({},e);return t.capture=!!e.capture,t.passive=!!e.passive,t}export default{id:"events",install(s){var r;const p=[],l={},c=[],u={add:v,remove:d,addDelegate(t,s,n,r,o){const i=a(o);if(!l[n]){l[n]=[];for(const e of c)v(e,n,f),v(e,n,g,!0)}const p=l[n];let u=e.find(p,(e=>e.selector===t&&e.context===s));u||(u={selector:t,context:s,listeners:[]},p.push(u)),u.listeners.push([r,i])},removeDelegate(e,t,s,n,r){const o=a(r),i=l[s];let p,c=!1;if(i)for(p=i.length-1;p>=0;p--){const r=i[p];if(r.selector===e&&r.context===t){const{listeners:e}=r;for(let r=e.length-1;r>=0;r--){const[a,{capture:l,passive:u}]=e[r];if(a===n&&l===o.capture&&u===o.passive){e.splice(r,1),e.length||(i.splice(p,1),d(t,s,f),d(t,s,g,!0)),c=!0;break}}if(c)break}}},delegateListener:f,delegateUseCapture:g,delegatedEvents:l,documents:c,targets:p,supportsOptions:!1,supportsPassive:!1};function v(t,s,n,r){const o=a(r);let i=e.find(p,(e=>e.eventTarget===t));i||(i={eventTarget:t,events:{}},p.push(i)),i.events[s]||(i.events[s]=[]),t.addEventListener&&!e.contains(i.events[s],n)&&(t.addEventListener(s,n,u.supportsOptions?o:o.capture),i.events[s].push(n))}function d(t,s,n,r){const o=a(r),i=e.findIndex(p,(e=>e.eventTarget===t)),l=p[i];if(!l||!l.events)return;if("all"===s){for(s in l.events)l.events.hasOwnProperty(s)&&d(t,s,"all");return}let c=!1;const v=l.events[s];if(v){if("all"===n){for(let e=v.length-1;e>=0;e--)d(t,s,v[e],o);return}for(let e=0;e<v.length;e++)if(v[e]===n){t.removeEventListener(s,n,u.supportsOptions?o:o.capture),v.splice(e,1),0===v.length&&(delete l.events[s],c=!0);break}}c&&!Object.keys(l.events).length&&p.splice(i,1)}function f(e,s){const r=a(s),p=new i(e),c=l[e.type],[u]=o.getEventTargets(e);let v=u;for(;n.element(v);){for(let e=0;e<c.length;e++){const s=c[e],{selector:n,context:o}=s;if(t.matchesSelector(v,n)&&t.nodeContains(o,u)&&t.nodeContains(o,v)){const{listeners:e}=s;p.currentTarget=v;for(const[t,{capture:s,passive:n}]of e)s===r.capture&&n===r.passive&&t(p)}}v=t.parentNode(v)}}function g(e){return f(e,!0)}return null==(r=s.document)||r.createElement("div").addEventListener("test",null,{get capture(){return u.supportsOptions=!0},get passive(){return u.supportsPassive=!0}}),s.events=u,u}};
import*as e from"../utils/arr.prod.js";import*as t from"../utils/domUtils.prod.js";import s from"../utils/extend.prod.js";import n from"../utils/is.prod.js";import r from"../utils/pointerExtend.prod.js";import*as o from"../utils/pointerUtils.prod.js";class i{currentTarget;originalEvent;type;constructor(e){this.originalEvent=e,r(this,e)}preventOriginalDefault(){this.originalEvent.preventDefault()}stopPropagation(){this.originalEvent.stopPropagation()}stopImmediatePropagation(){this.originalEvent.stopImmediatePropagation()}}function a(e){if(!n.object(e))return{capture:!!e,passive:!1};const t=s({},e);return t.capture=!!e.capture,t.passive=!!e.passive,t}export default{id:"events",install(s){var r;const p=[],l={},c=[],u={add:v,remove:f,addDelegate(t,s,n,r,o){const i=a(o);if(!l[n]){l[n]=[];for(const e of c)v(e,n,d),v(e,n,g,!0)}const p=l[n];let u=e.find(p,(e=>e.selector===t&&e.context===s));u||(u={selector:t,context:s,listeners:[]},p.push(u)),u.listeners.push([r,i])},removeDelegate(e,t,s,n,r){const o=a(r),i=l[s];let p,c=!1;if(i)for(p=i.length-1;p>=0;p--){const r=i[p];if(r.selector===e&&r.context===t){const{listeners:e}=r;for(let r=e.length-1;r>=0;r--){const[a,{capture:l,passive:u}]=e[r];if(a===n&&l===o.capture&&u===o.passive){e.splice(r,1),e.length||(i.splice(p,1),f(t,s,d),f(t,s,g,!0)),c=!0;break}}if(c)break}}},delegateListener:d,delegateUseCapture:g,delegatedEvents:l,documents:c,targets:p,supportsOptions:!1,supportsPassive:!1};function v(t,s,n,r){const o=a(r);let i=e.find(p,(e=>e.eventTarget===t));i||(i={eventTarget:t,events:{}},p.push(i)),i.events[s]||(i.events[s]=[]),t.addEventListener&&!e.contains(i.events[s],n)&&(t.addEventListener(s,n,u.supportsOptions?o:o.capture),i.events[s].push(n))}function f(t,s,n,r){const o=a(r),i=e.findIndex(p,(e=>e.eventTarget===t)),l=p[i];if(!l||!l.events)return;if("all"===s){for(s in l.events)l.events.hasOwnProperty(s)&&f(t,s,"all");return}let c=!1;const v=l.events[s];if(v){if("all"===n){for(let e=v.length-1;e>=0;e--)f(t,s,v[e],o);return}for(let e=0;e<v.length;e++)if(v[e]===n){t.removeEventListener(s,n,u.supportsOptions?o:o.capture),v.splice(e,1),0===v.length&&(delete l.events[s],c=!0);break}}c&&!Object.keys(l.events).length&&p.splice(i,1)}function d(e,s){const r=a(s),p=new i(e),c=l[e.type],[u]=o.getEventTargets(e);let v=u;for(;n.element(v);){for(let e=0;e<c.length;e++){const s=c[e],{selector:n,context:o}=s;if(t.matchesSelector(v,n)&&t.nodeContains(o,u)&&t.nodeContains(o,v)){const{listeners:e}=s;p.currentTarget=v;for(const[t,{capture:s,passive:n}]of e)s===r.capture&&n===r.passive&&t(p)}}v=t.parentNode(v)}}function g(e){return d(e,!0)}return null==(r=s.document)||r.createElement("div").addEventListener("test",null,{get capture(){return u.supportsOptions=!0},get passive(){return u.supportsPassive=!0}}),s.events=u,u}};
//# sourceMappingURL=events.prod.js.map

@@ -24,13 +24,16 @@ /* eslint-disable no-dupe-class-members */

options;
_actions;
target;
events = new Eventable();
_context;
_win;
_doc;
_scopeEvents;
/** @internal */
_rectChecker;
/** */
constructor(target, options, defaultContext, scopeEvents) {
this.options = void 0;
this._actions = void 0;
this.target = void 0;
this.events = new Eventable();
this._context = void 0;
this._win = void 0;
this._doc = void 0;
this._scopeEvents = void 0;
this._rectChecker = void 0;
this._actions = options.actions;

@@ -93,19 +96,19 @@ this.target = target;

else if (is.plainObject(optionValue)) {
// copy the object
// copy the object
;
actionOptions[optionName] = extend(actionOptions[optionName] || {}, clone(optionValue)); // set anabled field to true if it exists in the defaults
if (is.object(defaults.perAction[optionName]) && 'enabled' in defaults.perAction[optionName]) {
;
actionOptions[optionName] = extend(actionOptions[optionName] || {}, clone(optionValue)); // set anabled field to true if it exists in the defaults
if (is.object(defaults.perAction[optionName]) && 'enabled' in defaults.perAction[optionName]) {
;
actionOptions[optionName].enabled = optionValue.enabled !== false;
}
} // if the option value is a boolean and the default is an object
else if (is.bool(optionValue) && is.object(defaults.perAction[optionName])) {
;
actionOptions[optionName].enabled = optionValue;
} // if it's anything else, do a plain assignment
else {
;
actionOptions[optionName] = optionValue;
}
actionOptions[optionName].enabled = optionValue.enabled !== false;
}
} // if the option value is a boolean and the default is an object
else if (is.bool(optionValue) && is.object(defaults.perAction[optionName])) {
;
actionOptions[optionName].enabled = optionValue;
} // if it's anything else, do a plain assignment
else {
;
actionOptions[optionName] = optionValue;
}
}

@@ -302,7 +305,7 @@ }

else if (is.string(this.target)) {
this._scopeEvents[`${addRemove}Delegate`](this.target, this._context, type, listener, options);
} // remove listener from this Interactable's element
else {
this._scopeEvents[addRemove](this.target, type, listener, options);
}
this._scopeEvents[`${addRemove}Delegate`](this.target, this._context, type, listener, options);
} // remove listener from this Interactable's element
else {
this._scopeEvents[addRemove](this.target, type, listener, options);
}
}

@@ -309,0 +312,0 @@ }

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

import*as t from"../utils/arr.prod.js";import e from"../utils/browser.prod.js";import s from"../utils/clone.prod.js";import{getElementRect as o,matchesUpTo as i,nodeContains as n,trySelector as r}from"../utils/domUtils.prod.js";import h from"../utils/extend.prod.js";import c from"../utils/is.prod.js";import a from"../utils/normalizeListeners.prod.js";import{getWindow as l}from"../utils/window.prod.js";import{Eventable as p}from"./Eventable.prod.js";import d from"./isNonNativeEvent.prod.js";export class Interactable{get _defaults(){return{base:{},perAction:{},actions:{}}}constructor(t,e,s,o){this.options=void 0,this._actions=void 0,this.target=void 0,this.events=new p,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=o,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,o){const i=this._defaults;for(const n in o){const r=n,a=this.options[e],l=o[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(i.perAction[r])&&"enabled"in i.perAction[r]&&(a[r].enabled=!1!==l.enabled)):c.bool(l)&&c.object(i.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)),o(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||n(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)?i(s,t,e):!!c.element(t)&&n(t,s))}testIgnore(t,e,s){return!(!t||!c.element(s))&&(c.string(t)?i(s,t,e):!!c.element(t)&&n(t,s))}fire(t){return this.events.fire(t),this}_onOff(t,s,o,i){c.object(s)&&!c.array(s)&&(i=o,o=null);const n="on"===t?"add":"remove",r=a(s,o);for(let s in r){"wheel"===s&&(s=e.wheelEvent);for(const e of r[s])d(s,this._actions)?this.events[t](s,e):c.string(this.target)?this._scopeEvents[n+"Delegate"](this.target,this._context,s,e,i):this._scopeEvents[n](this.target,s,e,i)}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 o=s,i=this._actions.methodDict[o];this.options[o]={},this.setPerAction(o,h(h({},e.perAction),e.actions[o])),this[i](t[o])}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:o,context:i,listeners:n}=e[s];o===this.target&&i===this._context&&e.splice(s,1);for(let e=n.length-1;e>=0;e--)this._scopeEvents.removeDelegate(this.target,this._context,t,n[e][0],n[e][1])}}else this._scopeEvents.remove(this.target,"all")}}
import*as t from"../utils/arr.prod.js";import e from"../utils/browser.prod.js";import s from"../utils/clone.prod.js";import{getElementRect as o,matchesUpTo as n,nodeContains as i,trySelector as r}from"../utils/domUtils.prod.js";import c from"../utils/extend.prod.js";import h from"../utils/is.prod.js";import a from"../utils/normalizeListeners.prod.js";import{getWindow as l}from"../utils/window.prod.js";import{Eventable as p}from"./Eventable.prod.js";import u from"./isNonNativeEvent.prod.js";export class Interactable{get _defaults(){return{base:{},perAction:{},actions:{}}}options;_actions;target;events=new p;_context;_win;_doc;_scopeEvents;_rectChecker;constructor(t,e,s,o){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=o,this.set(e)}setOnEvents(t,e){return h.func(e.onstart)&&this.on(t+"start",e.onstart),h.func(e.onmove)&&this.on(t+"move",e.onmove),h.func(e.onend)&&this.on(t+"end",e.onend),h.func(e.oninertiastart)&&this.on(t+"inertiastart",e.oninertiastart),this}updatePerActionListeners(t,e,s){(h.array(e)||h.object(e))&&this.off(t,e),(h.array(s)||h.object(s))&&this.on(t,s)}setPerAction(e,o){const n=this._defaults;for(const i in o){const r=i,a=this.options[e],l=o[r];"listeners"===r&&this.updatePerActionListeners(e,a.listeners,l),h.array(l)?a[r]=t.from(l):h.plainObject(l)?(a[r]=c(a[r]||{},s(l)),h.object(n.perAction[r])&&"enabled"in n.perAction[r]&&(a[r].enabled=!1!==l.enabled)):h.bool(l)&&h.object(n.perAction[r])?a[r].enabled=l:a[r]=l}}getRect(t){return t=t||(h.element(this.target)?this.target:null),h.string(this.target)&&(t=t||this._context.querySelector(this.target)),o(t)}rectChecker(t){return h.func(t)?(this._rectChecker=t,this.getRect=t=>{const e=c({},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)||h.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||i(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||!!h.element(s)&&(h.string(t)?n(s,t,e):!!h.element(t)&&i(t,s))}testIgnore(t,e,s){return!(!t||!h.element(s))&&(h.string(t)?n(s,t,e):!!h.element(t)&&i(t,s))}fire(t){return this.events.fire(t),this}_onOff(t,s,o,n){h.object(s)&&!h.array(s)&&(n=o,o=null);const i="on"===t?"add":"remove",r=a(s,o);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):h.string(this.target)?this._scopeEvents[i+"Delegate"](this.target,this._context,s,e,n):this._scopeEvents[i](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;h.object(t)||(t={}),this.options=s(e.base);for(const s in this._actions.methodDict){const o=s,n=this._actions.methodDict[o];this.options[o]={},this.setPerAction(o,c(c({},e.perAction),e.actions[o])),this[n](t[o])}for(const e in t)h.func(this[e])&&this[e](t[e]);return this}unset(){if(h.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:o,context:n,listeners:i}=e[s];o===this.target&&n===this._context&&e.splice(s,1);for(let e=i.length-1;e>=0;e--)this._scopeEvents.removeDelegate(this.target,this._context,t,i[e][0],i[e][1])}}else this._scopeEvents.remove(this.target,"all")}}
//# sourceMappingURL=Interactable.prod.js.map

@@ -7,6 +7,7 @@ import * as arr from "../utils/arr.js";

// all set interactables
list = [];
selectorMap = {};
scope;
constructor(scope) {
this.list = [];
this.selectorMap = {};
this.scope = void 0;
this.scope = scope;

@@ -13,0 +14,0 @@ scope.addListeners({

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

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

@@ -7,35 +7,32 @@ import extend from "../utils/extend.js";

export class InteractEvent extends BaseEvent {
// resize
relatedTarget = null;
screenX;
screenY;
button;
buttons;
ctrlKey;
shiftKey;
altKey;
metaKey;
page;
client;
delta;
rect;
x0;
y0;
t0;
dt;
duration;
clientX0;
clientY0;
velocity;
speed;
swipe; // resize
axes;
preEnd;
/** */
constructor(interaction, event, actionName, phase, element, preEnd, type) {
super(interaction);
this.target = void 0;
this.currentTarget = void 0;
this.relatedTarget = null;
this.screenX = void 0;
this.screenY = void 0;
this.button = void 0;
this.buttons = void 0;
this.ctrlKey = void 0;
this.shiftKey = void 0;
this.altKey = void 0;
this.metaKey = void 0;
this.page = void 0;
this.client = void 0;
this.delta = void 0;
this.rect = void 0;
this.x0 = void 0;
this.y0 = void 0;
this.t0 = void 0;
this.dt = void 0;
this.duration = void 0;
this.clientX0 = void 0;
this.clientY0 = void 0;
this.velocity = void 0;
this.speed = void 0;
this.swipe = void 0;
this.timeStamp = void 0;
this.axes = void 0;
this.preEnd = void 0;
element = element || interaction.element;

@@ -42,0 +39,0 @@ const target = interaction.interactable;

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

import t from"../utils/extend.prod.js";import e from"../utils/getOriginXY.prod.js";import i from"../utils/hypot.prod.js";import{BaseEvent as s}from"./BaseEvent.prod.js";import{defaults as o}from"./options.prod.js";export class InteractEvent extends s{constructor(s,r,h,n,a,p,d){super(s),this.target=void 0,this.currentTarget=void 0,this.relatedTarget=null,this.screenX=void 0,this.screenY=void 0,this.button=void 0,this.buttons=void 0,this.ctrlKey=void 0,this.shiftKey=void 0,this.altKey=void 0,this.metaKey=void 0,this.page=void 0,this.client=void 0,this.delta=void 0,this.rect=void 0,this.x0=void 0,this.y0=void 0,this.t0=void 0,this.dt=void 0,this.duration=void 0,this.clientX0=void 0,this.clientY0=void 0,this.velocity=void 0,this.speed=void 0,this.swipe=void 0,this.timeStamp=void 0,this.axes=void 0,this.preEnd=void 0,a=a||s.element;const c=s.interactable,l=(c&&c.options||o).deltaSource,v=e(c,a,h),y="start"===n,g="end"===n,m=y?this:s.prevEvent,u=y?s.coords.start:g?{page:m.page,client:m.client,timeStamp:s.coords.cur.timeStamp}:s.coords.cur;this.page=t({},u.page),this.client=t({},u.client),this.rect=t({},s.rect),this.timeStamp=u.timeStamp,g||(this.page.x-=v.x,this.page.y-=v.y,this.client.x-=v.x,this.client.y-=v.y),this.ctrlKey=r.ctrlKey,this.altKey=r.altKey,this.shiftKey=r.shiftKey,this.metaKey=r.metaKey,this.button=r.button,this.buttons=r.buttons,this.target=a,this.currentTarget=a,this.preEnd=p,this.type=d||h+(n||""),this.interactable=c,this.t0=y?s.pointers[s.pointers.length-1].downTime:m.t0,this.x0=s.coords.start.page.x-v.x,this.y0=s.coords.start.page.y-v.y,this.clientX0=s.coords.start.client.x-v.x,this.clientY0=s.coords.start.client.y-v.y,this.delta=y||g?{x:0,y:0}:{x:this[l].x-m[l].x,y:this[l].y-m[l].y},this.dt=s.coords.delta.timeStamp,this.duration=this.timeStamp-this.t0,this.velocity=t({},s.coords.velocity[l]),this.speed=i(this.velocity.x,this.velocity.y),this.swipe=g||"inertiastart"===n?this.getSwipe():null}getSwipe(){const t=this._interaction;if(t.prevEvent.speed<600||this.timeStamp-t.prevEvent.timeStamp>150)return null;let e=180*Math.atan2(t.prevEvent.velocityY,t.prevEvent.velocityX)/Math.PI;e<0&&(e+=360);const i=112.5<=e&&e<247.5,s=202.5<=e&&e<337.5;return{up:s,down:!s&&22.5<=e&&e<157.5,left:i,right:!i&&(292.5<=e||e<67.5),angle:e,speed:t.prevEvent.speed,velocity:{x:t.prevEvent.velocityX,y:t.prevEvent.velocityY}}}preventDefault(){}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}stopPropagation(){this.propagationStopped=!0}}Object.defineProperties(InteractEvent.prototype,{pageX:{get(){return this.page.x},set(t){this.page.x=t}},pageY:{get(){return this.page.y},set(t){this.page.y=t}},clientX:{get(){return this.client.x},set(t){this.client.x=t}},clientY:{get(){return this.client.y},set(t){this.client.y=t}},dx:{get(){return this.delta.x},set(t){this.delta.x=t}},dy:{get(){return this.delta.y},set(t){this.delta.y=t}},velocityX:{get(){return this.velocity.x},set(t){this.velocity.x=t}},velocityY:{get(){return this.velocity.y},set(t){this.velocity.y=t}}});
import t from"../utils/extend.prod.js";import e from"../utils/getOriginXY.prod.js";import i from"../utils/hypot.prod.js";import{BaseEvent as s}from"./BaseEvent.prod.js";import{defaults as r}from"./options.prod.js";export class InteractEvent extends s{relatedTarget=null;screenX;screenY;button;buttons;ctrlKey;shiftKey;altKey;metaKey;page;client;delta;rect;x0;y0;t0;dt;duration;clientX0;clientY0;velocity;speed;swipe;axes;preEnd;constructor(s,o,n,p,a,c,l){super(s),a=a||s.element;const h=s.interactable,y=(h&&h.options||r).deltaSource,d=e(h,a,n),g="start"===p,v="end"===p,m=g?this:s.prevEvent,u=g?s.coords.start:v?{page:m.page,client:m.client,timeStamp:s.coords.cur.timeStamp}:s.coords.cur;this.page=t({},u.page),this.client=t({},u.client),this.rect=t({},s.rect),this.timeStamp=u.timeStamp,v||(this.page.x-=d.x,this.page.y-=d.y,this.client.x-=d.x,this.client.y-=d.y),this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.button=o.button,this.buttons=o.buttons,this.target=a,this.currentTarget=a,this.preEnd=c,this.type=l||n+(p||""),this.interactable=h,this.t0=g?s.pointers[s.pointers.length-1].downTime:m.t0,this.x0=s.coords.start.page.x-d.x,this.y0=s.coords.start.page.y-d.y,this.clientX0=s.coords.start.client.x-d.x,this.clientY0=s.coords.start.client.y-d.y,this.delta=g||v?{x:0,y:0}:{x:this[y].x-m[y].x,y:this[y].y-m[y].y},this.dt=s.coords.delta.timeStamp,this.duration=this.timeStamp-this.t0,this.velocity=t({},s.coords.velocity[y]),this.speed=i(this.velocity.x,this.velocity.y),this.swipe=v||"inertiastart"===p?this.getSwipe():null}getSwipe(){const t=this._interaction;if(t.prevEvent.speed<600||this.timeStamp-t.prevEvent.timeStamp>150)return null;let e=180*Math.atan2(t.prevEvent.velocityY,t.prevEvent.velocityX)/Math.PI;e<0&&(e+=360);const i=112.5<=e&&e<247.5,s=202.5<=e&&e<337.5;return{up:s,down:!s&&22.5<=e&&e<157.5,left:i,right:!i&&(292.5<=e||e<67.5),angle:e,speed:t.prevEvent.speed,velocity:{x:t.prevEvent.velocityX,y:t.prevEvent.velocityY}}}preventDefault(){}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}stopPropagation(){this.propagationStopped=!0}}Object.defineProperties(InteractEvent.prototype,{pageX:{get(){return this.page.x},set(t){this.page.x=t}},pageY:{get(){return this.page.y},set(t){this.page.y=t}},clientX:{get(){return this.client.x},set(t){this.client.x=t}},clientY:{get(){return this.client.y},set(t){this.client.y=t}},dx:{get(){return this.delta.x},set(t){this.delta.x=t}},dy:{get(){return this.delta.y},set(t){this.delta.y=t}},velocityX:{get(){return this.velocity.x},set(t){this.velocity.x=t}},velocityY:{get(){return this.velocity.y},set(t){this.velocity.y=t}}});
//# sourceMappingURL=InteractEvent.prod.js.map

@@ -33,9 +33,37 @@ import * as arr from "../utils/arr.js";

// current interactable being interacted with
// the target element of the interactable
// action that's ready to be fired on next move event
// keep track of added pointers
// pointerdown/mousedown/touchstart event
// previous action event
interactable = null; // the target element of the interactable
element = null;
rect = null;
_rects;
edges = null;
_scopeFire; // action that's ready to be fired on next move event
prepared = {
name: null,
axis: null,
edges: null
};
pointerType; // keep track of added pointers
pointers = []; // pointerdown/mousedown/touchstart event
downEvent = null;
downPointer = {};
_latestPointer = {
pointer: null,
event: null,
eventTarget: null
}; // previous action event
prevEvent = null;
pointerIsDown = false;
pointerWasMoved = false;
_interacting = false;
_ending = false;
_stopped = true;
_proxy = null;
simulation = null;
/** @internal */
get pointerMoveTolerance() {

@@ -49,3 +77,20 @@ return 1;

doMove = warnOnce(function (signalArg) {
this.move(signalArg);
}, 'The interaction.doMove() method has been renamed to interaction.move()');
coords = {
// Starting InteractEvent pointer coordinates
start: pointerUtils.newCoords(),
// Previous native pointer move event coordinates
prev: pointerUtils.newCoords(),
// current native pointer move event coordinates
cur: pointerUtils.newCoords(),
// Change in coordinates and time of the pointer
delta: pointerUtils.newCoords(),
// pointer velocity
velocity: pointerUtils.newCoords()
};
_id = idCounter++;
/** */
constructor({

@@ -55,46 +100,2 @@ pointerType,

}) {
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 = false;
this.pointerWasMoved = false;
this._interacting = false;
this._ending = false;
this._stopped = true;
this._proxy = null;
this.simulation = null;
this.doMove = warnOnce(function (signalArg) {
this.move(signalArg);
}, 'The interaction.doMove() method has been renamed to interaction.move()');
this.coords = {
// Starting InteractEvent pointer coordinates
start: pointerUtils.newCoords(),
// Previous native pointer move event coordinates
prev: pointerUtils.newCoords(),
// current native pointer move event coordinates
cur: pointerUtils.newCoords(),
// Change in coordinates and time of the pointer
delta: pointerUtils.newCoords(),
// pointer velocity
velocity: pointerUtils.newCoords()
};
this._id = idCounter++;
this._scopeFire = scopeFire;

@@ -101,0 +102,0 @@ this.pointerType = pointerType;

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

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

@@ -71,4 +71,4 @@ import * as dom from "../utils/domUtils.js";

else if (!firstNonActive) {
firstNonActive = interaction;
}
firstNonActive = interaction;
}
}

@@ -125,4 +125,4 @@ } // if no active mouse interaction was found use the first inactive mouse

else if (interaction.pointers.length >= 2) {
continue;
}
continue;
}

@@ -129,0 +129,0 @@ if (!interaction.interacting() && pointerType === interaction.pointerType) {

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

interact.version = "1.10.11";
interact.version = "1.10.12";
interact.scope = scope;

@@ -131,6 +131,6 @@ /**

else {
this.scope.events.add(this.scope.document, type, listener, {
options
});
}
this.scope.events.add(this.scope.document, type, listener, {
options
});
}

@@ -137,0 +137,0 @@ return this;

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

import t from"../utils/browser.prod.js";import*as e from"../utils/domUtils.prod.js";import o from"../utils/is.prod.js";import{warnOnce as s}from"../utils/misc.prod.js";import*as n from"../utils/pointerUtils.prod.js";import i from"./isNonNativeEvent.prod.js";export function createInteractStatic(r){const c=(t,e)=>{let o=r.interactables.get(t,e);return o||(o=r.interactables.new(t,e),o.events.global=c.globalEvents),o};return c.getPointerAverage=n.pointerAverage,c.getTouchBBox=n.touchBBox,c.getTouchDistance=n.touchDistance,c.getTouchAngle=n.touchAngle,c.getElementRect=e.getElementRect,c.getElementClientRect=e.getElementClientRect,c.matchesSelector=e.matchesSelector,c.closest=e.closest,c.globalEvents={},c.version="1.10.11",c.scope=r,c.use=function(t,e){return this.scope.usePlugin(t,e),this},c.isSet=function(t,e){return!!this.scope.interactables.get(t,e&&e.context)},c.on=s((function(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 o in t)this.on(o,t[o],e);return this}return i(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}),"The interact.on() method is being deprecated"),c.off=s((function(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 o in t)this.off(o,t[o],e);return this}if(i(t,this.scope.actions)){let o;t in this.globalEvents&&-1!==(o=this.globalEvents[t].indexOf(e))&&this.globalEvents[t].splice(o,1)}else this.scope.events.remove(this.scope.document,t,e,s);return this}),"The interact.off() method is being deprecated"),c.debug=function(){return this.scope},c.supportsTouch=()=>t.supportsTouch,c.supportsPointerEvent=()=>t.supportsPointerEvent,c.stop=function(){for(const t of this.scope.interactions.list)t.stop();return this},c.pointerMoveTolerance=function(t){return o.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance},c.addDocument=function(t,e){this.scope.addDocument(t,e)},c.removeDocument=function(t){this.scope.removeDocument(t)},c}
import t from"../utils/browser.prod.js";import*as e from"../utils/domUtils.prod.js";import o from"../utils/is.prod.js";import{warnOnce as s}from"../utils/misc.prod.js";import*as n from"../utils/pointerUtils.prod.js";import i from"./isNonNativeEvent.prod.js";export function createInteractStatic(r){const c=(t,e)=>{let o=r.interactables.get(t,e);return o||(o=r.interactables.new(t,e),o.events.global=c.globalEvents),o};return c.getPointerAverage=n.pointerAverage,c.getTouchBBox=n.touchBBox,c.getTouchDistance=n.touchDistance,c.getTouchAngle=n.touchAngle,c.getElementRect=e.getElementRect,c.getElementClientRect=e.getElementClientRect,c.matchesSelector=e.matchesSelector,c.closest=e.closest,c.globalEvents={},c.version="1.10.12",c.scope=r,c.use=function(t,e){return this.scope.usePlugin(t,e),this},c.isSet=function(t,e){return!!this.scope.interactables.get(t,e&&e.context)},c.on=s((function(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 o in t)this.on(o,t[o],e);return this}return i(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}),"The interact.on() method is being deprecated"),c.off=s((function(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 o in t)this.off(o,t[o],e);return this}if(i(t,this.scope.actions)){let o;t in this.globalEvents&&-1!==(o=this.globalEvents[t].indexOf(e))&&this.globalEvents[t].splice(o,1)}else this.scope.events.remove(this.scope.document,t,e,s);return this}),"The interact.off() method is being deprecated"),c.debug=function(){return this.scope},c.supportsTouch=()=>t.supportsTouch,c.supportsPointerEvent=()=>t.supportsPointerEvent,c.stop=function(){for(const t of this.scope.interactions.list)t.stop();return this},c.pointerMoveTolerance=function(t){return o.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance},c.addDocument=function(t,e){this.scope.addDocument(t,e)},c.removeDocument=function(t){this.scope.removeDocument(t)},c}
//# sourceMappingURL=InteractStatic.prod.js.map
{
"name": "@interactjs/core",
"version": "1.10.11",
"version": "1.10.12",
"main": "index",
"module": "index",
"repository": {
"type": "git",
"url": "https://github.com/taye/interact.js.git",
"directory": "packages/@interactjs/core"
},
"peerDependencies": {
"@interactjs/utils": "1.10.11"
"@interactjs/utils": "1.10.12"
},

@@ -9,0 +14,0 @@ "publishConfig": {

export class PointerInfo {
id;
pointer;
event;
downTime;
downTarget;
constructor(id, pointer, event, downTime, downTarget) {
this.id = void 0;
this.pointer = void 0;
this.event = void 0;
this.downTime = void 0;
this.downTarget = void 0;
this.id = id;

@@ -9,0 +10,0 @@ this.pointer = pointer;

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

export class PointerInfo{constructor(i,t,o,s,e){this.id=void 0,this.pointer=void 0,this.event=void 0,this.downTime=void 0,this.downTarget=void 0,this.id=i,this.pointer=t,this.event=o,this.downTime=s,this.downTarget=e}}
export class PointerInfo{id;pointer;event;downTime;downTarget;constructor(t,e,i,n,o){this.id=t,this.pointer=e,this.event=i,this.downTime=n,this.downTarget=o}}
//# sourceMappingURL=PointerInfo.prod.js.map

@@ -17,38 +17,36 @@ import browser from "../utils/browser.js";

export class Scope {
// main window
// main document
// main window
// all documents being listened to
constructor() {
this.id = `__interact_scope_${Math.floor(Math.random() * 100)}`;
this.isInitialized = false;
this.listenerMaps = [];
this.browser = browser;
this.defaults = clone(defaults);
this.Eventable = Eventable;
this.actions = {
map: {},
phases: {
start: true,
move: true,
end: true
},
methodDict: {},
phaselessTypes: {}
};
this.interactStatic = createInteractStatic(this);
this.InteractEvent = InteractEvent;
this.Interactable = void 0;
this.interactables = new InteractableSet(this);
this._win = void 0;
this.document = void 0;
this.window = void 0;
this.documents = [];
this._plugins = {
list: [],
map: {}
};
id = `__interact_scope_${Math.floor(Math.random() * 100)}`;
isInitialized = false;
listenerMaps = [];
browser = browser;
defaults = clone(defaults);
Eventable = Eventable;
actions = {
map: {},
phases: {
start: true,
move: true,
end: true
},
methodDict: {},
phaselessTypes: {}
};
interactStatic = createInteractStatic(this);
InteractEvent = InteractEvent;
Interactable;
interactables = new InteractableSet(this); // main window
this.onWindowUnload = event => this.removeDocument(event.target);
_win; // main document
document; // main window
window; // all documents being listened to
documents = [];
_plugins = {
list: [],
map: {}
};
constructor() {
const scope = this;

@@ -71,3 +69,6 @@ this.Interactable = class extends InteractableBase {

super.unset();
scope.interactables.list.splice(scope.interactables.list.indexOf(this), 1);
const index = scope.interactables.list.indexOf(this);
if (index < 0) return;
super.unset();
scope.interactables.list.splice(index, 1);
scope.fire('interactable:unset', {

@@ -100,2 +101,4 @@ interactable: this

onWindowUnload = event => this.removeDocument(event.target);
init(window) {

@@ -102,0 +105,0 @@ return this.isInitialized ? this : initScope(this, window);

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

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

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