foxact 0.3.2 → 0.3.4
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/noop-component/index.cjs +1 -0
- package/noop-component/index.mjs +1 -0
- package/package.json +115 -115
- package/sizes.json +1 -1
- package/use-clipboard/index.cjs +1 -1
- package/use-clipboard/index.d.ts +5 -2
- package/use-clipboard/index.mjs +1 -1
package/noop-component/index.cjs
CHANGED
package/noop-component/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxact",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
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": {
|
|
@@ -61,23 +61,14 @@
|
|
|
61
61
|
"require": "./compose-context-provider/index.cjs",
|
|
62
62
|
"default": "./compose-context-provider/index.cjs"
|
|
63
63
|
},
|
|
64
|
-
"./context-
|
|
65
|
-
"types": "./context-
|
|
66
|
-
"import": {
|
|
67
|
-
"types": "./context-state/index.d.ts",
|
|
68
|
-
"default": "./context-state/index.mjs"
|
|
69
|
-
},
|
|
70
|
-
"require": "./context-state/index.cjs",
|
|
71
|
-
"default": "./context-state/index.cjs"
|
|
72
|
-
},
|
|
73
|
-
"./create-context-reducer": {
|
|
74
|
-
"types": "./create-context-reducer/index.d.ts",
|
|
64
|
+
"./context-reducer": {
|
|
65
|
+
"types": "./context-reducer/index.d.ts",
|
|
75
66
|
"import": {
|
|
76
|
-
"types": "./
|
|
77
|
-
"default": "./
|
|
67
|
+
"types": "./context-reducer/index.d.ts",
|
|
68
|
+
"default": "./context-reducer/index.mjs"
|
|
78
69
|
},
|
|
79
|
-
"require": "./
|
|
80
|
-
"default": "./
|
|
70
|
+
"require": "./context-reducer/index.cjs",
|
|
71
|
+
"default": "./context-reducer/index.cjs"
|
|
81
72
|
},
|
|
82
73
|
"./create-context-state": {
|
|
83
74
|
"types": "./create-context-state/index.d.ts",
|
|
@@ -88,15 +79,6 @@
|
|
|
88
79
|
"require": "./create-context-state/index.cjs",
|
|
89
80
|
"default": "./create-context-state/index.cjs"
|
|
90
81
|
},
|
|
91
|
-
"./context-reducer": {
|
|
92
|
-
"types": "./context-reducer/index.d.ts",
|
|
93
|
-
"import": {
|
|
94
|
-
"types": "./context-reducer/index.d.ts",
|
|
95
|
-
"default": "./context-reducer/index.mjs"
|
|
96
|
-
},
|
|
97
|
-
"require": "./context-reducer/index.cjs",
|
|
98
|
-
"default": "./context-reducer/index.cjs"
|
|
99
|
-
},
|
|
100
82
|
"./create-fixed-array": {
|
|
101
83
|
"types": "./create-fixed-array/index.d.ts",
|
|
102
84
|
"import": {
|
|
@@ -115,6 +97,24 @@
|
|
|
115
97
|
"require": "./create-local-storage-state/index.cjs",
|
|
116
98
|
"default": "./create-local-storage-state/index.cjs"
|
|
117
99
|
},
|
|
100
|
+
"./create-context-reducer": {
|
|
101
|
+
"types": "./create-context-reducer/index.d.ts",
|
|
102
|
+
"import": {
|
|
103
|
+
"types": "./create-context-reducer/index.d.ts",
|
|
104
|
+
"default": "./create-context-reducer/index.mjs"
|
|
105
|
+
},
|
|
106
|
+
"require": "./create-context-reducer/index.cjs",
|
|
107
|
+
"default": "./create-context-reducer/index.cjs"
|
|
108
|
+
},
|
|
109
|
+
"./context-state": {
|
|
110
|
+
"types": "./context-state/index.d.ts",
|
|
111
|
+
"import": {
|
|
112
|
+
"types": "./context-state/index.d.ts",
|
|
113
|
+
"default": "./context-state/index.mjs"
|
|
114
|
+
},
|
|
115
|
+
"require": "./context-state/index.cjs",
|
|
116
|
+
"default": "./context-state/index.cjs"
|
|
117
|
+
},
|
|
118
118
|
"./create-magic-portal": {
|
|
119
119
|
"types": "./create-magic-portal/index.d.ts",
|
|
120
120
|
"import": {
|
|
@@ -142,15 +142,6 @@
|
|
|
142
142
|
"require": "./create-storage-hook/index.cjs",
|
|
143
143
|
"default": "./create-storage-hook/index.cjs"
|
|
144
144
|
},
|
|
145
|
-
"./create-storage-state-factory": {
|
|
146
|
-
"types": "./create-storage-state-factory/index.d.ts",
|
|
147
|
-
"import": {
|
|
148
|
-
"types": "./create-storage-state-factory/index.d.ts",
|
|
149
|
-
"default": "./create-storage-state-factory/index.mjs"
|
|
150
|
-
},
|
|
151
|
-
"require": "./create-storage-state-factory/index.cjs",
|
|
152
|
-
"default": "./create-storage-state-factory/index.cjs"
|
|
153
|
-
},
|
|
154
145
|
"./create-session-storage-state": {
|
|
155
146
|
"types": "./create-session-storage-state/index.d.ts",
|
|
156
147
|
"import": {
|
|
@@ -160,6 +151,15 @@
|
|
|
160
151
|
"require": "./create-session-storage-state/index.cjs",
|
|
161
152
|
"default": "./create-session-storage-state/index.cjs"
|
|
162
153
|
},
|
|
154
|
+
"./create-storage-state-factory": {
|
|
155
|
+
"types": "./create-storage-state-factory/index.d.ts",
|
|
156
|
+
"import": {
|
|
157
|
+
"types": "./create-storage-state-factory/index.d.ts",
|
|
158
|
+
"default": "./create-storage-state-factory/index.mjs"
|
|
159
|
+
},
|
|
160
|
+
"require": "./create-storage-state-factory/index.cjs",
|
|
161
|
+
"default": "./create-storage-state-factory/index.cjs"
|
|
162
|
+
},
|
|
163
163
|
"./current-year": {
|
|
164
164
|
"types": "./current-year/index.d.ts",
|
|
165
165
|
"import": {
|
|
@@ -169,15 +169,6 @@
|
|
|
169
169
|
"require": "./current-year/index.cjs",
|
|
170
170
|
"default": "./current-year/index.cjs"
|
|
171
171
|
},
|
|
172
|
-
"./fetch-jsonp": {
|
|
173
|
-
"types": "./fetch-jsonp/index.d.ts",
|
|
174
|
-
"import": {
|
|
175
|
-
"types": "./fetch-jsonp/index.d.ts",
|
|
176
|
-
"default": "./fetch-jsonp/index.mjs"
|
|
177
|
-
},
|
|
178
|
-
"require": "./fetch-jsonp/index.cjs",
|
|
179
|
-
"default": "./fetch-jsonp/index.cjs"
|
|
180
|
-
},
|
|
181
172
|
"./email-protection": {
|
|
182
173
|
"types": "./email-protection/index.d.ts",
|
|
183
174
|
"import": {
|
|
@@ -205,6 +196,15 @@
|
|
|
205
196
|
"require": "./invariant/index.cjs",
|
|
206
197
|
"default": "./invariant/index.cjs"
|
|
207
198
|
},
|
|
199
|
+
"./fetch-jsonp": {
|
|
200
|
+
"types": "./fetch-jsonp/index.d.ts",
|
|
201
|
+
"import": {
|
|
202
|
+
"types": "./fetch-jsonp/index.d.ts",
|
|
203
|
+
"default": "./fetch-jsonp/index.mjs"
|
|
204
|
+
},
|
|
205
|
+
"require": "./fetch-jsonp/index.cjs",
|
|
206
|
+
"default": "./fetch-jsonp/index.cjs"
|
|
207
|
+
},
|
|
208
208
|
"./merge-refs": {
|
|
209
209
|
"types": "./merge-refs/index.d.ts",
|
|
210
210
|
"import": {
|
|
@@ -214,15 +214,6 @@
|
|
|
214
214
|
"require": "./merge-refs/index.cjs",
|
|
215
215
|
"default": "./merge-refs/index.cjs"
|
|
216
216
|
},
|
|
217
|
-
"./magic-portal": {
|
|
218
|
-
"types": "./magic-portal/index.d.ts",
|
|
219
|
-
"import": {
|
|
220
|
-
"types": "./magic-portal/index.d.ts",
|
|
221
|
-
"default": "./magic-portal/index.mjs"
|
|
222
|
-
},
|
|
223
|
-
"require": "./magic-portal/index.cjs",
|
|
224
|
-
"default": "./magic-portal/index.cjs"
|
|
225
|
-
},
|
|
226
217
|
"./no-ssr": {
|
|
227
218
|
"types": "./no-ssr/index.d.ts",
|
|
228
219
|
"import": {
|
|
@@ -232,6 +223,15 @@
|
|
|
232
223
|
"require": "./no-ssr/index.cjs",
|
|
233
224
|
"default": "./no-ssr/index.cjs"
|
|
234
225
|
},
|
|
226
|
+
"./magic-portal": {
|
|
227
|
+
"types": "./magic-portal/index.d.ts",
|
|
228
|
+
"import": {
|
|
229
|
+
"types": "./magic-portal/index.d.ts",
|
|
230
|
+
"default": "./magic-portal/index.mjs"
|
|
231
|
+
},
|
|
232
|
+
"require": "./magic-portal/index.cjs",
|
|
233
|
+
"default": "./magic-portal/index.cjs"
|
|
234
|
+
},
|
|
235
235
|
"./noop": {
|
|
236
236
|
"types": "./noop/index.d.ts",
|
|
237
237
|
"import": {
|
|
@@ -241,15 +241,6 @@
|
|
|
241
241
|
"require": "./noop/index.cjs",
|
|
242
242
|
"default": "./noop/index.cjs"
|
|
243
243
|
},
|
|
244
|
-
"./noop-component": {
|
|
245
|
-
"types": "./noop-component/index.d.ts",
|
|
246
|
-
"import": {
|
|
247
|
-
"types": "./noop-component/index.d.ts",
|
|
248
|
-
"default": "./noop-component/index.mjs"
|
|
249
|
-
},
|
|
250
|
-
"require": "./noop-component/index.cjs",
|
|
251
|
-
"default": "./noop-component/index.cjs"
|
|
252
|
-
},
|
|
253
244
|
"./nullthrow": {
|
|
254
245
|
"types": "./nullthrow/index.d.ts",
|
|
255
246
|
"import": {
|
|
@@ -259,6 +250,15 @@
|
|
|
259
250
|
"require": "./nullthrow/index.cjs",
|
|
260
251
|
"default": "./nullthrow/index.cjs"
|
|
261
252
|
},
|
|
253
|
+
"./noop-component": {
|
|
254
|
+
"types": "./noop-component/index.d.ts",
|
|
255
|
+
"import": {
|
|
256
|
+
"types": "./noop-component/index.d.ts",
|
|
257
|
+
"default": "./noop-component/index.mjs"
|
|
258
|
+
},
|
|
259
|
+
"require": "./noop-component/index.cjs",
|
|
260
|
+
"default": "./noop-component/index.cjs"
|
|
261
|
+
},
|
|
262
262
|
"./open-new-tab": {
|
|
263
263
|
"types": "./open-new-tab/index.d.ts",
|
|
264
264
|
"import": {
|
|
@@ -286,15 +286,6 @@
|
|
|
286
286
|
"require": "./request-idle-callback/index.cjs",
|
|
287
287
|
"default": "./request-idle-callback/index.cjs"
|
|
288
288
|
},
|
|
289
|
-
"./typescript-happy-forward-ref": {
|
|
290
|
-
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
291
|
-
"import": {
|
|
292
|
-
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
293
|
-
"default": "./typescript-happy-forward-ref/index.mjs"
|
|
294
|
-
},
|
|
295
|
-
"require": "./typescript-happy-forward-ref/index.cjs",
|
|
296
|
-
"default": "./typescript-happy-forward-ref/index.cjs"
|
|
297
|
-
},
|
|
298
289
|
"./types": {
|
|
299
290
|
"types": "./types/index.d.ts",
|
|
300
291
|
"import": {
|
|
@@ -304,6 +295,15 @@
|
|
|
304
295
|
"require": "./types/index.cjs",
|
|
305
296
|
"default": "./types/index.cjs"
|
|
306
297
|
},
|
|
298
|
+
"./typescript-happy-forward-ref": {
|
|
299
|
+
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
300
|
+
"import": {
|
|
301
|
+
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
302
|
+
"default": "./typescript-happy-forward-ref/index.mjs"
|
|
303
|
+
},
|
|
304
|
+
"require": "./typescript-happy-forward-ref/index.cjs",
|
|
305
|
+
"default": "./typescript-happy-forward-ref/index.cjs"
|
|
306
|
+
},
|
|
307
307
|
"./use": {
|
|
308
308
|
"types": "./use/index.d.ts",
|
|
309
309
|
"import": {
|
|
@@ -349,15 +349,6 @@
|
|
|
349
349
|
"require": "./use-component-will-receive-update/index.cjs",
|
|
350
350
|
"default": "./use-component-will-receive-update/index.cjs"
|
|
351
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
|
-
},
|
|
361
352
|
"./use-composition-input": {
|
|
362
353
|
"types": "./use-composition-input/index.d.ts",
|
|
363
354
|
"import": {
|
|
@@ -367,6 +358,15 @@
|
|
|
367
358
|
"require": "./use-composition-input/index.cjs",
|
|
368
359
|
"default": "./use-composition-input/index.cjs"
|
|
369
360
|
},
|
|
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
370
|
"./use-debounced-value": {
|
|
371
371
|
"types": "./use-debounced-value/index.d.ts",
|
|
372
372
|
"import": {
|
|
@@ -412,15 +412,6 @@
|
|
|
412
412
|
"require": "./use-is-client/index.cjs",
|
|
413
413
|
"default": "./use-is-client/index.cjs"
|
|
414
414
|
},
|
|
415
|
-
"./use-is-online": {
|
|
416
|
-
"types": "./use-is-online/index.d.ts",
|
|
417
|
-
"import": {
|
|
418
|
-
"types": "./use-is-online/index.d.ts",
|
|
419
|
-
"default": "./use-is-online/index.mjs"
|
|
420
|
-
},
|
|
421
|
-
"require": "./use-is-online/index.cjs",
|
|
422
|
-
"default": "./use-is-online/index.cjs"
|
|
423
|
-
},
|
|
424
415
|
"./use-isomorphic-layout-effect": {
|
|
425
416
|
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
426
417
|
"import": {
|
|
@@ -430,6 +421,15 @@
|
|
|
430
421
|
"require": "./use-isomorphic-layout-effect/index.cjs",
|
|
431
422
|
"default": "./use-isomorphic-layout-effect/index.cjs"
|
|
432
423
|
},
|
|
424
|
+
"./use-is-online": {
|
|
425
|
+
"types": "./use-is-online/index.d.ts",
|
|
426
|
+
"import": {
|
|
427
|
+
"types": "./use-is-online/index.d.ts",
|
|
428
|
+
"default": "./use-is-online/index.mjs"
|
|
429
|
+
},
|
|
430
|
+
"require": "./use-is-online/index.cjs",
|
|
431
|
+
"default": "./use-is-online/index.cjs"
|
|
432
|
+
},
|
|
433
433
|
"./use-local-storage": {
|
|
434
434
|
"types": "./use-local-storage/index.d.ts",
|
|
435
435
|
"import": {
|
|
@@ -448,15 +448,6 @@
|
|
|
448
448
|
"require": "./use-map/index.cjs",
|
|
449
449
|
"default": "./use-map/index.cjs"
|
|
450
450
|
},
|
|
451
|
-
"./use-page-visibility": {
|
|
452
|
-
"types": "./use-page-visibility/index.d.ts",
|
|
453
|
-
"import": {
|
|
454
|
-
"types": "./use-page-visibility/index.d.ts",
|
|
455
|
-
"default": "./use-page-visibility/index.mjs"
|
|
456
|
-
},
|
|
457
|
-
"require": "./use-page-visibility/index.cjs",
|
|
458
|
-
"default": "./use-page-visibility/index.cjs"
|
|
459
|
-
},
|
|
460
451
|
"./use-media-query": {
|
|
461
452
|
"types": "./use-media-query/index.d.ts",
|
|
462
453
|
"import": {
|
|
@@ -466,6 +457,15 @@
|
|
|
466
457
|
"require": "./use-media-query/index.cjs",
|
|
467
458
|
"default": "./use-media-query/index.cjs"
|
|
468
459
|
},
|
|
460
|
+
"./use-page-visibility": {
|
|
461
|
+
"types": "./use-page-visibility/index.d.ts",
|
|
462
|
+
"import": {
|
|
463
|
+
"types": "./use-page-visibility/index.d.ts",
|
|
464
|
+
"default": "./use-page-visibility/index.mjs"
|
|
465
|
+
},
|
|
466
|
+
"require": "./use-page-visibility/index.cjs",
|
|
467
|
+
"default": "./use-page-visibility/index.cjs"
|
|
468
|
+
},
|
|
469
469
|
"./use-readonly-search-params": {
|
|
470
470
|
"types": "./use-readonly-search-params/index.d.ts",
|
|
471
471
|
"import": {
|
|
@@ -493,15 +493,6 @@
|
|
|
493
493
|
"require": "./use-session-storage/index.cjs",
|
|
494
494
|
"default": "./use-session-storage/index.cjs"
|
|
495
495
|
},
|
|
496
|
-
"./use-set": {
|
|
497
|
-
"types": "./use-set/index.d.ts",
|
|
498
|
-
"import": {
|
|
499
|
-
"types": "./use-set/index.d.ts",
|
|
500
|
-
"default": "./use-set/index.mjs"
|
|
501
|
-
},
|
|
502
|
-
"require": "./use-set/index.cjs",
|
|
503
|
-
"default": "./use-set/index.cjs"
|
|
504
|
-
},
|
|
505
496
|
"./use-singleton": {
|
|
506
497
|
"types": "./use-singleton/index.d.ts",
|
|
507
498
|
"import": {
|
|
@@ -511,6 +502,15 @@
|
|
|
511
502
|
"require": "./use-singleton/index.cjs",
|
|
512
503
|
"default": "./use-singleton/index.cjs"
|
|
513
504
|
},
|
|
505
|
+
"./use-set": {
|
|
506
|
+
"types": "./use-set/index.d.ts",
|
|
507
|
+
"import": {
|
|
508
|
+
"types": "./use-set/index.d.ts",
|
|
509
|
+
"default": "./use-set/index.mjs"
|
|
510
|
+
},
|
|
511
|
+
"require": "./use-set/index.cjs",
|
|
512
|
+
"default": "./use-set/index.cjs"
|
|
513
|
+
},
|
|
514
514
|
"./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
|
|
515
515
|
"types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
|
|
516
516
|
"import": {
|
|
@@ -520,6 +520,15 @@
|
|
|
520
520
|
"require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
|
|
521
521
|
"default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs"
|
|
522
522
|
},
|
|
523
|
+
"./use-typescript-happy-callback": {
|
|
524
|
+
"types": "./use-typescript-happy-callback/index.d.ts",
|
|
525
|
+
"import": {
|
|
526
|
+
"types": "./use-typescript-happy-callback/index.d.ts",
|
|
527
|
+
"default": "./use-typescript-happy-callback/index.mjs"
|
|
528
|
+
},
|
|
529
|
+
"require": "./use-typescript-happy-callback/index.cjs",
|
|
530
|
+
"default": "./use-typescript-happy-callback/index.cjs"
|
|
531
|
+
},
|
|
523
532
|
"./use-state-with-deps": {
|
|
524
533
|
"types": "./use-state-with-deps/index.d.ts",
|
|
525
534
|
"import": {
|
|
@@ -538,15 +547,6 @@
|
|
|
538
547
|
"require": "./use-uncontrolled/index.cjs",
|
|
539
548
|
"default": "./use-uncontrolled/index.cjs"
|
|
540
549
|
},
|
|
541
|
-
"./use-typescript-happy-callback": {
|
|
542
|
-
"types": "./use-typescript-happy-callback/index.d.ts",
|
|
543
|
-
"import": {
|
|
544
|
-
"types": "./use-typescript-happy-callback/index.d.ts",
|
|
545
|
-
"default": "./use-typescript-happy-callback/index.mjs"
|
|
546
|
-
},
|
|
547
|
-
"require": "./use-typescript-happy-callback/index.cjs",
|
|
548
|
-
"default": "./use-typescript-happy-callback/index.cjs"
|
|
549
|
-
},
|
|
550
550
|
"./use-url-hash-state": {
|
|
551
551
|
"types": "./use-url-hash-state/index.d.ts",
|
|
552
552
|
"import": {
|
package/sizes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"total":{"raw":
|
|
1
|
+
{"total":{"raw":27314,"gzip":16298,"br":0},"exports":{"create-context-state":{"raw":145,"gzip":116,"br":96},"create-local-storage-state":{"raw":446,"gzip":222,"br":209},"create-fixed-array":{"raw":452,"gzip":282,"br":248},"context-reducer":{"raw":557,"gzip":332,"br":319},"create-context-reducer":{"raw":223,"gzip":146,"br":117},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"create-magic-portal":{"raw":268,"gzip":148,"br":121},"context-state":{"raw":402,"gzip":259,"br":218},"create-stackless-error":{"raw":278,"gzip":198,"br":162},"create-storage-state-factory":{"raw":620,"gzip":341,"br":290},"is-safari":{"raw":233,"gzip":164,"br":119},"current-year":{"raw":524,"gzip":355,"br":293},"invariant":{"raw":178,"gzip":156,"br":118},"create-session-storage-state":{"raw":450,"gzip":223,"br":206},"email-protection":{"raw":426,"gzip":321,"br":272},"create-storage-hook":{"raw":2462,"gzip":972,"br":852},"no-ssr":{"raw":338,"gzip":267,"br":219},"merge-refs":{"raw":525,"gzip":280,"br":235},"noop":{"raw":33,"gzip":53,"br":37},"fetch-jsonp":{"raw":890,"gzip":546,"br":429},"nullthrow":{"raw":187,"gzip":163,"br":121},"noop-component":{"raw":142,"gzip":130,"br":111},"open-new-tab":{"raw":335,"gzip":255,"br":187},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"magic-portal":{"raw":1083,"gzip":536,"br":472},"types":{"raw":0,"gzip":20,"br":1},"request-idle-callback":{"raw":392,"gzip":221,"br":171},"use":{"raw":298,"gzip":197,"br":160},"use-abortable-effect":{"raw":215,"gzip":170,"br":144},"rem":{"raw":823,"gzip":395,"br":350},"use-array":{"raw":322,"gzip":236,"br":202},"use-composition-input":{"raw":470,"gzip":286,"br":241},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-debounced-value":{"raw":524,"gzip":342,"br":286},"use-error-boundary":{"raw":252,"gzip":195,"br":165},"use-is-client":{"raw":204,"gzip":153,"br":121},"use-clipboard":{"raw":2723,"gzip":1332,"br":1140},"use-fast-click":{"raw":622,"gzip":392,"br":317},"use-isomorphic-layout-effect":{"raw":169,"gzip":137,"br":110},"use-is-online":{"raw":370,"gzip":258,"br":220},"use-local-storage":{"raw":428,"gzip":226,"br":198},"use-map":{"raw":339,"gzip":243,"br":208},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-retimer":{"raw":199,"gzip":166,"br":127},"use-page-visibility":{"raw":359,"gzip":263,"br":210},"use-media-query":{"raw":648,"gzip":397,"br":332},"use-singleton":{"raw":149,"gzip":135,"br":116},"use-readonly-search-params":{"raw":1164,"gzip":589,"br":496},"use-session-storage":{"raw":434,"gzip":225,"br":210},"use-set":{"raw":340,"gzip":238,"br":203},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-state-with-deps":{"raw":464,"gzip":321,"br":295},"use-uncontrolled":{"raw":388,"gzip":273,"br":230},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":450,"gzip":318,"br":249},"use-url-hash-state":{"raw":1121,"gzip":628,"br":556}}}
|
package/use-clipboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("../noop/index.cjs"),r=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs"),l=require("../use-typescript-happy-callback/index.cjs");class a extends Error{constructor(...e){var t;super(...e),(t="name")in this?Object.defineProperty(this,t,{value:"UseClipboardError",enumerable:!0,configurable:!0,writable:!0}):this[t]="UseClipboardError"}}async function o(e,t,r,l){let o;if("clipboard"in navigator)try{return await navigator.clipboard.writeText(e),!0}catch(e){(o=new a("[foxact/use-clipboard] Failed to copy using navigator.clipboard")).cause=e}else o=new a("[foxact/use-clipboard] navigator.clipboard is not supported");if(t){var n;let t;const r=document.activeElement,l=[],c=document.getSelection();let s=null,i=null!=(n=document.fullscreenElement)?n:document.body,u=r;for(;u;){if("DIALOG"===u.tagName&&u.open){i=u;break}u=u.parentElement}let d=null;try{if(c.rangeCount){for(let e=0;e<c.rangeCount;e++)l.push(c.getRangeAt(e));c.removeAllRanges()}((null==r?void 0:r.tagName)==="INPUT"||(null==r?void 0:r.tagName)==="TEXTAREA")&&(s=r).blur();const a=document.createRange();(d=document.createElement("span")).textContent=e,d.style.whiteSpace="pre",d.ariaHidden="true",d.style.all="unset",d.style.position="fixed",d.style.top="0",d.style.clip="rect(0, 0, 0, 0)",d.style.borderWidth="0",d.style.overflow="hidden",d.style.userSelect="text",d.style.webkitUserSelect="text",d.style.MozUserSelect="text",d.style.msUserSelect="text",d.addEventListener("copy",e=>{e.stopPropagation()}),i.appendChild(d),a.selectNodeContents(d),c.removeAllRanges(),c.addRange(a),t=document.execCommand("copy")}catch(e){(o=new a("[foxact/use-clipboard] Failed to copy using execCommand fallback")).cause=e,t=!1}finally{c.removeAllRanges(),d&&i.removeChild(d),"Caret"===c.type&&c.removeAllRanges(),c.rangeCount||l.forEach(e=>c.addRange(e)),null==s||s.focus()}if(t)return!0}return r?(window.prompt(l,e),!1):o}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:a=1e3,useExecCommandAsFallback:n=!0,usePromptAsFallback:c=!1,promptFallbackText:s="Failed to copy to clipboard, please manually copy the text below.",onCopyError:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,d]=e.useState(null),[p,y]=e.useState(!1),b=e.useRef(null),m=r.useStableHandler(i||t.noop),g=l.useCallback(e=>{b.current&&clearTimeout(b.current),e&&(b.current=window.setTimeout(()=>y(!1),a)),y(e)},[a]),f=l.useCallback(e=>{d(e),m(e)},[m]);return{copy:l.useCallback(async e=>{try{const t=await o(e,n,c,s);"boolean"==typeof t?t&&g(!0):f(t)}catch(e){f(e)}},[g,s,f,n,c]),reset:l.useCallback(()=>{y(!1),d(null),b.current&&clearTimeout(b.current)},[]),error:u,copied:p}};
|
package/use-clipboard/index.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
declare class UseClipboardError extends Error {
|
|
2
|
-
|
|
2
|
+
readonly name = "UseClipboardError";
|
|
3
3
|
}
|
|
4
4
|
interface UseClipboardOption {
|
|
5
5
|
timeout?: number;
|
|
6
|
+
/** @default true */
|
|
7
|
+
useExecCommandAsFallback?: boolean;
|
|
8
|
+
/** @default false */
|
|
6
9
|
usePromptAsFallback?: boolean;
|
|
7
10
|
promptFallbackText?: string;
|
|
8
11
|
onCopyError?: (error: Error) => void;
|
|
9
12
|
}
|
|
10
13
|
/** @see https://foxact.skk.moe/use-clipboard */
|
|
11
|
-
declare function useClipboard({ timeout, usePromptAsFallback, promptFallbackText, onCopyError }?: UseClipboardOption): {
|
|
14
|
+
declare function useClipboard({ timeout, useExecCommandAsFallback, usePromptAsFallback, promptFallbackText, onCopyError }?: UseClipboardOption): {
|
|
12
15
|
copy: (valueToCopy: string) => Promise<void>;
|
|
13
16
|
reset: () => void;
|
|
14
17
|
error: Error | null;
|
package/use-clipboard/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as
|
|
1
|
+
import"client-only";import{useState as e,useRef as t}from"react";import{noop as o}from"../noop/index.mjs";import{useStableHandler as r}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";import{useCallback as n}from"../use-typescript-happy-callback/index.mjs";class l extends Error{constructor(...e){var t;super(...e),(t="name")in this?Object.defineProperty(this,t,{value:"UseClipboardError",enumerable:!0,configurable:!0,writable:!0}):this[t]="UseClipboardError"}}function a(){let{timeout:l=1e3,useExecCommandAsFallback:a=!0,usePromptAsFallback:c=!1,promptFallbackText:s="Failed to copy to clipboard, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[d,p]=e(null),[m,y]=e(!1),b=t(null),f=r(u||o),g=n(e=>{b.current&&clearTimeout(b.current),e&&(b.current=window.setTimeout(()=>y(!1),l)),y(e)},[l]),h=n(e=>{p(e),f(e)},[f]);return{copy:n(async e=>{try{const t=await i(e,a,c,s);"boolean"==typeof t?t&&g(!0):h(t)}catch(e){h(e)}},[g,s,h,a,c]),reset:n(()=>{y(!1),p(null),b.current&&clearTimeout(b.current)},[]),error:d,copied:m}}async function i(e,t,o,r){let n;if("clipboard"in navigator)try{return await navigator.clipboard.writeText(e),!0}catch(e){(n=new l("[foxact/use-clipboard] Failed to copy using navigator.clipboard")).cause=e}else n=new l("[foxact/use-clipboard] navigator.clipboard is not supported");if(t){var a;let t;const o=document.activeElement,r=[],i=document.getSelection();let c=null,s=null!=(a=document.fullscreenElement)?a:document.body,u=o;for(;u;){if("DIALOG"===u.tagName&&u.open){s=u;break}u=u.parentElement}let d=null;try{if(i.rangeCount){for(let e=0;e<i.rangeCount;e++)r.push(i.getRangeAt(e));i.removeAllRanges()}((null==o?void 0:o.tagName)==="INPUT"||(null==o?void 0:o.tagName)==="TEXTAREA")&&(c=o).blur();const n=document.createRange();(d=document.createElement("span")).textContent=e,d.style.whiteSpace="pre",d.ariaHidden="true",d.style.all="unset",d.style.position="fixed",d.style.top="0",d.style.clip="rect(0, 0, 0, 0)",d.style.borderWidth="0",d.style.overflow="hidden",d.style.userSelect="text",d.style.webkitUserSelect="text",d.style.MozUserSelect="text",d.style.msUserSelect="text",d.addEventListener("copy",e=>{e.stopPropagation()}),s.appendChild(d),n.selectNodeContents(d),i.removeAllRanges(),i.addRange(n),t=document.execCommand("copy")}catch(e){(n=new l("[foxact/use-clipboard] Failed to copy using execCommand fallback")).cause=e,t=!1}finally{i.removeAllRanges(),d&&s.removeChild(d),"Caret"===i.type&&i.removeAllRanges(),i.rangeCount||r.forEach(e=>i.addRange(e)),null==c||c.focus()}if(t)return!0}return o?(window.prompt(r,e),!1):n}export{l as UseClipboardError,a as useClipboard};
|