foxact 0.2.29 → 0.2.30

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 +1 @@
1
- "use strict";var e=require("react");exports.ComposeContextProvider=r=>{let{contexts:t,children:o}=r;return t.reduceRight((r,t)=>e.cloneElement(t,{children:r}),o)};
1
+ "use strict";var e=require("react");const r=e.memo(r=>{let{contexts:t,children:o}=r;return t.reduceRight((r,t)=>e.cloneElement(t,{children:r}),o)});exports.ComposeContextProvider=r;
@@ -3,6 +3,7 @@ import * as react from 'react';
3
3
  interface ContextComposeProviderProps extends React.PropsWithChildren {
4
4
  contexts: React.ReactElement[];
5
5
  }
6
- declare const ComposeContextProvider: ({ contexts, children }: ContextComposeProviderProps) => react.ReactNode;
6
+ /** @see https://foxact.skk.moe/compose-context-provider */
7
+ declare const ComposeContextProvider: react.MemoExoticComponent<({ contexts, children }: ContextComposeProviderProps) => react.ReactNode>;
7
8
 
8
9
  export { ComposeContextProvider, type ContextComposeProviderProps };
@@ -1 +1 @@
1
- "use strict";var e=require("react");exports.ComposeContextProvider=r=>{let{contexts:t,children:o}=r;return t.reduceRight((r,t)=>e.cloneElement(t,{children:r}),o)};
1
+ "use strict";var e=require("react");const r=e.memo(r=>{let{contexts:t,children:o}=r;return t.reduceRight((r,t)=>e.cloneElement(t,{children:r}),o)});exports.ComposeContextProvider=r;
@@ -1 +1 @@
1
- import{cloneElement as e}from"react";const r=r=>{let{contexts:t,children:o}=r;return t.reduceRight((r,t)=>e(t,{children:r}),o)};export{r as ComposeContextProvider};
1
+ import{memo as e,cloneElement as r}from"react";const t=e(e=>{let{contexts:t,children:o}=e;return t.reduceRight((e,t)=>r(t,{children:e}),o)});export{t as ComposeContextProvider};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");var i=r.memo(function(i){let{defaultYear:n,...u}=i;"undefined"==typeof window&&void 0===n&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[o,a]=r.useState(n||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:o})});module.exports=i;
2
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");const n=r.memo(n=>{let{defaultYear:i,...u}=n;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(i||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:s})});"production"!==process.env.NODE_ENV&&(n.displayName="CurrentYear"),exports.CurrentYear=n;
@@ -4,7 +4,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  interface CurrentYearProps extends React.ComponentProps<'span'> {
5
5
  defaultYear?: number;
6
6
  }
7
- declare function CopyrightYear({ defaultYear, ...restProps }: CurrentYearProps): react_jsx_runtime.JSX.Element;
8
- declare const _default: react.MemoExoticComponent<typeof CopyrightYear>;
7
+ /** @see https://foxact.skk.moe/current-year */
8
+ declare const CurrentYear: react.MemoExoticComponent<({ defaultYear, ...restProps }: CurrentYearProps) => react_jsx_runtime.JSX.Element>;
9
9
 
10
- export { _default as default };
10
+ export { CurrentYear };
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.js");require("client-only");var i=r.memo(function(i){let{defaultYear:n,...u}=i;"undefined"==typeof window&&void 0===n&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[o,a]=r.useState(n||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:o})});module.exports=i;
2
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.js");require("client-only");const n=r.memo(n=>{let{defaultYear:i,...u}=n;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(i||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:s})});"production"!==process.env.NODE_ENV&&(n.displayName="CurrentYear"),exports.CurrentYear=n;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";var i=r(function(r){let{defaultYear:i,...o}=r;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,d]=t(i||new Date().getFullYear());return n(()=>{d(new Date().getFullYear())},[]),e("span",{...o,children:a})});export{i as default};
2
+ import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";const o=r(r=>{let{defaultYear:o,...i}=r;"undefined"==typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,s]=t(o||new Date().getFullYear());return n(()=>{s(new Date().getFullYear())},[]),e("span",{...i,children:a})});"production"!==process.env.NODE_ENV&&(o.displayName="CurrentYear");export{o as CurrentYear};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.29",
3
+ "version": "0.2.30",
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": {
@@ -67,6 +67,15 @@
67
67
  "exports": {
68
68
  "./package.json": "./package.json",
69
69
  "./sizes.json": "./sizes.json",
70
+ "./use-uncontrolled": {
71
+ "types": "./use-uncontrolled/index.d.ts",
72
+ "import": {
73
+ "types": "./use-uncontrolled/index.d.ts",
74
+ "default": "./use-uncontrolled/index.mjs"
75
+ },
76
+ "require": "./use-uncontrolled/index.cjs",
77
+ "default": "./use-uncontrolled/index.js"
78
+ },
70
79
  "./nullthrow": {
71
80
  "types": "./nullthrow/index.d.ts",
72
81
  "import": {
@@ -76,14 +85,14 @@
76
85
  "require": "./nullthrow/index.cjs",
77
86
  "default": "./nullthrow/index.js"
78
87
  },
79
- "./use-uncontrolled": {
80
- "types": "./use-uncontrolled/index.d.ts",
88
+ "./use-retimer": {
89
+ "types": "./use-retimer/index.d.ts",
81
90
  "import": {
82
- "types": "./use-uncontrolled/index.d.ts",
83
- "default": "./use-uncontrolled/index.mjs"
91
+ "types": "./use-retimer/index.d.ts",
92
+ "default": "./use-retimer/index.mjs"
84
93
  },
85
- "require": "./use-uncontrolled/index.cjs",
86
- "default": "./use-uncontrolled/index.js"
94
+ "require": "./use-retimer/index.cjs",
95
+ "default": "./use-retimer/index.js"
87
96
  },
88
97
  "./use-error-boundary": {
89
98
  "types": "./use-error-boundary/index.d.ts",
@@ -103,15 +112,6 @@
103
112
  "require": "./rem/index.cjs",
104
113
  "default": "./rem/index.js"
105
114
  },
106
- "./use-retimer": {
107
- "types": "./use-retimer/index.d.ts",
108
- "import": {
109
- "types": "./use-retimer/index.d.ts",
110
- "default": "./use-retimer/index.mjs"
111
- },
112
- "require": "./use-retimer/index.cjs",
113
- "default": "./use-retimer/index.js"
114
- },
115
115
  "./use-url-hash-state": {
116
116
  "types": "./use-url-hash-state/index.d.ts",
117
117
  "import": {
@@ -166,15 +166,6 @@
166
166
  "require": "./use-map/index.cjs",
167
167
  "default": "./use-map/index.js"
168
168
  },
169
- "./use": {
170
- "types": "./use/index.d.ts",
171
- "import": {
172
- "types": "./use/index.d.ts",
173
- "default": "./use/index.mjs"
174
- },
175
- "require": "./use/index.cjs",
176
- "default": "./use/index.js"
177
- },
178
169
  "./typescript-happy-forward-ref": {
179
170
  "types": "./typescript-happy-forward-ref/index.d.ts",
180
171
  "import": {
@@ -184,6 +175,15 @@
184
175
  "require": "./typescript-happy-forward-ref/index.cjs",
185
176
  "default": "./typescript-happy-forward-ref/index.js"
186
177
  },
178
+ "./use": {
179
+ "types": "./use/index.d.ts",
180
+ "import": {
181
+ "types": "./use/index.d.ts",
182
+ "default": "./use/index.mjs"
183
+ },
184
+ "require": "./use/index.cjs",
185
+ "default": "./use/index.js"
186
+ },
187
187
  "./compose-context-provider": {
188
188
  "types": "./compose-context-provider/index.d.ts",
189
189
  "import": {
@@ -220,15 +220,6 @@
220
220
  "require": "./use-singleton/index.cjs",
221
221
  "default": "./use-singleton/index.js"
222
222
  },
223
- "./use-intersection": {
224
- "types": "./use-intersection/index.d.ts",
225
- "import": {
226
- "types": "./use-intersection/index.d.ts",
227
- "default": "./use-intersection/index.mjs"
228
- },
229
- "require": "./use-intersection/index.cjs",
230
- "default": "./use-intersection/index.js"
231
- },
232
223
  "./no-ssr": {
233
224
  "types": "./no-ssr/index.d.ts",
234
225
  "import": {
@@ -238,6 +229,15 @@
238
229
  "require": "./no-ssr/index.cjs",
239
230
  "default": "./no-ssr/index.js"
240
231
  },
232
+ "./use-intersection": {
233
+ "types": "./use-intersection/index.d.ts",
234
+ "import": {
235
+ "types": "./use-intersection/index.d.ts",
236
+ "default": "./use-intersection/index.mjs"
237
+ },
238
+ "require": "./use-intersection/index.cjs",
239
+ "default": "./use-intersection/index.js"
240
+ },
241
241
  "./current-year": {
242
242
  "types": "./current-year/index.d.ts",
243
243
  "import": {
@@ -274,15 +274,6 @@
274
274
  "require": "./use-react-router-enable-concurrent-navigation/index.cjs",
275
275
  "default": "./use-react-router-enable-concurrent-navigation/index.js"
276
276
  },
277
- "./use-next-pathname": {
278
- "types": "./use-next-pathname/index.d.ts",
279
- "import": {
280
- "types": "./use-next-pathname/index.d.ts",
281
- "default": "./use-next-pathname/index.mjs"
282
- },
283
- "require": "./use-next-pathname/index.cjs",
284
- "default": "./use-next-pathname/index.js"
285
- },
286
277
  "./use-composition-input": {
287
278
  "types": "./use-composition-input/index.d.ts",
288
279
  "import": {
@@ -292,6 +283,15 @@
292
283
  "require": "./use-composition-input/index.cjs",
293
284
  "default": "./use-composition-input/index.js"
294
285
  },
286
+ "./use-next-pathname": {
287
+ "types": "./use-next-pathname/index.d.ts",
288
+ "import": {
289
+ "types": "./use-next-pathname/index.d.ts",
290
+ "default": "./use-next-pathname/index.mjs"
291
+ },
292
+ "require": "./use-next-pathname/index.cjs",
293
+ "default": "./use-next-pathname/index.js"
294
+ },
295
295
  "./use-session-storage": {
296
296
  "types": "./use-session-storage/index.d.ts",
297
297
  "import": {
@@ -310,15 +310,6 @@
310
310
  "require": "./invariant/index.cjs",
311
311
  "default": "./invariant/index.js"
312
312
  },
313
- "./use-debounced-value": {
314
- "types": "./use-debounced-value/index.d.ts",
315
- "import": {
316
- "types": "./use-debounced-value/index.d.ts",
317
- "default": "./use-debounced-value/index.mjs"
318
- },
319
- "require": "./use-debounced-value/index.cjs",
320
- "default": "./use-debounced-value/index.js"
321
- },
322
313
  "./create-storage-hook": {
323
314
  "types": "./create-storage-hook/index.d.ts",
324
315
  "import": {
@@ -328,6 +319,15 @@
328
319
  "require": "./create-storage-hook/index.cjs",
329
320
  "default": "./create-storage-hook/index.js"
330
321
  },
322
+ "./use-debounced-value": {
323
+ "types": "./use-debounced-value/index.d.ts",
324
+ "import": {
325
+ "types": "./use-debounced-value/index.d.ts",
326
+ "default": "./use-debounced-value/index.mjs"
327
+ },
328
+ "require": "./use-debounced-value/index.cjs",
329
+ "default": "./use-debounced-value/index.js"
330
+ },
331
331
  "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
332
332
  "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
333
333
  "import": {
@@ -337,15 +337,6 @@
337
337
  "require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
338
338
  "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
339
339
  },
340
- "./context-state": {
341
- "types": "./context-state/index.d.ts",
342
- "import": {
343
- "types": "./context-state/index.d.ts",
344
- "default": "./context-state/index.mjs"
345
- },
346
- "require": "./context-state/index.cjs",
347
- "default": "./context-state/index.js"
348
- },
349
340
  "./use-local-storage": {
350
341
  "types": "./use-local-storage/index.d.ts",
351
342
  "import": {
@@ -355,14 +346,14 @@
355
346
  "require": "./use-local-storage/index.cjs",
356
347
  "default": "./use-local-storage/index.js"
357
348
  },
358
- "./use-isomorphic-layout-effect": {
359
- "types": "./use-isomorphic-layout-effect/index.d.ts",
349
+ "./context-state": {
350
+ "types": "./context-state/index.d.ts",
360
351
  "import": {
361
- "types": "./use-isomorphic-layout-effect/index.d.ts",
362
- "default": "./use-isomorphic-layout-effect/index.mjs"
352
+ "types": "./context-state/index.d.ts",
353
+ "default": "./context-state/index.mjs"
363
354
  },
364
- "require": "./use-isomorphic-layout-effect/index.cjs",
365
- "default": "./use-isomorphic-layout-effect/index.js"
355
+ "require": "./context-state/index.cjs",
356
+ "default": "./context-state/index.js"
366
357
  },
367
358
  "./create-context-state": {
368
359
  "types": "./create-context-state/index.d.ts",
@@ -381,6 +372,15 @@
381
372
  },
382
373
  "require": "./use-array/index.cjs",
383
374
  "default": "./use-array/index.js"
375
+ },
376
+ "./use-isomorphic-layout-effect": {
377
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
378
+ "import": {
379
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
380
+ "default": "./use-isomorphic-layout-effect/index.mjs"
381
+ },
382
+ "require": "./use-isomorphic-layout-effect/index.cjs",
383
+ "default": "./use-isomorphic-layout-effect/index.js"
384
384
  }
385
385
  }
386
386
  }
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":15590,"gzip":9630,"br":0},"exports":{"use-error-boundary":{"raw":244,"gzip":196,"br":159},"nullthrow":{"raw":194,"gzip":167,"br":128},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-is-client":{"raw":151,"gzip":142,"br":118},"rem":{"raw":734,"gzip":380,"br":333},"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-set":{"raw":347,"gzip":240,"br":203},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"use-map":{"raw":346,"gzip":244,"br":210},"use":{"raw":276,"gzip":182,"br":150},"compose-context-provider":{"raw":164,"gzip":148,"br":114},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-react-router-is-match":{"raw":568,"gzip":371,"br":309},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"no-ssr":{"raw":389,"gzip":269,"br":228},"use-intersection":{"raw":1230,"gzip":649,"br":597},"create-fixed-array":{"raw":100,"gzip":104,"br":89},"current-year":{"raw":527,"gzip":358,"br":290},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"use-clipboard":{"raw":1067,"gzip":611,"br":524},"use-composition-input":{"raw":454,"gzip":281,"br":238},"invariant":{"raw":178,"gzip":156,"br":118},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387},"use-session-storage":{"raw":316,"gzip":181,"br":152},"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},"create-context-state":{"raw":145,"gzip":116,"br":96},"use-local-storage":{"raw":310,"gzip":184,"br":157},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"create-storage-hook":{"raw":2090,"gzip":891,"br":775},"use-array":{"raw":329,"gzip":238,"br":199}}}
1
+ {"total":{"raw":15668,"gzip":9679,"br":0},"exports":{"nullthrow":{"raw":194,"gzip":167,"br":128},"use-retimer":{"raw":200,"gzip":165,"br":123},"use-is-client":{"raw":151,"gzip":142,"br":118},"use-uncontrolled":{"raw":296,"gzip":227,"br":193},"use-error-boundary":{"raw":244,"gzip":196,"br":159},"noop":{"raw":33,"gzip":53,"br":37},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"rem":{"raw":734,"gzip":380,"br":333},"use-set":{"raw":347,"gzip":240,"br":203},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"use-url-hash-state":{"raw":1069,"gzip":613,"br":534},"use-map":{"raw":346,"gzip":244,"br":210},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"use":{"raw":276,"gzip":182,"br":150},"use-singleton":{"raw":138,"gzip":129,"br":109},"use-react-router-is-match":{"raw":568,"gzip":371,"br":309},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"no-ssr":{"raw":389,"gzip":269,"br":228},"current-year":{"raw":592,"gzip":400,"br":326},"create-fixed-array":{"raw":100,"gzip":104,"br":89},"use-clipboard":{"raw":1067,"gzip":611,"br":524},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-composition-input":{"raw":454,"gzip":281,"br":238},"use-session-storage":{"raw":316,"gzip":181,"br":152},"use-react-router-enable-concurrent-navigation":{"raw":960,"gzip":470,"br":387},"use-next-pathname":{"raw":321,"gzip":236,"br":199},"invariant":{"raw":178,"gzip":156,"br":118},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":254},"use-debounced-value":{"raw":470,"gzip":309,"br":252},"use-local-storage":{"raw":310,"gzip":184,"br":157},"create-context-state":{"raw":145,"gzip":116,"br":96},"context-state":{"raw":377,"gzip":241,"br":207},"use-array":{"raw":329,"gzip":238,"br":199},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":113},"create-storage-hook":{"raw":2090,"gzip":891,"br":775}}}