foxact 0.2.55 → 0.3.1

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 (50) hide show
  1. package/create-local-storage-state/index.cjs +1 -1
  2. package/create-local-storage-state/index.d.ts +2 -1
  3. package/create-local-storage-state/index.mjs +1 -1
  4. package/create-magic-portal/index.cjs +1 -1
  5. package/create-magic-portal/index.mjs +1 -1
  6. package/create-session-storage-state/index.cjs +1 -1
  7. package/create-session-storage-state/index.d.ts +2 -1
  8. package/create-session-storage-state/index.mjs +1 -1
  9. package/create-stackless-error/index.cjs +1 -0
  10. package/create-stackless-error/index.d.ts +3 -0
  11. package/create-stackless-error/index.mjs +1 -0
  12. package/create-storage-hook/index.cjs +1 -1
  13. package/create-storage-hook/index.d.ts +5 -1
  14. package/create-storage-hook/index.mjs +1 -1
  15. package/create-storage-state-factory/index.cjs +1 -1
  16. package/create-storage-state-factory/index.d.ts +1 -1
  17. package/create-storage-state-factory/index.mjs +1 -1
  18. package/current-year/index.d.ts +2 -1
  19. package/magic-portal/index.cjs +1 -1
  20. package/magic-portal/index.mjs +1 -1
  21. package/no-ssr/index.cjs +1 -1
  22. package/no-ssr/index.mjs +1 -1
  23. package/package.json +37 -64
  24. package/sizes.json +1 -1
  25. package/use-fast-click/index.cjs +1 -1
  26. package/use-fast-click/index.mjs +1 -1
  27. package/use-local-storage/index.cjs +1 -1
  28. package/use-local-storage/index.d.ts +4 -4
  29. package/use-local-storage/index.mjs +1 -1
  30. package/use-media-query/index.cjs +1 -1
  31. package/use-media-query/index.mjs +1 -1
  32. package/use-readonly-search-params/index.cjs +1 -1
  33. package/use-readonly-search-params/index.mjs +1 -1
  34. package/use-session-storage/index.cjs +1 -1
  35. package/use-session-storage/index.d.ts +4 -4
  36. package/use-session-storage/index.mjs +1 -1
  37. package/use-url-hash-state/index.cjs +1 -1
  38. package/use-url-hash-state/index.mjs +1 -1
  39. package/use-next-link/index.cjs +0 -1
  40. package/use-next-link/index.d.ts +0 -31
  41. package/use-next-link/index.mjs +0 -1
  42. package/use-next-pathname/index.cjs +0 -1
  43. package/use-next-pathname/index.d.ts +0 -4
  44. package/use-next-pathname/index.mjs +0 -1
  45. package/use-react-router-enable-concurrent-navigation/index.cjs +0 -2
  46. package/use-react-router-enable-concurrent-navigation/index.d.ts +0 -8
  47. package/use-react-router-enable-concurrent-navigation/index.mjs +0 -2
  48. package/use-react-router-is-match/index.cjs +0 -1
  49. package/use-react-router-is-match/index.d.ts +0 -11
  50. package/use-react-router-is-match/index.mjs +0 -1
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("../create-storage-state-factory/index.cjs");require("../chunks/index.b9dLwVor.cjs"),require("../create-storage-hook/index.cjs"),require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const r=e.createStorageStateFactory("localStorage");exports.createLocalStorageState=r;
1
+ "use strict";require("client-only");var e=require("../create-storage-state-factory/index.cjs");require("../create-storage-hook/index.cjs"),require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const r=e.createStorageStateFactory("localStorage");exports.createLocalStorageState=r;
@@ -6,7 +6,7 @@ import { NotUndefined, UseStorageRawOption, UseStorageParserOption } from '../cr
6
6
  *
7
7
  * @example
8
8
  * ```ts
9
- * const [useOpenState, useOpen] = createLocalStorageState(
9
+ * const [useOpenState, useOpen, useSetOpen] = createLocalStorageState(
10
10
  * 'open', // storage key
11
11
  * false, // server default value
12
12
  * { raw: false } // options
@@ -14,6 +14,7 @@ import { NotUndefined, UseStorageRawOption, UseStorageParserOption } from '../cr
14
14
  *
15
15
  * const [open, setOpen] = useOpenState();
16
16
  * const open = useOpen();
17
+ * const setOpen = useSetOpen();
17
18
  * ```
18
19
  */
19
20
  declare const createLocalStorageState: {
@@ -1 +1 @@
1
- import"client-only";import{createStorageStateFactory as o}from"../create-storage-state-factory/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../chunks/index.C9-3oDdv.mjs";const t=o("localStorage");export{t as createLocalStorageState};
1
+ import"client-only";import{createStorageStateFactory as e}from"../create-storage-state-factory/index.mjs";import"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";const o=e("localStorage");export{o as createLocalStorageState};
@@ -1 +1 @@
1
- "use strict";var e=require("../magic-portal/index.cjs");require("react/jsx-runtime"),require("client-only"),require("react-dom"),require("../context-state/index.cjs"),require("react"),require("../noop/index.cjs"),require("../no-ssr/index.cjs"),exports.createMagicPortal=e.createMagicPortal;
1
+ "use strict";var e=require("../magic-portal/index.cjs");require("react/jsx-runtime"),require("client-only"),require("react-dom"),require("../context-state/index.cjs"),require("react"),require("../noop/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),exports.createMagicPortal=e.createMagicPortal;
@@ -1 +1 @@
1
- export{createMagicPortal}from"../magic-portal/index.mjs";import"react/jsx-runtime";import"client-only";import"react-dom";import"../context-state/index.mjs";import"react";import"../noop/index.mjs";import"../no-ssr/index.mjs";
1
+ export{createMagicPortal}from"../magic-portal/index.mjs";import"react/jsx-runtime";import"client-only";import"react-dom";import"../context-state/index.mjs";import"react";import"../noop/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("../create-storage-state-factory/index.cjs");require("../chunks/index.b9dLwVor.cjs"),require("../create-storage-hook/index.cjs"),require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const r=e.createStorageStateFactory("sessionStorage");exports.createSessionStorageState=r;
1
+ "use strict";require("client-only");var e=require("../create-storage-state-factory/index.cjs");require("../create-storage-hook/index.cjs"),require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const r=e.createStorageStateFactory("sessionStorage");exports.createSessionStorageState=r;
@@ -7,7 +7,7 @@ import { NotUndefined, UseStorageRawOption, UseStorageParserOption } from '../cr
7
7
  * @example
8
8
  * ```ts
9
9
  * ```ts
10
- * const [useOpenState, useOpen] = createSessionStorageState(
10
+ * const [useOpenState, useOpen, useSetOpen] = createSessionStorageState(
11
11
  * 'open', // storage key
12
12
  * false, // server default value
13
13
  * { raw: false } // options
@@ -15,6 +15,7 @@ import { NotUndefined, UseStorageRawOption, UseStorageParserOption } from '../cr
15
15
  *
16
16
  * const [open, setOpen] = useOpenState();
17
17
  * const open = useOpen();
18
+ * const setOpen = useSetOpen();
18
19
  * ```
19
20
  */
20
21
  declare const createSessionStorageState: {
@@ -1 +1 @@
1
- import"client-only";import{createStorageStateFactory as o}from"../create-storage-state-factory/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../chunks/index.C9-3oDdv.mjs";const e=o("sessionStorage");export{e as createSessionStorageState};
1
+ import"client-only";import{createStorageStateFactory as e}from"../create-storage-state-factory/index.mjs";import"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";const o=e("sessionStorage");export{o as createSessionStorageState};
@@ -0,0 +1 @@
1
+ "use strict";const r=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit"),t=(null==r?void 0:r.writable)&&"number"==typeof r.value;exports.createStacklessError=function(r){const e=Error.stackTraceLimit;t&&(Error.stackTraceLimit=0);const c=r();return t&&(Error.stackTraceLimit=e),c};
@@ -0,0 +1,3 @@
1
+ declare function createStacklessError<T = Error>(errorFacrory: () => T): T;
2
+
3
+ export { createStacklessError };
@@ -0,0 +1 @@
1
+ const r=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit"),t=(null==r?void 0:r.writable)&&"number"==typeof r.value;function e(r){const e=Error.stackTraceLimit;t&&(Error.stackTraceLimit=0);const c=r();return t&&(Error.stackTraceLimit=e),c}export{e as createStacklessError};
@@ -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"),r=require("../chunks/index.b9dLwVor.cjs"),a=require("../chunks/index.BtiK5_Nn.cjs");function 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="u"<typeof window?o.noop:e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))},u="u"<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="u"<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("u"<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("u"<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?r.t:c.serializer,g=c.raw?r.t:c.deserializer,y=void 0===s?i:()=>v(s),h=e.useSyncExternalStore(f,()=>w(n),y),m=e.useMemo(()=>null===h?null:g(h),[h,g]),p=e.useCallback(e=>{try{const o=a.n(e)?e(null!=m?m:null):e;null===o?d(n):u(n,v(o))}catch(e){console.warn(e)}},[n,v,m]);return t.useLayoutEffect(()=>{null===w(n)&&void 0!==s&&u(n,v(s))},[g,n,v,s]),[null===m?void 0===s?null:s:m,p]},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"),t=require("../noop/index.cjs"),r=require("../use-isomorphic-layout-effect/index.cjs"),n=require("../no-ssr/index.cjs"),o=require("../chunks/index.b9dLwVor.cjs"),i=require("../chunks/index.BtiK5_Nn.cjs");require("../create-stackless-error/index.cjs"),exports.createStorage=function(a){const s="localStorage"===a?"foxact-use-local-storage":"foxact-use-session-storage",l="localStorage"===a?"foxact/use-local-storage":"foxact/use-session-storage";function c(){throw n.noSSRError("[".concat(l,"] cannot be used on the server without a serverValue"))}const u="u"<typeof window?t.noop:e=>{window.dispatchEvent(new CustomEvent(s,{detail:e}))},d="u"<typeof window?t.noop:(e,t)=>{try{window[a].setItem(e,t)}catch(e){console.warn("[".concat(l,"] Failed to set value to ").concat(a,", it might be blocked"))}finally{u(e)}},w="u"<typeof window?t.noop:e=>{try{window[a].removeItem(e)}catch(e){console.warn("[".concat(l,"] Failed to remove value from ").concat(a,", it might be blocked"))}finally{u(e)}},f=e=>{if("u"<typeof window)return null;try{return window[a].getItem(e)}catch(e){return console.warn("[".concat(l,"] Failed to get value from ").concat(a,", it might be blocked")),null}},v=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const n=r.raw?o.t:r.serializer,a=r.raw?o.t:r.deserializer;return e.useCallback(e=>{try{let r;if(i.n(e)){const n=f(t),o=null===n?null:a(n);r=e(o)}else r=e;null===r?w(t):d(t,n(r))}catch(e){console.warn(e)}},[t,n,a])};function g(n,i){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const l=e.useCallback(e=>{if("u"<typeof window)return t.noop;const r=t=>{"key"in t&&t.key!==n||e()},o=t=>{t.detail===n&&e()};return window.addEventListener("storage",r),window.addEventListener(s,o),()=>{window.removeEventListener("storage",r),window.removeEventListener(s,o)}},[n]),u=a.raw?o.t:a.serializer,w=a.raw?o.t:a.deserializer,v=void 0===i?c:()=>u(i),g=e.useSyncExternalStore(l,()=>f(n),v),y=e.useMemo(()=>null===g?null:w(g),[g,w]);return r.useLayoutEffect(()=>{null===f(n)&&void 0!==i&&d(n,u(i))},[n,u,i]),null===y?void 0===i?null:i:y}return{useStorageValue:g,useSetStorage:v,useStorage:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};return[g(e,t,r),v(e,r)]}}};
@@ -19,11 +19,15 @@ interface UseStorageParserOption<T> {
19
19
  deserializer: Deserializer<T>;
20
20
  }
21
21
  declare function createStorage(type: StorageType): {
22
+ useStorageValue: {
23
+ <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): T;
24
+ <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): T | null;
25
+ };
26
+ useSetStorage: <T>(key: string, options?: UseStorageRawOption | UseStorageParserOption<T>) => (v: React.SetStateAction<T | null>) => void;
22
27
  useStorage: {
23
28
  <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): StateHookTuple<T>;
24
29
  <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): StateHookTuple<T | null>;
25
30
  };
26
- useSetStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
27
31
  };
28
32
 
29
33
  export { createStorage };
@@ -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";import{t as a}from"../chunks/index.D0KaUCcV.mjs";import{n as l}from"../chunks/index.C9-3oDdv.mjs";function s(){throw i("useLocalStorage cannot be used on the server without a serverValue")}function c(i){const c="localStorage"===i?"foxact-use-local-storage":"foxact-use-session-storage",u="localStorage"===i?"foxact/use-local-storage":"foxact/use-session-storage",d="u"<typeof window?n:e=>{window.dispatchEvent(new CustomEvent(c,{detail:e}))},w="u"<typeof window?n:(e,o)=>{try{window[i].setItem(e,o)}catch(e){console.warn("[".concat(u,"] Failed to set value to ").concat(i,", it might be blocked"))}finally{d(e)}},m="u"<typeof window?n:e=>{try{window[i].removeItem(e)}catch(e){console.warn("[".concat(u,"] Failed to remove value from ").concat(i,", it might be blocked"))}finally{d(e)}},f=e=>{if("u"<typeof window)return null;try{return window[i].getItem(e)}catch(e){return console.warn("[".concat(u,"] Failed to get value from ").concat(i,", it might be blocked")),null}};return{useStorage:function(i,u){let d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const g=e(e=>{if("u"<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(c,t),()=>{window.removeEventListener("storage",o),window.removeEventListener(c,t)}},[i]),v=d.raw?a:d.serializer,p=d.raw?a:d.deserializer,y=o(g,()=>f(i),void 0===u?s:()=>v(u)),h=t(()=>null===y?null:p(y),[y,p]),x=e(e=>{try{const o=l(e)?e(null!=h?h:null):e;null===o?m(i):w(i,v(o))}catch(e){console.warn(e)}},[i,v,h]);return r(()=>{null===f(i)&&void 0!==u&&w(i,v(u))},[p,i,v,u]),[null===h?void 0===u?null:u:h,x]},useSetStorage:(o,t)=>e(e=>{try{null===e?m(o):w(o,t(e))}catch(e){console.warn(e)}},[o,t])}}export{c as createStorage};
1
+ import"client-only";import{useCallback as e,useSyncExternalStore as t,useMemo as o}from"react";import{noop as r}from"../noop/index.mjs";import{useLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as i}from"../no-ssr/index.mjs";import{t as a}from"../chunks/index.D0KaUCcV.mjs";import{n as s}from"../chunks/index.C9-3oDdv.mjs";import"../create-stackless-error/index.mjs";function l(l){const c="localStorage"===l?"foxact-use-local-storage":"foxact-use-session-storage",u="localStorage"===l?"foxact/use-local-storage":"foxact/use-session-storage";function d(){throw i("[".concat(u,"] cannot be used on the server without a serverValue"))}const w="u"<typeof window?r:e=>{window.dispatchEvent(new CustomEvent(c,{detail:e}))},m="u"<typeof window?r:(e,t)=>{try{window[l].setItem(e,t)}catch(e){console.warn("[".concat(u,"] Failed to set value to ").concat(l,", it might be blocked"))}finally{w(e)}},f="u"<typeof window?r:e=>{try{window[l].removeItem(e)}catch(e){console.warn("[".concat(u,"] Failed to remove value from ").concat(l,", it might be blocked"))}finally{w(e)}},g=e=>{if("u"<typeof window)return null;try{return window[l].getItem(e)}catch(e){return console.warn("[".concat(u,"] Failed to get value from ").concat(l,", it might be blocked")),null}},v=function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const r=o.raw?a:o.serializer,n=o.raw?a:o.deserializer;return e(e=>{try{let o;if(s(e)){const r=g(t),i=null===r?null:n(r);o=e(i)}else o=e;null===o?f(t):m(t,r(o))}catch(e){console.warn(e)}},[t,r,n])};function p(i,s){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const u=e(e=>{if("u"<typeof window)return r;const t=t=>{"key"in t&&t.key!==i||e()},o=t=>{t.detail===i&&e()};return window.addEventListener("storage",t),window.addEventListener(c,o),()=>{window.removeEventListener("storage",t),window.removeEventListener(c,o)}},[i]),w=l.raw?a:l.serializer,f=l.raw?a:l.deserializer,v=t(u,()=>g(i),void 0===s?d:()=>w(s)),p=o(()=>null===v?null:f(v),[v,f]);return n(()=>{null===g(i)&&void 0!==s&&m(i,w(s))},[i,w,s]),null===p?void 0===s?null:s:p}return{useStorageValue:p,useSetStorage:v,useStorage:function(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};return[p(e,t,o),v(e,o)]}}}export{l as createStorage};
@@ -1 +1 @@
1
- "use strict";var e=require("../chunks/index.b9dLwVor.cjs"),r=require("../create-storage-hook/index.cjs");require("client-only"),require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../chunks/index.BtiK5_Nn.cjs"),exports.createStorageStateFactory=function(i){return function(t,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const{useStorage:c,useSetStorage:o}=r.createStorage(i);return[()=>c(t,s,n),()=>c(t,s,n)[0],()=>o(t,n.raw?e.t:n.serializer)]}};
1
+ "use strict";var e=require("../create-storage-hook/index.cjs");require("client-only"),require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs"),exports.createStorageStateFactory=function(r){return function(t,i){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const{useStorage:c,useStorageValue:n,useSetStorage:o}=e.createStorage(r);return[()=>c(t,i,s),()=>n(t,i,s),()=>o(t,s)]}};
@@ -1,7 +1,7 @@
1
1
  import { StateHookTuple, StorageType, NotUndefined, UseStorageRawOption, UseStorageParserOption } from '../create-storage-hook/index.js';
2
2
 
3
3
  type ValueHook<T> = () => T;
4
- type SetValueHook<T> = () => (value: T) => void;
4
+ type SetValueHook<T> = () => React.Dispatch<React.SetStateAction<T>>;
5
5
  type StateHook<T> = () => StateHookTuple<T>;
6
6
  declare function createStorageStateFactory(type: StorageType): {
7
7
  <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [StateHook<T>, ValueHook<T>, SetValueHook<T | null>];
@@ -1 +1 @@
1
- import{t as e}from"../chunks/index.D0KaUCcV.mjs";import{createStorage as r}from"../create-storage-hook/index.mjs";import"client-only";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../chunks/index.C9-3oDdv.mjs";function t(t){return function(o,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const{useStorage:s,useSetStorage:m}=r(t);return[()=>s(o,i,n),()=>s(o,i,n)[0],()=>m(o,n.raw?e:n.serializer)]}}export{t as createStorageStateFactory};
1
+ import{createStorage as e}from"../create-storage-hook/index.mjs";import"client-only";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";function r(r){return function(t,o){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const{useStorage:s,useStorageValue:n,useSetStorage:a}=e(r);return[()=>s(t,o,i),()=>n(t,o,i),()=>a(t,i)]}}export{r as createStorageStateFactory};
@@ -1,9 +1,10 @@
1
1
  import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
3
 
3
4
  interface CurrentYearProps extends React.ComponentProps<'span'> {
4
5
  defaultYear?: number;
5
6
  }
6
7
  /** @see https://foxact.skk.moe/current-year */
7
- declare const CurrentYear: react.NamedExoticComponent<CurrentYearProps>;
8
+ declare const CurrentYear: react.MemoExoticComponent<({ defaultYear, ...restProps }: CurrentYearProps) => react_jsx_runtime.JSX.Element>;
8
9
 
9
10
  export { CurrentYear };
@@ -1 +1 @@
1
- "use strict";var e=require("react/jsx-runtime");require("client-only");var r=require("react-dom"),t=require("../context-state/index.cjs"),n=require("../no-ssr/index.cjs"),o=require("react");require("../noop/index.cjs"),exports.createMagicPortal=function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[i,l,a]=t.createContextState(null);function s(r){let{as:t,ssrFallback:o=null,...i}=r;null!=o&&n.noSSR();const l=a();return e.jsx(t||"div",{...c?{"data-foxact-magic-portal-target":c}:{},ref:l,...i})}function u(r){const{ssrFallback:t=null}=r;return null!=t?e.jsx(o.Suspense,{fallback:t,children:e.jsx(s,{...r})}):e.jsx(s,{...r})}function d(e){let{children:t}=e;const n=l();return"u"<typeof window||!n?null:r.createPortal(t,n)}function p(r){let{children:t}=r;return e.jsx(i,{children:t})}return"production"!==process.env.NODE_ENV&&(u.displayName=c+".PortalTarget"),"production"!==process.env.NODE_ENV&&(d.displayName=c+".PortalContent"),"production"!==process.env.NODE_ENV&&(p.displayName=c+".PortalProvider"),[p,u,d]};
1
+ "use strict";var e=require("react/jsx-runtime");require("client-only");var r=require("react-dom"),t=require("../context-state/index.cjs"),n=require("../no-ssr/index.cjs"),o=require("react");require("../noop/index.cjs"),require("../create-stackless-error/index.cjs"),exports.createMagicPortal=function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[s,i,a]=t.createContextState(null);function l(r){let{as:t,ssrFallback:o=null,...s}=r;null!=o&&n.noSSR();const i=a();return e.jsx(t||"div",{...c?{"data-foxact-magic-portal-target":c}:{},ref:i,...s})}function u(r){const{ssrFallback:t=null}=r;return null!=t?e.jsx(o.Suspense,{fallback:t,children:e.jsx(l,{...r})}):e.jsx(l,{...r})}function d(e){let{children:t}=e;const n=i();return"u"<typeof window||!n?null:r.createPortal(t,n)}function p(r){let{children:t}=r;return e.jsx(s,{children:t})}return"production"!==process.env.NODE_ENV&&(u.displayName=c+".PortalTarget"),"production"!==process.env.NODE_ENV&&(d.displayName=c+".PortalContent"),"production"!==process.env.NODE_ENV&&(p.displayName=c+".PortalProvider"),[p,u,d]};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import"client-only";import{createPortal as o}from"react-dom";import{createContextState as n}from"../context-state/index.mjs";import{noSSR as r}from"../no-ssr/index.mjs";import{Suspense as e}from"react";import"../noop/index.mjs";function i(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[l,c,a]=n(null);function m(o){let{as:n,ssrFallback:e=null,...l}=o;null!=e&&r();const c=a();return t(n||"div",{...i?{"data-foxact-magic-portal-target":i}:{},ref:c,...l})}function u(o){const{ssrFallback:n=null}=o;return null!=n?t(e,{fallback:n,children:t(m,{...o})}):t(m,{...o})}function s(t){let{children:n}=t;const r=c();return"u"<typeof window||!r?null:o(n,r)}function p(o){let{children:n}=o;return t(l,{children:n})}return"production"!==process.env.NODE_ENV&&(u.displayName=i+".PortalTarget"),"production"!==process.env.NODE_ENV&&(s.displayName=i+".PortalContent"),"production"!==process.env.NODE_ENV&&(p.displayName=i+".PortalProvider"),[p,u,s]}export{i as createMagicPortal};
1
+ import{jsx as t}from"react/jsx-runtime";import"client-only";import{createPortal as o}from"react-dom";import{createContextState as r}from"../context-state/index.mjs";import{noSSR as n}from"../no-ssr/index.mjs";import{Suspense as e}from"react";import"../noop/index.mjs";import"../create-stackless-error/index.mjs";function i(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[l,c,a]=r(null);function s(o){let{as:r,ssrFallback:e=null,...l}=o;null!=e&&n();const c=a();return t(r||"div",{...i?{"data-foxact-magic-portal-target":i}:{},ref:c,...l})}function m(o){const{ssrFallback:r=null}=o;return null!=r?t(e,{fallback:r,children:t(s,{...o})}):t(s,{...o})}function u(t){let{children:r}=t;const n=c();return"u"<typeof window||!n?null:o(r,n)}function p(o){let{children:r}=o;return t(l,{children:r})}return"production"!==process.env.NODE_ENV&&(m.displayName=i+".PortalTarget"),"production"!==process.env.NODE_ENV&&(u.displayName=i+".PortalContent"),"production"!==process.env.NODE_ENV&&(p.displayName=i+".PortalProvider"),[p,m,u]}export{i as createMagicPortal};
package/no-ssr/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const r=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit"),t=(null==r?void 0:r.writable)&&"number"==typeof r.value;function o(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const e=Error.stackTraceLimit;t&&(Error.stackTraceLimit=0);const i=Error(r);return t&&(Error.stackTraceLimit=e),i.digest=o,i.recoverableError="NO_SSR",i}exports.noSSR=function(r){if("u"<typeof window)throw o(r)},exports.noSSRError=o;
1
+ "use strict";var r=require("../create-stackless-error/index.cjs");function e(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const t=r.createStacklessError(()=>Error(e));return t.digest=o,t.recoverableError="NO_SSR",t}exports.noSSR=function(r){if("u"<typeof window)throw e(r)},exports.noSSRError=e;
package/no-ssr/index.mjs CHANGED
@@ -1 +1 @@
1
- const r=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit"),t=(null==r?void 0:r.writable)&&"number"==typeof r.value;function o(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const e=Error.stackTraceLimit;t&&(Error.stackTraceLimit=0);const i=Error(r);return t&&(Error.stackTraceLimit=e),i.digest=o,i.recoverableError="NO_SSR",i}function e(r){if("u"<typeof window)throw o(r)}export{e as noSSR,o as noSSRError};
1
+ import{createStacklessError as r}from"../create-stackless-error/index.mjs";function o(o){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const t=r(()=>Error(o));return t.digest=e,t.recoverableError="NO_SSR",t}function e(r){if("u"<typeof window)throw o(r)}export{e as noSSR,o as noSSRError};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.55",
3
+ "version": "0.3.1",
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": {
@@ -61,15 +61,6 @@
61
61
  "require": "./compose-context-provider/index.cjs",
62
62
  "default": "./compose-context-provider/index.cjs"
63
63
  },
64
- "./context-reducer": {
65
- "types": "./context-reducer/index.d.ts",
66
- "import": {
67
- "types": "./context-reducer/index.d.ts",
68
- "default": "./context-reducer/index.mjs"
69
- },
70
- "require": "./context-reducer/index.cjs",
71
- "default": "./context-reducer/index.cjs"
72
- },
73
64
  "./context-state": {
74
65
  "types": "./context-state/index.d.ts",
75
66
  "import": {
@@ -88,6 +79,15 @@
88
79
  "require": "./create-context-reducer/index.cjs",
89
80
  "default": "./create-context-reducer/index.cjs"
90
81
  },
82
+ "./context-reducer": {
83
+ "types": "./context-reducer/index.d.ts",
84
+ "import": {
85
+ "types": "./context-reducer/index.d.ts",
86
+ "default": "./context-reducer/index.mjs"
87
+ },
88
+ "require": "./context-reducer/index.cjs",
89
+ "default": "./context-reducer/index.cjs"
90
+ },
91
91
  "./create-context-state": {
92
92
  "types": "./create-context-state/index.d.ts",
93
93
  "import": {
@@ -133,6 +133,15 @@
133
133
  "require": "./create-session-storage-state/index.cjs",
134
134
  "default": "./create-session-storage-state/index.cjs"
135
135
  },
136
+ "./create-stackless-error": {
137
+ "types": "./create-stackless-error/index.d.ts",
138
+ "import": {
139
+ "types": "./create-stackless-error/index.d.ts",
140
+ "default": "./create-stackless-error/index.mjs"
141
+ },
142
+ "require": "./create-stackless-error/index.cjs",
143
+ "default": "./create-stackless-error/index.cjs"
144
+ },
136
145
  "./create-storage-hook": {
137
146
  "types": "./create-storage-hook/index.d.ts",
138
147
  "import": {
@@ -196,15 +205,6 @@
196
205
  "require": "./is-safari/index.cjs",
197
206
  "default": "./is-safari/index.cjs"
198
207
  },
199
- "./magic-portal": {
200
- "types": "./magic-portal/index.d.ts",
201
- "import": {
202
- "types": "./magic-portal/index.d.ts",
203
- "default": "./magic-portal/index.mjs"
204
- },
205
- "require": "./magic-portal/index.cjs",
206
- "default": "./magic-portal/index.cjs"
207
- },
208
208
  "./merge-refs": {
209
209
  "types": "./merge-refs/index.d.ts",
210
210
  "import": {
@@ -214,6 +214,15 @@
214
214
  "require": "./merge-refs/index.cjs",
215
215
  "default": "./merge-refs/index.cjs"
216
216
  },
217
+ "./magic-portal": {
218
+ "types": "./magic-portal/index.d.ts",
219
+ "import": {
220
+ "types": "./magic-portal/index.d.ts",
221
+ "default": "./magic-portal/index.mjs"
222
+ },
223
+ "require": "./magic-portal/index.cjs",
224
+ "default": "./magic-portal/index.cjs"
225
+ },
217
226
  "./no-ssr": {
218
227
  "types": "./no-ssr/index.d.ts",
219
228
  "import": {
@@ -439,24 +448,6 @@
439
448
  "require": "./use-media-query/index.cjs",
440
449
  "default": "./use-media-query/index.cjs"
441
450
  },
442
- "./use-next-link": {
443
- "types": "./use-next-link/index.d.ts",
444
- "import": {
445
- "types": "./use-next-link/index.d.ts",
446
- "default": "./use-next-link/index.mjs"
447
- },
448
- "require": "./use-next-link/index.cjs",
449
- "default": "./use-next-link/index.cjs"
450
- },
451
- "./use-next-pathname": {
452
- "types": "./use-next-pathname/index.d.ts",
453
- "import": {
454
- "types": "./use-next-pathname/index.d.ts",
455
- "default": "./use-next-pathname/index.mjs"
456
- },
457
- "require": "./use-next-pathname/index.cjs",
458
- "default": "./use-next-pathname/index.cjs"
459
- },
460
451
  "./use-page-visibility": {
461
452
  "types": "./use-page-visibility/index.d.ts",
462
453
  "import": {
@@ -466,24 +457,6 @@
466
457
  "require": "./use-page-visibility/index.cjs",
467
458
  "default": "./use-page-visibility/index.cjs"
468
459
  },
469
- "./use-react-router-enable-concurrent-navigation": {
470
- "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
471
- "import": {
472
- "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
473
- "default": "./use-react-router-enable-concurrent-navigation/index.mjs"
474
- },
475
- "require": "./use-react-router-enable-concurrent-navigation/index.cjs",
476
- "default": "./use-react-router-enable-concurrent-navigation/index.cjs"
477
- },
478
- "./use-react-router-is-match": {
479
- "types": "./use-react-router-is-match/index.d.ts",
480
- "import": {
481
- "types": "./use-react-router-is-match/index.d.ts",
482
- "default": "./use-react-router-is-match/index.mjs"
483
- },
484
- "require": "./use-react-router-is-match/index.cjs",
485
- "default": "./use-react-router-is-match/index.cjs"
486
- },
487
460
  "./use-readonly-search-params": {
488
461
  "types": "./use-readonly-search-params/index.d.ts",
489
462
  "import": {
@@ -502,15 +475,6 @@
502
475
  "require": "./use-retimer/index.cjs",
503
476
  "default": "./use-retimer/index.cjs"
504
477
  },
505
- "./use-session-storage": {
506
- "types": "./use-session-storage/index.d.ts",
507
- "import": {
508
- "types": "./use-session-storage/index.d.ts",
509
- "default": "./use-session-storage/index.mjs"
510
- },
511
- "require": "./use-session-storage/index.cjs",
512
- "default": "./use-session-storage/index.cjs"
513
- },
514
478
  "./use-set": {
515
479
  "types": "./use-set/index.d.ts",
516
480
  "import": {
@@ -520,6 +484,15 @@
520
484
  "require": "./use-set/index.cjs",
521
485
  "default": "./use-set/index.cjs"
522
486
  },
487
+ "./use-session-storage": {
488
+ "types": "./use-session-storage/index.d.ts",
489
+ "import": {
490
+ "types": "./use-session-storage/index.d.ts",
491
+ "default": "./use-session-storage/index.mjs"
492
+ },
493
+ "require": "./use-session-storage/index.cjs",
494
+ "default": "./use-session-storage/index.cjs"
495
+ },
523
496
  "./use-singleton": {
524
497
  "types": "./use-singleton/index.d.ts",
525
498
  "import": {
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":28153,"gzip":17099,"br":0},"exports":{"compose-context-provider":{"raw":177,"gzip":155,"br":122},"context-state":{"raw":402,"gzip":259,"br":218},"create-context-reducer":{"raw":223,"gzip":146,"br":117},"create-context-state":{"raw":145,"gzip":116,"br":96},"create-magic-portal":{"raw":224,"gzip":136,"br":112},"create-fixed-array":{"raw":452,"gzip":282,"br":248},"create-session-storage-state":{"raw":406,"gzip":215,"br":188},"create-local-storage-state":{"raw":402,"gzip":216,"br":189},"context-reducer":{"raw":557,"gzip":332,"br":319},"current-year":{"raw":524,"gzip":355,"br":293},"email-protection":{"raw":426,"gzip":321,"br":272},"create-storage-state-factory":{"raw":592,"gzip":338,"br":304},"invariant":{"raw":178,"gzip":156,"br":118},"fetch-jsonp":{"raw":890,"gzip":546,"br":429},"is-safari":{"raw":233,"gzip":164,"br":119},"create-storage-hook":{"raw":2087,"gzip":897,"br":789},"noop":{"raw":33,"gzip":53,"br":37},"no-ssr":{"raw":465,"gzip":313,"br":260},"nullthrow":{"raw":187,"gzip":163,"br":121},"magic-portal":{"raw":1039,"gzip":521,"br":463},"request-idle-callback":{"raw":392,"gzip":221,"br":171},"types":{"raw":0,"gzip":20,"br":1},"merge-refs":{"raw":525,"gzip":280,"br":235},"use":{"raw":298,"gzip":197,"br":160},"use-abortable-effect":{"raw":215,"gzip":170,"br":144},"open-new-tab":{"raw":335,"gzip":255,"br":187},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"rem":{"raw":823,"gzip":395,"br":350},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154},"use-composition-input":{"raw":470,"gzip":286,"br":241},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-array":{"raw":322,"gzip":236,"br":202},"use-error-boundary":{"raw":252,"gzip":195,"br":165},"use-clipboard":{"raw":1177,"gzip":650,"br":552},"use-is-client":{"raw":204,"gzip":153,"br":121},"use-debounced-value":{"raw":524,"gzip":342,"br":286},"use-isomorphic-layout-effect":{"raw":169,"gzip":137,"br":110},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-fast-click":{"raw":578,"gzip":377,"br":304},"use-local-storage":{"raw":384,"gzip":215,"br":201},"use-map":{"raw":339,"gzip":243,"br":208},"use-is-online":{"raw":370,"gzip":258,"br":220},"use-page-visibility":{"raw":359,"gzip":263,"br":210},"use-next-pathname":{"raw":314,"gzip":235,"br":203},"use-media-query":{"raw":604,"gzip":380,"br":315},"use-next-link":{"raw":1647,"gzip":875,"br":742},"use-retimer":{"raw":199,"gzip":166,"br":127},"use-react-router-is-match":{"raw":594,"gzip":395,"br":337},"use-set":{"raw":340,"gzip":238,"br":203},"use-react-router-enable-concurrent-navigation":{"raw":966,"gzip":470,"br":397},"use-session-storage":{"raw":390,"gzip":210,"br":201},"use-singleton":{"raw":149,"gzip":135,"br":116},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-readonly-search-params":{"raw":1120,"gzip":573,"br":477},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":450,"gzip":318,"br":249},"use-state-with-deps":{"raw":464,"gzip":321,"br":295},"use-uncontrolled":{"raw":388,"gzip":273,"br":230},"use-url-hash-state":{"raw":1077,"gzip":611,"br":536}}}
1
+ {"total":{"raw":25626,"gzip":15486,"br":0},"exports":{"context-state":{"raw":402,"gzip":259,"br":218},"create-context-state":{"raw":145,"gzip":116,"br":96},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"create-local-storage-state":{"raw":446,"gzip":222,"br":209},"create-magic-portal":{"raw":268,"gzip":148,"br":121},"context-reducer":{"raw":557,"gzip":332,"br":319},"create-stackless-error":{"raw":278,"gzip":198,"br":162},"create-context-reducer":{"raw":223,"gzip":146,"br":117},"create-storage-state-factory":{"raw":620,"gzip":341,"br":290},"email-protection":{"raw":426,"gzip":321,"br":272},"create-fixed-array":{"raw":452,"gzip":282,"br":248},"fetch-jsonp":{"raw":890,"gzip":546,"br":429},"create-session-storage-state":{"raw":450,"gzip":223,"br":206},"create-storage-hook":{"raw":2462,"gzip":972,"br":852},"invariant":{"raw":178,"gzip":156,"br":118},"is-safari":{"raw":233,"gzip":164,"br":119},"no-ssr":{"raw":338,"gzip":267,"br":219},"current-year":{"raw":524,"gzip":355,"br":293},"merge-refs":{"raw":525,"gzip":280,"br":235},"nullthrow":{"raw":187,"gzip":163,"br":121},"open-new-tab":{"raw":335,"gzip":255,"br":187},"magic-portal":{"raw":1083,"gzip":536,"br":472},"types":{"raw":0,"gzip":20,"br":1},"rem":{"raw":823,"gzip":395,"br":350},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"use":{"raw":298,"gzip":197,"br":160},"use-abortable-effect":{"raw":215,"gzip":170,"br":144},"use-array":{"raw":322,"gzip":236,"br":202},"noop":{"raw":33,"gzip":53,"br":37},"request-idle-callback":{"raw":392,"gzip":221,"br":171},"use-composition-input":{"raw":470,"gzip":286,"br":241},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154},"use-clipboard":{"raw":1177,"gzip":650,"br":552},"use-fast-click":{"raw":622,"gzip":392,"br":317},"use-error-boundary":{"raw":252,"gzip":195,"br":165},"use-debounced-value":{"raw":524,"gzip":342,"br":286},"use-isomorphic-layout-effect":{"raw":169,"gzip":137,"br":110},"use-is-online":{"raw":370,"gzip":258,"br":220},"use-local-storage":{"raw":428,"gzip":226,"br":198},"use-is-client":{"raw":204,"gzip":153,"br":121},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-page-visibility":{"raw":359,"gzip":263,"br":210},"use-map":{"raw":339,"gzip":243,"br":208},"use-set":{"raw":340,"gzip":238,"br":203},"use-media-query":{"raw":648,"gzip":397,"br":332},"use-singleton":{"raw":149,"gzip":135,"br":116},"use-retimer":{"raw":199,"gzip":166,"br":127},"use-readonly-search-params":{"raw":1164,"gzip":589,"br":496},"use-state-with-deps":{"raw":464,"gzip":321,"br":295},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-session-storage":{"raw":434,"gzip":225,"br":210},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":450,"gzip":318,"br":249},"use-uncontrolled":{"raw":388,"gzip":273,"br":230},"use-url-hash-state":{"raw":1121,"gzip":628,"br":556}}}
@@ -1 +1 @@
1
- "use strict";var e=require("react"),n=require("../use-media-query/index.cjs");require("../no-ssr/index.cjs"),require("../noop/index.cjs"),require("event-target-bus"),exports.useFastClick=function(t){const r=e.useCallback(e=>{("mousedown"!==e.type||0===e.button)&&("development"!==process.env.NODE_ENV||e.currentTarget instanceof HTMLDivElement||e.currentTarget instanceof HTMLButtonElement||console.warn('[foxact/use-fast-click] You should only use "useFastClick" on <div /> or <button /> elements'),t(e))},[t]);return n.useMediaQuery("(pointer: coarse)",!1)?{onClick:r}:{onMouseDown:r}};
1
+ "use strict";var e=require("react"),r=require("../use-media-query/index.cjs");require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../noop/index.cjs"),require("event-target-bus"),exports.useFastClick=function(n){const s=e.useCallback(e=>{("mousedown"!==e.type||0===e.button)&&("development"!==process.env.NODE_ENV||e.currentTarget instanceof HTMLDivElement||e.currentTarget instanceof HTMLButtonElement||console.warn('[foxact/use-fast-click] You should only use "useFastClick" on <div /> or <button /> elements'),n(e))},[n]);return r.useMediaQuery("(pointer: coarse)",!1)?{onClick:s}:{onMouseDown:s}};
@@ -1 +1 @@
1
- import{useCallback as e}from"react";import{useMediaQuery as o}from"../use-media-query/index.mjs";import"../no-ssr/index.mjs";import"../noop/index.mjs";import"event-target-bus";function t(t){const n=e(e=>{("mousedown"!==e.type||0===e.button)&&("development"!==process.env.NODE_ENV||e.currentTarget instanceof HTMLDivElement||e.currentTarget instanceof HTMLButtonElement||console.warn('[foxact/use-fast-click] You should only use "useFastClick" on <div /> or <button /> elements'),t(e))},[t]);return o("(pointer: coarse)",!1)?{onClick:n}:{onMouseDown:n}}export{t as useFastClick};
1
+ import{useCallback as e}from"react";import{useMediaQuery as o}from"../use-media-query/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../noop/index.mjs";import"event-target-bus";function t(t){const n=e(e=>{("mousedown"!==e.type||0===e.button)&&("development"!==process.env.NODE_ENV||e.currentTarget instanceof HTMLDivElement||e.currentTarget instanceof HTMLButtonElement||console.warn('[foxact/use-fast-click] You should only use "useFastClick" on <div /> or <button /> elements'),t(e))},[t]);return o("(pointer: coarse)",!1)?{onClick:n}:{onMouseDown:n}}export{t as useFastClick};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("../create-storage-hook/index.cjs");require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const{useStorage:r,useSetStorage:o}=e.createStorage("localStorage");exports.useLocalStorage=r,exports.useSetLocalStorage=o;
1
+ "use strict";require("client-only");var e=require("../create-storage-hook/index.cjs");require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const{useStorage:r,useSetStorage:s}=e.createStorage("localStorage");exports.useLocalStorage=r,exports.useSetLocalStorage=s;
@@ -1,10 +1,10 @@
1
- import { NotUndefined, UseStorageRawOption, UseStorageParserOption, StateHookTuple, Serializer } from '../create-storage-hook/index.js';
2
- export { Deserializer } from '../create-storage-hook/index.js';
1
+ import { NotUndefined, UseStorageRawOption, UseStorageParserOption, StateHookTuple } from '../create-storage-hook/index.js';
2
+ export { Deserializer, Serializer } from '../create-storage-hook/index.js';
3
3
 
4
4
  declare const useLocalStorage: {
5
5
  <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): StateHookTuple<T>;
6
6
  <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): StateHookTuple<T | null>;
7
7
  };
8
- declare const useSetLocalStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
8
+ declare const useSetLocalStorage: <T>(key: string, options?: UseStorageRawOption | UseStorageParserOption<T>) => (v: React.SetStateAction<T | null>) => void;
9
9
 
10
- export { Serializer, UseStorageParserOption as UseLocalStorageParserOption, UseStorageRawOption as UseLocalStorageRawOption, useLocalStorage, useSetLocalStorage };
10
+ export { UseStorageParserOption as UseLocalStorageParserOption, UseStorageRawOption as UseLocalStorageRawOption, useLocalStorage, useSetLocalStorage };
@@ -1 +1 @@
1
- import"client-only";import{createStorage as o}from"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";const{useStorage:e,useSetStorage:t}=o("localStorage");export{e as useLocalStorage,t as useSetLocalStorage};
1
+ import"client-only";import{createStorage as e}from"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";const{useStorage:o,useSetStorage:t}=e("localStorage");export{o as useLocalStorage,t as useSetLocalStorage};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("../no-ssr/index.cjs"),r=require("../noop/index.cjs"),t=require("react"),n=require("event-target-bus");const o=new Map;function u(){throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")}exports.useMediaQuery=function(e,i){const a=t.useCallback(t=>(function(e,t){if("u"<typeof window)return r.noop;let u=o.get(e);return u||(u=n.createEventTargetBus(window.matchMedia(e),"change"),o.set(e,u)),u.on(t)})(e,t),[e]);return t.useSyncExternalStore(a,()=>"u"<typeof window?null!=i&&i:window.matchMedia(e).matches,void 0===i?u:()=>i)};
2
+ "use strict";var e=require("../no-ssr/index.cjs"),r=require("../noop/index.cjs"),t=require("react"),n=require("event-target-bus");require("../create-stackless-error/index.cjs");const o=new Map;function u(){throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")}exports.useMediaQuery=function(e,s){const i=t.useCallback(t=>(function(e,t){if("u"<typeof window)return r.noop;let u=o.get(e);return u||(u=n.createEventTargetBus(window.matchMedia(e),"change"),o.set(e,u)),u.on(t)})(e,t),[e]);return t.useSyncExternalStore(i,()=>"u"<typeof window?null!=s&&s:window.matchMedia(e).matches,void 0===s?u:()=>s)};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{noSSRError as e}from"../no-ssr/index.mjs";import{noop as t}from"../noop/index.mjs";import{useCallback as o,useSyncExternalStore as n}from"react";import{createEventTargetBus as r}from"event-target-bus";const i=new Map;function u(){throw e("useMediaQuery cannot be used on the server without a serverValue")}function a(e,a){return n(o(o=>(function(e,o){if("u"<typeof window)return t;let n=i.get(e);return n||(n=r(window.matchMedia(e),"change"),i.set(e,n)),n.on(o)})(e,o),[e]),()=>"u"<typeof window?null!=a&&a:window.matchMedia(e).matches,void 0===a?u:()=>a)}export{a as useMediaQuery};
2
+ import{noSSRError as e}from"../no-ssr/index.mjs";import{noop as t}from"../noop/index.mjs";import{useCallback as o,useSyncExternalStore as r}from"react";import{createEventTargetBus as n}from"event-target-bus";import"../create-stackless-error/index.mjs";const i=new Map;function s(){throw e("useMediaQuery cannot be used on the server without a serverValue")}function u(e,u){return r(o(o=>(function(e,o){if("u"<typeof window)return t;let r=i.get(e);return r||(r=n(window.matchMedia(e),"change"),i.set(e,r)),r.on(o)})(e,o),[e]),()=>"u"<typeof window?null!=u&&u:window.matchMedia(e).matches,void 0===u?s:()=>u)}export{u as useMediaQuery};
@@ -1 +1 @@
1
- "use strict";var e=require("event-target-bus"),r=require("../no-ssr/index.cjs"),n=require("../noop/index.cjs"),a=require("react");class t extends Error{constructor(){var e;super("[foxact/use-readonly-search-params] Method unavailable on `ReadonlyURLSearchParams`"),(e="name")in this?Object.defineProperty(this,e,{value:"ReadonlyURLSearchParamsError",enumerable:!0,configurable:!0,writable:!0}):this[e]="ReadonlyURLSearchParamsError"}}class o extends URLSearchParams{append(){throw new t}delete(){throw new t}set(){throw new t}sort(){throw new t}}let s=null;function u(r){return"u"<typeof window?n.noop:(null!=s||(s=e.createEventTargetBus(window,"popstate")),s.on(r))}let l=null,c=null;function i(){return"u"<typeof window?new o:window.location.search===l&&null!==c?c:c=new o(l=window.location.search)}function w(){throw r.noSSRError('[foxact] useReadonlySearchParams cannot be used on the server without a "getServerDefaultValue" function')}exports.ReadonlyURLSearchParams=o,exports.useReadonlySearchParams=function(e){return a.useSyncExternalStore(u,i,null==e?w:()=>{const r=e();return r instanceof o?r:new o(r)})};
1
+ "use strict";var e=require("event-target-bus"),r=require("../no-ssr/index.cjs"),n=require("../noop/index.cjs"),a=require("react");require("../create-stackless-error/index.cjs");class t extends Error{constructor(){var e;super("[foxact/use-readonly-search-params] Method unavailable on `ReadonlyURLSearchParams`"),(e="name")in this?Object.defineProperty(this,e,{value:"ReadonlyURLSearchParamsError",enumerable:!0,configurable:!0,writable:!0}):this[e]="ReadonlyURLSearchParamsError"}}class o extends URLSearchParams{append(){throw new t}delete(){throw new t}set(){throw new t}sort(){throw new t}}let s=null;function u(r){return"u"<typeof window?n.noop:(null!=s||(s=e.createEventTargetBus(window,"popstate")),s.on(r))}let c=null,l=null;function i(){return"u"<typeof window?new o:window.location.search===c&&null!==l?l:l=new o(c=window.location.search)}function w(){throw r.noSSRError('[foxact] useReadonlySearchParams cannot be used on the server without a "getServerDefaultValue" function')}exports.ReadonlyURLSearchParams=o,exports.useReadonlySearchParams=function(e){return a.useSyncExternalStore(u,i,null==e?w:()=>{const r=e();return r instanceof o?r:new o(r)})};
@@ -1 +1 @@
1
- import{createEventTargetBus as e}from"event-target-bus";import{noSSRError as r}from"../no-ssr/index.mjs";import{noop as n}from"../noop/index.mjs";import{useSyncExternalStore as o}from"react";class a extends Error{constructor(){var e;super("[foxact/use-readonly-search-params] Method unavailable on `ReadonlyURLSearchParams`"),(e="name")in this?Object.defineProperty(this,e,{value:"ReadonlyURLSearchParamsError",enumerable:!0,configurable:!0,writable:!0}):this[e]="ReadonlyURLSearchParamsError"}}class t extends URLSearchParams{append(){throw new a}delete(){throw new a}set(){throw new a}sort(){throw new a}}let s=null;function l(r){return"u"<typeof window?n:(null!=s||(s=e(window,"popstate")),s.on(r))}let u=null,c=null;function i(){return"u"<typeof window?new t:window.location.search===u&&null!==c?c:c=new t(u=window.location.search)}function w(){throw r('[foxact] useReadonlySearchParams cannot be used on the server without a "getServerDefaultValue" function')}function d(e){return o(l,i,null==e?w:()=>{const r=e();return r instanceof t?r:new t(r)})}export{t as ReadonlyURLSearchParams,d as useReadonlySearchParams};
1
+ import{createEventTargetBus as e}from"event-target-bus";import{noSSRError as r}from"../no-ssr/index.mjs";import{noop as n}from"../noop/index.mjs";import{useSyncExternalStore as o}from"react";import"../create-stackless-error/index.mjs";class a extends Error{constructor(){var e;super("[foxact/use-readonly-search-params] Method unavailable on `ReadonlyURLSearchParams`"),(e="name")in this?Object.defineProperty(this,e,{value:"ReadonlyURLSearchParamsError",enumerable:!0,configurable:!0,writable:!0}):this[e]="ReadonlyURLSearchParamsError"}}class t extends URLSearchParams{append(){throw new a}delete(){throw new a}set(){throw new a}sort(){throw new a}}let s=null;function l(r){return"u"<typeof window?n:(null!=s||(s=e(window,"popstate")),s.on(r))}let c=null,u=null;function i(){return"u"<typeof window?new t:window.location.search===c&&null!==u?u:u=new t(c=window.location.search)}function w(){throw r('[foxact] useReadonlySearchParams cannot be used on the server without a "getServerDefaultValue" function')}function d(e){return o(l,i,null==e?w:()=>{const r=e();return r instanceof t?r:new t(r)})}export{t as ReadonlyURLSearchParams,d as useReadonlySearchParams};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("../create-storage-hook/index.cjs");require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const{useStorage:r,useSetStorage:s}=e.createStorage("sessionStorage");exports.useSessionStorage=r,exports.useSetSessionStorage=s;
1
+ "use strict";require("client-only");var e=require("../create-storage-hook/index.cjs");require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const{useStorage:r,useSetStorage:s}=e.createStorage("sessionStorage");exports.useSessionStorage=r,exports.useSetSessionStorage=s;
@@ -1,10 +1,10 @@
1
- import { NotUndefined, UseStorageRawOption, UseStorageParserOption, StateHookTuple, Serializer } from '../create-storage-hook/index.js';
2
- export { Deserializer } from '../create-storage-hook/index.js';
1
+ import { NotUndefined, UseStorageRawOption, UseStorageParserOption, StateHookTuple } from '../create-storage-hook/index.js';
2
+ export { Deserializer, Serializer } from '../create-storage-hook/index.js';
3
3
 
4
4
  declare const useSessionStorage: {
5
5
  <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): StateHookTuple<T>;
6
6
  <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): StateHookTuple<T | null>;
7
7
  };
8
- declare const useSetSessionStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
8
+ declare const useSetSessionStorage: <T>(key: string, options?: UseStorageRawOption | UseStorageParserOption<T>) => (v: React.SetStateAction<T | null>) => void;
9
9
 
10
- export { Serializer, UseStorageParserOption as UseSessionStorageParserOption, UseStorageRawOption as UseSessionStorageRawOption, useSessionStorage, useSetSessionStorage };
10
+ export { UseStorageParserOption as UseSessionStorageParserOption, UseStorageRawOption as UseSessionStorageRawOption, useSessionStorage, useSetSessionStorage };
@@ -1 +1 @@
1
- import"client-only";import{createStorage as e}from"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";const{useStorage:o,useSetStorage:s}=e("sessionStorage");export{o as useSessionStorage,s as useSetSessionStorage};
1
+ import"client-only";import{createStorage as e}from"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";const{useStorage:o,useSetStorage:s}=e("sessionStorage");export{o as useSessionStorage,s as useSetSessionStorage};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),n=require("../no-ssr/index.cjs"),t=require("../chunks/index.b9dLwVor.cjs"),s=require("../chunks/index.BtiK5_Nn.cjs"),l=require("event-target-bus");let a=null;const i=e=>"u"<typeof window?r.noop:(null!=a||(a=l.createEventTargetBus(window,"hashchange")),a.on(e));function o(){throw n.noSSRError("useUrlHashState cannot be used on the server without a serverValue")}exports.unstable_useUrlHashState=function(r,n){var l;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:t.t,deserializer:t.t};const u=a.raw?t.t:a.serializer,c=a.raw?t.t:a.deserializer,h=void 0===n?o:()=>u(n),d=e.useSyncExternalStore(i,()=>new URLSearchParams(location.hash.slice(1)).get(r),h),w=e.useMemo(()=>null===d?null!=n?n:null:c(d),[n,c,d]),S=e.useCallback(e=>{const t=location.hash,l=new URLSearchParams(t.slice(1)),a=s.n(e)?e(w):e;a===n||null===a?l.delete(r):l.set(r,u(a));const i=l.toString();t!==i&&(location.hash=i)},[n,w,r,u]);return[null!=(l=null!=w?w:n)?l:null,S]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),n=require("../no-ssr/index.cjs"),t=require("../chunks/index.b9dLwVor.cjs"),s=require("../chunks/index.BtiK5_Nn.cjs"),l=require("event-target-bus");require("../create-stackless-error/index.cjs");let a=null;const i=e=>"u"<typeof window?r.noop:(null!=a||(a=l.createEventTargetBus(window,"hashchange")),a.on(e));function o(){throw n.noSSRError("useUrlHashState cannot be used on the server without a serverValue")}exports.unstable_useUrlHashState=function(r,n){var l;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:t.t,deserializer:t.t};const u=a.raw?t.t:a.serializer,c=a.raw?t.t:a.deserializer,h=void 0===n?o:()=>u(n),d=e.useSyncExternalStore(i,()=>new URLSearchParams(location.hash.slice(1)).get(r),h),w=e.useMemo(()=>null===d?null!=n?n:null:c(d),[n,c,d]),S=e.useCallback(e=>{const t=location.hash,l=new URLSearchParams(t.slice(1)),a=s.n(e)?e(w):e;a===n||null===a?l.delete(r):l.set(r,u(a));const i=l.toString();t!==i&&(location.hash=i)},[n,w,r,u]);return[null!=(l=null!=w?w:n)?l:null,S]};
@@ -1 +1 @@
1
- import"client-only";import{useSyncExternalStore as e,useMemo as n,useCallback as r}from"react";import{noop as t}from"../noop/index.mjs";import{noSSRError as o}from"../no-ssr/index.mjs";import{t as l}from"../chunks/index.D0KaUCcV.mjs";import{n as s}from"../chunks/index.C9-3oDdv.mjs";import{createEventTargetBus as a}from"event-target-bus";let i=null;const u=e=>"u"<typeof window?t:(null!=i||(i=a(window,"hashchange")),i.on(e));function h(){throw o("useUrlHashState cannot be used on the server without a serverValue")}function c(t,o){var a;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:l,deserializer:l};const c=i.raw?l:i.serializer,m=i.raw?l:i.deserializer,d=e(u,()=>new URLSearchParams(location.hash.slice(1)).get(t),void 0===o?h:()=>c(o)),w=n(()=>null===d?null!=o?o:null:m(d),[o,m,d]),p=r(e=>{const n=location.hash,r=new URLSearchParams(n.slice(1)),l=s(e)?e(w):e;l===o||null===l?r.delete(t):r.set(t,c(l));const a=r.toString();n!==a&&(location.hash=a)},[o,w,t,c]);return[null!=(a=null!=w?w:o)?a:null,p]}export{c as unstable_useUrlHashState};
1
+ import"client-only";import{useSyncExternalStore as e,useMemo as r,useCallback as t}from"react";import{noop as n}from"../noop/index.mjs";import{noSSRError as o}from"../no-ssr/index.mjs";import{t as s}from"../chunks/index.D0KaUCcV.mjs";import{n as l}from"../chunks/index.C9-3oDdv.mjs";import{createEventTargetBus as a}from"event-target-bus";import"../create-stackless-error/index.mjs";let i=null;const u=e=>"u"<typeof window?n:(null!=i||(i=a(window,"hashchange")),i.on(e));function c(){throw o("useUrlHashState cannot be used on the server without a serverValue")}function m(n,o){var a;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:s,deserializer:s};const m=i.raw?s:i.serializer,h=i.raw?s:i.deserializer,d=e(u,()=>new URLSearchParams(location.hash.slice(1)).get(n),void 0===o?c:()=>m(o)),p=r(()=>null===d?null!=o?o:null:h(d),[o,h,d]),w=t(e=>{const r=location.hash,t=new URLSearchParams(r.slice(1)),s=l(e)?e(p):e;s===o||null===s?t.delete(n):t.set(n,m(s));const a=t.toString();r!==a&&(location.hash=a)},[o,p,n,m]);return[null!=(a=null!=p?p:o)?a:null,w]}export{m as unstable_useUrlHashState};
@@ -1 +0,0 @@
1
- "use strict";require("client-only");var e=require("react"),t=require("next/navigation"),r=require("next/dist/shared/lib/router/utils/format-url"),n=require("../use-intersection/index.cjs"),o=require("../use-component-will-receive-update/index.cjs");function u(e,t,r){"u">typeof window&&Promise.resolve(e.prefetch(t,r)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})}require("../request-idle-callback/index.cjs");const i={rootMargin:"200px"};exports.unstable_useNextLink=function(c,s){let{prefetch:l,ref:a,onClick:f,onMouseEnter:p,onTouchStart:d,scroll:v=!0,replace:y=!1,...E}=s;const h=null==l?"auto":"full",k=!1!==l,m=t.useRouter(),[N,b]=e.useTransition(),[q,x,g]=n.useIntersection(i),C=e.useMemo(()=>"string"==typeof c?c:r.formatUrl(c),[c]);return o.useComponentWillReceiveUpdate(g,[C]),e.useEffect(()=>{"production"!==process.env.NODE_ENV||x&&k&&u(m,C,{kind:h})},[h,x,k,C,m]),[N,{ref:e.useCallback(e=>{q(e),"function"==typeof a?a(e):a&&e&&(a.current=e)},[a,q]),onClick:e.useCallback(e=>{if("function"==typeof f&&f(e),e.defaultPrevented)return;const{nodeName:t}=e.currentTarget;"A"===t.toUpperCase()&&function(e){var t;const r=e.currentTarget,n=r.getAttribute("target");return n&&"_self"!==n||r.download||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(null==(t=e.nativeEvent)?void 0:t.which)===2}(e)||(e.preventDefault(),b(()=>{m[y?"replace":"push"](C,{scroll:v})}))},[f,y,C,m,v]),onMouseEnter:e.useCallback(e=>{"function"==typeof p&&p(e),"development"===process.env.NODE_ENV||k&&u(m,C,{kind:h})},[h,p,k,C,m]),onTouchStart:e.useCallback(e=>{"function"==typeof d&&d(e),"development"===process.env.NODE_ENV||k&&u(m,C,{kind:h})},[h,d,k,C,m]),...E}]};
@@ -1,31 +0,0 @@
1
- import { LinkProps } from 'next/link';
2
-
3
- interface UrlObject {
4
- auth?: string | null | undefined;
5
- hash?: string | null | undefined;
6
- host?: string | null | undefined;
7
- hostname?: string | null | undefined;
8
- href?: string | null | undefined;
9
- pathname?: string | null | undefined;
10
- protocol?: string | null | undefined;
11
- search?: string | null | undefined;
12
- slashes?: boolean | null | undefined;
13
- port?: string | number | null | undefined;
14
- query?: any;
15
- }
16
- interface UseNextLinkOptions extends Omit<LinkProps, 'as' | 'href' | 'legacyBehavior' | 'shallow' | 'passHref' | 'locale'> {
17
- ref?: React.RefObject<HTMLAnchorElement> | React.RefCallback<HTMLAnchorElement> | null;
18
- }
19
- interface UseNextLinkReturnProps extends Partial<React.JSX.IntrinsicElements['a']> {
20
- ref: React.RefCallback<HTMLAnchorElement>;
21
- onTouchStart: React.TouchEventHandler<HTMLAnchorElement>;
22
- onMouseEnter: React.MouseEventHandler<HTMLAnchorElement>;
23
- onClick: React.MouseEventHandler<HTMLAnchorElement>;
24
- href?: string;
25
- }
26
- /** @see https://foxact.skk.moe/use-next-link */
27
- declare function useNextLink(hrefProp: string | UrlObject, { prefetch: prefetchProp, ref, onClick, onMouseEnter, onTouchStart, scroll: routerScroll, replace, ...restProps }: UseNextLinkOptions): [isPending: boolean, linkProps: UseNextLinkReturnProps];
28
- declare const unstable_useNextLink: typeof useNextLink;
29
-
30
- export { unstable_useNextLink };
31
- export type { UseNextLinkOptions, UseNextLinkReturnProps };
@@ -1 +0,0 @@
1
- import"client-only";import{useTransition as e,useMemo as t,useEffect as o,useCallback as n}from"react";import{useRouter as r}from"next/navigation";import{formatUrl as i}from"next/dist/shared/lib/router/utils/format-url";import{useIntersection as c}from"../use-intersection/index.mjs";import{useComponentWillReceiveUpdate as u}from"../use-component-will-receive-update/index.mjs";import"../request-idle-callback/index.mjs";function s(e,t,o){"u">typeof window&&Promise.resolve(e.prefetch(t,o)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})}const l={rootMargin:"200px"},p=function(p,f){let{prefetch:a,ref:m,onClick:d,onMouseEnter:v,onTouchStart:y,scroll:h=!0,replace:E=!1,...N}=f;const x=null==a?"auto":"full",g=!1!==a,k=r(),[w,_]=e(),[D,b,K]=c(l),O=t(()=>"string"==typeof p?p:i(p),[p]);return u(K,[O]),o(()=>{"production"!==process.env.NODE_ENV||b&&g&&s(k,O,{kind:x})},[x,b,g,O,k]),[w,{ref:n(e=>{D(e),"function"==typeof m?m(e):m&&e&&(m.current=e)},[m,D]),onClick:n(e=>{if("function"==typeof d&&d(e),e.defaultPrevented)return;const{nodeName:t}=e.currentTarget;"A"===t.toUpperCase()&&function(e){var t;const o=e.currentTarget,n=o.getAttribute("target");return n&&"_self"!==n||o.download||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(null==(t=e.nativeEvent)?void 0:t.which)===2}(e)||(e.preventDefault(),_(()=>{k[E?"replace":"push"](O,{scroll:h})}))},[d,E,O,k,h]),onMouseEnter:n(e=>{"function"==typeof v&&v(e),"development"===process.env.NODE_ENV||g&&s(k,O,{kind:x})},[x,v,g,O,k]),onTouchStart:n(e=>{"function"==typeof y&&y(e),"development"===process.env.NODE_ENV||g&&s(k,O,{kind:x})},[x,y,g,O,k]),...N}]};export{p as unstable_useNextLink};
@@ -1 +0,0 @@
1
- "use strict";require("client-only");var e=require("next/router.js"),t=require("react");exports.useNextPathname=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{asPath:n}=e.useRouter();return t.useMemo(()=>{const e=n.split(/[#?]/)[0];return r?e.endsWith("/")?e:"".concat(e,"/"):e},[r,n])};
@@ -1,4 +0,0 @@
1
- /** @see https://foxact.skk.moe/use-next-pathname */
2
- declare function useNextPathname(ensureTrailingSlash?: boolean): string;
3
-
4
- export { useNextPathname };
@@ -1 +0,0 @@
1
- import"client-only";import{useRouter as t}from"next/router.js";import{useMemo as e}from"react";function n(){let n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{asPath:o}=t();return e(()=>{const t=o.split(/[#?]/)[0];return n?t.endsWith("/")?t:"".concat(t,"/"):t},[n,o])}export{n as useNextPathname};
@@ -1,2 +0,0 @@
1
- 'use client';
2
- "use strict";require("client-only");var r=require("react"),e=require("react-router-dom");function t(){const{navigator:t}=r.useContext(e.UNSAFE_NavigationContext);if(!t)throw TypeError("[foxact/use-react-router-enable-concurrent-navigation] must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");r.useEffect(()=>{const e=t.go.bind(t),n=t.push.bind(t),o=t.replace.bind(t);return t.go=function(){for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];return r.startTransition(()=>e.apply(t,o))},t.push=function(){for(var e=arguments.length,o=Array(e),a=0;a<e;a++)o[a]=arguments[a];return r.startTransition(()=>n.apply(t,o))},t.replace=function(){for(var e=arguments.length,n=Array(e),a=0;a<e;a++)n[a]=arguments[a];return r.startTransition(()=>o.apply(t,n))},()=>{t.go=e,t.push=n,t.replace=o}},[t])}exports.ReactRouterConcurrentNavigationProvider=function(r){let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
@@ -1,8 +0,0 @@
1
- import * as react from 'react';
2
- import { Foxact } from '../types/index.js';
3
-
4
- /** @see https://foxact.skk.moe/use-react-router-enable-concurrent-navigation */
5
- declare function useReactRouterEnableConcurrentNavigation(): void;
6
- declare function ReactRouterConcurrentNavigationProvider({ children }: Foxact.PropsWithChildren): react.ReactNode;
7
-
8
- export { ReactRouterConcurrentNavigationProvider, useReactRouterEnableConcurrentNavigation };
@@ -1,2 +0,0 @@
1
- 'use client';
2
- import"client-only";import{useContext as r,useEffect as e,startTransition as o}from"react";import{UNSAFE_NavigationContext as t}from"react-router-dom";function n(){const{navigator:n}=r(t);if(!n)throw TypeError("[foxact/use-react-router-enable-concurrent-navigation] must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");e(()=>{const r=n.go.bind(n),e=n.push.bind(n),t=n.replace.bind(n);return n.go=function(){for(var e=arguments.length,t=Array(e),u=0;u<e;u++)t[u]=arguments[u];return o(()=>r.apply(n,t))},n.push=function(){for(var r=arguments.length,t=Array(r),u=0;u<r;u++)t[u]=arguments[u];return o(()=>e.apply(n,t))},n.replace=function(){for(var r=arguments.length,e=Array(r),u=0;u<r;u++)e[u]=arguments[u];return o(()=>t.apply(n,e))},()=>{n.go=r,n.push=e,n.replace=t}},[n])}function u(r){let{children:e}=r;return n(),e}export{u as ReactRouterConcurrentNavigationProvider,n as useReactRouterEnableConcurrentNavigation};
@@ -1 +0,0 @@
1
- "use strict";require("client-only");var e=require("../chunks/index.b9dLwVor.cjs"),t=require("react"),r=require("react-router-dom");exports.useReactRouterIsMatch=function(o){let{relative:a,caseSensitive:n=!1,end:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{pathname:u}=r.useLocation(),{navigator:{encodeLocation:i=e.t}}=t.useContext(r.UNSAFE_NavigationContext),c=r.useResolvedPath(o,{relative:a});return t.useMemo(()=>{let e=u,t=i(c).pathname;return n||(e=e.toLowerCase(),t=t.toLowerCase()),e===t||!s&&e.startsWith(t)&&"/"===e.charAt(t.length)},[i,c,u,n,s])};
@@ -1,11 +0,0 @@
1
- import { To, RelativeRoutingType } from 'react-router-dom';
2
-
3
- interface UseReactRouterIsMatchOption {
4
- relative?: RelativeRoutingType;
5
- caseSensitive?: boolean;
6
- end?: boolean;
7
- }
8
- /** @see https://foxact.skk.moe/use-react-router-is-match */
9
- declare function useReactRouterIsMatch(to: To, { relative, caseSensitive, end }?: UseReactRouterIsMatchOption): any;
10
-
11
- export { useReactRouterIsMatch };
@@ -1 +0,0 @@
1
- import"client-only";import{t}from"../chunks/index.D0KaUCcV.mjs";import{useContext as r,useMemo as e}from"react";import{useLocation as o,UNSAFE_NavigationContext as a,useResolvedPath as n}from"react-router-dom";function m(m){let{relative:i,caseSensitive:c=!1,end:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{pathname:h}=o(),{navigator:{encodeLocation:p=t}}=r(a),u=n(m,{relative:i});return e(()=>{let t=h,r=p(u).pathname;return c||(t=t.toLowerCase(),r=r.toLowerCase()),t===r||!s&&t.startsWith(r)&&"/"===t.charAt(r.length)},[p,u,h,c,s])}export{m as useReactRouterIsMatch};