Socket
Socket
Sign inDemoInstall

@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.2 to 1.9.3

2

base.min.js

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

import t from"./Modification.min.js";export function makeModifier(t,i){const{defaults:o}=t,n={start:t.start,set:t.set,beforeEnd:t.beforeEnd,stop:t.stop},e=t=>{const e=t||{};e.enabled=!1!==e.enabled;for(const t in o)t in e||(e[t]=o[t]);return{options:e,methods:n,name:i}};return i&&"string"==typeof i&&(e._defaults=o,e._methods=n),e}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=>t.interaction.modification.setAndApply(t),"interactions:before-action-end":t=>t.interaction.modification.beforeEnd(t),"interactions:action-start":addEventModifiers,"interactions:action-move":addEventModifiers,"interactions:action-end":addEventModifiers,"interactions:after-action-start":t=>t.interaction.modification.restoreInteractionCoords(t),"interactions:after-action-move":t=>t.interaction.modification.restoreInteractionCoords(t),"interactions:stop":t=>t.interaction.modification.stop(t)},before:["actions","action/drag","actions/resize","actions/gesture"]};export default i;
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;
//# sourceMappingURL=base.min.js.map

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

import t from"../utils/clone.min.js";import e from"../utils/extend.min.js";import*as s from"../utils/rect.min.js";export default class Modification{constructor(t){this.interaction=t,this.states=[],this.startOffset={left:0,right:0,top:0,bottom:0},this.startDelta=null,this.result=null,this.endResult=null,this.edges=void 0,this.result=o()}start({phase:t},s){const{interaction:r}=this,i=function(t){const e=t.interactable.options[t.prepared.name],s=e.modifiers;if(s&&s.length)return s.filter(t=>!t.options||!1!==t.options.enabled);return["snap","snapSize","snapEdges","restrict","restrictEdges","restrictSize"].map(t=>{const s=e[t];return s&&s.enabled&&{options:s,methods:s._methods}}).filter(t=>!!t)}(r);this.prepareStates(i),this.edges=e({},r.edges),this.startOffset=getRectOffset(r.rect,s),this.startDelta={x:0,y:0};const n={phase:t,pageCoords:s,preEnd:!1};return this.result=o(),this.startAll(n),this.result=this.setAll(n)}fillArg(t){const{interaction:e}=this;t.interaction=e,t.interactable=e.interactable,t.element=e.element,t.rect=t.rect||e.rect,t.edges=this.edges,t.startOffset=this.startOffset}startAll(t){this.fillArg(t);for(const e of this.states)e.methods.start&&(t.state=e,e.methods.start(t))}setAll(t){this.fillArg(t);const{phase:r,preEnd:i,skipModifiers:n,rect:a}=t;t.coords=e({},t.pageCoords),t.rect=e({},a);const l=n?this.states.slice(n):this.states,c=o(t.coords,t.rect);for(const o of l){const{options:n}=o,a=e({},t.coords);let l=null;o.methods.set&&this.shouldDo(n,i,r)&&(t.state=o,l=o.methods.set(t),s.addEdges(this.interaction.edges,t.rect,{x:t.coords.x-a.x,y:t.coords.y-a.y})),c.eventProps.push(l)}c.delta.x=t.coords.x-t.pageCoords.x,c.delta.y=t.coords.y-t.pageCoords.y,c.rectDelta.left=t.rect.left-a.left,c.rectDelta.right=t.rect.right-a.right,c.rectDelta.top=t.rect.top-a.top,c.rectDelta.bottom=t.rect.bottom-a.bottom;const h=this.result.coords,d=this.result.rect;if(h&&d){const t=c.rect.left!==d.left||c.rect.right!==d.right||c.rect.top!==d.top||c.rect.bottom!==d.bottom;c.changed=t||h.x!==c.coords.x||h.y!==c.coords.y}return c}applyToInteraction(t){const{interaction:s}=this,{phase:o}=t,r=s.coords.cur,i=s.coords.start,{result:n,startDelta:a}=this,l=n.delta;"start"===o&&e(this.startDelta,n.delta);for(const[t,e]of[[i,a],[r,l]])t.page.x+=e.x,t.page.y+=e.y,t.client.x+=e.x,t.client.y+=e.y;const{rectDelta:c}=this.result,h=t.rect||s.rect;h.left+=c.left,h.right+=c.right,h.top+=c.top,h.bottom+=c.bottom,h.width=h.right-h.left,h.height=h.bottom-h.top}setAndApply(t){const{interaction:e}=this,{phase:s,preEnd:o,skipModifiers:r}=t,i=this.setAll({preEnd:o,phase:s,pageCoords:t.modifiedCoords||e.coords.cur.page});if(this.result=i,!i.changed&&(!r||r<this.states.length)&&e.interacting())return!1;if(t.modifiedCoords){const{page:s}=e.coords.cur,o={x:t.modifiedCoords.x-s.x,y:t.modifiedCoords.y-s.y};i.coords.x+=o.x,i.coords.y+=o.y,i.delta.x+=o.x,i.delta.y+=o.y}this.applyToInteraction(t)}beforeEnd(t){const{interaction:e,event:s}=t,o=this.states;if(!o||!o.length)return;let r=!1;for(const e of o){t.state=e;const{options:s,methods:o}=e,i=o.beforeEnd&&o.beforeEnd(t);if(i)return this.endResult=i,!1;r=r||!r&&this.shouldDo(s,!0,t.phase,!0)}r&&e.move({event:s,preEnd:!0})}stop(t){const{interaction:s}=t;if(!this.states||!this.states.length)return;const o=e({states:this.states,interactable:s.interactable,element:s.element,rect:null},t);this.fillArg(o);for(const t of this.states)o.state=t,t.methods.stop&&t.methods.stop(o);this.states=null,this.endResult=null}prepareStates(t){this.states=[];for(let e=0;e<t.length;e++){const{options:s,methods:o,name:r}=t[e];s&&!1===s.enabled||this.states.push({options:s,methods:o,index:e,name:r})}return this.states}restoreInteractionCoords({interaction:{coords:t,rect:e,modification:s}}){if(!s.result)return;const{startDelta:o}=s,{delta:r,rectDelta:i}=s.result,n=[[t.start,o],[t.cur,r]];for(const[t,e]of n)t.page.x-=e.x,t.page.y-=e.y,t.client.x-=e.x,t.client.y-=e.y;e.left-=i.left,e.right-=i.right,e.top-=i.top,e.bottom-=i.bottom}shouldDo(t,e,s,o){return!(!t||!1===t.enabled||o&&!t.endOnly||t.endOnly&&!e||"start"===s&&!t.setStart)}copyFrom(s){this.startOffset=s.startOffset,this.startDelta=s.startDelta,this.edges=s.edges,this.states=s.states.map(e=>t(e)),this.result=o(e({},s.result.coords),e({},s.result.rect))}destroy(){for(const t in this)this[t]=null}}function o(t,e){return{rect:e,coords:t,delta:{x:0,y:0},rectDelta:{left:0,right:0,top:0,bottom:0},eventProps:[],changed:!0}}export function getRectOffset(t,e){return t?{left:e.x-t.left,top:e.y-t.top,right:t.right-e.x,bottom:t.bottom-e.y}:{left:0,top:0,right:0,bottom:0}}
import t from"../utils/clone.min.js";import e from"../utils/extend.min.js";import*as s from"../utils/rect.min.js";export default class o{constructor(t){this.interaction=t,this.states=[],this.startOffset={left:0,right:0,top:0,bottom:0},this.startDelta=null,this.result=null,this.endResult=null,this.edges=void 0,this.result=r()}start({phase:t},s){const{interaction:o}=this,i=function(t){const e=t.interactable.options[t.prepared.name],s=e.modifiers;if(s&&s.length)return s.filter(t=>!t.options||!1!==t.options.enabled);return["snap","snapSize","snapEdges","restrict","restrictEdges","restrictSize"].map(t=>{const s=e[t];return s&&s.enabled&&{options:s,methods:s._methods}}).filter(t=>!!t)}(o);this.prepareStates(i),this.edges=e({},o.edges),this.startOffset=getRectOffset(o.rect,s),this.startDelta={x:0,y:0};const n={phase:t,pageCoords:s,preEnd:!1};return this.result=r(),this.startAll(n),this.result=this.setAll(n)}fillArg(t){const{interaction:e}=this;t.interaction=e,t.interactable=e.interactable,t.element=e.element,t.rect=t.rect||e.rect,t.edges=this.edges,t.startOffset=this.startOffset}startAll(t){this.fillArg(t);for(const e of this.states)e.methods.start&&(t.state=e,e.methods.start(t))}setAll(t){this.fillArg(t);const{phase:o,preEnd:i,skipModifiers:n,rect:a}=t;t.coords=e({},t.pageCoords),t.rect=e({},a);const l=n?this.states.slice(n):this.states,c=r(t.coords,t.rect);for(const r of l){const{options:n}=r,a=e({},t.coords);let l=null;r.methods.set&&this.shouldDo(n,i,o)&&(t.state=r,l=r.methods.set(t),s.addEdges(this.interaction.edges,t.rect,{x:t.coords.x-a.x,y:t.coords.y-a.y})),c.eventProps.push(l)}c.delta.x=t.coords.x-t.pageCoords.x,c.delta.y=t.coords.y-t.pageCoords.y,c.rectDelta.left=t.rect.left-a.left,c.rectDelta.right=t.rect.right-a.right,c.rectDelta.top=t.rect.top-a.top,c.rectDelta.bottom=t.rect.bottom-a.bottom;const h=this.result.coords,d=this.result.rect;if(h&&d){const t=c.rect.left!==d.left||c.rect.right!==d.right||c.rect.top!==d.top||c.rect.bottom!==d.bottom;c.changed=t||h.x!==c.coords.x||h.y!==c.coords.y}return c}applyToInteraction(t){const{interaction:s}=this,{phase:o}=t,r=s.coords.cur,i=s.coords.start,{result:n,startDelta:a}=this,l=n.delta;"start"===o&&e(this.startDelta,n.delta);for(const[t,e]of[[i,a],[r,l]])t.page.x+=e.x,t.page.y+=e.y,t.client.x+=e.x,t.client.y+=e.y;const{rectDelta:c}=this.result,h=t.rect||s.rect;h.left+=c.left,h.right+=c.right,h.top+=c.top,h.bottom+=c.bottom,h.width=h.right-h.left,h.height=h.bottom-h.top}setAndApply(t){const{interaction:e}=this,{phase:s,preEnd:o,skipModifiers:r}=t,i=this.setAll({preEnd:o,phase:s,pageCoords:t.modifiedCoords||e.coords.cur.page});if(this.result=i,!i.changed&&(!r||r<this.states.length)&&e.interacting())return!1;if(t.modifiedCoords){const{page:s}=e.coords.cur,o={x:t.modifiedCoords.x-s.x,y:t.modifiedCoords.y-s.y};i.coords.x+=o.x,i.coords.y+=o.y,i.delta.x+=o.x,i.delta.y+=o.y}this.applyToInteraction(t)}beforeEnd(t){const{interaction:e,event:s}=t,o=this.states;if(!o||!o.length)return;let r=!1;for(const e of o){t.state=e;const{options:s,methods:o}=e,i=o.beforeEnd&&o.beforeEnd(t);if(i)return this.endResult=i,!1;r=r||!r&&this.shouldDo(s,!0,t.phase,!0)}r&&e.move({event:s,preEnd:!0})}stop(t){const{interaction:s}=t;if(!this.states||!this.states.length)return;const o=e({states:this.states,interactable:s.interactable,element:s.element,rect:null},t);this.fillArg(o);for(const t of this.states)o.state=t,t.methods.stop&&t.methods.stop(o);this.states=null,this.endResult=null}prepareStates(t){this.states=[];for(let e=0;e<t.length;e++){const{options:s,methods:o,name:r}=t[e];s&&!1===s.enabled||this.states.push({options:s,methods:o,index:e,name:r})}return this.states}restoreInteractionCoords({interaction:{coords:t,rect:e,modification:s}}){if(!s.result)return;const{startDelta:o}=s,{delta:r,rectDelta:i}=s.result,n=[[t.start,o],[t.cur,r]];for(const[t,e]of n)t.page.x-=e.x,t.page.y-=e.y,t.client.x-=e.x,t.client.y-=e.y;e.left-=i.left,e.right-=i.right,e.top-=i.top,e.bottom-=i.bottom}shouldDo(t,e,s,o){return!(!t||!1===t.enabled||o&&!t.endOnly||t.endOnly&&!e||"start"===s&&!t.setStart)}copyFrom(s){this.startOffset=s.startOffset,this.startDelta=s.startDelta,this.edges=s.edges,this.states=s.states.map(e=>t(e)),this.result=r(e({},s.result.coords),e({},s.result.rect))}destroy(){for(const t in this)this[t]=null}}function r(t,e){return{rect:e,coords:t,delta:{x:0,y:0},rectDelta:{left:0,right:0,top:0,bottom:0},eventProps:[],changed:!0}}export function getRectOffset(t,e){return t?{left:e.x-t.left,top:e.y-t.top,right:t.right-e.x,bottom:t.bottom-e.y}:{left:0,top:0,right:0,bottom:0}}
//# sourceMappingURL=Modification.min.js.map
{
"name": "@interactjs/modifiers",
"version": "1.9.2",
"version": "1.9.3",
"license": "MIT",
"peerDependencies": {
"@interactjs/core": "1.9.2",
"@interactjs/utils": "1.9.2"
"@interactjs/core": "1.9.3",
"@interactjs/utils": "1.9.3"
},
"devDependencies": {
"@interactjs/_dev": "1.9.2",
"@interactjs/actions": "1.9.2"
"@interactjs/_dev": "1.9.3",
"@interactjs/actions": "1.9.3"
},
"optionalDependencies": {
"@interactjs/interact": "1.9.2"
"@interactjs/interact": "1.9.3"
},

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

},
"gitHead": "77b581be"
"gitHead": "2032dde4"
}

@@ -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 n}from"./pointer.min.js";const r={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:r,noOuter:i,start:function({interaction:t,startOffset:e,state:r}){const{options:i}=r;let s;if(i){const e=n(i.offset,t,t.coords.start.page);s=o.rectToXY(e)}s=s||{x:0,y:0},r.offset={top:s.y+e.top,left:s.x+e.left,bottom:s.y-e.bottom,right:s.x-e.right}},set:function({coords:o,edges:e,interaction:f,state:m}){const{offset:a,options:l}=m;if(!e)return;const p=t({},o),h=n(l.inner,f,p)||{},c=n(l.outer,f,p)||{};s(h,r),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.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};
//# sourceMappingURL=edges.min.js.map

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

import t from"../../utils/extend.min.js";import*as 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:function({rect:e,startOffset:o,state:i,interaction:r,pageCoords:n}){const{options:s}=i,{elementRect:c}=s,f=t({left:0,top:0,right:0,bottom:0},s.offset||{});if(e&&c){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&&(f.left+=o,f.right+=o),i<0&&(f.top+=i,f.bottom+=i)}f.left+=o.left-e.width*c.left,f.top+=o.top-e.height*c.top,f.right+=o.right-e.width*(1-c.right),f.bottom+=o.bottom-e.height*(1-c.bottom)}i.offset=f},set:function({coords:t,interaction:e,state:i}){const{options:r,offset:n}=i,s=getRestrictionRect(r.restriction,e,t);if(!s)return;const c=o.xywhToTlbr(s);t.x=Math.max(Math.min(c.right-n.right,t.x),c.left+n.left),t.y=Math.max(Math.min(c.bottom-n.bottom,t.y),c.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*as 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};
//# sourceMappingURL=pointer.min.js.map

@@ -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:function(t){return n.start(t)},set:function(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 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};
//# sourceMappingURL=size.min.js.map

@@ -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 o}from"./size.min.js";const r={start:function(t){const{edges:e}=t;return e?(t.state.targetFields=t.state.targetFields||[[e.left?"left":"right",e.top?"top":"bottom"]],o.start(t)):null},set:o.set,defaults:e(t(o.defaults),{targets:null,range:null,offset:{x:0,y:0}})};export default s(r,"snapEdges");export{r as snapEdges};
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};
//# sourceMappingURL=edges.min.js.map

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

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

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

import t from"../../utils/extend.min.js";import*as 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:function(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:function(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*as 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};
//# sourceMappingURL=size.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

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