foxact 0.2.33 → 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/README.md +6 -0
- 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 +232 -220
- package/sizes.json +1 -1
- package/use-composition-input/index.cjs +1 -1
- package/use-composition-input/index.d.ts +6 -2
- package/use-composition-input/index.js +1 -1
- package/use-composition-input/index.mjs +1 -1
- package/use-isomorphic-layout-effect/index.d.ts +3 -3
- package/use-local-storage/index.d.ts +4 -1
- package/use-media-query/index.cjs +2 -0
- package/use-media-query/index.d.ts +4 -0
- package/use-media-query/index.js +2 -0
- package/use-media-query/index.mjs +2 -0
- package/use-next-link/index.cjs +1 -1
- package/use-next-link/index.js +1 -1
- package/use-next-link/index.mjs +1 -1
- package/use-react-router-is-match/index.cjs +1 -1
- package/use-react-router-is-match/index.d.ts +2 -2
- package/use-react-router-is-match/index.js +1 -1
- package/use-react-router-is-match/index.mjs +1 -1
- package/use-session-storage/index.d.ts +4 -1
package/README.md
CHANGED
|
@@ -42,3 +42,9 @@ Every hook and util is isolated and side-effects free, eliminating unused code a
|
|
|
42
42
|
Authored and maintained by Sukka with help from contributors ([list](https://github.com/SukkaW/foxact/graphs/contributors)).
|
|
43
43
|
|
|
44
44
|
> [Personal Website](https://skk.moe) · [Blog](https://blog.skk.moe) · GitHub [@SukkaW](https://github.com/SukkaW) · Telegram Channel [@SukkaChannel](https://t.me/SukkaChannel) · Mastodon [@sukka@acg.mn](https://acg.mn/@sukka) · Twitter [@isukkaw](https://twitter.com/isukkaw) · Keybase [@sukka](https://keybase.io/sukka)
|
|
45
|
+
|
|
46
|
+
<p align="center">
|
|
47
|
+
<a href="https://github.com/sponsors/SukkaW/">
|
|
48
|
+
<img src="https://sponsor.cdn.skk.moe/sponsors.svg"/>
|
|
49
|
+
</a>
|
|
50
|
+
</p>
|
|
@@ -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": {
|
|
@@ -32,24 +32,27 @@
|
|
|
32
32
|
"optional": true
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
"packageManager": "pnpm@9.1.4",
|
|
36
|
+
"pnpm": {
|
|
37
|
+
"overrides": {
|
|
38
|
+
"array-includes": "npm:@nolyfill/array-includes@latest",
|
|
39
|
+
"array.prototype.findlastindex": "npm:@nolyfill/array.prototype.findlastindex@latest",
|
|
40
|
+
"array.prototype.flat": "npm:@nolyfill/array.prototype.flat@latest",
|
|
41
|
+
"array.prototype.flatmap": "npm:@nolyfill/array.prototype.flatmap@latest",
|
|
42
|
+
"array.prototype.tosorted": "npm:@nolyfill/array.prototype.tosorted@latest",
|
|
43
|
+
"es-iterator-helpers": "npm:@nolyfill/es-iterator-helpers@latest",
|
|
44
|
+
"function-bind": "npm:@nolyfill/function-bind@latest",
|
|
45
|
+
"has": "npm:@nolyfill/has@latest",
|
|
46
|
+
"hasown": "npm:@nolyfill/hasown@latest",
|
|
47
|
+
"object.assign": "npm:@nolyfill/object.assign@latest",
|
|
48
|
+
"object.entries": "npm:@nolyfill/object.entries@latest",
|
|
49
|
+
"object.fromentries": "npm:@nolyfill/object.fromentries@latest",
|
|
50
|
+
"object.groupby": "npm:@nolyfill/object.groupby@latest",
|
|
51
|
+
"object.hasown": "npm:@nolyfill/object.hasown@latest",
|
|
52
|
+
"object.values": "npm:@nolyfill/object.values@latest",
|
|
53
|
+
"string.prototype.matchall": "npm:@nolyfill/string.prototype.matchall@latest",
|
|
54
|
+
"rollup": "$rollup"
|
|
55
|
+
}
|
|
53
56
|
},
|
|
54
57
|
"typeVersions": {
|
|
55
58
|
">=4.8": {
|
|
@@ -66,50 +69,14 @@
|
|
|
66
69
|
"exports": {
|
|
67
70
|
"./package.json": "./package.json",
|
|
68
71
|
"./sizes.json": "./sizes.json",
|
|
69
|
-
"./use-
|
|
70
|
-
"types": "./use-
|
|
71
|
-
"import": {
|
|
72
|
-
"types": "./use-array/index.d.ts",
|
|
73
|
-
"default": "./use-array/index.mjs"
|
|
74
|
-
},
|
|
75
|
-
"require": "./use-array/index.cjs",
|
|
76
|
-
"default": "./use-array/index.js"
|
|
77
|
-
},
|
|
78
|
-
"./current-year": {
|
|
79
|
-
"types": "./current-year/index.d.ts",
|
|
80
|
-
"import": {
|
|
81
|
-
"types": "./current-year/index.d.ts",
|
|
82
|
-
"default": "./current-year/index.mjs"
|
|
83
|
-
},
|
|
84
|
-
"require": "./current-year/index.cjs",
|
|
85
|
-
"default": "./current-year/index.js"
|
|
86
|
-
},
|
|
87
|
-
"./use-react-router-enable-concurrent-navigation": {
|
|
88
|
-
"types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
|
|
89
|
-
"import": {
|
|
90
|
-
"types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
|
|
91
|
-
"default": "./use-react-router-enable-concurrent-navigation/index.mjs"
|
|
92
|
-
},
|
|
93
|
-
"require": "./use-react-router-enable-concurrent-navigation/index.cjs",
|
|
94
|
-
"default": "./use-react-router-enable-concurrent-navigation/index.js"
|
|
95
|
-
},
|
|
96
|
-
"./compose-context-provider": {
|
|
97
|
-
"types": "./compose-context-provider/index.d.ts",
|
|
98
|
-
"import": {
|
|
99
|
-
"types": "./compose-context-provider/index.d.ts",
|
|
100
|
-
"default": "./compose-context-provider/index.mjs"
|
|
101
|
-
},
|
|
102
|
-
"require": "./compose-context-provider/index.cjs",
|
|
103
|
-
"default": "./compose-context-provider/index.js"
|
|
104
|
-
},
|
|
105
|
-
"./nullthrow": {
|
|
106
|
-
"types": "./nullthrow/index.d.ts",
|
|
72
|
+
"./use-abortable-effect": {
|
|
73
|
+
"types": "./use-abortable-effect/index.d.ts",
|
|
107
74
|
"import": {
|
|
108
|
-
"types": "./
|
|
109
|
-
"default": "./
|
|
75
|
+
"types": "./use-abortable-effect/index.d.ts",
|
|
76
|
+
"default": "./use-abortable-effect/index.mjs"
|
|
110
77
|
},
|
|
111
|
-
"require": "./
|
|
112
|
-
"default": "./
|
|
78
|
+
"require": "./use-abortable-effect/index.cjs",
|
|
79
|
+
"default": "./use-abortable-effect/index.js"
|
|
113
80
|
},
|
|
114
81
|
"./use-next-pathname": {
|
|
115
82
|
"types": "./use-next-pathname/index.d.ts",
|
|
@@ -120,41 +87,14 @@
|
|
|
120
87
|
"require": "./use-next-pathname/index.cjs",
|
|
121
88
|
"default": "./use-next-pathname/index.js"
|
|
122
89
|
},
|
|
123
|
-
"./
|
|
124
|
-
"types": "./
|
|
125
|
-
"import": {
|
|
126
|
-
"types": "./use-intersection/index.d.ts",
|
|
127
|
-
"default": "./use-intersection/index.mjs"
|
|
128
|
-
},
|
|
129
|
-
"require": "./use-intersection/index.cjs",
|
|
130
|
-
"default": "./use-intersection/index.js"
|
|
131
|
-
},
|
|
132
|
-
"./typescript-happy-forward-ref": {
|
|
133
|
-
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
134
|
-
"import": {
|
|
135
|
-
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
136
|
-
"default": "./typescript-happy-forward-ref/index.mjs"
|
|
137
|
-
},
|
|
138
|
-
"require": "./typescript-happy-forward-ref/index.cjs",
|
|
139
|
-
"default": "./typescript-happy-forward-ref/index.js"
|
|
140
|
-
},
|
|
141
|
-
"./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
|
|
142
|
-
"types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
|
|
143
|
-
"import": {
|
|
144
|
-
"types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
|
|
145
|
-
"default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs"
|
|
146
|
-
},
|
|
147
|
-
"require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
|
|
148
|
-
"default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
|
|
149
|
-
},
|
|
150
|
-
"./use-session-storage": {
|
|
151
|
-
"types": "./use-session-storage/index.d.ts",
|
|
90
|
+
"./noop": {
|
|
91
|
+
"types": "./noop/index.d.ts",
|
|
152
92
|
"import": {
|
|
153
|
-
"types": "./
|
|
154
|
-
"default": "./
|
|
93
|
+
"types": "./noop/index.d.ts",
|
|
94
|
+
"default": "./noop/index.mjs"
|
|
155
95
|
},
|
|
156
|
-
"require": "./
|
|
157
|
-
"default": "./
|
|
96
|
+
"require": "./noop/index.cjs",
|
|
97
|
+
"default": "./noop/index.js"
|
|
158
98
|
},
|
|
159
99
|
"./use-singleton": {
|
|
160
100
|
"types": "./use-singleton/index.d.ts",
|
|
@@ -165,50 +105,41 @@
|
|
|
165
105
|
"require": "./use-singleton/index.cjs",
|
|
166
106
|
"default": "./use-singleton/index.js"
|
|
167
107
|
},
|
|
168
|
-
"./use-
|
|
169
|
-
"types": "./use-
|
|
170
|
-
"import": {
|
|
171
|
-
"types": "./use-react-router-is-match/index.d.ts",
|
|
172
|
-
"default": "./use-react-router-is-match/index.mjs"
|
|
173
|
-
},
|
|
174
|
-
"require": "./use-react-router-is-match/index.cjs",
|
|
175
|
-
"default": "./use-react-router-is-match/index.js"
|
|
176
|
-
},
|
|
177
|
-
"./use-debounced-value": {
|
|
178
|
-
"types": "./use-debounced-value/index.d.ts",
|
|
108
|
+
"./use-url-hash-state": {
|
|
109
|
+
"types": "./use-url-hash-state/index.d.ts",
|
|
179
110
|
"import": {
|
|
180
|
-
"types": "./use-
|
|
181
|
-
"default": "./use-
|
|
111
|
+
"types": "./use-url-hash-state/index.d.ts",
|
|
112
|
+
"default": "./use-url-hash-state/index.mjs"
|
|
182
113
|
},
|
|
183
|
-
"require": "./use-
|
|
184
|
-
"default": "./use-
|
|
114
|
+
"require": "./use-url-hash-state/index.cjs",
|
|
115
|
+
"default": "./use-url-hash-state/index.js"
|
|
185
116
|
},
|
|
186
|
-
"./use-
|
|
187
|
-
"types": "./use-
|
|
117
|
+
"./use-retimer": {
|
|
118
|
+
"types": "./use-retimer/index.d.ts",
|
|
188
119
|
"import": {
|
|
189
|
-
"types": "./use-
|
|
190
|
-
"default": "./use-
|
|
120
|
+
"types": "./use-retimer/index.d.ts",
|
|
121
|
+
"default": "./use-retimer/index.mjs"
|
|
191
122
|
},
|
|
192
|
-
"require": "./use-
|
|
193
|
-
"default": "./use-
|
|
123
|
+
"require": "./use-retimer/index.cjs",
|
|
124
|
+
"default": "./use-retimer/index.js"
|
|
194
125
|
},
|
|
195
|
-
"./
|
|
196
|
-
"types": "./
|
|
126
|
+
"./use-next-link": {
|
|
127
|
+
"types": "./use-next-link/index.d.ts",
|
|
197
128
|
"import": {
|
|
198
|
-
"types": "./
|
|
199
|
-
"default": "./
|
|
129
|
+
"types": "./use-next-link/index.d.ts",
|
|
130
|
+
"default": "./use-next-link/index.mjs"
|
|
200
131
|
},
|
|
201
|
-
"require": "./
|
|
202
|
-
"default": "./
|
|
132
|
+
"require": "./use-next-link/index.cjs",
|
|
133
|
+
"default": "./use-next-link/index.js"
|
|
203
134
|
},
|
|
204
|
-
"./
|
|
205
|
-
"types": "./
|
|
135
|
+
"./invariant": {
|
|
136
|
+
"types": "./invariant/index.d.ts",
|
|
206
137
|
"import": {
|
|
207
|
-
"types": "./
|
|
208
|
-
"default": "./
|
|
138
|
+
"types": "./invariant/index.d.ts",
|
|
139
|
+
"default": "./invariant/index.mjs"
|
|
209
140
|
},
|
|
210
|
-
"require": "./
|
|
211
|
-
"default": "./
|
|
141
|
+
"require": "./invariant/index.cjs",
|
|
142
|
+
"default": "./invariant/index.js"
|
|
212
143
|
},
|
|
213
144
|
"./context-state": {
|
|
214
145
|
"types": "./context-state/index.d.ts",
|
|
@@ -219,32 +150,14 @@
|
|
|
219
150
|
"require": "./context-state/index.cjs",
|
|
220
151
|
"default": "./context-state/index.js"
|
|
221
152
|
},
|
|
222
|
-
"./
|
|
223
|
-
"types": "./
|
|
224
|
-
"import": {
|
|
225
|
-
"types": "./request-idle-callback/index.d.ts",
|
|
226
|
-
"default": "./request-idle-callback/index.mjs"
|
|
227
|
-
},
|
|
228
|
-
"require": "./request-idle-callback/index.cjs",
|
|
229
|
-
"default": "./request-idle-callback/index.js"
|
|
230
|
-
},
|
|
231
|
-
"./use-abortable-effect": {
|
|
232
|
-
"types": "./use-abortable-effect/index.d.ts",
|
|
233
|
-
"import": {
|
|
234
|
-
"types": "./use-abortable-effect/index.d.ts",
|
|
235
|
-
"default": "./use-abortable-effect/index.mjs"
|
|
236
|
-
},
|
|
237
|
-
"require": "./use-abortable-effect/index.cjs",
|
|
238
|
-
"default": "./use-abortable-effect/index.js"
|
|
239
|
-
},
|
|
240
|
-
"./create-fixed-array": {
|
|
241
|
-
"types": "./create-fixed-array/index.d.ts",
|
|
153
|
+
"./current-year": {
|
|
154
|
+
"types": "./current-year/index.d.ts",
|
|
242
155
|
"import": {
|
|
243
|
-
"types": "./
|
|
244
|
-
"default": "./
|
|
156
|
+
"types": "./current-year/index.d.ts",
|
|
157
|
+
"default": "./current-year/index.mjs"
|
|
245
158
|
},
|
|
246
|
-
"require": "./
|
|
247
|
-
"default": "./
|
|
159
|
+
"require": "./current-year/index.cjs",
|
|
160
|
+
"default": "./current-year/index.js"
|
|
248
161
|
},
|
|
249
162
|
"./use": {
|
|
250
163
|
"types": "./use/index.d.ts",
|
|
@@ -255,32 +168,23 @@
|
|
|
255
168
|
"require": "./use/index.cjs",
|
|
256
169
|
"default": "./use/index.js"
|
|
257
170
|
},
|
|
258
|
-
"./
|
|
259
|
-
"types": "./
|
|
260
|
-
"import": {
|
|
261
|
-
"types": "./invariant/index.d.ts",
|
|
262
|
-
"default": "./invariant/index.mjs"
|
|
263
|
-
},
|
|
264
|
-
"require": "./invariant/index.cjs",
|
|
265
|
-
"default": "./invariant/index.js"
|
|
266
|
-
},
|
|
267
|
-
"./use-uncontrolled": {
|
|
268
|
-
"types": "./use-uncontrolled/index.d.ts",
|
|
171
|
+
"./use-map": {
|
|
172
|
+
"types": "./use-map/index.d.ts",
|
|
269
173
|
"import": {
|
|
270
|
-
"types": "./use-
|
|
271
|
-
"default": "./use-
|
|
174
|
+
"types": "./use-map/index.d.ts",
|
|
175
|
+
"default": "./use-map/index.mjs"
|
|
272
176
|
},
|
|
273
|
-
"require": "./use-
|
|
274
|
-
"default": "./use-
|
|
177
|
+
"require": "./use-map/index.cjs",
|
|
178
|
+
"default": "./use-map/index.js"
|
|
275
179
|
},
|
|
276
|
-
"./
|
|
277
|
-
"types": "./
|
|
180
|
+
"./use-is-client": {
|
|
181
|
+
"types": "./use-is-client/index.d.ts",
|
|
278
182
|
"import": {
|
|
279
|
-
"types": "./
|
|
280
|
-
"default": "./
|
|
183
|
+
"types": "./use-is-client/index.d.ts",
|
|
184
|
+
"default": "./use-is-client/index.mjs"
|
|
281
185
|
},
|
|
282
|
-
"require": "./
|
|
283
|
-
"default": "./
|
|
186
|
+
"require": "./use-is-client/index.cjs",
|
|
187
|
+
"default": "./use-is-client/index.js"
|
|
284
188
|
},
|
|
285
189
|
"./use-debounced-state": {
|
|
286
190
|
"types": "./use-debounced-state/index.d.ts",
|
|
@@ -291,23 +195,50 @@
|
|
|
291
195
|
"require": "./use-debounced-state/index.cjs",
|
|
292
196
|
"default": "./use-debounced-state/index.js"
|
|
293
197
|
},
|
|
294
|
-
"./use-
|
|
295
|
-
"types": "./use-
|
|
198
|
+
"./use-media-query": {
|
|
199
|
+
"types": "./use-media-query/index.d.ts",
|
|
296
200
|
"import": {
|
|
297
|
-
"types": "./use-
|
|
298
|
-
"default": "./use-
|
|
201
|
+
"types": "./use-media-query/index.d.ts",
|
|
202
|
+
"default": "./use-media-query/index.mjs"
|
|
299
203
|
},
|
|
300
|
-
"require": "./use-
|
|
301
|
-
"default": "./use-
|
|
204
|
+
"require": "./use-media-query/index.cjs",
|
|
205
|
+
"default": "./use-media-query/index.js"
|
|
302
206
|
},
|
|
303
|
-
"./use-
|
|
304
|
-
"types": "./use-
|
|
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",
|
|
305
209
|
"import": {
|
|
306
|
-
"types": "./use-
|
|
307
|
-
"default": "./use-
|
|
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"
|
|
308
212
|
},
|
|
309
|
-
"require": "./use-
|
|
310
|
-
"default": "./use-
|
|
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
|
+
"./use-uncontrolled": {
|
|
217
|
+
"types": "./use-uncontrolled/index.d.ts",
|
|
218
|
+
"import": {
|
|
219
|
+
"types": "./use-uncontrolled/index.d.ts",
|
|
220
|
+
"default": "./use-uncontrolled/index.mjs"
|
|
221
|
+
},
|
|
222
|
+
"require": "./use-uncontrolled/index.cjs",
|
|
223
|
+
"default": "./use-uncontrolled/index.js"
|
|
224
|
+
},
|
|
225
|
+
"./use-react-router-is-match": {
|
|
226
|
+
"types": "./use-react-router-is-match/index.d.ts",
|
|
227
|
+
"import": {
|
|
228
|
+
"types": "./use-react-router-is-match/index.d.ts",
|
|
229
|
+
"default": "./use-react-router-is-match/index.mjs"
|
|
230
|
+
},
|
|
231
|
+
"require": "./use-react-router-is-match/index.cjs",
|
|
232
|
+
"default": "./use-react-router-is-match/index.js"
|
|
233
|
+
},
|
|
234
|
+
"./create-fixed-array": {
|
|
235
|
+
"types": "./create-fixed-array/index.d.ts",
|
|
236
|
+
"import": {
|
|
237
|
+
"types": "./create-fixed-array/index.d.ts",
|
|
238
|
+
"default": "./create-fixed-array/index.mjs"
|
|
239
|
+
},
|
|
240
|
+
"require": "./create-fixed-array/index.cjs",
|
|
241
|
+
"default": "./create-fixed-array/index.js"
|
|
311
242
|
},
|
|
312
243
|
"./create-storage-hook": {
|
|
313
244
|
"types": "./create-storage-hook/index.d.ts",
|
|
@@ -318,6 +249,15 @@
|
|
|
318
249
|
"require": "./create-storage-hook/index.cjs",
|
|
319
250
|
"default": "./create-storage-hook/index.js"
|
|
320
251
|
},
|
|
252
|
+
"./use-intersection": {
|
|
253
|
+
"types": "./use-intersection/index.d.ts",
|
|
254
|
+
"import": {
|
|
255
|
+
"types": "./use-intersection/index.d.ts",
|
|
256
|
+
"default": "./use-intersection/index.mjs"
|
|
257
|
+
},
|
|
258
|
+
"require": "./use-intersection/index.cjs",
|
|
259
|
+
"default": "./use-intersection/index.js"
|
|
260
|
+
},
|
|
321
261
|
"./use-clipboard": {
|
|
322
262
|
"types": "./use-clipboard/index.d.ts",
|
|
323
263
|
"import": {
|
|
@@ -327,59 +267,113 @@
|
|
|
327
267
|
"require": "./use-clipboard/index.cjs",
|
|
328
268
|
"default": "./use-clipboard/index.js"
|
|
329
269
|
},
|
|
330
|
-
"./
|
|
331
|
-
"types": "./
|
|
270
|
+
"./compose-context-provider": {
|
|
271
|
+
"types": "./compose-context-provider/index.d.ts",
|
|
332
272
|
"import": {
|
|
333
|
-
"types": "./
|
|
334
|
-
"default": "./
|
|
273
|
+
"types": "./compose-context-provider/index.d.ts",
|
|
274
|
+
"default": "./compose-context-provider/index.mjs"
|
|
335
275
|
},
|
|
336
|
-
"require": "./
|
|
337
|
-
"default": "./
|
|
276
|
+
"require": "./compose-context-provider/index.cjs",
|
|
277
|
+
"default": "./compose-context-provider/index.js"
|
|
338
278
|
},
|
|
339
|
-
"./
|
|
340
|
-
"types": "./
|
|
279
|
+
"./request-idle-callback": {
|
|
280
|
+
"types": "./request-idle-callback/index.d.ts",
|
|
341
281
|
"import": {
|
|
342
|
-
"types": "./
|
|
343
|
-
"default": "./
|
|
282
|
+
"types": "./request-idle-callback/index.d.ts",
|
|
283
|
+
"default": "./request-idle-callback/index.mjs"
|
|
344
284
|
},
|
|
345
|
-
"require": "./
|
|
346
|
-
"default": "./
|
|
285
|
+
"require": "./request-idle-callback/index.cjs",
|
|
286
|
+
"default": "./request-idle-callback/index.js"
|
|
347
287
|
},
|
|
348
|
-
"./use-
|
|
349
|
-
"types": "./use-
|
|
288
|
+
"./use-isomorphic-layout-effect": {
|
|
289
|
+
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
350
290
|
"import": {
|
|
351
|
-
"types": "./use-
|
|
352
|
-
"default": "./use-
|
|
291
|
+
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
292
|
+
"default": "./use-isomorphic-layout-effect/index.mjs"
|
|
353
293
|
},
|
|
354
|
-
"require": "./use-
|
|
355
|
-
"default": "./use-
|
|
294
|
+
"require": "./use-isomorphic-layout-effect/index.cjs",
|
|
295
|
+
"default": "./use-isomorphic-layout-effect/index.js"
|
|
356
296
|
},
|
|
357
|
-
"./use-
|
|
358
|
-
"types": "./use-
|
|
297
|
+
"./use-debounced-value": {
|
|
298
|
+
"types": "./use-debounced-value/index.d.ts",
|
|
359
299
|
"import": {
|
|
360
|
-
"types": "./use-
|
|
361
|
-
"default": "./use-
|
|
300
|
+
"types": "./use-debounced-value/index.d.ts",
|
|
301
|
+
"default": "./use-debounced-value/index.mjs"
|
|
362
302
|
},
|
|
363
|
-
"require": "./use-
|
|
364
|
-
"default": "./use-
|
|
303
|
+
"require": "./use-debounced-value/index.cjs",
|
|
304
|
+
"default": "./use-debounced-value/index.js"
|
|
365
305
|
},
|
|
366
|
-
"./use-
|
|
367
|
-
"types": "./use-
|
|
306
|
+
"./use-local-storage": {
|
|
307
|
+
"types": "./use-local-storage/index.d.ts",
|
|
368
308
|
"import": {
|
|
369
|
-
"types": "./use-
|
|
370
|
-
"default": "./use-
|
|
309
|
+
"types": "./use-local-storage/index.d.ts",
|
|
310
|
+
"default": "./use-local-storage/index.mjs"
|
|
371
311
|
},
|
|
372
|
-
"require": "./use-
|
|
373
|
-
"default": "./use-
|
|
312
|
+
"require": "./use-local-storage/index.cjs",
|
|
313
|
+
"default": "./use-local-storage/index.js"
|
|
374
314
|
},
|
|
375
|
-
"./use-
|
|
376
|
-
"types": "./use-
|
|
315
|
+
"./use-set": {
|
|
316
|
+
"types": "./use-set/index.d.ts",
|
|
377
317
|
"import": {
|
|
378
|
-
"types": "./use-
|
|
379
|
-
"default": "./use-
|
|
318
|
+
"types": "./use-set/index.d.ts",
|
|
319
|
+
"default": "./use-set/index.mjs"
|
|
380
320
|
},
|
|
381
|
-
"require": "./use-
|
|
382
|
-
"default": "./use-
|
|
321
|
+
"require": "./use-set/index.cjs",
|
|
322
|
+
"default": "./use-set/index.js"
|
|
323
|
+
},
|
|
324
|
+
"./rem": {
|
|
325
|
+
"types": "./rem/index.d.ts",
|
|
326
|
+
"import": {
|
|
327
|
+
"types": "./rem/index.d.ts",
|
|
328
|
+
"default": "./rem/index.mjs"
|
|
329
|
+
},
|
|
330
|
+
"require": "./rem/index.cjs",
|
|
331
|
+
"default": "./rem/index.js"
|
|
332
|
+
},
|
|
333
|
+
"./use-array": {
|
|
334
|
+
"types": "./use-array/index.d.ts",
|
|
335
|
+
"import": {
|
|
336
|
+
"types": "./use-array/index.d.ts",
|
|
337
|
+
"default": "./use-array/index.mjs"
|
|
338
|
+
},
|
|
339
|
+
"require": "./use-array/index.cjs",
|
|
340
|
+
"default": "./use-array/index.js"
|
|
341
|
+
},
|
|
342
|
+
"./typescript-happy-forward-ref": {
|
|
343
|
+
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
344
|
+
"import": {
|
|
345
|
+
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
346
|
+
"default": "./typescript-happy-forward-ref/index.mjs"
|
|
347
|
+
},
|
|
348
|
+
"require": "./typescript-happy-forward-ref/index.cjs",
|
|
349
|
+
"default": "./typescript-happy-forward-ref/index.js"
|
|
350
|
+
},
|
|
351
|
+
"./use-session-storage": {
|
|
352
|
+
"types": "./use-session-storage/index.d.ts",
|
|
353
|
+
"import": {
|
|
354
|
+
"types": "./use-session-storage/index.d.ts",
|
|
355
|
+
"default": "./use-session-storage/index.mjs"
|
|
356
|
+
},
|
|
357
|
+
"require": "./use-session-storage/index.cjs",
|
|
358
|
+
"default": "./use-session-storage/index.js"
|
|
359
|
+
},
|
|
360
|
+
"./no-ssr": {
|
|
361
|
+
"types": "./no-ssr/index.d.ts",
|
|
362
|
+
"import": {
|
|
363
|
+
"types": "./no-ssr/index.d.ts",
|
|
364
|
+
"default": "./no-ssr/index.mjs"
|
|
365
|
+
},
|
|
366
|
+
"require": "./no-ssr/index.cjs",
|
|
367
|
+
"default": "./no-ssr/index.js"
|
|
368
|
+
},
|
|
369
|
+
"./nullthrow": {
|
|
370
|
+
"types": "./nullthrow/index.d.ts",
|
|
371
|
+
"import": {
|
|
372
|
+
"types": "./nullthrow/index.d.ts",
|
|
373
|
+
"default": "./nullthrow/index.mjs"
|
|
374
|
+
},
|
|
375
|
+
"require": "./nullthrow/index.cjs",
|
|
376
|
+
"default": "./nullthrow/index.js"
|
|
383
377
|
},
|
|
384
378
|
"./use-error-boundary": {
|
|
385
379
|
"types": "./use-error-boundary/index.d.ts",
|
|
@@ -390,6 +384,15 @@
|
|
|
390
384
|
"require": "./use-error-boundary/index.cjs",
|
|
391
385
|
"default": "./use-error-boundary/index.js"
|
|
392
386
|
},
|
|
387
|
+
"./use-react-router-enable-concurrent-navigation": {
|
|
388
|
+
"types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
|
|
389
|
+
"import": {
|
|
390
|
+
"types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
|
|
391
|
+
"default": "./use-react-router-enable-concurrent-navigation/index.mjs"
|
|
392
|
+
},
|
|
393
|
+
"require": "./use-react-router-enable-concurrent-navigation/index.cjs",
|
|
394
|
+
"default": "./use-react-router-enable-concurrent-navigation/index.js"
|
|
395
|
+
},
|
|
393
396
|
"./create-context-state": {
|
|
394
397
|
"types": "./create-context-state/index.d.ts",
|
|
395
398
|
"import": {
|
|
@@ -398,6 +401,15 @@
|
|
|
398
401
|
},
|
|
399
402
|
"require": "./create-context-state/index.cjs",
|
|
400
403
|
"default": "./create-context-state/index.js"
|
|
404
|
+
},
|
|
405
|
+
"./use-composition-input": {
|
|
406
|
+
"types": "./use-composition-input/index.d.ts",
|
|
407
|
+
"import": {
|
|
408
|
+
"types": "./use-composition-input/index.d.ts",
|
|
409
|
+
"default": "./use-composition-input/index.mjs"
|
|
410
|
+
},
|
|
411
|
+
"require": "./use-composition-input/index.cjs",
|
|
412
|
+
"default": "./use-composition-input/index.js"
|
|
401
413
|
}
|
|
402
414
|
}
|
|
403
415
|
}
|
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}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),r=require("../use-singleton/index.cjs");
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),r=require("../use-singleton/index.cjs");const t=()=>({c:!1,e:!1});exports.useCompositionInput=c=>{const n=r.useSingleton(t),u=e.useCallback(e=>{if("value"in e.target){const r=e.target.value;n.current.c?n.current.e=!1:(c(r),n.current.e=!0)}},[c,n]),s=e.useCallback(()=>{n.current.c=!0,n.current.e=!1},[n]),a=e.useCallback(e=>{n.current.c=!1,n.current.e||u(e)},[n,u]);return{onChange:u,onCompositionStart:s,onCompositionEnd:a}};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
type UseCompositionInputCallback = (value: string) => void;
|
|
2
2
|
type UseCompositionInputReturnKey = 'onChange' | 'onCompositionStart' | 'onCompositionEnd';
|
|
3
|
-
|
|
3
|
+
interface UseCompositionInputReturn<T extends HTMLInputElement | HTMLTextAreaElement> {
|
|
4
|
+
onChange: React.ChangeEventHandler<T>;
|
|
5
|
+
onCompositionStart: React.CompositionEventHandler<T>;
|
|
6
|
+
onCompositionEnd: React.CompositionEventHandler<T>;
|
|
7
|
+
}
|
|
4
8
|
/** @see https://foxact.skk.moe/use-composition-input */
|
|
5
|
-
declare const useCompositionInput: (cb: UseCompositionInputCallback) => UseCompositionInputReturn
|
|
9
|
+
declare const useCompositionInput: <T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement>(cb: UseCompositionInputCallback) => UseCompositionInputReturn<T>;
|
|
6
10
|
|
|
7
11
|
export { type UseCompositionInputCallback, type UseCompositionInputReturn, type UseCompositionInputReturnKey, useCompositionInput };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),r=require("../use-singleton/index.js");
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),r=require("../use-singleton/index.js");const t=()=>({c:!1,e:!1});exports.useCompositionInput=n=>{const u=r.useSingleton(t),c=e.useCallback(e=>{if("value"in e.target){const r=e.target.value;u.current.c?u.current.e=!1:(n(r),u.current.e=!0)}},[n,u]),s=e.useCallback(()=>{u.current.c=!0,u.current.e=!1},[u]),a=e.useCallback(e=>{u.current.c=!1,u.current.e||c(e)},[u,c]);return{onChange:c,onCompositionStart:s,onCompositionEnd:a}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useCallback as r}from"react";import{useSingleton as e}from"../use-singleton/index.mjs";const t=
|
|
1
|
+
import"client-only";import{useCallback as r}from"react";import{useSingleton as e}from"../use-singleton/index.mjs";const t=()=>({c:!1,e:!1}),n=n=>{const c=e(t),o=r(r=>{if("value"in r.target){const e=r.target.value;c.current.c?c.current.e=!1:(n(e),c.current.e=!0)}},[n,c]),u=r(()=>{c.current.c=!0,c.current.e=!1},[c]),i=r(r=>{c.current.c=!1,c.current.e||o(r)},[c,o]);return{onChange:o,onCompositionStart:u,onCompositionEnd:i}};export{n as useCompositionInput};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
/** @see https://foxact.skk.moe/use-isomorphic-layout-effect */
|
|
4
|
-
declare const useIsomorphicLayoutEffect: typeof
|
|
4
|
+
declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
5
5
|
/** @see https://foxact.skk.moe/use-isomorphic-layout-effect */
|
|
6
|
-
declare const useLayoutEffect: typeof
|
|
6
|
+
declare const useLayoutEffect: typeof useEffect;
|
|
7
7
|
|
|
8
8
|
export { useIsomorphicLayoutEffect, useLayoutEffect };
|
|
@@ -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 };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";var e=require("../no-ssr/index.cjs"),n=require("../noop/index.cjs"),r=require("react");const t=new Map,o=(e,r)=>{if("undefined"==typeof window)return n.noop;const o=window.matchMedia(e),i=()=>{t.set(e,o.matches),r()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}},i=()=>{throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")};exports.useMediaQuery=(e,n)=>{"undefined"==typeof window||t.has(e)||t.set(e,window.matchMedia(e).matches);const a=r.useCallback(n=>o(e,n),[e]);return r.useSyncExternalStore(a,()=>{var n;return"undefined"!=typeof window&&(null!==(n=t.get(e))&&void 0!==n?n:window.matchMedia(e).matches)},void 0!==n?()=>n:i)};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";var e=require("../no-ssr/index.js"),n=require("../noop/index.js"),r=require("react");const t=new Map,o=(e,r)=>{if("undefined"==typeof window)return n.noop;const o=window.matchMedia(e),i=()=>{t.set(e,o.matches),r()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}},i=()=>{throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")};exports.useMediaQuery=(e,n)=>{"undefined"==typeof window||t.has(e)||t.set(e,window.matchMedia(e).matches);const a=r.useCallback(n=>o(e,n),[e]);return r.useSyncExternalStore(a,()=>{var n;return"undefined"!=typeof window&&(null!==(n=t.get(e))&&void 0!==n?n:window.matchMedia(e).matches)},void 0!==n?()=>n:i)};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import{noSSRError as e}from"../no-ssr/index.mjs";import{noop as n}from"../noop/index.mjs";import{useCallback as t,useSyncExternalStore as o}from"react";const r=new Map,i=(e,t)=>{if("undefined"==typeof window)return n;const o=window.matchMedia(e),i=()=>{r.set(e,o.matches),t()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}},d=()=>{throw e("useMediaQuery cannot be used on the server without a serverValue")},a=(e,n)=>("undefined"==typeof window||r.has(e)||r.set(e,window.matchMedia(e).matches),o(t(n=>i(e,n),[e]),()=>{var n;return"undefined"!=typeof window&&(null!==(n=r.get(e))&&void 0!==n?n:window.matchMedia(e).matches)},void 0!==n?()=>n:d));export{a as useMediaQuery};
|
package/use-next-link/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),t=require("next/navigation"),r=require("next/dist/shared/lib/router/utils/format-url"),n=require("../use-intersection/index.cjs");require("../request-idle-callback/index.cjs");const o=e=>{const t=e.currentTarget,r=t.getAttribute("target");return r&&"_self"!==r||t.download||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which},s=(e,t,r)=>{"undefined"!=typeof window&&Promise.resolve(e.prefetch(t,r)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})};exports.unstable_useNextLink=(u,i)=>{let{prefetch:c,ref:l,onClick:a,onMouseEnter:f,onTouchStart:p,scroll:d=!0,replace:v=!1,...E}=i;process.env.NODE_ENV;const y=null==c?"auto":"full",N=!1!==c,h=t.useRouter(),[k,b]=e.useTransition(),[g,
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("next/navigation"),r=require("next/dist/shared/lib/router/utils/format-url"),n=require("../use-intersection/index.cjs");require("../request-idle-callback/index.cjs");const o=e=>{const t=e.currentTarget,r=t.getAttribute("target");return r&&"_self"!==r||t.download||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which},s=(e,t,r)=>{"undefined"!=typeof window&&Promise.resolve(e.prefetch(t,r)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})};exports.unstable_useNextLink=(u,i)=>{let{prefetch:c,ref:l,onClick:a,onMouseEnter:f,onTouchStart:p,scroll:d=!0,replace:v=!1,...E}=i;process.env.NODE_ENV;const y=null==c?"auto":"full",N=!1!==c,h=t.useRouter(),[k,b]=e.useTransition(),[m,g,q]=n.useIntersection(e.useMemo(()=>({rootMargin:"200px"}),[])),x=e.useMemo(()=>"string"==typeof u?u:r.formatUrl(u),[u]),[_,C]=e.useState(x);return _!==x&&(C(x),q()),e.useEffect(()=>{"production"===process.env.NODE_ENV&&g&&N&&s(h,x,{kind:y})},[y,g,N,x,h]),[k,{ref:e.useCallback(e=>{m(e),"function"==typeof l?l(e):l&&e&&(l.current=e)},[l,m]),onClick:e.useCallback(e=>{if("function"==typeof a&&a(e),e.defaultPrevented)return;const{nodeName:t}=e.currentTarget;!("A"===t.toUpperCase()&&o(e))&&(e.preventDefault(),b(()=>{h[v?"replace":"push"](x,{scroll:d})}))},[a,v,x,h,d]),onMouseEnter:e.useCallback(e=>{"function"==typeof f&&f(e),"development"!==process.env.NODE_ENV&&N&&s(h,x,{kind:y})},[y,f,N,x,h]),onTouchStart:e.useCallback(e=>{"function"==typeof p&&p(e),"development"!==process.env.NODE_ENV&&N&&s(h,x,{kind:y})},[y,p,N,x,h]),...E}]};
|
package/use-next-link/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),t=require("next/navigation"),r=require("next/dist/shared/lib/router/utils/format-url"),n=require("../use-intersection/index.js");require("../request-idle-callback/index.js");const o=e=>{const t=e.currentTarget,r=t.getAttribute("target");return r&&"_self"!==r||t.download||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which},s=(e,t,r)=>{"undefined"!=typeof window&&Promise.resolve(e.prefetch(t,r)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})};exports.unstable_useNextLink=(u,i)=>{let{prefetch:c,ref:l,onClick:a,onMouseEnter:f,onTouchStart:p,scroll:d=!0,replace:v=!1,...E}=i;process.env.NODE_ENV;const y=null==c?"auto":"full",N=!1!==c,h=t.useRouter(),[k,b]=e.useTransition(),[g,
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("next/navigation"),r=require("next/dist/shared/lib/router/utils/format-url"),n=require("../use-intersection/index.js");require("../request-idle-callback/index.js");const o=e=>{const t=e.currentTarget,r=t.getAttribute("target");return r&&"_self"!==r||t.download||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which},s=(e,t,r)=>{"undefined"!=typeof window&&Promise.resolve(e.prefetch(t,r)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})};exports.unstable_useNextLink=(u,i)=>{let{prefetch:c,ref:l,onClick:a,onMouseEnter:f,onTouchStart:p,scroll:d=!0,replace:v=!1,...E}=i;process.env.NODE_ENV;const y=null==c?"auto":"full",N=!1!==c,h=t.useRouter(),[k,b]=e.useTransition(),[m,g,q]=n.useIntersection(e.useMemo(()=>({rootMargin:"200px"}),[])),x=e.useMemo(()=>"string"==typeof u?u:r.formatUrl(u),[u]),[_,C]=e.useState(x);return _!==x&&(C(x),q()),e.useEffect(()=>{"production"===process.env.NODE_ENV&&g&&N&&s(h,x,{kind:y})},[y,g,N,x,h]),[k,{ref:e.useCallback(e=>{m(e),"function"==typeof l?l(e):l&&e&&(l.current=e)},[l,m]),onClick:e.useCallback(e=>{if("function"==typeof a&&a(e),e.defaultPrevented)return;const{nodeName:t}=e.currentTarget;!("A"===t.toUpperCase()&&o(e))&&(e.preventDefault(),b(()=>{h[v?"replace":"push"](x,{scroll:d})}))},[a,v,x,h,d]),onMouseEnter:e.useCallback(e=>{"function"==typeof f&&f(e),"development"!==process.env.NODE_ENV&&N&&s(h,x,{kind:y})},[y,f,N,x,h]),onTouchStart:e.useCallback(e=>{"function"==typeof p&&p(e),"development"!==process.env.NODE_ENV&&N&&s(h,x,{kind:y})},[y,p,N,x,h]),...E}]};
|
package/use-next-link/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useTransition as e,useMemo as t,useState as r,useEffect as n,useCallback as o}from"react";import{useRouter as i}from"next/navigation";import{formatUrl as c}from"next/dist/shared/lib/router/utils/format-url";import{useIntersection as s}from"../use-intersection/index.mjs";import"../request-idle-callback/index.mjs";const p=e=>{const t=e.currentTarget,r=t.getAttribute("target");return r&&"_self"!==r||t.download||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which},l=(e,t,r)=>{"undefined"!=typeof window&&Promise.resolve(e.prefetch(t,r)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})},u=(u,f)=>{let{prefetch:a,ref:d,onClick:m,onMouseEnter:v,onTouchStart:E,scroll:y=!0,replace:N=!1,...h}=f;process.env.NODE_ENV;const g=null==a?"auto":"full",x=!1!==a,_=i(),[k,D]=e(),[w,O,V]=s({rootMargin:"200px"}),b=t(()=>"string"==typeof u?u:c(u),[u]),[K,T]=r(b);return K!==b&&(T(b),V()),n(()=>{"production"===process.env.NODE_ENV&&O&&x&&l(_,b,{kind:g})},[g,O,x,b,_]),[k,{ref:o(e=>{w(e),"function"==typeof d?d(e):d&&e&&(d.current=e)},[d,w]),onClick:o(e=>{if("function"==typeof m&&m(e),e.defaultPrevented)return;const{nodeName:t}=e.currentTarget;!("A"===t.toUpperCase()&&p(e))&&(e.preventDefault(),D(()=>{_[N?"replace":"push"](b,{scroll:y})}))},[m,N,b,_,y]),onMouseEnter:o(e=>{"function"==typeof v&&v(e),"development"!==process.env.NODE_ENV&&x&&l(_,b,{kind:g})},[g,v,x,b,_]),onTouchStart:o(e=>{"function"==typeof E&&E(e),"development"!==process.env.NODE_ENV&&x&&l(_,b,{kind:g})},[g,E,x,b,_]),...h}]};export{u as unstable_useNextLink};
|
|
1
|
+
import"client-only";import{useTransition as e,useMemo as t,useState as r,useEffect as n,useCallback as o}from"react";import{useRouter as i}from"next/navigation";import{formatUrl as c}from"next/dist/shared/lib/router/utils/format-url";import{useIntersection as s}from"../use-intersection/index.mjs";import"../request-idle-callback/index.mjs";const p=e=>{const t=e.currentTarget,r=t.getAttribute("target");return r&&"_self"!==r||t.download||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which},l=(e,t,r)=>{"undefined"!=typeof window&&Promise.resolve(e.prefetch(t,r)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})},u=(u,f)=>{let{prefetch:a,ref:d,onClick:m,onMouseEnter:v,onTouchStart:E,scroll:y=!0,replace:N=!1,...h}=f;process.env.NODE_ENV;const g=null==a?"auto":"full",x=!1!==a,_=i(),[k,D]=e(),[w,O,V]=s(t(()=>({rootMargin:"200px"}),[])),b=t(()=>"string"==typeof u?u:c(u),[u]),[K,T]=r(b);return K!==b&&(T(b),V()),n(()=>{"production"===process.env.NODE_ENV&&O&&x&&l(_,b,{kind:g})},[g,O,x,b,_]),[k,{ref:o(e=>{w(e),"function"==typeof d?d(e):d&&e&&(d.current=e)},[d,w]),onClick:o(e=>{if("function"==typeof m&&m(e),e.defaultPrevented)return;const{nodeName:t}=e.currentTarget;!("A"===t.toUpperCase()&&p(e))&&(e.preventDefault(),D(()=>{_[N?"replace":"push"](b,{scroll:y})}))},[m,N,b,_,y]),onMouseEnter:o(e=>{"function"==typeof v&&v(e),"development"!==process.env.NODE_ENV&&x&&l(_,b,{kind:g})},[g,v,x,b,_]),onTouchStart:o(e=>{"function"==typeof E&&E(e),"development"!==process.env.NODE_ENV&&x&&l(_,b,{kind:g})},[g,E,x,b,_]),...h}]};export{u as unstable_useNextLink};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),t=require("react-router-dom");exports.useReactRouterIsMatch=function(
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("react-router-dom");const r=e=>e;exports.useReactRouterIsMatch=function(o){let{relative:a,caseSensitive:n=!1,end:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{pathname:u}=t.useLocation(),{navigator:{encodeLocation:i=r}}=e.useContext(t.UNSAFE_NavigationContext),c=t.useResolvedPath(o,{relative:a});return e.useMemo(()=>{let e=u,t=i(c).pathname;return n||(e=e.toLowerCase(),t=t.toLowerCase()),e===t||!s&&e.startsWith(t)&&"/"===e.charAt(t.length)},[i,c,u,n,s])};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RelativeRoutingType } from 'react-router-dom';
|
|
2
2
|
|
|
3
3
|
interface UseReactRouterIsMatchOption {
|
|
4
4
|
relative?: RelativeRoutingType;
|
|
@@ -6,6 +6,6 @@ interface UseReactRouterIsMatchOption {
|
|
|
6
6
|
end?: boolean;
|
|
7
7
|
}
|
|
8
8
|
/** @see https://foxact.skk.moe/use-react-router-is-match */
|
|
9
|
-
declare const useReactRouterIsMatch: (to: To, { relative, caseSensitive, end }?: UseReactRouterIsMatchOption) =>
|
|
9
|
+
declare const useReactRouterIsMatch: (to: To, { relative, caseSensitive, end }?: UseReactRouterIsMatchOption) => any;
|
|
10
10
|
|
|
11
11
|
export { useReactRouterIsMatch };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),t=require("react-router-dom");exports.useReactRouterIsMatch=function(
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("react-router-dom");const r=e=>e;exports.useReactRouterIsMatch=function(o){let{relative:a,caseSensitive:n=!1,end:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{pathname:u}=t.useLocation(),{navigator:{encodeLocation:i=r}}=e.useContext(t.UNSAFE_NavigationContext),c=t.useResolvedPath(o,{relative:a});return e.useMemo(()=>{let e=u,t=i(c).pathname;return n||(e=e.toLowerCase(),t=t.toLowerCase()),e===t||!s&&e.startsWith(t)&&"/"===e.charAt(t.length)},[i,c,u,n,s])};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useContext as t,useMemo as e}from"react";import{useLocation as r,UNSAFE_NavigationContext as o,useResolvedPath as a}from"react-router-dom";const n=function(
|
|
1
|
+
import"client-only";import{useContext as t,useMemo as e}from"react";import{useLocation as r,UNSAFE_NavigationContext as o,useResolvedPath as a}from"react-router-dom";const n=t=>t,c=function(c){let{relative:i,caseSensitive:m=!1,end:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{pathname:h}=r(),{navigator:{encodeLocation:l=n}}=t(o),p=a(c,{relative:i});return e(()=>{let t=h,e=l(p).pathname;return m||(t=t.toLowerCase(),e=e.toLowerCase()),t===e||!s&&t.startsWith(e)&&"/"===t.charAt(e.length)},[l,p,h,m,s])};export{c as useReactRouterIsMatch};
|
|
@@ -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 };
|