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

@interactjs/core

Package Overview
Dependencies
Maintainers
2
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interactjs/core - npm Package Compare versions

Comparing version 1.10.23 to 1.10.24

1

BaseEvent.d.ts

@@ -9,3 +9,2 @@ import type { Interactable } from '@interactjs/core/Interactable';

interactable: Interactable;
_interaction: Interaction<T>;
timeStamp: number;

@@ -12,0 +11,0 @@ immediatePropagationStopped: boolean;

15

BaseEvent.js
export class BaseEvent {
/** @internal */
immediatePropagationStopped = false;
propagationStopped = false;
constructor(interaction) {
this._interaction = interaction;
}
preventDefault() {}
preventDefault() {}
/**
* Don't call any other listeners (even on the current target)
*/
stopPropagation() {
this.propagationStopped = true;
}
/**
* Don't call listeners on the remaining targets
*/
stopImmediatePropagation() {
this.immediatePropagationStopped = this.propagationStopped = true;
}
}
} // defined outside of class definition to avoid assignment of undefined during
// defined outside of class definition to avoid assignment of undefined during
// construction

@@ -36,6 +35,4 @@

},
set() {}
});
//# sourceMappingURL=BaseEvent.js.map

@@ -0,3 +1,3 @@

import type { NormalizedListeners } from '@interactjs/utils/normalizeListeners';
import type { ListenersArg, Rect } from '@interactjs/core/types';
import type { NormalizedListeners } from '@interactjs/utils/normalizeListeners';
export declare class Eventable {

@@ -4,0 +4,0 @@ options: any;

import * as arr from "../utils/arr.js";
import extend from "../utils/extend.js";
import normalize from "../utils/normalizeListeners.js";
function fireUntilImmediateStopped(event, listeners) {

@@ -10,7 +9,5 @@ for (const listener of listeners) {

}
listener(event);
}
}
export class Eventable {

@@ -22,17 +19,16 @@ options;

global;
constructor(options) {
this.options = extend({}, options || {});
}
fire(event) {
let listeners;
const global = this.global; // Interactable#on() listeners
const global = this.global;
// Interactable#on() listeners
// tslint:disable no-conditional-assignment
if (listeners = this.types[event.type]) {
fireUntilImmediateStopped(event, listeners);
} // interact.on() listeners
}
// interact.on() listeners
if (!event.propagationStopped && global && (listeners = global[event.type])) {

@@ -42,6 +38,4 @@ fireUntilImmediateStopped(event, listeners);

}
on(type, listener) {
const listeners = normalize(type, listener);
for (type in listeners) {

@@ -51,16 +45,11 @@ this.types[type] = arr.merge(this.types[type] || [], listeners[type]);

}
off(type, listener) {
const listeners = normalize(type, listener);
for (type in listeners) {
const eventList = this.types[type];
if (!eventList || !eventList.length) {
continue;
}
for (const subListener of listeners[type]) {
const index = eventList.indexOf(subListener);
if (index !== -1) {

@@ -72,8 +61,6 @@ eventList.splice(index, 1);

}
getRect(_element) {
return null;
}
}
//# sourceMappingURL=Eventable.js.map

@@ -13,4 +13,4 @@ import type { Scope } from '@interactjs/core/scope';

}
declare type PartialEventTarget = Partial<NativeEventTarget>;
declare type ListenerEntry = {
type PartialEventTarget = Partial<NativeEventTarget>;
type ListenerEntry = {
func: (event: Event | FakeEvent) => any;

@@ -17,0 +17,0 @@ options: EventOptions;

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

import * as pointerUtils from "../utils/pointerUtils.js";
function install(scope) {
var _scope$document;
const targets = [];

@@ -26,4 +24,5 @@ const delegatedEvents = {};

supportsPassive: false
}; // check if browser supports passive events and options arg
};
// check if browser supports passive events and options arg
(_scope$document = scope.document) == null ? void 0 : _scope$document.createElement('div').addEventListener('test', null, {

@@ -33,10 +32,7 @@ get capture() {

},
get passive() {
return eventsMethods.supportsPassive = true;
}
});
scope.events = eventsMethods;
function add(eventTarget, type, listener, optionalArg) {

@@ -46,3 +42,2 @@ if (!eventTarget.addEventListener) return;

let target = arr.find(targets, t => t.eventTarget === eventTarget);
if (!target) {

@@ -55,7 +50,5 @@ target = {

}
if (!target.events[type]) {
target.events[type] = [];
}
if (!arr.find(target.events[type], l => l.func === listener && optionsMatch(l.options, options))) {

@@ -69,3 +62,2 @@ eventTarget.addEventListener(type, listener, eventsMethods.supportsOptions ? options : options.capture);

}
function remove(eventTarget, type, listener, optionalArg) {

@@ -75,7 +67,5 @@ if (!eventTarget.addEventListener || !eventTarget.removeEventListener) return;

const target = targets[targetIndex];
if (!target || !target.events) {
return;
}
if (type === 'all') {

@@ -87,9 +77,6 @@ for (type in target.events) {

}
return;
}
let typeIsEmpty = false;
const typeListeners = target.events[type];
if (typeListeners) {

@@ -101,14 +88,10 @@ if (listener === 'all') {

}
return;
} else {
const options = getOptions(optionalArg);
for (let i = 0; i < typeListeners.length; i++) {
const entry = typeListeners[i];
if (entry.func === listener && optionsMatch(entry.options, options)) {
eventTarget.removeEventListener(type, listener, eventsMethods.supportsOptions ? options : options.capture);
typeListeners.splice(i, 1);
if (typeListeners.length === 0) {

@@ -118,3 +101,2 @@ delete target.events[type];

}
break;

@@ -125,3 +107,2 @@ }

}
if (typeIsEmpty && !Object.keys(target.events).length) {

@@ -131,9 +112,8 @@ targets.splice(targetIndex, 1);

}
function addDelegate(selector, context, type, listener, optionalArg) {
const options = getOptions(optionalArg);
if (!delegatedEvents[type]) {
delegatedEvents[type] = []; // add delegate listener functions
delegatedEvents[type] = [];
// add delegate listener functions
for (const doc of documents) {

@@ -144,6 +124,4 @@ add(doc, type, delegateListener);

}
const delegates = delegatedEvents[type];
let delegate = arr.find(delegates, d => d.selector === selector && d.context === context);
if (!delegate) {

@@ -157,3 +135,2 @@ delegate = {

}
delegate.listeners.push({

@@ -164,3 +141,2 @@ func: listener,

}
function removeDelegate(selector, context, type, listener, optionalArg) {

@@ -171,28 +147,33 @@ const options = getOptions(optionalArg);

let index;
if (!delegates) return; // count from last index of delegated to 0
if (!delegates) return;
// count from last index of delegated to 0
for (index = delegates.length - 1; index >= 0; index--) {
const cur = delegates[index]; // look for matching selector and context Node
const cur = delegates[index];
// look for matching selector and context Node
if (cur.selector === selector && cur.context === context) {
const {
listeners
} = cur; // each item of the listeners array is an array: [function, capture, passive]
} = cur;
// each item of the listeners array is an array: [function, capture, passive]
for (let i = listeners.length - 1; i >= 0; i--) {
const entry = listeners[i]; // check if the listener functions and capture and passive flags match
const entry = listeners[i];
// check if the listener functions and capture and passive flags match
if (entry.func === listener && optionsMatch(entry.options, options)) {
// remove the listener from the array of listeners
listeners.splice(i, 1); // if all listeners for this target have been removed
listeners.splice(i, 1);
// if all listeners for this target have been removed
// remove the target from the delegates array
if (!listeners.length) {
delegates.splice(index, 1); // remove delegate function from context
delegates.splice(index, 1);
// remove delegate function from context
remove(context, type, delegateListener);
remove(context, type, delegateUseCapture, true);
} // only remove one listener
}
// only remove one listener
matchFound = true;

@@ -202,3 +183,2 @@ break;

}
if (matchFound) {

@@ -209,6 +189,6 @@ break;

}
} // bound to the interactable context when a DOM event
}
// bound to the interactable context when a DOM event
// listener is added to a selector interactable
function delegateListener(event, optionalArg) {

@@ -219,4 +199,5 @@ const options = getOptions(optionalArg);

const [eventTarget] = pointerUtils.getEventTargets(event);
let element = eventTarget; // climb up document tree looking for selector matches
let element = eventTarget;
// climb up document tree looking for selector matches
while (is.element(element)) {

@@ -229,3 +210,2 @@ for (let i = 0; i < delegates.length; i++) {

} = cur;
if (domUtils.matchesSelector(element, selector) && domUtils.nodeContains(context, eventTarget) && domUtils.nodeContains(context, element)) {

@@ -236,3 +216,2 @@ const {

fakeEvent.currentTarget = element;
for (const entry of listeners) {

@@ -245,15 +224,12 @@ if (optionsMatch(entry.options, options)) {

}
element = domUtils.parentNode(element);
}
}
function delegateUseCapture(event) {
return delegateListener.call(this, event, true);
} // for type inferrence
}
// for type inferrence
return eventsMethods;
}
class FakeEvent {

@@ -263,23 +239,17 @@ currentTarget;

type;
constructor(originalEvent) {
this.originalEvent = originalEvent; // duplicate the event so that currentTarget can be changed
this.originalEvent = originalEvent;
// duplicate the event so that currentTarget can be changed
pExtend(this, originalEvent);
}
preventOriginalDefault() {
this.originalEvent.preventDefault();
}
stopPropagation() {
this.originalEvent.stopPropagation();
}
stopImmediatePropagation() {
this.originalEvent.stopImmediatePropagation();
}
}
function getOptions(param) {

@@ -292,3 +262,2 @@ if (!is.object(param)) {

}
return {

@@ -299,3 +268,2 @@ capture: !!param.capture,

}
function optionsMatch(a, b) {

@@ -306,3 +274,2 @@ if (a === b) return true;

}
export default {

@@ -309,0 +276,0 @@ id: 'events',

import type { Scope } from '@interactjs/core/scope';
import type { ActionName, Actions, Context, Element, EventTypes, Listeners, ListenersArg, OrBoolean, Target } from '@interactjs/core/types';
import type { ActionName, Context, Element, EventTypes, Listeners, ListenersArg, OrBoolean, Target } from '@interactjs/core/types';
import { Eventable } from './Eventable';
import type { OptionsArg, Options } from './options';
declare type IgnoreValue = string | Element | boolean;
declare type DeltaSource = 'page' | 'client';
declare const enum OnOffMethod {
On = 0,
Off = 1
}
/** */
type DeltaSource = 'page' | 'client';
/**
* ```ts
* const interactable = interact('.cards')
* .draggable({
* listeners: { move: event => console.log(event.type, event.pageX, event.pageY) }
* })
* .resizable({
* listeners: { move: event => console.log(event.rect) },
* modifiers: [interact.modifiers.restrictEdges({ outer: 'parent' })]
* })
* ```
*/
export declare class Interactable implements Partial<Eventable> {
readonly options: Required<Options>;
readonly _actions: Actions;
readonly target: Target;
readonly events: Eventable;
readonly _context: Context;
readonly _win: Window;
readonly _doc: Document;
readonly _scopeEvents: Scope['events'];
/** */
constructor(target: Target, options: any, defaultContext: Document | Element, scopeEvents: Scope['events']);

@@ -44,3 +42,2 @@ setOnEvents(actionName: ActionName, phases: NonNullable<any>): this;

rectChecker(checker: (element: Element) => any): this;
_backCompatOption(optionName: keyof Options, newValue: any): any;
/**

@@ -75,8 +72,2 @@ * Gets or sets the origin of the Interactable's element. The x and y

inContext(element: Document | Node): boolean;
testIgnoreAllow(this: Interactable, options: {
ignoreFrom?: IgnoreValue;
allowFrom?: IgnoreValue;
}, targetNode: Node, eventTarget: Node): boolean;
testAllow(this: Interactable, allowFrom: IgnoreValue | undefined, targetNode: Node, element: Node): boolean;
testIgnore(this: Interactable, ignoreFrom: IgnoreValue | undefined, targetNode: Node, element: Node): boolean;
/**

@@ -93,3 +84,2 @@ * Calls listeners for the given InteractEvent type bound globally

}>(iEvent: E): this;
_onOff(method: OnOffMethod, typeArg: EventTypes, listenerArg?: ListenersArg | null, options?: any, filter?: (type: string) => boolean): this;
/**

@@ -96,0 +86,0 @@ * Binds a listener for an InteractEvent, pointerEvent or DOM event.

@@ -12,13 +12,21 @@ /* eslint-disable no-dupe-class-members */

import { Eventable } from './Eventable';
var OnOffMethod;
/** */
(function (OnOffMethod) {
var OnOffMethod = /*#__PURE__*/function (OnOffMethod) {
OnOffMethod[OnOffMethod["On"] = 0] = "On";
OnOffMethod[OnOffMethod["Off"] = 1] = "Off";
})(OnOffMethod || (OnOffMethod = {}));
return OnOffMethod;
}(OnOffMethod || {});
/**
* ```ts
* const interactable = interact('.cards')
* .draggable({
* listeners: { move: event => console.log(event.type, event.pageX, event.pageY) }
* })
* .resizable({
* listeners: { move: event => console.log(event.rect) },
* modifiers: [interact.modifiers.restrictEdges({ outer: 'parent' })]
* })
* ```
*/
export class Interactable {
/** @internal */
get _defaults() {
/** @internal */get _defaults() {
return {

@@ -30,13 +38,17 @@ base: {},

}
target;
/** @internal */
options;
/** @internal */
_actions;
target;
/** @internal */
events = new Eventable();
/** @internal */
_context;
/** @internal */
_win;
/** @internal */
_doc;
/** @internal */
_scopeEvents;
/** */
constructor(target, options, defaultContext, scopeEvents) {

@@ -51,3 +63,2 @@ this._actions = options.actions;

}
setOnEvents(actionName, phases) {

@@ -57,29 +68,20 @@ if (is.func(phases.onstart)) {

}
if (is.func(phases.onmove)) {
this.on(`${actionName}move`, phases.onmove);
}
if (is.func(phases.onend)) {
this.on(`${actionName}end`, phases.onend);
}
if (is.func(phases.oninertiastart)) {
this.on(`${actionName}inertiastart`, phases.oninertiastart);
}
return this;
}
updatePerActionListeners(actionName, prev, cur) {
var _this$_actions$map$ac;
const actionFilter = (_this$_actions$map$ac = this._actions.map[actionName]) == null ? void 0 : _this$_actions$map$ac.filterEventType;
const filter = type => (actionFilter == null || actionFilter(type)) && isNonNativeEvent(type, this._actions);
if (is.array(prev) || is.object(prev)) {
this._onOff(OnOffMethod.Off, actionName, prev, undefined, filter);
}
if (is.array(cur) || is.object(cur)) {

@@ -89,25 +91,28 @@ this._onOff(OnOffMethod.On, actionName, cur, undefined, filter);

}
setPerAction(actionName, options) {
const defaults = this._defaults; // for all the default per-action options
const defaults = this._defaults;
// for all the default per-action options
for (const optionName_ in options) {
const optionName = optionName_;
const actionOptions = this.options[actionName];
const optionValue = options[optionName]; // remove old event listeners and add new ones
const optionValue = options[optionName];
// remove old event listeners and add new ones
if (optionName === 'listeners') {
this.updatePerActionListeners(actionName, actionOptions.listeners, optionValue);
} // if the option value is an array
}
// if the option value is an array
if (is.array(optionValue)) {
;
actionOptions[optionName] = arr.from(optionValue);
} // if the option value is an object
}
// if the option value is an object
else if (is.plainObject(optionValue)) {
// copy the object
;
actionOptions[optionName] = extend(actionOptions[optionName] || {}, clone(optionValue)); // set anabled field to true if it exists in the defaults
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]) {

@@ -117,7 +122,9 @@ ;

}
} // if the option value is a boolean and the default is an object
}
// 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
}
// if it's anything else, do a plain assignment
else {

@@ -129,2 +136,3 @@ ;

}
/**

@@ -137,13 +145,10 @@ * The default function to get an Interactables bounding rect. Can be

*/
getRect(element) {
element = element || (is.element(this.target) ? this.target : null);
if (is.string(this.target)) {
element = element || this._context.querySelector(this.target);
}
return getElementRect(element);
}
/**

@@ -158,3 +163,2 @@ * Returns or sets the function used to calculate the interactable's

rectChecker(checker) {

@@ -164,3 +168,2 @@ if (is.func(checker)) {

const rect = extend({}, checker.apply(this, element));
if (!('width' in rect)) {

@@ -170,9 +173,6 @@ rect.width = rect.right - rect.left;

}
return rect;
};
return this;
}
if (checker === null) {

@@ -182,6 +182,6 @@ delete this.getRect;

}
return this.getRect;
}
/** @internal */
_backCompatOption(optionName, newValue) {

@@ -191,3 +191,2 @@ if (trySelector(newValue) || is.object(newValue)) {

this.options[optionName] = newValue;
for (const action in this._actions.map) {

@@ -197,8 +196,7 @@ ;

}
return this;
}
return this.options[optionName];
}
/**

@@ -214,7 +212,6 @@ * Gets or sets the origin of the Interactable's element. The x and y

*/
origin(newValue) {
return this._backCompatOption('origin', newValue);
}
/**

@@ -229,3 +226,2 @@ * Returns or sets the mouse coordinate types used to calculate the

deltaSource(newValue) {

@@ -236,8 +232,6 @@ if (newValue === 'page' || newValue === 'client') {

}
return this.options.deltaSource;
}
/** @internal */
getAllElements() {

@@ -247,13 +241,11 @@ const {

} = this;
if (is.string(target)) {
return Array.from(this._context.querySelectorAll(target));
}
if (is.func(target) && target.getAllElements) {
return target.getAllElements();
}
return is.element(target) ? [target] : [];
}
/**

@@ -265,8 +257,5 @@ * Gets the selector context Node of the Interactable. The default is

*/
context() {
return this._context;
}
inContext(element) {

@@ -276,2 +265,3 @@ return this._context === element.ownerDocument || nodeContains(this._context, element);

/** @internal */
testIgnoreAllow(options, targetNode, eventTarget) {

@@ -281,2 +271,3 @@ return !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) && this.testAllow(options.allowFrom, targetNode, eventTarget);

/** @internal */
testAllow(allowFrom, targetNode, element) {

@@ -286,7 +277,5 @@ if (!allowFrom) {

}
if (!is.element(element)) {
return false;
}
if (is.string(allowFrom)) {

@@ -297,6 +286,6 @@ return matchesUpTo(element, allowFrom, targetNode);

}
return false;
}
/** @internal */
testIgnore(ignoreFrom, targetNode, element) {

@@ -306,3 +295,2 @@ if (!ignoreFrom || !is.element(element)) {

}
if (is.string(ignoreFrom)) {

@@ -313,5 +301,5 @@ return matchesUpTo(element, ignoreFrom, targetNode);

}
return false;
}
/**

@@ -325,4 +313,2 @@ * Calls listeners for the given InteractEvent type bound globally

*/
fire(iEvent) {

@@ -333,2 +319,3 @@ this.events.fire(iEvent);

/** @internal */
_onOff(method, typeArg, listenerArg, options, filter) {

@@ -339,5 +326,3 @@ if (is.object(typeArg) && !is.array(typeArg)) {

}
const listeners = normalizeListeners(typeArg, listenerArg, filter);
for (let type in listeners) {

@@ -347,3 +332,2 @@ if (type === 'wheel') {

}
for (const listener of listeners[type]) {

@@ -353,6 +337,8 @@ // if it is an action event type

this.events[method === OnOffMethod.On ? 'on' : 'off'](type, listener);
} // delegated event
}
// delegated event
else if (is.string(this.target)) {
this._scopeEvents[method === OnOffMethod.On ? 'addDelegate' : 'removeDelegate'](this.target, this._context, type, listener, options);
} // remove listener from this Interactable's element
}
// remove listener from this Interactable's element
else {

@@ -363,5 +349,5 @@ this._scopeEvents[method === OnOffMethod.On ? 'add' : 'remove'](this.target, type, listener, options);

}
return this;
}
/**

@@ -377,7 +363,6 @@ * Binds a listener for an InteractEvent, pointerEvent or DOM event.

*/
on(types, listener, options) {
return this._onOff(OnOffMethod.On, types, listener, options);
}
/**

@@ -393,7 +378,6 @@ * Removes an InteractEvent, pointerEvent or DOM event listener.

*/
off(types, listener, options) {
return this._onOff(OnOffMethod.Off, types, listener, options);
}
/**

@@ -405,14 +389,9 @@ * Reset the options of this Interactable

*/
set(options) {
const defaults = this._defaults;
if (!is.object(options)) {
options = {};
}
;
this.options = clone(defaults.base);
for (const actionName_ in this._actions.methodDict) {

@@ -425,3 +404,2 @@ const actionName = actionName_;

}
for (const setting in options) {

@@ -432,3 +410,2 @@ if (setting === 'getRect') {

}
if (is.func(this[setting])) {

@@ -439,5 +416,5 @@ ;

}
return this;
}
/**

@@ -447,4 +424,2 @@ * Remove this interactable from the list of interactables and remove it's

*/
unset() {

@@ -455,3 +430,2 @@ if (is.string(this.target)) {

const delegated = this._scopeEvents.delegatedEvents[type];
for (let i = delegated.length - 1; i >= 0; i--) {

@@ -463,7 +437,5 @@ const {

} = delegated[i];
if (selector === this.target && context === this._context) {
delegated.splice(i, 1);
}
for (let l = listeners.length - 1; l >= 0; l--) {

@@ -478,4 +450,3 @@ this._scopeEvents.removeDelegate(this.target, this._context, type, listeners[l][0], listeners[l][1]);

}
}
//# sourceMappingURL=Interactable.js.map

@@ -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 n,matchesUpTo as o,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 l from"../utils/isNonNativeEvent.prod.js";import a from"../utils/normalizeListeners.prod.js";import{getWindow as f}from"../utils/window.prod.js";import{Eventable as p}from"./Eventable";var u;(t=>{t[t.On=0]="On",t[t.Off=1]="Off"})(u||(u={}));export class Interactable{get _defaults(){return{base:{},perAction:{},actions:{}}}options;_actions;target;events=new p;_context;_win;_doc;_scopeEvents;constructor(t,e,s,n){this._actions=e.actions,this.target=t,this._context=e.context||s,this._win=f(r(t)?this._context:t),this._doc=this._win.document,this._scopeEvents=n,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){var n;const o=null==(n=this._actions.map[t])?void 0:n.filterEventType,i=t=>(null==o||o(t))&&l(t,this._actions);(h.array(e)||h.object(e))&&this._onOff(u.Off,t,e,void 0,i),(h.array(s)||h.object(s))&&this._onOff(u.On,t,s,void 0,i)}setPerAction(e,n){const o=this._defaults;for(const i in n){const r=i,l=this.options[e],a=n[r];"listeners"===r&&this.updatePerActionListeners(e,l.listeners,a),h.array(a)?l[r]=t.from(a):h.plainObject(a)?(l[r]=c(l[r]||{},s(a)),h.object(o.perAction[r])&&"enabled"in o.perAction[r]&&(l[r].enabled=!1!==a.enabled)):h.bool(a)&&h.object(o.perAction[r])?l[r].enabled=a:l[r]=a}}getRect(t){return t=t||(h.element(this.target)?this.target:null),h.string(this.target)&&(t=t||this._context.querySelector(this.target)),n(t)}rectChecker(t){return h.func(t)?(this.getRect=e=>{const s=c({},t.apply(this,e));return"width"in s||(s.width=s.right-s.left,s.height=s.bottom-s.top),s},this):null===t?(delete this.getRect,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}getAllElements(){const{target:t}=this;return h.string(t)?Array.from(this._context.querySelectorAll(t)):h.func(t)&&t.getAllElements?t.getAllElements():h.element(t)?[t]:[]}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)?o(s,t,e):!!h.element(t)&&i(t,s))}testIgnore(t,e,s){return!(!t||!h.element(s))&&(h.string(t)?o(s,t,e):!!h.element(t)&&i(t,s))}fire(t){return this.events.fire(t),this}_onOff(t,s,n,o,i){h.object(s)&&!h.array(s)&&(o=n,n=null);const r=a(s,n,i);for(let s in r){"wheel"===s&&(s=e.wheelEvent);for(const e of r[s])l(s,this._actions)?this.events[t===u.On?"on":"off"](s,e):h.string(this.target)?this._scopeEvents[t===u.On?"addDelegate":"removeDelegate"](this.target,this._context,s,e,o):this._scopeEvents[t===u.On?"add":"remove"](this.target,s,e,o)}return this}on(t,e,s){return this._onOff(u.On,t,e,s)}off(t,e,s){return this._onOff(u.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 n=s,o=this._actions.methodDict[n];this.options[n]={},this.setPerAction(n,c(c({},e.perAction),e.actions[n])),this[o](t[n])}for(const e in t)"getRect"!==e?h.func(this[e])&&this[e](t[e]):this.rectChecker(t.getRect);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:n,context:o,listeners:i}=e[s];n===this.target&&o===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")}}
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 n,matchesUpTo as o,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 l from"../utils/isNonNativeEvent.prod.js";import a from"../utils/normalizeListeners.prod.js";import{getWindow as f}from"../utils/window.prod.js";import{Eventable as p}from"./Eventable";var u=(t=>(t[t.On=0]="On",t[t.Off=1]="Off",t))(u||{});export class Interactable{get _defaults(){return{base:{},perAction:{},actions:{}}}target;options;_actions;events=new p;_context;_win;_doc;_scopeEvents;constructor(t,e,s,n){this._actions=e.actions,this.target=t,this._context=e.context||s,this._win=f(r(t)?this._context:t),this._doc=this._win.document,this._scopeEvents=n,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){var n;const o=null==(n=this._actions.map[t])?void 0:n.filterEventType,i=t=>(null==o||o(t))&&l(t,this._actions);(h.array(e)||h.object(e))&&this._onOff(u.Off,t,e,void 0,i),(h.array(s)||h.object(s))&&this._onOff(u.On,t,s,void 0,i)}setPerAction(e,n){const o=this._defaults;for(const i in n){const r=i,l=this.options[e],a=n[r];"listeners"===r&&this.updatePerActionListeners(e,l.listeners,a),h.array(a)?l[r]=t.from(a):h.plainObject(a)?(l[r]=c(l[r]||{},s(a)),h.object(o.perAction[r])&&"enabled"in o.perAction[r]&&(l[r].enabled=!1!==a.enabled)):h.bool(a)&&h.object(o.perAction[r])?l[r].enabled=a:l[r]=a}}getRect(t){return t=t||(h.element(this.target)?this.target:null),h.string(this.target)&&(t=t||this._context.querySelector(this.target)),n(t)}rectChecker(t){return h.func(t)?(this.getRect=e=>{const s=c({},t.apply(this,e));return"width"in s||(s.width=s.right-s.left,s.height=s.bottom-s.top),s},this):null===t?(delete this.getRect,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}getAllElements(){const{target:t}=this;return h.string(t)?Array.from(this._context.querySelectorAll(t)):h.func(t)&&t.getAllElements?t.getAllElements():h.element(t)?[t]:[]}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)?o(s,t,e):!!h.element(t)&&i(t,s))}testIgnore(t,e,s){return!(!t||!h.element(s))&&(h.string(t)?o(s,t,e):!!h.element(t)&&i(t,s))}fire(t){return this.events.fire(t),this}_onOff(t,s,n,o,i){h.object(s)&&!h.array(s)&&(o=n,n=null);const r=a(s,n,i);for(let s in r){"wheel"===s&&(s=e.wheelEvent);for(const e of r[s])l(s,this._actions)?this.events[t===u.On?"on":"off"](s,e):h.string(this.target)?this._scopeEvents[t===u.On?"addDelegate":"removeDelegate"](this.target,this._context,s,e,o):this._scopeEvents[t===u.On?"add":"remove"](this.target,s,e,o)}return this}on(t,e,s){return this._onOff(u.On,t,e,s)}off(t,e,s){return this._onOff(u.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 n=s,o=this._actions.methodDict[n];this.options[n]={},this.setPerAction(n,c(c({},e.perAction),e.actions[n])),this[o](t[n])}for(const e in t)"getRect"!==e?h.func(this[e])&&this[e](t[e]):this.rectChecker(t.getRect);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:n,context:o,listeners:i}=e[s];n===this.target&&o===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

@@ -1,12 +0,21 @@

import type { Interactable } from '@interactjs/core/Interactable';
import type { Scope } from '@interactjs/core/scope';
type PreventDefaultValue = 'always' | 'never' | 'auto';
declare module '@interactjs/core/Interactable' {
interface Interactable {
preventDefault: typeof preventDefault;
checkAndPreventDefault: (event: Event) => void;
preventDefault(newValue: PreventDefaultValue): this;
preventDefault(): PreventDefaultValue;
/**
* Returns or sets whether to prevent the browser's default behaviour in
* response to pointer events. Can be set to:
* - `'always'` to always prevent
* - `'never'` to never prevent
* - `'auto'` to let interact.js try to determine what would be best
*
* @param newValue - `'always'`, `'never'` or `'auto'`
* @returns The current setting or this Interactable
*/
preventDefault(newValue?: PreventDefaultValue): PreventDefaultValue | this;
checkAndPreventDefault(event: Event): void;
}
}
declare type PreventDefaultValue = 'always' | 'never' | 'auto';
declare function preventDefault(this: Interactable): PreventDefaultValue;
declare function preventDefault(this: Interactable, newValue: PreventDefaultValue): typeof this;
export declare function install(scope: Scope): void;

@@ -13,0 +22,0 @@ declare const _default: {

import { matchesSelector, nodeContains } from "../utils/domUtils.js";
import is from "../utils/is.js";
import { getWindow } from "../utils/window.js";
function preventDefault(newValue) {
const preventDefault = function preventDefault(newValue) {
if (/^(always|never|auto)$/.test(newValue)) {

@@ -10,3 +9,2 @@ this.options.preventDefault = newValue;

}
if (is.bool(newValue)) {

@@ -16,41 +14,36 @@ this.options.preventDefault = newValue ? 'always' : 'never';

}
return this.options.preventDefault;
}
};
function checkAndPreventDefault(interactable, scope, event) {
const setting = interactable.options.preventDefault;
if (setting === 'never') return;
if (setting === 'always') {
event.preventDefault();
return;
} // setting === 'auto'
}
// setting === 'auto'
// if the browser supports passive event listeners and isn't running on iOS,
// don't preventDefault of touch{start,move} events. CSS touch-action and
// user-select should be used instead of calling event.preventDefault().
if (scope.events.supportsPassive && /^touch(start|move)$/.test(event.type)) {
const doc = getWindow(event.target).document;
const docOptions = scope.getDocOptions(doc);
if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) {
return;
}
} // don't preventDefault of pointerdown events
}
// don't preventDefault of pointerdown events
if (/^(mouse|pointer|touch)*(down|start)/i.test(event.type)) {
return;
} // don't preventDefault on editable elements
}
// don't preventDefault on editable elements
if (is.element(event.target) && matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) {
return;
}
event.preventDefault();
}
function onInteractionEvent({

@@ -64,29 +57,14 @@ interaction,

}
export function install(scope) {
/** @lends Interactable */
const {
Interactable
} = scope;
/**
* Returns or sets whether to prevent the browser's default behaviour in
* response to pointer events. Can be set to:
* - `'always'` to always prevent
* - `'never'` to never prevent
* - `'auto'` to let interact.js try to determine what would be best
*
* @param {string} [newValue] `'always'`, `'never'` or `'auto'`
* @return {string | Interactable} The current setting or this Interactable
*/
Interactable.prototype.preventDefault = preventDefault;
Interactable.prototype.checkAndPreventDefault = function (event) {
return checkAndPreventDefault(this, scope, event);
}; // prevent native HTML5 drag on interact.js target elements
};
// prevent native HTML5 drag on interact.js target elements
scope.interactions.docEvents.push({
type: 'dragstart',
listener(event) {

@@ -100,3 +78,2 @@ for (const interaction of scope.interactions.list) {

}
});

@@ -103,0 +80,0 @@ }

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

import{matchesSelector as t,nodeContains as e}from"../utils/domUtils.prod.js";import n from"../utils/is.prod.js";import{getWindow as r}from"../utils/window.prod.js";function o(t){return/^(always|never|auto)$/.test(t)?(this.options.preventDefault=t,this):n.bool(t)?(this.options.preventDefault=t?"always":"never",this):this.options.preventDefault}function i({interaction:t,event:e}){t.interactable&&t.interactable.checkAndPreventDefault(e)}export function install(i){const{Interactable:s}=i;s.prototype.preventDefault=o,s.prototype.checkAndPreventDefault=function(e){return((e,o,i)=>{const s=e.options.preventDefault;if("never"!==s)if("always"!==s){if(o.events.supportsPassive&&/^touch(start|move)$/.test(i.type)){const t=r(i.target).document,e=o.getDocOptions(t);if(!e||!e.events||!1!==e.events.passive)return}/^(mouse|pointer|touch)*(down|start)/i.test(i.type)||n.element(i.target)&&t(i.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||i.preventDefault()}else i.preventDefault()})(this,i,e)},i.interactions.docEvents.push({type:"dragstart",listener(t){for(const n of i.interactions.list)if(n.element&&(n.element===t.target||e(n.element,t.target)))return void n.interactable.checkAndPreventDefault(t)}})}export default{id:"core/interactablePreventDefault",install:install,listeners:["down","move","up","cancel"].reduce(((t,e)=>(t["interactions:"+e]=i,t)),{})};
import{matchesSelector as t,nodeContains as e}from"../utils/domUtils.prod.js";import n from"../utils/is.prod.js";import{getWindow as r}from"../utils/window.prod.js";const o=function(t){return/^(always|never|auto)$/.test(t)?(this.options.preventDefault=t,this):n.bool(t)?(this.options.preventDefault=t?"always":"never",this):this.options.preventDefault};function s({interaction:t,event:e}){t.interactable&&t.interactable.checkAndPreventDefault(e)}export function install(s){const{Interactable:i}=s;i.prototype.preventDefault=o,i.prototype.checkAndPreventDefault=function(e){return((e,o,s)=>{const i=e.options.preventDefault;if("never"!==i)if("always"!==i){if(o.events.supportsPassive&&/^touch(start|move)$/.test(s.type)){const t=r(s.target).document,e=o.getDocOptions(t);if(!e||!e.events||!1!==e.events.passive)return}/^(mouse|pointer|touch)*(down|start)/i.test(s.type)||n.element(s.target)&&t(s.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||s.preventDefault()}else s.preventDefault()})(this,s,e)},s.interactions.docEvents.push({type:"dragstart",listener(t){for(const n of s.interactions.list)if(n.element&&(n.element===t.target||e(n.element,t.target)))return void n.interactable.checkAndPreventDefault(t)}})}export default{id:"core/interactablePreventDefault",install:install,listeners:["down","move","up","cancel"].reduce(((t,e)=>(t["interactions:"+e]=s,t)),{})};
//# sourceMappingURL=interactablePreventDefault.prod.js.map

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

scope;
constructor(scope) {

@@ -27,3 +26,2 @@ this.scope = scope;

}
new(target, options) {

@@ -36,3 +34,2 @@ options = extend(options || {}, {

this.list.push(interactable);
if (is.string(target)) {

@@ -42,3 +39,2 @@ if (!this.selectorMap[target]) {

}
this.selectorMap[target].push(interactable);

@@ -52,7 +48,5 @@ } else {

}
;
target[this.scope.id].push(interactable);
}
this.scope.fire('interactable:new', {

@@ -66,3 +60,2 @@ target,

}
getExisting(target, options) {

@@ -75,14 +68,14 @@ const context = options && options.context || this.scope.document;

}
forEachMatch(node, callback) {
for (const interactable of this.list) {
let ret;
if ((is.string(interactable.target) ? // target is a selector and the element matches
is.element(node) && domUtils.matchesSelector(node, interactable.target) : // target is the element
node === interactable.target) && // the element is in context
if ((is.string(interactable.target) ?
// target is a selector and the element matches
is.element(node) && domUtils.matchesSelector(node, interactable.target) :
// target is the element
node === interactable.target) &&
// the element is in context
interactable.inContext(node)) {
ret = callback(interactable);
}
if (ret !== undefined) {

@@ -93,4 +86,3 @@ return ret;

}
}
//# sourceMappingURL=InteractableSet.js.map

@@ -1,6 +0,5 @@

import type { Point, FullRect, PointerEventType, Element } from '@interactjs/core/types';
import type { Point, FullRect, PointerEventType, Element, ActionName } from '@interactjs/core/types';
import { BaseEvent } from './BaseEvent';
import type { Interaction } from './Interaction';
import type { ActionName } from './types';
export declare type EventPhase = keyof PhaseMap;
export type EventPhase = keyof PhaseMap;
export interface PhaseMap {

@@ -48,4 +47,2 @@ start: true;

axes?: 'x' | 'y' | 'xy';
preEnd?: boolean;
/** */
constructor(interaction: Interaction<T>, event: PointerEventType, actionName: T, phase: P, element: Element, preEnd?: boolean, type?: string);

@@ -52,0 +49,0 @@ getSwipe(): {

@@ -6,2 +6,6 @@ import extend from "../utils/extend.js";

import { defaults } from './options';
// defined outside of class definition to avoid assignment of undefined during
// construction
export class InteractEvent extends BaseEvent {

@@ -30,8 +34,7 @@ relatedTarget = null;

speed;
swipe; // resize
swipe;
// resize
axes;
/** @internal */
preEnd;
/** */
constructor(interaction, event, actionName, phase, element, preEnd, type) {

@@ -55,3 +58,2 @@ super(interaction);

this.timeStamp = coords.timeStamp;
if (!ending) {

@@ -63,3 +65,2 @@ this.page.x -= origin.x;

}
this.ctrlKey = event.ctrlKey;

@@ -81,3 +82,2 @@ this.altKey = event.altKey;

this.clientY0 = interaction.coords.start.client.y - origin.y;
if (starting || ending) {

@@ -94,6 +94,6 @@ this.delta = {

}
this.dt = interaction.coords.delta.timeStamp;
this.duration = this.timeStamp - this.t0; // velocity and speed in pixels per second
this.duration = this.timeStamp - this.t0;
// velocity and speed in pixels per second
this.velocity = extend({}, interaction.coords.velocity[deltaSource]);

@@ -103,17 +103,12 @@ this.speed = hypot(this.velocity.x, this.velocity.y);

}
getSwipe() {
const interaction = this._interaction;
if (interaction.prevEvent.speed < 600 || this.timeStamp - interaction.prevEvent.timeStamp > 150) {
return null;
}
let angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI;
const overlap = 22.5;
if (angle < 0) {
angle += 360;
}
const left = 135 - overlap <= angle && angle < 225 + overlap;

@@ -136,24 +131,21 @@ const up = 225 - overlap <= angle && angle < 315 + overlap;

}
preventDefault() {}
preventDefault() {}
/**
* Don't call listeners on the remaining targets
*/
stopImmediatePropagation() {
this.immediatePropagationStopped = this.propagationStopped = true;
}
/**
* Don't call any other listeners (even on the current target)
*/
stopPropagation() {
this.propagationStopped = true;
}
}
} // getters and setters defined here to support typescript 3.6 and below which
// getters and setters defined here to support typescript 3.6 and below which
// don't support getter and setters in .d.ts files
Object.defineProperties(InteractEvent.prototype, {

@@ -164,7 +156,5 @@ pageX: {

},
set(value) {
this.page.x = value;
}
},

@@ -175,7 +165,5 @@ pageY: {

},
set(value) {
this.page.y = value;
}
},

@@ -186,7 +174,5 @@ clientX: {

},
set(value) {
this.client.x = value;
}
},

@@ -197,7 +183,5 @@ clientY: {

},
set(value) {
this.client.y = value;
}
},

@@ -208,7 +192,5 @@ dx: {

},
set(value) {
this.delta.x = value;
}
},

@@ -219,7 +201,5 @@ dy: {

},
set(value) {
this.delta.y = value;
}
},

@@ -230,7 +210,5 @@ velocityX: {

},
set(value) {
this.velocity.x = value;
}
},

@@ -241,9 +219,7 @@ velocityY: {

},
set(value) {
this.velocity.y = value;
}
}
});
//# sourceMappingURL=InteractEvent.js.map

@@ -1,8 +0,7 @@

import type { Element, EdgeOptions, PointerEventType, PointerType, FullRect, CoordsSet } from '@interactjs/core/types';
import type { Element, PointerEventType, PointerType, FullRect, CoordsSet, ActionName, ActionProps } from '@interactjs/core/types';
import type { Interactable } from './Interactable';
import type { EventPhase } from './InteractEvent';
import { InteractEvent } from './InteractEvent';
import type { Interactable } from './Interactable';
import { PointerInfo } from './PointerInfo';
import type { Scope } from './scope';
import type { ActionName, ActionProps } from './types';
export declare enum _ProxyValues {

@@ -23,3 +22,3 @@ interactable = "",

}
export declare type PointerArgProps<T extends {} = {}> = {
export type PointerArgProps<T extends {} = {}> = {
pointer: PointerType;

@@ -40,3 +39,3 @@ event: PointerEventType;

}
export declare type DoAnyPhaseArg = DoPhaseArg<ActionName, EventPhase>;
export type DoAnyPhaseArg = DoPhaseArg<ActionName, EventPhase>;
declare module '@interactjs/core/scope' {

@@ -87,40 +86,15 @@ interface SignalArgs {

}
export declare type InteractionProxy<T extends ActionName | null = never> = Pick<Interaction<T>, keyof typeof _ProxyValues | keyof typeof _ProxyMethods>;
export type InteractionProxy<T extends ActionName | null = never> = Pick<Interaction<T>, keyof typeof _ProxyValues | keyof typeof _ProxyMethods>;
export declare class Interaction<T extends ActionName | null = ActionName> {
/** current interactable being interacted with */
interactable: Interactable | null;
/** the target element of the interactable */
element: Element | null;
rect: FullRect | null;
_rects?: {
start: FullRect;
corrected: FullRect;
previous: FullRect;
delta: FullRect;
};
edges: EdgeOptions | null;
_scopeFire: Scope['fire'];
prepared: ActionProps<T>;
pointerType: string;
pointers: PointerInfo[];
downEvent: PointerEventType | null;
downPointer: PointerType;
_latestPointer: {
pointer: PointerType;
event: PointerEventType;
eventTarget: Node;
};
prevEvent: InteractEvent<T, EventPhase>;
pointerIsDown: boolean;
pointerWasMoved: boolean;
_interacting: boolean;
_ending: boolean;
_stopped: boolean;
_proxy: InteractionProxy<T>;
simulation: any;
/**
* @alias Interaction.prototype.move
*/
doMove: (this: void) => any;
coords: CoordsSet;
readonly _id: number;
/** */
constructor({ pointerType, scopeFire }: {

@@ -157,6 +131,6 @@ pointerType?: string;

*
* @param {object} action The action to be performed - drag, resize, etc.
* @param {Interactable} target The Interactable to target
* @param {Element} element The DOM Element to target
* @return {Boolean} Whether the interaction was successfully started
* @param action - The action to be performed - drag, resize, etc.
* @param target - The Interactable to target
* @param element - The DOM Element to target
* @returns Whether the interaction was successfully started
*/

@@ -184,4 +158,2 @@ start<A extends ActionName>(action: ActionProps<A>, interactable: Interactable, element: Element): boolean;

move(signalArg?: any): void;
pointerUp(pointer: PointerType, event: PointerEventType, eventTarget: Node, curEventTarget: EventTarget): void;
documentBlur(event: Event): void;
/**

@@ -200,4 +172,2 @@ * ```js

* ```
*
* @param {PointerEvent} [event]
*/

@@ -207,18 +177,6 @@ end(event?: PointerEventType): void;

interacting(): boolean;
/** */
stop(): void;
getPointerIndex(pointer: any): number;
getPointerInfo(pointer: any): PointerInfo;
updatePointer(pointer: PointerType, event: PointerEventType, eventTarget: Node, down?: boolean): number;
removePointer(pointer: PointerType, event: PointerEventType): void;
_updateLatestPointer(pointer: PointerType, event: PointerEventType, eventTarget: Node): void;
destroy(): void;
_createPreparedEvent<P extends EventPhase>(event: PointerEventType, phase: P, preEnd?: boolean, type?: string): InteractEvent<T, P>;
_fireEvent<P extends EventPhase>(iEvent: InteractEvent<T, P>): void;
_doPhase<P extends EventPhase>(signalArg: Omit<DoPhaseArg<T, P>, 'iEvent'> & {
iEvent?: InteractEvent<T, P>;
}): boolean;
_now(): number;
}
export default Interaction;
export { PointerInfo };

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

import { PointerInfo } from './PointerInfo';
export let _ProxyValues;
(function (_ProxyValues) {
export let _ProxyValues = /*#__PURE__*/function (_ProxyValues) {
_ProxyValues["interactable"] = "";

@@ -19,7 +17,5 @@ _ProxyValues["element"] = "";

_ProxyValues["_proxy"] = "";
})(_ProxyValues || (_ProxyValues = {}));
export let _ProxyMethods;
(function (_ProxyMethods) {
return _ProxyValues;
}({});
export let _ProxyMethods = /*#__PURE__*/function (_ProxyMethods) {
_ProxyMethods["start"] = "";

@@ -30,15 +26,21 @@ _ProxyMethods["move"] = "";

_ProxyMethods["interacting"] = "";
})(_ProxyMethods || (_ProxyMethods = {}));
return _ProxyMethods;
}({});
let idCounter = 0;
export class Interaction {
// current interactable being interacted with
interactable = null; // the target element of the interactable
/** current interactable being interacted with */
interactable = null;
/** the target element of the interactable */
element = null;
rect = null;
/** @internal */
_rects;
/** @internal */
edges = null;
_scopeFire; // action that's ready to be fired on next move event
/** @internal */
_scopeFire;
// action that's ready to be fired on next move event
prepared = {

@@ -49,8 +51,14 @@ name: null,

};
pointerType; // keep track of added pointers
pointerType;
pointers = []; // pointerdown/mousedown/touchstart event
/** @internal keep track of added pointers */
pointers = [];
/** @internal pointerdown/mousedown/touchstart event */
downEvent = null;
/** @internal */
downPointer = {};
/** @internal */
_latestPointer = {

@@ -60,22 +68,24 @@ pointer: null,

eventTarget: null
}; // previous action event
};
/** @internal */
prevEvent = null;
pointerIsDown = false;
pointerWasMoved = false;
/** @internal */
_interacting = false;
/** @internal */
_ending = false;
/** @internal */
_stopped = true;
/** @internal */
_proxy;
/** @internal */
simulation = null;
/** @internal */
get pointerMoveTolerance() {
return 1;
}
/**
* @alias Interaction.prototype.move
*/
doMove = warnOnce(function (signalArg) {

@@ -96,5 +106,5 @@ this.move(signalArg);

};
/** @internal */
_id = idCounter++;
/** */
constructor({

@@ -108,3 +118,2 @@ pointerType,

this._proxy = {};
for (const key in _ProxyValues) {

@@ -115,6 +124,4 @@ Object.defineProperty(this._proxy, key, {

}
});
}
for (const key in _ProxyMethods) {

@@ -125,3 +132,2 @@ Object.defineProperty(this._proxy, key, {

}
this._scopeFire('interactions:new', {

@@ -131,7 +137,5 @@ interaction: this

}
pointerDown(pointer, event, eventTarget) {
const pointerIndex = this.updatePointer(pointer, event, eventTarget, true);
const pointerInfo = this.pointers[pointerIndex];
this._scopeFire('interactions:down', {

@@ -147,2 +151,3 @@ pointer,

}
/**

@@ -174,9 +179,7 @@ * ```js

*
* @param {object} action The action to be performed - drag, resize, etc.
* @param {Interactable} target The Interactable to target
* @param {Element} element The DOM Element to target
* @return {Boolean} Whether the interaction was successfully started
* @param action - The action to be performed - drag, resize, etc.
* @param target - The Interactable to target
* @param element - The DOM Element to target
* @returns Whether the interaction was successfully started
*/
start(action, interactable, element) {

@@ -186,3 +189,2 @@ if (this.interacting() || !this.pointerIsDown || this.pointers.length < (action.name === 'gesture' ? 2 : 1) || !interactable.options[action.name].enabled) {

}
copyAction(this.prepared, action);

@@ -206,3 +208,2 @@ this.interactable = interactable;

}
pointerMove(pointer, event, eventTarget) {

@@ -212,7 +213,7 @@ if (!this.simulation && !(this.modification && this.modification.endResult)) {

}
const duplicateMove = 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 dx;
let dy; // register movement greater than pointerMoveTolerance
let dy;
// register movement greater than pointerMoveTolerance
if (this.pointerIsDown && !this.pointerWasMoved) {

@@ -223,3 +224,2 @@ dx = this.coords.cur.client.x - this.coords.start.client.x;

}
const pointerIndex = this.getPointerIndex(pointer);

@@ -238,3 +238,2 @@ const signalArg = {

};
if (!duplicateMove) {

@@ -244,5 +243,3 @@ // set pointer coordinate, time changes and velocity

}
this._scopeFire('interactions:move', signalArg);
if (!duplicateMove && !this.simulation) {

@@ -254,3 +251,2 @@ // if interacting, fire an 'action-move' signal etc

}
if (this.pointerWasMoved) {

@@ -261,2 +257,3 @@ pointerUtils.copyCoords(this.coords.prev, this.coords.cur);

}
/**

@@ -280,4 +277,2 @@ * ```js

*/
move(signalArg) {

@@ -287,3 +282,2 @@ if (!signalArg || !signalArg.event) {

}
signalArg = extend({

@@ -296,16 +290,15 @@ pointer: this._latestPointer.pointer,

signalArg.phase = 'move';
this._doPhase(signalArg);
} // End interact move events and stop auto-scroll unless simulation is running
}
/**
* @internal
* End interact move events and stop auto-scroll unless simulation is running
*/
pointerUp(pointer, event, eventTarget, curEventTarget) {
let pointerIndex = this.getPointerIndex(pointer);
if (pointerIndex === -1) {
pointerIndex = this.updatePointer(pointer, event, eventTarget, false);
}
const type = /cancel$/i.test(event.type) ? 'cancel' : 'up';
this._scopeFire(`interactions:${type}`, {

@@ -321,13 +314,11 @@ pointer,

});
if (!this.simulation) {
this.end(event);
}
this.removePointer(pointer, event);
}
/** @internal */
documentBlur(event) {
this.end(event);
this._scopeFire('interactions:blur', {

@@ -339,2 +330,3 @@ event,

}
/**

@@ -353,7 +345,3 @@ * ```js

* ```
*
* @param {PointerEvent} [event]
*/
end(event) {

@@ -363,3 +351,2 @@ this._ending = true;

let endPhaseResult;
if (this.interacting()) {

@@ -372,5 +359,3 @@ endPhaseResult = this._doPhase({

}
this._ending = false;
if (endPhaseResult === true) {

@@ -380,13 +365,8 @@ this.stop();

}
currentAction() {
return this._interacting ? this.prepared.name : null;
}
interacting() {
return this._interacting;
}
/** */
stop() {

@@ -396,3 +376,2 @@ this._scopeFire('interactions:stop', {

});
this.interactable = this.element = null;

@@ -404,8 +383,11 @@ this._interacting = false;

/** @internal */
getPointerIndex(pointer) {
const pointerId = pointerUtils.getPointerId(pointer); // mouse and pen interactions may have only one pointer
const pointerId = pointerUtils.getPointerId(pointer);
// mouse and pen interactions may have only one pointer
return this.pointerType === 'mouse' || this.pointerType === 'pen' ? this.pointers.length - 1 : arr.findIndex(this.pointers, curPointer => curPointer.id === pointerId);
}
/** @internal */
getPointerInfo(pointer) {

@@ -415,2 +397,3 @@ return this.pointers[this.getPointerIndex(pointer)];

/** @internal */
updatePointer(pointer, event, eventTarget, down) {

@@ -421,3 +404,2 @@ const id = pointerUtils.getPointerId(pointer);

down = down === false ? false : down || /(down|start)$/i.test(event.type);
if (!pointerInfo) {

@@ -430,6 +412,4 @@ pointerInfo = new PointerInfo(id, pointer, event, null, null);

}
pointerUtils.setCoords(this.coords.cur, this.pointers.map(p => p.pointer), this._now());
pointerUtils.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur);
if (down) {

@@ -440,3 +420,2 @@ this.pointerIsDown = true;

pointerUtils.pointerExtend(this.downPointer, pointer);
if (!this.interacting()) {

@@ -449,5 +428,3 @@ pointerUtils.copyCoords(this.coords.start, this.coords.cur);

}
this._updateLatestPointer(pointer, event, eventTarget);
this._scopeFire('interactions:update-pointer', {

@@ -462,6 +439,6 @@ pointer,

});
return pointerIndex;
}
/** @internal */
removePointer(pointer, event) {

@@ -471,3 +448,2 @@ const pointerIndex = this.getPointerIndex(pointer);

const pointerInfo = this.pointers[pointerIndex];
this._scopeFire('interactions:remove-pointer', {

@@ -481,3 +457,2 @@ pointer,

});
this.pointers.splice(pointerIndex, 1);

@@ -487,2 +462,3 @@ this.pointerIsDown = false;

/** @internal */
_updateLatestPointer(pointer, event, eventTarget) {

@@ -493,3 +469,2 @@ this._latestPointer.pointer = pointer;

}
destroy() {

@@ -501,2 +476,3 @@ this._latestPointer.pointer = null;

/** @internal */
_createPreparedEvent(event, phase, preEnd, type) {

@@ -506,7 +482,6 @@ return new InteractEvent(this, event, this.prepared.name, phase, this.element, preEnd, type);

/** @internal */
_fireEvent(iEvent) {
var _this$interactable;
(_this$interactable = this.interactable) == null ? void 0 : _this$interactable.fire(iEvent);
if (!this.prevEvent || iEvent.timeStamp >= this.prevEvent.timeStamp) {

@@ -517,2 +492,3 @@ this.prevEvent = iEvent;

/** @internal */
_doPhase(signalArg) {

@@ -528,3 +504,2 @@ const {

} = this;
if (rect && phase === 'move') {

@@ -536,28 +511,20 @@ // update the rect changes due to pointer move

}
const beforeResult = this._scopeFire(`interactions:before-action-${phase}`, signalArg);
if (beforeResult === false) {
return false;
}
const iEvent = signalArg.iEvent = this._createPreparedEvent(event, phase, preEnd, type);
this._scopeFire(`interactions:action-${phase}`, signalArg);
if (phase === 'start') {
this.prevEvent = iEvent;
}
this._fireEvent(iEvent);
this._scopeFire(`interactions:after-action-${phase}`, signalArg);
return true;
}
/** @internal */
_now() {
return Date.now();
}
}

@@ -564,0 +531,0 @@ export default Interaction;

@@ -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 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";import{PointerInfo as h}from"./PointerInfo";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;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){var e;null==(e=this.interactable)||e.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};
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";import{PointerInfo as h}from"./PointerInfo";export let _ProxyValues=(t=>(t.interactable="",t.element="",t.prepared="",t.pointerIsDown="",t.pointerWasMoved="",t._proxy="",t))({});export let _ProxyMethods=(t=>(t.start="",t.move="",t.end="",t.stop="",t.interacting="",t))({});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;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){var e;null==(e=this.interactable)||e.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
import * as dom from "../utils/domUtils.js";
const finder = {
methodOrder: ['simulationResume', 'mouseOrPen', 'hasPointer', 'idle'],
search(details) {
for (const method of finder.methodOrder) {
const interaction = finder[method](details);
if (interaction) {

@@ -13,6 +11,4 @@ return interaction;

}
return null;
},
// try to resume simulation with a new pointer

@@ -28,6 +24,4 @@ simulationResume({

}
for (const interaction of scope.interactions.list) {
let element = eventTarget;
if (interaction.simulation && interaction.simulation.allowResume && interaction.pointerType === pointerType) {

@@ -39,3 +33,2 @@ while (element) {

}
element = dom.parentNode(element);

@@ -45,6 +38,4 @@ }

}
return null;
},
// if it's a mouse or pen interaction

@@ -60,5 +51,3 @@ mouseOrPen({

}
let firstNonActive;
for (const interaction of scope.interactions.list) {

@@ -69,8 +58,9 @@ if (interaction.pointerType === pointerType) {

continue;
} // if the interaction is active, return it immediately
}
// if the interaction is active, return it immediately
if (interaction.interacting()) {
return interaction;
} // otherwise save it and look for another active interaction
}
// otherwise save it and look for another active interaction
else if (!firstNonActive) {

@@ -80,13 +70,13 @@ firstNonActive = interaction;

}
} // if no active mouse interaction was found use the first inactive mouse
}
// if no active mouse interaction was found use the first inactive mouse
// interaction
if (firstNonActive) {
return firstNonActive;
} // find any mouse or pen interaction.
}
// find any mouse or pen interaction.
// ignore the interaction if the eventType is a *down, and a simulation
// is active
for (const interaction of scope.interactions.list) {

@@ -97,6 +87,4 @@ if (interaction.pointerType === pointerType && !(/down/i.test(eventType) && interaction.simulation)) {

}
return null;
},
// get interaction that has this pointer

@@ -112,6 +100,4 @@ hasPointer({

}
return null;
},
// get first idle interaction with a matching pointerType

@@ -125,13 +111,13 @@ idle({

if (interaction.pointers.length === 1) {
const target = interaction.interactable; // don't add this pointer if there is a target interactable and it
const target = interaction.interactable;
// don't add this pointer if there is a target interactable and it
// isn't gesturable
if (target && !(target.options.gesture && target.options.gesture.enabled)) {
continue;
}
} // maximum of 2 pointers per interaction
}
// maximum of 2 pointers per interaction
else if (interaction.pointers.length >= 2) {
continue;
}
if (!interaction.interacting() && pointerType === interaction.pointerType) {

@@ -141,8 +127,5 @@ return interaction;

}
return null;
}
};
function hasPointerId(interaction, pointerId) {

@@ -153,4 +136,3 @@ return interaction.pointers.some(({

}
export default finder;
//# sourceMappingURL=interactionFinder.js.map
import type { Plugin } from '@interactjs/core/scope';
import type { ActionName, Listener } from '@interactjs/core/types';
import './interactablePreventDefault';
import InteractionBase from './Interaction';
import './interactablePreventDefault';
import type { SearchDetails } from './interactionFinder';

@@ -6,0 +6,0 @@ declare module '@interactjs/core/scope' {

@@ -5,7 +5,6 @@ import browser from "../utils/browser.js";

import * as pointerUtils from "../utils/pointerUtils.js";
import InteractionBase from './Interaction';
/* eslint-disable import/no-duplicates -- for typescript module augmentations */
import './interactablePreventDefault';
import interactablePreventDefault from './interactablePreventDefault';
import InteractionBase from './Interaction';
/* eslint-enable import/no-duplicates */

@@ -15,13 +14,9 @@

const methodNames = ['pointerDown', 'pointerMove', 'pointerUp', 'updatePointer', 'removePointer', 'windowBlur'];
function install(scope) {
const listeners = {};
for (const method of methodNames) {
listeners[method] = doOnInteractions(method, scope);
}
const pEventTypes = browser.pEventTypes;
let docEvents;
if (domObjects.PointerEvent) {

@@ -71,6 +66,4 @@ docEvents = [{

}
docEvents.push({
type: 'blur',
listener(event) {

@@ -81,5 +74,5 @@ for (const interaction of scope.interactions.list) {

}
});
}); // for ignoring browser's simulated mouse events
// for ignoring browser's simulated mouse events
scope.prevTouchTime = 0;

@@ -90,11 +83,8 @@ scope.Interaction = class extends InteractionBase {

}
set pointerMoveTolerance(value) {
scope.interactions.pointerMoveTolerance = value;
}
_now() {
return scope.now();
}
};

@@ -104,6 +94,4 @@ scope.interactions = {

list: [],
new(options) {
options.scopeFire = (name, arg) => scope.fire(name, arg);
const interaction = new scope.Interaction(options);

@@ -113,3 +101,2 @@ scope.interactions.list.push(interaction);

},
listeners,

@@ -119,3 +106,2 @@ docEvents,

};
function releasePointersOnRemovedEls() {

@@ -126,5 +112,5 @@ // for all inactive touch interactions with pointers down

continue;
} // if a pointer is down on an element that is no longer in the DOM tree
}
// if a pointer is down on an element that is no longer in the DOM tree
for (const pointer of interaction.pointers) {

@@ -140,6 +126,4 @@ if (!scope.documents.some(({

}
scope.usePlugin(interactablePreventDefault);
}
function doOnInteractions(method, scope) {

@@ -153,4 +137,5 @@ return function (event) {

if (/^touch/.test(event.type)) {
scope.prevTouchTime = scope.now(); // @ts-expect-error
scope.prevTouchTime = scope.now();
// @ts-expect-error
for (const changedTouch of event.changedTouches) {

@@ -173,3 +158,2 @@ const pointer = changedTouch;

let invalidPointer = false;
if (!browser.supportsPointerEvent && /mouse/.test(event.type)) {

@@ -179,10 +163,10 @@ // ignore mouse events while touch interactions are active

invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown;
} // try to ignore mouse events that are simulated by the browser
}
// try to ignore mouse events that are simulated by the browser
// after a touch event
invalidPointer = invalidPointer || scope.now() - scope.prevTouchTime < 500 || // on iOS and Firefox Mobile, MouseEvent.timeStamp is zero if simulated
invalidPointer = invalidPointer || scope.now() - scope.prevTouchTime < 500 ||
// on iOS and Firefox Mobile, MouseEvent.timeStamp is zero if simulated
event.timeStamp === 0;
}
if (!invalidPointer) {

@@ -201,5 +185,5 @@ const searchDetails = {

}
} // eslint-disable-next-line no-shadow
}
// eslint-disable-next-line no-shadow
for (const [pointer, eventTarget, curEventTarget, interaction] of matches) {

@@ -210,3 +194,2 @@ interaction[method](pointer, event, eventTarget, curEventTarget);

}
function getInteraction(searchDetails) {

@@ -227,3 +210,2 @@ const {

}
function onDocSignal({

@@ -241,3 +223,2 @@ doc,

const eventMethod = events[eventMethodName];
if (scope.browser.isIOS && !options.events) {

@@ -247,5 +228,5 @@ options.events = {

};
} // delegate event listener
}
// delegate event listener
for (const eventType in events.delegatedEvents) {

@@ -255,5 +236,3 @@ eventMethod(doc, eventType, events.delegateListener);

}
const eventOptions = options && options.events;
for (const {

@@ -266,3 +245,2 @@ type,

}
const interactions = {

@@ -280,7 +258,5 @@ id: 'core/interactions',

const interaction = scope.interactions.list[i];
if (interaction.interactable !== interactable) {
continue;
}
interaction.stop();

@@ -291,3 +267,2 @@ scope.fire('interactions:destroy', {

interaction.destroy();
if (scope.interactions.list.length > 2) {

@@ -294,0 +269,0 @@ scope.interactions.list.splice(i, 1);

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

import e from"../utils/browser.prod.js";import t from"../utils/domObjects.prod.js";import{nodeContains as n}from"../utils/domUtils.prod.js";import*as o from"../utils/pointerUtils.prod.js";import r from"./Interaction";import"./interactablePreventDefault";import i from"./interactablePreventDefault";import s from"./interactionFinder";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=>l(e,"add"),"scope:remove-document":e=>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;
import e from"../utils/browser.prod.js";import t from"../utils/domObjects.prod.js";import{nodeContains as n}from"../utils/domUtils.prod.js";import*as o from"../utils/pointerUtils.prod.js";import"./interactablePreventDefault";import r from"./interactablePreventDefault";import i from"./Interaction";import s from"./interactionFinder";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 i{get pointerMoveTolerance(){return o.interactions.pointerMoveTolerance}set pointerMoveTolerance(e){o.interactions.pointerMoveTolerance=e}_now(){return o.now()}},o.interactions={list:[],new(e){e.scopeFire=(e,t)=>o.fire(e,t);const t=new o.Interaction(e);return o.interactions.list.push(t),t},listeners:s,docEvents:l,pointerMoveTolerance:1},o.usePlugin(r)},listeners:{"scope:add-document":e=>l(e,"add"),"scope:remove-document":e=>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.prod.js.map

@@ -1,37 +0,80 @@

/** @module interact */
import * as domUtils from '@interactjs/utils/domUtils';
import * as pointerUtils from '@interactjs/utils/pointerUtils';
import type { Scope, Plugin } from '@interactjs/core/scope';
import type { EventTypes, ListenersArg, Target } from '@interactjs/core/types';
import * as domUtils from '@interactjs/utils/domUtils';
import * as pointerUtils from '@interactjs/utils/pointerUtils';
import type { Interactable } from './Interactable';
import type { Options } from './options';
declare module '@interactjs/core/InteractStatic' {
interface InteractStatic {
(target: Target, options?: Options): Interactable;
getPointerAverage: typeof pointerUtils.pointerAverage;
getTouchBBox: typeof pointerUtils.touchBBox;
getTouchDistance: typeof pointerUtils.touchDistance;
getTouchAngle: typeof pointerUtils.touchAngle;
getElementRect: typeof domUtils.getElementRect;
getElementClientRect: typeof domUtils.getElementClientRect;
matchesSelector: typeof domUtils.matchesSelector;
closest: typeof domUtils.closest;
version: string;
use(plugin: Plugin, options?: {
[key: string]: any;
}): any;
isSet(target: Target, options?: any): boolean;
on(type: string | EventTypes, listener: ListenersArg, options?: object): any;
off(type: EventTypes, listener: any, options?: object): any;
debug(): any;
supportsTouch(): boolean;
supportsPointerEvent(): boolean;
stop(): any;
pointerMoveTolerance(newValue?: number): any;
addDocument(doc: Document, options?: object): void;
removeDocument(doc: Document): void;
}
/**
* ```js
* interact('#draggable').draggable(true)
*
* var rectables = interact('rect')
* rectables
* .gesturable(true)
* .on('gesturemove', function (event) {
* // ...
* })
* ```
*
* The methods of this variable can be used to set elements as interactables
* and also to change various default settings.
*
* Calling it as a function and passing an element or a valid CSS selector
* string returns an Interactable object which has various methods to configure
* it.
*
* @param {Element | string} target The HTML or SVG Element to interact with
* or CSS selector
* @return {Interactable}
*/
export interface InteractStatic {
(target: Target, options?: Options): Interactable;
getPointerAverage: typeof pointerUtils.pointerAverage;
getTouchBBox: typeof pointerUtils.touchBBox;
getTouchDistance: typeof pointerUtils.touchDistance;
getTouchAngle: typeof pointerUtils.touchAngle;
getElementRect: typeof domUtils.getElementRect;
getElementClientRect: typeof domUtils.getElementClientRect;
matchesSelector: typeof domUtils.matchesSelector;
closest: typeof domUtils.closest;
version: string;
/**
* Use a plugin
*/
use(plugin: Plugin, options?: {
[key: string]: any;
}): any;
/**
* Check if an element or selector has been set with the `interact(target)`
* function
*
* @return {boolean} Indicates if the element or CSS selector was previously
* passed to interact
*/
isSet(target: Target, options?: any): boolean;
on(type: string | EventTypes, listener: ListenersArg, options?: object): any;
off(type: EventTypes, listener: any, options?: object): any;
debug(): any;
/**
* Whether or not the browser supports touch input
*/
supportsTouch(): boolean;
/**
* Whether or not the browser supports PointerEvents
*/
supportsPointerEvent(): boolean;
/**
* Cancels all interactions (end events are not fired)
*/
stop(): InteractStatic;
/**
* Returns or sets the distance the pointer must be moved before an action
* sequence occurs. This also affects tolerance for tap events.
*/
pointerMoveTolerance(
/** The movement from the start position must be greater than this value */
newValue?: number): InteractStatic | number;
addDocument(doc: Document, options?: object): void;
removeDocument(doc: Document): void;
}
declare type _InteractStatic = import('@interactjs/core/InteractStatic').InteractStatic;
export declare function createInteractStatic(scope: Scope): _InteractStatic;
export {};
export declare function createInteractStatic(scope: Scope): InteractStatic;

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

/** @module interact */
import browser from "../utils/browser.js";

@@ -8,31 +7,30 @@ import * as domUtils from "../utils/domUtils.js";

import * as pointerUtils from "../utils/pointerUtils.js";
/**
* ```js
* interact('#draggable').draggable(true)
*
* var rectables = interact('rect')
* rectables
* .gesturable(true)
* .on('gesturemove', function (event) {
* // ...
* })
* ```
*
* The methods of this variable can be used to set elements as interactables
* and also to change various default settings.
*
* Calling it as a function and passing an element or a valid CSS selector
* string returns an Interactable object which has various methods to configure
* it.
*
* @param {Element | string} target The HTML or SVG Element to interact with
* or CSS selector
* @return {Interactable}
*/
export function createInteractStatic(scope) {
/**
* ```js
* interact('#draggable').draggable(true)
*
* var rectables = interact('rect')
* rectables
* .gesturable(true)
* .on('gesturemove', function (event) {
* // ...
* })
* ```
*
* The methods of this variable can be used to set elements as interactables
* and also to change various default settings.
*
* Calling it as a function and passing an element or a valid CSS selector
* string returns an Interactable object which has various methods to configure
* it.
*
* @global
*
* @param {Element | string} target The HTML or SVG Element to interact with
* or CSS selector
* @return {Interactable}
*/
const interact = (target, options) => {
let interactable = scope.interactables.getExisting(target, options);
if (!interactable) {

@@ -42,7 +40,6 @@ interactable = scope.interactables.new(target, options);

}
return interactable;
}; // expose the functions used to calculate multi-touch properties
};
// expose the functions used to calculate multi-touch properties
interact.getPointerAverage = pointerUtils.pointerAverage;

@@ -56,13 +53,7 @@ interact.getTouchBBox = pointerUtils.touchBBox;

interact.closest = domUtils.closest;
interact.globalEvents = {}; // eslint-disable-next-line no-undef
interact.globalEvents = {};
interact.version = "1.10.23";
// eslint-disable-next-line no-undef
interact.version = "1.10.24";
interact.scope = scope;
/**
* Use a plugin
*
* @alias module:interact.use
*
*/
interact.use = function (plugin, options) {

@@ -72,32 +63,5 @@ this.scope.usePlugin(plugin, options);

};
/**
* Check if an element or selector has been set with the {@link interact}
* function
*
* @alias module:interact.isSet
*
* @param {Target} target The Element or string being searched for
* @param {object} options
* @return {boolean} Indicates if the element or CSS selector was previously
* passed to interact
*/
interact.isSet = function (target, options) {
return !!this.scope.interactables.get(target, options && options.context);
};
/**
* @deprecated
* Add a global listener for an InteractEvent or adds a DOM event to `document`
*
* @alias module:interact.on
*
* @param {string | array | object} type The types of events to listen for
* @param {function} listener The function event (s)
* @param {object | boolean} [options] object or useCapture flag for
* addEventListener
* @return {object} interact
*/
interact.on = warnOnce(function on(type, listener, options) {

@@ -107,3 +71,2 @@ if (is.string(type) && type.search(' ') !== -1) {

}
if (is.array(type)) {

@@ -113,6 +76,4 @@ for (const eventType of type) {

}
return this;
}
if (is.object(type)) {

@@ -122,7 +83,6 @@ for (const prop in type) {

}
return this;
} // if it is an InteractEvent type, add listener to globalEvents
}
// if it is an InteractEvent type, add listener to globalEvents
if (isNonNativeEvent(type, this.scope.actions)) {

@@ -135,3 +95,4 @@ // if this type of event was never bound

}
} // If non InteractEvent type, addEventListener to document
}
// If non InteractEvent type, addEventListener to document
else {

@@ -142,19 +103,4 @@ this.scope.events.add(this.scope.document, type, listener, {

}
return this;
}, 'The interact.on() method is being deprecated');
/**
* @deprecated
* Removes a global InteractEvent listener or DOM event from `document`
*
* @alias module:interact.off
*
* @param {string | array | object} type The types of events that were listened
* for
* @param {function} listener The listener function to be removed
* @param {object | boolean} options [options] object or useCapture flag for
* removeEventListener
* @return {object} interact
*/
interact.off = warnOnce(function off(type, listener, options) {

@@ -164,3 +110,2 @@ if (is.string(type) && type.search(' ') !== -1) {

}
if (is.array(type)) {

@@ -170,6 +115,4 @@ for (const eventType of type) {

}
return this;
}
if (is.object(type)) {

@@ -179,9 +122,6 @@ for (const prop in type) {

}
return this;
}
if (isNonNativeEvent(type, this.scope.actions)) {
let index;
if (type in this.globalEvents && (index = this.globalEvents[type].indexOf(listener)) !== -1) {

@@ -193,38 +133,13 @@ this.globalEvents[type].splice(index, 1);

}
return this;
}, 'The interact.off() method is being deprecated');
interact.debug = function () {
return this.scope;
};
/**
* @alias module:interact.supportsTouch
*
* @return {boolean} Whether or not the browser supports touch input
*/
interact.supportsTouch = function () {
return browser.supportsTouch;
};
/**
* @alias module:interact.supportsPointerEvent
*
* @return {boolean} Whether or not the browser supports PointerEvents
*/
interact.supportsPointerEvent = function () {
return browser.supportsPointerEvent;
};
/**
* Cancels all interactions (end events are not fired)
*
* @alias module:interact.stop
*
* @return {object} interact
*/
interact.stop = function () {

@@ -234,16 +149,4 @@ for (const interaction of this.scope.interactions.list) {

}
return this;
};
/**
* Returns or sets the distance the pointer must be moved before an action
* sequence occurs. This also affects tolerance for tap events.
*
* @alias module:interact.pointerMoveTolerance
*
* @param {number} [newValue] The movement from the start position must be greater than this value
* @return {interact | number}
*/
interact.pointerMoveTolerance = function (newValue) {

@@ -254,16 +157,12 @@ if (is.number(newValue)) {

}
return this.scope.interactions.pointerMoveTolerance;
};
interact.addDocument = function (doc, options) {
this.scope.addDocument(doc, options);
};
interact.removeDocument = function (doc) {
this.scope.removeDocument(doc);
};
return interact;
}
//# sourceMappingURL=InteractStatic.js.map

@@ -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 s from"../utils/isNonNativeEvent.prod.js";import{warnOnce as i}from"../utils/misc.prod.js";import*as n from"../utils/pointerUtils.prod.js";export function createInteractStatic(r){const c=(t,e)=>{let o=r.interactables.getExisting(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.23",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=i((function(t,e,i){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.on(o,e,i);return this}if(o.object(t)){for(const o in t)this.on(o,t[o],e);return this}return s(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:i}),this}),"The interact.on() method is being deprecated"),c.off=i((function(t,e,i){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.off(o,e,i);return this}if(o.object(t)){for(const o in t)this.off(o,t[o],e);return this}if(s(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,i);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 s from"../utils/isNonNativeEvent.prod.js";import{warnOnce as i}from"../utils/misc.prod.js";import*as n from"../utils/pointerUtils.prod.js";export function createInteractStatic(r){const c=(t,e)=>{let o=r.interactables.getExisting(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.24",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=i((function(t,e,i){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.on(o,e,i);return this}if(o.object(t)){for(const o in t)this.on(o,t[o],e);return this}return s(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:i}),this}),"The interact.on() method is being deprecated"),c.off=i((function(t,e,i){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.off(o,e,i);return this}if(o.object(t)){for(const o in t)this.off(o,t[o],e);return this}if(s(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,i);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
export declare const NativePointerEvent: PointerEvent;
export declare type NativeEventTarget = EventTarget;
export declare type NativeElement = Element;
export type NativeEventTarget = EventTarget;
export type NativeElement = Element;

@@ -10,3 +10,3 @@ import type { Point, Listeners, OrBoolean, Element, Rect } from '@interactjs/core/types';

export interface BaseDefaults {
preventDefault?: 'auto' | 'never' | string;
preventDefault?: 'always' | 'never' | 'auto';
deltaSource?: 'page' | 'client';

@@ -23,3 +23,3 @@ context?: Node;

}
export declare type Options = Partial<BaseDefaults> & Partial<PerActionDefaults> & {
export type Options = Partial<BaseDefaults> & Partial<PerActionDefaults> & {
[P in keyof ActionDefaults]?: Partial<ActionDefaults[P]>;

@@ -26,0 +26,0 @@ };

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export const defaults = {

@@ -3,0 +4,0 @@ base: {

{
"name": "@interactjs/core",
"version": "1.10.23",
"version": "1.10.24",
"main": "index",

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

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

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

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

@@ -7,3 +7,2 @@ export class PointerInfo {

downTarget;
constructor(id, pointer, event, downTime, downTarget) {

@@ -16,4 +15,3 @@ this.id = id;

}
}
//# sourceMappingURL=PointerInfo.js.map
import type Interaction from '@interactjs/core/Interaction';
import { Eventable } from './Eventable';
import { InteractEvent } from './InteractEvent';
import { Interactable as InteractableBase } from './Interactable';
import { InteractableSet } from './InteractableSet';
import './events';
import './interactions';
import { Interactable as InteractableBase } from './Interactable';
import './InteractableSet';
import type { OptionsArg } from './options';
import type { Actions } from './types';
export interface SignalArgs {

@@ -24,4 +21,4 @@ 'scope:add-document': DocSignalArg;

}
export declare type ListenerName = keyof SignalArgs;
export declare type ListenerMap = {
export type ListenerName = keyof SignalArgs;
export type ListenerMap = {
[P in ListenerName]?: (arg: SignalArgs[P], scope: Scope, signalName: P) => void | boolean;

@@ -35,71 +32,2 @@ };

}
export interface Plugin {
[key: string]: any;
id?: string;
listeners?: ListenerMap;
before?: string[];
install?(scope: Scope, options?: any): void;
}
export declare class Scope {
id: string;
isInitialized: boolean;
listenerMaps: Array<{
map: ListenerMap;
id?: string;
}>;
browser: {
init: (window: any) => void;
supportsTouch: boolean;
supportsPointerEvent: boolean;
isIOS7: boolean;
isIOS: boolean;
isIe9: boolean;
isOperaMobile: boolean;
prefixedMatchesSelector: "matches";
pEventTypes: {
up: string;
down: string;
over: string;
out: string;
move: string;
cancel: string;
};
wheelEvent: string;
};
defaults: import("@interactjs/core/options").Defaults;
Eventable: typeof Eventable;
actions: Actions;
interactStatic: import("@interactjs/core/InteractStatic").InteractStatic;
InteractEvent: typeof InteractEvent;
Interactable: typeof InteractableBase;
interactables: InteractableSet;
_win: Window;
document: Document;
window: Window;
documents: Array<{
doc: Document;
options: any;
}>;
_plugins: {
list: Plugin[];
map: {
[id: string]: Plugin;
};
};
constructor();
addListeners(map: ListenerMap, id?: string): void;
fire<T extends ListenerName>(name: T, arg: SignalArgs[T]): void | false;
onWindowUnload: (event: BeforeUnloadEvent) => void;
init(window: Window | typeof globalThis): Scope;
pluginIsInstalled(plugin: Plugin): boolean;
usePlugin(plugin: Plugin, options?: {
[key: string]: any;
}): this;
addDocument(doc: Document, options?: any): void | false;
removeDocument(doc: Document): void;
getDocIndex(doc: Document): number;
getDocOptions(doc: Document): any;
now(): number;
}
export declare function initScope(scope: Scope, window: Window | typeof globalThis): Scope;
export {};

@@ -9,15 +9,17 @@ import browser from "../utils/browser.js";

import { Eventable } from './Eventable';
import { InteractEvent } from './InteractEvent';
import { createInteractStatic } from './InteractStatic';
import { Interactable as InteractableBase } from './Interactable';
import { InteractableSet } from './InteractableSet';
/* eslint-disable import/no-duplicates -- for typescript module augmentations */
import './events';
import './interactions';
import events from './events';
import { Interactable as InteractableBase } from './Interactable';
import { InteractableSet } from './InteractableSet';
import { InteractEvent } from './InteractEvent';
import interactions from './interactions';
/* eslint-enable import/no-duplicates */
import { createInteractStatic } from './InteractStatic';
import { defaults } from './options';
import { defaults } from './options';
/** @internal */
/** @internal */
export class Scope {

@@ -43,10 +45,14 @@ id = `__interact_scope_${Math.floor(Math.random() * 100)}`;

Interactable;
interactables = new InteractableSet(this); // main window
interactables = new InteractableSet(this);
_win; // main document
// main window
_win;
document; // main window
// main document
document;
window; // all documents being listened to
// main window
window;
// all documents being listened to
documents = [];

@@ -57,3 +63,2 @@ _plugins = {

};
constructor() {

@@ -65,3 +70,2 @@ const scope = this;

}
set(options) {

@@ -75,3 +79,2 @@ super.set(options);

}
unset() {

@@ -86,6 +89,4 @@ super.unset();

}
};
}
addListeners(map, id) {

@@ -97,3 +98,2 @@ this.listenerMaps.push({

}
fire(name, arg) {

@@ -110,9 +110,6 @@ for (const {

}
onWindowUnload = event => this.removeDocument(event.target);
init(window) {
return this.isInitialized ? this : initScope(this, window);
}
pluginIsInstalled(plugin) {

@@ -124,3 +121,2 @@ const {

}
usePlugin(plugin, options) {

@@ -130,17 +126,12 @@ if (!this.isInitialized) {

}
if (this.pluginIsInstalled(plugin)) {
return this;
}
if (plugin.id) {
this._plugins.map[plugin.id] = plugin;
}
this._plugins.list.push(plugin);
if (plugin.install) {
plugin.install(this, options);
}
if (plugin.listeners && plugin.before) {

@@ -154,6 +145,4 @@ let index = 0;

}, {});
for (; index < len; index++) {
const otherId = this.listenerMaps[index].id;
if (otherId && (before[otherId] || before[pluginIdRoot(otherId)])) {

@@ -163,3 +152,2 @@ break;

}
this.listenerMaps.splice(index, 0, {

@@ -175,6 +163,4 @@ id: plugin.id,

}
return this;
}
addDocument(doc, options) {

@@ -185,3 +171,2 @@ // do nothing if document is already known

}
const window = win.getWindow(doc);

@@ -193,9 +178,9 @@ options = options ? extend({}, options) : {};

});
this.events.documents.push(doc); // don't add an unload event for the main document
this.events.documents.push(doc);
// don't add an unload event for the main document
// so that the page may be cached in browser history
if (doc !== this.document) {
this.events.add(window, 'unload', this.onWindowUnload);
}
this.fire('scope:add-document', {

@@ -208,3 +193,2 @@ doc,

}
removeDocument(doc) {

@@ -224,3 +208,2 @@ const index = this.getDocIndex(doc);

}
getDocIndex(doc) {

@@ -232,6 +215,4 @@ for (let i = 0; i < this.documents.length; i++) {

}
return -1;
}
getDocOptions(doc) {

@@ -241,19 +222,18 @@ const docIndex = this.getDocIndex(doc);

}
now() {
return (this.window.Date || Date).now();
}
}
}
/** @internal */
export function initScope(scope, window) {
scope.isInitialized = true;
if (is.window(window)) {
win.init(window);
}
domObjects.init(window);
browser.init(window);
raf.init(window); // @ts-expect-error
raf.init(window);
// @ts-expect-error
scope.window = window;

@@ -265,3 +245,2 @@ scope.document = window.document;

}
function pluginIdRoot(id) {

@@ -268,0 +247,0 @@ return id && id.replace(/\/.*$/, '');

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

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

@@ -1,6 +0,5 @@

import type { PointerType, Rect, Target } from '@interactjs/core/types';
import * as pointerUtils from '@interactjs/utils/pointerUtils';
import type { PointerType, Rect, Target, ActionProps } from '@interactjs/core/types';
import type { Plugin } from '../scope';
import { Scope } from '../scope';
import type { ActionProps } from '../types';
export declare function unique(): number;

@@ -7,0 +6,0 @@ export declare function uniqueProps(obj: any): void;

import type Interaction from '@interactjs/core/Interaction';
import type { Interactable } from './Interactable';
import type { PhaseMap, InteractEvent } from './InteractEvent';
import type { Interactable } from './Interactable';
import type { NativePointerEvent as NativePointerEvent_ } from './NativeTypes';
export declare type OrBoolean<T> = {
export type OrBoolean<T> = {
[P in keyof T]: T[P] | boolean;
};
export declare type Element = HTMLElement | SVGElement;
export declare type Context = Document | Element;
export declare type EventTarget = Window | Document | Element;
export declare type Target = EventTarget | string;
export type Element = HTMLElement | SVGElement;
export type Context = Document | Element;
export type EventTarget = Window | Document | Element;
export type Target = EventTarget | string;
export interface Point {

@@ -28,6 +28,6 @@ x: number;

}
export declare type FullRect = Required<Rect>;
export declare type RectFunction<T extends any[]> = (...args: T) => Rect | Element;
export declare type RectResolvable<T extends any[]> = Rect | string | Element | RectFunction<T>;
export declare type Dimensions = Point & Size;
export type FullRect = Required<Rect>;
export type RectFunction<T extends any[]> = (...args: T) => Rect | Element;
export type RectResolvable<T extends any[]> = Rect | string | Element | RectFunction<T>;
export type Dimensions = Point & Size;
export interface CoordsSetMember {

@@ -50,3 +50,3 @@ page: Point;

}
export declare type ActionName = keyof ActionMap;
export type ActionName = keyof ActionMap;
export interface Actions {

@@ -72,3 +72,3 @@ map: ActionMap;

}
export declare type InertiaOptions = InertiaOption | boolean;
export type InertiaOptions = InertiaOption | boolean;
export interface EdgeOptions {

@@ -80,3 +80,3 @@ top?: boolean | string | Element;

}
export declare type CursorChecker = (action: ActionProps<ActionName>, interactable: Interactable, element: Element, interacting: boolean) => string;
export type CursorChecker = (action: ActionProps<ActionName>, interactable: Interactable, element: Element, interacting: boolean) => string;
export interface ActionMethod<T> {

@@ -90,4 +90,4 @@ (this: Interactable): T;

}
export declare type ActionChecker = (pointerEvent: any, defaultAction: string, interactable: Interactable, element: Element, interaction: Interaction) => ActionProps;
export declare type OriginFunction = (target: Element) => Rect;
export type ActionChecker = (pointerEvent: any, defaultAction: string, interactable: Interactable, element: Element, interaction: Interaction) => ActionProps;
export type OriginFunction = (target: Element) => Rect;
export interface PointerEventsOptions {

@@ -99,13 +99,13 @@ holdDuration?: number;

}
export declare type RectChecker = (element: Element) => Rect;
export declare type NativePointerEventType = typeof NativePointerEvent_;
export declare type PointerEventType = MouseEvent | TouchEvent | Partial<NativePointerEventType> | InteractEvent;
export declare type PointerType = MouseEvent | Touch | Partial<NativePointerEventType> | InteractEvent;
export declare type EventTypes = string | ListenerMap | Array<string | ListenerMap>;
export declare type Listener = (...args: any[]) => any;
export declare type Listeners = ListenerMap | ListenerMap[];
export declare type ListenersArg = Listener | ListenerMap | Array<Listener | ListenerMap>;
export type RectChecker = (element: Element) => Rect;
export type NativePointerEventType = typeof NativePointerEvent_;
export type PointerEventType = MouseEvent | TouchEvent | Partial<NativePointerEventType> | InteractEvent;
export type PointerType = MouseEvent | Touch | Partial<NativePointerEventType> | InteractEvent;
export type EventTypes = string | ListenerMap | Array<string | ListenerMap>;
export type Listener = (...args: any[]) => any;
export type Listeners = ListenerMap | ListenerMap[];
export type ListenersArg = Listener | ListenerMap | Array<Listener | ListenerMap>;
export interface ListenerMap {
[index: string]: ListenersArg | ListenersArg[];
}
export declare type ArrayElementType<T> = T extends Array<infer P> ? P : never;
export type ArrayElementType<T> = T extends Array<infer P> ? P : never;

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

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