Socket
Socket
Sign inDemoInstall

@interactjs/utils

Package Overview
Dependencies
Maintainers
2
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interactjs/utils - npm Package Compare versions

Comparing version 1.9.18 to 1.9.19

6

browser.js

@@ -1,4 +0,4 @@

import domObjects from './domObjects';
import is from './is';
import win from './window';
import domObjects from "./domObjects.js";
import is from "./is.js";
import win from "./window.js";
const browser = {

@@ -5,0 +5,0 @@ init,

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

import e from"./domObjects";import t from"./is";import o from"./window";const n={init(r){const s=e.Element,i=o.window.navigator;n.supportsTouch="ontouchstart"in r||t.func(r.DocumentTouch)&&e.document instanceof r.DocumentTouch,n.supportsPointerEvent=!1!==i.pointerEnabled&&!!e.PointerEvent,n.isIOS=/iP(hone|od|ad)/.test(i.platform),n.isIOS7=/iP(hone|od|ad)/.test(i.platform)&&/OS 7[^\d]/.test(i.appVersion),n.isIe9=/MSIE 9/.test(i.userAgent),n.isOperaMobile="Opera"===i.appName&&n.supportsTouch&&/Presto/.test(i.userAgent),n.prefixedMatchesSelector="matches"in s.prototype?"matches":"webkitMatchesSelector"in s.prototype?"webkitMatchesSelector":"mozMatchesSelector"in s.prototype?"mozMatchesSelector":"oMatchesSelector"in s.prototype?"oMatchesSelector":"msMatchesSelector",n.pEventTypes=n.supportsPointerEvent?e.PointerEvent===r.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}:{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"}:null,n.wheelEvent="onmousewheel"in e.document?"mousewheel":"wheel"},supportsTouch:null,supportsPointerEvent:null,isIOS7:null,isIOS:null,isIe9:null,isOperaMobile:null,prefixedMatchesSelector:null,pEventTypes:null,wheelEvent:null};export default n;
import e from"./domObjects.min.js";import t from"./is.min.js";import o from"./window.min.js";const n={init(r){const s=e.Element,i=o.window.navigator;n.supportsTouch="ontouchstart"in r||t.func(r.DocumentTouch)&&e.document instanceof r.DocumentTouch,n.supportsPointerEvent=!1!==i.pointerEnabled&&!!e.PointerEvent,n.isIOS=/iP(hone|od|ad)/.test(i.platform),n.isIOS7=/iP(hone|od|ad)/.test(i.platform)&&/OS 7[^\d]/.test(i.appVersion),n.isIe9=/MSIE 9/.test(i.userAgent),n.isOperaMobile="Opera"===i.appName&&n.supportsTouch&&/Presto/.test(i.userAgent),n.prefixedMatchesSelector="matches"in s.prototype?"matches":"webkitMatchesSelector"in s.prototype?"webkitMatchesSelector":"mozMatchesSelector"in s.prototype?"mozMatchesSelector":"oMatchesSelector"in s.prototype?"oMatchesSelector":"msMatchesSelector",n.pEventTypes=n.supportsPointerEvent?e.PointerEvent===r.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}:{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"}:null,n.wheelEvent="onmousewheel"in e.document?"mousewheel":"wheel"},supportsTouch:null,supportsPointerEvent:null,isIOS7:null,isIOS:null,isIe9:null,isOperaMobile:null,prefixedMatchesSelector:null,pEventTypes:null,wheelEvent:null};export default n;
//# sourceMappingURL=browser.min.js.map

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

import * as arr from './arr';
import is from './is'; // tslint:disable-next-line ban-types
import * as arr from "./arr.js";
import is from "./is.js"; // tslint:disable-next-line ban-types

@@ -4,0 +4,0 @@ export default function clone(source) {

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

import*as r from"./arr";import o from"./is";export default function t(n){const a={};for(const f in n){const i=n[f];o.plainObject(i)?a[f]=t(i):o.array(i)?a[f]=r.from(i):a[f]=i}return a}
import*as r from"./arr.min.js";import o from"./is.min.js";export default function n(t){const i={};for(const m in t){const s=t[m];o.plainObject(s)?i[m]=n(s):o.array(s)?i[m]=r.from(s):i[m]=s}return i}
//# sourceMappingURL=clone.min.js.map

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

import browser from './browser';
import domObjects from './domObjects';
import is from './is';
import win, { getWindow } from './window';
import browser from "./browser.js";
import domObjects from "./domObjects.js";
import is from "./is.js";
import win, { getWindow } from "./window.js";
export function nodeContains(parent, child) {

@@ -51,33 +51,31 @@ while (child) {

const getParent = el => el.parentNode ? el.parentNode : el.host; // Test for the element that's "above" all other qualifiers
const getParent = el => el.parentNode || el.host; // Test for the element that's "above" all other qualifiers
export function indexOfDeepestElement(elements) {
let deepestZoneParents = [];
let deepestZone = elements[0];
let index = deepestZone ? 0 : -1;
let i;
let n;
let deepestNodeParents = [];
let deepestNodeIndex;
for (i = 1; i < elements.length; i++) {
const dropzone = elements[i]; // an element might belong to multiple selector dropzones
for (let i = 0; i < elements.length; i++) {
const currentNode = elements[i];
const deepestNode = elements[deepestNodeIndex]; // node may appear in elements array multiple times
if (!dropzone || dropzone === deepestZone) {
if (!currentNode || i === deepestNodeIndex) {
continue;
}
if (!deepestZone) {
deepestZone = dropzone;
index = i;
if (!deepestNode) {
deepestNodeIndex = i;
continue;
} // check if the deepest or current are document.documentElement or document.rootElement
// - if the current dropzone is, do nothing and continue
}
const currentNodeParent = getParent(currentNode);
const deepestNodeParent = getParent(deepestNode); // check if the deepest or current are document.documentElement/rootElement
// - if the current node is, do nothing and continue
if (dropzone.parentNode === dropzone.ownerDocument) {
if (currentNodeParent === currentNode.ownerDocument) {
continue;
} // - if deepest is, update with the current dropzone and continue to next
else if (deepestZone.parentNode === dropzone.ownerDocument) {
deepestZone = dropzone;
index = i;
} // - if deepest is, update with the current node and continue to next
else if (deepestNodeParent === currentNode.ownerDocument) {
deepestNodeIndex = i;
continue;

@@ -87,52 +85,33 @@ } // compare zIndex of siblings

if (dropzone.parentNode === deepestZone.parentNode) {
const deepestZIndex = parseInt(getWindow(deepestZone).getComputedStyle(deepestZone).zIndex, 10) || 0;
const dropzoneZIndex = parseInt(getWindow(dropzone).getComputedStyle(dropzone).zIndex, 10) || 0;
if (dropzoneZIndex >= deepestZIndex) {
deepestZone = dropzone;
index = i;
if (currentNodeParent === deepestNodeParent) {
if (zIndexIsHigherThan(currentNode, deepestNode)) {
deepestNodeIndex = i;
}
continue;
} // populate the ancestry array for the latest deepest dropzone
} // populate the ancestry array for the latest deepest node
if (!deepestZoneParents.length) {
let parent = deepestZone;
let parentParent;
deepestNodeParents = deepestNodeParents.length ? deepestNodeParents : getNodeParents(deepestNode);
let ancestryStart; // if the deepest node is an HTMLElement and the current node is a non root svg element
while ((parentParent = getParent(parent)) && parentParent !== parent.ownerDocument) {
deepestZoneParents.unshift(parent);
parent = parentParent;
}
}
let parent; // if this element is an svg element and the current deepest is an
// HTMLElement
if (deepestZone instanceof domObjects.HTMLElement && dropzone instanceof domObjects.SVGElement && !(dropzone instanceof domObjects.SVGSVGElement)) {
if (dropzone === deepestZone.parentNode) {
if (deepestNode instanceof domObjects.HTMLElement && currentNode instanceof domObjects.SVGElement && !(currentNode instanceof domObjects.SVGSVGElement)) {
// TODO: is this check necessary? Was this for HTML elements embedded in SVG?
if (currentNode === deepestNodeParent) {
continue;
}
parent = dropzone.ownerSVGElement;
ancestryStart = currentNode.ownerSVGElement;
} else {
parent = dropzone;
ancestryStart = currentNode;
}
const dropzoneParents = [];
const currentNodeParents = getNodeParents(ancestryStart, deepestNode.ownerDocument);
let commonIndex = 0; // get (position of closest common ancestor) + 1
while (parent.parentNode !== parent.ownerDocument) {
dropzoneParents.unshift(parent);
parent = getParent(parent);
while (currentNodeParents[commonIndex] && currentNodeParents[commonIndex] === deepestNodeParents[commonIndex]) {
commonIndex++;
}
n = 0; // get (position of last common ancestor) + 1
while (dropzoneParents[n] && dropzoneParents[n] === deepestZoneParents[n]) {
n++;
}
const parents = [dropzoneParents[n - 1], dropzoneParents[n], deepestZoneParents[n]];
const parents = [currentNodeParents[commonIndex - 1], currentNodeParents[commonIndex], deepestNodeParents[commonIndex]];
let child = parents[0].lastChild;

@@ -142,5 +121,4 @@

if (child === parents[1]) {
deepestZone = dropzone;
index = i;
deepestZoneParents = dropzoneParents;
deepestNodeIndex = i;
deepestNodeParents = currentNodeParents;
break;

@@ -155,4 +133,24 @@ } else if (child === parents[2]) {

return index;
return deepestNodeIndex;
}
function getNodeParents(node, limit) {
const parents = [];
let parent = node;
let parentParent;
while ((parentParent = getParent(parent)) && parent !== limit && parentParent !== parent.ownerDocument) {
parents.unshift(parent);
parent = parentParent;
}
return parents;
}
function zIndexIsHigherThan(higherNode, lowerNode) {
const higherIndex = parseInt(getWindow(higherNode).getComputedStyle(higherNode).zIndex, 10) || 0;
const lowerIndex = parseInt(getWindow(lowerNode).getComputedStyle(lowerNode).zIndex, 10) || 0;
return higherIndex >= lowerIndex;
}
export function matchesUpTo(element, selector, limit) {

@@ -159,0 +157,0 @@ while (is.element(element)) {

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

import e from"./browser";import t from"./domObjects";import n from"./is";import o,{getWindow as r}from"./window";export function nodeContains(e,t){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}export function closest(e,t){for(;n.element(e);){if(matchesSelector(e,t))return e;e=parentNode(e)}return null}export function parentNode(e){let t=e.parentNode;if(n.docFrag(t)){for(;(t=t.host)&&n.docFrag(t););return t}return t}export function matchesSelector(t,n){return o.window!==o.realWindow&&(n=n.replace(/\/deep\//g," ")),t[e.prefixedMatchesSelector](n)}const i=e=>e.parentNode?e.parentNode:e.host;export function indexOfDeepestElement(e){let n,o,c=[],l=e[0],f=l?0:-1;for(n=1;n<e.length;n++){const u=e[n];if(!u||u===l)continue;if(!l){l=u,f=n;continue}if(u.parentNode===u.ownerDocument)continue;if(l.parentNode===u.ownerDocument){l=u,f=n;continue}if(u.parentNode===l.parentNode){const e=parseInt(r(l).getComputedStyle(l).zIndex,10)||0;(parseInt(r(u).getComputedStyle(u).zIndex,10)||0)>=e&&(l=u,f=n);continue}if(!c.length){let e,t=l;for(;(e=i(t))&&e!==t.ownerDocument;)c.unshift(t),t=e}let p;if(l instanceof t.HTMLElement&&u instanceof t.SVGElement&&!(u instanceof t.SVGSVGElement)){if(u===l.parentNode)continue;p=u.ownerSVGElement}else p=u;const s=[];for(;p.parentNode!==p.ownerDocument;)s.unshift(p),p=i(p);for(o=0;s[o]&&s[o]===c[o];)o++;const m=[s[o-1],s[o],c[o]];let d=m[0].lastChild;for(;d;){if(d===m[1]){l=u,f=n,c=s;break}if(d===m[2])break;d=d.previousSibling}}return f}export function matchesUpTo(e,t,o){for(;n.element(e);){if(matchesSelector(e,t))return!0;if((e=parentNode(e))===o)return matchesSelector(e,t)}return!1}export function getActualElement(e){return e instanceof t.SVGElementInstance?e.correspondingUseElement:e}export function getScrollXY(e){return{x:(e=e||o.window).scrollX||e.document.documentElement.scrollLeft,y:e.scrollY||e.document.documentElement.scrollTop}}export function getElementClientRect(e){const n=e instanceof t.SVGElement?e.getBoundingClientRect():e.getClientRects()[0];return n&&{left:n.left,right:n.right,top:n.top,bottom:n.bottom,width:n.width||n.right-n.left,height:n.height||n.bottom-n.top}}export function getElementRect(t){const n=getElementClientRect(t);if(!e.isIOS7&&n){const e=getScrollXY(o.getWindow(t));n.left+=e.x,n.right+=e.x,n.top+=e.y,n.bottom+=e.y}return n}export function getPath(e){const t=[];for(;e;)t.push(e),e=parentNode(e);return t}export function trySelector(e){return!!n.string(e)&&(t.document.querySelector(e),!0)}
import e from"./browser.min.js";import t from"./domObjects.min.js";import n from"./is.min.js";import o,{getWindow as r}from"./window.min.js";export function nodeContains(e,t){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}export function closest(e,t){for(;n.element(e);){if(matchesSelector(e,t))return e;e=parentNode(e)}return null}export function parentNode(e){let t=e.parentNode;if(n.docFrag(t)){for(;(t=t.host)&&n.docFrag(t););return t}return t}export function matchesSelector(t,n){return o.window!==o.realWindow&&(n=n.replace(/\/deep\//g," ")),t[e.prefixedMatchesSelector](n)}const i=e=>e.parentNode||e.host;export function indexOfDeepestElement(e){let n,o=[];for(let r=0;r<e.length;r++){const u=e[r],f=e[n];if(!u||r===n)continue;if(!f){n=r;continue}const s=i(u),m=i(f);if(s===u.ownerDocument)continue;if(m===u.ownerDocument){n=r;continue}if(s===m){l(u,f)&&(n=r);continue}let p;if(o=o.length?o:c(f),f instanceof t.HTMLElement&&u instanceof t.SVGElement&&!(u instanceof t.SVGSVGElement)){if(u===m)continue;p=u.ownerSVGElement}else p=u;const d=c(p,f.ownerDocument);let a=0;for(;d[a]&&d[a]===o[a];)a++;const g=[d[a-1],d[a],o[a]];let h=g[0].lastChild;for(;h;){if(h===g[1]){n=r,o=d;break}if(h===g[2])break;h=h.previousSibling}}return n}function c(e,t){const n=[];let o,r=e;for(;(o=i(r))&&r!==t&&o!==r.ownerDocument;)n.unshift(r),r=o;return n}function l(e,t){return(parseInt(r(e).getComputedStyle(e).zIndex,10)||0)>=(parseInt(r(t).getComputedStyle(t).zIndex,10)||0)}export function matchesUpTo(e,t,o){for(;n.element(e);){if(matchesSelector(e,t))return!0;if((e=parentNode(e))===o)return matchesSelector(e,t)}return!1}export function getActualElement(e){return e instanceof t.SVGElementInstance?e.correspondingUseElement:e}export function getScrollXY(e){return{x:(e=e||o.window).scrollX||e.document.documentElement.scrollLeft,y:e.scrollY||e.document.documentElement.scrollTop}}export function getElementClientRect(e){const n=e instanceof t.SVGElement?e.getBoundingClientRect():e.getClientRects()[0];return n&&{left:n.left,right:n.right,top:n.top,bottom:n.bottom,width:n.width||n.right-n.left,height:n.height||n.bottom-n.top}}export function getElementRect(t){const n=getElementClientRect(t);if(!e.isIOS7&&n){const e=getScrollXY(o.getWindow(t));n.left+=e.x,n.right+=e.x,n.top+=e.y,n.bottom+=e.y}return n}export function getPath(e){const t=[];for(;e;)t.push(e),e=parentNode(e);return t}export function trySelector(e){return!!n.string(e)&&(t.document.querySelector(e),!0)}
//# sourceMappingURL=domUtils.min.js.map

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

import { rectToXY, resolveRectLike } from './rect';
import { rectToXY, resolveRectLike } from "./rect.js";
export default function (target, element, actionName) {

@@ -3,0 +3,0 @@ const actionOptions = target.options[actionName];

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

import{rectToXY as o,resolveRectLike as r}from"./rect";export default(t,i,n)=>{const e=t.options[n],p=e&&e.origin||t.options.origin,s=r(p,t,i,[t&&i]);return o(s)||{x:0,y:0}};
import{rectToXY as o,resolveRectLike as i}from"./rect.min.js";export default(r,t,n)=>{const e=r.options[n],p=e&&e.origin||r.options.origin,s=i(p,r,t,[r&&t]);return o(s)||{x:0,y:0}};
//# sourceMappingURL=getOriginXY.min.js.map

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

import isWindow from './isWindow';
import win from './window';
import isWindow from "./isWindow.js";
import win from "./window.js";

@@ -4,0 +4,0 @@ const window = thing => thing === win.window || isWindow(thing);

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

import t from"./isWindow";import e from"./window";const n=t=>!!t&&"object"==typeof t,o=t=>"function"==typeof t;export default{window(n){return n===e.window||t(n)},docFrag(t){return n(t)&&11===t.nodeType},object:n,func:o,number(t){return"number"==typeof t},bool(t){return"boolean"==typeof t},string(t){return"string"==typeof t},element(t){if(!t||"object"!=typeof t)return!1;const n=e.getWindow(t)||e.window;return/object|function/.test(typeof n.Element)?t instanceof n.Element:1===t.nodeType&&"string"==typeof t.nodeName},plainObject(t){return n(t)&&!!t.constructor&&/function Object\b/.test(t.constructor.toString())},array(t){return n(t)&&void 0!==t.length&&o(t.splice)}};
import t from"./isWindow.min.js";import e from"./window.min.js";const n=t=>!!t&&"object"==typeof t,o=t=>"function"==typeof t;export default{window(n){return n===e.window||t(n)},docFrag(t){return n(t)&&11===t.nodeType},object:n,func:o,number(t){return"number"==typeof t},bool(t){return"boolean"==typeof t},string(t){return"string"==typeof t},element(t){if(!t||"object"!=typeof t)return!1;const n=e.getWindow(t)||e.window;return/object|function/.test(typeof n.Element)?t instanceof n.Element:1===t.nodeType&&"string"==typeof t.nodeName},plainObject(t){return n(t)&&!!t.constructor&&/function Object\b/.test(t.constructor.toString())},array(t){return n(t)&&void 0!==t.length&&o(t.splice)}};
//# sourceMappingURL=is.min.js.map

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

import win from './window';
import win from "./window.js";
export function warnOnce(method, message) {

@@ -3,0 +3,0 @@ let warned = false;

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

import n from"./window";export function warnOnce(e,o){let r=!1;return function(){return r||(n.window.console.warn(o),r=!0),e.apply(this,arguments)}}export function copyAction(n,e){return n.name=e.name,n.axis=e.axis,n.edges=e.edges,n}
import n from"./window.min.js";export function warnOnce(e,o){let r=!1;return function(){return r||(n.window.console.warn(o),r=!0),e.apply(this,arguments)}}export function copyAction(n,e){return n.name=e.name,n.axis=e.axis,n.edges=e.edges,n}
//# sourceMappingURL=misc.min.js.map

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

import extend from './extend';
import is from './is';
import extend from "./extend.js";
import is from "./is.js";
export default function normalize(type, listeners, result) {

@@ -4,0 +4,0 @@ result = result || {};

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

import r from"./extend";import t from"./is";export default function e(f,i,n){if(n=n||{},t.string(f)&&-1!==f.search(" ")&&(f=o(f)),t.array(f))return f.reduce((t,o)=>r(t,e(o,i,n)),n);if(t.object(f)&&(i=f,f=""),t.func(i))n[f]=n[f]||[],n[f].push(i);else if(t.array(i))for(const r of i)e(f,r,n);else if(t.object(i))for(const r in i){e(o(r).map(r=>`${f}${r}`),i[r],n)}return n}function o(r){return r.trim().split(/ +/)}
import r from"./extend.min.js";import t from"./is.min.js";export default function e(n,o,f){if(f=f||{},t.string(n)&&-1!==n.search(" ")&&(n=i(n)),t.array(n))return n.reduce((t,i)=>r(t,e(i,o,f)),f);if(t.object(n)&&(o=n,n=""),t.func(o))f[n]=f[n]||[],f[n].push(o);else if(t.array(o))for(const r of o)e(n,r,f);else if(t.object(o))for(const r in o){e(i(r).map(r=>`${n}${r}`),o[r],f)}return f}function i(r){return r.trim().split(/ +/)}
//# sourceMappingURL=normalizeListeners.min.js.map
{
"name": "@interactjs/utils",
"version": "1.9.18",
"version": "1.9.19",
"license": "MIT",

@@ -5,0 +5,0 @@ "publishConfig": {

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

import browser from './browser';
import dom from './domObjects';
import * as domUtils from './domUtils';
import hypot from './hypot';
import is from './is';
import pointerExtend from './pointerExtend';
import browser from "./browser.js";
import dom from "./domObjects.js";
import * as domUtils from "./domUtils.js";
import hypot from "./hypot.js";
import is from "./is.js";
import pointerExtend from "./pointerExtend.js";
export function copyCoords(dest, src) {

@@ -8,0 +8,0 @@ dest.page = dest.page || {};

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

import t from"./browser";import e from"./domObjects";import*as o from"./domUtils";import n from"./hypot";import r from"./is";import i from"./pointerExtend";export function copyCoords(t,e){t.page=t.page||{},t.page.x=e.page.x,t.page.y=e.page.y,t.client=t.client||{},t.client.x=e.client.x,t.client.y=e.client.y,t.timeStamp=e.timeStamp}export function setCoordDeltas(t,e,o){t.page.x=o.page.x-e.page.x,t.page.y=o.page.y-e.page.y,t.client.x=o.client.x-e.client.x,t.client.y=o.client.y-e.client.y,t.timeStamp=o.timeStamp-e.timeStamp}export function setCoordVelocity(t,e){const o=Math.max(e.timeStamp/1e3,.001);t.page.x=e.page.x/o,t.page.y=e.page.y/o,t.client.x=e.client.x/o,t.client.y=e.client.y/o,t.timeStamp=o}export function setZeroCoords(t){t.page.x=0,t.page.y=0,t.client.x=0,t.client.y=0}export function isNativePointer(t){return t instanceof e.Event||t instanceof e.Touch}export function getXY(t,e,o){return t=t||"page",(o=o||{}).x=e[t+"X"],o.y=e[t+"Y"],o}export function getPageXY(e,o){return o=o||{x:0,y:0},t.isOperaMobile&&isNativePointer(e)?(getXY("screen",e,o),o.x+=window.scrollX,o.y+=window.scrollY):getXY("page",e,o),o}export function getClientXY(e,o){return o=o||{},t.isOperaMobile&&isNativePointer(e)?getXY("screen",e,o):getXY("client",e,o),o}export function getPointerId(t){return r.number(t.pointerId)?t.pointerId:t.identifier}export function setCoords(t,e,o){const n=e.length>1?pointerAverage(e):e[0],r={};getPageXY(n,r),t.page.x=r.x,t.page.y=r.y,getClientXY(n,r),t.client.x=r.x,t.client.y=r.y,t.timeStamp=o}export function getTouchPair(t){const e=[];return r.array(t)?(e[0]=t[0],e[1]=t[1]):"touchend"===t.type?1===t.touches.length?(e[0]=t.touches[0],e[1]=t.changedTouches[0]):0===t.touches.length&&(e[0]=t.changedTouches[0],e[1]=t.changedTouches[1]):(e[0]=t.touches[0],e[1]=t.touches[1]),e}export function pointerAverage(t){const e={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0};for(const o of t)for(const t in e)e[t]+=o[t];for(const o in e)e[o]/=t.length;return e}export function touchBBox(t){if(!(t.length||t.touches&&t.touches.length>1))return null;const e=getTouchPair(t),o=Math.min(e[0].pageX,e[1].pageX),n=Math.min(e[0].pageY,e[1].pageY),r=Math.max(e[0].pageX,e[1].pageX),i=Math.max(e[0].pageY,e[1].pageY);return{x:o,y:n,left:o,top:n,right:r,bottom:i,width:r-o,height:i-n}}export function touchDistance(t,e){const o=e+"X",r=e+"Y",i=getTouchPair(t),c=i[0][o]-i[1][o],p=i[0][r]-i[1][r];return n(c,p)}export function touchAngle(t,e){const o=e+"X",n=e+"Y",r=getTouchPair(t),i=r[1][o]-r[0][o],c=r[1][n]-r[0][n];return 180*Math.atan2(c,i)/Math.PI}export function getPointerType(t){return r.string(t.pointerType)?t.pointerType:r.number(t.pointerType)?[void 0,void 0,"touch","pen","mouse"][t.pointerType]:/touch/.test(t.type)||t instanceof e.Touch?"touch":"mouse"}export function getEventTargets(t){const e=r.func(t.composedPath)?t.composedPath():t.path;return[o.getActualElement(e?e[0]:t.target),o.getActualElement(t.currentTarget)]}export function newCoords(){return{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0}}export function coordsToEvent(t){return{coords:t,get page(){return this.coords.page},get client(){return this.coords.client},get timeStamp(){return this.coords.timeStamp},get pageX(){return this.coords.page.x},get pageY(){return this.coords.page.y},get clientX(){return this.coords.client.x},get clientY(){return this.coords.client.y},get pointerId(){return this.coords.pointerId},get target(){return this.coords.target},get type(){return this.coords.type},get pointerType(){return this.coords.pointerType},get buttons(){return this.coords.buttons},preventDefault(){}}}export{i as pointerExtend};
import t from"./browser.min.js";import e from"./domObjects.min.js";import*as n from"./domUtils.min.js";import o from"./hypot.min.js";import r from"./is.min.js";import i from"./pointerExtend.min.js";export function copyCoords(t,e){t.page=t.page||{},t.page.x=e.page.x,t.page.y=e.page.y,t.client=t.client||{},t.client.x=e.client.x,t.client.y=e.client.y,t.timeStamp=e.timeStamp}export function setCoordDeltas(t,e,n){t.page.x=n.page.x-e.page.x,t.page.y=n.page.y-e.page.y,t.client.x=n.client.x-e.client.x,t.client.y=n.client.y-e.client.y,t.timeStamp=n.timeStamp-e.timeStamp}export function setCoordVelocity(t,e){const n=Math.max(e.timeStamp/1e3,.001);t.page.x=e.page.x/n,t.page.y=e.page.y/n,t.client.x=e.client.x/n,t.client.y=e.client.y/n,t.timeStamp=n}export function setZeroCoords(t){t.page.x=0,t.page.y=0,t.client.x=0,t.client.y=0}export function isNativePointer(t){return t instanceof e.Event||t instanceof e.Touch}export function getXY(t,e,n){return t=t||"page",(n=n||{}).x=e[t+"X"],n.y=e[t+"Y"],n}export function getPageXY(e,n){return n=n||{x:0,y:0},t.isOperaMobile&&isNativePointer(e)?(getXY("screen",e,n),n.x+=window.scrollX,n.y+=window.scrollY):getXY("page",e,n),n}export function getClientXY(e,n){return n=n||{},t.isOperaMobile&&isNativePointer(e)?getXY("screen",e,n):getXY("client",e,n),n}export function getPointerId(t){return r.number(t.pointerId)?t.pointerId:t.identifier}export function setCoords(t,e,n){const o=e.length>1?pointerAverage(e):e[0],r={};getPageXY(o,r),t.page.x=r.x,t.page.y=r.y,getClientXY(o,r),t.client.x=r.x,t.client.y=r.y,t.timeStamp=n}export function getTouchPair(t){const e=[];return r.array(t)?(e[0]=t[0],e[1]=t[1]):"touchend"===t.type?1===t.touches.length?(e[0]=t.touches[0],e[1]=t.changedTouches[0]):0===t.touches.length&&(e[0]=t.changedTouches[0],e[1]=t.changedTouches[1]):(e[0]=t.touches[0],e[1]=t.touches[1]),e}export function pointerAverage(t){const e={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0};for(const n of t)for(const t in e)e[t]+=n[t];for(const n in e)e[n]/=t.length;return e}export function touchBBox(t){if(!(t.length||t.touches&&t.touches.length>1))return null;const e=getTouchPair(t),n=Math.min(e[0].pageX,e[1].pageX),o=Math.min(e[0].pageY,e[1].pageY),r=Math.max(e[0].pageX,e[1].pageX),i=Math.max(e[0].pageY,e[1].pageY);return{x:n,y:o,left:n,top:o,right:r,bottom:i,width:r-n,height:i-o}}export function touchDistance(t,e){const n=e+"X",r=e+"Y",i=getTouchPair(t),c=i[0][n]-i[1][n],p=i[0][r]-i[1][r];return o(c,p)}export function touchAngle(t,e){const n=e+"X",o=e+"Y",r=getTouchPair(t),i=r[1][n]-r[0][n],c=r[1][o]-r[0][o];return 180*Math.atan2(c,i)/Math.PI}export function getPointerType(t){return r.string(t.pointerType)?t.pointerType:r.number(t.pointerType)?[void 0,void 0,"touch","pen","mouse"][t.pointerType]:/touch/.test(t.type)||t instanceof e.Touch?"touch":"mouse"}export function getEventTargets(t){const e=r.func(t.composedPath)?t.composedPath():t.path;return[n.getActualElement(e?e[0]:t.target),n.getActualElement(t.currentTarget)]}export function newCoords(){return{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0}}export function coordsToEvent(t){return{coords:t,get page(){return this.coords.page},get client(){return this.coords.client},get timeStamp(){return this.coords.timeStamp},get pageX(){return this.coords.page.x},get pageY(){return this.coords.page.y},get clientX(){return this.coords.client.x},get clientY(){return this.coords.client.y},get pointerId(){return this.coords.pointerId},get target(){return this.coords.target},get type(){return this.coords.type},get pointerType(){return this.coords.pointerType},get buttons(){return this.coords.buttons},preventDefault(){}}}export{i as pointerExtend};
//# sourceMappingURL=pointerUtils.min.js.map

@@ -1,4 +0,4 @@

import { closest, getElementRect, parentNode } from './domUtils';
import extend from './extend';
import is from './is';
import { closest, getElementRect, parentNode } from "./domUtils.js";
import extend from "./extend.js";
import is from "./is.js";
export function getStringOptionResult(value, target, element) {

@@ -5,0 +5,0 @@ if (value === 'parent') {

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

import{closest as t,getElementRect as o,parentNode as e}from"./domUtils";import i from"./extend";import r from"./is";export function getStringOptionResult(o,i,r){return"parent"===o?e(r):"self"===o?i.getRect(r):t(r,o)}export function resolveRectLike(t,e,i,n){let h=t;return r.string(h)?h=getStringOptionResult(h,e,i):r.func(h)&&(h=h(...n)),r.element(h)&&(h=o(h)),h}export function rectToXY(t){return t&&{x:"x"in t?t.x:t.left,y:"y"in t?t.y:t.top}}export function xywhToTlbr(t){return!t||"left"in t&&"top"in t||((t=i({},t)).left=t.x||0,t.top=t.y||0,t.right=t.right||t.left+t.width,t.bottom=t.bottom||t.top+t.height),t}export function tlbrToXywh(t){return!t||"x"in t&&"y"in t||((t=i({},t)).x=t.left||0,t.y=t.top||0,t.width=t.width||(t.right||0)-t.x,t.height=t.height||(t.bottom||0)-t.y),t}export function addEdges(t,o,e){t.left&&(o.left+=e.x),t.right&&(o.right+=e.x),t.top&&(o.top+=e.y),t.bottom&&(o.bottom+=e.y),o.width=o.right-o.left,o.height=o.bottom-o.top}
import{closest as t,getElementRect as o,parentNode as e}from"./domUtils.min.js";import i from"./extend.min.js";import r from"./is.min.js";export function getStringOptionResult(o,i,r){return"parent"===o?e(r):"self"===o?i.getRect(r):t(r,o)}export function resolveRectLike(t,e,i,n){let h=t;return r.string(h)?h=getStringOptionResult(h,e,i):r.func(h)&&(h=h(...n)),r.element(h)&&(h=o(h)),h}export function rectToXY(t){return t&&{x:"x"in t?t.x:t.left,y:"y"in t?t.y:t.top}}export function xywhToTlbr(t){return!t||"left"in t&&"top"in t||((t=i({},t)).left=t.x||0,t.top=t.y||0,t.right=t.right||t.left+t.width,t.bottom=t.bottom||t.top+t.height),t}export function tlbrToXywh(t){return!t||"x"in t&&"y"in t||((t=i({},t)).x=t.left||0,t.y=t.top||0,t.width=t.width||(t.right||0)-t.x,t.height=t.height||(t.bottom||0)-t.y),t}export function addEdges(t,o,e){t.left&&(o.left+=e.x),t.right&&(o.right+=e.x),t.top&&(o.top+=e.y),t.bottom&&(o.bottom+=e.y),o.width=o.right-o.left,o.height=o.bottom-o.top}
//# sourceMappingURL=rect.min.js.map

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

import isWindow from './isWindow';
import isWindow from "./isWindow.js";
const win = {

@@ -3,0 +3,0 @@ realWindow: undefined,

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

import i from"./isWindow";const n={realWindow:void 0,window:void 0,getWindow:getWindow,init:init};export function init(i){n.realWindow=i;const o=i.document.createTextNode("");o.ownerDocument!==i.document&&"function"==typeof i.wrap&&i.wrap(o)===o&&(i=i.wrap(i)),n.window=i}"undefined"==typeof window?(n.window=void 0,n.realWindow=void 0):init(window);export function getWindow(o){if(i(o))return o;return(o.ownerDocument||o).defaultView||n.window}n.init=init;export default n;
import i from"./isWindow.min.js";const n={realWindow:void 0,window:void 0,getWindow:getWindow,init:init};export function init(i){n.realWindow=i;const o=i.document.createTextNode("");o.ownerDocument!==i.document&&"function"==typeof i.wrap&&i.wrap(o)===o&&(i=i.wrap(i)),n.window=i}"undefined"==typeof window?(n.window=void 0,n.realWindow=void 0):init(window);export function getWindow(o){if(i(o))return o;return(o.ownerDocument||o).defaultView||n.window}n.init=init;export default n;
//# sourceMappingURL=window.min.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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