@tanstack/solid-pacer 0.21.1 → 0.23.0

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.
Files changed (170) hide show
  1. package/README.md +21 -6
  2. package/dist/async-batcher/createAsyncBatcher.d.ts +5 -10
  3. package/dist/async-batcher/createAsyncBatcher.js +2 -5
  4. package/dist/async-debouncer/createAsyncDebouncer.d.ts +8 -12
  5. package/dist/async-debouncer/createAsyncDebouncer.js +5 -7
  6. package/dist/async-queuer/createAsyncQueuer.d.ts +9 -12
  7. package/dist/async-queuer/createAsyncQueuer.js +4 -5
  8. package/dist/async-rate-limiter/createAsyncRateLimiter.d.ts +10 -13
  9. package/dist/async-rate-limiter/createAsyncRateLimiter.js +7 -8
  10. package/dist/async-throttler/createAsyncThrottler.d.ts +8 -14
  11. package/dist/async-throttler/createAsyncThrottler.js +5 -9
  12. package/dist/batcher/createBatcher.d.ts +11 -15
  13. package/dist/batcher/createBatcher.js +6 -8
  14. package/dist/debouncer/createDebouncedSignal.d.ts +2 -5
  15. package/dist/debouncer/createDebouncedSignal.js +1 -2
  16. package/dist/debouncer/createDebouncedValue.d.ts +2 -5
  17. package/dist/debouncer/createDebouncedValue.js +1 -2
  18. package/dist/debouncer/createDebouncer.d.ts +4 -7
  19. package/dist/debouncer/createDebouncer.js +1 -2
  20. package/dist/provider/PacerProvider.d.ts +6 -9
  21. package/dist/provider/PacerProvider.js +1 -2
  22. package/dist/queuer/createQueuedSignal.d.ts +2 -5
  23. package/dist/queuer/createQueuedSignal.js +1 -2
  24. package/dist/queuer/createQueuer.d.ts +4 -7
  25. package/dist/queuer/createQueuer.js +1 -2
  26. package/dist/rate-limiter/createRateLimitedSignal.d.ts +12 -14
  27. package/dist/rate-limiter/createRateLimitedSignal.js +11 -11
  28. package/dist/rate-limiter/createRateLimitedValue.d.ts +2 -5
  29. package/dist/rate-limiter/createRateLimitedValue.js +1 -2
  30. package/dist/rate-limiter/createRateLimiter.d.ts +8 -10
  31. package/dist/rate-limiter/createRateLimiter.js +5 -5
  32. package/dist/throttler/createThrottledSignal.d.ts +2 -7
  33. package/dist/throttler/createThrottledSignal.js +1 -4
  34. package/dist/throttler/createThrottledValue.d.ts +2 -7
  35. package/dist/throttler/createThrottledValue.js +1 -4
  36. package/dist/throttler/createThrottler.d.ts +4 -9
  37. package/dist/throttler/createThrottler.js +1 -4
  38. package/package.json +24 -68
  39. package/dist/async-batcher/createAsyncBatcher.cjs +0 -166
  40. package/dist/async-batcher/createAsyncBatcher.cjs.map +0 -1
  41. package/dist/async-batcher/createAsyncBatcher.d.cts +0 -178
  42. package/dist/async-batcher/createAsyncBatcher.js.map +0 -1
  43. package/dist/async-batcher/index.cjs +0 -11
  44. package/dist/async-batcher/index.d.cts +0 -3
  45. package/dist/async-debouncer/createAsyncDebouncer.cjs +0 -151
  46. package/dist/async-debouncer/createAsyncDebouncer.cjs.map +0 -1
  47. package/dist/async-debouncer/createAsyncDebouncer.d.cts +0 -164
  48. package/dist/async-debouncer/createAsyncDebouncer.js.map +0 -1
  49. package/dist/async-debouncer/index.cjs +0 -11
  50. package/dist/async-debouncer/index.d.cts +0 -3
  51. package/dist/async-queuer/createAsyncQueuer.cjs +0 -158
  52. package/dist/async-queuer/createAsyncQueuer.cjs.map +0 -1
  53. package/dist/async-queuer/createAsyncQueuer.d.cts +0 -170
  54. package/dist/async-queuer/createAsyncQueuer.js.map +0 -1
  55. package/dist/async-queuer/index.cjs +0 -11
  56. package/dist/async-queuer/index.d.cts +0 -3
  57. package/dist/async-rate-limiter/createAsyncRateLimiter.cjs +0 -193
  58. package/dist/async-rate-limiter/createAsyncRateLimiter.cjs.map +0 -1
  59. package/dist/async-rate-limiter/createAsyncRateLimiter.d.cts +0 -209
  60. package/dist/async-rate-limiter/createAsyncRateLimiter.js.map +0 -1
  61. package/dist/async-rate-limiter/index.cjs +0 -11
  62. package/dist/async-rate-limiter/index.d.cts +0 -3
  63. package/dist/async-throttler/createAsyncThrottler.cjs +0 -151
  64. package/dist/async-throttler/createAsyncThrottler.cjs.map +0 -1
  65. package/dist/async-throttler/createAsyncThrottler.d.cts +0 -164
  66. package/dist/async-throttler/createAsyncThrottler.js.map +0 -1
  67. package/dist/async-throttler/index.cjs +0 -11
  68. package/dist/async-throttler/index.d.cts +0 -3
  69. package/dist/batcher/createBatcher.cjs +0 -132
  70. package/dist/batcher/createBatcher.cjs.map +0 -1
  71. package/dist/batcher/createBatcher.d.cts +0 -147
  72. package/dist/batcher/createBatcher.js.map +0 -1
  73. package/dist/batcher/index.cjs +0 -11
  74. package/dist/batcher/index.d.cts +0 -3
  75. package/dist/debouncer/createDebouncedSignal.cjs +0 -88
  76. package/dist/debouncer/createDebouncedSignal.cjs.map +0 -1
  77. package/dist/debouncer/createDebouncedSignal.d.cts +0 -80
  78. package/dist/debouncer/createDebouncedSignal.js.map +0 -1
  79. package/dist/debouncer/createDebouncedValue.cjs +0 -77
  80. package/dist/debouncer/createDebouncedValue.cjs.map +0 -1
  81. package/dist/debouncer/createDebouncedValue.d.cts +0 -71
  82. package/dist/debouncer/createDebouncedValue.js.map +0 -1
  83. package/dist/debouncer/createDebouncer.cjs +0 -129
  84. package/dist/debouncer/createDebouncer.cjs.map +0 -1
  85. package/dist/debouncer/createDebouncer.d.cts +0 -145
  86. package/dist/debouncer/createDebouncer.js.map +0 -1
  87. package/dist/debouncer/index.cjs +0 -15
  88. package/dist/debouncer/index.d.cts +0 -5
  89. package/dist/index.cjs +0 -47
  90. package/dist/index.d.cts +0 -20
  91. package/dist/provider/PacerProvider.cjs +0 -27
  92. package/dist/provider/PacerProvider.cjs.map +0 -1
  93. package/dist/provider/PacerProvider.d.cts +0 -29
  94. package/dist/provider/PacerProvider.js.map +0 -1
  95. package/dist/provider/index.cjs +0 -6
  96. package/dist/provider/index.d.cts +0 -2
  97. package/dist/queuer/createQueuedSignal.cjs +0 -129
  98. package/dist/queuer/createQueuedSignal.cjs.map +0 -1
  99. package/dist/queuer/createQueuedSignal.d.cts +0 -122
  100. package/dist/queuer/createQueuedSignal.js.map +0 -1
  101. package/dist/queuer/createQueuer.cjs +0 -133
  102. package/dist/queuer/createQueuer.cjs.map +0 -1
  103. package/dist/queuer/createQueuer.d.cts +0 -148
  104. package/dist/queuer/createQueuer.js.map +0 -1
  105. package/dist/queuer/index.cjs +0 -13
  106. package/dist/queuer/index.d.cts +0 -4
  107. package/dist/rate-limiter/createRateLimitedSignal.cjs +0 -102
  108. package/dist/rate-limiter/createRateLimitedSignal.cjs.map +0 -1
  109. package/dist/rate-limiter/createRateLimitedSignal.d.cts +0 -94
  110. package/dist/rate-limiter/createRateLimitedSignal.js.map +0 -1
  111. package/dist/rate-limiter/createRateLimitedValue.cjs +0 -102
  112. package/dist/rate-limiter/createRateLimitedValue.cjs.map +0 -1
  113. package/dist/rate-limiter/createRateLimitedValue.d.cts +0 -96
  114. package/dist/rate-limiter/createRateLimitedValue.js.map +0 -1
  115. package/dist/rate-limiter/createRateLimiter.cjs +0 -157
  116. package/dist/rate-limiter/createRateLimiter.cjs.map +0 -1
  117. package/dist/rate-limiter/createRateLimiter.d.cts +0 -174
  118. package/dist/rate-limiter/createRateLimiter.js.map +0 -1
  119. package/dist/rate-limiter/index.cjs +0 -15
  120. package/dist/rate-limiter/index.d.cts +0 -5
  121. package/dist/throttler/createThrottledSignal.cjs +0 -79
  122. package/dist/throttler/createThrottledSignal.cjs.map +0 -1
  123. package/dist/throttler/createThrottledSignal.d.cts +0 -71
  124. package/dist/throttler/createThrottledSignal.js.map +0 -1
  125. package/dist/throttler/createThrottledValue.cjs +0 -74
  126. package/dist/throttler/createThrottledValue.cjs.map +0 -1
  127. package/dist/throttler/createThrottledValue.d.cts +0 -68
  128. package/dist/throttler/createThrottledValue.js.map +0 -1
  129. package/dist/throttler/createThrottler.cjs +0 -132
  130. package/dist/throttler/createThrottler.cjs.map +0 -1
  131. package/dist/throttler/createThrottler.d.cts +0 -148
  132. package/dist/throttler/createThrottler.js.map +0 -1
  133. package/dist/throttler/index.cjs +0 -15
  134. package/dist/throttler/index.d.cts +0 -5
  135. package/dist/types/index.cjs +0 -9
  136. package/dist/types/index.d.cts +0 -1
  137. package/dist/utils/index.cjs +0 -9
  138. package/dist/utils/index.d.cts +0 -1
  139. package/src/async-batcher/createAsyncBatcher.ts +0 -234
  140. package/src/async-batcher/index.ts +0 -3
  141. package/src/async-debouncer/createAsyncDebouncer.ts +0 -225
  142. package/src/async-debouncer/index.ts +0 -4
  143. package/src/async-queuer/createAsyncQueuer.ts +0 -226
  144. package/src/async-queuer/index.ts +0 -3
  145. package/src/async-rate-limiter/createAsyncRateLimiter.ts +0 -269
  146. package/src/async-rate-limiter/index.ts +0 -4
  147. package/src/async-throttler/createAsyncThrottler.ts +0 -225
  148. package/src/async-throttler/index.ts +0 -4
  149. package/src/batcher/createBatcher.ts +0 -199
  150. package/src/batcher/index.ts +0 -3
  151. package/src/debouncer/createDebouncedSignal.ts +0 -92
  152. package/src/debouncer/createDebouncedValue.ts +0 -85
  153. package/src/debouncer/createDebouncer.ts +0 -201
  154. package/src/debouncer/index.ts +0 -6
  155. package/src/index.ts +0 -46
  156. package/src/provider/PacerProvider.tsx +0 -63
  157. package/src/provider/index.ts +0 -1
  158. package/src/queuer/createQueuedSignal.ts +0 -138
  159. package/src/queuer/createQueuer.ts +0 -199
  160. package/src/queuer/index.ts +0 -4
  161. package/src/rate-limiter/createRateLimitedSignal.ts +0 -117
  162. package/src/rate-limiter/createRateLimitedValue.ts +0 -110
  163. package/src/rate-limiter/createRateLimiter.ts +0 -226
  164. package/src/rate-limiter/index.ts +0 -5
  165. package/src/throttler/createThrottledSignal.ts +0 -81
  166. package/src/throttler/createThrottledValue.ts +0 -82
  167. package/src/throttler/createThrottler.ts +0 -204
  168. package/src/throttler/index.ts +0 -6
  169. package/src/types/index.ts +0 -1
  170. package/src/utils/index.ts +0 -1
@@ -1,7 +1,6 @@
1
1
  import { SolidDebouncer, SolidDebouncerOptions } from "./createDebouncer.js";
2
2
  import { Accessor, Setter } from "solid-js";
3
3
  import { DebouncerState } from "@tanstack/pacer/debouncer";
4
-
5
4
  //#region src/debouncer/createDebouncedValue.d.ts
6
5
  /**
7
6
  * A Solid hook that creates a debounced value that updates only after a specified delay.
@@ -65,7 +64,5 @@ import { DebouncerState } from "@tanstack/pacer/debouncer";
65
64
  * debouncer.cancel(); // Cancel any pending updates
66
65
  * ```
67
66
  */
68
- declare function createDebouncedValue<TValue, TSelected = {}>(value: Accessor<TValue>, initialOptions: SolidDebouncerOptions<Setter<TValue>, TSelected>, selector?: (state: DebouncerState<Setter<TValue>>) => TSelected): [Accessor<TValue>, SolidDebouncer<Setter<TValue>, TSelected>];
69
- //#endregion
70
- export { createDebouncedValue };
71
- //# sourceMappingURL=createDebouncedValue.d.ts.map
67
+ export declare function createDebouncedValue<TValue, TSelected = {}>(value: Accessor<TValue>, initialOptions: SolidDebouncerOptions<Setter<TValue>, TSelected>, selector?: (state: DebouncerState<Setter<TValue>>) => TSelected): [Accessor<TValue>, SolidDebouncer<Setter<TValue>, TSelected>];
68
+ //#endregion
@@ -73,5 +73,4 @@ function createDebouncedValue(value, initialOptions, selector) {
73
73
  }
74
74
 
75
75
  //#endregion
76
- export { createDebouncedValue };
77
- //# sourceMappingURL=createDebouncedValue.js.map
76
+ export { createDebouncedValue };
@@ -2,16 +2,15 @@ import { Accessor, JSX } from "solid-js";
2
2
  import { Store } from "@tanstack/solid-store";
3
3
  import { Debouncer, DebouncerOptions, DebouncerState } from "@tanstack/pacer/debouncer";
4
4
  import { AnyFunction } from "@tanstack/pacer/types";
5
-
6
5
  //#region src/debouncer/createDebouncer.d.ts
7
- interface SolidDebouncerOptions<TFn extends AnyFunction, TSelected = {}> extends DebouncerOptions<TFn> {
6
+ export interface SolidDebouncerOptions<TFn extends AnyFunction, TSelected = {}> extends DebouncerOptions<TFn> {
8
7
  /**
9
8
  * Optional callback invoked when the owning component unmounts. Receives the debouncer instance.
10
9
  * When provided, replaces the default cleanup (cancel); use it to call flush(), reset(), cancel(), add logging, etc.
11
10
  */
12
11
  onUnmount?: (debouncer: SolidDebouncer<TFn, TSelected>) => void;
13
12
  }
14
- interface SolidDebouncer<TFn extends AnyFunction, TSelected = {}> extends Omit<Debouncer<TFn>, 'store'> {
13
+ export interface SolidDebouncer<TFn extends AnyFunction, TSelected = {}> extends Omit<Debouncer<TFn>, 'store'> {
15
14
  /**
16
15
  * A Solid component that allows you to subscribe to the debouncer state.
17
16
  *
@@ -139,7 +138,5 @@ interface SolidDebouncer<TFn extends AnyFunction, TSelected = {}> extends Omit<D
139
138
  * const { isPending } = debouncer.state();
140
139
  * ```
141
140
  */
142
- declare function createDebouncer<TFn extends AnyFunction, TSelected = {}>(fn: TFn, options: SolidDebouncerOptions<TFn, TSelected>, selector?: (state: DebouncerState<TFn>) => TSelected): SolidDebouncer<TFn, TSelected>;
143
- //#endregion
144
- export { SolidDebouncer, SolidDebouncerOptions, createDebouncer };
145
- //# sourceMappingURL=createDebouncer.d.ts.map
141
+ export declare function createDebouncer<TFn extends AnyFunction, TSelected = {}>(fn: TFn, options: SolidDebouncerOptions<TFn, TSelected>, selector?: (state: DebouncerState<TFn>) => TSelected): SolidDebouncer<TFn, TSelected>;
142
+ //#endregion
@@ -125,5 +125,4 @@ function createDebouncer(fn, options, selector = () => ({})) {
125
125
  }
126
126
 
127
127
  //#endregion
128
- export { createDebouncer };
129
- //# sourceMappingURL=createDebouncer.js.map
128
+ export { createDebouncer };
@@ -1,8 +1,7 @@
1
1
  import { AnyAsyncFunction, AnyFunction, AsyncBatcherOptions, AsyncDebouncerOptions, AsyncQueuerOptions, AsyncRateLimiterOptions, AsyncThrottlerOptions, BatcherOptions, DebouncerOptions, QueuerOptions, RateLimiterOptions, ThrottlerOptions } from "@tanstack/pacer";
2
2
  import { JSX } from "solid-js";
3
-
4
3
  //#region src/provider/PacerProvider.d.ts
5
- interface PacerProviderOptions {
4
+ export interface PacerProviderOptions {
6
5
  asyncBatcher?: Partial<AsyncBatcherOptions<any>>;
7
6
  asyncDebouncer?: Partial<AsyncDebouncerOptions<AnyAsyncFunction>>;
8
7
  asyncQueuer?: Partial<AsyncQueuerOptions<any>>;
@@ -17,13 +16,11 @@ interface PacerProviderOptions {
17
16
  interface PacerContextValue {
18
17
  defaultOptions: PacerProviderOptions;
19
18
  }
20
- interface PacerProviderProps {
19
+ export interface PacerProviderProps {
21
20
  children: JSX.Element;
22
21
  defaultOptions?: PacerProviderOptions;
23
22
  }
24
- declare function PacerProvider(props: PacerProviderProps): JSX.Element;
25
- declare function usePacerContext(): PacerContextValue | null;
26
- declare function useDefaultPacerOptions(): PacerProviderOptions;
27
- //#endregion
28
- export { PacerProvider, PacerProviderOptions, PacerProviderProps, useDefaultPacerOptions, usePacerContext };
29
- //# sourceMappingURL=PacerProvider.d.ts.map
23
+ export declare function PacerProvider(props: PacerProviderProps): JSX.Element;
24
+ export declare function usePacerContext(): PacerContextValue | null;
25
+ export declare function useDefaultPacerOptions(): PacerProviderOptions;
26
+ //#endregion
@@ -21,5 +21,4 @@ function useDefaultPacerOptions() {
21
21
  }
22
22
 
23
23
  //#endregion
24
- export { PacerProvider, useDefaultPacerOptions, usePacerContext };
25
- //# sourceMappingURL=PacerProvider.js.map
24
+ export { PacerProvider, useDefaultPacerOptions, usePacerContext };
@@ -1,6 +1,5 @@
1
1
  import { SolidQueuer, SolidQueuerOptions } from "./createQueuer.js";
2
2
  import { QueuerState } from "@tanstack/pacer/queuer";
3
-
4
3
  //#region src/queuer/createQueuedSignal.d.ts
5
4
  /**
6
5
  * A Solid primitive that creates a queuer with managed state, combining Solid's signals with queuing functionality.
@@ -116,7 +115,5 @@ import { QueuerState } from "@tanstack/pacer/queuer";
116
115
  * const { size, isRunning, executionCount } = queue.state;
117
116
  * ```
118
117
  */
119
- declare function createQueuedSignal<TValue, TSelected extends Pick<QueuerState<TValue>, 'items'> = Pick<QueuerState<TValue>, 'items'>>(fn: (item: TValue) => void, options?: SolidQueuerOptions<TValue, TSelected>, selector?: (state: QueuerState<TValue>) => TSelected): [() => Array<TValue>, SolidQueuer<TValue, TSelected>['addItem'], SolidQueuer<TValue, TSelected>];
120
- //#endregion
121
- export { createQueuedSignal };
122
- //# sourceMappingURL=createQueuedSignal.d.ts.map
118
+ export declare function createQueuedSignal<TValue, TSelected extends Pick<QueuerState<TValue>, 'items'> = Pick<QueuerState<TValue>, 'items'>>(fn: (item: TValue) => void, options?: SolidQueuerOptions<TValue, TSelected>, selector?: (state: QueuerState<TValue>) => TSelected): [() => Array<TValue>, SolidQueuer<TValue, TSelected>['addItem'], SolidQueuer<TValue, TSelected>];
119
+ //#endregion
@@ -125,5 +125,4 @@ function createQueuedSignal(fn, options = {}, selector = (state) => ({ items: st
125
125
  }
126
126
 
127
127
  //#endregion
128
- export { createQueuedSignal };
129
- //# sourceMappingURL=createQueuedSignal.js.map
128
+ export { createQueuedSignal };
@@ -1,16 +1,15 @@
1
1
  import { Accessor, JSX } from "solid-js";
2
2
  import { Store } from "@tanstack/solid-store";
3
3
  import { Queuer, QueuerOptions, QueuerState } from "@tanstack/pacer/queuer";
4
-
5
4
  //#region src/queuer/createQueuer.d.ts
6
- interface SolidQueuerOptions<TValue, TSelected = {}> extends QueuerOptions<TValue> {
5
+ export interface SolidQueuerOptions<TValue, TSelected = {}> extends QueuerOptions<TValue> {
7
6
  /**
8
7
  * Optional callback invoked when the owning component unmounts. Receives the queuer instance.
9
8
  * When provided, replaces the default cleanup (stop); use it to call flush(), flushAsBatch(), stop(), add logging, etc.
10
9
  */
11
10
  onUnmount?: (queuer: SolidQueuer<TValue, TSelected>) => void;
12
11
  }
13
- interface SolidQueuer<TValue, TSelected = {}> extends Omit<Queuer<TValue>, 'store'> {
12
+ export interface SolidQueuer<TValue, TSelected = {}> extends Omit<Queuer<TValue>, 'store'> {
14
13
  /**
15
14
  * A Solid component that allows you to subscribe to the queuer state.
16
15
  *
@@ -142,7 +141,5 @@ interface SolidQueuer<TValue, TSelected = {}> extends Omit<Queuer<TValue>, 'stor
142
141
  * const { items, isRunning } = queue.state();
143
142
  * ```
144
143
  */
145
- declare function createQueuer<TValue, TSelected = {}>(fn: (item: TValue) => void, options?: SolidQueuerOptions<TValue, TSelected>, selector?: (state: QueuerState<TValue>) => TSelected): SolidQueuer<TValue, TSelected>;
146
- //#endregion
147
- export { SolidQueuer, SolidQueuerOptions, createQueuer };
148
- //# sourceMappingURL=createQueuer.d.ts.map
144
+ export declare function createQueuer<TValue, TSelected = {}>(fn: (item: TValue) => void, options?: SolidQueuerOptions<TValue, TSelected>, selector?: (state: QueuerState<TValue>) => TSelected): SolidQueuer<TValue, TSelected>;
145
+ //#endregion
@@ -129,5 +129,4 @@ function createQueuer(fn, options = {}, selector = () => ({})) {
129
129
  }
130
130
 
131
131
  //#endregion
132
- export { createQueuer };
133
- //# sourceMappingURL=createQueuer.js.map
132
+ export { createQueuer };
@@ -1,7 +1,6 @@
1
1
  import { SolidRateLimiter, SolidRateLimiterOptions } from "./createRateLimiter.js";
2
2
  import { Accessor, Setter } from "solid-js";
3
3
  import { RateLimiterState } from "@tanstack/pacer/rate-limiter";
4
-
5
4
  //#region src/rate-limiter/createRateLimitedSignal.d.ts
6
5
  /**
7
6
  * A Solid hook that creates a rate-limited state value that enforces a hard limit on state updates within a time window.
@@ -43,13 +42,14 @@ import { RateLimiterState } from "@tanstack/pacer/rate-limiter";
43
42
  * the reactive system track the selected state values.
44
43
  *
45
44
  * Available rate limiter state properties:
46
- * - `callsInWindow`: Number of calls made in the current window
47
- * - `remainingInWindow`: Number of calls remaining in the current window
48
- * - `windowStart`: Unix timestamp when the current window started
49
- * - `nextWindowStart`: Unix timestamp when the next window will start
50
- * - `msUntilNextWindow`: Milliseconds until the next window starts
51
- * - `isAtLimit`: Whether the call limit for the current window has been reached
52
- * - `status`: Current status ('disabled' | 'idle' | 'at-limit')
45
+ * - `executionCount`: Number of function executions
46
+ * - `executionTimes`: Timestamps of executions tracked for the current window
47
+ * - `maybeExecuteCount`: Number of calls to maybeExecute
48
+ * - `rejectionCount`: Number of calls rejected by the rate limit
49
+ * - `isExceeded`: Whether the rate limit has been reached
50
+ * - `status`: Current status ('disabled' | 'exceeded' | 'idle')
51
+ *
52
+ * Use `getRemainingInWindow()` and `getMsUntilNextWindow()` for current window capacity and timing.
53
53
  *
54
54
  * @example
55
55
  * ```tsx
@@ -64,7 +64,7 @@ import { RateLimiterState } from "@tanstack/pacer/rate-limiter";
64
64
  * const [value, setValue, rateLimiter] = createRateLimitedSignal(
65
65
  * 0,
66
66
  * { limit: 5, window: 60000 },
67
- * (state) => ({ isAtLimit: state.isAtLimit, remainingInWindow: state.remainingInWindow })
67
+ * (state) => ({ isExceeded: state.isExceeded })
68
68
  * );
69
69
  *
70
70
  * // With rejection callback and fixed window
@@ -79,7 +79,7 @@ import { RateLimiterState } from "@tanstack/pacer/rate-limiter";
79
79
  *
80
80
  * // Access rateLimiter state via signals
81
81
  * const handleSubmit = () => {
82
- * const remaining = rateLimiter.state().remainingInWindow;
82
+ * const remaining = rateLimiter.getRemainingInWindow();
83
83
  * if (remaining > 0) {
84
84
  * setValue(newValue);
85
85
  * } else {
@@ -88,7 +88,5 @@ import { RateLimiterState } from "@tanstack/pacer/rate-limiter";
88
88
  * };
89
89
  * ```
90
90
  */
91
- declare function createRateLimitedSignal<TValue, TSelected = {}>(value: TValue, initialOptions: SolidRateLimiterOptions<Setter<TValue>, TSelected>, selector?: (state: RateLimiterState) => TSelected): [Accessor<TValue>, Setter<TValue>, SolidRateLimiter<Setter<TValue>, TSelected>];
92
- //#endregion
93
- export { createRateLimitedSignal };
94
- //# sourceMappingURL=createRateLimitedSignal.d.ts.map
91
+ export declare function createRateLimitedSignal<TValue, TSelected = {}>(value: TValue, initialOptions: SolidRateLimiterOptions<Setter<TValue>, TSelected>, selector?: (state: RateLimiterState) => TSelected): [Accessor<TValue>, Setter<TValue>, SolidRateLimiter<Setter<TValue>, TSelected>];
92
+ //#endregion
@@ -42,13 +42,14 @@ import { createSignal } from "solid-js";
42
42
  * the reactive system track the selected state values.
43
43
  *
44
44
  * Available rate limiter state properties:
45
- * - `callsInWindow`: Number of calls made in the current window
46
- * - `remainingInWindow`: Number of calls remaining in the current window
47
- * - `windowStart`: Unix timestamp when the current window started
48
- * - `nextWindowStart`: Unix timestamp when the next window will start
49
- * - `msUntilNextWindow`: Milliseconds until the next window starts
50
- * - `isAtLimit`: Whether the call limit for the current window has been reached
51
- * - `status`: Current status ('disabled' | 'idle' | 'at-limit')
45
+ * - `executionCount`: Number of function executions
46
+ * - `executionTimes`: Timestamps of executions tracked for the current window
47
+ * - `maybeExecuteCount`: Number of calls to maybeExecute
48
+ * - `rejectionCount`: Number of calls rejected by the rate limit
49
+ * - `isExceeded`: Whether the rate limit has been reached
50
+ * - `status`: Current status ('disabled' | 'exceeded' | 'idle')
51
+ *
52
+ * Use `getRemainingInWindow()` and `getMsUntilNextWindow()` for current window capacity and timing.
52
53
  *
53
54
  * @example
54
55
  * ```tsx
@@ -63,7 +64,7 @@ import { createSignal } from "solid-js";
63
64
  * const [value, setValue, rateLimiter] = createRateLimitedSignal(
64
65
  * 0,
65
66
  * { limit: 5, window: 60000 },
66
- * (state) => ({ isAtLimit: state.isAtLimit, remainingInWindow: state.remainingInWindow })
67
+ * (state) => ({ isExceeded: state.isExceeded })
67
68
  * );
68
69
  *
69
70
  * // With rejection callback and fixed window
@@ -78,7 +79,7 @@ import { createSignal } from "solid-js";
78
79
  *
79
80
  * // Access rateLimiter state via signals
80
81
  * const handleSubmit = () => {
81
- * const remaining = rateLimiter.state().remainingInWindow;
82
+ * const remaining = rateLimiter.getRemainingInWindow();
82
83
  * if (remaining > 0) {
83
84
  * setValue(newValue);
84
85
  * } else {
@@ -98,5 +99,4 @@ function createRateLimitedSignal(value, initialOptions, selector) {
98
99
  }
99
100
 
100
101
  //#endregion
101
- export { createRateLimitedSignal };
102
- //# sourceMappingURL=createRateLimitedSignal.js.map
102
+ export { createRateLimitedSignal };
@@ -1,7 +1,6 @@
1
1
  import { SolidRateLimiter, SolidRateLimiterOptions } from "./createRateLimiter.js";
2
2
  import { Accessor, Setter } from "solid-js";
3
3
  import { RateLimiterState } from "@tanstack/pacer/rate-limiter";
4
-
5
4
  //#region src/rate-limiter/createRateLimitedValue.d.ts
6
5
  /**
7
6
  * A high-level Solid hook that creates a rate-limited version of a value that updates at most a certain number of times within a time window.
@@ -90,7 +89,5 @@ import { RateLimiterState } from "@tanstack/pacer/rate-limiter";
90
89
  * const { executionCount, rejectionCount } = rateLimiter.state;
91
90
  * ```
92
91
  */
93
- declare function createRateLimitedValue<TValue, TSelected = {}>(value: Accessor<TValue>, initialOptions: SolidRateLimiterOptions<Setter<TValue>, TSelected>, selector?: (state: RateLimiterState) => TSelected): [Accessor<TValue>, SolidRateLimiter<Setter<TValue>, TSelected>];
94
- //#endregion
95
- export { createRateLimitedValue };
96
- //# sourceMappingURL=createRateLimitedValue.d.ts.map
92
+ export declare function createRateLimitedValue<TValue, TSelected = {}>(value: Accessor<TValue>, initialOptions: SolidRateLimiterOptions<Setter<TValue>, TSelected>, selector?: (state: RateLimiterState) => TSelected): [Accessor<TValue>, SolidRateLimiter<Setter<TValue>, TSelected>];
93
+ //#endregion
@@ -98,5 +98,4 @@ function createRateLimitedValue(value, initialOptions, selector) {
98
98
  }
99
99
 
100
100
  //#endregion
101
- export { createRateLimitedValue };
102
- //# sourceMappingURL=createRateLimitedValue.js.map
101
+ export { createRateLimitedValue };
@@ -2,16 +2,15 @@ import { Accessor, JSX } from "solid-js";
2
2
  import { Store } from "@tanstack/solid-store";
3
3
  import { RateLimiter, RateLimiterOptions, RateLimiterState } from "@tanstack/pacer/rate-limiter";
4
4
  import { AnyFunction } from "@tanstack/pacer/types";
5
-
6
5
  //#region src/rate-limiter/createRateLimiter.d.ts
7
- interface SolidRateLimiterOptions<TFn extends AnyFunction, TSelected = {}> extends RateLimiterOptions<TFn> {
6
+ export interface SolidRateLimiterOptions<TFn extends AnyFunction, TSelected = {}> extends RateLimiterOptions<TFn> {
8
7
  /**
9
8
  * Optional callback invoked when the owning component unmounts. Receives the rate limiter instance.
10
9
  * When provided, replaces the default cleanup; use it to call reset(), add logging, etc.
11
10
  */
12
11
  onUnmount?: (rateLimiter: SolidRateLimiter<TFn, TSelected>) => void;
13
12
  }
14
- interface SolidRateLimiter<TFn extends AnyFunction, TSelected = {}> extends Omit<RateLimiter<TFn>, 'store'> {
13
+ export interface SolidRateLimiter<TFn extends AnyFunction, TSelected = {}> extends Omit<RateLimiter<TFn>, 'store'> {
15
14
  /**
16
15
  * A Solid component that allows you to subscribe to the rate limiter state.
17
16
  *
@@ -84,12 +83,13 @@ interface SolidRateLimiter<TFn extends AnyFunction, TSelected = {}> extends Omit
84
83
  * tracking by providing a selector function or using the `Subscribe` component. This prevents unnecessary
85
84
  * updates and gives you full control over when your component tracks state changes.
86
85
  *
86
+ * Use `getRemainingInWindow()` and `getMsUntilNextWindow()` for current window capacity and timing.
87
+ *
87
88
  * Available state properties:
89
+ * - `executionTimes`: Timestamps of executions tracked for the current window
90
+ * - `isExceeded`: Whether the rate limit has been reached
88
91
  * - `executionCount`: Number of function executions that have been completed
89
92
  * - `rejectionCount`: Number of function calls that were rejected due to rate limiting
90
- * - `remainingInWindow`: Number of executions remaining in the current window
91
- * - `nextWindowTime`: Timestamp when the next window begins
92
- * - `currentWindowStart`: Timestamp when the current window started
93
93
  *
94
94
  * @example
95
95
  * ```tsx
@@ -168,7 +168,5 @@ interface SolidRateLimiter<TFn extends AnyFunction, TSelected = {}> extends Omit
168
168
  * const { executionCount, rejectionCount } = rateLimiter.state();
169
169
  * ```
170
170
  */
171
- declare function createRateLimiter<TFn extends AnyFunction, TSelected = {}>(fn: TFn, options: SolidRateLimiterOptions<TFn, TSelected>, selector?: (state: RateLimiterState) => TSelected): SolidRateLimiter<TFn, TSelected>;
172
- //#endregion
173
- export { SolidRateLimiter, SolidRateLimiterOptions, createRateLimiter };
174
- //# sourceMappingURL=createRateLimiter.d.ts.map
171
+ export declare function createRateLimiter<TFn extends AnyFunction, TSelected = {}>(fn: TFn, options: SolidRateLimiterOptions<TFn, TSelected>, selector?: (state: RateLimiterState) => TSelected): SolidRateLimiter<TFn, TSelected>;
172
+ //#endregion
@@ -46,12 +46,13 @@ import { RateLimiter } from "@tanstack/pacer/rate-limiter";
46
46
  * tracking by providing a selector function or using the `Subscribe` component. This prevents unnecessary
47
47
  * updates and gives you full control over when your component tracks state changes.
48
48
  *
49
+ * Use `getRemainingInWindow()` and `getMsUntilNextWindow()` for current window capacity and timing.
50
+ *
49
51
  * Available state properties:
52
+ * - `executionTimes`: Timestamps of executions tracked for the current window
53
+ * - `isExceeded`: Whether the rate limit has been reached
50
54
  * - `executionCount`: Number of function executions that have been completed
51
55
  * - `rejectionCount`: Number of function calls that were rejected due to rate limiting
52
- * - `remainingInWindow`: Number of executions remaining in the current window
53
- * - `nextWindowTime`: Timestamp when the next window begins
54
- * - `currentWindowStart`: Timestamp when the current window started
55
56
  *
56
57
  * @example
57
58
  * ```tsx
@@ -153,5 +154,4 @@ function createRateLimiter(fn, options, selector = () => ({})) {
153
154
  }
154
155
 
155
156
  //#endregion
156
- export { createRateLimiter };
157
- //# sourceMappingURL=createRateLimiter.js.map
157
+ export { createRateLimiter };
@@ -1,7 +1,6 @@
1
1
  import { SolidThrottler, SolidThrottlerOptions } from "./createThrottler.js";
2
2
  import { Accessor, Setter } from "solid-js";
3
3
  import { ThrottlerState } from "@tanstack/pacer/throttler";
4
-
5
4
  //#region src/throttler/createThrottledSignal.d.ts
6
5
  /**
7
6
  * A Solid hook that creates a throttled state value that updates at most once within a specified time window.
@@ -30,8 +29,6 @@ import { ThrottlerState } from "@tanstack/pacer/throttler";
30
29
  * the reactive system track the selected state values.
31
30
  *
32
31
  * Available throttler state properties:
33
- * - `canLeadingExecute`: Whether the throttler can execute on the leading edge
34
- * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge
35
32
  * - `executionCount`: Number of function executions that have been completed
36
33
  * - `isPending`: Whether the throttler is waiting for the timeout to trigger trailing execution
37
34
  * - `lastArgs`: The arguments from the most recent call to maybeExecute
@@ -65,7 +62,5 @@ import { ThrottlerState } from "@tanstack/pacer/throttler";
65
62
  * console.log('Next execution:', throttler.state().nextExecutionTime);
66
63
  * ```
67
64
  */
68
- declare function createThrottledSignal<TValue, TSelected = {}>(value: TValue, initialOptions: SolidThrottlerOptions<Setter<TValue>, TSelected>, selector?: (state: ThrottlerState<Setter<TValue>>) => TSelected): [Accessor<TValue>, Setter<TValue>, SolidThrottler<Setter<TValue>, TSelected>];
69
- //#endregion
70
- export { createThrottledSignal };
71
- //# sourceMappingURL=createThrottledSignal.d.ts.map
65
+ export declare function createThrottledSignal<TValue, TSelected = {}>(value: TValue, initialOptions: SolidThrottlerOptions<Setter<TValue>, TSelected>, selector?: (state: ThrottlerState<Setter<TValue>>) => TSelected): [Accessor<TValue>, Setter<TValue>, SolidThrottler<Setter<TValue>, TSelected>];
66
+ //#endregion
@@ -29,8 +29,6 @@ import { createSignal } from "solid-js";
29
29
  * the reactive system track the selected state values.
30
30
  *
31
31
  * Available throttler state properties:
32
- * - `canLeadingExecute`: Whether the throttler can execute on the leading edge
33
- * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge
34
32
  * - `executionCount`: Number of function executions that have been completed
35
33
  * - `isPending`: Whether the throttler is waiting for the timeout to trigger trailing execution
36
34
  * - `lastArgs`: The arguments from the most recent call to maybeExecute
@@ -75,5 +73,4 @@ function createThrottledSignal(value, initialOptions, selector) {
75
73
  }
76
74
 
77
75
  //#endregion
78
- export { createThrottledSignal };
79
- //# sourceMappingURL=createThrottledSignal.js.map
76
+ export { createThrottledSignal };
@@ -1,7 +1,6 @@
1
1
  import { SolidThrottler, SolidThrottlerOptions } from "./createThrottler.js";
2
2
  import { Accessor, Setter } from "solid-js";
3
3
  import { ThrottlerState } from "@tanstack/pacer/throttler";
4
-
5
4
  //#region src/throttler/createThrottledValue.d.ts
6
5
  /**
7
6
  * A high-level Solid hook that creates a throttled version of a value that updates at most once within a specified time window.
@@ -31,8 +30,6 @@ import { ThrottlerState } from "@tanstack/pacer/throttler";
31
30
  * the reactive system track the selected state values.
32
31
  *
33
32
  * Available throttler state properties:
34
- * - `canLeadingExecute`: Whether the throttler can execute on the leading edge
35
- * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge
36
33
  * - `executionCount`: Number of function executions that have been completed
37
34
  * - `isPending`: Whether the throttler is waiting for the timeout to trigger trailing execution
38
35
  * - `lastArgs`: The arguments from the most recent call to maybeExecute
@@ -62,7 +59,5 @@ import { ThrottlerState } from "@tanstack/pacer/throttler";
62
59
  * throttler.cancel(); // Cancel any pending updates
63
60
  * ```
64
61
  */
65
- declare function createThrottledValue<TValue, TSelected = {}>(value: Accessor<TValue>, initialOptions: SolidThrottlerOptions<Setter<TValue>, TSelected>, selector?: (state: ThrottlerState<Setter<TValue>>) => TSelected): [Accessor<TValue>, SolidThrottler<Setter<TValue>, TSelected>];
66
- //#endregion
67
- export { createThrottledValue };
68
- //# sourceMappingURL=createThrottledValue.d.ts.map
62
+ export declare function createThrottledValue<TValue, TSelected = {}>(value: Accessor<TValue>, initialOptions: SolidThrottlerOptions<Setter<TValue>, TSelected>, selector?: (state: ThrottlerState<Setter<TValue>>) => TSelected): [Accessor<TValue>, SolidThrottler<Setter<TValue>, TSelected>];
63
+ //#endregion
@@ -30,8 +30,6 @@ import { createEffect } from "solid-js";
30
30
  * the reactive system track the selected state values.
31
31
  *
32
32
  * Available throttler state properties:
33
- * - `canLeadingExecute`: Whether the throttler can execute on the leading edge
34
- * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge
35
33
  * - `executionCount`: Number of function executions that have been completed
36
34
  * - `isPending`: Whether the throttler is waiting for the timeout to trigger trailing execution
37
35
  * - `lastArgs`: The arguments from the most recent call to maybeExecute
@@ -70,5 +68,4 @@ function createThrottledValue(value, initialOptions, selector) {
70
68
  }
71
69
 
72
70
  //#endregion
73
- export { createThrottledValue };
74
- //# sourceMappingURL=createThrottledValue.js.map
71
+ export { createThrottledValue };
@@ -2,16 +2,15 @@ import { Accessor, JSX } from "solid-js";
2
2
  import { Store } from "@tanstack/solid-store";
3
3
  import { Throttler, ThrottlerOptions, ThrottlerState } from "@tanstack/pacer/throttler";
4
4
  import { AnyFunction } from "@tanstack/pacer/types";
5
-
6
5
  //#region src/throttler/createThrottler.d.ts
7
- interface SolidThrottlerOptions<TFn extends AnyFunction, TSelected = {}> extends ThrottlerOptions<TFn> {
6
+ export interface SolidThrottlerOptions<TFn extends AnyFunction, TSelected = {}> extends ThrottlerOptions<TFn> {
8
7
  /**
9
8
  * Optional callback invoked when the owning component unmounts. Receives the throttler instance.
10
9
  * When provided, replaces the default cleanup (cancel); use it to call flush(), reset(), cancel(), add logging, etc.
11
10
  */
12
11
  onUnmount?: (throttler: SolidThrottler<TFn, TSelected>) => void;
13
12
  }
14
- interface SolidThrottler<TFn extends AnyFunction, TSelected = {}> extends Omit<Throttler<TFn>, 'store'> {
13
+ export interface SolidThrottler<TFn extends AnyFunction, TSelected = {}> extends Omit<Throttler<TFn>, 'store'> {
15
14
  /**
16
15
  * A Solid component that allows you to subscribe to the throttler state.
17
16
  *
@@ -75,8 +74,6 @@ interface SolidThrottler<TFn extends AnyFunction, TSelected = {}> extends Omit<T
75
74
  * updates and gives you full control over when your component tracks state changes.
76
75
  *
77
76
  * Available state properties:
78
- * - `canLeadingExecute`: Whether the throttler can execute on the leading edge
79
- * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge
80
77
  * - `executionCount`: Number of function executions that have been completed
81
78
  * - `isPending`: Whether the throttler is waiting for the timeout to trigger execution
82
79
  * - `lastArgs`: The arguments from the most recent call to maybeExecute
@@ -142,7 +139,5 @@ interface SolidThrottler<TFn extends AnyFunction, TSelected = {}> extends Omit<T
142
139
  * const { isPending, executionCount } = throttler.state();
143
140
  * ```
144
141
  */
145
- declare function createThrottler<TFn extends AnyFunction, TSelected = {}>(fn: TFn, options: SolidThrottlerOptions<TFn, TSelected>, selector?: (state: ThrottlerState<TFn>) => TSelected): SolidThrottler<TFn, TSelected>;
146
- //#endregion
147
- export { SolidThrottler, SolidThrottlerOptions, createThrottler };
148
- //# sourceMappingURL=createThrottler.d.ts.map
142
+ export declare function createThrottler<TFn extends AnyFunction, TSelected = {}>(fn: TFn, options: SolidThrottlerOptions<TFn, TSelected>, selector?: (state: ThrottlerState<TFn>) => TSelected): SolidThrottler<TFn, TSelected>;
143
+ //#endregion
@@ -37,8 +37,6 @@ import { Throttler } from "@tanstack/pacer/throttler";
37
37
  * updates and gives you full control over when your component tracks state changes.
38
38
  *
39
39
  * Available state properties:
40
- * - `canLeadingExecute`: Whether the throttler can execute on the leading edge
41
- * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge
42
40
  * - `executionCount`: Number of function executions that have been completed
43
41
  * - `isPending`: Whether the throttler is waiting for the timeout to trigger execution
44
42
  * - `lastArgs`: The arguments from the most recent call to maybeExecute
@@ -128,5 +126,4 @@ function createThrottler(fn, options, selector = () => ({})) {
128
126
  }
129
127
 
130
128
  //#endregion
131
- export { createThrottler };
132
- //# sourceMappingURL=createThrottler.js.map
129
+ export { createThrottler };