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

@interactjs/modifiers

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/modifiers - npm Package Compare versions

Comparing version 1.9.14 to 1.9.15

24

all.js
/* eslint-disable node/no-extraneous-import */
import aspectRatio from "./aspectRatio.js";
import avoid from "./avoid.js";
import restrictEdges from "./restrict/edges.js";
import restrict from "./restrict/pointer.js";
import restrictRect from "./restrict/rect.js";
import restrictSize from "./restrict/size.js";
import rubberband from "./rubberband.js";
import snapEdges from "./snap/edges.js";
import snap from "./snap/pointer.js";
import snapSize from "./snap/size.js";
import spring from "./spring.js";
import transform from "./transform.js";
import aspectRatio from './aspectRatio';
import avoid from './avoid';
import restrictEdges from './restrict/edges';
import restrict from './restrict/pointer';
import restrictRect from './restrict/rect';
import restrictSize from './restrict/size';
import rubberband from './rubberband';
import snapEdges from './snap/edges';
import snap from './snap/pointer';
import snapSize from './snap/size';
import spring from './spring';
import transform from './transform';
export default {

@@ -15,0 +15,0 @@ aspectRatio,

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

import r from"./aspectRatio.min.js";import i from"./avoid.min.js";import t from"./restrict/edges.min.js";import m from"./restrict/pointer.min.js";import s from"./restrict/rect.min.js";import o from"./restrict/size.min.js";import e from"./rubberband.min.js";import n from"./snap/edges.min.js";import p from"./snap/pointer.min.js";import a from"./snap/size.min.js";import f from"./spring.min.js";import c from"./transform.min.js";export default{aspectRatio:r,restrictEdges:t,restrict:m,restrictRect:s,restrictSize:o,snapEdges:n,snap:p,snapSize:a,spring:f,avoid:i,transform:c,rubberband:e};
import r from"./aspectRatio";import t from"./avoid";import o from"./restrict/edges";import i from"./restrict/pointer";import e from"./restrict/rect";import m from"./restrict/size";import s from"./rubberband";import p from"./snap/edges";import a from"./snap/pointer";import f from"./snap/size";import n from"./spring";import c from"./transform";export default{aspectRatio:r,restrictEdges:o,restrict:i,restrictRect:e,restrictSize:m,snapEdges:p,snap:a,snapSize:f,spring:n,avoid:t,transform:c,rubberband:s};
//# sourceMappingURL=all.min.js.map

@@ -19,4 +19,4 @@ /**

import { addEdges } from "../utils/rect.js";
import Modification from "./Modification.js";
import { makeModifier } from "./base.js";
import Modification from './Modification';
import { makeModifier } from './base';
const aspectRatio = {

@@ -23,0 +23,0 @@ start(arg) {

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

import t from"../utils/extend.min.js";import{addEdges as e}from"../utils/rect.min.js";import o from"./Modification.min.js";import{makeModifier as i}from"./base.min.js";const s={start(e){const{state:i,rect:s,edges:r,pageCoords:a}=e;let{ratio:n}=i.options;const{equalDelta:d,modifiers:l}=i.options;"preserve"===n&&(n=s.width/s.height),i.startCoords=t({},a),i.startRect=t({},s),i.ratio=n,i.equalDelta=d;const c=i.linkedEdges={top:r.top||r.left&&!r.bottom,left:r.left||r.top&&!r.right,bottom:r.bottom||r.right&&!r.top,right:r.right||r.bottom&&!r.left};if(i.xIsPrimaryAxis=!(!r.left&&!r.right),i.equalDelta)i.edgeSign=(c.left?1:-1)*(c.top?1:-1);else{const t=i.xIsPrimaryAxis?c.top:c.left;i.edgeSign=t?-1:1}if(t(e.edges,c),!l||!l.length)return;const f=new o(e.interaction);f.copyFrom(e.interaction.modification),f.prepareStates(l),i.subModification=f,f.startAll({...e})},set(o){const{state:i,rect:s,coords:n}=o,d=t({},n),l=i.equalDelta?r:a;if(l(i,i.xIsPrimaryAxis,n,s),!i.subModification)return null;const c=t({},s);e(i.linkedEdges,c,{x:n.x-d.x,y:n.y-d.y});const f=i.subModification.setAll({...o,rect:c,edges:i.linkedEdges,pageCoords:n,prevCoords:n,prevRect:c}),{delta:g}=f;if(f.changed){l(i,Math.abs(g.x)>Math.abs(g.y),f.coords,f.rect),t(n,f.coords)}return f.eventProps},defaults:{ratio:"preserve",equalDelta:!1,modifiers:[],enabled:!1}};function r({startCoords:t,edgeSign:e},o,i){o?i.y=t.y+(i.x-t.x)*e:i.x=t.x+(i.y-t.y)*e}function a({startRect:t,startCoords:e,ratio:o,edgeSign:i},s,r,a){if(s){const s=a.width/o;r.y=e.y+(s-t.height)*i}else{const s=a.height*o;r.x=e.x+(s-t.width)*i}}export default i(s,"aspectRatio");export{s as aspectRatio};
import t from"../utils/extend.min.js";import{addEdges as e}from"../utils/rect.min.js";import o from"./Modification";import{makeModifier as i}from"./base";const r={start(e){const{state:i,rect:r,edges:s,pageCoords:a}=e;let{ratio:n}=i.options;const{equalDelta:d,modifiers:l}=i.options;"preserve"===n&&(n=r.width/r.height),i.startCoords=t({},a),i.startRect=t({},r),i.ratio=n,i.equalDelta=d;const c=i.linkedEdges={top:s.top||s.left&&!s.bottom,left:s.left||s.top&&!s.right,bottom:s.bottom||s.right&&!s.top,right:s.right||s.bottom&&!s.left};if(i.xIsPrimaryAxis=!(!s.left&&!s.right),i.equalDelta)i.edgeSign=(c.left?1:-1)*(c.top?1:-1);else{const t=i.xIsPrimaryAxis?c.top:c.left;i.edgeSign=t?-1:1}if(t(e.edges,c),!l||!l.length)return;const f=new o(e.interaction);f.copyFrom(e.interaction.modification),f.prepareStates(l),i.subModification=f,f.startAll({...e})},set(o){const{state:i,rect:r,coords:n}=o,d=t({},n),l=i.equalDelta?s:a;if(l(i,i.xIsPrimaryAxis,n,r),!i.subModification)return null;const c=t({},r);e(i.linkedEdges,c,{x:n.x-d.x,y:n.y-d.y});const f=i.subModification.setAll({...o,rect:c,edges:i.linkedEdges,pageCoords:n,prevCoords:n,prevRect:c}),{delta:g}=f;if(f.changed){l(i,Math.abs(g.x)>Math.abs(g.y),f.coords,f.rect),t(n,f.coords)}return f.eventProps},defaults:{ratio:"preserve",equalDelta:!1,modifiers:[],enabled:!1}};function s({startCoords:t,edgeSign:e},o,i){o?i.y=t.y+(i.x-t.x)*e:i.x=t.x+(i.y-t.y)*e}function a({startRect:t,startCoords:e,ratio:o,edgeSign:i},r,s,a){if(r){const r=a.width/o;s.y=e.y+(r-t.height)*i}else{const r=a.height*o;s.x=e.x+(r-t.width)*i}}export default i(r,"aspectRatio");export{r as aspectRatio};
//# sourceMappingURL=aspectRatio.min.js.map

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

export { default } from "./noop.js";
export { default } from './noop';
//# sourceMappingURL=avoid.js.map

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

export{default}from"./noop.min.js";
export{default}from"./noop";
//# sourceMappingURL=avoid.min.js.map

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

import Modification from "./Modification.js";
import Modification from './Modification';
export function makeModifier(module, name) {

@@ -3,0 +3,0 @@ const {

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

import t from"./Modification.min.js";export function makeModifier(t,i){const{defaults:n}=t,e={start:t.start,set:t.set,beforeEnd:t.beforeEnd,stop:t.stop},o=t=>{const o=t||{};o.enabled=!1!==o.enabled;for(const t in n)t in o||(o[t]=n[t]);return{options:o,methods:e,name:i}};return i&&"string"==typeof i&&(o._defaults=n,o._methods=e),o}export function addEventModifiers({iEvent:t,interaction:{modification:{result:i}}}){i&&(t.modifiers=i.eventProps)}const i={id:"modifiers/base",install(t){t.defaults.perAction.modifiers=[]},listeners:{"interactions:new"({interaction:i}){i.modification=new t(i)},"interactions:before-action-start"(t){const{modification:i}=t.interaction;i.start(t,t.interaction.coords.start.page),t.interaction.edges=i.edges,i.applyToInteraction(t)},"interactions:before-action-move"(t){return t.interaction.modification.setAndApply(t)},"interactions:before-action-end"(t){return t.interaction.modification.beforeEnd(t)},"interactions:action-start":addEventModifiers,"interactions:action-move":addEventModifiers,"interactions:action-end":addEventModifiers,"interactions:after-action-start"(t){return t.interaction.modification.restoreInteractionCoords(t)},"interactions:after-action-move"(t){return t.interaction.modification.restoreInteractionCoords(t)},"interactions:stop"(t){return t.interaction.modification.stop(t)}},before:["actions","action/drag","actions/resize","actions/gesture"]};export default i;
import t from"./Modification";export function makeModifier(t,i){const{defaults:n}=t,e={start:t.start,set:t.set,beforeEnd:t.beforeEnd,stop:t.stop},o=t=>{const o=t||{};o.enabled=!1!==o.enabled;for(const t in n)t in o||(o[t]=n[t]);return{options:o,methods:e,name:i}};return i&&"string"==typeof i&&(o._defaults=n,o._methods=e),o}export function addEventModifiers({iEvent:t,interaction:{modification:{result:i}}}){i&&(t.modifiers=i.eventProps)}const i={id:"modifiers/base",install(t){t.defaults.perAction.modifiers=[]},listeners:{"interactions:new"({interaction:i}){i.modification=new t(i)},"interactions:before-action-start"(t){const{modification:i}=t.interaction;i.start(t,t.interaction.coords.start.page),t.interaction.edges=i.edges,i.applyToInteraction(t)},"interactions:before-action-move"(t){return t.interaction.modification.setAndApply(t)},"interactions:before-action-end"(t){return t.interaction.modification.beforeEnd(t)},"interactions:action-start":addEventModifiers,"interactions:action-move":addEventModifiers,"interactions:action-end":addEventModifiers,"interactions:after-action-start"(t){return t.interaction.modification.restoreInteractionCoords(t)},"interactions:after-action-move"(t){return t.interaction.modification.restoreInteractionCoords(t)},"interactions:stop"(t){return t.interaction.modification.stop(t)}},before:["actions","action/drag","actions/resize","actions/gesture"]};export default i;
//# sourceMappingURL=base.min.js.map
{
"name": "@interactjs/modifiers",
"version": "1.9.14",
"version": "1.9.15",
"license": "MIT",
"dependencies": {
"@interactjs/snappers": "1.9.14"
"@interactjs/snappers": "1.9.15"
},
"peerDependencies": {
"@interactjs/core": "1.9.14",
"@interactjs/utils": "1.9.14"
"@interactjs/core": "1.9.15",
"@interactjs/utils": "1.9.15"
},
"optionalDependencies": {
"@interactjs/interact": "1.9.14"
"@interactjs/interact": "1.9.15"
},

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

},
"gitHead": "baf83fba"
"gitHead": "96ae04e4"
}
import snappers from "../snappers/plugin.js";
import all from "./all.js";
import base from "./base.js";
import all from './all';
import base from './base';
const modifiers = {

@@ -5,0 +5,0 @@ id: 'modifiers',

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

import i from"../snappers/plugin.min.js";import s from"./all.min.js";import t from"./base.min.js";const o={id:"modifiers",install(o){const{interactStatic:n}=o;o.usePlugin(t),o.usePlugin(i),n.modifiers=s;for(const i in s){const{_defaults:t,_methods:n}=s[i];t._methods=n,o.defaults.perAction[i]=t}}};export default o;
import t from"../snappers/plugin.min.js";import i from"./all";import o from"./base";const s={id:"modifiers",install(s){const{interactStatic:e}=s;s.usePlugin(o),s.usePlugin(t),e.modifiers=i;for(const t in i){const{_defaults:o,_methods:e}=i[t];o._methods=e,s.defaults.perAction[t]=o}}};export default s;
//# sourceMappingURL=plugin.min.js.map

@@ -13,4 +13,4 @@ // This module adds the options.resize.restrictEdges setting which sets min and

import * as rectUtils from "../../utils/rect.js";
import { makeModifier } from "../base.js";
import { getRestrictionRect } from "./pointer.js";
import { makeModifier } from '../base';
import { getRestrictionRect } from './pointer';
const noInner = {

@@ -17,0 +17,0 @@ top: +Infinity,

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

import t from"../../utils/extend.min.js";import*as o from"../../utils/rect.min.js";import{makeModifier as e}from"../base.min.js";import{getRestrictionRect as r}from"./pointer.min.js";const n={top:1/0,left:1/0,bottom:-1/0,right:-1/0},i={top:-1/0,left:-1/0,bottom:1/0,right:1/0};function s(t,o){for(const e of["top","left","bottom","right"])e in t||(t[e]=o[e]);return t}const f={noInner:n,noOuter:i,start({interaction:t,startOffset:e,state:n}){const{options:i}=n;let s;if(i){const e=r(i.offset,t,t.coords.start.page);s=o.rectToXY(e)}s=s||{x:0,y:0},n.offset={top:s.y+e.top,left:s.x+e.left,bottom:s.y-e.bottom,right:s.x-e.right}},set({coords:o,edges:e,interaction:f,state:m}){const{offset:a,options:l}=m;if(!e)return;const p=t({},o),h=r(l.inner,f,p)||{},c=r(l.outer,f,p)||{};s(h,n),s(c,i),e.top?o.y=Math.min(Math.max(c.top+a.top,p.y),h.top+a.top):e.bottom&&(o.y=Math.max(Math.min(c.bottom+a.bottom,p.y),h.bottom+a.bottom)),e.left?o.x=Math.min(Math.max(c.left+a.left,p.x),h.left+a.left):e.right&&(o.x=Math.max(Math.min(c.right+a.right,p.x),h.right+a.right))},defaults:{inner:null,outer:null,offset:null,endOnly:!1,enabled:!1}};export default e(f,"restrictEdges");export{f as restrictEdges};
import t from"../../utils/extend.min.js";import*as o from"../../utils/rect.min.js";import{makeModifier as e}from"../base";import{getRestrictionRect as r}from"./pointer";const n={top:1/0,left:1/0,bottom:-1/0,right:-1/0},i={top:-1/0,left:-1/0,bottom:1/0,right:1/0};function s(t,o){for(const e of["top","left","bottom","right"])e in t||(t[e]=o[e]);return t}const f={noInner:n,noOuter:i,start({interaction:t,startOffset:e,state:n}){const{options:i}=n;let s;if(i){const e=r(i.offset,t,t.coords.start.page);s=o.rectToXY(e)}s=s||{x:0,y:0},n.offset={top:s.y+e.top,left:s.x+e.left,bottom:s.y-e.bottom,right:s.x-e.right}},set({coords:o,edges:e,interaction:f,state:m}){const{offset:a,options:l}=m;if(!e)return;const p=t({},o),h=r(l.inner,f,p)||{},c=r(l.outer,f,p)||{};s(h,n),s(c,i),e.top?o.y=Math.min(Math.max(c.top+a.top,p.y),h.top+a.top):e.bottom&&(o.y=Math.max(Math.min(c.bottom+a.bottom,p.y),h.bottom+a.bottom)),e.left?o.x=Math.min(Math.max(c.left+a.left,p.x),h.left+a.left):e.right&&(o.x=Math.max(Math.min(c.right+a.right,p.x),h.right+a.right))},defaults:{inner:null,outer:null,offset:null,endOnly:!1,enabled:!1}};export default e(f,"restrictEdges");export{f as restrictEdges};
//# sourceMappingURL=edges.min.js.map
import extend from "../../utils/extend.js";
import is from "../../utils/is.js";
import * as rectUtils from "../../utils/rect.js";
import { makeModifier } from "../base.js";
import { makeModifier } from '../base';

@@ -6,0 +6,0 @@ function start({

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

import t from"../../utils/extend.min.js";import e from"../../utils/is.min.js";import*as o from"../../utils/rect.min.js";import{makeModifier as i}from"../base.min.js";export function getRestrictionRect(t,i,r){return e.func(t)?o.resolveRectLike(t,i.interactable,i.element,[r.x,r.y,i]):o.resolveRectLike(t,i.interactable,i.element)}const r={start({rect:e,startOffset:o,state:i,interaction:r,pageCoords:n}){const{options:s}=i,{elementRect:l}=s,c=t({left:0,top:0,right:0,bottom:0},s.offset||{});if(e&&l){const t=getRestrictionRect(s.restriction,r,n);if(t){const o=t.right-t.left-e.width,i=t.bottom-t.top-e.height;o<0&&(c.left+=o,c.right+=o),i<0&&(c.top+=i,c.bottom+=i)}c.left+=o.left-e.width*l.left,c.top+=o.top-e.height*l.top,c.right+=o.right-e.width*(1-l.right),c.bottom+=o.bottom-e.height*(1-l.bottom)}i.offset=c},set({coords:t,interaction:e,state:i}){const{options:r,offset:n}=i,s=getRestrictionRect(r.restriction,e,t);if(!s)return;const l=o.xywhToTlbr(s);t.x=Math.max(Math.min(l.right-n.right,t.x),l.left+n.left),t.y=Math.max(Math.min(l.bottom-n.bottom,t.y),l.top+n.top)},defaults:{restriction:null,elementRect:null,offset:null,endOnly:!1,enabled:!1}};export default i(r,"restrict");export{r as restrict};
import t from"../../utils/extend.min.js";import e from"../../utils/is.min.js";import*as o from"../../utils/rect.min.js";import{makeModifier as i}from"../base";export function getRestrictionRect(t,i,r){return e.func(t)?o.resolveRectLike(t,i.interactable,i.element,[r.x,r.y,i]):o.resolveRectLike(t,i.interactable,i.element)}const r={start({rect:e,startOffset:o,state:i,interaction:r,pageCoords:n}){const{options:s}=i,{elementRect:l}=s,c=t({left:0,top:0,right:0,bottom:0},s.offset||{});if(e&&l){const t=getRestrictionRect(s.restriction,r,n);if(t){const o=t.right-t.left-e.width,i=t.bottom-t.top-e.height;o<0&&(c.left+=o,c.right+=o),i<0&&(c.top+=i,c.bottom+=i)}c.left+=o.left-e.width*l.left,c.top+=o.top-e.height*l.top,c.right+=o.right-e.width*(1-l.right),c.bottom+=o.bottom-e.height*(1-l.bottom)}i.offset=c},set({coords:t,interaction:e,state:i}){const{options:r,offset:n}=i,s=getRestrictionRect(r.restriction,e,t);if(!s)return;const l=o.xywhToTlbr(s);t.x=Math.max(Math.min(l.right-n.right,t.x),l.left+n.left),t.y=Math.max(Math.min(l.bottom-n.bottom,t.y),l.top+n.top)},defaults:{restriction:null,elementRect:null,offset:null,endOnly:!1,enabled:!1}};export default i(r,"restrict");export{r as restrict};
//# sourceMappingURL=pointer.min.js.map
import extend from "../../utils/extend.js";
import { makeModifier } from "../base.js";
import { restrict } from "./pointer.js";
import { makeModifier } from '../base';
import { restrict } from './pointer';
const defaults = extend({

@@ -5,0 +5,0 @@ get elementRect() {

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

import t from"../../utils/extend.min.js";import{makeModifier as e}from"../base.min.js";import{restrict as r}from"./pointer.min.js";const s=t({get elementRect(){return{top:0,left:0,bottom:1,right:1}},set elementRect(t){}},r.defaults),o={start:r.start,set:r.set,defaults:s};export default e(o,"restrictRect");export{o as restrictRect};
import t from"../../utils/extend.min.js";import{makeModifier as e}from"../base";import{restrict as r}from"./pointer";const o=t({get elementRect(){return{top:0,left:0,bottom:1,right:1}},set elementRect(t){}},r.defaults),s={start:r.start,set:r.set,defaults:o};export default e(s,"restrictRect");export{s as restrictRect};
//# sourceMappingURL=rect.min.js.map
import extend from "../../utils/extend.js";
import * as rectUtils from "../../utils/rect.js";
import { makeModifier } from "../base.js";
import { restrictEdges } from "./edges.js";
import { getRestrictionRect } from "./pointer.js";
import { makeModifier } from '../base';
import { restrictEdges } from './edges';
import { getRestrictionRect } from './pointer';
const noMin = {

@@ -7,0 +7,0 @@ width: -Infinity,

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

import t from"../../utils/extend.min.js";import*as o from"../../utils/rect.min.js";import{makeModifier as i}from"../base.min.js";import{restrictEdges as n}from"./edges.min.js";import{getRestrictionRect as e}from"./pointer.min.js";const r={width:-1/0,height:-1/0},s={width:1/0,height:1/0};const h={start(t){return n.start(t)},set(i){const{interaction:h,state:m,rect:p,edges:l}=i,{options:d}=m;if(!l)return;const u=o.tlbrToXywh(e(d.min,h,i.coords))||r,f=o.tlbrToXywh(e(d.max,h,i.coords))||s;m.options={endOnly:d.endOnly,inner:t({},n.noInner),outer:t({},n.noOuter)},l.top?(m.options.inner.top=p.bottom-u.height,m.options.outer.top=p.bottom-f.height):l.bottom&&(m.options.inner.bottom=p.top+u.height,m.options.outer.bottom=p.top+f.height),l.left?(m.options.inner.left=p.right-u.width,m.options.outer.left=p.right-f.width):l.right&&(m.options.inner.right=p.left+u.width,m.options.outer.right=p.left+f.width),n.set(i),m.options=d},defaults:{min:null,max:null,endOnly:!1,enabled:!1}};export default i(h,"restrictSize");export{h as restrictSize};
import t from"../../utils/extend.min.js";import*as o from"../../utils/rect.min.js";import{makeModifier as e}from"../base";import{restrictEdges as i}from"./edges";import{getRestrictionRect as n}from"./pointer";const r={width:-1/0,height:-1/0},s={width:1/0,height:1/0};const h={start(t){return i.start(t)},set(e){const{interaction:h,state:p,rect:m,edges:l}=e,{options:d}=p;if(!l)return;const u=o.tlbrToXywh(n(d.min,h,e.coords))||r,f=o.tlbrToXywh(n(d.max,h,e.coords))||s;p.options={endOnly:d.endOnly,inner:t({},i.noInner),outer:t({},i.noOuter)},l.top?(p.options.inner.top=m.bottom-u.height,p.options.outer.top=m.bottom-f.height):l.bottom&&(p.options.inner.bottom=m.top+u.height,p.options.outer.bottom=m.top+f.height),l.left?(p.options.inner.left=m.right-u.width,p.options.outer.left=m.right-f.width):l.right&&(p.options.inner.right=m.left+u.width,p.options.outer.right=m.left+f.width),i.set(e),p.options=d},defaults:{min:null,max:null,endOnly:!1,enabled:!1}};export default e(h,"restrictSize");export{h as restrictSize};
//# sourceMappingURL=size.min.js.map

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

export { default } from "./noop.js";
export { default } from './noop';
//# sourceMappingURL=rubberband.js.map

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

export{default}from"./noop.min.js";
export{default}from"./noop";
//# sourceMappingURL=rubberband.min.js.map

@@ -30,4 +30,4 @@ /**

import extend from "../../utils/extend.js";
import { makeModifier } from "../base.js";
import { snapSize } from "./size.js";
import { makeModifier } from '../base';
import { snapSize } from './size';

@@ -34,0 +34,0 @@ function start(arg) {

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

import t from"../../utils/clone.min.js";import e from"../../utils/extend.min.js";import{makeModifier as s}from"../base.min.js";import{snapSize as r}from"./size.min.js";const o={start(t){const{edges:e}=t;return e?(t.state.targetFields=t.state.targetFields||[[e.left?"left":"right",e.top?"top":"bottom"]],r.start(t)):null},set:r.set,defaults:e(t(r.defaults),{targets:null,range:null,offset:{x:0,y:0}})};export default s(o,"snapEdges");export{o as snapEdges};
import t from"../../utils/clone.min.js";import e from"../../utils/extend.min.js";import{makeModifier as s}from"../base";import{snapSize as r}from"./size";const o={start(t){const{edges:e}=t;return e?(t.state.targetFields=t.state.targetFields||[[e.left?"left":"right",e.top?"top":"bottom"]],r.start(t)):null},set:r.set,defaults:e(t(r.defaults),{targets:null,range:null,offset:{x:0,y:0}})};export default s(o,"snapEdges");export{o as snapEdges};
//# sourceMappingURL=edges.min.js.map

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

import { resolveRectLike, rectToXY } from "../../utils/rect.js";
import { makeModifier } from "../base.js";
import { makeModifier } from '../base';

@@ -9,0 +9,0 @@ function start(arg) {

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

import t from"../../utils/extend.min.js";import e from"../../utils/getOriginXY.min.js";import n from"../../utils/hypot.min.js";import r from"../../utils/is.min.js";import{resolveRectLike as i,rectToXY as o}from"../../utils/rect.min.js";import{makeModifier as s}from"../base.min.js";const a={start(n){const{interaction:r,interactable:s,element:a,rect:l,state:f,startOffset:g}=n,{options:c}=f,x=c.offsetWithOrigin?function(t){const{element:n}=t.interaction;return o(i(t.state.options.origin,null,null,[n]))||e(t.interactable,n,t.interaction.prepared.name)}(n):{x:0,y:0};let m;if("startCoords"===c.offset)m={x:r.coords.start.page.x,y:r.coords.start.page.y};else{const t=i(c.offset,s,a,[r]);m=o(t)||{x:0,y:0},m.x+=x.x,m.y+=x.y}const{relativePoints:y}=c;f.offsets=l&&y&&y.length?y.map((t,e)=>({index:e,relativePoint:t,x:g.left-l.width*t.x+m.x,y:g.top-l.height*t.y+m.y})):[t({index:0,relativePoint:null},m)]},set(i){const{interaction:o,coords:s,state:a}=i,{options:l,offsets:f}=a,g=e(o.interactable,o.element,o.prepared.name),c=t({},s),x=[];l.offsetWithOrigin||(c.x-=g.x,c.y-=g.y);for(const t of f){const e=c.x-t.x,n=c.y-t.y;for(let i=0,s=l.targets.length;i<s;i++){const s=l.targets[i];let a;a=r.func(s)?s(e,n,o._proxy,t,i):s,a&&x.push({x:(r.number(a.x)?a.x:e)+t.x,y:(r.number(a.y)?a.y:n)+t.y,range:r.number(a.range)?a.range:l.range,source:s,index:i,offset:t})}}const m={target:null,inRange:!1,distance:0,range:0,delta:{x:0,y:0}};for(const t of x){const e=t.range,r=t.x-c.x,i=t.y-c.y,o=n(r,i);let s=o<=e;e===1/0&&m.inRange&&m.range!==1/0&&(s=!1),m.target&&!(s?m.inRange&&e!==1/0?o/e<m.distance/m.range:e===1/0&&m.range!==1/0||o<m.distance:!m.inRange&&o<m.distance)||(m.target=t,m.distance=o,m.range=e,m.inRange=s,m.delta.x=r,m.delta.y=i)}return m.inRange&&(s.x=m.target.x,s.y=m.target.y),a.closest=m,m},defaults:{range:1/0,targets:null,offset:null,offsetWithOrigin:!0,origin:null,relativePoints:null,endOnly:!1,enabled:!1}};export default s(a,"snap");export{a as snap};
import t from"../../utils/extend.min.js";import e from"../../utils/getOriginXY.min.js";import n from"../../utils/hypot.min.js";import r from"../../utils/is.min.js";import{resolveRectLike as i,rectToXY as o}from"../../utils/rect.min.js";import{makeModifier as s}from"../base";const a={start(n){const{interaction:r,interactable:s,element:a,rect:l,state:f,startOffset:g}=n,{options:c}=f,x=c.offsetWithOrigin?function(t){const{element:n}=t.interaction;return o(i(t.state.options.origin,null,null,[n]))||e(t.interactable,n,t.interaction.prepared.name)}(n):{x:0,y:0};let m;if("startCoords"===c.offset)m={x:r.coords.start.page.x,y:r.coords.start.page.y};else{const t=i(c.offset,s,a,[r]);m=o(t)||{x:0,y:0},m.x+=x.x,m.y+=x.y}const{relativePoints:y}=c;f.offsets=l&&y&&y.length?y.map((t,e)=>({index:e,relativePoint:t,x:g.left-l.width*t.x+m.x,y:g.top-l.height*t.y+m.y})):[t({index:0,relativePoint:null},m)]},set(i){const{interaction:o,coords:s,state:a}=i,{options:l,offsets:f}=a,g=e(o.interactable,o.element,o.prepared.name),c=t({},s),x=[];l.offsetWithOrigin||(c.x-=g.x,c.y-=g.y);for(const t of f){const e=c.x-t.x,n=c.y-t.y;for(let i=0,s=l.targets.length;i<s;i++){const s=l.targets[i];let a;a=r.func(s)?s(e,n,o._proxy,t,i):s,a&&x.push({x:(r.number(a.x)?a.x:e)+t.x,y:(r.number(a.y)?a.y:n)+t.y,range:r.number(a.range)?a.range:l.range,source:s,index:i,offset:t})}}const m={target:null,inRange:!1,distance:0,range:0,delta:{x:0,y:0}};for(const t of x){const e=t.range,r=t.x-c.x,i=t.y-c.y,o=n(r,i);let s=o<=e;e===1/0&&m.inRange&&m.range!==1/0&&(s=!1),m.target&&!(s?m.inRange&&e!==1/0?o/e<m.distance/m.range:e===1/0&&m.range!==1/0||o<m.distance:!m.inRange&&o<m.distance)||(m.target=t,m.distance=o,m.range=e,m.inRange=s,m.delta.x=r,m.delta.y=i)}return m.inRange&&(s.x=m.target.x,s.y=m.target.y),a.closest=m,m},defaults:{range:1/0,targets:null,offset:null,offsetWithOrigin:!0,origin:null,relativePoints:null,endOnly:!1,enabled:!1}};export default s(a,"snap");export{a as snap};
//# sourceMappingURL=pointer.min.js.map

@@ -5,4 +5,4 @@ // This module allows snapping of the size of targets during resize

import is from "../../utils/is.js";
import { makeModifier } from "../base.js";
import { snap } from "./pointer.js";
import { makeModifier } from '../base';
import { snap } from './pointer';

@@ -9,0 +9,0 @@ function start(arg) {

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

import t from"../../utils/extend.min.js";import s from"../../utils/is.min.js";import{makeModifier as e}from"../base.min.js";import{snap as o}from"./pointer.min.js";const n={start(t){const{state:s,edges:e}=t,{options:n}=s;if(!e)return null;t.state={options:{targets:null,relativePoints:[{x:e.left?0:1,y:e.top?0:1}],offset:n.offset||"self",origin:{x:0,y:0},range:n.range}},s.targetFields=s.targetFields||[["width","height"],["x","y"]],o.start(t),s.offsets=t.state.offsets,t.state=s},set(e){const{interaction:n,state:i,coords:r}=e,{options:f,offsets:a}=i,l={x:r.x-a[0].x,y:r.y-a[0].y};i.options=t({},f),i.options.targets=[];for(const t of f.targets||[]){let e;if(e=s.func(t)?t(l.x,l.y,n):t,e){for(const[t,s]of i.targetFields)if(t in e||s in e){e.x=e[t],e.y=e[s];break}i.options.targets.push(e)}}const p=o.set(e);return i.options=f,p},defaults:{range:1/0,targets:null,offset:null,endOnly:!1,enabled:!1}};export default e(n,"snapSize");export{n as snapSize};
import t from"../../utils/extend.min.js";import s from"../../utils/is.min.js";import{makeModifier as e}from"../base";import{snap as o}from"./pointer";const n={start(t){const{state:s,edges:e}=t,{options:n}=s;if(!e)return null;t.state={options:{targets:null,relativePoints:[{x:e.left?0:1,y:e.top?0:1}],offset:n.offset||"self",origin:{x:0,y:0},range:n.range}},s.targetFields=s.targetFields||[["width","height"],["x","y"]],o.start(t),s.offsets=t.state.offsets,t.state=s},set(e){const{interaction:n,state:r,coords:i}=e,{options:f,offsets:a}=r,l={x:i.x-a[0].x,y:i.y-a[0].y};r.options=t({},f),r.options.targets=[];for(const t of f.targets||[]){let e;if(e=s.func(t)?t(l.x,l.y,n):t,e){for(const[t,s]of r.targetFields)if(t in e||s in e){e.x=e[t],e.y=e[s];break}r.options.targets.push(e)}}const p=o.set(e);return r.options=f,p},defaults:{range:1/0,targets:null,offset:null,endOnly:!1,enabled:!1}};export default e(n,"snapSize");export{n as snapSize};
//# sourceMappingURL=size.min.js.map

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

export { default } from "./noop.js";
export { default } from './noop';
//# sourceMappingURL=spring.js.map

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

export{default}from"./noop.min.js";
export{default}from"./noop";
//# sourceMappingURL=spring.min.js.map

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

export { default } from "./noop.js";
export { default } from './noop';
//# sourceMappingURL=transform.js.map

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

export{default}from"./noop.min.js";
export{default}from"./noop";
//# sourceMappingURL=transform.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

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