foxact 0.2.12 → 0.2.14
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/package.json +28 -19
- package/sizes.json +1 -1
- package/use-react-router-enable-concurrent-navigation/index.cjs +2 -0
- package/use-react-router-enable-concurrent-navigation/index.d.ts +7 -0
- package/use-react-router-enable-concurrent-navigation/index.js +2 -0
- package/use-react-router-enable-concurrent-navigation/index.mjs +2 -0
- package/use-react-router-is-match/index.cjs +1 -1
- package/use-react-router-is-match/index.d.ts +1 -1
- package/use-react-router-is-match/index.js +1 -1
- package/use-react-router-is-match/index.mjs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxact",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "React Hooks/Utils done right. For browser, SSR, and React Server Components.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
@@ -65,6 +65,15 @@
|
|
|
65
65
|
"require": "./create-context-state/index.cjs",
|
|
66
66
|
"default": "./create-context-state/index.js"
|
|
67
67
|
},
|
|
68
|
+
"./noop": {
|
|
69
|
+
"types": "./noop/index.d.ts",
|
|
70
|
+
"import": {
|
|
71
|
+
"types": "./noop/index.d.ts",
|
|
72
|
+
"default": "./noop/index.mjs"
|
|
73
|
+
},
|
|
74
|
+
"require": "./noop/index.cjs",
|
|
75
|
+
"default": "./noop/index.js"
|
|
76
|
+
},
|
|
68
77
|
"./request-idle-callback": {
|
|
69
78
|
"types": "./request-idle-callback/index.d.ts",
|
|
70
79
|
"import": {
|
|
@@ -119,15 +128,6 @@
|
|
|
119
128
|
"require": "./use-composition-input/index.cjs",
|
|
120
129
|
"default": "./use-composition-input/index.js"
|
|
121
130
|
},
|
|
122
|
-
"./use-debounced-value": {
|
|
123
|
-
"types": "./use-debounced-value/index.d.ts",
|
|
124
|
-
"import": {
|
|
125
|
-
"types": "./use-debounced-value/index.d.ts",
|
|
126
|
-
"default": "./use-debounced-value/index.mjs"
|
|
127
|
-
},
|
|
128
|
-
"require": "./use-debounced-value/index.cjs",
|
|
129
|
-
"default": "./use-debounced-value/index.js"
|
|
130
|
-
},
|
|
131
131
|
"./use-debounced-state": {
|
|
132
132
|
"types": "./use-debounced-state/index.d.ts",
|
|
133
133
|
"import": {
|
|
@@ -137,6 +137,15 @@
|
|
|
137
137
|
"require": "./use-debounced-state/index.cjs",
|
|
138
138
|
"default": "./use-debounced-state/index.js"
|
|
139
139
|
},
|
|
140
|
+
"./use-debounced-value": {
|
|
141
|
+
"types": "./use-debounced-value/index.d.ts",
|
|
142
|
+
"import": {
|
|
143
|
+
"types": "./use-debounced-value/index.d.ts",
|
|
144
|
+
"default": "./use-debounced-value/index.mjs"
|
|
145
|
+
},
|
|
146
|
+
"require": "./use-debounced-value/index.cjs",
|
|
147
|
+
"default": "./use-debounced-value/index.js"
|
|
148
|
+
},
|
|
140
149
|
"./use-error-boundary": {
|
|
141
150
|
"types": "./use-error-boundary/index.d.ts",
|
|
142
151
|
"import": {
|
|
@@ -155,15 +164,6 @@
|
|
|
155
164
|
"require": "./use-intersection/index.cjs",
|
|
156
165
|
"default": "./use-intersection/index.js"
|
|
157
166
|
},
|
|
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-enable-concurrent-navigation": {
|
|
186
|
+
"types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
|
|
187
|
+
"import": {
|
|
188
|
+
"types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
|
|
189
|
+
"default": "./use-react-router-enable-concurrent-navigation/index.mjs"
|
|
190
|
+
},
|
|
191
|
+
"require": "./use-react-router-enable-concurrent-navigation/index.cjs",
|
|
192
|
+
"default": "./use-react-router-enable-concurrent-navigation/index.js"
|
|
193
|
+
},
|
|
185
194
|
"./use-react-router-is-match": {
|
|
186
195
|
"types": "./use-react-router-is-match/index.d.ts",
|
|
187
196
|
"import": {
|
package/sizes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"total":{"raw":
|
|
1
|
+
{"total":{"raw":8657,"gzip":5557,"br":0},"exports":{"create-context-state":{"raw":146,"gzip":116,"br":102},"context-state":{"raw":371,"gzip":240,"br":204},"typescript-happy-forward-ref":{"raw":118,"gzip":102,"br":87},"use":{"raw":279,"gzip":175,"br":151},"noop":{"raw":32,"gzip":52,"br":36},"request-idle-callback":{"raw":407,"gzip":231,"br":180},"use-debounced-state":{"raw":380,"gzip":275,"br":231},"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},"use-composition-input":{"raw":420,"gzip":262,"br":230},"use-map":{"raw":348,"gzip":243,"br":210},"use-isomorphic-layout-effect":{"raw":177,"gzip":143,"br":120},"use-retimer":{"raw":197,"gzip":165,"br":125},"use-set":{"raw":349,"gzip":242,"br":203},"use-react-router-is-match":{"raw":562,"gzip":369,"br":309},"use-debounced-value":{"raw":370,"gzip":263,"br":214},"use-uncontrolled":{"raw":304,"gzip":236,"br":201},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":461,"gzip":325,"br":256},"use-react-router-enable-concurrent-navigation":{"raw":950,"gzip":453,"br":373}}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";require("client-only");var r=require("react"),e=require("react-router-dom");const t=()=>{let{navigator:t}=r.useContext(e.UNSAFE_NavigationContext);if(!t)throw TypeError("[foxact] useReactRouterEnableConcurrentNavigation must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");r.useEffect(()=>{let e=t.go.bind(t),n=t.push.bind(t),o=t.replace.bind(t);return t.go=function(){for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];return r.startTransition(()=>e.apply(t,o))},t.push=function(){for(var e=arguments.length,o=Array(e),a=0;a<e;a++)o[a]=arguments[a];return r.startTransition(()=>n.apply(t,o))},t.replace=function(){for(var e=arguments.length,n=Array(e),a=0;a<e;a++)n[a]=arguments[a];return r.startTransition(()=>o.apply(t,n))},()=>{t.go=e,t.push=n,t.replace=o}},[t])};exports.ReactRouterConcurrentNavigationProvider=r=>{let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
/** @see https://foxact.skk.moe/use-react-router-enable-concurrent-navigation */
|
|
4
|
+
declare const useReactRouterEnableConcurrentNavigation: () => void;
|
|
5
|
+
declare const ReactRouterConcurrentNavigationProvider: ({ children }: React.PropsWithChildren) => react.ReactNode;
|
|
6
|
+
|
|
7
|
+
export { ReactRouterConcurrentNavigationProvider, useReactRouterEnableConcurrentNavigation };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";require("client-only");var r=require("react"),e=require("react-router-dom");const t=()=>{let{navigator:t}=r.useContext(e.UNSAFE_NavigationContext);if(!t)throw TypeError("[foxact] useReactRouterEnableConcurrentNavigation must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");r.useEffect(()=>{let e=t.go.bind(t),n=t.push.bind(t),o=t.replace.bind(t);return t.go=function(){for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];return r.startTransition(()=>e.apply(t,o))},t.push=function(){for(var e=arguments.length,o=Array(e),a=0;a<e;a++)o[a]=arguments[a];return r.startTransition(()=>n.apply(t,o))},t.replace=function(){for(var e=arguments.length,n=Array(e),a=0;a<e;a++)n[a]=arguments[a];return r.startTransition(()=>o.apply(t,n))},()=>{t.go=e,t.push=n,t.replace=o}},[t])};exports.ReactRouterConcurrentNavigationProvider=r=>{let{children:e}=r;return t(),e},exports.useReactRouterEnableConcurrentNavigation=t;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import"client-only";import{useContext as r,useEffect as e,startTransition as t}from"react";import{UNSAFE_NavigationContext as o}from"react-router-dom";let n=()=>{let{navigator:n}=r(o);if(!n)throw TypeError("[foxact] useReactRouterEnableConcurrentNavigation must be used under <RouterProvider /> or a Router component (e.g. <BrowserRouter />)");e(()=>{let r=n.go.bind(n),e=n.push.bind(n),o=n.replace.bind(n);return n.go=function(){for(var e=arguments.length,o=Array(e),a=0;a<e;a++)o[a]=arguments[a];return t(()=>r.apply(n,o))},n.push=function(){for(var r=arguments.length,o=Array(r),a=0;a<r;a++)o[a]=arguments[a];return t(()=>e.apply(n,o))},n.replace=function(){for(var r=arguments.length,e=Array(r),a=0;a<r;a++)e[a]=arguments[a];return t(()=>o.apply(n,e))},()=>{n.go=r,n.push=e,n.replace=o}},[n])},a=r=>{let{children:e}=r;return n(),e};export{a as ReactRouterConcurrentNavigationProvider,n as useReactRouterEnableConcurrentNavigation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),t=require("react-router-dom");exports.useReactRouterIsMatch=(r
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("react-router-dom");exports.useReactRouterIsMatch=function(r){let{relative:a,caseSensitive:o=!1,end:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{pathname:s}=t.useLocation(),{navigator:{encodeLocation:u}}=e.useContext(t.UNSAFE_NavigationContext),i=t.useResolvedPath(r,{relative:a});return e.useMemo(()=>{let e=s,t=u?u(i).pathname:i.pathname;return o||(e=e.toLowerCase(),t=t.toLowerCase()),e===t||!n&&e.startsWith(t)&&"/"===e.charAt(t.length)},[u,i,s,o,n])};
|
|
@@ -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 }
|
|
9
|
+
declare const useReactRouterIsMatch: (to: To, { relative, caseSensitive, end }?: UseReactRouterIsMatchOption) => boolean;
|
|
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=(r
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("react-router-dom");exports.useReactRouterIsMatch=function(r){let{relative:a,caseSensitive:o=!1,end:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{pathname:s}=t.useLocation(),{navigator:{encodeLocation:u}}=e.useContext(t.UNSAFE_NavigationContext),i=t.useResolvedPath(r,{relative:a});return e.useMemo(()=>{let e=s,t=u?u(i).pathname:i.pathname;return o||(e=e.toLowerCase(),t=t.toLowerCase()),e===t||!n&&e.startsWith(t)&&"/"===e.charAt(t.length)},[u,i,s,o,n])};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useContext as t,useMemo as e}from"react";import{useLocation as r,UNSAFE_NavigationContext as
|
|
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";let n=function(n){let{relative:m,caseSensitive:h=!1,end:i=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{pathname:c}=r(),{navigator:{encodeLocation:l}}=t(o),p=a(n,{relative:m});return e(()=>{let t=c,e=l?l(p).pathname:p.pathname;return h||(t=t.toLowerCase(),e=e.toLowerCase()),t===e||!i&&t.startsWith(e)&&"/"===t.charAt(e.length)},[l,p,c,h,i])};export{n as useReactRouterIsMatch};
|