foxact 0.2.23 → 0.2.24
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.
- package/no-ssr/index.cjs +1 -1
- package/no-ssr/index.d.ts +4 -2
- package/no-ssr/index.js +1 -1
- package/no-ssr/index.mjs +1 -1
- package/package.json +10 -10
- package/sizes.json +1 -1
- package/use-local-storage/index.cjs +1 -1
- package/use-local-storage/index.d.ts +3 -1
- package/use-local-storage/index.js +1 -1
- package/use-local-storage/index.mjs +1 -1
package/no-ssr/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const r=r=>{const o=Error(r);return o.digest="NEXT_DYNAMIC_NO_SSR_CODE",o.recoverableError="NO_SSR",o};exports.noSSR=o=>{if("undefined"==typeof window)throw r(o)},exports.noSSRError=r;
|
package/no-ssr/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/** @private */
|
|
2
|
+
declare const noSSRError: (errorMessage?: string) => Error;
|
|
1
3
|
/** @see https://foxact.skk.moe/no-ssr */
|
|
2
|
-
declare const noSSR: (extraMessage?: string) =>
|
|
4
|
+
declare const noSSR: (extraMessage?: string) => void;
|
|
3
5
|
|
|
4
|
-
export { noSSR };
|
|
6
|
+
export { noSSR, noSSRError };
|
package/no-ssr/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const r=r=>{const o=Error(r);return o.digest="NEXT_DYNAMIC_NO_SSR_CODE",o.recoverableError="NO_SSR",o};exports.noSSR=o=>{if("undefined"==typeof window)throw r(o)},exports.noSSRError=r;
|
package/no-ssr/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const r=r=>{const o=Error(r);
|
|
1
|
+
const r=r=>{const o=Error(r);return o.digest="NEXT_DYNAMIC_NO_SSR_CODE",o.recoverableError="NO_SSR",o},o=o=>{if("undefined"==typeof window)throw r(o)};export{o as noSSR,r as noSSRError};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxact",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.24",
|
|
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": {
|
|
@@ -92,15 +92,6 @@
|
|
|
92
92
|
"require": "./create-context-state/index.cjs",
|
|
93
93
|
"default": "./create-context-state/index.js"
|
|
94
94
|
},
|
|
95
|
-
"./no-ssr": {
|
|
96
|
-
"types": "./no-ssr/index.d.ts",
|
|
97
|
-
"import": {
|
|
98
|
-
"types": "./no-ssr/index.d.ts",
|
|
99
|
-
"default": "./no-ssr/index.mjs"
|
|
100
|
-
},
|
|
101
|
-
"require": "./no-ssr/index.cjs",
|
|
102
|
-
"default": "./no-ssr/index.js"
|
|
103
|
-
},
|
|
104
95
|
"./create-fixed-array": {
|
|
105
96
|
"types": "./create-fixed-array/index.d.ts",
|
|
106
97
|
"import": {
|
|
@@ -110,6 +101,15 @@
|
|
|
110
101
|
"require": "./create-fixed-array/index.cjs",
|
|
111
102
|
"default": "./create-fixed-array/index.js"
|
|
112
103
|
},
|
|
104
|
+
"./no-ssr": {
|
|
105
|
+
"types": "./no-ssr/index.d.ts",
|
|
106
|
+
"import": {
|
|
107
|
+
"types": "./no-ssr/index.d.ts",
|
|
108
|
+
"default": "./no-ssr/index.mjs"
|
|
109
|
+
},
|
|
110
|
+
"require": "./no-ssr/index.cjs",
|
|
111
|
+
"default": "./no-ssr/index.js"
|
|
112
|
+
},
|
|
113
113
|
"./noop": {
|
|
114
114
|
"types": "./noop/index.d.ts",
|
|
115
115
|
"import": {
|
package/sizes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"total":{"raw":
|
|
1
|
+
{"total":{"raw":12922,"gzip":8186,"br":0},"exports":{"compose-context-provider":{"raw":165,"gzip":150,"br":118},"context-state":{"raw":378,"gzip":243,"br":210},"create-context-state":{"raw":146,"gzip":116,"br":102},"create-fixed-array":{"raw":101,"gzip":105,"br":89},"no-ssr":{"raw":187,"gzip":172,"br":143},"noop":{"raw":34,"gzip":54,"br":38},"rem":{"raw":589,"gzip":331,"br":285},"request-idle-callback":{"raw":411,"gzip":232,"br":179},"typescript-happy-forward-ref":{"raw":120,"gzip":104,"br":95},"use":{"raw":277,"gzip":185,"br":155},"use-array":{"raw":338,"gzip":247,"br":207},"use-clipboard":{"raw":1076,"gzip":617,"br":533},"use-debounced-state":{"raw":410,"gzip":291,"br":247},"use-debounced-value":{"raw":471,"gzip":313,"br":254},"use-intersection":{"raw":1239,"gzip":659,"br":605},"use-isomorphic-layout-effect":{"raw":179,"gzip":145,"br":115},"use-local-storage":{"raw":1322,"gzip":617,"br":537},"use-is-client":{"raw":152,"gzip":144,"br":122},"use-error-boundary":{"raw":245,"gzip":197,"br":173},"use-next-pathname":{"raw":322,"gzip":242,"br":202},"use-react-router-enable-concurrent-navigation":{"raw":956,"gzip":455,"br":382},"use-react-router-is-match":{"raw":569,"gzip":371,"br":313},"use-retimer":{"raw":201,"gzip":168,"br":127},"use-composition-input":{"raw":455,"gzip":282,"br":240},"use-map":{"raw":355,"gzip":249,"br":213},"use-uncontrolled":{"raw":301,"gzip":232,"br":197},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":467,"gzip":326,"br":257},"use-set":{"raw":356,"gzip":243,"br":208},"use-url-hash-state":{"raw":961,"gzip":565,"br":487},"use-singleton":{"raw":139,"gzip":131,"br":104}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react"),n=require("../noop/index.cjs"),o=require("../use-isomorphic-layout-effect/index.cjs"),t=require("../no-ssr/index.cjs");function r(e,n){"undefined"!=typeof window&&window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:n}))}require("client-only");const i=(e,n)=>{if("undefined"!=typeof window){const o=JSON.stringify(n);try{window.localStorage.setItem(e,o)}catch(e){console.error(e)}finally{r(e,o)}}},l=e=>{if("undefined"!=typeof window)try{window.localStorage.removeItem(e)}catch(e){console.error(e)}finally{r(e,null)}},c=e=>{if("undefined"!=typeof window)try{
|
|
1
|
+
"use strict";var e=require("react"),n=require("../noop/index.cjs"),o=require("../use-isomorphic-layout-effect/index.cjs"),t=require("../no-ssr/index.cjs");function r(e,n){"undefined"!=typeof window&&window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:n}))}require("client-only");const i=(e,n)=>{if("undefined"!=typeof window){const o=JSON.stringify(n);try{window.localStorage.setItem(e,o)}catch(e){console.error(e)}finally{r(e,o)}}},l=e=>{if("undefined"!=typeof window)try{window.localStorage.removeItem(e)}catch(e){console.error(e)}finally{r(e,null)}},c=e=>{if("undefined"!=typeof window)try{const n=window.localStorage.getItem(e);if(n)return JSON.parse(n);return n}catch(e){console.warn(e)}return null},u=e=>"undefined"!=typeof window?(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)):n.noop,s=()=>{throw t.noSSRError("useLocalStorage cannot be used on the server without a serverValue")},a=e=>"function"==typeof e;exports.useLocalStorage=function(n,t){var r;const d=void 0!==t?()=>t:s,w=e.useSyncExternalStore(u,()=>c(n),d),f=e.useCallback(e=>{try{const o=a(e)?e(null!=w?w:null):e;null==o?l(n):i(n,o)}catch(e){console.warn(e)}},[n,w]);return o.useIsomorphicLayoutEffect(()=>{null===c(n)&&void 0!==t&&i(n,t)},[n,t]),[null!==(r=null!=w?w:t)&&void 0!==r?r:null,f]};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
1
3
|
/** @see https://foxact.skk.moe/use-local-storage */
|
|
2
|
-
declare
|
|
4
|
+
declare function useLocalStorage<T extends string | number>(key: string, serverValue?: T): readonly [T | null, react.Dispatch<react.SetStateAction<T | null>>];
|
|
3
5
|
|
|
4
6
|
export { useLocalStorage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react"),n=require("../noop/index.js"),o=require("../use-isomorphic-layout-effect/index.js"),t=require("../no-ssr/index.js");function r(e,n){"undefined"!=typeof window&&window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:n}))}require("client-only");const i=(e,n)=>{if("undefined"!=typeof window){const o=JSON.stringify(n);try{window.localStorage.setItem(e,o)}catch(e){console.error(e)}finally{r(e,o)}}},l=e=>{if("undefined"!=typeof window)try{window.localStorage.removeItem(e)}catch(e){console.error(e)}finally{r(e,null)}},
|
|
1
|
+
"use strict";var e=require("react"),n=require("../noop/index.js"),o=require("../use-isomorphic-layout-effect/index.js"),t=require("../no-ssr/index.js");function r(e,n){"undefined"!=typeof window&&window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:n}))}require("client-only");const i=(e,n)=>{if("undefined"!=typeof window){const o=JSON.stringify(n);try{window.localStorage.setItem(e,o)}catch(e){console.error(e)}finally{r(e,o)}}},l=e=>{if("undefined"!=typeof window)try{window.localStorage.removeItem(e)}catch(e){console.error(e)}finally{r(e,null)}},u=e=>{if("undefined"!=typeof window)try{const n=window.localStorage.getItem(e);if(n)return JSON.parse(n);return n}catch(e){console.warn(e)}return null},s=e=>"undefined"!=typeof window?(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)):n.noop,a=()=>{throw t.noSSRError("useLocalStorage cannot be used on the server without a serverValue")},c=e=>"function"==typeof e;exports.useLocalStorage=function(n,t){var r;const d=void 0!==t?()=>t:a,w=e.useSyncExternalStore(s,()=>u(n),d),f=e.useCallback(e=>{try{const o=c(e)?e(null!=w?w:null):e;null==o?l(n):i(n,o)}catch(e){console.warn(e)}},[n,w]);return o.useIsomorphicLayoutEffect(()=>{null===u(n)&&void 0!==t&&i(n,t)},[n,t]),[null!==(r=null!=w?w:t)&&void 0!==r?r:null,f]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSyncExternalStore as
|
|
1
|
+
import{useSyncExternalStore as o,useCallback as e}from"react";import{noop as n}from"../noop/index.mjs";import{useIsomorphicLayoutEffect as t}from"../use-isomorphic-layout-effect/index.mjs";import{noSSRError as r}from"../no-ssr/index.mjs";import"client-only";function i(o,e){"undefined"!=typeof window&&window.dispatchEvent(new StorageEvent("storage",{key:o,newValue:e}))}const l=(o,e)=>{if("undefined"!=typeof window){const n=JSON.stringify(e);try{window.localStorage.setItem(o,n)}catch(o){console.error(o)}finally{i(o,n)}}},a=o=>{if("undefined"!=typeof window)try{window.localStorage.removeItem(o)}catch(o){console.error(o)}finally{i(o,null)}},c=o=>{if("undefined"!=typeof window)try{const e=window.localStorage.getItem(o);if(e)return JSON.parse(e);return e}catch(o){console.warn(o)}return null},d=o=>"undefined"!=typeof window?(window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)):n,s=()=>{throw r("useLocalStorage cannot be used on the server without a serverValue")},u=o=>"function"==typeof o;function f(n,r){var i;const f=void 0!==r?()=>r:s,w=o(d,()=>c(n),f),m=e(o=>{try{const e=u(o)?o(null!=w?w:null):o;null==e?a(n):l(n,e)}catch(o){console.warn(o)}},[n,w]);return t(()=>{null===c(n)&&void 0!==r&&l(n,r)},[n,r]),[null!==(i=null!=w?w:r)&&void 0!==i?i:null,m]}export{f as useLocalStorage};
|