@dflex/utils
Advanced tools
Comparing version 3.9.8 to 3.9.9
@@ -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}O(t){return this.bottom<=t.bottom}M(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.O(t)&&this.M(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",x="position";function p(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=p(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 y(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[w,_]=y(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 O=Object.freeze(["x","y"]);let M=new WeakMap;function B(t,s,i){t.style.setProperty(s,i)}function A(t,s,i){const e=function(t){if(M.has(t))return M.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return M.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 S(t){return{width:A(t,a,!0),height:A(t,l,!0)}}const v=/absolute|fixed/;function D(t){return A(t,x,!1)}exports.AbstractBox=i,exports.AxesPoint=t,exports.BOTH_AXIS=O,exports.Box=e,exports.BoxBool=n,exports.BoxNum=r,exports.BoxRect=f,exports.DFlexCreateRAF=b,exports.DFlexCreateTimeout=y,exports.DFlexCycle=class{constructor(t,s,i,e,n){const r=new T(t,s,i,e,n);this.A=[r],this.SKs=[i],this.complete()}latest(){return this.A[this.A.length-1]}prev(){return this.A[this.A.length-2]}getAll(){return this.A}filter(t,s){return this.A.filter(s?s=>t.find((t=>t===s.cycleID)):s=>t.find((t=>t===s.id)))}S(t){this.SKs=this.SKs.filter((s=>!t.has(s)))}flush(t){const s=new Set;this.A=this.A.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.S(s)}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.A.push(new T(t,s,i,n,r)),e?this.SKs.unshift(i):this.SKs.push(i)}updateReconciledIDs(t,s){const i=this.A.find((s=>s.SK===t));i&&(i.reconciledIDs.clear(),s.forEach((t=>i.reconciledIDs.add(t))))}getMigrationBySK(t){return this.A.find((s=>s.SK===t))}getReconciledIDsBySK(t){const s=this.A.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.A=[],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]=[])}P(t,s,i){this.v[s].push(t),i&&this.D.add(i)}R(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.P(t,i,e)}enqueue(t,s,i){this.q(s),this.P(t,s,i)}executeQueue(t){const s=[];if(this.R(t))return s;try{this.v[t].forEach((t=>{const i=t();s.push(i)}))}catch(t){}finally{_(),delete this.v[t]}return s}$(t){w((()=>{const[s,i]=t;this.executeQueue(s),i&&queueMicrotask((()=>this.executeQueue(i))),this.D.clear()}),!0)}scheduleNextTask(t){this.$(t)}cancelQueuedTask(){_()}clear(){_(),this.v={},this.D.clear()}},exports.Threshold=class{constructor(t){this.F=t,this.thresholds={},this.isOut={}}I({width:t,height:s}){const i=Math.round(this.F.horizontal*t/100),e=Math.round(this.F.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(){M=new WeakMap},exports.combineKeys=function(t,s){return`${t}_${s}`},exports.eventDebounce=function(t,s=!1,i=200){const[e,n]=y(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=A,exports.getDimensionTypeByAxis=p,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=S,exports.getElmOverflow=function(t,s){return A(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}(A(t,"transform",!1))},exports.getSelection=function(){return window.getSelection()},exports.getStartingPointByAxis=d,exports.hasCSSTransition=function(t){const s=A(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}=S(t);B(t,l,`${s}px`),B(t,a,`${i}px`)},exports.setRelativePosition=function(t){const s=D(t);v.test(s)&&B(t,x,"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)}}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))}; |
@@ -1157,2 +1157,6 @@ 'use strict'; | ||
} | ||
pruneSKFromMigration(SK) { | ||
this._migrations = this._migrations.filter(m => m.SK !== SK); | ||
this._deleteKeysFromSKs(new Set([SK])); | ||
} | ||
@@ -1159,0 +1163,0 @@ /** |
@@ -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}O(t){return this.bottom<=t.bottom}M(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.O(t)&&this.M(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",x="position";function p(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=p(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 y(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[w,_]=y(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 O=Object.freeze(["x","y"]);let M=new WeakMap;function B(t,s,i){t.style.setProperty(s,i)}function A(t,s,i){const e=function(t){if(M.has(t))return M.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return M.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 S(t){return{width:A(t,a,!0),height:A(t,l,!0)}}const v=/absolute|fixed/;function D(t){return A(t,x,!1)}exports.AbstractBox=i,exports.AxesPoint=t,exports.BOTH_AXIS=O,exports.Box=e,exports.BoxBool=n,exports.BoxNum=r,exports.BoxRect=f,exports.DFlexCreateRAF=b,exports.DFlexCreateTimeout=y,exports.DFlexCycle=class{constructor(t,s,i,e,n){const r=new T(t,s,i,e,n);this.A=[r],this.SKs=[i],this.complete()}latest(){return this.A[this.A.length-1]}prev(){return this.A[this.A.length-2]}getAll(){return this.A}filter(t,s){return this.A.filter(s?s=>t.find((t=>t===s.cycleID)):s=>t.find((t=>t===s.id)))}S(t){this.SKs=this.SKs.filter((s=>!t.has(s)))}flush(t){const s=new Set;this.A=this.A.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.S(s)}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.A.push(new T(t,s,i,n,r)),e?this.SKs.unshift(i):this.SKs.push(i)}updateReconciledIDs(t,s){const i=this.A.find((s=>s.SK===t));i&&(i.reconciledIDs.clear(),s.forEach((t=>i.reconciledIDs.add(t))))}getMigrationBySK(t){return this.A.find((s=>s.SK===t))}getReconciledIDsBySK(t){const s=this.A.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.A=[],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]=[])}P(t,s,i){this.v[s].push(t),i&&this.D.add(i)}R(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.P(t,i,e)}enqueue(t,s,i){this.q(s),this.P(t,s,i)}executeQueue(t){const s=[];if(this.R(t))return s;try{this.v[t].forEach((t=>{const i=t();s.push(i)}))}catch(t){}finally{_(),delete this.v[t]}return s}$(t){w((()=>{const[s,i]=t;this.executeQueue(s),i&&queueMicrotask((()=>this.executeQueue(i))),this.D.clear()}),!0)}scheduleNextTask(t){this.$(t)}cancelQueuedTask(){_()}clear(){_(),this.v={},this.D.clear()}},exports.Threshold=class{constructor(t){this.F=t,this.thresholds={},this.isOut={}}I({width:t,height:s}){const i=Math.round(this.F.horizontal*t/100),e=Math.round(this.F.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(){M=new WeakMap},exports.combineKeys=function(t,s){return`${t}_${s}`},exports.eventDebounce=function(t,s=!1,i=200){const[e,n]=y(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=A,exports.getDimensionTypeByAxis=p,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=S,exports.getElmOverflow=function(t,s){return A(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}(A(t,"transform",!1))},exports.getSelection=function(){return window.getSelection()},exports.getStartingPointByAxis=d,exports.hasCSSTransition=function(t){const s=A(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}=S(t);B(t,l,`${s}px`),B(t,a,`${i}px`)},exports.setRelativePosition=function(t){const s=D(t);v.test(s)&&B(t,x,"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)}}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))}; |
{ | ||
"name": "@dflex/utils", | ||
"version": "3.9.8", | ||
"version": "3.9.9", | ||
"description": "Utility package for DFlex", | ||
@@ -5,0 +5,0 @@ "author": "Jalal Maskoun", |
@@ -422,2 +422,3 @@ declare class AxesPoint<T = number> { | ||
flush(cycleIDs: string[]): void; | ||
pruneSKFromMigration(SK: string): void; | ||
/** | ||
@@ -424,0 +425,0 @@ * We only update indexes considering migration definition when it happens |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
131698
3427