foxact 0.2.37 → 0.2.38

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.37",
3
+ "version": "0.2.38",
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": {
@@ -87,15 +87,6 @@
87
87
  "require": "./context-state/index.cjs",
88
88
  "default": "./context-state/index.js"
89
89
  },
90
- "./create-context-state": {
91
- "types": "./create-context-state/index.d.ts",
92
- "import": {
93
- "types": "./create-context-state/index.d.ts",
94
- "default": "./create-context-state/index.mjs"
95
- },
96
- "require": "./create-context-state/index.cjs",
97
- "default": "./create-context-state/index.js"
98
- },
99
90
  "./create-fixed-array": {
100
91
  "types": "./create-fixed-array/index.d.ts",
101
92
  "import": {
@@ -132,6 +123,15 @@
132
123
  "require": "./invariant/index.cjs",
133
124
  "default": "./invariant/index.js"
134
125
  },
126
+ "./create-context-state": {
127
+ "types": "./create-context-state/index.d.ts",
128
+ "import": {
129
+ "types": "./create-context-state/index.d.ts",
130
+ "default": "./create-context-state/index.mjs"
131
+ },
132
+ "require": "./create-context-state/index.cjs",
133
+ "default": "./create-context-state/index.js"
134
+ },
135
135
  "./no-ssr": {
136
136
  "types": "./no-ssr/index.d.ts",
137
137
  "import": {
@@ -168,15 +168,6 @@
168
168
  "require": "./rem/index.cjs",
169
169
  "default": "./rem/index.js"
170
170
  },
171
- "./request-idle-callback": {
172
- "types": "./request-idle-callback/index.d.ts",
173
- "import": {
174
- "types": "./request-idle-callback/index.d.ts",
175
- "default": "./request-idle-callback/index.mjs"
176
- },
177
- "require": "./request-idle-callback/index.cjs",
178
- "default": "./request-idle-callback/index.js"
179
- },
180
171
  "./types": {
181
172
  "types": "./types/index.d.ts",
182
173
  "import": {
@@ -195,6 +186,15 @@
195
186
  "require": "./typescript-happy-forward-ref/index.cjs",
196
187
  "default": "./typescript-happy-forward-ref/index.js"
197
188
  },
189
+ "./request-idle-callback": {
190
+ "types": "./request-idle-callback/index.d.ts",
191
+ "import": {
192
+ "types": "./request-idle-callback/index.d.ts",
193
+ "default": "./request-idle-callback/index.mjs"
194
+ },
195
+ "require": "./request-idle-callback/index.cjs",
196
+ "default": "./request-idle-callback/index.js"
197
+ },
198
198
  "./use": {
199
199
  "types": "./use/index.d.ts",
200
200
  "import": {
@@ -204,15 +204,6 @@
204
204
  "require": "./use/index.cjs",
205
205
  "default": "./use/index.js"
206
206
  },
207
- "./use-abortable-effect": {
208
- "types": "./use-abortable-effect/index.d.ts",
209
- "import": {
210
- "types": "./use-abortable-effect/index.d.ts",
211
- "default": "./use-abortable-effect/index.mjs"
212
- },
213
- "require": "./use-abortable-effect/index.cjs",
214
- "default": "./use-abortable-effect/index.js"
215
- },
216
207
  "./use-array": {
217
208
  "types": "./use-array/index.d.ts",
218
209
  "import": {
@@ -222,6 +213,15 @@
222
213
  "require": "./use-array/index.cjs",
223
214
  "default": "./use-array/index.js"
224
215
  },
216
+ "./use-abortable-effect": {
217
+ "types": "./use-abortable-effect/index.d.ts",
218
+ "import": {
219
+ "types": "./use-abortable-effect/index.d.ts",
220
+ "default": "./use-abortable-effect/index.mjs"
221
+ },
222
+ "require": "./use-abortable-effect/index.cjs",
223
+ "default": "./use-abortable-effect/index.js"
224
+ },
225
225
  "./use-clipboard": {
226
226
  "types": "./use-clipboard/index.d.ts",
227
227
  "import": {
@@ -240,15 +240,6 @@
240
240
  "require": "./use-composition-input/index.cjs",
241
241
  "default": "./use-composition-input/index.js"
242
242
  },
243
- "./use-debounced-state": {
244
- "types": "./use-debounced-state/index.d.ts",
245
- "import": {
246
- "types": "./use-debounced-state/index.d.ts",
247
- "default": "./use-debounced-state/index.mjs"
248
- },
249
- "require": "./use-debounced-state/index.cjs",
250
- "default": "./use-debounced-state/index.js"
251
- },
252
243
  "./use-debounced-value": {
253
244
  "types": "./use-debounced-value/index.d.ts",
254
245
  "import": {
@@ -267,6 +258,15 @@
267
258
  "require": "./use-error-boundary/index.cjs",
268
259
  "default": "./use-error-boundary/index.js"
269
260
  },
261
+ "./use-debounced-state": {
262
+ "types": "./use-debounced-state/index.d.ts",
263
+ "import": {
264
+ "types": "./use-debounced-state/index.d.ts",
265
+ "default": "./use-debounced-state/index.mjs"
266
+ },
267
+ "require": "./use-debounced-state/index.cjs",
268
+ "default": "./use-debounced-state/index.js"
269
+ },
270
270
  "./use-intersection": {
271
271
  "types": "./use-intersection/index.d.ts",
272
272
  "import": {
@@ -294,15 +294,6 @@
294
294
  "require": "./use-isomorphic-layout-effect/index.cjs",
295
295
  "default": "./use-isomorphic-layout-effect/index.js"
296
296
  },
297
- "./use-local-storage": {
298
- "types": "./use-local-storage/index.d.ts",
299
- "import": {
300
- "types": "./use-local-storage/index.d.ts",
301
- "default": "./use-local-storage/index.mjs"
302
- },
303
- "require": "./use-local-storage/index.cjs",
304
- "default": "./use-local-storage/index.js"
305
- },
306
297
  "./use-map": {
307
298
  "types": "./use-map/index.d.ts",
308
299
  "import": {
@@ -321,6 +312,15 @@
321
312
  "require": "./use-media-query/index.cjs",
322
313
  "default": "./use-media-query/index.js"
323
314
  },
315
+ "./use-local-storage": {
316
+ "types": "./use-local-storage/index.d.ts",
317
+ "import": {
318
+ "types": "./use-local-storage/index.d.ts",
319
+ "default": "./use-local-storage/index.mjs"
320
+ },
321
+ "require": "./use-local-storage/index.cjs",
322
+ "default": "./use-local-storage/index.js"
323
+ },
324
324
  "./use-next-link": {
325
325
  "types": "./use-next-link/index.d.ts",
326
326
  "import": {
@@ -339,6 +339,15 @@
339
339
  "require": "./use-next-pathname/index.cjs",
340
340
  "default": "./use-next-pathname/index.js"
341
341
  },
342
+ "./use-page-visibility": {
343
+ "types": "./use-page-visibility/index.d.ts",
344
+ "import": {
345
+ "types": "./use-page-visibility/index.d.ts",
346
+ "default": "./use-page-visibility/index.mjs"
347
+ },
348
+ "require": "./use-page-visibility/index.cjs",
349
+ "default": "./use-page-visibility/index.js"
350
+ },
342
351
  "./use-react-router-enable-concurrent-navigation": {
343
352
  "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
344
353
  "import": {
@@ -357,15 +366,6 @@
357
366
  "require": "./use-react-router-is-match/index.cjs",
358
367
  "default": "./use-react-router-is-match/index.js"
359
368
  },
360
- "./use-retimer": {
361
- "types": "./use-retimer/index.d.ts",
362
- "import": {
363
- "types": "./use-retimer/index.d.ts",
364
- "default": "./use-retimer/index.mjs"
365
- },
366
- "require": "./use-retimer/index.cjs",
367
- "default": "./use-retimer/index.js"
368
- },
369
369
  "./use-session-storage": {
370
370
  "types": "./use-session-storage/index.d.ts",
371
371
  "import": {
@@ -375,6 +375,15 @@
375
375
  "require": "./use-session-storage/index.cjs",
376
376
  "default": "./use-session-storage/index.js"
377
377
  },
378
+ "./use-retimer": {
379
+ "types": "./use-retimer/index.d.ts",
380
+ "import": {
381
+ "types": "./use-retimer/index.d.ts",
382
+ "default": "./use-retimer/index.mjs"
383
+ },
384
+ "require": "./use-retimer/index.cjs",
385
+ "default": "./use-retimer/index.js"
386
+ },
378
387
  "./use-set": {
379
388
  "types": "./use-set/index.d.ts",
380
389
  "import": {
@@ -393,6 +402,15 @@
393
402
  "require": "./use-singleton/index.cjs",
394
403
  "default": "./use-singleton/index.js"
395
404
  },
405
+ "./use-typescript-happy-callback": {
406
+ "types": "./use-typescript-happy-callback/index.d.ts",
407
+ "import": {
408
+ "types": "./use-typescript-happy-callback/index.d.ts",
409
+ "default": "./use-typescript-happy-callback/index.mjs"
410
+ },
411
+ "require": "./use-typescript-happy-callback/index.cjs",
412
+ "default": "./use-typescript-happy-callback/index.js"
413
+ },
396
414
  "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
397
415
  "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
398
416
  "import": {
@@ -419,6 +437,15 @@
419
437
  },
420
438
  "require": "./use-url-hash-state/index.cjs",
421
439
  "default": "./use-url-hash-state/index.js"
440
+ },
441
+ "./use-is-online": {
442
+ "types": "./use-is-online/index.d.ts",
443
+ "import": {
444
+ "types": "./use-is-online/index.d.ts",
445
+ "default": "./use-is-online/index.mjs"
446
+ },
447
+ "require": "./use-is-online/index.cjs",
448
+ "default": "./use-is-online/index.js"
422
449
  }
423
450
  }
424
451
  }
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":18655,"gzip":11350,"br":0},"exports":{"compose-context-provider":{"raw":177,"gzip":155,"br":122},"create-context-state":{"raw":145,"gzip":116,"br":96},"context-state":{"raw":377,"gzip":241,"br":207},"create-fixed-array":{"raw":419,"gzip":279,"br":251},"invariant":{"raw":178,"gzip":156,"br":118},"noop":{"raw":33,"gzip":53,"br":37},"current-year":{"raw":592,"gzip":400,"br":326},"no-ssr":{"raw":468,"gzip":318,"br":266},"nullthrow":{"raw":194,"gzip":167,"br":128},"types":{"raw":0,"gzip":20,"br":1},"create-storage-hook":{"raw":2061,"gzip":880,"br":762},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"use":{"raw":276,"gzip":182,"br":150},"rem":{"raw":824,"gzip":396,"br":352},"use-abortable-effect":{"raw":210,"gzip":166,"br":150},"use-array":{"raw":329,"gzip":238,"br":199},"use-composition-input":{"raw":458,"gzip":283,"br":241},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-clipboard":{"raw":1067,"gzip":611,"br":524},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"use-is-client":{"raw":151,"gzip":142,"br":118},"use-map":{"raw":346,"gzip":244,"br":210},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-media-query":{"raw":718,"gzip":402,"br":334},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387},"use-next-link":{"raw":1600,"gzip":851,"br":730},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-react-router-is-match":{"raw":564,"gzip":373,"br":314},"use-session-storage":{"raw":316,"gzip":181,"br":152},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-set":{"raw":347,"gzip":240,"br":203},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":254},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"use-url-hash-state":{"raw":1069,"gzip":612,"br":534}}}
1
+ {"total":{"raw":19387,"gzip":11872,"br":0},"exports":{"context-state":{"raw":377,"gzip":241,"br":207},"create-fixed-array":{"raw":419,"gzip":279,"br":251},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"invariant":{"raw":178,"gzip":156,"br":118},"create-context-state":{"raw":145,"gzip":116,"br":96},"current-year":{"raw":592,"gzip":400,"br":326},"noop":{"raw":33,"gzip":53,"br":37},"no-ssr":{"raw":468,"gzip":318,"br":266},"types":{"raw":0,"gzip":20,"br":1},"nullthrow":{"raw":194,"gzip":167,"br":128},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"create-storage-hook":{"raw":2061,"gzip":880,"br":762},"rem":{"raw":824,"gzip":396,"br":352},"use":{"raw":276,"gzip":182,"br":150},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"use-abortable-effect":{"raw":210,"gzip":166,"br":150},"use-array":{"raw":329,"gzip":238,"br":199},"use-composition-input":{"raw":458,"gzip":283,"br":241},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"use-clipboard":{"raw":1067,"gzip":611,"br":524},"use-is-client":{"raw":151,"gzip":142,"br":118},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-map":{"raw":346,"gzip":244,"br":210},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-media-query":{"raw":718,"gzip":402,"br":334},"use-page-visibility":{"raw":290,"gzip":206,"br":154},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-session-storage":{"raw":316,"gzip":181,"br":152},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387},"use-react-router-is-match":{"raw":564,"gzip":373,"br":314},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-set":{"raw":347,"gzip":240,"br":203},"use-next-link":{"raw":1600,"gzip":851,"br":730},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":254},"use-is-online":{"raw":335,"gzip":214,"br":160},"use-url-hash-state":{"raw":1069,"gzip":612,"br":534}}}
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ "use strict";var e=require("react");const n=e=>(window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}),i=()=>"undefined"!=typeof window&&navigator.onLine;exports.useIsOnline=function(){return e.useSyncExternalStore(n,i,i)};
@@ -0,0 +1,4 @@
1
+ /** @see https://foxact.skk.moe/use-is-online */
2
+ declare function useIsOnline(): unknown;
3
+
4
+ export { useIsOnline };
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ "use strict";var e=require("react");const n=e=>(window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}),i=()=>"undefined"!=typeof window&&navigator.onLine;exports.useIsOnline=function(){return e.useSyncExternalStore(n,i,i)};
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ import{useSyncExternalStore as n}from"react";const e=n=>(window.addEventListener("online",n),window.addEventListener("offline",n),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",n)}),i=()=>"undefined"!=typeof window&&navigator.onLine;function o(){return n(e,i,i)}export{o as useIsOnline};
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ "use strict";var e=require("react");const t=e=>(document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}),i=()=>"undefined"!=typeof document&&!document.hidden;exports.usePageVisibility=function(){return e.useSyncExternalStore(t,i,i)};
@@ -0,0 +1,4 @@
1
+ /** @see https://foxact.skk.moe/use-page-visibility */
2
+ declare function usePageVisibility(): unknown;
3
+
4
+ export { usePageVisibility };
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ "use strict";var e=require("react");const t=e=>(document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}),i=()=>"undefined"!=typeof document&&!document.hidden;exports.usePageVisibility=function(){return e.useSyncExternalStore(t,i,i)};
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ import{useSyncExternalStore as e}from"react";const i=e=>(document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}),t=()=>"undefined"!=typeof document&&!document.hidden;function n(){return e(i,t,t)}export{n as usePageVisibility};
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react").useCallback;exports.useCallback=e,exports.useTypeScriptHappyCallback=e;
@@ -0,0 +1,6 @@
1
+ /** @see https://foxact.skk.moe/use-typescript-happy-callback */
2
+ declare const useTypeScriptHappyCallback: <Args extends unknown[], R>(fn: (...args: Args) => R, deps: React.DependencyList) => (...args: Args) => R;
3
+ /** @see https://foxact.skk.moe/use-typescript-happy-callback */
4
+ declare const useCallback: <Args extends unknown[], R>(fn: (...args: Args) => R, deps: React.DependencyList) => (...args: Args) => R;
5
+
6
+ export { useCallback, useTypeScriptHappyCallback };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react").useCallback;exports.useCallback=e,exports.useTypeScriptHappyCallback=e;
@@ -0,0 +1 @@
1
+ import{useCallback as a}from"react";const c=a,e=c;export{e as useCallback,c as useTypeScriptHappyCallback};