@tanstack/solid-pacer 0.15.3 → 0.16.1

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 (320) hide show
  1. package/README.md +165 -0
  2. package/dist/async-batcher/createAsyncBatcher.cjs +122 -0
  3. package/dist/async-batcher/createAsyncBatcher.cjs.map +1 -0
  4. package/dist/{cjs/async-batcher → async-batcher}/createAsyncBatcher.d.cts +22 -17
  5. package/dist/{esm/async-batcher → async-batcher}/createAsyncBatcher.d.ts +22 -17
  6. package/dist/async-batcher/createAsyncBatcher.js +122 -0
  7. package/dist/async-batcher/createAsyncBatcher.js.map +1 -0
  8. package/dist/async-batcher/index.cjs +10 -0
  9. package/dist/async-batcher/index.d.cts +3 -0
  10. package/dist/async-batcher/index.d.ts +3 -0
  11. package/dist/async-batcher/index.js +5 -0
  12. package/dist/async-debouncer/createAsyncDebouncer.cjs +114 -0
  13. package/dist/async-debouncer/createAsyncDebouncer.cjs.map +1 -0
  14. package/dist/{cjs/async-debouncer → async-debouncer}/createAsyncDebouncer.d.cts +23 -18
  15. package/dist/{esm/async-debouncer → async-debouncer}/createAsyncDebouncer.d.ts +23 -18
  16. package/dist/async-debouncer/createAsyncDebouncer.js +114 -0
  17. package/dist/async-debouncer/createAsyncDebouncer.js.map +1 -0
  18. package/dist/async-debouncer/index.cjs +10 -0
  19. package/dist/async-debouncer/index.d.cts +3 -0
  20. package/dist/async-debouncer/index.d.ts +3 -0
  21. package/dist/async-debouncer/index.js +5 -0
  22. package/dist/async-queuer/createAsyncQueuer.cjs +114 -0
  23. package/dist/async-queuer/createAsyncQueuer.cjs.map +1 -0
  24. package/dist/{cjs/async-queuer → async-queuer}/createAsyncQueuer.d.cts +22 -17
  25. package/dist/{esm/async-queuer → async-queuer}/createAsyncQueuer.d.ts +22 -17
  26. package/dist/async-queuer/createAsyncQueuer.js +114 -0
  27. package/dist/async-queuer/createAsyncQueuer.js.map +1 -0
  28. package/dist/async-queuer/index.cjs +10 -0
  29. package/dist/async-queuer/index.d.cts +3 -0
  30. package/dist/async-queuer/index.d.ts +3 -0
  31. package/dist/async-queuer/index.js +5 -0
  32. package/dist/async-rate-limiter/createAsyncRateLimiter.cjs +120 -0
  33. package/dist/async-rate-limiter/createAsyncRateLimiter.cjs.map +1 -0
  34. package/dist/{cjs/async-rate-limiter → async-rate-limiter}/createAsyncRateLimiter.d.cts +23 -18
  35. package/dist/{esm/async-rate-limiter → async-rate-limiter}/createAsyncRateLimiter.d.ts +23 -18
  36. package/dist/async-rate-limiter/createAsyncRateLimiter.js +120 -0
  37. package/dist/async-rate-limiter/createAsyncRateLimiter.js.map +1 -0
  38. package/dist/async-rate-limiter/index.cjs +10 -0
  39. package/dist/async-rate-limiter/index.d.cts +3 -0
  40. package/dist/async-rate-limiter/index.d.ts +3 -0
  41. package/dist/async-rate-limiter/index.js +5 -0
  42. package/dist/async-throttler/createAsyncThrottler.cjs +108 -0
  43. package/dist/async-throttler/createAsyncThrottler.cjs.map +1 -0
  44. package/dist/{cjs/async-throttler → async-throttler}/createAsyncThrottler.d.cts +23 -18
  45. package/dist/{esm/async-throttler → async-throttler}/createAsyncThrottler.d.ts +23 -18
  46. package/dist/async-throttler/createAsyncThrottler.js +108 -0
  47. package/dist/async-throttler/createAsyncThrottler.js.map +1 -0
  48. package/dist/async-throttler/index.cjs +10 -0
  49. package/dist/async-throttler/index.d.cts +3 -0
  50. package/dist/async-throttler/index.d.ts +3 -0
  51. package/dist/async-throttler/index.js +5 -0
  52. package/dist/batcher/createBatcher.cjs +97 -0
  53. package/dist/batcher/createBatcher.cjs.map +1 -0
  54. package/dist/{cjs/batcher → batcher}/createBatcher.d.cts +22 -17
  55. package/dist/{esm/batcher → batcher}/createBatcher.d.ts +22 -17
  56. package/dist/batcher/createBatcher.js +97 -0
  57. package/dist/batcher/createBatcher.js.map +1 -0
  58. package/dist/batcher/index.cjs +10 -0
  59. package/dist/batcher/index.d.cts +3 -0
  60. package/dist/batcher/index.d.ts +3 -0
  61. package/dist/batcher/index.js +5 -0
  62. package/dist/debouncer/createDebouncedSignal.cjs +88 -0
  63. package/dist/debouncer/createDebouncedSignal.cjs.map +1 -0
  64. package/dist/{cjs/debouncer → debouncer}/createDebouncedSignal.d.cts +10 -8
  65. package/dist/{esm/debouncer → debouncer}/createDebouncedSignal.d.ts +10 -8
  66. package/dist/debouncer/createDebouncedSignal.js +88 -0
  67. package/dist/debouncer/createDebouncedSignal.js.map +1 -0
  68. package/dist/debouncer/createDebouncedValue.cjs +77 -0
  69. package/dist/debouncer/createDebouncedValue.cjs.map +1 -0
  70. package/dist/{cjs/debouncer → debouncer}/createDebouncedValue.d.cts +10 -4
  71. package/dist/{esm/debouncer → debouncer}/createDebouncedValue.d.ts +10 -4
  72. package/dist/debouncer/createDebouncedValue.js +77 -0
  73. package/dist/debouncer/createDebouncedValue.js.map +1 -0
  74. package/dist/debouncer/createDebouncer.cjs +101 -0
  75. package/dist/debouncer/createDebouncer.cjs.map +1 -0
  76. package/dist/{cjs/debouncer → debouncer}/createDebouncer.d.cts +23 -18
  77. package/dist/{esm/debouncer → debouncer}/createDebouncer.d.ts +23 -18
  78. package/dist/debouncer/createDebouncer.js +101 -0
  79. package/dist/debouncer/createDebouncer.js.map +1 -0
  80. package/dist/debouncer/index.cjs +14 -0
  81. package/dist/debouncer/index.d.cts +5 -0
  82. package/dist/debouncer/index.d.ts +5 -0
  83. package/dist/{esm/debouncer → debouncer}/index.js +5 -8
  84. package/dist/index.cjs +46 -0
  85. package/dist/index.d.cts +20 -0
  86. package/dist/index.d.ts +20 -0
  87. package/dist/{esm/index.js → index.js} +8 -22
  88. package/dist/provider/PacerProvider.cjs +27 -0
  89. package/dist/provider/PacerProvider.cjs.map +1 -0
  90. package/dist/provider/PacerProvider.d.cts +29 -0
  91. package/dist/provider/PacerProvider.d.ts +29 -0
  92. package/dist/provider/PacerProvider.js +25 -0
  93. package/dist/provider/PacerProvider.js.map +1 -0
  94. package/dist/provider/index.cjs +5 -0
  95. package/dist/provider/index.d.cts +2 -0
  96. package/dist/provider/index.d.ts +2 -0
  97. package/dist/provider/index.js +3 -0
  98. package/dist/queuer/createQueuedSignal.cjs +129 -0
  99. package/dist/queuer/createQueuedSignal.cjs.map +1 -0
  100. package/dist/queuer/createQueuedSignal.d.cts +123 -0
  101. package/dist/queuer/createQueuedSignal.d.ts +123 -0
  102. package/dist/queuer/createQueuedSignal.js +129 -0
  103. package/dist/queuer/createQueuedSignal.js.map +1 -0
  104. package/dist/queuer/createQueuer.cjs +98 -0
  105. package/dist/queuer/createQueuer.cjs.map +1 -0
  106. package/dist/{cjs/queuer → queuer}/createQueuer.d.cts +22 -17
  107. package/dist/{esm/queuer → queuer}/createQueuer.d.ts +22 -17
  108. package/dist/queuer/createQueuer.js +98 -0
  109. package/dist/queuer/createQueuer.js.map +1 -0
  110. package/dist/queuer/index.cjs +12 -0
  111. package/dist/queuer/index.d.cts +4 -0
  112. package/dist/queuer/index.d.ts +4 -0
  113. package/dist/queuer/index.js +6 -0
  114. package/dist/rate-limiter/createRateLimitedSignal.cjs +102 -0
  115. package/dist/rate-limiter/createRateLimitedSignal.cjs.map +1 -0
  116. package/dist/{cjs/rate-limiter → rate-limiter}/createRateLimitedSignal.d.cts +10 -8
  117. package/dist/{esm/rate-limiter → rate-limiter}/createRateLimitedSignal.d.ts +10 -8
  118. package/dist/rate-limiter/createRateLimitedSignal.js +102 -0
  119. package/dist/rate-limiter/createRateLimitedSignal.js.map +1 -0
  120. package/dist/rate-limiter/createRateLimitedValue.cjs +102 -0
  121. package/dist/rate-limiter/createRateLimitedValue.cjs.map +1 -0
  122. package/dist/{cjs/rate-limiter → rate-limiter}/createRateLimitedValue.d.cts +40 -20
  123. package/dist/{esm/rate-limiter → rate-limiter}/createRateLimitedValue.d.ts +40 -20
  124. package/dist/rate-limiter/createRateLimitedValue.js +102 -0
  125. package/dist/rate-limiter/createRateLimitedValue.js.map +1 -0
  126. package/dist/rate-limiter/createRateLimiter.cjs +95 -0
  127. package/dist/rate-limiter/createRateLimiter.cjs.map +1 -0
  128. package/dist/{cjs/rate-limiter → rate-limiter}/createRateLimiter.d.cts +23 -18
  129. package/dist/{esm/rate-limiter → rate-limiter}/createRateLimiter.d.ts +23 -18
  130. package/dist/rate-limiter/createRateLimiter.js +95 -0
  131. package/dist/rate-limiter/createRateLimiter.js.map +1 -0
  132. package/dist/rate-limiter/index.cjs +14 -0
  133. package/dist/rate-limiter/index.d.cts +5 -0
  134. package/dist/rate-limiter/index.d.ts +5 -0
  135. package/dist/{esm/rate-limiter → rate-limiter}/index.js +4 -7
  136. package/dist/throttler/createThrottledSignal.cjs +79 -0
  137. package/dist/throttler/createThrottledSignal.cjs.map +1 -0
  138. package/dist/{cjs/throttler → throttler}/createThrottledSignal.d.cts +10 -8
  139. package/dist/{esm/throttler → throttler}/createThrottledSignal.d.ts +10 -8
  140. package/dist/throttler/createThrottledSignal.js +79 -0
  141. package/dist/throttler/createThrottledSignal.js.map +1 -0
  142. package/dist/throttler/createThrottledValue.cjs +74 -0
  143. package/dist/throttler/createThrottledValue.cjs.map +1 -0
  144. package/dist/{cjs/throttler → throttler}/createThrottledValue.d.cts +10 -4
  145. package/dist/{esm/throttler → throttler}/createThrottledValue.d.ts +10 -4
  146. package/dist/throttler/createThrottledValue.js +74 -0
  147. package/dist/throttler/createThrottledValue.js.map +1 -0
  148. package/dist/throttler/createThrottler.cjs +97 -0
  149. package/dist/throttler/createThrottler.cjs.map +1 -0
  150. package/dist/{cjs/throttler → throttler}/createThrottler.d.cts +23 -18
  151. package/dist/{esm/throttler → throttler}/createThrottler.d.ts +23 -18
  152. package/dist/throttler/createThrottler.js +97 -0
  153. package/dist/throttler/createThrottler.js.map +1 -0
  154. package/dist/throttler/index.cjs +14 -0
  155. package/dist/throttler/index.d.cts +5 -0
  156. package/dist/throttler/index.d.ts +5 -0
  157. package/dist/{esm/throttler → throttler}/index.js +5 -8
  158. package/dist/types/index.cjs +9 -0
  159. package/dist/types/index.d.cts +1 -0
  160. package/dist/types/index.d.ts +1 -0
  161. package/dist/types/index.js +3 -0
  162. package/dist/utils/index.cjs +9 -0
  163. package/dist/utils/index.d.cts +1 -0
  164. package/dist/utils/index.d.ts +1 -0
  165. package/dist/utils/index.js +3 -0
  166. package/package.json +37 -106
  167. package/src/async-batcher/createAsyncBatcher.ts +12 -4
  168. package/src/async-debouncer/createAsyncDebouncer.ts +8 -2
  169. package/src/async-queuer/createAsyncQueuer.ts +12 -4
  170. package/src/async-rate-limiter/createAsyncRateLimiter.ts +8 -2
  171. package/src/async-throttler/createAsyncThrottler.ts +8 -2
  172. package/src/batcher/createBatcher.ts +12 -4
  173. package/src/debouncer/createDebouncer.ts +12 -4
  174. package/src/index.ts +4 -0
  175. package/src/provider/PacerProvider.tsx +63 -0
  176. package/src/provider/index.ts +1 -0
  177. package/src/queuer/createQueuedSignal.ts +138 -0
  178. package/src/queuer/createQueuer.ts +12 -4
  179. package/src/queuer/index.ts +1 -0
  180. package/src/rate-limiter/createRateLimitedValue.ts +30 -16
  181. package/src/rate-limiter/createRateLimiter.ts +12 -4
  182. package/src/throttler/createThrottler.ts +12 -4
  183. package/dist/cjs/async-batcher/createAsyncBatcher.cjs +0 -14
  184. package/dist/cjs/async-batcher/createAsyncBatcher.cjs.map +0 -1
  185. package/dist/cjs/async-batcher/index.cjs +0 -12
  186. package/dist/cjs/async-batcher/index.cjs.map +0 -1
  187. package/dist/cjs/async-batcher/index.d.cts +0 -2
  188. package/dist/cjs/async-debouncer/createAsyncDebouncer.cjs +0 -20
  189. package/dist/cjs/async-debouncer/createAsyncDebouncer.cjs.map +0 -1
  190. package/dist/cjs/async-debouncer/index.cjs +0 -12
  191. package/dist/cjs/async-debouncer/index.cjs.map +0 -1
  192. package/dist/cjs/async-debouncer/index.d.cts +0 -2
  193. package/dist/cjs/async-queuer/createAsyncQueuer.cjs +0 -14
  194. package/dist/cjs/async-queuer/createAsyncQueuer.cjs.map +0 -1
  195. package/dist/cjs/async-queuer/index.cjs +0 -12
  196. package/dist/cjs/async-queuer/index.cjs.map +0 -1
  197. package/dist/cjs/async-queuer/index.d.cts +0 -2
  198. package/dist/cjs/async-rate-limiter/createAsyncRateLimiter.cjs +0 -14
  199. package/dist/cjs/async-rate-limiter/createAsyncRateLimiter.cjs.map +0 -1
  200. package/dist/cjs/async-rate-limiter/index.cjs +0 -12
  201. package/dist/cjs/async-rate-limiter/index.cjs.map +0 -1
  202. package/dist/cjs/async-rate-limiter/index.d.cts +0 -2
  203. package/dist/cjs/async-throttler/createAsyncThrottler.cjs +0 -14
  204. package/dist/cjs/async-throttler/createAsyncThrottler.cjs.map +0 -1
  205. package/dist/cjs/async-throttler/index.cjs +0 -12
  206. package/dist/cjs/async-throttler/index.cjs.map +0 -1
  207. package/dist/cjs/async-throttler/index.d.cts +0 -2
  208. package/dist/cjs/batcher/createBatcher.cjs +0 -14
  209. package/dist/cjs/batcher/createBatcher.cjs.map +0 -1
  210. package/dist/cjs/batcher/index.cjs +0 -12
  211. package/dist/cjs/batcher/index.cjs.map +0 -1
  212. package/dist/cjs/batcher/index.d.cts +0 -2
  213. package/dist/cjs/debouncer/createDebouncedSignal.cjs +0 -11
  214. package/dist/cjs/debouncer/createDebouncedSignal.cjs.map +0 -1
  215. package/dist/cjs/debouncer/createDebouncedValue.cjs +0 -17
  216. package/dist/cjs/debouncer/createDebouncedValue.cjs.map +0 -1
  217. package/dist/cjs/debouncer/createDebouncer.cjs +0 -20
  218. package/dist/cjs/debouncer/createDebouncer.cjs.map +0 -1
  219. package/dist/cjs/debouncer/index.cjs +0 -16
  220. package/dist/cjs/debouncer/index.cjs.map +0 -1
  221. package/dist/cjs/debouncer/index.d.cts +0 -4
  222. package/dist/cjs/index.cjs +0 -42
  223. package/dist/cjs/index.cjs.map +0 -1
  224. package/dist/cjs/index.d.cts +0 -20
  225. package/dist/cjs/queuer/createQueuer.cjs +0 -14
  226. package/dist/cjs/queuer/createQueuer.cjs.map +0 -1
  227. package/dist/cjs/queuer/index.cjs +0 -12
  228. package/dist/cjs/queuer/index.cjs.map +0 -1
  229. package/dist/cjs/queuer/index.d.cts +0 -2
  230. package/dist/cjs/rate-limiter/createRateLimitedSignal.cjs +0 -19
  231. package/dist/cjs/rate-limiter/createRateLimitedSignal.cjs.map +0 -1
  232. package/dist/cjs/rate-limiter/createRateLimitedValue.cjs +0 -13
  233. package/dist/cjs/rate-limiter/createRateLimitedValue.cjs.map +0 -1
  234. package/dist/cjs/rate-limiter/createRateLimiter.cjs +0 -14
  235. package/dist/cjs/rate-limiter/createRateLimiter.cjs.map +0 -1
  236. package/dist/cjs/rate-limiter/index.cjs +0 -16
  237. package/dist/cjs/rate-limiter/index.cjs.map +0 -1
  238. package/dist/cjs/rate-limiter/index.d.cts +0 -4
  239. package/dist/cjs/throttler/createThrottledSignal.cjs +0 -11
  240. package/dist/cjs/throttler/createThrottledSignal.cjs.map +0 -1
  241. package/dist/cjs/throttler/createThrottledValue.cjs +0 -17
  242. package/dist/cjs/throttler/createThrottledValue.cjs.map +0 -1
  243. package/dist/cjs/throttler/createThrottler.cjs +0 -20
  244. package/dist/cjs/throttler/createThrottler.cjs.map +0 -1
  245. package/dist/cjs/throttler/index.cjs +0 -16
  246. package/dist/cjs/throttler/index.cjs.map +0 -1
  247. package/dist/cjs/throttler/index.d.cts +0 -4
  248. package/dist/cjs/types/index.cjs +0 -10
  249. package/dist/cjs/types/index.cjs.map +0 -1
  250. package/dist/cjs/types/index.d.cts +0 -1
  251. package/dist/cjs/utils/index.cjs +0 -10
  252. package/dist/cjs/utils/index.cjs.map +0 -1
  253. package/dist/cjs/utils/index.d.cts +0 -1
  254. package/dist/esm/async-batcher/createAsyncBatcher.js +0 -14
  255. package/dist/esm/async-batcher/createAsyncBatcher.js.map +0 -1
  256. package/dist/esm/async-batcher/index.d.ts +0 -2
  257. package/dist/esm/async-batcher/index.js +0 -6
  258. package/dist/esm/async-batcher/index.js.map +0 -1
  259. package/dist/esm/async-debouncer/createAsyncDebouncer.js +0 -20
  260. package/dist/esm/async-debouncer/createAsyncDebouncer.js.map +0 -1
  261. package/dist/esm/async-debouncer/index.d.ts +0 -2
  262. package/dist/esm/async-debouncer/index.js +0 -6
  263. package/dist/esm/async-debouncer/index.js.map +0 -1
  264. package/dist/esm/async-queuer/createAsyncQueuer.js +0 -14
  265. package/dist/esm/async-queuer/createAsyncQueuer.js.map +0 -1
  266. package/dist/esm/async-queuer/index.d.ts +0 -2
  267. package/dist/esm/async-queuer/index.js +0 -6
  268. package/dist/esm/async-queuer/index.js.map +0 -1
  269. package/dist/esm/async-rate-limiter/createAsyncRateLimiter.js +0 -14
  270. package/dist/esm/async-rate-limiter/createAsyncRateLimiter.js.map +0 -1
  271. package/dist/esm/async-rate-limiter/index.d.ts +0 -2
  272. package/dist/esm/async-rate-limiter/index.js +0 -6
  273. package/dist/esm/async-rate-limiter/index.js.map +0 -1
  274. package/dist/esm/async-throttler/createAsyncThrottler.js +0 -14
  275. package/dist/esm/async-throttler/createAsyncThrottler.js.map +0 -1
  276. package/dist/esm/async-throttler/index.d.ts +0 -2
  277. package/dist/esm/async-throttler/index.js +0 -6
  278. package/dist/esm/async-throttler/index.js.map +0 -1
  279. package/dist/esm/batcher/createBatcher.js +0 -14
  280. package/dist/esm/batcher/createBatcher.js.map +0 -1
  281. package/dist/esm/batcher/index.d.ts +0 -2
  282. package/dist/esm/batcher/index.js +0 -6
  283. package/dist/esm/batcher/index.js.map +0 -1
  284. package/dist/esm/debouncer/createDebouncedSignal.js +0 -11
  285. package/dist/esm/debouncer/createDebouncedSignal.js.map +0 -1
  286. package/dist/esm/debouncer/createDebouncedValue.js +0 -17
  287. package/dist/esm/debouncer/createDebouncedValue.js.map +0 -1
  288. package/dist/esm/debouncer/createDebouncer.js +0 -20
  289. package/dist/esm/debouncer/createDebouncer.js.map +0 -1
  290. package/dist/esm/debouncer/index.d.ts +0 -4
  291. package/dist/esm/debouncer/index.js.map +0 -1
  292. package/dist/esm/index.d.ts +0 -20
  293. package/dist/esm/index.js.map +0 -1
  294. package/dist/esm/queuer/createQueuer.js +0 -14
  295. package/dist/esm/queuer/createQueuer.js.map +0 -1
  296. package/dist/esm/queuer/index.d.ts +0 -2
  297. package/dist/esm/queuer/index.js +0 -6
  298. package/dist/esm/queuer/index.js.map +0 -1
  299. package/dist/esm/rate-limiter/createRateLimitedSignal.js +0 -19
  300. package/dist/esm/rate-limiter/createRateLimitedSignal.js.map +0 -1
  301. package/dist/esm/rate-limiter/createRateLimitedValue.js +0 -13
  302. package/dist/esm/rate-limiter/createRateLimitedValue.js.map +0 -1
  303. package/dist/esm/rate-limiter/createRateLimiter.js +0 -14
  304. package/dist/esm/rate-limiter/createRateLimiter.js.map +0 -1
  305. package/dist/esm/rate-limiter/index.d.ts +0 -4
  306. package/dist/esm/rate-limiter/index.js.map +0 -1
  307. package/dist/esm/throttler/createThrottledSignal.js +0 -11
  308. package/dist/esm/throttler/createThrottledSignal.js.map +0 -1
  309. package/dist/esm/throttler/createThrottledValue.js +0 -17
  310. package/dist/esm/throttler/createThrottledValue.js.map +0 -1
  311. package/dist/esm/throttler/createThrottler.js +0 -20
  312. package/dist/esm/throttler/createThrottler.js.map +0 -1
  313. package/dist/esm/throttler/index.d.ts +0 -4
  314. package/dist/esm/throttler/index.js.map +0 -1
  315. package/dist/esm/types/index.d.ts +0 -1
  316. package/dist/esm/types/index.js +0 -2
  317. package/dist/esm/types/index.js.map +0 -1
  318. package/dist/esm/utils/index.d.ts +0 -1
  319. package/dist/esm/utils/index.js +0 -2
  320. package/dist/esm/utils/index.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAsyncBatcher.cjs","sources":["../../../src/async-batcher/createAsyncBatcher.ts"],"sourcesContent":["import { AsyncBatcher } from '@tanstack/pacer/async-batcher'\nimport { useStore } from '@tanstack/solid-store'\nimport type { Store } from '@tanstack/solid-store'\nimport type { Accessor } from 'solid-js'\nimport type {\n AsyncBatcherOptions,\n AsyncBatcherState,\n} from '@tanstack/pacer/async-batcher'\n\nexport interface SolidAsyncBatcher<TValue, TSelected = {}>\n extends Omit<AsyncBatcher<TValue>, 'store'> {\n /**\n * Reactive state that will be updated when the batcher state changes\n *\n * Use this instead of `batcher.store.state`\n */\n readonly state: Accessor<Readonly<TSelected>>\n /**\n * @deprecated Use `batcher.state` instead of `batcher.store.state` if you want to read reactive state.\n * The state on the store object is not reactive, as it has not been wrapped in a `useStore` hook internally.\n * Although, you can make the state reactive by using the `useStore` in your own usage.\n */\n readonly store: Store<Readonly<AsyncBatcherState<TValue>>>\n}\n\n/**\n * Creates a Solid-compatible AsyncBatcher instance for managing asynchronous batches of items, exposing Solid signals for all stateful properties.\n *\n * This is the async version of the createBatcher hook. Unlike the sync version, this async batcher:\n * - Handles promises and returns results from batch executions\n * - Provides error handling with configurable error behavior\n * - Tracks success, error, and settle counts separately\n * - Has state tracking for when batches are executing\n * - Returns the result of the batch function execution\n *\n * Features:\n * - Configurable batch size and wait time\n * - Custom batch processing logic via getShouldExecute\n * - Event callbacks for monitoring batch operations\n * - Error handling for failed batch operations\n * - Automatic or manual batch processing\n * - All stateful properties (items, counts, etc.) are exposed as Solid signals for reactivity\n *\n * The batcher collects items and processes them in batches based on:\n * - Maximum batch size (number of items per batch)\n * - Time-based batching (process after X milliseconds)\n * - Custom batch processing logic via getShouldExecute\n *\n * Error Handling:\n * - If an `onError` handler is provided, it will be called with the error and batcher instance\n * - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown\n * - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed\n * - Both onError and throwOnError can be used together; the handler will be called before any error is thrown\n * - The error state can be checked using the underlying AsyncBatcher instance\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. The `selector` parameter allows you\n * to specify which state changes will trigger a re-render, optimizing performance by preventing\n * unnecessary re-renders when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary re-renders and gives you\n * full control over when your component updates. Only when you provide a selector will the\n * component re-render when the selected state values change.\n *\n * Available state properties:\n * - `errorCount`: Number of failed batch executions\n * - `executionCount`: Total number of batch execution attempts (successful + failed)\n * - `hasError`: Whether the last batch execution resulted in an error\n * - `isExecuting`: Whether a batch execution is currently in progress\n * - `items`: Array of items currently queued for batching\n * - `lastError`: The error from the most recent failed batch execution (if any)\n * - `lastResult`: The result from the most recent successful batch execution\n * - `settleCount`: Number of batch executions that have completed (successful or failed)\n * - `successCount`: Number of successful batch executions\n *\n * Example usage:\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const asyncBatcher = createAsyncBatcher(\n * async (items) => {\n * const results = await Promise.all(items.map(item => processItem(item)));\n * return results;\n * },\n * {\n * maxSize: 10,\n * wait: 2000,\n * onSuccess: (result) => {\n * console.log('Batch processed successfully:', result);\n * },\n * onError: (error) => {\n * console.error('Batch processing failed:', error);\n * }\n * }\n * );\n *\n * // Opt-in to re-render when items or isExecuting changes (optimized for UI updates)\n * const asyncBatcher = createAsyncBatcher(\n * async (items) => {\n * const results = await Promise.all(items.map(item => processItem(item)));\n * return results;\n * },\n * { maxSize: 10, wait: 2000 },\n * (state) => ({ items: state.items, isExecuting: state.isExecuting })\n * );\n *\n * // Opt-in to re-render when error state changes (optimized for error handling)\n * const asyncBatcher = createAsyncBatcher(\n * async (items) => {\n * const results = await Promise.all(items.map(item => processItem(item)));\n * return results;\n * },\n * { maxSize: 10, wait: 2000 },\n * (state) => ({ hasError: state.hasError, lastError: state.lastError })\n * );\n *\n * // Add items to batch\n * asyncBatcher.addItem(newItem);\n *\n * // Manually execute batch\n * const result = await asyncBatcher.execute();\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { items, isExecuting } = asyncBatcher.state();\n * ```\n */\nexport function createAsyncBatcher<TValue, TSelected = {}>(\n fn: (items: Array<TValue>) => Promise<any>,\n initialOptions: AsyncBatcherOptions<TValue> = {},\n selector: (state: AsyncBatcherState<TValue>) => TSelected = () =>\n ({}) as TSelected,\n): SolidAsyncBatcher<TValue, TSelected> {\n const asyncBatcher = new AsyncBatcher<TValue>(fn, initialOptions)\n\n const state = useStore(asyncBatcher.store, selector)\n\n return {\n ...asyncBatcher,\n state,\n } as SolidAsyncBatcher<TValue, TSelected> // omit `store` in favor of `state`\n}\n"],"names":["asyncBatcher","AsyncBatcher","useStore"],"mappings":";;;;AA+HO,SAAS,mBACd,IACA,iBAA8C,CAAA,GAC9C,WAA4D,OACzD,CAAA,IACmC;AACtC,QAAMA,iBAAe,IAAIC,0BAAqB,IAAI,cAAc;AAEhE,QAAM,QAAQC,WAAAA,SAASF,eAAa,OAAO,QAAQ;AAEnD,SAAO;AAAA,IACL,GAAGA;AAAAA,IACH;AAAA,EAAA;AAEJ;;"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const asyncBatcher = require("@tanstack/pacer/async-batcher");
4
- const createAsyncBatcher = require("./createAsyncBatcher.cjs");
5
- exports.createAsyncBatcher = createAsyncBatcher.createAsyncBatcher;
6
- Object.keys(asyncBatcher).forEach((k) => {
7
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
8
- enumerable: true,
9
- get: () => asyncBatcher[k]
10
- });
11
- });
12
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- export * from '@tanstack/pacer/async-batcher';
2
- export * from './createAsyncBatcher.cjs';
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const asyncDebouncer = require("@tanstack/pacer/async-debouncer");
4
- const solidStore = require("@tanstack/solid-store");
5
- const solidJs = require("solid-js");
6
- function createAsyncDebouncer(fn, initialOptions, selector = () => ({})) {
7
- const asyncDebouncer$1 = new asyncDebouncer.AsyncDebouncer(fn, initialOptions);
8
- const state = solidStore.useStore(asyncDebouncer$1.store, selector);
9
- solidJs.createEffect(() => {
10
- solidJs.onCleanup(() => {
11
- asyncDebouncer$1.cancel();
12
- });
13
- });
14
- return {
15
- ...asyncDebouncer$1,
16
- state
17
- };
18
- }
19
- exports.createAsyncDebouncer = createAsyncDebouncer;
20
- //# sourceMappingURL=createAsyncDebouncer.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAsyncDebouncer.cjs","sources":["../../../src/async-debouncer/createAsyncDebouncer.ts"],"sourcesContent":["import { AsyncDebouncer } from '@tanstack/pacer/async-debouncer'\nimport { useStore } from '@tanstack/solid-store'\nimport { createEffect, onCleanup } from 'solid-js'\nimport type { Store } from '@tanstack/solid-store'\nimport type { Accessor } from 'solid-js'\nimport type {\n AsyncDebouncerOptions,\n AsyncDebouncerState,\n} from '@tanstack/pacer/async-debouncer'\nimport type { AnyAsyncFunction } from '@tanstack/pacer/types'\n\nexport interface SolidAsyncDebouncer<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n> extends Omit<AsyncDebouncer<TFn>, 'store'> {\n /**\n * Reactive state that will be updated when the debouncer state changes\n *\n * Use this instead of `debouncer.store.state`\n */\n readonly state: Accessor<Readonly<TSelected>>\n /**\n * @deprecated Use `debouncer.state` instead of `debouncer.store.state` if you want to read reactive state.\n * The state on the store object is not reactive, as it has not been wrapped in a `useStore` hook internally.\n * Although, you can make the state reactive by using the `useStore` in your own usage.\n */\n readonly store: Store<Readonly<AsyncDebouncerState<TFn>>>\n}\n\n/**\n * A low-level Solid hook that creates an `AsyncDebouncer` instance to delay execution of an async function.\n *\n * This hook is designed to be flexible and state-management agnostic - it simply returns a debouncer instance that\n * you can integrate with any state management solution (createSignal, etc).\n *\n * Async debouncing ensures that an async function only executes after a specified delay has passed since its last invocation.\n * Each new invocation resets the delay timer. This is useful for handling frequent events like window resizing\n * or input changes where you only want to execute the handler after the events have stopped occurring.\n *\n * Unlike throttling which allows execution at regular intervals, debouncing prevents any execution until\n * the function stops being called for the specified delay period.\n *\n * Unlike the non-async Debouncer, this async version supports returning values from the debounced function,\n * making it ideal for API calls and other async operations where you want the result of the `maybeExecute` call\n * instead of setting the result on a state variable from within the debounced function.\n *\n * Error Handling:\n * - If an `onError` handler is provided, it will be called with the error and debouncer instance\n * - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown\n * - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed\n * - Both onError and throwOnError can be used together - the handler will be called before any error is thrown\n * - The error state can be checked using the underlying AsyncDebouncer instance\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. The `selector` parameter allows you\n * to specify which state changes will trigger a re-render, optimizing performance by preventing\n * unnecessary re-renders when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary re-renders and gives you\n * full control over when your component updates. Only when you provide a selector will the\n * component re-render when the selected state values change.\n *\n * Available state properties:\n * - `canLeadingExecute`: Whether the debouncer can execute on the leading edge\n * - `executionCount`: Number of function executions that have been completed\n * - `hasError`: Whether the last execution resulted in an error\n * - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution\n * - `isExecuting`: Whether an async function execution is currently in progress\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `lastError`: The error from the most recent failed execution (if any)\n * - `lastResult`: The result from the most recent successful execution\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing')\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const { maybeExecute } = createAsyncDebouncer(\n * async (query: string) => {\n * const results = await api.search(query);\n * return results;\n * },\n * { wait: 500 }\n * );\n *\n * // Opt-in to re-render when isPending or isExecuting changes (optimized for loading states)\n * const debouncer = createAsyncDebouncer(\n * async (query: string) => {\n * const results = await api.search(query);\n * return results;\n * },\n * { wait: 500 },\n * (state) => ({ isPending: state.isPending, isExecuting: state.isExecuting })\n * );\n *\n * // Opt-in to re-render when error state changes (optimized for error handling)\n * const debouncer = createAsyncDebouncer(\n * async (searchTerm) => {\n * const data = await searchAPI(searchTerm);\n * return data;\n * },\n * {\n * wait: 300,\n * leading: true, // Execute immediately on first call\n * trailing: false, // Skip trailing edge updates\n * onError: (error) => {\n * console.error('API call failed:', error);\n * }\n * },\n * (state) => ({ hasError: state.hasError, lastError: state.lastError })\n * );\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { isPending, isExecuting } = debouncer.state();\n * ```\n */\nexport function createAsyncDebouncer<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n>(\n fn: TFn,\n initialOptions: AsyncDebouncerOptions<TFn>,\n selector: (state: AsyncDebouncerState<TFn>) => TSelected = () =>\n ({}) as TSelected,\n): SolidAsyncDebouncer<TFn, TSelected> {\n const asyncDebouncer = new AsyncDebouncer<TFn>(fn, initialOptions)\n\n const state = useStore(asyncDebouncer.store, selector)\n\n createEffect(() => {\n onCleanup(() => {\n asyncDebouncer.cancel()\n })\n })\n\n return {\n ...asyncDebouncer,\n state,\n } as SolidAsyncDebouncer<TFn, TSelected> // omit `store` in favor of `state`\n}\n"],"names":["asyncDebouncer","AsyncDebouncer","useStore","createEffect","onCleanup"],"mappings":";;;;;AAqHO,SAAS,qBAId,IACA,gBACA,WAA2D,OACxD,CAAA,IACkC;AACrC,QAAMA,mBAAiB,IAAIC,8BAAoB,IAAI,cAAc;AAEjE,QAAM,QAAQC,WAAAA,SAASF,iBAAe,OAAO,QAAQ;AAErDG,UAAAA,aAAa,MAAM;AACjBC,YAAAA,UAAU,MAAM;AACdJ,uBAAe,OAAA;AAAA,IACjB,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AAAA,IACL,GAAGA;AAAAA,IACH;AAAA,EAAA;AAEJ;;"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const asyncDebouncer = require("@tanstack/pacer/async-debouncer");
4
- const createAsyncDebouncer = require("./createAsyncDebouncer.cjs");
5
- exports.createAsyncDebouncer = createAsyncDebouncer.createAsyncDebouncer;
6
- Object.keys(asyncDebouncer).forEach((k) => {
7
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
8
- enumerable: true,
9
- get: () => asyncDebouncer[k]
10
- });
11
- });
12
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- export * from '@tanstack/pacer/async-debouncer';
2
- export * from './createAsyncDebouncer.cjs';
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const asyncQueuer = require("@tanstack/pacer/async-queuer");
4
- const solidStore = require("@tanstack/solid-store");
5
- function createAsyncQueuer(fn, initialOptions = {}, selector = () => ({})) {
6
- const asyncQueuer$1 = new asyncQueuer.AsyncQueuer(fn, initialOptions);
7
- const state = solidStore.useStore(asyncQueuer$1.store, selector);
8
- return {
9
- ...asyncQueuer$1,
10
- state
11
- };
12
- }
13
- exports.createAsyncQueuer = createAsyncQueuer;
14
- //# sourceMappingURL=createAsyncQueuer.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAsyncQueuer.cjs","sources":["../../../src/async-queuer/createAsyncQueuer.ts"],"sourcesContent":["import { AsyncQueuer } from '@tanstack/pacer/async-queuer'\nimport { useStore } from '@tanstack/solid-store'\nimport type { Store } from '@tanstack/solid-store'\nimport type { Accessor } from 'solid-js'\nimport type {\n AsyncQueuerOptions,\n AsyncQueuerState,\n} from '@tanstack/pacer/async-queuer'\n\nexport interface SolidAsyncQueuer<TValue, TSelected = {}>\n extends Omit<AsyncQueuer<TValue>, 'store'> {\n /**\n * Reactive state that will be updated when the queuer state changes\n *\n * Use this instead of `queuer.store.state`\n */\n readonly state: Accessor<Readonly<TSelected>>\n /**\n * @deprecated Use `queuer.state` instead of `queuer.store.state` if you want to read reactive state.\n * The state on the store object is not reactive, as it has not been wrapped in a `useStore` hook internally.\n * Although, you can make the state reactive by using the `useStore` in your own usage.\n */\n readonly store: Store<Readonly<AsyncQueuerState<TValue>>>\n}\n\n/**\n * Creates a Solid-compatible AsyncQueuer instance for managing an asynchronous queue of items, exposing Solid signals for all stateful properties.\n *\n * Features:\n * - Priority queueing via `getPriority` or item `priority` property\n * - Configurable concurrency limit\n * - FIFO (First In First Out) or LIFO (Last In First Out) queue behavior\n * - Pause/resume processing\n * - Task cancellation\n * - Item expiration\n * - Lifecycle callbacks for success, error, settled, items change, etc.\n * - All stateful properties (active items, pending items, counts, etc.) are exposed as Solid signals for reactivity\n *\n * Tasks are processed concurrently up to the configured concurrency limit. When a task completes,\n * the next pending task is processed if the concurrency limit allows.\n *\n * Error Handling:\n * - If an `onError` handler is provided, it will be called with the error and queuer instance\n * - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown\n * - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed\n * - Both onError and throwOnError can be used together; the handler will be called before any error is thrown\n * - The error state can be checked using the underlying AsyncQueuer instance\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. The `selector` parameter allows you\n * to specify which state changes will trigger a re-render, optimizing performance by preventing\n * unnecessary re-renders when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary re-renders and gives you\n * full control over when your component updates. Only when you provide a selector will the\n * component re-render when the selected state values change.\n *\n * Available state properties:\n * - `activeItems`: Array of items currently being processed\n * - `errorCount`: Number of items that failed processing\n * - `isRunning`: Whether the queuer is currently running (not stopped)\n * - `pendingItems`: Array of items waiting to be processed\n * - `rejectionCount`: Number of items that were rejected (expired or failed validation)\n * - `settleCount`: Number of items that have completed processing (successful or failed)\n * - `successCount`: Number of items that were processed successfully\n *\n * Example usage:\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const asyncQueuer = createAsyncQueuer(async (item) => {\n * // process item\n * return await fetchData(item);\n * }, {\n * initialItems: [],\n * concurrency: 2,\n * maxSize: 100,\n * started: false,\n * onSuccess: (result) => {\n * console.log('Item processed:', result);\n * },\n * onError: (error) => {\n * console.error('Processing failed:', error);\n * }\n * });\n *\n * // Opt-in to re-render when queue state changes (optimized for UI updates)\n * const asyncQueuer = createAsyncQueuer(\n * async (item) => await fetchData(item),\n * { concurrency: 2, started: true },\n * (state) => ({\n * pendingItems: state.pendingItems,\n * activeItems: state.activeItems,\n * isRunning: state.isRunning\n * })\n * );\n *\n * // Opt-in to re-render when processing metrics change (optimized for tracking progress)\n * const asyncQueuer = createAsyncQueuer(\n * async (item) => await fetchData(item),\n * { concurrency: 2, started: true },\n * (state) => ({\n * successCount: state.successCount,\n * errorCount: state.errorCount,\n * settleCount: state.settleCount\n * })\n * );\n *\n * // Add items to queue\n * asyncQueuer.addItem(newItem);\n *\n * // Start processing\n * asyncQueuer.start();\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { pendingItems, activeItems } = asyncQueuer.state();\n * ```\n */\nexport function createAsyncQueuer<TValue, TSelected = {}>(\n fn: (value: TValue) => Promise<any>,\n initialOptions: AsyncQueuerOptions<TValue> = {},\n selector: (state: AsyncQueuerState<TValue>) => TSelected = () =>\n ({}) as TSelected,\n): SolidAsyncQueuer<TValue, TSelected> {\n const asyncQueuer = new AsyncQueuer<TValue>(fn, initialOptions)\n\n const state = useStore(asyncQueuer.store, selector)\n\n return {\n ...asyncQueuer,\n state,\n } as SolidAsyncQueuer<TValue, TSelected> // omit `store` in favor of `state`\n}\n"],"names":["asyncQueuer","AsyncQueuer","useStore"],"mappings":";;;;AAuHO,SAAS,kBACd,IACA,iBAA6C,CAAA,GAC7C,WAA2D,OACxD,CAAA,IACkC;AACrC,QAAMA,gBAAc,IAAIC,wBAAoB,IAAI,cAAc;AAE9D,QAAM,QAAQC,WAAAA,SAASF,cAAY,OAAO,QAAQ;AAElD,SAAO;AAAA,IACL,GAAGA;AAAAA,IACH;AAAA,EAAA;AAEJ;;"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const asyncQueuer = require("@tanstack/pacer/async-queuer");
4
- const createAsyncQueuer = require("./createAsyncQueuer.cjs");
5
- exports.createAsyncQueuer = createAsyncQueuer.createAsyncQueuer;
6
- Object.keys(asyncQueuer).forEach((k) => {
7
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
8
- enumerable: true,
9
- get: () => asyncQueuer[k]
10
- });
11
- });
12
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- export * from '@tanstack/pacer/async-queuer';
2
- export * from './createAsyncQueuer.cjs';
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const asyncRateLimiter = require("@tanstack/pacer/async-rate-limiter");
4
- const solidStore = require("@tanstack/solid-store");
5
- function createAsyncRateLimiter(fn, initialOptions, selector = () => ({})) {
6
- const asyncRateLimiter$1 = new asyncRateLimiter.AsyncRateLimiter(fn, initialOptions);
7
- const state = solidStore.useStore(asyncRateLimiter$1.store, selector);
8
- return {
9
- ...asyncRateLimiter$1,
10
- state
11
- };
12
- }
13
- exports.createAsyncRateLimiter = createAsyncRateLimiter;
14
- //# sourceMappingURL=createAsyncRateLimiter.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAsyncRateLimiter.cjs","sources":["../../../src/async-rate-limiter/createAsyncRateLimiter.ts"],"sourcesContent":["import { AsyncRateLimiter } from '@tanstack/pacer/async-rate-limiter'\nimport { useStore } from '@tanstack/solid-store'\nimport type { Store } from '@tanstack/solid-store'\nimport type { Accessor } from 'solid-js'\nimport type { AnyAsyncFunction } from '@tanstack/pacer/types'\nimport type {\n AsyncRateLimiterOptions,\n AsyncRateLimiterState,\n} from '@tanstack/pacer/async-rate-limiter'\n\nexport interface SolidAsyncRateLimiter<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n> extends Omit<AsyncRateLimiter<TFn>, 'store'> {\n /**\n * Reactive state that will be updated when the rate limiter state changes\n *\n * Use this instead of `rateLimiter.store.state`\n */\n readonly state: Accessor<Readonly<TSelected>>\n /**\n * @deprecated Use `rateLimiter.state` instead of `rateLimiter.store.state` if you want to read reactive state.\n * The state on the store object is not reactive, as it has not been wrapped in a `useStore` hook internally.\n * Although, you can make the state reactive by using the `useStore` in your own usage.\n */\n readonly store: Store<Readonly<AsyncRateLimiterState<TFn>>>\n}\n\n/**\n * A low-level Solid hook that creates an `AsyncRateLimiter` instance to limit how many times an async function can execute within a time window.\n *\n * This hook is designed to be flexible and state-management agnostic - it simply returns a rate limiter instance that\n * you can integrate with any state management solution (createSignal, etc).\n *\n * Rate limiting is a simple approach that allows a function to execute up to a limit within a time window,\n * then blocks all subsequent calls until the window passes. This can lead to \"bursty\" behavior where\n * all executions happen immediately, followed by a complete block.\n *\n * The rate limiter supports two types of windows:\n * - 'fixed': A strict window that resets after the window period. All executions within the window count\n * towards the limit, and the window resets completely after the period.\n * - 'sliding': A rolling window that allows executions as old ones expire. This provides a more\n * consistent rate of execution over time.\n *\n * Unlike the non-async RateLimiter, this async version supports returning values from the rate-limited function,\n * making it ideal for API calls and other async operations where you want the result of the `maybeExecute` call\n * instead of setting the result on a state variable from within the rate-limited function.\n *\n * For smoother execution patterns, consider using:\n * - Throttling: Ensures consistent spacing between executions (e.g. max once per 200ms)\n * - Debouncing: Waits for a pause in calls before executing (e.g. after 500ms of no calls)\n *\n * Rate limiting is best used for hard API limits or resource constraints. For UI updates or\n * smoothing out frequent events, throttling or debouncing usually provide better user experience.\n *\n * Error Handling:\n * - If an `onError` handler is provided, it will be called with the error and rate limiter instance\n * - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown\n * - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed\n * - Both onError and throwOnError can be used together - the handler will be called before any error is thrown\n * - The error state can be checked using the underlying AsyncRateLimiter instance\n * - Rate limit rejections (when limit is exceeded) are handled separately from execution errors via the `onReject` handler\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. The `selector` parameter allows you\n * to specify which state changes will trigger a re-render, optimizing performance by preventing\n * unnecessary re-renders when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary re-renders and gives you\n * full control over when your component updates. Only when you provide a selector will the\n * component re-render when the selected state values change.\n *\n * Available state properties:\n * - `currentWindowStart`: Timestamp when the current window started\n * - `executionCount`: Number of function executions that have been completed\n * - `hasError`: Whether the last execution resulted in an error\n * - `isExecuting`: Whether an async function execution is currently in progress\n * - `lastError`: The error from the most recent failed execution (if any)\n * - `lastResult`: The result from the most recent successful execution\n * - `nextWindowTime`: Timestamp when the next window begins\n * - `rejectionCount`: Number of function calls that were rejected due to rate limiting\n * - `remainingInWindow`: Number of executions remaining in the current window\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const { maybeExecute } = createAsyncRateLimiter(\n * async (id: string) => {\n * const data = await api.fetchData(id);\n * return data; // Return value is preserved\n * },\n * { limit: 5, window: 1000 } // 5 calls per second\n * );\n *\n * // Opt-in to re-render when rate limit and execution state changes (optimized for UI feedback)\n * const rateLimiter = createAsyncRateLimiter(\n * async (query) => {\n * const result = await searchAPI(query);\n * return result;\n * },\n * { limit: 10, window: 60000 },\n * (state) => ({\n * remainingInWindow: state.remainingInWindow,\n * isExecuting: state.isExecuting,\n * rejectionCount: state.rejectionCount\n * })\n * );\n *\n * // Opt-in to re-render when error state changes (optimized for error handling)\n * const rateLimiter = createAsyncRateLimiter(\n * async (query) => {\n * const result = await searchAPI(query);\n * return result;\n * },\n * {\n * limit: 10,\n * window: 60000, // 10 calls per minute\n * onReject: (info) => console.log(`Rate limit exceeded: ${info.nextValidTime - Date.now()}ms until next window`)\n * },\n * (state) => ({ hasError: state.hasError, lastError: state.lastError })\n * );\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { remainingInWindow, isExecuting } = rateLimiter.state();\n * ```\n */\nexport function createAsyncRateLimiter<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n>(\n fn: TFn,\n initialOptions: AsyncRateLimiterOptions<TFn>,\n selector: (state: AsyncRateLimiterState<TFn>) => TSelected = () =>\n ({}) as TSelected,\n): SolidAsyncRateLimiter<TFn, TSelected> {\n const asyncRateLimiter = new AsyncRateLimiter<TFn>(fn, initialOptions)\n\n const state = useStore(asyncRateLimiter.store, selector)\n\n return {\n ...asyncRateLimiter,\n state,\n } as SolidAsyncRateLimiter<TFn, TSelected>\n}\n"],"names":["asyncRateLimiter","AsyncRateLimiter","useStore"],"mappings":";;;;AAgIO,SAAS,uBAId,IACA,gBACA,WAA6D,OAC1D,CAAA,IACoC;AACvC,QAAMA,qBAAmB,IAAIC,kCAAsB,IAAI,cAAc;AAErE,QAAM,QAAQC,WAAAA,SAASF,mBAAiB,OAAO,QAAQ;AAEvD,SAAO;AAAA,IACL,GAAGA;AAAAA,IACH;AAAA,EAAA;AAEJ;;"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const asyncRateLimiter = require("@tanstack/pacer/async-rate-limiter");
4
- const createAsyncRateLimiter = require("./createAsyncRateLimiter.cjs");
5
- exports.createAsyncRateLimiter = createAsyncRateLimiter.createAsyncRateLimiter;
6
- Object.keys(asyncRateLimiter).forEach((k) => {
7
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
8
- enumerable: true,
9
- get: () => asyncRateLimiter[k]
10
- });
11
- });
12
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- export * from '@tanstack/pacer/async-rate-limiter';
2
- export * from './createAsyncRateLimiter.cjs';
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const asyncThrottler = require("@tanstack/pacer/async-throttler");
4
- const solidStore = require("@tanstack/solid-store");
5
- function createAsyncThrottler(fn, initialOptions, selector = () => ({})) {
6
- const asyncThrottler$1 = new asyncThrottler.AsyncThrottler(fn, initialOptions);
7
- const state = solidStore.useStore(asyncThrottler$1.store, selector);
8
- return {
9
- ...asyncThrottler$1,
10
- state
11
- };
12
- }
13
- exports.createAsyncThrottler = createAsyncThrottler;
14
- //# sourceMappingURL=createAsyncThrottler.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAsyncThrottler.cjs","sources":["../../../src/async-throttler/createAsyncThrottler.ts"],"sourcesContent":["import { AsyncThrottler } from '@tanstack/pacer/async-throttler'\nimport { useStore } from '@tanstack/solid-store'\nimport type { Store } from '@tanstack/solid-store'\nimport type { Accessor } from 'solid-js'\nimport type { AnyAsyncFunction } from '@tanstack/pacer/types'\nimport type {\n AsyncThrottlerOptions,\n AsyncThrottlerState,\n} from '@tanstack/pacer/async-throttler'\n\nexport interface SolidAsyncThrottler<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n> extends Omit<AsyncThrottler<TFn>, 'store'> {\n /**\n * Reactive state that will be updated when the throttler state changes\n *\n * Use this instead of `throttler.store.state`\n */\n readonly state: Accessor<Readonly<TSelected>>\n /**\n * @deprecated Use `throttler.state` instead of `throttler.store.state` if you want to read reactive state.\n * The state on the store object is not reactive, as it has not been wrapped in a `useStore` hook internally.\n * Although, you can make the state reactive by using the `useStore` in your own usage.\n */\n readonly store: Store<Readonly<AsyncThrottlerState<TFn>>>\n}\n\n/**\n * A low-level Solid hook that creates an `AsyncThrottler` instance to limit how often an async function can execute.\n *\n * This hook is designed to be flexible and state-management agnostic - it simply returns a throttler instance that\n * you can integrate with any state management solution (createSignal, etc).\n *\n * Async throttling ensures an async function executes at most once within a specified time window,\n * regardless of how many times it is called. This is useful for rate-limiting expensive API calls,\n * database operations, or other async tasks.\n *\n * Unlike the non-async Throttler, this async version supports returning values from the throttled function,\n * making it ideal for API calls and other async operations where you want the result of the `maybeExecute` call\n * instead of setting the result on a state variable from within the throttled function.\n *\n * Error Handling:\n * - If an `onError` handler is provided, it will be called with the error and throttler instance\n * - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown\n * - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed\n * - Both onError and throwOnError can be used together - the handler will be called before any error is thrown\n * - The error state can be checked using the underlying AsyncThrottler instance\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. The `selector` parameter allows you\n * to specify which state changes will trigger a re-render, optimizing performance by preventing\n * unnecessary re-renders when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary re-renders and gives you\n * full control over when your component updates. Only when you provide a selector will the\n * component re-render when the selected state values change.\n *\n * Available state properties:\n * - `canLeadingExecute`: Whether the throttler can execute on the leading edge\n * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge\n * - `executionCount`: Number of function executions that have been completed\n * - `hasError`: Whether the last execution resulted in an error\n * - `isPending`: Whether the throttler is waiting for the timeout to trigger execution\n * - `isExecuting`: Whether an async function execution is currently in progress\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `lastError`: The error from the most recent failed execution (if any)\n * - `lastExecutionTime`: Timestamp of the last execution\n * - `lastResult`: The result from the most recent successful execution\n * - `nextExecutionTime`: Timestamp of the next allowed execution\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing')\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const { maybeExecute } = createAsyncThrottler(\n * async (id: string) => {\n * const data = await api.fetchData(id);\n * return data;\n * },\n * { wait: 1000 }\n * );\n *\n * // Opt-in to re-render when isPending or isExecuting changes (optimized for loading states)\n * const throttler = createAsyncThrottler(\n * async (query) => {\n * const result = await searchAPI(query);\n * return result;\n * },\n * { wait: 2000 },\n * (state) => ({ isPending: state.isPending, isExecuting: state.isExecuting })\n * );\n *\n * // Opt-in to re-render when error state changes (optimized for error handling)\n * const throttler = createAsyncThrottler(\n * async (query) => {\n * const result = await searchAPI(query);\n * return result;\n * },\n * {\n * wait: 2000,\n * leading: true, // Execute immediately on first call\n * trailing: false, // Skip trailing edge updates\n * onError: (error) => {\n * console.error('API call failed:', error);\n * }\n * },\n * (state) => ({ hasError: state.hasError, lastError: state.lastError })\n * );\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { isPending, isExecuting } = throttler.state();\n * ```\n */\nexport function createAsyncThrottler<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n>(\n fn: TFn,\n initialOptions: AsyncThrottlerOptions<TFn>,\n selector: (state: AsyncThrottlerState<TFn>) => TSelected = () =>\n ({}) as TSelected,\n): SolidAsyncThrottler<TFn, TSelected> {\n const asyncThrottler = new AsyncThrottler(fn, initialOptions)\n\n const state = useStore(asyncThrottler.store, selector)\n\n return {\n ...asyncThrottler,\n state,\n } as SolidAsyncThrottler<TFn, TSelected>\n}\n"],"names":["asyncThrottler","AsyncThrottler","useStore"],"mappings":";;;;AAoHO,SAAS,qBAId,IACA,gBACA,WAA2D,OACxD,CAAA,IACkC;AACrC,QAAMA,mBAAiB,IAAIC,8BAAe,IAAI,cAAc;AAE5D,QAAM,QAAQC,WAAAA,SAASF,iBAAe,OAAO,QAAQ;AAErD,SAAO;AAAA,IACL,GAAGA;AAAAA,IACH;AAAA,EAAA;AAEJ;;"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const asyncThrottler = require("@tanstack/pacer/async-throttler");
4
- const createAsyncThrottler = require("./createAsyncThrottler.cjs");
5
- exports.createAsyncThrottler = createAsyncThrottler.createAsyncThrottler;
6
- Object.keys(asyncThrottler).forEach((k) => {
7
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
8
- enumerable: true,
9
- get: () => asyncThrottler[k]
10
- });
11
- });
12
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- export * from '@tanstack/pacer/async-throttler';
2
- export * from './createAsyncThrottler.cjs';
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const batcher = require("@tanstack/pacer/batcher");
4
- const solidStore = require("@tanstack/solid-store");
5
- function createBatcher(fn, initialOptions = {}, selector = () => ({})) {
6
- const batcher$1 = new batcher.Batcher(fn, initialOptions);
7
- const state = solidStore.useStore(batcher$1.store, selector);
8
- return {
9
- ...batcher$1,
10
- state
11
- };
12
- }
13
- exports.createBatcher = createBatcher;
14
- //# sourceMappingURL=createBatcher.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createBatcher.cjs","sources":["../../../src/batcher/createBatcher.ts"],"sourcesContent":["import { Batcher } from '@tanstack/pacer/batcher'\nimport { useStore } from '@tanstack/solid-store'\nimport type { Store } from '@tanstack/solid-store'\nimport type { Accessor } from 'solid-js'\nimport type { BatcherOptions, BatcherState } from '@tanstack/pacer/batcher'\n\nexport interface SolidBatcher<TValue, TSelected = {}>\n extends Omit<Batcher<TValue>, 'store'> {\n /**\n * Reactive state that will be updated when the batcher state changes\n *\n * Use this instead of `batcher.store.state`\n */\n readonly state: Accessor<Readonly<TSelected>>\n /**\n * @deprecated Use `batcher.state` instead of `batcher.store.state` if you want to read reactive state.\n * The state on the store object is not reactive, as it has not been wrapped in a `useStore` hook internally.\n * Although, you can make the state reactive by using the `useStore` in your own usage.\n */\n readonly store: Store<Readonly<BatcherState<TValue>>>\n}\n\n/**\n * Creates a Solid-compatible Batcher instance for managing batches of items, exposing Solid signals for all stateful properties.\n *\n * Features:\n * - Batch processing of items using the provided `fn` function\n * - Configurable batch size and wait time\n * - Custom batch processing logic via getShouldExecute\n * - Event callbacks for monitoring batch operations\n * - All stateful properties (items, counts, etc.) are exposed as Solid signals for reactivity\n *\n * The batcher collects items and processes them in batches based on:\n * - Maximum batch size\n * - Time-based batching (process after X milliseconds)\n * - Custom batch processing logic via getShouldExecute\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. The `selector` parameter allows you\n * to specify which state changes will trigger a re-render, optimizing performance by preventing\n * unnecessary re-renders when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary re-renders and gives you\n * full control over when your component updates. Only when you provide a selector will the\n * component re-render when the selected state values change.\n *\n * Available state properties:\n * - `executionCount`: Number of batch executions that have been completed\n * - `isRunning`: Whether the batcher is currently running (not stopped)\n * - `items`: Array of items currently queued for batching\n * - `totalItemsProcessed`: Total number of individual items that have been processed across all batches\n *\n * Example usage:\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const batcher = createBatcher(\n * (items) => {\n * // Process batch of items\n * console.log('Processing batch:', items);\n * },\n * {\n * maxSize: 5,\n * wait: 2000,\n * onExecute: (batcher) => console.log('Batch executed'),\n * getShouldExecute: (items) => items.length >= 3\n * }\n * );\n *\n * // Opt-in to re-render when items or isRunning changes (optimized for UI updates)\n * const batcher = createBatcher(\n * (items) => console.log('Processing batch:', items),\n * { maxSize: 5, wait: 2000 },\n * (state) => ({ items: state.items, isRunning: state.isRunning })\n * );\n *\n * // Opt-in to re-render when execution metrics change (optimized for tracking progress)\n * const batcher = createBatcher(\n * (items) => console.log('Processing batch:', items),\n * { maxSize: 5, wait: 2000 },\n * (state) => ({\n * executionCount: state.executionCount,\n * totalItemsProcessed: state.totalItemsProcessed\n * })\n * );\n *\n * // Add items to batch\n * batcher.addItem('task1');\n * batcher.addItem('task2');\n *\n * // Control the batcher\n * batcher.stop(); // Pause processing\n * batcher.start(); // Resume processing\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { items, isRunning } = batcher.state();\n * ```\n */\nexport function createBatcher<TValue, TSelected = {}>(\n fn: (items: Array<TValue>) => void,\n initialOptions: BatcherOptions<TValue> = {},\n selector: (state: BatcherState<TValue>) => TSelected = () =>\n ({}) as TSelected,\n): SolidBatcher<TValue, TSelected> {\n const batcher = new Batcher(fn, initialOptions)\n\n const state = useStore(batcher.store, selector)\n return {\n ...batcher,\n state,\n } as SolidBatcher<TValue, TSelected>\n}\n"],"names":["batcher","Batcher","useStore"],"mappings":";;;;AAmGO,SAAS,cACd,IACA,iBAAyC,CAAA,GACzC,WAAuD,OACpD,CAAA,IAC8B;AACjC,QAAMA,YAAU,IAAIC,gBAAQ,IAAI,cAAc;AAE9C,QAAM,QAAQC,WAAAA,SAASF,UAAQ,OAAO,QAAQ;AAC9C,SAAO;AAAA,IACL,GAAGA;AAAAA,IACH;AAAA,EAAA;AAEJ;;"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const batcher = require("@tanstack/pacer/batcher");
4
- const createBatcher = require("./createBatcher.cjs");
5
- exports.createBatcher = createBatcher.createBatcher;
6
- Object.keys(batcher).forEach((k) => {
7
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
8
- enumerable: true,
9
- get: () => batcher[k]
10
- });
11
- });
12
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- export * from '@tanstack/pacer/batcher';
2
- export * from './createBatcher.cjs';
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const solidJs = require("solid-js");
4
- const createDebouncer = require("./createDebouncer.cjs");
5
- function createDebouncedSignal(value, initialOptions, selector) {
6
- const [debouncedValue, setDebouncedValue] = solidJs.createSignal(value);
7
- const debouncer = createDebouncer.createDebouncer(setDebouncedValue, initialOptions, selector);
8
- return [debouncedValue, debouncer.maybeExecute, debouncer];
9
- }
10
- exports.createDebouncedSignal = createDebouncedSignal;
11
- //# sourceMappingURL=createDebouncedSignal.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDebouncedSignal.cjs","sources":["../../../src/debouncer/createDebouncedSignal.ts"],"sourcesContent":["import { createSignal } from 'solid-js'\nimport { createDebouncer } from './createDebouncer'\nimport type { SolidDebouncer } from './createDebouncer'\nimport type { Accessor, Setter } from 'solid-js'\nimport type {\n DebouncerOptions,\n DebouncerState,\n} from '@tanstack/pacer/debouncer'\n\n/**\n * A Solid hook that creates a debounced state value, combining Solid's createSignal with debouncing functionality.\n * This hook provides both the current debounced value and methods to update it.\n *\n * The state value is only updated after the specified wait time has elapsed since the last update attempt.\n * If another update is attempted before the wait time expires, the timer resets and starts waiting again.\n * This is useful for handling frequent state updates that should be throttled, like search input values\n * or window resize dimensions.\n *\n * The hook returns a tuple containing:\n * - The current debounced value accessor\n * - A function to update the debounced value\n * - The debouncer instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management via the underlying debouncer instance.\n * The `selector` parameter allows you to specify which debouncer state changes will trigger reactive updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary reactive updates and gives you\n * full control over when your component subscribes to state changes. Only when you provide a selector will\n * the reactive system track the selected state values.\n *\n * Available debouncer state properties:\n * - `canLeadingExecute`: Whether the debouncer can execute on the leading edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const [searchTerm, setSearchTerm, debouncer] = createDebouncedSignal('', {\n * wait: 500 // Wait 500ms after last keystroke\n * });\n *\n * // Opt-in to reactive updates when pending state changes (optimized for loading indicators)\n * const [searchTerm, setSearchTerm, debouncer] = createDebouncedSignal(\n * '',\n * { wait: 500 },\n * (state) => ({ isPending: state.isPending })\n * );\n *\n * // Opt-in to reactive updates when execution count changes (optimized for tracking executions)\n * const [searchTerm, setSearchTerm, debouncer] = createDebouncedSignal(\n * '',\n * { wait: 500 },\n * (state) => ({ executionCount: state.executionCount })\n * );\n *\n * // Update value - will be debounced\n * const handleChange = (e) => {\n * setSearchTerm(e.target.value);\n * };\n *\n * // Access debouncer state via signals\n * console.log('Executions:', debouncer.state().executionCount);\n * console.log('Is pending:', debouncer.state().isPending);\n *\n * // In onExecute callback, use get* methods\n * const [searchTerm, setSearchTerm, debouncer] = createDebouncedSignal('', {\n * wait: 500,\n * onExecute: (debouncer) => {\n * console.log('Total executions:', debouncer.getExecutionCount());\n * }\n * });\n * ```\n */\nexport function createDebouncedSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: DebouncerOptions<Setter<TValue>>,\n selector?: (state: DebouncerState<Setter<TValue>>) => TSelected,\n): [\n Accessor<TValue>,\n Setter<TValue>,\n SolidDebouncer<Setter<TValue>, TSelected>,\n] {\n const [debouncedValue, setDebouncedValue] = createSignal<TValue>(value)\n\n const debouncer = createDebouncer(setDebouncedValue, initialOptions, selector)\n\n return [debouncedValue, debouncer.maybeExecute as Setter<TValue>, debouncer]\n}\n"],"names":["createSignal","createDebouncer"],"mappings":";;;;AAgFO,SAAS,sBACd,OACA,gBACA,UAKA;AACA,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,QAAAA,aAAqB,KAAK;AAEtE,QAAM,YAAYC,gBAAAA,gBAAgB,mBAAmB,gBAAgB,QAAQ;AAE7E,SAAO,CAAC,gBAAgB,UAAU,cAAgC,SAAS;AAC7E;;"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const solidJs = require("solid-js");
4
- const createDebouncedSignal = require("./createDebouncedSignal.cjs");
5
- function createDebouncedValue(value, initialOptions, selector) {
6
- const [debouncedValue, setDebouncedValue, debouncer] = createDebouncedSignal.createDebouncedSignal(
7
- value(),
8
- initialOptions,
9
- selector
10
- );
11
- solidJs.createEffect(() => {
12
- setDebouncedValue(value());
13
- });
14
- return [debouncedValue, debouncer];
15
- }
16
- exports.createDebouncedValue = createDebouncedValue;
17
- //# sourceMappingURL=createDebouncedValue.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDebouncedValue.cjs","sources":["../../../src/debouncer/createDebouncedValue.ts"],"sourcesContent":["import { createEffect } from 'solid-js'\nimport { createDebouncedSignal } from './createDebouncedSignal'\nimport type { SolidDebouncer } from './createDebouncer'\nimport type { Accessor, Setter } from 'solid-js'\nimport type {\n DebouncerOptions,\n DebouncerState,\n} from '@tanstack/pacer/debouncer'\n\n/**\n * A Solid hook that creates a debounced value that updates only after a specified delay.\n * Unlike createDebouncedSignal, this hook automatically tracks changes to the input value\n * and updates the debounced value accordingly.\n *\n * The debounced value will only update after the specified wait time has elapsed since\n * the last change to the input value. If the input value changes again before the wait\n * time expires, the timer resets and starts waiting again.\n *\n * This is useful for deriving debounced values from props or state that change frequently,\n * like search queries or form inputs, where you want to limit how often downstream effects\n * or calculations occur.\n *\n * The hook returns a tuple containing:\n * - An Accessor that provides the current debounced value\n * - The debouncer instance with control methods\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management via the underlying debouncer instance.\n * The `selector` parameter allows you to specify which debouncer state changes will trigger reactive updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary reactive updates and gives you\n * full control over when your component subscribes to state changes. Only when you provide a selector will\n * the reactive system track the selected state values.\n *\n * Available debouncer state properties:\n * - `canLeadingExecute`: Whether the debouncer can execute on the leading edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const [searchQuery, setSearchQuery] = createSignal('');\n * const [debouncedQuery, debouncer] = createDebouncedValue(searchQuery, {\n * wait: 500 // Wait 500ms after last change\n * });\n *\n * // Opt-in to reactive updates when pending state changes (optimized for loading indicators)\n * const [debouncedQuery, debouncer] = createDebouncedValue(\n * searchQuery,\n * { wait: 500 },\n * (state) => ({ isPending: state.isPending })\n * );\n *\n * // debouncedQuery will update 500ms after searchQuery stops changing\n * createEffect(() => {\n * fetchSearchResults(debouncedQuery());\n * });\n *\n * // Access debouncer state via signals\n * console.log('Is pending:', debouncer.state().isPending);\n *\n * // Control the debouncer\n * debouncer.cancel(); // Cancel any pending updates\n * ```\n */\nexport function createDebouncedValue<TValue, TSelected = {}>(\n value: Accessor<TValue>,\n initialOptions: DebouncerOptions<Setter<TValue>>,\n selector?: (state: DebouncerState<Setter<TValue>>) => TSelected,\n): [Accessor<TValue>, SolidDebouncer<Setter<TValue>, TSelected>] {\n const [debouncedValue, setDebouncedValue, debouncer] = createDebouncedSignal(\n value(),\n initialOptions,\n selector,\n )\n\n createEffect(() => {\n setDebouncedValue(value() as any)\n })\n\n return [debouncedValue, debouncer]\n}\n"],"names":["createDebouncedSignal","createEffect"],"mappings":";;;;AAuEO,SAAS,qBACd,OACA,gBACA,UAC+D;AAC/D,QAAM,CAAC,gBAAgB,mBAAmB,SAAS,IAAIA,sBAAAA;AAAAA,IACrD,MAAA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGFC,UAAAA,aAAa,MAAM;AACjB,sBAAkB,OAAc;AAAA,EAClC,CAAC;AAED,SAAO,CAAC,gBAAgB,SAAS;AACnC;;"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const debouncer = require("@tanstack/pacer/debouncer");
4
- const solidJs = require("solid-js");
5
- const solidStore = require("@tanstack/solid-store");
6
- function createDebouncer(fn, initialOptions, selector = () => ({})) {
7
- const asyncDebouncer = new debouncer.Debouncer(fn, initialOptions);
8
- const state = solidStore.useStore(asyncDebouncer.store, selector);
9
- solidJs.createEffect(() => {
10
- solidJs.onCleanup(() => {
11
- asyncDebouncer.cancel();
12
- });
13
- });
14
- return {
15
- ...asyncDebouncer,
16
- state
17
- };
18
- }
19
- exports.createDebouncer = createDebouncer;
20
- //# sourceMappingURL=createDebouncer.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDebouncer.cjs","sources":["../../../src/debouncer/createDebouncer.ts"],"sourcesContent":["import { Debouncer } from '@tanstack/pacer/debouncer'\nimport { createEffect, onCleanup } from 'solid-js'\nimport { useStore } from '@tanstack/solid-store'\nimport type { Store } from '@tanstack/solid-store'\nimport type { Accessor } from 'solid-js'\nimport type { AnyFunction } from '@tanstack/pacer/types'\nimport type {\n DebouncerOptions,\n DebouncerState,\n} from '@tanstack/pacer/debouncer'\n\nexport interface SolidDebouncer<TFn extends AnyFunction, TSelected = {}>\n extends Omit<Debouncer<TFn>, 'store'> {\n /**\n * Reactive state that will be updated when the debouncer state changes\n *\n * Use this instead of `debouncer.store.state`\n */\n readonly state: Accessor<Readonly<TSelected>>\n /**\n * @deprecated Use `debouncer.state` instead of `debouncer.store.state` if you want to read reactive state.\n * The state on the store object is not reactive, as it has not been wrapped in a `useStore` hook internally.\n * Although, you can make the state reactive by using the `useStore` in your own usage.\n */\n readonly store: Store<Readonly<DebouncerState<TFn>>>\n}\n\n/**\n * A Solid hook that creates and manages a Debouncer instance.\n *\n * This is a lower-level hook that provides direct access to the Debouncer's functionality without\n * any built-in state management. This allows you to integrate it with any state management solution\n * you prefer (createSignal, Redux, Zustand, etc.).\n *\n * This hook provides debouncing functionality to limit how often a function can be called,\n * waiting for a specified delay before executing the latest call. This is useful for handling\n * frequent events like window resizing, scroll events, or real-time search inputs.\n *\n * The debouncer will only execute the function after the specified wait time has elapsed\n * since the last call. If the function is called again before the wait time expires, the\n * timer resets and starts waiting again.\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. The `selector` parameter allows you\n * to specify which state changes will trigger a re-render, optimizing performance by preventing\n * unnecessary re-renders when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary re-renders and gives you\n * full control over when your component updates. Only when you provide a selector will the\n * component re-render when the selected state values change.\n *\n * Available state properties:\n * - `canLeadingExecute`: Whether the debouncer can execute on the leading edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const debouncer = createDebouncer(\n * (query: string) => fetchSearchResults(query),\n * { wait: 500 }\n * );\n *\n * // Opt-in to re-render when isPending changes (optimized for loading states)\n * const debouncer = createDebouncer(\n * (query: string) => fetchSearchResults(query),\n * { wait: 500 },\n * (state) => ({ isPending: state.isPending })\n * );\n *\n * // Opt-in to re-render when executionCount changes (optimized for tracking execution)\n * const debouncer = createDebouncer(\n * (query: string) => fetchSearchResults(query),\n * { wait: 500 },\n * (state) => ({ executionCount: state.executionCount })\n * );\n *\n * // Multiple state properties - re-render when any of these change\n * const debouncer = createDebouncer(\n * (query: string) => fetchSearchResults(query),\n * { wait: 500 },\n * (state) => ({\n * isPending: state.isPending,\n * executionCount: state.executionCount,\n * status: state.status\n * })\n * );\n *\n * // In an event handler\n * const handleChange = (e) => {\n * debouncer.maybeExecute(e.target.value);\n * };\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { isPending } = debouncer.state();\n * ```\n */\nexport function createDebouncer<TFn extends AnyFunction, TSelected = {}>(\n fn: TFn,\n initialOptions: DebouncerOptions<TFn>,\n selector: (state: DebouncerState<TFn>) => TSelected = () => ({}) as TSelected,\n): SolidDebouncer<TFn, TSelected> {\n const asyncDebouncer = new Debouncer<TFn>(fn, initialOptions)\n\n const state = useStore(asyncDebouncer.store, selector)\n\n createEffect(() => {\n onCleanup(() => {\n asyncDebouncer.cancel()\n })\n })\n\n return {\n ...asyncDebouncer,\n state,\n } as SolidDebouncer<TFn, TSelected> // omit `store` in favor of `state`\n}\n"],"names":["Debouncer","useStore","createEffect","onCleanup"],"mappings":";;;;;AAsGO,SAAS,gBACd,IACA,gBACA,WAAsD,OAAO,CAAA,IAC7B;AAChC,QAAM,iBAAiB,IAAIA,oBAAe,IAAI,cAAc;AAE5D,QAAM,QAAQC,WAAAA,SAAS,eAAe,OAAO,QAAQ;AAErDC,UAAAA,aAAa,MAAM;AACjBC,YAAAA,UAAU,MAAM;AACd,qBAAe,OAAA;AAAA,IACjB,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EAAA;AAEJ;;"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const debouncer = require("@tanstack/pacer/debouncer");
4
- const createDebouncedSignal = require("./createDebouncedSignal.cjs");
5
- const createDebouncedValue = require("./createDebouncedValue.cjs");
6
- const createDebouncer = require("./createDebouncer.cjs");
7
- exports.createDebouncedSignal = createDebouncedSignal.createDebouncedSignal;
8
- exports.createDebouncedValue = createDebouncedValue.createDebouncedValue;
9
- exports.createDebouncer = createDebouncer.createDebouncer;
10
- Object.keys(debouncer).forEach((k) => {
11
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
12
- enumerable: true,
13
- get: () => debouncer[k]
14
- });
15
- });
16
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
@@ -1,4 +0,0 @@
1
- export * from '@tanstack/pacer/debouncer';
2
- export * from './createDebouncedSignal.cjs';
3
- export * from './createDebouncedValue.cjs';
4
- export * from './createDebouncer.cjs';
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const pacer = require("@tanstack/pacer");
4
- const createAsyncBatcher = require("./async-batcher/createAsyncBatcher.cjs");
5
- const createAsyncDebouncer = require("./async-debouncer/createAsyncDebouncer.cjs");
6
- const createAsyncQueuer = require("./async-queuer/createAsyncQueuer.cjs");
7
- const createAsyncRateLimiter = require("./async-rate-limiter/createAsyncRateLimiter.cjs");
8
- const createAsyncThrottler = require("./async-throttler/createAsyncThrottler.cjs");
9
- const createBatcher = require("./batcher/createBatcher.cjs");
10
- const createDebouncedSignal = require("./debouncer/createDebouncedSignal.cjs");
11
- const createDebouncedValue = require("./debouncer/createDebouncedValue.cjs");
12
- const createDebouncer = require("./debouncer/createDebouncer.cjs");
13
- const createQueuer = require("./queuer/createQueuer.cjs");
14
- const createRateLimiter = require("./rate-limiter/createRateLimiter.cjs");
15
- const createRateLimitedSignal = require("./rate-limiter/createRateLimitedSignal.cjs");
16
- const createRateLimitedValue = require("./rate-limiter/createRateLimitedValue.cjs");
17
- const createThrottledSignal = require("./throttler/createThrottledSignal.cjs");
18
- const createThrottledValue = require("./throttler/createThrottledValue.cjs");
19
- const createThrottler = require("./throttler/createThrottler.cjs");
20
- exports.createAsyncBatcher = createAsyncBatcher.createAsyncBatcher;
21
- exports.createAsyncDebouncer = createAsyncDebouncer.createAsyncDebouncer;
22
- exports.createAsyncQueuer = createAsyncQueuer.createAsyncQueuer;
23
- exports.createAsyncRateLimiter = createAsyncRateLimiter.createAsyncRateLimiter;
24
- exports.createAsyncThrottler = createAsyncThrottler.createAsyncThrottler;
25
- exports.createBatcher = createBatcher.createBatcher;
26
- exports.createDebouncedSignal = createDebouncedSignal.createDebouncedSignal;
27
- exports.createDebouncedValue = createDebouncedValue.createDebouncedValue;
28
- exports.createDebouncer = createDebouncer.createDebouncer;
29
- exports.createQueuer = createQueuer.createQueuer;
30
- exports.createRateLimiter = createRateLimiter.createRateLimiter;
31
- exports.createRateLimitedSignal = createRateLimitedSignal.createRateLimitedSignal;
32
- exports.createRateLimitedValue = createRateLimitedValue.createRateLimitedValue;
33
- exports.createThrottledSignal = createThrottledSignal.createThrottledSignal;
34
- exports.createThrottledValue = createThrottledValue.createThrottledValue;
35
- exports.createThrottler = createThrottler.createThrottler;
36
- Object.keys(pacer).forEach((k) => {
37
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
38
- enumerable: true,
39
- get: () => pacer[k]
40
- });
41
- });
42
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,20 +0,0 @@
1
- export * from '@tanstack/pacer';
2
- /**
3
- * Export every hook individually - DON'T export from barrel files
4
- */
5
- export * from './async-batcher/createAsyncBatcher.cjs';
6
- export * from './async-debouncer/createAsyncDebouncer.cjs';
7
- export * from './async-queuer/createAsyncQueuer.cjs';
8
- export * from './async-rate-limiter/createAsyncRateLimiter.cjs';
9
- export * from './async-throttler/createAsyncThrottler.cjs';
10
- export * from './batcher/createBatcher.cjs';
11
- export * from './debouncer/createDebouncedSignal.cjs';
12
- export * from './debouncer/createDebouncedValue.cjs';
13
- export * from './debouncer/createDebouncer.cjs';
14
- export * from './queuer/createQueuer.cjs';
15
- export * from './rate-limiter/createRateLimiter.cjs';
16
- export * from './rate-limiter/createRateLimitedSignal.cjs';
17
- export * from './rate-limiter/createRateLimitedValue.cjs';
18
- export * from './throttler/createThrottledSignal.cjs';
19
- export * from './throttler/createThrottledValue.cjs';
20
- export * from './throttler/createThrottler.cjs';
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const queuer = require("@tanstack/pacer/queuer");
4
- const solidStore = require("@tanstack/solid-store");
5
- function createQueuer(fn, initialOptions = {}, selector = () => ({})) {
6
- const queuer$1 = new queuer.Queuer(fn, initialOptions);
7
- const state = solidStore.useStore(queuer$1.store, selector);
8
- return {
9
- ...queuer$1,
10
- state
11
- };
12
- }
13
- exports.createQueuer = createQueuer;
14
- //# sourceMappingURL=createQueuer.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createQueuer.cjs","sources":["../../../src/queuer/createQueuer.ts"],"sourcesContent":["import { Queuer } from '@tanstack/pacer/queuer'\nimport { useStore } from '@tanstack/solid-store'\nimport type { Store } from '@tanstack/solid-store'\nimport type { Accessor } from 'solid-js'\nimport type { QueuerOptions, QueuerState } from '@tanstack/pacer/queuer'\n\nexport interface SolidQueuer<TValue, TSelected = {}>\n extends Omit<Queuer<TValue>, 'store'> {\n /**\n * Reactive state that will be updated when the queuer state changes\n *\n * Use this instead of `queuer.store.state`\n */\n readonly state: Accessor<Readonly<TSelected>>\n /**\n * @deprecated Use `queuer.state` instead of `queuer.store.state` if you want to read reactive state.\n * The state on the store object is not reactive, as it has not been wrapped in a `useStore` hook internally.\n * Although, you can make the state reactive by using the `useStore` in your own usage.\n */\n readonly store: Store<Readonly<QueuerState<TValue>>>\n}\n\n/**\n * Creates a Solid-compatible Queuer instance for managing a synchronous queue of items, exposing Solid signals for all stateful properties.\n *\n * Features:\n * - Synchronous processing of items using the provided `fn` function\n * - FIFO (First In First Out) or LIFO (Last In First Out) queue behavior\n * - Priority queueing via `getPriority` or item `priority` property\n * - Item expiration and removal of stale items\n * - Configurable wait time between processing items\n * - Pause/resume processing\n * - Callbacks for queue state changes, execution, rejection, and expiration\n * - All stateful properties (items, counts, etc.) are exposed as Solid signals for reactivity\n *\n * The queue processes items synchronously in order, with optional delays between each item. When started, it will process one item per tick, with an optional wait time between ticks. You can pause and resume processing with `stop()` and `start()`.\n *\n * By default, the queue uses FIFO behavior, but you can configure LIFO or double-ended queueing by specifying the position when adding or removing items.\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. The `selector` parameter allows you\n * to specify which state changes will trigger a re-render, optimizing performance by preventing\n * unnecessary re-renders when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary re-renders and gives you\n * full control over when your component updates. Only when you provide a selector will the\n * component re-render when the selected state values change.\n *\n * Available state properties:\n * - `executionCount`: Number of items that have been processed\n * - `isRunning`: Whether the queuer is currently running (not stopped)\n * - `items`: Array of items currently queued for processing\n * - `rejectionCount`: Number of items that were rejected (expired or failed validation)\n *\n * Example usage:\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const queue = createQueuer(\n * (item) => {\n * // process item synchronously\n * console.log('Processing', item);\n * },\n * {\n * started: true, // Start processing immediately\n * wait: 1000, // Process one item every second\n * getPriority: (item) => item.priority // Process higher priority items first\n * }\n * );\n *\n * // Opt-in to re-render when items or isRunning changes (optimized for UI updates)\n * const queue = createQueuer(\n * (item) => console.log('Processing', item),\n * { started: true, wait: 1000 },\n * (state) => ({ items: state.items, isRunning: state.isRunning })\n * );\n *\n * // Opt-in to re-render when execution metrics change (optimized for tracking progress)\n * const queue = createQueuer(\n * (item) => console.log('Processing', item),\n * { started: true, wait: 1000 },\n * (state) => ({\n * executionCount: state.executionCount,\n * rejectionCount: state.rejectionCount\n * })\n * );\n *\n * // Add items to process - they'll be handled automatically\n * queue.addItem('task1');\n * queue.addItem('task2');\n *\n * // Control the scheduler\n * queue.stop(); // Pause processing\n * queue.start(); // Resume processing\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { items, isRunning } = queue.state();\n * ```\n */\nexport function createQueuer<TValue, TSelected = {}>(\n fn: (item: TValue) => void,\n initialOptions: QueuerOptions<TValue> = {},\n selector: (state: QueuerState<TValue>) => TSelected = () => ({}) as TSelected,\n): SolidQueuer<TValue, TSelected> {\n const queuer = new Queuer(fn, initialOptions)\n\n const state = useStore(queuer.store, selector)\n\n return {\n ...queuer,\n state,\n } as SolidQueuer<TValue, TSelected> // omit `store` in favor of `state`\n}\n"],"names":["queuer","Queuer","useStore"],"mappings":";;;;AAoGO,SAAS,aACd,IACA,iBAAwC,CAAA,GACxC,WAAsD,OAAO,CAAA,IAC7B;AAChC,QAAMA,WAAS,IAAIC,cAAO,IAAI,cAAc;AAE5C,QAAM,QAAQC,WAAAA,SAASF,SAAO,OAAO,QAAQ;AAE7C,SAAO;AAAA,IACL,GAAGA;AAAAA,IACH;AAAA,EAAA;AAEJ;;"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const queuer = require("@tanstack/pacer/queuer");
4
- const createQueuer = require("./createQueuer.cjs");
5
- exports.createQueuer = createQueuer.createQueuer;
6
- Object.keys(queuer).forEach((k) => {
7
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
8
- enumerable: true,
9
- get: () => queuer[k]
10
- });
11
- });
12
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- export * from '@tanstack/pacer/queuer';
2
- export * from './createQueuer.cjs';
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const solidJs = require("solid-js");
4
- const createRateLimiter = require("./createRateLimiter.cjs");
5
- function createRateLimitedSignal(value, initialOptions, selector) {
6
- const [rateLimitedValue, setRateLimitedValue] = solidJs.createSignal(value);
7
- const rateLimiter = createRateLimiter.createRateLimiter(
8
- setRateLimitedValue,
9
- initialOptions,
10
- selector
11
- );
12
- return [
13
- rateLimitedValue,
14
- rateLimiter.maybeExecute,
15
- rateLimiter
16
- ];
17
- }
18
- exports.createRateLimitedSignal = createRateLimitedSignal;
19
- //# sourceMappingURL=createRateLimitedSignal.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createRateLimitedSignal.cjs","sources":["../../../src/rate-limiter/createRateLimitedSignal.ts"],"sourcesContent":["import { createSignal } from 'solid-js'\nimport { createRateLimiter } from './createRateLimiter'\nimport type { SolidRateLimiter } from './createRateLimiter'\nimport type { Accessor, Setter } from 'solid-js'\nimport type {\n RateLimiterOptions,\n RateLimiterState,\n} from '@tanstack/pacer/rate-limiter'\n\n/**\n * A Solid hook that creates a rate-limited state value that enforces a hard limit on state updates within a time window.\n * This hook combines Solid's createSignal with rate limiting functionality to provide controlled state updates.\n *\n * Rate limiting is a simple \"hard limit\" approach - it allows all updates until the limit is reached, then blocks\n * subsequent updates until the window resets. Unlike throttling or debouncing, it does not attempt to space out\n * or intelligently collapse updates. This can lead to bursts of rapid updates followed by periods of no updates.\n *\n * The rate limiter supports two types of windows:\n * - 'fixed': A strict window that resets after the window period. All updates within the window count\n * towards the limit, and the window resets completely after the period.\n * - 'sliding': A rolling window that allows updates as old ones expire. This provides a more\n * consistent rate of updates over time.\n *\n * For smoother update patterns, consider:\n * - createThrottledSignal: When you want consistent spacing between updates (e.g. UI changes)\n * - createDebouncedSignal: When you want to collapse rapid updates into a single update (e.g. search input)\n *\n * Rate limiting should primarily be used when you need to enforce strict limits, like API rate limits.\n *\n * The hook returns a tuple containing:\n * - The rate-limited state value accessor\n * - A rate-limited setter function that respects the configured limits\n * - The rateLimiter instance for additional control\n *\n * For more direct control over rate limiting without state management,\n * consider using the lower-level createRateLimiter hook instead.\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management via the underlying rate limiter instance.\n * The `selector` parameter allows you to specify which rate limiter state changes will trigger reactive updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary reactive updates and gives you\n * full control over when your component subscribes to state changes. Only when you provide a selector will\n * the reactive system track the selected state values.\n *\n * Available rate limiter state properties:\n * - `callsInWindow`: Number of calls made in the current window\n * - `remainingInWindow`: Number of calls remaining in the current window\n * - `windowStart`: Unix timestamp when the current window started\n * - `nextWindowStart`: Unix timestamp when the next window will start\n * - `msUntilNextWindow`: Milliseconds until the next window starts\n * - `isAtLimit`: Whether the call limit for the current window has been reached\n * - `status`: Current status ('disabled' | 'idle' | 'at-limit')\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const [value, setValue, rateLimiter] = createRateLimitedSignal(0, {\n * limit: 5,\n * window: 60000,\n * windowType: 'sliding'\n * });\n *\n * // Opt-in to reactive updates when limit state changes (optimized for UI feedback)\n * const [value, setValue, rateLimiter] = createRateLimitedSignal(\n * 0,\n * { limit: 5, window: 60000 },\n * (state) => ({ isAtLimit: state.isAtLimit, remainingInWindow: state.remainingInWindow })\n * );\n *\n * // With rejection callback and fixed window\n * const [value, setValue] = createRateLimitedSignal(0, {\n * limit: 3,\n * window: 5000,\n * windowType: 'fixed',\n * onReject: (rateLimiter) => {\n * alert(`Rate limit reached. Try again in ${rateLimiter.getMsUntilNextWindow()}ms`);\n * }\n * });\n *\n * // Access rateLimiter state via signals\n * const handleSubmit = () => {\n * const remaining = rateLimiter.state().remainingInWindow;\n * if (remaining > 0) {\n * setValue(newValue);\n * } else {\n * showRateLimitWarning();\n * }\n * };\n * ```\n */\nexport function createRateLimitedSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: RateLimiterOptions<Setter<TValue>>,\n selector?: (state: RateLimiterState) => TSelected,\n): [\n Accessor<TValue>,\n Setter<TValue>,\n SolidRateLimiter<Setter<TValue>, TSelected>,\n] {\n const [rateLimitedValue, setRateLimitedValue] = createSignal<TValue>(value)\n\n const rateLimiter = createRateLimiter(\n setRateLimitedValue,\n initialOptions,\n selector,\n )\n\n return [\n rateLimitedValue,\n rateLimiter.maybeExecute as Setter<TValue>,\n rateLimiter,\n ]\n}\n"],"names":["createSignal","createRateLimiter"],"mappings":";;;;AA8FO,SAAS,wBACd,OACA,gBACA,UAKA;AACA,QAAM,CAAC,kBAAkB,mBAAmB,IAAIA,QAAAA,aAAqB,KAAK;AAE1E,QAAM,cAAcC,kBAAAA;AAAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGF,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EAAA;AAEJ;;"}