foxact 0.3.4 → 0.3.5
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 +3 -3
- package/current-year/index.cjs +1 -1
- package/current-year/index.d.ts +1 -2
- package/current-year/index.mjs +1 -1
- package/email-protection/index.cjs +1 -1
- package/email-protection/index.mjs +1 -1
- package/package.json +115 -115
- package/sizes.json +1 -1
- package/use-array/index.cjs +1 -1
- package/use-array/index.mjs +1 -1
- package/use-debounced-value/index.cjs +1 -1
- package/use-debounced-value/index.mjs +1 -1
- package/use-intersection/index.cjs +1 -1
- package/use-intersection/index.mjs +1 -1
- package/use-map/index.cjs +1 -1
- package/use-map/index.mjs +1 -1
- package/use-retimer/index.cjs +1 -1
- package/use-retimer/index.mjs +1 -1
- package/use-set/index.cjs +1 -1
- package/use-set/index.mjs +1 -1
- package/use-state-with-deps/index.cjs +1 -1
- package/use-state-with-deps/index.d.ts +3 -5
- package/use-state-with-deps/index.mjs +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { Foxact } from '../types/index.js';
|
|
3
2
|
|
|
4
|
-
interface ContextComposeProviderProps extends
|
|
5
|
-
|
|
3
|
+
interface ContextComposeProviderProps extends React.PropsWithChildren {
|
|
4
|
+
/** Only elements that accept a `children` prop (e.g. context providers) can be composed */
|
|
5
|
+
contexts: Array<React.ReactElement<React.PropsWithChildren>>;
|
|
6
6
|
}
|
|
7
7
|
/** @see https://foxact.skk.moe/compose-context-provider */
|
|
8
8
|
declare const ComposeContextProvider: react.MemoExoticComponent<({ contexts, children }: ContextComposeProviderProps) => react.ReactNode>;
|
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=r.memo(function(n){let{defaultYear:u,...i}=n;"u"<typeof window&&void 0===u&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[o,s]=r.useState(u||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{s(new Date().getFullYear())},[]),e.jsx("span",{...i,children:o})});exports.CurrentYear=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(function(n){let{defaultYear:u,...i}=n;"u"<typeof window&&void 0===u&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[o,s]=r.useState(()=>u||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{s(new Date().getFullYear())},[]),e.jsx("span",{...i,children:o})});exports.CurrentYear=n;
|
package/current-year/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
|
|
4
3
|
interface CurrentYearProps extends React.ComponentProps<'span'> {
|
|
5
4
|
defaultYear?: number;
|
|
6
5
|
}
|
|
7
6
|
/** @see https://foxact.skk.moe/current-year */
|
|
8
|
-
declare const CurrentYear: react.MemoExoticComponent<({ defaultYear, ...restProps }: CurrentYearProps) =>
|
|
7
|
+
declare const CurrentYear: react.MemoExoticComponent<({ defaultYear, ...restProps }: CurrentYearProps) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { CurrentYear };
|
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=r(function(r){let{defaultYear:o,...i}=r;"u"<typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,u]=t(o||new Date().getFullYear());return n(()=>{u(new Date().getFullYear())},[]),e("span",{...i,children:a})});export{o as CurrentYear};
|
|
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(function(r){let{defaultYear:o,...i}=r;"u"<typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,u]=t(()=>o||new Date().getFullYear());return n(()=>{u(new Date().getFullYear())},[]),e("span",{...i,children:a})});export{o as CurrentYear};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var e=require("react"),t=require("../
|
|
2
|
+
"use strict";var e=require("react"),t=require("../noop/index.cjs");const o=e.memo(o=>{let{mailbox:r,domain:n}=o;const[a]=e.useState(()=>Math.random().toString(36).slice(2)+"[at]"+n.replace(/\./g,"[dot]"));return e.useSyncExternalStore(t.noop,()=>r+"@"+n,()=>a)});"production"!==process.env.NODE_ENV&&(o.displayName="EmailProtection"),exports.EmailProtection=o;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{memo as o,useState as t}from"react";import{
|
|
2
|
+
import{memo as o,useState as t,useSyncExternalStore as r}from"react";import{noop as e}from"../noop/index.mjs";const i=o(o=>{let{mailbox:i,domain:n}=o;const[a]=t(()=>Math.random().toString(36).slice(2)+"[at]"+n.replace(/\./g,"[dot]"));return r(e,()=>i+"@"+n,()=>a)});"production"!==process.env.NODE_ENV&&(i.displayName="EmailProtection");export{i as EmailProtection};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxact",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
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": {
|
|
@@ -124,33 +124,6 @@
|
|
|
124
124
|
"require": "./create-magic-portal/index.cjs",
|
|
125
125
|
"default": "./create-magic-portal/index.cjs"
|
|
126
126
|
},
|
|
127
|
-
"./create-stackless-error": {
|
|
128
|
-
"types": "./create-stackless-error/index.d.ts",
|
|
129
|
-
"import": {
|
|
130
|
-
"types": "./create-stackless-error/index.d.ts",
|
|
131
|
-
"default": "./create-stackless-error/index.mjs"
|
|
132
|
-
},
|
|
133
|
-
"require": "./create-stackless-error/index.cjs",
|
|
134
|
-
"default": "./create-stackless-error/index.cjs"
|
|
135
|
-
},
|
|
136
|
-
"./create-storage-hook": {
|
|
137
|
-
"types": "./create-storage-hook/index.d.ts",
|
|
138
|
-
"import": {
|
|
139
|
-
"types": "./create-storage-hook/index.d.ts",
|
|
140
|
-
"default": "./create-storage-hook/index.mjs"
|
|
141
|
-
},
|
|
142
|
-
"require": "./create-storage-hook/index.cjs",
|
|
143
|
-
"default": "./create-storage-hook/index.cjs"
|
|
144
|
-
},
|
|
145
|
-
"./create-session-storage-state": {
|
|
146
|
-
"types": "./create-session-storage-state/index.d.ts",
|
|
147
|
-
"import": {
|
|
148
|
-
"types": "./create-session-storage-state/index.d.ts",
|
|
149
|
-
"default": "./create-session-storage-state/index.mjs"
|
|
150
|
-
},
|
|
151
|
-
"require": "./create-session-storage-state/index.cjs",
|
|
152
|
-
"default": "./create-session-storage-state/index.cjs"
|
|
153
|
-
},
|
|
154
127
|
"./create-storage-state-factory": {
|
|
155
128
|
"types": "./create-storage-state-factory/index.d.ts",
|
|
156
129
|
"import": {
|
|
@@ -169,6 +142,15 @@
|
|
|
169
142
|
"require": "./current-year/index.cjs",
|
|
170
143
|
"default": "./current-year/index.cjs"
|
|
171
144
|
},
|
|
145
|
+
"./create-stackless-error": {
|
|
146
|
+
"types": "./create-stackless-error/index.d.ts",
|
|
147
|
+
"import": {
|
|
148
|
+
"types": "./create-stackless-error/index.d.ts",
|
|
149
|
+
"default": "./create-stackless-error/index.mjs"
|
|
150
|
+
},
|
|
151
|
+
"require": "./create-stackless-error/index.cjs",
|
|
152
|
+
"default": "./create-stackless-error/index.cjs"
|
|
153
|
+
},
|
|
172
154
|
"./email-protection": {
|
|
173
155
|
"types": "./email-protection/index.d.ts",
|
|
174
156
|
"import": {
|
|
@@ -178,15 +160,6 @@
|
|
|
178
160
|
"require": "./email-protection/index.cjs",
|
|
179
161
|
"default": "./email-protection/index.cjs"
|
|
180
162
|
},
|
|
181
|
-
"./is-safari": {
|
|
182
|
-
"types": "./is-safari/index.d.ts",
|
|
183
|
-
"import": {
|
|
184
|
-
"types": "./is-safari/index.d.ts",
|
|
185
|
-
"default": "./is-safari/index.mjs"
|
|
186
|
-
},
|
|
187
|
-
"require": "./is-safari/index.cjs",
|
|
188
|
-
"default": "./is-safari/index.cjs"
|
|
189
|
-
},
|
|
190
163
|
"./invariant": {
|
|
191
164
|
"types": "./invariant/index.d.ts",
|
|
192
165
|
"import": {
|
|
@@ -205,23 +178,14 @@
|
|
|
205
178
|
"require": "./fetch-jsonp/index.cjs",
|
|
206
179
|
"default": "./fetch-jsonp/index.cjs"
|
|
207
180
|
},
|
|
208
|
-
"./
|
|
209
|
-
"types": "./
|
|
210
|
-
"import": {
|
|
211
|
-
"types": "./merge-refs/index.d.ts",
|
|
212
|
-
"default": "./merge-refs/index.mjs"
|
|
213
|
-
},
|
|
214
|
-
"require": "./merge-refs/index.cjs",
|
|
215
|
-
"default": "./merge-refs/index.cjs"
|
|
216
|
-
},
|
|
217
|
-
"./no-ssr": {
|
|
218
|
-
"types": "./no-ssr/index.d.ts",
|
|
181
|
+
"./is-safari": {
|
|
182
|
+
"types": "./is-safari/index.d.ts",
|
|
219
183
|
"import": {
|
|
220
|
-
"types": "./
|
|
221
|
-
"default": "./
|
|
184
|
+
"types": "./is-safari/index.d.ts",
|
|
185
|
+
"default": "./is-safari/index.mjs"
|
|
222
186
|
},
|
|
223
|
-
"require": "./
|
|
224
|
-
"default": "./
|
|
187
|
+
"require": "./is-safari/index.cjs",
|
|
188
|
+
"default": "./is-safari/index.cjs"
|
|
225
189
|
},
|
|
226
190
|
"./magic-portal": {
|
|
227
191
|
"types": "./magic-portal/index.d.ts",
|
|
@@ -232,6 +196,15 @@
|
|
|
232
196
|
"require": "./magic-portal/index.cjs",
|
|
233
197
|
"default": "./magic-portal/index.cjs"
|
|
234
198
|
},
|
|
199
|
+
"./merge-refs": {
|
|
200
|
+
"types": "./merge-refs/index.d.ts",
|
|
201
|
+
"import": {
|
|
202
|
+
"types": "./merge-refs/index.d.ts",
|
|
203
|
+
"default": "./merge-refs/index.mjs"
|
|
204
|
+
},
|
|
205
|
+
"require": "./merge-refs/index.cjs",
|
|
206
|
+
"default": "./merge-refs/index.cjs"
|
|
207
|
+
},
|
|
235
208
|
"./noop": {
|
|
236
209
|
"types": "./noop/index.d.ts",
|
|
237
210
|
"import": {
|
|
@@ -241,14 +214,14 @@
|
|
|
241
214
|
"require": "./noop/index.cjs",
|
|
242
215
|
"default": "./noop/index.cjs"
|
|
243
216
|
},
|
|
244
|
-
"./
|
|
245
|
-
"types": "./
|
|
217
|
+
"./no-ssr": {
|
|
218
|
+
"types": "./no-ssr/index.d.ts",
|
|
246
219
|
"import": {
|
|
247
|
-
"types": "./
|
|
248
|
-
"default": "./
|
|
220
|
+
"types": "./no-ssr/index.d.ts",
|
|
221
|
+
"default": "./no-ssr/index.mjs"
|
|
249
222
|
},
|
|
250
|
-
"require": "./
|
|
251
|
-
"default": "./
|
|
223
|
+
"require": "./no-ssr/index.cjs",
|
|
224
|
+
"default": "./no-ssr/index.cjs"
|
|
252
225
|
},
|
|
253
226
|
"./noop-component": {
|
|
254
227
|
"types": "./noop-component/index.d.ts",
|
|
@@ -259,6 +232,15 @@
|
|
|
259
232
|
"require": "./noop-component/index.cjs",
|
|
260
233
|
"default": "./noop-component/index.cjs"
|
|
261
234
|
},
|
|
235
|
+
"./nullthrow": {
|
|
236
|
+
"types": "./nullthrow/index.d.ts",
|
|
237
|
+
"import": {
|
|
238
|
+
"types": "./nullthrow/index.d.ts",
|
|
239
|
+
"default": "./nullthrow/index.mjs"
|
|
240
|
+
},
|
|
241
|
+
"require": "./nullthrow/index.cjs",
|
|
242
|
+
"default": "./nullthrow/index.cjs"
|
|
243
|
+
},
|
|
262
244
|
"./open-new-tab": {
|
|
263
245
|
"types": "./open-new-tab/index.d.ts",
|
|
264
246
|
"import": {
|
|
@@ -268,15 +250,6 @@
|
|
|
268
250
|
"require": "./open-new-tab/index.cjs",
|
|
269
251
|
"default": "./open-new-tab/index.cjs"
|
|
270
252
|
},
|
|
271
|
-
"./rem": {
|
|
272
|
-
"types": "./rem/index.d.ts",
|
|
273
|
-
"import": {
|
|
274
|
-
"types": "./rem/index.d.ts",
|
|
275
|
-
"default": "./rem/index.mjs"
|
|
276
|
-
},
|
|
277
|
-
"require": "./rem/index.cjs",
|
|
278
|
-
"default": "./rem/index.cjs"
|
|
279
|
-
},
|
|
280
253
|
"./request-idle-callback": {
|
|
281
254
|
"types": "./request-idle-callback/index.d.ts",
|
|
282
255
|
"import": {
|
|
@@ -286,6 +259,15 @@
|
|
|
286
259
|
"require": "./request-idle-callback/index.cjs",
|
|
287
260
|
"default": "./request-idle-callback/index.cjs"
|
|
288
261
|
},
|
|
262
|
+
"./rem": {
|
|
263
|
+
"types": "./rem/index.d.ts",
|
|
264
|
+
"import": {
|
|
265
|
+
"types": "./rem/index.d.ts",
|
|
266
|
+
"default": "./rem/index.mjs"
|
|
267
|
+
},
|
|
268
|
+
"require": "./rem/index.cjs",
|
|
269
|
+
"default": "./rem/index.cjs"
|
|
270
|
+
},
|
|
289
271
|
"./types": {
|
|
290
272
|
"types": "./types/index.d.ts",
|
|
291
273
|
"import": {
|
|
@@ -313,15 +295,6 @@
|
|
|
313
295
|
"require": "./use/index.cjs",
|
|
314
296
|
"default": "./use/index.cjs"
|
|
315
297
|
},
|
|
316
|
-
"./use-abortable-effect": {
|
|
317
|
-
"types": "./use-abortable-effect/index.d.ts",
|
|
318
|
-
"import": {
|
|
319
|
-
"types": "./use-abortable-effect/index.d.ts",
|
|
320
|
-
"default": "./use-abortable-effect/index.mjs"
|
|
321
|
-
},
|
|
322
|
-
"require": "./use-abortable-effect/index.cjs",
|
|
323
|
-
"default": "./use-abortable-effect/index.cjs"
|
|
324
|
-
},
|
|
325
298
|
"./use-array": {
|
|
326
299
|
"types": "./use-array/index.d.ts",
|
|
327
300
|
"import": {
|
|
@@ -331,6 +304,15 @@
|
|
|
331
304
|
"require": "./use-array/index.cjs",
|
|
332
305
|
"default": "./use-array/index.cjs"
|
|
333
306
|
},
|
|
307
|
+
"./use-abortable-effect": {
|
|
308
|
+
"types": "./use-abortable-effect/index.d.ts",
|
|
309
|
+
"import": {
|
|
310
|
+
"types": "./use-abortable-effect/index.d.ts",
|
|
311
|
+
"default": "./use-abortable-effect/index.mjs"
|
|
312
|
+
},
|
|
313
|
+
"require": "./use-abortable-effect/index.cjs",
|
|
314
|
+
"default": "./use-abortable-effect/index.cjs"
|
|
315
|
+
},
|
|
334
316
|
"./use-clipboard": {
|
|
335
317
|
"types": "./use-clipboard/index.d.ts",
|
|
336
318
|
"import": {
|
|
@@ -358,15 +340,6 @@
|
|
|
358
340
|
"require": "./use-composition-input/index.cjs",
|
|
359
341
|
"default": "./use-composition-input/index.cjs"
|
|
360
342
|
},
|
|
361
|
-
"./use-debounced-state": {
|
|
362
|
-
"types": "./use-debounced-state/index.d.ts",
|
|
363
|
-
"import": {
|
|
364
|
-
"types": "./use-debounced-state/index.d.ts",
|
|
365
|
-
"default": "./use-debounced-state/index.mjs"
|
|
366
|
-
},
|
|
367
|
-
"require": "./use-debounced-state/index.cjs",
|
|
368
|
-
"default": "./use-debounced-state/index.cjs"
|
|
369
|
-
},
|
|
370
343
|
"./use-debounced-value": {
|
|
371
344
|
"types": "./use-debounced-value/index.d.ts",
|
|
372
345
|
"import": {
|
|
@@ -376,6 +349,15 @@
|
|
|
376
349
|
"require": "./use-debounced-value/index.cjs",
|
|
377
350
|
"default": "./use-debounced-value/index.cjs"
|
|
378
351
|
},
|
|
352
|
+
"./use-debounced-state": {
|
|
353
|
+
"types": "./use-debounced-state/index.d.ts",
|
|
354
|
+
"import": {
|
|
355
|
+
"types": "./use-debounced-state/index.d.ts",
|
|
356
|
+
"default": "./use-debounced-state/index.mjs"
|
|
357
|
+
},
|
|
358
|
+
"require": "./use-debounced-state/index.cjs",
|
|
359
|
+
"default": "./use-debounced-state/index.cjs"
|
|
360
|
+
},
|
|
379
361
|
"./use-error-boundary": {
|
|
380
362
|
"types": "./use-error-boundary/index.d.ts",
|
|
381
363
|
"import": {
|
|
@@ -403,6 +385,15 @@
|
|
|
403
385
|
"require": "./use-intersection/index.cjs",
|
|
404
386
|
"default": "./use-intersection/index.cjs"
|
|
405
387
|
},
|
|
388
|
+
"./use-is-online": {
|
|
389
|
+
"types": "./use-is-online/index.d.ts",
|
|
390
|
+
"import": {
|
|
391
|
+
"types": "./use-is-online/index.d.ts",
|
|
392
|
+
"default": "./use-is-online/index.mjs"
|
|
393
|
+
},
|
|
394
|
+
"require": "./use-is-online/index.cjs",
|
|
395
|
+
"default": "./use-is-online/index.cjs"
|
|
396
|
+
},
|
|
406
397
|
"./use-is-client": {
|
|
407
398
|
"types": "./use-is-client/index.d.ts",
|
|
408
399
|
"import": {
|
|
@@ -421,14 +412,14 @@
|
|
|
421
412
|
"require": "./use-isomorphic-layout-effect/index.cjs",
|
|
422
413
|
"default": "./use-isomorphic-layout-effect/index.cjs"
|
|
423
414
|
},
|
|
424
|
-
"./use-
|
|
425
|
-
"types": "./use-
|
|
415
|
+
"./use-map": {
|
|
416
|
+
"types": "./use-map/index.d.ts",
|
|
426
417
|
"import": {
|
|
427
|
-
"types": "./use-
|
|
428
|
-
"default": "./use-
|
|
418
|
+
"types": "./use-map/index.d.ts",
|
|
419
|
+
"default": "./use-map/index.mjs"
|
|
429
420
|
},
|
|
430
|
-
"require": "./use-
|
|
431
|
-
"default": "./use-
|
|
421
|
+
"require": "./use-map/index.cjs",
|
|
422
|
+
"default": "./use-map/index.cjs"
|
|
432
423
|
},
|
|
433
424
|
"./use-local-storage": {
|
|
434
425
|
"types": "./use-local-storage/index.d.ts",
|
|
@@ -439,15 +430,6 @@
|
|
|
439
430
|
"require": "./use-local-storage/index.cjs",
|
|
440
431
|
"default": "./use-local-storage/index.cjs"
|
|
441
432
|
},
|
|
442
|
-
"./use-map": {
|
|
443
|
-
"types": "./use-map/index.d.ts",
|
|
444
|
-
"import": {
|
|
445
|
-
"types": "./use-map/index.d.ts",
|
|
446
|
-
"default": "./use-map/index.mjs"
|
|
447
|
-
},
|
|
448
|
-
"require": "./use-map/index.cjs",
|
|
449
|
-
"default": "./use-map/index.cjs"
|
|
450
|
-
},
|
|
451
433
|
"./use-media-query": {
|
|
452
434
|
"types": "./use-media-query/index.d.ts",
|
|
453
435
|
"import": {
|
|
@@ -475,15 +457,6 @@
|
|
|
475
457
|
"require": "./use-readonly-search-params/index.cjs",
|
|
476
458
|
"default": "./use-readonly-search-params/index.cjs"
|
|
477
459
|
},
|
|
478
|
-
"./use-retimer": {
|
|
479
|
-
"types": "./use-retimer/index.d.ts",
|
|
480
|
-
"import": {
|
|
481
|
-
"types": "./use-retimer/index.d.ts",
|
|
482
|
-
"default": "./use-retimer/index.mjs"
|
|
483
|
-
},
|
|
484
|
-
"require": "./use-retimer/index.cjs",
|
|
485
|
-
"default": "./use-retimer/index.cjs"
|
|
486
|
-
},
|
|
487
460
|
"./use-session-storage": {
|
|
488
461
|
"types": "./use-session-storage/index.d.ts",
|
|
489
462
|
"import": {
|
|
@@ -493,14 +466,14 @@
|
|
|
493
466
|
"require": "./use-session-storage/index.cjs",
|
|
494
467
|
"default": "./use-session-storage/index.cjs"
|
|
495
468
|
},
|
|
496
|
-
"./use-
|
|
497
|
-
"types": "./use-
|
|
469
|
+
"./use-retimer": {
|
|
470
|
+
"types": "./use-retimer/index.d.ts",
|
|
498
471
|
"import": {
|
|
499
|
-
"types": "./use-
|
|
500
|
-
"default": "./use-
|
|
472
|
+
"types": "./use-retimer/index.d.ts",
|
|
473
|
+
"default": "./use-retimer/index.mjs"
|
|
501
474
|
},
|
|
502
|
-
"require": "./use-
|
|
503
|
-
"default": "./use-
|
|
475
|
+
"require": "./use-retimer/index.cjs",
|
|
476
|
+
"default": "./use-retimer/index.cjs"
|
|
504
477
|
},
|
|
505
478
|
"./use-set": {
|
|
506
479
|
"types": "./use-set/index.d.ts",
|
|
@@ -511,6 +484,15 @@
|
|
|
511
484
|
"require": "./use-set/index.cjs",
|
|
512
485
|
"default": "./use-set/index.cjs"
|
|
513
486
|
},
|
|
487
|
+
"./use-singleton": {
|
|
488
|
+
"types": "./use-singleton/index.d.ts",
|
|
489
|
+
"import": {
|
|
490
|
+
"types": "./use-singleton/index.d.ts",
|
|
491
|
+
"default": "./use-singleton/index.mjs"
|
|
492
|
+
},
|
|
493
|
+
"require": "./use-singleton/index.cjs",
|
|
494
|
+
"default": "./use-singleton/index.cjs"
|
|
495
|
+
},
|
|
514
496
|
"./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
|
|
515
497
|
"types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
|
|
516
498
|
"import": {
|
|
@@ -555,6 +537,24 @@
|
|
|
555
537
|
},
|
|
556
538
|
"require": "./use-url-hash-state/index.cjs",
|
|
557
539
|
"default": "./use-url-hash-state/index.cjs"
|
|
540
|
+
},
|
|
541
|
+
"./create-storage-hook": {
|
|
542
|
+
"types": "./create-storage-hook/index.d.ts",
|
|
543
|
+
"import": {
|
|
544
|
+
"types": "./create-storage-hook/index.d.ts",
|
|
545
|
+
"default": "./create-storage-hook/index.mjs"
|
|
546
|
+
},
|
|
547
|
+
"require": "./create-storage-hook/index.cjs",
|
|
548
|
+
"default": "./create-storage-hook/index.cjs"
|
|
549
|
+
},
|
|
550
|
+
"./create-session-storage-state": {
|
|
551
|
+
"types": "./create-session-storage-state/index.d.ts",
|
|
552
|
+
"import": {
|
|
553
|
+
"types": "./create-session-storage-state/index.d.ts",
|
|
554
|
+
"default": "./create-session-storage-state/index.mjs"
|
|
555
|
+
},
|
|
556
|
+
"require": "./create-session-storage-state/index.cjs",
|
|
557
|
+
"default": "./create-session-storage-state/index.cjs"
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
}
|
package/sizes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"total":{"raw":
|
|
1
|
+
{"total":{"raw":27817,"gzip":16550,"br":0},"exports":{"create-context-state":{"raw":145,"gzip":116,"br":96},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"context-reducer":{"raw":557,"gzip":332,"br":319},"create-context-reducer":{"raw":223,"gzip":146,"br":117},"create-magic-portal":{"raw":268,"gzip":148,"br":121},"create-local-storage-state":{"raw":446,"gzip":222,"br":209},"context-state":{"raw":402,"gzip":259,"br":218},"create-fixed-array":{"raw":452,"gzip":282,"br":248},"create-stackless-error":{"raw":278,"gzip":198,"br":162},"create-storage-state-factory":{"raw":620,"gzip":341,"br":290},"invariant":{"raw":178,"gzip":156,"br":118},"email-protection":{"raw":380,"gzip":292,"br":248},"current-year":{"raw":528,"gzip":356,"br":292},"is-safari":{"raw":233,"gzip":164,"br":119},"noop":{"raw":33,"gzip":53,"br":37},"fetch-jsonp":{"raw":890,"gzip":546,"br":429},"merge-refs":{"raw":525,"gzip":280,"br":235},"noop-component":{"raw":142,"gzip":130,"br":111},"magic-portal":{"raw":1083,"gzip":536,"br":472},"no-ssr":{"raw":338,"gzip":267,"br":219},"nullthrow":{"raw":187,"gzip":163,"br":121},"types":{"raw":0,"gzip":20,"br":1},"open-new-tab":{"raw":335,"gzip":255,"br":187},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"request-idle-callback":{"raw":392,"gzip":221,"br":171},"use":{"raw":298,"gzip":197,"br":160},"rem":{"raw":823,"gzip":395,"br":350},"use-abortable-effect":{"raw":215,"gzip":170,"br":144},"use-array":{"raw":334,"gzip":243,"br":206},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154},"use-composition-input":{"raw":470,"gzip":286,"br":241},"use-debounced-value":{"raw":553,"gzip":358,"br":320},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-error-boundary":{"raw":252,"gzip":195,"br":165},"use-is-online":{"raw":370,"gzip":258,"br":220},"use-fast-click":{"raw":622,"gzip":392,"br":317},"use-clipboard":{"raw":2723,"gzip":1332,"br":1140},"use-is-client":{"raw":204,"gzip":153,"br":121},"use-isomorphic-layout-effect":{"raw":169,"gzip":137,"br":110},"use-intersection":{"raw":1363,"gzip":716,"br":654},"use-map":{"raw":384,"gzip":256,"br":220},"use-local-storage":{"raw":428,"gzip":226,"br":198},"use-page-visibility":{"raw":359,"gzip":263,"br":210},"use-media-query":{"raw":648,"gzip":397,"br":332},"use-retimer":{"raw":194,"gzip":166,"br":127},"use-session-storage":{"raw":434,"gzip":225,"br":210},"use-readonly-search-params":{"raw":1164,"gzip":589,"br":496},"use-set":{"raw":368,"gzip":247,"br":211},"use-singleton":{"raw":149,"gzip":135,"br":116},"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":450,"gzip":318,"br":249},"use-uncontrolled":{"raw":388,"gzip":273,"br":230},"use-state-with-deps":{"raw":767,"gzip":489,"br":427},"use-url-hash-state":{"raw":1121,"gzip":628,"br":556},"create-session-storage-state":{"raw":450,"gzip":223,"br":206},"create-storage-hook":{"raw":2462,"gzip":972,"br":852}}}
|
package/use-array/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react");exports.useArray=function(){let
|
|
1
|
+
"use strict";require("client-only");var e=require("react");exports.useArray=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[r,c]=e.useState(t),l=e.useCallback(e=>c(t=>t.concat(e)),[]);return[r,l,e.useCallback(()=>c([]),[]),e.useCallback(e=>c(t=>{if(e>-1&&e<t.length){const r=t.slice();return r.splice(e,1),r}return t}),[])]};
|
package/use-array/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as t,useCallback as r}from"react";function e(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[n,o]=t(e),c=r(t=>o(r=>r.concat(t)),[]);return[n,c,r(()=>o([]),[]),r(t=>o(r=>{if(t>-1){const e=r.slice();return e.splice(t,1),e}return r}),[])]}export{e as useArray};
|
|
1
|
+
import"client-only";import{useState as t,useCallback as r}from"react";function e(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[n,o]=t(e),c=r(t=>o(r=>r.concat(t)),[]);return[n,c,r(()=>o([]),[]),r(t=>o(r=>{if(t>-1&&t<r.length){const e=r.slice();return e.splice(t,1),e}return r}),[])]}export{e as useArray};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),t=require("../use-abortable-effect/index.cjs");exports.useDebouncedValue=function(r
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("../use-abortable-effect/index.cjs");exports.useDebouncedValue=function(u,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof u)throw TypeError("[foxact/use-debounced-value] useDebouncedValue does not support function as value");const[o,c]=e.useState(u),s=e.useRef(!0);return t.useEffect(e=>{let t=null;return e.aborted||(n&&s.current?(s.current=!1,c(u)):t=window.setTimeout(()=>{s.current=!0,c(u)},r)),()=>{t&&window.clearTimeout(t)}},[u,n,r]),o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as e,useRef as t}from"react";import{useEffect as o}from"../use-abortable-effect/index.mjs";function r(r,n){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof r)throw TypeError("useDebouncedValue does not support function as value");const[i
|
|
1
|
+
import"client-only";import{useState as e,useRef as t}from"react";import{useEffect as o}from"../use-abortable-effect/index.mjs";function r(r,n){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof r)throw TypeError("[foxact/use-debounced-value] useDebouncedValue does not support function as value");const[c,i]=e(r),l=t(!0);return o(e=>{let t=null;return e.aborted||(u&&l.current?(l.current=!1,i(r)):t=window.setTimeout(()=>{l.current=!0,i(r)},n)),()=>{t&&window.clearTimeout(t)}},[r,u,n]),c}export{r as useDebouncedValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),n=require("../request-idle-callback/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs");const r="function"==typeof IntersectionObserver,o=new Map,i=[];exports.useIntersection=function(s){let{rootRef:c,rootMargin:u,disabled:l}=s;const[a,f]=e.useState(!1),d=e.useRef(null),b=t.useStableHandler(()=>f(!0));e.useEffect(()=>{if(r){if(l||a)return;const e=d.current;if(null==e?void 0:e.tagName)return function(e,n,t){const{id:r,observer:s,elements:c}=function(e){let n;const t={root:e.root||null,margin:e.rootMargin||""},r=i.find(e=>e.root===t.root&&e.margin===t.margin);if(r&&(n=o.get(r)))return n;const s=new Map;return n={id:t,observer:new IntersectionObserver(e=>{e.forEach(e=>{const n=s.get(e.target),t=e.isIntersecting||e.intersectionRatio>0;n&&t&&n(t)})},e),elements:s},i.push(t),o.set(t,n),n}(t);return c.set(e,n),s.observe(e),function(){if(c.delete(e),s.unobserve(e),0===c.size){s.disconnect(),o.delete(r);const e=i.findIndex(e=>e.root===r.root&&e.margin===r.margin);e>-1&&i.splice(e,1)}}}(e,e=>e&&b(),{root:null==c?void 0:c.current,rootMargin:u})}if(!a){const e=n.requestIdleCallback(b);return()=>n.cancelIdleCallback(e)}},[l,u,c,a,b]);const g=e.useCallback(()=>{f(!1)},[]);return[e.useCallback(e=>{d.current=e},[]),a,g]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as
|
|
1
|
+
import"client-only";import{useState as n,useRef as e,useEffect as t,useCallback as r}from"react";import{requestIdleCallback as o,cancelIdleCallback as i}from"../request-idle-callback/index.mjs";import{useStableHandler as s}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";const c="function"==typeof IntersectionObserver;function u(u){let{rootRef:f,rootMargin:m,disabled:d}=u;const[g,p]=n(!1),b=e(null),v=s(()=>p(!0));t(()=>{if(c){if(d||g)return;const n=b.current;if(null==n?void 0:n.tagName)return function(n,e,t){const{id:r,observer:o,elements:i}=function(n){let e;const t={root:n.root||null,margin:n.rootMargin||""},r=a.find(n=>n.root===t.root&&n.margin===t.margin);if(r&&(e=l.get(r)))return e;const o=new Map;return e={id:t,observer:new IntersectionObserver(n=>{n.forEach(n=>{const e=o.get(n.target),t=n.isIntersecting||n.intersectionRatio>0;e&&t&&e(t)})},n),elements:o},a.push(t),l.set(t,e),e}(t);return i.set(n,e),o.observe(n),function(){if(i.delete(n),o.unobserve(n),0===i.size){o.disconnect(),l.delete(r);const n=a.findIndex(n=>n.root===r.root&&n.margin===r.margin);n>-1&&a.splice(n,1)}}}(n,n=>n&&v(),{root:null==f?void 0:f.current,rootMargin:m})}if(!g){const n=o(v);return()=>i(n)}},[d,m,f,g,v]);const w=r(()=>{p(!1)},[]);return[r(n=>{b.current=n},[]),g,w]}const l=new Map,a=[];export{u as useIntersection};
|
package/use-map/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react");exports.useMap=function(){let
|
|
1
|
+
"use strict";require("client-only");var e=require("react");exports.useMap=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[a,n]=e.useState(t),r=e.useCallback((e,t)=>n(a=>{const n=new Map(a);return n.set(e,t),n}),[]),s=e.useCallback(e=>n(t=>{if(!t.has(e))return t;const a=new Map(t);return a.delete(e),a}),[]);return[a,r,s,e.useCallback(()=>n(new Map),[]),e.useCallback(e=>n(e),[])]};
|
package/use-map/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as e,useCallback as t}from"react";function n(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[o
|
|
1
|
+
import"client-only";import{useState as e,useCallback as t}from"react";function n(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[r,o]=e(n),p=t((e,t)=>o(n=>{const r=new Map(n);return r.set(e,t),r}),[]),a=t(e=>o(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),[]);return[r,p,a,t(()=>o(new Map),[]),t(e=>o(e),[])]}export{n as useMap};
|
package/use-retimer/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react");exports.useRetimer=function(){const r=e.useRef();return e.useCallback(e=>{
|
|
1
|
+
"use strict";require("client-only");var e=require("react");exports.useRetimer=function(){const r=e.useRef(void 0);return e.useCallback(e=>{null!=r.current&&clearTimeout(r.current),r.current=e},[])};
|
package/use-retimer/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useRef as r,useCallback as
|
|
1
|
+
import"client-only";import{useRef as r,useCallback as t}from"react";function e(){const e=r(void 0);return t(r=>{null!=e.current&&clearTimeout(e.current),e.current=r},[])}export{e as useRetimer};
|
package/use-set/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react");exports.useSet=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[
|
|
1
|
+
"use strict";require("client-only");var e=require("react");exports.useSet=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[n,r]=e.useState(t),a=e.useCallback(e=>r(t=>t.has(e)?t:new Set([...t,e])),[]),l=e.useCallback(e=>r(t=>{if(!t.has(e))return t;const n=new Set(t);return n.delete(e),n}),[]);return[n,a,l,e.useCallback(()=>r(new Set),[]),e.useCallback(e=>r(e),[])]};
|
package/use-set/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as e,useCallback as t}from"react";function n(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[o
|
|
1
|
+
import"client-only";import{useState as e,useCallback as t}from"react";function n(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[r,o]=e(n),i=t(e=>o(t=>t.has(e)?t:new Set([...t,e])),[]),c=t(e=>o(t=>{if(!t.has(e))return t;const n=new Set(t);return n.delete(e),n}),[]);return[r,i,c,t(()=>o(new Set),[]),t(e=>o(e),[])]}export{n as useSet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only")
|
|
1
|
+
"use strict";var e=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");function s(e,t){Object.defineProperty(e.t,t,{get:()=>(e.d[t]=!0,e.s[t]),enumerable:!0})}function n(e){return{state:e.s,tracked:e.d}}require("client-only");const r=Object.prototype.hasOwnProperty;exports.useStateWithDeps=function(c){const[{inst:u},o]=e.useState(()=>{const e={s:c,d:{},t:{},u:!1};for(const t in c)r.call(c,t)&&s(e,t);return{inst:e}}),i=e.useCallback(e=>{const t="function"==typeof e?e(u.s):e;let n=!1;for(const e in t)r.call(t,e)&&(r.call(u.t,e)||s(u,e),!Object.is(u.s[e],t[e])&&(u.s[e]=t[e],u.d[e]&&(n=!0)));n&&!u.u&&o({inst:u})},[u]);return t.useLayoutEffect(()=>(u.u=!1,()=>{u.u=!0})),"production"!==process.env.NODE_ENV&&e.useDebugValue(u,n),[u.t,i]};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/** @see https://foxact.skk.moe/use-state-with-deps */
|
|
3
2
|
declare function useStateWithDeps<S extends Record<string, any> = Record<string, any>>(initialState: S): [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
setState: (payload: Partial<S>) => void
|
|
3
|
+
snapshot: Readonly<S>,
|
|
4
|
+
setState: (payload: Partial<S> | ((prevState: Readonly<S>) => Partial<S>)) => void
|
|
7
5
|
];
|
|
8
6
|
|
|
9
7
|
export { useStateWithDeps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as t,
|
|
1
|
+
import{useState as t,useCallback as e,useDebugValue as o}from"react";import{useLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";function r(t,e){Object.defineProperty(t.t,e,{get:()=>(t.d[e]=!0,t.s[e]),enumerable:!0})}function c(t){return{state:t.s,tracked:t.d}}const s=Object.prototype.hasOwnProperty;function i(i){const[{inst:u},p]=t(()=>{const t={s:i,d:{},t:{},u:!1};for(const e in i)s.call(i,e)&&r(t,e);return{inst:t}}),f=e(t=>{const e="function"==typeof t?t(u.s):t;let o=!1;for(const t in e)s.call(e,t)&&(s.call(u.t,t)||r(u,t),!Object.is(u.s[t],e[t])&&(u.s[t]=e[t],u.d[t]&&(o=!0)));o&&!u.u&&p({inst:u})},[u]);return n(()=>(u.u=!1,()=>{u.u=!0})),"production"!==process.env.NODE_ENV&&o(u,c),[u.t,f]}export{i as useStateWithDeps};
|