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

@dflex/core-instance

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dflex/core-instance - npm Package Compare versions

Comparing version 3.4.1 to 3.5.0

8

dist/Container/Container.d.ts

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

import type { IScroll, IPointNum, RectBoundaries, RectDimensions } from "@dflex/utils";
import type { Dimensions, IScroll, IPointNum, IPointAxes, RectBoundaries, RectDimensions } from "@dflex/utils";
import type { IContainer } from "./types";

@@ -8,6 +8,8 @@ declare class Container implements IContainer {

scroll: IScroll;
lastElmPosition: IPointNum;
constructor();
setGrid(grid: IPointNum, rect: RectDimensions): void;
setBoundaries(rect: RectDimensions): void;
registerNewElm(offset: RectDimensions, unifiedContainerDimensions?: Dimensions): void;
resetIndicators(): void;
preservePosition(position: IPointAxes): void;
}
export default Container;

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

import type { RectBoundaries, RectDimensions, IPointNum, IScroll } from "@dflex/utils";
import type { Dimensions, RectBoundaries, RectDimensions, IPointNum, IPointAxes, IScroll } from "@dflex/utils";
export interface IContainer {
/**
* Preserve the last element position in the list .
* Usage: Getting this position when the dragged is going back from the tail.
*/
readonly lastElmPosition: IPointNum;
/** Strict Rect for siblings containers. */

@@ -9,4 +14,5 @@ readonly boundaries: RectBoundaries;

scroll: IScroll;
setGrid(grid: IPointNum, rect: RectDimensions): void;
setBoundaries(rect: RectDimensions): void;
registerNewElm(offset: RectDimensions, unifiedContainerDimensions?: Dimensions): void;
resetIndicators(): void;
preservePosition(position: IPointAxes | null): void;
}

@@ -67,2 +67,20 @@ var __defProp = Object.defineProperty;

// ../utils/src/collections/assignBiggestRect.ts
function dirtyAssignBiggestRect($, elm) {
const { top, left, right, bottom } = elm;
if (left < $.left) {
$.left = left;
}
if (top < $.top) {
$.top = top;
}
if (right > $.right) {
$.right = right;
}
if (bottom > $.bottom) {
$.bottom = bottom;
}
}
var assignBiggestRect_default = dirtyAssignBiggestRect;
// src/Node/Abstract.ts

@@ -245,2 +263,3 @@ var Abstract = class {

console.error("Illegal Attempt: Colliding in positions.\n", `Element id: ${this.id}
`, `Collided at index: ${newIndex}
`, `Siblings list: ${branchIDsOrder}

@@ -253,15 +272,5 @@ `);

}
#leaveToNewPosition(branchIDsOrder, newIndex, oldIndex, siblingsEmptyElmIndex) {
if (siblingsEmptyElmIndex >= 0 && siblingsEmptyElmIndex !== newIndex) {
if (true) {
console.error(`Illegal Attempt: More than one element have left the siblings list.
`, `Element id: ${this.id} - index: ${oldIndex}
`, `Siblings list: ${branchIDsOrder}
`);
}
return siblingsEmptyElmIndex;
}
#leaveToNewPosition(branchIDsOrder, newIndex, oldIndex) {
branchIDsOrder[oldIndex] = "";
branchIDsOrder[newIndex] = this.id;
return siblingsEmptyElmIndex;
}

@@ -289,3 +298,3 @@ #seTranslate(elmSpace, axis, operationID, isForceTransform = false) {

}
setPosition(iDsInOrder, direction, elmSpace, operationID, siblingsEmptyElmIndex, axis) {
setPosition(iDsInOrder, direction, elmSpace, operationID, axis) {
const numberOfPassedElm = 1;

@@ -308,4 +317,3 @@ if (axis === "z") {

}
const newStatusSiblingsHasEmptyElm = this.#leaveToNewPosition(iDsInOrder, newIndex, oldIndex, siblingsEmptyElmIndex);
return newStatusSiblingsHasEmptyElm;
this.#leaveToNewPosition(iDsInOrder, newIndex, oldIndex);
}

@@ -342,2 +350,14 @@ rollBack(operationID, isForceTransform) {

var CoreUtils = class extends Core_default {
static getRectByAxis(axis) {
return axis === "x" ? "width" : "height";
}
static getDistance(currentPosition, elm, axis) {
let diff = currentPosition[axis] - elm.currentPosition[axis];
diff += elm.translate[axis];
return diff;
}
static getDisplacement(currentPosition, elm, axis) {
const diff = axis === "x" ? elm.getRectRight() : elm.getRectBottom();
return currentPosition[axis] - diff;
}
isConnected() {

@@ -347,6 +367,6 @@ return this.ref.isConnected;

isPositionedUnder(elmY) {
return elmY < this.currentPosition.y;
return elmY <= this.currentPosition.y;
}
isPositionedLeft(elmX) {
return elmX < this.currentPosition.x;
return elmX <= this.currentPosition.x;
}

@@ -362,2 +382,12 @@ hasSamePosition(elm, axis) {

}
getRectDiff(elm, axis) {
const rectType = CoreUtils.getRectByAxis(axis);
return this.offset[rectType] - elm.offset[rectType];
}
getDisplacement(elm, axis) {
return CoreUtils.getDisplacement(this.currentPosition, elm, axis);
}
getDistance(elm, axis) {
return CoreUtils.getDistance(this.currentPosition, elm, axis);
}
getOffset() {

@@ -376,41 +406,28 @@ return {

var Container = class {
#boundariesStorageForGrid;
#boundariesByRow;
boundaries;
grid;
scroll;
#gridContainer;
#gridSiblingsHasNewRow;
lastElmPosition;
constructor() {
this.#boundariesStorageForGrid = {};
this.grid = new PointNum_default(1, 1);
this.#gridContainer = new PointNum_default(1, 0);
this.#boundariesByRow = {};
this.#gridSiblingsHasNewRow = false;
}
setGrid(grid, rect) {
const { height, left, top, width } = rect;
const right = left + width;
const bottom = top + height;
const $ = this.#boundariesStorageForGrid;
const row = grid.x || 1;
const rowRect = $[row];
if (!rowRect) {
this.grid = new PointNum_default(1, 1);
grid.clone(this.grid);
this.#boundariesStorageForGrid = {
[row]: {
top,
left,
right,
bottom
}
#addNewElmToGridIndicator(rect) {
if (!this.#boundariesByRow[this.grid.x]) {
this.#boundariesByRow[this.grid.x] = {
...rect
};
return;
}
if (bottom > rowRect.bottom || top < rowRect.top) {
const $ = this.#boundariesByRow[this.grid.x];
if (rect.bottom > $.bottom || rect.top < $.top) {
this.grid.y += 1;
this.#gridSiblingsHasNewRow = true;
rowRect.left = 0;
rowRect.right = 0;
$.left = 0;
$.right = 0;
}
if (left > rowRect.right || right < rowRect.left) {
if (rect.left > $.right || rect.right < $.left) {
if (this.#gridSiblingsHasNewRow) {

@@ -423,50 +440,43 @@ this.grid.x = 1;

}
grid.clone(this.grid);
if (left < rowRect.left) {
rowRect.left = left;
}
if (top < rowRect.top) {
rowRect.top = top;
}
if (right > rowRect.right) {
rowRect.right = right;
}
if (bottom > rowRect.bottom) {
rowRect.bottom = bottom;
}
assignBiggestRect_default($, rect);
}
setBoundaries(rect) {
const { height, left, top, width } = rect;
registerNewElm(offset, unifiedContainerDimensions) {
const { height, left, top, width } = offset;
const right = left + width;
const bottom = top + height;
const elmRectBoundaries = {
top,
left,
right,
bottom
};
if (!this.boundaries) {
this.boundaries = {
top,
left,
right,
bottom
};
return;
this.boundaries = elmRectBoundaries;
} else {
assignBiggestRect_default(this.boundaries, elmRectBoundaries);
}
this.#addNewElmToGridIndicator(elmRectBoundaries);
const $ = this.boundaries;
if (bottom > $.bottom || top < $.top) {
this.#gridContainer.y += 1;
const uni = unifiedContainerDimensions;
if (!uni)
return;
const $height = $.bottom - $.top;
const $width = $.right - $.left;
if (uni.height < $height) {
uni.height = $height;
}
if (left > $.right || right < $.left) {
this.#gridContainer.x += 1;
if (uni.width < $width) {
uni.width = $height;
}
if (left < $.left) {
$.left = left;
}
if (top < $.top) {
$.top = top;
}
if (right > $.right) {
$.right = right;
}
if (bottom > $.bottom) {
$.bottom = bottom;
}
}
resetIndicators() {
this.boundaries = null;
this.grid.setAxes(1, 1);
this.#boundariesByRow = {};
this.#gridSiblingsHasNewRow = false;
}
preservePosition(position) {
this.lastElmPosition = new PointNum_default(position.x, position.y);
}
};
var Container_default = Container;

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

var f=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var S=(a,t)=>{for(var e in t)f(a,e,{get:t[e],enumerable:!0})},R=(a,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of O(t))!D.call(a,i)&&i!==e&&f(a,i,{get:()=>t[i],enumerable:!(s=N(t,i))||s.enumerable});return a};var C=a=>R(f({},"__esModule",{value:!0}),a);var V={};S(V,{Container:()=>T,Node:()=>I});module.exports=C(V);var p=class{x;y;constructor(t,e){this.setAxes(t,e)}setAxes(t,e){this.x=t,this.y=e}clone(t){this.setAxes(t.x,t.y)}isEqual(t){return this.x===t.x&&this.y===t.y}},u=p;var b=class extends u{increase(t){this.x+=t.x,this.y+=t.y}decrease(t){this.x-=t.x,this.y-=t.y}multiplyAll(t){this.x*=t,this.y*=t}getMultiplied(t){return{x:this.x*t,y:this.y*t}}},c=b;var g=class{ref;id;translate;isInitialized;isPaused;hasAttribute;constructor({ref:t,id:e},s){if(this.id=e,s.isInitialized){this.attach(t||null),this.isPaused=s.isPaused,this.isPaused||this.initTranslate();return}this.isInitialized=!1,this.ref=null,this.isPaused=!0}attach(t){if(this.ref=null,t){if(t.nodeType!==Node.ELEMENT_NODE)throw new Error(`DFlex: Invalid HTMLElement: ${t} is passed to registry.`)}else if(!document.getElementById(this.id))throw new Error(`DFlex: Element with ID: ${this.id} is not found.`);this.ref=t,this.isInitialized=!0}detach(){this.isInitialized=!1,this.ref=null}transform(t,e){this.ref.style.transform=`translate3d(${t}px,${e}px, 0)`}initTranslate(){this.translate||(this.translate=new c(0,0),this.hasAttribute={}),this.isPaused=!1}setDataset(t,e){if(t==="index"||t==="gridX"||t==="gridY"){this.ref.dataset[t]=`${e}`;return}this.hasAttribute[t]||(this.ref.dataset[t]=`${e}`,this.hasAttribute[t]=!0)}rmDateset(t){delete this.ref.dataset[t],this.hasAttribute[t]&&(this.hasAttribute[t]=!1)}setAttribute(t,e){this.hasAttribute[t]||(this.ref.setAttribute(t,e),this.hasAttribute[t]=!0)}removeAttribute(t){!this.hasAttribute[t]||(this.ref.removeAttribute(t),this.hasAttribute[t]=!1)}clearAttributes(){Object.keys(this.hasAttribute).forEach(t=>{t==="dragged"?this.removeAttribute(t):this.rmDateset(t)}),this.hasAttribute={}}},A=g;var x=class extends A{offset;currentPosition;grid;order;keys;depth;isVisible;hasToTransform;animatedFrame;#t;constructor(t,e){let{order:s,keys:i,depth:r,scrollX:o,scrollY:l,...n}=t;super(n,e),this.order=s,this.keys=i,this.depth=r,this.isVisible=this.isInitialized&&!this.isPaused,this.isInitialized&&this.setDataset("index",this.order.self),this.isPaused||this.#e(o,l),this.animatedFrame=null}#e(t,e){let{height:s,width:i,left:r,top:o}=this.ref.getBoundingClientRect();this.offset={height:s,width:i,left:r+t,top:o+e},this.currentPosition=new c(this.offset.left,this.offset.top),this.grid=new c(0,0),this.hasToTransform=!1}#s(t){this.translate.increase(t);let{left:e,top:s}=this.offset;this.currentPosition.setAxes(e+this.translate.x,s+this.translate.y),this.isVisible||(this.hasToTransform=!0)}resume(t,e){this.isInitialized||this.attach(null),this.initTranslate(),this.#e(t,e)}changeVisibility(t){t!==this.isVisible&&(this.isVisible=t,this.hasToTransform&&this.isVisible&&(this.transformElm(),this.hasToTransform=!1))}transformElm(){this.animatedFrame!==null&&window.cancelAnimationFrame(this.animatedFrame),this.animatedFrame=window.requestAnimationFrame(()=>{this.transform(this.translate.x,this.translate.y),this.animatedFrame=null})}#i(t){let{self:e}=this.order,s=e+t;return this.order.self=s,this.setDataset("index",s),{oldIndex:e,newIndex:s}}assignNewPosition(t,e){e<0||e>t.length-1||t[e].length>0||(t[e]=this.id)}#o(t,e,s,i){return i>=0&&i!==e||(t[s]="",t[e]=this.id),i}#r(t,e,s,i=!1){if(s){let r={ID:s,axis:e,translate:{x:this.translate.x,y:this.translate.y}};Array.isArray(this.#t)?this.#t.push(r):this.#t=[r]}if(this.#s(t),!i&&!this.isVisible){this.hasToTransform=!0;return}this.transformElm(),this.hasToTransform=!1}setPosition(t,e,s,i,r,o){o==="z"?s.multiplyAll(e):s[o]*=e,this.#r(s,o,i);let{oldIndex:n,newIndex:m}=this.#i(e*1);if(o==="z"){let h=e*1;this.grid.increase({x:h,y:h})}else this.grid[o]+=e*1;return this.#o(t,m,n,r)}rollBack(t,e){if(!Array.isArray(this.#t)||this.#t.length===0||this.#t[this.#t.length-1].ID!==t)return;let s=this.#t.pop(),{translate:i,axis:r}=s,o={x:i.x-this.translate.x,y:i.y-this.translate.y},l=0;r==="z"?(l=o.x>0||o.y>0?1:-1,this.grid.increase({x:l,y:l})):(l=o[r]>0?1:-1,this.grid[r]+=l),this.#r(o,r,void 0,e),this.#i(l),this.rollBack(t,e)}},E=x;var y=class extends E{isConnected(){return this.ref.isConnected}isPositionedUnder(t){return t<this.currentPosition.y}isPositionedLeft(t){return t<this.currentPosition.x}hasSamePosition(t,e){return this.currentPosition[e]===t.currentPosition[e]}getRectBottom(){return this.currentPosition.y+this.offset.height}getRectRight(){return this.currentPosition.x+this.offset.width}getOffset(){return{width:this.offset.width,height:this.offset.height,top:this.currentPosition.y,left:this.currentPosition.x}}},I=y;var P=class{#t;boundaries;grid;scroll;#e;#s;constructor(){this.#t={},this.grid=new c(1,1),this.#e=new c(1,0),this.#s=!1}setGrid(t,e){let{height:s,left:i,top:r,width:o}=e,l=i+o,n=r+s,m=this.#t,d=t.x||1,h=m[d];if(!h){this.grid=new c(1,1),t.clone(this.grid),this.#t={[d]:{top:r,left:i,right:l,bottom:n}};return}(n>h.bottom||r<h.top)&&(this.grid.y+=1,this.#s=!0,h.left=0,h.right=0),(i>h.right||l<h.left)&&(this.#s?(this.grid.x=1,this.#s=!1):this.grid.x+=1),t.clone(this.grid),i<h.left&&(h.left=i),r<h.top&&(h.top=r),l>h.right&&(h.right=l),n>h.bottom&&(h.bottom=n)}setBoundaries(t){let{height:e,left:s,top:i,width:r}=t,o=s+r,l=i+e;if(!this.boundaries){this.boundaries={top:i,left:s,right:o,bottom:l};return}let n=this.boundaries;(l>n.bottom||i<n.top)&&(this.#e.y+=1),(s>n.right||o<n.left)&&(this.#e.x+=1),s<n.left&&(n.left=s),i<n.top&&(n.top=i),o>n.right&&(n.right=o),l>n.bottom&&(n.bottom=l)}},T=P;
var b=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var v=(o,t)=>{for(var e in t)b(o,e,{get:t[e],enumerable:!0})},M=(o,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of S(t))!C.call(o,i)&&i!==e&&b(o,i,{get:()=>t[i],enumerable:!(s=L(t,i))||s.enumerable});return o};var B=o=>M(b({},"__esModule",{value:!0}),o);var K={};v(K,{Container:()=>w,Node:()=>T});module.exports=B(K);var x=class{x;y;constructor(t,e){this.setAxes(t,e)}setAxes(t,e){this.x=t,this.y=e}clone(t){this.setAxes(t.x,t.y)}isEqual(t){return this.x===t.x&&this.y===t.y}},f=x;var y=class extends f{increase(t){this.x+=t.x,this.y+=t.y}decrease(t){this.x-=t.x,this.y-=t.y}multiplyAll(t){this.x*=t,this.y*=t}getMultiplied(t){return{x:this.x*t,y:this.y*t}}},h=y;function V(o,t){let{top:e,left:s,right:i,bottom:r}=t;s<o.left&&(o.left=s),e<o.top&&(o.top=e),i>o.right&&(o.right=i),r>o.bottom&&(o.bottom=r)}var u=V;var I=class{ref;id;translate;isInitialized;isPaused;hasAttribute;constructor({ref:t,id:e},s){if(this.id=e,s.isInitialized){this.attach(t||null),this.isPaused=s.isPaused,this.isPaused||this.initTranslate();return}this.isInitialized=!1,this.ref=null,this.isPaused=!0}attach(t){if(this.ref=null,t){if(t.nodeType!==Node.ELEMENT_NODE)throw new Error(`DFlex: Invalid HTMLElement: ${t} is passed to registry.`)}else if(!document.getElementById(this.id))throw new Error(`DFlex: Element with ID: ${this.id} is not found.`);this.ref=t,this.isInitialized=!0}detach(){this.isInitialized=!1,this.ref=null}transform(t,e){this.ref.style.transform=`translate3d(${t}px,${e}px, 0)`}initTranslate(){this.translate||(this.translate=new h(0,0),this.hasAttribute={}),this.isPaused=!1}setDataset(t,e){if(t==="index"||t==="gridX"||t==="gridY"){this.ref.dataset[t]=`${e}`;return}this.hasAttribute[t]||(this.ref.dataset[t]=`${e}`,this.hasAttribute[t]=!0)}rmDateset(t){delete this.ref.dataset[t],this.hasAttribute[t]&&(this.hasAttribute[t]=!1)}setAttribute(t,e){this.hasAttribute[t]||(this.ref.setAttribute(t,e),this.hasAttribute[t]=!0)}removeAttribute(t){!this.hasAttribute[t]||(this.ref.removeAttribute(t),this.hasAttribute[t]=!1)}clearAttributes(){Object.keys(this.hasAttribute).forEach(t=>{t==="dragged"?this.removeAttribute(t):this.rmDateset(t)}),this.hasAttribute={}}},E=I;var A=class extends E{offset;currentPosition;grid;order;keys;depth;isVisible;hasToTransform;animatedFrame;#t;constructor(t,e){let{order:s,keys:i,depth:r,scrollX:l,scrollY:n,...d}=t;super(d,e),this.order=s,this.keys=i,this.depth=r,this.isVisible=this.isInitialized&&!this.isPaused,this.isInitialized&&this.setDataset("index",this.order.self),this.isPaused||this.#e(l,n),this.animatedFrame=null}#e(t,e){let{height:s,width:i,left:r,top:l}=this.ref.getBoundingClientRect();this.offset={height:s,width:i,left:r+t,top:l+e},this.currentPosition=new h(this.offset.left,this.offset.top),this.grid=new h(0,0),this.hasToTransform=!1}#s(t){this.translate.increase(t);let{left:e,top:s}=this.offset;this.currentPosition.setAxes(e+this.translate.x,s+this.translate.y),this.isVisible||(this.hasToTransform=!0)}resume(t,e){this.isInitialized||this.attach(null),this.initTranslate(),this.#e(t,e)}changeVisibility(t){t!==this.isVisible&&(this.isVisible=t,this.hasToTransform&&this.isVisible&&(this.transformElm(),this.hasToTransform=!1))}transformElm(){this.animatedFrame!==null&&window.cancelAnimationFrame(this.animatedFrame),this.animatedFrame=window.requestAnimationFrame(()=>{this.transform(this.translate.x,this.translate.y),this.animatedFrame=null})}#i(t){let{self:e}=this.order,s=e+t;return this.order.self=s,this.setDataset("index",s),{oldIndex:e,newIndex:s}}assignNewPosition(t,e){e<0||e>t.length-1||t[e].length>0||(t[e]=this.id)}#o(t,e,s){t[s]="",t[e]=this.id}#r(t,e,s,i=!1){if(s){let r={ID:s,axis:e,translate:{x:this.translate.x,y:this.translate.y}};Array.isArray(this.#t)?this.#t.push(r):this.#t=[r]}if(this.#s(t),!i&&!this.isVisible){this.hasToTransform=!0;return}this.transformElm(),this.hasToTransform=!1}setPosition(t,e,s,i,r){r==="z"?s.multiplyAll(e):s[r]*=e,this.#r(s,r,i);let{oldIndex:n,newIndex:d}=this.#i(e*1);if(r==="z"){let c=e*1;this.grid.increase({x:c,y:c})}else this.grid[r]+=e*1;this.#o(t,d,n)}rollBack(t,e){if(!Array.isArray(this.#t)||this.#t.length===0||this.#t[this.#t.length-1].ID!==t)return;let s=this.#t.pop(),{translate:i,axis:r}=s,l={x:i.x-this.translate.x,y:i.y-this.translate.y},n=0;r==="z"?(n=l.x>0||l.y>0?1:-1,this.grid.increase({x:n,y:n})):(n=l[r]>0?1:-1,this.grid[r]+=n),this.#r(l,r,void 0,e),this.#i(n),this.rollBack(t,e)}},O=A;var a=class extends O{static getRectByAxis(t){return t==="x"?"width":"height"}static getDistance(t,e,s){let i=t[s]-e.currentPosition[s];return i+=e.translate[s],i}static getDisplacement(t,e,s){let i=s==="x"?e.getRectRight():e.getRectBottom();return t[s]-i}isConnected(){return this.ref.isConnected}isPositionedUnder(t){return t<=this.currentPosition.y}isPositionedLeft(t){return t<=this.currentPosition.x}hasSamePosition(t,e){return this.currentPosition[e]===t.currentPosition[e]}getRectBottom(){return this.currentPosition.y+this.offset.height}getRectRight(){return this.currentPosition.x+this.offset.width}getRectDiff(t,e){let s=a.getRectByAxis(e);return this.offset[s]-t.offset[s]}getDisplacement(t,e){return a.getDisplacement(this.currentPosition,t,e)}getDistance(t,e){return a.getDistance(this.currentPosition,t,e)}getOffset(){return{width:this.offset.width,height:this.offset.height,top:this.currentPosition.y,left:this.currentPosition.x}}},T=a;var P=class{#t;boundaries;grid;scroll;#e;lastElmPosition;constructor(){this.grid=new h(1,1),this.#t={},this.#e=!1}#s(t){if(!this.#t[this.grid.x]){this.#t[this.grid.x]={...t};return}let e=this.#t[this.grid.x];(t.bottom>e.bottom||t.top<e.top)&&(this.grid.y+=1,this.#e=!0,e.left=0,e.right=0),(t.left>e.right||t.right<e.left)&&(this.#e?(this.grid.x=1,this.#e=!1):this.grid.x+=1),u(e,t)}registerNewElm(t,e){let{height:s,left:i,top:r,width:l}=t,n=i+l,d=r+s,c={top:r,left:i,right:n,bottom:d};this.boundaries?u(this.boundaries,c):this.boundaries=c,this.#s(c);let p=this.boundaries,m=e;if(!m)return;let g=p.bottom-p.top,N=p.right-p.left;m.height<g&&(m.height=g),m.width<N&&(m.width=g)}resetIndicators(){this.boundaries=null,this.grid.setAxes(1,1),this.#t={},this.#e=!1}preservePosition(t){this.lastElmPosition=new h(t.x,t.y)}},w=P;

@@ -27,3 +27,3 @@ import type { RectDimensions, Direction, Axes, IPointNum } from "@dflex/utils";

*/
setPosition(iDsInOrder: string[], direction: Direction, elmSpace: IPointNum, operationID: string, siblingsEmptyElmIndex: number, axis: Axes): number;
setPosition(iDsInOrder: string[], direction: Direction, elmSpace: IPointNum, operationID: string, axis: Axes): void;
/**

@@ -30,0 +30,0 @@ * Roll back element position.

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

import type { Axis } from "@dflex/utils";
import type { Axis, IPointAxes } from "@dflex/utils";
import NodeCore from "./Core";
import type { INode } from "./types";
declare class CoreUtils extends NodeCore implements INode {
static getRectByAxis(axis: Axis): "width" | "height";
static getDistance(currentPosition: IPointAxes, elm: INode, axis: Axis): number;
static getDisplacement(currentPosition: IPointAxes, elm: INode, axis: Axis): number;
isConnected(): boolean;

@@ -11,2 +14,5 @@ isPositionedUnder(elmY: number): boolean;

getRectRight(): number;
getRectDiff(elm: this, axis: Axis): number;
getDisplacement(elm: this, axis: Axis): number;
getDistance(elm: this, axis: Axis): number;
getOffset(): {

@@ -13,0 +19,0 @@ width: number;

@@ -79,3 +79,3 @@ import type { RectDimensions, IPointNum, IPointAxes, Direction, Axes, Axis } from "@dflex/utils";

changeVisibility(isVisible: boolean): void;
setPosition(iDsInOrder: string[], direction: Direction, elmSpace: IPointNum, operationID: string, siblingsEmptyElmIndex: number, axis: Axes): number;
setPosition(iDsInOrder: string[], direction: Direction, elmSpace: IPointNum, operationID: string, axis: Axes): void;
transformElm(): void;

@@ -92,4 +92,8 @@ /** Direct element assignment. Handle the case for settling the draggable element */

getRectRight(): number;
getRectDiff(elm: this, axis: Axis): number;
/** Getting the displacement between two points. Rect is excluded. */
getDisplacement(elm: this, axis: Axis): number;
getDistance(elm: this, axis: Axis): number;
getOffset(): RectDimensions;
hasSamePosition(elm: this, axis: Axis): boolean;
}
{
"name": "@dflex/core-instance",
"version": "3.4.1",
"version": "3.5.0",
"description": "Core instance is the mirror of interactive element that includes all the properties and methods to manipulate the node",

@@ -33,3 +33,3 @@ "author": "Jalal Maskoun",

"devDependencies": {
"@dflex/utils": "workspace:^3.4.1"
"@dflex/utils": "workspace:^3.5.0"
},

@@ -36,0 +36,0 @@ "keywords": [

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