foxact 0.2.10 → 0.2.12
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 +1 -1
- package/package.json +31 -22
- package/sizes.json +1 -1
- package/use-react-router-is-match/index.cjs +1 -0
- package/use-react-router-is-match/index.d.ts +11 -0
- package/use-react-router-is-match/index.js +1 -0
- package/use-react-router-is-match/index.mjs +1 -0
- package/use-uncontrolled/index.cjs +1 -1
- package/use-uncontrolled/index.js +1 -1
- package/use-uncontrolled/index.mjs +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Written in TypeScript. Unlocking strong typing benefits with TypeScript 4.8+.
|
|
|
26
26
|
|
|
27
27
|
#### Super Lightweight
|
|
28
28
|
|
|
29
|
-
The entire **foxact** library has zero dependencies and is **less than 5 KiB gzipped in sum**, ensuring a lean and efficient solution. And what's more...
|
|
29
|
+
The entire **foxact** library has zero dependencies and is **less than 5 KiB gzipped in sum**, ensuring a lean and efficient solution. And what's more...
|
|
30
30
|
|
|
31
31
|
#### Fully Tree Shakable
|
|
32
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxact",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "React Hooks/Utils done right. For browser, SSR, and React Server Components.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"require": "./context-state/index.cjs",
|
|
57
57
|
"default": "./context-state/index.js"
|
|
58
58
|
},
|
|
59
|
-
"./
|
|
60
|
-
"types": "./
|
|
59
|
+
"./create-context-state": {
|
|
60
|
+
"types": "./create-context-state/index.d.ts",
|
|
61
61
|
"import": {
|
|
62
|
-
"types": "./
|
|
63
|
-
"default": "./
|
|
62
|
+
"types": "./create-context-state/index.d.ts",
|
|
63
|
+
"default": "./create-context-state/index.mjs"
|
|
64
64
|
},
|
|
65
|
-
"require": "./
|
|
66
|
-
"default": "./
|
|
65
|
+
"require": "./create-context-state/index.cjs",
|
|
66
|
+
"default": "./create-context-state/index.js"
|
|
67
67
|
},
|
|
68
68
|
"./request-idle-callback": {
|
|
69
69
|
"types": "./request-idle-callback/index.d.ts",
|
|
@@ -119,15 +119,6 @@
|
|
|
119
119
|
"require": "./use-composition-input/index.cjs",
|
|
120
120
|
"default": "./use-composition-input/index.js"
|
|
121
121
|
},
|
|
122
|
-
"./use-debounced-state": {
|
|
123
|
-
"types": "./use-debounced-state/index.d.ts",
|
|
124
|
-
"import": {
|
|
125
|
-
"types": "./use-debounced-state/index.d.ts",
|
|
126
|
-
"default": "./use-debounced-state/index.mjs"
|
|
127
|
-
},
|
|
128
|
-
"require": "./use-debounced-state/index.cjs",
|
|
129
|
-
"default": "./use-debounced-state/index.js"
|
|
130
|
-
},
|
|
131
122
|
"./use-debounced-value": {
|
|
132
123
|
"types": "./use-debounced-value/index.d.ts",
|
|
133
124
|
"import": {
|
|
@@ -137,6 +128,15 @@
|
|
|
137
128
|
"require": "./use-debounced-value/index.cjs",
|
|
138
129
|
"default": "./use-debounced-value/index.js"
|
|
139
130
|
},
|
|
131
|
+
"./use-debounced-state": {
|
|
132
|
+
"types": "./use-debounced-state/index.d.ts",
|
|
133
|
+
"import": {
|
|
134
|
+
"types": "./use-debounced-state/index.d.ts",
|
|
135
|
+
"default": "./use-debounced-state/index.mjs"
|
|
136
|
+
},
|
|
137
|
+
"require": "./use-debounced-state/index.cjs",
|
|
138
|
+
"default": "./use-debounced-state/index.js"
|
|
139
|
+
},
|
|
140
140
|
"./use-error-boundary": {
|
|
141
141
|
"types": "./use-error-boundary/index.d.ts",
|
|
142
142
|
"import": {
|
|
@@ -155,14 +155,14 @@
|
|
|
155
155
|
"require": "./use-intersection/index.cjs",
|
|
156
156
|
"default": "./use-intersection/index.js"
|
|
157
157
|
},
|
|
158
|
-
"./
|
|
159
|
-
"types": "./
|
|
158
|
+
"./noop": {
|
|
159
|
+
"types": "./noop/index.d.ts",
|
|
160
160
|
"import": {
|
|
161
|
-
"types": "./
|
|
162
|
-
"default": "./
|
|
161
|
+
"types": "./noop/index.d.ts",
|
|
162
|
+
"default": "./noop/index.mjs"
|
|
163
163
|
},
|
|
164
|
-
"require": "./
|
|
165
|
-
"default": "./
|
|
164
|
+
"require": "./noop/index.cjs",
|
|
165
|
+
"default": "./noop/index.js"
|
|
166
166
|
},
|
|
167
167
|
"./use-isomorphic-layout-effect": {
|
|
168
168
|
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
@@ -182,6 +182,15 @@
|
|
|
182
182
|
"require": "./use-map/index.cjs",
|
|
183
183
|
"default": "./use-map/index.js"
|
|
184
184
|
},
|
|
185
|
+
"./use-react-router-is-match": {
|
|
186
|
+
"types": "./use-react-router-is-match/index.d.ts",
|
|
187
|
+
"import": {
|
|
188
|
+
"types": "./use-react-router-is-match/index.d.ts",
|
|
189
|
+
"default": "./use-react-router-is-match/index.mjs"
|
|
190
|
+
},
|
|
191
|
+
"require": "./use-react-router-is-match/index.cjs",
|
|
192
|
+
"default": "./use-react-router-is-match/index.js"
|
|
193
|
+
},
|
|
185
194
|
"./use-retimer": {
|
|
186
195
|
"types": "./use-retimer/index.d.ts",
|
|
187
196
|
"import": {
|
package/sizes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"total":{"raw":
|
|
1
|
+
{"total":{"raw":7647,"gzip":5072,"br":0},"exports":{"context-state":{"raw":371,"gzip":240,"br":204},"create-context-state":{"raw":146,"gzip":116,"br":102},"typescript-happy-forward-ref":{"raw":118,"gzip":102,"br":87},"use":{"raw":279,"gzip":175,"br":151},"request-idle-callback":{"raw":407,"gzip":231,"br":180},"use-clipboard":{"raw":1071,"gzip":614,"br":527},"use-array":{"raw":329,"gzip":242,"br":201},"use-error-boundary":{"raw":172,"gzip":157,"br":148},"use-intersection":{"raw":1214,"gzip":652,"br":592},"noop":{"raw":32,"gzip":52,"br":36},"use-isomorphic-layout-effect":{"raw":177,"gzip":143,"br":120},"use-debounced-state":{"raw":380,"gzip":275,"br":231},"use-debounced-value":{"raw":370,"gzip":263,"br":214},"use-retimer":{"raw":197,"gzip":165,"br":125},"use-react-router-is-match":{"raw":502,"gzip":337,"br":284},"use-set":{"raw":349,"gzip":242,"br":203},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":461,"gzip":325,"br":256},"use-composition-input":{"raw":420,"gzip":262,"br":230},"use-uncontrolled":{"raw":304,"gzip":236,"br":201},"use-map":{"raw":348,"gzip":243,"br":210}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("react-router-dom");exports.useReactRouterIsMatch=(r,a)=>{let{relative:o,caseSensitive:s=!1,end:n=!1}=a,{pathname:u}=t.useLocation(),{navigator:{encodeLocation:i}}=e.useContext(t.UNSAFE_NavigationContext),c=t.useResolvedPath(r,{relative:o});return e.useMemo(()=>{let e=u,t=i?i(c).pathname:c.pathname;return s||(e=e.toLowerCase(),t=t.toLowerCase()),e===t||!n&&e.startsWith(t)&&"/"===e.charAt(t.length)},[i,c,u,s,n])};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { To, RelativeRoutingType } from 'react-router-dom';
|
|
2
|
+
|
|
3
|
+
interface UseReactRouterIsMatchOption {
|
|
4
|
+
relative?: RelativeRoutingType;
|
|
5
|
+
caseSensitive?: boolean;
|
|
6
|
+
end?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** @see https://foxact.skk.moe/use-react-router-is-match */
|
|
9
|
+
declare const useReactRouterIsMatch: (to: To, { relative, caseSensitive, end }: UseReactRouterIsMatchOption) => boolean;
|
|
10
|
+
|
|
11
|
+
export { useReactRouterIsMatch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("react-router-dom");exports.useReactRouterIsMatch=(r,a)=>{let{relative:o,caseSensitive:s=!1,end:n=!1}=a,{pathname:u}=t.useLocation(),{navigator:{encodeLocation:i}}=e.useContext(t.UNSAFE_NavigationContext),c=t.useResolvedPath(r,{relative:o});return e.useMemo(()=>{let e=u,t=i?i(c).pathname:c.pathname;return s||(e=e.toLowerCase(),t=t.toLowerCase()),e===t||!n&&e.startsWith(t)&&"/"===e.charAt(t.length)},[i,c,u,s,n])};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"client-only";import{useContext as t,useMemo as e}from"react";import{useLocation as r,UNSAFE_NavigationContext as a,useResolvedPath as o}from"react-router-dom";let m=(m,n)=>{let{relative:h,caseSensitive:p=!1,end:c=!1}=n,{pathname:i}=r(),{navigator:{encodeLocation:l}}=t(a),s=o(m,{relative:h});return e(()=>{let t=i,e=l?l(s).pathname:s.pathname;return p||(t=t.toLowerCase(),e=e.toLowerCase()),t===e||!c&&t.startsWith(e)&&"/"===t.charAt(e.length)},[l,s,i,p,c])};export{m as useReactRouterIsMatch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react")
|
|
1
|
+
"use strict";require("client-only");var e=require("react");const r=e=>e;exports.useUncontrolled=function(u){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,t=e.useRef(null),n=e.useCallback((e,r)=>l(r),[l]),[c,s]=e.useReducer(n,u),a=e.useCallback(()=>{t.current&&s(t.current.value)},[]);return[c,a,t]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react")
|
|
1
|
+
"use strict";require("client-only");var e=require("react");const r=e=>e;exports.useUncontrolled=function(u){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,t=e.useRef(null),n=e.useCallback((e,r)=>l(r),[l]),[c,s]=e.useReducer(n,u),a=e.useCallback(()=>{t.current&&s(t.current.value)},[]);return[c,a,t]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{
|
|
1
|
+
import"client-only";import{useRef as t,useCallback as e,useReducer as r}from"react";let n=t=>t;function l(l){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,u=t(null),c=e((t,e)=>o(e),[o]),[i,m]=r(c,l),p=e(()=>{u.current&&m(u.current.value)},[]);return[i,p,u]}export{l as useUncontrolled};
|