foxact 0.2.39 → 0.2.41

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 (86) hide show
  1. package/create-fixed-array/index.cjs +1 -1
  2. package/create-fixed-array/index.d.ts +3 -3
  3. package/create-fixed-array/index.js +1 -1
  4. package/create-fixed-array/index.mjs +1 -1
  5. package/create-local-storage-state/index.cjs +1 -0
  6. package/create-local-storage-state/index.d.ts +24 -0
  7. package/create-local-storage-state/index.js +1 -0
  8. package/create-local-storage-state/index.mjs +1 -0
  9. package/create-session-storage-state/index.cjs +1 -0
  10. package/create-session-storage-state/index.d.ts +25 -0
  11. package/create-session-storage-state/index.js +1 -0
  12. package/create-session-storage-state/index.mjs +1 -0
  13. package/create-storage-hook/index.cjs +1 -1
  14. package/create-storage-hook/index.d.ts +4 -3
  15. package/create-storage-hook/index.js +1 -1
  16. package/create-storage-hook/index.mjs +1 -1
  17. package/create-storage-state-factory/index.cjs +1 -0
  18. package/create-storage-state-factory/index.d.ts +11 -0
  19. package/create-storage-state-factory/index.js +1 -0
  20. package/create-storage-state-factory/index.mjs +1 -0
  21. package/no-ssr/index.cjs +1 -1
  22. package/no-ssr/index.d.ts +2 -2
  23. package/no-ssr/index.js +1 -1
  24. package/no-ssr/index.mjs +1 -1
  25. package/nullthrow/index.d.ts +1 -1
  26. package/nullthrow/index.mjs +1 -1
  27. package/package.json +127 -100
  28. package/rem/index.cjs +1 -1
  29. package/rem/index.js +1 -1
  30. package/rem/index.mjs +1 -1
  31. package/sizes.json +1 -1
  32. package/use-abortable-effect/index.cjs +1 -1
  33. package/use-abortable-effect/index.d.ts +2 -2
  34. package/use-abortable-effect/index.js +1 -1
  35. package/use-abortable-effect/index.mjs +1 -1
  36. package/use-array/index.d.ts +1 -1
  37. package/use-array/index.mjs +1 -1
  38. package/use-component-will-receive-update/index.cjs +1 -1
  39. package/use-component-will-receive-update/index.d.ts +1 -1
  40. package/use-component-will-receive-update/index.js +1 -1
  41. package/use-component-will-receive-update/index.mjs +1 -1
  42. package/use-composition-input/index.cjs +1 -1
  43. package/use-composition-input/index.d.ts +1 -1
  44. package/use-composition-input/index.js +1 -1
  45. package/use-composition-input/index.mjs +1 -1
  46. package/use-error-boundary/index.cjs +1 -1
  47. package/use-error-boundary/index.d.ts +1 -1
  48. package/use-error-boundary/index.js +1 -1
  49. package/use-error-boundary/index.mjs +1 -1
  50. package/use-is-client/index.cjs +1 -1
  51. package/use-is-client/index.d.ts +1 -1
  52. package/use-is-client/index.js +1 -1
  53. package/use-is-client/index.mjs +1 -1
  54. package/use-local-storage/index.d.ts +3 -3
  55. package/use-map/index.d.ts +1 -1
  56. package/use-map/index.mjs +1 -1
  57. package/use-media-query/index.cjs +1 -1
  58. package/use-media-query/index.d.ts +1 -1
  59. package/use-media-query/index.js +1 -1
  60. package/use-media-query/index.mjs +1 -1
  61. package/use-next-link/index.cjs +1 -1
  62. package/use-next-link/index.d.ts +3 -1
  63. package/use-next-link/index.js +1 -1
  64. package/use-next-link/index.mjs +1 -1
  65. package/use-next-pathname/index.d.ts +1 -1
  66. package/use-next-pathname/index.mjs +1 -1
  67. package/use-react-router-enable-concurrent-navigation/index.cjs +1 -1
  68. package/use-react-router-enable-concurrent-navigation/index.d.ts +2 -2
  69. package/use-react-router-enable-concurrent-navigation/index.js +1 -1
  70. package/use-react-router-enable-concurrent-navigation/index.mjs +1 -1
  71. package/use-react-router-is-match/index.d.ts +1 -1
  72. package/use-react-router-is-match/index.mjs +1 -1
  73. package/use-retimer/index.cjs +1 -1
  74. package/use-retimer/index.d.ts +1 -1
  75. package/use-retimer/index.js +1 -1
  76. package/use-retimer/index.mjs +1 -1
  77. package/use-session-storage/index.d.ts +3 -3
  78. package/use-set/index.d.ts +1 -1
  79. package/use-set/index.mjs +1 -1
  80. package/use-singleton/index.cjs +1 -1
  81. package/use-singleton/index.d.ts +1 -1
  82. package/use-singleton/index.js +1 -1
  83. package/use-singleton/index.mjs +1 -1
  84. package/use-url-hash-state/index.cjs +1 -1
  85. package/use-url-hash-state/index.js +1 -1
  86. package/use-url-hash-state/index.mjs +1 -1
@@ -1 +1 @@
1
- "use strict";const e=new Map,r=e=>{const r=Array.from(Array(e).keys());return"development"===process.env.NODE_ENV&&Object.freeze(r),r},t=t=>{if(e.has(t))return e.get(t);const s=r(t);return e.set(t,s),s},s=new Map,a=e=>{let t,a;return s.has(e)&&(a=(t=s.get(e)).deref()),a||(t=new WeakRef(a=r(e)),s.set(e,t)),a},n="function"==typeof WeakRef?a:t;exports.createFixedArray=n,exports.createFixedArrayWithGC=a,exports.createFixedArrayWithoutGC=t;
1
+ "use strict";const e=new Map;function t(e){const t=Array.from(Array(e).keys());return"development"===process.env.NODE_ENV&&Object.freeze(t),t}function r(r){if(e.has(r))return e.get(r);const n=t(r);return e.set(r,n),n}const n=new Map;function o(e){let r,o;return n.has(e)&&(o=(r=n.get(e)).deref()),o||(r=new WeakRef(o=t(e)),n.set(e,r)),o}const s="function"==typeof WeakRef?o:r;exports.createFixedArray=s,exports.createFixedArrayWithGC=o,exports.createFixedArrayWithoutGC=r;
@@ -1,5 +1,5 @@
1
- declare const createFixedArrayWithoutGC: (length: number) => readonly number[];
2
- declare const createFixedArrayWithGC: (length: number) => readonly number[];
3
- declare const createFixedArray: (length: number) => readonly number[];
1
+ declare function createFixedArrayWithoutGC(length: number): readonly number[];
2
+ declare function createFixedArrayWithGC(length: number): readonly number[];
3
+ declare const createFixedArray: typeof createFixedArrayWithGC;
4
4
 
5
5
  export { createFixedArray, createFixedArrayWithGC, createFixedArrayWithoutGC };
@@ -1 +1 @@
1
- "use strict";const e=new Map,r=e=>{const r=Array.from(Array(e).keys());return"development"===process.env.NODE_ENV&&Object.freeze(r),r},t=t=>{if(e.has(t))return e.get(t);const s=r(t);return e.set(t,s),s},s=new Map,a=e=>{let t,a;return s.has(e)&&(a=(t=s.get(e)).deref()),a||(t=new WeakRef(a=r(e)),s.set(e,t)),a},n="function"==typeof WeakRef?a:t;exports.createFixedArray=n,exports.createFixedArrayWithGC=a,exports.createFixedArrayWithoutGC=t;
1
+ "use strict";const e=new Map;function t(e){const t=Array.from(Array(e).keys());return"development"===process.env.NODE_ENV&&Object.freeze(t),t}function r(r){if(e.has(r))return e.get(r);const n=t(r);return e.set(r,n),n}const n=new Map;function o(e){let r,o;return n.has(e)&&(o=(r=n.get(e)).deref()),o||(r=new WeakRef(o=t(e)),n.set(e,r)),o}const s="function"==typeof WeakRef?o:r;exports.createFixedArray=s,exports.createFixedArrayWithGC=o,exports.createFixedArrayWithoutGC=r;
@@ -1 +1 @@
1
- const e=new Map,r=e=>{const r=Array.from(Array(e).keys());return"development"===process.env.NODE_ENV&&Object.freeze(r),r},t=t=>{if(e.has(t))return e.get(t);const a=r(t);return e.set(t,a),a},a=new Map,n=e=>{let t,n;return a.has(e)&&(n=(t=a.get(e)).deref()),n||(t=new WeakRef(n=r(e)),a.set(e,t)),n},o="function"==typeof WeakRef?n:t;export{o as createFixedArray,n as createFixedArrayWithGC,t as createFixedArrayWithoutGC};
1
+ const e=new Map;function t(e){const t=Array.from(Array(e).keys());return"development"===process.env.NODE_ENV&&Object.freeze(t),t}function r(r){if(e.has(r))return e.get(r);const n=t(r);return e.set(r,n),n}const n=new Map;function o(e){let r,o;return n.has(e)&&(o=(r=n.get(e)).deref()),o||(r=new WeakRef(o=t(e)),n.set(e,r)),o}const a="function"==typeof WeakRef?o:r;export{a as createFixedArray,o as createFixedArrayWithGC,r as createFixedArrayWithoutGC};
@@ -0,0 +1 @@
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");const r=e.createStorageStateFactory("localStorage");exports.createLocalStorageState=r;
@@ -0,0 +1,24 @@
1
+ import { StateHook, ValueHook, SetValueHook } from '../create-storage-state-factory/index.js';
2
+ import { NotUndefined, UseStorageRawOption, UseStorageParserOption } from '../create-storage-hook/index.js';
3
+
4
+ /**
5
+ * @see https://foxact.skk.moe/create-local-storage-state
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const [useOpenState, useOpen] = createLocalStorageState(
10
+ * 'open', // storage key
11
+ * false, // server default value
12
+ * { raw: false } // options
13
+ * );
14
+ *
15
+ * const [open, setOpen] = useOpenState();
16
+ * const open = useOpen();
17
+ * ```
18
+ */
19
+ declare const createLocalStorageState: {
20
+ <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [StateHook<T>, ValueHook<T>, SetValueHook<T | null>];
21
+ <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [StateHook<T | null>, ValueHook<T | null>, SetValueHook<T | null>];
22
+ };
23
+
24
+ export { createLocalStorageState };
@@ -0,0 +1 @@
1
+ "use strict";require("client-only");var e=require("../create-storage-state-factory/index.js");require("../create-storage-hook/index.js"),require("react"),require("../noop/index.js"),require("../use-isomorphic-layout-effect/index.js"),require("../no-ssr/index.js");const r=e.createStorageStateFactory("localStorage");exports.createLocalStorageState=r;
@@ -0,0 +1 @@
1
+ import"client-only";import{createStorageStateFactory as o}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";const t=o("localStorage");export{t as createLocalStorageState};
@@ -0,0 +1 @@
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");const r=e.createStorageStateFactory("sessionStorage");exports.createSessionStorageState=r;
@@ -0,0 +1,25 @@
1
+ import { StateHook, ValueHook, SetValueHook } from '../create-storage-state-factory/index.js';
2
+ import { NotUndefined, UseStorageRawOption, UseStorageParserOption } from '../create-storage-hook/index.js';
3
+
4
+ /**
5
+ * @see https://foxact.skk.moe/create-session-storage-state
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * ```ts
10
+ * const [useOpenState, useOpen] = createSessionStorageState(
11
+ * 'open', // storage key
12
+ * false, // server default value
13
+ * { raw: false } // options
14
+ * );
15
+ *
16
+ * const [open, setOpen] = useOpenState();
17
+ * const open = useOpen();
18
+ * ```
19
+ */
20
+ declare const createSessionStorageState: {
21
+ <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [StateHook<T>, ValueHook<T>, SetValueHook<T | null>];
22
+ <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [StateHook<T | null>, ValueHook<T | null>, SetValueHook<T | null>];
23
+ };
24
+
25
+ export { createSessionStorageState };
@@ -0,0 +1 @@
1
+ "use strict";require("client-only");var e=require("../create-storage-state-factory/index.js");require("../create-storage-hook/index.js"),require("react"),require("../noop/index.js"),require("../use-isomorphic-layout-effect/index.js"),require("../no-ssr/index.js");const r=e.createStorageStateFactory("sessionStorage");exports.createSessionStorageState=r;
@@ -0,0 +1 @@
1
+ import"client-only";import{createStorageStateFactory as o}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";const e=o("sessionStorage");export{e as createSessionStorageState};
@@ -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?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
+ "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;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",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,5 +1,6 @@
1
1
  type StorageType = 'localStorage' | 'sessionStorage';
2
2
  type NotUndefined<T> = T extends undefined ? never : T;
3
+ type StateHookTuple<T> = readonly [T, React.Dispatch<React.SetStateAction<T | null>>];
3
4
  type CustomStorageEvent = CustomEvent<string>;
4
5
  declare global {
5
6
  interface WindowEventMap {
@@ -19,10 +20,10 @@ interface UseStorageParserOption<T> {
19
20
  }
20
21
  declare function createStorage(type: StorageType): {
21
22
  useStorage: {
22
- <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [T, React.Dispatch<React.SetStateAction<T | null>>];
23
- <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [T | null, React.Dispatch<React.SetStateAction<T | null>>];
23
+ <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): StateHookTuple<T>;
24
+ <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): StateHookTuple<T | null>;
24
25
  };
25
26
  useSetStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
26
27
  };
27
28
 
28
- export { type Deserializer, type Serializer, type UseStorageParserOption, type UseStorageRawOption, createStorage };
29
+ export { type Deserializer, type NotUndefined, type Serializer, type StateHookTuple, type StorageType, type UseStorageParserOption, type UseStorageRawOption, createStorage };
@@ -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?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
+ "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;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="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?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
+ 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;function 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};
@@ -0,0 +1 @@
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");const r=e=>e;exports.createStorageStateFactory=function(t){return function(i,o){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const{useStorage:a,useSetStorage:n}=e.createStorage(t);return[()=>a(i,o,s),()=>a(i,o,s)[0],()=>n(i,s.raw?r:s.serializer)]}};
@@ -0,0 +1,11 @@
1
+ import { StateHookTuple, StorageType, NotUndefined, UseStorageRawOption, UseStorageParserOption } from '../create-storage-hook/index.js';
2
+
3
+ type ValueHook<T> = () => T;
4
+ type SetValueHook<T> = () => (value: T) => void;
5
+ type StateHook<T> = () => StateHookTuple<T>;
6
+ declare function createStorageStateFactory(type: StorageType): {
7
+ <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [StateHook<T>, ValueHook<T>, SetValueHook<T | null>];
8
+ <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [StateHook<T | null>, ValueHook<T | null>, SetValueHook<T | null>];
9
+ };
10
+
11
+ export { type SetValueHook, type StateHook, type ValueHook, createStorageStateFactory };
@@ -0,0 +1 @@
1
+ "use strict";var e=require("../create-storage-hook/index.js");require("client-only"),require("react"),require("../noop/index.js"),require("../use-isomorphic-layout-effect/index.js"),require("../no-ssr/index.js");const r=e=>e;exports.createStorageStateFactory=function(t){return function(i,o){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const{useStorage:a,useSetStorage:n}=e.createStorage(t);return[()=>a(i,o,s),()=>a(i,o,s)[0],()=>n(i,s.raw?r:s.serializer)]}};
@@ -0,0 +1 @@
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";const r=e=>e;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:a}=e(t);return[()=>s(o,i,n),()=>s(o,i,n)[0],()=>a(o,n.raw?r:n.serializer)]}}export{t as createStorageStateFactory};
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,e=function(r){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const o=Error.stackTraceLimit;t&&(Error.stackTraceLimit=0);const i=Error(r);return t&&(Error.stackTraceLimit=o),i.digest=e,i.recoverableError="NO_SSR",i};exports.noSSR=r=>{if("undefined"==typeof window)throw e(r)},exports.noSSRError=e;
1
+ "use strict";const r=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit"),t=(null==r?void 0:r.writable)&&"number"==typeof r.value;function e(r){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const o=Error.stackTraceLimit;t&&(Error.stackTraceLimit=0);const i=Error(r);return t&&(Error.stackTraceLimit=o),i.digest=e,i.recoverableError="NO_SSR",i}exports.noSSR=function(r){if("undefined"==typeof window)throw e(r)},exports.noSSRError=e;
package/no-ssr/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /** @private */
2
- declare const noSSRError: (errorMessage?: string, nextjsDigest?: string) => Error;
2
+ declare function noSSRError(errorMessage?: string, nextjsDigest?: string): Error;
3
3
  /** @see https://foxact.skk.moe/no-ssr */
4
- declare const noSSR: (extraMessage?: string) => void;
4
+ declare function noSSR(extraMessage?: string): void;
5
5
 
6
6
  export { noSSR, noSSRError };
package/no-ssr/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const r=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit"),t=(null==r?void 0:r.writable)&&"number"==typeof r.value,e=function(r){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const o=Error.stackTraceLimit;t&&(Error.stackTraceLimit=0);const i=Error(r);return t&&(Error.stackTraceLimit=o),i.digest=e,i.recoverableError="NO_SSR",i};exports.noSSR=r=>{if("undefined"==typeof window)throw e(r)},exports.noSSRError=e;
1
+ "use strict";const r=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit"),t=(null==r?void 0:r.writable)&&"number"==typeof r.value;function e(r){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const o=Error.stackTraceLimit;t&&(Error.stackTraceLimit=0);const i=Error(r);return t&&(Error.stackTraceLimit=o),i.digest=e,i.recoverableError="NO_SSR",i}exports.noSSR=function(r){if("undefined"==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,e=function(r){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const o=Error.stackTraceLimit;t&&(Error.stackTraceLimit=0);const i=Error(r);return t&&(Error.stackTraceLimit=o),i.digest=e,i.recoverableError="NO_SSR",i},o=r=>{if("undefined"==typeof window)throw e(r)};export{o as noSSR,e as noSSRError};
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("undefined"==typeof window)throw o(r)}export{e as noSSR,o as noSSRError};
@@ -1,4 +1,4 @@
1
1
  /** @see https://foxact.skk.moe/invariant-nullthrow */
2
- declare const nullthrow: <T>(value: T, message?: string) => NonNullable<T>;
2
+ declare function nullthrow<T>(value: T, message?: string): NonNullable<T>;
3
3
 
4
4
  export { nullthrow };
@@ -1 +1 @@
1
- const n=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(r);return n};export{n as nullthrow};
1
+ function n(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(r);return n}export{n as nullthrow};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.39",
3
+ "version": "0.2.41",
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": {
@@ -78,6 +78,24 @@
78
78
  "require": "./compose-context-provider/index.cjs",
79
79
  "default": "./compose-context-provider/index.js"
80
80
  },
81
+ "./create-context-state": {
82
+ "types": "./create-context-state/index.d.ts",
83
+ "import": {
84
+ "types": "./create-context-state/index.d.ts",
85
+ "default": "./create-context-state/index.mjs"
86
+ },
87
+ "require": "./create-context-state/index.cjs",
88
+ "default": "./create-context-state/index.js"
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
+ },
81
99
  "./context-state": {
82
100
  "types": "./context-state/index.d.ts",
83
101
  "import": {
@@ -87,6 +105,15 @@
87
105
  "require": "./context-state/index.cjs",
88
106
  "default": "./context-state/index.js"
89
107
  },
108
+ "./create-session-storage-state": {
109
+ "types": "./create-session-storage-state/index.d.ts",
110
+ "import": {
111
+ "types": "./create-session-storage-state/index.d.ts",
112
+ "default": "./create-session-storage-state/index.mjs"
113
+ },
114
+ "require": "./create-session-storage-state/index.cjs",
115
+ "default": "./create-session-storage-state/index.js"
116
+ },
90
117
  "./create-storage-hook": {
91
118
  "types": "./create-storage-hook/index.d.ts",
92
119
  "import": {
@@ -96,14 +123,23 @@
96
123
  "require": "./create-storage-hook/index.cjs",
97
124
  "default": "./create-storage-hook/index.js"
98
125
  },
99
- "./create-context-state": {
100
- "types": "./create-context-state/index.d.ts",
126
+ "./create-local-storage-state": {
127
+ "types": "./create-local-storage-state/index.d.ts",
101
128
  "import": {
102
- "types": "./create-context-state/index.d.ts",
103
- "default": "./create-context-state/index.mjs"
129
+ "types": "./create-local-storage-state/index.d.ts",
130
+ "default": "./create-local-storage-state/index.mjs"
104
131
  },
105
- "require": "./create-context-state/index.cjs",
106
- "default": "./create-context-state/index.js"
132
+ "require": "./create-local-storage-state/index.cjs",
133
+ "default": "./create-local-storage-state/index.js"
134
+ },
135
+ "./create-storage-state-factory": {
136
+ "types": "./create-storage-state-factory/index.d.ts",
137
+ "import": {
138
+ "types": "./create-storage-state-factory/index.d.ts",
139
+ "default": "./create-storage-state-factory/index.mjs"
140
+ },
141
+ "require": "./create-storage-state-factory/index.cjs",
142
+ "default": "./create-storage-state-factory/index.js"
107
143
  },
108
144
  "./current-year": {
109
145
  "types": "./current-year/index.d.ts",
@@ -123,6 +159,15 @@
123
159
  "require": "./invariant/index.cjs",
124
160
  "default": "./invariant/index.js"
125
161
  },
162
+ "./no-ssr": {
163
+ "types": "./no-ssr/index.d.ts",
164
+ "import": {
165
+ "types": "./no-ssr/index.d.ts",
166
+ "default": "./no-ssr/index.mjs"
167
+ },
168
+ "require": "./no-ssr/index.cjs",
169
+ "default": "./no-ssr/index.js"
170
+ },
126
171
  "./noop": {
127
172
  "types": "./noop/index.d.ts",
128
173
  "import": {
@@ -132,15 +177,6 @@
132
177
  "require": "./noop/index.cjs",
133
178
  "default": "./noop/index.js"
134
179
  },
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
- },
144
180
  "./nullthrow": {
145
181
  "types": "./nullthrow/index.d.ts",
146
182
  "import": {
@@ -150,24 +186,6 @@
150
186
  "require": "./nullthrow/index.cjs",
151
187
  "default": "./nullthrow/index.js"
152
188
  },
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
- "./rem": {
163
- "types": "./rem/index.d.ts",
164
- "import": {
165
- "types": "./rem/index.d.ts",
166
- "default": "./rem/index.mjs"
167
- },
168
- "require": "./rem/index.cjs",
169
- "default": "./rem/index.js"
170
- },
171
189
  "./request-idle-callback": {
172
190
  "types": "./request-idle-callback/index.d.ts",
173
191
  "import": {
@@ -213,6 +231,15 @@
213
231
  "require": "./use-abortable-effect/index.cjs",
214
232
  "default": "./use-abortable-effect/index.js"
215
233
  },
234
+ "./use-array": {
235
+ "types": "./use-array/index.d.ts",
236
+ "import": {
237
+ "types": "./use-array/index.d.ts",
238
+ "default": "./use-array/index.mjs"
239
+ },
240
+ "require": "./use-array/index.cjs",
241
+ "default": "./use-array/index.js"
242
+ },
216
243
  "./use-clipboard": {
217
244
  "types": "./use-clipboard/index.d.ts",
218
245
  "import": {
@@ -222,6 +249,15 @@
222
249
  "require": "./use-clipboard/index.cjs",
223
250
  "default": "./use-clipboard/index.js"
224
251
  },
252
+ "./rem": {
253
+ "types": "./rem/index.d.ts",
254
+ "import": {
255
+ "types": "./rem/index.d.ts",
256
+ "default": "./rem/index.mjs"
257
+ },
258
+ "require": "./rem/index.cjs",
259
+ "default": "./rem/index.js"
260
+ },
225
261
  "./use-component-will-receive-update": {
226
262
  "types": "./use-component-will-receive-update/index.d.ts",
227
263
  "import": {
@@ -240,6 +276,15 @@
240
276
  "require": "./use-composition-input/index.cjs",
241
277
  "default": "./use-composition-input/index.js"
242
278
  },
279
+ "./use-debounced-value": {
280
+ "types": "./use-debounced-value/index.d.ts",
281
+ "import": {
282
+ "types": "./use-debounced-value/index.d.ts",
283
+ "default": "./use-debounced-value/index.mjs"
284
+ },
285
+ "require": "./use-debounced-value/index.cjs",
286
+ "default": "./use-debounced-value/index.js"
287
+ },
243
288
  "./use-debounced-state": {
244
289
  "types": "./use-debounced-state/index.d.ts",
245
290
  "import": {
@@ -249,23 +294,14 @@
249
294
  "require": "./use-debounced-state/index.cjs",
250
295
  "default": "./use-debounced-state/index.js"
251
296
  },
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
- },
261
- "./use-debounced-value": {
262
- "types": "./use-debounced-value/index.d.ts",
297
+ "./use-error-boundary": {
298
+ "types": "./use-error-boundary/index.d.ts",
263
299
  "import": {
264
- "types": "./use-debounced-value/index.d.ts",
265
- "default": "./use-debounced-value/index.mjs"
300
+ "types": "./use-error-boundary/index.d.ts",
301
+ "default": "./use-error-boundary/index.mjs"
266
302
  },
267
- "require": "./use-debounced-value/index.cjs",
268
- "default": "./use-debounced-value/index.js"
303
+ "require": "./use-error-boundary/index.cjs",
304
+ "default": "./use-error-boundary/index.js"
269
305
  },
270
306
  "./use-intersection": {
271
307
  "types": "./use-intersection/index.d.ts",
@@ -276,14 +312,14 @@
276
312
  "require": "./use-intersection/index.cjs",
277
313
  "default": "./use-intersection/index.js"
278
314
  },
279
- "./use-error-boundary": {
280
- "types": "./use-error-boundary/index.d.ts",
315
+ "./use-is-client": {
316
+ "types": "./use-is-client/index.d.ts",
281
317
  "import": {
282
- "types": "./use-error-boundary/index.d.ts",
283
- "default": "./use-error-boundary/index.mjs"
318
+ "types": "./use-is-client/index.d.ts",
319
+ "default": "./use-is-client/index.mjs"
284
320
  },
285
- "require": "./use-error-boundary/index.cjs",
286
- "default": "./use-error-boundary/index.js"
321
+ "require": "./use-is-client/index.cjs",
322
+ "default": "./use-is-client/index.js"
287
323
  },
288
324
  "./use-is-online": {
289
325
  "types": "./use-is-online/index.d.ts",
@@ -303,15 +339,6 @@
303
339
  "require": "./use-isomorphic-layout-effect/index.cjs",
304
340
  "default": "./use-isomorphic-layout-effect/index.js"
305
341
  },
306
- "./use-is-client": {
307
- "types": "./use-is-client/index.d.ts",
308
- "import": {
309
- "types": "./use-is-client/index.d.ts",
310
- "default": "./use-is-client/index.mjs"
311
- },
312
- "require": "./use-is-client/index.cjs",
313
- "default": "./use-is-client/index.js"
314
- },
315
342
  "./use-map": {
316
343
  "types": "./use-map/index.d.ts",
317
344
  "import": {
@@ -321,15 +348,6 @@
321
348
  "require": "./use-map/index.cjs",
322
349
  "default": "./use-map/index.js"
323
350
  },
324
- "./use-media-query": {
325
- "types": "./use-media-query/index.d.ts",
326
- "import": {
327
- "types": "./use-media-query/index.d.ts",
328
- "default": "./use-media-query/index.mjs"
329
- },
330
- "require": "./use-media-query/index.cjs",
331
- "default": "./use-media-query/index.js"
332
- },
333
351
  "./use-local-storage": {
334
352
  "types": "./use-local-storage/index.d.ts",
335
353
  "import": {
@@ -339,6 +357,15 @@
339
357
  "require": "./use-local-storage/index.cjs",
340
358
  "default": "./use-local-storage/index.js"
341
359
  },
360
+ "./use-media-query": {
361
+ "types": "./use-media-query/index.d.ts",
362
+ "import": {
363
+ "types": "./use-media-query/index.d.ts",
364
+ "default": "./use-media-query/index.mjs"
365
+ },
366
+ "require": "./use-media-query/index.cjs",
367
+ "default": "./use-media-query/index.js"
368
+ },
342
369
  "./use-next-link": {
343
370
  "types": "./use-next-link/index.d.ts",
344
371
  "import": {
@@ -348,15 +375,6 @@
348
375
  "require": "./use-next-link/index.cjs",
349
376
  "default": "./use-next-link/index.js"
350
377
  },
351
- "./use-page-visibility": {
352
- "types": "./use-page-visibility/index.d.ts",
353
- "import": {
354
- "types": "./use-page-visibility/index.d.ts",
355
- "default": "./use-page-visibility/index.mjs"
356
- },
357
- "require": "./use-page-visibility/index.cjs",
358
- "default": "./use-page-visibility/index.js"
359
- },
360
378
  "./use-next-pathname": {
361
379
  "types": "./use-next-pathname/index.d.ts",
362
380
  "import": {
@@ -366,6 +384,15 @@
366
384
  "require": "./use-next-pathname/index.cjs",
367
385
  "default": "./use-next-pathname/index.js"
368
386
  },
387
+ "./use-page-visibility": {
388
+ "types": "./use-page-visibility/index.d.ts",
389
+ "import": {
390
+ "types": "./use-page-visibility/index.d.ts",
391
+ "default": "./use-page-visibility/index.mjs"
392
+ },
393
+ "require": "./use-page-visibility/index.cjs",
394
+ "default": "./use-page-visibility/index.js"
395
+ },
369
396
  "./use-react-router-enable-concurrent-navigation": {
370
397
  "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
371
398
  "import": {
@@ -402,15 +429,6 @@
402
429
  "require": "./use-session-storage/index.cjs",
403
430
  "default": "./use-session-storage/index.js"
404
431
  },
405
- "./use-set": {
406
- "types": "./use-set/index.d.ts",
407
- "import": {
408
- "types": "./use-set/index.d.ts",
409
- "default": "./use-set/index.mjs"
410
- },
411
- "require": "./use-set/index.cjs",
412
- "default": "./use-set/index.js"
413
- },
414
432
  "./use-singleton": {
415
433
  "types": "./use-singleton/index.d.ts",
416
434
  "import": {
@@ -420,6 +438,15 @@
420
438
  "require": "./use-singleton/index.cjs",
421
439
  "default": "./use-singleton/index.js"
422
440
  },
441
+ "./use-set": {
442
+ "types": "./use-set/index.d.ts",
443
+ "import": {
444
+ "types": "./use-set/index.d.ts",
445
+ "default": "./use-set/index.mjs"
446
+ },
447
+ "require": "./use-set/index.cjs",
448
+ "default": "./use-set/index.js"
449
+ },
423
450
  "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
424
451
  "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
425
452
  "import": {
@@ -438,15 +465,6 @@
438
465
  "require": "./use-typescript-happy-callback/index.cjs",
439
466
  "default": "./use-typescript-happy-callback/index.js"
440
467
  },
441
- "./use-uncontrolled": {
442
- "types": "./use-uncontrolled/index.d.ts",
443
- "import": {
444
- "types": "./use-uncontrolled/index.d.ts",
445
- "default": "./use-uncontrolled/index.mjs"
446
- },
447
- "require": "./use-uncontrolled/index.cjs",
448
- "default": "./use-uncontrolled/index.js"
449
- },
450
468
  "./use-url-hash-state": {
451
469
  "types": "./use-url-hash-state/index.d.ts",
452
470
  "import": {
@@ -455,6 +473,15 @@
455
473
  },
456
474
  "require": "./use-url-hash-state/index.cjs",
457
475
  "default": "./use-url-hash-state/index.js"
476
+ },
477
+ "./use-uncontrolled": {
478
+ "types": "./use-uncontrolled/index.d.ts",
479
+ "import": {
480
+ "types": "./use-uncontrolled/index.d.ts",
481
+ "default": "./use-uncontrolled/index.mjs"
482
+ },
483
+ "require": "./use-uncontrolled/index.cjs",
484
+ "default": "./use-uncontrolled/index.js"
458
485
  }
459
486
  }
460
487
  }
package/rem/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const e="16px",n=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r&&r!==e?"calc(".concat(n," * ").concat(r,")"):n};function r(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16;return function c(i){if(Array.isArray(i))return i.map(c).join(" ");if(0===i||"0"===i)return"0";if("number"==typeof i)return n("".concat(i/t).concat(e),r);if(i.includes("calc(")||i.includes("var(")||i.includes("clamp("))return i;if(i.includes(" "))return i.split(" ").map(c).join(" ");if(i.includes(e))return n(i,r);const o=Number(i.replace("px",""));return o==o?n("".concat(o/t).concat(e),r):i}}const t=r("rem",e,16),c=r("rem","var(--mantine-scale)",16),i=r("em",e,16);exports.createConverter=r,exports.em=i,exports.mantine_rem=c,exports.rem=t;
1
+ "use strict";const e="16px";function n(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r&&r!==e?"calc(".concat(n," * ").concat(r,")"):n}function r(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16;return function c(i){if(Array.isArray(i))return i.map(c).join(" ");if(0===i||"0"===i)return"0";if("number"==typeof i)return n("".concat(i/t).concat(e),r);if(i.includes("calc(")||i.includes("var(")||i.includes("clamp("))return i;if(i.includes(" "))return i.split(" ").map(c).join(" ");if(i.includes(e))return n(i,r);const o=Number(i.replace("px",""));return o==o?n("".concat(o/t).concat(e),r):i}}const t=r("rem",e,16),c=r("rem","var(--mantine-scale)",16),i=r("em",e,16);exports.createConverter=r,exports.em=i,exports.mantine_rem=c,exports.rem=t;
package/rem/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const e="16px",n=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r&&r!==e?"calc(".concat(n," * ").concat(r,")"):n};function r(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16;return function c(i){if(Array.isArray(i))return i.map(c).join(" ");if(0===i||"0"===i)return"0";if("number"==typeof i)return n("".concat(i/t).concat(e),r);if(i.includes("calc(")||i.includes("var(")||i.includes("clamp("))return i;if(i.includes(" "))return i.split(" ").map(c).join(" ");if(i.includes(e))return n(i,r);const o=Number(i.replace("px",""));return o==o?n("".concat(o/t).concat(e),r):i}}const t=r("rem",e,16),c=r("rem","var(--mantine-scale)",16),i=r("em",e,16);exports.createConverter=r,exports.em=i,exports.mantine_rem=c,exports.rem=t;
1
+ "use strict";const e="16px";function n(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r&&r!==e?"calc(".concat(n," * ").concat(r,")"):n}function r(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16;return function c(i){if(Array.isArray(i))return i.map(c).join(" ");if(0===i||"0"===i)return"0";if("number"==typeof i)return n("".concat(i/t).concat(e),r);if(i.includes("calc(")||i.includes("var(")||i.includes("clamp("))return i;if(i.includes(" "))return i.split(" ").map(c).join(" ");if(i.includes(e))return n(i,r);const o=Number(i.replace("px",""));return o==o?n("".concat(o/t).concat(e),r):i}}const t=r("rem",e,16),c=r("rem","var(--mantine-scale)",16),i=r("em",e,16);exports.createConverter=r,exports.em=i,exports.mantine_rem=c,exports.rem=t;