foxact 0.3.7 → 0.3.8
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/merge-props/index.cjs +1 -0
- package/merge-props/index.d.ts +7 -0
- package/merge-props/index.mjs +1 -0
- package/package.json +160 -142
- package/polymorphic/index.cjs +1 -0
- package/polymorphic/index.d.ts +19 -0
- package/polymorphic/index.mjs +1 -0
- package/sizes.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t={};function r(t){return"function"==typeof t}function n(n,e){return r(n)?n(e):null!=n?n:t}exports.mergeProps=function(){for(var e,o,c,s=arguments.length,u=Array(s),a=0;a<s;a++)u[a]=arguments[a];const f=1===u.length&&Array.isArray(u[0])?u[0]:u;if(0===f.length)return t;let l=r(e=f[0])?{...n(e,t)}:{...e};if(1===f.length)return l;for(let t=1,e=f.length;t<e;t+=1){f[t]&&(o=l,l=r(c=f[t])?n(c,o):function(t,r){if(!r)return t;const n=Object.keys(r);for(let c=0;c<n.length;c++){const s=n[c],u=r[s];switch(s){case"style":{const r=t.style;r&&!u?t[s]=r:!r&&u?t[s]=u:(r||u)&&(t[s]={...r,...u});break}case"className":var e,o;t[s]=(e=t.className,(o=u)?e?o+" "+e:o:e);break;default:!function(t,r){const n=t.charCodeAt(0),e=t.charCodeAt(1),o=t.charCodeAt(2);return 111===n&&110===e&&o>=65&&o<=90&&("function"==typeof r||void 0===r)}(s,u)?t[s]=u:t[s]=function(t,r){return r?t?function(){for(var n=arguments.length,e=Array(n),o=0;o<n;o++)e[o]=arguments[o];const c=r(...e);return t(...e),c}:r:t}(t[s],u)}}return t}(o,c))}return l};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type PropsOf<T extends React.ElementType> = React.ComponentPropsWithRef<T>;
|
|
2
|
+
type InputProps<T extends React.ElementType> = PropsOf<T> | ((otherProps: PropsOf<T>) => PropsOf<T>) | undefined;
|
|
3
|
+
/** @see https://foxact.skk.moe/merge-props */
|
|
4
|
+
declare function mergeProps<T extends React.ElementType>(propsArray: Array<InputProps<T>>): PropsOf<T>;
|
|
5
|
+
declare function mergeProps<T extends React.ElementType>(...props: Array<InputProps<T>>): PropsOf<T>;
|
|
6
|
+
|
|
7
|
+
export { mergeProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={};function n(){for(var n,o,c,u=arguments.length,a=Array(u),f=0;f<u;f++)a[f]=arguments[f];const s=1===a.length&&Array.isArray(a[0])?a[0]:a;if(0===s.length)return t;let l=r(n=s[0])?{...e(n,t)}:{...n};if(1===s.length)return l;for(let t=1,n=s.length;t<n;t+=1){s[t]&&(o=l,l=r(c=s[t])?e(c,o):function(t,n){if(!n)return t;const r=Object.keys(n);for(let c=0;c<r.length;c++){const u=r[c],a=n[u];switch(u){case"style":{const n=t.style;n&&!a?t[u]=n:!n&&a?t[u]=a:(n||a)&&(t[u]={...n,...a});break}case"className":var e,o;t[u]=(e=t.className,(o=a)?e?o+" "+e:o:e);break;default:!function(t,n){const r=t.charCodeAt(0),e=t.charCodeAt(1),o=t.charCodeAt(2);return 111===r&&110===e&&o>=65&&o<=90&&("function"==typeof n||void 0===n)}(u,a)?t[u]=a:t[u]=function(t,n){return n?t?function(){for(var r=arguments.length,e=Array(r),o=0;o<r;o++)e[o]=arguments[o];const c=n(...e);return t(...e),c}:n:t}(t[u],a)}}return t}(o,c))}return l}function r(t){return"function"==typeof t}function e(n,e){return r(n)?n(e):null!=n?n:t}export{n as mergeProps};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxact",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
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": "./breadcrumbs/index.cjs",
|
|
62
62
|
"default": "./breadcrumbs/index.cjs"
|
|
63
63
|
},
|
|
64
|
-
"./context-
|
|
65
|
-
"types": "./context-
|
|
66
|
-
"import": {
|
|
67
|
-
"types": "./context-reducer/index.d.ts",
|
|
68
|
-
"default": "./context-reducer/index.mjs"
|
|
69
|
-
},
|
|
70
|
-
"require": "./context-reducer/index.cjs",
|
|
71
|
-
"default": "./context-reducer/index.cjs"
|
|
72
|
-
},
|
|
73
|
-
"./context-state": {
|
|
74
|
-
"types": "./context-state/index.d.ts",
|
|
64
|
+
"./compose-context-provider": {
|
|
65
|
+
"types": "./compose-context-provider/index.d.ts",
|
|
75
66
|
"import": {
|
|
76
|
-
"types": "./context-
|
|
77
|
-
"default": "./context-
|
|
67
|
+
"types": "./compose-context-provider/index.d.ts",
|
|
68
|
+
"default": "./compose-context-provider/index.mjs"
|
|
78
69
|
},
|
|
79
|
-
"require": "./context-
|
|
80
|
-
"default": "./context-
|
|
70
|
+
"require": "./compose-context-provider/index.cjs",
|
|
71
|
+
"default": "./compose-context-provider/index.cjs"
|
|
81
72
|
},
|
|
82
73
|
"./create-context-reducer": {
|
|
83
74
|
"types": "./create-context-reducer/index.d.ts",
|
|
@@ -88,6 +79,15 @@
|
|
|
88
79
|
"require": "./create-context-reducer/index.cjs",
|
|
89
80
|
"default": "./create-context-reducer/index.cjs"
|
|
90
81
|
},
|
|
82
|
+
"./context-reducer": {
|
|
83
|
+
"types": "./context-reducer/index.d.ts",
|
|
84
|
+
"import": {
|
|
85
|
+
"types": "./context-reducer/index.d.ts",
|
|
86
|
+
"default": "./context-reducer/index.mjs"
|
|
87
|
+
},
|
|
88
|
+
"require": "./context-reducer/index.cjs",
|
|
89
|
+
"default": "./context-reducer/index.cjs"
|
|
90
|
+
},
|
|
91
91
|
"./create-context-state": {
|
|
92
92
|
"types": "./create-context-state/index.d.ts",
|
|
93
93
|
"import": {
|
|
@@ -97,23 +97,14 @@
|
|
|
97
97
|
"require": "./create-context-state/index.cjs",
|
|
98
98
|
"default": "./create-context-state/index.cjs"
|
|
99
99
|
},
|
|
100
|
-
"./
|
|
101
|
-
"types": "./
|
|
102
|
-
"import": {
|
|
103
|
-
"types": "./compose-context-provider/index.d.ts",
|
|
104
|
-
"default": "./compose-context-provider/index.mjs"
|
|
105
|
-
},
|
|
106
|
-
"require": "./compose-context-provider/index.cjs",
|
|
107
|
-
"default": "./compose-context-provider/index.cjs"
|
|
108
|
-
},
|
|
109
|
-
"./create-breadcrumbs": {
|
|
110
|
-
"types": "./create-breadcrumbs/index.d.ts",
|
|
100
|
+
"./context-state": {
|
|
101
|
+
"types": "./context-state/index.d.ts",
|
|
111
102
|
"import": {
|
|
112
|
-
"types": "./
|
|
113
|
-
"default": "./
|
|
103
|
+
"types": "./context-state/index.d.ts",
|
|
104
|
+
"default": "./context-state/index.mjs"
|
|
114
105
|
},
|
|
115
|
-
"require": "./
|
|
116
|
-
"default": "./
|
|
106
|
+
"require": "./context-state/index.cjs",
|
|
107
|
+
"default": "./context-state/index.cjs"
|
|
117
108
|
},
|
|
118
109
|
"./create-fixed-array": {
|
|
119
110
|
"types": "./create-fixed-array/index.d.ts",
|
|
@@ -124,6 +115,15 @@
|
|
|
124
115
|
"require": "./create-fixed-array/index.cjs",
|
|
125
116
|
"default": "./create-fixed-array/index.cjs"
|
|
126
117
|
},
|
|
118
|
+
"./create-local-storage-state": {
|
|
119
|
+
"types": "./create-local-storage-state/index.d.ts",
|
|
120
|
+
"import": {
|
|
121
|
+
"types": "./create-local-storage-state/index.d.ts",
|
|
122
|
+
"default": "./create-local-storage-state/index.mjs"
|
|
123
|
+
},
|
|
124
|
+
"require": "./create-local-storage-state/index.cjs",
|
|
125
|
+
"default": "./create-local-storage-state/index.cjs"
|
|
126
|
+
},
|
|
127
127
|
"./create-magic-portal": {
|
|
128
128
|
"types": "./create-magic-portal/index.d.ts",
|
|
129
129
|
"import": {
|
|
@@ -133,14 +133,14 @@
|
|
|
133
133
|
"require": "./create-magic-portal/index.cjs",
|
|
134
134
|
"default": "./create-magic-portal/index.cjs"
|
|
135
135
|
},
|
|
136
|
-
"./create-
|
|
137
|
-
"types": "./create-
|
|
136
|
+
"./create-breadcrumbs": {
|
|
137
|
+
"types": "./create-breadcrumbs/index.d.ts",
|
|
138
138
|
"import": {
|
|
139
|
-
"types": "./create-
|
|
140
|
-
"default": "./create-
|
|
139
|
+
"types": "./create-breadcrumbs/index.d.ts",
|
|
140
|
+
"default": "./create-breadcrumbs/index.mjs"
|
|
141
141
|
},
|
|
142
|
-
"require": "./create-
|
|
143
|
-
"default": "./create-
|
|
142
|
+
"require": "./create-breadcrumbs/index.cjs",
|
|
143
|
+
"default": "./create-breadcrumbs/index.cjs"
|
|
144
144
|
},
|
|
145
145
|
"./create-session-storage-state": {
|
|
146
146
|
"types": "./create-session-storage-state/index.d.ts",
|
|
@@ -151,6 +151,15 @@
|
|
|
151
151
|
"require": "./create-session-storage-state/index.cjs",
|
|
152
152
|
"default": "./create-session-storage-state/index.cjs"
|
|
153
153
|
},
|
|
154
|
+
"./create-stackless-error": {
|
|
155
|
+
"types": "./create-stackless-error/index.d.ts",
|
|
156
|
+
"import": {
|
|
157
|
+
"types": "./create-stackless-error/index.d.ts",
|
|
158
|
+
"default": "./create-stackless-error/index.mjs"
|
|
159
|
+
},
|
|
160
|
+
"require": "./create-stackless-error/index.cjs",
|
|
161
|
+
"default": "./create-stackless-error/index.cjs"
|
|
162
|
+
},
|
|
154
163
|
"./create-storage-hook": {
|
|
155
164
|
"types": "./create-storage-hook/index.d.ts",
|
|
156
165
|
"import": {
|
|
@@ -169,15 +178,6 @@
|
|
|
169
178
|
"require": "./create-storage-state-factory/index.cjs",
|
|
170
179
|
"default": "./create-storage-state-factory/index.cjs"
|
|
171
180
|
},
|
|
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
181
|
"./current-year": {
|
|
182
182
|
"types": "./current-year/index.d.ts",
|
|
183
183
|
"import": {
|
|
@@ -187,23 +187,14 @@
|
|
|
187
187
|
"require": "./current-year/index.cjs",
|
|
188
188
|
"default": "./current-year/index.cjs"
|
|
189
189
|
},
|
|
190
|
-
"./
|
|
191
|
-
"types": "./
|
|
192
|
-
"import": {
|
|
193
|
-
"types": "./create-local-storage-state/index.d.ts",
|
|
194
|
-
"default": "./create-local-storage-state/index.mjs"
|
|
195
|
-
},
|
|
196
|
-
"require": "./create-local-storage-state/index.cjs",
|
|
197
|
-
"default": "./create-local-storage-state/index.cjs"
|
|
198
|
-
},
|
|
199
|
-
"./is-safari": {
|
|
200
|
-
"types": "./is-safari/index.d.ts",
|
|
190
|
+
"./fetch-jsonp": {
|
|
191
|
+
"types": "./fetch-jsonp/index.d.ts",
|
|
201
192
|
"import": {
|
|
202
|
-
"types": "./
|
|
203
|
-
"default": "./
|
|
193
|
+
"types": "./fetch-jsonp/index.d.ts",
|
|
194
|
+
"default": "./fetch-jsonp/index.mjs"
|
|
204
195
|
},
|
|
205
|
-
"require": "./
|
|
206
|
-
"default": "./
|
|
196
|
+
"require": "./fetch-jsonp/index.cjs",
|
|
197
|
+
"default": "./fetch-jsonp/index.cjs"
|
|
207
198
|
},
|
|
208
199
|
"./invariant": {
|
|
209
200
|
"types": "./invariant/index.d.ts",
|
|
@@ -223,14 +214,23 @@
|
|
|
223
214
|
"require": "./magic-portal/index.cjs",
|
|
224
215
|
"default": "./magic-portal/index.cjs"
|
|
225
216
|
},
|
|
226
|
-
"./
|
|
227
|
-
"types": "./
|
|
217
|
+
"./is-safari": {
|
|
218
|
+
"types": "./is-safari/index.d.ts",
|
|
228
219
|
"import": {
|
|
229
|
-
"types": "./
|
|
230
|
-
"default": "./
|
|
220
|
+
"types": "./is-safari/index.d.ts",
|
|
221
|
+
"default": "./is-safari/index.mjs"
|
|
231
222
|
},
|
|
232
|
-
"require": "./
|
|
233
|
-
"default": "./
|
|
223
|
+
"require": "./is-safari/index.cjs",
|
|
224
|
+
"default": "./is-safari/index.cjs"
|
|
225
|
+
},
|
|
226
|
+
"./merge-props": {
|
|
227
|
+
"types": "./merge-props/index.d.ts",
|
|
228
|
+
"import": {
|
|
229
|
+
"types": "./merge-props/index.d.ts",
|
|
230
|
+
"default": "./merge-props/index.mjs"
|
|
231
|
+
},
|
|
232
|
+
"require": "./merge-props/index.cjs",
|
|
233
|
+
"default": "./merge-props/index.cjs"
|
|
234
234
|
},
|
|
235
235
|
"./merge-refs": {
|
|
236
236
|
"types": "./merge-refs/index.d.ts",
|
|
@@ -241,15 +241,6 @@
|
|
|
241
241
|
"require": "./merge-refs/index.cjs",
|
|
242
242
|
"default": "./merge-refs/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
|
"./noop": {
|
|
254
245
|
"types": "./noop/index.d.ts",
|
|
255
246
|
"import": {
|
|
@@ -259,6 +250,15 @@
|
|
|
259
250
|
"require": "./noop/index.cjs",
|
|
260
251
|
"default": "./noop/index.cjs"
|
|
261
252
|
},
|
|
253
|
+
"./no-ssr": {
|
|
254
|
+
"types": "./no-ssr/index.d.ts",
|
|
255
|
+
"import": {
|
|
256
|
+
"types": "./no-ssr/index.d.ts",
|
|
257
|
+
"default": "./no-ssr/index.mjs"
|
|
258
|
+
},
|
|
259
|
+
"require": "./no-ssr/index.cjs",
|
|
260
|
+
"default": "./no-ssr/index.cjs"
|
|
261
|
+
},
|
|
262
262
|
"./nullthrow": {
|
|
263
263
|
"types": "./nullthrow/index.d.ts",
|
|
264
264
|
"import": {
|
|
@@ -268,6 +268,15 @@
|
|
|
268
268
|
"require": "./nullthrow/index.cjs",
|
|
269
269
|
"default": "./nullthrow/index.cjs"
|
|
270
270
|
},
|
|
271
|
+
"./noop-component": {
|
|
272
|
+
"types": "./noop-component/index.d.ts",
|
|
273
|
+
"import": {
|
|
274
|
+
"types": "./noop-component/index.d.ts",
|
|
275
|
+
"default": "./noop-component/index.mjs"
|
|
276
|
+
},
|
|
277
|
+
"require": "./noop-component/index.cjs",
|
|
278
|
+
"default": "./noop-component/index.cjs"
|
|
279
|
+
},
|
|
271
280
|
"./open-new-tab": {
|
|
272
281
|
"types": "./open-new-tab/index.d.ts",
|
|
273
282
|
"import": {
|
|
@@ -277,14 +286,14 @@
|
|
|
277
286
|
"require": "./open-new-tab/index.cjs",
|
|
278
287
|
"default": "./open-new-tab/index.cjs"
|
|
279
288
|
},
|
|
280
|
-
"./
|
|
281
|
-
"types": "./
|
|
289
|
+
"./polymorphic": {
|
|
290
|
+
"types": "./polymorphic/index.d.ts",
|
|
282
291
|
"import": {
|
|
283
|
-
"types": "./
|
|
284
|
-
"default": "./
|
|
292
|
+
"types": "./polymorphic/index.d.ts",
|
|
293
|
+
"default": "./polymorphic/index.mjs"
|
|
285
294
|
},
|
|
286
|
-
"require": "./
|
|
287
|
-
"default": "./
|
|
295
|
+
"require": "./polymorphic/index.cjs",
|
|
296
|
+
"default": "./polymorphic/index.cjs"
|
|
288
297
|
},
|
|
289
298
|
"./rem": {
|
|
290
299
|
"types": "./rem/index.d.ts",
|
|
@@ -295,6 +304,15 @@
|
|
|
295
304
|
"require": "./rem/index.cjs",
|
|
296
305
|
"default": "./rem/index.cjs"
|
|
297
306
|
},
|
|
307
|
+
"./request-idle-callback": {
|
|
308
|
+
"types": "./request-idle-callback/index.d.ts",
|
|
309
|
+
"import": {
|
|
310
|
+
"types": "./request-idle-callback/index.d.ts",
|
|
311
|
+
"default": "./request-idle-callback/index.mjs"
|
|
312
|
+
},
|
|
313
|
+
"require": "./request-idle-callback/index.cjs",
|
|
314
|
+
"default": "./request-idle-callback/index.cjs"
|
|
315
|
+
},
|
|
298
316
|
"./types": {
|
|
299
317
|
"types": "./types/index.d.ts",
|
|
300
318
|
"import": {
|
|
@@ -304,15 +322,6 @@
|
|
|
304
322
|
"require": "./types/index.cjs",
|
|
305
323
|
"default": "./types/index.cjs"
|
|
306
324
|
},
|
|
307
|
-
"./typescript-happy-forward-ref": {
|
|
308
|
-
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
309
|
-
"import": {
|
|
310
|
-
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
311
|
-
"default": "./typescript-happy-forward-ref/index.mjs"
|
|
312
|
-
},
|
|
313
|
-
"require": "./typescript-happy-forward-ref/index.cjs",
|
|
314
|
-
"default": "./typescript-happy-forward-ref/index.cjs"
|
|
315
|
-
},
|
|
316
325
|
"./use": {
|
|
317
326
|
"types": "./use/index.d.ts",
|
|
318
327
|
"import": {
|
|
@@ -322,6 +331,15 @@
|
|
|
322
331
|
"require": "./use/index.cjs",
|
|
323
332
|
"default": "./use/index.cjs"
|
|
324
333
|
},
|
|
334
|
+
"./typescript-happy-forward-ref": {
|
|
335
|
+
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
336
|
+
"import": {
|
|
337
|
+
"types": "./typescript-happy-forward-ref/index.d.ts",
|
|
338
|
+
"default": "./typescript-happy-forward-ref/index.mjs"
|
|
339
|
+
},
|
|
340
|
+
"require": "./typescript-happy-forward-ref/index.cjs",
|
|
341
|
+
"default": "./typescript-happy-forward-ref/index.cjs"
|
|
342
|
+
},
|
|
325
343
|
"./use-abortable-effect": {
|
|
326
344
|
"types": "./use-abortable-effect/index.d.ts",
|
|
327
345
|
"import": {
|
|
@@ -331,15 +349,6 @@
|
|
|
331
349
|
"require": "./use-abortable-effect/index.cjs",
|
|
332
350
|
"default": "./use-abortable-effect/index.cjs"
|
|
333
351
|
},
|
|
334
|
-
"./use-array": {
|
|
335
|
-
"types": "./use-array/index.d.ts",
|
|
336
|
-
"import": {
|
|
337
|
-
"types": "./use-array/index.d.ts",
|
|
338
|
-
"default": "./use-array/index.mjs"
|
|
339
|
-
},
|
|
340
|
-
"require": "./use-array/index.cjs",
|
|
341
|
-
"default": "./use-array/index.cjs"
|
|
342
|
-
},
|
|
343
352
|
"./use-clipboard": {
|
|
344
353
|
"types": "./use-clipboard/index.d.ts",
|
|
345
354
|
"import": {
|
|
@@ -349,14 +358,14 @@
|
|
|
349
358
|
"require": "./use-clipboard/index.cjs",
|
|
350
359
|
"default": "./use-clipboard/index.cjs"
|
|
351
360
|
},
|
|
352
|
-
"./use-
|
|
353
|
-
"types": "./use-
|
|
361
|
+
"./use-array": {
|
|
362
|
+
"types": "./use-array/index.d.ts",
|
|
354
363
|
"import": {
|
|
355
|
-
"types": "./use-
|
|
356
|
-
"default": "./use-
|
|
364
|
+
"types": "./use-array/index.d.ts",
|
|
365
|
+
"default": "./use-array/index.mjs"
|
|
357
366
|
},
|
|
358
|
-
"require": "./use-
|
|
359
|
-
"default": "./use-
|
|
367
|
+
"require": "./use-array/index.cjs",
|
|
368
|
+
"default": "./use-array/index.cjs"
|
|
360
369
|
},
|
|
361
370
|
"./use-component-will-receive-update": {
|
|
362
371
|
"types": "./use-component-will-receive-update/index.d.ts",
|
|
@@ -367,6 +376,15 @@
|
|
|
367
376
|
"require": "./use-component-will-receive-update/index.cjs",
|
|
368
377
|
"default": "./use-component-will-receive-update/index.cjs"
|
|
369
378
|
},
|
|
379
|
+
"./use-composition-input": {
|
|
380
|
+
"types": "./use-composition-input/index.d.ts",
|
|
381
|
+
"import": {
|
|
382
|
+
"types": "./use-composition-input/index.d.ts",
|
|
383
|
+
"default": "./use-composition-input/index.mjs"
|
|
384
|
+
},
|
|
385
|
+
"require": "./use-composition-input/index.cjs",
|
|
386
|
+
"default": "./use-composition-input/index.cjs"
|
|
387
|
+
},
|
|
370
388
|
"./use-debounced-state": {
|
|
371
389
|
"types": "./use-debounced-state/index.d.ts",
|
|
372
390
|
"import": {
|
|
@@ -394,15 +412,6 @@
|
|
|
394
412
|
"require": "./use-error-boundary/index.cjs",
|
|
395
413
|
"default": "./use-error-boundary/index.cjs"
|
|
396
414
|
},
|
|
397
|
-
"./use-is-client": {
|
|
398
|
-
"types": "./use-is-client/index.d.ts",
|
|
399
|
-
"import": {
|
|
400
|
-
"types": "./use-is-client/index.d.ts",
|
|
401
|
-
"default": "./use-is-client/index.mjs"
|
|
402
|
-
},
|
|
403
|
-
"require": "./use-is-client/index.cjs",
|
|
404
|
-
"default": "./use-is-client/index.cjs"
|
|
405
|
-
},
|
|
406
415
|
"./use-fast-click": {
|
|
407
416
|
"types": "./use-fast-click/index.d.ts",
|
|
408
417
|
"import": {
|
|
@@ -412,6 +421,15 @@
|
|
|
412
421
|
"require": "./use-fast-click/index.cjs",
|
|
413
422
|
"default": "./use-fast-click/index.cjs"
|
|
414
423
|
},
|
|
424
|
+
"./use-is-client": {
|
|
425
|
+
"types": "./use-is-client/index.d.ts",
|
|
426
|
+
"import": {
|
|
427
|
+
"types": "./use-is-client/index.d.ts",
|
|
428
|
+
"default": "./use-is-client/index.mjs"
|
|
429
|
+
},
|
|
430
|
+
"require": "./use-is-client/index.cjs",
|
|
431
|
+
"default": "./use-is-client/index.cjs"
|
|
432
|
+
},
|
|
415
433
|
"./use-intersection": {
|
|
416
434
|
"types": "./use-intersection/index.d.ts",
|
|
417
435
|
"import": {
|
|
@@ -421,15 +439,6 @@
|
|
|
421
439
|
"require": "./use-intersection/index.cjs",
|
|
422
440
|
"default": "./use-intersection/index.cjs"
|
|
423
441
|
},
|
|
424
|
-
"./use-isomorphic-layout-effect": {
|
|
425
|
-
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
426
|
-
"import": {
|
|
427
|
-
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
428
|
-
"default": "./use-isomorphic-layout-effect/index.mjs"
|
|
429
|
-
},
|
|
430
|
-
"require": "./use-isomorphic-layout-effect/index.cjs",
|
|
431
|
-
"default": "./use-isomorphic-layout-effect/index.cjs"
|
|
432
|
-
},
|
|
433
442
|
"./use-is-online": {
|
|
434
443
|
"types": "./use-is-online/index.d.ts",
|
|
435
444
|
"import": {
|
|
@@ -439,6 +448,15 @@
|
|
|
439
448
|
"require": "./use-is-online/index.cjs",
|
|
440
449
|
"default": "./use-is-online/index.cjs"
|
|
441
450
|
},
|
|
451
|
+
"./use-isomorphic-layout-effect": {
|
|
452
|
+
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
453
|
+
"import": {
|
|
454
|
+
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
455
|
+
"default": "./use-isomorphic-layout-effect/index.mjs"
|
|
456
|
+
},
|
|
457
|
+
"require": "./use-isomorphic-layout-effect/index.cjs",
|
|
458
|
+
"default": "./use-isomorphic-layout-effect/index.cjs"
|
|
459
|
+
},
|
|
442
460
|
"./use-local-storage": {
|
|
443
461
|
"types": "./use-local-storage/index.d.ts",
|
|
444
462
|
"import": {
|
|
@@ -448,15 +466,6 @@
|
|
|
448
466
|
"require": "./use-local-storage/index.cjs",
|
|
449
467
|
"default": "./use-local-storage/index.cjs"
|
|
450
468
|
},
|
|
451
|
-
"./use-map": {
|
|
452
|
-
"types": "./use-map/index.d.ts",
|
|
453
|
-
"import": {
|
|
454
|
-
"types": "./use-map/index.d.ts",
|
|
455
|
-
"default": "./use-map/index.mjs"
|
|
456
|
-
},
|
|
457
|
-
"require": "./use-map/index.cjs",
|
|
458
|
-
"default": "./use-map/index.cjs"
|
|
459
|
-
},
|
|
460
469
|
"./use-media-query": {
|
|
461
470
|
"types": "./use-media-query/index.d.ts",
|
|
462
471
|
"import": {
|
|
@@ -466,6 +475,15 @@
|
|
|
466
475
|
"require": "./use-media-query/index.cjs",
|
|
467
476
|
"default": "./use-media-query/index.cjs"
|
|
468
477
|
},
|
|
478
|
+
"./use-map": {
|
|
479
|
+
"types": "./use-map/index.d.ts",
|
|
480
|
+
"import": {
|
|
481
|
+
"types": "./use-map/index.d.ts",
|
|
482
|
+
"default": "./use-map/index.mjs"
|
|
483
|
+
},
|
|
484
|
+
"require": "./use-map/index.cjs",
|
|
485
|
+
"default": "./use-map/index.cjs"
|
|
486
|
+
},
|
|
469
487
|
"./use-page-visibility": {
|
|
470
488
|
"types": "./use-page-visibility/index.d.ts",
|
|
471
489
|
"import": {
|
|
@@ -547,15 +565,6 @@
|
|
|
547
565
|
"require": "./use-state-with-deps/index.cjs",
|
|
548
566
|
"default": "./use-state-with-deps/index.cjs"
|
|
549
567
|
},
|
|
550
|
-
"./use-uncontrolled": {
|
|
551
|
-
"types": "./use-uncontrolled/index.d.ts",
|
|
552
|
-
"import": {
|
|
553
|
-
"types": "./use-uncontrolled/index.d.ts",
|
|
554
|
-
"default": "./use-uncontrolled/index.mjs"
|
|
555
|
-
},
|
|
556
|
-
"require": "./use-uncontrolled/index.cjs",
|
|
557
|
-
"default": "./use-uncontrolled/index.cjs"
|
|
558
|
-
},
|
|
559
568
|
"./use-typescript-happy-callback": {
|
|
560
569
|
"types": "./use-typescript-happy-callback/index.d.ts",
|
|
561
570
|
"import": {
|
|
@@ -565,6 +574,15 @@
|
|
|
565
574
|
"require": "./use-typescript-happy-callback/index.cjs",
|
|
566
575
|
"default": "./use-typescript-happy-callback/index.cjs"
|
|
567
576
|
},
|
|
577
|
+
"./use-uncontrolled": {
|
|
578
|
+
"types": "./use-uncontrolled/index.d.ts",
|
|
579
|
+
"import": {
|
|
580
|
+
"types": "./use-uncontrolled/index.d.ts",
|
|
581
|
+
"default": "./use-uncontrolled/index.mjs"
|
|
582
|
+
},
|
|
583
|
+
"require": "./use-uncontrolled/index.cjs",
|
|
584
|
+
"default": "./use-uncontrolled/index.cjs"
|
|
585
|
+
},
|
|
568
586
|
"./use-url-hash-state": {
|
|
569
587
|
"types": "./use-url-hash-state/index.d.ts",
|
|
570
588
|
"import": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("react");exports.createPolymorphic=function(r){return{propName:r,renderPolymorphic:function(n){const{props:t,defaultComponent:l,ref:c}=n,{[r]:o,...i}=t;return(null!=c&&(i.ref=c),e.isValidElement(o))?e.cloneElement(o,i):e.createElement(null!=o?o:l,i)}}};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @see https://foxact.skk.moe/polymorphic */
|
|
2
|
+
type PolymorphicComponentProps<PropName extends string, Component extends React.ElementType, OwnProps extends Record<string, any> = object> = OwnProps & {
|
|
3
|
+
[K in PropName]?: Component | React.ReactElement;
|
|
4
|
+
} & Omit<React.ComponentPropsWithRef<Component>, keyof OwnProps | PropName>;
|
|
5
|
+
/** @see https://foxact.skk.moe/polymorphic */
|
|
6
|
+
type PolymorphicRef<Component extends React.ElementType> = React.ComponentPropsWithRef<Component>['ref'];
|
|
7
|
+
interface RenderPolymorphicOptions {
|
|
8
|
+
props: Record<string, any>;
|
|
9
|
+
defaultComponent: React.ElementType;
|
|
10
|
+
ref?: React.Ref<any>;
|
|
11
|
+
}
|
|
12
|
+
/** @see https://foxact.skk.moe/polymorphic */
|
|
13
|
+
declare function createPolymorphic<PropName extends string>(propName: PropName): {
|
|
14
|
+
readonly propName: PropName;
|
|
15
|
+
readonly renderPolymorphic: (options: RenderPolymorphicOptions) => React.ReactNode;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { createPolymorphic };
|
|
19
|
+
export type { PolymorphicComponentProps, PolymorphicRef };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isValidElement as r,cloneElement as n,createElement as o}from"react";function e(e){return{propName:e,renderPolymorphic:function(t){const{props:c,defaultComponent:l,ref:u}=t,{[e]:i,...f}=c;return(null!=u&&(f.ref=u),r(i))?n(i,f):o(null!=i?i:l,f)}}}export{e as createPolymorphic};
|
package/sizes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"total":{"raw":
|
|
1
|
+
{"total":{"raw":28045,"gzip":17127,"br":14398,"zstd":17172},"exports":{"create-context-reducer":{"raw":63,"gzip":74,"br":64,"zstd":72},"compose-context-provider":{"raw":177,"gzip":155,"br":122,"zstd":144},"breadcrumbs":{"raw":879,"gzip":467,"br":395,"zstd":472},"create-context-state":{"raw":59,"gzip":72,"br":59,"zstd":68},"context-reducer":{"raw":557,"gzip":332,"br":319,"zstd":336},"context-state":{"raw":402,"gzip":259,"br":218,"zstd":259},"create-fixed-array":{"raw":452,"gzip":282,"br":248,"zstd":282},"create-magic-portal":{"raw":57,"gzip":71,"br":53,"zstd":66},"create-breadcrumbs":{"raw":56,"gzip":68,"br":52,"zstd":65},"create-local-storage-state":{"raw":169,"gzip":138,"br":111,"zstd":130},"create-session-storage-state":{"raw":173,"gzip":138,"br":108,"zstd":129},"create-stackless-error":{"raw":278,"gzip":198,"br":162,"zstd":188},"fetch-jsonp":{"raw":890,"gzip":546,"br":429,"zstd":552},"current-year":{"raw":508,"gzip":348,"br":283,"zstd":349},"invariant":{"raw":178,"gzip":156,"br":118,"zstd":149},"magic-portal":{"raw":1013,"gzip":517,"br":445,"zstd":526},"create-storage-state-factory":{"raw":364,"gzip":248,"br":197,"zstd":243},"create-storage-hook":{"raw":2418,"gzip":955,"br":834,"zstd":998},"is-safari":{"raw":233,"gzip":164,"br":119,"zstd":156},"merge-props":{"raw":1026,"gzip":556,"br":497,"zstd":575},"noop":{"raw":33,"gzip":53,"br":37,"zstd":42},"merge-refs":{"raw":525,"gzip":280,"br":235,"zstd":278},"no-ssr":{"raw":338,"gzip":267,"br":219,"zstd":268},"nullthrow":{"raw":187,"gzip":163,"br":121,"zstd":156},"noop-component":{"raw":142,"gzip":130,"br":111,"zstd":119},"polymorphic":{"raw":284,"gzip":212,"br":180,"zstd":199},"open-new-tab":{"raw":335,"gzip":255,"br":187,"zstd":255},"rem":{"raw":823,"gzip":395,"br":350,"zstd":402},"types":{"raw":0,"gzip":20,"br":1,"zstd":9},"request-idle-callback":{"raw":392,"gzip":221,"br":171,"zstd":213},"use":{"raw":298,"gzip":197,"br":160,"zstd":190},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80,"zstd":91},"use-abortable-effect":{"raw":215,"gzip":170,"br":144,"zstd":166},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154,"zstd":178},"use-array":{"raw":334,"gzip":243,"br":206,"zstd":236},"use-composition-input":{"raw":470,"gzip":286,"br":241,"zstd":296},"use-debounced-state":{"raw":401,"gzip":280,"br":242,"zstd":286},"use-error-boundary":{"raw":252,"gzip":195,"br":165,"zstd":187},"use-debounced-value":{"raw":553,"gzip":358,"br":320,"zstd":360},"use-fast-click":{"raw":499,"gzip":350,"br":284,"zstd":355},"use-is-client":{"raw":204,"gzip":153,"br":121,"zstd":148},"use-is-online":{"raw":370,"gzip":258,"br":220,"zstd":257},"use-isomorphic-layout-effect":{"raw":169,"gzip":137,"br":110,"zstd":127},"use-local-storage":{"raw":192,"gzip":143,"br":114,"zstd":137},"use-clipboard":{"raw":2723,"gzip":1332,"br":1140,"zstd":1397},"use-media-query":{"raw":604,"gzip":380,"br":315,"zstd":382},"use-map":{"raw":384,"gzip":256,"br":220,"zstd":262},"use-page-visibility":{"raw":359,"gzip":263,"br":210,"zstd":266},"use-session-storage":{"raw":198,"gzip":141,"br":118,"zstd":137},"use-resizing":{"raw":511,"gzip":334,"br":294,"zstd":342},"use-intersection":{"raw":1363,"gzip":716,"br":654,"zstd":750},"use-readonly-search-params":{"raw":1120,"gzip":573,"br":477,"zstd":584},"use-singleton":{"raw":149,"gzip":135,"br":116,"zstd":123},"use-retimer":{"raw":194,"gzip":166,"br":127,"zstd":154},"use-set":{"raw":368,"gzip":247,"br":211,"zstd":255},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":450,"gzip":318,"br":249,"zstd":321},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77,"zstd":94},"use-uncontrolled":{"raw":388,"gzip":273,"br":230,"zstd":277},"use-state-with-deps":{"raw":747,"gzip":479,"br":418,"zstd":488},"use-url-hash-state":{"raw":1077,"gzip":611,"br":536,"zstd":626}}}
|