foxact 0.2.34 → 0.2.35
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/create-storage-hook/index.cjs +1 -1
- package/create-storage-hook/index.d.ts +5 -2
- package/create-storage-hook/index.js +1 -1
- package/create-storage-hook/index.mjs +1 -1
- package/package.json +37 -37
- package/sizes.json +1 -1
- package/use-local-storage/index.d.ts +4 -1
- package/use-session-storage/index.d.ts +4 -1
|
@@ -1 +1 @@
|
|
|
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){
|
|
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){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const f=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]),v=s.raw?a:s.serializer,y=s.raw?a:s.deserializer,g=void 0!==c?()=>v(c):i,m=e.useSyncExternalStore(f,()=>w(n),g),p=e.useMemo(()=>null===m?null:y(m),[m,y]),h=e.useCallback(e=>{try{const o=r(e)?e(null!=p?p:null):e;null===o?d(n):u(n,v(o))}catch(e){console.warn(e)}},[n,v,p]);return t.useLayoutEffect(()=>{null===w(n)&&void 0!==c&&u(n,v(c))},[y,n,v,c]),[null===p?void 0===c?null:c:p,h]},useSetStorage:(o,t)=>e.useCallback(e=>{try{null===e?d(o):u(o,t(e))}catch(e){console.warn(e)}},[o,t])}};
|
|
@@ -20,8 +20,11 @@ interface UseStorageParserOption<T> {
|
|
|
20
20
|
deserializer: Deserializer<T>;
|
|
21
21
|
}
|
|
22
22
|
declare function createStorage(type: StorageType): {
|
|
23
|
-
useStorage:
|
|
24
|
-
|
|
23
|
+
useStorage: {
|
|
24
|
+
<T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [T, React.Dispatch<React.SetStateAction<T | null>>];
|
|
25
|
+
<T_1>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T_1> | undefined): readonly [T_1 | null, react.Dispatch<react.SetStateAction<T_1 | null>>];
|
|
26
|
+
};
|
|
27
|
+
useSetStorage: <T_2>(key: string, serializer: Serializer<T_2>) => (v: T_2 | null) => void;
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
export { type Deserializer, type Serializer, type UseStorageParserOption, type UseStorageRawOption, createStorage };
|
|
@@ -1 +1 @@
|
|
|
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){
|
|
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){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{serializer:JSON.stringify,deserializer:JSON.parse};const f=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]),v=c.raw?a:c.serializer,y=c.raw?a:c.deserializer,g=void 0!==s?()=>v(s):i,m=e.useSyncExternalStore(f,()=>w(n),g),p=e.useMemo(()=>null===m?null:y(m),[m,y]),h=e.useCallback(e=>{try{const o=r(e)?e(null!=p?p:null):e;null===o?d(n):u(n,v(o))}catch(e){console.warn(e)}},[n,v,p]);return t.useLayoutEffect(()=>{null===w(n)&&void 0!==s&&u(n,v(s))},[y,n,v,s]),[null===p?void 0===s?null:s:p,h]},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 o,useMemo as t}from"react";import{noop as n}from"../noop/index.mjs";import{
|
|
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{useLayoutEffect 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){let u=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]),v=u.raw?l:u.serializer,y=u.raw?l:u.deserializer,p=o(g,()=>m(i),void 0!==d?()=>v(d):c),h=t(()=>null===p?null:y(p),[p,y]),S=e(e=>{try{const o=a(e)?e(null!=h?h:null):e;null===o?f(i):w(i,v(o))}catch(e){console.warn(e)}},[i,v,h]);return r(()=>{null===m(i)&&void 0!==d&&w(i,v(d))},[y,i,v,d]),[null===h?void 0===d?null:d:h,S]},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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxact",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.35",
|
|
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": {
|
|
@@ -69,15 +69,6 @@
|
|
|
69
69
|
"exports": {
|
|
70
70
|
"./package.json": "./package.json",
|
|
71
71
|
"./sizes.json": "./sizes.json",
|
|
72
|
-
"./use-next-pathname": {
|
|
73
|
-
"types": "./use-next-pathname/index.d.ts",
|
|
74
|
-
"import": {
|
|
75
|
-
"types": "./use-next-pathname/index.d.ts",
|
|
76
|
-
"default": "./use-next-pathname/index.mjs"
|
|
77
|
-
},
|
|
78
|
-
"require": "./use-next-pathname/index.cjs",
|
|
79
|
-
"default": "./use-next-pathname/index.js"
|
|
80
|
-
},
|
|
81
72
|
"./use-abortable-effect": {
|
|
82
73
|
"types": "./use-abortable-effect/index.d.ts",
|
|
83
74
|
"import": {
|
|
@@ -87,6 +78,15 @@
|
|
|
87
78
|
"require": "./use-abortable-effect/index.cjs",
|
|
88
79
|
"default": "./use-abortable-effect/index.js"
|
|
89
80
|
},
|
|
81
|
+
"./use-next-pathname": {
|
|
82
|
+
"types": "./use-next-pathname/index.d.ts",
|
|
83
|
+
"import": {
|
|
84
|
+
"types": "./use-next-pathname/index.d.ts",
|
|
85
|
+
"default": "./use-next-pathname/index.mjs"
|
|
86
|
+
},
|
|
87
|
+
"require": "./use-next-pathname/index.cjs",
|
|
88
|
+
"default": "./use-next-pathname/index.js"
|
|
89
|
+
},
|
|
90
90
|
"./noop": {
|
|
91
91
|
"types": "./noop/index.d.ts",
|
|
92
92
|
"import": {
|
|
@@ -105,15 +105,6 @@
|
|
|
105
105
|
"require": "./use-singleton/index.cjs",
|
|
106
106
|
"default": "./use-singleton/index.js"
|
|
107
107
|
},
|
|
108
|
-
"./use-retimer": {
|
|
109
|
-
"types": "./use-retimer/index.d.ts",
|
|
110
|
-
"import": {
|
|
111
|
-
"types": "./use-retimer/index.d.ts",
|
|
112
|
-
"default": "./use-retimer/index.mjs"
|
|
113
|
-
},
|
|
114
|
-
"require": "./use-retimer/index.cjs",
|
|
115
|
-
"default": "./use-retimer/index.js"
|
|
116
|
-
},
|
|
117
108
|
"./use-url-hash-state": {
|
|
118
109
|
"types": "./use-url-hash-state/index.d.ts",
|
|
119
110
|
"import": {
|
|
@@ -123,6 +114,15 @@
|
|
|
123
114
|
"require": "./use-url-hash-state/index.cjs",
|
|
124
115
|
"default": "./use-url-hash-state/index.js"
|
|
125
116
|
},
|
|
117
|
+
"./use-retimer": {
|
|
118
|
+
"types": "./use-retimer/index.d.ts",
|
|
119
|
+
"import": {
|
|
120
|
+
"types": "./use-retimer/index.d.ts",
|
|
121
|
+
"default": "./use-retimer/index.mjs"
|
|
122
|
+
},
|
|
123
|
+
"require": "./use-retimer/index.cjs",
|
|
124
|
+
"default": "./use-retimer/index.js"
|
|
125
|
+
},
|
|
126
126
|
"./use-next-link": {
|
|
127
127
|
"types": "./use-next-link/index.d.ts",
|
|
128
128
|
"import": {
|
|
@@ -195,15 +195,6 @@
|
|
|
195
195
|
"require": "./use-debounced-state/index.cjs",
|
|
196
196
|
"default": "./use-debounced-state/index.js"
|
|
197
197
|
},
|
|
198
|
-
"./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
|
|
199
|
-
"types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
|
|
200
|
-
"import": {
|
|
201
|
-
"types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
|
|
202
|
-
"default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs"
|
|
203
|
-
},
|
|
204
|
-
"require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
|
|
205
|
-
"default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
|
|
206
|
-
},
|
|
207
198
|
"./use-media-query": {
|
|
208
199
|
"types": "./use-media-query/index.d.ts",
|
|
209
200
|
"import": {
|
|
@@ -213,6 +204,15 @@
|
|
|
213
204
|
"require": "./use-media-query/index.cjs",
|
|
214
205
|
"default": "./use-media-query/index.js"
|
|
215
206
|
},
|
|
207
|
+
"./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
|
|
208
|
+
"types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
|
|
209
|
+
"import": {
|
|
210
|
+
"types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
|
|
211
|
+
"default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs"
|
|
212
|
+
},
|
|
213
|
+
"require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
|
|
214
|
+
"default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
|
|
215
|
+
},
|
|
216
216
|
"./use-uncontrolled": {
|
|
217
217
|
"types": "./use-uncontrolled/index.d.ts",
|
|
218
218
|
"import": {
|
|
@@ -231,15 +231,6 @@
|
|
|
231
231
|
"require": "./use-react-router-is-match/index.cjs",
|
|
232
232
|
"default": "./use-react-router-is-match/index.js"
|
|
233
233
|
},
|
|
234
|
-
"./create-storage-hook": {
|
|
235
|
-
"types": "./create-storage-hook/index.d.ts",
|
|
236
|
-
"import": {
|
|
237
|
-
"types": "./create-storage-hook/index.d.ts",
|
|
238
|
-
"default": "./create-storage-hook/index.mjs"
|
|
239
|
-
},
|
|
240
|
-
"require": "./create-storage-hook/index.cjs",
|
|
241
|
-
"default": "./create-storage-hook/index.js"
|
|
242
|
-
},
|
|
243
234
|
"./create-fixed-array": {
|
|
244
235
|
"types": "./create-fixed-array/index.d.ts",
|
|
245
236
|
"import": {
|
|
@@ -249,6 +240,15 @@
|
|
|
249
240
|
"require": "./create-fixed-array/index.cjs",
|
|
250
241
|
"default": "./create-fixed-array/index.js"
|
|
251
242
|
},
|
|
243
|
+
"./create-storage-hook": {
|
|
244
|
+
"types": "./create-storage-hook/index.d.ts",
|
|
245
|
+
"import": {
|
|
246
|
+
"types": "./create-storage-hook/index.d.ts",
|
|
247
|
+
"default": "./create-storage-hook/index.mjs"
|
|
248
|
+
},
|
|
249
|
+
"require": "./create-storage-hook/index.cjs",
|
|
250
|
+
"default": "./create-storage-hook/index.js"
|
|
251
|
+
},
|
|
252
252
|
"./use-intersection": {
|
|
253
253
|
"types": "./use-intersection/index.d.ts",
|
|
254
254
|
"import": {
|
package/sizes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"total":{"raw":
|
|
1
|
+
{"total":{"raw":18246,"gzip":11139,"br":0},"exports":{"noop":{"raw":33,"gzip":53,"br":37},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-abortable-effect":{"raw":210,"gzip":166,"br":150},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-retimer":{"raw":200,"gzip":165,"br":123},"invariant":{"raw":178,"gzip":156,"br":118},"use-url-hash-state":{"raw":1069,"gzip":612,"br":534},"context-state":{"raw":377,"gzip":241,"br":207},"current-year":{"raw":592,"gzip":400,"br":326},"use":{"raw":276,"gzip":182,"br":150},"use-next-link":{"raw":1600,"gzip":851,"br":730},"use-map":{"raw":346,"gzip":244,"br":210},"use-is-client":{"raw":151,"gzip":142,"br":118},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":254},"use-media-query":{"raw":718,"gzip":402,"br":334},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"create-fixed-array":{"raw":100,"gzip":104,"br":89},"use-react-router-is-match":{"raw":564,"gzip":373,"br":314},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-clipboard":{"raw":1067,"gzip":611,"br":524},"create-storage-hook":{"raw":2061,"gzip":880,"br":762},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-local-storage":{"raw":310,"gzip":184,"br":157},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"use-set":{"raw":347,"gzip":240,"br":203},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"use-array":{"raw":329,"gzip":238,"br":199},"use-session-storage":{"raw":316,"gzip":181,"br":152},"rem":{"raw":734,"gzip":380,"br":333},"nullthrow":{"raw":194,"gzip":167,"br":128},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"no-ssr":{"raw":468,"gzip":318,"br":266},"create-context-state":{"raw":145,"gzip":116,"br":96},"use-composition-input":{"raw":458,"gzip":283,"br":241},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387}}}
|
|
@@ -2,7 +2,10 @@ import * as react from 'react';
|
|
|
2
2
|
import { UseStorageRawOption, UseStorageParserOption, Serializer } from '../create-storage-hook/index.js';
|
|
3
3
|
export { Deserializer } from '../create-storage-hook/index.js';
|
|
4
4
|
|
|
5
|
-
declare const useLocalStorage:
|
|
5
|
+
declare const useLocalStorage: {
|
|
6
|
+
<T>(key: string, serverValue: T extends undefined ? never : T, options?: UseStorageRawOption | UseStorageParserOption<T> | undefined): readonly [T, react.Dispatch<react.SetStateAction<T | null>>];
|
|
7
|
+
<T_1>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T_1> | undefined): readonly [T_1 | null, react.Dispatch<react.SetStateAction<T_1 | null>>];
|
|
8
|
+
};
|
|
6
9
|
declare const useSetLocalStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
|
|
7
10
|
|
|
8
11
|
export { Serializer, UseStorageParserOption as UseLocalStorageParserOption, UseStorageRawOption as UseLocalStorageRawOption, useLocalStorage, useSetLocalStorage };
|
|
@@ -2,7 +2,10 @@ import * as react from 'react';
|
|
|
2
2
|
import { UseStorageRawOption, UseStorageParserOption, Serializer } from '../create-storage-hook/index.js';
|
|
3
3
|
export { Deserializer } from '../create-storage-hook/index.js';
|
|
4
4
|
|
|
5
|
-
declare const useSessionStorage:
|
|
5
|
+
declare const useSessionStorage: {
|
|
6
|
+
<T>(key: string, serverValue: T extends undefined ? never : T, options?: UseStorageRawOption | UseStorageParserOption<T> | undefined): readonly [T, react.Dispatch<react.SetStateAction<T | null>>];
|
|
7
|
+
<T_1>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T_1> | undefined): readonly [T_1 | null, react.Dispatch<react.SetStateAction<T_1 | null>>];
|
|
8
|
+
};
|
|
6
9
|
declare const useSetSessionStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
|
|
7
10
|
|
|
8
11
|
export { Serializer, UseStorageParserOption as UseSessionStorageParserOption, UseStorageRawOption as UseSessionStorageRawOption, useSessionStorage, useSetSessionStorage };
|