foxact 0.2.35 → 0.2.36

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.
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
+ import { Foxact } from '../types/index.js';
2
3
 
3
- interface ContextComposeProviderProps extends React.PropsWithChildren {
4
+ interface ContextComposeProviderProps extends Foxact.PropsWithChildren {
4
5
  contexts: React.ReactElement[];
5
6
  }
6
7
  /** @see https://foxact.skk.moe/compose-context-provider */
@@ -1,7 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { Foxact } from '../types/index.js';
3
4
 
4
5
  /** @see https://foxact.skk.moe/context-state */
5
- declare function createContextState<T>(initialState: T): readonly [({ children }: React.PropsWithChildren) => react_jsx_runtime.JSX.Element, () => T, () => react.Dispatch<react.SetStateAction<T>>, react.Context<T>];
6
+ declare function createContextState<T>(initialState: T): readonly [({ children }: Foxact.PropsWithChildren) => react_jsx_runtime.JSX.Element, () => T, () => react.Dispatch<react.SetStateAction<T>>, react.Context<T>];
6
7
 
7
8
  export { createContextState };
@@ -1,3 +1,4 @@
1
1
  export { createContextState } from '../context-state/index.js';
2
2
  import 'react';
3
3
  import 'react/jsx-runtime';
4
+ import '../types/index.js';
@@ -1 +1 @@
1
- "use strict";const r={};exports.createFixedArray=e=>(r[e]||(r[e]=r[e]||Array.from(Array(e).keys())),r[e]);
1
+ "use strict";const e=new Map,r=e=>{const r=Array.from(Array(e).keys());return"development"===process.env.NODE_ENV&&Object.freeze(r),r},t=t=>{if(e.has(t))return e.get(t);const s=r(t);return e.set(t,s),s},s=new Map,a=e=>{let t,a;return s.has(e)&&(a=(t=s.get(e)).deref()),a||(t=new WeakRef(a=r(e)),s.set(e,t)),a},n="function"==typeof WeakRef?a:t;exports.createFixedArray=n,exports.createFixedArrayWithGC=a,exports.createFixedArrayWithoutGC=t;
@@ -1,3 +1,5 @@
1
+ declare const createFixedArrayWithoutGC: (length: number) => readonly number[];
2
+ declare const createFixedArrayWithGC: (length: number) => readonly number[];
1
3
  declare const createFixedArray: (length: number) => readonly number[];
2
4
 
3
- export { createFixedArray };
5
+ export { createFixedArray, createFixedArrayWithGC, createFixedArrayWithoutGC };
@@ -1 +1 @@
1
- "use strict";const r={};exports.createFixedArray=e=>(r[e]||(r[e]=r[e]||Array.from(Array(e).keys())),r[e]);
1
+ "use strict";const e=new Map,r=e=>{const r=Array.from(Array(e).keys());return"development"===process.env.NODE_ENV&&Object.freeze(r),r},t=t=>{if(e.has(t))return e.get(t);const s=r(t);return e.set(t,s),s},s=new Map,a=e=>{let t,a;return s.has(e)&&(a=(t=s.get(e)).deref()),a||(t=new WeakRef(a=r(e)),s.set(e,t)),a},n="function"==typeof WeakRef?a:t;exports.createFixedArray=n,exports.createFixedArrayWithGC=a,exports.createFixedArrayWithoutGC=t;
@@ -1 +1 @@
1
- const r={},e=e=>(r[e]||(r[e]=r[e]||Array.from(Array(e).keys())),r[e]);export{e as createFixedArray};
1
+ const e=new Map,r=e=>{const r=Array.from(Array(e).keys());return"development"===process.env.NODE_ENV&&Object.freeze(r),r},t=t=>{if(e.has(t))return e.get(t);const a=r(t);return e.set(t,a),a},a=new Map,n=e=>{let t,n;return a.has(e)&&(n=(t=a.get(e)).deref()),n||(t=new WeakRef(n=r(e)),a.set(e,t)),n},o="function"==typeof WeakRef?n:t;export{o as createFixedArray,n as createFixedArrayWithGC,t as createFixedArrayWithoutGC};
@@ -1,5 +1,3 @@
1
- import * as react from 'react';
2
-
3
1
  type StorageType = 'localStorage' | 'sessionStorage';
4
2
  type NotUndefined<T> = T extends undefined ? never : T;
5
3
  type CustomStorageEvent = CustomEvent<string>;
@@ -22,9 +20,9 @@ interface UseStorageParserOption<T> {
22
20
  declare function createStorage(type: StorageType): {
23
21
  useStorage: {
24
22
  <T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [T, React.Dispatch<React.SetStateAction<T | null>>];
25
- <T_1>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T_1> | undefined): readonly [T_1 | null, react.Dispatch<react.SetStateAction<T_1 | null>>];
23
+ <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [T | null, React.Dispatch<React.SetStateAction<T | null>>];
26
24
  };
27
- useSetStorage: <T_2>(key: string, serializer: Serializer<T_2>) => (v: T_2 | null) => void;
25
+ useSetStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
28
26
  };
29
27
 
30
28
  export { type Deserializer, type Serializer, type UseStorageParserOption, type UseStorageRawOption, createStorage };
@@ -1,10 +1,11 @@
1
1
  import * as react from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { Foxact } from '../types/index.js';
3
4
 
4
- interface CurrentYearProps extends React.ComponentProps<'span'> {
5
+ interface CurrentYearProps extends Foxact.ComponentProps<'span'> {
5
6
  defaultYear?: number;
6
7
  }
7
8
  /** @see https://foxact.skk.moe/current-year */
8
- declare const CurrentYear: react.MemoExoticComponent<({ defaultYear, ...restProps }: CurrentYearProps) => react_jsx_runtime.JSX.Element>;
9
+ declare const CurrentYear: react.MemoExoticComponent<({ defaultYear, ...restProps }: Readonly<CurrentYearProps>) => react_jsx_runtime.JSX.Element>;
9
10
 
10
11
  export { CurrentYear };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.35",
3
+ "version": "0.2.36",
4
4
  "description": "React Hooks/Utils done right. For browser, SSR, and React Server Components.",
5
5
  "homepage": "https://foxact.skk.moe",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "optional": true
33
33
  }
34
34
  },
35
- "packageManager": "pnpm@9.1.4",
35
+ "packageManager": "pnpm@9.4.0",
36
36
  "pnpm": {
37
37
  "overrides": {
38
38
  "array-includes": "npm:@nolyfill/array-includes@latest",
@@ -69,68 +69,59 @@
69
69
  "exports": {
70
70
  "./package.json": "./package.json",
71
71
  "./sizes.json": "./sizes.json",
72
- "./use-abortable-effect": {
73
- "types": "./use-abortable-effect/index.d.ts",
74
- "import": {
75
- "types": "./use-abortable-effect/index.d.ts",
76
- "default": "./use-abortable-effect/index.mjs"
77
- },
78
- "require": "./use-abortable-effect/index.cjs",
79
- "default": "./use-abortable-effect/index.js"
80
- },
81
- "./use-next-pathname": {
82
- "types": "./use-next-pathname/index.d.ts",
72
+ "./compose-context-provider": {
73
+ "types": "./compose-context-provider/index.d.ts",
83
74
  "import": {
84
- "types": "./use-next-pathname/index.d.ts",
85
- "default": "./use-next-pathname/index.mjs"
75
+ "types": "./compose-context-provider/index.d.ts",
76
+ "default": "./compose-context-provider/index.mjs"
86
77
  },
87
- "require": "./use-next-pathname/index.cjs",
88
- "default": "./use-next-pathname/index.js"
78
+ "require": "./compose-context-provider/index.cjs",
79
+ "default": "./compose-context-provider/index.js"
89
80
  },
90
- "./noop": {
91
- "types": "./noop/index.d.ts",
81
+ "./context-state": {
82
+ "types": "./context-state/index.d.ts",
92
83
  "import": {
93
- "types": "./noop/index.d.ts",
94
- "default": "./noop/index.mjs"
84
+ "types": "./context-state/index.d.ts",
85
+ "default": "./context-state/index.mjs"
95
86
  },
96
- "require": "./noop/index.cjs",
97
- "default": "./noop/index.js"
87
+ "require": "./context-state/index.cjs",
88
+ "default": "./context-state/index.js"
98
89
  },
99
- "./use-singleton": {
100
- "types": "./use-singleton/index.d.ts",
90
+ "./create-context-state": {
91
+ "types": "./create-context-state/index.d.ts",
101
92
  "import": {
102
- "types": "./use-singleton/index.d.ts",
103
- "default": "./use-singleton/index.mjs"
93
+ "types": "./create-context-state/index.d.ts",
94
+ "default": "./create-context-state/index.mjs"
104
95
  },
105
- "require": "./use-singleton/index.cjs",
106
- "default": "./use-singleton/index.js"
96
+ "require": "./create-context-state/index.cjs",
97
+ "default": "./create-context-state/index.js"
107
98
  },
108
- "./use-url-hash-state": {
109
- "types": "./use-url-hash-state/index.d.ts",
99
+ "./create-fixed-array": {
100
+ "types": "./create-fixed-array/index.d.ts",
110
101
  "import": {
111
- "types": "./use-url-hash-state/index.d.ts",
112
- "default": "./use-url-hash-state/index.mjs"
102
+ "types": "./create-fixed-array/index.d.ts",
103
+ "default": "./create-fixed-array/index.mjs"
113
104
  },
114
- "require": "./use-url-hash-state/index.cjs",
115
- "default": "./use-url-hash-state/index.js"
105
+ "require": "./create-fixed-array/index.cjs",
106
+ "default": "./create-fixed-array/index.js"
116
107
  },
117
- "./use-retimer": {
118
- "types": "./use-retimer/index.d.ts",
108
+ "./create-storage-hook": {
109
+ "types": "./create-storage-hook/index.d.ts",
119
110
  "import": {
120
- "types": "./use-retimer/index.d.ts",
121
- "default": "./use-retimer/index.mjs"
111
+ "types": "./create-storage-hook/index.d.ts",
112
+ "default": "./create-storage-hook/index.mjs"
122
113
  },
123
- "require": "./use-retimer/index.cjs",
124
- "default": "./use-retimer/index.js"
114
+ "require": "./create-storage-hook/index.cjs",
115
+ "default": "./create-storage-hook/index.js"
125
116
  },
126
- "./use-next-link": {
127
- "types": "./use-next-link/index.d.ts",
117
+ "./current-year": {
118
+ "types": "./current-year/index.d.ts",
128
119
  "import": {
129
- "types": "./use-next-link/index.d.ts",
130
- "default": "./use-next-link/index.mjs"
120
+ "types": "./current-year/index.d.ts",
121
+ "default": "./current-year/index.mjs"
131
122
  },
132
- "require": "./use-next-link/index.cjs",
133
- "default": "./use-next-link/index.js"
123
+ "require": "./current-year/index.cjs",
124
+ "default": "./current-year/index.js"
134
125
  },
135
126
  "./invariant": {
136
127
  "types": "./invariant/index.d.ts",
@@ -141,23 +132,59 @@
141
132
  "require": "./invariant/index.cjs",
142
133
  "default": "./invariant/index.js"
143
134
  },
144
- "./context-state": {
145
- "types": "./context-state/index.d.ts",
135
+ "./no-ssr": {
136
+ "types": "./no-ssr/index.d.ts",
146
137
  "import": {
147
- "types": "./context-state/index.d.ts",
148
- "default": "./context-state/index.mjs"
138
+ "types": "./no-ssr/index.d.ts",
139
+ "default": "./no-ssr/index.mjs"
149
140
  },
150
- "require": "./context-state/index.cjs",
151
- "default": "./context-state/index.js"
141
+ "require": "./no-ssr/index.cjs",
142
+ "default": "./no-ssr/index.js"
152
143
  },
153
- "./current-year": {
154
- "types": "./current-year/index.d.ts",
144
+ "./noop": {
145
+ "types": "./noop/index.d.ts",
155
146
  "import": {
156
- "types": "./current-year/index.d.ts",
157
- "default": "./current-year/index.mjs"
147
+ "types": "./noop/index.d.ts",
148
+ "default": "./noop/index.mjs"
158
149
  },
159
- "require": "./current-year/index.cjs",
160
- "default": "./current-year/index.js"
150
+ "require": "./noop/index.cjs",
151
+ "default": "./noop/index.js"
152
+ },
153
+ "./nullthrow": {
154
+ "types": "./nullthrow/index.d.ts",
155
+ "import": {
156
+ "types": "./nullthrow/index.d.ts",
157
+ "default": "./nullthrow/index.mjs"
158
+ },
159
+ "require": "./nullthrow/index.cjs",
160
+ "default": "./nullthrow/index.js"
161
+ },
162
+ "./rem": {
163
+ "types": "./rem/index.d.ts",
164
+ "import": {
165
+ "types": "./rem/index.d.ts",
166
+ "default": "./rem/index.mjs"
167
+ },
168
+ "require": "./rem/index.cjs",
169
+ "default": "./rem/index.js"
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
+ "./types": {
181
+ "types": "./types/index.d.ts",
182
+ "import": {
183
+ "types": "./types/index.d.ts",
184
+ "default": "./types/index.mjs"
185
+ },
186
+ "require": "./types/index.cjs",
187
+ "default": "./types/index.js"
161
188
  },
162
189
  "./use": {
163
190
  "types": "./use/index.d.ts",
@@ -168,86 +195,77 @@
168
195
  "require": "./use/index.cjs",
169
196
  "default": "./use/index.js"
170
197
  },
171
- "./use-map": {
172
- "types": "./use-map/index.d.ts",
173
- "import": {
174
- "types": "./use-map/index.d.ts",
175
- "default": "./use-map/index.mjs"
176
- },
177
- "require": "./use-map/index.cjs",
178
- "default": "./use-map/index.js"
179
- },
180
- "./use-is-client": {
181
- "types": "./use-is-client/index.d.ts",
198
+ "./use-abortable-effect": {
199
+ "types": "./use-abortable-effect/index.d.ts",
182
200
  "import": {
183
- "types": "./use-is-client/index.d.ts",
184
- "default": "./use-is-client/index.mjs"
201
+ "types": "./use-abortable-effect/index.d.ts",
202
+ "default": "./use-abortable-effect/index.mjs"
185
203
  },
186
- "require": "./use-is-client/index.cjs",
187
- "default": "./use-is-client/index.js"
204
+ "require": "./use-abortable-effect/index.cjs",
205
+ "default": "./use-abortable-effect/index.js"
188
206
  },
189
- "./use-debounced-state": {
190
- "types": "./use-debounced-state/index.d.ts",
207
+ "./use-array": {
208
+ "types": "./use-array/index.d.ts",
191
209
  "import": {
192
- "types": "./use-debounced-state/index.d.ts",
193
- "default": "./use-debounced-state/index.mjs"
210
+ "types": "./use-array/index.d.ts",
211
+ "default": "./use-array/index.mjs"
194
212
  },
195
- "require": "./use-debounced-state/index.cjs",
196
- "default": "./use-debounced-state/index.js"
213
+ "require": "./use-array/index.cjs",
214
+ "default": "./use-array/index.js"
197
215
  },
198
- "./use-media-query": {
199
- "types": "./use-media-query/index.d.ts",
216
+ "./typescript-happy-forward-ref": {
217
+ "types": "./typescript-happy-forward-ref/index.d.ts",
200
218
  "import": {
201
- "types": "./use-media-query/index.d.ts",
202
- "default": "./use-media-query/index.mjs"
219
+ "types": "./typescript-happy-forward-ref/index.d.ts",
220
+ "default": "./typescript-happy-forward-ref/index.mjs"
203
221
  },
204
- "require": "./use-media-query/index.cjs",
205
- "default": "./use-media-query/index.js"
222
+ "require": "./typescript-happy-forward-ref/index.cjs",
223
+ "default": "./typescript-happy-forward-ref/index.js"
206
224
  },
207
- "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
208
- "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
225
+ "./use-clipboard": {
226
+ "types": "./use-clipboard/index.d.ts",
209
227
  "import": {
210
- "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
211
- "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs"
228
+ "types": "./use-clipboard/index.d.ts",
229
+ "default": "./use-clipboard/index.mjs"
212
230
  },
213
- "require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
214
- "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
231
+ "require": "./use-clipboard/index.cjs",
232
+ "default": "./use-clipboard/index.js"
215
233
  },
216
- "./use-uncontrolled": {
217
- "types": "./use-uncontrolled/index.d.ts",
234
+ "./use-composition-input": {
235
+ "types": "./use-composition-input/index.d.ts",
218
236
  "import": {
219
- "types": "./use-uncontrolled/index.d.ts",
220
- "default": "./use-uncontrolled/index.mjs"
237
+ "types": "./use-composition-input/index.d.ts",
238
+ "default": "./use-composition-input/index.mjs"
221
239
  },
222
- "require": "./use-uncontrolled/index.cjs",
223
- "default": "./use-uncontrolled/index.js"
240
+ "require": "./use-composition-input/index.cjs",
241
+ "default": "./use-composition-input/index.js"
224
242
  },
225
- "./use-react-router-is-match": {
226
- "types": "./use-react-router-is-match/index.d.ts",
243
+ "./use-debounced-state": {
244
+ "types": "./use-debounced-state/index.d.ts",
227
245
  "import": {
228
- "types": "./use-react-router-is-match/index.d.ts",
229
- "default": "./use-react-router-is-match/index.mjs"
246
+ "types": "./use-debounced-state/index.d.ts",
247
+ "default": "./use-debounced-state/index.mjs"
230
248
  },
231
- "require": "./use-react-router-is-match/index.cjs",
232
- "default": "./use-react-router-is-match/index.js"
249
+ "require": "./use-debounced-state/index.cjs",
250
+ "default": "./use-debounced-state/index.js"
233
251
  },
234
- "./create-fixed-array": {
235
- "types": "./create-fixed-array/index.d.ts",
252
+ "./use-debounced-value": {
253
+ "types": "./use-debounced-value/index.d.ts",
236
254
  "import": {
237
- "types": "./create-fixed-array/index.d.ts",
238
- "default": "./create-fixed-array/index.mjs"
255
+ "types": "./use-debounced-value/index.d.ts",
256
+ "default": "./use-debounced-value/index.mjs"
239
257
  },
240
- "require": "./create-fixed-array/index.cjs",
241
- "default": "./create-fixed-array/index.js"
258
+ "require": "./use-debounced-value/index.cjs",
259
+ "default": "./use-debounced-value/index.js"
242
260
  },
243
- "./create-storage-hook": {
244
- "types": "./create-storage-hook/index.d.ts",
261
+ "./use-error-boundary": {
262
+ "types": "./use-error-boundary/index.d.ts",
245
263
  "import": {
246
- "types": "./create-storage-hook/index.d.ts",
247
- "default": "./create-storage-hook/index.mjs"
264
+ "types": "./use-error-boundary/index.d.ts",
265
+ "default": "./use-error-boundary/index.mjs"
248
266
  },
249
- "require": "./create-storage-hook/index.cjs",
250
- "default": "./create-storage-hook/index.js"
267
+ "require": "./use-error-boundary/index.cjs",
268
+ "default": "./use-error-boundary/index.js"
251
269
  },
252
270
  "./use-intersection": {
253
271
  "types": "./use-intersection/index.d.ts",
@@ -258,32 +276,14 @@
258
276
  "require": "./use-intersection/index.cjs",
259
277
  "default": "./use-intersection/index.js"
260
278
  },
261
- "./use-clipboard": {
262
- "types": "./use-clipboard/index.d.ts",
263
- "import": {
264
- "types": "./use-clipboard/index.d.ts",
265
- "default": "./use-clipboard/index.mjs"
266
- },
267
- "require": "./use-clipboard/index.cjs",
268
- "default": "./use-clipboard/index.js"
269
- },
270
- "./compose-context-provider": {
271
- "types": "./compose-context-provider/index.d.ts",
272
- "import": {
273
- "types": "./compose-context-provider/index.d.ts",
274
- "default": "./compose-context-provider/index.mjs"
275
- },
276
- "require": "./compose-context-provider/index.cjs",
277
- "default": "./compose-context-provider/index.js"
278
- },
279
- "./request-idle-callback": {
280
- "types": "./request-idle-callback/index.d.ts",
279
+ "./use-is-client": {
280
+ "types": "./use-is-client/index.d.ts",
281
281
  "import": {
282
- "types": "./request-idle-callback/index.d.ts",
283
- "default": "./request-idle-callback/index.mjs"
282
+ "types": "./use-is-client/index.d.ts",
283
+ "default": "./use-is-client/index.mjs"
284
284
  },
285
- "require": "./request-idle-callback/index.cjs",
286
- "default": "./request-idle-callback/index.js"
285
+ "require": "./use-is-client/index.cjs",
286
+ "default": "./use-is-client/index.js"
287
287
  },
288
288
  "./use-isomorphic-layout-effect": {
289
289
  "types": "./use-isomorphic-layout-effect/index.d.ts",
@@ -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-debounced-value": {
298
- "types": "./use-debounced-value/index.d.ts",
299
- "import": {
300
- "types": "./use-debounced-value/index.d.ts",
301
- "default": "./use-debounced-value/index.mjs"
302
- },
303
- "require": "./use-debounced-value/index.cjs",
304
- "default": "./use-debounced-value/index.js"
305
- },
306
297
  "./use-local-storage": {
307
298
  "types": "./use-local-storage/index.d.ts",
308
299
  "import": {
@@ -312,41 +303,68 @@
312
303
  "require": "./use-local-storage/index.cjs",
313
304
  "default": "./use-local-storage/index.js"
314
305
  },
315
- "./use-set": {
316
- "types": "./use-set/index.d.ts",
306
+ "./use-map": {
307
+ "types": "./use-map/index.d.ts",
317
308
  "import": {
318
- "types": "./use-set/index.d.ts",
319
- "default": "./use-set/index.mjs"
309
+ "types": "./use-map/index.d.ts",
310
+ "default": "./use-map/index.mjs"
320
311
  },
321
- "require": "./use-set/index.cjs",
322
- "default": "./use-set/index.js"
312
+ "require": "./use-map/index.cjs",
313
+ "default": "./use-map/index.js"
323
314
  },
324
- "./rem": {
325
- "types": "./rem/index.d.ts",
315
+ "./use-media-query": {
316
+ "types": "./use-media-query/index.d.ts",
326
317
  "import": {
327
- "types": "./rem/index.d.ts",
328
- "default": "./rem/index.mjs"
318
+ "types": "./use-media-query/index.d.ts",
319
+ "default": "./use-media-query/index.mjs"
329
320
  },
330
- "require": "./rem/index.cjs",
331
- "default": "./rem/index.js"
321
+ "require": "./use-media-query/index.cjs",
322
+ "default": "./use-media-query/index.js"
332
323
  },
333
- "./use-array": {
334
- "types": "./use-array/index.d.ts",
324
+ "./use-next-link": {
325
+ "types": "./use-next-link/index.d.ts",
335
326
  "import": {
336
- "types": "./use-array/index.d.ts",
337
- "default": "./use-array/index.mjs"
327
+ "types": "./use-next-link/index.d.ts",
328
+ "default": "./use-next-link/index.mjs"
338
329
  },
339
- "require": "./use-array/index.cjs",
340
- "default": "./use-array/index.js"
330
+ "require": "./use-next-link/index.cjs",
331
+ "default": "./use-next-link/index.js"
341
332
  },
342
- "./typescript-happy-forward-ref": {
343
- "types": "./typescript-happy-forward-ref/index.d.ts",
333
+ "./use-next-pathname": {
334
+ "types": "./use-next-pathname/index.d.ts",
344
335
  "import": {
345
- "types": "./typescript-happy-forward-ref/index.d.ts",
346
- "default": "./typescript-happy-forward-ref/index.mjs"
336
+ "types": "./use-next-pathname/index.d.ts",
337
+ "default": "./use-next-pathname/index.mjs"
347
338
  },
348
- "require": "./typescript-happy-forward-ref/index.cjs",
349
- "default": "./typescript-happy-forward-ref/index.js"
339
+ "require": "./use-next-pathname/index.cjs",
340
+ "default": "./use-next-pathname/index.js"
341
+ },
342
+ "./use-react-router-enable-concurrent-navigation": {
343
+ "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
344
+ "import": {
345
+ "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
346
+ "default": "./use-react-router-enable-concurrent-navigation/index.mjs"
347
+ },
348
+ "require": "./use-react-router-enable-concurrent-navigation/index.cjs",
349
+ "default": "./use-react-router-enable-concurrent-navigation/index.js"
350
+ },
351
+ "./use-react-router-is-match": {
352
+ "types": "./use-react-router-is-match/index.d.ts",
353
+ "import": {
354
+ "types": "./use-react-router-is-match/index.d.ts",
355
+ "default": "./use-react-router-is-match/index.mjs"
356
+ },
357
+ "require": "./use-react-router-is-match/index.cjs",
358
+ "default": "./use-react-router-is-match/index.js"
359
+ },
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"
350
368
  },
351
369
  "./use-session-storage": {
352
370
  "types": "./use-session-storage/index.d.ts",
@@ -357,59 +375,50 @@
357
375
  "require": "./use-session-storage/index.cjs",
358
376
  "default": "./use-session-storage/index.js"
359
377
  },
360
- "./no-ssr": {
361
- "types": "./no-ssr/index.d.ts",
362
- "import": {
363
- "types": "./no-ssr/index.d.ts",
364
- "default": "./no-ssr/index.mjs"
365
- },
366
- "require": "./no-ssr/index.cjs",
367
- "default": "./no-ssr/index.js"
368
- },
369
- "./nullthrow": {
370
- "types": "./nullthrow/index.d.ts",
378
+ "./use-set": {
379
+ "types": "./use-set/index.d.ts",
371
380
  "import": {
372
- "types": "./nullthrow/index.d.ts",
373
- "default": "./nullthrow/index.mjs"
381
+ "types": "./use-set/index.d.ts",
382
+ "default": "./use-set/index.mjs"
374
383
  },
375
- "require": "./nullthrow/index.cjs",
376
- "default": "./nullthrow/index.js"
384
+ "require": "./use-set/index.cjs",
385
+ "default": "./use-set/index.js"
377
386
  },
378
- "./use-error-boundary": {
379
- "types": "./use-error-boundary/index.d.ts",
387
+ "./use-singleton": {
388
+ "types": "./use-singleton/index.d.ts",
380
389
  "import": {
381
- "types": "./use-error-boundary/index.d.ts",
382
- "default": "./use-error-boundary/index.mjs"
390
+ "types": "./use-singleton/index.d.ts",
391
+ "default": "./use-singleton/index.mjs"
383
392
  },
384
- "require": "./use-error-boundary/index.cjs",
385
- "default": "./use-error-boundary/index.js"
393
+ "require": "./use-singleton/index.cjs",
394
+ "default": "./use-singleton/index.js"
386
395
  },
387
- "./use-react-router-enable-concurrent-navigation": {
388
- "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
396
+ "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
397
+ "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
389
398
  "import": {
390
- "types": "./use-react-router-enable-concurrent-navigation/index.d.ts",
391
- "default": "./use-react-router-enable-concurrent-navigation/index.mjs"
399
+ "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
400
+ "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs"
392
401
  },
393
- "require": "./use-react-router-enable-concurrent-navigation/index.cjs",
394
- "default": "./use-react-router-enable-concurrent-navigation/index.js"
402
+ "require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
403
+ "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
395
404
  },
396
- "./create-context-state": {
397
- "types": "./create-context-state/index.d.ts",
405
+ "./use-uncontrolled": {
406
+ "types": "./use-uncontrolled/index.d.ts",
398
407
  "import": {
399
- "types": "./create-context-state/index.d.ts",
400
- "default": "./create-context-state/index.mjs"
408
+ "types": "./use-uncontrolled/index.d.ts",
409
+ "default": "./use-uncontrolled/index.mjs"
401
410
  },
402
- "require": "./create-context-state/index.cjs",
403
- "default": "./create-context-state/index.js"
411
+ "require": "./use-uncontrolled/index.cjs",
412
+ "default": "./use-uncontrolled/index.js"
404
413
  },
405
- "./use-composition-input": {
406
- "types": "./use-composition-input/index.d.ts",
414
+ "./use-url-hash-state": {
415
+ "types": "./use-url-hash-state/index.d.ts",
407
416
  "import": {
408
- "types": "./use-composition-input/index.d.ts",
409
- "default": "./use-composition-input/index.mjs"
417
+ "types": "./use-url-hash-state/index.d.ts",
418
+ "default": "./use-url-hash-state/index.mjs"
410
419
  },
411
- "require": "./use-composition-input/index.cjs",
412
- "default": "./use-composition-input/index.js"
420
+ "require": "./use-url-hash-state/index.cjs",
421
+ "default": "./use-url-hash-state/index.js"
413
422
  }
414
423
  }
415
424
  }
package/rem/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- declare const rem: (value: number | string | number[] | string[]) => string;
2
- declare const mantine_rem: (value: number | string | number[] | string[]) => string;
3
- declare const em: (value: number | string | number[] | string[]) => string;
1
+ declare const rem: (value: number | string | number[]) => string;
2
+ declare const mantine_rem: (value: number | string | number[]) => string;
3
+ declare const em: (value: number | string | number[]) => string;
4
4
 
5
5
  export { em, mantine_rem, rem };
@@ -1,5 +1,5 @@
1
1
  /** @see https://foxact.skk.moe/request-idle-callback */
2
- declare const requestIdleCallback: ((callback: IdleRequestCallback, options?: IdleRequestOptions | undefined) => number) & typeof globalThis.requestIdleCallback;
2
+ declare const requestIdleCallback: ((callback: IdleRequestCallback, options?: IdleRequestOptions) => number) & typeof globalThis.requestIdleCallback;
3
3
  /** @see https://foxact.skk.moe/request-idle-callback */
4
4
  declare const cancelIdleCallback: ((handle: number) => void) & typeof globalThis.cancelIdleCallback;
5
5
 
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":18246,"gzip":11139,"br":0},"exports":{"noop":{"raw":33,"gzip":53,"br":37},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-abortable-effect":{"raw":210,"gzip":166,"br":150},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-retimer":{"raw":200,"gzip":165,"br":123},"invariant":{"raw":178,"gzip":156,"br":118},"use-url-hash-state":{"raw":1069,"gzip":612,"br":534},"context-state":{"raw":377,"gzip":241,"br":207},"current-year":{"raw":592,"gzip":400,"br":326},"use":{"raw":276,"gzip":182,"br":150},"use-next-link":{"raw":1600,"gzip":851,"br":730},"use-map":{"raw":346,"gzip":244,"br":210},"use-is-client":{"raw":151,"gzip":142,"br":118},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":254},"use-media-query":{"raw":718,"gzip":402,"br":334},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"create-fixed-array":{"raw":100,"gzip":104,"br":89},"use-react-router-is-match":{"raw":564,"gzip":373,"br":314},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-clipboard":{"raw":1067,"gzip":611,"br":524},"create-storage-hook":{"raw":2061,"gzip":880,"br":762},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-local-storage":{"raw":310,"gzip":184,"br":157},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"use-set":{"raw":347,"gzip":240,"br":203},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"use-array":{"raw":329,"gzip":238,"br":199},"use-session-storage":{"raw":316,"gzip":181,"br":152},"rem":{"raw":734,"gzip":380,"br":333},"nullthrow":{"raw":194,"gzip":167,"br":128},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"no-ssr":{"raw":468,"gzip":318,"br":266},"create-context-state":{"raw":145,"gzip":116,"br":96},"use-composition-input":{"raw":458,"gzip":283,"br":241},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387}}}
1
+ {"total":{"raw":18565,"gzip":11334,"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},"current-year":{"raw":592,"gzip":400,"br":326},"invariant":{"raw":178,"gzip":156,"br":118},"no-ssr":{"raw":468,"gzip":318,"br":266},"create-storage-hook":{"raw":2061,"gzip":880,"br":762},"noop":{"raw":33,"gzip":53,"br":37},"nullthrow":{"raw":194,"gzip":167,"br":128},"types":{"raw":0,"gzip":20,"br":1},"use":{"raw":276,"gzip":182,"br":150},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"rem":{"raw":734,"gzip":380,"br":333},"use-abortable-effect":{"raw":210,"gzip":166,"br":150},"use-array":{"raw":329,"gzip":238,"br":199},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"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-error-boundary":{"raw":244,"gzip":196,"br":159},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-is-client":{"raw":151,"gzip":142,"br":118},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-map":{"raw":346,"gzip":244,"br":210},"use-media-query":{"raw":718,"gzip":402,"br":334},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"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-singleton":{"raw":138,"gzip":129,"br":109},"use-session-storage":{"raw":316,"gzip":181,"br":152},"use-set":{"raw":347,"gzip":240,"br":203},"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-url-hash-state":{"raw":1069,"gzip":612,"br":534},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387}}}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,13 @@
1
+ declare namespace Foxact {
2
+ type PropsWithRef<P> = Readonly<React.PropsWithRef<P>>;
3
+ type PropsWithoutRef<P> = Readonly<React.PropsWithoutRef<P>>;
4
+ type PropsWithChildren<P = unknown> = Readonly<React.PropsWithChildren<P>>;
5
+ type ComponentProps<T extends keyof React.JSX.IntrinsicElements | React.JSXElementConstructor<any>> = Readonly<React.ComponentProps<T>>;
6
+ type CustomComponentProps<T extends React.ComponentType> = Readonly<React.ComponentProps<T>>;
7
+ type ComponentPropsWithRef<T extends React.ElementType> = Readonly<React.ComponentPropsWithRef<T>>;
8
+ type CustomComponentPropsWithRef<T extends React.ComponentType> = Readonly<React.ComponentPropsWithRef<T>>;
9
+ type ComponentPropsWithoutRef<T extends React.ElementType> = Readonly<React.ComponentPropsWithoutRef<T>>;
10
+ type CustomComponentPropsWithoutRef<T extends React.ElementType> = Readonly<React.ComponentPropsWithoutRef<T>>;
11
+ }
12
+
13
+ export { Foxact };
package/types/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -1,5 +1,5 @@
1
1
  interface TypeScriptHappyForwardRef {
2
- <T, P = {}>(render: (props: P, ref: React.ForwardedRef<T>) => React.ReactNode | null): (props: P & React.RefAttributes<T>) => React.ReactNode | null;
2
+ <T, P = unknown>(render: (props: P, ref: React.ForwardedRef<T>) => React.ReactNode | null): (props: P & React.RefAttributes<T>) => React.ReactNode | null;
3
3
  }
4
4
  /** @see https://foxact.skk.moe/typescript-happy-forward-ref */
5
5
  declare const typeScriptHappyForwardRef: TypeScriptHappyForwardRef;
@@ -1,8 +1,8 @@
1
- import { useEffect } from 'react';
1
+ import { useLayoutEffect as useLayoutEffect$1 } from 'react';
2
2
 
3
3
  /** @see https://foxact.skk.moe/use-isomorphic-layout-effect */
4
- declare const useIsomorphicLayoutEffect: typeof useEffect;
4
+ declare const useIsomorphicLayoutEffect: typeof useLayoutEffect$1;
5
5
  /** @see https://foxact.skk.moe/use-isomorphic-layout-effect */
6
- declare const useLayoutEffect: typeof useEffect;
6
+ declare const useLayoutEffect: typeof useLayoutEffect$1;
7
7
 
8
8
  export { useIsomorphicLayoutEffect, useLayoutEffect };
@@ -1,10 +1,9 @@
1
- import * as react from 'react';
2
1
  import { UseStorageRawOption, UseStorageParserOption, Serializer } from '../create-storage-hook/index.js';
3
2
  export { Deserializer } from '../create-storage-hook/index.js';
4
3
 
5
4
  declare const useLocalStorage: {
6
- <T>(key: string, serverValue: T extends undefined ? never : T, options?: UseStorageRawOption | UseStorageParserOption<T> | undefined): readonly [T, react.Dispatch<react.SetStateAction<T | null>>];
7
- <T_1>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T_1> | undefined): readonly [T_1 | null, react.Dispatch<react.SetStateAction<T_1 | null>>];
5
+ <T>(key: string, serverValue: T extends undefined ? never : T, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [T, React.Dispatch<React.SetStateAction<T | null>>];
6
+ <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [T | null, React.Dispatch<React.SetStateAction<T | null>>];
8
7
  };
9
8
  declare const useSetLocalStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
10
9
 
@@ -16,7 +16,7 @@ interface UrlObject {
16
16
  interface UseNextLinkOptions extends Omit<LinkProps, 'as' | 'href' | 'legacyBehavior' | 'shallow' | 'passHref' | 'locale'> {
17
17
  ref?: React.RefObject<HTMLAnchorElement> | React.RefCallback<HTMLAnchorElement> | null;
18
18
  }
19
- interface UseNextLinkReturnProps extends Partial<JSX.IntrinsicElements['a']> {
19
+ interface UseNextLinkReturnProps extends Partial<React.JSX.IntrinsicElements['a']> {
20
20
  ref: React.RefCallback<HTMLAnchorElement>;
21
21
  onTouchStart: React.TouchEventHandler<HTMLAnchorElement>;
22
22
  onMouseEnter: React.MouseEventHandler<HTMLAnchorElement>;
@@ -1,7 +1,8 @@
1
1
  import * as react from 'react';
2
+ import { Foxact } from '../types/index.js';
2
3
 
3
4
  /** @see https://foxact.skk.moe/use-react-router-enable-concurrent-navigation */
4
5
  declare const useReactRouterEnableConcurrentNavigation: () => void;
5
- declare const ReactRouterConcurrentNavigationProvider: ({ children }: React.PropsWithChildren) => react.ReactNode;
6
+ declare const ReactRouterConcurrentNavigationProvider: ({ children }: Foxact.PropsWithChildren) => react.ReactNode;
6
7
 
7
8
  export { ReactRouterConcurrentNavigationProvider, useReactRouterEnableConcurrentNavigation };
@@ -1,4 +1,4 @@
1
- import { RelativeRoutingType } from 'react-router-dom';
1
+ import { To, RelativeRoutingType } from 'react-router-dom';
2
2
 
3
3
  interface UseReactRouterIsMatchOption {
4
4
  relative?: RelativeRoutingType;
@@ -1,10 +1,9 @@
1
- import * as react from 'react';
2
1
  import { UseStorageRawOption, UseStorageParserOption, Serializer } from '../create-storage-hook/index.js';
3
2
  export { Deserializer } from '../create-storage-hook/index.js';
4
3
 
5
4
  declare const useSessionStorage: {
6
- <T>(key: string, serverValue: T extends undefined ? never : T, options?: UseStorageRawOption | UseStorageParserOption<T> | undefined): readonly [T, react.Dispatch<react.SetStateAction<T | null>>];
7
- <T_1>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T_1> | undefined): readonly [T_1 | null, react.Dispatch<react.SetStateAction<T_1 | null>>];
5
+ <T>(key: string, serverValue: T extends undefined ? never : T, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [T, React.Dispatch<React.SetStateAction<T | null>>];
6
+ <T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [T | null, React.Dispatch<React.SetStateAction<T | null>>];
8
7
  };
9
8
  declare const useSetSessionStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
10
9