@react-hive/honey-layout 10.8.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-honey-decay.d.ts +142 -0
- package/dist/hooks/use-honey-drag.d.ts +91 -50
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +233 -91
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +12 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.dev.cjs
CHANGED
|
@@ -7932,93 +7932,96 @@ function rectToClientRect(rect) {
|
|
|
7932
7932
|
"use strict";
|
|
7933
7933
|
__webpack_require__.r(__webpack_exports__);
|
|
7934
7934
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7935
|
-
/* harmony export */ FOCUSABLE_HTML_TAGS: () => (/* binding */
|
|
7936
|
-
/* harmony export */ applyInertiaStep: () => (/* binding */
|
|
7935
|
+
/* harmony export */ FOCUSABLE_HTML_TAGS: () => (/* binding */ Ee),
|
|
7936
|
+
/* harmony export */ applyInertiaStep: () => (/* binding */ ke),
|
|
7937
7937
|
/* harmony export */ assert: () => (/* binding */ t),
|
|
7938
|
-
/* harmony export */ blobToFile: () => (/* binding */
|
|
7939
|
-
/* harmony export */ calculateCenterOffset: () => (/* binding */
|
|
7940
|
-
/* harmony export */ calculateEuclideanDistance: () => (/* binding */
|
|
7941
|
-
/* harmony export */ calculateMovingSpeed: () => (/* binding */
|
|
7942
|
-
/* harmony export */ calculatePercentage: () => (/* binding */
|
|
7938
|
+
/* harmony export */ blobToFile: () => (/* binding */ Me),
|
|
7939
|
+
/* harmony export */ calculateCenterOffset: () => (/* binding */ ge),
|
|
7940
|
+
/* harmony export */ calculateEuclideanDistance: () => (/* binding */ re),
|
|
7941
|
+
/* harmony export */ calculateMovingSpeed: () => (/* binding */ le),
|
|
7942
|
+
/* harmony export */ calculatePercentage: () => (/* binding */ ae),
|
|
7943
7943
|
/* harmony export */ camelToDashCase: () => (/* binding */ Z),
|
|
7944
7944
|
/* harmony export */ camelToWords: () => (/* binding */ G),
|
|
7945
|
-
/* harmony export */ centerElementInContainer: () => (/* binding */
|
|
7945
|
+
/* harmony export */ centerElementInContainer: () => (/* binding */ we),
|
|
7946
7946
|
/* harmony export */ chunk: () => (/* binding */ O),
|
|
7947
|
-
/* harmony export */ cloneBlob: () => (/* binding */
|
|
7948
|
-
/* harmony export */ compact: () => (/* binding */
|
|
7949
|
-
/* harmony export */ compose: () => (/* binding */
|
|
7950
|
-
/* harmony export */ definedProps: () => (/* binding */
|
|
7951
|
-
/* harmony export */ delay: () => (/* binding */
|
|
7952
|
-
/* harmony export */ difference: () => (/* binding */
|
|
7953
|
-
/* harmony export */ downloadFile: () => (/* binding */
|
|
7947
|
+
/* harmony export */ cloneBlob: () => (/* binding */ oe),
|
|
7948
|
+
/* harmony export */ compact: () => (/* binding */ v),
|
|
7949
|
+
/* harmony export */ compose: () => (/* binding */ E),
|
|
7950
|
+
/* harmony export */ definedProps: () => (/* binding */ Ae),
|
|
7951
|
+
/* harmony export */ delay: () => (/* binding */ H),
|
|
7952
|
+
/* harmony export */ difference: () => (/* binding */ C),
|
|
7953
|
+
/* harmony export */ downloadFile: () => (/* binding */ fe),
|
|
7954
7954
|
/* harmony export */ everyAsync: () => (/* binding */ I),
|
|
7955
|
-
/* harmony export */ fileListToFiles: () => (/* binding */
|
|
7956
|
-
/* harmony export */ filterParallel: () => (/* binding */
|
|
7957
|
-
/* harmony export */ filterSequential: () => (/* binding */
|
|
7958
|
-
/* harmony export */ findAsync: () => (/* binding */
|
|
7959
|
-
/* harmony export */
|
|
7960
|
-
/* harmony export */
|
|
7961
|
-
/* harmony export */
|
|
7962
|
-
/* harmony export */
|
|
7963
|
-
/* harmony export */
|
|
7964
|
-
/* harmony export */
|
|
7965
|
-
/* harmony export */
|
|
7966
|
-
/* harmony export */
|
|
7967
|
-
/* harmony export */
|
|
7955
|
+
/* harmony export */ fileListToFiles: () => (/* binding */ xe),
|
|
7956
|
+
/* harmony export */ filterParallel: () => (/* binding */ N),
|
|
7957
|
+
/* harmony export */ filterSequential: () => (/* binding */ j),
|
|
7958
|
+
/* harmony export */ findAsync: () => (/* binding */ $),
|
|
7959
|
+
/* harmony export */ findCharIndices: () => (/* binding */ Q),
|
|
7960
|
+
/* harmony export */ forEachChar: () => (/* binding */ ee),
|
|
7961
|
+
/* harmony export */ getDOMRectIntersectionRatio: () => (/* binding */ Ce),
|
|
7962
|
+
/* harmony export */ getElementOffsetRect: () => (/* binding */ se),
|
|
7963
|
+
/* harmony export */ getFocusableHtmlElements: () => (/* binding */ Xe),
|
|
7964
|
+
/* harmony export */ getLocalStorageCapabilities: () => (/* binding */ Le),
|
|
7965
|
+
/* harmony export */ getWordsInitials: () => (/* binding */ te),
|
|
7966
|
+
/* harmony export */ getXOverflowWidth: () => (/* binding */ de),
|
|
7967
|
+
/* harmony export */ getYOverflowHeight: () => (/* binding */ ye),
|
|
7968
|
+
/* harmony export */ hasXOverflow: () => (/* binding */ he),
|
|
7969
|
+
/* harmony export */ hasYOverflow: () => (/* binding */ me),
|
|
7970
|
+
/* harmony export */ hashString: () => (/* binding */ ie),
|
|
7968
7971
|
/* harmony export */ intersection: () => (/* binding */ k),
|
|
7969
|
-
/* harmony export */ invokeIfFunction: () => (/* binding */
|
|
7970
|
-
/* harmony export */ isAnchorHtmlElement: () => (/* binding */
|
|
7971
|
-
/* harmony export */ isArray: () => (/* binding */
|
|
7972
|
+
/* harmony export */ invokeIfFunction: () => (/* binding */ ne),
|
|
7973
|
+
/* harmony export */ isAnchorHtmlElement: () => (/* binding */ ce),
|
|
7974
|
+
/* harmony export */ isArray: () => (/* binding */ M),
|
|
7972
7975
|
/* harmony export */ isBlob: () => (/* binding */ f),
|
|
7973
7976
|
/* harmony export */ isBool: () => (/* binding */ o),
|
|
7974
|
-
/* harmony export */ isContentEditableHtmlElement: () => (/* binding */
|
|
7977
|
+
/* harmony export */ isContentEditableHtmlElement: () => (/* binding */ ue),
|
|
7975
7978
|
/* harmony export */ isDate: () => (/* binding */ u),
|
|
7976
7979
|
/* harmony export */ isDecimal: () => (/* binding */ x),
|
|
7977
|
-
/* harmony export */ isDefined: () => (/* binding */
|
|
7978
|
-
/* harmony export */ isEmptyArray: () => (/* binding */
|
|
7980
|
+
/* harmony export */ isDefined: () => (/* binding */ l),
|
|
7981
|
+
/* harmony export */ isEmptyArray: () => (/* binding */ S),
|
|
7979
7982
|
/* harmony export */ isEmptyObject: () => (/* binding */ c),
|
|
7980
7983
|
/* harmony export */ isError: () => (/* binding */ h),
|
|
7981
|
-
/* harmony export */ isFile: () => (/* binding */
|
|
7984
|
+
/* harmony export */ isFile: () => (/* binding */ be),
|
|
7982
7985
|
/* harmony export */ isFiniteNumber: () => (/* binding */ p),
|
|
7983
|
-
/* harmony export */ isFunction: () => (/* binding */
|
|
7984
|
-
/* harmony export */ isHtmlElementFocusable: () => (/* binding */
|
|
7986
|
+
/* harmony export */ isFunction: () => (/* binding */ X),
|
|
7987
|
+
/* harmony export */ isHtmlElementFocusable: () => (/* binding */ Te),
|
|
7985
7988
|
/* harmony export */ isInteger: () => (/* binding */ b),
|
|
7986
|
-
/* harmony export */ isLocalStorageReadable: () => (/* binding */
|
|
7989
|
+
/* harmony export */ isLocalStorageReadable: () => (/* binding */ ze),
|
|
7987
7990
|
/* harmony export */ isMap: () => (/* binding */ y),
|
|
7988
7991
|
/* harmony export */ isNil: () => (/* binding */ r),
|
|
7989
7992
|
/* harmony export */ isNilOrEmptyString: () => (/* binding */ J),
|
|
7990
7993
|
/* harmony export */ isNull: () => (/* binding */ n),
|
|
7991
7994
|
/* harmony export */ isNumber: () => (/* binding */ i),
|
|
7992
7995
|
/* harmony export */ isObject: () => (/* binding */ s),
|
|
7993
|
-
/* harmony export */ isPromise: () => (/* binding */
|
|
7996
|
+
/* harmony export */ isPromise: () => (/* binding */ L),
|
|
7994
7997
|
/* harmony export */ isRegExp: () => (/* binding */ m),
|
|
7995
|
-
/* harmony export */ isSet: () => (/* binding */
|
|
7998
|
+
/* harmony export */ isSet: () => (/* binding */ g),
|
|
7996
7999
|
/* harmony export */ isString: () => (/* binding */ D),
|
|
7997
|
-
/* harmony export */ isSymbol: () => (/* binding */
|
|
7998
|
-
/* harmony export */ isUndefined: () => (/* binding */
|
|
8000
|
+
/* harmony export */ isSymbol: () => (/* binding */ w),
|
|
8001
|
+
/* harmony export */ isUndefined: () => (/* binding */ a),
|
|
7999
8002
|
/* harmony export */ isValidDate: () => (/* binding */ d),
|
|
8000
|
-
/* harmony export */ moveFocusWithinContainer: () => (/* binding */
|
|
8001
|
-
/* harmony export */ noop: () => (/* binding */
|
|
8002
|
-
/* harmony export */ not: () => (/* binding */
|
|
8003
|
-
/* harmony export */ once: () => (/* binding */
|
|
8004
|
-
/* harmony export */ parse2DMatrix: () => (/* binding */
|
|
8003
|
+
/* harmony export */ moveFocusWithinContainer: () => (/* binding */ _e),
|
|
8004
|
+
/* harmony export */ noop: () => (/* binding */ T),
|
|
8005
|
+
/* harmony export */ not: () => (/* binding */ _),
|
|
8006
|
+
/* harmony export */ once: () => (/* binding */ z),
|
|
8007
|
+
/* harmony export */ parse2DMatrix: () => (/* binding */ pe),
|
|
8005
8008
|
/* harmony export */ parseFileName: () => (/* binding */ K),
|
|
8006
|
-
/* harmony export */ pipe: () => (/* binding */
|
|
8007
|
-
/* harmony export */ readFilesFromDataTransfer: () => (/* binding */
|
|
8008
|
-
/* harmony export */ reduceAsync: () => (/* binding */
|
|
8009
|
-
/* harmony export */ resolveAxisDelta: () => (/* binding */
|
|
8010
|
-
/* harmony export */ resolveBoundedDelta: () => (/* binding */
|
|
8009
|
+
/* harmony export */ pipe: () => (/* binding */ P),
|
|
8010
|
+
/* harmony export */ readFilesFromDataTransfer: () => (/* binding */ ve),
|
|
8011
|
+
/* harmony export */ reduceAsync: () => (/* binding */ U),
|
|
8012
|
+
/* harmony export */ resolveAxisDelta: () => (/* binding */ Pe),
|
|
8013
|
+
/* harmony export */ resolveBoundedDelta: () => (/* binding */ Oe),
|
|
8011
8014
|
/* harmony export */ retry: () => (/* binding */ B),
|
|
8012
8015
|
/* harmony export */ runParallel: () => (/* binding */ R),
|
|
8013
|
-
/* harmony export */ runSequential: () => (/* binding */
|
|
8016
|
+
/* harmony export */ runSequential: () => (/* binding */ Y),
|
|
8014
8017
|
/* harmony export */ someAsync: () => (/* binding */ F),
|
|
8015
8018
|
/* harmony export */ splitStringIntoWords: () => (/* binding */ q),
|
|
8016
8019
|
/* harmony export */ timeout: () => (/* binding */ W),
|
|
8017
8020
|
/* harmony export */ toKebabCase: () => (/* binding */ V),
|
|
8018
|
-
/* harmony export */ traverseFileSystemDirectory: () => (/* binding */
|
|
8019
|
-
/* harmony export */ unique: () => (/* binding */
|
|
8021
|
+
/* harmony export */ traverseFileSystemDirectory: () => (/* binding */ Se),
|
|
8022
|
+
/* harmony export */ unique: () => (/* binding */ A)
|
|
8020
8023
|
/* harmony export */ });
|
|
8021
|
-
var e={};function t(e,t){if(!e)throw new Error(t)}e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const n=e=>null===e,r=e=>null==e,
|
|
8024
|
+
var e={};function t(e,t){if(!e)throw new Error(t)}e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const n=e=>null===e,r=e=>null==e,l=e=>null!=e,a=e=>void 0===e,i=e=>"number"==typeof e,o=e=>"boolean"==typeof e,s=e=>"object"==typeof e,c=e=>s(e)&&!n(e)&&0===Object.keys(e).length,u=e=>e instanceof Date,f=e=>e instanceof Blob,h=e=>e instanceof Error,d=e=>u(e)&&!isNaN(e.getTime()),m=e=>e instanceof RegExp,y=e=>e instanceof Map,g=e=>e instanceof Set,w=e=>"symbol"==typeof e,p=e=>i(e)&&isFinite(e),b=e=>i(e)&&Number.isInteger(e),x=e=>p(e)&&!Number.isInteger(e),M=e=>Array.isArray(e),S=e=>M(e)&&0===e.length,v=e=>e.filter(Boolean),A=e=>[...new Set(e)],O=(e,n)=>(t(n>0,"Chunk size must be greater than 0"),Array.from({length:Math.ceil(e.length/n)},(t,r)=>e.slice(r*n,(r+1)*n))),k=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return A(t).filter(e=>n.every(t=>t.includes(e)))},C=(e,t)=>e.filter(e=>!t.includes(e)),P=(...e)=>t=>e.reduce((e,t)=>t(e),t),E=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),T=()=>{},X=e=>"function"==typeof e,_=e=>(...t)=>!e(...t),z=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},L=e=>X(e?.then),Y=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},R=async(e,t)=>Promise.all(e.map(t)),j=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const l=e[r];await t(l,r,e)&&n.push(l)}return n},N=async(e,t)=>{const n=await R(e,async(e,n,r)=>!!await t(e,n,r)&&e);return v(n)},F=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},I=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},U=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},$=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},H=e=>new Promise(t=>setTimeout(t,e)),W=async(e,t,n="Operation timed out")=>{try{return await Promise.race([e,H(t).then(()=>Promise.reject(new Error(n)))])}finally{}},B=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:l}={})=>async(...a)=>{let i;for(let o=1;o<=t;o++)try{return await e(...a)}catch(e){if(i=e,o<t){l?.(o,e);const t=r?n*2**(o-1):n;await H(t)}}throw i},D=e=>"string"==typeof e,V=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Z=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},G=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"),q=e=>0===e.length?[]:e.split(" ").filter(Boolean),J=e=>""===e||r(e),K=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},Q=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},ee=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let l=0;l<r;l++){const a=e[l],i={charIndex:l,prevChar:l>0?e[l-1]:null,nextChar:l<r-1?e[l+1]:null};n?.(a,i)||t(a,i)}},te=(e,t=1/0)=>0===e.length?"":q(e).slice(0,t).map(e=>e[0]).join("").toUpperCase(),ne=(e,...t)=>"function"==typeof e?e(...t):e,re=(e,t,n,r)=>{const l=n-e,a=r-t;return Math.hypot(l,a)},le=(e,t)=>Math.abs(e/t),ae=(e,t)=>e*t/100,ie=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},oe=e=>new Blob([e],{type:e.type}),se=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),ce=e=>"A"===e.tagName,ue=e=>"true"===e.getAttribute("contenteditable"),fe=(e,{fileName:n,target:r}={})=>{if(a(document))return;const l=document.createElement("a");let i=null;try{const t=D(e)?e:i=URL.createObjectURL(e);l.href=t,n&&(l.download=n),r&&(l.target=r),document.body.appendChild(l),l.click()}finally{l.remove(),i&&setTimeout(()=>{t(i,"Object URL should not be null"),URL.revokeObjectURL(i)},0)}},he=e=>e.scrollWidth>e.clientWidth,de=e=>Math.max(0,e.scrollWidth-e.clientWidth),me=e=>e.scrollHeight>e.clientHeight,ye=e=>Math.max(0,e.scrollHeight-e.clientHeight),ge=({overflowSize:e,containerSize:t,elementOffset:n,elementSize:r})=>{if(e<=0)return 0;const l=n+r/2-t/2;return-Math.max(0,Math.min(l,e))},we=(e,t,{axis:n="both"}={})=>{let r=0,l=0;"x"!==n&&"both"!==n||(r=ge({overflowSize:de(e),containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth})),"y"!==n&&"both"!==n||(l=ge({overflowSize:ye(e),containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight})),e.style.transform=`translate(${r}px, ${l}px)`},pe=e=>{const t=window.getComputedStyle(e).getPropertyValue("transform").match(/^matrix\((.+)\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[n,r,l,a,i,o]=t[1].split(", ").map(parseFloat);return{translateX:i,translateY:o,scaleX:n,scaleY:a,skewX:l,skewY:r}},be=e=>e instanceof File,xe=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},Me=(e,t)=>new File([e],t,{type:e.type}),Se=async(e,{skipFiles:t=[".DS_Store","Thumbs.db","desktop.ini","ehthumbs.db",".Spotlight-V100",".Trashes",".fseventsd","__MACOSX"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await R(r,async e=>e.isDirectory?Se(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},ve=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const l=n[e];if("webkitGetAsEntry"in l){const e=l.webkitGetAsEntry?.();if(e?.isDirectory){r.push(Se(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const a=l.getAsFile();a&&r.push(Promise.resolve([a]))}return(await Promise.all(r)).flat()},Ae=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),Oe=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const l=t+e;return e<0?t<=n?null:Math.max(l,n):e>0?t>=r?null:Math.min(l,r):null},ke=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:l,friction:a=.002,minVelocityPxMs:i=.01})=>{if(Math.abs(r)<i)return null;const o=Oe({delta:r*l,value:e,min:t,max:n});return null===o?null:{value:o,velocityPxMs:r*Math.exp(-a*l)}},Ce=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),Pe=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const l=r?-1:1;switch(t){case"x":return{deltaX:l*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case"y":return{deltaX:0,deltaY:l*e.deltaY};default:return{deltaX:l*e.deltaX,deltaY:l*e.deltaY}}},Ee=["INPUT","SELECT","TEXTAREA","BUTTON","A"],Te=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if("hidden"===t.visibility||"none"===t.display)return!1;if("disabled"in e&&e.disabled)return!1;const n=e.getAttribute("tabindex");return"-1"!==n&&(Ee.includes(e.tagName)?!ce(e)||""!==e.href:!!ue(e)||null!==n)},Xe=e=>Array.from(e.querySelectorAll("*")).filter(Te),_e=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const l=document.activeElement,a=t??l?.parentElement;if(!l||!a)return;const i=Xe(a);if(0===i.length)return;const o=i.indexOf(l);if(-1===o)return;let s;r?s=r(o,e,i):"next"===e?(s=o+1,s>=i.length&&(s=n?0:null)):(s=o-1,s<0&&(s=n?i.length-1:null)),null!==s&&i[s]?.focus()},ze=()=>{if("undefined"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem("__non_existing_key__"),!0}catch{return!1}},Le=()=>{if(!ze())return{readable:!1,writable:!1};try{const e="__test_write__";return window.localStorage.setItem(e,"1"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}};
|
|
8022
8025
|
//# sourceMappingURL=index.mjs.map
|
|
8023
8026
|
|
|
8024
8027
|
/***/ },
|
|
@@ -13719,6 +13722,7 @@ const mergeRefs = (...refs) => value => {
|
|
|
13719
13722
|
__webpack_require__.r(__webpack_exports__);
|
|
13720
13723
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13721
13724
|
/* harmony export */ resolveAxisTranslate: () => (/* reexport safe */ _use_honey_synthetic_scroll__WEBPACK_IMPORTED_MODULE_8__.resolveAxisTranslate),
|
|
13725
|
+
/* harmony export */ useHoneyDecay: () => (/* reexport safe */ _use_honey_decay__WEBPACK_IMPORTED_MODULE_13__.useHoneyDecay),
|
|
13722
13726
|
/* harmony export */ useHoneyDocumentKeyUpHandler: () => (/* reexport safe */ _use_honey_document_key_up_handler__WEBPACK_IMPORTED_MODULE_3__.useHoneyDocumentKeyUpHandler),
|
|
13723
13727
|
/* harmony export */ useHoneyDrag: () => (/* reexport safe */ _use_honey_drag__WEBPACK_IMPORTED_MODULE_2__.useHoneyDrag),
|
|
13724
13728
|
/* harmony export */ useHoneyLayout: () => (/* reexport safe */ _use_honey_layout__WEBPACK_IMPORTED_MODULE_4__.useHoneyLayout),
|
|
@@ -13746,6 +13750,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13746
13750
|
/* harmony import */ var _use_honey_synthetic_scroll_y__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./use-honey-synthetic-scroll-y */ "./src/hooks/use-honey-synthetic-scroll-y.ts");
|
|
13747
13751
|
/* harmony import */ var _use_honey_raf_loop__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./use-honey-raf-loop */ "./src/hooks/use-honey-raf-loop.ts");
|
|
13748
13752
|
/* harmony import */ var _use_honey_timer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./use-honey-timer */ "./src/hooks/use-honey-timer.ts");
|
|
13753
|
+
/* harmony import */ var _use_honey_decay__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./use-honey-decay */ "./src/hooks/use-honey-decay.ts");
|
|
13754
|
+
|
|
13749
13755
|
|
|
13750
13756
|
|
|
13751
13757
|
|
|
@@ -13761,6 +13767,133 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13761
13767
|
|
|
13762
13768
|
|
|
13763
13769
|
|
|
13770
|
+
/***/ },
|
|
13771
|
+
|
|
13772
|
+
/***/ "./src/hooks/use-honey-decay.ts"
|
|
13773
|
+
/*!**************************************!*\
|
|
13774
|
+
!*** ./src/hooks/use-honey-decay.ts ***!
|
|
13775
|
+
\**************************************/
|
|
13776
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
13777
|
+
|
|
13778
|
+
"use strict";
|
|
13779
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13780
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13781
|
+
/* harmony export */ useHoneyDecay: () => (/* binding */ useHoneyDecay)
|
|
13782
|
+
/* harmony export */ });
|
|
13783
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
13784
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
13785
|
+
/* harmony import */ var _react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @react-hive/honey-utils */ "./node_modules/@react-hive/honey-utils/dist/index.mjs");
|
|
13786
|
+
/* harmony import */ var _use_honey_raf_loop__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./use-honey-raf-loop */ "./src/hooks/use-honey-raf-loop.ts");
|
|
13787
|
+
|
|
13788
|
+
|
|
13789
|
+
|
|
13790
|
+
/**
|
|
13791
|
+
* A bounded, velocity-based inertia (decay) hook built on top of {@link useHoneyRafLoop} and {@link applyInertiaStep}.
|
|
13792
|
+
*
|
|
13793
|
+
* This hook models **momentum-driven motion** where:
|
|
13794
|
+
* - Motion starts with an initial velocity
|
|
13795
|
+
* - Velocity decays exponentially over time
|
|
13796
|
+
* - Movement is constrained by hard numeric bounds
|
|
13797
|
+
* - Inertia stops naturally when velocity becomes negligible
|
|
13798
|
+
*
|
|
13799
|
+
* Unlike spring-based motion, this hook has **no target value**.
|
|
13800
|
+
* Motion continues purely based on momentum until it decays
|
|
13801
|
+
* or is blocked by a boundary.
|
|
13802
|
+
*
|
|
13803
|
+
* ---
|
|
13804
|
+
*
|
|
13805
|
+
* ### Key characteristics
|
|
13806
|
+
* - Frame-rate independent (delta-time based)
|
|
13807
|
+
* - Deterministic and interruptible
|
|
13808
|
+
* - Direction-aware and bound-safe (no overshoot or jitter)
|
|
13809
|
+
* - Closely matches native scroll and drag inertia behavior
|
|
13810
|
+
*
|
|
13811
|
+
* ---
|
|
13812
|
+
*
|
|
13813
|
+
* ### Visibility behavior
|
|
13814
|
+
* This hook is a **simulation-based system**:
|
|
13815
|
+
* - Inertia automatically pauses when the document becomes hidden
|
|
13816
|
+
* - No time elapses while hidden
|
|
13817
|
+
* - Motion resumes only when explicitly restarted
|
|
13818
|
+
*
|
|
13819
|
+
* This behavior is inherited from {@link useHoneyRafLoop} and is intentional.
|
|
13820
|
+
*
|
|
13821
|
+
* ---
|
|
13822
|
+
*
|
|
13823
|
+
* ### Common use cases
|
|
13824
|
+
* - Scroll containers with momentum
|
|
13825
|
+
* - Drag-to-scroll interactions
|
|
13826
|
+
* - Carousels and sliders
|
|
13827
|
+
* - Timelines and scrubbers
|
|
13828
|
+
* - Kinetic panning and flinging
|
|
13829
|
+
*
|
|
13830
|
+
* ---
|
|
13831
|
+
*
|
|
13832
|
+
* @example
|
|
13833
|
+
* ```ts
|
|
13834
|
+
* const decay = useHoneyDecay({
|
|
13835
|
+
* initialValue: 0,
|
|
13836
|
+
* min: -maxOverflow,
|
|
13837
|
+
* max: 0,
|
|
13838
|
+
* });
|
|
13839
|
+
*
|
|
13840
|
+
* const onRelease = (velocityPxMs: number) => {
|
|
13841
|
+
* decay.start(velocityPxMs);
|
|
13842
|
+
* };
|
|
13843
|
+
*
|
|
13844
|
+
* return (
|
|
13845
|
+
* <div style={{ transform: `translateX(${decay.value}px)` }} />
|
|
13846
|
+
* );
|
|
13847
|
+
* ```
|
|
13848
|
+
*/
|
|
13849
|
+
const useHoneyDecay = ({ initialValue, min, max, friction, minVelocityPxMs, }) => {
|
|
13850
|
+
const [value, setValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialValue);
|
|
13851
|
+
const valueRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(initialValue);
|
|
13852
|
+
const velocityPxMsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);
|
|
13853
|
+
const onFrameHandler = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((deltaTimeMs, frameContext) => {
|
|
13854
|
+
const result = (0,_react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_1__.applyInertiaStep)({
|
|
13855
|
+
value: valueRef.current,
|
|
13856
|
+
velocityPxMs: velocityPxMsRef.current,
|
|
13857
|
+
min,
|
|
13858
|
+
max,
|
|
13859
|
+
deltaTimeMs,
|
|
13860
|
+
friction,
|
|
13861
|
+
minVelocityPxMs,
|
|
13862
|
+
});
|
|
13863
|
+
if (!result) {
|
|
13864
|
+
velocityPxMsRef.current = 0;
|
|
13865
|
+
frameContext.stop();
|
|
13866
|
+
return;
|
|
13867
|
+
}
|
|
13868
|
+
valueRef.current = result.value;
|
|
13869
|
+
velocityPxMsRef.current = result.velocityPxMs;
|
|
13870
|
+
setValue(result.value);
|
|
13871
|
+
}, [min, max, friction, minVelocityPxMs]);
|
|
13872
|
+
const rafLoop = (0,_use_honey_raf_loop__WEBPACK_IMPORTED_MODULE_2__.useHoneyRafLoop)(onFrameHandler);
|
|
13873
|
+
const start = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((velocityPxMs) => {
|
|
13874
|
+
velocityPxMsRef.current = velocityPxMs;
|
|
13875
|
+
rafLoop.start();
|
|
13876
|
+
}, [rafLoop.start]);
|
|
13877
|
+
const stop = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => {
|
|
13878
|
+
velocityPxMsRef.current = 0;
|
|
13879
|
+
rafLoop.stop();
|
|
13880
|
+
}, [rafLoop.stop]);
|
|
13881
|
+
const snapTo = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((nextValue) => {
|
|
13882
|
+
velocityPxMsRef.current = 0;
|
|
13883
|
+
valueRef.current = nextValue;
|
|
13884
|
+
rafLoop.stop();
|
|
13885
|
+
setValue(nextValue);
|
|
13886
|
+
}, [rafLoop.stop]);
|
|
13887
|
+
return {
|
|
13888
|
+
value,
|
|
13889
|
+
isRunning: rafLoop.isRunning,
|
|
13890
|
+
start,
|
|
13891
|
+
stop,
|
|
13892
|
+
snapTo,
|
|
13893
|
+
};
|
|
13894
|
+
};
|
|
13895
|
+
|
|
13896
|
+
|
|
13764
13897
|
/***/ },
|
|
13765
13898
|
|
|
13766
13899
|
/***/ "./src/hooks/use-honey-document-key-up-handler.ts"
|
|
@@ -13834,21 +13967,25 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13834
13967
|
/* harmony export */ });
|
|
13835
13968
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
13836
13969
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
13837
|
-
/* harmony import */ var _react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @react-hive/honey-utils */ "./node_modules/@react-hive/honey-utils/dist/index.mjs");
|
|
13838
|
-
|
|
13839
13970
|
|
|
13840
13971
|
/**
|
|
13841
|
-
*
|
|
13842
|
-
* It enables the ability to drag an element on both mouse and touch interfaces,
|
|
13843
|
-
* with customizable handlers for different stages of the drag.
|
|
13972
|
+
* Enables high-precision mouse and touch dragging for an element.
|
|
13844
13973
|
*
|
|
13845
|
-
*
|
|
13974
|
+
* This hook:
|
|
13975
|
+
* - Tracks pointer movement using `performance.now()`
|
|
13976
|
+
* - Computes **instantaneous release velocity** (px/ms)
|
|
13977
|
+
* - Emits deterministic drag lifecycle events
|
|
13978
|
+
* - Supports both mouse and touch input
|
|
13979
|
+
*
|
|
13980
|
+
* Architectural notes:
|
|
13981
|
+
* - Velocity is computed **during movement**, not at drag end
|
|
13982
|
+
* - Release velocity is suitable for inertia / decay systems
|
|
13983
|
+
* - No layout reads or writes are performed internally
|
|
13846
13984
|
*
|
|
13847
|
-
* @
|
|
13848
|
-
* @param options - Handlers for different stages of the drag operation and configuration options
|
|
13849
|
-
* for controlling drag behavior.
|
|
13985
|
+
* @template Element - The draggable HTML element type.
|
|
13850
13986
|
*
|
|
13851
|
-
* @
|
|
13987
|
+
* @param draggableElementRef - Ref pointing to the draggable element.
|
|
13988
|
+
* @param options - Drag lifecycle handlers and configuration flags.
|
|
13852
13989
|
*/
|
|
13853
13990
|
const useHoneyDrag = (draggableElementRef, { skipOnEndDragWhenStopped = false, enabled = true, onMoveDrag, onStartDrag, onEndDrag, }) => {
|
|
13854
13991
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
@@ -13862,19 +13999,22 @@ const useHoneyDrag = (draggableElementRef, { skipOnEndDragWhenStopped = false, e
|
|
|
13862
13999
|
let startY = 0;
|
|
13863
14000
|
let lastX = 0;
|
|
13864
14001
|
let lastY = 0;
|
|
13865
|
-
|
|
13866
|
-
let
|
|
14002
|
+
let lastMoveTimeMs = 0;
|
|
14003
|
+
let velocityXPxMs = 0;
|
|
14004
|
+
let velocityYPxMs = 0;
|
|
13867
14005
|
const startDrag = async (clientX, clientY, e) => {
|
|
13868
14006
|
if (onStartDrag && !(await onStartDrag(draggableElement, e))) {
|
|
13869
14007
|
// Exit when `onStartDrag` returns false, preventing the dragging
|
|
13870
14008
|
return;
|
|
13871
14009
|
}
|
|
14010
|
+
lastMoveTimeMs = performance.now();
|
|
13872
14011
|
isDragging = true;
|
|
13873
14012
|
startX = clientX;
|
|
13874
14013
|
startY = clientY;
|
|
13875
14014
|
lastX = clientX;
|
|
13876
14015
|
lastY = clientY;
|
|
13877
|
-
|
|
14016
|
+
velocityXPxMs = 0;
|
|
14017
|
+
velocityYPxMs = 0;
|
|
13878
14018
|
};
|
|
13879
14019
|
const stopDrag = async (isTriggerOnEndDrag, e) => {
|
|
13880
14020
|
if (!isDragging) {
|
|
@@ -13882,19 +14022,13 @@ const useHoneyDrag = (draggableElementRef, { skipOnEndDragWhenStopped = false, e
|
|
|
13882
14022
|
}
|
|
13883
14023
|
isDragging = false;
|
|
13884
14024
|
if (isTriggerOnEndDrag && onEndDrag) {
|
|
13885
|
-
// Calculate the elapsed time for speed calculations.
|
|
13886
|
-
const elapsedTime = Date.now() - startTime;
|
|
13887
14025
|
const deltaX = lastX - startX;
|
|
13888
14026
|
const deltaY = lastY - startY;
|
|
13889
14027
|
const endContext = {
|
|
13890
14028
|
deltaX,
|
|
13891
14029
|
deltaY,
|
|
13892
|
-
|
|
13893
|
-
|
|
13894
|
-
},
|
|
13895
|
-
get movingSpeedY() {
|
|
13896
|
-
return (0,_react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_1__.calculateMovingSpeed)(deltaY, elapsedTime);
|
|
13897
|
-
},
|
|
14030
|
+
velocityXPxMs,
|
|
14031
|
+
velocityYPxMs,
|
|
13898
14032
|
};
|
|
13899
14033
|
await onEndDrag(endContext, draggableElement, e);
|
|
13900
14034
|
}
|
|
@@ -13914,21 +14048,28 @@ const useHoneyDrag = (draggableElementRef, { skipOnEndDragWhenStopped = false, e
|
|
|
13914
14048
|
if (!isDragging) {
|
|
13915
14049
|
return;
|
|
13916
14050
|
}
|
|
13917
|
-
const
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
if (!(await onMove(moveContext))) {
|
|
13925
|
-
lastX = clientX;
|
|
13926
|
-
lastY = clientY;
|
|
13927
|
-
await releaseDrag(!skipOnEndDragWhenStopped, e);
|
|
13928
|
-
return;
|
|
14051
|
+
const nowMs = performance.now();
|
|
14052
|
+
const deltaTimeMs = nowMs - lastMoveTimeMs;
|
|
14053
|
+
const deltaX = clientX - lastX;
|
|
14054
|
+
const deltaY = clientY - lastY;
|
|
14055
|
+
if (deltaTimeMs > 0) {
|
|
14056
|
+
velocityXPxMs = deltaX / deltaTimeMs;
|
|
14057
|
+
velocityYPxMs = deltaY / deltaTimeMs;
|
|
13929
14058
|
}
|
|
14059
|
+
const distanceX = clientX - startX;
|
|
14060
|
+
const distanceY = clientY - startY;
|
|
14061
|
+
const isContinue = await onMove({
|
|
14062
|
+
deltaX,
|
|
14063
|
+
deltaY,
|
|
14064
|
+
distanceX,
|
|
14065
|
+
distanceY,
|
|
14066
|
+
});
|
|
13930
14067
|
lastX = clientX;
|
|
13931
14068
|
lastY = clientY;
|
|
14069
|
+
lastMoveTimeMs = nowMs;
|
|
14070
|
+
if (!isContinue) {
|
|
14071
|
+
await releaseDrag(!skipOnEndDragWhenStopped, e);
|
|
14072
|
+
}
|
|
13932
14073
|
};
|
|
13933
14074
|
const mouseMoveHandler = async (e) => {
|
|
13934
14075
|
await moveHandler(e.clientX, e.clientY, e);
|
|
@@ -14678,7 +14819,7 @@ const useHoneyTimer = ({ initialTimeMs, targetTimeMs = 0, mode = 'countdown', au
|
|
|
14678
14819
|
* - Detects completion and stops the RAF loop
|
|
14679
14820
|
* - Updates React state with the derived value
|
|
14680
14821
|
*/
|
|
14681
|
-
const onFrameHandler = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((deltaTimeMs,
|
|
14822
|
+
const onFrameHandler = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((deltaTimeMs, frameContext) => {
|
|
14682
14823
|
let nextTime = mode === 'countdown' ? timeRef.current - deltaTimeMs : timeRef.current + deltaTimeMs;
|
|
14683
14824
|
let finished = false;
|
|
14684
14825
|
if (mode === 'countdown') {
|
|
@@ -14694,7 +14835,7 @@ const useHoneyTimer = ({ initialTimeMs, targetTimeMs = 0, mode = 'countdown', au
|
|
|
14694
14835
|
timeRef.current = nextTime;
|
|
14695
14836
|
setTimeMs(nextTime);
|
|
14696
14837
|
if (finished) {
|
|
14697
|
-
stop();
|
|
14838
|
+
frameContext.stop();
|
|
14698
14839
|
onEndRef.current?.();
|
|
14699
14840
|
}
|
|
14700
14841
|
}, [mode, targetTimeMs]);
|
|
@@ -15513,6 +15654,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
15513
15654
|
/* harmony export */ resolveScreenState: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_7__.resolveScreenState),
|
|
15514
15655
|
/* harmony export */ resolveSpacing: () => (/* binding */ resolveSpacing),
|
|
15515
15656
|
/* harmony export */ searchFlattenedItems: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_6__.searchFlattenedItems),
|
|
15657
|
+
/* harmony export */ useHoneyDecay: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_5__.useHoneyDecay),
|
|
15516
15658
|
/* harmony export */ useHoneyDocumentKeyUpHandler: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_5__.useHoneyDocumentKeyUpHandler),
|
|
15517
15659
|
/* harmony export */ useHoneyDrag: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_5__.useHoneyDrag),
|
|
15518
15660
|
/* harmony export */ useHoneyGridContext: () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_3__.useHoneyGridContext),
|