@alessiofrittoli/react-hooks 3.2.0-alpha.1 → 3.2.0-alpha.3

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/index.mjs CHANGED
@@ -1 +1 @@
1
- import{useCallback as w,useEffect as z,useState as G}from"react";import{LocalStorage as V}from"@alessiofrittoli/web-utils/storage/LocalStorage";import{SessionStorage as K}from"@alessiofrittoli/web-utils/storage/SessionStorage";var O=(e,o,t="local")=>{let s=w(()=>(t==="local"?V:K).get(e)??o,[t,e,o]),[i,a]=G(o),r=w(n=>{a(u=>{let l=n instanceof Function?n(u):n;return(typeof window<"u"&&t==="local"?V:K).set(e,l),l})},[t,e]);return z(()=>{a(s())},[s]),[i,r]};var W=(e,o)=>O(e,o,"local");var Ve=(e,o)=>O(e,o,"session");import{useCallback as R,useEffect as Q,useRef as re}from"react";import{useEffect as X}from"react";import{useRef as J}from"react";var S=()=>{let e=J(!0);return e.current?(e.current=!1,!0):e.current};var je=e=>{let o=S();X(()=>{if(o)return e()},[])};import{useEffect as Y,useState as Z}from"react";var U=()=>{let[e,o]=Z(!1);return Y(()=>o(!0),[]),e};import{useEffect as _}from"react";var h=(e,o)=>{let t=S();_(()=>{if(!t)return e()},o)};import{useCallback as ee,useEffect as te,useState as ne}from"react";import{getMediaMatches as A}from"@alessiofrittoli/web-utils/browser-api";function b(e,o={}){let{updateState:t=!0,onChange:s}=o,[i,a]=ne(A(e)),r=ee(()=>{let n=A(e);t&&a(n),s?.(n)},[e,t,s]);if(te(()=>{let n=window.matchMedia(e),{matches:u}=n;return t&&a(u),s?.(u),n.addEventListener("change",r),()=>{n.removeEventListener("change",r)}},[e,t,s,r]),!!t)return i}var it=(e={})=>{let o=U(),t=b("(prefers-color-scheme: dark)"),{initial:s=t,docClassNames:i=[]}=e,[a,r]=W("dark-mode",s),n=a??t,[u,l]=i,c=re({light:"",dark:""});return h(()=>{r(t)},[t,r]),Q(()=>{u&&document.documentElement.classList.toggle(u,n),l&&document.documentElement.classList.toggle(l,!n)},[n,u,l]),Q(()=>{document.head.querySelectorAll('meta[name="theme-color"]').forEach(p=>{let f=p.getAttribute("media"),T=p.getAttribute("content");if(T){if(!f||f==="(prefers-color-scheme: light)"){c.current.light=T;return}c.current.dark=T}})},[]),h(()=>{let p=c.current.dark,f=c.current.light;a&&!p||!a&&!f||document.head.querySelectorAll('meta[name="theme-color"]').forEach(T=>{T.setAttribute("content",a?p:f)})},[a]),{isDarkMode:o?n:!1,isDarkOS:o?t:!1,toggleDarkMode:R(()=>r(p=>!p),[r]),enableDarkMode:R(()=>r(!0),[r]),disableDarkMode:R(()=>r(!1),[r])}};import{useEffect as oe}from"react";function lt(e,o){let{target:t,query:s,options:i,listener:a,onLoad:r,onCleanUp:n}=o;oe(()=>{let u=Array.isArray(e)?e:[e],l=(s?window.matchMedia(s):t&&"current"in t?t.current:t)??window;if(l.addEventListener)return r?.(),u.map(c=>{l.addEventListener(c,a,i)}),()=>{u.map(c=>{l.removeEventListener(c,a,i)}),n?.()}},[e,t,s,i,a,r,n])}import{portraitMediaQuery as se}from"@alessiofrittoli/web-utils/device";var Tt=()=>b(se);import{useCallback as F,useEffect as ie,useRef as ae,useState as ue}from"react";var ce=["input","select","textarea","button","[href]",'[tabindex]:not([tabindex="-1"])'].join(", "),xt=e=>{let[o,t]=ue(!1),s=ae(null),i=F(r=>{s.current=document.activeElement;let n=r||e?.current||!1;if(n)return t(n)},[e]),a=F(()=>{s.current?.focus(),t(!1)},[]);return ie(()=>{if(!o)return;let r=n=>{if(n.key!=="Tab")return;let u=Array.from(o.querySelectorAll(ce)),l=u.at(0),c=u.at(-1);if(!n.shiftKey){document.activeElement===c&&(n.preventDefault(),l?.focus());return}document.activeElement===l&&(n.preventDefault(),c?.focus())};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[o]),[i,a]};import{useEffect as le,useMemo as pe,useRef as I,useState as $}from"react";var St=(e,o={})=>{let{initial:t=!1,once:s,amount:i,margin:a,root:r,enable:n=!0}=o,{onEnter:u,onExit:l,onIntersect:c}=o,p=I(!0),[f,T]=$(t),[v,N]=$(n),L=I(null),M=I(!1),x=pe(()=>{if(!v||typeof IntersectionObserver>"u")return;let P=i==="all"?1:i==="some"?.5:i;try{return new IntersectionObserver(async([E],g)=>{if(!E)return;let y=E.isIntersecting;try{if(M.current=!y&&!!L.current,y&&u&&await u({entry:E,observer:g}),M.current&&l&&await l({entry:E,observer:g}),c&&(y||!y&&L.current!=null)){let k={isEntering:y,isExiting:M.current};await c({entry:E,observer:g,...k})}if(L.current=y,!p.current)return;T(y)}catch(k){console.error(k)}y&&s&&g.disconnect()},{root:r||void 0,rootMargin:a,threshold:P})}catch(E){console.error(E)}},[r,a,i,s,v,u,l,c]);return le(()=>{if(p.current=!0,!(!v||!e.current||!x))return x.observe(e.current),()=>{p.current=!1,x.disconnect()}},[e,x,v]),{inView:f,enabled:v,observer:x,isExiting:M.current,setInView:T,setEnabled:N}};import{useCallback as j}from"react";import{blockScroll as me,restoreScroll as de}from"@alessiofrittoli/web-utils/dom";var Rt=e=>{let o=j(()=>me(e?.current||void 0),[e]),t=j(()=>de(e?.current||void 0),[e]);return[o,t]};import{useMemo as Te,useState as ye}from"react";import{useEffect as fe}from"react";var B=(e,o={})=>{let{delay:t=1,args:s}=o;fe(()=>{let i=setTimeout(e,t,...s||[]);return()=>clearTimeout(i)},[t,s,e])};var Wt=(e,o=500)=>{let[t,s]=ye(e),i=Te(()=>[e],[e]);return B(s,{delay:o,args:i}),t};import{useCallback as H,useEffect as Ee,useRef as ve,useState as xe}from"react";function q(e,o={}){let{delay:t=1,args:s,autoplay:i=!0,runOnStart:a=!1,updateState:r=!1}=o,n=ve(void 0),[u,l]=xe(i),c=H(()=>n.current?(clearInterval(n.current),n.current=void 0,!0):!1,[]),p=H(()=>{let T=c();return a&&(s?e(...s):e()),n.current=setInterval(e,t,...s||[]),!T&&r&&l(!0),n.current},[t,s,r,a,e,c]),f=H(()=>{c()&&r&&l(!1)},[r,c]);return Ee(()=>{if(i)return p(),f},[i,p,f]),r?{isActive:u,start:p,stop:f}:{start:p,stop:f}}import{useEffect as Me}from"react";var Bt=(e,o={})=>{let{delay:t=1,args:s}=o;Me(()=>{let i=setInterval(e,t,...s||[]);return()=>clearInterval(i)},[t,s,e])};import{useCallback as C,useEffect as ge}from"react";function Gt(e,o={}){let{autoplay:t=!0}=o,s=q(e,{autoplay:!1,...o}),{start:i,stop:a}=s,r=C(()=>document.hidden?a():i(),[i,a]),n=C(()=>{if(document.addEventListener("visibilitychange",r),!document.hidden)return i()},[i,r]),u=C(()=>{a(),document.removeEventListener("visibilitychange",r)},[a,r]);return ge(()=>{if(t)return n(),u},[t,n,u]),{...s,start:n,stop:u}}import{useCallback as D,useEffect as Oe,useRef as Se,useState as be}from"react";function Zt(e,o={}){let{delay:t=1,args:s,autoplay:i=!0,runOnStart:a=!1,updateState:r=!1}=o,n=Se(void 0),[u,l]=be(i),c=D(()=>n.current?(clearTimeout(n.current),n.current=void 0,!0):!1,[]),p=D(()=>{let T=c();return a&&(s?e(...s):e()),n.current=setTimeout(()=>{if(n.current=void 0,r&&l(!1),s)return e(...s);e()},t),!T&&r&&l(!0),n.current},[t,s,r,a,e,c]),f=D(()=>{c()&&r&&l(!1)},[r,c]);return Oe(()=>{if(i)return p(),f},[i,p,f]),r?{isActive:u,start:p,stop:f}:{start:p,stop:f}}export{it as useDarkMode,Wt as useDebounce,je as useEffectOnce,lt as useEventListener,xt as useFocusTrap,St as useInView,q as useInterval,Gt as useIntervalWhenVisible,U as useIsClient,S as useIsFirstRender,Tt as useIsPortrait,Bt as useLightInterval,B as useLightTimeout,W as useLocalStorage,b as useMediaQuery,Rt as useScrollBlock,Ve as useSessionStorage,O as useStorage,Zt as useTimeout,h as useUpdateEffect};
1
+ import{useCallback as Q,useEffect as ee,useState as te}from"react";import{LocalStorage as F}from"@alessiofrittoli/web-utils/storage/LocalStorage";import{SessionStorage as $}from"@alessiofrittoli/web-utils/storage/SessionStorage";var h=(e,n,t="local")=>{let r=Q(()=>(t==="local"?F:$).get(e)??n,[t,e,n]),[i,u]=te(n),s=Q(o=>{u(c=>{let l=o instanceof Function?o(c):o;return(typeof window<"u"&&t==="local"?F:$).set(e,l),l})},[t,e]);return ee(()=>{u(r())},[r]),[i,s]};var j=(e,n)=>h(e,n,"local");var ze=(e,n)=>h(e,n,"session");import{useCallback as ne,useState as re}from"react";var P=e=>e?"online":"offline",_e=()=>{let[e,n]=re(P(!0)),t=e==="online",r=e==="offline",i=ne(()=>n(P(navigator.onLine)),[]);return B(["online","offline"],{listener:i,onLoad:i}),{connection:e,isOnline:t,isOffline:r}};import{useCallback as D,useEffect as z,useRef as ve}from"react";import{useCallback as I,useReducer as ae}from"react";import{useEffect as se}from"react";import{useRef as oe}from"react";var R=()=>{let e=oe(!0);return e.current?(e.current=!1,!0):e.current};var H=(e,n)=>{let t=R();se(()=>{if(!t)return e()},n)};import{isEmpty as ie}from"@alessiofrittoli/web-utils";var L=e=>typeof e=="string"?ie(e):!e,w={value:"",isTouched:!1,isValid:!0},N=(e,n)=>{switch(n.type){case"TOUCHED":return{...e,isTouched:!0};case"CHANGE":return{...e,value:n.value};case"BLUR":return{...e,value:e.value,isTouched:!L(e.value??"")};case"RESET":return w}};var Tt=(e={})=>{let{inputRef:n}=e,{initialValue:t}=e,{touchTimeout:r=600}=e,{validate:i,parse:u}=e,{onChange:s}=e,[o,c]=ae(N,{...w,value:t}),l=u?u(o.value):o.value,{isTouched:a}=o,d=L(l),p=typeof i=="function"?i(l):!0,T=!p&&a||!!t&&!p;H(()=>{let y=setTimeout(()=>{L(l)||c({type:"TOUCHED"})},r);return()=>clearTimeout(y)},[l,r]);let v=I(y=>{let{target:S}=y,{type:E}=S,b=E==="checkbox"?S.checked:S.value;c({type:"CHANGE",value:b}),s?.(u?u(b):b)},[s,u]),O=I(()=>{c({type:"BLUR"})},[]),g=I(()=>{c({type:"TOUCHED"})},[]),x=I(y=>{c({type:"CHANGE",value:y})},[]),M=I(()=>{n?.current?.focus()},[n]),C=I(()=>{c({type:"RESET"})},[]);return{value:l,isTouched:a,isValid:p,isEmpty:d,hasError:T,changeHandler:v,blurHandler:O,setValue:x,submit:g,focus:M,reset:C}};import{useEffect as ue}from"react";var St=e=>{let n=R();ue(()=>{if(n)return e()},[])};import{useEffect as ce,useState as le}from"react";var G=()=>{let[e,n]=le(!1);return ce(()=>n(!0),[]),e};import{useMemo as pe}from"react";import{paginate as de}from"@alessiofrittoli/math-utils/helpers";var Rt=(e={})=>pe(()=>de(e),[e]);import{useCallback as k,useState as me}from"react";var Ct=(e,n=[])=>{let[t,r]=me(n),i=t.length>0,u=a=>t.includes(a),s=k(a=>r(d=>{let p=new Set(d);return p.has(a)?p.delete(a):p.add(a),Array.from(p.values())}),[]),o=k(a=>{r(d=>{if(d.length===0)return[a];let p=[...e],T=p.indexOf(d.at(0)),v=p.indexOf(a);if(T>v){let O=[...p].reverse(),g=O.indexOf(d.at(0)),x=O.indexOf(a);return O.slice(g,x+1).reverse()}return p.slice(T,v+1)})},[e]),c=k(()=>{r(e)},[e]),l=k(a=>r(a?n:[]),[n]);return{selection:t,hasSelection:i,isSelected:u,setSelection:r,select:s,groupSelect:o,selectAll:c,resetSelection:l}};import{useCallback as fe,useEffect as Te,useState as ye}from"react";import{getMediaMatches as q}from"@alessiofrittoli/web-utils/browser-api";function V(e,n={}){let{updateState:t=!0,onChange:r}=n,[i,u]=ye(q(e)),s=fe(()=>{let o=q(e);t&&u(o),r?.(o)},[e,t,r]);if(Te(()=>{let o=window.matchMedia(e),{matches:c}=o;return t&&u(c),r?.(c),o.addEventListener("change",s),()=>{o.removeEventListener("change",s)}},[e,t,r,s]),!!t)return i}var Pt=(e={})=>{let n=G(),t=V("(prefers-color-scheme: dark)"),{initial:r=t,docClassNames:i=[]}=e,[u,s]=j("dark-mode",r),o=u??t,[c,l]=i,a=ve({light:"",dark:""});return H(()=>{s(t)},[t,s]),z(()=>{c&&document.documentElement.classList.toggle(c,o),l&&document.documentElement.classList.toggle(l,!o)},[o,c,l]),z(()=>{document.head.querySelectorAll('meta[name="theme-color"]').forEach(d=>{let p=d.getAttribute("media"),T=d.getAttribute("content");if(T){if(!p||p==="(prefers-color-scheme: light)"){a.current.light=T;return}a.current.dark=T}})},[]),H(()=>{let d=a.current.dark,p=a.current.light;u&&!d||!u&&!p||document.head.querySelectorAll('meta[name="theme-color"]').forEach(T=>{T.setAttribute("content",u?d:p)})},[u]),{isDarkMode:n?o:!1,isDarkOS:n?t:!1,toggleDarkMode:D(()=>s(d=>!d),[s]),enableDarkMode:D(()=>s(!0),[s]),disableDarkMode:D(()=>s(!1),[s])}};import{useEffect as Ee}from"react";function B(e,n){let{target:t,query:r,options:i,listener:u,onLoad:s,onCleanUp:o}=n;Ee(()=>{let c=Array.isArray(e)?e:[e],l=(r?window.matchMedia(r):t&&"current"in t?t.current:t)??window;if(l.addEventListener)return s?.(),c.map(a=>{l.addEventListener(a,u,i)}),()=>{c.map(a=>{l.removeEventListener(a,u,i)}),o?.()}},[e,t,r,i,u,s,o])}import{portraitMediaQuery as xe}from"@alessiofrittoli/web-utils/device";var Yt=()=>V(xe);import{useCallback as J,useEffect as Se,useRef as Oe,useState as ge}from"react";var Me=["input","select","textarea","button","[href]",'[tabindex]:not([tabindex="-1"])'].join(", "),tn=e=>{let[n,t]=ge(!1),r=Oe(null),i=J(s=>{r.current=document.activeElement;let o=s||e?.current||!1;if(o)return t(o)},[e]),u=J(()=>{r.current?.focus(),t(!1)},[]);return Se(()=>{if(!n)return;let s=o=>{if(o.key!=="Tab")return;let c=Array.from(n.querySelectorAll(Me)),l=c.at(0),a=c.at(-1);if(!o.shiftKey){document.activeElement===a&&(o.preventDefault(),l?.focus());return}document.activeElement===l&&(o.preventDefault(),a?.focus())};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[n]),[i,u]};import{useEffect as be,useMemo as Ie,useRef as U,useState as X}from"react";var sn=(e,n={})=>{let{initial:t=!1,once:r,amount:i,margin:u,root:s,enable:o=!0}=n,{onEnter:c,onExit:l,onIntersect:a}=n,d=U(!0),[p,T]=X(t),[v,O]=X(o),g=U(null),x=U(!1),M=Ie(()=>{if(!v||typeof IntersectionObserver>"u")return;let C=i==="all"?1:i==="some"?.5:i;try{return new IntersectionObserver(async([y],S)=>{if(!y)return;let E=y.isIntersecting;try{if(x.current=!E&&!!g.current,E&&c&&await c({entry:y,observer:S}),x.current&&l&&await l({entry:y,observer:S}),a&&(E||!E&&g.current!=null)){let b={isEntering:E,isExiting:x.current};await a({entry:y,observer:S,...b})}if(g.current=E,!d.current)return;T(E)}catch(b){console.error(b)}E&&r&&S.disconnect()},{root:s||void 0,rootMargin:u,threshold:C})}catch(y){console.error(y)}},[s,u,i,r,v,c,l,a]);return be(()=>{if(d.current=!0,!(!v||!e.current||!M))return M.observe(e.current),()=>{d.current=!1,M.disconnect()}},[e,M,v]),{inView:p,enabled:v,observer:M,isExiting:x.current,setInView:T,setEnabled:O}};import{useCallback as Y}from"react";import{blockScroll as He,restoreScroll as he}from"@alessiofrittoli/web-utils/dom";var pn=e=>{let n=Y(()=>He(e?.current||void 0),[e]),t=Y(()=>he(e?.current||void 0),[e]);return[n,t]};import{useMemo as Le,useState as ke}from"react";import{useEffect as Re}from"react";var Z=(e,n={})=>{let{delay:t=1,args:r}=n;Re(()=>{let i=setTimeout(e,t,...r||[]);return()=>clearTimeout(i)},[t,r,e])};var xn=(e,n=500)=>{let[t,r]=ke(e),i=Le(()=>[e],[e]);return Z(r,{delay:n,args:i}),t};import{useCallback as K,useEffect as Ve,useRef as Ce,useState as we}from"react";function _(e,n={}){let{delay:t=1,args:r,autoplay:i=!0,runOnStart:u=!1,updateState:s=!1}=n,o=Ce(void 0),[c,l]=we(i),a=K(()=>o.current?(clearInterval(o.current),o.current=void 0,!0):!1,[]),d=K(()=>{let T=a();return u&&(r?e(...r):e()),o.current=setInterval(e,t,...r||[]),!T&&s&&l(!0),o.current},[t,r,s,u,e,a]),p=K(()=>{a()&&s&&l(!1)},[s,a]);return Ve(()=>{if(i)return d(),p},[i,d,p]),s?{isActive:c,start:d,stop:p}:{start:d,stop:p}}import{useEffect as De}from"react";var Hn=(e,n={})=>{let{delay:t=1,args:r}=n;De(()=>{let i=setInterval(e,t,...r||[]);return()=>clearInterval(i)},[t,r,e])};import{useCallback as A,useEffect as Ue}from"react";function Vn(e,n={}){let{autoplay:t=!0}=n,r=_(e,{autoplay:!1,...n}),{start:i,stop:u}=r,s=A(()=>document.hidden?u():i(),[i,u]),o=A(()=>{if(document.addEventListener("visibilitychange",s),!document.hidden)return i()},[i,s]),c=A(()=>{u(),document.removeEventListener("visibilitychange",s)},[u,s]);return Ue(()=>{if(t)return o(),c},[t,o,c]),{...r,start:o,stop:c}}import{useCallback as W,useEffect as Ke,useRef as Ae,useState as We}from"react";function Un(e,n={}){let{delay:t=1,args:r,autoplay:i=!0,runOnStart:u=!1,updateState:s=!1}=n,o=Ae(void 0),[c,l]=We(i),a=W(()=>o.current?(clearTimeout(o.current),o.current=void 0,!0):!1,[]),d=W(()=>{let T=a();return u&&(r?e(...r):e()),o.current=setTimeout(()=>{if(o.current=void 0,s&&l(!1),r)return e(...r);e()},t),!T&&s&&l(!0),o.current},[t,r,s,u,e,a]),p=W(()=>{a()&&s&&l(!1)},[s,a]);return Ke(()=>{if(i)return d(),p},[i,d,p]),s?{isActive:c,start:d,stop:p}:{start:d,stop:p}}export{P as getState,_e as useConnection,Pt as useDarkMode,xn as useDebounce,St as useEffectOnce,B as useEventListener,tn as useFocusTrap,sn as useInView,Tt as useInput,_ as useInterval,Vn as useIntervalWhenVisible,G as useIsClient,R as useIsFirstRender,Yt as useIsPortrait,Hn as useLightInterval,Z as useLightTimeout,j as useLocalStorage,V as useMediaQuery,Rt as usePagination,pn as useScrollBlock,Ct as useSelection,ze as useSessionStorage,h as useStorage,Un as useTimeout,H as useUpdateEffect};
package/license.md CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2024-2025 Alessio Frittoli.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024-2025 Alessio Frittoli.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alessiofrittoli/react-hooks",
3
- "version": "3.2.0-alpha.1",
3
+ "version": "3.2.0-alpha.3",
4
4
  "description": "TypeScript React utility Hooks",
5
5
  "author": {
6
6
  "name": "Alessio Frittoli",
@@ -60,8 +60,8 @@
60
60
  "//1a": "*********************************************************************",
61
61
  "//1b": "******************** DEV - BUILD - LINT - RELEASE *******************",
62
62
  "//1c": "*********************************************************************",
63
- "dev": "NODE_ENV=development tsup --watch",
64
- "build:prod": "NODE_ENV=production tsup",
63
+ "dev": "cross-env NODE_ENV=development tsup --watch",
64
+ "build:prod": "cross-env NODE_ENV=production tsup",
65
65
  "build": "pnpm lint && pnpm test:ci && pnpm build:prod",
66
66
  "lint": "eslint",
67
67
  "release": "node scripts/publish.js --verbose --npm",
@@ -103,6 +103,7 @@
103
103
  "@types/react": "^19.1.8",
104
104
  "@types/react-dom": "^19.1.6",
105
105
  "concurrently": "^9.2.0",
106
+ "cross-env": "^7.0.3",
106
107
  "dotenv": "^17.1.0",
107
108
  "eslint": "^9.30.1",
108
109
  "eslint-plugin-react": "^7.37.5",