foxact 0.2.17 → 0.2.18

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.
@@ -0,0 +1 @@
1
+ "use strict";const r={};exports.createFixedArray=e=>(r[e]||(r[e]=r[e]||Array.from(Array(e).keys())),r[e]);
@@ -0,0 +1,3 @@
1
+ declare const createFixedArray: (length: number) => readonly unknown[];
2
+
3
+ export { createFixedArray };
@@ -0,0 +1 @@
1
+ "use strict";const r={};exports.createFixedArray=e=>(r[e]||(r[e]=r[e]||Array.from(Array(e).keys())),r[e]);
@@ -0,0 +1 @@
1
+ let r={},e=e=>(r[e]||(r[e]=r[e]||Array.from(Array(e).keys())),r[e]);export{e as createFixedArray};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "description": "React Hooks/Utils done right. For browser, SSR, and React Server Components.",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -65,6 +65,15 @@
65
65
  "require": "./create-context-state/index.cjs",
66
66
  "default": "./create-context-state/index.js"
67
67
  },
68
+ "./create-fixed-array": {
69
+ "types": "./create-fixed-array/index.d.ts",
70
+ "import": {
71
+ "types": "./create-fixed-array/index.d.ts",
72
+ "default": "./create-fixed-array/index.mjs"
73
+ },
74
+ "require": "./create-fixed-array/index.cjs",
75
+ "default": "./create-fixed-array/index.js"
76
+ },
68
77
  "./noop": {
69
78
  "types": "./noop/index.d.ts",
70
79
  "import": {
@@ -110,15 +119,6 @@
110
119
  "require": "./use-array/index.cjs",
111
120
  "default": "./use-array/index.js"
112
121
  },
113
- "./use-clipboard": {
114
- "types": "./use-clipboard/index.d.ts",
115
- "import": {
116
- "types": "./use-clipboard/index.d.ts",
117
- "default": "./use-clipboard/index.mjs"
118
- },
119
- "require": "./use-clipboard/index.cjs",
120
- "default": "./use-clipboard/index.js"
121
- },
122
122
  "./use-composition-input": {
123
123
  "types": "./use-composition-input/index.d.ts",
124
124
  "import": {
@@ -164,6 +164,15 @@
164
164
  "require": "./use-intersection/index.cjs",
165
165
  "default": "./use-intersection/index.js"
166
166
  },
167
+ "./use-clipboard": {
168
+ "types": "./use-clipboard/index.d.ts",
169
+ "import": {
170
+ "types": "./use-clipboard/index.d.ts",
171
+ "default": "./use-clipboard/index.mjs"
172
+ },
173
+ "require": "./use-clipboard/index.cjs",
174
+ "default": "./use-clipboard/index.js"
175
+ },
167
176
  "./use-is-client": {
168
177
  "types": "./use-is-client/index.d.ts",
169
178
  "import": {
@@ -173,15 +182,6 @@
173
182
  "require": "./use-is-client/index.cjs",
174
183
  "default": "./use-is-client/index.js"
175
184
  },
176
- "./use-isomorphic-layout-effect": {
177
- "types": "./use-isomorphic-layout-effect/index.d.ts",
178
- "import": {
179
- "types": "./use-isomorphic-layout-effect/index.d.ts",
180
- "default": "./use-isomorphic-layout-effect/index.mjs"
181
- },
182
- "require": "./use-isomorphic-layout-effect/index.cjs",
183
- "default": "./use-isomorphic-layout-effect/index.js"
184
- },
185
185
  "./use-map": {
186
186
  "types": "./use-map/index.d.ts",
187
187
  "import": {
@@ -245,6 +245,15 @@
245
245
  "require": "./use-singleton/index.cjs",
246
246
  "default": "./use-singleton/index.js"
247
247
  },
248
+ "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
249
+ "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
250
+ "import": {
251
+ "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
252
+ "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs"
253
+ },
254
+ "require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
255
+ "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
256
+ },
248
257
  "./use-uncontrolled": {
249
258
  "types": "./use-uncontrolled/index.d.ts",
250
259
  "import": {
@@ -254,14 +263,14 @@
254
263
  "require": "./use-uncontrolled/index.cjs",
255
264
  "default": "./use-uncontrolled/index.js"
256
265
  },
257
- "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
258
- "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
266
+ "./use-isomorphic-layout-effect": {
267
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
259
268
  "import": {
260
- "types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
261
- "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs"
269
+ "types": "./use-isomorphic-layout-effect/index.d.ts",
270
+ "default": "./use-isomorphic-layout-effect/index.mjs"
262
271
  },
263
- "require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
264
- "default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js"
272
+ "require": "./use-isomorphic-layout-effect/index.cjs",
273
+ "default": "./use-isomorphic-layout-effect/index.js"
265
274
  }
266
275
  }
267
276
  }
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":9337,"gzip":6112,"br":0},"exports":{"context-state":{"raw":371,"gzip":240,"br":204},"noop":{"raw":32,"gzip":52,"br":36},"request-idle-callback":{"raw":407,"gzip":231,"br":180},"typescript-happy-forward-ref":{"raw":118,"gzip":102,"br":87},"use":{"raw":279,"gzip":175,"br":151},"use-array":{"raw":329,"gzip":242,"br":201},"use-composition-input":{"raw":449,"gzip":280,"br":240},"use-clipboard":{"raw":1071,"gzip":614,"br":527},"use-debounced-value":{"raw":370,"gzip":263,"br":214},"create-context-state":{"raw":146,"gzip":116,"br":102},"use-is-client":{"raw":148,"gzip":143,"br":115},"use-debounced-state":{"raw":380,"gzip":275,"br":231},"use-map":{"raw":348,"gzip":243,"br":210},"use-error-boundary":{"raw":238,"gzip":194,"br":158},"use-next-pathname":{"raw":313,"gzip":236,"br":196},"use-intersection":{"raw":1214,"gzip":652,"br":592},"use-react-router-is-match":{"raw":562,"gzip":369,"br":309},"use-retimer":{"raw":197,"gzip":165,"br":125},"use-set":{"raw":349,"gzip":242,"br":203},"use-singleton":{"raw":135,"gzip":129,"br":111},"use-uncontrolled":{"raw":293,"gzip":228,"br":189},"use-isomorphic-layout-effect":{"raw":177,"gzip":143,"br":120},"use-react-router-enable-concurrent-navigation":{"raw":950,"gzip":453,"br":373},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":461,"gzip":325,"br":256}}}
1
+ {"total":{"raw":9461,"gzip":6227,"br":0},"exports":{"context-state":{"raw":371,"gzip":240,"br":204},"create-context-state":{"raw":146,"gzip":116,"br":102},"create-fixed-array":{"raw":99,"gzip":103,"br":93},"noop":{"raw":32,"gzip":52,"br":36},"request-idle-callback":{"raw":407,"gzip":231,"br":180},"typescript-happy-forward-ref":{"raw":118,"gzip":102,"br":87},"use":{"raw":279,"gzip":175,"br":151},"use-array":{"raw":329,"gzip":242,"br":201},"use-composition-input":{"raw":449,"gzip":280,"br":240},"use-debounced-state":{"raw":405,"gzip":287,"br":241},"use-debounced-value":{"raw":370,"gzip":263,"br":214},"use-error-boundary":{"raw":238,"gzip":194,"br":158},"use-intersection":{"raw":1214,"gzip":652,"br":592},"use-is-client":{"raw":148,"gzip":143,"br":115},"use-clipboard":{"raw":1071,"gzip":614,"br":527},"use-next-pathname":{"raw":313,"gzip":236,"br":196},"use-map":{"raw":348,"gzip":243,"br":210},"use-react-router-enable-concurrent-navigation":{"raw":950,"gzip":453,"br":373},"use-retimer":{"raw":197,"gzip":165,"br":125},"use-set":{"raw":349,"gzip":242,"br":203},"use-singleton":{"raw":135,"gzip":129,"br":111},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":461,"gzip":325,"br":256},"use-react-router-is-match":{"raw":562,"gzip":369,"br":309},"use-uncontrolled":{"raw":293,"gzip":228,"br":189},"use-isomorphic-layout-effect":{"raw":177,"gzip":143,"br":120}}}
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../use-retimer/index.cjs");exports.useDebouncedState=function(t,u){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],[n,s]=e.useState(t),c=e.useRef(!0),o=r.useRetimer(),a=e.useCallback(e=>{c.current&&i?s(e):o(window.setTimeout(()=>{c.current=!0,s(e)},u)),c.current=!1},[i,o,u]);return[n,a]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../use-retimer/index.cjs");exports.useDebouncedState=function(t,u){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],[n,s]=e.useState(t),c=e.useRef(!0),a=r.useRetimer(),l=e.useCallback(e=>{c.current&&i?s(e):a(window.setTimeout(()=>{c.current=!0,s(e)},u)),c.current=!1},[i,a,u]),o=e.useCallback(e=>{a(),s(e)},[a]);return[n,l,o]};
@@ -1,4 +1,4 @@
1
1
  /** @see https://foxact.skk.moe/use-debounced-state */
2
- declare function useDebouncedState<T>(defaultValue: T | (() => T), wait: number, leading?: boolean): readonly [T, (newValue: T) => void];
2
+ declare function useDebouncedState<T>(defaultValue: T | (() => T), wait: number, leading?: boolean): readonly [T, (newValue: T) => void, (newValue: T) => void];
3
3
 
4
4
  export { useDebouncedState };
@@ -1 +1 @@
1
- "use strict";require("client-only");var e=require("react"),r=require("../use-retimer/index.js");exports.useDebouncedState=function(t,u){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],[n,s]=e.useState(t),c=e.useRef(!0),o=r.useRetimer(),a=e.useCallback(e=>{c.current&&i?s(e):o(window.setTimeout(()=>{c.current=!0,s(e)},u)),c.current=!1},[i,o,u]);return[n,a]};
1
+ "use strict";require("client-only");var e=require("react"),r=require("../use-retimer/index.js");exports.useDebouncedState=function(t,u){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],[n,s]=e.useState(t),c=e.useRef(!0),a=r.useRetimer(),l=e.useCallback(e=>{c.current&&i?s(e):a(window.setTimeout(()=>{c.current=!0,s(e)},u)),c.current=!1},[i,a,u]),o=e.useCallback(e=>{a(),s(e)},[a]);return[n,l,o]};
@@ -1 +1 @@
1
- import"client-only";import{useState as e,useRef as t,useCallback as r}from"react";import{useRetimer as n}from"../use-retimer/index.mjs";function o(o,i){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2],[m,c]=e(o),d=t(!0),l=n(),p=r(e=>{d.current&&u?c(e):l(window.setTimeout(()=>{d.current=!0,c(e)},i)),d.current=!1},[u,l,i]);return[m,p]}export{o as useDebouncedState};
1
+ import"client-only";import{useState as e,useRef as t,useCallback as r}from"react";import{useRetimer as n}from"../use-retimer/index.mjs";function o(o,i){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2],[m,c]=e(o),d=t(!0),l=n(),p=r(e=>{d.current&&u?c(e):l(window.setTimeout(()=>{d.current=!0,c(e)},i)),d.current=!1},[u,l,i]),s=r(e=>{l(),c(e)},[l]);return[m,p,s]}export{o as useDebouncedState};
@@ -1,4 +1,4 @@
1
1
  /** @see https://foxact.skk.moe/use-retimer */
2
- declare const useRetimer: () => (timerId: number) => void;
2
+ declare const useRetimer: () => (timerId?: number) => void;
3
3
 
4
4
  export { useRetimer };