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.9.6 to 3.9.7

2

./dist/dflex-core.js

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

class t{constructor(t,s){this.x=t,this.y=s}}class s extends t{setAxes(t,s){this.x=t,this.y=s}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,s){return this.x===t&&this.y===s}isNotEqual(t,s){return this.x!==t||this.y!==s}}class i{constructor(t,s,i,h){this.top=t,this.right=s,this.bottom=i,this.left=h}}class h extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,h){return this.top=t,this.right=s,this.bottom=i,this.left=h,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,s,i){"x"===t?(this.left=s,this.right=i):(this.top=s,this.bottom=i)}setOne(t,s,i){"x"===t?-1===s?this.left=i:this.right=i:-1===s?this.top=i:this.bottom=i}getOne(t,s){return"x"===t?-1===s?this.left:this.right:-1===s?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,s){this.top=s,this.left=t}hasEqualPosition(t,s){return this.top===s||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends h{constructor(t,s,i,h){super(t,s,i,h)}setFalsy(){return this.setBox(!1,!1,!1,!1),this}isTruthyByAxis(t){return"x"===t?this.left||this.right:this.top||this.bottom}isTruthyOnSide(t,s){return"x"===t?1===s?this.right:this.left:1===s?this.bottom:this.top}isTruthy(){return this.left||this.right||this.top||this.bottom}}class n extends h{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}l(t){return this.top<t.top}u(t){return this.right>t.right}m(t){return this.bottom>t.bottom}p(t){return this.left<t.left}g(t){return this.top>=t.top}T(t){return this.right<=t.right}_(t){return this.bottom<=t.bottom}O(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,s,i){if(s.setBox(!1,!1,!1,!1),i){if("y"===i){const i=this.l(t),h=this.m(t);return i&&(s.top=!0),h&&(s.bottom=!0),i||h}const h=this.p(t),e=this.u(t);return h&&(s.left=!0),e&&(s.right=!0),h||e}return this.l(t)?(s.top=!0,!0):this.u(t)?(s.right=!0,!0):this.m(t)?(s.bottom=!0,!0):!!this.p(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this.g(t)&&this.T(t)&&this._(t)&&this.O(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:s,left:i,right:h,bottom:e}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),h>this.right&&(this.right=h),e>this.bottom&&(this.bottom=e)}}function r(){}const o="height",l="width",u="position";function c(t){return"x"===t?l:o}function a(t){return"x"===t?"left":"top"}class d extends n{constructor(t,s,i,h){super(t,s,i,h),this.width=s-h,this.height=i-t}setByPointAndDimensions(t,s,i,h){this.top=t,this.left=s,this.width=h,this.height=i,this.right=s+h,this.bottom=t+i}setAxes(t,s){this.left=t,this.right=this.width+t,this.top=s,this.bottom=this.height+s}getDimensionDiff(t,s){const i=c(t);return this[i]-s[i]}getPositionDiff(t,s){return this[a(t)]-s[t]}}class f extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:h,bottom:e,right:r}=t;return s?new n(i+this.y,r-this.x,e-this.y,h+this.x):new n(i-this.y,r+this.x,e+this.y,h-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}class m extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}}class p{constructor(t){this.v=t,this.thresholds={},this.isOut={}}P({width:t,height:s}){const i=Math.round(this.v.horizontal*t/100),h=Math.round(this.v.vertical*s/100);this.D=new f(i,h)}A(t,s,i){this.thresholds[t]=this.D.composeBox(s,i),this.isOut[t]=new e(!1,!1,!1,!1)}S(t,s){const i=`${s}`;this.thresholds[i]?this.thresholds[s].assignBiggestBox(this.thresholds[t]):this.A(i,this.thresholds[t],!1)}setMainThreshold(t,s,i){this.P(s),this.A(t,s,i)}updateMainThreshold(t,s,i){this.thresholds[t]=this.D.composeBox(s,i),this.isOut[t].setFalsy()}getElmMainThreshold(t){return this.D.composeBox(t,!1)}setContainerThreshold(t,s,i,h,e){this.A(t,h,!1);const{top:n,left:r}=h,{height:o,width:l}=e;this.A(s,{left:r,top:n,right:r+l,bottom:n+o},!1),this.S(s,i)}isOutThreshold(t,s,i){return s.isOutThreshold(this.thresholds[t],this.isOut[t],i)}destroy(){Object.keys(this.thresholds).forEach((t=>{delete this.thresholds[t]})),Object.keys(this.isOut).forEach((t=>{delete this.isOut[t]}))}}function g(t,s,i){const{left:h,top:e,right:n,bottom:r,height:o,width:l}=t.getBoundingClientRect(),u=new d(e,n,r,h);return 0===s&&0===i||u.setByPointAndDimensions(e+i,h+s,o,l),u}function x(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,h){h&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function y(t,s=!1,i=200){const[h,e]=function(t){let s=null,i=!1;function h(){s&&(clearTimeout(s),s=null)}return[function(e,n){const o=e||r;i=!0,n&&h(),s=setTimeout((()=>{i=!1,o()}),t)},h,function(){return i}]}(i),[n,o]=x();let l=performance.now(),u=!1;const c=()=>{if(u)return;const e=performance.now();s||e-l>=i?(n(t,!0),l=e):h(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,o(),e())},c.resume=()=>{u&&(u=!1,c())},c}const w=Object.freeze(["x","y"]);let T=new WeakMap;function _(t,s,i){t.style.setProperty(s,i)}function O(t,s){t.style.removeProperty(s)}function v(t,s,i){const h=function(t){if(T.has(t))return T.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return T.set(t,s),s}(t),{parsedProperties:e,computedStyle:n}=h,r=e.get(s);if(void 0===r){const t=n.getPropertyValue(s),h=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return e.set(s,h),h}return r}function b(t){return v(t,u,!1)}function P(t,s){return v(t,s,!1)}const D=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function E(t,s,i){_(t,"transform",`translate3d(${s}px, ${i}px, 0)`)}class A{static getType(){return"base:element"}static transform=E;constructor(t){this.id=t,this.translate=new f(0,0),this.I=new Set}setAttribute(t,s,i){"INDEX"!==s?this.I.has(s)||(t.setAttribute(D[s],`${i}`),this.I.add(s)):t.setAttribute(D[s],`${i}`)}removeAttribute(t,s){"INDEX"!==s&&this.I.has(s)&&(t.removeAttribute(D[s]),this.I.delete(s))}clearAttributes(t){this.I.forEach((s=>{this.removeAttribute(t,s)})),this.I.clear()}}const S="transition-property",I="transition-delay",M="transition-duration",B="transition-timing-function";const R="transitionend";class N extends A{static getType(){return"core:element"}constructor(t){const{order:s,keys:i,depth:h,readonly:e,animation:n,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...s},this.DOMOrder={...s},this.keys={...i},this.depth=h,this.readonly=e,this.M=n,this.B=o,[this.R]=x(),this.N=!0,this.F=!1,this.L=void 0,this.q=null,this.C=new f(0,0),this.rect=new d(0,0,0,0),this.DOMGrid=new f(0,0)}updateConfig(t,s,i){this.readonly=t,this.M=s,this.B=i}initElmRect(t,s,i){this.rect=g(t,s,i);const{left:h,top:e}=this.rect;this.C.setAxes(h,e),this.$(t)}$(t){const s=function(t){const s=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const s=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return s?[parseFloat(s[5]),parseFloat(s[6])]:null}(v(t,"transform",!1));return s}(t);if(s){const[t,i]=s,h=this.C.x-t,e=this.C.y-i;this.C.setAxes(h,e),this.rect.setByPointAndDimensions(e,h,this.rect.height,this.rect.width),this.translate.setAxes(t,i)}}getDimensions(t){if(this.q)return this.q;const{width:s,height:i}=function(t){return{width:v(t,l,!0),height:v(t,o,!0)}}(t);return this.q=new f(s,i),this.q}getInitialPosition(){return this.C}changeVisibility(t,s){s!==this.N&&(this.N=s,this.F&&this.N&&(this.k(t,null),this.F=!1))}k(t,s,i=r){if(!this.N)return void(this.F=!0);const h=()=>{this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.keys(s).forEach((s=>{O(t,s)}))}(t,s):function(t,s){t.classList.remove(s)}(t,s)}(t,this.B),this.M&&function(t){O(t,S),O(t,I),O(t,M),O(t,B)}(t),s&&t.removeEventListener(R,h),i()};this.R((()=>{if(this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.entries(s).forEach((([s,i])=>{_(t,s,i)}))}(t,s):function(t,s){t.classList.add(s)}(t,s)}(t,this.B),null===s)return N.transform(t,this.translate.x,this.translate.y),void h();t.addEventListener(R,h),function(t,s,i,h){_(t,S,"transform"),_(t,I,"0ms"),_(t,M,`${i}ms`),_(t,B,h)}(t,0,s,this.M.easing),N.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,s){this.setAttribute(t,"INDEX",s),this.VDOMOrder.self=s}assignNewIndex(t,s){t[s]=this.id}j(t,s,i){const h={axes:t,numberOfPassedElm:i,translate:this.translate.getInstance()};void 0===this.L&&(this.L=new Map),this.L.has(s)||this.L.set(s,[]),this.L.get(s).push(h)}G(t,s,i){if(s)return!this.N&&this.F?void(this.F=!1):void this.k(t,i);this.N?this.k(t,i):this.F=!0}V(t,s,i,h){let e=null;if(this.M){const{duration:t}=this.M,i=this.translate.getInstance(),h=this.translate.increase(s).getInstance();e="number"==typeof t?t:function(t,s){const i=t.x-s.x,h=t.y-s.y,e=Math.sqrt(i*i+h*h);return 20*Math.sqrt(e)}(i,h)}else this.translate.increase(s);this.rect.setAxes(this.C.x+this.translate.x,this.C.y+this.translate.y),this.G(t,i,e);const{self:n}=this.VDOMOrder,r=n+h;return this.updateIndex(t,r),[n,r]}H(t,s,i){if(-1!==t)for(let t=0;t<s;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>i.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<s;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=i.x,this.DOMGrid.y-=1)}reconcilePosition(t,s,i,h,e,n,r,o){let l;const u={x:1===s?-1:1,y:s};"z"===t?l=w:(l=[t],u[t]=s),l.forEach((t=>{e[t]*=u[t],this.H(u[t],n,r)})),this.j(t,o,n);const c=s*n,[a,d]=this.V(i,e,!1,c);h[a]="",h[d]=this.id}restorePosition(t){this.k(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,s){this.translate.clone(s),this.k(t,null)}rollBackPosition(t,s){if(void 0===this.L||!this.L.has(s))return;const i=this.L.get(s),{translate:h,axes:e,numberOfPassedElm:n}=i.pop(),r={x:h.x-this.translate.x,y:h.y-this.translate.y};let o=0;const l={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:l.x*n,y:l.y*n})):(o=l[e]*n,this.DOMGrid[e]+=o),this.V(t,r,!0,o),0===i.length)return this.L.delete(s),void(0===this.L.size&&(this.L=void 0));this.rollBackPosition(t,s)}hasTransformedFromOrigin(){return this.C.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t){this.L=void 0,this.translate.setAxes(0,0),this.F=!1,this.DOMOrder.self=this.VDOMOrder.self,O(t,"transform"),function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)}(t,"style"),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:N.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof f?this.translate:null,order:this.VDOMOrder,initialPosition:this.C.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.F,isVisible:this.N}}}class F extends N{static getDistance(t,s,i){let h=t[i]-s.rect["x"===i?"left":"top"];return h+=s.translate[i],h}static getDisplacement(t,s,i){return t[i]-("x"===i?s.rect.right:s.rect.bottom)}getDisplacement(t,s){return F.getDisplacement(this.rect.getPosition(),t,s)}getDistance(t,s){return F.getDistance(this.rect.getPosition(),t,s)}}const L=/(auto|scroll|overlay)/;function z(t){const s=b(t),i=[void 0,!1,new m(!1,!1)],h=function(t,h){let e=0,n=t;try{do{if(e+=1,e>1&&((t,s,i)=>{const h=P(t,"overflow-x"),e=P(t,"overflow-y");if("absolute"===s&&"static"===b(t))return!1;const[,,n]=i,r=(s,i)=>((t,s,i,h)=>{if(L.test(s)){const s=function(t,s){return"y"===s?t.scrollHeight>t.clientHeight:t.scrollWidth>t.clientWidth}(i,t);if(s)return h[t]=!0,!0}return!1})(s,i,t,n);return r("y",e)||r("x",h)})(n,s,i))return e=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{e=0}return null}(t);return h&&"fixed"!==s?i[0]=h:(i[0]=document.documentElement,i[1]=!0),i}const q={horizontal:25,vertical:25},C={horizontal:10,vertical:10};class ${static getType(){return"scroll:container"}constructor(t,s,i,h){this.X=s,this.U=h,this.W={inner:{threshold:null,key:`scroll_inner_${s}`},outer:{threshold:null,key:`scroll_outer_${s}`}},this.Y=`scroll__${s}`,[this.J,this.K,this.hasOverflow]=z(t),this.totalScrollRect=new d(0,0,0,0),this.visibleScrollRect=new d(0,0,0,0),this.Z(),this.tt=i>10,this.K?this.st():this.it(),this.ht(!0)}hasDynamicVisibility(){return this.tt&&this.hasOverflow.isOneTruthy()}et(t,s){const i=this.W[t];if(!s)return void(i.threshold&&(i.threshold.destroy(),i.threshold=null));const h=new p(s);i.threshold=h,h.setMainThreshold(i.key,this.visibleScrollRect,"inner"===t)}nt(t,s){const i=this.Y,h=s.toString(),e=this.K?document.body:this.J;t?e.dataset[i]=h:delete e.dataset[i]}it(){if(this.hasOverflow.isAllFalsy())return this.et("inner",null),this.et("outer",null),void this.nt(!1,!0);this.nt(!0,!0),this.et("inner",null),this.et("inner",C),this.hasDynamicVisibility()&&(this.et("outer",null),this.et("outer",q))}st(){const t=(t,s)=>function(t,s,i,h=!1){const e=c(i);return t[e]/(h?.5:1)>s[e]}(this.totalScrollRect,this.visibleScrollRect,t,s),s=t("x"),i=t("y");this.hasOverflow.setAxes(s,i),this.it()}Z(){const{scrollHeight:t,scrollWidth:s,scrollLeft:i,scrollTop:h,clientHeight:e,clientWidth:n}=this.J;if(this.totalScrollRect.setByPointAndDimensions(h,i,t,s),this.K)this.visibleScrollRect.setByPointAndDimensions(h,i,e,n);else{const{left:t,top:s}=this.J.getBoundingClientRect();this.visibleScrollRect.setByPointAndDimensions(s,t,e,n)}}rt(t,s,i){return!!this.totalScrollRect.hasEqualPosition(t,s)&&(this.totalScrollRect.setPosition(t,s),i&&(this.J.scrollTop=s,this.J.scrollLeft=t),!0)}scrollTo(t,s){this.rt(-1===t?this.totalScrollRect.left:t,-1===s?this.totalScrollRect.right:s,!0),this.U(this.X)}ot(t){const s=a(t),i=this.totalScrollRect[s],h=function(t){return"x"===t?"right":"bottom"}(t),e=this.totalScrollRect[h],n=c(t);return[i,e,this.visibleScrollRect[n]]}calculateDistance(t,s){const[i,h,e]=this.ot(t);return 1===s?h-(i+e):i}hasScrollableArea(t,s){const[i,h,e]=this.ot(t);return 1===s?i+e<h:i>0}lt=y((()=>{const{scrollLeft:t,scrollTop:s}=this.J;this.rt(t,s,!1)&&this.U(this.X)}));ut=y((()=>{this.Z(),this.st()}));ht(t){const s=t?"addEventListener":"removeEventListener",i=this.K?window:this.J,h={passive:!0};i[s]("resize",this.ut,h),i[s]("scroll",this.lt,h)}pauseListeners(t){t?this.lt.pause():this.lt.resume()}getMaximumScrollContainerLeft(){const{left:t,width:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.left}getMaximumScrollContainerTop(){const{top:t,height:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.top}getElmViewportPosition(t,s){const{top:i,left:h}=this.totalScrollRect;return[t-i,s-h]}isElmOutViewport(t){let s,i;if(t instanceof d){const[h,e]=this.getElmViewportPosition(t.top,t.left);s=new n(h,e+t.width,h+t.height,e),i=this.W.outer}else s=t,i=this.W.inner;const{threshold:h,key:e}=i;return[h.isOutThreshold(e,s,this.hasOverflow.y?"y":"x"),h.isOut[e]]}ct(){const{height:t,width:s}=this.visibleScrollRect;return{height:t,width:s}}getSerializedInstance(){return{type:$.getType(),version:3,key:this.X,hasOverFlow:this.hasOverflow.getInstance(),hasDocumentAsContainer:this.K,scrollRect:this.totalScrollRect.getBox(),scrollContainerRect:this.visibleScrollRect.getBox(),visibleScreen:this.ct()}}destroy(){this.ht(!1),this.et("inner",null),this.et("outer",null),this.nt(!1,!0),this.U=void 0,this.J=void 0}}exports.DFlexBaseElement=A,exports.DFlexElement=F,exports.DFlexParentContainer=class{constructor(t,s,i,h){this.id=t,this.dt=new f(-1,-1),this.grid=new f(-1,-1),this.originLength=i,this.ft=new n(0,0,0,0),this.gt=null;const{left:e,top:r}=h;this.xt=g(s,e,r),this.lastElmPosition=null}yt(t){const s=this.ft;return s.isPositionedY(t)?(this.dt.y+=1,this.dt.x=0,this.ft.setBox(0,0,0,0)):this.dt.x+=1,this.dt.x>this.grid.x&&(this.grid.x=this.dt.x),this.dt.y>this.grid.y&&(this.grid.y=this.dt.y),s.assignBiggestBox(t),this.dt}register(t,s){this.gt?this.gt.assignBiggestBox(t):this.gt=new n(t.top,t.right,t.bottom,t.left);const i=this.yt(t),h=this.gt,e=s;if(!e)return i;const r=h.bottom-h.top,o=h.right-h.left;return e.height<r&&(e.height=r),e.width<o&&(e.width=r),i}extendGrid(t){this.grid[t]+=1}reduceGrid(t){this.grid[t]-=1}getBoundaries(){return this.gt||this.xt.getBox()}resetIndicators(t){this.dt.setAxes(-1,-1),this.grid.setAxes(-1,-1),this.originLength=t,this.ft.setBox(0,0,0,0),this.gt=null,this.lastElmPosition=null}preservePosition(t){this.lastElmPosition?this.lastElmPosition.setAxes(t.x,t.y):this.lastElmPosition=new f(t.x,t.y)}},exports.DFlexScrollContainer=$;
class t{constructor(t,s){this.x=t,this.y=s}}class s extends t{setAxes(t,s){this.x=t,this.y=s}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,s){return this.x===t&&this.y===s}isNotEqual(t,s){return this.x!==t||this.y!==s}}class i{constructor(t,s,i,h){this.top=t,this.right=s,this.bottom=i,this.left=h}}class h extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,h){return this.top=t,this.right=s,this.bottom=i,this.left=h,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,s,i){"x"===t?(this.left=s,this.right=i):(this.top=s,this.bottom=i)}setOne(t,s,i){"x"===t?-1===s?this.left=i:this.right=i:-1===s?this.top=i:this.bottom=i}getOne(t,s){return"x"===t?-1===s?this.left:this.right:-1===s?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,s){this.top=s,this.left=t}hasEqualPosition(t,s){return this.top===s||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends h{constructor(t,s,i,h){super(t,s,i,h)}setFalsy(){return this.setBox(!1,!1,!1,!1),this}isTruthyByAxis(t){return"x"===t?this.left||this.right:this.top||this.bottom}isTruthyOnSide(t,s){return"x"===t?1===s?this.right:this.left:1===s?this.bottom:this.top}isTruthy(){return this.left||this.right||this.top||this.bottom}}class n extends h{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}l(t){return this.top<t.top}u(t){return this.right>t.right}m(t){return this.bottom>t.bottom}p(t){return this.left<t.left}T(t){return this.top>=t.top}_(t){return this.right<=t.right}O(t){return this.bottom<=t.bottom}v(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,s,i){if(s.setBox(!1,!1,!1,!1),i){if("y"===i){const i=this.l(t),h=this.m(t);return i&&(s.top=!0),h&&(s.bottom=!0),i||h}const h=this.p(t),e=this.u(t);return h&&(s.left=!0),e&&(s.right=!0),h||e}return this.l(t)?(s.top=!0,!0):this.u(t)?(s.right=!0,!0):this.m(t)?(s.bottom=!0,!0):!!this.p(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this.T(t)&&this._(t)&&this.O(t)&&this.v(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:s,left:i,right:h,bottom:e}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),h>this.right&&(this.right=h),e>this.bottom&&(this.bottom=e)}}function r(){}const o="height",l="width",u="position";function c(t){return"x"===t?l:o}function a(t){return"x"===t?"left":"top"}class d extends n{constructor(t,s,i,h){super(t,s,i,h),this.width=s-h,this.height=i-t}setByPointAndDimensions(t,s,i,h){this.top=t,this.left=s,this.width=h,this.height=i,this.right=s+h,this.bottom=t+i}setAxes(t,s){this.left=t,this.right=this.width+t,this.top=s,this.bottom=this.height+s}getDimensionDiff(t,s){const i=c(t);return this[i]-s[i]}getPositionDiff(t,s){return this[a(t)]-s[t]}}class f extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:h,bottom:e,right:r}=t;return s?new n(i+this.y,r-this.x,e-this.y,h+this.x):new n(i-this.y,r+this.x,e+this.y,h-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}class m extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}}class p{constructor(t){this.P=t,this.thresholds={},this.isOut={}}D({width:t,height:s}){const i=Math.round(this.P.horizontal*t/100),h=Math.round(this.P.vertical*s/100);this.A=new f(i,h)}S(t,s,i){this.thresholds[t]=this.A.composeBox(s,i),this.isOut[t]=new e(!1,!1,!1,!1)}I(t,s){const i=`${s}`;this.thresholds[i]?this.thresholds[s].assignBiggestBox(this.thresholds[t]):this.S(i,this.thresholds[t],!1)}setMainThreshold(t,s,i){this.D(s),this.S(t,s,i)}updateMainThreshold(t,s,i){this.thresholds[t]=this.A.composeBox(s,i),this.isOut[t].setFalsy()}getElmMainThreshold(t){return this.A.composeBox(t,!1)}setContainerThreshold(t,s,i,h,e){this.S(t,h,!1);const{top:n,left:r}=h,{height:o,width:l}=e;this.S(s,{left:r,top:n,right:r+l,bottom:n+o},!1),this.I(s,i)}isOutThreshold(t,s,i){return s.isOutThreshold(this.thresholds[t],this.isOut[t],i)}destroy(){Object.keys(this.thresholds).forEach((t=>{delete this.thresholds[t]})),Object.keys(this.isOut).forEach((t=>{delete this.isOut[t]}))}}function g(t,s,i){const{left:h,top:e,right:n,bottom:r,height:o,width:l}=t.getBoundingClientRect(),u=new d(e,n,r,h);return 0===s&&0===i||u.setByPointAndDimensions(e+i,h+s,o,l),u}function x(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,h){h&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function y(t,s=!1,i=200){const[h,e]=function(t){let s=null,i=!1;function h(){s&&(clearTimeout(s),s=null)}return[function(e,n){const o=e||r;i=!0,n&&h(),s=setTimeout((()=>{i=!1,o()}),t)},h,function(){return i}]}(i),[n,o]=x();let l=performance.now(),u=!1;const c=()=>{if(u)return;const e=performance.now();s||e-l>=i?(n(t,!0),l=e):h(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,o(),e())},c.resume=()=>{u&&(u=!1,c())},c}const w=Object.freeze(["x","y"]);let T=new WeakMap;function _(t,s,i){t.style.setProperty(s,i)}function O(t,s){t.style.removeProperty(s)}function v(t,s,i){const h=function(t){if(T.has(t))return T.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return T.set(t,s),s}(t),{parsedProperties:e,computedStyle:n}=h,r=e.get(s);if(void 0===r){const t=n.getPropertyValue(s),h=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return e.set(s,h),h}return r}function b(t){return v(t,u,!1)}function P(t,s){return v(t,s,!1)}const D=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function E(t,s,i){_(t,"transform",`translate3d(${s}px, ${i}px, 0)`)}class A{static getType(){return"base:element"}static transform=E;constructor(t){this.id=t,this.translate=new f(0,0),this.M=new Set}setAttribute(t,s,i){"INDEX"!==s?this.M.has(s)||(t.setAttribute(D[s],`${i}`),this.M.add(s)):t.setAttribute(D[s],`${i}`)}removeAttribute(t,s){"INDEX"!==s&&this.M.has(s)&&(t.removeAttribute(D[s]),this.M.delete(s))}clearAttributes(t){this.M.forEach((s=>{this.removeAttribute(t,s)})),this.M.clear()}}const S="transition-property",I="transition-delay",M="transition-duration",B="transition-timing-function";const R="transitionend";class N extends A{static getType(){return"core:element"}constructor(t){const{order:s,keys:i,depth:h,readonly:e,animation:n,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...s},this.DOMOrder={...s},this.keys={...i},this.depth=h,this.readonly=e,this.B=n,this.R=o,[this.N]=x(),this.F=!0,this.L=!1,this.q=void 0,this.C=null,this.$=new f(0,0),this.rect=new d(0,0,0,0),this.DOMGrid=new f(0,0)}updateConfig(t,s,i){this.readonly=t,this.B=s,this.R=i}initElmRect(t,s,i){this.rect=g(t,s,i);const{left:h,top:e}=this.rect;this.$.setAxes(h,e),this.k(t)}k(t){const s=function(t){const s=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const s=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return s?[parseFloat(s[5]),parseFloat(s[6])]:null}(v(t,"transform",!1));return s}(t);if(s){const[t,i]=s,h=this.$.x-t,e=this.$.y-i;this.$.setAxes(h,e),this.rect.setByPointAndDimensions(e,h,this.rect.height,this.rect.width),this.translate.setAxes(t,i)}}getDimensions(t){if(this.C)return this.C;const{width:s,height:i}=function(t){return{width:v(t,l,!0),height:v(t,o,!0)}}(t);return this.C=new f(s,i),this.C}getInitialPosition(){return this.$}changeVisibility(t,s){s!==this.F&&(this.F=s,this.L&&this.F&&(this.j(t,null),this.L=!1))}j(t,s,i=r){if(!this.F)return void(this.L=!0);const h=()=>{this.R&&function(t,s){"string"!=typeof s?function(t,s){Object.keys(s).forEach((s=>{O(t,s)}))}(t,s):function(t,s){t.classList.remove(s)}(t,s)}(t,this.R),this.B&&function(t){O(t,S),O(t,I),O(t,M),O(t,B)}(t),s&&t.removeEventListener(R,h),i()};this.N((()=>{if(this.R&&function(t,s){"string"!=typeof s?function(t,s){Object.entries(s).forEach((([s,i])=>{_(t,s,i)}))}(t,s):function(t,s){t.classList.add(s)}(t,s)}(t,this.R),null===s)return N.transform(t,this.translate.x,this.translate.y),void h();t.addEventListener(R,h),function(t,s,i,h){_(t,S,"transform"),_(t,I,"0ms"),_(t,M,`${i}ms`),_(t,B,h)}(t,0,s,this.B.easing),N.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,s){this.setAttribute(t,"INDEX",s),this.VDOMOrder.self=s}assignNewIndex(t,s){t[s]=this.id}G(t,s,i){const h={axes:t,numberOfPassedElm:i,translate:this.translate.getInstance()};void 0===this.q&&(this.q=new Map),this.q.has(s)||this.q.set(s,[]),this.q.get(s).push(h)}V(t,s,i){if(s)return!this.F&&this.L?void(this.L=!1):void this.j(t,i);this.F?this.j(t,i):this.L=!0}H(t,s,i,h){let e=null;if(this.B){const{duration:t}=this.B,i=this.translate.getInstance(),h=this.translate.increase(s).getInstance();e="number"==typeof t?t:function(t,s){const i=t.x-s.x,h=t.y-s.y,e=Math.sqrt(i*i+h*h);return 20*Math.sqrt(e)}(i,h)}else this.translate.increase(s);this.rect.setAxes(this.$.x+this.translate.x,this.$.y+this.translate.y),this.V(t,i,e);const{self:n}=this.VDOMOrder,r=n+h;return this.updateIndex(t,r),[n,r]}X(t,s,i){if(-1!==t)for(let t=0;t<s;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>i.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<s;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=i.x,this.DOMGrid.y-=1)}reconcilePosition(t,s,i,h,e,n,r,o){let l;const u={x:1===s?-1:1,y:s};"z"===t?l=w:(l=[t],u[t]=s),l.forEach((t=>{e[t]*=u[t],this.X(u[t],n,r)})),this.G(t,o,n);const c=s*n,[a,d]=this.H(i,e,!1,c);h[a]="",h[d]=this.id}restorePosition(t){this.j(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,s){this.translate.clone(s),this.j(t,null)}rollBackPosition(t,s){if(void 0===this.q||!this.q.has(s))return;const i=this.q.get(s),{translate:h,axes:e,numberOfPassedElm:n}=i.pop(),r={x:h.x-this.translate.x,y:h.y-this.translate.y};let o=0;const l={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:l.x*n,y:l.y*n})):(o=l[e]*n,this.DOMGrid[e]+=o),this.H(t,r,!0,o),0===i.length)return this.q.delete(s),void(0===this.q.size&&(this.q=void 0));this.rollBackPosition(t,s)}hasTransformedFromOrigin(){return this.$.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t){this.q=void 0,this.translate.setAxes(0,0),this.L=!1,this.DOMOrder.self=this.VDOMOrder.self,O(t,"transform"),function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)}(t,"style"),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:N.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof f?this.translate:null,order:this.VDOMOrder,initialPosition:this.$.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.L,isVisible:this.F}}}class F extends N{static getDistance(t,s,i){let h=t[i]-s.rect["x"===i?"left":"top"];return h+=s.translate[i],h}static getDisplacement(t,s,i){return t[i]-("x"===i?s.rect.right:s.rect.bottom)}getDisplacement(t,s){return F.getDisplacement(this.rect.getPosition(),t,s)}getDistance(t,s){return F.getDistance(this.rect.getPosition(),t,s)}}const L=/(auto|scroll|overlay)/;function z(t){const s=b(t),i=[void 0,!1,new m(!1,!1)],h=function(t,h){let e=0,n=t;try{do{if(e+=1,e>1&&((t,s,i)=>{const h=P(t,"overflow-x"),e=P(t,"overflow-y");if("absolute"===s&&"static"===b(t))return!1;const[,,n]=i,r=(s,i)=>((t,s,i,h)=>{if(L.test(s)){const s=function(t,s){return"y"===s?t.scrollHeight>t.clientHeight:t.scrollWidth>t.clientWidth}(i,t);if(s)return h[t]=!0,!0}return!1})(s,i,t,n);return r("y",e)||r("x",h)})(n,s,i))return e=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{e=0}return null}(t);return h&&"fixed"!==s?i[0]=h:(i[0]=document.documentElement,i[1]=!0),i}const q={horizontal:25,vertical:25},C={horizontal:10,vertical:10};class ${static getType(){return"scroll:container"}constructor(t,s,i,h){this.U=s,this.W=h,this.Y={inner:{threshold:null,key:`scroll_inner_${s}`},outer:{threshold:null,key:`scroll_outer_${s}`}},this.J=`scroll__${s}`,[this.K,this.Z,this.hasOverflow]=z(t),this.totalScrollRect=new d(0,0,0,0),this.visibleScrollRect=new d(0,0,0,0),this.tt(),this.st=i>10,this.Z?this.it():this.ht(),this.et(!0)}hasDynamicVisibility(){return this.st&&this.hasOverflow.isOneTruthy()}nt(t,s){const i=this.Y[t];if(!s)return void(i.threshold&&(i.threshold.destroy(),i.threshold=null));const h=new p(s);i.threshold=h,h.setMainThreshold(i.key,this.visibleScrollRect,"inner"===t)}rt(t,s){const i=this.J,h=s.toString(),e=this.Z?document.body:this.K;t?e.dataset[i]=h:delete e.dataset[i]}ht(){if(this.hasOverflow.isAllFalsy())return this.nt("inner",null),this.nt("outer",null),void this.rt(!1,!0);this.rt(!0,!0),this.nt("inner",null),this.nt("inner",C),this.hasDynamicVisibility()&&(this.nt("outer",null),this.nt("outer",q))}it(){const t=(t,s)=>function(t,s,i,h=!1){const e=c(i);return t[e]/(h?.5:1)>s[e]}(this.totalScrollRect,this.visibleScrollRect,t,s),s=t("x"),i=t("y");this.hasOverflow.setAxes(s,i),this.ht()}tt(){const{scrollHeight:t,scrollWidth:s,scrollLeft:i,scrollTop:h,clientHeight:e,clientWidth:n}=this.K;if(this.totalScrollRect.setByPointAndDimensions(h,i,t,s),this.Z)this.visibleScrollRect.setByPointAndDimensions(h,i,e,n);else{const{left:t,top:s}=this.K.getBoundingClientRect();this.visibleScrollRect.setByPointAndDimensions(s,t,e,n)}}ot(t,s,i){return!!this.totalScrollRect.hasEqualPosition(t,s)&&(this.totalScrollRect.setPosition(t,s),i&&(this.K.scrollTop=s,this.K.scrollLeft=t),!0)}scrollTo(t,s){this.ot(-1===t?this.totalScrollRect.left:t,-1===s?this.totalScrollRect.right:s,!0),this.W(this.U)}lt(t){const s=a(t),i=this.totalScrollRect[s],h=function(t){return"x"===t?"right":"bottom"}(t),e=this.totalScrollRect[h],n=c(t);return[i,e,this.visibleScrollRect[n]]}calculateDistance(t,s){const[i,h,e]=this.lt(t);return 1===s?h-(i+e):i}hasScrollableArea(t,s){const[i,h,e]=this.lt(t);return 1===s?i+e<h:i>0}ut=y((()=>{const{scrollLeft:t,scrollTop:s}=this.K;this.ot(t,s,!1)&&this.W(this.U)}));ct=y((()=>{this.tt(),this.it()}));et(t){const s=t?"addEventListener":"removeEventListener",i=this.Z?window:this.K,h={passive:!0};i[s]("resize",this.ct,h),i[s]("scroll",this.ut,h)}pauseListeners(t){t?this.ut.pause():this.ut.resume()}getMaximumScrollContainerLeft(){const{left:t,width:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.left}getMaximumScrollContainerTop(){const{top:t,height:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.top}getElmViewportPosition(t,s){const{top:i,left:h}=this.totalScrollRect;return[t-i,s-h]}isElmOutViewport(t){let s,i;if(t instanceof d){const[h,e]=this.getElmViewportPosition(t.top,t.left);s=new n(h,e+t.width,h+t.height,e),i=this.Y.outer}else s=t,i=this.Y.inner;const{threshold:h,key:e}=i;return[h.isOutThreshold(e,s,this.hasOverflow.y?"y":"x"),h.isOut[e]]}dt(){const{height:t,width:s}=this.visibleScrollRect;return{height:t,width:s}}getSerializedInstance(){return{type:$.getType(),version:3,key:this.U,hasOverFlow:this.hasOverflow.getInstance(),hasDocumentAsContainer:this.Z,scrollRect:this.totalScrollRect.getBox(),scrollContainerRect:this.visibleScrollRect.getBox(),visibleScreen:this.dt()}}destroy(){this.et(!1),this.nt("inner",null),this.nt("outer",null),this.rt(!1,!0),this.W=void 0,this.K=void 0}}exports.DFlexBaseElement=A,exports.DFlexElement=F,exports.DFlexParentContainer=class{constructor(t,s,i,h){this.id=t,this.ft=new f(-1,-1),this.grid=new f(-1,-1),this.originLength=i,this.gt=new n(0,0,0,0),this.xt=null;const{left:e,top:r}=h;this.yt=g(s,e,r),this.lastElmPosition=null}wt(t){const s=this.gt;return s.isPositionedY(t)?(this.ft.y+=1,this.ft.x=0,this.gt.setBox(0,0,0,0)):this.ft.x+=1,this.ft.x>this.grid.x&&(this.grid.x=this.ft.x),this.ft.y>this.grid.y&&(this.grid.y=this.ft.y),s.assignBiggestBox(t),this.ft}register(t,s){this.xt?this.xt.assignBiggestBox(t):this.xt=new n(t.top,t.right,t.bottom,t.left);const i=this.wt(t),h=this.xt,e=s;if(!e)return i;const r=h.bottom-h.top,o=h.right-h.left;return e.height<r&&(e.height=r),e.width<o&&(e.width=r),i}extendGrid(t){this.grid[t]+=1}reduceGrid(t){this.grid[t]-=1}getBoundaries(){return this.xt||this.yt.getBox()}resetIndicators(t){this.ft.setAxes(-1,-1),this.grid.setAxes(-1,-1),this.originLength=t,this.gt.setBox(0,0,0,0),this.xt=null,this.lastElmPosition=null}preservePosition(t){this.lastElmPosition?this.lastElmPosition.setAxes(t.x,t.y):this.lastElmPosition=new f(t.x,t.y)}},exports.DFlexScrollContainer=$;

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

class t{constructor(t,s){this.x=t,this.y=s}}class s extends t{setAxes(t,s){this.x=t,this.y=s}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,s){return this.x===t&&this.y===s}isNotEqual(t,s){return this.x!==t||this.y!==s}}class i{constructor(t,s,i,h){this.top=t,this.right=s,this.bottom=i,this.left=h}}class h extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,h){return this.top=t,this.right=s,this.bottom=i,this.left=h,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,s,i){"x"===t?(this.left=s,this.right=i):(this.top=s,this.bottom=i)}setOne(t,s,i){"x"===t?-1===s?this.left=i:this.right=i:-1===s?this.top=i:this.bottom=i}getOne(t,s){return"x"===t?-1===s?this.left:this.right:-1===s?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,s){this.top=s,this.left=t}hasEqualPosition(t,s){return this.top===s||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends h{constructor(t,s,i,h){super(t,s,i,h)}setFalsy(){return this.setBox(!1,!1,!1,!1),this}isTruthyByAxis(t){return"x"===t?this.left||this.right:this.top||this.bottom}isTruthyOnSide(t,s){return"x"===t?1===s?this.right:this.left:1===s?this.bottom:this.top}isTruthy(){return this.left||this.right||this.top||this.bottom}}class n extends h{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}l(t){return this.top<t.top}u(t){return this.right>t.right}m(t){return this.bottom>t.bottom}p(t){return this.left<t.left}g(t){return this.top>=t.top}T(t){return this.right<=t.right}_(t){return this.bottom<=t.bottom}O(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,s,i){if(s.setBox(!1,!1,!1,!1),i){if("y"===i){const i=this.l(t),h=this.m(t);return i&&(s.top=!0),h&&(s.bottom=!0),i||h}const h=this.p(t),e=this.u(t);return h&&(s.left=!0),e&&(s.right=!0),h||e}return this.l(t)?(s.top=!0,!0):this.u(t)?(s.right=!0,!0):this.m(t)?(s.bottom=!0,!0):!!this.p(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this.g(t)&&this.T(t)&&this._(t)&&this.O(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:s,left:i,right:h,bottom:e}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),h>this.right&&(this.right=h),e>this.bottom&&(this.bottom=e)}}function r(){}const o="height",l="width",u="position";function c(t){return"x"===t?l:o}function a(t){return"x"===t?"left":"top"}class d extends n{constructor(t,s,i,h){super(t,s,i,h),this.width=s-h,this.height=i-t}setByPointAndDimensions(t,s,i,h){this.top=t,this.left=s,this.width=h,this.height=i,this.right=s+h,this.bottom=t+i}setAxes(t,s){this.left=t,this.right=this.width+t,this.top=s,this.bottom=this.height+s}getDimensionDiff(t,s){const i=c(t);return this[i]-s[i]}getPositionDiff(t,s){return this[a(t)]-s[t]}}class f extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:h,bottom:e,right:r}=t;return s?new n(i+this.y,r-this.x,e-this.y,h+this.x):new n(i-this.y,r+this.x,e+this.y,h-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}class m extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}}class p{constructor(t){this.v=t,this.thresholds={},this.isOut={}}P({width:t,height:s}){const i=Math.round(this.v.horizontal*t/100),h=Math.round(this.v.vertical*s/100);this.D=new f(i,h)}A(t,s,i){this.thresholds[t]=this.D.composeBox(s,i),this.isOut[t]=new e(!1,!1,!1,!1)}S(t,s){const i=`${s}`;this.thresholds[i]?this.thresholds[s].assignBiggestBox(this.thresholds[t]):this.A(i,this.thresholds[t],!1)}setMainThreshold(t,s,i){this.P(s),this.A(t,s,i)}updateMainThreshold(t,s,i){this.thresholds[t]=this.D.composeBox(s,i),this.isOut[t].setFalsy()}getElmMainThreshold(t){return this.D.composeBox(t,!1)}setContainerThreshold(t,s,i,h,e){this.A(t,h,!1);const{top:n,left:r}=h,{height:o,width:l}=e;this.A(s,{left:r,top:n,right:r+l,bottom:n+o},!1),this.S(s,i)}isOutThreshold(t,s,i){return s.isOutThreshold(this.thresholds[t],this.isOut[t],i)}destroy(){Object.keys(this.thresholds).forEach((t=>{delete this.thresholds[t]})),Object.keys(this.isOut).forEach((t=>{delete this.isOut[t]}))}}function g(t,s,i){const{left:h,top:e,right:n,bottom:r,height:o,width:l}=t.getBoundingClientRect(),u=new d(e,n,r,h);return 0===s&&0===i||u.setByPointAndDimensions(e+i,h+s,o,l),u}function x(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,h){h&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function y(t,s=!1,i=200){const[h,e]=function(t){let s=null,i=!1;function h(){s&&(clearTimeout(s),s=null)}return[function(e,n){const o=e||r;i=!0,n&&h(),s=setTimeout((()=>{i=!1,o()}),t)},h,function(){return i}]}(i),[n,o]=x();let l=performance.now(),u=!1;const c=()=>{if(u)return;const e=performance.now();s||e-l>=i?(n(t,!0),l=e):h(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,o(),e())},c.resume=()=>{u&&(u=!1,c())},c}const w=Object.freeze(["x","y"]);let T=new WeakMap;function _(t,s,i){t.style.setProperty(s,i)}function O(t,s){t.style.removeProperty(s)}function v(t,s,i){const h=function(t){if(T.has(t))return T.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return T.set(t,s),s}(t),{parsedProperties:e,computedStyle:n}=h,r=e.get(s);if(void 0===r){const t=n.getPropertyValue(s),h=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return e.set(s,h),h}return r}function b(t){return v(t,u,!1)}function P(t,s){return v(t,s,!1)}const D=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function E(t,s,i){_(t,"transform",`translate3d(${s}px, ${i}px, 0)`)}class A{static getType(){return"base:element"}static transform=E;constructor(t){this.id=t,this.translate=new f(0,0),this.I=new Set}setAttribute(t,s,i){"INDEX"!==s?this.I.has(s)||(t.setAttribute(D[s],`${i}`),this.I.add(s)):t.setAttribute(D[s],`${i}`)}removeAttribute(t,s){"INDEX"!==s&&this.I.has(s)&&(t.removeAttribute(D[s]),this.I.delete(s))}clearAttributes(t){this.I.forEach((s=>{this.removeAttribute(t,s)})),this.I.clear()}}const S="transition-property",I="transition-delay",M="transition-duration",B="transition-timing-function";const R="transitionend";class N extends A{static getType(){return"core:element"}constructor(t){const{order:s,keys:i,depth:h,readonly:e,animation:n,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...s},this.DOMOrder={...s},this.keys={...i},this.depth=h,this.readonly=e,this.M=n,this.B=o,[this.R]=x(),this.N=!0,this.F=!1,this.L=void 0,this.q=null,this.C=new f(0,0),this.rect=new d(0,0,0,0),this.DOMGrid=new f(0,0)}updateConfig(t,s,i){this.readonly=t,this.M=s,this.B=i}initElmRect(t,s,i){this.rect=g(t,s,i);const{left:h,top:e}=this.rect;this.C.setAxes(h,e),this.$(t)}$(t){const s=function(t){const s=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const s=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return s?[parseFloat(s[5]),parseFloat(s[6])]:null}(v(t,"transform",!1));return s}(t);if(s){const[t,i]=s,h=this.C.x-t,e=this.C.y-i;this.C.setAxes(h,e),this.rect.setByPointAndDimensions(e,h,this.rect.height,this.rect.width),this.translate.setAxes(t,i)}}getDimensions(t){if(this.q)return this.q;const{width:s,height:i}=function(t){return{width:v(t,l,!0),height:v(t,o,!0)}}(t);return this.q=new f(s,i),this.q}getInitialPosition(){return this.C}changeVisibility(t,s){s!==this.N&&(this.N=s,this.F&&this.N&&(this.k(t,null),this.F=!1))}k(t,s,i=r){if(!this.N)return void(this.F=!0);const h=()=>{this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.keys(s).forEach((s=>{O(t,s)}))}(t,s):function(t,s){t.classList.remove(s)}(t,s)}(t,this.B),this.M&&function(t){O(t,S),O(t,I),O(t,M),O(t,B)}(t),s&&t.removeEventListener(R,h),i()};this.R((()=>{if(this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.entries(s).forEach((([s,i])=>{_(t,s,i)}))}(t,s):function(t,s){t.classList.add(s)}(t,s)}(t,this.B),null===s)return N.transform(t,this.translate.x,this.translate.y),void h();t.addEventListener(R,h),function(t,s,i,h){_(t,S,"transform"),_(t,I,"0ms"),_(t,M,`${i}ms`),_(t,B,h)}(t,0,s,this.M.easing),N.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,s){this.setAttribute(t,"INDEX",s),this.VDOMOrder.self=s}assignNewIndex(t,s){t[s]=this.id}j(t,s,i){const h={axes:t,numberOfPassedElm:i,translate:this.translate.getInstance()};void 0===this.L&&(this.L=new Map),this.L.has(s)||this.L.set(s,[]),this.L.get(s).push(h)}G(t,s,i){if(s)return!this.N&&this.F?void(this.F=!1):void this.k(t,i);this.N?this.k(t,i):this.F=!0}V(t,s,i,h){let e=null;if(this.M){const{duration:t}=this.M,i=this.translate.getInstance(),h=this.translate.increase(s).getInstance();e="number"==typeof t?t:function(t,s){const i=t.x-s.x,h=t.y-s.y,e=Math.sqrt(i*i+h*h);return 20*Math.sqrt(e)}(i,h)}else this.translate.increase(s);this.rect.setAxes(this.C.x+this.translate.x,this.C.y+this.translate.y),this.G(t,i,e);const{self:n}=this.VDOMOrder,r=n+h;return this.updateIndex(t,r),[n,r]}H(t,s,i){if(-1!==t)for(let t=0;t<s;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>i.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<s;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=i.x,this.DOMGrid.y-=1)}reconcilePosition(t,s,i,h,e,n,r,o){let l;const u={x:1===s?-1:1,y:s};"z"===t?l=w:(l=[t],u[t]=s),l.forEach((t=>{e[t]*=u[t],this.H(u[t],n,r)})),this.j(t,o,n);const c=s*n,[a,d]=this.V(i,e,!1,c);h[a]="",h[d]=this.id}restorePosition(t){this.k(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,s){this.translate.clone(s),this.k(t,null)}rollBackPosition(t,s){if(void 0===this.L||!this.L.has(s))return;const i=this.L.get(s),{translate:h,axes:e,numberOfPassedElm:n}=i.pop(),r={x:h.x-this.translate.x,y:h.y-this.translate.y};let o=0;const l={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:l.x*n,y:l.y*n})):(o=l[e]*n,this.DOMGrid[e]+=o),this.V(t,r,!0,o),0===i.length)return this.L.delete(s),void(0===this.L.size&&(this.L=void 0));this.rollBackPosition(t,s)}hasTransformedFromOrigin(){return this.C.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t){this.L=void 0,this.translate.setAxes(0,0),this.F=!1,this.DOMOrder.self=this.VDOMOrder.self,O(t,"transform"),function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)}(t,"style"),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:N.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof f?this.translate:null,order:this.VDOMOrder,initialPosition:this.C.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.F,isVisible:this.N}}}class F extends N{static getDistance(t,s,i){let h=t[i]-s.rect["x"===i?"left":"top"];return h+=s.translate[i],h}static getDisplacement(t,s,i){return t[i]-("x"===i?s.rect.right:s.rect.bottom)}getDisplacement(t,s){return F.getDisplacement(this.rect.getPosition(),t,s)}getDistance(t,s){return F.getDistance(this.rect.getPosition(),t,s)}}const L=/(auto|scroll|overlay)/;function z(t){const s=b(t),i=[void 0,!1,new m(!1,!1)],h=function(t,h){let e=0,n=t;try{do{if(e+=1,e>1&&((t,s,i)=>{const h=P(t,"overflow-x"),e=P(t,"overflow-y");if("absolute"===s&&"static"===b(t))return!1;const[,,n]=i,r=(s,i)=>((t,s,i,h)=>{if(L.test(s)){const s=function(t,s){return"y"===s?t.scrollHeight>t.clientHeight:t.scrollWidth>t.clientWidth}(i,t);if(s)return h[t]=!0,!0}return!1})(s,i,t,n);return r("y",e)||r("x",h)})(n,s,i))return e=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{e=0}return null}(t);return h&&"fixed"!==s?i[0]=h:(i[0]=document.documentElement,i[1]=!0),i}const q={horizontal:25,vertical:25},C={horizontal:10,vertical:10};class ${static getType(){return"scroll:container"}constructor(t,s,i,h){this.X=s,this.U=h,this.W={inner:{threshold:null,key:`scroll_inner_${s}`},outer:{threshold:null,key:`scroll_outer_${s}`}},this.Y=`scroll__${s}`,[this.J,this.K,this.hasOverflow]=z(t),this.totalScrollRect=new d(0,0,0,0),this.visibleScrollRect=new d(0,0,0,0),this.Z(),this.tt=i>10,this.K?this.st():this.it(),this.ht(!0)}hasDynamicVisibility(){return this.tt&&this.hasOverflow.isOneTruthy()}et(t,s){const i=this.W[t];if(!s)return void(i.threshold&&(i.threshold.destroy(),i.threshold=null));const h=new p(s);i.threshold=h,h.setMainThreshold(i.key,this.visibleScrollRect,"inner"===t)}nt(t,s){const i=this.Y,h=s.toString(),e=this.K?document.body:this.J;t?e.dataset[i]=h:delete e.dataset[i]}it(){if(this.hasOverflow.isAllFalsy())return this.et("inner",null),this.et("outer",null),void this.nt(!1,!0);this.nt(!0,!0),this.et("inner",null),this.et("inner",C),this.hasDynamicVisibility()&&(this.et("outer",null),this.et("outer",q))}st(){const t=(t,s)=>function(t,s,i,h=!1){const e=c(i);return t[e]/(h?.5:1)>s[e]}(this.totalScrollRect,this.visibleScrollRect,t,s),s=t("x"),i=t("y");this.hasOverflow.setAxes(s,i),this.it()}Z(){const{scrollHeight:t,scrollWidth:s,scrollLeft:i,scrollTop:h,clientHeight:e,clientWidth:n}=this.J;if(this.totalScrollRect.setByPointAndDimensions(h,i,t,s),this.K)this.visibleScrollRect.setByPointAndDimensions(h,i,e,n);else{const{left:t,top:s}=this.J.getBoundingClientRect();this.visibleScrollRect.setByPointAndDimensions(s,t,e,n)}}rt(t,s,i){return!!this.totalScrollRect.hasEqualPosition(t,s)&&(this.totalScrollRect.setPosition(t,s),i&&(this.J.scrollTop=s,this.J.scrollLeft=t),!0)}scrollTo(t,s){this.rt(-1===t?this.totalScrollRect.left:t,-1===s?this.totalScrollRect.right:s,!0),this.U(this.X)}ot(t){const s=a(t),i=this.totalScrollRect[s],h=function(t){return"x"===t?"right":"bottom"}(t),e=this.totalScrollRect[h],n=c(t);return[i,e,this.visibleScrollRect[n]]}calculateDistance(t,s){const[i,h,e]=this.ot(t);return 1===s?h-(i+e):i}hasScrollableArea(t,s){const[i,h,e]=this.ot(t);return 1===s?i+e<h:i>0}lt=y((()=>{const{scrollLeft:t,scrollTop:s}=this.J;this.rt(t,s,!1)&&this.U(this.X)}));ut=y((()=>{this.Z(),this.st()}));ht(t){const s=t?"addEventListener":"removeEventListener",i=this.K?window:this.J,h={passive:!0};i[s]("resize",this.ut,h),i[s]("scroll",this.lt,h)}pauseListeners(t){t?this.lt.pause():this.lt.resume()}getMaximumScrollContainerLeft(){const{left:t,width:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.left}getMaximumScrollContainerTop(){const{top:t,height:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.top}getElmViewportPosition(t,s){const{top:i,left:h}=this.totalScrollRect;return[t-i,s-h]}isElmOutViewport(t){let s,i;if(t instanceof d){const[h,e]=this.getElmViewportPosition(t.top,t.left);s=new n(h,e+t.width,h+t.height,e),i=this.W.outer}else s=t,i=this.W.inner;const{threshold:h,key:e}=i;return[h.isOutThreshold(e,s,this.hasOverflow.y?"y":"x"),h.isOut[e]]}ct(){const{height:t,width:s}=this.visibleScrollRect;return{height:t,width:s}}getSerializedInstance(){return{type:$.getType(),version:3,key:this.X,hasOverFlow:this.hasOverflow.getInstance(),hasDocumentAsContainer:this.K,scrollRect:this.totalScrollRect.getBox(),scrollContainerRect:this.visibleScrollRect.getBox(),visibleScreen:this.ct()}}destroy(){this.ht(!1),this.et("inner",null),this.et("outer",null),this.nt(!1,!0),this.U=void 0,this.J=void 0}}exports.DFlexBaseElement=A,exports.DFlexElement=F,exports.DFlexParentContainer=class{constructor(t,s,i,h){this.id=t,this.dt=new f(-1,-1),this.grid=new f(-1,-1),this.originLength=i,this.ft=new n(0,0,0,0),this.gt=null;const{left:e,top:r}=h;this.xt=g(s,e,r),this.lastElmPosition=null}yt(t){const s=this.ft;return s.isPositionedY(t)?(this.dt.y+=1,this.dt.x=0,this.ft.setBox(0,0,0,0)):this.dt.x+=1,this.dt.x>this.grid.x&&(this.grid.x=this.dt.x),this.dt.y>this.grid.y&&(this.grid.y=this.dt.y),s.assignBiggestBox(t),this.dt}register(t,s){this.gt?this.gt.assignBiggestBox(t):this.gt=new n(t.top,t.right,t.bottom,t.left);const i=this.yt(t),h=this.gt,e=s;if(!e)return i;const r=h.bottom-h.top,o=h.right-h.left;return e.height<r&&(e.height=r),e.width<o&&(e.width=r),i}extendGrid(t){this.grid[t]+=1}reduceGrid(t){this.grid[t]-=1}getBoundaries(){return this.gt||this.xt.getBox()}resetIndicators(t){this.dt.setAxes(-1,-1),this.grid.setAxes(-1,-1),this.originLength=t,this.ft.setBox(0,0,0,0),this.gt=null,this.lastElmPosition=null}preservePosition(t){this.lastElmPosition?this.lastElmPosition.setAxes(t.x,t.y):this.lastElmPosition=new f(t.x,t.y)}},exports.DFlexScrollContainer=$;
class t{constructor(t,s){this.x=t,this.y=s}}class s extends t{setAxes(t,s){this.x=t,this.y=s}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,s){return this.x===t&&this.y===s}isNotEqual(t,s){return this.x!==t||this.y!==s}}class i{constructor(t,s,i,h){this.top=t,this.right=s,this.bottom=i,this.left=h}}class h extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,h){return this.top=t,this.right=s,this.bottom=i,this.left=h,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,s,i){"x"===t?(this.left=s,this.right=i):(this.top=s,this.bottom=i)}setOne(t,s,i){"x"===t?-1===s?this.left=i:this.right=i:-1===s?this.top=i:this.bottom=i}getOne(t,s){return"x"===t?-1===s?this.left:this.right:-1===s?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,s){this.top=s,this.left=t}hasEqualPosition(t,s){return this.top===s||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends h{constructor(t,s,i,h){super(t,s,i,h)}setFalsy(){return this.setBox(!1,!1,!1,!1),this}isTruthyByAxis(t){return"x"===t?this.left||this.right:this.top||this.bottom}isTruthyOnSide(t,s){return"x"===t?1===s?this.right:this.left:1===s?this.bottom:this.top}isTruthy(){return this.left||this.right||this.top||this.bottom}}class n extends h{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}l(t){return this.top<t.top}u(t){return this.right>t.right}m(t){return this.bottom>t.bottom}p(t){return this.left<t.left}T(t){return this.top>=t.top}_(t){return this.right<=t.right}O(t){return this.bottom<=t.bottom}v(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,s,i){if(s.setBox(!1,!1,!1,!1),i){if("y"===i){const i=this.l(t),h=this.m(t);return i&&(s.top=!0),h&&(s.bottom=!0),i||h}const h=this.p(t),e=this.u(t);return h&&(s.left=!0),e&&(s.right=!0),h||e}return this.l(t)?(s.top=!0,!0):this.u(t)?(s.right=!0,!0):this.m(t)?(s.bottom=!0,!0):!!this.p(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this.T(t)&&this._(t)&&this.O(t)&&this.v(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:s,left:i,right:h,bottom:e}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),h>this.right&&(this.right=h),e>this.bottom&&(this.bottom=e)}}function r(){}const o="height",l="width",u="position";function c(t){return"x"===t?l:o}function a(t){return"x"===t?"left":"top"}class d extends n{constructor(t,s,i,h){super(t,s,i,h),this.width=s-h,this.height=i-t}setByPointAndDimensions(t,s,i,h){this.top=t,this.left=s,this.width=h,this.height=i,this.right=s+h,this.bottom=t+i}setAxes(t,s){this.left=t,this.right=this.width+t,this.top=s,this.bottom=this.height+s}getDimensionDiff(t,s){const i=c(t);return this[i]-s[i]}getPositionDiff(t,s){return this[a(t)]-s[t]}}class f extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:h,bottom:e,right:r}=t;return s?new n(i+this.y,r-this.x,e-this.y,h+this.x):new n(i-this.y,r+this.x,e+this.y,h-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}class m extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}}class p{constructor(t){this.P=t,this.thresholds={},this.isOut={}}D({width:t,height:s}){const i=Math.round(this.P.horizontal*t/100),h=Math.round(this.P.vertical*s/100);this.A=new f(i,h)}S(t,s,i){this.thresholds[t]=this.A.composeBox(s,i),this.isOut[t]=new e(!1,!1,!1,!1)}I(t,s){const i=`${s}`;this.thresholds[i]?this.thresholds[s].assignBiggestBox(this.thresholds[t]):this.S(i,this.thresholds[t],!1)}setMainThreshold(t,s,i){this.D(s),this.S(t,s,i)}updateMainThreshold(t,s,i){this.thresholds[t]=this.A.composeBox(s,i),this.isOut[t].setFalsy()}getElmMainThreshold(t){return this.A.composeBox(t,!1)}setContainerThreshold(t,s,i,h,e){this.S(t,h,!1);const{top:n,left:r}=h,{height:o,width:l}=e;this.S(s,{left:r,top:n,right:r+l,bottom:n+o},!1),this.I(s,i)}isOutThreshold(t,s,i){return s.isOutThreshold(this.thresholds[t],this.isOut[t],i)}destroy(){Object.keys(this.thresholds).forEach((t=>{delete this.thresholds[t]})),Object.keys(this.isOut).forEach((t=>{delete this.isOut[t]}))}}function g(t,s,i){const{left:h,top:e,right:n,bottom:r,height:o,width:l}=t.getBoundingClientRect(),u=new d(e,n,r,h);return 0===s&&0===i||u.setByPointAndDimensions(e+i,h+s,o,l),u}function x(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,h){h&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function y(t,s=!1,i=200){const[h,e]=function(t){let s=null,i=!1;function h(){s&&(clearTimeout(s),s=null)}return[function(e,n){const o=e||r;i=!0,n&&h(),s=setTimeout((()=>{i=!1,o()}),t)},h,function(){return i}]}(i),[n,o]=x();let l=performance.now(),u=!1;const c=()=>{if(u)return;const e=performance.now();s||e-l>=i?(n(t,!0),l=e):h(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,o(),e())},c.resume=()=>{u&&(u=!1,c())},c}const w=Object.freeze(["x","y"]);let T=new WeakMap;function _(t,s,i){t.style.setProperty(s,i)}function O(t,s){t.style.removeProperty(s)}function v(t,s,i){const h=function(t){if(T.has(t))return T.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return T.set(t,s),s}(t),{parsedProperties:e,computedStyle:n}=h,r=e.get(s);if(void 0===r){const t=n.getPropertyValue(s),h=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return e.set(s,h),h}return r}function b(t){return v(t,u,!1)}function P(t,s){return v(t,s,!1)}const D=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function E(t,s,i){_(t,"transform",`translate3d(${s}px, ${i}px, 0)`)}class A{static getType(){return"base:element"}static transform=E;constructor(t){this.id=t,this.translate=new f(0,0),this.M=new Set}setAttribute(t,s,i){"INDEX"!==s?this.M.has(s)||(t.setAttribute(D[s],`${i}`),this.M.add(s)):t.setAttribute(D[s],`${i}`)}removeAttribute(t,s){"INDEX"!==s&&this.M.has(s)&&(t.removeAttribute(D[s]),this.M.delete(s))}clearAttributes(t){this.M.forEach((s=>{this.removeAttribute(t,s)})),this.M.clear()}}const S="transition-property",I="transition-delay",M="transition-duration",B="transition-timing-function";const R="transitionend";class N extends A{static getType(){return"core:element"}constructor(t){const{order:s,keys:i,depth:h,readonly:e,animation:n,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...s},this.DOMOrder={...s},this.keys={...i},this.depth=h,this.readonly=e,this.B=n,this.R=o,[this.N]=x(),this.F=!0,this.L=!1,this.q=void 0,this.C=null,this.$=new f(0,0),this.rect=new d(0,0,0,0),this.DOMGrid=new f(0,0)}updateConfig(t,s,i){this.readonly=t,this.B=s,this.R=i}initElmRect(t,s,i){this.rect=g(t,s,i);const{left:h,top:e}=this.rect;this.$.setAxes(h,e),this.k(t)}k(t){const s=function(t){const s=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const s=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return s?[parseFloat(s[5]),parseFloat(s[6])]:null}(v(t,"transform",!1));return s}(t);if(s){const[t,i]=s,h=this.$.x-t,e=this.$.y-i;this.$.setAxes(h,e),this.rect.setByPointAndDimensions(e,h,this.rect.height,this.rect.width),this.translate.setAxes(t,i)}}getDimensions(t){if(this.C)return this.C;const{width:s,height:i}=function(t){return{width:v(t,l,!0),height:v(t,o,!0)}}(t);return this.C=new f(s,i),this.C}getInitialPosition(){return this.$}changeVisibility(t,s){s!==this.F&&(this.F=s,this.L&&this.F&&(this.j(t,null),this.L=!1))}j(t,s,i=r){if(!this.F)return void(this.L=!0);const h=()=>{this.R&&function(t,s){"string"!=typeof s?function(t,s){Object.keys(s).forEach((s=>{O(t,s)}))}(t,s):function(t,s){t.classList.remove(s)}(t,s)}(t,this.R),this.B&&function(t){O(t,S),O(t,I),O(t,M),O(t,B)}(t),s&&t.removeEventListener(R,h),i()};this.N((()=>{if(this.R&&function(t,s){"string"!=typeof s?function(t,s){Object.entries(s).forEach((([s,i])=>{_(t,s,i)}))}(t,s):function(t,s){t.classList.add(s)}(t,s)}(t,this.R),null===s)return N.transform(t,this.translate.x,this.translate.y),void h();t.addEventListener(R,h),function(t,s,i,h){_(t,S,"transform"),_(t,I,"0ms"),_(t,M,`${i}ms`),_(t,B,h)}(t,0,s,this.B.easing),N.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,s){this.setAttribute(t,"INDEX",s),this.VDOMOrder.self=s}assignNewIndex(t,s){t[s]=this.id}G(t,s,i){const h={axes:t,numberOfPassedElm:i,translate:this.translate.getInstance()};void 0===this.q&&(this.q=new Map),this.q.has(s)||this.q.set(s,[]),this.q.get(s).push(h)}V(t,s,i){if(s)return!this.F&&this.L?void(this.L=!1):void this.j(t,i);this.F?this.j(t,i):this.L=!0}H(t,s,i,h){let e=null;if(this.B){const{duration:t}=this.B,i=this.translate.getInstance(),h=this.translate.increase(s).getInstance();e="number"==typeof t?t:function(t,s){const i=t.x-s.x,h=t.y-s.y,e=Math.sqrt(i*i+h*h);return 20*Math.sqrt(e)}(i,h)}else this.translate.increase(s);this.rect.setAxes(this.$.x+this.translate.x,this.$.y+this.translate.y),this.V(t,i,e);const{self:n}=this.VDOMOrder,r=n+h;return this.updateIndex(t,r),[n,r]}X(t,s,i){if(-1!==t)for(let t=0;t<s;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>i.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<s;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=i.x,this.DOMGrid.y-=1)}reconcilePosition(t,s,i,h,e,n,r,o){let l;const u={x:1===s?-1:1,y:s};"z"===t?l=w:(l=[t],u[t]=s),l.forEach((t=>{e[t]*=u[t],this.X(u[t],n,r)})),this.G(t,o,n);const c=s*n,[a,d]=this.H(i,e,!1,c);h[a]="",h[d]=this.id}restorePosition(t){this.j(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,s){this.translate.clone(s),this.j(t,null)}rollBackPosition(t,s){if(void 0===this.q||!this.q.has(s))return;const i=this.q.get(s),{translate:h,axes:e,numberOfPassedElm:n}=i.pop(),r={x:h.x-this.translate.x,y:h.y-this.translate.y};let o=0;const l={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:l.x*n,y:l.y*n})):(o=l[e]*n,this.DOMGrid[e]+=o),this.H(t,r,!0,o),0===i.length)return this.q.delete(s),void(0===this.q.size&&(this.q=void 0));this.rollBackPosition(t,s)}hasTransformedFromOrigin(){return this.$.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t){this.q=void 0,this.translate.setAxes(0,0),this.L=!1,this.DOMOrder.self=this.VDOMOrder.self,O(t,"transform"),function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)}(t,"style"),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:N.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof f?this.translate:null,order:this.VDOMOrder,initialPosition:this.$.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.L,isVisible:this.F}}}class F extends N{static getDistance(t,s,i){let h=t[i]-s.rect["x"===i?"left":"top"];return h+=s.translate[i],h}static getDisplacement(t,s,i){return t[i]-("x"===i?s.rect.right:s.rect.bottom)}getDisplacement(t,s){return F.getDisplacement(this.rect.getPosition(),t,s)}getDistance(t,s){return F.getDistance(this.rect.getPosition(),t,s)}}const L=/(auto|scroll|overlay)/;function z(t){const s=b(t),i=[void 0,!1,new m(!1,!1)],h=function(t,h){let e=0,n=t;try{do{if(e+=1,e>1&&((t,s,i)=>{const h=P(t,"overflow-x"),e=P(t,"overflow-y");if("absolute"===s&&"static"===b(t))return!1;const[,,n]=i,r=(s,i)=>((t,s,i,h)=>{if(L.test(s)){const s=function(t,s){return"y"===s?t.scrollHeight>t.clientHeight:t.scrollWidth>t.clientWidth}(i,t);if(s)return h[t]=!0,!0}return!1})(s,i,t,n);return r("y",e)||r("x",h)})(n,s,i))return e=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{e=0}return null}(t);return h&&"fixed"!==s?i[0]=h:(i[0]=document.documentElement,i[1]=!0),i}const q={horizontal:25,vertical:25},C={horizontal:10,vertical:10};class ${static getType(){return"scroll:container"}constructor(t,s,i,h){this.U=s,this.W=h,this.Y={inner:{threshold:null,key:`scroll_inner_${s}`},outer:{threshold:null,key:`scroll_outer_${s}`}},this.J=`scroll__${s}`,[this.K,this.Z,this.hasOverflow]=z(t),this.totalScrollRect=new d(0,0,0,0),this.visibleScrollRect=new d(0,0,0,0),this.tt(),this.st=i>10,this.Z?this.it():this.ht(),this.et(!0)}hasDynamicVisibility(){return this.st&&this.hasOverflow.isOneTruthy()}nt(t,s){const i=this.Y[t];if(!s)return void(i.threshold&&(i.threshold.destroy(),i.threshold=null));const h=new p(s);i.threshold=h,h.setMainThreshold(i.key,this.visibleScrollRect,"inner"===t)}rt(t,s){const i=this.J,h=s.toString(),e=this.Z?document.body:this.K;t?e.dataset[i]=h:delete e.dataset[i]}ht(){if(this.hasOverflow.isAllFalsy())return this.nt("inner",null),this.nt("outer",null),void this.rt(!1,!0);this.rt(!0,!0),this.nt("inner",null),this.nt("inner",C),this.hasDynamicVisibility()&&(this.nt("outer",null),this.nt("outer",q))}it(){const t=(t,s)=>function(t,s,i,h=!1){const e=c(i);return t[e]/(h?.5:1)>s[e]}(this.totalScrollRect,this.visibleScrollRect,t,s),s=t("x"),i=t("y");this.hasOverflow.setAxes(s,i),this.ht()}tt(){const{scrollHeight:t,scrollWidth:s,scrollLeft:i,scrollTop:h,clientHeight:e,clientWidth:n}=this.K;if(this.totalScrollRect.setByPointAndDimensions(h,i,t,s),this.Z)this.visibleScrollRect.setByPointAndDimensions(h,i,e,n);else{const{left:t,top:s}=this.K.getBoundingClientRect();this.visibleScrollRect.setByPointAndDimensions(s,t,e,n)}}ot(t,s,i){return!!this.totalScrollRect.hasEqualPosition(t,s)&&(this.totalScrollRect.setPosition(t,s),i&&(this.K.scrollTop=s,this.K.scrollLeft=t),!0)}scrollTo(t,s){this.ot(-1===t?this.totalScrollRect.left:t,-1===s?this.totalScrollRect.right:s,!0),this.W(this.U)}lt(t){const s=a(t),i=this.totalScrollRect[s],h=function(t){return"x"===t?"right":"bottom"}(t),e=this.totalScrollRect[h],n=c(t);return[i,e,this.visibleScrollRect[n]]}calculateDistance(t,s){const[i,h,e]=this.lt(t);return 1===s?h-(i+e):i}hasScrollableArea(t,s){const[i,h,e]=this.lt(t);return 1===s?i+e<h:i>0}ut=y((()=>{const{scrollLeft:t,scrollTop:s}=this.K;this.ot(t,s,!1)&&this.W(this.U)}));ct=y((()=>{this.tt(),this.it()}));et(t){const s=t?"addEventListener":"removeEventListener",i=this.Z?window:this.K,h={passive:!0};i[s]("resize",this.ct,h),i[s]("scroll",this.ut,h)}pauseListeners(t){t?this.ut.pause():this.ut.resume()}getMaximumScrollContainerLeft(){const{left:t,width:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.left}getMaximumScrollContainerTop(){const{top:t,height:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.top}getElmViewportPosition(t,s){const{top:i,left:h}=this.totalScrollRect;return[t-i,s-h]}isElmOutViewport(t){let s,i;if(t instanceof d){const[h,e]=this.getElmViewportPosition(t.top,t.left);s=new n(h,e+t.width,h+t.height,e),i=this.Y.outer}else s=t,i=this.Y.inner;const{threshold:h,key:e}=i;return[h.isOutThreshold(e,s,this.hasOverflow.y?"y":"x"),h.isOut[e]]}dt(){const{height:t,width:s}=this.visibleScrollRect;return{height:t,width:s}}getSerializedInstance(){return{type:$.getType(),version:3,key:this.U,hasOverFlow:this.hasOverflow.getInstance(),hasDocumentAsContainer:this.Z,scrollRect:this.totalScrollRect.getBox(),scrollContainerRect:this.visibleScrollRect.getBox(),visibleScreen:this.dt()}}destroy(){this.et(!1),this.nt("inner",null),this.nt("outer",null),this.rt(!1,!0),this.W=void 0,this.K=void 0}}exports.DFlexBaseElement=A,exports.DFlexElement=F,exports.DFlexParentContainer=class{constructor(t,s,i,h){this.id=t,this.ft=new f(-1,-1),this.grid=new f(-1,-1),this.originLength=i,this.gt=new n(0,0,0,0),this.xt=null;const{left:e,top:r}=h;this.yt=g(s,e,r),this.lastElmPosition=null}wt(t){const s=this.gt;return s.isPositionedY(t)?(this.ft.y+=1,this.ft.x=0,this.gt.setBox(0,0,0,0)):this.ft.x+=1,this.ft.x>this.grid.x&&(this.grid.x=this.ft.x),this.ft.y>this.grid.y&&(this.grid.y=this.ft.y),s.assignBiggestBox(t),this.ft}register(t,s){this.xt?this.xt.assignBiggestBox(t):this.xt=new n(t.top,t.right,t.bottom,t.left);const i=this.wt(t),h=this.xt,e=s;if(!e)return i;const r=h.bottom-h.top,o=h.right-h.left;return e.height<r&&(e.height=r),e.width<o&&(e.width=r),i}extendGrid(t){this.grid[t]+=1}reduceGrid(t){this.grid[t]-=1}getBoundaries(){return this.xt||this.yt.getBox()}resetIndicators(t){this.ft.setAxes(-1,-1),this.grid.setAxes(-1,-1),this.originLength=t,this.gt.setBox(0,0,0,0),this.xt=null,this.lastElmPosition=null}preservePosition(t){this.lastElmPosition?this.lastElmPosition.setAxes(t.x,t.y):this.lastElmPosition=new f(t.x,t.y)}},exports.DFlexScrollContainer=$;
{
"name": "@dflex/core-instance",
"version": "3.9.6",
"version": "3.9.7",
"description": "Core instance is a DFlex package for interactive DOM element",

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

"devDependencies": {
"@dflex/utils": "^3.9.6"
"@dflex/utils": "^3.9.7"
},

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

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

export type { DFlexSerializedElement, DFlexElementInput, DFlexDOMGenOrder, } from "./Element";
export { DFlexElement, DFlexBaseElement } from "./Element";
export { DFlexParentContainer, DFlexScrollContainer } from "./Container";
export type { DFlexSerializedScroll } from "./Container";
declare class AxesPoint<T = number> {
x: T;
y: T;
constructor(x: T, y: T);
}
declare class Point<T> extends AxesPoint<T> {
/**
* Assigns the given values to the local instance.
*
* @param x
* @param y
*/
setAxes(x: T, y: T): void;
/**
* Clone a given point into local instance.
*
* @param target
*/
clone(target: Point<T> | AxesPoint<T>): void;
/**
* Get local instance of point.
*
* @returns
*/
getInstance(): AxesPoint<T>;
/**
* True when both axes match the same value.
*
* @param target
* @returns
*/
isInstanceEqual(target: Point<T> | AxesPoint<T>): boolean;
/**
* True when both axes match the same value.
*
* @param x
* @param y
* @returns
*/
isEqual(x: T, y: T): boolean;
/**
* True when both axes doesn't match the given value.
*
* @param x
* @param y
* @returns
*/
isNotEqual(x: T, y: T): boolean;
}
/** Four direction instance - clockwise */
declare class AbstractBox<T = number> {
/** Minimal `Y` coordinate */
top: T;
/** Maximal `X` coordinate */
right: T;
/** Maximal `Y` coordinate */
bottom: T;
/** Minimal `X` coordinate */
left: T;
/**
*
* @param top - minimal y coordinate
* @param right - maximal x coordinate
* @param bottom - maximal y coordinate
* @param left - minimal x coordinate
*/
constructor(top: T, right: T, bottom: T, left: T);
}
interface Dimensions {
height: number;
width: number;
}
type Direction = 1 | -1;
/** Single Axis. */
type Axis = "x" | "y";
/** Bi-directional Axis. */
type Axes = Axis | "z";
type CubicBezier = "ease" | "ease-in" | "ease-out" | "ease-in-out" | "linear";
type AnimationOpts = {
/**
* The easing function to use for the animation.
* Specifies the speed curve of the animation.
* Example values: 'linear', 'ease-in', 'ease-out', 'ease-in-out'.
* (Default: 'ease-in')
*/
easing: CubicBezier;
/**
* The duration of the animation in milliseconds.
* Specifies how long the animation should take to complete.
* (Default: 'dynamic')
*/
duration: number | "dynamic";
} | null;
type CSSStyle = Record<string, string | null>;
type CSSClass = string;
/** Four direction instance - clockwise */
declare class Box<T> extends AbstractBox<T> {
clone(box: AbstractBox<T>): void;
/**
* Set all directions.
*
* @param top
* @param right
* @param bottom
* @param left
*/
setBox(top: T, right: T, bottom: T, left: T): this;
/**
* Get an instance of FourDirections.
*
* @returns
*/
getBox(): AbstractBox<T>;
/**
* Set one axis only.
*
* @param axis
* @param x
* @param y
*/
setByAxis(axis: Axis, x: T, y: T): void;
/**
* Set one direction only.
*
* @param axis
* @param direction
* @param value
*/
setOne(axis: Axis, direction: Direction, value: T): void;
/**
* Get the value of one direction.
*
* @param axis
* @param direction
* @returns
*/
getOne(axis: Axis, direction: Direction): T;
setPositionInstance(point: AxesPoint<T>): void;
setPosition(x: T, y: T): void;
hasEqualPosition(x: T, y: T): boolean;
/**
* Get starting point instance.
*
* @returns
*/
getPosition(): AxesPoint<T>;
}
declare class BoxBool extends Box<boolean> {
constructor(top: boolean, right: boolean, bottom: boolean, left: boolean);
/**
* Reset all directions to false.
*
* @returns
*/
setFalsy(): this;
/**
* True when one of two directions in a given axis is true.
*
* @param axis
* @returns
*/
isTruthyByAxis(axis: Axis): boolean;
isTruthyOnSide(axis: Axis, direction: Direction): boolean;
/**
* True when one of four directions is true.
*
* @returns
*/
isTruthy(): boolean;
}
declare class BoxNum extends Box<number> {
private _isUnder;
private _isAbove;
private _isOnLeft;
private _isOneRight;
private _isAboveThresholdTop;
private _isRightOfThresholdRight;
private _isBelowThresholdBottom;
private _isLeftOfThresholdLeft;
private _isBelowOrEqualThresholdTop;
private _isLeftOrEqualThresholdRight;
private _isAboveOrEqualThresholdBottom;
private _isRightOrEqualThresholdLeft;
isBoxIntersect(box: AbstractBox): boolean;
isOutThreshold(threshold: AbstractBox, preservedBoxResult: BoxBool, axis: Axis | null): boolean;
isInsideThreshold(threshold: AbstractBox): boolean;
getSurroundingBox(box: AbstractBox): AbstractBox;
isPositionedY(box: AbstractBox): boolean;
assignBiggestBox(box: AbstractBox): void;
}
type AbstractBoxRect = AbstractBox & Dimensions;
declare class BoxRect extends BoxNum {
width: number;
height: number;
/**
* clockwise
*
* @param top
* @param right
* @param bottom
* @param left
*/
constructor(top: number, right: number, bottom: number, left: number);
/**
*
* @param top
* @param left
* @param height
* @param width
* @returns
*/
setByPointAndDimensions(top: number, left: number, height: number, width: number): void;
/**
* Update the box point position.
*
* @param x
* @param y
* @returns
*/
setAxes(x: number, y: number): void;
/**
* Gets the width/height difference between two boxes based on axis.
*
* @param axis
* @param box
* @returns
*/
getDimensionDiff(axis: Axis, box: AbstractBoxRect): number;
/**
* Gets the left/top difference between two points based on axis.
*
* @param axis
* @param point
* @returns
*/
getPositionDiff(axis: Axis, point: AxesPoint): number;
}
declare class PointNum extends Point<number> {
/**
* Increase the current point by the given another point.
*
* @param point
*/
increase(point: AxesPoint): this;
composeBox(box: AbstractBox, isInner: boolean): BoxNum;
onSameAxis(axis: Axis, point: AxesPoint): boolean;
}
declare class PointBool extends Point<boolean> {
/**
* True when both points X and Y are true.
* @returns
*/
isOneTruthy(): boolean;
/**
* True when one point is false.
* @returns
*/
isAllFalsy(): boolean;
/**
* Set both x and y to false.
*/
setFalsy(): void;
}
declare const DFLEX_ATTRIBUTES: Readonly<{
DRAGGED: "dragged";
INDEX: "data-index";
OUT_POS: "data-dragged-out-position";
OUT_CONTAINER: "data-dragged-out-container";
}>;
type AllowedAttributes = keyof typeof DFLEX_ATTRIBUTES;
declare function transform(DOM: HTMLElement, x: number, y: number): void;
declare class DFlexBaseElement {
id: string;
translate: PointNum;
private _hasAttribute?;
static getType(): string;
static transform: typeof transform;
constructor(id: string);
setAttribute(DOM: HTMLElement, key: AllowedAttributes, value: string | number): void;
removeAttribute(DOM: HTMLElement, key: AllowedAttributes): void;
clearAttributes(DOM: HTMLElement): void;
}
type DFlexSerializedElement = {
type: string;
version: 3;
id: string;
translate: PointNum | null;
grid: PointNum;
order: DFlexDOMGenOrder;
initialPosition: AxesPoint;
rect: AbstractBoxRect;
hasTransformedFromOrigin: boolean;
hasPendingTransformation: boolean;
isVisible: boolean;
};
/**
* Element unique keys in DOM tree.
*/
interface Keys {
BK: string;
SK: string;
PK: string;
CHK: string | null;
}
/**
* Element order in its branch & higher branch
*/
interface DFlexDOMGenOrder {
self: number;
parent: number;
}
type CSS = CSSClass | CSSStyle;
interface DFlexElementInput {
id: string;
order: DFlexDOMGenOrder;
keys: Keys;
depth: number;
readonly: boolean;
animation: AnimationOpts;
CSSTransform: CSS | null;
}
declare class DFlexCoreElement extends DFlexBaseElement {
/**
* The initial position of the element before any transformations. This value
* is not updated during regular operations, only when the element undergoes
* reconciliation.
*/
private _initialPosition;
/**
* The bounding box rectangle representing the element's position and
* dimensions.
* This value is updated with each transformation, ensuring it reflects the
* current state, even if the element is not yet reconciled.
*/
rect: BoxRect;
private _computedDimensions;
VDOMOrder: DFlexDOMGenOrder;
DOMOrder: DFlexDOMGenOrder;
keys: Keys;
depth: number;
DOMGrid: PointNum;
private _isVisible;
private _hasPendingTransform;
readonly: boolean;
private _RAF;
private _animation;
private _CSSTransform;
private _translateHistory?;
static getType(): string;
constructor(eleWithPointer: DFlexElementInput);
updateConfig(readonly: boolean, animation: AnimationOpts, CSSTransform: CSS | null): void;
initElmRect(DOM: HTMLElement, scrollLeft: number, scrollTop: number): void;
private _initElmTranslate;
getDimensions(DOM: HTMLElement): PointNum;
getInitialPosition(): PointNum;
changeVisibility(DOM: HTMLElement, isVisible: boolean): void;
private _transform;
updateIndex(DOM: HTMLElement, i: number): void;
assignNewIndex(siblings: string[], newIndex: number): void;
private _pushToTranslateHistory;
private _transformOrPend;
private _transformationProcess;
private _updateDOMGridOnAxes;
/**
*
* @param DOM
* @param siblings
* @param mainAxisDirection
* @param elmTransition
* @param cycleID
* @param axis
*/
reconcilePosition(axis: Axes, mainAxisDirection: Direction, DOM: HTMLElement, siblings: string[], elmTransition: AxesPoint, numberOfPassedElm: number, maxContainerGridBoundaries: PointNum, cycleID: string): void;
restorePosition(DOM: HTMLElement): void;
assignNewPosition(DOM: HTMLElement, t: PointNum): void;
/**
* Roll back element position.
*
* @param cycleID
*/
rollBackPosition(DOM: HTMLElement, cycleID: string): void;
hasTransformedFromOrigin(): boolean;
needDOMReconciliation(): boolean;
refreshIndicators(DOM: HTMLElement): void;
getSerializedInstance(): DFlexSerializedElement;
}
declare class DFlexElement extends DFlexCoreElement {
static getDistance(currentPosition: AxesPoint, elm: DFlexElement, axis: Axis): number;
static getDisplacement(currentPosition: AxesPoint, elm: DFlexElement, axis: Axis): number;
getDisplacement(elm: this, axis: Axis): number;
getDistance(elm: this, axis: Axis): number;
}
declare class DFlexParentContainer {
private _boundariesByRow;
/** Strict Rect for siblings containers. */
private _siblingBoundaries;
private _rect;
/** Numbers of total columns and rows each container has. */
private _gridIndex;
grid: PointNum;
/**
* Origin length for container before being transformed used to prevent
* layout shift.
* */
originLength: number;
id: string;
/**
* Preserve the last element position in the list .
* Usage: Getting this position when the dragged is going back from the tail.
*/
lastElmPosition: PointNum;
constructor(id: string, DOM: HTMLElement, originLength: number, scroll: BoxRect);
private _addNewElmToGridIndicator;
register(rect: AbstractBox, unifiedContainerDimensions?: Dimensions): PointNum;
extendGrid(axis: Axis): void;
reduceGrid(axis: Axis): void;
/**
* If container doesn't have siblings then it returns the container rect.
*
* @returns
*/
getBoundaries(): AbstractBox<number>;
/**
*
* @param originLength
*/
resetIndicators(originLength: number): void;
preservePosition(pos: AxesPoint): void;
}
type ScrollEventCallback = (SK: string) => void;
type DFlexSerializedScroll = {
type: string;
version: 3;
key: string;
hasOverFlow: AxesPoint<boolean>;
hasDocumentAsContainer: boolean;
scrollRect: AbstractBox;
scrollContainerRect: AbstractBox;
visibleScreen: Dimensions;
};
declare class DFlexScrollContainer {
private _thresholdInViewport;
private _SK;
private _scrollEventCallback;
/**
* scroll container in the viewport. Only in the visible area.
*/
visibleScrollRect: BoxRect;
/**
* The entire scroll rect visible and invisible.
*/
totalScrollRect: BoxRect;
hasOverflow: PointBool;
/**
* Determines if the length of the branch exceeds the threshold for being
* considered a candidate for dynamic visibility.
*/
private _isCandidateForDynamicVisibility;
/**
* The parent element that is owning the scroll.
*/
private _containerDOM;
private _isDocumentContainer;
private _listenerDatasetKey;
static getType(): string;
constructor(firstELmDOM: HTMLElement, SK: string, branchLength: number, scrollEventCallback: ScrollEventCallback);
hasDynamicVisibility(): boolean;
private _initializeOrDestroyThreshold;
private _updateDOMDataset;
private _handleOverflowUpdate;
private _updateOverflow;
/**
* Updates the scroll-related rectangles based on the container's dimensions and scroll positions.
* - Updates the overall scroll rectangle representing the entire scrollable content.
* - Calculates the visible scroll rectangle representing the visible portion of the container.
* For document containers, it represents the entire client viewport.
* For non-document containers, it takes into account the container's position.
*/
private _updateScrollRect;
private _updateScrollPosition;
scrollTo(x: number, y: number): void;
private _getNumbersFromPoints;
calculateDistance(axis: Axis, direction: Direction): number;
hasScrollableArea(axis: Axis, direction: Direction): boolean;
private _throttledScrollHandler;
private _throttledResizeHandler;
private _attachResizeAndScrollListeners;
/**
* Pausing and resuming the scroll listener. This method should be associated
* with scrolling animation to prevent the scroll listener from being called
* while scrolling which is causing latency and performance issues.
*
* Note: when listener is off make sure you call `updateInvisibleDistance` to
* keep the the container in sync with the scrollable instance.
*
* @param pause
*/
pauseListeners(pause: boolean): void;
/**
* @deprecated - Should be removed when refactoring retractions.
* @returns
*/
getMaximumScrollContainerLeft(): number;
/**
* @deprecated - Should be removed when refactoring retractions.
* @returns
*/
getMaximumScrollContainerTop(): number;
getElmViewportPosition(elmTopPos: number, elmLeftPos: number): [number, number];
isElmOutViewport(absPos: BoxRect | BoxNum): [boolean, BoxBool];
private _getVisibleScreen;
getSerializedInstance(): DFlexSerializedScroll;
/**
* Clean up the container instances.
*/
destroy(): void;
}
export { DFlexBaseElement, type DFlexDOMGenOrder, DFlexElement, type DFlexElementInput, DFlexParentContainer, DFlexScrollContainer, type DFlexSerializedElement, type DFlexSerializedScroll };

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