foxact 0.3.8 → 0.3.9

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 (40) hide show
  1. package/browser/index.cjs +1 -0
  2. package/browser/index.d.ts +21 -0
  3. package/browser/index.mjs +1 -0
  4. package/create-storage-hook/index.cjs +1 -1
  5. package/create-storage-hook/index.mjs +1 -1
  6. package/fetch-jsonp/index.cjs +1 -1
  7. package/fetch-jsonp/index.mjs +1 -1
  8. package/is-safari/index.cjs +1 -1
  9. package/is-safari/index.mjs +1 -1
  10. package/merge-props/index.cjs +1 -1
  11. package/merge-props/index.mjs +1 -1
  12. package/no-ssr/index.cjs +1 -1
  13. package/no-ssr/index.d.ts +3 -1
  14. package/no-ssr/index.mjs +1 -1
  15. package/package.json +128 -119
  16. package/sizes.json +1 -1
  17. package/use/index.cjs +1 -1
  18. package/use/index.d.ts +21 -7
  19. package/use/index.mjs +1 -1
  20. package/use-abortable-effect/index.d.ts +1 -3
  21. package/use-clipboard/index.cjs +1 -1
  22. package/use-clipboard/index.mjs +1 -1
  23. package/use-component-will-receive-update/index.cjs +1 -1
  24. package/use-component-will-receive-update/index.mjs +1 -1
  25. package/use-debounced-state/index.cjs +1 -1
  26. package/use-debounced-state/index.mjs +1 -1
  27. package/use-is-client/index.cjs +1 -1
  28. package/use-is-client/index.mjs +1 -1
  29. package/use-is-online/index.cjs +1 -1
  30. package/use-is-online/index.mjs +1 -1
  31. package/use-media-query/index.cjs +1 -1
  32. package/use-media-query/index.mjs +1 -1
  33. package/use-page-visibility/index.cjs +1 -1
  34. package/use-page-visibility/index.mjs +1 -1
  35. package/use-readonly-search-params/index.cjs +1 -1
  36. package/use-readonly-search-params/index.mjs +1 -1
  37. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs +1 -1
  38. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs +1 -1
  39. package/use-url-hash-state/index.cjs +1 -1
  40. package/use-url-hash-state/index.mjs +1 -1
@@ -0,0 +1 @@
1
+ "use strict";var e,r=require("react-dom"),t=require("../no-ssr/index.cjs"),o=(e=Object.create(null),r&&Object.keys(r).forEach(function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e));const n="Browser-only rendering was requested by `browser()`.";function s(e){let r;if(void 0===e)return t.noSSRError(n);if("function"==typeof e)try{r=e()}catch(e){r="The reason for browser-only rendering could not be determined because its initializer threw."}else r=e;return t.noSSRError(n,void 0,{cause:r})}const i={status:"fulfilled",value:void 0,then:(e,r)=>Promise.resolve(void 0).then(e,r)},u="browser"in o&&"function"==typeof o.browser?o.browser:function(e){if("u"<typeof window){const r=s(e);return{status:"rejected",reason:r,then:(e,t)=>Promise.reject(r).then(e,t)}}return i};exports.browser=u,exports.browserBailoutError=s;
@@ -0,0 +1,21 @@
1
+ import { FulfilledReactPromise, RejectedReactPromise } from '../use/index.js';
2
+
3
+ /**
4
+ * Explains why the content has to render in the browser. It becomes the `cause`
5
+ * of the error reported by the server renderer. A function is only invoked by
6
+ * the server renderer and never in the browser, so pass one (e.g. `() => new
7
+ * Error('...')`) when creating the reason is expensive.
8
+ */
9
+ type BrowserReason = string | (() => unknown);
10
+ /**
11
+ * The opaque value returned by `browser()`. Pass it to `use()`, do not read
12
+ * it, await it, or throw it yourself.
13
+ */
14
+ type BrowserUsable = FulfilledReactPromise<undefined> | RejectedReactPromise<undefined>;
15
+ /** @private */
16
+ declare function browserBailoutError(reason?: BrowserReason): Error;
17
+ /** @see https://foxact.skk.moe/browser */
18
+ declare const browser: (reason?: BrowserReason) => BrowserUsable;
19
+
20
+ export { browser, browserBailoutError };
21
+ export type { BrowserReason, BrowserUsable };
@@ -0,0 +1 @@
1
+ import*as e from"react-dom";import{noSSRError as r}from"../no-ssr/index.mjs";const o="Browser-only rendering was requested by `browser()`.";function t(e){let t;if(void 0===e)return r(o);if("function"==typeof e)try{t=e()}catch(e){t="The reason for browser-only rendering could not be determined because its initializer threw."}else t=e;return r(o,void 0,{cause:t})}const n={status:"fulfilled",value:void 0,then:(e,r)=>Promise.resolve(void 0).then(e,r)},s="browser"in e&&"function"==typeof e.browser?e.browser:function(e){if("u"<typeof window){const r=t(e);return{status:"rejected",reason:r,then:(e,o)=>Promise.reject(r).then(e,o)}}return n};export{s as browser,t as browserBailoutError};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),t=require("../noop/index.cjs"),n=require("../use-isomorphic-layout-effect/index.cjs"),r=require("../no-ssr/index.cjs"),o=require("../chunks/index.b9dLwVor.cjs"),i=require("../chunks/index.BtiK5_Nn.cjs");exports.createStorage=function(a){const s="localStorage"===a?"foxact-use-local-storage":"foxact-use-session-storage",l="localStorage"===a?"foxact/use-local-storage":"foxact/use-session-storage";function c(){throw r.noSSRError("[".concat(l,"] cannot be used on the server without a serverValue"))}const u="u"<typeof window?t.noop:e=>{window.dispatchEvent(new CustomEvent(s,{detail:e}))},d="u"<typeof window?t.noop:(e,t)=>{try{window[a].setItem(e,t)}catch(e){console.warn("[".concat(l,"] Failed to set value to ").concat(a,", it might be blocked"))}finally{u(e)}},w="u"<typeof window?t.noop:e=>{try{window[a].removeItem(e)}catch(e){console.warn("[".concat(l,"] Failed to remove value from ").concat(a,", it might be blocked"))}finally{u(e)}},f=e=>{if("u"<typeof window)return null;try{return window[a].getItem(e)}catch(e){return console.warn("[".concat(l,"] Failed to get value from ").concat(a,", it might be blocked")),null}},v=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const r=n.raw?o.t:n.serializer,a=n.raw?o.t:n.deserializer;return e.useCallback(e=>{try{let n;if(i.n(e)){const r=f(t),o=null===r?null:a(r);n=e(o)}else n=e;null===n?w(t):d(t,r(n))}catch(e){console.warn(e)}},[t,r,a])};function g(r,i){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const l=e.useCallback(e=>{if("u"<typeof window)return t.noop;const n=t=>{"key"in t&&t.key!==r||e()},o=t=>{t.detail===r&&e()};return window.addEventListener("storage",n),window.addEventListener(s,o),()=>{window.removeEventListener("storage",n),window.removeEventListener(s,o)}},[r]),u=a.raw?o.t:a.serializer,w=a.raw?o.t:a.deserializer,v=void 0===i?c:()=>u(i),g=e.useSyncExternalStore(l,()=>f(r),v),y=e.useMemo(()=>null===g?null:w(g),[g,w]);return n.useLayoutEffect(()=>{null===f(r)&&void 0!==i&&d(r,u(i))},[r,u,i]),null===y?void 0===i?null:i:y}return{useStorageValue:g,useSetStorage:v,useStorage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};return[g(e,t,n),v(e,n)]}}};
1
+ "use strict";require("client-only");var e=require("react"),t=require("../noop/index.cjs"),n=require("../use-isomorphic-layout-effect/index.cjs"),r=require("../no-ssr/index.cjs"),o=require("../chunks/index.b9dLwVor.cjs"),i=require("../chunks/index.BtiK5_Nn.cjs");exports.createStorage=function(a){const s="localStorage"===a?"foxact-use-local-storage":"foxact-use-session-storage",l="localStorage"===a?"foxact/use-local-storage":"foxact/use-session-storage";function c(){throw r.noSSRError("[".concat(l,"] cannot be used on the server without a serverValue"))}const u="u"<typeof window?t.noop:e=>{window.dispatchEvent(new CustomEvent(s,{detail:e}))},d="u"<typeof window?t.noop:(e,t)=>{try{window[a].setItem(e,t)}catch(e){console.warn("[".concat(l,"] Failed to set value to ").concat(a,", it might be blocked"))}finally{u(e)}},w="u"<typeof window?t.noop:e=>{try{window[a].removeItem(e)}catch(e){console.warn("[".concat(l,"] Failed to remove value from ").concat(a,", it might be blocked"))}finally{u(e)}},f=e=>{if("u"<typeof window)return null;try{return window[a].getItem(e)}catch(e){return console.warn("[".concat(l,"] Failed to get value from ").concat(a,", it might be blocked")),null}},v=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const r=n.raw?o.t:n.serializer,a=n.raw?o.t:n.deserializer;return e.useCallback(e=>{try{let n;if(i.n(e)){const r=f(t),o=null===r?null:a(r);n=e(o)}else n=e;null===n?w(t):d(t,r(n))}catch(e){console.warn(e)}},[t,r,a])};function g(r,i){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const l=e.useCallback(e=>{if("u"<typeof window)return t.noop;const n=t=>{"key"in t&&t.key!==r||e()},o=t=>{t.detail===r&&e()};return window.addEventListener("storage",n),window.addEventListener(s,o),()=>{window.removeEventListener("storage",n),window.removeEventListener(s,o)}},[r]),u=a.raw?o.t:a.serializer,w=a.raw?o.t:a.deserializer,v=void 0===i?c:()=>u(i),g=e.useSyncExternalStore(l,()=>f(r),v),y=e.useMemo(()=>null===g?null:w(g),[g,w]);return n.useLayoutEffect(()=>{void 0!==i&&null===f(r)&&d(r,u(i))},[r,u,i]),null===y?void 0===i?null:i:y}return{useStorageValue:g,useSetStorage:v,useStorage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};return[g(e,t,n),v(e,n)]}}};
@@ -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{useLayoutEffect as r}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as i}from"../no-ssr/index.mjs";import{t as a}from"../chunks/index.D0KaUCcV.mjs";import{n as l}from"../chunks/index.C9-3oDdv.mjs";function s(s){const c="localStorage"===s?"foxact-use-local-storage":"foxact-use-session-storage",u="localStorage"===s?"foxact/use-local-storage":"foxact/use-session-storage";function d(){throw i("[".concat(u,"] cannot be used on the server without a serverValue"))}const w="u"<typeof window?n:e=>{window.dispatchEvent(new CustomEvent(c,{detail:e}))},f="u"<typeof window?n:(e,t)=>{try{window[s].setItem(e,t)}catch(e){console.warn("[".concat(u,"] Failed to set value to ").concat(s,", it might be blocked"))}finally{w(e)}},m="u"<typeof window?n:e=>{try{window[s].removeItem(e)}catch(e){console.warn("[".concat(u,"] Failed to remove value from ").concat(s,", it might be blocked"))}finally{w(e)}},g=e=>{if("u"<typeof window)return null;try{return window[s].getItem(e)}catch(e){return console.warn("[".concat(u,"] Failed to get value from ").concat(s,", it might be blocked")),null}},v=function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const n=o.raw?a:o.serializer,r=o.raw?a:o.deserializer;return e(e=>{try{let o;if(l(e)){const n=g(t),i=null===n?null:r(n);o=e(i)}else o=e;null===o?m(t):f(t,n(o))}catch(e){console.warn(e)}},[t,n,r])};function p(i,l){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const u=e(e=>{if("u"<typeof window)return n;const t=t=>{"key"in t&&t.key!==i||e()},o=t=>{t.detail===i&&e()};return window.addEventListener("storage",t),window.addEventListener(c,o),()=>{window.removeEventListener("storage",t),window.removeEventListener(c,o)}},[i]),w=s.raw?a:s.serializer,m=s.raw?a:s.deserializer,v=t(u,()=>g(i),void 0===l?d:()=>w(l)),p=o(()=>null===v?null:m(v),[v,m]);return r(()=>{null===g(i)&&void 0!==l&&f(i,w(l))},[i,w,l]),null===p?void 0===l?null:l:p}return{useStorageValue:p,useSetStorage:v,useStorage:function(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};return[p(e,t,o),v(e,o)]}}}export{s as createStorage};
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{useLayoutEffect as r}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as i}from"../no-ssr/index.mjs";import{t as a}from"../chunks/index.D0KaUCcV.mjs";import{n as l}from"../chunks/index.C9-3oDdv.mjs";function s(s){const c="localStorage"===s?"foxact-use-local-storage":"foxact-use-session-storage",u="localStorage"===s?"foxact/use-local-storage":"foxact/use-session-storage";function d(){throw i("[".concat(u,"] cannot be used on the server without a serverValue"))}const w="u"<typeof window?n:e=>{window.dispatchEvent(new CustomEvent(c,{detail:e}))},f="u"<typeof window?n:(e,t)=>{try{window[s].setItem(e,t)}catch(e){console.warn("[".concat(u,"] Failed to set value to ").concat(s,", it might be blocked"))}finally{w(e)}},m="u"<typeof window?n:e=>{try{window[s].removeItem(e)}catch(e){console.warn("[".concat(u,"] Failed to remove value from ").concat(s,", it might be blocked"))}finally{w(e)}},g=e=>{if("u"<typeof window)return null;try{return window[s].getItem(e)}catch(e){return console.warn("[".concat(u,"] Failed to get value from ").concat(s,", it might be blocked")),null}},v=function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const n=o.raw?a:o.serializer,r=o.raw?a:o.deserializer;return e(e=>{try{let o;if(l(e)){const n=g(t),i=null===n?null:r(n);o=e(i)}else o=e;null===o?m(t):f(t,n(o))}catch(e){console.warn(e)}},[t,n,r])};function p(i,l){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const u=e(e=>{if("u"<typeof window)return n;const t=t=>{"key"in t&&t.key!==i||e()},o=t=>{t.detail===i&&e()};return window.addEventListener("storage",t),window.addEventListener(c,o),()=>{window.removeEventListener("storage",t),window.removeEventListener(c,o)}},[i]),w=s.raw?a:s.serializer,m=s.raw?a:s.deserializer,v=t(u,()=>g(i),void 0===l?d:()=>w(l)),p=o(()=>null===v?null:m(v),[v,m]);return r(()=>{void 0!==l&&null===g(i)&&f(i,w(l))},[i,w,l]),null===p?void 0===l?null:l:p}return{useStorageValue:p,useSetStorage:v,useStorage:function(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};return[p(e,t,o),v(e,o)]}}}export{s as createStorage};
@@ -1 +1 @@
1
- "use strict";const e="__foxact_jsonp_callbacks__SECRET_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED";exports.fetchJsonp=function(o,n){if("u"<typeof window)throw TypeError("fetchJsonp is only available in the browser");window[e]||Object.defineProperty(window,e,{value:{},writable:!0,configurable:!0,enumerable:!1});const t="__".concat(Date.now(),"_").concat(Math.random().toString().slice(2),"__"),r="window.".concat(e,".").concat(t);if(Object.prototype.hasOwnProperty.call(window[e],t))throw TypeError("Callback name conflict: ".concat(t));const c=o(r);return new Promise((o,r)=>{const a=document.createElement("script");a.src=c,a.async=!0,n&&Object.assign(a,n);const i=()=>{a.removeEventListener("error",s),a.remove(),window[e][t]&&delete window[e][t]};function s(){i(),r(Error("Failed to load script: ".concat(c)))}a.addEventListener("error",s),window[e][t]=e=>{i(),o(e)},document.body.append(a)})};
1
+ "use strict";var e=require("../invariant/index.cjs");const n="__foxact_jsonp_callbacks__SECRET_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED";exports.fetchJsonp=function(o,t){e.invariant("u">typeof window,"fetchJsonp is only available in the browser"),window[n]||Object.defineProperty(window,n,{value:{},writable:!0,configurable:!0,enumerable:!1});const r="__".concat(Date.now(),"_").concat(Math.random().toString().slice(2),"__"),c="window.".concat(n,".").concat(r);if(Object.prototype.hasOwnProperty.call(window[n],r))throw TypeError("Callback name conflict: ".concat(r));const a=o(c);return new Promise((e,o)=>{const c=document.createElement("script");c.src=a,c.async=!0,t&&Object.assign(c,t);const i=()=>{c.removeEventListener("error",s),c.remove(),window[n][r]&&delete window[n][r]};function s(){i(),o(Error("Failed to load script: ".concat(a)))}c.addEventListener("error",s),window[n][r]=n=>{i(),e(n)},document.body.append(c)})};
@@ -1 +1 @@
1
- const o="__foxact_jsonp_callbacks__SECRET_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED";function e(e,n){if("u"<typeof window)throw TypeError("fetchJsonp is only available in the browser");window[o]||Object.defineProperty(window,o,{value:{},writable:!0,configurable:!0,enumerable:!1});const t="__".concat(Date.now(),"_").concat(Math.random().toString().slice(2),"__"),r="window.".concat(o,".").concat(t);if(Object.prototype.hasOwnProperty.call(window[o],t))throw TypeError("Callback name conflict: ".concat(t));const c=e(r);return new Promise((e,r)=>{const a=document.createElement("script");a.src=c,a.async=!0,n&&Object.assign(a,n);const i=()=>{a.removeEventListener("error",w),a.remove(),window[o][t]&&delete window[o][t]};function w(){i(),r(Error("Failed to load script: ".concat(c)))}a.addEventListener("error",w),window[o][t]=o=>{i(),e(o)},document.body.append(a)})}export{e as fetchJsonp};
1
+ import{invariant as o}from"../invariant/index.mjs";const e="__foxact_jsonp_callbacks__SECRET_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED";function n(n,t){o("u">typeof window,"fetchJsonp is only available in the browser"),window[e]||Object.defineProperty(window,e,{value:{},writable:!0,configurable:!0,enumerable:!1});const c="__".concat(Date.now(),"_").concat(Math.random().toString().slice(2),"__"),r="window.".concat(e,".").concat(c);if(Object.prototype.hasOwnProperty.call(window[e],c))throw TypeError("Callback name conflict: ".concat(c));const a=n(r);return new Promise((o,n)=>{const r=document.createElement("script");r.src=a,r.async=!0,t&&Object.assign(r,t);const i=()=>{r.removeEventListener("error",s),r.remove(),window[e][c]&&delete window[e][c]};function s(){i(),n(Error("Failed to load script: ".concat(a)))}r.addEventListener("error",s),window[e][c]=e=>{i(),o(e)},document.body.append(r)})}export{n as fetchJsonp};
@@ -1 +1 @@
1
- "use strict";exports.isSafari=function(){return!("u"<typeof window||"u"<typeof navigator)&&"string"==typeof navigator.userAgent&&!!(/version\/[\d._].*?safari/i.test(navigator.userAgent)||/mobile safari [\d._]+/i.test(navigator.userAgent))};
1
+ "use strict";const t=/version\/[\d._].*?safari/i,e=/mobile safari [\d._]+/i;exports.isSafari=function(){return!("u"<typeof window||"u"<typeof navigator)&&"string"==typeof navigator.userAgent&&!!(t.test(navigator.userAgent)||e.test(navigator.userAgent))};
@@ -1 +1 @@
1
- function t(){return!("u"<typeof window||"u"<typeof navigator)&&"string"==typeof navigator.userAgent&&!!(/version\/[\d._].*?safari/i.test(navigator.userAgent)||/mobile safari [\d._]+/i.test(navigator.userAgent))}export{t as isSafari};
1
+ const t=/version\/[\d._].*?safari/i,e=/mobile safari [\d._]+/i;function i(){return!("u"<typeof window||"u"<typeof navigator)&&"string"==typeof navigator.userAgent&&!!(t.test(navigator.userAgent)||e.test(navigator.userAgent))}export{i as isSafari};
@@ -1 +1 @@
1
- "use strict";const t={};function r(t){return"function"==typeof t}function n(n,e){return r(n)?n(e):null!=n?n:t}exports.mergeProps=function(){for(var e,o,c,s=arguments.length,u=Array(s),a=0;a<s;a++)u[a]=arguments[a];const f=1===u.length&&Array.isArray(u[0])?u[0]:u;if(0===f.length)return t;let l=r(e=f[0])?{...n(e,t)}:{...e};if(1===f.length)return l;for(let t=1,e=f.length;t<e;t+=1){f[t]&&(o=l,l=r(c=f[t])?n(c,o):function(t,r){if(!r)return t;const n=Object.keys(r);for(let c=0;c<n.length;c++){const s=n[c],u=r[s];switch(s){case"style":{const r=t.style;r&&!u?t[s]=r:!r&&u?t[s]=u:(r||u)&&(t[s]={...r,...u});break}case"className":var e,o;t[s]=(e=t.className,(o=u)?e?o+" "+e:o:e);break;default:!function(t,r){const n=t.charCodeAt(0),e=t.charCodeAt(1),o=t.charCodeAt(2);return 111===n&&110===e&&o>=65&&o<=90&&("function"==typeof r||void 0===r)}(s,u)?t[s]=u:t[s]=function(t,r){return r?t?function(){for(var n=arguments.length,e=Array(n),o=0;o<n;o++)e[o]=arguments[o];const c=r(...e);return t(...e),c}:r:t}(t[s],u)}}return t}(o,c))}return l};
1
+ "use strict";const t={};function r(t){return"function"==typeof t}function n(n,e){return r(n)?n(e):null!=n?n:t}exports.mergeProps=function(){for(var e,o,c,s=arguments.length,u=Array(s),a=0;a<s;a++)u[a]=arguments[a];const f=1===u.length&&Array.isArray(u[0])?u[0]:u;if(0===f.length)return t;let l=r(e=f[0])?{...n(e,t)}:{...e};if(1===f.length)return l;for(let t=1,e=f.length;t<e;t+=1){f[t]&&(o=l,l=r(c=f[t])?n(c,o):function(t,r){if(!r)return t;const n=Object.keys(r);for(let c=0,s=n.length;c<s;c++){const s=n[c],u=r[s];switch(s){case"style":{const r=t.style;r&&!u?t[s]=r:!r&&u?t[s]=u:(r||u)&&(t[s]={...r,...u});break}case"className":var e,o;t[s]=(e=t.className,(o=u)?e?o+" "+e:o:e);break;default:!function(t,r){const n=t.charCodeAt(0),e=t.charCodeAt(1),o=t.charCodeAt(2);return 111===n&&110===e&&o>=65&&o<=90&&("function"==typeof r||void 0===r)}(s,u)?t[s]=u:t[s]=function(t,r){return r?t?function(){for(var n=arguments.length,e=Array(n),o=0;o<n;o++)e[o]=arguments[o];const c=r(...e);return t(...e),c}:r:t}(t[s],u)}}return t}(o,c))}return l};
@@ -1 +1 @@
1
- const t={};function n(){for(var n,o,c,u=arguments.length,a=Array(u),f=0;f<u;f++)a[f]=arguments[f];const s=1===a.length&&Array.isArray(a[0])?a[0]:a;if(0===s.length)return t;let l=r(n=s[0])?{...e(n,t)}:{...n};if(1===s.length)return l;for(let t=1,n=s.length;t<n;t+=1){s[t]&&(o=l,l=r(c=s[t])?e(c,o):function(t,n){if(!n)return t;const r=Object.keys(n);for(let c=0;c<r.length;c++){const u=r[c],a=n[u];switch(u){case"style":{const n=t.style;n&&!a?t[u]=n:!n&&a?t[u]=a:(n||a)&&(t[u]={...n,...a});break}case"className":var e,o;t[u]=(e=t.className,(o=a)?e?o+" "+e:o:e);break;default:!function(t,n){const r=t.charCodeAt(0),e=t.charCodeAt(1),o=t.charCodeAt(2);return 111===r&&110===e&&o>=65&&o<=90&&("function"==typeof n||void 0===n)}(u,a)?t[u]=a:t[u]=function(t,n){return n?t?function(){for(var r=arguments.length,e=Array(r),o=0;o<r;o++)e[o]=arguments[o];const c=n(...e);return t(...e),c}:n:t}(t[u],a)}}return t}(o,c))}return l}function r(t){return"function"==typeof t}function e(n,e){return r(n)?n(e):null!=n?n:t}export{n as mergeProps};
1
+ const t={};function n(){for(var n,o,c,u=arguments.length,a=Array(u),f=0;f<u;f++)a[f]=arguments[f];const s=1===a.length&&Array.isArray(a[0])?a[0]:a;if(0===s.length)return t;let l=r(n=s[0])?{...e(n,t)}:{...n};if(1===s.length)return l;for(let t=1,n=s.length;t<n;t+=1){s[t]&&(o=l,l=r(c=s[t])?e(c,o):function(t,n){if(!n)return t;const r=Object.keys(n);for(let c=0,u=r.length;c<u;c++){const u=r[c],a=n[u];switch(u){case"style":{const n=t.style;n&&!a?t[u]=n:!n&&a?t[u]=a:(n||a)&&(t[u]={...n,...a});break}case"className":var e,o;t[u]=(e=t.className,(o=a)?e?o+" "+e:o:e);break;default:!function(t,n){const r=t.charCodeAt(0),e=t.charCodeAt(1),o=t.charCodeAt(2);return 111===r&&110===e&&o>=65&&o<=90&&("function"==typeof n||void 0===n)}(u,a)?t[u]=a:t[u]=function(t,n){return n?t?function(){for(var r=arguments.length,e=Array(r),o=0;o<r;o++)e[o]=arguments[o];const c=n(...e);return t(...e),c}:n:t}(t[u],a)}}return t}(o,c))}return l}function r(t){return"function"==typeof t}function e(n,e){return r(n)?n(e):null!=n?n:t}export{n as mergeProps};
package/no-ssr/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var r=require("../create-stackless-error/index.cjs");function e(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const t=r.createStacklessError(()=>Error(e));return t.digest=o,t.recoverableError="NO_SSR",t}exports.noSSR=function(r){if("u"<typeof window)throw e(r)},exports.noSSRError=e;
1
+ "use strict";var r=require("../create-stackless-error/index.cjs");function e(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING",t=arguments.length>2?arguments[2]:void 0;const n=r.createStacklessError(()=>Error(e,t));return n.digest=o,n.recoverableError="NO_SSR",n}exports.noSSR=function(r){if("u"<typeof window)throw e(r)},exports.noSSRError=e;
package/no-ssr/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  /** @private */
2
- declare function noSSRError(errorMessage?: string, nextjsDigest?: string): Error;
2
+ declare function noSSRError(errorMessage?: string, nextjsDigest?: string, errorOptions?: {
3
+ cause?: unknown;
4
+ }): Error;
3
5
  /** @see https://foxact.skk.moe/no-ssr */
4
6
  declare function noSSR(extraMessage?: string): void;
5
7
 
package/no-ssr/index.mjs CHANGED
@@ -1 +1 @@
1
- import{createStacklessError as r}from"../create-stackless-error/index.mjs";function o(o){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING";const t=r(()=>Error(o));return t.digest=e,t.recoverableError="NO_SSR",t}function e(r){if("u"<typeof window)throw o(r)}export{e as noSSR,o as noSSRError};
1
+ import{createStacklessError as r}from"../create-stackless-error/index.mjs";function o(o){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BAILOUT_TO_CLIENT_SIDE_RENDERING",t=arguments.length>2?arguments[2]:void 0;const n=r(()=>Error(o,t));return n.digest=e,n.recoverableError="NO_SSR",n}function e(r){if("u"<typeof window)throw o(r)}export{e as noSSR,o as noSSRError};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
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,7 +22,7 @@
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "client-only": "^0.0.1",
25
- "event-target-bus": "^1.0.0",
25
+ "event-target-bus": "^1.1.0",
26
26
  "server-only": "^0.0.1"
27
27
  },
28
28
  "peerDependencies": {
@@ -61,14 +61,32 @@
61
61
  "require": "./breadcrumbs/index.cjs",
62
62
  "default": "./breadcrumbs/index.cjs"
63
63
  },
64
- "./compose-context-provider": {
65
- "types": "./compose-context-provider/index.d.ts",
64
+ "./browser": {
65
+ "types": "./browser/index.d.ts",
66
66
  "import": {
67
- "types": "./compose-context-provider/index.d.ts",
68
- "default": "./compose-context-provider/index.mjs"
67
+ "types": "./browser/index.d.ts",
68
+ "default": "./browser/index.mjs"
69
69
  },
70
- "require": "./compose-context-provider/index.cjs",
71
- "default": "./compose-context-provider/index.cjs"
70
+ "require": "./browser/index.cjs",
71
+ "default": "./browser/index.cjs"
72
+ },
73
+ "./context-reducer": {
74
+ "types": "./context-reducer/index.d.ts",
75
+ "import": {
76
+ "types": "./context-reducer/index.d.ts",
77
+ "default": "./context-reducer/index.mjs"
78
+ },
79
+ "require": "./context-reducer/index.cjs",
80
+ "default": "./context-reducer/index.cjs"
81
+ },
82
+ "./context-state": {
83
+ "types": "./context-state/index.d.ts",
84
+ "import": {
85
+ "types": "./context-state/index.d.ts",
86
+ "default": "./context-state/index.mjs"
87
+ },
88
+ "require": "./context-state/index.cjs",
89
+ "default": "./context-state/index.cjs"
72
90
  },
73
91
  "./create-context-reducer": {
74
92
  "types": "./create-context-reducer/index.d.ts",
@@ -79,14 +97,23 @@
79
97
  "require": "./create-context-reducer/index.cjs",
80
98
  "default": "./create-context-reducer/index.cjs"
81
99
  },
82
- "./context-reducer": {
83
- "types": "./context-reducer/index.d.ts",
100
+ "./create-breadcrumbs": {
101
+ "types": "./create-breadcrumbs/index.d.ts",
84
102
  "import": {
85
- "types": "./context-reducer/index.d.ts",
86
- "default": "./context-reducer/index.mjs"
103
+ "types": "./create-breadcrumbs/index.d.ts",
104
+ "default": "./create-breadcrumbs/index.mjs"
87
105
  },
88
- "require": "./context-reducer/index.cjs",
89
- "default": "./context-reducer/index.cjs"
106
+ "require": "./create-breadcrumbs/index.cjs",
107
+ "default": "./create-breadcrumbs/index.cjs"
108
+ },
109
+ "./compose-context-provider": {
110
+ "types": "./compose-context-provider/index.d.ts",
111
+ "import": {
112
+ "types": "./compose-context-provider/index.d.ts",
113
+ "default": "./compose-context-provider/index.mjs"
114
+ },
115
+ "require": "./compose-context-provider/index.cjs",
116
+ "default": "./compose-context-provider/index.cjs"
90
117
  },
91
118
  "./create-context-state": {
92
119
  "types": "./create-context-state/index.d.ts",
@@ -97,15 +124,6 @@
97
124
  "require": "./create-context-state/index.cjs",
98
125
  "default": "./create-context-state/index.cjs"
99
126
  },
100
- "./context-state": {
101
- "types": "./context-state/index.d.ts",
102
- "import": {
103
- "types": "./context-state/index.d.ts",
104
- "default": "./context-state/index.mjs"
105
- },
106
- "require": "./context-state/index.cjs",
107
- "default": "./context-state/index.cjs"
108
- },
109
127
  "./create-fixed-array": {
110
128
  "types": "./create-fixed-array/index.d.ts",
111
129
  "import": {
@@ -133,15 +151,6 @@
133
151
  "require": "./create-magic-portal/index.cjs",
134
152
  "default": "./create-magic-portal/index.cjs"
135
153
  },
136
- "./create-breadcrumbs": {
137
- "types": "./create-breadcrumbs/index.d.ts",
138
- "import": {
139
- "types": "./create-breadcrumbs/index.d.ts",
140
- "default": "./create-breadcrumbs/index.mjs"
141
- },
142
- "require": "./create-breadcrumbs/index.cjs",
143
- "default": "./create-breadcrumbs/index.cjs"
144
- },
145
154
  "./create-session-storage-state": {
146
155
  "types": "./create-session-storage-state/index.d.ts",
147
156
  "import": {
@@ -169,15 +178,6 @@
169
178
  "require": "./create-storage-hook/index.cjs",
170
179
  "default": "./create-storage-hook/index.cjs"
171
180
  },
172
- "./create-storage-state-factory": {
173
- "types": "./create-storage-state-factory/index.d.ts",
174
- "import": {
175
- "types": "./create-storage-state-factory/index.d.ts",
176
- "default": "./create-storage-state-factory/index.mjs"
177
- },
178
- "require": "./create-storage-state-factory/index.cjs",
179
- "default": "./create-storage-state-factory/index.cjs"
180
- },
181
181
  "./current-year": {
182
182
  "types": "./current-year/index.d.ts",
183
183
  "import": {
@@ -205,15 +205,6 @@
205
205
  "require": "./invariant/index.cjs",
206
206
  "default": "./invariant/index.cjs"
207
207
  },
208
- "./magic-portal": {
209
- "types": "./magic-portal/index.d.ts",
210
- "import": {
211
- "types": "./magic-portal/index.d.ts",
212
- "default": "./magic-portal/index.mjs"
213
- },
214
- "require": "./magic-portal/index.cjs",
215
- "default": "./magic-portal/index.cjs"
216
- },
217
208
  "./is-safari": {
218
209
  "types": "./is-safari/index.d.ts",
219
210
  "import": {
@@ -223,6 +214,15 @@
223
214
  "require": "./is-safari/index.cjs",
224
215
  "default": "./is-safari/index.cjs"
225
216
  },
217
+ "./magic-portal": {
218
+ "types": "./magic-portal/index.d.ts",
219
+ "import": {
220
+ "types": "./magic-portal/index.d.ts",
221
+ "default": "./magic-portal/index.mjs"
222
+ },
223
+ "require": "./magic-portal/index.cjs",
224
+ "default": "./magic-portal/index.cjs"
225
+ },
226
226
  "./merge-props": {
227
227
  "types": "./merge-props/index.d.ts",
228
228
  "import": {
@@ -241,15 +241,6 @@
241
241
  "require": "./merge-refs/index.cjs",
242
242
  "default": "./merge-refs/index.cjs"
243
243
  },
244
- "./noop": {
245
- "types": "./noop/index.d.ts",
246
- "import": {
247
- "types": "./noop/index.d.ts",
248
- "default": "./noop/index.mjs"
249
- },
250
- "require": "./noop/index.cjs",
251
- "default": "./noop/index.cjs"
252
- },
253
244
  "./no-ssr": {
254
245
  "types": "./no-ssr/index.d.ts",
255
246
  "import": {
@@ -259,14 +250,14 @@
259
250
  "require": "./no-ssr/index.cjs",
260
251
  "default": "./no-ssr/index.cjs"
261
252
  },
262
- "./nullthrow": {
263
- "types": "./nullthrow/index.d.ts",
253
+ "./noop": {
254
+ "types": "./noop/index.d.ts",
264
255
  "import": {
265
- "types": "./nullthrow/index.d.ts",
266
- "default": "./nullthrow/index.mjs"
256
+ "types": "./noop/index.d.ts",
257
+ "default": "./noop/index.mjs"
267
258
  },
268
- "require": "./nullthrow/index.cjs",
269
- "default": "./nullthrow/index.cjs"
259
+ "require": "./noop/index.cjs",
260
+ "default": "./noop/index.cjs"
270
261
  },
271
262
  "./noop-component": {
272
263
  "types": "./noop-component/index.d.ts",
@@ -286,6 +277,24 @@
286
277
  "require": "./open-new-tab/index.cjs",
287
278
  "default": "./open-new-tab/index.cjs"
288
279
  },
280
+ "./nullthrow": {
281
+ "types": "./nullthrow/index.d.ts",
282
+ "import": {
283
+ "types": "./nullthrow/index.d.ts",
284
+ "default": "./nullthrow/index.mjs"
285
+ },
286
+ "require": "./nullthrow/index.cjs",
287
+ "default": "./nullthrow/index.cjs"
288
+ },
289
+ "./create-storage-state-factory": {
290
+ "types": "./create-storage-state-factory/index.d.ts",
291
+ "import": {
292
+ "types": "./create-storage-state-factory/index.d.ts",
293
+ "default": "./create-storage-state-factory/index.mjs"
294
+ },
295
+ "require": "./create-storage-state-factory/index.cjs",
296
+ "default": "./create-storage-state-factory/index.cjs"
297
+ },
289
298
  "./polymorphic": {
290
299
  "types": "./polymorphic/index.d.ts",
291
300
  "import": {
@@ -322,6 +331,15 @@
322
331
  "require": "./types/index.cjs",
323
332
  "default": "./types/index.cjs"
324
333
  },
334
+ "./typescript-happy-forward-ref": {
335
+ "types": "./typescript-happy-forward-ref/index.d.ts",
336
+ "import": {
337
+ "types": "./typescript-happy-forward-ref/index.d.ts",
338
+ "default": "./typescript-happy-forward-ref/index.mjs"
339
+ },
340
+ "require": "./typescript-happy-forward-ref/index.cjs",
341
+ "default": "./typescript-happy-forward-ref/index.cjs"
342
+ },
325
343
  "./use": {
326
344
  "types": "./use/index.d.ts",
327
345
  "import": {
@@ -331,14 +349,14 @@
331
349
  "require": "./use/index.cjs",
332
350
  "default": "./use/index.cjs"
333
351
  },
334
- "./typescript-happy-forward-ref": {
335
- "types": "./typescript-happy-forward-ref/index.d.ts",
352
+ "./use-array": {
353
+ "types": "./use-array/index.d.ts",
336
354
  "import": {
337
- "types": "./typescript-happy-forward-ref/index.d.ts",
338
- "default": "./typescript-happy-forward-ref/index.mjs"
355
+ "types": "./use-array/index.d.ts",
356
+ "default": "./use-array/index.mjs"
339
357
  },
340
- "require": "./typescript-happy-forward-ref/index.cjs",
341
- "default": "./typescript-happy-forward-ref/index.cjs"
358
+ "require": "./use-array/index.cjs",
359
+ "default": "./use-array/index.cjs"
342
360
  },
343
361
  "./use-abortable-effect": {
344
362
  "types": "./use-abortable-effect/index.d.ts",
@@ -358,15 +376,6 @@
358
376
  "require": "./use-clipboard/index.cjs",
359
377
  "default": "./use-clipboard/index.cjs"
360
378
  },
361
- "./use-array": {
362
- "types": "./use-array/index.d.ts",
363
- "import": {
364
- "types": "./use-array/index.d.ts",
365
- "default": "./use-array/index.mjs"
366
- },
367
- "require": "./use-array/index.cjs",
368
- "default": "./use-array/index.cjs"
369
- },
370
379
  "./use-component-will-receive-update": {
371
380
  "types": "./use-component-will-receive-update/index.d.ts",
372
381
  "import": {
@@ -412,15 +421,6 @@
412
421
  "require": "./use-error-boundary/index.cjs",
413
422
  "default": "./use-error-boundary/index.cjs"
414
423
  },
415
- "./use-fast-click": {
416
- "types": "./use-fast-click/index.d.ts",
417
- "import": {
418
- "types": "./use-fast-click/index.d.ts",
419
- "default": "./use-fast-click/index.mjs"
420
- },
421
- "require": "./use-fast-click/index.cjs",
422
- "default": "./use-fast-click/index.cjs"
423
- },
424
424
  "./use-is-client": {
425
425
  "types": "./use-is-client/index.d.ts",
426
426
  "import": {
@@ -439,6 +439,15 @@
439
439
  "require": "./use-intersection/index.cjs",
440
440
  "default": "./use-intersection/index.cjs"
441
441
  },
442
+ "./use-fast-click": {
443
+ "types": "./use-fast-click/index.d.ts",
444
+ "import": {
445
+ "types": "./use-fast-click/index.d.ts",
446
+ "default": "./use-fast-click/index.mjs"
447
+ },
448
+ "require": "./use-fast-click/index.cjs",
449
+ "default": "./use-fast-click/index.cjs"
450
+ },
442
451
  "./use-is-online": {
443
452
  "types": "./use-is-online/index.d.ts",
444
453
  "import": {
@@ -448,15 +457,6 @@
448
457
  "require": "./use-is-online/index.cjs",
449
458
  "default": "./use-is-online/index.cjs"
450
459
  },
451
- "./use-isomorphic-layout-effect": {
452
- "types": "./use-isomorphic-layout-effect/index.d.ts",
453
- "import": {
454
- "types": "./use-isomorphic-layout-effect/index.d.ts",
455
- "default": "./use-isomorphic-layout-effect/index.mjs"
456
- },
457
- "require": "./use-isomorphic-layout-effect/index.cjs",
458
- "default": "./use-isomorphic-layout-effect/index.cjs"
459
- },
460
460
  "./use-local-storage": {
461
461
  "types": "./use-local-storage/index.d.ts",
462
462
  "import": {
@@ -466,6 +466,15 @@
466
466
  "require": "./use-local-storage/index.cjs",
467
467
  "default": "./use-local-storage/index.cjs"
468
468
  },
469
+ "./use-isomorphic-layout-effect": {
470
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
471
+ "import": {
472
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
473
+ "default": "./use-isomorphic-layout-effect/index.mjs"
474
+ },
475
+ "require": "./use-isomorphic-layout-effect/index.cjs",
476
+ "default": "./use-isomorphic-layout-effect/index.cjs"
477
+ },
469
478
  "./use-media-query": {
470
479
  "types": "./use-media-query/index.d.ts",
471
480
  "import": {
@@ -511,14 +520,14 @@
511
520
  "require": "./use-resizing/index.cjs",
512
521
  "default": "./use-resizing/index.cjs"
513
522
  },
514
- "./use-retimer": {
515
- "types": "./use-retimer/index.d.ts",
523
+ "./use-set": {
524
+ "types": "./use-set/index.d.ts",
516
525
  "import": {
517
- "types": "./use-retimer/index.d.ts",
518
- "default": "./use-retimer/index.mjs"
526
+ "types": "./use-set/index.d.ts",
527
+ "default": "./use-set/index.mjs"
519
528
  },
520
- "require": "./use-retimer/index.cjs",
521
- "default": "./use-retimer/index.cjs"
529
+ "require": "./use-set/index.cjs",
530
+ "default": "./use-set/index.cjs"
522
531
  },
523
532
  "./use-session-storage": {
524
533
  "types": "./use-session-storage/index.d.ts",
@@ -529,14 +538,14 @@
529
538
  "require": "./use-session-storage/index.cjs",
530
539
  "default": "./use-session-storage/index.cjs"
531
540
  },
532
- "./use-set": {
533
- "types": "./use-set/index.d.ts",
541
+ "./use-retimer": {
542
+ "types": "./use-retimer/index.d.ts",
534
543
  "import": {
535
- "types": "./use-set/index.d.ts",
536
- "default": "./use-set/index.mjs"
544
+ "types": "./use-retimer/index.d.ts",
545
+ "default": "./use-retimer/index.mjs"
537
546
  },
538
- "require": "./use-set/index.cjs",
539
- "default": "./use-set/index.cjs"
547
+ "require": "./use-retimer/index.cjs",
548
+ "default": "./use-retimer/index.cjs"
540
549
  },
541
550
  "./use-singleton": {
542
551
  "types": "./use-singleton/index.d.ts",
@@ -565,15 +574,6 @@
565
574
  "require": "./use-state-with-deps/index.cjs",
566
575
  "default": "./use-state-with-deps/index.cjs"
567
576
  },
568
- "./use-typescript-happy-callback": {
569
- "types": "./use-typescript-happy-callback/index.d.ts",
570
- "import": {
571
- "types": "./use-typescript-happy-callback/index.d.ts",
572
- "default": "./use-typescript-happy-callback/index.mjs"
573
- },
574
- "require": "./use-typescript-happy-callback/index.cjs",
575
- "default": "./use-typescript-happy-callback/index.cjs"
576
- },
577
577
  "./use-uncontrolled": {
578
578
  "types": "./use-uncontrolled/index.d.ts",
579
579
  "import": {
@@ -583,6 +583,15 @@
583
583
  "require": "./use-uncontrolled/index.cjs",
584
584
  "default": "./use-uncontrolled/index.cjs"
585
585
  },
586
+ "./use-typescript-happy-callback": {
587
+ "types": "./use-typescript-happy-callback/index.d.ts",
588
+ "import": {
589
+ "types": "./use-typescript-happy-callback/index.d.ts",
590
+ "default": "./use-typescript-happy-callback/index.mjs"
591
+ },
592
+ "require": "./use-typescript-happy-callback/index.cjs",
593
+ "default": "./use-typescript-happy-callback/index.cjs"
594
+ },
586
595
  "./use-url-hash-state": {
587
596
  "types": "./use-url-hash-state/index.d.ts",
588
597
  "import": {
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":28045,"gzip":17127,"br":14398,"zstd":17172},"exports":{"create-context-reducer":{"raw":63,"gzip":74,"br":64,"zstd":72},"compose-context-provider":{"raw":177,"gzip":155,"br":122,"zstd":144},"breadcrumbs":{"raw":879,"gzip":467,"br":395,"zstd":472},"create-context-state":{"raw":59,"gzip":72,"br":59,"zstd":68},"context-reducer":{"raw":557,"gzip":332,"br":319,"zstd":336},"context-state":{"raw":402,"gzip":259,"br":218,"zstd":259},"create-fixed-array":{"raw":452,"gzip":282,"br":248,"zstd":282},"create-magic-portal":{"raw":57,"gzip":71,"br":53,"zstd":66},"create-breadcrumbs":{"raw":56,"gzip":68,"br":52,"zstd":65},"create-local-storage-state":{"raw":169,"gzip":138,"br":111,"zstd":130},"create-session-storage-state":{"raw":173,"gzip":138,"br":108,"zstd":129},"create-stackless-error":{"raw":278,"gzip":198,"br":162,"zstd":188},"fetch-jsonp":{"raw":890,"gzip":546,"br":429,"zstd":552},"current-year":{"raw":508,"gzip":348,"br":283,"zstd":349},"invariant":{"raw":178,"gzip":156,"br":118,"zstd":149},"magic-portal":{"raw":1013,"gzip":517,"br":445,"zstd":526},"create-storage-state-factory":{"raw":364,"gzip":248,"br":197,"zstd":243},"create-storage-hook":{"raw":2418,"gzip":955,"br":834,"zstd":998},"is-safari":{"raw":233,"gzip":164,"br":119,"zstd":156},"merge-props":{"raw":1026,"gzip":556,"br":497,"zstd":575},"noop":{"raw":33,"gzip":53,"br":37,"zstd":42},"merge-refs":{"raw":525,"gzip":280,"br":235,"zstd":278},"no-ssr":{"raw":338,"gzip":267,"br":219,"zstd":268},"nullthrow":{"raw":187,"gzip":163,"br":121,"zstd":156},"noop-component":{"raw":142,"gzip":130,"br":111,"zstd":119},"polymorphic":{"raw":284,"gzip":212,"br":180,"zstd":199},"open-new-tab":{"raw":335,"gzip":255,"br":187,"zstd":255},"rem":{"raw":823,"gzip":395,"br":350,"zstd":402},"types":{"raw":0,"gzip":20,"br":1,"zstd":9},"request-idle-callback":{"raw":392,"gzip":221,"br":171,"zstd":213},"use":{"raw":298,"gzip":197,"br":160,"zstd":190},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80,"zstd":91},"use-abortable-effect":{"raw":215,"gzip":170,"br":144,"zstd":166},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154,"zstd":178},"use-array":{"raw":334,"gzip":243,"br":206,"zstd":236},"use-composition-input":{"raw":470,"gzip":286,"br":241,"zstd":296},"use-debounced-state":{"raw":401,"gzip":280,"br":242,"zstd":286},"use-error-boundary":{"raw":252,"gzip":195,"br":165,"zstd":187},"use-debounced-value":{"raw":553,"gzip":358,"br":320,"zstd":360},"use-fast-click":{"raw":499,"gzip":350,"br":284,"zstd":355},"use-is-client":{"raw":204,"gzip":153,"br":121,"zstd":148},"use-is-online":{"raw":370,"gzip":258,"br":220,"zstd":257},"use-isomorphic-layout-effect":{"raw":169,"gzip":137,"br":110,"zstd":127},"use-local-storage":{"raw":192,"gzip":143,"br":114,"zstd":137},"use-clipboard":{"raw":2723,"gzip":1332,"br":1140,"zstd":1397},"use-media-query":{"raw":604,"gzip":380,"br":315,"zstd":382},"use-map":{"raw":384,"gzip":256,"br":220,"zstd":262},"use-page-visibility":{"raw":359,"gzip":263,"br":210,"zstd":266},"use-session-storage":{"raw":198,"gzip":141,"br":118,"zstd":137},"use-resizing":{"raw":511,"gzip":334,"br":294,"zstd":342},"use-intersection":{"raw":1363,"gzip":716,"br":654,"zstd":750},"use-readonly-search-params":{"raw":1120,"gzip":573,"br":477,"zstd":584},"use-singleton":{"raw":149,"gzip":135,"br":116,"zstd":123},"use-retimer":{"raw":194,"gzip":166,"br":127,"zstd":154},"use-set":{"raw":368,"gzip":247,"br":211,"zstd":255},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":450,"gzip":318,"br":249,"zstd":321},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77,"zstd":94},"use-uncontrolled":{"raw":388,"gzip":273,"br":230,"zstd":277},"use-state-with-deps":{"raw":747,"gzip":479,"br":418,"zstd":488},"use-url-hash-state":{"raw":1077,"gzip":611,"br":536,"zstd":626}}}
1
+ {"total":{"raw":28361,"gzip":17381,"br":14619,"zstd":17408},"exports":{"browser":{"raw":686,"gzip":402,"br":333,"zstd":413},"context-state":{"raw":402,"gzip":259,"br":218,"zstd":259},"create-context-reducer":{"raw":63,"gzip":74,"br":64,"zstd":72},"compose-context-provider":{"raw":177,"gzip":155,"br":122,"zstd":144},"create-breadcrumbs":{"raw":56,"gzip":68,"br":52,"zstd":65},"breadcrumbs":{"raw":879,"gzip":467,"br":395,"zstd":472},"create-context-state":{"raw":59,"gzip":72,"br":59,"zstd":68},"create-local-storage-state":{"raw":169,"gzip":138,"br":111,"zstd":130},"create-fixed-array":{"raw":452,"gzip":282,"br":248,"zstd":282},"create-magic-portal":{"raw":57,"gzip":71,"br":53,"zstd":66},"context-reducer":{"raw":557,"gzip":332,"br":319,"zstd":336},"create-session-storage-state":{"raw":173,"gzip":138,"br":108,"zstd":129},"create-stackless-error":{"raw":278,"gzip":198,"br":162,"zstd":188},"create-storage-hook":{"raw":2418,"gzip":957,"br":835,"zstd":1000},"current-year":{"raw":508,"gzip":348,"br":283,"zstd":349},"fetch-jsonp":{"raw":924,"gzip":570,"br":446,"zstd":576},"is-safari":{"raw":247,"gzip":175,"br":133,"zstd":169},"invariant":{"raw":178,"gzip":156,"br":118,"zstd":149},"merge-props":{"raw":1030,"gzip":559,"br":501,"zstd":577},"no-ssr":{"raw":381,"gzip":281,"br":236,"zstd":285},"merge-refs":{"raw":525,"gzip":280,"br":235,"zstd":278},"noop-component":{"raw":142,"gzip":130,"br":111,"zstd":119},"create-storage-state-factory":{"raw":364,"gzip":248,"br":197,"zstd":243},"nullthrow":{"raw":187,"gzip":163,"br":121,"zstd":156},"open-new-tab":{"raw":335,"gzip":255,"br":187,"zstd":255},"polymorphic":{"raw":284,"gzip":212,"br":180,"zstd":199},"noop":{"raw":33,"gzip":53,"br":37,"zstd":42},"types":{"raw":0,"gzip":20,"br":1,"zstd":9},"request-idle-callback":{"raw":392,"gzip":221,"br":171,"zstd":213},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80,"zstd":91},"magic-portal":{"raw":1013,"gzip":517,"br":445,"zstd":526},"use-array":{"raw":334,"gzip":243,"br":206,"zstd":236},"use":{"raw":301,"gzip":200,"br":177,"zstd":193},"use-component-will-receive-update":{"raw":220,"gzip":190,"br":157,"zstd":179},"rem":{"raw":823,"gzip":395,"br":350,"zstd":402},"use-composition-input":{"raw":470,"gzip":286,"br":241,"zstd":296},"use-debounced-state":{"raw":401,"gzip":282,"br":244,"zstd":288},"use-debounced-value":{"raw":553,"gzip":358,"br":320,"zstd":360},"use-clipboard":{"raw":2718,"gzip":1333,"br":1141,"zstd":1398},"use-is-client":{"raw":184,"gzip":158,"br":130,"zstd":149},"use-error-boundary":{"raw":252,"gzip":195,"br":165,"zstd":187},"use-local-storage":{"raw":192,"gzip":143,"br":114,"zstd":137},"use-fast-click":{"raw":499,"gzip":350,"br":284,"zstd":355},"use-is-online":{"raw":288,"gzip":216,"br":196,"zstd":205},"use-isomorphic-layout-effect":{"raw":169,"gzip":137,"br":110,"zstd":127},"use-intersection":{"raw":1363,"gzip":716,"br":654,"zstd":750},"use-map":{"raw":384,"gzip":256,"br":220,"zstd":262},"use-media-query":{"raw":483,"gzip":322,"br":256,"zstd":325},"use-page-visibility":{"raw":283,"gzip":211,"br":162,"zstd":203},"use-set":{"raw":368,"gzip":247,"br":211,"zstd":255},"use-resizing":{"raw":511,"gzip":334,"br":294,"zstd":342},"use-abortable-effect":{"raw":215,"gzip":170,"br":144,"zstd":166},"use-retimer":{"raw":194,"gzip":166,"br":127,"zstd":154},"use-singleton":{"raw":149,"gzip":135,"br":116,"zstd":123},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77,"zstd":94},"use-uncontrolled":{"raw":388,"gzip":273,"br":230,"zstd":277},"use-state-with-deps":{"raw":747,"gzip":479,"br":418,"zstd":488},"use-readonly-search-params":{"raw":1035,"gzip":547,"br":449,"zstd":558},"use-session-storage":{"raw":198,"gzip":141,"br":118,"zstd":137},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":443,"gzip":320,"br":252,"zstd":320},"use-url-hash-state":{"raw":1001,"gzip":572,"br":495,"zstd":582}}}
package/use/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("react");const t="function"==typeof e.use?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";var e,t=require("react"),r=(e=Object.create(null),t&&Object.keys(t).forEach(function(r){if("default"!==r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e));const s="function"==typeof r.use?r.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=s;
package/use/index.d.ts CHANGED
@@ -1,9 +1,23 @@
1
- import react__default from 'react';
2
-
3
- declare const use: typeof react__default.use | (<T>(promise: Promise<T> & {
4
- status?: "pending" | "fulfilled" | "rejected";
5
- value?: T;
6
- reason?: unknown;
7
- }) => T);
1
+ interface UntrackedReactPromise<T> extends PromiseLike<T> {
2
+ status?: undefined;
3
+ }
4
+ interface PendingReactPromise<T> extends PromiseLike<T> {
5
+ status: 'pending';
6
+ }
7
+ interface FulfilledReactPromise<T> extends PromiseLike<T> {
8
+ status: 'fulfilled';
9
+ value: T;
10
+ }
11
+ interface RejectedReactPromise<T> extends PromiseLike<T> {
12
+ status: 'rejected';
13
+ reason: unknown;
14
+ }
15
+ /**
16
+ * A thenable whose settled state React's `use()` reads synchronously, off the
17
+ * `status` / `value` / `reason` properties React attaches while tracking it.
18
+ */
19
+ type ReactPromise<T> = UntrackedReactPromise<T> | PendingReactPromise<T> | FulfilledReactPromise<T> | RejectedReactPromise<T>;
20
+ declare const use: <T>(usable: ReactPromise<T>) => T;
8
21
 
9
22
  export { use };
23
+ export type { FulfilledReactPromise, PendingReactPromise, ReactPromise, RejectedReactPromise, UntrackedReactPromise };
package/use/index.mjs CHANGED
@@ -1 +1 @@
1
- import e from"react";const t="function"==typeof e.use?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}};export{t as use};
1
+ import*as e from"react";const t="function"==typeof e.use?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}};export{t as use};
@@ -1,7 +1,5 @@
1
- import { EffectCallback, DependencyList } from 'react';
2
-
3
1
  /** @see https://foxact.skk.moe/use-abortable-effect */
4
- declare function useAbortableEffect(callback: (signal: AbortSignal) => ReturnType<EffectCallback>, deps: DependencyList): void;
2
+ declare function useAbortableEffect(callback: (signal: AbortSignal) => ReturnType<React.EffectCallback>, deps: React.DependencyList): void;
5
3
  declare const useEffect: typeof useAbortableEffect;
6
4
 
7
5
  export { useAbortableEffect, useEffect };
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),t=require("../noop/index.cjs"),r=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs"),l=require("../use-typescript-happy-callback/index.cjs");class a extends Error{constructor(...e){var t;super(...e),(t="name")in this?Object.defineProperty(this,t,{value:"UseClipboardError",enumerable:!0,configurable:!0,writable:!0}):this[t]="UseClipboardError"}}async function o(e,t,r,l){let o;if("clipboard"in navigator)try{return await navigator.clipboard.writeText(e),!0}catch(e){(o=new a("[foxact/use-clipboard] Failed to copy using navigator.clipboard")).cause=e}else o=new a("[foxact/use-clipboard] navigator.clipboard is not supported");if(t){var n;let t;const r=document.activeElement,l=[],c=document.getSelection();let s=null,i=null!=(n=document.fullscreenElement)?n:document.body,u=r;for(;u;){if("DIALOG"===u.tagName&&u.open){i=u;break}u=u.parentElement}let d=null;try{if(c.rangeCount){for(let e=0;e<c.rangeCount;e++)l.push(c.getRangeAt(e));c.removeAllRanges()}((null==r?void 0:r.tagName)==="INPUT"||(null==r?void 0:r.tagName)==="TEXTAREA")&&(s=r).blur();const a=document.createRange();(d=document.createElement("span")).textContent=e,d.style.whiteSpace="pre",d.ariaHidden="true",d.style.all="unset",d.style.position="fixed",d.style.top="0",d.style.clip="rect(0, 0, 0, 0)",d.style.borderWidth="0",d.style.overflow="hidden",d.style.userSelect="text",d.style.webkitUserSelect="text",d.style.MozUserSelect="text",d.style.msUserSelect="text",d.addEventListener("copy",e=>{e.stopPropagation()}),i.appendChild(d),a.selectNodeContents(d),c.removeAllRanges(),c.addRange(a),t=document.execCommand("copy")}catch(e){(o=new a("[foxact/use-clipboard] Failed to copy using execCommand fallback")).cause=e,t=!1}finally{c.removeAllRanges(),d&&i.removeChild(d),"Caret"===c.type&&c.removeAllRanges(),c.rangeCount||l.forEach(e=>c.addRange(e)),null==s||s.focus()}if(t)return!0}return r?(window.prompt(l,e),!1):o}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:a=1e3,useExecCommandAsFallback:n=!0,usePromptAsFallback:c=!1,promptFallbackText:s="Failed to copy to clipboard, please manually copy the text below.",onCopyError:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,d]=e.useState(null),[p,y]=e.useState(!1),b=e.useRef(null),m=r.useStableHandler(i||t.noop),g=l.useCallback(e=>{b.current&&clearTimeout(b.current),e&&(b.current=window.setTimeout(()=>y(!1),a)),y(e)},[a]),f=l.useCallback(e=>{d(e),m(e)},[m]);return{copy:l.useCallback(async e=>{try{const t=await o(e,n,c,s);"boolean"==typeof t?t&&g(!0):f(t)}catch(e){f(e)}},[g,s,f,n,c]),reset:l.useCallback(()=>{y(!1),d(null),b.current&&clearTimeout(b.current)},[]),error:u,copied:p}};
1
+ "use strict";require("client-only");var e=require("react"),t=require("../noop/index.cjs"),r=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs"),l=require("../use-typescript-happy-callback/index.cjs");class a extends Error{constructor(...e){var t;super(...e),(t="name")in this?Object.defineProperty(this,t,{value:"UseClipboardError",enumerable:!0,configurable:!0,writable:!0}):this[t]="UseClipboardError"}}async function o(e,t,r,l){let o;if("clipboard"in navigator)try{return await navigator.clipboard.writeText(e),!0}catch(e){(o=new a("[foxact/use-clipboard] Failed to copy using navigator.clipboard")).cause=e}else o=new a("[foxact/use-clipboard] navigator.clipboard is not supported");if(t){var n;let t;const r=document.activeElement,l=[],c=document.getSelection();let s=null,i=null!=(n=document.fullscreenElement)?n:document.body,u=r;for(;u;){if("DIALOG"===u.tagName&&u.open){i=u;break}u=u.parentElement}let d=null;try{if(c.rangeCount){for(let e=0;e<c.rangeCount;e++)l.push(c.getRangeAt(e));c.removeAllRanges()}((null==r?void 0:r.tagName)==="INPUT"||(null==r?void 0:r.tagName)==="TEXTAREA")&&(s=r).blur();const a=document.createRange();(d=document.createElement("span")).textContent=e,d.style.whiteSpace="pre",d.ariaHidden="true",d.style.all="unset",d.style.position="fixed",d.style.top="0",d.style.clip="rect(0, 0, 0, 0)",d.style.borderWidth="0",d.style.overflow="hidden",d.style.userSelect="text",d.style.webkitUserSelect="text",d.style.MozUserSelect="text",d.style.msUserSelect="text",d.addEventListener("copy",e=>{e.stopPropagation()}),i.appendChild(d),a.selectNodeContents(d),c.removeAllRanges(),c.addRange(a),t=document.execCommand("copy")}catch(e){(o=new a("[foxact/use-clipboard] Failed to copy using execCommand fallback")).cause=e,t=!1}finally{c.removeAllRanges(),d&&i.removeChild(d),"Caret"===c.type&&c.removeAllRanges(),c.rangeCount||l.forEach(e=>c.addRange(e)),null==s||s.focus()}if(t)return!0}return r?(window.prompt(l,e),!1):o}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:a=1e3,useExecCommandAsFallback:n=!0,usePromptAsFallback:c=!1,promptFallbackText:s="Failed to copy to clipboard, please manually copy the text below.",onCopyError:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,d]=e.useState(null),[p,y]=e.useState(!1),b=e.useRef(null),m=r.useStableHandler(i||t.noop),g=l.useCallback(e=>{b.current&&clearTimeout(b.current),e&&(b.current=window.setTimeout(y,a,!1)),y(e)},[a]),f=l.useCallback(e=>{d(e),m(e)},[m]);return{copy:l.useCallback(async e=>{try{const t=await o(e,n,c,s);"boolean"==typeof t?t&&g(!0):f(t)}catch(e){f(e)}},[g,s,f,n,c]),reset:l.useCallback(()=>{y(!1),d(null),b.current&&clearTimeout(b.current)},[]),error:u,copied:p}};
@@ -1 +1 @@
1
- import"client-only";import{useState as e,useRef as t}from"react";import{noop as o}from"../noop/index.mjs";import{useStableHandler as r}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";import{useCallback as n}from"../use-typescript-happy-callback/index.mjs";class l extends Error{constructor(...e){var t;super(...e),(t="name")in this?Object.defineProperty(this,t,{value:"UseClipboardError",enumerable:!0,configurable:!0,writable:!0}):this[t]="UseClipboardError"}}function a(){let{timeout:l=1e3,useExecCommandAsFallback:a=!0,usePromptAsFallback:c=!1,promptFallbackText:s="Failed to copy to clipboard, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[d,p]=e(null),[m,y]=e(!1),b=t(null),f=r(u||o),g=n(e=>{b.current&&clearTimeout(b.current),e&&(b.current=window.setTimeout(()=>y(!1),l)),y(e)},[l]),h=n(e=>{p(e),f(e)},[f]);return{copy:n(async e=>{try{const t=await i(e,a,c,s);"boolean"==typeof t?t&&g(!0):h(t)}catch(e){h(e)}},[g,s,h,a,c]),reset:n(()=>{y(!1),p(null),b.current&&clearTimeout(b.current)},[]),error:d,copied:m}}async function i(e,t,o,r){let n;if("clipboard"in navigator)try{return await navigator.clipboard.writeText(e),!0}catch(e){(n=new l("[foxact/use-clipboard] Failed to copy using navigator.clipboard")).cause=e}else n=new l("[foxact/use-clipboard] navigator.clipboard is not supported");if(t){var a;let t;const o=document.activeElement,r=[],i=document.getSelection();let c=null,s=null!=(a=document.fullscreenElement)?a:document.body,u=o;for(;u;){if("DIALOG"===u.tagName&&u.open){s=u;break}u=u.parentElement}let d=null;try{if(i.rangeCount){for(let e=0;e<i.rangeCount;e++)r.push(i.getRangeAt(e));i.removeAllRanges()}((null==o?void 0:o.tagName)==="INPUT"||(null==o?void 0:o.tagName)==="TEXTAREA")&&(c=o).blur();const n=document.createRange();(d=document.createElement("span")).textContent=e,d.style.whiteSpace="pre",d.ariaHidden="true",d.style.all="unset",d.style.position="fixed",d.style.top="0",d.style.clip="rect(0, 0, 0, 0)",d.style.borderWidth="0",d.style.overflow="hidden",d.style.userSelect="text",d.style.webkitUserSelect="text",d.style.MozUserSelect="text",d.style.msUserSelect="text",d.addEventListener("copy",e=>{e.stopPropagation()}),s.appendChild(d),n.selectNodeContents(d),i.removeAllRanges(),i.addRange(n),t=document.execCommand("copy")}catch(e){(n=new l("[foxact/use-clipboard] Failed to copy using execCommand fallback")).cause=e,t=!1}finally{i.removeAllRanges(),d&&s.removeChild(d),"Caret"===i.type&&i.removeAllRanges(),i.rangeCount||r.forEach(e=>i.addRange(e)),null==c||c.focus()}if(t)return!0}return o?(window.prompt(r,e),!1):n}export{l as UseClipboardError,a as useClipboard};
1
+ import"client-only";import{useState as e,useRef as t}from"react";import{noop as o}from"../noop/index.mjs";import{useStableHandler as r}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";import{useCallback as n}from"../use-typescript-happy-callback/index.mjs";class l extends Error{constructor(...e){var t;super(...e),(t="name")in this?Object.defineProperty(this,t,{value:"UseClipboardError",enumerable:!0,configurable:!0,writable:!0}):this[t]="UseClipboardError"}}function a(){let{timeout:l=1e3,useExecCommandAsFallback:a=!0,usePromptAsFallback:c=!1,promptFallbackText:s="Failed to copy to clipboard, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[d,p]=e(null),[m,y]=e(!1),b=t(null),f=r(u||o),g=n(e=>{b.current&&clearTimeout(b.current),e&&(b.current=window.setTimeout(y,l,!1)),y(e)},[l]),h=n(e=>{p(e),f(e)},[f]);return{copy:n(async e=>{try{const t=await i(e,a,c,s);"boolean"==typeof t?t&&g(!0):h(t)}catch(e){h(e)}},[g,s,h,a,c]),reset:n(()=>{y(!1),p(null),b.current&&clearTimeout(b.current)},[]),error:d,copied:m}}async function i(e,t,o,r){let n;if("clipboard"in navigator)try{return await navigator.clipboard.writeText(e),!0}catch(e){(n=new l("[foxact/use-clipboard] Failed to copy using navigator.clipboard")).cause=e}else n=new l("[foxact/use-clipboard] navigator.clipboard is not supported");if(t){var a;let t;const o=document.activeElement,r=[],i=document.getSelection();let c=null,s=null!=(a=document.fullscreenElement)?a:document.body,u=o;for(;u;){if("DIALOG"===u.tagName&&u.open){s=u;break}u=u.parentElement}let d=null;try{if(i.rangeCount){for(let e=0;e<i.rangeCount;e++)r.push(i.getRangeAt(e));i.removeAllRanges()}((null==o?void 0:o.tagName)==="INPUT"||(null==o?void 0:o.tagName)==="TEXTAREA")&&(c=o).blur();const n=document.createRange();(d=document.createElement("span")).textContent=e,d.style.whiteSpace="pre",d.ariaHidden="true",d.style.all="unset",d.style.position="fixed",d.style.top="0",d.style.clip="rect(0, 0, 0, 0)",d.style.borderWidth="0",d.style.overflow="hidden",d.style.userSelect="text",d.style.webkitUserSelect="text",d.style.MozUserSelect="text",d.style.msUserSelect="text",d.addEventListener("copy",e=>{e.stopPropagation()}),s.appendChild(d),n.selectNodeContents(d),i.removeAllRanges(),i.addRange(n),t=document.execCommand("copy")}catch(e){(n=new l("[foxact/use-clipboard] Failed to copy using execCommand fallback")).cause=e,t=!1}finally{i.removeAllRanges(),d&&s.removeChild(d),"Caret"===i.type&&i.removeAllRanges(),i.rangeCount||r.forEach(e=>i.addRange(e)),null==c||c.focus()}if(t)return!0}return o?(window.prompt(r,e),!1):n}export{l as UseClipboardError,a as useClipboard};
@@ -1 +1 @@
1
- "use strict";var e=require("react");exports.useComponentWillReceiveUpdate=function(t,n){n=[...n];const[r,l]=e.useState(n);let o=n.length!==r.length;for(let e=0;e<n.length&&!o;e+=1)r[e]!==n[e]&&(o=!0);return o&&(l(n),t()),o};
1
+ "use strict";var e=require("react");exports.useComponentWillReceiveUpdate=function(t,n){n=[...n];const[r,l]=e.useState(n);let o=n.length!==r.length;for(let e=0,t=n.length;e<t&&!o;e+=1)r[e]!==n[e]&&(o=!0);return o&&(l(n),t()),o};
@@ -1 +1 @@
1
- import{useState as e}from"react";function t(t,n){const[o,l]=e(n=[...n]);let r=n.length!==o.length;for(let e=0;e<n.length&&!r;e+=1)o[e]!==n[e]&&(r=!0);return r&&(l(n),t()),r}export{t as useComponentWillReceiveUpdate};
1
+ import{useState as e}from"react";function t(t,n){const[o,l]=e(n=[...n]);let r=n.length!==o.length;for(let e=0,t=n.length;e<t&&!r;e+=1)o[e]!==n[e]&&(r=!0);return r&&(l(n),t()),r}export{t as useComponentWillReceiveUpdate};
@@ -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();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
+ "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=>{n&&i.current?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
- 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
+ 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=>{u&&s.current?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("../noop/index.cjs"),r=require("react");function n(){return!0}function t(){return!1}exports.useIsClient=function(){return r.useSyncExternalStore(e.noop,n,t)};
1
+ "use strict";require("client-only");var e=require("../noop/index.cjs"),r=require("react");const n=()=>!0,t=()=>!1;exports.useIsClient=function(){return r.useSyncExternalStore(e.noop,n,t)};
@@ -1 +1 @@
1
- import"client-only";import{noop as n}from"../noop/index.mjs";import{useSyncExternalStore as r}from"react";function t(){return!0}function o(){return!1}function e(){return r(n,t,o)}export{e as useIsClient};
1
+ import"client-only";import{noop as o}from"../noop/index.mjs";import{useSyncExternalStore as t}from"react";const n=()=>!0,r=()=>!1;function e(){return t(o,n,r)}export{e as useIsClient};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var n=require("react"),e=require("event-target-bus");let t=null,r=null;function u(n){null!=t||(t=e.createEventTargetBus(window,"online")),null!=r||(r=e.createEventTargetBus(window,"offline"));const u=t.on(n),o=r.on(n);return()=>{u(),o()}}function o(){return!("u"<typeof window)&&navigator.onLine}exports.useIsOnline=function(){return n.useSyncExternalStore(u,o,o)};
2
+ "use strict";var e=require("react");const n=require("event-target-bus/react").createSyncExternalStoreSubscribe(()=>window,["online","offline"]);function r(){return!("u"<typeof window)&&navigator.onLine}exports.useIsOnline=function(){return e.useSyncExternalStore(n,r,r)};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{useSyncExternalStore as n}from"react";import{createEventTargetBus as o}from"event-target-bus";let t=null,e=null;function r(n){null!=t||(t=o(window,"online")),null!=e||(e=o(window,"offline"));const r=t.on(n),i=e.on(n);return()=>{r(),i()}}function i(){return!("u"<typeof window)&&navigator.onLine}function u(){return n(r,i,i)}export{u as useIsOnline};
2
+ import{useSyncExternalStore as n}from"react";import{createSyncExternalStoreSubscribe as o}from"event-target-bus/react";const t=o(()=>window,["online","offline"]);function e(){return!("u"<typeof window)&&navigator.onLine}function r(){return n(t,e,e)}export{r as useIsOnline};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("../no-ssr/index.cjs"),r=require("../noop/index.cjs"),t=require("react"),n=require("event-target-bus");const o=new Map;function u(){throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")}exports.useMediaQuery=function(e,i){const a=t.useCallback(t=>(function(e,t){if("u"<typeof window)return r.noop;let u=o.get(e);return u||(u=n.createEventTargetBus(window.matchMedia(e),"change"),o.set(e,u)),u.on(t)})(e,t),[e]);return t.useSyncExternalStore(a,()=>"u"<typeof window?null!=i&&i:window.matchMedia(e).matches,void 0===i?u:()=>i)};
2
+ "use strict";var e=require("../no-ssr/index.cjs"),r=require("react");const t=require("event-target-bus/react").createKeyedSyncExternalStoreSubscribe(e=>window.matchMedia(e),"change");function n(){throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")}exports.useMediaQuery=function(e,o){const u=r.useMemo(()=>t(e),[e]);return r.useSyncExternalStore(u,()=>"u"<typeof window?null!=o&&o:window.matchMedia(e).matches,void 0===o?n:()=>o)};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{noSSRError as e}from"../no-ssr/index.mjs";import{noop as t}from"../noop/index.mjs";import{useCallback as o,useSyncExternalStore as n}from"react";import{createEventTargetBus as r}from"event-target-bus";const i=new Map;function u(){throw e("useMediaQuery cannot be used on the server without a serverValue")}function a(e,a){return n(o(o=>(function(e,o){if("u"<typeof window)return t;let n=i.get(e);return n||(n=r(window.matchMedia(e),"change"),i.set(e,n)),n.on(o)})(e,o),[e]),()=>"u"<typeof window?null!=a&&a:window.matchMedia(e).matches,void 0===a?u:()=>a)}export{a as useMediaQuery};
2
+ import{noSSRError as e}from"../no-ssr/index.mjs";import{useMemo as t,useSyncExternalStore as o}from"react";import{createKeyedSyncExternalStoreSubscribe as r}from"event-target-bus/react";const n=r(e=>window.matchMedia(e),"change");function i(){throw e("useMediaQuery cannot be used on the server without a serverValue")}function a(e,r){return o(t(()=>n(e),[e]),()=>"u"<typeof window?null!=r&&r:window.matchMedia(e).matches,void 0===r?i:()=>r)}export{a as useMediaQuery};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("react"),t=require("event-target-bus"),n=require("../noop/index.cjs");let r=null;const u=e=>"u"<typeof window?n.noop:(null!=r||(r=t.createEventTargetBus(document,"visibilitychange")),r.on(e)),i=()=>!("u"<typeof document)&&!document.hidden;exports.usePageVisibility=function(){return e.useSyncExternalStore(u,i,i)};
2
+ "use strict";var e=require("react");const t=require("event-target-bus/react").createSyncExternalStoreSubscribe(()=>document,"visibilitychange"),r=()=>!("u"<typeof document)&&!document.hidden;exports.usePageVisibility=function(){return e.useSyncExternalStore(t,r,r)};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{useSyncExternalStore as t}from"react";import{createEventTargetBus as o}from"event-target-bus";import{noop as e}from"../noop/index.mjs";let n=null;const i=t=>"u"<typeof window?e:(null!=n||(n=o(document,"visibilitychange")),n.on(t)),r=()=>!("u"<typeof document)&&!document.hidden;function u(){return t(i,r,r)}export{u as usePageVisibility};
2
+ import{useSyncExternalStore as t}from"react";import{createSyncExternalStoreSubscribe as e}from"event-target-bus/react";const i=e(()=>document,"visibilitychange"),o=()=>!("u"<typeof document)&&!document.hidden;function n(){return t(i,o,o)}export{n as usePageVisibility};
@@ -1 +1 @@
1
- "use strict";var e=require("event-target-bus"),r=require("../no-ssr/index.cjs"),n=require("../noop/index.cjs"),a=require("react");class t extends Error{constructor(){var e;super("[foxact/use-readonly-search-params] Method unavailable on `ReadonlyURLSearchParams`"),(e="name")in this?Object.defineProperty(this,e,{value:"ReadonlyURLSearchParamsError",enumerable:!0,configurable:!0,writable:!0}):this[e]="ReadonlyURLSearchParamsError"}}class o extends URLSearchParams{append(){throw new t}delete(){throw new t}set(){throw new t}sort(){throw new t}}let s=null;function u(r){return"u"<typeof window?n.noop:(null!=s||(s=e.createEventTargetBus(window,"popstate")),s.on(r))}let l=null,c=null;function i(){return"u"<typeof window?new o:window.location.search===l&&null!==c?c:c=new o(l=window.location.search)}function w(){throw r.noSSRError('[foxact] useReadonlySearchParams cannot be used on the server without a "getServerDefaultValue" function')}exports.ReadonlyURLSearchParams=o,exports.useReadonlySearchParams=function(e){return a.useSyncExternalStore(u,i,null==e?w:()=>{const r=e();return r instanceof o?r:new o(r)})};
1
+ "use strict";var e=require("event-target-bus/react"),r=require("../no-ssr/index.cjs"),a=require("react");class n extends Error{constructor(){var e;super("[foxact/use-readonly-search-params] Method unavailable on `ReadonlyURLSearchParams`"),(e="name")in this?Object.defineProperty(this,e,{value:"ReadonlyURLSearchParamsError",enumerable:!0,configurable:!0,writable:!0}):this[e]="ReadonlyURLSearchParamsError"}}class t extends URLSearchParams{append(){throw new n}delete(){throw new n}set(){throw new n}sort(){throw new n}}const o=e.createSyncExternalStoreSubscribe(()=>window,"popstate");let s=null,c=null;function u(){return"u"<typeof window?new t:null!==c&&window.location.search===s?c:c=new t(s=window.location.search)}function l(){throw r.noSSRError('[foxact] useReadonlySearchParams cannot be used on the server without a "getServerDefaultValue" function')}exports.ReadonlyURLSearchParams=t,exports.useReadonlySearchParams=function(e){return a.useSyncExternalStore(o,u,null==e?l:()=>{const r=e();return r instanceof t?r:new t(r)})};
@@ -1 +1 @@
1
- import{createEventTargetBus as e}from"event-target-bus";import{noSSRError as r}from"../no-ssr/index.mjs";import{noop as n}from"../noop/index.mjs";import{useSyncExternalStore as o}from"react";class a extends Error{constructor(){var e;super("[foxact/use-readonly-search-params] Method unavailable on `ReadonlyURLSearchParams`"),(e="name")in this?Object.defineProperty(this,e,{value:"ReadonlyURLSearchParamsError",enumerable:!0,configurable:!0,writable:!0}):this[e]="ReadonlyURLSearchParamsError"}}class t extends URLSearchParams{append(){throw new a}delete(){throw new a}set(){throw new a}sort(){throw new a}}let s=null;function l(r){return"u"<typeof window?n:(null!=s||(s=e(window,"popstate")),s.on(r))}let u=null,c=null;function i(){return"u"<typeof window?new t:window.location.search===u&&null!==c?c:c=new t(u=window.location.search)}function w(){throw r('[foxact] useReadonlySearchParams cannot be used on the server without a "getServerDefaultValue" function')}function d(e){return o(l,i,null==e?w:()=>{const r=e();return r instanceof t?r:new t(r)})}export{t as ReadonlyURLSearchParams,d as useReadonlySearchParams};
1
+ import{createSyncExternalStoreSubscribe as e}from"event-target-bus/react";import{noSSRError as r}from"../no-ssr/index.mjs";import{useSyncExternalStore as a}from"react";class n extends Error{constructor(){var e;super("[foxact/use-readonly-search-params] Method unavailable on `ReadonlyURLSearchParams`"),(e="name")in this?Object.defineProperty(this,e,{value:"ReadonlyURLSearchParamsError",enumerable:!0,configurable:!0,writable:!0}):this[e]="ReadonlyURLSearchParamsError"}}class o extends URLSearchParams{append(){throw new n}delete(){throw new n}set(){throw new n}sort(){throw new n}}const t=e(()=>window,"popstate");let s=null,c=null;function l(){return"u"<typeof window?new o:null!==c&&window.location.search===s?c:c=new o(s=window.location.search)}function u(){throw r('[foxact] useReadonlySearchParams cannot be used on the server without a "getServerDefaultValue" function')}function i(e){return a(t,l,null==e?u:()=>{const r=e();return r instanceof o?r:new o(r)})}export{o as ReadonlyURLSearchParams,i as useReadonlySearchParams};
@@ -1 +1 @@
1
- "use strict";var e=require("react");const t="u"<typeof window?e.useEffect:e.useInsertionEffect||e.useLayoutEffect;function r(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}exports.useStableHandler=function(n){const o=e.useRef(r);return t(()=>{o.current=n},[n]),e.useCallback(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,o.current)(...t)},[])};
1
+ "use strict";var e,t=require("react"),r=(e=Object.create(null),t&&Object.keys(t).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e));const{useCallback:n,useEffect:o,useLayoutEffect:c,useRef:u}=r,a="u"<typeof window?o:r.useInsertionEffect||c;function f(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}exports.useStableHandler=function(e){const t=u(f);return a(()=>{t.current=e},[e]),n(function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,t.current)(...r)},[])};
@@ -1 +1 @@
1
- import t,{useEffect as e,useLayoutEffect as n,useRef as r,useCallback as o}from"react";const c="u"<typeof window?e:t.useInsertionEffect||n;function u(t){const e=r(a);return c(()=>{e.current=t},[t]),o(function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return(0,e.current)(...n)},[])}function a(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}export{u as useStableHandler};
1
+ import*as t from"react";const{useCallback:e,useEffect:n,useLayoutEffect:r,useRef:o}=t,c="u"<typeof window?n:t.useInsertionEffect||r;function a(t){const n=o(u);return c(()=>{n.current=t},[t]),e(function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,n.current)(...e)},[])}function u(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}export{a as useStableHandler};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),n=require("../no-ssr/index.cjs"),t=require("../chunks/index.b9dLwVor.cjs"),s=require("../chunks/index.BtiK5_Nn.cjs"),l=require("event-target-bus");let a=null;const i=e=>"u"<typeof window?r.noop:(null!=a||(a=l.createEventTargetBus(window,"hashchange")),a.on(e));function o(){throw n.noSSRError("useUrlHashState cannot be used on the server without a serverValue")}exports.unstable_useUrlHashState=function(r,n){var l;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:t.t,deserializer:t.t};const u=a.raw?t.t:a.serializer,c=a.raw?t.t:a.deserializer,h=void 0===n?o:()=>u(n),d=e.useSyncExternalStore(i,()=>new URLSearchParams(location.hash.slice(1)).get(r),h),w=e.useMemo(()=>null===d?null!=n?n:null:c(d),[n,c,d]),S=e.useCallback(e=>{const t=location.hash,l=new URLSearchParams(t.slice(1)),a=s.n(e)?e(w):e;a===n||null===a?l.delete(r):l.set(r,u(a));const i=l.toString();t!==i&&(location.hash=i)},[n,w,r,u]);return[null!=(l=null!=w?w:n)?l:null,S]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../no-ssr/index.cjs"),t=require("../chunks/index.b9dLwVor.cjs"),n=require("../chunks/index.BtiK5_Nn.cjs");const s=require("event-target-bus/react").createSyncExternalStoreSubscribe(()=>window,"hashchange");function a(){throw r.noSSRError("useUrlHashState cannot be used on the server without a serverValue")}exports.unstable_useUrlHashState=function(r,l){var i;let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:t.t,deserializer:t.t};const c=u.raw?t.t:u.serializer,o=u.raw?t.t:u.deserializer,h=void 0===l?a:()=>c(l),S=e.useSyncExternalStore(s,()=>new URLSearchParams(location.hash.slice(1)).get(r),h),d=e.useMemo(()=>null===S?null!=l?l:null:o(S),[l,o,S]),w=e.useCallback(e=>{const t=location.hash,s=new URLSearchParams(t.slice(1)),a=n.n(e)?e(d):e;a===l||null===a?s.delete(r):s.set(r,c(a));const i=s.toString();t!==i&&(location.hash=i)},[l,d,r,c]);return[null!=(i=null!=d?d:l)?i:null,w]};
@@ -1 +1 @@
1
- import"client-only";import{useSyncExternalStore as e,useMemo as n,useCallback as r}from"react";import{noop as t}from"../noop/index.mjs";import{noSSRError as o}from"../no-ssr/index.mjs";import{t as l}from"../chunks/index.D0KaUCcV.mjs";import{n as s}from"../chunks/index.C9-3oDdv.mjs";import{createEventTargetBus as a}from"event-target-bus";let i=null;const u=e=>"u"<typeof window?t:(null!=i||(i=a(window,"hashchange")),i.on(e));function h(){throw o("useUrlHashState cannot be used on the server without a serverValue")}function c(t,o){var a;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:l,deserializer:l};const c=i.raw?l:i.serializer,m=i.raw?l:i.deserializer,d=e(u,()=>new URLSearchParams(location.hash.slice(1)).get(t),void 0===o?h:()=>c(o)),w=n(()=>null===d?null!=o?o:null:m(d),[o,m,d]),p=r(e=>{const n=location.hash,r=new URLSearchParams(n.slice(1)),l=s(e)?e(w):e;l===o||null===l?r.delete(t):r.set(t,c(l));const a=r.toString();n!==a&&(location.hash=a)},[o,w,t,c]);return[null!=(a=null!=w?w:o)?a:null,p]}export{c as unstable_useUrlHashState};
1
+ import"client-only";import{useSyncExternalStore as e,useMemo as r,useCallback as t}from"react";import{noSSRError as n}from"../no-ssr/index.mjs";import{t as a}from"../chunks/index.D0KaUCcV.mjs";import{n as s}from"../chunks/index.C9-3oDdv.mjs";import{createSyncExternalStoreSubscribe as o}from"event-target-bus/react";const l=o(()=>window,"hashchange");function i(){throw n("useUrlHashState cannot be used on the server without a serverValue")}function c(n,o){var c;let h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:a,deserializer:a};const u=h.raw?a:h.serializer,m=h.raw?a:h.deserializer,d=e(l,()=>new URLSearchParams(location.hash.slice(1)).get(n),void 0===o?i:()=>u(o)),w=r(()=>null===d?null!=o?o:null:m(d),[o,m,d]),f=t(e=>{const r=location.hash,t=new URLSearchParams(r.slice(1)),a=s(e)?e(w):e;a===o||null===a?t.delete(n):t.set(n,u(a));const l=t.toString();r!==l&&(location.hash=l)},[o,w,n,u]);return[null!=(c=null!=w?w:o)?c:null,f]}export{c as unstable_useUrlHashState};