use-good-hooks 1.0.34 → 1.0.35

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/README.md CHANGED
@@ -244,7 +244,7 @@ const TextEditor = () => {
244
244
  - `initialState`: The initial state value
245
245
  - `options`: (Optional) Configuration options:
246
246
  - `debounceSettings`: Debounce settings object (default: { leading: true, trailing: false })
247
- - `debounceTime`: Time in milliseconds to debounce the state changes (default: 0)
247
+ - `debounceMs`: Time in milliseconds to debounce the state changes (default: 0)
248
248
  - `immutable`: Boolean indicating if the state should be treated as immutable (default: false)
249
249
  - `maxCapacity`: Maximum number of history entries to keep (default: 10)
250
250
  - `onChange`: Function to call when the state changes
@@ -516,7 +516,7 @@ const [state, setState] = useTemporaryState('initial', 1000);
516
516
  #### Parameters
517
517
 
518
518
  - `initialState`: The initial state value
519
- - `timeout`: The timeout duration in milliseconds (default: 3000)
519
+ - `ms`: The timeout duration in milliseconds (default: 3000)
520
520
 
521
521
  #### Returns
522
522
 
@@ -1,4 +1,4 @@
1
- declare const useDebounce: <T>(value: T, delay?: number) => T;
1
+ declare const useDebounce: <T>(value: T, ms?: number) => T;
2
2
  export default useDebounce;
3
3
 
4
4
  export { }
@@ -1,6 +1,6 @@
1
1
  import { useState as s, useRef as d, useEffect as n } from "react";
2
2
  import f from "lodash/debounce";
3
- const b = 300, D = (e, o = b) => {
3
+ const b = 300, p = (e, o = b) => {
4
4
  const [u, r] = s(e), c = d(
5
5
  f((t) => {
6
6
  r(t);
@@ -16,5 +16,5 @@ const b = 300, D = (e, o = b) => {
16
16
  }, []), u;
17
17
  };
18
18
  export {
19
- D as default
19
+ p as default
20
20
  };
@@ -35,7 +35,7 @@ declare type HistoryState<T> = {
35
35
 
36
36
  declare type UseHistoryOptionsState<T> = {
37
37
  debounceSettings?: DebounceSettings;
38
- debounceTime?: number;
38
+ debounceMs?: number;
39
39
  immutable?: boolean;
40
40
  maxCapacity?: number;
41
41
  onChange?: HistoryOnChange<T>;
@@ -1,13 +1,13 @@
1
- import { useRef as F, useReducer as H, useCallback as d } from "react";
2
- import J from "lodash/cloneDeep";
3
- import M from "lodash/isNil";
1
+ import { useRef as M, useReducer as T, useCallback as d } from "react";
2
+ import H from "lodash/cloneDeep";
3
+ import J from "lodash/isNil";
4
4
  import E from "lodash/size";
5
5
  import k from "./use-debounce-fn.js";
6
6
  const q = {
7
7
  future: [],
8
8
  past: [],
9
9
  present: null
10
- }, l = (e, r) => r ? e : J(e), v = (e, r, y) => y ? e === r : JSON.stringify(e) === JSON.stringify(r), z = ({
10
+ }, l = (e, r) => r ? e : H(e), v = (e, r, y) => y ? e === r : JSON.stringify(e) === JSON.stringify(r), z = ({
11
11
  action: e,
12
12
  immutable: r,
13
13
  maxCapacity: y,
@@ -77,7 +77,7 @@ const q = {
77
77
  }), w;
78
78
  }
79
79
  let u = [...n];
80
- p !== null && (u = [...u, l(p, r)]), !M(y) && y > 0 && E(u) > y && (u = u.slice(E(u) - y));
80
+ p !== null && (u = [...u, l(p, r)]), !J(y) && y > 0 && E(u) > y && (u = u.slice(E(u) - y));
81
81
  const c = {
82
82
  future: [],
83
83
  past: u,
@@ -106,9 +106,9 @@ const q = {
106
106
  }
107
107
  }
108
108
  }, G = (e, r) => {
109
- const { maxCapacity: y, debounceTime: t, debounceSettings: f, onChange: o, immutable: n } = r || {}, S = F(e), [p, s] = H(
110
- (i, T) => z({
111
- action: T,
109
+ const { maxCapacity: y, debounceMs: t, debounceSettings: f, onChange: o, immutable: n } = r || {}, S = M(e), [p, s] = T(
110
+ (i, F) => z({
111
+ action: F,
112
112
  immutable: n,
113
113
  maxCapacity: y,
114
114
  onChange: o,
@@ -1,7 +1,7 @@
1
1
  import { Dispatch } from 'react';
2
2
  import { SetStateAction } from 'react';
3
3
 
4
- declare const useTemporaryState: <T>(initialState: T, timeout: number) => readonly [T, Dispatch<SetStateAction<T>>];
4
+ declare const useTemporaryState: <T>(initialState: T, ms: number) => readonly [T, Dispatch<SetStateAction<T>>];
5
5
  export default useTemporaryState;
6
6
 
7
7
  export { }
@@ -1,11 +1,11 @@
1
- import { useRef as o, useState as c, useEffect as n } from "react";
1
+ import { useRef as s, useState as c, useEffect as n } from "react";
2
2
  const m = (e, r) => {
3
- const t = o(null), [u, s] = c(e);
3
+ const t = s(null), [u, o] = c(e);
4
4
  return n(() => (clearTimeout(t.current), t.current = setTimeout(() => {
5
- s(e);
5
+ o(e);
6
6
  }, r), () => {
7
7
  clearTimeout(t.current);
8
- }), [e, u, r]), [u, s];
8
+ }), [e, u, r]), [u, o];
9
9
  };
10
10
  export {
11
11
  m as default
@@ -1,4 +1,4 @@
1
- declare const useThrottle: <T>(value: T, delay?: number) => T;
1
+ declare const useThrottle: <T>(value: T, ms?: number) => T;
2
2
  export default useThrottle;
3
3
 
4
4
  export { }
package/package.json CHANGED
@@ -50,5 +50,5 @@
50
50
  "test:coverage": "vitest --coverage --run",
51
51
  "test:watch": "vitest"
52
52
  },
53
- "version": "1.0.34"
53
+ "version": "1.0.35"
54
54
  }