@react-hive/honey-layout 10.8.0 → 11.1.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/components/HoneyBox/HoneyBox.d.ts +1 -1
- package/dist/components/HoneyFlex/HoneyFlex.d.ts +1 -1
- package/dist/components/HoneyGrid/HoneyGridStyled.d.ts +1 -1
- package/dist/components/HoneyGridColumn/HoneyGridColumnStyled.d.ts +1 -1
- package/dist/components/HoneyList/HoneyListStyled.d.ts +1 -1
- package/dist/components/HoneyPopup/HoneyPopupStyled.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-honey-decay.d.ts +153 -0
- package/dist/hooks/use-honey-drag.d.ts +91 -50
- package/dist/hooks/use-honey-raf-loop.d.ts +4 -4
- package/dist/hooks/use-honey-timer.d.ts +2 -2
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +249 -92
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +13 -13
- 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,7 @@ __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");
|
|
13749
13754
|
|
|
13750
13755
|
|
|
13751
13756
|
|
|
@@ -13761,6 +13766,149 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13761
13766
|
|
|
13762
13767
|
|
|
13763
13768
|
|
|
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 = 0.002, minVelocityPxMs = 0.01, }) => {
|
|
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 minRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(min);
|
|
13854
|
+
const maxRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(max);
|
|
13855
|
+
const frameHandler = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((deltaTimeMs, frameContext) => {
|
|
13856
|
+
const result = (0,_react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_1__.applyInertiaStep)({
|
|
13857
|
+
value: valueRef.current,
|
|
13858
|
+
velocityPxMs: velocityPxMsRef.current,
|
|
13859
|
+
min: minRef.current,
|
|
13860
|
+
max: maxRef.current,
|
|
13861
|
+
deltaTimeMs,
|
|
13862
|
+
friction,
|
|
13863
|
+
minVelocityPxMs,
|
|
13864
|
+
});
|
|
13865
|
+
if (!result) {
|
|
13866
|
+
velocityPxMsRef.current = 0;
|
|
13867
|
+
frameContext.stop();
|
|
13868
|
+
return;
|
|
13869
|
+
}
|
|
13870
|
+
valueRef.current = result.value;
|
|
13871
|
+
velocityPxMsRef.current = result.velocityPxMs;
|
|
13872
|
+
setValue(result.value);
|
|
13873
|
+
}, [friction, minVelocityPxMs]);
|
|
13874
|
+
const rafLoop = (0,_use_honey_raf_loop__WEBPACK_IMPORTED_MODULE_2__.useHoneyRafLoop)(frameHandler);
|
|
13875
|
+
const setBounds = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((nextMin, nextMax) => {
|
|
13876
|
+
minRef.current = nextMin;
|
|
13877
|
+
maxRef.current = nextMax;
|
|
13878
|
+
if (valueRef.current < nextMin) {
|
|
13879
|
+
valueRef.current = nextMin;
|
|
13880
|
+
setValue(nextMin);
|
|
13881
|
+
}
|
|
13882
|
+
else if (valueRef.current > nextMax) {
|
|
13883
|
+
valueRef.current = nextMax;
|
|
13884
|
+
setValue(nextMax);
|
|
13885
|
+
}
|
|
13886
|
+
}, []);
|
|
13887
|
+
const start = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((velocityPxMs) => {
|
|
13888
|
+
velocityPxMsRef.current = velocityPxMs;
|
|
13889
|
+
rafLoop.start();
|
|
13890
|
+
}, [rafLoop.start]);
|
|
13891
|
+
const stop = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => {
|
|
13892
|
+
velocityPxMsRef.current = 0;
|
|
13893
|
+
rafLoop.stop();
|
|
13894
|
+
}, [rafLoop.stop]);
|
|
13895
|
+
const snapTo = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((nextValue) => {
|
|
13896
|
+
velocityPxMsRef.current = 0;
|
|
13897
|
+
valueRef.current = nextValue;
|
|
13898
|
+
rafLoop.stop();
|
|
13899
|
+
setValue(nextValue);
|
|
13900
|
+
}, [rafLoop.stop]);
|
|
13901
|
+
return {
|
|
13902
|
+
value,
|
|
13903
|
+
isRunning: rafLoop.isRunning,
|
|
13904
|
+
setBounds,
|
|
13905
|
+
start,
|
|
13906
|
+
stop,
|
|
13907
|
+
snapTo,
|
|
13908
|
+
};
|
|
13909
|
+
};
|
|
13910
|
+
|
|
13911
|
+
|
|
13764
13912
|
/***/ },
|
|
13765
13913
|
|
|
13766
13914
|
/***/ "./src/hooks/use-honey-document-key-up-handler.ts"
|
|
@@ -13834,21 +13982,25 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13834
13982
|
/* harmony export */ });
|
|
13835
13983
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
13836
13984
|
/* 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
13985
|
|
|
13840
13986
|
/**
|
|
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.
|
|
13987
|
+
* Enables high-precision mouse and touch dragging for an element.
|
|
13844
13988
|
*
|
|
13845
|
-
*
|
|
13989
|
+
* This hook:
|
|
13990
|
+
* - Tracks pointer movement using `performance.now()`
|
|
13991
|
+
* - Computes **instantaneous release velocity** (px/ms)
|
|
13992
|
+
* - Emits deterministic drag lifecycle events
|
|
13993
|
+
* - Supports both mouse and touch input
|
|
13994
|
+
*
|
|
13995
|
+
* Architectural notes:
|
|
13996
|
+
* - Velocity is computed **during movement**, not at drag end
|
|
13997
|
+
* - Release velocity is suitable for inertia / decay systems
|
|
13998
|
+
* - No layout reads or writes are performed internally
|
|
13846
13999
|
*
|
|
13847
|
-
* @
|
|
13848
|
-
* @param options - Handlers for different stages of the drag operation and configuration options
|
|
13849
|
-
* for controlling drag behavior.
|
|
14000
|
+
* @template Element - The draggable HTML element type.
|
|
13850
14001
|
*
|
|
13851
|
-
* @
|
|
14002
|
+
* @param draggableElementRef - Ref pointing to the draggable element.
|
|
14003
|
+
* @param options - Drag lifecycle handlers and configuration flags.
|
|
13852
14004
|
*/
|
|
13853
14005
|
const useHoneyDrag = (draggableElementRef, { skipOnEndDragWhenStopped = false, enabled = true, onMoveDrag, onStartDrag, onEndDrag, }) => {
|
|
13854
14006
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
@@ -13862,19 +14014,22 @@ const useHoneyDrag = (draggableElementRef, { skipOnEndDragWhenStopped = false, e
|
|
|
13862
14014
|
let startY = 0;
|
|
13863
14015
|
let lastX = 0;
|
|
13864
14016
|
let lastY = 0;
|
|
13865
|
-
|
|
13866
|
-
let
|
|
14017
|
+
let lastMoveTimeMs = 0;
|
|
14018
|
+
let velocityXPxMs = 0;
|
|
14019
|
+
let velocityYPxMs = 0;
|
|
13867
14020
|
const startDrag = async (clientX, clientY, e) => {
|
|
13868
14021
|
if (onStartDrag && !(await onStartDrag(draggableElement, e))) {
|
|
13869
14022
|
// Exit when `onStartDrag` returns false, preventing the dragging
|
|
13870
14023
|
return;
|
|
13871
14024
|
}
|
|
14025
|
+
lastMoveTimeMs = performance.now();
|
|
13872
14026
|
isDragging = true;
|
|
13873
14027
|
startX = clientX;
|
|
13874
14028
|
startY = clientY;
|
|
13875
14029
|
lastX = clientX;
|
|
13876
14030
|
lastY = clientY;
|
|
13877
|
-
|
|
14031
|
+
velocityXPxMs = 0;
|
|
14032
|
+
velocityYPxMs = 0;
|
|
13878
14033
|
};
|
|
13879
14034
|
const stopDrag = async (isTriggerOnEndDrag, e) => {
|
|
13880
14035
|
if (!isDragging) {
|
|
@@ -13882,19 +14037,13 @@ const useHoneyDrag = (draggableElementRef, { skipOnEndDragWhenStopped = false, e
|
|
|
13882
14037
|
}
|
|
13883
14038
|
isDragging = false;
|
|
13884
14039
|
if (isTriggerOnEndDrag && onEndDrag) {
|
|
13885
|
-
// Calculate the elapsed time for speed calculations.
|
|
13886
|
-
const elapsedTime = Date.now() - startTime;
|
|
13887
14040
|
const deltaX = lastX - startX;
|
|
13888
14041
|
const deltaY = lastY - startY;
|
|
13889
14042
|
const endContext = {
|
|
13890
14043
|
deltaX,
|
|
13891
14044
|
deltaY,
|
|
13892
|
-
|
|
13893
|
-
|
|
13894
|
-
},
|
|
13895
|
-
get movingSpeedY() {
|
|
13896
|
-
return (0,_react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_1__.calculateMovingSpeed)(deltaY, elapsedTime);
|
|
13897
|
-
},
|
|
14045
|
+
velocityXPxMs,
|
|
14046
|
+
velocityYPxMs,
|
|
13898
14047
|
};
|
|
13899
14048
|
await onEndDrag(endContext, draggableElement, e);
|
|
13900
14049
|
}
|
|
@@ -13914,21 +14063,28 @@ const useHoneyDrag = (draggableElementRef, { skipOnEndDragWhenStopped = false, e
|
|
|
13914
14063
|
if (!isDragging) {
|
|
13915
14064
|
return;
|
|
13916
14065
|
}
|
|
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;
|
|
14066
|
+
const nowMs = performance.now();
|
|
14067
|
+
const deltaTimeMs = nowMs - lastMoveTimeMs;
|
|
14068
|
+
const deltaX = clientX - lastX;
|
|
14069
|
+
const deltaY = clientY - lastY;
|
|
14070
|
+
if (deltaTimeMs > 0) {
|
|
14071
|
+
velocityXPxMs = deltaX / deltaTimeMs;
|
|
14072
|
+
velocityYPxMs = deltaY / deltaTimeMs;
|
|
13929
14073
|
}
|
|
14074
|
+
const distanceX = clientX - startX;
|
|
14075
|
+
const distanceY = clientY - startY;
|
|
14076
|
+
const isContinue = await onMove({
|
|
14077
|
+
deltaX,
|
|
14078
|
+
deltaY,
|
|
14079
|
+
distanceX,
|
|
14080
|
+
distanceY,
|
|
14081
|
+
});
|
|
13930
14082
|
lastX = clientX;
|
|
13931
14083
|
lastY = clientY;
|
|
14084
|
+
lastMoveTimeMs = nowMs;
|
|
14085
|
+
if (!isContinue) {
|
|
14086
|
+
await releaseDrag(!skipOnEndDragWhenStopped, e);
|
|
14087
|
+
}
|
|
13932
14088
|
};
|
|
13933
14089
|
const mouseMoveHandler = async (e) => {
|
|
13934
14090
|
await moveHandler(e.clientX, e.clientY, e);
|
|
@@ -14678,7 +14834,7 @@ const useHoneyTimer = ({ initialTimeMs, targetTimeMs = 0, mode = 'countdown', au
|
|
|
14678
14834
|
* - Detects completion and stops the RAF loop
|
|
14679
14835
|
* - Updates React state with the derived value
|
|
14680
14836
|
*/
|
|
14681
|
-
const
|
|
14837
|
+
const frameHandler = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((deltaTimeMs, frameContext) => {
|
|
14682
14838
|
let nextTime = mode === 'countdown' ? timeRef.current - deltaTimeMs : timeRef.current + deltaTimeMs;
|
|
14683
14839
|
let finished = false;
|
|
14684
14840
|
if (mode === 'countdown') {
|
|
@@ -14694,11 +14850,11 @@ const useHoneyTimer = ({ initialTimeMs, targetTimeMs = 0, mode = 'countdown', au
|
|
|
14694
14850
|
timeRef.current = nextTime;
|
|
14695
14851
|
setTimeMs(nextTime);
|
|
14696
14852
|
if (finished) {
|
|
14697
|
-
stop();
|
|
14853
|
+
frameContext.stop();
|
|
14698
14854
|
onEndRef.current?.();
|
|
14699
14855
|
}
|
|
14700
14856
|
}, [mode, targetTimeMs]);
|
|
14701
|
-
const rafLoop = (0,_use_honey_raf_loop__WEBPACK_IMPORTED_MODULE_1__.useHoneyRafLoop)(
|
|
14857
|
+
const rafLoop = (0,_use_honey_raf_loop__WEBPACK_IMPORTED_MODULE_1__.useHoneyRafLoop)(frameHandler);
|
|
14702
14858
|
const start = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => {
|
|
14703
14859
|
timeRef.current = initialTimeMs;
|
|
14704
14860
|
setTimeMs(initialTimeMs);
|
|
@@ -15513,6 +15669,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
15513
15669
|
/* harmony export */ resolveScreenState: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_7__.resolveScreenState),
|
|
15514
15670
|
/* harmony export */ resolveSpacing: () => (/* binding */ resolveSpacing),
|
|
15515
15671
|
/* harmony export */ searchFlattenedItems: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_6__.searchFlattenedItems),
|
|
15672
|
+
/* harmony export */ useHoneyDecay: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_5__.useHoneyDecay),
|
|
15516
15673
|
/* harmony export */ useHoneyDocumentKeyUpHandler: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_5__.useHoneyDocumentKeyUpHandler),
|
|
15517
15674
|
/* harmony export */ useHoneyDrag: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_5__.useHoneyDrag),
|
|
15518
15675
|
/* harmony export */ useHoneyGridContext: () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_3__.useHoneyGridContext),
|