🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@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

to
1.10.20

2

getOriginXY.d.ts
import type { PerActionDefaults } from '@interactjs/core/options';
import type { ActionName, HasGetRect } from '@interactjs/core/types';
export default function (target: HasGetRect & {
export default function getOriginXY(target: HasGetRect & {
options: PerActionDefaults;

@@ -5,0 +5,0 @@ }, element: Node, actionName?: ActionName): {

import { rectToXY, resolveRectLike } from './rect';
export default function (target, element, actionName) {
const actionOptions = target.options[actionName];
export default function getOriginXY(target, element, actionName) {
const actionOptions = actionName && target.options[actionName];
const actionOrigin = actionOptions && actionOptions.origin;

@@ -5,0 +5,0 @@ const origin = actionOrigin || target.options.origin;

@@ -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 t}from"./rect";export default function i(i,n,r){const e=r&&i.options[r],p=e&&e.origin||i.options.origin,c=t(p,i,n,[i&&n]);return o(c)||{x:0,y:0}}
//# sourceMappingURL=getOriginXY.prod.js.map

@@ -5,2 +5,2 @@ import type { EventTypes, Listener, ListenersArg } from '@interactjs/core/types';

}
export default function normalize(type: EventTypes, listeners?: ListenersArg | ListenersArg[], result?: NormalizedListeners): NormalizedListeners;
export default function normalize(type: EventTypes, listeners?: ListenersArg | ListenersArg[] | null, result?: NormalizedListeners): NormalizedListeners;
{
"name": "@interactjs/utils",
"version": "1.10.19",
"version": "1.10.20",
"type": "module",

@@ -16,3 +16,3 @@ "repository": {

"license": "MIT",
"gitHead": "f3a3a694"
"gitHead": "f7135537"
}

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

import type { HasGetRect, RectResolvable, Rect, Point, EdgeOptions } from '@interactjs/core/types';
import type { HasGetRect, RectResolvable, Rect, Point, FullRect, EdgeOptions } from '@interactjs/core/types';
export declare function getStringOptionResult(value: any, target: HasGetRect, element: Node): ParentNode | Rect;
export declare function resolveRectLike<T extends any[]>(value: RectResolvable<T>, target?: HasGetRect, element?: Node, functionArgs?: T): Rect;
export declare function toFullRect(rect: Rect): FullRect;
export declare function rectToXY(rect: Rect | Point): {

@@ -5,0 +6,0 @@ x: number;

@@ -30,2 +30,20 @@ import { closest, getElementRect, parentNode } from './domUtils';

}
export function toFullRect(rect) {
const {
top,
left,
bottom,
right
} = rect;
const width = rect.width ?? rect.right - rect.left;
const height = rect.height ?? rect.bottom - rect.top;
return {
top,
left,
bottom,
right,
width,
height
};
}
export function rectToXY(rect) {

@@ -32,0 +50,0 @@ return rect && {

@@ -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";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 toFullRect(t){const{top:o,left:e,bottom:i,right:r}=t;return{top:o,left:e,bottom:i,right:r,width:t.width??t.right-t.left,height:t.height??t.bottom-t.top}}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.prod.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet