foxact 0.2.27 → 0.2.29

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 (56) hide show
  1. package/create-storage-hook/index.cjs +1 -1
  2. package/create-storage-hook/index.d.ts +2 -2
  3. package/create-storage-hook/index.js +1 -1
  4. package/create-storage-hook/index.mjs +1 -1
  5. package/current-year/index.cjs +2 -0
  6. package/current-year/index.d.ts +10 -0
  7. package/current-year/index.js +2 -0
  8. package/current-year/index.mjs +2 -0
  9. package/invariant/index.cjs +1 -0
  10. package/invariant/index.d.ts +4 -0
  11. package/invariant/index.js +1 -0
  12. package/invariant/index.mjs +1 -0
  13. package/nullthrow/index.cjs +1 -0
  14. package/nullthrow/index.d.ts +4 -0
  15. package/nullthrow/index.js +1 -0
  16. package/nullthrow/index.mjs +1 -0
  17. package/package.json +199 -170
  18. package/rem/index.cjs +1 -1
  19. package/rem/index.d.ts +3 -3
  20. package/rem/index.js +1 -1
  21. package/rem/index.mjs +1 -1
  22. package/sizes.json +1 -1
  23. package/use/index.cjs +1 -1
  24. package/use/index.js +1 -1
  25. package/use-array/index.cjs +1 -1
  26. package/use-array/index.js +1 -1
  27. package/use-array/index.mjs +1 -1
  28. package/use-clipboard/index.cjs +1 -1
  29. package/use-clipboard/index.js +1 -1
  30. package/use-clipboard/index.mjs +1 -1
  31. package/use-debounced-state/index.cjs +1 -1
  32. package/use-debounced-state/index.js +1 -1
  33. package/use-debounced-state/index.mjs +1 -1
  34. package/use-intersection/index.cjs +1 -1
  35. package/use-intersection/index.js +1 -1
  36. package/use-intersection/index.mjs +1 -1
  37. package/use-isomorphic-layout-effect/index.d.ts +3 -3
  38. package/use-map/index.cjs +1 -1
  39. package/use-map/index.js +1 -1
  40. package/use-map/index.mjs +1 -1
  41. package/use-react-router-enable-concurrent-navigation/index.cjs +1 -1
  42. package/use-react-router-enable-concurrent-navigation/index.js +1 -1
  43. package/use-react-router-enable-concurrent-navigation/index.mjs +1 -1
  44. package/use-set/index.cjs +1 -1
  45. package/use-set/index.js +1 -1
  46. package/use-set/index.mjs +1 -1
  47. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs +1 -1
  48. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js +1 -1
  49. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs +1 -1
  50. package/use-uncontrolled/index.cjs +1 -1
  51. package/use-uncontrolled/index.js +1 -1
  52. package/use-uncontrolled/index.mjs +1 -1
  53. package/use-url-hash-state/index.cjs +1 -1
  54. package/use-url-hash-state/index.d.ts +13 -3
  55. package/use-url-hash-state/index.js +1 -1
  56. package/use-url-hash-state/index.mjs +1 -1
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),o=require("../noop/index.cjs"),n=require("../use-isomorphic-layout-effect/index.cjs"),t=require("../no-ssr/index.cjs");const r=e=>"function"==typeof e,i=e=>e,a=()=>{throw t.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(t){const l="localStorage"===t?"foxact-local-storage":"foxact-session-storage",c="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))}:o.noop,s="undefined"!=typeof window?(e,o)=>{try{window[t].setItem(e,o)}catch(e){console.warn("[foxact] Failed to set value to ".concat(t,", it might be blocked"))}finally{c(e)}}:o.noop,u="undefined"!=typeof window?e=>{try{window[t].removeItem(e)}catch(e){console.warn("[foxact] Failed to remove value from ".concat(t,", it might be blocked"))}finally{c(e)}}:o.noop,d=e=>{if("undefined"==typeof window)return null;try{return window[t].getItem(e)}catch(e){return console.warn("[foxact] Failed to get value from ".concat(t,", it might be blocked")),null}};return{useStorage:function(t,c){var w;let f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const v=e.useCallback(e=>{if("undefined"==typeof window)return o.noop;const n=o=>{"key"in o&&o.key!==t||e()},r=o=>{o.detail===t&&e()};return window.addEventListener("storage",n),window.addEventListener(l,r),()=>{window.removeEventListener("storage",n),window.removeEventListener(l,r)}},[t]),y=f.raw?i:f.serializer,g=f.raw?i:f.deserializer,m=void 0!==c?()=>y(c):a,p=e.useSyncExternalStore(v,()=>d(t),m),h=e.useMemo(()=>null===p?null:g(p),[p,g]),S=e.useCallback(e=>{try{const o=r(e)?e(null!=h?h:null):e;null===o?u(t):s(t,y(o))}catch(e){console.warn(e)}},[t,y,h]);return n.useIsomorphicLayoutEffect(()=>{null===d(t)&&void 0!==c&&s(t,y(c))},[g,t,y,c]),[null!==(w=null!=h?h:c)&&void 0!==w?w:null,S]},useSetStorage:(o,n)=>e.useCallback(e=>{try{null===e?u(o):s(o,n(e))}catch(e){console.warn(e)}},[o,n])}};
1
+ "use strict";require("client-only");var e=require("react"),o=require("../noop/index.cjs"),t=require("../use-isomorphic-layout-effect/index.cjs"),n=require("../no-ssr/index.cjs");const r=e=>"function"==typeof e,a=e=>e,i=()=>{throw n.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(n){const l="localStorage"===n?"foxact-use-local-storage":"foxact-use-session-storage",c="localStorage"===n?"foxact/use-local-storage":"foxact/use-session-storage",s="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))}:o.noop,u="undefined"!=typeof window?(e,o)=>{try{window[n].setItem(e,o)}catch(e){console.warn("[".concat(c,"] Failed to set value to ").concat(n,", it might be blocked"))}finally{s(e)}}:o.noop,d="undefined"!=typeof window?e=>{try{window[n].removeItem(e)}catch(e){console.warn("[".concat(c,"] Failed to remove value from ").concat(n,", it might be blocked"))}finally{s(e)}}:o.noop,w=e=>{if("undefined"==typeof window)return null;try{return window[n].getItem(e)}catch(e){return console.warn("[".concat(c,"] Failed to get value from ").concat(n,", it might be blocked")),null}};return{useStorage:function(n,c){var s;let f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const v=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]),y=f.raw?a:f.serializer,g=f.raw?a:f.deserializer,m=void 0!==c?()=>y(c):i,p=e.useSyncExternalStore(v,()=>w(n),m),h=e.useMemo(()=>null===p?null:g(p),[p,g]),S=e.useCallback(e=>{try{const o=r(e)?e(null!=h?h:null):e;null===o?d(n):u(n,y(o))}catch(e){console.warn(e)}},[n,y,h]);return t.useIsomorphicLayoutEffect(()=>{null===w(n)&&void 0!==c&&u(n,y(c))},[g,n,y,c]),[(s=null!=h?h:c)!==null&&void 0!==s?s:null,S]},useSetStorage:(o,t)=>e.useCallback(e=>{try{null===e?d(o):u(o,t(e))}catch(e){console.warn(e)}},[o,t])}};
@@ -5,8 +5,8 @@ type NotUndefined<T> = T extends undefined ? never : T;
5
5
  type CustomStorageEvent = CustomEvent<string>;
6
6
  declare global {
7
7
  interface WindowEventMap {
8
- 'foxact-local-storage': CustomStorageEvent;
9
- 'foxact-session-storage': CustomStorageEvent;
8
+ 'foxact-use-local-storage': CustomStorageEvent;
9
+ 'foxact-use-session-storage': CustomStorageEvent;
10
10
  }
11
11
  }
12
12
  type Serializer<T> = (value: T) => string;
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),o=require("../noop/index.js"),n=require("../use-isomorphic-layout-effect/index.js"),t=require("../no-ssr/index.js");const r=e=>"function"==typeof e,i=e=>e,a=()=>{throw t.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(t){const l="localStorage"===t?"foxact-local-storage":"foxact-session-storage",c="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))}:o.noop,s="undefined"!=typeof window?(e,o)=>{try{window[t].setItem(e,o)}catch(e){console.warn("[foxact] Failed to set value to ".concat(t,", it might be blocked"))}finally{c(e)}}:o.noop,u="undefined"!=typeof window?e=>{try{window[t].removeItem(e)}catch(e){console.warn("[foxact] Failed to remove value from ".concat(t,", it might be blocked"))}finally{c(e)}}:o.noop,d=e=>{if("undefined"==typeof window)return null;try{return window[t].getItem(e)}catch(e){return console.warn("[foxact] Failed to get value from ".concat(t,", it might be blocked")),null}};return{useStorage:function(t,c){var w;let f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const v=e.useCallback(e=>{if("undefined"==typeof window)return o.noop;const n=o=>{"key"in o&&o.key!==t||e()},r=o=>{o.detail===t&&e()};return window.addEventListener("storage",n),window.addEventListener(l,r),()=>{window.removeEventListener("storage",n),window.removeEventListener(l,r)}},[t]),y=f.raw?i:f.serializer,g=f.raw?i:f.deserializer,m=void 0!==c?()=>y(c):a,p=e.useSyncExternalStore(v,()=>d(t),m),h=e.useMemo(()=>null===p?null:g(p),[p,g]),S=e.useCallback(e=>{try{const o=r(e)?e(null!=h?h:null):e;null===o?u(t):s(t,y(o))}catch(e){console.warn(e)}},[t,y,h]);return n.useIsomorphicLayoutEffect(()=>{null===d(t)&&void 0!==c&&s(t,y(c))},[g,t,y,c]),[null!==(w=null!=h?h:c)&&void 0!==w?w:null,S]},useSetStorage:(o,n)=>e.useCallback(e=>{try{null===e?u(o):s(o,n(e))}catch(e){console.warn(e)}},[o,n])}};
1
+ "use strict";require("client-only");var e=require("react"),o=require("../noop/index.js"),t=require("../use-isomorphic-layout-effect/index.js"),n=require("../no-ssr/index.js");const r=e=>"function"==typeof e,a=e=>e,i=()=>{throw n.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(n){const l="localStorage"===n?"foxact-use-local-storage":"foxact-use-session-storage",s="localStorage"===n?"foxact/use-local-storage":"foxact/use-session-storage",c="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))}:o.noop,u="undefined"!=typeof window?(e,o)=>{try{window[n].setItem(e,o)}catch(e){console.warn("[".concat(s,"] Failed to set value to ").concat(n,", it might be blocked"))}finally{c(e)}}:o.noop,d="undefined"!=typeof window?e=>{try{window[n].removeItem(e)}catch(e){console.warn("[".concat(s,"] Failed to remove value from ").concat(n,", it might be blocked"))}finally{c(e)}}:o.noop,w=e=>{if("undefined"==typeof window)return null;try{return window[n].getItem(e)}catch(e){return console.warn("[".concat(s,"] Failed to get value from ").concat(n,", it might be blocked")),null}};return{useStorage:function(n,s){var c;let f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const v=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]),y=f.raw?a:f.serializer,g=f.raw?a:f.deserializer,m=void 0!==s?()=>y(s):i,p=e.useSyncExternalStore(v,()=>w(n),m),h=e.useMemo(()=>null===p?null:g(p),[p,g]),S=e.useCallback(e=>{try{const o=r(e)?e(null!=h?h:null):e;null===o?d(n):u(n,y(o))}catch(e){console.warn(e)}},[n,y,h]);return t.useIsomorphicLayoutEffect(()=>{null===w(n)&&void 0!==s&&u(n,y(s))},[g,n,y,s]),[(c=null!=h?h:s)!==null&&void 0!==c?c:null,S]},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 t,useMemo as o}from"react";import{noop as n}from"../noop/index.mjs";import{useIsomorphicLayoutEffect as r}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as i}from"../no-ssr/index.mjs";const l=e=>"function"==typeof e,a=e=>e,c=()=>{throw i("useLocalStorage cannot be used on the server without a serverValue")};function d(i){const d="localStorage"===i?"foxact-local-storage":"foxact-session-storage",s="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(d,{detail:e}))}:n,u="undefined"!=typeof window?(e,t)=>{try{window[i].setItem(e,t)}catch(e){console.warn("[foxact] Failed to set value to ".concat(i,", it might be blocked"))}finally{s(e)}}:n,w="undefined"!=typeof window?e=>{try{window[i].removeItem(e)}catch(e){console.warn("[foxact] Failed to remove value from ".concat(i,", it might be blocked"))}finally{s(e)}}:n,f=e=>{if("undefined"==typeof window)return null;try{return window[i].getItem(e)}catch(e){return console.warn("[foxact] Failed to get value from ".concat(i,", it might be blocked")),null}};return{useStorage:function(i,s){var m;let v=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const y=e(e=>{if("undefined"==typeof window)return n;const t=t=>{"key"in t&&t.key!==i||e()},o=t=>{t.detail===i&&e()};return window.addEventListener("storage",t),window.addEventListener(d,o),()=>{window.removeEventListener("storage",t),window.removeEventListener(d,o)}},[i]),g=v.raw?a:v.serializer,p=v.raw?a:v.deserializer,h=void 0!==s?()=>g(s):c,x=t(y,()=>f(i),h),S=o(()=>null===x?null:p(x),[x,p]),b=e(e=>{try{const t=l(e)?e(null!=S?S:null):e;null===t?w(i):u(i,g(t))}catch(e){console.warn(e)}},[i,g,S]);return r(()=>{null===f(i)&&void 0!==s&&u(i,g(s))},[p,i,g,s]),[null!==(m=null!=S?S:s)&&void 0!==m?m:null,b]},useSetStorage:(t,o)=>e(e=>{try{null===e?w(t):u(t,o(e))}catch(e){console.warn(e)}},[t,o])}}export{d 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{useIsomorphicLayoutEffect as r}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as i}from"../no-ssr/index.mjs";const a=e=>"function"==typeof e,l=e=>e,c=()=>{throw i("useLocalStorage cannot be used on the server without a serverValue")};function s(i){const s="localStorage"===i?"foxact-use-local-storage":"foxact-use-session-storage",d="localStorage"===i?"foxact/use-local-storage":"foxact/use-session-storage",u="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(s,{detail:e}))}:n,w="undefined"!=typeof window?(e,o)=>{try{window[i].setItem(e,o)}catch(e){console.warn("[".concat(d,"] Failed to set value to ").concat(i,", it might be blocked"))}finally{u(e)}}:n,f="undefined"!=typeof window?e=>{try{window[i].removeItem(e)}catch(e){console.warn("[".concat(d,"] Failed to remove value from ").concat(i,", it might be blocked"))}finally{u(e)}}:n,m=e=>{if("undefined"==typeof window)return null;try{return window[i].getItem(e)}catch(e){return console.warn("[".concat(d,"] Failed to get value from ").concat(i,", it might be blocked")),null}};return{useStorage:function(i,d){var u;let v=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const g=e(e=>{if("undefined"==typeof window)return n;const o=o=>{"key"in o&&o.key!==i||e()},t=o=>{o.detail===i&&e()};return window.addEventListener("storage",o),window.addEventListener(s,t),()=>{window.removeEventListener("storage",o),window.removeEventListener(s,t)}},[i]),y=v.raw?l:v.serializer,p=v.raw?l:v.deserializer,h=o(g,()=>m(i),void 0!==d?()=>y(d):c),S=t(()=>null===h?null:p(h),[h,p]),x=e(e=>{try{const o=a(e)?e(null!=S?S:null):e;null===o?f(i):w(i,y(o))}catch(e){console.warn(e)}},[i,y,S]);return r(()=>{null===m(i)&&void 0!==d&&w(i,y(d))},[p,i,y,d]),[(u=null!=S?S:d)!==null&&void 0!==u?u:null,x]},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,2 @@
1
+ 'use client';
2
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");var i=r.memo(function(i){let{defaultYear:n,...u}=i;"undefined"==typeof window&&void 0===n&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[o,a]=r.useState(n||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:o})});module.exports=i;
@@ -0,0 +1,10 @@
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+
4
+ interface CurrentYearProps extends React.ComponentProps<'span'> {
5
+ defaultYear?: number;
6
+ }
7
+ declare function CopyrightYear({ defaultYear, ...restProps }: CurrentYearProps): react_jsx_runtime.JSX.Element;
8
+ declare const _default: react.MemoExoticComponent<typeof CopyrightYear>;
9
+
10
+ export { _default as default };
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.js");require("client-only");var i=r.memo(function(i){let{defaultYear:n,...u}=i;"undefined"==typeof window&&void 0===n&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[o,a]=r.useState(n||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:o})});module.exports=i;
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";var i=r(function(r){let{defaultYear:i,...o}=r;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,d]=t(i||new Date().getFullYear());return n(()=>{d(new Date().getFullYear())},[]),e("span",{...o,children:a})});export{i as default};
@@ -0,0 +1 @@
1
+ "use strict";exports.invariant=function(n){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(i)};
@@ -0,0 +1,4 @@
1
+ /** @see https://foxact.skk.moe/invariant-nullthrow */
2
+ declare function invariant<T>(value: T, message?: string): asserts value is NonNullable<T>;
3
+
4
+ export { invariant };
@@ -0,0 +1 @@
1
+ "use strict";exports.invariant=function(n){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(i)};
@@ -0,0 +1 @@
1
+ function n(n){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(i)}export{n as invariant};
@@ -0,0 +1 @@
1
+ "use strict";exports.nullthrow=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};
@@ -0,0 +1,4 @@
1
+ /** @see https://foxact.skk.moe/invariant-nullthrow */
2
+ declare const nullthrow: <T>(value: T, message?: string) => NonNullable<T>;
3
+
4
+ export { nullthrow };
@@ -0,0 +1 @@
1
+ "use strict";exports.nullthrow=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};
@@ -0,0 +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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.27",
3
+ "version": "0.2.29",
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": {
@@ -22,6 +22,7 @@
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "client-only": "^0.0.1",
25
+ "rollup-preserve-directives": "^1.1.0",
25
26
  "server-only": "^0.0.1"
26
27
  },
27
28
  "peerDependencies": {
@@ -48,7 +49,8 @@
48
49
  "es-iterator-helpers": "npm:@nolyfill/es-iterator-helpers@latest",
49
50
  "array.prototype.findlastindex": "npm:@nolyfill/array.prototype.findlastindex@latest",
50
51
  "function-bind": "npm:@nolyfill/function-bind@latest",
51
- "object.groupby": "npm:@nolyfill/object.groupby@latest"
52
+ "object.groupby": "npm:@nolyfill/object.groupby@latest",
53
+ "hasown": "npm:@nolyfill/hasown@latest"
52
54
  },
53
55
  "typeVersions": {
54
56
  ">=4.8": {
@@ -65,95 +67,104 @@
65
67
  "exports": {
66
68
  "./package.json": "./package.json",
67
69
  "./sizes.json": "./sizes.json",
68
- "./compose-context-provider": {
69
- "types": "./compose-context-provider/index.d.ts",
70
+ "./nullthrow": {
71
+ "types": "./nullthrow/index.d.ts",
70
72
  "import": {
71
- "types": "./compose-context-provider/index.d.ts",
72
- "default": "./compose-context-provider/index.mjs"
73
+ "types": "./nullthrow/index.d.ts",
74
+ "default": "./nullthrow/index.mjs"
73
75
  },
74
- "require": "./compose-context-provider/index.cjs",
75
- "default": "./compose-context-provider/index.js"
76
+ "require": "./nullthrow/index.cjs",
77
+ "default": "./nullthrow/index.js"
76
78
  },
77
- "./context-state": {
78
- "types": "./context-state/index.d.ts",
79
+ "./use-uncontrolled": {
80
+ "types": "./use-uncontrolled/index.d.ts",
79
81
  "import": {
80
- "types": "./context-state/index.d.ts",
81
- "default": "./context-state/index.mjs"
82
+ "types": "./use-uncontrolled/index.d.ts",
83
+ "default": "./use-uncontrolled/index.mjs"
82
84
  },
83
- "require": "./context-state/index.cjs",
84
- "default": "./context-state/index.js"
85
+ "require": "./use-uncontrolled/index.cjs",
86
+ "default": "./use-uncontrolled/index.js"
85
87
  },
86
- "./create-fixed-array": {
87
- "types": "./create-fixed-array/index.d.ts",
88
+ "./use-error-boundary": {
89
+ "types": "./use-error-boundary/index.d.ts",
88
90
  "import": {
89
- "types": "./create-fixed-array/index.d.ts",
90
- "default": "./create-fixed-array/index.mjs"
91
+ "types": "./use-error-boundary/index.d.ts",
92
+ "default": "./use-error-boundary/index.mjs"
91
93
  },
92
- "require": "./create-fixed-array/index.cjs",
93
- "default": "./create-fixed-array/index.js"
94
+ "require": "./use-error-boundary/index.cjs",
95
+ "default": "./use-error-boundary/index.js"
94
96
  },
95
- "./create-context-state": {
96
- "types": "./create-context-state/index.d.ts",
97
+ "./rem": {
98
+ "types": "./rem/index.d.ts",
97
99
  "import": {
98
- "types": "./create-context-state/index.d.ts",
99
- "default": "./create-context-state/index.mjs"
100
+ "types": "./rem/index.d.ts",
101
+ "default": "./rem/index.mjs"
100
102
  },
101
- "require": "./create-context-state/index.cjs",
102
- "default": "./create-context-state/index.js"
103
+ "require": "./rem/index.cjs",
104
+ "default": "./rem/index.js"
103
105
  },
104
- "./create-storage-hook": {
105
- "types": "./create-storage-hook/index.d.ts",
106
+ "./use-retimer": {
107
+ "types": "./use-retimer/index.d.ts",
106
108
  "import": {
107
- "types": "./create-storage-hook/index.d.ts",
108
- "default": "./create-storage-hook/index.mjs"
109
+ "types": "./use-retimer/index.d.ts",
110
+ "default": "./use-retimer/index.mjs"
109
111
  },
110
- "require": "./create-storage-hook/index.cjs",
111
- "default": "./create-storage-hook/index.js"
112
+ "require": "./use-retimer/index.cjs",
113
+ "default": "./use-retimer/index.js"
112
114
  },
113
- "./noop": {
114
- "types": "./noop/index.d.ts",
115
+ "./use-url-hash-state": {
116
+ "types": "./use-url-hash-state/index.d.ts",
115
117
  "import": {
116
- "types": "./noop/index.d.ts",
117
- "default": "./noop/index.mjs"
118
+ "types": "./use-url-hash-state/index.d.ts",
119
+ "default": "./use-url-hash-state/index.mjs"
118
120
  },
119
- "require": "./noop/index.cjs",
120
- "default": "./noop/index.js"
121
+ "require": "./use-url-hash-state/index.cjs",
122
+ "default": "./use-url-hash-state/index.js"
121
123
  },
122
- "./rem": {
123
- "types": "./rem/index.d.ts",
124
+ "./use-is-client": {
125
+ "types": "./use-is-client/index.d.ts",
124
126
  "import": {
125
- "types": "./rem/index.d.ts",
126
- "default": "./rem/index.mjs"
127
+ "types": "./use-is-client/index.d.ts",
128
+ "default": "./use-is-client/index.mjs"
127
129
  },
128
- "require": "./rem/index.cjs",
129
- "default": "./rem/index.js"
130
+ "require": "./use-is-client/index.cjs",
131
+ "default": "./use-is-client/index.js"
130
132
  },
131
- "./no-ssr": {
132
- "types": "./no-ssr/index.d.ts",
133
+ "./use-debounced-state": {
134
+ "types": "./use-debounced-state/index.d.ts",
133
135
  "import": {
134
- "types": "./no-ssr/index.d.ts",
135
- "default": "./no-ssr/index.mjs"
136
+ "types": "./use-debounced-state/index.d.ts",
137
+ "default": "./use-debounced-state/index.mjs"
136
138
  },
137
- "require": "./no-ssr/index.cjs",
138
- "default": "./no-ssr/index.js"
139
+ "require": "./use-debounced-state/index.cjs",
140
+ "default": "./use-debounced-state/index.js"
139
141
  },
140
- "./request-idle-callback": {
141
- "types": "./request-idle-callback/index.d.ts",
142
+ "./noop": {
143
+ "types": "./noop/index.d.ts",
142
144
  "import": {
143
- "types": "./request-idle-callback/index.d.ts",
144
- "default": "./request-idle-callback/index.mjs"
145
+ "types": "./noop/index.d.ts",
146
+ "default": "./noop/index.mjs"
145
147
  },
146
- "require": "./request-idle-callback/index.cjs",
147
- "default": "./request-idle-callback/index.js"
148
+ "require": "./noop/index.cjs",
149
+ "default": "./noop/index.js"
148
150
  },
149
- "./typescript-happy-forward-ref": {
150
- "types": "./typescript-happy-forward-ref/index.d.ts",
151
+ "./use-set": {
152
+ "types": "./use-set/index.d.ts",
151
153
  "import": {
152
- "types": "./typescript-happy-forward-ref/index.d.ts",
153
- "default": "./typescript-happy-forward-ref/index.mjs"
154
+ "types": "./use-set/index.d.ts",
155
+ "default": "./use-set/index.mjs"
154
156
  },
155
- "require": "./typescript-happy-forward-ref/index.cjs",
156
- "default": "./typescript-happy-forward-ref/index.js"
157
+ "require": "./use-set/index.cjs",
158
+ "default": "./use-set/index.js"
159
+ },
160
+ "./use-map": {
161
+ "types": "./use-map/index.d.ts",
162
+ "import": {
163
+ "types": "./use-map/index.d.ts",
164
+ "default": "./use-map/index.mjs"
165
+ },
166
+ "require": "./use-map/index.cjs",
167
+ "default": "./use-map/index.js"
157
168
  },
158
169
  "./use": {
159
170
  "types": "./use/index.d.ts",
@@ -164,59 +175,50 @@
164
175
  "require": "./use/index.cjs",
165
176
  "default": "./use/index.js"
166
177
  },
167
- "./use-array": {
168
- "types": "./use-array/index.d.ts",
169
- "import": {
170
- "types": "./use-array/index.d.ts",
171
- "default": "./use-array/index.mjs"
172
- },
173
- "require": "./use-array/index.cjs",
174
- "default": "./use-array/index.js"
175
- },
176
- "./use-clipboard": {
177
- "types": "./use-clipboard/index.d.ts",
178
+ "./typescript-happy-forward-ref": {
179
+ "types": "./typescript-happy-forward-ref/index.d.ts",
178
180
  "import": {
179
- "types": "./use-clipboard/index.d.ts",
180
- "default": "./use-clipboard/index.mjs"
181
+ "types": "./typescript-happy-forward-ref/index.d.ts",
182
+ "default": "./typescript-happy-forward-ref/index.mjs"
181
183
  },
182
- "require": "./use-clipboard/index.cjs",
183
- "default": "./use-clipboard/index.js"
184
+ "require": "./typescript-happy-forward-ref/index.cjs",
185
+ "default": "./typescript-happy-forward-ref/index.js"
184
186
  },
185
- "./use-composition-input": {
186
- "types": "./use-composition-input/index.d.ts",
187
+ "./compose-context-provider": {
188
+ "types": "./compose-context-provider/index.d.ts",
187
189
  "import": {
188
- "types": "./use-composition-input/index.d.ts",
189
- "default": "./use-composition-input/index.mjs"
190
+ "types": "./compose-context-provider/index.d.ts",
191
+ "default": "./compose-context-provider/index.mjs"
190
192
  },
191
- "require": "./use-composition-input/index.cjs",
192
- "default": "./use-composition-input/index.js"
193
+ "require": "./compose-context-provider/index.cjs",
194
+ "default": "./compose-context-provider/index.js"
193
195
  },
194
- "./use-debounced-state": {
195
- "types": "./use-debounced-state/index.d.ts",
196
+ "./use-react-router-is-match": {
197
+ "types": "./use-react-router-is-match/index.d.ts",
196
198
  "import": {
197
- "types": "./use-debounced-state/index.d.ts",
198
- "default": "./use-debounced-state/index.mjs"
199
+ "types": "./use-react-router-is-match/index.d.ts",
200
+ "default": "./use-react-router-is-match/index.mjs"
199
201
  },
200
- "require": "./use-debounced-state/index.cjs",
201
- "default": "./use-debounced-state/index.js"
202
+ "require": "./use-react-router-is-match/index.cjs",
203
+ "default": "./use-react-router-is-match/index.js"
202
204
  },
203
- "./use-debounced-value": {
204
- "types": "./use-debounced-value/index.d.ts",
205
+ "./request-idle-callback": {
206
+ "types": "./request-idle-callback/index.d.ts",
205
207
  "import": {
206
- "types": "./use-debounced-value/index.d.ts",
207
- "default": "./use-debounced-value/index.mjs"
208
+ "types": "./request-idle-callback/index.d.ts",
209
+ "default": "./request-idle-callback/index.mjs"
208
210
  },
209
- "require": "./use-debounced-value/index.cjs",
210
- "default": "./use-debounced-value/index.js"
211
+ "require": "./request-idle-callback/index.cjs",
212
+ "default": "./request-idle-callback/index.js"
211
213
  },
212
- "./use-error-boundary": {
213
- "types": "./use-error-boundary/index.d.ts",
214
+ "./use-singleton": {
215
+ "types": "./use-singleton/index.d.ts",
214
216
  "import": {
215
- "types": "./use-error-boundary/index.d.ts",
216
- "default": "./use-error-boundary/index.mjs"
217
+ "types": "./use-singleton/index.d.ts",
218
+ "default": "./use-singleton/index.mjs"
217
219
  },
218
- "require": "./use-error-boundary/index.cjs",
219
- "default": "./use-error-boundary/index.js"
220
+ "require": "./use-singleton/index.cjs",
221
+ "default": "./use-singleton/index.js"
220
222
  },
221
223
  "./use-intersection": {
222
224
  "types": "./use-intersection/index.d.ts",
@@ -227,50 +229,41 @@
227
229
  "require": "./use-intersection/index.cjs",
228
230
  "default": "./use-intersection/index.js"
229
231
  },
230
- "./use-is-client": {
231
- "types": "./use-is-client/index.d.ts",
232
- "import": {
233
- "types": "./use-is-client/index.d.ts",
234
- "default": "./use-is-client/index.mjs"
235
- },
236
- "require": "./use-is-client/index.cjs",
237
- "default": "./use-is-client/index.js"
238
- },
239
- "./use-local-storage": {
240
- "types": "./use-local-storage/index.d.ts",
232
+ "./no-ssr": {
233
+ "types": "./no-ssr/index.d.ts",
241
234
  "import": {
242
- "types": "./use-local-storage/index.d.ts",
243
- "default": "./use-local-storage/index.mjs"
235
+ "types": "./no-ssr/index.d.ts",
236
+ "default": "./no-ssr/index.mjs"
244
237
  },
245
- "require": "./use-local-storage/index.cjs",
246
- "default": "./use-local-storage/index.js"
238
+ "require": "./no-ssr/index.cjs",
239
+ "default": "./no-ssr/index.js"
247
240
  },
248
- "./use-isomorphic-layout-effect": {
249
- "types": "./use-isomorphic-layout-effect/index.d.ts",
241
+ "./current-year": {
242
+ "types": "./current-year/index.d.ts",
250
243
  "import": {
251
- "types": "./use-isomorphic-layout-effect/index.d.ts",
252
- "default": "./use-isomorphic-layout-effect/index.mjs"
244
+ "types": "./current-year/index.d.ts",
245
+ "default": "./current-year/index.mjs"
253
246
  },
254
- "require": "./use-isomorphic-layout-effect/index.cjs",
255
- "default": "./use-isomorphic-layout-effect/index.js"
247
+ "require": "./current-year/index.cjs",
248
+ "default": "./current-year/index.js"
256
249
  },
257
- "./use-map": {
258
- "types": "./use-map/index.d.ts",
250
+ "./create-fixed-array": {
251
+ "types": "./create-fixed-array/index.d.ts",
259
252
  "import": {
260
- "types": "./use-map/index.d.ts",
261
- "default": "./use-map/index.mjs"
253
+ "types": "./create-fixed-array/index.d.ts",
254
+ "default": "./create-fixed-array/index.mjs"
262
255
  },
263
- "require": "./use-map/index.cjs",
264
- "default": "./use-map/index.js"
256
+ "require": "./create-fixed-array/index.cjs",
257
+ "default": "./create-fixed-array/index.js"
265
258
  },
266
- "./use-next-pathname": {
267
- "types": "./use-next-pathname/index.d.ts",
259
+ "./use-clipboard": {
260
+ "types": "./use-clipboard/index.d.ts",
268
261
  "import": {
269
- "types": "./use-next-pathname/index.d.ts",
270
- "default": "./use-next-pathname/index.mjs"
262
+ "types": "./use-clipboard/index.d.ts",
263
+ "default": "./use-clipboard/index.mjs"
271
264
  },
272
- "require": "./use-next-pathname/index.cjs",
273
- "default": "./use-next-pathname/index.js"
265
+ "require": "./use-clipboard/index.cjs",
266
+ "default": "./use-clipboard/index.js"
274
267
  },
275
268
  "./use-react-router-enable-concurrent-navigation": {
276
269
  "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
@@ -281,23 +274,23 @@
281
274
  "require": "./use-react-router-enable-concurrent-navigation/index.cjs",
282
275
  "default": "./use-react-router-enable-concurrent-navigation/index.js"
283
276
  },
284
- "./use-react-router-is-match": {
285
- "types": "./use-react-router-is-match/index.d.ts",
277
+ "./use-next-pathname": {
278
+ "types": "./use-next-pathname/index.d.ts",
286
279
  "import": {
287
- "types": "./use-react-router-is-match/index.d.ts",
288
- "default": "./use-react-router-is-match/index.mjs"
280
+ "types": "./use-next-pathname/index.d.ts",
281
+ "default": "./use-next-pathname/index.mjs"
289
282
  },
290
- "require": "./use-react-router-is-match/index.cjs",
291
- "default": "./use-react-router-is-match/index.js"
283
+ "require": "./use-next-pathname/index.cjs",
284
+ "default": "./use-next-pathname/index.js"
292
285
  },
293
- "./use-retimer": {
294
- "types": "./use-retimer/index.d.ts",
286
+ "./use-composition-input": {
287
+ "types": "./use-composition-input/index.d.ts",
295
288
  "import": {
296
- "types": "./use-retimer/index.d.ts",
297
- "default": "./use-retimer/index.mjs"
289
+ "types": "./use-composition-input/index.d.ts",
290
+ "default": "./use-composition-input/index.mjs"
298
291
  },
299
- "require": "./use-retimer/index.cjs",
300
- "default": "./use-retimer/index.js"
292
+ "require": "./use-composition-input/index.cjs",
293
+ "default": "./use-composition-input/index.js"
301
294
  },
302
295
  "./use-session-storage": {
303
296
  "types": "./use-session-storage/index.d.ts",
@@ -308,23 +301,32 @@
308
301
  "require": "./use-session-storage/index.cjs",
309
302
  "default": "./use-session-storage/index.js"
310
303
  },
311
- "./use-set": {
312
- "types": "./use-set/index.d.ts",
304
+ "./invariant": {
305
+ "types": "./invariant/index.d.ts",
313
306
  "import": {
314
- "types": "./use-set/index.d.ts",
315
- "default": "./use-set/index.mjs"
307
+ "types": "./invariant/index.d.ts",
308
+ "default": "./invariant/index.mjs"
316
309
  },
317
- "require": "./use-set/index.cjs",
318
- "default": "./use-set/index.js"
310
+ "require": "./invariant/index.cjs",
311
+ "default": "./invariant/index.js"
319
312
  },
320
- "./use-singleton": {
321
- "types": "./use-singleton/index.d.ts",
313
+ "./use-debounced-value": {
314
+ "types": "./use-debounced-value/index.d.ts",
322
315
  "import": {
323
- "types": "./use-singleton/index.d.ts",
324
- "default": "./use-singleton/index.mjs"
316
+ "types": "./use-debounced-value/index.d.ts",
317
+ "default": "./use-debounced-value/index.mjs"
325
318
  },
326
- "require": "./use-singleton/index.cjs",
327
- "default": "./use-singleton/index.js"
319
+ "require": "./use-debounced-value/index.cjs",
320
+ "default": "./use-debounced-value/index.js"
321
+ },
322
+ "./create-storage-hook": {
323
+ "types": "./create-storage-hook/index.d.ts",
324
+ "import": {
325
+ "types": "./create-storage-hook/index.d.ts",
326
+ "default": "./create-storage-hook/index.mjs"
327
+ },
328
+ "require": "./create-storage-hook/index.cjs",
329
+ "default": "./create-storage-hook/index.js"
328
330
  },
329
331
  "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
330
332
  "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
@@ -335,23 +337,50 @@
335
337
  "require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
336
338
  "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
337
339
  },
338
- "./use-uncontrolled": {
339
- "types": "./use-uncontrolled/index.d.ts",
340
+ "./context-state": {
341
+ "types": "./context-state/index.d.ts",
340
342
  "import": {
341
- "types": "./use-uncontrolled/index.d.ts",
342
- "default": "./use-uncontrolled/index.mjs"
343
+ "types": "./context-state/index.d.ts",
344
+ "default": "./context-state/index.mjs"
343
345
  },
344
- "require": "./use-uncontrolled/index.cjs",
345
- "default": "./use-uncontrolled/index.js"
346
+ "require": "./context-state/index.cjs",
347
+ "default": "./context-state/index.js"
346
348
  },
347
- "./use-url-hash-state": {
348
- "types": "./use-url-hash-state/index.d.ts",
349
+ "./use-local-storage": {
350
+ "types": "./use-local-storage/index.d.ts",
349
351
  "import": {
350
- "types": "./use-url-hash-state/index.d.ts",
351
- "default": "./use-url-hash-state/index.mjs"
352
+ "types": "./use-local-storage/index.d.ts",
353
+ "default": "./use-local-storage/index.mjs"
352
354
  },
353
- "require": "./use-url-hash-state/index.cjs",
354
- "default": "./use-url-hash-state/index.js"
355
+ "require": "./use-local-storage/index.cjs",
356
+ "default": "./use-local-storage/index.js"
357
+ },
358
+ "./use-isomorphic-layout-effect": {
359
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
360
+ "import": {
361
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
362
+ "default": "./use-isomorphic-layout-effect/index.mjs"
363
+ },
364
+ "require": "./use-isomorphic-layout-effect/index.cjs",
365
+ "default": "./use-isomorphic-layout-effect/index.js"
366
+ },
367
+ "./create-context-state": {
368
+ "types": "./create-context-state/index.d.ts",
369
+ "import": {
370
+ "types": "./create-context-state/index.d.ts",
371
+ "default": "./create-context-state/index.mjs"
372
+ },
373
+ "require": "./create-context-state/index.cjs",
374
+ "default": "./create-context-state/index.js"
375
+ },
376
+ "./use-array": {
377
+ "types": "./use-array/index.d.ts",
378
+ "import": {
379
+ "types": "./use-array/index.d.ts",
380
+ "default": "./use-array/index.mjs"
381
+ },
382
+ "require": "./use-array/index.cjs",
383
+ "default": "./use-array/index.js"
355
384
  }
356
385
  }
357
386
  }
package/rem/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const n="16px";function e(n,e){return"calc(".concat(n," * ").concat(e,")")}function t(t){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(t);return c&&c!==n?e(o,c):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(t))return c&&c!==n?e(r,c):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(t);return c&&c!==n?e(r,c):r}return r}}const c=t("rem",n),r=t("rem","var(--mantine-scale)"),o=t("em");exports.em=o,exports.mantine_rem=r,exports.rem=c;
1
+ "use strict";const n="16px";function r(n,r){return"calc(".concat(n," * ").concat(r,")")}function e(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function c(i){if(Array.isArray(i))return i.map(n=>c(n)).join(" ");if(0===i||"0"===i)return"0";if("number"==typeof i){const c="".concat(i/16).concat(e);return t&&t!==n?r(c,t):c}if(i.includes("calc(")||i.includes("var(")||i.includes("clamp("))return i;if(i.includes(" "))return i.split(" ").map(n=>c(n)).join(" ");if(i.includes(e))return t&&t!==n?r(i,t):i;const u=Number(i.replace("px",""));if(u==u){const c="".concat(u/16).concat(e);return t&&t!==n?r(c,t):c}return i}}const t=e("rem",n),c=e("rem","var(--mantine-scale)"),i=e("em");exports.em=i,exports.mantine_rem=c,exports.rem=t;
package/rem/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- declare const rem: (value: number | string) => string;
2
- declare const mantine_rem: (value: number | string) => string;
3
- declare const em: (value: number | string) => string;
1
+ declare const rem: (value: number | string | number[] | string[]) => string;
2
+ declare const mantine_rem: (value: number | string | number[] | string[]) => string;
3
+ declare const em: (value: number | string | number[] | string[]) => string;
4
4
 
5
5
  export { em, mantine_rem, rem };
package/rem/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const n="16px";function e(n,e){return"calc(".concat(n," * ").concat(e,")")}function t(t){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(t);return c&&c!==n?e(o,c):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(t))return c&&c!==n?e(r,c):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(t);return c&&c!==n?e(r,c):r}return r}}const c=t("rem",n),r=t("rem","var(--mantine-scale)"),o=t("em");exports.em=o,exports.mantine_rem=r,exports.rem=c;
1
+ "use strict";const n="16px";function r(n,r){return"calc(".concat(n," * ").concat(r,")")}function e(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function c(i){if(Array.isArray(i))return i.map(n=>c(n)).join(" ");if(0===i||"0"===i)return"0";if("number"==typeof i){const c="".concat(i/16).concat(e);return t&&t!==n?r(c,t):c}if(i.includes("calc(")||i.includes("var(")||i.includes("clamp("))return i;if(i.includes(" "))return i.split(" ").map(n=>c(n)).join(" ");if(i.includes(e))return t&&t!==n?r(i,t):i;const u=Number(i.replace("px",""));if(u==u){const c="".concat(u/16).concat(e);return t&&t!==n?r(c,t):c}return i}}const t=e("rem",n),c=e("rem","var(--mantine-scale)"),i=e("em");exports.em=i,exports.mantine_rem=c,exports.rem=t;
package/rem/index.mjs CHANGED
@@ -1 +1 @@
1
- const n="16px";function c(n,c){return"calc(".concat(n," * ").concat(c,")")}function e(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(e);return t&&t!==n?c(o,t):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(e))return t&&t!==n?c(r,t):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(e);return t&&t!==n?c(r,t):r}return r}}const t=e("rem",n),r=e("rem","var(--mantine-scale)"),o=e("em");export{o as em,r as mantine_rem,t as rem};
1
+ const n="16px";function r(n,r){return"calc(".concat(n," * ").concat(r,")")}function c(c){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function t(i){if(Array.isArray(i))return i.map(n=>t(n)).join(" ");if(0===i||"0"===i)return"0";if("number"==typeof i){const t="".concat(i/16).concat(c);return e&&e!==n?r(t,e):t}if(i.includes("calc(")||i.includes("var(")||i.includes("clamp("))return i;if(i.includes(" "))return i.split(" ").map(n=>t(n)).join(" ");if(i.includes(c))return e&&e!==n?r(i,e):i;const u=Number(i.replace("px",""));if(u==u){const t="".concat(u/16).concat(c);return e&&e!==n?r(t,e):t}return i}}const e=c("rem",n),t=c("rem","var(--mantine-scale)"),i=c("em");export{i as em,t as mantine_rem,e as rem};
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":14388,"gzip":8850,"br":0},"exports":{"compose-context-provider":{"raw":164,"gzip":148,"br":114},"create-fixed-array":{"raw":100,"gzip":104,"br":89},"create-context-state":{"raw":145,"gzip":116,"br":96},"context-state":{"raw":377,"gzip":241,"br":207},"noop":{"raw":33,"gzip":53,"br":37},"rem":{"raw":588,"gzip":330,"br":282},"no-ssr":{"raw":389,"gzip":269,"br":228},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"use":{"raw":276,"gzip":182,"br":150},"use-array":{"raw":337,"gzip":244,"br":204},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"create-storage-hook":{"raw":1988,"gzip":877,"br":766},"use-composition-input":{"raw":454,"gzip":281,"br":238},"use-debounced-state":{"raw":409,"gzip":285,"br":245},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-clipboard":{"raw":1075,"gzip":616,"br":533},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"use-is-client":{"raw":151,"gzip":142,"br":118},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-map":{"raw":354,"gzip":248,"br":211},"use-intersection":{"raw":1238,"gzip":654,"br":604},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-react-router-is-match":{"raw":568,"gzip":371,"br":309},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-session-storage":{"raw":316,"gzip":181,"br":152},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-set":{"raw":355,"gzip":243,"br":205},"use-react-router-enable-concurrent-navigation":{"raw":955,"gzip":457,"br":375},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":466,"gzip":325,"br":254},"use-uncontrolled":{"raw":300,"gzip":229,"br":194},"use-url-hash-state":{"raw":960,"gzip":561,"br":486}}}
1
+ {"total":{"raw":15590,"gzip":9630,"br":0},"exports":{"use-error-boundary":{"raw":244,"gzip":196,"br":159},"nullthrow":{"raw":194,"gzip":167,"br":128},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-is-client":{"raw":151,"gzip":142,"br":118},"rem":{"raw":734,"gzip":380,"br":333},"noop":{"raw":33,"gzip":53,"br":37},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-url-hash-state":{"raw":1069,"gzip":613,"br":534},"use-set":{"raw":347,"gzip":240,"br":203},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"use-map":{"raw":346,"gzip":244,"br":210},"use":{"raw":276,"gzip":182,"br":150},"compose-context-provider":{"raw":164,"gzip":148,"br":114},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-react-router-is-match":{"raw":568,"gzip":371,"br":309},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"no-ssr":{"raw":389,"gzip":269,"br":228},"use-intersection":{"raw":1230,"gzip":649,"br":597},"create-fixed-array":{"raw":100,"gzip":104,"br":89},"current-year":{"raw":527,"gzip":358,"br":290},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-clipboard":{"raw":1067,"gzip":611,"br":524},"use-composition-input":{"raw":454,"gzip":281,"br":238},"invariant":{"raw":178,"gzip":156,"br":118},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387},"use-session-storage":{"raw":316,"gzip":181,"br":152},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":254},"context-state":{"raw":377,"gzip":241,"br":207},"create-context-state":{"raw":145,"gzip":116,"br":96},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"create-storage-hook":{"raw":2090,"gzip":891,"br":775},"use-array":{"raw":329,"gzip":238,"br":199}}}
package/use/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("react");const t=e.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}});exports.use=t;
1
+ "use strict";const e=require("react").use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}});exports.use=e;
package/use/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("react");const t=e.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}});exports.use=t;
1
+ "use strict";const e=require("react").use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}});exports.use=e;
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");exports.useArray=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[t,c]=e.useState(r),l=e.useCallback(e=>c(r=>r.concat(e)),[]),s=e.useCallback(()=>c([]),[]),u=e.useCallback(e=>c(r=>{if(e>-1){const t=r.slice();return t.splice(e,1),t}return r}),[]);return[t,l,s,u]};
1
+ "use strict";require("client-only");var e=require("react");exports.useArray=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[t,c]=e.useState(r),l=e.useCallback(e=>c(r=>r.concat(e)),[]);return[t,l,e.useCallback(()=>c([]),[]),e.useCallback(e=>c(r=>{if(e>-1){const t=r.slice();return t.splice(e,1),t}return r}),[])]};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");exports.useArray=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[t,c]=e.useState(r),l=e.useCallback(e=>c(r=>r.concat(e)),[]),s=e.useCallback(()=>c([]),[]),u=e.useCallback(e=>c(r=>{if(e>-1){const t=r.slice();return t.splice(e,1),t}return r}),[]);return[t,l,s,u]};
1
+ "use strict";require("client-only");var e=require("react");exports.useArray=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[t,c]=e.useState(r),l=e.useCallback(e=>c(r=>r.concat(e)),[]);return[t,l,e.useCallback(()=>c([]),[]),e.useCallback(e=>c(r=>{if(e>-1){const t=r.slice();return t.splice(e,1),t}return r}),[])]};
@@ -1 +1 @@
1
- import"client-only";import{useState as t,useCallback as r}from"react";const n=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[e,o]=t(n),c=r(t=>o(r=>r.concat(t)),[]),i=r(()=>o([]),[]),l=r(t=>o(r=>{if(t>-1){const n=r.slice();return n.splice(t,1),n}return r}),[]);return[e,c,i,l]};export{n as useArray};
1
+ import"client-only";import{useState as t,useCallback as r}from"react";const n=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[e,o]=t(n),c=r(t=>o(r=>r.concat(t)),[]);return[e,c,r(()=>o([]),[]),r(t=>o(r=>{if(t>-1){const n=r.slice();return n.splice(t,1),n}return r}),[])]};export{n as useArray};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]),h=e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),x=e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]);return{copy:h,reset:x,error:u,copied:s}};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]);return{copy:e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),reset:e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]),error:u,copied:s}};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]),h=e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),x=e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]);return{copy:h,reset:x,error:u,copied:s}};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]);return{copy:e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),reset:e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]),error:u,copied:s}};
@@ -1 +1 @@
1
- import"client-only";import{useState as o,useRef as r,useCallback as e}from"react";import{noop as t}from"../noop/index.mjs";import{useStableHandler as i}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";class a extends Error{}function l(){let{timeout:l=1e3,usePromptAsFallback:n=!1,promptFallbackText:c="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[p,d]=o(null),[s,m]=o(!1),w=r(null),y=i(u||t),b=e(o=>{w.current&&clearTimeout(w.current),o&&(w.current=window.setTimeout(()=>m(!1),l)),m(o)},[l]),f=e(o=>{d(o),y(o)},[y]),h=e(async o=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(o),b(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(n)try{window.prompt(c,o)}catch(o){f(o)}else f(r)}},[b,c,f,n]),x=e(()=>{m(!1),d(null),w.current&&clearTimeout(w.current)},[]);return{copy:h,reset:x,error:p,copied:s}}export{a as UseClipboardError,l as useClipboard};
1
+ import"client-only";import{useState as o,useRef as r,useCallback as e}from"react";import{noop as t}from"../noop/index.mjs";import{useStableHandler as i}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";class a extends Error{}function l(){let{timeout:l=1e3,usePromptAsFallback:n=!1,promptFallbackText:c="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[p,s]=o(null),[d,m]=o(!1),w=r(null),y=i(u||t),b=e(o=>{w.current&&clearTimeout(w.current),o&&(w.current=window.setTimeout(()=>m(!1),l)),m(o)},[l]),f=e(o=>{s(o),y(o)},[y]);return{copy:e(async o=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(o),b(!0);else throw new a("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(n)try{window.prompt(c,o)}catch(o){f(o)}else f(r)}},[b,c,f,n]),reset:e(()=>{m(!1),s(null),w.current&&clearTimeout(w.current)},[]),error:p,copied:d}}export{a as UseClipboardError,l as useClipboard};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../use-retimer/index.cjs");exports.useDebouncedState=function(t,u){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const[s,c]=e.useState(t),i=e.useRef(!0),a=r.useRetimer(),l=e.useCallback(e=>{i.current&&n?c(e):a(window.setTimeout(()=>{i.current=!0,c(e)},u)),i.current=!1},[n,a,u]),o=e.useCallback(e=>{a(),c(e)},[a]);return[s,l,o]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../use-retimer/index.cjs");exports.useDebouncedState=function(t,u){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const[s,c]=e.useState(t),i=e.useRef(!0),a=r.useRetimer();return[s,e.useCallback(e=>{i.current&&n?c(e):a(window.setTimeout(()=>{i.current=!0,c(e)},u)),i.current=!1},[n,a,u]),e.useCallback(e=>{a(),c(e)},[a])]};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../use-retimer/index.js");exports.useDebouncedState=function(t,u){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const[s,i]=e.useState(t),c=e.useRef(!0),a=r.useRetimer(),l=e.useCallback(e=>{c.current&&n?i(e):a(window.setTimeout(()=>{c.current=!0,i(e)},u)),c.current=!1},[n,a,u]),o=e.useCallback(e=>{a(),i(e)},[a]);return[s,l,o]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../use-retimer/index.js");exports.useDebouncedState=function(t,u){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const[s,i]=e.useState(t),c=e.useRef(!0),a=r.useRetimer();return[s,e.useCallback(e=>{c.current&&n?i(e):a(window.setTimeout(()=>{c.current=!0,i(e)},u)),c.current=!1},[n,a,u]),e.useCallback(e=>{a(),i(e)},[a])]};
@@ -1 +1 @@
1
- import"client-only";import{useState as e,useRef as t,useCallback as r}from"react";import{useRetimer as n}from"../use-retimer/index.mjs";function o(o,i){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const[c,m]=e(o),s=t(!0),d=n(),l=r(e=>{s.current&&u?m(e):d(window.setTimeout(()=>{s.current=!0,m(e)},i)),s.current=!1},[u,d,i]),p=r(e=>{d(),m(e)},[d]);return[c,l,p]}export{o as useDebouncedState};
1
+ import"client-only";import{useState as e,useRef as t,useCallback as r}from"react";import{useRetimer as n}from"../use-retimer/index.mjs";function o(o,i){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const[c,m]=e(o),s=t(!0),d=n();return[c,r(e=>{s.current&&u?m(e):d(window.setTimeout(()=>{s.current=!0,m(e)},i)),s.current=!1},[u,d,i]),r(e=>{d(),m(e)},[d])]}export{o as useDebouncedState};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),t=require("../request-idle-callback/index.cjs");const n="function"==typeof IntersectionObserver,r=new Map,o=[];exports.useIntersection=function(c){let{rootRef:i,rootMargin:s,disabled:u}=c;const[l,a]=e.useState(!1),f=e.useRef(null);e.useEffect(()=>{if(n){if(u||l)return;const e=f.current;if(null==e?void 0:e.tagName)return function(e,t,n){const{id:c,observer:i,elements:s}=function(e){let t;const n={root:e.root||null,margin:e.rootMargin||""},c=o.find(e=>e.root===n.root&&e.margin===n.margin);if(c&&(t=r.get(c)))return t;const i=new Map,s=new IntersectionObserver(e=>{e.forEach(e=>{const t=i.get(e.target),n=e.isIntersecting||e.intersectionRatio>0;t&&n&&t(n)})},e);return t={id:n,observer:s,elements:i},o.push(n),r.set(n,t),t}(n);return s.set(e,t),i.observe(e),function(){if(s.delete(e),i.unobserve(e),0===s.size){i.disconnect(),r.delete(c);const e=o.findIndex(e=>e.root===c.root&&e.margin===c.margin);e>-1&&o.splice(e,1)}}}(e,e=>e&&a(!0),{root:null==i?void 0:i.current,rootMargin:s})}if(!l){const e=t.requestIdleCallback(()=>a(!0));return()=>t.cancelIdleCallback(e)}},[u,s,i,l]);const d=e.useCallback(()=>{a(!1)},[]),g=e.useCallback(e=>{f.current=e},[]);return[g,l,d]};
1
+ "use strict";require("client-only");var e=require("react"),t=require("../request-idle-callback/index.cjs");const n="function"==typeof IntersectionObserver,r=new Map,o=[];exports.useIntersection=function(c){let{rootRef:i,rootMargin:s,disabled:u}=c;const[l,a]=e.useState(!1),f=e.useRef(null);e.useEffect(()=>{if(n){if(u||l)return;const e=f.current;if(null==e?void 0:e.tagName)return function(e,t,n){const{id:c,observer:i,elements:s}=function(e){let t;const n={root:e.root||null,margin:e.rootMargin||""},c=o.find(e=>e.root===n.root&&e.margin===n.margin);if(c&&(t=r.get(c)))return t;const i=new Map;return t={id:n,observer:new IntersectionObserver(e=>{e.forEach(e=>{const t=i.get(e.target),n=e.isIntersecting||e.intersectionRatio>0;t&&n&&t(n)})},e),elements:i},o.push(n),r.set(n,t),t}(n);return s.set(e,t),i.observe(e),function(){if(s.delete(e),i.unobserve(e),0===s.size){i.disconnect(),r.delete(c);const e=o.findIndex(e=>e.root===c.root&&e.margin===c.margin);e>-1&&o.splice(e,1)}}}(e,e=>e&&a(!0),{root:null==i?void 0:i.current,rootMargin:s})}if(!l){const e=t.requestIdleCallback(()=>a(!0));return()=>t.cancelIdleCallback(e)}},[u,s,i,l]);const d=e.useCallback(()=>{a(!1)},[]);return[e.useCallback(e=>{f.current=e},[]),l,d]};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),t=require("../request-idle-callback/index.js");const n="function"==typeof IntersectionObserver,r=new Map,o=[];exports.useIntersection=function(c){let{rootRef:i,rootMargin:s,disabled:u}=c;const[l,a]=e.useState(!1),f=e.useRef(null);e.useEffect(()=>{if(n){if(u||l)return;const e=f.current;if(null==e?void 0:e.tagName)return function(e,t,n){const{id:c,observer:i,elements:s}=function(e){let t;const n={root:e.root||null,margin:e.rootMargin||""},c=o.find(e=>e.root===n.root&&e.margin===n.margin);if(c&&(t=r.get(c)))return t;const i=new Map,s=new IntersectionObserver(e=>{e.forEach(e=>{const t=i.get(e.target),n=e.isIntersecting||e.intersectionRatio>0;t&&n&&t(n)})},e);return t={id:n,observer:s,elements:i},o.push(n),r.set(n,t),t}(n);return s.set(e,t),i.observe(e),function(){if(s.delete(e),i.unobserve(e),0===s.size){i.disconnect(),r.delete(c);const e=o.findIndex(e=>e.root===c.root&&e.margin===c.margin);e>-1&&o.splice(e,1)}}}(e,e=>e&&a(!0),{root:null==i?void 0:i.current,rootMargin:s})}if(!l){const e=t.requestIdleCallback(()=>a(!0));return()=>t.cancelIdleCallback(e)}},[u,s,i,l]);const d=e.useCallback(()=>{a(!1)},[]),g=e.useCallback(e=>{f.current=e},[]);return[g,l,d]};
1
+ "use strict";require("client-only");var e=require("react"),t=require("../request-idle-callback/index.js");const n="function"==typeof IntersectionObserver,r=new Map,o=[];exports.useIntersection=function(c){let{rootRef:i,rootMargin:s,disabled:u}=c;const[l,a]=e.useState(!1),f=e.useRef(null);e.useEffect(()=>{if(n){if(u||l)return;const e=f.current;if(null==e?void 0:e.tagName)return function(e,t,n){const{id:c,observer:i,elements:s}=function(e){let t;const n={root:e.root||null,margin:e.rootMargin||""},c=o.find(e=>e.root===n.root&&e.margin===n.margin);if(c&&(t=r.get(c)))return t;const i=new Map;return t={id:n,observer:new IntersectionObserver(e=>{e.forEach(e=>{const t=i.get(e.target),n=e.isIntersecting||e.intersectionRatio>0;t&&n&&t(n)})},e),elements:i},o.push(n),r.set(n,t),t}(n);return s.set(e,t),i.observe(e),function(){if(s.delete(e),i.unobserve(e),0===s.size){i.disconnect(),r.delete(c);const e=o.findIndex(e=>e.root===c.root&&e.margin===c.margin);e>-1&&o.splice(e,1)}}}(e,e=>e&&a(!0),{root:null==i?void 0:i.current,rootMargin:s})}if(!l){const e=t.requestIdleCallback(()=>a(!0));return()=>t.cancelIdleCallback(e)}},[u,s,i,l]);const d=e.useCallback(()=>{a(!1)},[]);return[e.useCallback(e=>{f.current=e},[]),l,d]};
@@ -1 +1 @@
1
- import"client-only";import{useState as t,useRef as n,useEffect as e,useCallback as r}from"react";import{requestIdleCallback as o,cancelIdleCallback as i}from"../request-idle-callback/index.mjs";const c="function"==typeof IntersectionObserver;function s(s){let{rootRef:f,rootMargin:a,disabled:m}=s;const[g,d]=t(!1),p=n(null);e(()=>{if(c){if(m||g)return;const t=p.current;if(null==t?void 0:t.tagName)return function(t,n,e){const{id:r,observer:o,elements:i}=function(t){let n;const e={root:t.root||null,margin:t.rootMargin||""},r=l.find(t=>t.root===e.root&&t.margin===e.margin);if(r&&(n=u.get(r)))return n;const o=new Map,i=new IntersectionObserver(t=>{t.forEach(t=>{const n=o.get(t.target),e=t.isIntersecting||t.intersectionRatio>0;n&&e&&n(e)})},t);return n={id:e,observer:i,elements:o},l.push(e),u.set(e,n),n}(e);return i.set(t,n),o.observe(t),function(){if(i.delete(t),o.unobserve(t),0===i.size){o.disconnect(),u.delete(r);const t=l.findIndex(t=>t.root===r.root&&t.margin===r.margin);t>-1&&l.splice(t,1)}}}(t,t=>t&&d(!0),{root:null==f?void 0:f.current,rootMargin:a})}if(!g){const t=o(()=>d(!0));return()=>i(t)}},[m,a,f,g]);const v=r(()=>{d(!1)},[]),b=r(t=>{p.current=t},[]);return[b,g,v]}const u=new Map,l=[];export{s as useIntersection};
1
+ import"client-only";import{useState as t,useRef as n,useEffect as e,useCallback as r}from"react";import{requestIdleCallback as o,cancelIdleCallback as i}from"../request-idle-callback/index.mjs";const c="function"==typeof IntersectionObserver;function s(s){let{rootRef:f,rootMargin:a,disabled:m}=s;const[g,d]=t(!1),p=n(null);e(()=>{if(c){if(m||g)return;const t=p.current;if(null==t?void 0:t.tagName)return function(t,n,e){const{id:r,observer:o,elements:i}=function(t){let n;const e={root:t.root||null,margin:t.rootMargin||""},r=l.find(t=>t.root===e.root&&t.margin===e.margin);if(r&&(n=u.get(r)))return n;const o=new Map;return n={id:e,observer:new IntersectionObserver(t=>{t.forEach(t=>{const n=o.get(t.target),e=t.isIntersecting||t.intersectionRatio>0;n&&e&&n(e)})},t),elements:o},l.push(e),u.set(e,n),n}(e);return i.set(t,n),o.observe(t),function(){if(i.delete(t),o.unobserve(t),0===i.size){o.disconnect(),u.delete(r);const t=l.findIndex(t=>t.root===r.root&&t.margin===r.margin);t>-1&&l.splice(t,1)}}}(t,t=>t&&d(!0),{root:null==f?void 0:f.current,rootMargin:a})}if(!g){const t=o(()=>d(!0));return()=>i(t)}},[m,a,f,g]);const v=r(()=>{d(!1)},[]);return[r(t=>{p.current=t},[]),g,v]}const u=new Map,l=[];export{s as useIntersection};
@@ -1,8 +1,8 @@
1
- import { useLayoutEffect as useLayoutEffect$1 } from 'react';
1
+ import { useEffect } from 'react';
2
2
 
3
3
  /** @see https://foxact.skk.moe/use-isomorphic-layout-effect */
4
- declare const useIsomorphicLayoutEffect: typeof useLayoutEffect$1;
4
+ declare const useIsomorphicLayoutEffect: typeof useEffect;
5
5
  /** @see https://foxact.skk.moe/use-isomorphic-layout-effect */
6
- declare const useLayoutEffect: typeof useLayoutEffect$1;
6
+ declare const useLayoutEffect: typeof useEffect;
7
7
 
8
8
  export { useIsomorphicLayoutEffect, useLayoutEffect };
package/use-map/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");exports.useMap=function(){let a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[t,l]=e.useState(a),s=e.useCallback((e,a)=>l(t=>(t.set(e,a),new Map(t))),[]),n=e.useCallback(e=>l(a=>a.has(e)?(a.delete(e),new Map(a)):a),[]),u=e.useCallback(()=>l(new Map),[]),r=e.useCallback(e=>l(e),[]);return[t,s,n,u,r]};
1
+ "use strict";require("client-only");var e=require("react");exports.useMap=function(){let a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[t,l]=e.useState(a),s=e.useCallback((e,a)=>l(t=>(t.set(e,a),new Map(t))),[]),n=e.useCallback(e=>l(a=>a.has(e)?(a.delete(e),new Map(a)):a),[]);return[t,s,n,e.useCallback(()=>l(new Map),[]),e.useCallback(e=>l(e),[])]};
package/use-map/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");exports.useMap=function(){let a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[t,l]=e.useState(a),s=e.useCallback((e,a)=>l(t=>(t.set(e,a),new Map(t))),[]),n=e.useCallback(e=>l(a=>a.has(e)?(a.delete(e),new Map(a)):a),[]),u=e.useCallback(()=>l(new Map),[]),r=e.useCallback(e=>l(e),[]);return[t,s,n,u,r]};
1
+ "use strict";require("client-only");var e=require("react");exports.useMap=function(){let a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[t,l]=e.useState(a),s=e.useCallback((e,a)=>l(t=>(t.set(e,a),new Map(t))),[]),n=e.useCallback(e=>l(a=>a.has(e)?(a.delete(e),new Map(a)):a),[]);return[t,s,n,e.useCallback(()=>l(new Map),[]),e.useCallback(e=>l(e),[])]};
package/use-map/index.mjs CHANGED
@@ -1 +1 @@
1
- import"client-only";import{useState as e,useCallback as t}from"react";const n=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[o,p]=e(n),a=t((e,t)=>p(n=>(n.set(e,t),new Map(n))),[]),r=t(e=>p(t=>t.has(e)?(t.delete(e),new Map(t)):t),[]),c=t(()=>p(new Map),[]),i=t(e=>p(e),[]);return[o,a,r,c,i]};export{n as useMap};
1
+ import"client-only";import{useState as e,useCallback as t}from"react";const n=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[o,p]=e(n),a=t((e,t)=>p(n=>(n.set(e,t),new Map(n))),[]),r=t(e=>p(t=>t.has(e)?(t.delete(e),new Map(t)):t),[]);return[o,a,r,t(()=>p(new Map),[]),t(e=>p(e),[])]};export{n as useMap};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";require("client-only");var r=require("react"),e=require("react-router-dom");const t=()=>{const{navigator:t}=r.useContext(e.UNSAFE_NavigationContext);if(!t)throw TypeError("[foxact] useReactRouterEnableConcurrentNavigation 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=r=>{let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
2
+ "use strict";require("client-only");var r=require("react"),e=require("react-router-dom");const 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=r=>{let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";require("client-only");var r=require("react"),e=require("react-router-dom");const t=()=>{const{navigator:t}=r.useContext(e.UNSAFE_NavigationContext);if(!t)throw TypeError("[foxact] useReactRouterEnableConcurrentNavigation 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=r=>{let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
2
+ "use strict";require("client-only");var r=require("react"),e=require("react-router-dom");const 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=r=>{let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
@@ -1,2 +1,2 @@
1
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";const n=()=>{const{navigator:n}=r(t);if(!n)throw TypeError("[foxact] useReactRouterEnableConcurrentNavigation 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),a=0;a<e;a++)t[a]=arguments[a];return o(()=>r.apply(n,t))},n.push=function(){for(var r=arguments.length,t=Array(r),a=0;a<r;a++)t[a]=arguments[a];return o(()=>e.apply(n,t))},n.replace=function(){for(var r=arguments.length,e=Array(r),a=0;a<r;a++)e[a]=arguments[a];return o(()=>t.apply(n,e))},()=>{n.go=r,n.push=e,n.replace=t}},[n])},a=r=>{let{children:e}=r;return n(),e};export{a as ReactRouterConcurrentNavigationProvider,n as useReactRouterEnableConcurrentNavigation};
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";const 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),a=0;a<e;a++)t[a]=arguments[a];return o(()=>r.apply(n,t))},n.push=function(){for(var r=arguments.length,t=Array(r),a=0;a<r;a++)t[a]=arguments[a];return o(()=>e.apply(n,t))},n.replace=function(){for(var r=arguments.length,e=Array(r),a=0;a<r;a++)e[a]=arguments[a];return o(()=>t.apply(n,e))},()=>{n.go=r,n.push=e,n.replace=t}},[n])},a=r=>{let{children:e}=r;return n(),e};export{a as ReactRouterConcurrentNavigationProvider,n as useReactRouterEnableConcurrentNavigation};
package/use-set/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");exports.useSet=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[a,l]=e.useState(t),s=e.useCallback(e=>l(t=>t.has(e)?t:new Set([...t,e])),[]),n=e.useCallback(e=>l(t=>t.has(e)?(t.delete(e),new Set(t)):t),[]),u=e.useCallback(()=>l(new Set),[]),r=e.useCallback(e=>l(e),[]);return[a,s,n,u,r]};
1
+ "use strict";require("client-only");var e=require("react");exports.useSet=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[a,l]=e.useState(t),s=e.useCallback(e=>l(t=>t.has(e)?t:new Set([...t,e])),[]),n=e.useCallback(e=>l(t=>t.has(e)?(t.delete(e),new Set(t)):t),[]);return[a,s,n,e.useCallback(()=>l(new Set),[]),e.useCallback(e=>l(e),[])]};
package/use-set/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");exports.useSet=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[a,l]=e.useState(t),s=e.useCallback(e=>l(t=>t.has(e)?t:new Set([...t,e])),[]),n=e.useCallback(e=>l(t=>t.has(e)?(t.delete(e),new Set(t)):t),[]),u=e.useCallback(()=>l(new Set),[]),r=e.useCallback(e=>l(e),[]);return[a,s,n,u,r]};
1
+ "use strict";require("client-only");var e=require("react");exports.useSet=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[a,l]=e.useState(t),s=e.useCallback(e=>l(t=>t.has(e)?t:new Set([...t,e])),[]),n=e.useCallback(e=>l(t=>t.has(e)?(t.delete(e),new Set(t)):t),[]);return[a,s,n,e.useCallback(()=>l(new Set),[]),e.useCallback(e=>l(e),[])]};
package/use-set/index.mjs CHANGED
@@ -1 +1 @@
1
- import"client-only";import{useState as e,useCallback as t}from"react";const n=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[o,r]=e(n),c=t(e=>r(t=>t.has(e)?t:new Set([...t,e])),[]),i=t(e=>r(t=>t.has(e)?(t.delete(e),new Set(t)):t),[]),l=t(()=>r(new Set),[]),s=t(e=>r(e),[]);return[o,c,i,l,s]};export{n as useSet};
1
+ import"client-only";import{useState as e,useCallback as t}from"react";const n=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[o,r]=e(n),c=t(e=>r(t=>t.has(e)?t:new Set([...t,e])),[]),i=t(e=>r(t=>t.has(e)?(t.delete(e),new Set(t)):t),[]);return[o,c,i,t(()=>r(new Set),[]),t(e=>r(e),[])]};export{n as useSet};
@@ -1 +1 @@
1
- "use strict";var e=require("react");const t="undefined"!=typeof window?e.useInsertionEffect||e.useLayoutEffect:e.useEffect;function n(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}exports.useStableHandler=function(r){const o=e.useRef(n);return t(()=>{o.current=r},[r]),e.useCallback(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=o.current;return r(...t)},[])};
1
+ "use strict";var e=require("react");const t="undefined"!=typeof window?e.useInsertionEffect||e.useLayoutEffect:e.useEffect;function n(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}exports.useStableHandler=function(r){const o=e.useRef(n);return t(()=>{o.current=r},[r]),e.useCallback(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.current)(...t)},[])};
@@ -1 +1 @@
1
- "use strict";var e=require("react");const t="undefined"!=typeof window?e.useInsertionEffect||e.useLayoutEffect:e.useEffect;function n(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}exports.useStableHandler=function(r){const o=e.useRef(n);return t(()=>{o.current=r},[r]),e.useCallback(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=o.current;return r(...t)},[])};
1
+ "use strict";var e=require("react");const t="undefined"!=typeof window?e.useInsertionEffect||e.useLayoutEffect:e.useEffect;function n(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}exports.useStableHandler=function(r){const o=e.useRef(n);return t(()=>{o.current=r},[r]),e.useCallback(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.current)(...t)},[])};
@@ -1 +1 @@
1
- import n,{useLayoutEffect as e,useEffect as t,useRef as r,useCallback as o}from"react";const c="undefined"!=typeof window?n.useInsertionEffect||e:t;function f(n){const e=r(u);return c(()=>{e.current=n},[n]),o(function(){for(var n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];const o=e.current;return o(...t)},[])}function u(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}export{f as useStableHandler};
1
+ import e,{useLayoutEffect as n,useEffect as t,useRef as r,useCallback as o}from"react";const c="undefined"!=typeof window?e.useInsertionEffect||n:t;function f(e){const n=r(u);return c(()=>{n.current=e},[e]),o(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.current)(...t)},[])}function u(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}export{f as useStableHandler};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");const r=e=>e;exports.useUncontrolled=function(t){let u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;const n=e.useRef(null),[c,l]=e.useReducer((e,r)=>u(r),t),s=e.useCallback(()=>{n.current&&l(n.current.value)},[]);return[c,s,n]};
1
+ "use strict";require("client-only");var e=require("react");const r=e=>e;exports.useUncontrolled=function(t){let u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;const n=e.useRef(null),[c,l]=e.useReducer((e,r)=>u(r),t);return[c,e.useCallback(()=>{n.current&&l(n.current.value)},[]),n]};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");const r=e=>e;exports.useUncontrolled=function(t){let u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;const n=e.useRef(null),[c,l]=e.useReducer((e,r)=>u(r),t),s=e.useCallback(()=>{n.current&&l(n.current.value)},[]);return[c,s,n]};
1
+ "use strict";require("client-only");var e=require("react");const r=e=>e;exports.useUncontrolled=function(t){let u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;const n=e.useRef(null),[c,l]=e.useReducer((e,r)=>u(r),t);return[c,e.useCallback(()=>{n.current&&l(n.current.value)},[]),n]};
@@ -1 +1 @@
1
- import"client-only";import{useRef as t,useReducer as n,useCallback as r}from"react";const e=t=>t;function o(o){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=t(null),[u,i]=n((t,n)=>l(n),o),m=r(()=>{c.current&&i(c.current.value)},[]);return[u,m,c]}export{o as useUncontrolled};
1
+ import"client-only";import{useRef as t,useReducer as n,useCallback as r}from"react";const e=t=>t;function o(o){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=t(null),[u,i]=n((t,n)=>l(n),o);return[u,r(()=>{c.current&&i(c.current.value)},[]),c]}export{o as useUncontrolled};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),n=require("../noop/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs");const o=e=>e,r=(()=>{if("undefined"==typeof window)return e=>n.noop;let e=!1;const t=new Set,o=()=>{t.forEach(e=>e())};return n=>(t.add(n),e||(e=!0,window.addEventListener("hashchange",o)),()=>{t.delete(n)})})(),s=e=>"function"==typeof e;exports.unstable_useUrlHashState=function(n,a){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o;const i=t.useStableHandler(l);return[e.useSyncExternalStore(r,()=>{const e=new URLSearchParams(location.hash.slice(1)),t=e.get(n);return null!==t?l(t):a},()=>a),e.useCallback(e=>{let t;const o=location.hash,r=new URLSearchParams(o.slice(1));if(s(e)){const o=r.get(n);t=e(null!==o?i(o):a)}else t=e;t===a||void 0===t?r.delete(n):r.set(n,JSON.stringify(t));const l=r.toString();o!==l&&(location.hash=l)},[a,n,i])]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),n=require("../no-ssr/index.cjs");const t=e=>e,a=(()=>{if("undefined"==typeof window)return e=>r.noop;let e=!1;const n=new Set,t=()=>{n.forEach(e=>e())};return r=>(n.add(r),e||(e=!0,window.addEventListener("hashchange",t)),()=>{n.delete(r)})})(),l=e=>"function"==typeof e,o=()=>{throw n.noSSRError("useUrlHashState cannot be used on the server without a serverValue")};exports.unstable_useUrlHashState=function(r,n){var s;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:t,deserializer:t};const u=i.raw?t:i.serializer,c=i.raw?t:i.deserializer,d=void 0!==n?()=>u(n):o,h=e.useSyncExternalStore(a,()=>new URLSearchParams(location.hash.slice(1)).get(r),d),w=e.useMemo(()=>null===h?null!=n?n:null:c(h),[n,c,h]),S=e.useCallback(e=>{const t=location.hash,a=new URLSearchParams(t.slice(1)),o=l(e)?e(w):e;o===n||null===o?a.delete(r):a.set(r,u(o));const s=a.toString();t!==s&&(location.hash=s)},[n,w,r,u]);return[(s=null!=w?w:n)!==null&&void 0!==s?s:null,S]};
@@ -1,5 +1,15 @@
1
+ type NotUndefined<T> = T extends undefined ? never : T;
2
+ type Serializer<T> = (value: T) => string;
3
+ type Deserializer<T> = (value: string) => T;
4
+ interface UseUrlHashStateRawOption {
5
+ raw: true;
6
+ }
7
+ interface UseUrlHashStateParserOption<T> {
8
+ raw?: false;
9
+ serializer: Serializer<T>;
10
+ deserializer: Deserializer<T>;
11
+ }
1
12
  /** @see https://foxact.skk.moe/use-url-hash-state */
2
- declare function useUrlHashState<T>(key: string, defaultValue?: undefined): readonly [T | undefined, React.Dispatch<React.SetStateAction<T | undefined>>];
3
- declare function useUrlHashState<T>(key: string, defaultValue: T, transform?: (value: string) => T): readonly [T, React.Dispatch<React.SetStateAction<T>>];
13
+ declare function useUrlHashState<T>(key: string, defaultValue?: NotUndefined<T> | undefined, options?: UseUrlHashStateRawOption | UseUrlHashStateParserOption<T>): readonly [NonNullable<T> | null, (v: React.SetStateAction<T | null>) => void];
4
14
 
5
- export { useUrlHashState as unstable_useUrlHashState };
15
+ export { type Deserializer, type Serializer, type UseUrlHashStateParserOption, type UseUrlHashStateRawOption, useUrlHashState as unstable_useUrlHashState };
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),n=require("../noop/index.js"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js");const o=e=>e,r=(()=>{if("undefined"==typeof window)return e=>n.noop;let e=!1;const t=new Set,o=()=>{t.forEach(e=>e())};return n=>(t.add(n),e||(e=!0,window.addEventListener("hashchange",o)),()=>{t.delete(n)})})(),s=e=>"function"==typeof e;exports.unstable_useUrlHashState=function(n,a){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o;const i=t.useStableHandler(l);return[e.useSyncExternalStore(r,()=>{const e=new URLSearchParams(location.hash.slice(1)),t=e.get(n);return null!==t?l(t):a},()=>a),e.useCallback(e=>{let t;const o=location.hash,r=new URLSearchParams(o.slice(1));if(s(e)){const o=r.get(n);t=e(null!==o?i(o):a)}else t=e;t===a||void 0===t?r.delete(n):r.set(n,JSON.stringify(t));const l=r.toString();o!==l&&(location.hash=l)},[a,n,i])]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),n=require("../no-ssr/index.js");const t=e=>e,a=(()=>{if("undefined"==typeof window)return e=>r.noop;let e=!1;const n=new Set,t=()=>{n.forEach(e=>e())};return r=>(n.add(r),e||(e=!0,window.addEventListener("hashchange",t)),()=>{n.delete(r)})})(),l=e=>"function"==typeof e,o=()=>{throw n.noSSRError("useUrlHashState cannot be used on the server without a serverValue")};exports.unstable_useUrlHashState=function(r,n){var s;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:t,deserializer:t};const u=i.raw?t:i.serializer,c=i.raw?t:i.deserializer,d=void 0!==n?()=>u(n):o,h=e.useSyncExternalStore(a,()=>new URLSearchParams(location.hash.slice(1)).get(r),d),w=e.useMemo(()=>null===h?null!=n?n:null:c(h),[n,c,h]),S=e.useCallback(e=>{const t=location.hash,a=new URLSearchParams(t.slice(1)),o=l(e)?e(w):e;o===n||null===o?a.delete(r):a.set(r,u(o));const s=a.toString();t!==s&&(location.hash=s)},[n,w,r,u]);return[(s=null!=w?w:n)!==null&&void 0!==s?s:null,S]};
@@ -1 +1 @@
1
- import"client-only";import{useSyncExternalStore as e,useCallback as t}from"react";import{noop as n}from"../noop/index.mjs";import{useStableHandler as o}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";const r=e=>e,s=(()=>{if("undefined"==typeof window)return e=>n;let e=!1;const t=new Set,o=()=>{t.forEach(e=>e())};return n=>(t.add(n),e||(e=!0,window.addEventListener("hashchange",o)),()=>{t.delete(n)})})(),a=e=>"function"==typeof e;function i(n,i){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r;const c=o(l);return[e(s,()=>{const e=new URLSearchParams(location.hash.slice(1)),t=e.get(n);return null!==t?l(t):i},()=>i),t(e=>{let t;const o=location.hash,r=new URLSearchParams(o.slice(1));if(a(e)){const o=r.get(n);t=e(null!==o?c(o):i)}else t=e;t===i||void 0===t?r.delete(n):r.set(n,JSON.stringify(t));const s=r.toString();o!==s&&(location.hash=s)},[i,n,c])]}export{i as unstable_useUrlHashState};
1
+ import"client-only";import{useSyncExternalStore as e,useMemo as t,useCallback as n}from"react";import{noop as r}from"../noop/index.mjs";import{noSSRError as o}from"../no-ssr/index.mjs";const a=e=>e,l=(()=>{if("undefined"==typeof window)return e=>r;let e=!1;const t=new Set,n=()=>{t.forEach(e=>e())};return r=>(t.add(r),e||(e=!0,window.addEventListener("hashchange",n)),()=>{t.delete(r)})})(),s=e=>"function"==typeof e,i=()=>{throw o("useUrlHashState cannot be used on the server without a serverValue")};function u(r,o){var u;let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:a,deserializer:a};const h=c.raw?a:c.serializer,d=c.raw?a:c.deserializer,m=e(l,()=>new URLSearchParams(location.hash.slice(1)).get(r),void 0!==o?()=>h(o):i),w=t(()=>null===m?null!=o?o:null:d(m),[o,d,m]),f=n(e=>{const t=location.hash,n=new URLSearchParams(t.slice(1)),a=s(e)?e(w):e;a===o||null===a?n.delete(r):n.set(r,h(a));const l=n.toString();t!==l&&(location.hash=l)},[o,w,r,h]);return[(u=null!=w?w:o)!==null&&void 0!==u?u:null,f]}export{u as unstable_useUrlHashState};