foxact 0.2.11 → 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
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": [
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
"require": "./create-context-state/index.cjs",
|
|
66
66
|
"default": "./create-context-state/index.js"
|
|
67
67
|
},
|
|
68
|
-
"./
|
|
69
|
-
"types": "./
|
|
68
|
+
"./request-idle-callback": {
|
|
69
|
+
"types": "./request-idle-callback/index.d.ts",
|
|
70
70
|
"import": {
|
|
71
|
-
"types": "./
|
|
72
|
-
"default": "./
|
|
71
|
+
"types": "./request-idle-callback/index.d.ts",
|
|
72
|
+
"default": "./request-idle-callback/index.mjs"
|
|
73
73
|
},
|
|
74
|
-
"require": "./
|
|
75
|
-
"default": "./
|
|
74
|
+
"require": "./request-idle-callback/index.cjs",
|
|
75
|
+
"default": "./request-idle-callback/index.js"
|
|
76
76
|
},
|
|
77
77
|
"./typescript-happy-forward-ref": {
|
|
78
78
|
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
@@ -101,15 +101,6 @@
|
|
|
101
101
|
"require": "./use-array/index.cjs",
|
|
102
102
|
"default": "./use-array/index.js"
|
|
103
103
|
},
|
|
104
|
-
"./request-idle-callback": {
|
|
105
|
-
"types": "./request-idle-callback/index.d.ts",
|
|
106
|
-
"import": {
|
|
107
|
-
"types": "./request-idle-callback/index.d.ts",
|
|
108
|
-
"default": "./request-idle-callback/index.mjs"
|
|
109
|
-
},
|
|
110
|
-
"require": "./request-idle-callback/index.cjs",
|
|
111
|
-
"default": "./request-idle-callback/index.js"
|
|
112
|
-
},
|
|
113
104
|
"./use-clipboard": {
|
|
114
105
|
"types": "./use-clipboard/index.d.ts",
|
|
115
106
|
"import": {
|
|
@@ -128,15 +119,6 @@
|
|
|
128
119
|
"require": "./use-composition-input/index.cjs",
|
|
129
120
|
"default": "./use-composition-input/index.js"
|
|
130
121
|
},
|
|
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
122
|
"./use-debounced-value": {
|
|
141
123
|
"types": "./use-debounced-value/index.d.ts",
|
|
142
124
|
"import": {
|
|
@@ -146,6 +128,15 @@
|
|
|
146
128
|
"require": "./use-debounced-value/index.cjs",
|
|
147
129
|
"default": "./use-debounced-value/index.js"
|
|
148
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
|
+
},
|
|
149
140
|
"./use-error-boundary": {
|
|
150
141
|
"types": "./use-error-boundary/index.d.ts",
|
|
151
142
|
"import": {
|
|
@@ -164,6 +155,15 @@
|
|
|
164
155
|
"require": "./use-intersection/index.cjs",
|
|
165
156
|
"default": "./use-intersection/index.js"
|
|
166
157
|
},
|
|
158
|
+
"./noop": {
|
|
159
|
+
"types": "./noop/index.d.ts",
|
|
160
|
+
"import": {
|
|
161
|
+
"types": "./noop/index.d.ts",
|
|
162
|
+
"default": "./noop/index.mjs"
|
|
163
|
+
},
|
|
164
|
+
"require": "./noop/index.cjs",
|
|
165
|
+
"default": "./noop/index.js"
|
|
166
|
+
},
|
|
167
167
|
"./use-isomorphic-layout-effect": {
|
|
168
168
|
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
169
169
|
"import": {
|
|
@@ -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};
|