foxact 0.2.28 → 0.2.30

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.
@@ -1 +1 @@
1
- "use strict";var e=require("react");exports.ComposeContextProvider=r=>{let{contexts:t,children:o}=r;return t.reduceRight((r,t)=>e.cloneElement(t,{children:r}),o)};
1
+ "use strict";var e=require("react");const r=e.memo(r=>{let{contexts:t,children:o}=r;return t.reduceRight((r,t)=>e.cloneElement(t,{children:r}),o)});exports.ComposeContextProvider=r;
@@ -3,6 +3,7 @@ import * as react from 'react';
3
3
  interface ContextComposeProviderProps extends React.PropsWithChildren {
4
4
  contexts: React.ReactElement[];
5
5
  }
6
- declare const ComposeContextProvider: ({ contexts, children }: ContextComposeProviderProps) => react.ReactNode;
6
+ /** @see https://foxact.skk.moe/compose-context-provider */
7
+ declare const ComposeContextProvider: react.MemoExoticComponent<({ contexts, children }: ContextComposeProviderProps) => react.ReactNode>;
7
8
 
8
9
  export { ComposeContextProvider, type ContextComposeProviderProps };
@@ -1 +1 @@
1
- "use strict";var e=require("react");exports.ComposeContextProvider=r=>{let{contexts:t,children:o}=r;return t.reduceRight((r,t)=>e.cloneElement(t,{children:r}),o)};
1
+ "use strict";var e=require("react");const r=e.memo(r=>{let{contexts:t,children:o}=r;return t.reduceRight((r,t)=>e.cloneElement(t,{children:r}),o)});exports.ComposeContextProvider=r;
@@ -1 +1 @@
1
- import{cloneElement as e}from"react";const r=r=>{let{contexts:t,children:o}=r;return t.reduceRight((r,t)=>e(t,{children:r}),o)};export{r as ComposeContextProvider};
1
+ import{memo as e,cloneElement as r}from"react";const t=e(e=>{let{contexts:t,children:o}=e;return t.reduceRight((e,t)=>r(t,{children:e}),o)});export{t as ComposeContextProvider};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),o=require("../noop/index.cjs"),n=require("../use-isomorphic-layout-effect/index.cjs"),t=require("../no-ssr/index.cjs");const r=e=>"function"==typeof e,i=e=>e,a=()=>{throw t.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(t){const l="localStorage"===t?"foxact-local-storage":"foxact-session-storage",c="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))}:o.noop,s="undefined"!=typeof window?(e,o)=>{try{window[t].setItem(e,o)}catch(e){console.warn("[foxact] Failed to set value to ".concat(t,", it might be blocked"))}finally{c(e)}}:o.noop,u="undefined"!=typeof window?e=>{try{window[t].removeItem(e)}catch(e){console.warn("[foxact] Failed to remove value from ".concat(t,", it might be blocked"))}finally{c(e)}}:o.noop,d=e=>{if("undefined"==typeof window)return null;try{return window[t].getItem(e)}catch(e){return console.warn("[foxact] Failed to get value from ".concat(t,", it might be blocked")),null}};return{useStorage:function(t,c){var w;let f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const v=e.useCallback(e=>{if("undefined"==typeof window)return o.noop;const n=o=>{"key"in o&&o.key!==t||e()},r=o=>{o.detail===t&&e()};return window.addEventListener("storage",n),window.addEventListener(l,r),()=>{window.removeEventListener("storage",n),window.removeEventListener(l,r)}},[t]),y=f.raw?i:f.serializer,g=f.raw?i:f.deserializer,m=void 0!==c?()=>y(c):a,p=e.useSyncExternalStore(v,()=>d(t),m),h=e.useMemo(()=>null===p?null:g(p),[p,g]),S=e.useCallback(e=>{try{const o=r(e)?e(null!=h?h:null):e;null===o?u(t):s(t,y(o))}catch(e){console.warn(e)}},[t,y,h]);return n.useIsomorphicLayoutEffect(()=>{null===d(t)&&void 0!==c&&s(t,y(c))},[g,t,y,c]),[(w=null!=h?h:c)!==null&&void 0!==w?w:null,S]},useSetStorage:(o,n)=>e.useCallback(e=>{try{null===e?u(o):s(o,n(e))}catch(e){console.warn(e)}},[o,n])}};
1
+ "use strict";require("client-only");var e=require("react"),o=require("../noop/index.cjs"),t=require("../use-isomorphic-layout-effect/index.cjs"),n=require("../no-ssr/index.cjs");const r=e=>"function"==typeof e,a=e=>e,i=()=>{throw n.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(n){const l="localStorage"===n?"foxact-use-local-storage":"foxact-use-session-storage",c="localStorage"===n?"foxact/use-local-storage":"foxact/use-session-storage",s="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))}:o.noop,u="undefined"!=typeof window?(e,o)=>{try{window[n].setItem(e,o)}catch(e){console.warn("[".concat(c,"] Failed to set value to ").concat(n,", it might be blocked"))}finally{s(e)}}:o.noop,d="undefined"!=typeof window?e=>{try{window[n].removeItem(e)}catch(e){console.warn("[".concat(c,"] Failed to remove value from ").concat(n,", it might be blocked"))}finally{s(e)}}:o.noop,w=e=>{if("undefined"==typeof window)return null;try{return window[n].getItem(e)}catch(e){return console.warn("[".concat(c,"] Failed to get value from ").concat(n,", it might be blocked")),null}};return{useStorage:function(n,c){var s;let f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const v=e.useCallback(e=>{if("undefined"==typeof window)return o.noop;const t=o=>{"key"in o&&o.key!==n||e()},r=o=>{o.detail===n&&e()};return window.addEventListener("storage",t),window.addEventListener(l,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(l,r)}},[n]),y=f.raw?a:f.serializer,g=f.raw?a:f.deserializer,m=void 0!==c?()=>y(c):i,p=e.useSyncExternalStore(v,()=>w(n),m),h=e.useMemo(()=>null===p?null:g(p),[p,g]),S=e.useCallback(e=>{try{const o=r(e)?e(null!=h?h:null):e;null===o?d(n):u(n,y(o))}catch(e){console.warn(e)}},[n,y,h]);return t.useIsomorphicLayoutEffect(()=>{null===w(n)&&void 0!==c&&u(n,y(c))},[g,n,y,c]),[(s=null!=h?h:c)!==null&&void 0!==s?s:null,S]},useSetStorage:(o,t)=>e.useCallback(e=>{try{null===e?d(o):u(o,t(e))}catch(e){console.warn(e)}},[o,t])}};
@@ -5,8 +5,8 @@ type NotUndefined<T> = T extends undefined ? never : T;
5
5
  type CustomStorageEvent = CustomEvent<string>;
6
6
  declare global {
7
7
  interface WindowEventMap {
8
- 'foxact-local-storage': CustomStorageEvent;
9
- 'foxact-session-storage': CustomStorageEvent;
8
+ 'foxact-use-local-storage': CustomStorageEvent;
9
+ 'foxact-use-session-storage': CustomStorageEvent;
10
10
  }
11
11
  }
12
12
  type Serializer<T> = (value: T) => string;
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),o=require("../noop/index.js"),n=require("../use-isomorphic-layout-effect/index.js"),t=require("../no-ssr/index.js");const r=e=>"function"==typeof e,i=e=>e,a=()=>{throw t.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(t){const l="localStorage"===t?"foxact-local-storage":"foxact-session-storage",c="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))}:o.noop,s="undefined"!=typeof window?(e,o)=>{try{window[t].setItem(e,o)}catch(e){console.warn("[foxact] Failed to set value to ".concat(t,", it might be blocked"))}finally{c(e)}}:o.noop,u="undefined"!=typeof window?e=>{try{window[t].removeItem(e)}catch(e){console.warn("[foxact] Failed to remove value from ".concat(t,", it might be blocked"))}finally{c(e)}}:o.noop,d=e=>{if("undefined"==typeof window)return null;try{return window[t].getItem(e)}catch(e){return console.warn("[foxact] Failed to get value from ".concat(t,", it might be blocked")),null}};return{useStorage:function(t,c){var w;let f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const v=e.useCallback(e=>{if("undefined"==typeof window)return o.noop;const n=o=>{"key"in o&&o.key!==t||e()},r=o=>{o.detail===t&&e()};return window.addEventListener("storage",n),window.addEventListener(l,r),()=>{window.removeEventListener("storage",n),window.removeEventListener(l,r)}},[t]),y=f.raw?i:f.serializer,g=f.raw?i:f.deserializer,m=void 0!==c?()=>y(c):a,p=e.useSyncExternalStore(v,()=>d(t),m),h=e.useMemo(()=>null===p?null:g(p),[p,g]),S=e.useCallback(e=>{try{const o=r(e)?e(null!=h?h:null):e;null===o?u(t):s(t,y(o))}catch(e){console.warn(e)}},[t,y,h]);return n.useIsomorphicLayoutEffect(()=>{null===d(t)&&void 0!==c&&s(t,y(c))},[g,t,y,c]),[(w=null!=h?h:c)!==null&&void 0!==w?w:null,S]},useSetStorage:(o,n)=>e.useCallback(e=>{try{null===e?u(o):s(o,n(e))}catch(e){console.warn(e)}},[o,n])}};
1
+ "use strict";require("client-only");var e=require("react"),o=require("../noop/index.js"),t=require("../use-isomorphic-layout-effect/index.js"),n=require("../no-ssr/index.js");const r=e=>"function"==typeof e,a=e=>e,i=()=>{throw n.noSSRError("useLocalStorage cannot be used on the server without a serverValue")};exports.createStorage=function(n){const l="localStorage"===n?"foxact-use-local-storage":"foxact-use-session-storage",s="localStorage"===n?"foxact/use-local-storage":"foxact/use-session-storage",c="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))}:o.noop,u="undefined"!=typeof window?(e,o)=>{try{window[n].setItem(e,o)}catch(e){console.warn("[".concat(s,"] Failed to set value to ").concat(n,", it might be blocked"))}finally{c(e)}}:o.noop,d="undefined"!=typeof window?e=>{try{window[n].removeItem(e)}catch(e){console.warn("[".concat(s,"] Failed to remove value from ").concat(n,", it might be blocked"))}finally{c(e)}}:o.noop,w=e=>{if("undefined"==typeof window)return null;try{return window[n].getItem(e)}catch(e){return console.warn("[".concat(s,"] Failed to get value from ").concat(n,", it might be blocked")),null}};return{useStorage:function(n,s){var c;let f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const v=e.useCallback(e=>{if("undefined"==typeof window)return o.noop;const t=o=>{"key"in o&&o.key!==n||e()},r=o=>{o.detail===n&&e()};return window.addEventListener("storage",t),window.addEventListener(l,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(l,r)}},[n]),y=f.raw?a:f.serializer,g=f.raw?a:f.deserializer,m=void 0!==s?()=>y(s):i,p=e.useSyncExternalStore(v,()=>w(n),m),h=e.useMemo(()=>null===p?null:g(p),[p,g]),S=e.useCallback(e=>{try{const o=r(e)?e(null!=h?h:null):e;null===o?d(n):u(n,y(o))}catch(e){console.warn(e)}},[n,y,h]);return t.useIsomorphicLayoutEffect(()=>{null===w(n)&&void 0!==s&&u(n,y(s))},[g,n,y,s]),[(c=null!=h?h:s)!==null&&void 0!==c?c:null,S]},useSetStorage:(o,t)=>e.useCallback(e=>{try{null===e?d(o):u(o,t(e))}catch(e){console.warn(e)}},[o,t])}};
@@ -1 +1 @@
1
- import"client-only";import{useCallback as e,useSyncExternalStore as t,useMemo as o}from"react";import{noop as n}from"../noop/index.mjs";import{useIsomorphicLayoutEffect as r}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as i}from"../no-ssr/index.mjs";const l=e=>"function"==typeof e,a=e=>e,c=()=>{throw i("useLocalStorage cannot be used on the server without a serverValue")};function d(i){const d="localStorage"===i?"foxact-local-storage":"foxact-session-storage",s="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(d,{detail:e}))}:n,u="undefined"!=typeof window?(e,t)=>{try{window[i].setItem(e,t)}catch(e){console.warn("[foxact] Failed to set value to ".concat(i,", it might be blocked"))}finally{s(e)}}:n,w="undefined"!=typeof window?e=>{try{window[i].removeItem(e)}catch(e){console.warn("[foxact] Failed to remove value from ".concat(i,", it might be blocked"))}finally{s(e)}}:n,f=e=>{if("undefined"==typeof window)return null;try{return window[i].getItem(e)}catch(e){return console.warn("[foxact] Failed to get value from ".concat(i,", it might be blocked")),null}};return{useStorage:function(i,s){var m;let v=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const y=e(e=>{if("undefined"==typeof window)return n;const t=t=>{"key"in t&&t.key!==i||e()},o=t=>{t.detail===i&&e()};return window.addEventListener("storage",t),window.addEventListener(d,o),()=>{window.removeEventListener("storage",t),window.removeEventListener(d,o)}},[i]),g=v.raw?a:v.serializer,p=v.raw?a:v.deserializer,h=t(y,()=>f(i),void 0!==s?()=>g(s):c),x=o(()=>null===h?null:p(h),[h,p]),S=e(e=>{try{const t=l(e)?e(null!=x?x:null):e;null===t?w(i):u(i,g(t))}catch(e){console.warn(e)}},[i,g,x]);return r(()=>{null===f(i)&&void 0!==s&&u(i,g(s))},[p,i,g,s]),[(m=null!=x?x:s)!==null&&void 0!==m?m:null,S]},useSetStorage:(t,o)=>e(e=>{try{null===e?w(t):u(t,o(e))}catch(e){console.warn(e)}},[t,o])}}export{d as createStorage};
1
+ import"client-only";import{useCallback as e,useSyncExternalStore as o,useMemo as t}from"react";import{noop as n}from"../noop/index.mjs";import{useIsomorphicLayoutEffect as r}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as i}from"../no-ssr/index.mjs";const a=e=>"function"==typeof e,l=e=>e,c=()=>{throw i("useLocalStorage cannot be used on the server without a serverValue")};function s(i){const s="localStorage"===i?"foxact-use-local-storage":"foxact-use-session-storage",d="localStorage"===i?"foxact/use-local-storage":"foxact/use-session-storage",u="undefined"!=typeof window?e=>{window.dispatchEvent(new CustomEvent(s,{detail:e}))}:n,w="undefined"!=typeof window?(e,o)=>{try{window[i].setItem(e,o)}catch(e){console.warn("[".concat(d,"] Failed to set value to ").concat(i,", it might be blocked"))}finally{u(e)}}:n,f="undefined"!=typeof window?e=>{try{window[i].removeItem(e)}catch(e){console.warn("[".concat(d,"] Failed to remove value from ").concat(i,", it might be blocked"))}finally{u(e)}}:n,m=e=>{if("undefined"==typeof window)return null;try{return window[i].getItem(e)}catch(e){return console.warn("[".concat(d,"] Failed to get value from ").concat(i,", it might be blocked")),null}};return{useStorage:function(i,d){var u;let v=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const g=e(e=>{if("undefined"==typeof window)return n;const o=o=>{"key"in o&&o.key!==i||e()},t=o=>{o.detail===i&&e()};return window.addEventListener("storage",o),window.addEventListener(s,t),()=>{window.removeEventListener("storage",o),window.removeEventListener(s,t)}},[i]),y=v.raw?l:v.serializer,p=v.raw?l:v.deserializer,h=o(g,()=>m(i),void 0!==d?()=>y(d):c),S=t(()=>null===h?null:p(h),[h,p]),x=e(e=>{try{const o=a(e)?e(null!=S?S:null):e;null===o?f(i):w(i,y(o))}catch(e){console.warn(e)}},[i,y,S]);return r(()=>{null===m(i)&&void 0!==d&&w(i,y(d))},[p,i,y,d]),[(u=null!=S?S:d)!==null&&void 0!==u?u:null,x]},useSetStorage:(o,t)=>e(e=>{try{null===e?f(o):w(o,t(e))}catch(e){console.warn(e)}},[o,t])}}export{s as createStorage};
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");const n=r.memo(n=>{let{defaultYear:i,...u}=n;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(i||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:s})});"production"!==process.env.NODE_ENV&&(n.displayName="CurrentYear"),exports.CurrentYear=n;
@@ -0,0 +1,10 @@
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+
4
+ interface CurrentYearProps extends React.ComponentProps<'span'> {
5
+ defaultYear?: number;
6
+ }
7
+ /** @see https://foxact.skk.moe/current-year */
8
+ declare const CurrentYear: react.MemoExoticComponent<({ defaultYear, ...restProps }: CurrentYearProps) => react_jsx_runtime.JSX.Element>;
9
+
10
+ export { CurrentYear };
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.js");require("client-only");const n=r.memo(n=>{let{defaultYear:i,...u}=n;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(i||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:s})});"production"!==process.env.NODE_ENV&&(n.displayName="CurrentYear"),exports.CurrentYear=n;
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";const o=r(r=>{let{defaultYear:o,...i}=r;"undefined"==typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,s]=t(o||new Date().getFullYear());return n(()=>{s(new Date().getFullYear())},[]),e("span",{...i,children:a})});"production"!==process.env.NODE_ENV&&(o.displayName="CurrentYear");export{o as CurrentYear};
@@ -1 +1 @@
1
- "use strict";exports.invariant=function(n){if(null==n)throw Error("Value is null or undefined")};
1
+ "use strict";exports.invariant=function(n){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(i)};
@@ -1,4 +1,4 @@
1
1
  /** @see https://foxact.skk.moe/invariant-nullthrow */
2
- declare function invariant<T>(value: T): asserts value is NonNullable<T>;
2
+ declare function invariant<T>(value: T, message?: string): asserts value is NonNullable<T>;
3
3
 
4
4
  export { invariant };
@@ -1 +1 @@
1
- "use strict";exports.invariant=function(n){if(null==n)throw Error("Value is null or undefined")};
1
+ "use strict";exports.invariant=function(n){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(i)};
@@ -1 +1 @@
1
- function n(n){if(null==n)throw Error("Value is null or undefined")}export{n as invariant};
1
+ function n(n){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(i)}export{n as invariant};
@@ -1 +1 @@
1
- "use strict";exports.nullthrow=function(r){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Value is null or undefined";if(null==r)throw Error(l);return r};
1
+ "use strict";exports.nullthrow=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(r);return n};
@@ -1 +1 @@
1
- "use strict";exports.nullthrow=function(r){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Value is null or undefined";if(null==r)throw Error(l);return r};
1
+ "use strict";exports.nullthrow=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(r);return n};
@@ -1 +1 @@
1
- const n=function(n){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Value is null or undefined";if(null==n)throw Error(l);return n};export{n as nullthrow};
1
+ const n=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'[foxact/invariant] "value" is null or undefined';if(null==n)throw TypeError(r);return n};export{n as nullthrow};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.28",
3
+ "version": "0.2.30",
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": {
@@ -49,7 +49,8 @@
49
49
  "es-iterator-helpers": "npm:@nolyfill/es-iterator-helpers@latest",
50
50
  "array.prototype.findlastindex": "npm:@nolyfill/array.prototype.findlastindex@latest",
51
51
  "function-bind": "npm:@nolyfill/function-bind@latest",
52
- "object.groupby": "npm:@nolyfill/object.groupby@latest"
52
+ "object.groupby": "npm:@nolyfill/object.groupby@latest",
53
+ "hasown": "npm:@nolyfill/hasown@latest"
53
54
  },
54
55
  "typeVersions": {
55
56
  ">=4.8": {
@@ -66,15 +67,6 @@
66
67
  "exports": {
67
68
  "./package.json": "./package.json",
68
69
  "./sizes.json": "./sizes.json",
69
- "./nullthrow": {
70
- "types": "./nullthrow/index.d.ts",
71
- "import": {
72
- "types": "./nullthrow/index.d.ts",
73
- "default": "./nullthrow/index.mjs"
74
- },
75
- "require": "./nullthrow/index.cjs",
76
- "default": "./nullthrow/index.js"
77
- },
78
70
  "./use-uncontrolled": {
79
71
  "types": "./use-uncontrolled/index.d.ts",
80
72
  "import": {
@@ -84,6 +76,15 @@
84
76
  "require": "./use-uncontrolled/index.cjs",
85
77
  "default": "./use-uncontrolled/index.js"
86
78
  },
79
+ "./nullthrow": {
80
+ "types": "./nullthrow/index.d.ts",
81
+ "import": {
82
+ "types": "./nullthrow/index.d.ts",
83
+ "default": "./nullthrow/index.mjs"
84
+ },
85
+ "require": "./nullthrow/index.cjs",
86
+ "default": "./nullthrow/index.js"
87
+ },
87
88
  "./use-retimer": {
88
89
  "types": "./use-retimer/index.d.ts",
89
90
  "import": {
@@ -165,15 +166,6 @@
165
166
  "require": "./use-map/index.cjs",
166
167
  "default": "./use-map/index.js"
167
168
  },
168
- "./use": {
169
- "types": "./use/index.d.ts",
170
- "import": {
171
- "types": "./use/index.d.ts",
172
- "default": "./use/index.mjs"
173
- },
174
- "require": "./use/index.cjs",
175
- "default": "./use/index.js"
176
- },
177
169
  "./typescript-happy-forward-ref": {
178
170
  "types": "./typescript-happy-forward-ref/index.d.ts",
179
171
  "import": {
@@ -183,6 +175,15 @@
183
175
  "require": "./typescript-happy-forward-ref/index.cjs",
184
176
  "default": "./typescript-happy-forward-ref/index.js"
185
177
  },
178
+ "./use": {
179
+ "types": "./use/index.d.ts",
180
+ "import": {
181
+ "types": "./use/index.d.ts",
182
+ "default": "./use/index.mjs"
183
+ },
184
+ "require": "./use/index.cjs",
185
+ "default": "./use/index.js"
186
+ },
186
187
  "./compose-context-provider": {
187
188
  "types": "./compose-context-provider/index.d.ts",
188
189
  "import": {
@@ -219,6 +220,15 @@
219
220
  "require": "./use-singleton/index.cjs",
220
221
  "default": "./use-singleton/index.js"
221
222
  },
223
+ "./no-ssr": {
224
+ "types": "./no-ssr/index.d.ts",
225
+ "import": {
226
+ "types": "./no-ssr/index.d.ts",
227
+ "default": "./no-ssr/index.mjs"
228
+ },
229
+ "require": "./no-ssr/index.cjs",
230
+ "default": "./no-ssr/index.js"
231
+ },
222
232
  "./use-intersection": {
223
233
  "types": "./use-intersection/index.d.ts",
224
234
  "import": {
@@ -228,14 +238,14 @@
228
238
  "require": "./use-intersection/index.cjs",
229
239
  "default": "./use-intersection/index.js"
230
240
  },
231
- "./no-ssr": {
232
- "types": "./no-ssr/index.d.ts",
241
+ "./current-year": {
242
+ "types": "./current-year/index.d.ts",
233
243
  "import": {
234
- "types": "./no-ssr/index.d.ts",
235
- "default": "./no-ssr/index.mjs"
244
+ "types": "./current-year/index.d.ts",
245
+ "default": "./current-year/index.mjs"
236
246
  },
237
- "require": "./no-ssr/index.cjs",
238
- "default": "./no-ssr/index.js"
247
+ "require": "./current-year/index.cjs",
248
+ "default": "./current-year/index.js"
239
249
  },
240
250
  "./create-fixed-array": {
241
251
  "types": "./create-fixed-array/index.d.ts",
@@ -300,15 +310,6 @@
300
310
  "require": "./invariant/index.cjs",
301
311
  "default": "./invariant/index.js"
302
312
  },
303
- "./use-debounced-value": {
304
- "types": "./use-debounced-value/index.d.ts",
305
- "import": {
306
- "types": "./use-debounced-value/index.d.ts",
307
- "default": "./use-debounced-value/index.mjs"
308
- },
309
- "require": "./use-debounced-value/index.cjs",
310
- "default": "./use-debounced-value/index.js"
311
- },
312
313
  "./create-storage-hook": {
313
314
  "types": "./create-storage-hook/index.d.ts",
314
315
  "import": {
@@ -318,6 +319,15 @@
318
319
  "require": "./create-storage-hook/index.cjs",
319
320
  "default": "./create-storage-hook/index.js"
320
321
  },
322
+ "./use-debounced-value": {
323
+ "types": "./use-debounced-value/index.d.ts",
324
+ "import": {
325
+ "types": "./use-debounced-value/index.d.ts",
326
+ "default": "./use-debounced-value/index.mjs"
327
+ },
328
+ "require": "./use-debounced-value/index.cjs",
329
+ "default": "./use-debounced-value/index.js"
330
+ },
321
331
  "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
322
332
  "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
323
333
  "import": {
@@ -327,15 +337,6 @@
327
337
  "require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
328
338
  "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
329
339
  },
330
- "./context-state": {
331
- "types": "./context-state/index.d.ts",
332
- "import": {
333
- "types": "./context-state/index.d.ts",
334
- "default": "./context-state/index.mjs"
335
- },
336
- "require": "./context-state/index.cjs",
337
- "default": "./context-state/index.js"
338
- },
339
340
  "./use-local-storage": {
340
341
  "types": "./use-local-storage/index.d.ts",
341
342
  "import": {
@@ -345,14 +346,14 @@
345
346
  "require": "./use-local-storage/index.cjs",
346
347
  "default": "./use-local-storage/index.js"
347
348
  },
348
- "./use-isomorphic-layout-effect": {
349
- "types": "./use-isomorphic-layout-effect/index.d.ts",
349
+ "./context-state": {
350
+ "types": "./context-state/index.d.ts",
350
351
  "import": {
351
- "types": "./use-isomorphic-layout-effect/index.d.ts",
352
- "default": "./use-isomorphic-layout-effect/index.mjs"
352
+ "types": "./context-state/index.d.ts",
353
+ "default": "./context-state/index.mjs"
353
354
  },
354
- "require": "./use-isomorphic-layout-effect/index.cjs",
355
- "default": "./use-isomorphic-layout-effect/index.js"
355
+ "require": "./context-state/index.cjs",
356
+ "default": "./context-state/index.js"
356
357
  },
357
358
  "./create-context-state": {
358
359
  "types": "./create-context-state/index.d.ts",
@@ -371,6 +372,15 @@
371
372
  },
372
373
  "require": "./use-array/index.cjs",
373
374
  "default": "./use-array/index.js"
375
+ },
376
+ "./use-isomorphic-layout-effect": {
377
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
378
+ "import": {
379
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
380
+ "default": "./use-isomorphic-layout-effect/index.mjs"
381
+ },
382
+ "require": "./use-isomorphic-layout-effect/index.cjs",
383
+ "default": "./use-isomorphic-layout-effect/index.js"
374
384
  }
375
385
  }
376
386
  }
package/rem/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const n="16px";function e(n,e){return"calc(".concat(n," * ").concat(e,")")}function t(t){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(t);return c&&c!==n?e(o,c):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(t))return c&&c!==n?e(r,c):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(t);return c&&c!==n?e(r,c):r}return r}}const c=t("rem",n),r=t("rem","var(--mantine-scale)"),o=t("em");exports.em=o,exports.mantine_rem=r,exports.rem=c;
1
+ "use strict";const n="16px";function r(n,r){return"calc(".concat(n," * ").concat(r,")")}function e(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function c(i){if(Array.isArray(i))return i.map(n=>c(n)).join(" ");if(0===i||"0"===i)return"0";if("number"==typeof i){const c="".concat(i/16).concat(e);return t&&t!==n?r(c,t):c}if(i.includes("calc(")||i.includes("var(")||i.includes("clamp("))return i;if(i.includes(" "))return i.split(" ").map(n=>c(n)).join(" ");if(i.includes(e))return t&&t!==n?r(i,t):i;const u=Number(i.replace("px",""));if(u==u){const c="".concat(u/16).concat(e);return t&&t!==n?r(c,t):c}return i}}const t=e("rem",n),c=e("rem","var(--mantine-scale)"),i=e("em");exports.em=i,exports.mantine_rem=c,exports.rem=t;
package/rem/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- declare const rem: (value: number | string) => string;
2
- declare const mantine_rem: (value: number | string) => string;
3
- declare const em: (value: number | string) => string;
1
+ declare const rem: (value: number | string | number[] | string[]) => string;
2
+ declare const mantine_rem: (value: number | string | number[] | string[]) => string;
3
+ declare const em: (value: number | string | number[] | string[]) => string;
4
4
 
5
5
  export { em, mantine_rem, rem };
package/rem/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const n="16px";function e(n,e){return"calc(".concat(n," * ").concat(e,")")}function t(t){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(t);return c&&c!==n?e(o,c):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(t))return c&&c!==n?e(r,c):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(t);return c&&c!==n?e(r,c):r}return r}}const c=t("rem",n),r=t("rem","var(--mantine-scale)"),o=t("em");exports.em=o,exports.mantine_rem=r,exports.rem=c;
1
+ "use strict";const n="16px";function r(n,r){return"calc(".concat(n," * ").concat(r,")")}function e(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function c(i){if(Array.isArray(i))return i.map(n=>c(n)).join(" ");if(0===i||"0"===i)return"0";if("number"==typeof i){const c="".concat(i/16).concat(e);return t&&t!==n?r(c,t):c}if(i.includes("calc(")||i.includes("var(")||i.includes("clamp("))return i;if(i.includes(" "))return i.split(" ").map(n=>c(n)).join(" ");if(i.includes(e))return t&&t!==n?r(i,t):i;const u=Number(i.replace("px",""));if(u==u){const c="".concat(u/16).concat(e);return t&&t!==n?r(c,t):c}return i}}const t=e("rem",n),c=e("rem","var(--mantine-scale)"),i=e("em");exports.em=i,exports.mantine_rem=c,exports.rem=t;
package/rem/index.mjs CHANGED
@@ -1 +1 @@
1
- const n="16px";function c(n,c){return"calc(".concat(n," * ").concat(c,")")}function e(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(e);return t&&t!==n?c(o,t):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(e))return t&&t!==n?c(r,t):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(e);return t&&t!==n?c(r,t):r}return r}}const t=e("rem",n),r=e("rem","var(--mantine-scale)"),o=e("em");export{o as em,r as mantine_rem,t as rem};
1
+ const n="16px";function r(n,r){return"calc(".concat(n," * ").concat(r,")")}function c(c){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function t(i){if(Array.isArray(i))return i.map(n=>t(n)).join(" ");if(0===i||"0"===i)return"0";if("number"==typeof i){const t="".concat(i/16).concat(c);return e&&e!==n?r(t,e):t}if(i.includes("calc(")||i.includes("var(")||i.includes("clamp("))return i;if(i.includes(" "))return i.split(" ").map(n=>t(n)).join(" ");if(i.includes(c))return e&&e!==n?r(i,e):i;const u=Number(i.replace("px",""));if(u==u){const t="".concat(u/16).concat(c);return e&&e!==n?r(t,e):t}return i}}const e=c("rem",n),t=c("rem","var(--mantine-scale)"),i=c("em");export{i as em,t as mantine_rem,e as rem};
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":14693,"gzip":9118,"br":0},"exports":{"nullthrow":{"raw":169,"gzip":149,"br":109},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"use-is-client":{"raw":151,"gzip":142,"br":118},"rem":{"raw":588,"gzip":330,"br":282},"noop":{"raw":33,"gzip":53,"br":37},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-url-hash-state":{"raw":1069,"gzip":613,"br":534},"use":{"raw":276,"gzip":182,"br":150},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"use-set":{"raw":347,"gzip":240,"br":203},"use-map":{"raw":346,"gzip":244,"br":210},"compose-context-provider":{"raw":164,"gzip":148,"br":114},"use-singleton":{"raw":138,"gzip":129,"br":109},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"use-react-router-is-match":{"raw":568,"gzip":371,"br":309},"create-fixed-array":{"raw":100,"gzip":104,"br":89},"no-ssr":{"raw":389,"gzip":269,"br":228},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-composition-input":{"raw":454,"gzip":281,"br":238},"use-react-router-enable-concurrent-navigation":{"raw":955,"gzip":457,"br":375},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-session-storage":{"raw":316,"gzip":181,"br":152},"invariant":{"raw":90,"gzip":100,"br":71},"use-clipboard":{"raw":1067,"gzip":611,"br":525},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":254},"context-state":{"raw":377,"gzip":241,"br":207},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"create-context-state":{"raw":145,"gzip":116,"br":96},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-array":{"raw":329,"gzip":238,"br":199},"create-storage-hook":{"raw":1984,"gzip":874,"br":760}}}
1
+ {"total":{"raw":15668,"gzip":9679,"br":0},"exports":{"nullthrow":{"raw":194,"gzip":167,"br":128},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-is-client":{"raw":151,"gzip":142,"br":118},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"noop":{"raw":33,"gzip":53,"br":37},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"rem":{"raw":734,"gzip":380,"br":333},"use-set":{"raw":347,"gzip":240,"br":203},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"use-url-hash-state":{"raw":1069,"gzip":613,"br":534},"use-map":{"raw":346,"gzip":244,"br":210},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"use":{"raw":276,"gzip":182,"br":150},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-react-router-is-match":{"raw":568,"gzip":371,"br":309},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"no-ssr":{"raw":389,"gzip":269,"br":228},"current-year":{"raw":592,"gzip":400,"br":326},"create-fixed-array":{"raw":100,"gzip":104,"br":89},"use-clipboard":{"raw":1067,"gzip":611,"br":524},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-composition-input":{"raw":454,"gzip":281,"br":238},"use-session-storage":{"raw":316,"gzip":181,"br":152},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"invariant":{"raw":178,"gzip":156,"br":118},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":254},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-local-storage":{"raw":310,"gzip":184,"br":157},"create-context-state":{"raw":145,"gzip":116,"br":96},"context-state":{"raw":377,"gzip":241,"br":207},"use-array":{"raw":329,"gzip":238,"br":199},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"create-storage-hook":{"raw":2090,"gzip":891,"br":775}}}
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]);return{copy:e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),reset:e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]),error:u,copied:s}};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]);return{copy:e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),reset:e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]),error:u,copied:s}};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]);return{copy:e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),reset:e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]),error:u,copied:s}};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]);return{copy:e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),reset:e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]),error:u,copied:s}};
@@ -1 +1 @@
1
- import"client-only";import{useState as o,useRef as r,useCallback as e}from"react";import{noop as t}from"../noop/index.mjs";import{useStableHandler as i}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";class a extends Error{}function l(){let{timeout:l=1e3,usePromptAsFallback:n=!1,promptFallbackText:c="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[p,s]=o(null),[d,m]=o(!1),w=r(null),y=i(u||t),b=e(o=>{w.current&&clearTimeout(w.current),o&&(w.current=window.setTimeout(()=>m(!1),l)),m(o)},[l]),f=e(o=>{s(o),y(o)},[y]);return{copy:e(async o=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(o),b(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(n)try{window.prompt(c,o)}catch(o){f(o)}else f(r)}},[b,c,f,n]),reset:e(()=>{m(!1),s(null),w.current&&clearTimeout(w.current)},[]),error:p,copied:d}}export{a as UseClipboardError,l as useClipboard};
1
+ import"client-only";import{useState as o,useRef as r,useCallback as e}from"react";import{noop as t}from"../noop/index.mjs";import{useStableHandler as i}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";class a extends Error{}function l(){let{timeout:l=1e3,usePromptAsFallback:n=!1,promptFallbackText:c="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[p,s]=o(null),[d,m]=o(!1),w=r(null),y=i(u||t),b=e(o=>{w.current&&clearTimeout(w.current),o&&(w.current=window.setTimeout(()=>m(!1),l)),m(o)},[l]),f=e(o=>{s(o),y(o)},[y]);return{copy:e(async o=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(o),b(!0);else throw new a("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(r){if(n)try{window.prompt(c,o)}catch(o){f(o)}else f(r)}},[b,c,f,n]),reset:e(()=>{m(!1),s(null),w.current&&clearTimeout(w.current)},[]),error:p,copied:d}}export{a as UseClipboardError,l as useClipboard};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";require("client-only");var r=require("react"),e=require("react-router-dom");const t=()=>{const{navigator:t}=r.useContext(e.UNSAFE_NavigationContext);if(!t)throw TypeError("[foxact] useReactRouterEnableConcurrentNavigation must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");r.useEffect(()=>{const e=t.go.bind(t),n=t.push.bind(t),o=t.replace.bind(t);return t.go=function(){for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];return r.startTransition(()=>e.apply(t,o))},t.push=function(){for(var e=arguments.length,o=Array(e),a=0;a<e;a++)o[a]=arguments[a];return r.startTransition(()=>n.apply(t,o))},t.replace=function(){for(var e=arguments.length,n=Array(e),a=0;a<e;a++)n[a]=arguments[a];return r.startTransition(()=>o.apply(t,n))},()=>{t.go=e,t.push=n,t.replace=o}},[t])};exports.ReactRouterConcurrentNavigationProvider=r=>{let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
2
+ "use strict";require("client-only");var r=require("react"),e=require("react-router-dom");const t=()=>{const{navigator:t}=r.useContext(e.UNSAFE_NavigationContext);if(!t)throw TypeError("[foxact/use-react-router-enable-concurrent-navigation] must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");r.useEffect(()=>{const e=t.go.bind(t),n=t.push.bind(t),o=t.replace.bind(t);return t.go=function(){for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];return r.startTransition(()=>e.apply(t,o))},t.push=function(){for(var e=arguments.length,o=Array(e),a=0;a<e;a++)o[a]=arguments[a];return r.startTransition(()=>n.apply(t,o))},t.replace=function(){for(var e=arguments.length,n=Array(e),a=0;a<e;a++)n[a]=arguments[a];return r.startTransition(()=>o.apply(t,n))},()=>{t.go=e,t.push=n,t.replace=o}},[t])};exports.ReactRouterConcurrentNavigationProvider=r=>{let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";require("client-only");var r=require("react"),e=require("react-router-dom");const t=()=>{const{navigator:t}=r.useContext(e.UNSAFE_NavigationContext);if(!t)throw TypeError("[foxact] useReactRouterEnableConcurrentNavigation must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");r.useEffect(()=>{const e=t.go.bind(t),n=t.push.bind(t),o=t.replace.bind(t);return t.go=function(){for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];return r.startTransition(()=>e.apply(t,o))},t.push=function(){for(var e=arguments.length,o=Array(e),a=0;a<e;a++)o[a]=arguments[a];return r.startTransition(()=>n.apply(t,o))},t.replace=function(){for(var e=arguments.length,n=Array(e),a=0;a<e;a++)n[a]=arguments[a];return r.startTransition(()=>o.apply(t,n))},()=>{t.go=e,t.push=n,t.replace=o}},[t])};exports.ReactRouterConcurrentNavigationProvider=r=>{let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
2
+ "use strict";require("client-only");var r=require("react"),e=require("react-router-dom");const t=()=>{const{navigator:t}=r.useContext(e.UNSAFE_NavigationContext);if(!t)throw TypeError("[foxact/use-react-router-enable-concurrent-navigation] must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");r.useEffect(()=>{const e=t.go.bind(t),n=t.push.bind(t),o=t.replace.bind(t);return t.go=function(){for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];return r.startTransition(()=>e.apply(t,o))},t.push=function(){for(var e=arguments.length,o=Array(e),a=0;a<e;a++)o[a]=arguments[a];return r.startTransition(()=>n.apply(t,o))},t.replace=function(){for(var e=arguments.length,n=Array(e),a=0;a<e;a++)n[a]=arguments[a];return r.startTransition(()=>o.apply(t,n))},()=>{t.go=e,t.push=n,t.replace=o}},[t])};exports.ReactRouterConcurrentNavigationProvider=r=>{let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import"client-only";import{useContext as r,useEffect as e,startTransition as o}from"react";import{UNSAFE_NavigationContext as t}from"react-router-dom";const n=()=>{const{navigator:n}=r(t);if(!n)throw TypeError("[foxact] useReactRouterEnableConcurrentNavigation must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");e(()=>{const r=n.go.bind(n),e=n.push.bind(n),t=n.replace.bind(n);return n.go=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return o(()=>r.apply(n,t))},n.push=function(){for(var r=arguments.length,t=Array(r),a=0;a<r;a++)t[a]=arguments[a];return o(()=>e.apply(n,t))},n.replace=function(){for(var r=arguments.length,e=Array(r),a=0;a<r;a++)e[a]=arguments[a];return o(()=>t.apply(n,e))},()=>{n.go=r,n.push=e,n.replace=t}},[n])},a=r=>{let{children:e}=r;return n(),e};export{a as ReactRouterConcurrentNavigationProvider,n as useReactRouterEnableConcurrentNavigation};
2
+ import"client-only";import{useContext as r,useEffect as e,startTransition as o}from"react";import{UNSAFE_NavigationContext as t}from"react-router-dom";const n=()=>{const{navigator:n}=r(t);if(!n)throw TypeError("[foxact/use-react-router-enable-concurrent-navigation] must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");e(()=>{const r=n.go.bind(n),e=n.push.bind(n),t=n.replace.bind(n);return n.go=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return o(()=>r.apply(n,t))},n.push=function(){for(var r=arguments.length,t=Array(r),a=0;a<r;a++)t[a]=arguments[a];return o(()=>e.apply(n,t))},n.replace=function(){for(var r=arguments.length,e=Array(r),a=0;a<r;a++)e[a]=arguments[a];return o(()=>t.apply(n,e))},()=>{n.go=r,n.push=e,n.replace=t}},[n])},a=r=>{let{children:e}=r;return n(),e};export{a as ReactRouterConcurrentNavigationProvider,n as useReactRouterEnableConcurrentNavigation};