foxact 0.2.26 → 0.2.28

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.
Files changed (111) hide show
  1. package/compose-context-provider/index.cjs +1 -1
  2. package/compose-context-provider/index.js +1 -1
  3. package/compose-context-provider/index.mjs +1 -1
  4. package/context-state/index.cjs +1 -1
  5. package/context-state/index.js +1 -1
  6. package/context-state/index.mjs +1 -1
  7. package/create-context-state/index.cjs +1 -1
  8. package/create-context-state/index.js +1 -1
  9. package/create-context-state/index.mjs +1 -1
  10. package/create-fixed-array/index.cjs +1 -1
  11. package/create-fixed-array/index.js +1 -1
  12. package/create-fixed-array/index.mjs +1 -1
  13. package/create-storage-hook/index.cjs +1 -0
  14. package/create-storage-hook/index.d.ts +27 -0
  15. package/create-storage-hook/index.js +1 -0
  16. package/create-storage-hook/index.mjs +1 -0
  17. package/invariant/index.cjs +1 -0
  18. package/invariant/index.d.ts +4 -0
  19. package/invariant/index.js +1 -0
  20. package/invariant/index.mjs +1 -0
  21. package/no-ssr/index.cjs +1 -1
  22. package/no-ssr/index.js +1 -1
  23. package/no-ssr/index.mjs +1 -1
  24. package/noop/index.cjs +1 -1
  25. package/noop/index.js +1 -1
  26. package/noop/index.mjs +1 -1
  27. package/nullthrow/index.cjs +1 -0
  28. package/nullthrow/index.d.ts +4 -0
  29. package/nullthrow/index.js +1 -0
  30. package/nullthrow/index.mjs +1 -0
  31. package/package.json +194 -157
  32. package/rem/index.cjs +1 -1
  33. package/rem/index.js +1 -1
  34. package/rem/index.mjs +1 -1
  35. package/request-idle-callback/index.cjs +1 -1
  36. package/request-idle-callback/index.js +1 -1
  37. package/request-idle-callback/index.mjs +1 -1
  38. package/sizes.json +1 -1
  39. package/typescript-happy-forward-ref/index.cjs +1 -1
  40. package/typescript-happy-forward-ref/index.js +1 -1
  41. package/typescript-happy-forward-ref/index.mjs +1 -1
  42. package/use/index.cjs +1 -1
  43. package/use/index.js +1 -1
  44. package/use/index.mjs +1 -1
  45. package/use-array/index.cjs +1 -1
  46. package/use-array/index.js +1 -1
  47. package/use-array/index.mjs +1 -1
  48. package/use-clipboard/index.cjs +1 -1
  49. package/use-clipboard/index.js +1 -1
  50. package/use-clipboard/index.mjs +1 -1
  51. package/use-composition-input/index.cjs +1 -1
  52. package/use-composition-input/index.js +1 -1
  53. package/use-composition-input/index.mjs +1 -1
  54. package/use-debounced-state/index.cjs +1 -1
  55. package/use-debounced-state/index.js +1 -1
  56. package/use-debounced-state/index.mjs +1 -1
  57. package/use-debounced-value/index.cjs +1 -1
  58. package/use-debounced-value/index.js +1 -1
  59. package/use-debounced-value/index.mjs +1 -1
  60. package/use-error-boundary/index.cjs +1 -1
  61. package/use-error-boundary/index.js +1 -1
  62. package/use-error-boundary/index.mjs +1 -1
  63. package/use-intersection/index.cjs +1 -1
  64. package/use-intersection/index.js +1 -1
  65. package/use-intersection/index.mjs +1 -1
  66. package/use-is-client/index.cjs +1 -1
  67. package/use-is-client/index.js +1 -1
  68. package/use-is-client/index.mjs +1 -1
  69. package/use-isomorphic-layout-effect/index.cjs +1 -1
  70. package/use-isomorphic-layout-effect/index.d.ts +3 -3
  71. package/use-isomorphic-layout-effect/index.js +1 -1
  72. package/use-isomorphic-layout-effect/index.mjs +1 -1
  73. package/use-local-storage/index.cjs +1 -1
  74. package/use-local-storage/index.d.ts +5 -21
  75. package/use-local-storage/index.js +1 -1
  76. package/use-local-storage/index.mjs +1 -1
  77. package/use-map/index.cjs +1 -1
  78. package/use-map/index.js +1 -1
  79. package/use-map/index.mjs +1 -1
  80. package/use-next-pathname/index.cjs +1 -1
  81. package/use-next-pathname/index.js +1 -1
  82. package/use-next-pathname/index.mjs +1 -1
  83. package/use-react-router-enable-concurrent-navigation/index.cjs +1 -1
  84. package/use-react-router-enable-concurrent-navigation/index.js +1 -1
  85. package/use-react-router-enable-concurrent-navigation/index.mjs +1 -1
  86. package/use-react-router-is-match/index.cjs +1 -1
  87. package/use-react-router-is-match/index.js +1 -1
  88. package/use-react-router-is-match/index.mjs +1 -1
  89. package/use-retimer/index.cjs +1 -1
  90. package/use-retimer/index.js +1 -1
  91. package/use-retimer/index.mjs +1 -1
  92. package/use-session-storage/index.cjs +1 -0
  93. package/use-session-storage/index.d.ts +8 -0
  94. package/use-session-storage/index.js +1 -0
  95. package/use-session-storage/index.mjs +1 -0
  96. package/use-set/index.cjs +1 -1
  97. package/use-set/index.js +1 -1
  98. package/use-set/index.mjs +1 -1
  99. package/use-singleton/index.cjs +1 -1
  100. package/use-singleton/index.js +1 -1
  101. package/use-singleton/index.mjs +1 -1
  102. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs +1 -1
  103. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js +1 -1
  104. package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs +1 -1
  105. package/use-uncontrolled/index.cjs +1 -1
  106. package/use-uncontrolled/index.js +1 -1
  107. package/use-uncontrolled/index.mjs +1 -1
  108. package/use-url-hash-state/index.cjs +1 -1
  109. package/use-url-hash-state/index.d.ts +13 -3
  110. package/use-url-hash-state/index.js +1 -1
  111. package/use-url-hash-state/index.mjs +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.26",
3
+ "version": "0.2.28",
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": {
@@ -22,6 +22,7 @@
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "client-only": "^0.0.1",
25
+ "rollup-preserve-directives": "^1.1.0",
25
26
  "server-only": "^0.0.1"
26
27
  },
27
28
  "peerDependencies": {
@@ -65,41 +66,41 @@
65
66
  "exports": {
66
67
  "./package.json": "./package.json",
67
68
  "./sizes.json": "./sizes.json",
68
- "./compose-context-provider": {
69
- "types": "./compose-context-provider/index.d.ts",
69
+ "./nullthrow": {
70
+ "types": "./nullthrow/index.d.ts",
70
71
  "import": {
71
- "types": "./compose-context-provider/index.d.ts",
72
- "default": "./compose-context-provider/index.mjs"
72
+ "types": "./nullthrow/index.d.ts",
73
+ "default": "./nullthrow/index.mjs"
73
74
  },
74
- "require": "./compose-context-provider/index.cjs",
75
- "default": "./compose-context-provider/index.js"
75
+ "require": "./nullthrow/index.cjs",
76
+ "default": "./nullthrow/index.js"
76
77
  },
77
- "./context-state": {
78
- "types": "./context-state/index.d.ts",
78
+ "./use-uncontrolled": {
79
+ "types": "./use-uncontrolled/index.d.ts",
79
80
  "import": {
80
- "types": "./context-state/index.d.ts",
81
- "default": "./context-state/index.mjs"
81
+ "types": "./use-uncontrolled/index.d.ts",
82
+ "default": "./use-uncontrolled/index.mjs"
82
83
  },
83
- "require": "./context-state/index.cjs",
84
- "default": "./context-state/index.js"
84
+ "require": "./use-uncontrolled/index.cjs",
85
+ "default": "./use-uncontrolled/index.js"
85
86
  },
86
- "./no-ssr": {
87
- "types": "./no-ssr/index.d.ts",
87
+ "./use-retimer": {
88
+ "types": "./use-retimer/index.d.ts",
88
89
  "import": {
89
- "types": "./no-ssr/index.d.ts",
90
- "default": "./no-ssr/index.mjs"
90
+ "types": "./use-retimer/index.d.ts",
91
+ "default": "./use-retimer/index.mjs"
91
92
  },
92
- "require": "./no-ssr/index.cjs",
93
- "default": "./no-ssr/index.js"
93
+ "require": "./use-retimer/index.cjs",
94
+ "default": "./use-retimer/index.js"
94
95
  },
95
- "./noop": {
96
- "types": "./noop/index.d.ts",
96
+ "./use-error-boundary": {
97
+ "types": "./use-error-boundary/index.d.ts",
97
98
  "import": {
98
- "types": "./noop/index.d.ts",
99
- "default": "./noop/index.mjs"
99
+ "types": "./use-error-boundary/index.d.ts",
100
+ "default": "./use-error-boundary/index.mjs"
100
101
  },
101
- "require": "./noop/index.cjs",
102
- "default": "./noop/index.js"
102
+ "require": "./use-error-boundary/index.cjs",
103
+ "default": "./use-error-boundary/index.js"
103
104
  },
104
105
  "./rem": {
105
106
  "types": "./rem/index.d.ts",
@@ -110,41 +111,59 @@
110
111
  "require": "./rem/index.cjs",
111
112
  "default": "./rem/index.js"
112
113
  },
113
- "./create-context-state": {
114
- "types": "./create-context-state/index.d.ts",
114
+ "./use-url-hash-state": {
115
+ "types": "./use-url-hash-state/index.d.ts",
115
116
  "import": {
116
- "types": "./create-context-state/index.d.ts",
117
- "default": "./create-context-state/index.mjs"
117
+ "types": "./use-url-hash-state/index.d.ts",
118
+ "default": "./use-url-hash-state/index.mjs"
118
119
  },
119
- "require": "./create-context-state/index.cjs",
120
- "default": "./create-context-state/index.js"
120
+ "require": "./use-url-hash-state/index.cjs",
121
+ "default": "./use-url-hash-state/index.js"
121
122
  },
122
- "./create-fixed-array": {
123
- "types": "./create-fixed-array/index.d.ts",
123
+ "./use-is-client": {
124
+ "types": "./use-is-client/index.d.ts",
124
125
  "import": {
125
- "types": "./create-fixed-array/index.d.ts",
126
- "default": "./create-fixed-array/index.mjs"
126
+ "types": "./use-is-client/index.d.ts",
127
+ "default": "./use-is-client/index.mjs"
127
128
  },
128
- "require": "./create-fixed-array/index.cjs",
129
- "default": "./create-fixed-array/index.js"
129
+ "require": "./use-is-client/index.cjs",
130
+ "default": "./use-is-client/index.js"
130
131
  },
131
- "./request-idle-callback": {
132
- "types": "./request-idle-callback/index.d.ts",
132
+ "./use-debounced-state": {
133
+ "types": "./use-debounced-state/index.d.ts",
133
134
  "import": {
134
- "types": "./request-idle-callback/index.d.ts",
135
- "default": "./request-idle-callback/index.mjs"
135
+ "types": "./use-debounced-state/index.d.ts",
136
+ "default": "./use-debounced-state/index.mjs"
136
137
  },
137
- "require": "./request-idle-callback/index.cjs",
138
- "default": "./request-idle-callback/index.js"
138
+ "require": "./use-debounced-state/index.cjs",
139
+ "default": "./use-debounced-state/index.js"
139
140
  },
140
- "./typescript-happy-forward-ref": {
141
- "types": "./typescript-happy-forward-ref/index.d.ts",
141
+ "./noop": {
142
+ "types": "./noop/index.d.ts",
142
143
  "import": {
143
- "types": "./typescript-happy-forward-ref/index.d.ts",
144
- "default": "./typescript-happy-forward-ref/index.mjs"
144
+ "types": "./noop/index.d.ts",
145
+ "default": "./noop/index.mjs"
145
146
  },
146
- "require": "./typescript-happy-forward-ref/index.cjs",
147
- "default": "./typescript-happy-forward-ref/index.js"
147
+ "require": "./noop/index.cjs",
148
+ "default": "./noop/index.js"
149
+ },
150
+ "./use-set": {
151
+ "types": "./use-set/index.d.ts",
152
+ "import": {
153
+ "types": "./use-set/index.d.ts",
154
+ "default": "./use-set/index.mjs"
155
+ },
156
+ "require": "./use-set/index.cjs",
157
+ "default": "./use-set/index.js"
158
+ },
159
+ "./use-map": {
160
+ "types": "./use-map/index.d.ts",
161
+ "import": {
162
+ "types": "./use-map/index.d.ts",
163
+ "default": "./use-map/index.mjs"
164
+ },
165
+ "require": "./use-map/index.cjs",
166
+ "default": "./use-map/index.js"
148
167
  },
149
168
  "./use": {
150
169
  "types": "./use/index.d.ts",
@@ -155,59 +174,50 @@
155
174
  "require": "./use/index.cjs",
156
175
  "default": "./use/index.js"
157
176
  },
158
- "./use-array": {
159
- "types": "./use-array/index.d.ts",
160
- "import": {
161
- "types": "./use-array/index.d.ts",
162
- "default": "./use-array/index.mjs"
163
- },
164
- "require": "./use-array/index.cjs",
165
- "default": "./use-array/index.js"
166
- },
167
- "./use-clipboard": {
168
- "types": "./use-clipboard/index.d.ts",
177
+ "./typescript-happy-forward-ref": {
178
+ "types": "./typescript-happy-forward-ref/index.d.ts",
169
179
  "import": {
170
- "types": "./use-clipboard/index.d.ts",
171
- "default": "./use-clipboard/index.mjs"
180
+ "types": "./typescript-happy-forward-ref/index.d.ts",
181
+ "default": "./typescript-happy-forward-ref/index.mjs"
172
182
  },
173
- "require": "./use-clipboard/index.cjs",
174
- "default": "./use-clipboard/index.js"
183
+ "require": "./typescript-happy-forward-ref/index.cjs",
184
+ "default": "./typescript-happy-forward-ref/index.js"
175
185
  },
176
- "./use-composition-input": {
177
- "types": "./use-composition-input/index.d.ts",
186
+ "./compose-context-provider": {
187
+ "types": "./compose-context-provider/index.d.ts",
178
188
  "import": {
179
- "types": "./use-composition-input/index.d.ts",
180
- "default": "./use-composition-input/index.mjs"
189
+ "types": "./compose-context-provider/index.d.ts",
190
+ "default": "./compose-context-provider/index.mjs"
181
191
  },
182
- "require": "./use-composition-input/index.cjs",
183
- "default": "./use-composition-input/index.js"
192
+ "require": "./compose-context-provider/index.cjs",
193
+ "default": "./compose-context-provider/index.js"
184
194
  },
185
- "./use-debounced-state": {
186
- "types": "./use-debounced-state/index.d.ts",
195
+ "./use-react-router-is-match": {
196
+ "types": "./use-react-router-is-match/index.d.ts",
187
197
  "import": {
188
- "types": "./use-debounced-state/index.d.ts",
189
- "default": "./use-debounced-state/index.mjs"
198
+ "types": "./use-react-router-is-match/index.d.ts",
199
+ "default": "./use-react-router-is-match/index.mjs"
190
200
  },
191
- "require": "./use-debounced-state/index.cjs",
192
- "default": "./use-debounced-state/index.js"
201
+ "require": "./use-react-router-is-match/index.cjs",
202
+ "default": "./use-react-router-is-match/index.js"
193
203
  },
194
- "./use-debounced-value": {
195
- "types": "./use-debounced-value/index.d.ts",
204
+ "./request-idle-callback": {
205
+ "types": "./request-idle-callback/index.d.ts",
196
206
  "import": {
197
- "types": "./use-debounced-value/index.d.ts",
198
- "default": "./use-debounced-value/index.mjs"
207
+ "types": "./request-idle-callback/index.d.ts",
208
+ "default": "./request-idle-callback/index.mjs"
199
209
  },
200
- "require": "./use-debounced-value/index.cjs",
201
- "default": "./use-debounced-value/index.js"
210
+ "require": "./request-idle-callback/index.cjs",
211
+ "default": "./request-idle-callback/index.js"
202
212
  },
203
- "./use-error-boundary": {
204
- "types": "./use-error-boundary/index.d.ts",
213
+ "./use-singleton": {
214
+ "types": "./use-singleton/index.d.ts",
205
215
  "import": {
206
- "types": "./use-error-boundary/index.d.ts",
207
- "default": "./use-error-boundary/index.mjs"
216
+ "types": "./use-singleton/index.d.ts",
217
+ "default": "./use-singleton/index.mjs"
208
218
  },
209
- "require": "./use-error-boundary/index.cjs",
210
- "default": "./use-error-boundary/index.js"
219
+ "require": "./use-singleton/index.cjs",
220
+ "default": "./use-singleton/index.js"
211
221
  },
212
222
  "./use-intersection": {
213
223
  "types": "./use-intersection/index.d.ts",
@@ -218,41 +228,50 @@
218
228
  "require": "./use-intersection/index.cjs",
219
229
  "default": "./use-intersection/index.js"
220
230
  },
221
- "./use-is-client": {
222
- "types": "./use-is-client/index.d.ts",
231
+ "./no-ssr": {
232
+ "types": "./no-ssr/index.d.ts",
223
233
  "import": {
224
- "types": "./use-is-client/index.d.ts",
225
- "default": "./use-is-client/index.mjs"
234
+ "types": "./no-ssr/index.d.ts",
235
+ "default": "./no-ssr/index.mjs"
226
236
  },
227
- "require": "./use-is-client/index.cjs",
228
- "default": "./use-is-client/index.js"
237
+ "require": "./no-ssr/index.cjs",
238
+ "default": "./no-ssr/index.js"
229
239
  },
230
- "./use-isomorphic-layout-effect": {
231
- "types": "./use-isomorphic-layout-effect/index.d.ts",
240
+ "./create-fixed-array": {
241
+ "types": "./create-fixed-array/index.d.ts",
232
242
  "import": {
233
- "types": "./use-isomorphic-layout-effect/index.d.ts",
234
- "default": "./use-isomorphic-layout-effect/index.mjs"
243
+ "types": "./create-fixed-array/index.d.ts",
244
+ "default": "./create-fixed-array/index.mjs"
235
245
  },
236
- "require": "./use-isomorphic-layout-effect/index.cjs",
237
- "default": "./use-isomorphic-layout-effect/index.js"
246
+ "require": "./create-fixed-array/index.cjs",
247
+ "default": "./create-fixed-array/index.js"
238
248
  },
239
- "./use-local-storage": {
240
- "types": "./use-local-storage/index.d.ts",
249
+ "./use-clipboard": {
250
+ "types": "./use-clipboard/index.d.ts",
241
251
  "import": {
242
- "types": "./use-local-storage/index.d.ts",
243
- "default": "./use-local-storage/index.mjs"
252
+ "types": "./use-clipboard/index.d.ts",
253
+ "default": "./use-clipboard/index.mjs"
244
254
  },
245
- "require": "./use-local-storage/index.cjs",
246
- "default": "./use-local-storage/index.js"
255
+ "require": "./use-clipboard/index.cjs",
256
+ "default": "./use-clipboard/index.js"
247
257
  },
248
- "./use-map": {
249
- "types": "./use-map/index.d.ts",
258
+ "./use-react-router-enable-concurrent-navigation": {
259
+ "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
250
260
  "import": {
251
- "types": "./use-map/index.d.ts",
252
- "default": "./use-map/index.mjs"
261
+ "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
262
+ "default": "./use-react-router-enable-concurrent-navigation/index.mjs"
253
263
  },
254
- "require": "./use-map/index.cjs",
255
- "default": "./use-map/index.js"
264
+ "require": "./use-react-router-enable-concurrent-navigation/index.cjs",
265
+ "default": "./use-react-router-enable-concurrent-navigation/index.js"
266
+ },
267
+ "./use-composition-input": {
268
+ "types": "./use-composition-input/index.d.ts",
269
+ "import": {
270
+ "types": "./use-composition-input/index.d.ts",
271
+ "default": "./use-composition-input/index.mjs"
272
+ },
273
+ "require": "./use-composition-input/index.cjs",
274
+ "default": "./use-composition-input/index.js"
256
275
  },
257
276
  "./use-next-pathname": {
258
277
  "types": "./use-next-pathname/index.d.ts",
@@ -263,50 +282,41 @@
263
282
  "require": "./use-next-pathname/index.cjs",
264
283
  "default": "./use-next-pathname/index.js"
265
284
  },
266
- "./use-react-router-enable-concurrent-navigation": {
267
- "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
268
- "import": {
269
- "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
270
- "default": "./use-react-router-enable-concurrent-navigation/index.mjs"
271
- },
272
- "require": "./use-react-router-enable-concurrent-navigation/index.cjs",
273
- "default": "./use-react-router-enable-concurrent-navigation/index.js"
274
- },
275
- "./use-react-router-is-match": {
276
- "types": "./use-react-router-is-match/index.d.ts",
285
+ "./use-session-storage": {
286
+ "types": "./use-session-storage/index.d.ts",
277
287
  "import": {
278
- "types": "./use-react-router-is-match/index.d.ts",
279
- "default": "./use-react-router-is-match/index.mjs"
288
+ "types": "./use-session-storage/index.d.ts",
289
+ "default": "./use-session-storage/index.mjs"
280
290
  },
281
- "require": "./use-react-router-is-match/index.cjs",
282
- "default": "./use-react-router-is-match/index.js"
291
+ "require": "./use-session-storage/index.cjs",
292
+ "default": "./use-session-storage/index.js"
283
293
  },
284
- "./use-retimer": {
285
- "types": "./use-retimer/index.d.ts",
294
+ "./invariant": {
295
+ "types": "./invariant/index.d.ts",
286
296
  "import": {
287
- "types": "./use-retimer/index.d.ts",
288
- "default": "./use-retimer/index.mjs"
297
+ "types": "./invariant/index.d.ts",
298
+ "default": "./invariant/index.mjs"
289
299
  },
290
- "require": "./use-retimer/index.cjs",
291
- "default": "./use-retimer/index.js"
300
+ "require": "./invariant/index.cjs",
301
+ "default": "./invariant/index.js"
292
302
  },
293
- "./use-set": {
294
- "types": "./use-set/index.d.ts",
303
+ "./use-debounced-value": {
304
+ "types": "./use-debounced-value/index.d.ts",
295
305
  "import": {
296
- "types": "./use-set/index.d.ts",
297
- "default": "./use-set/index.mjs"
306
+ "types": "./use-debounced-value/index.d.ts",
307
+ "default": "./use-debounced-value/index.mjs"
298
308
  },
299
- "require": "./use-set/index.cjs",
300
- "default": "./use-set/index.js"
309
+ "require": "./use-debounced-value/index.cjs",
310
+ "default": "./use-debounced-value/index.js"
301
311
  },
302
- "./use-singleton": {
303
- "types": "./use-singleton/index.d.ts",
312
+ "./create-storage-hook": {
313
+ "types": "./create-storage-hook/index.d.ts",
304
314
  "import": {
305
- "types": "./use-singleton/index.d.ts",
306
- "default": "./use-singleton/index.mjs"
315
+ "types": "./create-storage-hook/index.d.ts",
316
+ "default": "./create-storage-hook/index.mjs"
307
317
  },
308
- "require": "./use-singleton/index.cjs",
309
- "default": "./use-singleton/index.js"
318
+ "require": "./create-storage-hook/index.cjs",
319
+ "default": "./create-storage-hook/index.js"
310
320
  },
311
321
  "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
312
322
  "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
@@ -317,23 +327,50 @@
317
327
  "require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
318
328
  "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
319
329
  },
320
- "./use-uncontrolled": {
321
- "types": "./use-uncontrolled/index.d.ts",
330
+ "./context-state": {
331
+ "types": "./context-state/index.d.ts",
322
332
  "import": {
323
- "types": "./use-uncontrolled/index.d.ts",
324
- "default": "./use-uncontrolled/index.mjs"
333
+ "types": "./context-state/index.d.ts",
334
+ "default": "./context-state/index.mjs"
325
335
  },
326
- "require": "./use-uncontrolled/index.cjs",
327
- "default": "./use-uncontrolled/index.js"
336
+ "require": "./context-state/index.cjs",
337
+ "default": "./context-state/index.js"
328
338
  },
329
- "./use-url-hash-state": {
330
- "types": "./use-url-hash-state/index.d.ts",
339
+ "./use-local-storage": {
340
+ "types": "./use-local-storage/index.d.ts",
331
341
  "import": {
332
- "types": "./use-url-hash-state/index.d.ts",
333
- "default": "./use-url-hash-state/index.mjs"
342
+ "types": "./use-local-storage/index.d.ts",
343
+ "default": "./use-local-storage/index.mjs"
334
344
  },
335
- "require": "./use-url-hash-state/index.cjs",
336
- "default": "./use-url-hash-state/index.js"
345
+ "require": "./use-local-storage/index.cjs",
346
+ "default": "./use-local-storage/index.js"
347
+ },
348
+ "./use-isomorphic-layout-effect": {
349
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
350
+ "import": {
351
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
352
+ "default": "./use-isomorphic-layout-effect/index.mjs"
353
+ },
354
+ "require": "./use-isomorphic-layout-effect/index.cjs",
355
+ "default": "./use-isomorphic-layout-effect/index.js"
356
+ },
357
+ "./create-context-state": {
358
+ "types": "./create-context-state/index.d.ts",
359
+ "import": {
360
+ "types": "./create-context-state/index.d.ts",
361
+ "default": "./create-context-state/index.mjs"
362
+ },
363
+ "require": "./create-context-state/index.cjs",
364
+ "default": "./create-context-state/index.js"
365
+ },
366
+ "./use-array": {
367
+ "types": "./use-array/index.d.ts",
368
+ "import": {
369
+ "types": "./use-array/index.d.ts",
370
+ "default": "./use-array/index.mjs"
371
+ },
372
+ "require": "./use-array/index.cjs",
373
+ "default": "./use-array/index.js"
337
374
  }
338
375
  }
339
376
  }
package/rem/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const n="16px";function e(n,e){return"calc(".concat(n," * ").concat(e,")")}function t(t){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(t);return c&&c!==n?e(o,c):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(t))return c&&c!==n?e(r,c):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(t);return c&&c!==n?e(r,c):r}return r}}const c=t("rem",n),r=t("rem","var(--mantine-scale)"),o=t("em");exports.em=o,exports.mantine_rem=r,exports.rem=c;
1
+ "use strict";const n="16px";function e(n,e){return"calc(".concat(n," * ").concat(e,")")}function t(t){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(t);return c&&c!==n?e(o,c):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(t))return c&&c!==n?e(r,c):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(t);return c&&c!==n?e(r,c):r}return r}}const c=t("rem",n),r=t("rem","var(--mantine-scale)"),o=t("em");exports.em=o,exports.mantine_rem=r,exports.rem=c;
package/rem/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const n="16px";function e(n,e){return"calc(".concat(n," * ").concat(e,")")}function t(t){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(t);return c&&c!==n?e(o,c):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(t))return c&&c!==n?e(r,c):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(t);return c&&c!==n?e(r,c):r}return r}}const c=t("rem",n),r=t("rem","var(--mantine-scale)"),o=t("em");exports.em=o,exports.mantine_rem=r,exports.rem=c;
1
+ "use strict";const n="16px";function e(n,e){return"calc(".concat(n," * ").concat(e,")")}function t(t){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(t);return c&&c!==n?e(o,c):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(t))return c&&c!==n?e(r,c):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(t);return c&&c!==n?e(r,c):r}return r}}const c=t("rem",n),r=t("rem","var(--mantine-scale)"),o=t("em");exports.em=o,exports.mantine_rem=r,exports.rem=c;
package/rem/index.mjs CHANGED
@@ -1 +1 @@
1
- const n="16px";function c(n,c){return"calc(".concat(n," * ").concat(c,")")}function e(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(e);return t&&t!==n?c(o,t):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(e))return t&&t!==n?c(r,t):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(e);return t&&t!==n?c(r,t):r}return r}}const t=e("rem",n),r=e("rem","var(--mantine-scale)"),o=e("em");export{o as em,r as mantine_rem,t as rem};
1
+ const n="16px";function c(n,c){return"calc(".concat(n," * ").concat(c,")")}function e(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r=>{if(0===r||"0"===r)return"0";if("number"==typeof r){const o="".concat(r/16).concat(e);return t&&t!==n?c(o,t):o}if(r.includes("calc(")||r.includes("var("))return r;if(r.includes(e))return t&&t!==n?c(r,t):r;const o=Number(r.replace("px",""));if(o==o){const r="".concat(o/16).concat(e);return t&&t!==n?c(r,t):r}return r}}const t=e("rem",n),r=e("rem","var(--mantine-scale)"),o=e("em");export{o as em,r as mantine_rem,t as rem};
@@ -1 +1 @@
1
- "use strict";const e="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(self)||function(e){const l=Date.now();return self.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-l))})},1)},l="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(self)||function(e){return clearTimeout(e)};exports.cancelIdleCallback=l,exports.requestIdleCallback=e;
1
+ "use strict";const e="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(self)||function(e){const l=Date.now();return self.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-l))})},1)},l="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(self)||function(e){return clearTimeout(e)};exports.cancelIdleCallback=l,exports.requestIdleCallback=e;
@@ -1 +1 @@
1
- "use strict";const e="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(self)||function(e){const l=Date.now();return self.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-l))})},1)},l="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(self)||function(e){return clearTimeout(e)};exports.cancelIdleCallback=l,exports.requestIdleCallback=e;
1
+ "use strict";const e="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(self)||function(e){const l=Date.now();return self.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-l))})},1)},l="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(self)||function(e){return clearTimeout(e)};exports.cancelIdleCallback=l,exports.requestIdleCallback=e;
@@ -1 +1 @@
1
- const e="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(self)||function(e){const l=Date.now();return self.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-l))})},1)},l="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(self)||function(e){return clearTimeout(e)};export{l as cancelIdleCallback,e as requestIdleCallback};
1
+ const e="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(self)||function(e){const l=Date.now();return self.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-l))})},1)},l="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(self)||function(e){return clearTimeout(e)};export{l as cancelIdleCallback,e as requestIdleCallback};
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":13245,"gzip":8332,"br":0},"exports":{"noop":{"raw":34,"gzip":54,"br":38},"compose-context-provider":{"raw":165,"gzip":150,"br":118},"context-state":{"raw":378,"gzip":243,"br":210},"create-context-state":{"raw":146,"gzip":116,"br":102},"no-ssr":{"raw":187,"gzip":172,"br":143},"create-fixed-array":{"raw":101,"gzip":105,"br":89},"rem":{"raw":589,"gzip":331,"br":285},"use":{"raw":277,"gzip":185,"br":155},"request-idle-callback":{"raw":411,"gzip":232,"br":179},"use-array":{"raw":338,"gzip":247,"br":207},"typescript-happy-forward-ref":{"raw":120,"gzip":104,"br":95},"use-composition-input":{"raw":455,"gzip":282,"br":240},"use-debounced-state":{"raw":410,"gzip":291,"br":247},"use-debounced-value":{"raw":471,"gzip":313,"br":254},"use-clipboard":{"raw":1076,"gzip":617,"br":533},"use-error-boundary":{"raw":245,"gzip":197,"br":173},"use-is-client":{"raw":152,"gzip":144,"br":122},"use-isomorphic-layout-effect":{"raw":179,"gzip":145,"br":115},"use-map":{"raw":355,"gzip":249,"br":213},"use-next-pathname":{"raw":322,"gzip":242,"br":202},"use-intersection":{"raw":1239,"gzip":659,"br":605},"use-local-storage":{"raw":1645,"gzip":763,"br":665},"use-retimer":{"raw":201,"gzip":168,"br":127},"use-react-router-is-match":{"raw":569,"gzip":371,"br":313},"use-react-router-enable-concurrent-navigation":{"raw":956,"gzip":455,"br":382},"use-singleton":{"raw":139,"gzip":131,"br":104},"use-set":{"raw":356,"gzip":243,"br":208},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":467,"gzip":326,"br":257},"use-uncontrolled":{"raw":301,"gzip":232,"br":197},"use-url-hash-state":{"raw":961,"gzip":565,"br":487}}}
1
+ {"total":{"raw":14693,"gzip":9118,"br":0},"exports":{"nullthrow":{"raw":169,"gzip":149,"br":109},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"use-is-client":{"raw":151,"gzip":142,"br":118},"rem":{"raw":588,"gzip":330,"br":282},"noop":{"raw":33,"gzip":53,"br":37},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-url-hash-state":{"raw":1069,"gzip":613,"br":534},"use":{"raw":276,"gzip":182,"br":150},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"use-set":{"raw":347,"gzip":240,"br":203},"use-map":{"raw":346,"gzip":244,"br":210},"compose-context-provider":{"raw":164,"gzip":148,"br":114},"use-singleton":{"raw":138,"gzip":129,"br":109},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"use-react-router-is-match":{"raw":568,"gzip":371,"br":309},"create-fixed-array":{"raw":100,"gzip":104,"br":89},"no-ssr":{"raw":389,"gzip":269,"br":228},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-composition-input":{"raw":454,"gzip":281,"br":238},"use-react-router-enable-concurrent-navigation":{"raw":955,"gzip":457,"br":375},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-session-storage":{"raw":316,"gzip":181,"br":152},"invariant":{"raw":90,"gzip":100,"br":71},"use-clipboard":{"raw":1067,"gzip":611,"br":525},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":254},"context-state":{"raw":377,"gzip":241,"br":207},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"create-context-state":{"raw":145,"gzip":116,"br":96},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-array":{"raw":329,"gzip":238,"br":199},"create-storage-hook":{"raw":1984,"gzip":874,"br":760}}}
@@ -1 +1 @@
1
- "use strict";var r=require("react");const e=r.forwardRef,p=r.forwardRef;exports.typeScriptHappyForwardRef=e,exports.typescriptHappyForwardRef=p;
1
+ "use strict";var r=require("react");const e=r.forwardRef,p=r.forwardRef;exports.typeScriptHappyForwardRef=e,exports.typescriptHappyForwardRef=p;
@@ -1 +1 @@
1
- "use strict";var r=require("react");const e=r.forwardRef,p=r.forwardRef;exports.typeScriptHappyForwardRef=e,exports.typescriptHappyForwardRef=p;
1
+ "use strict";var r=require("react");const e=r.forwardRef,p=r.forwardRef;exports.typeScriptHappyForwardRef=e,exports.typescriptHappyForwardRef=p;
@@ -1 +1 @@
1
- import{forwardRef as p}from"react";const r=p,t=p;export{r as typeScriptHappyForwardRef,t as typescriptHappyForwardRef};
1
+ import{forwardRef as p}from"react";const r=p,t=p;export{r as typeScriptHappyForwardRef,t as typescriptHappyForwardRef};
package/use/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("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.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}});exports.use=t;
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.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}});exports.use=e;
package/use/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("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.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}});exports.use=t;
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.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=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.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}});export{t as use};
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.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}});export{t as use};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");exports.useArray=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[t,c]=e.useState(r),l=e.useCallback(e=>c(r=>r.concat(e)),[]),s=e.useCallback(()=>c([]),[]),u=e.useCallback(e=>c(r=>{if(e>-1){const t=r.slice();return t.splice(e,1),t}return r}),[]);return[t,l,s,u]};
1
+ "use strict";require("client-only");var e=require("react");exports.useArray=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[t,c]=e.useState(r),l=e.useCallback(e=>c(r=>r.concat(e)),[]);return[t,l,e.useCallback(()=>c([]),[]),e.useCallback(e=>c(r=>{if(e>-1){const t=r.slice();return t.splice(e,1),t}return r}),[])]};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react");exports.useArray=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[t,c]=e.useState(r),l=e.useCallback(e=>c(r=>r.concat(e)),[]),s=e.useCallback(()=>c([]),[]),u=e.useCallback(e=>c(r=>{if(e>-1){const t=r.slice();return t.splice(e,1),t}return r}),[]);return[t,l,s,u]};
1
+ "use strict";require("client-only");var e=require("react");exports.useArray=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[t,c]=e.useState(r),l=e.useCallback(e=>c(r=>r.concat(e)),[]);return[t,l,e.useCallback(()=>c([]),[]),e.useCallback(e=>c(r=>{if(e>-1){const t=r.slice();return t.splice(e,1),t}return r}),[])]};
@@ -1 +1 @@
1
- import"client-only";import{useState as t,useCallback as r}from"react";const n=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[e,o]=t(n),c=r(t=>o(r=>r.concat(t)),[]),i=r(()=>o([]),[]),l=r(t=>o(r=>{if(t>-1){const n=r.slice();return n.splice(t,1),n}return r}),[]);return[e,c,i,l]};export{n as useArray};
1
+ import"client-only";import{useState as t,useCallback as r}from"react";const n=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[e,o]=t(n),c=r(t=>o(r=>r.concat(t)),[]);return[e,c,r(()=>o([]),[]),r(t=>o(r=>{if(t>-1){const n=r.slice();return n.splice(t,1),n}return r}),[])]};export{n as useArray};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]),h=e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),x=e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]);return{copy:h,reset:x,error:u,copied:s}};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]);return{copy:e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),reset:e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]),error:u,copied:s}};
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]),h=e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),x=e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]);return{copy:h,reset:x,error:u,copied:s}};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../noop/index.js"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js");class a extends Error{}exports.UseClipboardError=a,exports.useClipboard=function(){let{timeout:o=1e3,usePromptAsFallback:l=!1,promptFallbackText:i="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,c]=e.useState(null),[s,d]=e.useState(!1),p=e.useRef(null),b=t.useStableHandler(n||r.noop),w=e.useCallback(e=>{p.current&&clearTimeout(p.current),e&&(p.current=window.setTimeout(()=>d(!1),o)),d(e)},[o]),y=e.useCallback(e=>{c(e),b(e)},[b]);return{copy:e.useCallback(async e=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(e),w(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(l)try{window.prompt(i,e)}catch(e){y(e)}else y(r)}},[w,i,y,l]),reset:e.useCallback(()=>{d(!1),c(null),p.current&&clearTimeout(p.current)},[]),error:u,copied:s}};
@@ -1 +1 @@
1
- import"client-only";import{useState as o,useRef as r,useCallback as e}from"react";import{noop as t}from"../noop/index.mjs";import{useStableHandler as i}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";class a extends Error{}function l(){let{timeout:l=1e3,usePromptAsFallback:n=!1,promptFallbackText:c="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[p,d]=o(null),[s,m]=o(!1),w=r(null),y=i(u||t),b=e(o=>{w.current&&clearTimeout(w.current),o&&(w.current=window.setTimeout(()=>m(!1),l)),m(o)},[l]),f=e(o=>{d(o),y(o)},[y]),h=e(async o=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(o),b(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(n)try{window.prompt(c,o)}catch(o){f(o)}else f(r)}},[b,c,f,n]),x=e(()=>{m(!1),d(null),w.current&&clearTimeout(w.current)},[]);return{copy:h,reset:x,error:p,copied:s}}export{a as UseClipboardError,l as useClipboard};
1
+ import"client-only";import{useState as o,useRef as r,useCallback as e}from"react";import{noop as t}from"../noop/index.mjs";import{useStableHandler as i}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";class a extends Error{}function l(){let{timeout:l=1e3,usePromptAsFallback:n=!1,promptFallbackText:c="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[p,s]=o(null),[d,m]=o(!1),w=r(null),y=i(u||t),b=e(o=>{w.current&&clearTimeout(w.current),o&&(w.current=window.setTimeout(()=>m(!1),l)),m(o)},[l]),f=e(o=>{s(o),y(o)},[y]);return{copy:e(async o=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(o),b(!0);else throw new a("[foxact] useClipboard: navigator.clipboard is not supported")}catch(r){if(n)try{window.prompt(c,o)}catch(o){f(o)}else f(r)}},[b,c,f,n]),reset:e(()=>{m(!1),s(null),w.current&&clearTimeout(w.current)},[]),error:p,copied:d}}export{a as UseClipboardError,l as useClipboard};