foxact 0.2.44 → 0.2.46
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/compose-context-provider/index.d.ts +2 -1
- package/context-state/index.cjs +1 -1
- package/context-state/index.d.ts +6 -3
- package/context-state/index.mjs +1 -1
- package/create-context-state/index.d.ts +0 -2
- package/create-storage-hook/index.d.ts +2 -1
- package/create-storage-state-factory/index.d.ts +2 -1
- package/current-year/index.cjs +1 -1
- package/current-year/index.mjs +1 -1
- package/is-safari/index.cjs +1 -0
- package/is-safari/index.d.ts +3 -0
- package/is-safari/index.mjs +1 -0
- package/noop/index.d.ts +2 -1
- package/open-new-tab/index.cjs +1 -0
- package/open-new-tab/index.d.ts +3 -0
- package/open-new-tab/index.mjs +1 -0
- package/package.json +64 -68
- package/sizes.json +1 -1
- package/typescript-happy-forward-ref/index.d.ts +2 -1
- package/use/index.cjs +1 -1
- package/use/index.mjs +1 -1
- package/use-composition-input/index.d.ts +2 -1
- package/use-error-boundary/index.cjs +1 -1
- package/use-error-boundary/index.mjs +1 -1
- package/use-fast-click/index.d.ts +2 -1
- package/use-media-query/index.cjs +1 -1
- package/use-media-query/index.mjs +1 -1
- package/use-next-link/index.cjs +1 -1
- package/use-next-link/index.d.ts +2 -1
- package/use-next-link/index.mjs +1 -1
- package/use-singleton/index.d.ts +2 -1
- package/use-uncontrolled/index.d.ts +1 -1
- package/use-url-hash-state/index.cjs +1 -1
- package/use-url-hash-state/index.d.ts +2 -1
- package/use-url-hash-state/index.mjs +1 -1
|
@@ -7,4 +7,5 @@ interface ContextComposeProviderProps extends Foxact.PropsWithChildren {
|
|
|
7
7
|
/** @see https://foxact.skk.moe/compose-context-provider */
|
|
8
8
|
declare const ComposeContextProvider: react.MemoExoticComponent<({ contexts, children }: ContextComposeProviderProps) => react.ReactNode>;
|
|
9
9
|
|
|
10
|
-
export { ComposeContextProvider
|
|
10
|
+
export { ComposeContextProvider };
|
|
11
|
+
export type { ContextComposeProviderProps };
|
package/context-state/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime");require("client-only");var t=require("react"),r=require("../noop/index.cjs");exports.createContextState=function(n){const o
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime");require("client-only");var t=require("react"),r=require("../noop/index.cjs");exports.createContextState=function(n){const o=t.createContext(n),u=t.createContext(r.noop);return[r=>{let{children:c}=r;const[i,s]=t.useState(n);return e.jsx(o.Provider,{value:i,children:e.jsx(u.Provider,{value:s,children:c})})},()=>t.useContext(o),()=>t.useContext(u),o]};
|
package/context-state/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
1
|
import { Foxact } from '../types/index.js';
|
|
4
2
|
|
|
5
3
|
/** @see https://foxact.skk.moe/context-state */
|
|
6
|
-
declare function createContextState<T>(initialState: T):
|
|
4
|
+
declare function createContextState<T>(initialState: T): [
|
|
5
|
+
Provider: React.ComponentType<Foxact.PropsWithChildren>,
|
|
6
|
+
useValue: () => T,
|
|
7
|
+
useSetValue: () => React.Dispatch<React.SetStateAction<T>>,
|
|
8
|
+
StateContext: React.Context<T>
|
|
9
|
+
];
|
|
7
10
|
|
|
8
11
|
export { createContextState };
|
package/context-state/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import"client-only";import{
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import"client-only";import{useContext as t,createContext as e,useState as o}from"react";import{noop as n}from"../noop/index.mjs";function i(i){const c=e(i),m=e(n);return[t=>{let{children:e}=t;const[n,l]=o(i);return r(c.Provider,{value:n,children:r(m.Provider,{value:l,children:e})})},()=>t(c),()=>t(m),c]}export{i as createContextState};
|
|
@@ -26,4 +26,5 @@ declare function createStorage(type: StorageType): {
|
|
|
26
26
|
useSetStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export {
|
|
29
|
+
export { createStorage };
|
|
30
|
+
export type { Deserializer, NotUndefined, Serializer, StateHookTuple, StorageType, UseStorageParserOption, UseStorageRawOption };
|
|
@@ -8,4 +8,5 @@ declare function createStorageStateFactory(type: StorageType): {
|
|
|
8
8
|
<T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [StateHook<T | null>, ValueHook<T | null>, SetValueHook<T | null>];
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export {
|
|
11
|
+
export { createStorageStateFactory };
|
|
12
|
+
export type { SetValueHook, StateHook, ValueHook };
|
package/current-year/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");const n
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");const n=r.memo(n=>{let{defaultYear:i,...u}=n;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(i||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:s})});"production"!==process.env.NODE_ENV&&(n.displayName="CurrentYear"),exports.CurrentYear=n;
|
package/current-year/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";const o
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";const o=r(r=>{let{defaultYear:o,...i}=r;"undefined"==typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,s]=t(o||new Date().getFullYear());return n(()=>{s(new Date().getFullYear())},[]),e("span",{...i,children:a})});"production"!==process.env.NODE_ENV&&(o.displayName="CurrentYear");export{o as CurrentYear};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.isSafari=function(){return"undefined"!=typeof window&&"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&!!(/version\/[\d._].*?safari/i.test(navigator.userAgent)||/mobile safari [\d._]+/i.test(navigator.userAgent))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){return"undefined"!=typeof window&&"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&!!(/version\/[\d._].*?safari/i.test(navigator.userAgent)||/mobile safari [\d._]+/i.test(navigator.userAgent))}export{e as isSafari};
|
package/noop/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("../is-safari/index.cjs");exports.openInNewTab=function(n){if("undefined"==typeof window)return;if(e.isSafari())return void window.open(n,"_blank");const r=document.createElement("a");r.href=n,r.target="_blank",r.rel="noopener noreferrer",document.body.appendChild(r),r.click(),Promise.resolve().finally(()=>{r.remove()})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isSafari as e}from"../is-safari/index.mjs";function n(n){if("undefined"==typeof window)return;if(e())return void window.open(n,"_blank");const o=document.createElement("a");o.href=n,o.target="_blank",o.rel="noopener noreferrer",document.body.appendChild(o),o.click(),Promise.resolve().finally(()=>{o.remove()})}export{n as openInNewTab};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxact",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.46",
|
|
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,28 +32,6 @@
|
|
|
32
32
|
"optional": true
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
"packageManager": "pnpm@9.14.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
|
-
}
|
|
56
|
-
},
|
|
57
35
|
"typeVersions": {
|
|
58
36
|
">=4.8": {
|
|
59
37
|
"*": [
|
|
@@ -78,15 +56,6 @@
|
|
|
78
56
|
"require": "./compose-context-provider/index.cjs",
|
|
79
57
|
"default": "./compose-context-provider/index.cjs"
|
|
80
58
|
},
|
|
81
|
-
"./context-state": {
|
|
82
|
-
"types": "./context-state/index.d.ts",
|
|
83
|
-
"import": {
|
|
84
|
-
"types": "./context-state/index.d.ts",
|
|
85
|
-
"default": "./context-state/index.mjs"
|
|
86
|
-
},
|
|
87
|
-
"require": "./context-state/index.cjs",
|
|
88
|
-
"default": "./context-state/index.cjs"
|
|
89
|
-
},
|
|
90
59
|
"./create-context-state": {
|
|
91
60
|
"types": "./create-context-state/index.d.ts",
|
|
92
61
|
"import": {
|
|
@@ -105,6 +74,15 @@
|
|
|
105
74
|
"require": "./create-fixed-array/index.cjs",
|
|
106
75
|
"default": "./create-fixed-array/index.cjs"
|
|
107
76
|
},
|
|
77
|
+
"./create-local-storage-state": {
|
|
78
|
+
"types": "./create-local-storage-state/index.d.ts",
|
|
79
|
+
"import": {
|
|
80
|
+
"types": "./create-local-storage-state/index.d.ts",
|
|
81
|
+
"default": "./create-local-storage-state/index.mjs"
|
|
82
|
+
},
|
|
83
|
+
"require": "./create-local-storage-state/index.cjs",
|
|
84
|
+
"default": "./create-local-storage-state/index.cjs"
|
|
85
|
+
},
|
|
108
86
|
"./create-session-storage-state": {
|
|
109
87
|
"types": "./create-session-storage-state/index.d.ts",
|
|
110
88
|
"import": {
|
|
@@ -123,14 +101,14 @@
|
|
|
123
101
|
"require": "./create-storage-hook/index.cjs",
|
|
124
102
|
"default": "./create-storage-hook/index.cjs"
|
|
125
103
|
},
|
|
126
|
-
"./
|
|
127
|
-
"types": "./
|
|
104
|
+
"./context-state": {
|
|
105
|
+
"types": "./context-state/index.d.ts",
|
|
128
106
|
"import": {
|
|
129
|
-
"types": "./
|
|
130
|
-
"default": "./
|
|
107
|
+
"types": "./context-state/index.d.ts",
|
|
108
|
+
"default": "./context-state/index.mjs"
|
|
131
109
|
},
|
|
132
|
-
"require": "./
|
|
133
|
-
"default": "./
|
|
110
|
+
"require": "./context-state/index.cjs",
|
|
111
|
+
"default": "./context-state/index.cjs"
|
|
134
112
|
},
|
|
135
113
|
"./create-storage-state-factory": {
|
|
136
114
|
"types": "./create-storage-state-factory/index.d.ts",
|
|
@@ -141,6 +119,15 @@
|
|
|
141
119
|
"require": "./create-storage-state-factory/index.cjs",
|
|
142
120
|
"default": "./create-storage-state-factory/index.cjs"
|
|
143
121
|
},
|
|
122
|
+
"./email-protection": {
|
|
123
|
+
"types": "./email-protection/index.d.ts",
|
|
124
|
+
"import": {
|
|
125
|
+
"types": "./email-protection/index.d.ts",
|
|
126
|
+
"default": "./email-protection/index.mjs"
|
|
127
|
+
},
|
|
128
|
+
"require": "./email-protection/index.cjs",
|
|
129
|
+
"default": "./email-protection/index.cjs"
|
|
130
|
+
},
|
|
144
131
|
"./current-year": {
|
|
145
132
|
"types": "./current-year/index.d.ts",
|
|
146
133
|
"import": {
|
|
@@ -150,14 +137,14 @@
|
|
|
150
137
|
"require": "./current-year/index.cjs",
|
|
151
138
|
"default": "./current-year/index.cjs"
|
|
152
139
|
},
|
|
153
|
-
"./
|
|
154
|
-
"types": "./
|
|
140
|
+
"./fetch-jsonp": {
|
|
141
|
+
"types": "./fetch-jsonp/index.d.ts",
|
|
155
142
|
"import": {
|
|
156
|
-
"types": "./
|
|
157
|
-
"default": "./
|
|
143
|
+
"types": "./fetch-jsonp/index.d.ts",
|
|
144
|
+
"default": "./fetch-jsonp/index.mjs"
|
|
158
145
|
},
|
|
159
|
-
"require": "./
|
|
160
|
-
"default": "./
|
|
146
|
+
"require": "./fetch-jsonp/index.cjs",
|
|
147
|
+
"default": "./fetch-jsonp/index.cjs"
|
|
161
148
|
},
|
|
162
149
|
"./invariant": {
|
|
163
150
|
"types": "./invariant/index.d.ts",
|
|
@@ -168,6 +155,15 @@
|
|
|
168
155
|
"require": "./invariant/index.cjs",
|
|
169
156
|
"default": "./invariant/index.cjs"
|
|
170
157
|
},
|
|
158
|
+
"./is-safari": {
|
|
159
|
+
"types": "./is-safari/index.d.ts",
|
|
160
|
+
"import": {
|
|
161
|
+
"types": "./is-safari/index.d.ts",
|
|
162
|
+
"default": "./is-safari/index.mjs"
|
|
163
|
+
},
|
|
164
|
+
"require": "./is-safari/index.cjs",
|
|
165
|
+
"default": "./is-safari/index.cjs"
|
|
166
|
+
},
|
|
171
167
|
"./no-ssr": {
|
|
172
168
|
"types": "./no-ssr/index.d.ts",
|
|
173
169
|
"import": {
|
|
@@ -195,14 +191,14 @@
|
|
|
195
191
|
"require": "./nullthrow/index.cjs",
|
|
196
192
|
"default": "./nullthrow/index.cjs"
|
|
197
193
|
},
|
|
198
|
-
"./
|
|
199
|
-
"types": "./
|
|
194
|
+
"./open-new-tab": {
|
|
195
|
+
"types": "./open-new-tab/index.d.ts",
|
|
200
196
|
"import": {
|
|
201
|
-
"types": "./
|
|
202
|
-
"default": "./
|
|
197
|
+
"types": "./open-new-tab/index.d.ts",
|
|
198
|
+
"default": "./open-new-tab/index.mjs"
|
|
203
199
|
},
|
|
204
|
-
"require": "./
|
|
205
|
-
"default": "./
|
|
200
|
+
"require": "./open-new-tab/index.cjs",
|
|
201
|
+
"default": "./open-new-tab/index.cjs"
|
|
206
202
|
},
|
|
207
203
|
"./rem": {
|
|
208
204
|
"types": "./rem/index.d.ts",
|
|
@@ -294,6 +290,15 @@
|
|
|
294
290
|
"require": "./use-composition-input/index.cjs",
|
|
295
291
|
"default": "./use-composition-input/index.cjs"
|
|
296
292
|
},
|
|
293
|
+
"./use-debounced-state": {
|
|
294
|
+
"types": "./use-debounced-state/index.d.ts",
|
|
295
|
+
"import": {
|
|
296
|
+
"types": "./use-debounced-state/index.d.ts",
|
|
297
|
+
"default": "./use-debounced-state/index.mjs"
|
|
298
|
+
},
|
|
299
|
+
"require": "./use-debounced-state/index.cjs",
|
|
300
|
+
"default": "./use-debounced-state/index.cjs"
|
|
301
|
+
},
|
|
297
302
|
"./use-debounced-value": {
|
|
298
303
|
"types": "./use-debounced-value/index.d.ts",
|
|
299
304
|
"import": {
|
|
@@ -321,15 +326,6 @@
|
|
|
321
326
|
"require": "./use-fast-click/index.cjs",
|
|
322
327
|
"default": "./use-fast-click/index.cjs"
|
|
323
328
|
},
|
|
324
|
-
"./use-debounced-state": {
|
|
325
|
-
"types": "./use-debounced-state/index.d.ts",
|
|
326
|
-
"import": {
|
|
327
|
-
"types": "./use-debounced-state/index.d.ts",
|
|
328
|
-
"default": "./use-debounced-state/index.mjs"
|
|
329
|
-
},
|
|
330
|
-
"require": "./use-debounced-state/index.cjs",
|
|
331
|
-
"default": "./use-debounced-state/index.cjs"
|
|
332
|
-
},
|
|
333
329
|
"./use-intersection": {
|
|
334
330
|
"types": "./use-intersection/index.d.ts",
|
|
335
331
|
"import": {
|
|
@@ -375,15 +371,6 @@
|
|
|
375
371
|
"require": "./use-local-storage/index.cjs",
|
|
376
372
|
"default": "./use-local-storage/index.cjs"
|
|
377
373
|
},
|
|
378
|
-
"./use-media-query": {
|
|
379
|
-
"types": "./use-media-query/index.d.ts",
|
|
380
|
-
"import": {
|
|
381
|
-
"types": "./use-media-query/index.d.ts",
|
|
382
|
-
"default": "./use-media-query/index.mjs"
|
|
383
|
-
},
|
|
384
|
-
"require": "./use-media-query/index.cjs",
|
|
385
|
-
"default": "./use-media-query/index.cjs"
|
|
386
|
-
},
|
|
387
374
|
"./use-map": {
|
|
388
375
|
"types": "./use-map/index.d.ts",
|
|
389
376
|
"import": {
|
|
@@ -393,6 +380,15 @@
|
|
|
393
380
|
"require": "./use-map/index.cjs",
|
|
394
381
|
"default": "./use-map/index.cjs"
|
|
395
382
|
},
|
|
383
|
+
"./use-media-query": {
|
|
384
|
+
"types": "./use-media-query/index.d.ts",
|
|
385
|
+
"import": {
|
|
386
|
+
"types": "./use-media-query/index.d.ts",
|
|
387
|
+
"default": "./use-media-query/index.mjs"
|
|
388
|
+
},
|
|
389
|
+
"require": "./use-media-query/index.cjs",
|
|
390
|
+
"default": "./use-media-query/index.cjs"
|
|
391
|
+
},
|
|
396
392
|
"./use-next-link": {
|
|
397
393
|
"types": "./use-next-link/index.d.ts",
|
|
398
394
|
"import": {
|
package/sizes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"total":{"raw":
|
|
1
|
+
{"total":{"raw":23599,"gzip":14509,"br":0},"exports":{"compose-context-provider":{"raw":177,"gzip":155,"br":122},"create-context-state":{"raw":145,"gzip":116,"br":96},"create-fixed-array":{"raw":452,"gzip":282,"br":248},"create-session-storage-state":{"raw":332,"gzip":182,"br":152},"context-state":{"raw":377,"gzip":241,"br":207},"email-protection":{"raw":426,"gzip":321,"br":272},"create-storage-state-factory":{"raw":519,"gzip":309,"br":263},"create-local-storage-state":{"raw":328,"gzip":183,"br":154},"invariant":{"raw":178,"gzip":156,"br":118},"is-safari":{"raw":248,"gzip":164,"br":117},"current-year":{"raw":592,"gzip":400,"br":326},"noop":{"raw":33,"gzip":53,"br":37},"create-storage-hook":{"raw":2073,"gzip":880,"br":764},"nullthrow":{"raw":187,"gzip":163,"br":121},"no-ssr":{"raw":474,"gzip":316,"br":260},"fetch-jsonp":{"raw":875,"gzip":533,"br":418},"types":{"raw":0,"gzip":20,"br":1},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"open-new-tab":{"raw":344,"gzip":260,"br":190},"rem":{"raw":823,"gzip":395,"br":350},"use":{"raw":283,"gzip":185,"br":154},"use-abortable-effect":{"raw":215,"gzip":170,"br":144},"use-array":{"raw":322,"gzip":236,"br":202},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154},"use-clipboard":{"raw":1177,"gzip":651,"br":552},"use-debounced-value":{"raw":524,"gzip":342,"br":286},"use-error-boundary":{"raw":252,"gzip":195,"br":165},"use-fast-click":{"raw":553,"gzip":364,"br":297},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-is-client":{"raw":150,"gzip":145,"br":115},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":112},"use-is-online":{"raw":356,"gzip":212,"br":158},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-composition-input":{"raw":470,"gzip":286,"br":241},"use-media-query":{"raw":725,"gzip":406,"br":332},"use-map":{"raw":339,"gzip":243,"br":208},"use-next-link":{"raw":1673,"gzip":871,"br":744},"use-page-visibility":{"raw":290,"gzip":206,"br":154},"use-retimer":{"raw":199,"gzip":166,"br":127},"use-react-router-is-match":{"raw":563,"gzip":372,"br":314},"use-session-storage":{"raw":316,"gzip":181,"br":152},"use-next-pathname":{"raw":314,"gzip":235,"br":203},"use-set":{"raw":340,"gzip":238,"br":203},"use-singleton":{"raw":139,"gzip":130,"br":104},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":249},"use-react-router-enable-concurrent-navigation":{"raw":966,"gzip":470,"br":397},"use-uncontrolled":{"raw":352,"gzip":258,"br":216},"use-url-hash-state":{"raw":1068,"gzip":616,"br":539}}}
|
|
@@ -6,4 +6,5 @@ declare const typeScriptHappyForwardRef: TypeScriptHappyForwardRef;
|
|
|
6
6
|
/** @see https://foxact.skk.moe/typescript-happy-forward-ref */
|
|
7
7
|
declare const typescriptHappyForwardRef: TypeScriptHappyForwardRef;
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { typeScriptHappyForwardRef, typescriptHappyForwardRef };
|
|
10
|
+
export type { TypeScriptHappyForwardRef };
|
package/use/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react").use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.
|
|
1
|
+
"use strict";const e=require("react").use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.catch(t=>{e.status="rejected",e.reason=t}).then(t=>{e.status="fulfilled",e.value=t}),e}});exports.use=e;
|
package/use/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";const t=e.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.
|
|
1
|
+
import e from"react";const t=e.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.catch(t=>{e.status="rejected",e.reason=t}).then(t=>{e.status="fulfilled",e.value=t}),e}});export{t as use};
|
|
@@ -8,4 +8,5 @@ interface UseCompositionInputReturn<T extends HTMLInputElement | HTMLTextAreaEle
|
|
|
8
8
|
/** @see https://foxact.skk.moe/use-composition-input */
|
|
9
9
|
declare function useCompositionInput<T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement>(cb: UseCompositionInputCallback): UseCompositionInputReturn<T>;
|
|
10
10
|
|
|
11
|
-
export {
|
|
11
|
+
export { useCompositionInput };
|
|
12
|
+
export type { UseCompositionInputCallback, UseCompositionInputReturn, UseCompositionInputReturnKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var r=require("react");function t(r){return!
|
|
1
|
+
"use strict";require("client-only");var r=require("react");function t(r){return!1!==r&&null!=r}exports.useErrorBoundary=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const[n,u]=r.useState(!1);if(t(e))throw e;if(t(n))throw n;return u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as r}from"react";function t(r){return!
|
|
1
|
+
import"client-only";import{useState as r}from"react";function t(r){return!1!==r&&null!=r}function o(){let o=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const[n,e]=r(!1);if(t(o))throw o;if(t(n))throw n;return e}export{o as useErrorBoundary};
|
|
@@ -2,4 +2,5 @@ type FastClickReturn<T extends HTMLDivElement | HTMLButtonElement> = Pick<React.
|
|
|
2
2
|
/** @see https://foxact.skk.moe/use-fast-click */
|
|
3
3
|
declare function useFastClick<T extends HTMLDivElement | HTMLButtonElement>(callback: React.MouseEventHandler<T>): FastClickReturn<T>;
|
|
4
4
|
|
|
5
|
-
export {
|
|
5
|
+
export { useFastClick };
|
|
6
|
+
export type { FastClickReturn };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var e=require("../no-ssr/index.cjs"),n=require("../noop/index.cjs"),t=require("react");const r=new Map;function o(){throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")}exports.useMediaQuery=function(e,i){"undefined"==typeof window||r.has(e)||r.set(e,window.matchMedia(e).matches);const a=t.useCallback(t=>(function(e,t){if("undefined"==typeof window)return n.noop;const o=window.matchMedia(e),i=()=>{r.set(e,o.matches),t()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}})(e,t),[e]);return t.useSyncExternalStore(a,()=>{var n;return"undefined"!=typeof window&&(null
|
|
2
|
+
"use strict";var e=require("../no-ssr/index.cjs"),n=require("../noop/index.cjs"),t=require("react");const r=new Map;function o(){throw e.noSSRError("useMediaQuery cannot be used on the server without a serverValue")}exports.useMediaQuery=function(e,i){"undefined"==typeof window||r.has(e)||r.set(e,window.matchMedia(e).matches);const a=t.useCallback(t=>(function(e,t){if("undefined"==typeof window)return n.noop;const o=window.matchMedia(e),i=()=>{r.set(e,o.matches),t()};return o.addEventListener("change",i),()=>{o.removeEventListener("change",i)}})(e,t),[e]);return t.useSyncExternalStore(a,()=>{var n;return"undefined"!=typeof window&&(null!=(n=r.get(e))?n:window.matchMedia(e).matches)},void 0===i?o:()=>i)};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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
|
|
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;function i(){throw e("useMediaQuery cannot be used on the server without a serverValue")}function d(e,d){return"undefined"==typeof window||r.has(e)||r.set(e,window.matchMedia(e).matches),o(t(t=>(function(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)}})(e,t),[e]),()=>{var n;return"undefined"!=typeof window&&(null!=(n=r.get(e))?n:window.matchMedia(e).matches)},void 0===d?i:()=>d)}export{d 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"),n=require("next/dist/shared/lib/router/utils/format-url"),r=require("../use-intersection/index.cjs"),o=require("../use-component-will-receive-update/index.cjs");function u(e,t,n){"undefined"!=typeof window&&Promise.resolve(e.prefetch(t,n)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})}require("../request-idle-callback/index.cjs"),exports.unstable_useNextLink=function(i,s){let{prefetch:c,ref:l,onClick:a,onMouseEnter:f,onTouchStart:p,scroll:d=!0,replace:v=!1,...E}=s;process.env.NODE_ENV;const y=null==c?"auto":"full",N=!1!==c,h=t.useRouter(),[k,m]=e.useTransition(),[b,q,x]=r.useIntersection(e.useMemo(()=>({rootMargin:"200px"}),[])),g=e.useMemo(()=>"string"==typeof i?i:n.formatUrl(i),[i]);return o.useComponentWillReceiveUpdate(x,[g]),e.useEffect(()=>{"production"===process.env.NODE_ENV&&q&&N&&u(h,g,{kind:y})},[y,q,N,g,h]),[k,{ref:e.useCallback(e=>{b(e),"function"==typeof l?l(e):l&&e&&(l.current=e)},[l,b]),onClick:e.useCallback(e=>{if("function"==typeof a&&a(e),e.defaultPrevented)return;const{nodeName:t}=e.currentTarget
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("next/navigation"),n=require("next/dist/shared/lib/router/utils/format-url"),r=require("../use-intersection/index.cjs"),o=require("../use-component-will-receive-update/index.cjs");function u(e,t,n){"undefined"!=typeof window&&Promise.resolve(e.prefetch(t,n)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})}require("../request-idle-callback/index.cjs"),exports.unstable_useNextLink=function(i,s){let{prefetch:c,ref:l,onClick:a,onMouseEnter:f,onTouchStart:p,scroll:d=!0,replace:v=!1,...E}=s;process.env.NODE_ENV;const y=null==c?"auto":"full",N=!1!==c,h=t.useRouter(),[k,m]=e.useTransition(),[b,q,x]=r.useIntersection(e.useMemo(()=>({rootMargin:"200px"}),[])),g=e.useMemo(()=>"string"==typeof i?i:n.formatUrl(i),[i]);return o.useComponentWillReceiveUpdate(x,[g]),e.useEffect(()=>{"production"===process.env.NODE_ENV&&q&&N&&u(h,g,{kind:y})},[y,q,N,g,h]),[k,{ref:e.useCallback(e=>{b(e),"function"==typeof l?l(e):l&&e&&(l.current=e)},[l,b]),onClick:e.useCallback(e=>{if("function"==typeof a&&a(e),e.defaultPrevented)return;const{nodeName:t}=e.currentTarget;"A"===t.toUpperCase()&&function(e){const t=e.currentTarget,n=t.getAttribute("target");return n&&"_self"!==n||t.download||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||(e.preventDefault(),m(()=>{h[v?"replace":"push"](g,{scroll:d})}))},[a,v,g,h,d]),onMouseEnter:e.useCallback(e=>{"function"==typeof f&&f(e),"development"!==process.env.NODE_ENV&&N&&u(h,g,{kind:y})},[y,f,N,g,h]),onTouchStart:e.useCallback(e=>{"function"==typeof p&&p(e),"development"!==process.env.NODE_ENV&&N&&u(h,g,{kind:y})},[y,p,N,g,h]),...E}]};
|
package/use-next-link/index.d.ts
CHANGED
|
@@ -27,4 +27,5 @@ interface UseNextLinkReturnProps extends Partial<React.JSX.IntrinsicElements['a'
|
|
|
27
27
|
declare function useNextLink(hrefProp: string | UrlObject, { prefetch: prefetchProp, ref, onClick, onMouseEnter, onTouchStart, scroll: routerScroll, replace, ...restProps }: UseNextLinkOptions): [isPending: boolean, linkProps: UseNextLinkReturnProps];
|
|
28
28
|
declare const unstable_useNextLink: typeof useNextLink;
|
|
29
29
|
|
|
30
|
-
export {
|
|
30
|
+
export { unstable_useNextLink };
|
|
31
|
+
export type { UseNextLinkOptions, UseNextLinkReturnProps };
|
package/use-next-link/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useTransition as e,useMemo as t,useEffect as n,useCallback as o}from"react";import{useRouter as r}from"next/navigation";import{formatUrl as i}from"next/dist/shared/lib/router/utils/format-url";import{useIntersection as c}from"../use-intersection/index.mjs";import{useComponentWillReceiveUpdate as s}from"../use-component-will-receive-update/index.mjs";import"../request-idle-callback/index.mjs";function u(e,t,n){"undefined"!=typeof window&&Promise.resolve(e.prefetch(t,n)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})}const p=function(p,l){let{prefetch:f,ref:a,onClick:d,onMouseEnter:m,onTouchStart:v,scroll:E=!0,replace:y=!1,...N}=l;process.env.NODE_ENV;const h=null==f?"auto":"full",x=!1!==f,g=r(),[_,k]=e(),[w,D,O]=c(t(()=>({rootMargin:"200px"}),[])),V=t(()=>"string"==typeof p?p:i(p),[p]);return s(O,[V]),n(()=>{"production"===process.env.NODE_ENV&&D&&x&&u(g,V,{kind:h})},[h,D,x,V,g]),[_,{ref:o(e=>{w(e),"function"==typeof a?a(e):a&&e&&(a.current=e)},[a,w]),onClick:o(e=>{if("function"==typeof d&&d(e),e.defaultPrevented)return;const{nodeName:t}=e.currentTarget
|
|
1
|
+
import"client-only";import{useTransition as e,useMemo as t,useEffect as n,useCallback as o}from"react";import{useRouter as r}from"next/navigation";import{formatUrl as i}from"next/dist/shared/lib/router/utils/format-url";import{useIntersection as c}from"../use-intersection/index.mjs";import{useComponentWillReceiveUpdate as s}from"../use-component-will-receive-update/index.mjs";import"../request-idle-callback/index.mjs";function u(e,t,n){"undefined"!=typeof window&&Promise.resolve(e.prefetch(t,n)).catch(e=>{if("production"!==process.env.NODE_ENV)throw e})}const p=function(p,l){let{prefetch:f,ref:a,onClick:d,onMouseEnter:m,onTouchStart:v,scroll:E=!0,replace:y=!1,...N}=l;process.env.NODE_ENV;const h=null==f?"auto":"full",x=!1!==f,g=r(),[_,k]=e(),[w,D,O]=c(t(()=>({rootMargin:"200px"}),[])),V=t(()=>"string"==typeof p?p:i(p),[p]);return s(O,[V]),n(()=>{"production"===process.env.NODE_ENV&&D&&x&&u(g,V,{kind:h})},[h,D,x,V,g]),[_,{ref:o(e=>{w(e),"function"==typeof a?a(e):a&&e&&(a.current=e)},[a,w]),onClick:o(e=>{if("function"==typeof d&&d(e),e.defaultPrevented)return;const{nodeName:t}=e.currentTarget;"A"===t.toUpperCase()&&function(e){const t=e.currentTarget,n=t.getAttribute("target");return n&&"_self"!==n||t.download||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||(e.preventDefault(),k(()=>{g[y?"replace":"push"](V,{scroll:E})}))},[d,y,V,g,E]),onMouseEnter:o(e=>{"function"==typeof m&&m(e),"development"!==process.env.NODE_ENV&&x&&u(g,V,{kind:h})},[h,m,x,V,g]),onTouchStart:o(e=>{"function"==typeof v&&v(e),"development"!==process.env.NODE_ENV&&x&&u(g,V,{kind:h})},[h,v,x,V,g]),...N}]};export{p as unstable_useNextLink};
|
package/use-singleton/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ interface SingletonRefObject<T> {
|
|
|
4
4
|
/** @see https://foxact.skk.moe/use-singleton */
|
|
5
5
|
declare function useSingleton<T>(initializor: () => T): SingletonRefObject<T>;
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { useSingleton };
|
|
8
|
+
export type { SingletonRefObject };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
/** @see https://foxact.skk.moe/use-uncontrolled */
|
|
4
|
-
declare function useUncontrolled<T, E extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement = HTMLInputElement>(initialValue: T, transformValue?: (value: T) => T): readonly [T, () => void, react.RefObject<E>];
|
|
4
|
+
declare function useUncontrolled<T, E extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement = HTMLInputElement>(initialValue: T, transformValue?: (value: T) => T): readonly [T, () => void, react.RefObject<E | null>];
|
|
5
5
|
|
|
6
6
|
export { useUncontrolled };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),n=require("../noop/index.cjs"),r=require("../no-ssr/index.cjs");const t=e=>e,a=(()=>{if("undefined"==typeof window)return e=>n.noop;let e=!1;const r=new Set,t=()=>{r.forEach(e=>e())};return n=>(r.add(n),e||(e=!0,window.addEventListener("hashchange",t)),()=>{r.delete(n)})})(),
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),n=require("../noop/index.cjs"),r=require("../no-ssr/index.cjs");const t=e=>e,a=(()=>{if("undefined"==typeof window)return e=>n.noop;let e=!1;const r=new Set,t=()=>{r.forEach(e=>e())};return n=>(r.add(n),e||(e=!0,window.addEventListener("hashchange",t)),()=>{r.delete(n)})})(),l=e=>"function"==typeof e;function o(){throw r.noSSRError("useUrlHashState cannot be used on the server without a serverValue")}exports.unstable_useUrlHashState=function(n,r){var s;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:t,deserializer:t};const u=i.raw?t:i.serializer,c=i.raw?t:i.deserializer,h=void 0===r?o:()=>u(r),d=e.useSyncExternalStore(a,()=>new URLSearchParams(location.hash.slice(1)).get(n),h),w=e.useMemo(()=>null===d?null!=r?r:null:c(d),[r,c,d]),S=e.useCallback(e=>{const t=location.hash,a=new URLSearchParams(t.slice(1)),o=l(e)?e(w):e;o===r||null===o?a.delete(n):a.set(n,u(o));const s=a.toString();t!==s&&(location.hash=s)},[r,w,n,u]);return[null!=(s=null!=w?w:r)?s:null,S]};
|
|
@@ -12,4 +12,5 @@ interface UseUrlHashStateParserOption<T> {
|
|
|
12
12
|
/** @see https://foxact.skk.moe/use-url-hash-state */
|
|
13
13
|
declare function useUrlHashState<T>(key: string, defaultValue?: NotUndefined<T>, options?: UseUrlHashStateRawOption | UseUrlHashStateParserOption<T>): readonly [NonNullable<T> | null, (v: React.SetStateAction<T | null>) => void];
|
|
14
14
|
|
|
15
|
-
export {
|
|
15
|
+
export { useUrlHashState as unstable_useUrlHashState };
|
|
16
|
+
export type { Deserializer, Serializer, UseUrlHashStateParserOption, UseUrlHashStateRawOption };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useSyncExternalStore as e,useMemo as t,useCallback as n}from"react";import{noop as r}from"../noop/index.mjs";import{noSSRError as o}from"../no-ssr/index.mjs";const a=e=>e,l=(()=>{if("undefined"==typeof window)return e=>r;let e=!1;const t=new Set,n=()=>{t.forEach(e=>e())};return r=>(t.add(r),e||(e=!0,window.addEventListener("hashchange",n)),()=>{t.delete(r)})})(),s=e=>"function"==typeof e;function i(){throw o("useUrlHashState cannot be used on the server without a serverValue")}function u(r,o){var u;let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:a,deserializer:a};const h=c.raw?a:c.serializer,d=c.raw?a:c.deserializer,w=e(l,()=>new URLSearchParams(location.hash.slice(1)).get(r),void 0===o?i:()=>h(o)),f=t(()=>null===w?null!=o?o:null:d(w),[o,d,w]),m=n(e=>{const t=location.hash,n=new URLSearchParams(t.slice(1)),a=s(e)?e(f):e;a===o||null===a?n.delete(r):n.set(r,h(a));const l=n.toString();t!==l&&(location.hash=l)},[o,f,r,h]);return[null
|
|
1
|
+
import"client-only";import{useSyncExternalStore as e,useMemo as t,useCallback as n}from"react";import{noop as r}from"../noop/index.mjs";import{noSSRError as o}from"../no-ssr/index.mjs";const a=e=>e,l=(()=>{if("undefined"==typeof window)return e=>r;let e=!1;const t=new Set,n=()=>{t.forEach(e=>e())};return r=>(t.add(r),e||(e=!0,window.addEventListener("hashchange",n)),()=>{t.delete(r)})})(),s=e=>"function"==typeof e;function i(){throw o("useUrlHashState cannot be used on the server without a serverValue")}function u(r,o){var u;let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{raw:!1,serializer:a,deserializer:a};const h=c.raw?a:c.serializer,d=c.raw?a:c.deserializer,w=e(l,()=>new URLSearchParams(location.hash.slice(1)).get(r),void 0===o?i:()=>h(o)),f=t(()=>null===w?null!=o?o:null:d(w),[o,d,w]),m=n(e=>{const t=location.hash,n=new URLSearchParams(t.slice(1)),a=s(e)?e(f):e;a===o||null===a?n.delete(r):n.set(r,h(a));const l=n.toString();t!==l&&(location.hash=l)},[o,f,r,h]);return[null!=(u=null!=f?f:o)?u:null,m]}export{u as unstable_useUrlHashState};
|