foxact 0.2.38 → 0.2.39

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.
Files changed (41) hide show
  1. package/context-state/index.cjs +1 -1
  2. package/context-state/index.js +1 -1
  3. package/context-state/index.mjs +1 -1
  4. package/create-storage-hook/index.cjs +1 -1
  5. package/create-storage-hook/index.js +1 -1
  6. package/create-storage-hook/index.mjs +1 -1
  7. package/current-year/index.cjs +1 -1
  8. package/current-year/index.js +1 -1
  9. package/current-year/index.mjs +1 -1
  10. package/no-ssr/index.d.ts +1 -1
  11. package/package.json +113 -104
  12. package/sizes.json +1 -1
  13. package/use-clipboard/index.cjs +1 -1
  14. package/use-clipboard/index.d.ts +1 -0
  15. package/use-clipboard/index.js +1 -1
  16. package/use-clipboard/index.mjs +1 -1
  17. package/use-component-will-receive-update/index.cjs +1 -0
  18. package/use-component-will-receive-update/index.d.ts +6 -0
  19. package/use-component-will-receive-update/index.js +1 -0
  20. package/use-component-will-receive-update/index.mjs +1 -0
  21. package/use-debounced-value/index.cjs +1 -1
  22. package/use-debounced-value/index.js +1 -1
  23. package/use-debounced-value/index.mjs +1 -1
  24. package/use-isomorphic-layout-effect/index.cjs +1 -1
  25. package/use-isomorphic-layout-effect/index.d.ts +3 -3
  26. package/use-isomorphic-layout-effect/index.js +1 -1
  27. package/use-isomorphic-layout-effect/index.mjs +1 -1
  28. package/use-media-query/index.cjs +1 -1
  29. package/use-media-query/index.d.ts +1 -1
  30. package/use-media-query/index.js +1 -1
  31. package/use-media-query/index.mjs +1 -1
  32. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs +1 -1
  33. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js +1 -1
  34. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs +1 -1
  35. package/use-uncontrolled/index.cjs +1 -1
  36. package/use-uncontrolled/index.js +1 -1
  37. package/use-uncontrolled/index.mjs +1 -1
  38. package/use-url-hash-state/index.cjs +1 -1
  39. package/use-url-hash-state/index.d.ts +1 -1
  40. package/use-url-hash-state/index.js +1 -1
  41. package/use-url-hash-state/index.mjs +1 -1
@@ -1 +1 @@
1
- "use strict";var e=require("react/jsx-runtime");require("client-only");var t=require("react"),r=require("../noop/index.cjs");exports.createContextState=function(n){const o=t.createContext(n),u=t.createContext(r.noop);return[r=>{let{children:c}=r;const[i,s]=t.useState(n);return e.jsx(o.Provider,{value:i,children:e.jsx(u.Provider,{value:s,children:c})})},()=>t.useContext(o),()=>t.useContext(u),o]};
1
+ "use strict";var e=require("react/jsx-runtime");require("client-only");var t=require("react"),r=require("../noop/index.cjs");exports.createContextState=function(n){const o=/*#__PURE__*/t.createContext(n),u=/*#__PURE__*/t.createContext(r.noop);return[r=>{let{children:c}=r;const[i,s]=t.useState(n);return /*#__PURE__*/e.jsx(o.Provider,{value:i,children:/*#__PURE__*/e.jsx(u.Provider,{value:s,children:c})})},()=>t.useContext(o),()=>t.useContext(u),o]};
@@ -1 +1 @@
1
- "use strict";var e=require("react/jsx-runtime");require("client-only");var t=require("react"),r=require("../noop/index.js");exports.createContextState=function(n){const o=t.createContext(n),u=t.createContext(r.noop);return[r=>{let{children:i}=r;const[c,s]=t.useState(n);return e.jsx(o.Provider,{value:c,children:e.jsx(u.Provider,{value:s,children:i})})},()=>t.useContext(o),()=>t.useContext(u),o]};
1
+ "use strict";var e=require("react/jsx-runtime");require("client-only");var t=require("react"),r=require("../noop/index.js");exports.createContextState=function(n){const o=/*#__PURE__*/t.createContext(n),u=/*#__PURE__*/t.createContext(r.noop);return[r=>{let{children:i}=r;const[c,s]=t.useState(n);return /*#__PURE__*/e.jsx(o.Provider,{value:c,children:/*#__PURE__*/e.jsx(u.Provider,{value:s,children:i})})},()=>t.useContext(o),()=>t.useContext(u),o]};
@@ -1 +1 @@
1
- import{jsx as r}from"react/jsx-runtime";import"client-only";import{createContext as t,useContext as e,useState as o}from"react";import{noop as n}from"../noop/index.mjs";function i(i){const c=t(i),m=t(n);return[t=>{let{children:e}=t;const[n,l]=o(i);return r(c.Provider,{value:n,children:r(m.Provider,{value:l,children:e})})},()=>e(c),()=>e(m),c]}export{i as createContextState};
1
+ import{jsx as r}from"react/jsx-runtime";import"client-only";import{createContext as t,useContext as e,useState as o}from"react";import{noop as n}from"../noop/index.mjs";function i(i){const c=/*#__PURE__*/t(i),m=/*#__PURE__*/t(n);return[t=>{let{children:e}=t;const[n,l]=o(i);return /*#__PURE__*/r(c.Provider,{value:n,children:/*#__PURE__*/r(m.Provider,{value:l,children:e})})},()=>e(c),()=>e(m),c]}export{i as createContextState};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),o=require("../noop/index.cjs"),t=require("../use-isomorphic-layout-effect/index.cjs"),n=require("../no-ssr/index.cjs");const r=e=>"function"==typeof e,a=e=>e,i=()=>{throw n.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(n){const l="localStorage"===n?"foxact-use-local-storage":"foxact-use-session-storage",c="localStorage"===n?"foxact/use-local-storage":"foxact/use-session-storage",s="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))}:o.noop,u="undefined"!=typeof window?(e,o)=>{try{window[n].setItem(e,o)}catch(e){console.warn("[".concat(c,"] Failed to set value to ").concat(n,", it might be blocked"))}finally{s(e)}}:o.noop,d="undefined"!=typeof window?e=>{try{window[n].removeItem(e)}catch(e){console.warn("[".concat(c,"] Failed to remove value from ").concat(n,", it might be blocked"))}finally{s(e)}}:o.noop,w=e=>{if("undefined"==typeof window)return null;try{return window[n].getItem(e)}catch(e){return console.warn("[".concat(c,"] Failed to get value from ").concat(n,", it might be blocked")),null}};return{useStorage:function(n,c){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const f=e.useCallback(e=>{if("undefined"==typeof window)return o.noop;const t=o=>{"key"in o&&o.key!==n||e()},r=o=>{o.detail===n&&e()};return window.addEventListener("storage",t),window.addEventListener(l,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(l,r)}},[n]),v=s.raw?a:s.serializer,y=s.raw?a:s.deserializer,g=void 0!==c?()=>v(c):i,m=e.useSyncExternalStore(f,()=>w(n),g),p=e.useMemo(()=>null===m?null:y(m),[m,y]),h=e.useCallback(e=>{try{const o=r(e)?e(null!=p?p:null):e;null===o?d(n):u(n,v(o))}catch(e){console.warn(e)}},[n,v,p]);return t.useLayoutEffect(()=>{null===w(n)&&void 0!==c&&u(n,v(c))},[y,n,v,c]),[null===p?void 0===c?null:c:p,h]},useSetStorage:(o,t)=>e.useCallback(e=>{try{null===e?d(o):u(o,t(e))}catch(e){console.warn(e)}},[o,t])}};
1
+ "use strict";require("client-only");var e=require("react"),o=require("../noop/index.cjs"),t=require("../use-isomorphic-layout-effect/index.cjs"),n=require("../no-ssr/index.cjs");const r=e=>"function"==typeof e,a=e=>e,i=()=>{throw n.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(n){const l="localStorage"===n?"foxact-use-local-storage":"foxact-use-session-storage",c="localStorage"===n?"foxact/use-local-storage":"foxact/use-session-storage",s="undefined"==typeof window?o.noop:e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))},u="undefined"==typeof window?o.noop:(e,o)=>{try{window[n].setItem(e,o)}catch(e){console.warn("[".concat(c,"] Failed to set value to ").concat(n,", it might be blocked"))}finally{s(e)}},d="undefined"==typeof window?o.noop:e=>{try{window[n].removeItem(e)}catch(e){console.warn("[".concat(c,"] Failed to remove value from ").concat(n,", it might be blocked"))}finally{s(e)}},w=e=>{if("undefined"==typeof window)return null;try{return window[n].getItem(e)}catch(e){return console.warn("[".concat(c,"] Failed to get value from ").concat(n,", it might be blocked")),null}};return{useStorage:function(n,c){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const f=e.useCallback(e=>{if("undefined"==typeof window)return o.noop;const t=o=>{"key"in o&&o.key!==n||e()},r=o=>{o.detail===n&&e()};return window.addEventListener("storage",t),window.addEventListener(l,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(l,r)}},[n]),v=s.raw?a:s.serializer,y=s.raw?a:s.deserializer,g=void 0===c?i:()=>v(c),m=e.useSyncExternalStore(f,()=>w(n),g),p=e.useMemo(()=>null===m?null:y(m),[m,y]),h=e.useCallback(e=>{try{const o=r(e)?e(null!=p?p:null):e;null===o?d(n):u(n,v(o))}catch(e){console.warn(e)}},[n,v,p]);return t.useLayoutEffect(()=>{null===w(n)&&void 0!==c&&u(n,v(c))},[y,n,v,c]),[null===p?void 0===c?null:c:p,h]},useSetStorage:(o,t)=>e.useCallback(e=>{try{null===e?d(o):u(o,t(e))}catch(e){console.warn(e)}},[o,t])}};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),o=require("../noop/index.js"),t=require("../use-isomorphic-layout-effect/index.js"),n=require("../no-ssr/index.js");const r=e=>"function"==typeof e,a=e=>e,i=()=>{throw n.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(n){const l="localStorage"===n?"foxact-use-local-storage":"foxact-use-session-storage",s="localStorage"===n?"foxact/use-local-storage":"foxact/use-session-storage",c="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))}:o.noop,u="undefined"!=typeof window?(e,o)=>{try{window[n].setItem(e,o)}catch(e){console.warn("[".concat(s,"] Failed to set value to ").concat(n,", it might be blocked"))}finally{c(e)}}:o.noop,d="undefined"!=typeof window?e=>{try{window[n].removeItem(e)}catch(e){console.warn("[".concat(s,"] Failed to remove value from ").concat(n,", it might be blocked"))}finally{c(e)}}:o.noop,w=e=>{if("undefined"==typeof window)return null;try{return window[n].getItem(e)}catch(e){return console.warn("[".concat(s,"] Failed to get value from ").concat(n,", it might be blocked")),null}};return{useStorage:function(n,s){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const f=e.useCallback(e=>{if("undefined"==typeof window)return o.noop;const t=o=>{"key"in o&&o.key!==n||e()},r=o=>{o.detail===n&&e()};return window.addEventListener("storage",t),window.addEventListener(l,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(l,r)}},[n]),v=c.raw?a:c.serializer,y=c.raw?a:c.deserializer,g=void 0!==s?()=>v(s):i,m=e.useSyncExternalStore(f,()=>w(n),g),p=e.useMemo(()=>null===m?null:y(m),[m,y]),h=e.useCallback(e=>{try{const o=r(e)?e(null!=p?p:null):e;null===o?d(n):u(n,v(o))}catch(e){console.warn(e)}},[n,v,p]);return t.useLayoutEffect(()=>{null===w(n)&&void 0!==s&&u(n,v(s))},[y,n,v,s]),[null===p?void 0===s?null:s:p,h]},useSetStorage:(o,t)=>e.useCallback(e=>{try{null===e?d(o):u(o,t(e))}catch(e){console.warn(e)}},[o,t])}};
1
+ "use strict";require("client-only");var e=require("react"),o=require("../noop/index.js"),t=require("../use-isomorphic-layout-effect/index.js"),n=require("../no-ssr/index.js");const r=e=>"function"==typeof e,a=e=>e,i=()=>{throw n.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(n){const l="localStorage"===n?"foxact-use-local-storage":"foxact-use-session-storage",s="localStorage"===n?"foxact/use-local-storage":"foxact/use-session-storage",c="undefined"==typeof window?o.noop:e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))},u="undefined"==typeof window?o.noop:(e,o)=>{try{window[n].setItem(e,o)}catch(e){console.warn("[".concat(s,"] Failed to set value to ").concat(n,", it might be blocked"))}finally{c(e)}},d="undefined"==typeof window?o.noop:e=>{try{window[n].removeItem(e)}catch(e){console.warn("[".concat(s,"] Failed to remove value from ").concat(n,", it might be blocked"))}finally{c(e)}},w=e=>{if("undefined"==typeof window)return null;try{return window[n].getItem(e)}catch(e){return console.warn("[".concat(s,"] Failed to get value from ").concat(n,", it might be blocked")),null}};return{useStorage:function(n,s){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const f=e.useCallback(e=>{if("undefined"==typeof window)return o.noop;const t=o=>{"key"in o&&o.key!==n||e()},r=o=>{o.detail===n&&e()};return window.addEventListener("storage",t),window.addEventListener(l,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(l,r)}},[n]),v=c.raw?a:c.serializer,y=c.raw?a:c.deserializer,g=void 0===s?i:()=>v(s),m=e.useSyncExternalStore(f,()=>w(n),g),p=e.useMemo(()=>null===m?null:y(m),[m,y]),h=e.useCallback(e=>{try{const o=r(e)?e(null!=p?p:null):e;null===o?d(n):u(n,v(o))}catch(e){console.warn(e)}},[n,v,p]);return t.useLayoutEffect(()=>{null===w(n)&&void 0!==s&&u(n,v(s))},[y,n,v,s]),[null===p?void 0===s?null:s:p,h]},useSetStorage:(o,t)=>e.useCallback(e=>{try{null===e?d(o):u(o,t(e))}catch(e){console.warn(e)}},[o,t])}};
@@ -1 +1 @@
1
- import"client-only";import{useCallback as e,useSyncExternalStore as o,useMemo as t}from"react";import{noop as n}from"../noop/index.mjs";import{useLayoutEffect as r}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as i}from"../no-ssr/index.mjs";const a=e=>"function"==typeof e,l=e=>e,c=()=>{throw i("useLocalStorage cannot be used on the server without a serverValue")};function s(i){const s="localStorage"===i?"foxact-use-local-storage":"foxact-use-session-storage",d="localStorage"===i?"foxact/use-local-storage":"foxact/use-session-storage",u="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(s,{detail:e}))}:n,w="undefined"!=typeof window?(e,o)=>{try{window[i].setItem(e,o)}catch(e){console.warn("[".concat(d,"] Failed to set value to ").concat(i,", it might be blocked"))}finally{u(e)}}:n,f="undefined"!=typeof window?e=>{try{window[i].removeItem(e)}catch(e){console.warn("[".concat(d,"] Failed to remove value from ").concat(i,", it might be blocked"))}finally{u(e)}}:n,m=e=>{if("undefined"==typeof window)return null;try{return window[i].getItem(e)}catch(e){return console.warn("[".concat(d,"] Failed to get value from ").concat(i,", it might be blocked")),null}};return{useStorage:function(i,d){let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const g=e(e=>{if("undefined"==typeof window)return n;const o=o=>{"key"in o&&o.key!==i||e()},t=o=>{o.detail===i&&e()};return window.addEventListener("storage",o),window.addEventListener(s,t),()=>{window.removeEventListener("storage",o),window.removeEventListener(s,t)}},[i]),v=u.raw?l:u.serializer,y=u.raw?l:u.deserializer,p=o(g,()=>m(i),void 0!==d?()=>v(d):c),h=t(()=>null===p?null:y(p),[p,y]),S=e(e=>{try{const o=a(e)?e(null!=h?h:null):e;null===o?f(i):w(i,v(o))}catch(e){console.warn(e)}},[i,v,h]);return r(()=>{null===m(i)&&void 0!==d&&w(i,v(d))},[y,i,v,d]),[null===h?void 0===d?null:d:h,S]},useSetStorage:(o,t)=>e(e=>{try{null===e?f(o):w(o,t(e))}catch(e){console.warn(e)}},[o,t])}}export{s as createStorage};
1
+ import"client-only";import{useCallback as e,useSyncExternalStore as o,useMemo as t}from"react";import{noop as n}from"../noop/index.mjs";import{useLayoutEffect as r}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as i}from"../no-ssr/index.mjs";const a=e=>"function"==typeof e,l=e=>e,c=()=>{throw i("useLocalStorage cannot be used on the server without a serverValue")};function s(i){const s="localStorage"===i?"foxact-use-local-storage":"foxact-use-session-storage",d="localStorage"===i?"foxact/use-local-storage":"foxact/use-session-storage",u="undefined"==typeof window?n:e=>{window.dispatchEvent(new CustomEvent(s,{detail:e}))},w="undefined"==typeof window?n:(e,o)=>{try{window[i].setItem(e,o)}catch(e){console.warn("[".concat(d,"] Failed to set value to ").concat(i,", it might be blocked"))}finally{u(e)}},f="undefined"==typeof window?n:e=>{try{window[i].removeItem(e)}catch(e){console.warn("[".concat(d,"] Failed to remove value from ").concat(i,", it might be blocked"))}finally{u(e)}},m=e=>{if("undefined"==typeof window)return null;try{return window[i].getItem(e)}catch(e){return console.warn("[".concat(d,"] Failed to get value from ").concat(i,", it might be blocked")),null}};return{useStorage:function(i,d){let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const g=e(e=>{if("undefined"==typeof window)return n;const o=o=>{"key"in o&&o.key!==i||e()},t=o=>{o.detail===i&&e()};return window.addEventListener("storage",o),window.addEventListener(s,t),()=>{window.removeEventListener("storage",o),window.removeEventListener(s,t)}},[i]),v=u.raw?l:u.serializer,y=u.raw?l:u.deserializer,p=o(g,()=>m(i),void 0===d?c:()=>v(d)),h=t(()=>null===p?null:y(p),[p,y]),S=e(e=>{try{const o=a(e)?e(null!=h?h:null):e;null===o?f(i):w(i,v(o))}catch(e){console.warn(e)}},[i,v,h]);return r(()=>{null===m(i)&&void 0!==d&&w(i,v(d))},[y,i,v,d]),[null===h?void 0===d?null:d:h,S]},useSetStorage:(o,t)=>e(e=>{try{null===e?f(o):w(o,t(e))}catch(e){console.warn(e)}},[o,t])}}export{s as createStorage};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");const n=r.memo(n=>{let{defaultYear:i,...u}=n;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(i||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:s})});"production"!==process.env.NODE_ENV&&(n.displayName="CurrentYear"),exports.CurrentYear=n;
2
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");const n=/*#__PURE__*/r.memo(n=>{let{defaultYear:i,...u}=n;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(i||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),/*#__PURE__*/e.jsx("span",{...u,children:s})});"production"!==process.env.NODE_ENV&&(n.displayName="CurrentYear"),exports.CurrentYear=n;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.js");require("client-only");const n=r.memo(n=>{let{defaultYear:i,...u}=n;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(i||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:s})});"production"!==process.env.NODE_ENV&&(n.displayName="CurrentYear"),exports.CurrentYear=n;
2
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.js");require("client-only");const n=/*#__PURE__*/r.memo(n=>{let{defaultYear:i,...u}=n;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(i||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),/*#__PURE__*/e.jsx("span",{...u,children:s})});"production"!==process.env.NODE_ENV&&(n.displayName="CurrentYear"),exports.CurrentYear=n;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";const o=r(r=>{let{defaultYear:o,...i}=r;"undefined"==typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,s]=t(o||new Date().getFullYear());return n(()=>{s(new Date().getFullYear())},[]),e("span",{...i,children:a})});"production"!==process.env.NODE_ENV&&(o.displayName="CurrentYear");export{o as CurrentYear};
2
+ import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";const o=/*#__PURE__*/r(r=>{let{defaultYear:o,...i}=r;"undefined"==typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,s]=t(o||new Date().getFullYear());return n(()=>{s(new Date().getFullYear())},[]),/*#__PURE__*/e("span",{...i,children:a})});"production"!==process.env.NODE_ENV&&(o.displayName="CurrentYear");export{o as CurrentYear};
package/no-ssr/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** @private */
2
- declare const noSSRError: (errorMessage?: string | undefined, nextjsDigest?: string) => Error;
2
+ declare const noSSRError: (errorMessage?: string, nextjsDigest?: string) => Error;
3
3
  /** @see https://foxact.skk.moe/no-ssr */
4
4
  declare const noSSR: (extraMessage?: string) => void;
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.38",
3
+ "version": "0.2.39",
4
4
  "description": "React Hooks/Utils done right. For browser, SSR, and React Server Components.",
5
5
  "homepage": "https://foxact.skk.moe",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "optional": true
33
33
  }
34
34
  },
35
- "packageManager": "pnpm@9.4.0",
35
+ "packageManager": "pnpm@9.10.0",
36
36
  "pnpm": {
37
37
  "overrides": {
38
38
  "array-includes": "npm:@nolyfill/array-includes@latest",
@@ -87,15 +87,6 @@
87
87
  "require": "./context-state/index.cjs",
88
88
  "default": "./context-state/index.js"
89
89
  },
90
- "./create-fixed-array": {
91
- "types": "./create-fixed-array/index.d.ts",
92
- "import": {
93
- "types": "./create-fixed-array/index.d.ts",
94
- "default": "./create-fixed-array/index.mjs"
95
- },
96
- "require": "./create-fixed-array/index.cjs",
97
- "default": "./create-fixed-array/index.js"
98
- },
99
90
  "./create-storage-hook": {
100
91
  "types": "./create-storage-hook/index.d.ts",
101
92
  "import": {
@@ -105,6 +96,15 @@
105
96
  "require": "./create-storage-hook/index.cjs",
106
97
  "default": "./create-storage-hook/index.js"
107
98
  },
99
+ "./create-context-state": {
100
+ "types": "./create-context-state/index.d.ts",
101
+ "import": {
102
+ "types": "./create-context-state/index.d.ts",
103
+ "default": "./create-context-state/index.mjs"
104
+ },
105
+ "require": "./create-context-state/index.cjs",
106
+ "default": "./create-context-state/index.js"
107
+ },
108
108
  "./current-year": {
109
109
  "types": "./current-year/index.d.ts",
110
110
  "import": {
@@ -123,24 +123,6 @@
123
123
  "require": "./invariant/index.cjs",
124
124
  "default": "./invariant/index.js"
125
125
  },
126
- "./create-context-state": {
127
- "types": "./create-context-state/index.d.ts",
128
- "import": {
129
- "types": "./create-context-state/index.d.ts",
130
- "default": "./create-context-state/index.mjs"
131
- },
132
- "require": "./create-context-state/index.cjs",
133
- "default": "./create-context-state/index.js"
134
- },
135
- "./no-ssr": {
136
- "types": "./no-ssr/index.d.ts",
137
- "import": {
138
- "types": "./no-ssr/index.d.ts",
139
- "default": "./no-ssr/index.mjs"
140
- },
141
- "require": "./no-ssr/index.cjs",
142
- "default": "./no-ssr/index.js"
143
- },
144
126
  "./noop": {
145
127
  "types": "./noop/index.d.ts",
146
128
  "import": {
@@ -150,6 +132,15 @@
150
132
  "require": "./noop/index.cjs",
151
133
  "default": "./noop/index.js"
152
134
  },
135
+ "./create-fixed-array": {
136
+ "types": "./create-fixed-array/index.d.ts",
137
+ "import": {
138
+ "types": "./create-fixed-array/index.d.ts",
139
+ "default": "./create-fixed-array/index.mjs"
140
+ },
141
+ "require": "./create-fixed-array/index.cjs",
142
+ "default": "./create-fixed-array/index.js"
143
+ },
153
144
  "./nullthrow": {
154
145
  "types": "./nullthrow/index.d.ts",
155
146
  "import": {
@@ -159,6 +150,15 @@
159
150
  "require": "./nullthrow/index.cjs",
160
151
  "default": "./nullthrow/index.js"
161
152
  },
153
+ "./no-ssr": {
154
+ "types": "./no-ssr/index.d.ts",
155
+ "import": {
156
+ "types": "./no-ssr/index.d.ts",
157
+ "default": "./no-ssr/index.mjs"
158
+ },
159
+ "require": "./no-ssr/index.cjs",
160
+ "default": "./no-ssr/index.js"
161
+ },
162
162
  "./rem": {
163
163
  "types": "./rem/index.d.ts",
164
164
  "import": {
@@ -168,6 +168,15 @@
168
168
  "require": "./rem/index.cjs",
169
169
  "default": "./rem/index.js"
170
170
  },
171
+ "./request-idle-callback": {
172
+ "types": "./request-idle-callback/index.d.ts",
173
+ "import": {
174
+ "types": "./request-idle-callback/index.d.ts",
175
+ "default": "./request-idle-callback/index.mjs"
176
+ },
177
+ "require": "./request-idle-callback/index.cjs",
178
+ "default": "./request-idle-callback/index.js"
179
+ },
171
180
  "./types": {
172
181
  "types": "./types/index.d.ts",
173
182
  "import": {
@@ -186,15 +195,6 @@
186
195
  "require": "./typescript-happy-forward-ref/index.cjs",
187
196
  "default": "./typescript-happy-forward-ref/index.js"
188
197
  },
189
- "./request-idle-callback": {
190
- "types": "./request-idle-callback/index.d.ts",
191
- "import": {
192
- "types": "./request-idle-callback/index.d.ts",
193
- "default": "./request-idle-callback/index.mjs"
194
- },
195
- "require": "./request-idle-callback/index.cjs",
196
- "default": "./request-idle-callback/index.js"
197
- },
198
198
  "./use": {
199
199
  "types": "./use/index.d.ts",
200
200
  "import": {
@@ -204,15 +204,6 @@
204
204
  "require": "./use/index.cjs",
205
205
  "default": "./use/index.js"
206
206
  },
207
- "./use-array": {
208
- "types": "./use-array/index.d.ts",
209
- "import": {
210
- "types": "./use-array/index.d.ts",
211
- "default": "./use-array/index.mjs"
212
- },
213
- "require": "./use-array/index.cjs",
214
- "default": "./use-array/index.js"
215
- },
216
207
  "./use-abortable-effect": {
217
208
  "types": "./use-abortable-effect/index.d.ts",
218
209
  "import": {
@@ -231,6 +222,15 @@
231
222
  "require": "./use-clipboard/index.cjs",
232
223
  "default": "./use-clipboard/index.js"
233
224
  },
225
+ "./use-component-will-receive-update": {
226
+ "types": "./use-component-will-receive-update/index.d.ts",
227
+ "import": {
228
+ "types": "./use-component-will-receive-update/index.d.ts",
229
+ "default": "./use-component-will-receive-update/index.mjs"
230
+ },
231
+ "require": "./use-component-will-receive-update/index.cjs",
232
+ "default": "./use-component-will-receive-update/index.js"
233
+ },
234
234
  "./use-composition-input": {
235
235
  "types": "./use-composition-input/index.d.ts",
236
236
  "import": {
@@ -240,6 +240,24 @@
240
240
  "require": "./use-composition-input/index.cjs",
241
241
  "default": "./use-composition-input/index.js"
242
242
  },
243
+ "./use-debounced-state": {
244
+ "types": "./use-debounced-state/index.d.ts",
245
+ "import": {
246
+ "types": "./use-debounced-state/index.d.ts",
247
+ "default": "./use-debounced-state/index.mjs"
248
+ },
249
+ "require": "./use-debounced-state/index.cjs",
250
+ "default": "./use-debounced-state/index.js"
251
+ },
252
+ "./use-array": {
253
+ "types": "./use-array/index.d.ts",
254
+ "import": {
255
+ "types": "./use-array/index.d.ts",
256
+ "default": "./use-array/index.mjs"
257
+ },
258
+ "require": "./use-array/index.cjs",
259
+ "default": "./use-array/index.js"
260
+ },
243
261
  "./use-debounced-value": {
244
262
  "types": "./use-debounced-value/index.d.ts",
245
263
  "import": {
@@ -249,6 +267,15 @@
249
267
  "require": "./use-debounced-value/index.cjs",
250
268
  "default": "./use-debounced-value/index.js"
251
269
  },
270
+ "./use-intersection": {
271
+ "types": "./use-intersection/index.d.ts",
272
+ "import": {
273
+ "types": "./use-intersection/index.d.ts",
274
+ "default": "./use-intersection/index.mjs"
275
+ },
276
+ "require": "./use-intersection/index.cjs",
277
+ "default": "./use-intersection/index.js"
278
+ },
252
279
  "./use-error-boundary": {
253
280
  "types": "./use-error-boundary/index.d.ts",
254
281
  "import": {
@@ -258,23 +285,23 @@
258
285
  "require": "./use-error-boundary/index.cjs",
259
286
  "default": "./use-error-boundary/index.js"
260
287
  },
261
- "./use-debounced-state": {
262
- "types": "./use-debounced-state/index.d.ts",
288
+ "./use-is-online": {
289
+ "types": "./use-is-online/index.d.ts",
263
290
  "import": {
264
- "types": "./use-debounced-state/index.d.ts",
265
- "default": "./use-debounced-state/index.mjs"
291
+ "types": "./use-is-online/index.d.ts",
292
+ "default": "./use-is-online/index.mjs"
266
293
  },
267
- "require": "./use-debounced-state/index.cjs",
268
- "default": "./use-debounced-state/index.js"
294
+ "require": "./use-is-online/index.cjs",
295
+ "default": "./use-is-online/index.js"
269
296
  },
270
- "./use-intersection": {
271
- "types": "./use-intersection/index.d.ts",
297
+ "./use-isomorphic-layout-effect": {
298
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
272
299
  "import": {
273
- "types": "./use-intersection/index.d.ts",
274
- "default": "./use-intersection/index.mjs"
300
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
301
+ "default": "./use-isomorphic-layout-effect/index.mjs"
275
302
  },
276
- "require": "./use-intersection/index.cjs",
277
- "default": "./use-intersection/index.js"
303
+ "require": "./use-isomorphic-layout-effect/index.cjs",
304
+ "default": "./use-isomorphic-layout-effect/index.js"
278
305
  },
279
306
  "./use-is-client": {
280
307
  "types": "./use-is-client/index.d.ts",
@@ -285,15 +312,6 @@
285
312
  "require": "./use-is-client/index.cjs",
286
313
  "default": "./use-is-client/index.js"
287
314
  },
288
- "./use-isomorphic-layout-effect": {
289
- "types": "./use-isomorphic-layout-effect/index.d.ts",
290
- "import": {
291
- "types": "./use-isomorphic-layout-effect/index.d.ts",
292
- "default": "./use-isomorphic-layout-effect/index.mjs"
293
- },
294
- "require": "./use-isomorphic-layout-effect/index.cjs",
295
- "default": "./use-isomorphic-layout-effect/index.js"
296
- },
297
315
  "./use-map": {
298
316
  "types": "./use-map/index.d.ts",
299
317
  "import": {
@@ -330,15 +348,6 @@
330
348
  "require": "./use-next-link/index.cjs",
331
349
  "default": "./use-next-link/index.js"
332
350
  },
333
- "./use-next-pathname": {
334
- "types": "./use-next-pathname/index.d.ts",
335
- "import": {
336
- "types": "./use-next-pathname/index.d.ts",
337
- "default": "./use-next-pathname/index.mjs"
338
- },
339
- "require": "./use-next-pathname/index.cjs",
340
- "default": "./use-next-pathname/index.js"
341
- },
342
351
  "./use-page-visibility": {
343
352
  "types": "./use-page-visibility/index.d.ts",
344
353
  "import": {
@@ -348,6 +357,15 @@
348
357
  "require": "./use-page-visibility/index.cjs",
349
358
  "default": "./use-page-visibility/index.js"
350
359
  },
360
+ "./use-next-pathname": {
361
+ "types": "./use-next-pathname/index.d.ts",
362
+ "import": {
363
+ "types": "./use-next-pathname/index.d.ts",
364
+ "default": "./use-next-pathname/index.mjs"
365
+ },
366
+ "require": "./use-next-pathname/index.cjs",
367
+ "default": "./use-next-pathname/index.js"
368
+ },
351
369
  "./use-react-router-enable-concurrent-navigation": {
352
370
  "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
353
371
  "import": {
@@ -366,15 +384,6 @@
366
384
  "require": "./use-react-router-is-match/index.cjs",
367
385
  "default": "./use-react-router-is-match/index.js"
368
386
  },
369
- "./use-session-storage": {
370
- "types": "./use-session-storage/index.d.ts",
371
- "import": {
372
- "types": "./use-session-storage/index.d.ts",
373
- "default": "./use-session-storage/index.mjs"
374
- },
375
- "require": "./use-session-storage/index.cjs",
376
- "default": "./use-session-storage/index.js"
377
- },
378
387
  "./use-retimer": {
379
388
  "types": "./use-retimer/index.d.ts",
380
389
  "import": {
@@ -384,6 +393,15 @@
384
393
  "require": "./use-retimer/index.cjs",
385
394
  "default": "./use-retimer/index.js"
386
395
  },
396
+ "./use-session-storage": {
397
+ "types": "./use-session-storage/index.d.ts",
398
+ "import": {
399
+ "types": "./use-session-storage/index.d.ts",
400
+ "default": "./use-session-storage/index.mjs"
401
+ },
402
+ "require": "./use-session-storage/index.cjs",
403
+ "default": "./use-session-storage/index.js"
404
+ },
387
405
  "./use-set": {
388
406
  "types": "./use-set/index.d.ts",
389
407
  "import": {
@@ -402,15 +420,6 @@
402
420
  "require": "./use-singleton/index.cjs",
403
421
  "default": "./use-singleton/index.js"
404
422
  },
405
- "./use-typescript-happy-callback": {
406
- "types": "./use-typescript-happy-callback/index.d.ts",
407
- "import": {
408
- "types": "./use-typescript-happy-callback/index.d.ts",
409
- "default": "./use-typescript-happy-callback/index.mjs"
410
- },
411
- "require": "./use-typescript-happy-callback/index.cjs",
412
- "default": "./use-typescript-happy-callback/index.js"
413
- },
414
423
  "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
415
424
  "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
416
425
  "import": {
@@ -420,6 +429,15 @@
420
429
  "require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
421
430
  "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
422
431
  },
432
+ "./use-typescript-happy-callback": {
433
+ "types": "./use-typescript-happy-callback/index.d.ts",
434
+ "import": {
435
+ "types": "./use-typescript-happy-callback/index.d.ts",
436
+ "default": "./use-typescript-happy-callback/index.mjs"
437
+ },
438
+ "require": "./use-typescript-happy-callback/index.cjs",
439
+ "default": "./use-typescript-happy-callback/index.js"
440
+ },
423
441
  "./use-uncontrolled": {
424
442
  "types": "./use-uncontrolled/index.d.ts",
425
443
  "import": {
@@ -437,15 +455,6 @@
437
455
  },
438
456
  "require": "./use-url-hash-state/index.cjs",
439
457
  "default": "./use-url-hash-state/index.js"
440
- },
441
- "./use-is-online": {
442
- "types": "./use-is-online/index.d.ts",
443
- "import": {
444
- "types": "./use-is-online/index.d.ts",
445
- "default": "./use-is-online/index.mjs"
446
- },
447
- "require": "./use-is-online/index.cjs",
448
- "default": "./use-is-online/index.js"
449
458
  }
450
459
  }
451
460
  }
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":19387,"gzip":11872,"br":0},"exports":{"context-state":{"raw":377,"gzip":241,"br":207},"create-fixed-array":{"raw":419,"gzip":279,"br":251},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"invariant":{"raw":178,"gzip":156,"br":118},"create-context-state":{"raw":145,"gzip":116,"br":96},"current-year":{"raw":592,"gzip":400,"br":326},"noop":{"raw":33,"gzip":53,"br":37},"no-ssr":{"raw":468,"gzip":318,"br":266},"types":{"raw":0,"gzip":20,"br":1},"nullthrow":{"raw":194,"gzip":167,"br":128},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"create-storage-hook":{"raw":2061,"gzip":880,"br":762},"rem":{"raw":824,"gzip":396,"br":352},"use":{"raw":276,"gzip":182,"br":150},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"use-abortable-effect":{"raw":210,"gzip":166,"br":150},"use-array":{"raw":329,"gzip":238,"br":199},"use-composition-input":{"raw":458,"gzip":283,"br":241},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"use-clipboard":{"raw":1067,"gzip":611,"br":524},"use-is-client":{"raw":151,"gzip":142,"br":118},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-map":{"raw":346,"gzip":244,"br":210},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-media-query":{"raw":718,"gzip":402,"br":334},"use-page-visibility":{"raw":290,"gzip":206,"br":154},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-session-storage":{"raw":316,"gzip":181,"br":152},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387},"use-react-router-is-match":{"raw":564,"gzip":373,"br":314},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-set":{"raw":347,"gzip":240,"br":203},"use-next-link":{"raw":1600,"gzip":851,"br":730},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":254},"use-is-online":{"raw":335,"gzip":214,"br":160},"use-url-hash-state":{"raw":1069,"gzip":612,"br":534}}}
1
+ {"total":{"raw":19906,"gzip":12199,"br":0},"exports":{"compose-context-provider":{"raw":177,"gzip":155,"br":122},"context-state":{"raw":429,"gzip":258,"br":218},"create-context-state":{"raw":145,"gzip":116,"br":96},"invariant":{"raw":178,"gzip":156,"br":118},"current-year":{"raw":618,"gzip":417,"br":339},"noop":{"raw":33,"gzip":53,"br":37},"create-fixed-array":{"raw":419,"gzip":279,"br":251},"nullthrow":{"raw":194,"gzip":167,"br":128},"create-storage-hook":{"raw":2068,"gzip":880,"br":767},"types":{"raw":0,"gzip":20,"br":1},"no-ssr":{"raw":468,"gzip":318,"br":266},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"rem":{"raw":824,"gzip":396,"br":352},"use":{"raw":276,"gzip":182,"br":150},"use-component-will-receive-update":{"raw":207,"gzip":181,"br":153},"use-abortable-effect":{"raw":210,"gzip":166,"br":150},"use-composition-input":{"raw":458,"gzip":283,"br":241},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-clipboard":{"raw":1177,"gzip":651,"br":552},"use-array":{"raw":329,"gzip":238,"br":199},"use-debounced-value":{"raw":524,"gzip":342,"br":286},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":112},"use-is-online":{"raw":335,"gzip":214,"br":160},"use-is-client":{"raw":151,"gzip":142,"br":118},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-map":{"raw":346,"gzip":244,"br":210},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-media-query":{"raw":718,"gzip":404,"br":331},"use-page-visibility":{"raw":290,"gzip":206,"br":154},"use-react-router-is-match":{"raw":564,"gzip":373,"br":314},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-next-link":{"raw":1600,"gzip":851,"br":730},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-set":{"raw":347,"gzip":240,"br":203},"use-session-storage":{"raw":316,"gzip":181,"br":152},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":249},"use-uncontrolled":{"raw":352,"gzip":258,"br":216},"use-url-hash-state":{"raw":1076,"gzip":618,"br":540}}}
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]);return{copy:e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),reset:e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]),error:u,copied:s}};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs"),a=require("../use-typescript-happy-callback/index.cjs");class o extends Error{constructor(e){super(e),this.name="UseClipboardError"}}exports.UseClipboardError=o,exports.useClipboard=function(){let{timeout:l=1e3,usePromptAsFallback:i=!1,promptFallbackText:c="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,s]=e.useState(null),[p,d]=e.useState(!1),b=e.useRef(null),y=t.useStableHandler(n||r.noop),w=a.useCallback(e=>{b.current&&clearTimeout(b.current),e&&(b.current=window.setTimeout(()=>d(!1),l)),d(e)},[l]),h=a.useCallback(e=>{s(e),y(e)},[y]);return{copy:a.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new o("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(i)try{window.prompt(c,e)}catch(e){h(e)}else h(r)}},[w,c,h,i]),reset:a.useCallback(()=>{d(!1),s(null),b.current&&clearTimeout(b.current)},[]),error:u,copied:p}};
@@ -1,4 +1,5 @@
1
1
  declare class UseClipboardError extends Error {
2
+ constructor(message: string);
2
3
  }
3
4
  interface UseClipboardOption {
4
5
  timeout?: number;
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]);return{copy:e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),reset:e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]),error:u,copied:s}};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"),a=require("../use-typescript-happy-callback/index.js");class o extends Error{constructor(e){super(e),this.name="UseClipboardError"}}exports.UseClipboardError=o,exports.useClipboard=function(){let{timeout:l=1e3,usePromptAsFallback:i=!1,promptFallbackText:n="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[s,c]=e.useState(null),[p,d]=e.useState(!1),b=e.useRef(null),y=t.useStableHandler(u||r.noop),w=a.useCallback(e=>{b.current&&clearTimeout(b.current),e&&(b.current=window.setTimeout(()=>d(!1),l)),d(e)},[l]),h=a.useCallback(e=>{c(e),y(e)},[y]);return{copy:a.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new o("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(i)try{window.prompt(n,e)}catch(e){h(e)}else h(r)}},[w,n,h,i]),reset:a.useCallback(()=>{d(!1),c(null),b.current&&clearTimeout(b.current)},[]),error:s,copied:p}};
@@ -1 +1 @@
1
- import"client-only";import{useState as o,useRef as r,useCallback as e}from"react";import{noop as t}from"../noop/index.mjs";import{useStableHandler as i}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";class a extends Error{}function l(){let{timeout:l=1e3,usePromptAsFallback:n=!1,promptFallbackText:c="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[p,s]=o(null),[d,m]=o(!1),w=r(null),y=i(u||t),b=e(o=>{w.current&&clearTimeout(w.current),o&&(w.current=window.setTimeout(()=>m(!1),l)),m(o)},[l]),f=e(o=>{s(o),y(o)},[y]);return{copy:e(async o=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(o),b(!0);else throw new a("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(n)try{window.prompt(c,o)}catch(o){f(o)}else f(r)}},[b,c,f,n]),reset:e(()=>{m(!1),s(null),w.current&&clearTimeout(w.current)},[]),error:p,copied:d}}export{a as UseClipboardError,l as useClipboard};
1
+ import"client-only";import{useState as r,useRef as o}from"react";import{noop as e}from"../noop/index.mjs";import{useStableHandler as t}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";import{useCallback as i}from"../use-typescript-happy-callback/index.mjs";class a extends Error{constructor(r){super(r),this.name="UseClipboardError"}}function l(){let{timeout:l=1e3,usePromptAsFallback:n=!1,promptFallbackText:c="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:p}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[s,u]=r(null),[d,m]=r(!1),y=o(null),w=t(p||e),b=i(r=>{y.current&&clearTimeout(y.current),r&&(y.current=window.setTimeout(()=>m(!1),l)),m(r)},[l]),h=i(r=>{u(r),w(r)},[w]);return{copy:i(async r=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(r),b(!0);else throw new a("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(o){if(n)try{window.prompt(c,r)}catch(r){h(r)}else h(o)}},[b,c,h,n]),reset:i(()=>{m(!1),u(null),y.current&&clearTimeout(y.current)},[]),error:s,copied:d}}export{a as UseClipboardError,l as useClipboard};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react");exports.useComponentWillReceiveUpdate=function(t,n){n=[...n];const[l,r]=e.useState(n);let o=n.length!==l.length;for(let e=0;e<n.length&&!o;e+=1)l[e]!==n[e]&&(o=!0);o&&(r(n),t())};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @see {https://foxact.skk.moe/use-component-will-receive-update}
3
+ */
4
+ declare function useComponentWillReceiveUpdate(callback: () => void, deps: readonly unknown[]): void;
5
+
6
+ export { useComponentWillReceiveUpdate };
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react");exports.useComponentWillReceiveUpdate=function(t,n){n=[...n];const[l,r]=e.useState(n);let o=n.length!==l.length;for(let e=0;e<n.length&&!o;e+=1)l[e]!==n[e]&&(o=!0);o&&(r(n),t())};
@@ -0,0 +1 @@
1
+ import{useState as e}from"react";function t(t,n){const[o,l]=e(n=[...n]);let r=n.length!==o.length;for(let e=0;e<n.length&&!r;e+=1)o[e]!==n[e]&&(r=!0);r&&(l(n),t())}export{t as useComponentWillReceiveUpdate};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");exports.useDebouncedValue=function(t,u){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof t)throw TypeError("useDebouncedValue does not support function as value");const[n,o]=e.useState(t),c=e.useRef(!0);return e.useEffect(()=>{let e=!1,n=null;return c.current&&r?(c.current=!1,o(t)):n=window.setTimeout(()=>{c.current=!0,o(t)},u),()=>{n&&window.clearTimeout(n)}},[t,r,u]),n};
1
+ "use strict";require("client-only");var e=require("react"),t=require("../use-abortable-effect/index.cjs");exports.useDebouncedValue=function(r,u){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof r)throw TypeError("useDebouncedValue does not support function as value");const[o,c]=e.useState(r),i=e.useRef(!0);return t.useEffect(e=>{let t=null;return e.aborted||(n&&i.current?(i.current=!1,c(r)):t=window.setTimeout(()=>{i.current=!0,c(r)},u)),()=>{t&&window.clearTimeout(t)}},[r,n,u]),o};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");exports.useDebouncedValue=function(t,u){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof t)throw TypeError("useDebouncedValue does not support function as value");const[n,o]=e.useState(t),c=e.useRef(!0);return e.useEffect(()=>{let e=!1,n=null;return c.current&&r?(c.current=!1,o(t)):n=window.setTimeout(()=>{c.current=!0,o(t)},u),()=>{n&&window.clearTimeout(n)}},[t,r,u]),n};
1
+ "use strict";require("client-only");var e=require("react"),t=require("../use-abortable-effect/index.js");exports.useDebouncedValue=function(r,u){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof r)throw TypeError("useDebouncedValue does not support function as value");const[o,c]=e.useState(r),i=e.useRef(!0);return t.useEffect(e=>{let t=null;return e.aborted||(n&&i.current?(i.current=!1,c(r)):t=window.setTimeout(()=>{i.current=!0,c(r)},u)),()=>{t&&window.clearTimeout(t)}},[r,n,u]),o};
@@ -1 +1 @@
1
- import"client-only";import{useState as e,useRef as t,useEffect as o}from"react";function n(n,r){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof n)throw TypeError("useDebouncedValue does not support function as value");const[c,i]=e(n),l=t(!0);return o(()=>{let e=!1,t=null;return l.current&&u?(l.current=!1,i(n)):t=window.setTimeout(()=>{l.current=!0,i(n)},r),()=>{t&&window.clearTimeout(t)}},[n,u,r]),c}export{n as useDebouncedValue};
1
+ import"client-only";import{useState as e,useRef as t}from"react";import{useEffect as o}from"../use-abortable-effect/index.mjs";function r(r,n){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof r)throw TypeError("useDebouncedValue does not support function as value");const[i,c]=e(r),l=t(!0);return o(e=>{let t=null;return e.aborted||(u&&l.current?(l.current=!1,c(r)):t=window.setTimeout(()=>{l.current=!0,c(r)},n)),()=>{t&&window.clearTimeout(t)}},[r,u,n]),i}export{r as useDebouncedValue};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");const t="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;exports.useIsomorphicLayoutEffect=t,exports.useLayoutEffect=t;
1
+ "use strict";require("client-only");var e=require("react");const t="undefined"==typeof window?e.useEffect:e.useLayoutEffect;exports.useIsomorphicLayoutEffect=t,exports.useLayoutEffect=t;
@@ -1,8 +1,8 @@
1
- import { useLayoutEffect as useLayoutEffect$1 } from 'react';
1
+ import { useEffect } from 'react';
2
2
 
3
3
  /** @see https://foxact.skk.moe/use-isomorphic-layout-effect */
4
- declare const useIsomorphicLayoutEffect: typeof useLayoutEffect$1;
4
+ declare const useIsomorphicLayoutEffect: typeof useEffect;
5
5
  /** @see https://foxact.skk.moe/use-isomorphic-layout-effect */
6
- declare const useLayoutEffect: typeof useLayoutEffect$1;
6
+ declare const useLayoutEffect: typeof useEffect;
7
7
 
8
8
  export { useIsomorphicLayoutEffect, useLayoutEffect };
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");const t="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;exports.useIsomorphicLayoutEffect=t,exports.useLayoutEffect=t;
1
+ "use strict";require("client-only");var e=require("react");const t="undefined"==typeof window?e.useEffect:e.useLayoutEffect;exports.useIsomorphicLayoutEffect=t,exports.useLayoutEffect=t;
@@ -1 +1 @@
1
- import"client-only";import{useLayoutEffect as o,useEffect as t}from"react";const e="undefined"!=typeof window?o:t,f=e;export{e as useIsomorphicLayoutEffect,f as useLayoutEffect};
1
+ import"client-only";import{useEffect as o,useLayoutEffect as t}from"react";const e="undefined"==typeof window?o:t,f=e;export{e as useIsomorphicLayoutEffect,f as useLayoutEffect};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("../no-ssr/index.cjs"),n=require("../noop/index.cjs"),r=require("react");const t=new Map,o=(e,r)=>{if("undefined"==typeof window)return n.noop;const o=window.matchMedia(e),i=()=>{t.set(e,o.matches),r()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}},i=()=>{throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")};exports.useMediaQuery=(e,n)=>{"undefined"==typeof window||t.has(e)||t.set(e,window.matchMedia(e).matches);const a=r.useCallback(n=>o(e,n),[e]);return r.useSyncExternalStore(a,()=>{var n;return"undefined"!=typeof window&&(null!==(n=t.get(e))&&void 0!==n?n:window.matchMedia(e).matches)},void 0!==n?()=>n:i)};
2
+ "use strict";var e=require("../no-ssr/index.cjs"),n=require("../noop/index.cjs"),r=require("react");const t=new Map,o=(e,r)=>{if("undefined"==typeof window)return n.noop;const o=window.matchMedia(e),i=()=>{t.set(e,o.matches),r()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}},i=()=>{throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")};exports.useMediaQuery=(e,n)=>{"undefined"==typeof window||t.has(e)||t.set(e,window.matchMedia(e).matches);const a=r.useCallback(n=>o(e,n),[e]);return r.useSyncExternalStore(a,()=>{var n;return"undefined"!=typeof window&&(null!==(n=t.get(e))&&void 0!==n?n:window.matchMedia(e).matches)},void 0===n?i:()=>n)};
@@ -1,4 +1,4 @@
1
1
  /** @see https://foxact.skk.moe/use-media-query */
2
- declare const useMediaQuery: (mq: string, serverValue?: boolean | undefined) => boolean;
2
+ declare const useMediaQuery: (mq: string, serverValue?: boolean) => boolean;
3
3
 
4
4
  export { useMediaQuery };
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("../no-ssr/index.js"),n=require("../noop/index.js"),r=require("react");const t=new Map,o=(e,r)=>{if("undefined"==typeof window)return n.noop;const o=window.matchMedia(e),i=()=>{t.set(e,o.matches),r()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}},i=()=>{throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")};exports.useMediaQuery=(e,n)=>{"undefined"==typeof window||t.has(e)||t.set(e,window.matchMedia(e).matches);const a=r.useCallback(n=>o(e,n),[e]);return r.useSyncExternalStore(a,()=>{var n;return"undefined"!=typeof window&&(null!==(n=t.get(e))&&void 0!==n?n:window.matchMedia(e).matches)},void 0!==n?()=>n:i)};
2
+ "use strict";var e=require("../no-ssr/index.js"),n=require("../noop/index.js"),r=require("react");const t=new Map,o=(e,r)=>{if("undefined"==typeof window)return n.noop;const o=window.matchMedia(e),i=()=>{t.set(e,o.matches),r()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}},i=()=>{throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")};exports.useMediaQuery=(e,n)=>{"undefined"==typeof window||t.has(e)||t.set(e,window.matchMedia(e).matches);const a=r.useCallback(n=>o(e,n),[e]);return r.useSyncExternalStore(a,()=>{var n;return"undefined"!=typeof window&&(null!==(n=t.get(e))&&void 0!==n?n:window.matchMedia(e).matches)},void 0===n?i:()=>n)};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{noSSRError as e}from"../no-ssr/index.mjs";import{noop as n}from"../noop/index.mjs";import{useCallback as t,useSyncExternalStore as o}from"react";const r=new Map,i=(e,t)=>{if("undefined"==typeof window)return n;const o=window.matchMedia(e),i=()=>{r.set(e,o.matches),t()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}},d=()=>{throw e("useMediaQuery cannot be used on the server without a serverValue")},a=(e,n)=>("undefined"==typeof window||r.has(e)||r.set(e,window.matchMedia(e).matches),o(t(n=>i(e,n),[e]),()=>{var n;return"undefined"!=typeof window&&(null!==(n=r.get(e))&&void 0!==n?n:window.matchMedia(e).matches)},void 0!==n?()=>n:d));export{a as useMediaQuery};
2
+ import{noSSRError as e}from"../no-ssr/index.mjs";import{noop as n}from"../noop/index.mjs";import{useCallback as t,useSyncExternalStore as o}from"react";const r=new Map,i=(e,t)=>{if("undefined"==typeof window)return n;const o=window.matchMedia(e),i=()=>{r.set(e,o.matches),t()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}},d=()=>{throw e("useMediaQuery cannot be used on the server without a serverValue")},a=(e,n)=>("undefined"==typeof window||r.has(e)||r.set(e,window.matchMedia(e).matches),o(t(n=>i(e,n),[e]),()=>{var n;return"undefined"!=typeof window&&(null!==(n=r.get(e))&&void 0!==n?n:window.matchMedia(e).matches)},void 0===n?d:()=>n));export{a as useMediaQuery};
@@ -1 +1 @@
1
- "use strict";var e=require("react");const t="undefined"!=typeof window?e.useInsertionEffect||e.useLayoutEffect:e.useEffect;function n(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}exports.useStableHandler=function(r){const o=e.useRef(n);return t(()=>{o.current=r},[r]),e.useCallback(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.current)(...t)},[])};
1
+ "use strict";var e=require("react");const t="undefined"==typeof window?e.useEffect:e.useInsertionEffect||e.useLayoutEffect;function n(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}exports.useStableHandler=function(r){const o=e.useRef(n);return t(()=>{o.current=r},[r]),e.useCallback(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.current)(...t)},[])};
@@ -1 +1 @@
1
- "use strict";var e=require("react");const t="undefined"!=typeof window?e.useInsertionEffect||e.useLayoutEffect:e.useEffect;function n(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}exports.useStableHandler=function(r){const o=e.useRef(n);return t(()=>{o.current=r},[r]),e.useCallback(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.current)(...t)},[])};
1
+ "use strict";var e=require("react");const t="undefined"==typeof window?e.useEffect:e.useInsertionEffect||e.useLayoutEffect;function n(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}exports.useStableHandler=function(r){const o=e.useRef(n);return t(()=>{o.current=r},[r]),e.useCallback(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.current)(...t)},[])};
@@ -1 +1 @@
1
- import e,{useLayoutEffect as n,useEffect as t,useRef as r,useCallback as o}from"react";const c="undefined"!=typeof window?e.useInsertionEffect||n:t;function f(e){const n=r(u);return c(()=>{n.current=e},[e]),o(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.current)(...t)},[])}function u(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}export{f as useStableHandler};
1
+ import e,{useEffect as n,useLayoutEffect as t,useRef as r,useCallback as o}from"react";const c="undefined"==typeof window?n:e.useInsertionEffect||t;function f(e){const n=r(u);return c(()=>{n.current=e},[e]),o(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.current)(...t)},[])}function u(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}export{f as useStableHandler};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");const r=e=>e;exports.useUncontrolled=function(t){let u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;const n=e.useRef(null),[c,l]=e.useReducer((e,r)=>u(r),t);return[c,e.useCallback(()=>{n.current&&l(n.current.value)},[]),n]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../use-typescript-happy-callback/index.cjs");const t=e=>e;exports.useUncontrolled=function(u){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;const n=e.useRef(null),[l,s]=e.useReducer((e,r)=>c(r),u);return[l,r.useCallback(()=>{n.current&&s(n.current.value)},[]),n]};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");const r=e=>e;exports.useUncontrolled=function(t){let u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;const n=e.useRef(null),[c,l]=e.useReducer((e,r)=>u(r),t);return[c,e.useCallback(()=>{n.current&&l(n.current.value)},[]),n]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../use-typescript-happy-callback/index.js");const t=e=>e;exports.useUncontrolled=function(u){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;const n=e.useRef(null),[l,s]=e.useReducer((e,r)=>c(r),u);return[l,r.useCallback(()=>{n.current&&s(n.current.value)},[]),n]};
@@ -1 +1 @@
1
- import"client-only";import{useRef as t,useReducer as n,useCallback as r}from"react";const e=t=>t;function o(o){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=t(null),[u,i]=n((t,n)=>l(n),o);return[u,r(()=>{c.current&&i(c.current.value)},[]),c]}export{o as useUncontrolled};
1
+ import"client-only";import{useRef as t,useReducer as r}from"react";import{useCallback as e}from"../use-typescript-happy-callback/index.mjs";const n=t=>t;function o(o){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const l=t(null),[i,p]=r((t,r)=>c(r),o);return[i,e(()=>{l.current&&p(l.current.value)},[]),l]}export{o as useUncontrolled};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),n=require("../no-ssr/index.cjs");const t=e=>e,a=(()=>{if("undefined"==typeof window)return e=>r.noop;let e=!1;const n=new Set,t=()=>{n.forEach(e=>e())};return r=>(n.add(r),e||(e=!0,window.addEventListener("hashchange",t)),()=>{n.delete(r)})})(),l=e=>"function"==typeof e,o=()=>{throw n.noSSRError("useUrlHashState cannot be used on the server without a serverValue")};exports.unstable_useUrlHashState=function(r,n){var s;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:t,deserializer:t};const u=i.raw?t:i.serializer,c=i.raw?t:i.deserializer,d=void 0!==n?()=>u(n):o,h=e.useSyncExternalStore(a,()=>new URLSearchParams(location.hash.slice(1)).get(r),d),w=e.useMemo(()=>null===h?null!=n?n:null:c(h),[n,c,h]),S=e.useCallback(e=>{const t=location.hash,a=new URLSearchParams(t.slice(1)),o=l(e)?e(w):e;o===n||null===o?a.delete(r):a.set(r,u(o));const s=a.toString();t!==s&&(location.hash=s)},[n,w,r,u]);return[null!==(s=null!=w?w:n)&&void 0!==s?s:null,S]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),n=require("../no-ssr/index.cjs");const t=e=>e,a=(()=>{if("undefined"==typeof window)return e=>r.noop;let e=!1;const n=new Set,t=()=>{n.forEach(e=>e())};return r=>(n.add(r),e||(e=!0,window.addEventListener("hashchange",t)),()=>{n.delete(r)})})(),l=e=>"function"==typeof e,o=()=>{throw n.noSSRError("useUrlHashState cannot be used on the server without a serverValue")};exports.unstable_useUrlHashState=function(r,n){var s;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:t,deserializer:t};const u=i.raw?t:i.serializer,c=i.raw?t:i.deserializer,d=void 0===n?o:()=>u(n),h=e.useSyncExternalStore(a,()=>new URLSearchParams(location.hash.slice(1)).get(r),d),w=e.useMemo(()=>null===h?null!=n?n:null:c(h),[n,c,h]),S=e.useCallback(e=>{const t=location.hash,a=new URLSearchParams(t.slice(1)),o=l(e)?e(w):e;o===n||null===o?a.delete(r):a.set(r,u(o));const s=a.toString();t!==s&&(location.hash=s)},[n,w,r,u]);return[null!==(s=null!=w?w:n)&&void 0!==s?s:null,S]};
@@ -10,6 +10,6 @@ interface UseUrlHashStateParserOption<T> {
10
10
  deserializer: Deserializer<T>;
11
11
  }
12
12
  /** @see https://foxact.skk.moe/use-url-hash-state */
13
- declare function useUrlHashState<T>(key: string, defaultValue?: NotUndefined<T> | undefined, options?: UseUrlHashStateRawOption | UseUrlHashStateParserOption<T>): readonly [NonNullable<T> | null, (v: React.SetStateAction<T | null>) => void];
13
+ declare function useUrlHashState<T>(key: string, defaultValue?: NotUndefined<T>, options?: UseUrlHashStateRawOption | UseUrlHashStateParserOption<T>): readonly [NonNullable<T> | null, (v: React.SetStateAction<T | null>) => void];
14
14
 
15
15
  export { type Deserializer, type Serializer, type UseUrlHashStateParserOption, type UseUrlHashStateRawOption, useUrlHashState as unstable_useUrlHashState };
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),n=require("../no-ssr/index.js");const t=e=>e,a=(()=>{if("undefined"==typeof window)return e=>r.noop;let e=!1;const n=new Set,t=()=>{n.forEach(e=>e())};return r=>(n.add(r),e||(e=!0,window.addEventListener("hashchange",t)),()=>{n.delete(r)})})(),l=e=>"function"==typeof e,o=()=>{throw n.noSSRError("useUrlHashState cannot be used on the server without a serverValue")};exports.unstable_useUrlHashState=function(r,n){var s;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:t,deserializer:t};const u=i.raw?t:i.serializer,c=i.raw?t:i.deserializer,d=void 0!==n?()=>u(n):o,h=e.useSyncExternalStore(a,()=>new URLSearchParams(location.hash.slice(1)).get(r),d),w=e.useMemo(()=>null===h?null!=n?n:null:c(h),[n,c,h]),S=e.useCallback(e=>{const t=location.hash,a=new URLSearchParams(t.slice(1)),o=l(e)?e(w):e;o===n||null===o?a.delete(r):a.set(r,u(o));const s=a.toString();t!==s&&(location.hash=s)},[n,w,r,u]);return[null!==(s=null!=w?w:n)&&void 0!==s?s:null,S]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),n=require("../no-ssr/index.js");const t=e=>e,a=(()=>{if("undefined"==typeof window)return e=>r.noop;let e=!1;const n=new Set,t=()=>{n.forEach(e=>e())};return r=>(n.add(r),e||(e=!0,window.addEventListener("hashchange",t)),()=>{n.delete(r)})})(),l=e=>"function"==typeof e,o=()=>{throw n.noSSRError("useUrlHashState cannot be used on the server without a serverValue")};exports.unstable_useUrlHashState=function(r,n){var s;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:t,deserializer:t};const u=i.raw?t:i.serializer,c=i.raw?t:i.deserializer,d=void 0===n?o:()=>u(n),h=e.useSyncExternalStore(a,()=>new URLSearchParams(location.hash.slice(1)).get(r),d),w=e.useMemo(()=>null===h?null!=n?n:null:c(h),[n,c,h]),S=e.useCallback(e=>{const t=location.hash,a=new URLSearchParams(t.slice(1)),o=l(e)?e(w):e;o===n||null===o?a.delete(r):a.set(r,u(o));const s=a.toString();t!==s&&(location.hash=s)},[n,w,r,u]);return[null!==(s=null!=w?w:n)&&void 0!==s?s:null,S]};
@@ -1 +1 @@
1
- import"client-only";import{useSyncExternalStore as e,useMemo as t,useCallback as n}from"react";import{noop as r}from"../noop/index.mjs";import{noSSRError as o}from"../no-ssr/index.mjs";const a=e=>e,l=(()=>{if("undefined"==typeof window)return e=>r;let e=!1;const t=new Set,n=()=>{t.forEach(e=>e())};return r=>(t.add(r),e||(e=!0,window.addEventListener("hashchange",n)),()=>{t.delete(r)})})(),s=e=>"function"==typeof e,i=()=>{throw o("useUrlHashState cannot be used on the server without a serverValue")};function u(r,o){var u;let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:a,deserializer:a};const h=c.raw?a:c.serializer,d=c.raw?a:c.deserializer,m=e(l,()=>new URLSearchParams(location.hash.slice(1)).get(r),void 0!==o?()=>h(o):i),w=t(()=>null===m?null!=o?o:null:d(m),[o,d,m]),f=n(e=>{const t=location.hash,n=new URLSearchParams(t.slice(1)),a=s(e)?e(w):e;a===o||null===a?n.delete(r):n.set(r,h(a));const l=n.toString();t!==l&&(location.hash=l)},[o,w,r,h]);return[null!==(u=null!=w?w:o)&&void 0!==u?u:null,f]}export{u as unstable_useUrlHashState};
1
+ import"client-only";import{useSyncExternalStore as e,useMemo as t,useCallback as n}from"react";import{noop as r}from"../noop/index.mjs";import{noSSRError as o}from"../no-ssr/index.mjs";const a=e=>e,l=(()=>{if("undefined"==typeof window)return e=>r;let e=!1;const t=new Set,n=()=>{t.forEach(e=>e())};return r=>(t.add(r),e||(e=!0,window.addEventListener("hashchange",n)),()=>{t.delete(r)})})(),s=e=>"function"==typeof e,i=()=>{throw o("useUrlHashState cannot be used on the server without a serverValue")};function u(r,o){var u;let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:a,deserializer:a};const h=c.raw?a:c.serializer,d=c.raw?a:c.deserializer,w=e(l,()=>new URLSearchParams(location.hash.slice(1)).get(r),void 0===o?i:()=>h(o)),m=t(()=>null===w?null!=o?o:null:d(w),[o,d,w]),f=n(e=>{const t=location.hash,n=new URLSearchParams(t.slice(1)),a=s(e)?e(m):e;a===o||null===a?n.delete(r):n.set(r,h(a));const l=n.toString();t!==l&&(location.hash=l)},[o,m,r,h]);return[null!==(u=null!=m?m:o)&&void 0!==u?u:null,f]}export{u as unstable_useUrlHashState};