@dflex/utils
Advanced tools
Comparing version 3.9.9 to 3.9.10
@@ -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,e){this.top=t,this.right=s,this.bottom=i,this.left=e}}class e extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,e){return this.top=t,this.right=s,this.bottom=i,this.left=e,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 n extends e{constructor(t,s,i,e){super(t,s,i,e)}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 r extends e{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}u(t){return this.top<t.top}l(t){return this.right>t.right}p(t){return this.bottom>t.bottom}m(t){return this.left<t.left}_(t){return this.top>=t.top}T(t){return this.right<=t.right}M(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.u(t),e=this.p(t);return i&&(s.top=!0),e&&(s.bottom=!0),i||e}const e=this.m(t),n=this.l(t);return e&&(s.left=!0),n&&(s.right=!0),e||n}return this.u(t)?(s.top=!0,!0):this.l(t)?(s.right=!0,!0):this.p(t)?(s.bottom=!0,!0):!!this.m(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this._(t)&&this.T(t)&&this.M(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:e,bottom:n}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),e>this.right&&(this.right=e),n>this.bottom&&(this.bottom=n)}}const h={};let o=!1;function u(){}const c=new Set,l="height",a="width",p="position";function x(t){return"x"===t?a:l}function d(t){return"x"===t?"left":"top"}class f extends r{constructor(t,s,i,e){super(t,s,i,e),this.width=s-e,this.height=i-t}setByPointAndDimensions(t,s,i,e){this.top=t,this.left=s,this.width=e,this.height=i,this.right=s+e,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=x(t);return this[i]-s[i]}getPositionDiff(t,s){return this[d(t)]-s[t]}}class g extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:e,bottom:n,right:h}=t;return s?new r(i+this.y,h-this.x,n-this.y,e+this.x):new r(i-this.y,h+this.x,n+this.y,e-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}var m=new class{constructor(){this.B={}}newTravel(t){return void 0===this.B[t]?this.B[t]=0:this.B[t]+=1,`${t}${this.B[t]}`}};function b(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,e){e&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function w(t){let s=null,i=!1;function e(){s&&(clearTimeout(s),s=null)}return[function(n,r){const h=n||u;i=!0,r&&e(),s=setTimeout((()=>{i=!1,h()}),t)},e,function(){return i}]}const[y,_]=w(0);class T{constructor(t,s,i,e,n){this.index=t,this.SK=i,this.id=s,this.cycleID=e,this.hasScroll=n,this.reconciledIDs=new Set,this.numberOfTransformedELm=0,this.marginBottom=null,this.marginTop=null}}const M=Object.freeze(["x","y"]);let O=new WeakMap;function B(t,s,i){t.style.setProperty(s,i)}function S(t,s,i){const e=function(t){if(O.has(t))return O.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return O.set(t,s),s}(t),{parsedProperties:n,computedStyle:r}=e,h=n.get(s);if(void 0===h){const t=r.getPropertyValue(s),e=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return n.set(s,e),e}return h}function A(t){return{width:S(t,a,!0),height:S(t,l,!0)}}const v=/absolute|fixed/;function D(t){return S(t,p,!1)}exports.AbstractBox=i,exports.AxesPoint=t,exports.BOTH_AXIS=M,exports.Box=e,exports.BoxBool=n,exports.BoxNum=r,exports.BoxRect=f,exports.DFlexCreateRAF=b,exports.DFlexCreateTimeout=w,exports.DFlexCycle=class{constructor(t,s,i,e,n){const r=new T(t,s,i,e,n);this.S=[r],this.SKs=[i],this.complete()}latest(){return this.S[this.S.length-1]}prev(){return this.S[this.S.length-2]}getAll(){return this.S}filter(t,s){return this.S.filter(s?s=>t.find((t=>t===s.cycleID)):s=>t.find((t=>t===s.id)))}A(t){this.SKs=this.SKs.filter((s=>!t.has(s)))}flush(t){const s=new Set;this.S=this.S.filter((i=>void 0===t.find((t=>t===i.SK&&(s.add(i.SK),!0)))||(s.has(i.SK)&&s.delete(i.SK),!1))),this.A(s)}pruneSKFromMigration(t){this.S=this.S.filter((s=>s.SK!==t)),this.A(new Set([t]))}setIndex(t){this.latest().index=t,this.latest().numberOfTransformedELm+=1}preserveVerticalMargin(t,s){this.latest()["bottom"===t?"marginBottom":"marginTop"]=s}clearMargin(){this.latest().marginBottom=null,this.latest().marginTop=null}add(t,s,i,e,n,r){this.S.push(new T(t,s,i,n,r)),e?this.SKs.unshift(i):this.SKs.push(i)}updateReconciledIDs(t,s){const i=this.S.find((s=>s.SK===t));i&&(i.reconciledIDs.clear(),s.forEach((t=>i.reconciledIDs.add(t))))}getMigrationBySK(t){return this.S.find((s=>s.SK===t))}getReconciledIDsBySK(t){const s=this.S.find((s=>s.SK===t));return s?s.reconciledIDs:c}start(){this.isTransitioning=!0}complete(){this.isTransitioning=!1,this.preserveVerticalMargin("top",null),this.preserveVerticalMargin("bottom",null)}clear(){this.S=[],this.SKs=[]}},exports.PREFIX_TRACKER_CYCLE="dflex_cycle_",exports.PREFIX_TRACKER_ID="dflex_id_",exports.PREFIX_TRACKER_KY="dflex_ky_",exports.Point=s,exports.PointBool=class extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}},exports.PointNum=g,exports.TaskQueue=class{constructor(){this.v={},this.D=new Set}q(t){Array.isArray(this.v[t])||(this.v[t]=[])}F(t,s,i){this.v[s].push(t),i&&this.D.add(i)}P(t){return!Array.isArray(this.v[t])||0===this.v[t].length}hasElm(t){return this.D.has(t)}enqueueBeforeLast(t,s,i,e){this.q(i);const{length:n}=this.v[i];0===n?this.v[i].push(s):this.v[i][n-1]=s,this.F(t,i,e)}enqueue(t,s,i){this.q(s),this.F(t,s,i)}executeQueue(t){const s=[];if(this.P(t))return s;try{this.v[t].forEach((t=>{const i=t();s.push(i)}))}catch(t){}finally{_(),delete this.v[t]}return s}R(t){y((()=>{const[s,i]=t;this.executeQueue(s),i&&queueMicrotask((()=>this.executeQueue(i))),this.D.clear()}),!0)}scheduleNextTask(t){this.R(t)}cancelQueuedTask(){_()}clear(){_(),this.v={},this.D.clear()}},exports.Threshold=class{constructor(t){this.$=t,this.thresholds={},this.isOut={}}I({width:t,height:s}){const i=Math.round(this.$.horizontal*t/100),e=Math.round(this.$.vertical*s/100);this.k=new g(i,e)}L(t,s,i){this.thresholds[t]=this.k.composeBox(s,i),this.isOut[t]=new n(!1,!1,!1,!1)}j(t,s){const i=`${s}`;this.thresholds[i]?this.thresholds[s].assignBiggestBox(this.thresholds[t]):this.L(i,this.thresholds[t],!1)}setMainThreshold(t,s,i){this.I(s),this.L(t,s,i)}updateMainThreshold(t,s,i){this.thresholds[t]=this.k.composeBox(s,i),this.isOut[t].setFalsy()}getElmMainThreshold(t){return this.k.composeBox(t,!1)}setContainerThreshold(t,s,i,e,n){this.L(t,e,!1);const{top:r,left:h}=e,{height:o,width:u}=n;this.L(s,{left:h,top:r,right:h+u,bottom:r+o},!1),this.j(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]}))}},exports.assertElmPos=function(t,s){if(o)return;const i=t.getBoundingClientRect();Object.keys(s).forEach((t=>{if(Object.prototype.hasOwnProperty.call(i,t)&&i[t]!==s[t])throw o=!0,new Error(`Element position assertion failed. Expected: ${i[t]} found: ${s[t]}`)}))},exports.canUseDOM=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},exports.clearComputedStyleCache=function(){O=new WeakMap},exports.combineKeys=function(t,s){return`${t}_${s}`},exports.eventDebounce=function(t,s=!1,i=200){const[e,n]=w(i),[r,h]=b();let o=performance.now(),u=!1;const c=()=>{if(u)return;const n=performance.now();s||n-o>=i?(r(t,!0),o=n):e(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,h(),n())},c.resume=()=>{u&&(u=!1,c())},c},exports.featureFlags={__proto__:null,enableCommit:!1,enableMechanismDebugger:!1,enableMutationDebugger:!1,enablePositionAssertion:!1,enableReconcileDebugger:!1,enableRegisterDebugger:!1,enableScrollDebugger:!1,enableUndoSiblingsDebugger:!1,enableVisibilityDebugger:!1},exports.getAnimationOptions=function(t){const s={easing:"ease-in",duration:"dynamic"};return void 0===t?s:null===t?null:{...s,...t}},exports.getCachedComputedStyleProperty=S,exports.getDimensionTypeByAxis=x,exports.getElmBoxRect=function(t,s,i){const{left:e,top:n,right:r,bottom:h,height:o,width:u}=t.getBoundingClientRect(),c=new f(n,r,h,e);return 0===s&&0===i||c.setByPointAndDimensions(n+i,e+s,o,u),c},exports.getElmDimensions=A,exports.getElmOverflow=function(t,s){return S(t,s,!1)},exports.getElmPos=D,exports.getEndingPointByAxis=function(t){return"x"===t?"right":"bottom"},exports.getOppositeAxis=function(t){return"x"===t?"y":"x"},exports.getParentElm=function(t,s){let i=0,e=t;try{do{if(i+=1,i>1&&s(e))return i=0,e;e=e.parentElement}while(null!==e&&!e.isSameNode(document.body))}catch(t){}finally{i=0}return null},exports.getParsedElmTransform=function(t){return 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}(S(t,"transform",!1))},exports.getSelection=function(){return window.getSelection()},exports.getStartingPointByAxis=d,exports.hasCSSTransition=function(t){const s=S(t,"transition",!1);return"none"!==s&&""!==s.trim()},exports.noop=u,exports.noopSet=c,exports.removeStyleProperty=function(t,s){t.style.removeProperty(s)},exports.rmEmptyAttr=function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)},exports.setFixedDimensions=function(t){const{height:s,width:i}=A(t);B(t,l,`${s}px`),B(t,a,`${i}px`)},exports.setRelativePosition=function(t){const s=D(t);v.test(s)&&B(t,p,"relative")},exports.setStyleProperty=B,exports.tracker=m,exports.updateElmDatasetGrid=function(t,s){t.dataset.devX=`${s.x}`,t.dataset.devY=`${s.y}`},exports.warnOnce=function(t,...s){h[t]||(h[t]=!0,console.warn(...s))}; | ||
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,e){this.top=t,this.right=s,this.bottom=i,this.left=e}}class e extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,e){return this.top=t,this.right=s,this.bottom=i,this.left=e,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 n extends e{constructor(t,s,i,e){super(t,s,i,e)}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 r extends e{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}u(t){return this.top<t.top}l(t){return this.right>t.right}p(t){return this.bottom>t.bottom}m(t){return this.left<t.left}_(t){return this.top>=t.top}T(t){return this.right<=t.right}M(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.u(t),e=this.p(t);return i&&(s.top=!0),e&&(s.bottom=!0),i||e}const e=this.m(t),n=this.l(t);return e&&(s.left=!0),n&&(s.right=!0),e||n}return this.u(t)?(s.top=!0,!0):this.l(t)?(s.right=!0,!0):this.p(t)?(s.bottom=!0,!0):!!this.m(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this._(t)&&this.T(t)&&this.M(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:e,bottom:n}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),e>this.right&&(this.right=e),n>this.bottom&&(this.bottom=n)}}function h(t,s){return`${t}_${s}`}const o={};let u=!1;function c(){}const l=new Set,a="height",p="width",x="position";function d(t){return"x"===t?p:a}function f(t){return"x"===t?"left":"top"}class g extends r{constructor(t,s,i,e){super(t,s,i,e),this.width=s-e,this.height=i-t}setByPointAndDimensions(t,s,i,e){this.top=t,this.left=s,this.width=e,this.height=i,this.right=s+e,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=d(t);return this[i]-s[i]}getPositionDiff(t,s){return this[f(t)]-s[t]}}class m extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:e,bottom:n,right:h}=t;return s?new r(i+this.y,h-this.x,n-this.y,e+this.x):new r(i-this.y,h+this.x,n+this.y,e-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}class y{static containerKey(t,s){return h(t,s)}static depthKey(t){return h(t,"dp")}constructor(t){this.B=t,this.thresholds={},this.isOut={}}S({width:t,height:s}){const i=Math.round(this.B.horizontal*t/100),e=Math.round(this.B.vertical*s/100);this.A=new m(i,e)}v(t,s,i){this.thresholds[t]=this.A.composeBox(s,i),this.isOut[t]=new n(!1,!1,!1,!1)}setMainThreshold(t,s,i){this.S(s),this.v(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,e){this.v(t,i,!1);const{top:n,left:r}=i,{height:h,width:o}=e,u=y.containerKey(s,t),c=y.depthKey(s);this.v(u,{left:r,top:n,right:r+o,bottom:n+h},!1),this.thresholds[c]?this.thresholds[c].assignBiggestBox(this.thresholds[u]):this.v(c,this.thresholds[u],!1)}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]}))}}var b=new class{constructor(){this.D={}}newTravel(t){return void 0===this.D[t]?this.D[t]=0:this.D[t]+=1,`${t}${this.D[t]}`}};function w(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,e){e&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function _(t){let s=null,i=!1;function e(){s&&(clearTimeout(s),s=null)}return[function(n,r){const h=n||c;i=!0,r&&e(),s=setTimeout((()=>{i=!1,h()}),t)},e,function(){return i}]}const[T,M]=_(0);class O{constructor(t,s,i,e,n){this.index=t,this.SK=i,this.id=s,this.cycleID=e,this.hasScroll=n,this.reconciledIDs=new Set,this.numberOfTransformedELm=0,this.marginBottom=null,this.marginTop=null}}const B=Object.freeze(["x","y"]);let S=new WeakMap;function A(t,s,i){t.style.setProperty(s,i)}function v(t,s,i){const e=function(t){if(S.has(t))return S.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return S.set(t,s),s}(t),{parsedProperties:n,computedStyle:r}=e,h=n.get(s);if(void 0===h){const t=r.getPropertyValue(s),e=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return n.set(s,e),e}return h}function E(t){return{width:v(t,p,!0),height:v(t,a,!0)}}const D=/absolute|fixed/;function q(t){return v(t,x,!1)}exports.AbstractBox=i,exports.AxesPoint=t,exports.BOTH_AXIS=B,exports.Box=e,exports.BoxBool=n,exports.BoxNum=r,exports.BoxRect=g,exports.DFlexCreateRAF=w,exports.DFlexCreateTimeout=_,exports.DFlexCycle=class{constructor(t,s,i,e,n){const r=new O(t,s,i,e,n);this.q=[r],this.SKs=[i],this.complete()}latest(){return this.q[this.q.length-1]}prev(){return this.q[this.q.length-2]}getAll(){return this.q}filter(t,s){return this.q.filter(s?s=>t.find((t=>t===s.cycleID)):s=>t.find((t=>t===s.id)))}F(t){this.SKs=this.SKs.filter((s=>!t.has(s)))}flush(t){const s=new Set;this.q=this.q.filter((i=>void 0===t.find((t=>t===i.SK&&(s.add(i.SK),!0)))||(s.has(i.SK)&&s.delete(i.SK),!1))),this.F(s)}pruneSKFromMigration(t){this.q=this.q.filter((s=>s.SK!==t)),this.F(new Set([t]))}setIndex(t){this.latest().index=t,this.latest().numberOfTransformedELm+=1}preserveVerticalMargin(t,s){this.latest()["bottom"===t?"marginBottom":"marginTop"]=s}clearMargin(){this.latest().marginBottom=null,this.latest().marginTop=null}add(t,s,i,e,n,r){this.q.push(new O(t,s,i,n,r)),e?this.SKs.unshift(i):this.SKs.push(i)}updateReconciledIDs(t,s){const i=this.q.find((s=>s.SK===t));i&&(i.reconciledIDs.clear(),s.forEach((t=>i.reconciledIDs.add(t))))}getMigrationBySK(t){return this.q.find((s=>s.SK===t))}getReconciledIDsBySK(t){const s=this.q.find((s=>s.SK===t));return s?s.reconciledIDs:l}start(){this.isTransitioning=!0}complete(){this.isTransitioning=!1,this.preserveVerticalMargin("top",null),this.preserveVerticalMargin("bottom",null)}clear(){this.q=[],this.SKs=[]}},exports.PREFIX_TRACKER_CYCLE="dflex_cycle_",exports.PREFIX_TRACKER_ID="dflex_id_",exports.PREFIX_TRACKER_KY="dflex_ky_",exports.Point=s,exports.PointBool=class extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}},exports.PointNum=m,exports.TaskQueue=class{constructor(){this.P={},this.R=new Set}$(t){Array.isArray(this.P[t])||(this.P[t]=[])}I(t,s,i){this.P[s].push(t),i&&this.R.add(i)}K(t){return!Array.isArray(this.P[t])||0===this.P[t].length}hasElm(t){return this.R.has(t)}enqueueBeforeLast(t,s,i,e){this.$(i);const{length:n}=this.P[i];0===n?this.P[i].push(s):this.P[i][n-1]=s,this.I(t,i,e)}enqueue(t,s,i){this.$(s),this.I(t,s,i)}executeQueue(t){const s=[];if(this.K(t))return s;try{this.P[t].forEach((t=>{const i=t();s.push(i)}))}catch(t){}finally{M(),delete this.P[t]}return s}k(t){T((()=>{const[s,i]=t;this.executeQueue(s),i&&queueMicrotask((()=>this.executeQueue(i))),this.R.clear()}),!0)}scheduleNextTask(t){this.k(t)}cancelQueuedTask(){M()}clear(){M(),this.P={},this.R.clear()}},exports.Threshold=y,exports.assertElmPos=function(t,s){if(u)return;const i=t.getBoundingClientRect();Object.keys(s).forEach((t=>{if(Object.prototype.hasOwnProperty.call(i,t)&&i[t]!==s[t])throw u=!0,new Error(`Element position assertion failed. Expected: ${i[t]} found: ${s[t]}`)}))},exports.canUseDOM=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},exports.clearComputedStyleCache=function(){S=new WeakMap},exports.combineKeys=h,exports.eventDebounce=function(t,s=!1,i=200){const[e,n]=_(i),[r,h]=w();let o=performance.now(),u=!1;const c=()=>{if(u)return;const n=performance.now();s||n-o>=i?(r(t,!0),o=n):e(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,h(),n())},c.resume=()=>{u&&(u=!1,c())},c},exports.featureFlags={__proto__:null,enableCommit:!1,enableMechanismDebugger:!1,enableMutationDebugger:!1,enablePositionAssertion:!1,enableReconcileDebugger:!1,enableRegisterDebugger:!1,enableScrollDebugger:!1,enableUndoSiblingsDebugger:!1,enableVisibilityDebugger:!1},exports.getAnimationOptions=function(t){const s={easing:"ease-in",duration:"dynamic"};return void 0===t?s:null===t?null:{...s,...t}},exports.getCachedComputedStyleProperty=v,exports.getDimensionTypeByAxis=d,exports.getElmBoxRect=function(t,s,i){const{left:e,top:n,right:r,bottom:h,height:o,width:u}=t.getBoundingClientRect(),c=new g(n,r,h,e);return 0===s&&0===i||c.setByPointAndDimensions(n+i,e+s,o,u),c},exports.getElmDimensions=E,exports.getElmOverflow=function(t,s){return v(t,s,!1)},exports.getElmPos=q,exports.getEndingPointByAxis=function(t){return"x"===t?"right":"bottom"},exports.getOppositeAxis=function(t){return"x"===t?"y":"x"},exports.getParentElm=function(t,s){let i=0,e=t;try{do{if(i+=1,i>1&&s(e))return i=0,e;e=e.parentElement}while(null!==e&&!e.isSameNode(document.body))}catch(t){}finally{i=0}return null},exports.getParsedElmTransform=function(t){return 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))},exports.getSelection=function(){return window.getSelection()},exports.getStartingPointByAxis=f,exports.hasCSSTransition=function(t){const s=v(t,"transition",!1);return"none"!==s&&""!==s.trim()},exports.noop=c,exports.noopSet=l,exports.removeStyleProperty=function(t,s){t.style.removeProperty(s)},exports.rmEmptyAttr=function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)},exports.setFixedDimensions=function(t){const{height:s,width:i}=E(t);A(t,a,`${s}px`),A(t,p,`${i}px`)},exports.setRelativePosition=function(t){const s=q(t);D.test(s)&&A(t,x,"relative")},exports.setStyleProperty=A,exports.tracker=b,exports.updateElmDatasetGrid=function(t,s){t.dataset.devX=`${s.x}`,t.dataset.devY=`${s.y}`},exports.warnOnce=function(t,...s){o[t]||(o[t]=!0,console.warn(...s))}; |
@@ -656,2 +656,8 @@ 'use strict'; | ||
class DFlexThreshold { | ||
static containerKey(depth, SK) { | ||
return combineKeys(depth, SK); | ||
} | ||
static depthKey(depth) { | ||
return combineKeys(depth, "dp"); | ||
} | ||
constructor(percentages) { | ||
@@ -681,10 +687,2 @@ this._percentages = percentages; | ||
} | ||
_setDepthThreshold(key, depth) { | ||
const dp = `${depth}`; | ||
if (!this.thresholds[dp]) { | ||
this._createThreshold(dp, this.thresholds[key], false); | ||
return; | ||
} | ||
this.thresholds[depth].assignBiggestBox(this.thresholds[key]); | ||
} | ||
@@ -734,7 +732,7 @@ /** | ||
* @param SK | ||
* @param childDepth | ||
* @param depth | ||
* @param containerRect | ||
* @param unifiedContainerDimensions | ||
*/ | ||
setContainerThreshold(SK, insertionLayerKey, childDepth, containerRect, unifiedContainerDimensions) { | ||
setContainerThreshold(SK, depth, containerRect, unifiedContainerDimensions) { | ||
// Regular threshold. | ||
@@ -750,5 +748,7 @@ this._createThreshold(SK, containerRect, false); | ||
} = unifiedContainerDimensions; | ||
const insertionKey = DFlexThreshold.containerKey(depth, SK); | ||
const depthKey = DFlexThreshold.depthKey(depth); | ||
// Insertion threshold. | ||
this._createThreshold(insertionLayerKey, { | ||
this._createThreshold(insertionKey, { | ||
left, | ||
@@ -759,5 +759,9 @@ top, | ||
}, false); | ||
if (!this.thresholds[depthKey]) { | ||
this._createThreshold(depthKey, this.thresholds[insertionKey], false); | ||
return; | ||
} | ||
// Accumulated depth threshold. Accumulation based on insertion layer. | ||
this._setDepthThreshold(insertionLayerKey, childDepth); | ||
this.thresholds[depthKey].assignBiggestBox(this.thresholds[insertionKey]); | ||
} | ||
@@ -764,0 +768,0 @@ isOutThreshold(key, box, axis) { |
@@ -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,e){this.top=t,this.right=s,this.bottom=i,this.left=e}}class e extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,e){return this.top=t,this.right=s,this.bottom=i,this.left=e,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 n extends e{constructor(t,s,i,e){super(t,s,i,e)}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 r extends e{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}u(t){return this.top<t.top}l(t){return this.right>t.right}p(t){return this.bottom>t.bottom}m(t){return this.left<t.left}_(t){return this.top>=t.top}T(t){return this.right<=t.right}M(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.u(t),e=this.p(t);return i&&(s.top=!0),e&&(s.bottom=!0),i||e}const e=this.m(t),n=this.l(t);return e&&(s.left=!0),n&&(s.right=!0),e||n}return this.u(t)?(s.top=!0,!0):this.l(t)?(s.right=!0,!0):this.p(t)?(s.bottom=!0,!0):!!this.m(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this._(t)&&this.T(t)&&this.M(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:e,bottom:n}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),e>this.right&&(this.right=e),n>this.bottom&&(this.bottom=n)}}const h={};let o=!1;function u(){}const c=new Set,l="height",a="width",p="position";function x(t){return"x"===t?a:l}function d(t){return"x"===t?"left":"top"}class f extends r{constructor(t,s,i,e){super(t,s,i,e),this.width=s-e,this.height=i-t}setByPointAndDimensions(t,s,i,e){this.top=t,this.left=s,this.width=e,this.height=i,this.right=s+e,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=x(t);return this[i]-s[i]}getPositionDiff(t,s){return this[d(t)]-s[t]}}class g extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:e,bottom:n,right:h}=t;return s?new r(i+this.y,h-this.x,n-this.y,e+this.x):new r(i-this.y,h+this.x,n+this.y,e-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}var m=new class{constructor(){this.B={}}newTravel(t){return void 0===this.B[t]?this.B[t]=0:this.B[t]+=1,`${t}${this.B[t]}`}};function b(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,e){e&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function w(t){let s=null,i=!1;function e(){s&&(clearTimeout(s),s=null)}return[function(n,r){const h=n||u;i=!0,r&&e(),s=setTimeout((()=>{i=!1,h()}),t)},e,function(){return i}]}const[y,_]=w(0);class T{constructor(t,s,i,e,n){this.index=t,this.SK=i,this.id=s,this.cycleID=e,this.hasScroll=n,this.reconciledIDs=new Set,this.numberOfTransformedELm=0,this.marginBottom=null,this.marginTop=null}}const M=Object.freeze(["x","y"]);let O=new WeakMap;function B(t,s,i){t.style.setProperty(s,i)}function S(t,s,i){const e=function(t){if(O.has(t))return O.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return O.set(t,s),s}(t),{parsedProperties:n,computedStyle:r}=e,h=n.get(s);if(void 0===h){const t=r.getPropertyValue(s),e=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return n.set(s,e),e}return h}function A(t){return{width:S(t,a,!0),height:S(t,l,!0)}}const v=/absolute|fixed/;function D(t){return S(t,p,!1)}exports.AbstractBox=i,exports.AxesPoint=t,exports.BOTH_AXIS=M,exports.Box=e,exports.BoxBool=n,exports.BoxNum=r,exports.BoxRect=f,exports.DFlexCreateRAF=b,exports.DFlexCreateTimeout=w,exports.DFlexCycle=class{constructor(t,s,i,e,n){const r=new T(t,s,i,e,n);this.S=[r],this.SKs=[i],this.complete()}latest(){return this.S[this.S.length-1]}prev(){return this.S[this.S.length-2]}getAll(){return this.S}filter(t,s){return this.S.filter(s?s=>t.find((t=>t===s.cycleID)):s=>t.find((t=>t===s.id)))}A(t){this.SKs=this.SKs.filter((s=>!t.has(s)))}flush(t){const s=new Set;this.S=this.S.filter((i=>void 0===t.find((t=>t===i.SK&&(s.add(i.SK),!0)))||(s.has(i.SK)&&s.delete(i.SK),!1))),this.A(s)}pruneSKFromMigration(t){this.S=this.S.filter((s=>s.SK!==t)),this.A(new Set([t]))}setIndex(t){this.latest().index=t,this.latest().numberOfTransformedELm+=1}preserveVerticalMargin(t,s){this.latest()["bottom"===t?"marginBottom":"marginTop"]=s}clearMargin(){this.latest().marginBottom=null,this.latest().marginTop=null}add(t,s,i,e,n,r){this.S.push(new T(t,s,i,n,r)),e?this.SKs.unshift(i):this.SKs.push(i)}updateReconciledIDs(t,s){const i=this.S.find((s=>s.SK===t));i&&(i.reconciledIDs.clear(),s.forEach((t=>i.reconciledIDs.add(t))))}getMigrationBySK(t){return this.S.find((s=>s.SK===t))}getReconciledIDsBySK(t){const s=this.S.find((s=>s.SK===t));return s?s.reconciledIDs:c}start(){this.isTransitioning=!0}complete(){this.isTransitioning=!1,this.preserveVerticalMargin("top",null),this.preserveVerticalMargin("bottom",null)}clear(){this.S=[],this.SKs=[]}},exports.PREFIX_TRACKER_CYCLE="dflex_cycle_",exports.PREFIX_TRACKER_ID="dflex_id_",exports.PREFIX_TRACKER_KY="dflex_ky_",exports.Point=s,exports.PointBool=class extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}},exports.PointNum=g,exports.TaskQueue=class{constructor(){this.v={},this.D=new Set}q(t){Array.isArray(this.v[t])||(this.v[t]=[])}F(t,s,i){this.v[s].push(t),i&&this.D.add(i)}P(t){return!Array.isArray(this.v[t])||0===this.v[t].length}hasElm(t){return this.D.has(t)}enqueueBeforeLast(t,s,i,e){this.q(i);const{length:n}=this.v[i];0===n?this.v[i].push(s):this.v[i][n-1]=s,this.F(t,i,e)}enqueue(t,s,i){this.q(s),this.F(t,s,i)}executeQueue(t){const s=[];if(this.P(t))return s;try{this.v[t].forEach((t=>{const i=t();s.push(i)}))}catch(t){}finally{_(),delete this.v[t]}return s}R(t){y((()=>{const[s,i]=t;this.executeQueue(s),i&&queueMicrotask((()=>this.executeQueue(i))),this.D.clear()}),!0)}scheduleNextTask(t){this.R(t)}cancelQueuedTask(){_()}clear(){_(),this.v={},this.D.clear()}},exports.Threshold=class{constructor(t){this.$=t,this.thresholds={},this.isOut={}}I({width:t,height:s}){const i=Math.round(this.$.horizontal*t/100),e=Math.round(this.$.vertical*s/100);this.k=new g(i,e)}L(t,s,i){this.thresholds[t]=this.k.composeBox(s,i),this.isOut[t]=new n(!1,!1,!1,!1)}j(t,s){const i=`${s}`;this.thresholds[i]?this.thresholds[s].assignBiggestBox(this.thresholds[t]):this.L(i,this.thresholds[t],!1)}setMainThreshold(t,s,i){this.I(s),this.L(t,s,i)}updateMainThreshold(t,s,i){this.thresholds[t]=this.k.composeBox(s,i),this.isOut[t].setFalsy()}getElmMainThreshold(t){return this.k.composeBox(t,!1)}setContainerThreshold(t,s,i,e,n){this.L(t,e,!1);const{top:r,left:h}=e,{height:o,width:u}=n;this.L(s,{left:h,top:r,right:h+u,bottom:r+o},!1),this.j(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]}))}},exports.assertElmPos=function(t,s){if(o)return;const i=t.getBoundingClientRect();Object.keys(s).forEach((t=>{if(Object.prototype.hasOwnProperty.call(i,t)&&i[t]!==s[t])throw o=!0,new Error(`Element position assertion failed. Expected: ${i[t]} found: ${s[t]}`)}))},exports.canUseDOM=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},exports.clearComputedStyleCache=function(){O=new WeakMap},exports.combineKeys=function(t,s){return`${t}_${s}`},exports.eventDebounce=function(t,s=!1,i=200){const[e,n]=w(i),[r,h]=b();let o=performance.now(),u=!1;const c=()=>{if(u)return;const n=performance.now();s||n-o>=i?(r(t,!0),o=n):e(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,h(),n())},c.resume=()=>{u&&(u=!1,c())},c},exports.featureFlags={__proto__:null,enableCommit:!1,enableMechanismDebugger:!1,enableMutationDebugger:!1,enablePositionAssertion:!1,enableReconcileDebugger:!1,enableRegisterDebugger:!1,enableScrollDebugger:!1,enableUndoSiblingsDebugger:!1,enableVisibilityDebugger:!1},exports.getAnimationOptions=function(t){const s={easing:"ease-in",duration:"dynamic"};return void 0===t?s:null===t?null:{...s,...t}},exports.getCachedComputedStyleProperty=S,exports.getDimensionTypeByAxis=x,exports.getElmBoxRect=function(t,s,i){const{left:e,top:n,right:r,bottom:h,height:o,width:u}=t.getBoundingClientRect(),c=new f(n,r,h,e);return 0===s&&0===i||c.setByPointAndDimensions(n+i,e+s,o,u),c},exports.getElmDimensions=A,exports.getElmOverflow=function(t,s){return S(t,s,!1)},exports.getElmPos=D,exports.getEndingPointByAxis=function(t){return"x"===t?"right":"bottom"},exports.getOppositeAxis=function(t){return"x"===t?"y":"x"},exports.getParentElm=function(t,s){let i=0,e=t;try{do{if(i+=1,i>1&&s(e))return i=0,e;e=e.parentElement}while(null!==e&&!e.isSameNode(document.body))}catch(t){}finally{i=0}return null},exports.getParsedElmTransform=function(t){return 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}(S(t,"transform",!1))},exports.getSelection=function(){return window.getSelection()},exports.getStartingPointByAxis=d,exports.hasCSSTransition=function(t){const s=S(t,"transition",!1);return"none"!==s&&""!==s.trim()},exports.noop=u,exports.noopSet=c,exports.removeStyleProperty=function(t,s){t.style.removeProperty(s)},exports.rmEmptyAttr=function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)},exports.setFixedDimensions=function(t){const{height:s,width:i}=A(t);B(t,l,`${s}px`),B(t,a,`${i}px`)},exports.setRelativePosition=function(t){const s=D(t);v.test(s)&&B(t,p,"relative")},exports.setStyleProperty=B,exports.tracker=m,exports.updateElmDatasetGrid=function(t,s){t.dataset.devX=`${s.x}`,t.dataset.devY=`${s.y}`},exports.warnOnce=function(t,...s){h[t]||(h[t]=!0,console.warn(...s))}; | ||
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,e){this.top=t,this.right=s,this.bottom=i,this.left=e}}class e extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,e){return this.top=t,this.right=s,this.bottom=i,this.left=e,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 n extends e{constructor(t,s,i,e){super(t,s,i,e)}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 r extends e{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}u(t){return this.top<t.top}l(t){return this.right>t.right}p(t){return this.bottom>t.bottom}m(t){return this.left<t.left}_(t){return this.top>=t.top}T(t){return this.right<=t.right}M(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.u(t),e=this.p(t);return i&&(s.top=!0),e&&(s.bottom=!0),i||e}const e=this.m(t),n=this.l(t);return e&&(s.left=!0),n&&(s.right=!0),e||n}return this.u(t)?(s.top=!0,!0):this.l(t)?(s.right=!0,!0):this.p(t)?(s.bottom=!0,!0):!!this.m(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this._(t)&&this.T(t)&&this.M(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:e,bottom:n}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),e>this.right&&(this.right=e),n>this.bottom&&(this.bottom=n)}}function h(t,s){return`${t}_${s}`}const o={};let u=!1;function c(){}const l=new Set,a="height",p="width",x="position";function d(t){return"x"===t?p:a}function f(t){return"x"===t?"left":"top"}class g extends r{constructor(t,s,i,e){super(t,s,i,e),this.width=s-e,this.height=i-t}setByPointAndDimensions(t,s,i,e){this.top=t,this.left=s,this.width=e,this.height=i,this.right=s+e,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=d(t);return this[i]-s[i]}getPositionDiff(t,s){return this[f(t)]-s[t]}}class m extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:e,bottom:n,right:h}=t;return s?new r(i+this.y,h-this.x,n-this.y,e+this.x):new r(i-this.y,h+this.x,n+this.y,e-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}class y{static containerKey(t,s){return h(t,s)}static depthKey(t){return h(t,"dp")}constructor(t){this.B=t,this.thresholds={},this.isOut={}}S({width:t,height:s}){const i=Math.round(this.B.horizontal*t/100),e=Math.round(this.B.vertical*s/100);this.A=new m(i,e)}v(t,s,i){this.thresholds[t]=this.A.composeBox(s,i),this.isOut[t]=new n(!1,!1,!1,!1)}setMainThreshold(t,s,i){this.S(s),this.v(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,e){this.v(t,i,!1);const{top:n,left:r}=i,{height:h,width:o}=e,u=y.containerKey(s,t),c=y.depthKey(s);this.v(u,{left:r,top:n,right:r+o,bottom:n+h},!1),this.thresholds[c]?this.thresholds[c].assignBiggestBox(this.thresholds[u]):this.v(c,this.thresholds[u],!1)}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]}))}}var b=new class{constructor(){this.D={}}newTravel(t){return void 0===this.D[t]?this.D[t]=0:this.D[t]+=1,`${t}${this.D[t]}`}};function w(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,e){e&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function _(t){let s=null,i=!1;function e(){s&&(clearTimeout(s),s=null)}return[function(n,r){const h=n||c;i=!0,r&&e(),s=setTimeout((()=>{i=!1,h()}),t)},e,function(){return i}]}const[T,M]=_(0);class O{constructor(t,s,i,e,n){this.index=t,this.SK=i,this.id=s,this.cycleID=e,this.hasScroll=n,this.reconciledIDs=new Set,this.numberOfTransformedELm=0,this.marginBottom=null,this.marginTop=null}}const B=Object.freeze(["x","y"]);let S=new WeakMap;function A(t,s,i){t.style.setProperty(s,i)}function v(t,s,i){const e=function(t){if(S.has(t))return S.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return S.set(t,s),s}(t),{parsedProperties:n,computedStyle:r}=e,h=n.get(s);if(void 0===h){const t=r.getPropertyValue(s),e=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return n.set(s,e),e}return h}function E(t){return{width:v(t,p,!0),height:v(t,a,!0)}}const D=/absolute|fixed/;function q(t){return v(t,x,!1)}exports.AbstractBox=i,exports.AxesPoint=t,exports.BOTH_AXIS=B,exports.Box=e,exports.BoxBool=n,exports.BoxNum=r,exports.BoxRect=g,exports.DFlexCreateRAF=w,exports.DFlexCreateTimeout=_,exports.DFlexCycle=class{constructor(t,s,i,e,n){const r=new O(t,s,i,e,n);this.q=[r],this.SKs=[i],this.complete()}latest(){return this.q[this.q.length-1]}prev(){return this.q[this.q.length-2]}getAll(){return this.q}filter(t,s){return this.q.filter(s?s=>t.find((t=>t===s.cycleID)):s=>t.find((t=>t===s.id)))}F(t){this.SKs=this.SKs.filter((s=>!t.has(s)))}flush(t){const s=new Set;this.q=this.q.filter((i=>void 0===t.find((t=>t===i.SK&&(s.add(i.SK),!0)))||(s.has(i.SK)&&s.delete(i.SK),!1))),this.F(s)}pruneSKFromMigration(t){this.q=this.q.filter((s=>s.SK!==t)),this.F(new Set([t]))}setIndex(t){this.latest().index=t,this.latest().numberOfTransformedELm+=1}preserveVerticalMargin(t,s){this.latest()["bottom"===t?"marginBottom":"marginTop"]=s}clearMargin(){this.latest().marginBottom=null,this.latest().marginTop=null}add(t,s,i,e,n,r){this.q.push(new O(t,s,i,n,r)),e?this.SKs.unshift(i):this.SKs.push(i)}updateReconciledIDs(t,s){const i=this.q.find((s=>s.SK===t));i&&(i.reconciledIDs.clear(),s.forEach((t=>i.reconciledIDs.add(t))))}getMigrationBySK(t){return this.q.find((s=>s.SK===t))}getReconciledIDsBySK(t){const s=this.q.find((s=>s.SK===t));return s?s.reconciledIDs:l}start(){this.isTransitioning=!0}complete(){this.isTransitioning=!1,this.preserveVerticalMargin("top",null),this.preserveVerticalMargin("bottom",null)}clear(){this.q=[],this.SKs=[]}},exports.PREFIX_TRACKER_CYCLE="dflex_cycle_",exports.PREFIX_TRACKER_ID="dflex_id_",exports.PREFIX_TRACKER_KY="dflex_ky_",exports.Point=s,exports.PointBool=class extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}},exports.PointNum=m,exports.TaskQueue=class{constructor(){this.P={},this.R=new Set}$(t){Array.isArray(this.P[t])||(this.P[t]=[])}I(t,s,i){this.P[s].push(t),i&&this.R.add(i)}K(t){return!Array.isArray(this.P[t])||0===this.P[t].length}hasElm(t){return this.R.has(t)}enqueueBeforeLast(t,s,i,e){this.$(i);const{length:n}=this.P[i];0===n?this.P[i].push(s):this.P[i][n-1]=s,this.I(t,i,e)}enqueue(t,s,i){this.$(s),this.I(t,s,i)}executeQueue(t){const s=[];if(this.K(t))return s;try{this.P[t].forEach((t=>{const i=t();s.push(i)}))}catch(t){}finally{M(),delete this.P[t]}return s}k(t){T((()=>{const[s,i]=t;this.executeQueue(s),i&&queueMicrotask((()=>this.executeQueue(i))),this.R.clear()}),!0)}scheduleNextTask(t){this.k(t)}cancelQueuedTask(){M()}clear(){M(),this.P={},this.R.clear()}},exports.Threshold=y,exports.assertElmPos=function(t,s){if(u)return;const i=t.getBoundingClientRect();Object.keys(s).forEach((t=>{if(Object.prototype.hasOwnProperty.call(i,t)&&i[t]!==s[t])throw u=!0,new Error(`Element position assertion failed. Expected: ${i[t]} found: ${s[t]}`)}))},exports.canUseDOM=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},exports.clearComputedStyleCache=function(){S=new WeakMap},exports.combineKeys=h,exports.eventDebounce=function(t,s=!1,i=200){const[e,n]=_(i),[r,h]=w();let o=performance.now(),u=!1;const c=()=>{if(u)return;const n=performance.now();s||n-o>=i?(r(t,!0),o=n):e(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,h(),n())},c.resume=()=>{u&&(u=!1,c())},c},exports.featureFlags={__proto__:null,enableCommit:!1,enableMechanismDebugger:!1,enableMutationDebugger:!1,enablePositionAssertion:!1,enableReconcileDebugger:!1,enableRegisterDebugger:!1,enableScrollDebugger:!1,enableUndoSiblingsDebugger:!1,enableVisibilityDebugger:!1},exports.getAnimationOptions=function(t){const s={easing:"ease-in",duration:"dynamic"};return void 0===t?s:null===t?null:{...s,...t}},exports.getCachedComputedStyleProperty=v,exports.getDimensionTypeByAxis=d,exports.getElmBoxRect=function(t,s,i){const{left:e,top:n,right:r,bottom:h,height:o,width:u}=t.getBoundingClientRect(),c=new g(n,r,h,e);return 0===s&&0===i||c.setByPointAndDimensions(n+i,e+s,o,u),c},exports.getElmDimensions=E,exports.getElmOverflow=function(t,s){return v(t,s,!1)},exports.getElmPos=q,exports.getEndingPointByAxis=function(t){return"x"===t?"right":"bottom"},exports.getOppositeAxis=function(t){return"x"===t?"y":"x"},exports.getParentElm=function(t,s){let i=0,e=t;try{do{if(i+=1,i>1&&s(e))return i=0,e;e=e.parentElement}while(null!==e&&!e.isSameNode(document.body))}catch(t){}finally{i=0}return null},exports.getParsedElmTransform=function(t){return 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))},exports.getSelection=function(){return window.getSelection()},exports.getStartingPointByAxis=f,exports.hasCSSTransition=function(t){const s=v(t,"transition",!1);return"none"!==s&&""!==s.trim()},exports.noop=c,exports.noopSet=l,exports.removeStyleProperty=function(t,s){t.style.removeProperty(s)},exports.rmEmptyAttr=function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)},exports.setFixedDimensions=function(t){const{height:s,width:i}=E(t);A(t,a,`${s}px`),A(t,p,`${i}px`)},exports.setRelativePosition=function(t){const s=q(t);D.test(s)&&A(t,x,"relative")},exports.setStyleProperty=A,exports.tracker=b,exports.updateElmDatasetGrid=function(t,s){t.dataset.devX=`${s.x}`,t.dataset.devY=`${s.y}`},exports.warnOnce=function(t,...s){o[t]||(o[t]=!0,console.warn(...s))}; |
{ | ||
"name": "@dflex/utils", | ||
"version": "3.9.9", | ||
"version": "3.9.10", | ||
"description": "Utility package for DFlex", | ||
@@ -5,0 +5,0 @@ "author": "Jalal Maskoun", |
@@ -287,2 +287,4 @@ declare class AxesPoint<T = number> { | ||
isOut: Record<string, BoxBool>; | ||
static containerKey(depth: number, SK: string): string; | ||
static depthKey(depth: number): string; | ||
constructor(percentages: ThresholdPercentages); | ||
@@ -292,3 +294,2 @@ private _createPixels; | ||
private _createThreshold; | ||
private _setDepthThreshold; | ||
/** | ||
@@ -322,7 +323,7 @@ * Set the main threshold for the element based on the element's dimensions | ||
* @param SK | ||
* @param childDepth | ||
* @param depth | ||
* @param containerRect | ||
* @param unifiedContainerDimensions | ||
*/ | ||
setContainerThreshold(SK: string, insertionLayerKey: string, childDepth: number, containerRect: AbstractBox, unifiedContainerDimensions: Dimensions): void; | ||
setContainerThreshold(SK: string, depth: number, containerRect: AbstractBox, unifiedContainerDimensions: Dimensions): void; | ||
isOutThreshold(key: string, box: BoxNum, axis: Axis | null): boolean; | ||
@@ -329,0 +330,0 @@ destroy(): void; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132243
3436