foxact 0.3.6 → 0.3.7

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 (42) hide show
  1. package/breadcrumbs/index.cjs +1 -1
  2. package/breadcrumbs/index.d.ts +2 -2
  3. package/breadcrumbs/index.mjs +1 -1
  4. package/create-breadcrumbs/index.cjs +1 -1
  5. package/create-breadcrumbs/index.mjs +1 -1
  6. package/create-context-reducer/index.cjs +1 -1
  7. package/create-context-reducer/index.mjs +1 -1
  8. package/create-context-state/index.cjs +1 -1
  9. package/create-context-state/index.mjs +1 -1
  10. package/create-local-storage-state/index.cjs +1 -1
  11. package/create-local-storage-state/index.mjs +1 -1
  12. package/create-magic-portal/index.cjs +1 -1
  13. package/create-magic-portal/index.mjs +1 -1
  14. package/create-session-storage-state/index.cjs +1 -1
  15. package/create-session-storage-state/index.mjs +1 -1
  16. package/create-storage-hook/index.cjs +1 -1
  17. package/create-storage-hook/index.mjs +1 -1
  18. package/create-storage-state-factory/index.cjs +1 -1
  19. package/create-storage-state-factory/index.mjs +1 -1
  20. package/current-year/index.cjs +1 -1
  21. package/current-year/index.mjs +1 -1
  22. package/magic-portal/index.cjs +1 -1
  23. package/magic-portal/index.mjs +1 -1
  24. package/package.json +142 -133
  25. package/sizes.json +1 -1
  26. package/use-fast-click/index.cjs +1 -1
  27. package/use-fast-click/index.mjs +1 -1
  28. package/use-local-storage/index.cjs +1 -1
  29. package/use-local-storage/index.mjs +1 -1
  30. package/use-media-query/index.cjs +1 -1
  31. package/use-media-query/index.mjs +1 -1
  32. package/use-readonly-search-params/index.cjs +1 -1
  33. package/use-readonly-search-params/index.mjs +1 -1
  34. package/use-resizing/index.cjs +1 -0
  35. package/use-resizing/index.d.ts +9 -0
  36. package/use-resizing/index.mjs +1 -0
  37. package/use-session-storage/index.cjs +1 -1
  38. package/use-session-storage/index.mjs +1 -1
  39. package/use-state-with-deps/index.cjs +1 -1
  40. package/use-state-with-deps/index.mjs +1 -1
  41. package/use-url-hash-state/index.cjs +1 -1
  42. package/use-url-hash-state/index.mjs +1 -1
@@ -1 +1 @@
1
- "use strict";var e=require("react/jsx-runtime");require("client-only");var r=require("react"),t=require("../magic-portal/index.cjs");require("react-dom"),require("../context-state/index.cjs"),require("../noop/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),exports.createBreadcrumbs=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anonymous)";const i=r.createContext([]),[c,s,o]=t.createMagicPortal(n);return[c,s,function(t){let{title:n,href:c,meta:s,children:o}=t;const u=r.useContext(i),a=r.useMemo(()=>[...u,{title:n,href:c,meta:s}],[u,n,c,s]);return e.jsx(i.Provider,{value:a,children:o})},function(t){const{title:n,meta:c}=t,s=r.useContext(i),u=r.useMemo(()=>[...s,{title:n,meta:c}],[s,n,c]),{children:a}=t,l=r.isValidElement(a)?a:a(u);return e.jsx(i.Provider,{value:u,children:e.jsx(o,{children:l})})},function(){return r.useContext(i)}]};
1
+ "use strict";var e=require("react/jsx-runtime");require("client-only");var r=require("react"),t=require("../magic-portal/index.cjs");exports.createBreadcrumbs=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anonymous)";const o=r.createContext([]),[u,c,i]=t.createMagicPortal(n);function s(t){let{title:n,href:u,meta:c,children:i}=t;const s=r.useContext(o),a=r.useMemo(()=>[...s,{title:n,href:u,meta:c}],[s,n,u,c]);return e.jsx(o.Provider,{value:a,children:i})}function a(t){const{title:n,meta:u}=t,c=r.useContext(o),s=r.useMemo(()=>[...c,{title:n,meta:u}],[c,n,u]),{children:a}=t,l=r.isValidElement(a)?a:a(s);return e.jsx(o.Provider,{value:s,children:e.jsx(i,{children:l})})}return"production"!==process.env.NODE_ENV&&(s.displayName=n+".BreadcrumbSegment"),"production"!==process.env.NODE_ENV&&(a.displayName=n+".BreadcrumbCurrent"),[u,c,s,a,function(){return r.useContext(o)}]};
@@ -22,8 +22,8 @@ type BreadcrumbPortalTargetProps<E extends React.ElementType = 'div'> = Omit<Rea
22
22
  declare function createBreadcrumbs<T = unknown>(name?: string): [
23
23
  BreadcrumbProvider: React.ComponentType<React.PropsWithChildren>,
24
24
  BreadcrumbPortalTarget: <E extends React.ElementType = 'div'>(props: BreadcrumbPortalTargetProps<E>) => React.ReactNode,
25
- BreadcrumbItem: (props: BreadcrumbItemProps<T>) => React.ReactNode,
26
- BreadcrumbPage: (props: BreadcrumbPageProps<T>) => React.ReactNode | null,
25
+ BreadcrumbSegment: (props: BreadcrumbItemProps<T>) => React.ReactNode,
26
+ BreadcrumbCurrent: (props: BreadcrumbPageProps<T>) => React.ReactNode | null,
27
27
  useBreadcrumbs: () => Array<BreadcrumbItemData<T>>
28
28
  ];
29
29
 
@@ -1 +1 @@
1
- import{jsx as r}from"react/jsx-runtime";import"client-only";import{useContext as t,useMemo as e,isValidElement as o,createContext as n}from"react";import{createMagicPortal as i}from"../magic-portal/index.mjs";import"react-dom";import"../context-state/index.mjs";import"../noop/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";function m(){let m=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anonymous)";const c=n([]),[s,d,u]=i(m);return[s,d,function(o){let{title:n,href:i,meta:m,children:s}=o;const d=t(c),u=e(()=>[...d,{title:n,href:i,meta:m}],[d,n,i,m]);return r(c.Provider,{value:u,children:s})},function(n){const{title:i,meta:m}=n,s=t(c),d=e(()=>[...s,{title:i,meta:m}],[s,i,m]),{children:a}=n,l=o(a)?a:a(d);return r(c.Provider,{value:d,children:r(u,{children:l})})},function(){return t(c)}]}export{m as createBreadcrumbs};
1
+ import{jsx as r}from"react/jsx-runtime";import"client-only";import{useContext as e,useMemo as n,isValidElement as t,createContext as o}from"react";import{createMagicPortal as c}from"../magic-portal/index.mjs";function i(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anonymous)";const u=o([]),[m,a,d]=c(i);function l(t){let{title:o,href:c,meta:i,children:m}=t;const a=e(u),d=n(()=>[...a,{title:o,href:c,meta:i}],[a,o,c,i]);return r(u.Provider,{value:d,children:m})}function s(o){const{title:c,meta:i}=o,m=e(u),a=n(()=>[...m,{title:c,meta:i}],[m,c,i]),{children:l}=o,s=t(l)?l:l(a);return r(u.Provider,{value:a,children:r(d,{children:s})})}return"production"!==process.env.NODE_ENV&&(l.displayName=i+".BreadcrumbSegment"),"production"!==process.env.NODE_ENV&&(s.displayName=i+".BreadcrumbCurrent"),[m,a,l,s,function(){return e(u)}]}export{i as createBreadcrumbs};
@@ -1 +1 @@
1
- "use strict";var e=require("../breadcrumbs/index.cjs");require("react/jsx-runtime"),require("client-only"),require("react"),require("../magic-portal/index.cjs"),require("react-dom"),require("../context-state/index.cjs"),require("../noop/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),exports.createBreadcrumbs=e.createBreadcrumbs;
1
+ "use strict";var r=require("../breadcrumbs/index.cjs");exports.createBreadcrumbs=r.createBreadcrumbs;
@@ -1 +1 @@
1
- export{createBreadcrumbs}from"../breadcrumbs/index.mjs";import"react/jsx-runtime";import"client-only";import"react";import"../magic-portal/index.mjs";import"react-dom";import"../context-state/index.mjs";import"../noop/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";
1
+ export{createBreadcrumbs}from"../breadcrumbs/index.mjs";
@@ -1 +1 @@
1
- "use strict";var e=require("../context-reducer/index.cjs");require("react/jsx-runtime"),require("client-only"),require("react"),require("../noop/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs"),exports.createContextReducer=e.createContextReducer;
1
+ "use strict";var e=require("../context-reducer/index.cjs");exports.createContextReducer=e.createContextReducer;
@@ -1 +1 @@
1
- export{createContextReducer}from"../context-reducer/index.mjs";import"react/jsx-runtime";import"client-only";import"react";import"../noop/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";
1
+ export{createContextReducer}from"../context-reducer/index.mjs";
@@ -1 +1 @@
1
- "use strict";var e=require("../context-state/index.cjs");require("react/jsx-runtime"),require("client-only"),require("react"),require("../noop/index.cjs"),exports.createContextState=e.createContextState;
1
+ "use strict";var t=require("../context-state/index.cjs");exports.createContextState=t.createContextState;
@@ -1 +1 @@
1
- export{createContextState}from"../context-state/index.mjs";import"react/jsx-runtime";import"client-only";import"react";import"../noop/index.mjs";
1
+ export{createContextState}from"../context-state/index.mjs";
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("../create-storage-state-factory/index.cjs");require("../create-storage-hook/index.cjs"),require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const r=e.createStorageStateFactory("localStorage");exports.createLocalStorageState=r;
1
+ "use strict";require("client-only");const e=require("../create-storage-state-factory/index.cjs").createStorageStateFactory("localStorage");exports.createLocalStorageState=e;
@@ -1 +1 @@
1
- import"client-only";import{createStorageStateFactory as e}from"../create-storage-state-factory/index.mjs";import"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";const o=e("localStorage");export{o as createLocalStorageState};
1
+ import"client-only";import{createStorageStateFactory as t}from"../create-storage-state-factory/index.mjs";const e=t("localStorage");export{e as createLocalStorageState};
@@ -1 +1 @@
1
- "use strict";var e=require("../magic-portal/index.cjs");require("react/jsx-runtime"),require("client-only"),require("react-dom"),require("../context-state/index.cjs"),require("react"),require("../noop/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),exports.createMagicPortal=e.createMagicPortal;
1
+ "use strict";var r=require("../magic-portal/index.cjs");exports.createMagicPortal=r.createMagicPortal;
@@ -1 +1 @@
1
- export{createMagicPortal}from"../magic-portal/index.mjs";import"react/jsx-runtime";import"client-only";import"react-dom";import"../context-state/index.mjs";import"react";import"../noop/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";
1
+ export{createMagicPortal}from"../magic-portal/index.mjs";
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("../create-storage-state-factory/index.cjs");require("../create-storage-hook/index.cjs"),require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const r=e.createStorageStateFactory("sessionStorage");exports.createSessionStorageState=r;
1
+ "use strict";require("client-only");const e=require("../create-storage-state-factory/index.cjs").createStorageStateFactory("sessionStorage");exports.createSessionStorageState=e;
@@ -1 +1 @@
1
- import"client-only";import{createStorageStateFactory as e}from"../create-storage-state-factory/index.mjs";import"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";const o=e("sessionStorage");export{o as createSessionStorageState};
1
+ import"client-only";import{createStorageStateFactory as t}from"../create-storage-state-factory/index.mjs";const e=t("sessionStorage");export{e as createSessionStorageState};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),t=require("../noop/index.cjs"),r=require("../use-isomorphic-layout-effect/index.cjs"),n=require("../no-ssr/index.cjs"),o=require("../chunks/index.b9dLwVor.cjs"),i=require("../chunks/index.BtiK5_Nn.cjs");require("../create-stackless-error/index.cjs"),exports.createStorage=function(a){const s="localStorage"===a?"foxact-use-local-storage":"foxact-use-session-storage",l="localStorage"===a?"foxact/use-local-storage":"foxact/use-session-storage";function c(){throw n.noSSRError("[".concat(l,"] cannot be used on the server without a serverValue"))}const u="u"<typeof window?t.noop:e=>{window.dispatchEvent(new CustomEvent(s,{detail:e}))},d="u"<typeof window?t.noop:(e,t)=>{try{window[a].setItem(e,t)}catch(e){console.warn("[".concat(l,"] Failed to set value to ").concat(a,", it might be blocked"))}finally{u(e)}},w="u"<typeof window?t.noop:e=>{try{window[a].removeItem(e)}catch(e){console.warn("[".concat(l,"] Failed to remove value from ").concat(a,", it might be blocked"))}finally{u(e)}},f=e=>{if("u"<typeof window)return null;try{return window[a].getItem(e)}catch(e){return console.warn("[".concat(l,"] Failed to get value from ").concat(a,", it might be blocked")),null}},v=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const n=r.raw?o.t:r.serializer,a=r.raw?o.t:r.deserializer;return e.useCallback(e=>{try{let r;if(i.n(e)){const n=f(t),o=null===n?null:a(n);r=e(o)}else r=e;null===r?w(t):d(t,n(r))}catch(e){console.warn(e)}},[t,n,a])};function g(n,i){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const l=e.useCallback(e=>{if("u"<typeof window)return t.noop;const r=t=>{"key"in t&&t.key!==n||e()},o=t=>{t.detail===n&&e()};return window.addEventListener("storage",r),window.addEventListener(s,o),()=>{window.removeEventListener("storage",r),window.removeEventListener(s,o)}},[n]),u=a.raw?o.t:a.serializer,w=a.raw?o.t:a.deserializer,v=void 0===i?c:()=>u(i),g=e.useSyncExternalStore(l,()=>f(n),v),y=e.useMemo(()=>null===g?null:w(g),[g,w]);return r.useLayoutEffect(()=>{null===f(n)&&void 0!==i&&d(n,u(i))},[n,u,i]),null===y?void 0===i?null:i:y}return{useStorageValue:g,useSetStorage:v,useStorage:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};return[g(e,t,r),v(e,r)]}}};
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 +1 @@
1
- import"client-only";import{useCallback as e,useSyncExternalStore as t,useMemo as o}from"react";import{noop as r}from"../noop/index.mjs";import{useLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as i}from"../no-ssr/index.mjs";import{t as a}from"../chunks/index.D0KaUCcV.mjs";import{n as s}from"../chunks/index.C9-3oDdv.mjs";import"../create-stackless-error/index.mjs";function l(l){const c="localStorage"===l?"foxact-use-local-storage":"foxact-use-session-storage",u="localStorage"===l?"foxact/use-local-storage":"foxact/use-session-storage";function d(){throw i("[".concat(u,"] cannot be used on the server without a serverValue"))}const w="u"<typeof window?r:e=>{window.dispatchEvent(new CustomEvent(c,{detail:e}))},m="u"<typeof window?r:(e,t)=>{try{window[l].setItem(e,t)}catch(e){console.warn("[".concat(u,"] Failed to set value to ").concat(l,", it might be blocked"))}finally{w(e)}},f="u"<typeof window?r:e=>{try{window[l].removeItem(e)}catch(e){console.warn("[".concat(u,"] Failed to remove value from ").concat(l,", it might be blocked"))}finally{w(e)}},g=e=>{if("u"<typeof window)return null;try{return window[l].getItem(e)}catch(e){return console.warn("[".concat(u,"] Failed to get value from ").concat(l,", it might be blocked")),null}},v=function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const r=o.raw?a:o.serializer,n=o.raw?a:o.deserializer;return e(e=>{try{let o;if(s(e)){const r=g(t),i=null===r?null:n(r);o=e(i)}else o=e;null===o?f(t):m(t,r(o))}catch(e){console.warn(e)}},[t,r,n])};function p(i,s){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const u=e(e=>{if("u"<typeof window)return r;const t=t=>{"key"in t&&t.key!==i||e()},o=t=>{t.detail===i&&e()};return window.addEventListener("storage",t),window.addEventListener(c,o),()=>{window.removeEventListener("storage",t),window.removeEventListener(c,o)}},[i]),w=l.raw?a:l.serializer,f=l.raw?a:l.deserializer,v=t(u,()=>g(i),void 0===s?d:()=>w(s)),p=o(()=>null===v?null:f(v),[v,f]);return n(()=>{null===g(i)&&void 0!==s&&m(i,w(s))},[i,w,s]),null===p?void 0===s?null:s:p}return{useStorageValue:p,useSetStorage:v,useStorage:function(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};return[p(e,t,o),v(e,o)]}}}export{l as createStorage};
1
+ 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 +1 @@
1
- "use strict";var e=require("../create-storage-hook/index.cjs");require("client-only"),require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs"),exports.createStorageStateFactory=function(r){return function(t,i){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const{useStorage:c,useStorageValue:n,useSetStorage:o}=e.createStorage(r);return[()=>c(t,i,s),()=>n(t,i,s),()=>o(t,s)]}};
1
+ "use strict";var e=require("../create-storage-hook/index.cjs");exports.createStorageStateFactory=function(r){return function(t,a){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const{useStorage:s,useStorageValue:i,useSetStorage:n}=e.createStorage(r);return[()=>s(t,a,o),()=>i(t,a,o),()=>n(t,o)]}};
@@ -1 +1 @@
1
- import{createStorage as e}from"../create-storage-hook/index.mjs";import"client-only";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";function r(r){return function(t,o){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const{useStorage:s,useStorageValue:n,useSetStorage:a}=e(r);return[()=>s(t,o,i),()=>n(t,o,i),()=>a(t,i)]}}export{r as createStorageStateFactory};
1
+ import{createStorage as e}from"../create-storage-hook/index.mjs";function r(r){return function(t,o){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:JSON.stringify,deserializer:JSON.parse};const{useStorage:i,useStorageValue:n,useSetStorage:s}=e(r);return[()=>i(t,o,a),()=>n(t,o,a),()=>s(t,a)]}}export{r as createStorageStateFactory};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");const n=r.memo(function(n){let{defaultYear:u,...i}=n;"u"<typeof window&&void 0===u&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[o,s]=r.useState(()=>u||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{s(new Date().getFullYear())},[]),e.jsx("span",{...i,children:o})});exports.CurrentYear=n;
2
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");const u=r.memo(function(u){let{defaultYear:n,...i}=u;"u"<typeof window&&void 0===n&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(()=>n||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...i,children:s})});exports.CurrentYear=u;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";const o=r(function(r){let{defaultYear:o,...i}=r;"u"<typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,u]=t(()=>o||new Date().getFullYear());return n(()=>{u(new Date().getFullYear())},[]),e("span",{...i,children:a})});export{o as CurrentYear};
2
+ import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";const o=r(function(r){let{defaultYear:o,...i}=r;"u"<typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,u]=t(()=>o||new Date().getFullYear());return n(()=>{u(new Date().getFullYear())},[]),e("span",{...i,children:a})});export{o as CurrentYear};
@@ -1 +1 @@
1
- "use strict";var e=require("react/jsx-runtime");require("client-only");var r=require("react-dom"),t=require("../context-state/index.cjs"),n=require("../no-ssr/index.cjs"),o=require("react");require("../noop/index.cjs"),require("../create-stackless-error/index.cjs"),exports.createMagicPortal=function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[s,i,a]=t.createContextState(null);function l(r){let{as:t,ssrFallback:o=null,...s}=r;null!=o&&n.noSSR();const i=a();return e.jsx(t||"div",{...c?{"data-foxact-magic-portal-target":c}:{},ref:i,...s})}function u(r){const{ssrFallback:t=null}=r;return null!=t?e.jsx(o.Suspense,{fallback:t,children:e.jsx(l,{...r})}):e.jsx(l,{...r})}function d(e){let{children:t}=e;const n=i();return"u"<typeof window||!n?null:r.createPortal(t,n)}function p(r){let{children:t}=r;return e.jsx(s,{children:t})}return"production"!==process.env.NODE_ENV&&(u.displayName=c+".PortalTarget"),"production"!==process.env.NODE_ENV&&(d.displayName=c+".PortalContent"),"production"!==process.env.NODE_ENV&&(p.displayName=c+".PortalProvider"),[p,u,d]};
1
+ "use strict";var e=require("react/jsx-runtime");require("client-only");var t=require("react-dom"),r=require("../context-state/index.cjs"),n=require("../no-ssr/index.cjs"),o=require("react");exports.createMagicPortal=function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[l,a,i]=r.createContextState(null);function s(t){let{as:r,ssrFallback:o=null,...l}=t;null!=o&&n.noSSR();const a=i();return e.jsx(r||"div",{...c?{"data-foxact-magic-portal-target":c}:{},ref:a,...l})}function u(t){const{ssrFallback:r=null}=t;return null!=r?e.jsx(o.Suspense,{fallback:r,children:e.jsx(s,{...t})}):e.jsx(s,{...t})}function d(e){let{children:r}=e;const n=a();return"u"<typeof window||!n?null:t.createPortal(r,n)}function p(t){let{children:r}=t;return e.jsx(l,{children:r})}return"production"!==process.env.NODE_ENV&&(u.displayName=c+".PortalTarget"),"production"!==process.env.NODE_ENV&&(d.displayName=c+".PortalContent"),"production"!==process.env.NODE_ENV&&(p.displayName=c+".PortalProvider"),[p,u,d]};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import"client-only";import{createPortal as o}from"react-dom";import{createContextState as r}from"../context-state/index.mjs";import{noSSR as n}from"../no-ssr/index.mjs";import{Suspense as e}from"react";import"../noop/index.mjs";import"../create-stackless-error/index.mjs";function i(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[l,c,a]=r(null);function s(o){let{as:r,ssrFallback:e=null,...l}=o;null!=e&&n();const c=a();return t(r||"div",{...i?{"data-foxact-magic-portal-target":i}:{},ref:c,...l})}function m(o){const{ssrFallback:r=null}=o;return null!=r?t(e,{fallback:r,children:t(s,{...o})}):t(s,{...o})}function u(t){let{children:r}=t;const n=c();return"u"<typeof window||!n?null:o(r,n)}function p(o){let{children:r}=o;return t(l,{children:r})}return"production"!==process.env.NODE_ENV&&(m.displayName=i+".PortalTarget"),"production"!==process.env.NODE_ENV&&(u.displayName=i+".PortalContent"),"production"!==process.env.NODE_ENV&&(p.displayName=i+".PortalProvider"),[p,m,u]}export{i as createMagicPortal};
1
+ import{jsx as t}from"react/jsx-runtime";import"client-only";import{createPortal as o}from"react-dom";import{createContextState as r}from"../context-state/index.mjs";import{noSSR as n}from"../no-ssr/index.mjs";import{Suspense as e}from"react";function l(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[i,c,a]=r(null);function u(o){let{as:r,ssrFallback:e=null,...i}=o;null!=e&&n();const c=a();return t(r||"div",{...l?{"data-foxact-magic-portal-target":l}:{},ref:c,...i})}function m(o){const{ssrFallback:r=null}=o;return null!=r?t(e,{fallback:r,children:t(u,{...o})}):t(u,{...o})}function s(t){let{children:r}=t;const n=c();return"u"<typeof window||!n?null:o(r,n)}function p(o){let{children:r}=o;return t(i,{children:r})}return"production"!==process.env.NODE_ENV&&(m.displayName=l+".PortalTarget"),"production"!==process.env.NODE_ENV&&(s.displayName=l+".PortalContent"),"production"!==process.env.NODE_ENV&&(p.displayName=l+".PortalProvider"),[p,m,s]}export{l as createMagicPortal};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "React Hooks/Utils done right. For browser, SSR, and React Server Components.",
5
5
  "homepage": "https://foxact.skk.moe",
6
6
  "repository": {
@@ -61,23 +61,23 @@
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
+ "./context-reducer": {
65
+ "types": "./context-reducer/index.d.ts",
66
66
  "import": {
67
- "types": "./compose-context-provider/index.d.ts",
68
- "default": "./compose-context-provider/index.mjs"
67
+ "types": "./context-reducer/index.d.ts",
68
+ "default": "./context-reducer/index.mjs"
69
69
  },
70
- "require": "./compose-context-provider/index.cjs",
71
- "default": "./compose-context-provider/index.cjs"
70
+ "require": "./context-reducer/index.cjs",
71
+ "default": "./context-reducer/index.cjs"
72
72
  },
73
- "./create-breadcrumbs": {
74
- "types": "./create-breadcrumbs/index.d.ts",
73
+ "./context-state": {
74
+ "types": "./context-state/index.d.ts",
75
75
  "import": {
76
- "types": "./create-breadcrumbs/index.d.ts",
77
- "default": "./create-breadcrumbs/index.mjs"
76
+ "types": "./context-state/index.d.ts",
77
+ "default": "./context-state/index.mjs"
78
78
  },
79
- "require": "./create-breadcrumbs/index.cjs",
80
- "default": "./create-breadcrumbs/index.cjs"
79
+ "require": "./context-state/index.cjs",
80
+ "default": "./context-state/index.cjs"
81
81
  },
82
82
  "./create-context-reducer": {
83
83
  "types": "./create-context-reducer/index.d.ts",
@@ -97,14 +97,23 @@
97
97
  "require": "./create-context-state/index.cjs",
98
98
  "default": "./create-context-state/index.cjs"
99
99
  },
100
- "./context-state": {
101
- "types": "./context-state/index.d.ts",
100
+ "./compose-context-provider": {
101
+ "types": "./compose-context-provider/index.d.ts",
102
102
  "import": {
103
- "types": "./context-state/index.d.ts",
104
- "default": "./context-state/index.mjs"
103
+ "types": "./compose-context-provider/index.d.ts",
104
+ "default": "./compose-context-provider/index.mjs"
105
105
  },
106
- "require": "./context-state/index.cjs",
107
- "default": "./context-state/index.cjs"
106
+ "require": "./compose-context-provider/index.cjs",
107
+ "default": "./compose-context-provider/index.cjs"
108
+ },
109
+ "./create-breadcrumbs": {
110
+ "types": "./create-breadcrumbs/index.d.ts",
111
+ "import": {
112
+ "types": "./create-breadcrumbs/index.d.ts",
113
+ "default": "./create-breadcrumbs/index.mjs"
114
+ },
115
+ "require": "./create-breadcrumbs/index.cjs",
116
+ "default": "./create-breadcrumbs/index.cjs"
108
117
  },
109
118
  "./create-fixed-array": {
110
119
  "types": "./create-fixed-array/index.d.ts",
@@ -124,15 +133,6 @@
124
133
  "require": "./create-magic-portal/index.cjs",
125
134
  "default": "./create-magic-portal/index.cjs"
126
135
  },
127
- "./create-session-storage-state": {
128
- "types": "./create-session-storage-state/index.d.ts",
129
- "import": {
130
- "types": "./create-session-storage-state/index.d.ts",
131
- "default": "./create-session-storage-state/index.mjs"
132
- },
133
- "require": "./create-session-storage-state/index.cjs",
134
- "default": "./create-session-storage-state/index.cjs"
135
- },
136
136
  "./create-stackless-error": {
137
137
  "types": "./create-stackless-error/index.d.ts",
138
138
  "import": {
@@ -142,6 +142,15 @@
142
142
  "require": "./create-stackless-error/index.cjs",
143
143
  "default": "./create-stackless-error/index.cjs"
144
144
  },
145
+ "./create-session-storage-state": {
146
+ "types": "./create-session-storage-state/index.d.ts",
147
+ "import": {
148
+ "types": "./create-session-storage-state/index.d.ts",
149
+ "default": "./create-session-storage-state/index.mjs"
150
+ },
151
+ "require": "./create-session-storage-state/index.cjs",
152
+ "default": "./create-session-storage-state/index.cjs"
153
+ },
145
154
  "./create-storage-hook": {
146
155
  "types": "./create-storage-hook/index.d.ts",
147
156
  "import": {
@@ -160,15 +169,6 @@
160
169
  "require": "./create-storage-state-factory/index.cjs",
161
170
  "default": "./create-storage-state-factory/index.cjs"
162
171
  },
163
- "./current-year": {
164
- "types": "./current-year/index.d.ts",
165
- "import": {
166
- "types": "./current-year/index.d.ts",
167
- "default": "./current-year/index.mjs"
168
- },
169
- "require": "./current-year/index.cjs",
170
- "default": "./current-year/index.cjs"
171
- },
172
172
  "./fetch-jsonp": {
173
173
  "types": "./fetch-jsonp/index.d.ts",
174
174
  "import": {
@@ -178,23 +178,23 @@
178
178
  "require": "./fetch-jsonp/index.cjs",
179
179
  "default": "./fetch-jsonp/index.cjs"
180
180
  },
181
- "./context-reducer": {
182
- "types": "./context-reducer/index.d.ts",
181
+ "./current-year": {
182
+ "types": "./current-year/index.d.ts",
183
183
  "import": {
184
- "types": "./context-reducer/index.d.ts",
185
- "default": "./context-reducer/index.mjs"
184
+ "types": "./current-year/index.d.ts",
185
+ "default": "./current-year/index.mjs"
186
186
  },
187
- "require": "./context-reducer/index.cjs",
188
- "default": "./context-reducer/index.cjs"
187
+ "require": "./current-year/index.cjs",
188
+ "default": "./current-year/index.cjs"
189
189
  },
190
- "./invariant": {
191
- "types": "./invariant/index.d.ts",
190
+ "./create-local-storage-state": {
191
+ "types": "./create-local-storage-state/index.d.ts",
192
192
  "import": {
193
- "types": "./invariant/index.d.ts",
194
- "default": "./invariant/index.mjs"
193
+ "types": "./create-local-storage-state/index.d.ts",
194
+ "default": "./create-local-storage-state/index.mjs"
195
195
  },
196
- "require": "./invariant/index.cjs",
197
- "default": "./invariant/index.cjs"
196
+ "require": "./create-local-storage-state/index.cjs",
197
+ "default": "./create-local-storage-state/index.cjs"
198
198
  },
199
199
  "./is-safari": {
200
200
  "types": "./is-safari/index.d.ts",
@@ -205,14 +205,14 @@
205
205
  "require": "./is-safari/index.cjs",
206
206
  "default": "./is-safari/index.cjs"
207
207
  },
208
- "./merge-refs": {
209
- "types": "./merge-refs/index.d.ts",
208
+ "./invariant": {
209
+ "types": "./invariant/index.d.ts",
210
210
  "import": {
211
- "types": "./merge-refs/index.d.ts",
212
- "default": "./merge-refs/index.mjs"
211
+ "types": "./invariant/index.d.ts",
212
+ "default": "./invariant/index.mjs"
213
213
  },
214
- "require": "./merge-refs/index.cjs",
215
- "default": "./merge-refs/index.cjs"
214
+ "require": "./invariant/index.cjs",
215
+ "default": "./invariant/index.cjs"
216
216
  },
217
217
  "./magic-portal": {
218
218
  "types": "./magic-portal/index.d.ts",
@@ -232,6 +232,24 @@
232
232
  "require": "./no-ssr/index.cjs",
233
233
  "default": "./no-ssr/index.cjs"
234
234
  },
235
+ "./merge-refs": {
236
+ "types": "./merge-refs/index.d.ts",
237
+ "import": {
238
+ "types": "./merge-refs/index.d.ts",
239
+ "default": "./merge-refs/index.mjs"
240
+ },
241
+ "require": "./merge-refs/index.cjs",
242
+ "default": "./merge-refs/index.cjs"
243
+ },
244
+ "./noop-component": {
245
+ "types": "./noop-component/index.d.ts",
246
+ "import": {
247
+ "types": "./noop-component/index.d.ts",
248
+ "default": "./noop-component/index.mjs"
249
+ },
250
+ "require": "./noop-component/index.cjs",
251
+ "default": "./noop-component/index.cjs"
252
+ },
235
253
  "./noop": {
236
254
  "types": "./noop/index.d.ts",
237
255
  "import": {
@@ -250,15 +268,6 @@
250
268
  "require": "./nullthrow/index.cjs",
251
269
  "default": "./nullthrow/index.cjs"
252
270
  },
253
- "./noop-component": {
254
- "types": "./noop-component/index.d.ts",
255
- "import": {
256
- "types": "./noop-component/index.d.ts",
257
- "default": "./noop-component/index.mjs"
258
- },
259
- "require": "./noop-component/index.cjs",
260
- "default": "./noop-component/index.cjs"
261
- },
262
271
  "./open-new-tab": {
263
272
  "types": "./open-new-tab/index.d.ts",
264
273
  "import": {
@@ -268,15 +277,6 @@
268
277
  "require": "./open-new-tab/index.cjs",
269
278
  "default": "./open-new-tab/index.cjs"
270
279
  },
271
- "./rem": {
272
- "types": "./rem/index.d.ts",
273
- "import": {
274
- "types": "./rem/index.d.ts",
275
- "default": "./rem/index.mjs"
276
- },
277
- "require": "./rem/index.cjs",
278
- "default": "./rem/index.cjs"
279
- },
280
280
  "./request-idle-callback": {
281
281
  "types": "./request-idle-callback/index.d.ts",
282
282
  "import": {
@@ -286,6 +286,15 @@
286
286
  "require": "./request-idle-callback/index.cjs",
287
287
  "default": "./request-idle-callback/index.cjs"
288
288
  },
289
+ "./rem": {
290
+ "types": "./rem/index.d.ts",
291
+ "import": {
292
+ "types": "./rem/index.d.ts",
293
+ "default": "./rem/index.mjs"
294
+ },
295
+ "require": "./rem/index.cjs",
296
+ "default": "./rem/index.cjs"
297
+ },
289
298
  "./types": {
290
299
  "types": "./types/index.d.ts",
291
300
  "import": {
@@ -304,15 +313,6 @@
304
313
  "require": "./typescript-happy-forward-ref/index.cjs",
305
314
  "default": "./typescript-happy-forward-ref/index.cjs"
306
315
  },
307
- "./create-local-storage-state": {
308
- "types": "./create-local-storage-state/index.d.ts",
309
- "import": {
310
- "types": "./create-local-storage-state/index.d.ts",
311
- "default": "./create-local-storage-state/index.mjs"
312
- },
313
- "require": "./create-local-storage-state/index.cjs",
314
- "default": "./create-local-storage-state/index.cjs"
315
- },
316
316
  "./use": {
317
317
  "types": "./use/index.d.ts",
318
318
  "import": {
@@ -340,14 +340,14 @@
340
340
  "require": "./use-array/index.cjs",
341
341
  "default": "./use-array/index.cjs"
342
342
  },
343
- "./use-component-will-receive-update": {
344
- "types": "./use-component-will-receive-update/index.d.ts",
343
+ "./use-clipboard": {
344
+ "types": "./use-clipboard/index.d.ts",
345
345
  "import": {
346
- "types": "./use-component-will-receive-update/index.d.ts",
347
- "default": "./use-component-will-receive-update/index.mjs"
346
+ "types": "./use-clipboard/index.d.ts",
347
+ "default": "./use-clipboard/index.mjs"
348
348
  },
349
- "require": "./use-component-will-receive-update/index.cjs",
350
- "default": "./use-component-will-receive-update/index.cjs"
349
+ "require": "./use-clipboard/index.cjs",
350
+ "default": "./use-clipboard/index.cjs"
351
351
  },
352
352
  "./use-composition-input": {
353
353
  "types": "./use-composition-input/index.d.ts",
@@ -358,14 +358,14 @@
358
358
  "require": "./use-composition-input/index.cjs",
359
359
  "default": "./use-composition-input/index.cjs"
360
360
  },
361
- "./use-clipboard": {
362
- "types": "./use-clipboard/index.d.ts",
361
+ "./use-component-will-receive-update": {
362
+ "types": "./use-component-will-receive-update/index.d.ts",
363
363
  "import": {
364
- "types": "./use-clipboard/index.d.ts",
365
- "default": "./use-clipboard/index.mjs"
364
+ "types": "./use-component-will-receive-update/index.d.ts",
365
+ "default": "./use-component-will-receive-update/index.mjs"
366
366
  },
367
- "require": "./use-clipboard/index.cjs",
368
- "default": "./use-clipboard/index.cjs"
367
+ "require": "./use-component-will-receive-update/index.cjs",
368
+ "default": "./use-component-will-receive-update/index.cjs"
369
369
  },
370
370
  "./use-debounced-state": {
371
371
  "types": "./use-debounced-state/index.d.ts",
@@ -394,6 +394,15 @@
394
394
  "require": "./use-error-boundary/index.cjs",
395
395
  "default": "./use-error-boundary/index.cjs"
396
396
  },
397
+ "./use-is-client": {
398
+ "types": "./use-is-client/index.d.ts",
399
+ "import": {
400
+ "types": "./use-is-client/index.d.ts",
401
+ "default": "./use-is-client/index.mjs"
402
+ },
403
+ "require": "./use-is-client/index.cjs",
404
+ "default": "./use-is-client/index.cjs"
405
+ },
397
406
  "./use-fast-click": {
398
407
  "types": "./use-fast-click/index.d.ts",
399
408
  "import": {
@@ -412,14 +421,14 @@
412
421
  "require": "./use-intersection/index.cjs",
413
422
  "default": "./use-intersection/index.cjs"
414
423
  },
415
- "./use-is-client": {
416
- "types": "./use-is-client/index.d.ts",
424
+ "./use-isomorphic-layout-effect": {
425
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
417
426
  "import": {
418
- "types": "./use-is-client/index.d.ts",
419
- "default": "./use-is-client/index.mjs"
427
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
428
+ "default": "./use-isomorphic-layout-effect/index.mjs"
420
429
  },
421
- "require": "./use-is-client/index.cjs",
422
- "default": "./use-is-client/index.cjs"
430
+ "require": "./use-isomorphic-layout-effect/index.cjs",
431
+ "default": "./use-isomorphic-layout-effect/index.cjs"
423
432
  },
424
433
  "./use-is-online": {
425
434
  "types": "./use-is-online/index.d.ts",
@@ -430,15 +439,6 @@
430
439
  "require": "./use-is-online/index.cjs",
431
440
  "default": "./use-is-online/index.cjs"
432
441
  },
433
- "./use-isomorphic-layout-effect": {
434
- "types": "./use-isomorphic-layout-effect/index.d.ts",
435
- "import": {
436
- "types": "./use-isomorphic-layout-effect/index.d.ts",
437
- "default": "./use-isomorphic-layout-effect/index.mjs"
438
- },
439
- "require": "./use-isomorphic-layout-effect/index.cjs",
440
- "default": "./use-isomorphic-layout-effect/index.cjs"
441
- },
442
442
  "./use-local-storage": {
443
443
  "types": "./use-local-storage/index.d.ts",
444
444
  "import": {
@@ -448,6 +448,15 @@
448
448
  "require": "./use-local-storage/index.cjs",
449
449
  "default": "./use-local-storage/index.cjs"
450
450
  },
451
+ "./use-map": {
452
+ "types": "./use-map/index.d.ts",
453
+ "import": {
454
+ "types": "./use-map/index.d.ts",
455
+ "default": "./use-map/index.mjs"
456
+ },
457
+ "require": "./use-map/index.cjs",
458
+ "default": "./use-map/index.cjs"
459
+ },
451
460
  "./use-media-query": {
452
461
  "types": "./use-media-query/index.d.ts",
453
462
  "import": {
@@ -475,6 +484,15 @@
475
484
  "require": "./use-readonly-search-params/index.cjs",
476
485
  "default": "./use-readonly-search-params/index.cjs"
477
486
  },
487
+ "./use-resizing": {
488
+ "types": "./use-resizing/index.d.ts",
489
+ "import": {
490
+ "types": "./use-resizing/index.d.ts",
491
+ "default": "./use-resizing/index.mjs"
492
+ },
493
+ "require": "./use-resizing/index.cjs",
494
+ "default": "./use-resizing/index.cjs"
495
+ },
478
496
  "./use-retimer": {
479
497
  "types": "./use-retimer/index.d.ts",
480
498
  "import": {
@@ -484,15 +502,6 @@
484
502
  "require": "./use-retimer/index.cjs",
485
503
  "default": "./use-retimer/index.cjs"
486
504
  },
487
- "./use-set": {
488
- "types": "./use-set/index.d.ts",
489
- "import": {
490
- "types": "./use-set/index.d.ts",
491
- "default": "./use-set/index.mjs"
492
- },
493
- "require": "./use-set/index.cjs",
494
- "default": "./use-set/index.cjs"
495
- },
496
505
  "./use-session-storage": {
497
506
  "types": "./use-session-storage/index.d.ts",
498
507
  "import": {
@@ -502,14 +511,14 @@
502
511
  "require": "./use-session-storage/index.cjs",
503
512
  "default": "./use-session-storage/index.cjs"
504
513
  },
505
- "./use-map": {
506
- "types": "./use-map/index.d.ts",
514
+ "./use-set": {
515
+ "types": "./use-set/index.d.ts",
507
516
  "import": {
508
- "types": "./use-map/index.d.ts",
509
- "default": "./use-map/index.mjs"
517
+ "types": "./use-set/index.d.ts",
518
+ "default": "./use-set/index.mjs"
510
519
  },
511
- "require": "./use-map/index.cjs",
512
- "default": "./use-map/index.cjs"
520
+ "require": "./use-set/index.cjs",
521
+ "default": "./use-set/index.cjs"
513
522
  },
514
523
  "./use-singleton": {
515
524
  "types": "./use-singleton/index.d.ts",
@@ -538,6 +547,15 @@
538
547
  "require": "./use-state-with-deps/index.cjs",
539
548
  "default": "./use-state-with-deps/index.cjs"
540
549
  },
550
+ "./use-uncontrolled": {
551
+ "types": "./use-uncontrolled/index.d.ts",
552
+ "import": {
553
+ "types": "./use-uncontrolled/index.d.ts",
554
+ "default": "./use-uncontrolled/index.mjs"
555
+ },
556
+ "require": "./use-uncontrolled/index.cjs",
557
+ "default": "./use-uncontrolled/index.cjs"
558
+ },
541
559
  "./use-typescript-happy-callback": {
542
560
  "types": "./use-typescript-happy-callback/index.d.ts",
543
561
  "import": {
@@ -555,15 +573,6 @@
555
573
  },
556
574
  "require": "./use-url-hash-state/index.cjs",
557
575
  "default": "./use-url-hash-state/index.cjs"
558
- },
559
- "./use-uncontrolled": {
560
- "types": "./use-uncontrolled/index.d.ts",
561
- "import": {
562
- "types": "./use-uncontrolled/index.d.ts",
563
- "default": "./use-uncontrolled/index.mjs"
564
- },
565
- "require": "./use-uncontrolled/index.cjs",
566
- "default": "./use-uncontrolled/index.cjs"
567
576
  }
568
577
  }
569
578
  }
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":28610,"gzip":16853,"br":0},"exports":{"compose-context-provider":{"raw":177,"gzip":155,"br":122},"create-context-state":{"raw":145,"gzip":116,"br":96},"create-breadcrumbs":{"raw":301,"gzip":155,"br":131},"breadcrumbs":{"raw":872,"gzip":440,"br":380},"create-magic-portal":{"raw":268,"gzip":148,"br":121},"context-state":{"raw":402,"gzip":259,"br":218},"create-context-reducer":{"raw":223,"gzip":146,"br":117},"create-fixed-array":{"raw":452,"gzip":282,"br":248},"create-stackless-error":{"raw":278,"gzip":198,"br":162},"create-session-storage-state":{"raw":450,"gzip":223,"br":206},"create-storage-state-factory":{"raw":620,"gzip":341,"br":290},"fetch-jsonp":{"raw":890,"gzip":546,"br":429},"context-reducer":{"raw":557,"gzip":332,"br":319},"current-year":{"raw":528,"gzip":356,"br":292},"invariant":{"raw":178,"gzip":156,"br":118},"is-safari":{"raw":233,"gzip":164,"br":119},"merge-refs":{"raw":525,"gzip":280,"br":235},"no-ssr":{"raw":338,"gzip":267,"br":219},"noop":{"raw":33,"gzip":53,"br":37},"create-storage-hook":{"raw":2462,"gzip":972,"br":852},"magic-portal":{"raw":1083,"gzip":536,"br":472},"nullthrow":{"raw":187,"gzip":163,"br":121},"open-new-tab":{"raw":335,"gzip":255,"br":187},"types":{"raw":0,"gzip":20,"br":1},"noop-component":{"raw":142,"gzip":130,"br":111},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"request-idle-callback":{"raw":392,"gzip":221,"br":171},"rem":{"raw":823,"gzip":395,"br":350},"use":{"raw":298,"gzip":197,"br":160},"use-abortable-effect":{"raw":215,"gzip":170,"br":144},"create-local-storage-state":{"raw":446,"gzip":222,"br":209},"use-array":{"raw":334,"gzip":243,"br":206},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154},"use-composition-input":{"raw":470,"gzip":286,"br":241},"use-debounced-value":{"raw":553,"gzip":358,"br":320},"use-error-boundary":{"raw":252,"gzip":195,"br":165},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-is-client":{"raw":204,"gzip":153,"br":121},"use-fast-click":{"raw":622,"gzip":392,"br":317},"use-isomorphic-layout-effect":{"raw":169,"gzip":137,"br":110},"use-intersection":{"raw":1363,"gzip":716,"br":654},"use-is-online":{"raw":370,"gzip":258,"br":220},"use-clipboard":{"raw":2723,"gzip":1332,"br":1140},"use-local-storage":{"raw":428,"gzip":226,"br":198},"use-page-visibility":{"raw":359,"gzip":263,"br":210},"use-media-query":{"raw":648,"gzip":397,"br":332},"use-retimer":{"raw":194,"gzip":166,"br":127},"use-set":{"raw":368,"gzip":247,"br":211},"use-readonly-search-params":{"raw":1164,"gzip":589,"br":496},"use-session-storage":{"raw":434,"gzip":225,"br":210},"use-map":{"raw":384,"gzip":256,"br":220},"use-singleton":{"raw":149,"gzip":135,"br":116},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":450,"gzip":318,"br":249},"use-uncontrolled":{"raw":388,"gzip":273,"br":230},"use-state-with-deps":{"raw":767,"gzip":489,"br":427},"use-url-hash-state":{"raw":1121,"gzip":628,"br":556}}}
1
+ {"total":{"raw":26735,"gzip":16359,"br":0},"exports":{"create-context-reducer":{"raw":63,"gzip":74,"br":64},"create-context-state":{"raw":59,"gzip":72,"br":59},"breadcrumbs":{"raw":879,"gzip":467,"br":395},"context-reducer":{"raw":557,"gzip":332,"br":319},"create-breadcrumbs":{"raw":56,"gzip":68,"br":52},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"create-magic-portal":{"raw":57,"gzip":71,"br":53},"context-state":{"raw":402,"gzip":259,"br":218},"create-fixed-array":{"raw":452,"gzip":282,"br":248},"create-storage-state-factory":{"raw":364,"gzip":248,"br":197},"create-storage-hook":{"raw":2418,"gzip":955,"br":834},"fetch-jsonp":{"raw":890,"gzip":546,"br":429},"create-stackless-error":{"raw":278,"gzip":198,"br":162},"create-session-storage-state":{"raw":173,"gzip":138,"br":108},"create-local-storage-state":{"raw":169,"gzip":138,"br":111},"is-safari":{"raw":233,"gzip":164,"br":119},"current-year":{"raw":508,"gzip":348,"br":283},"no-ssr":{"raw":338,"gzip":267,"br":219},"invariant":{"raw":178,"gzip":156,"br":118},"noop-component":{"raw":142,"gzip":130,"br":111},"magic-portal":{"raw":1013,"gzip":517,"br":445},"noop":{"raw":33,"gzip":53,"br":37},"nullthrow":{"raw":187,"gzip":163,"br":121},"merge-refs":{"raw":525,"gzip":280,"br":235},"types":{"raw":0,"gzip":20,"br":1},"open-new-tab":{"raw":335,"gzip":255,"br":187},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"request-idle-callback":{"raw":392,"gzip":221,"br":171},"use":{"raw":298,"gzip":197,"br":160},"rem":{"raw":823,"gzip":395,"br":350},"use-abortable-effect":{"raw":215,"gzip":170,"br":144},"use-array":{"raw":334,"gzip":243,"br":206},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154},"use-composition-input":{"raw":470,"gzip":286,"br":241},"use-error-boundary":{"raw":252,"gzip":195,"br":165},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-debounced-value":{"raw":553,"gzip":358,"br":320},"use-is-client":{"raw":204,"gzip":153,"br":121},"use-isomorphic-layout-effect":{"raw":169,"gzip":137,"br":110},"use-fast-click":{"raw":499,"gzip":350,"br":284},"use-clipboard":{"raw":2723,"gzip":1332,"br":1140},"use-local-storage":{"raw":192,"gzip":143,"br":114},"use-is-online":{"raw":370,"gzip":258,"br":220},"use-map":{"raw":384,"gzip":256,"br":220},"use-intersection":{"raw":1363,"gzip":716,"br":654},"use-retimer":{"raw":194,"gzip":166,"br":127},"use-page-visibility":{"raw":359,"gzip":263,"br":210},"use-media-query":{"raw":604,"gzip":380,"br":315},"use-readonly-search-params":{"raw":1120,"gzip":573,"br":477},"use-session-storage":{"raw":198,"gzip":141,"br":118},"use-resizing":{"raw":511,"gzip":334,"br":294},"use-set":{"raw":368,"gzip":247,"br":211},"use-singleton":{"raw":149,"gzip":135,"br":116},"use-uncontrolled":{"raw":388,"gzip":273,"br":230},"use-state-with-deps":{"raw":747,"gzip":479,"br":418},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":450,"gzip":318,"br":249},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-url-hash-state":{"raw":1077,"gzip":611,"br":536}}}
@@ -1 +1 @@
1
- "use strict";var e=require("react"),r=require("../use-media-query/index.cjs");require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../noop/index.cjs"),require("event-target-bus"),exports.useFastClick=function(n){const s=e.useCallback(e=>{("mousedown"!==e.type||0===e.button)&&("development"!==process.env.NODE_ENV||e.currentTarget instanceof HTMLDivElement||e.currentTarget instanceof HTMLButtonElement||console.warn('[foxact/use-fast-click] You should only use "useFastClick" on <div /> or <button /> elements'),n(e))},[n]);return r.useMediaQuery("(pointer: coarse)",!1)?{onClick:s}:{onMouseDown:s}};
1
+ "use strict";var e=require("react"),t=require("../use-media-query/index.cjs");exports.useFastClick=function(n){const o=e.useCallback(e=>{("mousedown"!==e.type||0===e.button)&&("development"!==process.env.NODE_ENV||e.currentTarget instanceof HTMLDivElement||e.currentTarget instanceof HTMLButtonElement||console.warn('[foxact/use-fast-click] You should only use "useFastClick" on <div /> or <button /> elements'),n(e))},[n]);return t.useMediaQuery("(pointer: coarse)",!1)?{onClick:o}:{onMouseDown:o}};
@@ -1 +1 @@
1
- import{useCallback as e}from"react";import{useMediaQuery as o}from"../use-media-query/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../noop/index.mjs";import"event-target-bus";function t(t){const n=e(e=>{("mousedown"!==e.type||0===e.button)&&("development"!==process.env.NODE_ENV||e.currentTarget instanceof HTMLDivElement||e.currentTarget instanceof HTMLButtonElement||console.warn('[foxact/use-fast-click] You should only use "useFastClick" on <div /> or <button /> elements'),t(e))},[t]);return o("(pointer: coarse)",!1)?{onClick:n}:{onMouseDown:n}}export{t as useFastClick};
1
+ import{useCallback as e}from"react";import{useMediaQuery as o}from"../use-media-query/index.mjs";function t(t){const n=e(e=>{("mousedown"!==e.type||0===e.button)&&("development"!==process.env.NODE_ENV||e.currentTarget instanceof HTMLDivElement||e.currentTarget instanceof HTMLButtonElement||console.warn('[foxact/use-fast-click] You should only use "useFastClick" on <div /> or <button /> elements'),t(e))},[t]);return o("(pointer: coarse)",!1)?{onClick:n}:{onMouseDown:n}}export{t as useFastClick};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("../create-storage-hook/index.cjs");require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const{useStorage:r,useSetStorage:s}=e.createStorage("localStorage");exports.useLocalStorage=r,exports.useSetLocalStorage=s;
1
+ "use strict";require("client-only");const{useStorage:e,useSetStorage:t}=require("../create-storage-hook/index.cjs").createStorage("localStorage");exports.useLocalStorage=e,exports.useSetLocalStorage=t;
@@ -1 +1 @@
1
- import"client-only";import{createStorage as e}from"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";const{useStorage:o,useSetStorage:t}=e("localStorage");export{o as useLocalStorage,t as useSetLocalStorage};
1
+ import"client-only";import{createStorage as e}from"../create-storage-hook/index.mjs";const{useStorage:o,useSetStorage:t}=e("localStorage");export{o as useLocalStorage,t as useSetLocalStorage};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("../no-ssr/index.cjs"),r=require("../noop/index.cjs"),t=require("react"),n=require("event-target-bus");require("../create-stackless-error/index.cjs");const o=new Map;function u(){throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")}exports.useMediaQuery=function(e,s){const i=t.useCallback(t=>(function(e,t){if("u"<typeof window)return r.noop;let u=o.get(e);return u||(u=n.createEventTargetBus(window.matchMedia(e),"change"),o.set(e,u)),u.on(t)})(e,t),[e]);return t.useSyncExternalStore(i,()=>"u"<typeof window?null!=s&&s:window.matchMedia(e).matches,void 0===s?u:()=>s)};
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)};
@@ -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 r}from"react";import{createEventTargetBus as n}from"event-target-bus";import"../create-stackless-error/index.mjs";const i=new Map;function s(){throw e("useMediaQuery cannot be used on the server without a serverValue")}function u(e,u){return r(o(o=>(function(e,o){if("u"<typeof window)return t;let r=i.get(e);return r||(r=n(window.matchMedia(e),"change"),i.set(e,r)),r.on(o)})(e,o),[e]),()=>"u"<typeof window?null!=u&&u:window.matchMedia(e).matches,void 0===u?s:()=>u)}export{u as useMediaQuery};
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};
@@ -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");require("../create-stackless-error/index.cjs");class t extends Error{constructor(){var e;super("[foxact/use-readonly-search-params] Method unavailable on `ReadonlyURLSearchParams`"),(e="name")in this?Object.defineProperty(this,e,{value:"ReadonlyURLSearchParamsError",enumerable:!0,configurable:!0,writable:!0}):this[e]="ReadonlyURLSearchParamsError"}}class o extends URLSearchParams{append(){throw new t}delete(){throw new t}set(){throw new t}sort(){throw new t}}let s=null;function u(r){return"u"<typeof window?n.noop:(null!=s||(s=e.createEventTargetBus(window,"popstate")),s.on(r))}let c=null,l=null;function i(){return"u"<typeof window?new o:window.location.search===c&&null!==l?l:l=new o(c=window.location.search)}function w(){throw r.noSSRError('[foxact] useReadonlySearchParams cannot be used on the server without a "getServerDefaultValue" function')}exports.ReadonlyURLSearchParams=o,exports.useReadonlySearchParams=function(e){return a.useSyncExternalStore(u,i,null==e?w:()=>{const r=e();return r instanceof o?r:new o(r)})};
1
+ "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 +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";import"../create-stackless-error/index.mjs";class a extends Error{constructor(){var e;super("[foxact/use-readonly-search-params] Method unavailable on `ReadonlyURLSearchParams`"),(e="name")in this?Object.defineProperty(this,e,{value:"ReadonlyURLSearchParamsError",enumerable:!0,configurable:!0,writable:!0}):this[e]="ReadonlyURLSearchParamsError"}}class t extends URLSearchParams{append(){throw new a}delete(){throw new a}set(){throw new a}sort(){throw new a}}let s=null;function l(r){return"u"<typeof window?n:(null!=s||(s=e(window,"popstate")),s.on(r))}let c=null,u=null;function i(){return"u"<typeof window?new t:window.location.search===c&&null!==u?u:u=new t(c=window.location.search)}function w(){throw r('[foxact] useReadonlySearchParams cannot be used on the server without a "getServerDefaultValue" function')}function d(e){return o(l,i,null==e?w:()=>{const r=e();return r instanceof t?r:new t(r)})}export{t as ReadonlyURLSearchParams,d as useReadonlySearchParams};
1
+ 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};
@@ -0,0 +1 @@
1
+ "use strict";require("client-only");var e=require("react"),r=require("../use-debounced-state/index.cjs");exports.useResizing=function(){let{timeout:n=150,leading:u=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[t,c,s]=r.useDebouncedState(!1,n,!1),i=e.useRef(null),l=e.useRef(!0);return[t,e.useCallback(e=>{i.current&&(i.current.disconnect(),i.current=null),s(!1),l.current=!0,e&&(i.current=new ResizeObserver(()=>{(!l.current||(l.current=!1,u))&&(s(!0),c(!1))}),i.current.observe(e))},[u,s,c])]};
@@ -0,0 +1,9 @@
1
+ interface UseResizingOptions {
2
+ timeout?: number;
3
+ leading?: boolean;
4
+ }
5
+ /** @see https://foxact.skk.moe/use-resizing */
6
+ declare function useResizing({ timeout, leading }?: UseResizingOptions): [isResizing: boolean, refCallback: React.RefCallback<Element>];
7
+
8
+ export { useResizing };
9
+ export type { UseResizingOptions };
@@ -0,0 +1 @@
1
+ import"client-only";import{useRef as e,useCallback as r}from"react";import{useDebouncedState as n}from"../use-debounced-state/index.mjs";function t(){let{timeout:t=150,leading:c=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,o,i]=n(!1,t,!1),s=e(null),l=e(!0);return[u,r(e=>{s.current&&(s.current.disconnect(),s.current=null),i(!1),l.current=!0,e&&(s.current=new ResizeObserver(()=>{(!l.current||(l.current=!1,c))&&(i(!0),o(!1))}),s.current.observe(e))},[c,i,o])]}export{t as useResizing};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("../create-storage-hook/index.cjs");require("react"),require("../noop/index.cjs"),require("../use-isomorphic-layout-effect/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),require("../chunks/index.b9dLwVor.cjs"),require("../chunks/index.BtiK5_Nn.cjs");const{useStorage:r,useSetStorage:s}=e.createStorage("sessionStorage");exports.useSessionStorage=r,exports.useSetSessionStorage=s;
1
+ "use strict";require("client-only");const{useStorage:e,useSetStorage:s}=require("../create-storage-hook/index.cjs").createStorage("sessionStorage");exports.useSessionStorage=e,exports.useSetSessionStorage=s;
@@ -1 +1 @@
1
- import"client-only";import{createStorage as e}from"../create-storage-hook/index.mjs";import"react";import"../noop/index.mjs";import"../use-isomorphic-layout-effect/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";import"../chunks/index.D0KaUCcV.mjs";import"../chunks/index.C9-3oDdv.mjs";const{useStorage:o,useSetStorage:s}=e("sessionStorage");export{o as useSessionStorage,s as useSetSessionStorage};
1
+ import"client-only";import{createStorage as e}from"../create-storage-hook/index.mjs";const{useStorage:o,useSetStorage:s}=e("sessionStorage");export{o as useSessionStorage,s as useSetSessionStorage};
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");function s(e,t){Object.defineProperty(e.t,t,{get:()=>(e.d[t]=!0,e.s[t]),enumerable:!0})}function n(e){return{state:e.s,tracked:e.d}}require("client-only");const r=Object.prototype.hasOwnProperty;exports.useStateWithDeps=function(c){const[{inst:u},o]=e.useState(()=>{const e={s:c,d:{},t:{},u:!1};for(const t in c)r.call(c,t)&&s(e,t);return{inst:e}}),i=e.useCallback(e=>{const t="function"==typeof e?e(u.s):e;let n=!1;for(const e in t)r.call(t,e)&&(r.call(u.t,e)||s(u,e),!Object.is(u.s[e],t[e])&&(u.s[e]=t[e],u.d[e]&&(n=!0)));n&&!u.u&&o({inst:u})},[u]);return t.useLayoutEffect(()=>(u.u=!1,()=>{u.u=!0})),"production"!==process.env.NODE_ENV&&e.useDebugValue(u,n),[u.t,i]};
1
+ "use strict";var t=require("react"),e=require("../use-isomorphic-layout-effect/index.cjs");function s(t,e){Object.defineProperty(t.t,e,{get:()=>(t.d[e]=!0,t.s[e]),enumerable:!0})}function c(t){return{state:t.s,tracked:t.d}}const n=Object.prototype.hasOwnProperty;exports.useStateWithDeps=function(r){const[{inst:u},o]=t.useState(()=>{const t={s:r,d:{},t:{},u:!1};for(const e in r)n.call(r,e)&&s(t,e);return{inst:t}}),i=t.useCallback(t=>{const e="function"==typeof t?t(u.s):t;let c=!1;for(const t in e)n.call(e,t)&&(n.call(u.t,t)||s(u,t),!Object.is(u.s[t],e[t])&&(u.s[t]=e[t],u.d[t]&&(c=!0)));c&&!u.u&&o({inst:u})},[u]);return e.useLayoutEffect(()=>(u.u=!1,()=>{u.u=!0})),"production"!==process.env.NODE_ENV&&t.useDebugValue(u,c),[u.t,i]};
@@ -1 +1 @@
1
- import{useState as t,useCallback as e,useDebugValue as o}from"react";import{useLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";function r(t,e){Object.defineProperty(t.t,e,{get:()=>(t.d[e]=!0,t.s[e]),enumerable:!0})}function c(t){return{state:t.s,tracked:t.d}}const s=Object.prototype.hasOwnProperty;function i(i){const[{inst:u},p]=t(()=>{const t={s:i,d:{},t:{},u:!1};for(const e in i)s.call(i,e)&&r(t,e);return{inst:t}}),f=e(t=>{const e="function"==typeof t?t(u.s):t;let o=!1;for(const t in e)s.call(e,t)&&(s.call(u.t,t)||r(u,t),!Object.is(u.s[t],e[t])&&(u.s[t]=e[t],u.d[t]&&(o=!0)));o&&!u.u&&p({inst:u})},[u]);return n(()=>(u.u=!1,()=>{u.u=!0})),"production"!==process.env.NODE_ENV&&o(u,c),[u.t,f]}export{i as useStateWithDeps};
1
+ import{useState as t,useCallback as e,useDebugValue as o}from"react";import{useLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";function r(t,e){Object.defineProperty(t.t,e,{get:()=>(t.d[e]=!0,t.s[e]),enumerable:!0})}function s(t){return{state:t.s,tracked:t.d}}const c=Object.prototype.hasOwnProperty;function i(i){const[{inst:u},f]=t(()=>{const t={s:i,d:{},t:{},u:!1};for(const e in i)c.call(i,e)&&r(t,e);return{inst:t}}),p=e(t=>{const e="function"==typeof t?t(u.s):t;let o=!1;for(const t in e)c.call(e,t)&&(c.call(u.t,t)||r(u,t),!Object.is(u.s[t],e[t])&&(u.s[t]=e[t],u.d[t]&&(o=!0)));o&&!u.u&&f({inst:u})},[u]);return n(()=>(u.u=!1,()=>{u.u=!0})),"production"!==process.env.NODE_ENV&&o(u,s),[u.t,p]}export{i as useStateWithDeps};
@@ -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");require("../create-stackless-error/index.cjs");let a=null;const i=e=>"u"<typeof window?r.noop:(null!=a||(a=l.createEventTargetBus(window,"hashchange")),a.on(e));function o(){throw n.noSSRError("useUrlHashState cannot be used on the server without a serverValue")}exports.unstable_useUrlHashState=function(r,n){var l;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:t.t,deserializer:t.t};const u=a.raw?t.t:a.serializer,c=a.raw?t.t:a.deserializer,h=void 0===n?o:()=>u(n),d=e.useSyncExternalStore(i,()=>new URLSearchParams(location.hash.slice(1)).get(r),h),w=e.useMemo(()=>null===d?null!=n?n:null:c(d),[n,c,d]),S=e.useCallback(e=>{const t=location.hash,l=new URLSearchParams(t.slice(1)),a=s.n(e)?e(w):e;a===n||null===a?l.delete(r):l.set(r,u(a));const i=l.toString();t!==i&&(location.hash=i)},[n,w,r,u]);return[null!=(l=null!=w?w:n)?l:null,S]};
1
+ "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 +1 @@
1
- import"client-only";import{useSyncExternalStore as e,useMemo as r,useCallback as t}from"react";import{noop as n}from"../noop/index.mjs";import{noSSRError as o}from"../no-ssr/index.mjs";import{t as s}from"../chunks/index.D0KaUCcV.mjs";import{n as l}from"../chunks/index.C9-3oDdv.mjs";import{createEventTargetBus as a}from"event-target-bus";import"../create-stackless-error/index.mjs";let i=null;const u=e=>"u"<typeof window?n:(null!=i||(i=a(window,"hashchange")),i.on(e));function c(){throw o("useUrlHashState cannot be used on the server without a serverValue")}function m(n,o){var a;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:s,deserializer:s};const m=i.raw?s:i.serializer,h=i.raw?s:i.deserializer,d=e(u,()=>new URLSearchParams(location.hash.slice(1)).get(n),void 0===o?c:()=>m(o)),p=r(()=>null===d?null!=o?o:null:h(d),[o,h,d]),w=t(e=>{const r=location.hash,t=new URLSearchParams(r.slice(1)),s=l(e)?e(p):e;s===o||null===s?t.delete(n):t.set(n,m(s));const a=t.toString();r!==a&&(location.hash=a)},[o,p,n,m]);return[null!=(a=null!=p?p:o)?a:null,w]}export{m as unstable_useUrlHashState};
1
+ 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};