@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
@@ -0,0 +1,25 @@
1
+ import { createComponent } from "solid-js/web";
2
+ import { createContext, useContext } from "solid-js";
3
+
4
+ //#region src/provider/PacerProvider.tsx
5
+ const PacerContext = createContext(null);
6
+ const DEFAULT_OPTIONS = {};
7
+ function PacerProvider(props) {
8
+ const contextValue = { defaultOptions: props.defaultOptions ?? DEFAULT_OPTIONS };
9
+ return createComponent(PacerContext.Provider, {
10
+ value: contextValue,
11
+ get children() {
12
+ return props.children;
13
+ }
14
+ });
15
+ }
16
+ function usePacerContext() {
17
+ return useContext(PacerContext);
18
+ }
19
+ function useDefaultPacerOptions() {
20
+ return useContext(PacerContext)?.defaultOptions ?? {};
21
+ }
22
+
23
+ //#endregion
24
+ export { PacerProvider, useDefaultPacerOptions, usePacerContext };
25
+ //# sourceMappingURL=PacerProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PacerProvider.js","names":["createContext","useContext","JSX","AnyAsyncFunction","AnyFunction","AsyncBatcherOptions","AsyncDebouncerOptions","AsyncQueuerOptions","AsyncRateLimiterOptions","AsyncThrottlerOptions","BatcherOptions","DebouncerOptions","QueuerOptions","RateLimiterOptions","ThrottlerOptions","PacerProviderOptions","asyncBatcher","Partial","asyncDebouncer","asyncQueuer","asyncRateLimiter","asyncThrottler","batcher","debouncer","queuer","rateLimiter","throttler","PacerContextValue","defaultOptions","PacerContext","PacerProviderProps","children","Element","DEFAULT_OPTIONS","PacerProvider","props","contextValue","_$createComponent","Provider","value","usePacerContext","useDefaultPacerOptions","context"],"sources":["../../src/provider/PacerProvider.tsx"],"sourcesContent":["import { createContext, useContext } from 'solid-js'\nimport type { JSX } from 'solid-js'\nimport type {\n AnyAsyncFunction,\n AnyFunction,\n AsyncBatcherOptions,\n AsyncDebouncerOptions,\n AsyncQueuerOptions,\n AsyncRateLimiterOptions,\n AsyncThrottlerOptions,\n BatcherOptions,\n DebouncerOptions,\n QueuerOptions,\n RateLimiterOptions,\n ThrottlerOptions,\n} from '@tanstack/pacer'\n\nexport interface PacerProviderOptions {\n asyncBatcher?: Partial<AsyncBatcherOptions<any>>\n asyncDebouncer?: Partial<AsyncDebouncerOptions<AnyAsyncFunction>>\n asyncQueuer?: Partial<AsyncQueuerOptions<any>>\n asyncRateLimiter?: Partial<AsyncRateLimiterOptions<AnyAsyncFunction>>\n asyncThrottler?: Partial<AsyncThrottlerOptions<AnyAsyncFunction>>\n batcher?: Partial<BatcherOptions<any>>\n debouncer?: Partial<DebouncerOptions<AnyFunction>>\n queuer?: Partial<QueuerOptions<any>>\n rateLimiter?: Partial<RateLimiterOptions<AnyFunction>>\n throttler?: Partial<ThrottlerOptions<AnyFunction>>\n}\n\ninterface PacerContextValue {\n defaultOptions: PacerProviderOptions\n}\n\nconst PacerContext = createContext<PacerContextValue | null>(null)\n\nexport interface PacerProviderProps {\n children: JSX.Element\n defaultOptions?: PacerProviderOptions\n}\n\nconst DEFAULT_OPTIONS: PacerProviderOptions = {}\n\nexport function PacerProvider(props: PacerProviderProps) {\n const contextValue: PacerContextValue = {\n defaultOptions: props.defaultOptions ?? DEFAULT_OPTIONS,\n }\n\n return (\n <PacerContext.Provider value={contextValue}>\n {props.children}\n </PacerContext.Provider>\n )\n}\n\nexport function usePacerContext() {\n return useContext(PacerContext)\n}\n\nexport function useDefaultPacerOptions() {\n const context = useContext(PacerContext)\n return context?.defaultOptions ?? {}\n}\n"],"mappings":";;;;AAkCA,MAAM6B,eAAe7B,cAAwC,KAAK;AAOlE,MAAMiC,kBAAwC,EAAE;AAEhD,SAAgBC,cAAcC,OAA2B;CACvD,MAAMC,eAAkC,EACtCR,gBAAgBO,MAAMP,kBAAkBK,iBACzC;AAED,QAAAI,gBACGR,aAAaS,UAAQ;EAACC,OAAOH;EAAY,IAAAL,WAAA;AAAA,UACvCI,MAAMJ;;EAAQ,CAAA;;AAKrB,SAAgBS,kBAAkB;AAChC,QAAOvC,WAAW4B,aAAa;;AAGjC,SAAgBY,yBAAyB;AAEvC,QADgBxC,WAAW4B,aAAa,EACxBD,kBAAkB,EAAE"}
@@ -0,0 +1,5 @@
1
+ const require_PacerProvider = require('./PacerProvider.cjs');
2
+
3
+ exports.PacerProvider = require_PacerProvider.PacerProvider;
4
+ exports.useDefaultPacerOptions = require_PacerProvider.useDefaultPacerOptions;
5
+ exports.usePacerContext = require_PacerProvider.usePacerContext;
@@ -0,0 +1,2 @@
1
+ import { PacerProvider, PacerProviderOptions, PacerProviderProps, useDefaultPacerOptions, usePacerContext } from "./PacerProvider.cjs";
2
+ export { PacerProvider, PacerProviderOptions, PacerProviderProps, useDefaultPacerOptions, usePacerContext };
@@ -0,0 +1,2 @@
1
+ import { PacerProvider, PacerProviderOptions, PacerProviderProps, useDefaultPacerOptions, usePacerContext } from "./PacerProvider.js";
2
+ export { PacerProvider, PacerProviderOptions, PacerProviderProps, useDefaultPacerOptions, usePacerContext };
@@ -0,0 +1,3 @@
1
+ import { PacerProvider, useDefaultPacerOptions, usePacerContext } from "./PacerProvider.js";
2
+
3
+ export { PacerProvider, useDefaultPacerOptions, usePacerContext };
@@ -0,0 +1,129 @@
1
+ const require_createQueuer = require('./createQueuer.cjs');
2
+
3
+ //#region src/queuer/createQueuedSignal.ts
4
+ /**
5
+ * A Solid primitive that creates a queuer with managed state, combining Solid's signals with queuing functionality.
6
+ * This primitive provides both the current queue state and queue control methods.
7
+ *
8
+ * The queue state is automatically updated whenever items are added, removed, or reordered in the queue.
9
+ * All queue operations are reflected in the state array returned by the primitive.
10
+ *
11
+ * The queue can be started and stopped to automatically process items at a specified interval,
12
+ * making it useful as a scheduler. When started, it will process one item per tick, with an
13
+ * optional wait time between ticks.
14
+ *
15
+ * The primitive returns a tuple containing:
16
+ * - The current queue state as an array
17
+ * - The queue instance with methods for queue manipulation
18
+ *
19
+ * ## State Management and Selector
20
+ *
21
+ * The primitive uses Solid's reactive state management via the underlying queuer instance.
22
+ * The `selector` parameter allows you to specify which queuer state changes will trigger a re-render,
23
+ * optimizing performance by preventing unnecessary re-renders when irrelevant state changes occur.
24
+ *
25
+ * **By default, there will be no reactive state subscriptions** and you must opt-in to state
26
+ * tracking by providing a selector function. This prevents unnecessary re-renders and gives you
27
+ * full control over when your component updates. Only when you provide a selector will the
28
+ * component re-render when the selected state values change.
29
+ *
30
+ * Available queuer state properties:
31
+ * - `executionCount`: Number of items that have been processed by the queuer
32
+ * - `expirationCount`: Number of items that have been removed due to expiration
33
+ * - `isEmpty`: Whether the queuer has no items to process
34
+ * - `isFull`: Whether the queuer has reached its maximum capacity
35
+ * - `isIdle`: Whether the queuer is not currently processing any items
36
+ * - `isRunning`: Whether the queuer is active and will process items automatically
37
+ * - `items`: Array of items currently waiting to be processed
38
+ * - `itemTimestamps`: Timestamps when items were added for expiration tracking
39
+ * - `pendingTick`: Whether the queuer has a pending timeout for processing the next item
40
+ * - `rejectionCount`: Number of items that have been rejected from being added
41
+ * - `size`: Number of items currently in the queue
42
+ * - `status`: Current processing status ('idle' | 'running' | 'stopped')
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * // Default behavior - no reactive state subscriptions
47
+ * const [items, addItem, queue] = createQueuedSignal(
48
+ * (item) => console.log('Processing:', item),
49
+ * {
50
+ * initialItems: ['item1', 'item2'],
51
+ * started: true,
52
+ * wait: 1000,
53
+ * getPriority: (item) => item.priority
54
+ * }
55
+ * );
56
+ *
57
+ * // Opt-in to re-render when queue contents change (optimized for displaying queue items)
58
+ * const [items, addItem, queue] = createQueuedSignal(
59
+ * (item) => console.log('Processing:', item),
60
+ * { started: true, wait: 1000 },
61
+ * (state) => ({
62
+ * items: state.items,
63
+ * size: state.size,
64
+ * isEmpty: state.isEmpty
65
+ * })
66
+ * );
67
+ *
68
+ * // Opt-in to re-render when processing state changes (optimized for loading indicators)
69
+ * const [items, addItem, queue] = createQueuedSignal(
70
+ * (item) => console.log('Processing:', item),
71
+ * { started: true, wait: 1000 },
72
+ * (state) => ({
73
+ * isRunning: state.isRunning,
74
+ * isIdle: state.isIdle,
75
+ * status: state.status,
76
+ * pendingTick: state.pendingTick
77
+ * })
78
+ * );
79
+ *
80
+ * // Opt-in to re-render when execution metrics change (optimized for stats display)
81
+ * const [items, addItem, queue] = createQueuedSignal(
82
+ * (item) => console.log('Processing:', item),
83
+ * { started: true, wait: 1000 },
84
+ * (state) => ({
85
+ * executionCount: state.executionCount,
86
+ * expirationCount: state.expirationCount,
87
+ * rejectionCount: state.rejectionCount
88
+ * })
89
+ * );
90
+ *
91
+ * // Add items to queue
92
+ * const handleAdd = (item) => {
93
+ * addItem(item);
94
+ * };
95
+ *
96
+ * // Start automatic processing
97
+ * const startProcessing = () => {
98
+ * queue.start();
99
+ * };
100
+ *
101
+ * // Stop automatic processing
102
+ * const stopProcessing = () => {
103
+ * queue.stop();
104
+ * };
105
+ *
106
+ * // Manual processing still available
107
+ * const handleProcess = () => {
108
+ * const nextItem = queue.getNextItem();
109
+ * if (nextItem) {
110
+ * processItem(nextItem);
111
+ * }
112
+ * };
113
+ *
114
+ * // Access the selected queuer state (will be empty object {} unless selector provided)
115
+ * const { size, isRunning, executionCount } = queue.state;
116
+ * ```
117
+ */
118
+ function createQueuedSignal(fn, options = {}, selector = (state) => ({ items: state.items })) {
119
+ const queue = require_createQueuer.createQueuer(fn, options, selector);
120
+ return [
121
+ () => queue.state().items,
122
+ queue.addItem,
123
+ queue
124
+ ];
125
+ }
126
+
127
+ //#endregion
128
+ exports.createQueuedSignal = createQueuedSignal;
129
+ //# sourceMappingURL=createQueuedSignal.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQueuedSignal.cjs","names":["createQueuer"],"sources":["../../src/queuer/createQueuedSignal.ts"],"sourcesContent":["import { createQueuer } from './createQueuer'\nimport type { SolidQueuer } from './createQueuer'\nimport type { QueuerOptions, QueuerState } from '@tanstack/pacer/queuer'\n\n/**\n * A Solid primitive that creates a queuer with managed state, combining Solid's signals with queuing functionality.\n * This primitive provides both the current queue state and queue control methods.\n *\n * The queue state is automatically updated whenever items are added, removed, or reordered in the queue.\n * All queue operations are reflected in the state array returned by the primitive.\n *\n * The queue can be started and stopped to automatically process items at a specified interval,\n * making it useful as a scheduler. When started, it will process one item per tick, with an\n * optional wait time between ticks.\n *\n * The primitive returns a tuple containing:\n * - The current queue state as an array\n * - The queue instance with methods for queue manipulation\n *\n * ## State Management and Selector\n *\n * The primitive uses Solid's reactive state management via the underlying queuer instance.\n * The `selector` parameter allows you to specify which queuer state changes will trigger a re-render,\n * optimizing performance by preventing 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 queuer state properties:\n * - `executionCount`: Number of items that have been processed by the queuer\n * - `expirationCount`: Number of items that have been removed due to expiration\n * - `isEmpty`: Whether the queuer has no items to process\n * - `isFull`: Whether the queuer has reached its maximum capacity\n * - `isIdle`: Whether the queuer is not currently processing any items\n * - `isRunning`: Whether the queuer is active and will process items automatically\n * - `items`: Array of items currently waiting to be processed\n * - `itemTimestamps`: Timestamps when items were added for expiration tracking\n * - `pendingTick`: Whether the queuer has a pending timeout for processing the next item\n * - `rejectionCount`: Number of items that have been rejected from being added\n * - `size`: Number of items currently in the queue\n * - `status`: Current processing status ('idle' | 'running' | 'stopped')\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const [items, addItem, queue] = createQueuedSignal(\n * (item) => console.log('Processing:', item),\n * {\n * initialItems: ['item1', 'item2'],\n * started: true,\n * wait: 1000,\n * getPriority: (item) => item.priority\n * }\n * );\n *\n * // Opt-in to re-render when queue contents change (optimized for displaying queue items)\n * const [items, addItem, queue] = createQueuedSignal(\n * (item) => console.log('Processing:', item),\n * { started: true, wait: 1000 },\n * (state) => ({\n * items: state.items,\n * size: state.size,\n * isEmpty: state.isEmpty\n * })\n * );\n *\n * // Opt-in to re-render when processing state changes (optimized for loading indicators)\n * const [items, addItem, queue] = createQueuedSignal(\n * (item) => console.log('Processing:', item),\n * { started: true, wait: 1000 },\n * (state) => ({\n * isRunning: state.isRunning,\n * isIdle: state.isIdle,\n * status: state.status,\n * pendingTick: state.pendingTick\n * })\n * );\n *\n * // Opt-in to re-render when execution metrics change (optimized for stats display)\n * const [items, addItem, queue] = createQueuedSignal(\n * (item) => console.log('Processing:', item),\n * { started: true, wait: 1000 },\n * (state) => ({\n * executionCount: state.executionCount,\n * expirationCount: state.expirationCount,\n * rejectionCount: state.rejectionCount\n * })\n * );\n *\n * // Add items to queue\n * const handleAdd = (item) => {\n * addItem(item);\n * };\n *\n * // Start automatic processing\n * const startProcessing = () => {\n * queue.start();\n * };\n *\n * // Stop automatic processing\n * const stopProcessing = () => {\n * queue.stop();\n * };\n *\n * // Manual processing still available\n * const handleProcess = () => {\n * const nextItem = queue.getNextItem();\n * if (nextItem) {\n * processItem(nextItem);\n * }\n * };\n *\n * // Access the selected queuer state (will be empty object {} unless selector provided)\n * const { size, isRunning, executionCount } = queue.state;\n * ```\n */\nexport function createQueuedSignal<\n TValue,\n TSelected extends Pick<QueuerState<TValue>, 'items'> = Pick<\n QueuerState<TValue>,\n 'items'\n >,\n>(\n fn: (item: TValue) => void,\n options: QueuerOptions<TValue> = {},\n selector: (state: QueuerState<TValue>) => TSelected = (state) =>\n ({ items: state.items }) as TSelected,\n): [\n () => Array<TValue>,\n SolidQueuer<TValue, TSelected>['addItem'],\n SolidQueuer<TValue, TSelected>,\n] {\n const queue = createQueuer(fn, options, selector)\n\n return [() => queue.state().items, queue.addItem, queue]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsHA,SAAgB,mBAOd,IACA,UAAiC,EAAE,EACnC,YAAuD,WACpD,EAAE,OAAO,MAAM,OAAO,GAKzB;CACA,MAAM,QAAQA,kCAAa,IAAI,SAAS,SAAS;AAEjD,QAAO;QAAO,MAAM,OAAO,CAAC;EAAO,MAAM;EAAS;EAAM"}
@@ -0,0 +1,123 @@
1
+ import { SolidQueuer } from "./createQueuer.cjs";
2
+ import { QueuerOptions, QueuerState } from "@tanstack/pacer/queuer";
3
+
4
+ //#region src/queuer/createQueuedSignal.d.ts
5
+
6
+ /**
7
+ * A Solid primitive that creates a queuer with managed state, combining Solid's signals with queuing functionality.
8
+ * This primitive provides both the current queue state and queue control methods.
9
+ *
10
+ * The queue state is automatically updated whenever items are added, removed, or reordered in the queue.
11
+ * All queue operations are reflected in the state array returned by the primitive.
12
+ *
13
+ * The queue can be started and stopped to automatically process items at a specified interval,
14
+ * making it useful as a scheduler. When started, it will process one item per tick, with an
15
+ * optional wait time between ticks.
16
+ *
17
+ * The primitive returns a tuple containing:
18
+ * - The current queue state as an array
19
+ * - The queue instance with methods for queue manipulation
20
+ *
21
+ * ## State Management and Selector
22
+ *
23
+ * The primitive uses Solid's reactive state management via the underlying queuer instance.
24
+ * The `selector` parameter allows you to specify which queuer state changes will trigger a re-render,
25
+ * optimizing performance by preventing unnecessary re-renders when irrelevant state changes occur.
26
+ *
27
+ * **By default, there will be no reactive state subscriptions** and you must opt-in to state
28
+ * tracking by providing a selector function. This prevents unnecessary re-renders and gives you
29
+ * full control over when your component updates. Only when you provide a selector will the
30
+ * component re-render when the selected state values change.
31
+ *
32
+ * Available queuer state properties:
33
+ * - `executionCount`: Number of items that have been processed by the queuer
34
+ * - `expirationCount`: Number of items that have been removed due to expiration
35
+ * - `isEmpty`: Whether the queuer has no items to process
36
+ * - `isFull`: Whether the queuer has reached its maximum capacity
37
+ * - `isIdle`: Whether the queuer is not currently processing any items
38
+ * - `isRunning`: Whether the queuer is active and will process items automatically
39
+ * - `items`: Array of items currently waiting to be processed
40
+ * - `itemTimestamps`: Timestamps when items were added for expiration tracking
41
+ * - `pendingTick`: Whether the queuer has a pending timeout for processing the next item
42
+ * - `rejectionCount`: Number of items that have been rejected from being added
43
+ * - `size`: Number of items currently in the queue
44
+ * - `status`: Current processing status ('idle' | 'running' | 'stopped')
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * // Default behavior - no reactive state subscriptions
49
+ * const [items, addItem, queue] = createQueuedSignal(
50
+ * (item) => console.log('Processing:', item),
51
+ * {
52
+ * initialItems: ['item1', 'item2'],
53
+ * started: true,
54
+ * wait: 1000,
55
+ * getPriority: (item) => item.priority
56
+ * }
57
+ * );
58
+ *
59
+ * // Opt-in to re-render when queue contents change (optimized for displaying queue items)
60
+ * const [items, addItem, queue] = createQueuedSignal(
61
+ * (item) => console.log('Processing:', item),
62
+ * { started: true, wait: 1000 },
63
+ * (state) => ({
64
+ * items: state.items,
65
+ * size: state.size,
66
+ * isEmpty: state.isEmpty
67
+ * })
68
+ * );
69
+ *
70
+ * // Opt-in to re-render when processing state changes (optimized for loading indicators)
71
+ * const [items, addItem, queue] = createQueuedSignal(
72
+ * (item) => console.log('Processing:', item),
73
+ * { started: true, wait: 1000 },
74
+ * (state) => ({
75
+ * isRunning: state.isRunning,
76
+ * isIdle: state.isIdle,
77
+ * status: state.status,
78
+ * pendingTick: state.pendingTick
79
+ * })
80
+ * );
81
+ *
82
+ * // Opt-in to re-render when execution metrics change (optimized for stats display)
83
+ * const [items, addItem, queue] = createQueuedSignal(
84
+ * (item) => console.log('Processing:', item),
85
+ * { started: true, wait: 1000 },
86
+ * (state) => ({
87
+ * executionCount: state.executionCount,
88
+ * expirationCount: state.expirationCount,
89
+ * rejectionCount: state.rejectionCount
90
+ * })
91
+ * );
92
+ *
93
+ * // Add items to queue
94
+ * const handleAdd = (item) => {
95
+ * addItem(item);
96
+ * };
97
+ *
98
+ * // Start automatic processing
99
+ * const startProcessing = () => {
100
+ * queue.start();
101
+ * };
102
+ *
103
+ * // Stop automatic processing
104
+ * const stopProcessing = () => {
105
+ * queue.stop();
106
+ * };
107
+ *
108
+ * // Manual processing still available
109
+ * const handleProcess = () => {
110
+ * const nextItem = queue.getNextItem();
111
+ * if (nextItem) {
112
+ * processItem(nextItem);
113
+ * }
114
+ * };
115
+ *
116
+ * // Access the selected queuer state (will be empty object {} unless selector provided)
117
+ * const { size, isRunning, executionCount } = queue.state;
118
+ * ```
119
+ */
120
+ declare function createQueuedSignal<TValue, TSelected extends Pick<QueuerState<TValue>, 'items'> = Pick<QueuerState<TValue>, 'items'>>(fn: (item: TValue) => void, options?: QueuerOptions<TValue>, selector?: (state: QueuerState<TValue>) => TSelected): [() => Array<TValue>, SolidQueuer<TValue, TSelected>['addItem'], SolidQueuer<TValue, TSelected>];
121
+ //#endregion
122
+ export { createQueuedSignal };
123
+ //# sourceMappingURL=createQueuedSignal.d.cts.map
@@ -0,0 +1,123 @@
1
+ import { SolidQueuer } from "./createQueuer.js";
2
+ import { QueuerOptions, QueuerState } from "@tanstack/pacer/queuer";
3
+
4
+ //#region src/queuer/createQueuedSignal.d.ts
5
+
6
+ /**
7
+ * A Solid primitive that creates a queuer with managed state, combining Solid's signals with queuing functionality.
8
+ * This primitive provides both the current queue state and queue control methods.
9
+ *
10
+ * The queue state is automatically updated whenever items are added, removed, or reordered in the queue.
11
+ * All queue operations are reflected in the state array returned by the primitive.
12
+ *
13
+ * The queue can be started and stopped to automatically process items at a specified interval,
14
+ * making it useful as a scheduler. When started, it will process one item per tick, with an
15
+ * optional wait time between ticks.
16
+ *
17
+ * The primitive returns a tuple containing:
18
+ * - The current queue state as an array
19
+ * - The queue instance with methods for queue manipulation
20
+ *
21
+ * ## State Management and Selector
22
+ *
23
+ * The primitive uses Solid's reactive state management via the underlying queuer instance.
24
+ * The `selector` parameter allows you to specify which queuer state changes will trigger a re-render,
25
+ * optimizing performance by preventing unnecessary re-renders when irrelevant state changes occur.
26
+ *
27
+ * **By default, there will be no reactive state subscriptions** and you must opt-in to state
28
+ * tracking by providing a selector function. This prevents unnecessary re-renders and gives you
29
+ * full control over when your component updates. Only when you provide a selector will the
30
+ * component re-render when the selected state values change.
31
+ *
32
+ * Available queuer state properties:
33
+ * - `executionCount`: Number of items that have been processed by the queuer
34
+ * - `expirationCount`: Number of items that have been removed due to expiration
35
+ * - `isEmpty`: Whether the queuer has no items to process
36
+ * - `isFull`: Whether the queuer has reached its maximum capacity
37
+ * - `isIdle`: Whether the queuer is not currently processing any items
38
+ * - `isRunning`: Whether the queuer is active and will process items automatically
39
+ * - `items`: Array of items currently waiting to be processed
40
+ * - `itemTimestamps`: Timestamps when items were added for expiration tracking
41
+ * - `pendingTick`: Whether the queuer has a pending timeout for processing the next item
42
+ * - `rejectionCount`: Number of items that have been rejected from being added
43
+ * - `size`: Number of items currently in the queue
44
+ * - `status`: Current processing status ('idle' | 'running' | 'stopped')
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * // Default behavior - no reactive state subscriptions
49
+ * const [items, addItem, queue] = createQueuedSignal(
50
+ * (item) => console.log('Processing:', item),
51
+ * {
52
+ * initialItems: ['item1', 'item2'],
53
+ * started: true,
54
+ * wait: 1000,
55
+ * getPriority: (item) => item.priority
56
+ * }
57
+ * );
58
+ *
59
+ * // Opt-in to re-render when queue contents change (optimized for displaying queue items)
60
+ * const [items, addItem, queue] = createQueuedSignal(
61
+ * (item) => console.log('Processing:', item),
62
+ * { started: true, wait: 1000 },
63
+ * (state) => ({
64
+ * items: state.items,
65
+ * size: state.size,
66
+ * isEmpty: state.isEmpty
67
+ * })
68
+ * );
69
+ *
70
+ * // Opt-in to re-render when processing state changes (optimized for loading indicators)
71
+ * const [items, addItem, queue] = createQueuedSignal(
72
+ * (item) => console.log('Processing:', item),
73
+ * { started: true, wait: 1000 },
74
+ * (state) => ({
75
+ * isRunning: state.isRunning,
76
+ * isIdle: state.isIdle,
77
+ * status: state.status,
78
+ * pendingTick: state.pendingTick
79
+ * })
80
+ * );
81
+ *
82
+ * // Opt-in to re-render when execution metrics change (optimized for stats display)
83
+ * const [items, addItem, queue] = createQueuedSignal(
84
+ * (item) => console.log('Processing:', item),
85
+ * { started: true, wait: 1000 },
86
+ * (state) => ({
87
+ * executionCount: state.executionCount,
88
+ * expirationCount: state.expirationCount,
89
+ * rejectionCount: state.rejectionCount
90
+ * })
91
+ * );
92
+ *
93
+ * // Add items to queue
94
+ * const handleAdd = (item) => {
95
+ * addItem(item);
96
+ * };
97
+ *
98
+ * // Start automatic processing
99
+ * const startProcessing = () => {
100
+ * queue.start();
101
+ * };
102
+ *
103
+ * // Stop automatic processing
104
+ * const stopProcessing = () => {
105
+ * queue.stop();
106
+ * };
107
+ *
108
+ * // Manual processing still available
109
+ * const handleProcess = () => {
110
+ * const nextItem = queue.getNextItem();
111
+ * if (nextItem) {
112
+ * processItem(nextItem);
113
+ * }
114
+ * };
115
+ *
116
+ * // Access the selected queuer state (will be empty object {} unless selector provided)
117
+ * const { size, isRunning, executionCount } = queue.state;
118
+ * ```
119
+ */
120
+ declare function createQueuedSignal<TValue, TSelected extends Pick<QueuerState<TValue>, 'items'> = Pick<QueuerState<TValue>, 'items'>>(fn: (item: TValue) => void, options?: QueuerOptions<TValue>, selector?: (state: QueuerState<TValue>) => TSelected): [() => Array<TValue>, SolidQueuer<TValue, TSelected>['addItem'], SolidQueuer<TValue, TSelected>];
121
+ //#endregion
122
+ export { createQueuedSignal };
123
+ //# sourceMappingURL=createQueuedSignal.d.ts.map
@@ -0,0 +1,129 @@
1
+ import { createQueuer } from "./createQueuer.js";
2
+
3
+ //#region src/queuer/createQueuedSignal.ts
4
+ /**
5
+ * A Solid primitive that creates a queuer with managed state, combining Solid's signals with queuing functionality.
6
+ * This primitive provides both the current queue state and queue control methods.
7
+ *
8
+ * The queue state is automatically updated whenever items are added, removed, or reordered in the queue.
9
+ * All queue operations are reflected in the state array returned by the primitive.
10
+ *
11
+ * The queue can be started and stopped to automatically process items at a specified interval,
12
+ * making it useful as a scheduler. When started, it will process one item per tick, with an
13
+ * optional wait time between ticks.
14
+ *
15
+ * The primitive returns a tuple containing:
16
+ * - The current queue state as an array
17
+ * - The queue instance with methods for queue manipulation
18
+ *
19
+ * ## State Management and Selector
20
+ *
21
+ * The primitive uses Solid's reactive state management via the underlying queuer instance.
22
+ * The `selector` parameter allows you to specify which queuer state changes will trigger a re-render,
23
+ * optimizing performance by preventing unnecessary re-renders when irrelevant state changes occur.
24
+ *
25
+ * **By default, there will be no reactive state subscriptions** and you must opt-in to state
26
+ * tracking by providing a selector function. This prevents unnecessary re-renders and gives you
27
+ * full control over when your component updates. Only when you provide a selector will the
28
+ * component re-render when the selected state values change.
29
+ *
30
+ * Available queuer state properties:
31
+ * - `executionCount`: Number of items that have been processed by the queuer
32
+ * - `expirationCount`: Number of items that have been removed due to expiration
33
+ * - `isEmpty`: Whether the queuer has no items to process
34
+ * - `isFull`: Whether the queuer has reached its maximum capacity
35
+ * - `isIdle`: Whether the queuer is not currently processing any items
36
+ * - `isRunning`: Whether the queuer is active and will process items automatically
37
+ * - `items`: Array of items currently waiting to be processed
38
+ * - `itemTimestamps`: Timestamps when items were added for expiration tracking
39
+ * - `pendingTick`: Whether the queuer has a pending timeout for processing the next item
40
+ * - `rejectionCount`: Number of items that have been rejected from being added
41
+ * - `size`: Number of items currently in the queue
42
+ * - `status`: Current processing status ('idle' | 'running' | 'stopped')
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * // Default behavior - no reactive state subscriptions
47
+ * const [items, addItem, queue] = createQueuedSignal(
48
+ * (item) => console.log('Processing:', item),
49
+ * {
50
+ * initialItems: ['item1', 'item2'],
51
+ * started: true,
52
+ * wait: 1000,
53
+ * getPriority: (item) => item.priority
54
+ * }
55
+ * );
56
+ *
57
+ * // Opt-in to re-render when queue contents change (optimized for displaying queue items)
58
+ * const [items, addItem, queue] = createQueuedSignal(
59
+ * (item) => console.log('Processing:', item),
60
+ * { started: true, wait: 1000 },
61
+ * (state) => ({
62
+ * items: state.items,
63
+ * size: state.size,
64
+ * isEmpty: state.isEmpty
65
+ * })
66
+ * );
67
+ *
68
+ * // Opt-in to re-render when processing state changes (optimized for loading indicators)
69
+ * const [items, addItem, queue] = createQueuedSignal(
70
+ * (item) => console.log('Processing:', item),
71
+ * { started: true, wait: 1000 },
72
+ * (state) => ({
73
+ * isRunning: state.isRunning,
74
+ * isIdle: state.isIdle,
75
+ * status: state.status,
76
+ * pendingTick: state.pendingTick
77
+ * })
78
+ * );
79
+ *
80
+ * // Opt-in to re-render when execution metrics change (optimized for stats display)
81
+ * const [items, addItem, queue] = createQueuedSignal(
82
+ * (item) => console.log('Processing:', item),
83
+ * { started: true, wait: 1000 },
84
+ * (state) => ({
85
+ * executionCount: state.executionCount,
86
+ * expirationCount: state.expirationCount,
87
+ * rejectionCount: state.rejectionCount
88
+ * })
89
+ * );
90
+ *
91
+ * // Add items to queue
92
+ * const handleAdd = (item) => {
93
+ * addItem(item);
94
+ * };
95
+ *
96
+ * // Start automatic processing
97
+ * const startProcessing = () => {
98
+ * queue.start();
99
+ * };
100
+ *
101
+ * // Stop automatic processing
102
+ * const stopProcessing = () => {
103
+ * queue.stop();
104
+ * };
105
+ *
106
+ * // Manual processing still available
107
+ * const handleProcess = () => {
108
+ * const nextItem = queue.getNextItem();
109
+ * if (nextItem) {
110
+ * processItem(nextItem);
111
+ * }
112
+ * };
113
+ *
114
+ * // Access the selected queuer state (will be empty object {} unless selector provided)
115
+ * const { size, isRunning, executionCount } = queue.state;
116
+ * ```
117
+ */
118
+ function createQueuedSignal(fn, options = {}, selector = (state) => ({ items: state.items })) {
119
+ const queue = createQueuer(fn, options, selector);
120
+ return [
121
+ () => queue.state().items,
122
+ queue.addItem,
123
+ queue
124
+ ];
125
+ }
126
+
127
+ //#endregion
128
+ export { createQueuedSignal };
129
+ //# sourceMappingURL=createQueuedSignal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQueuedSignal.js","names":[],"sources":["../../src/queuer/createQueuedSignal.ts"],"sourcesContent":["import { createQueuer } from './createQueuer'\nimport type { SolidQueuer } from './createQueuer'\nimport type { QueuerOptions, QueuerState } from '@tanstack/pacer/queuer'\n\n/**\n * A Solid primitive that creates a queuer with managed state, combining Solid's signals with queuing functionality.\n * This primitive provides both the current queue state and queue control methods.\n *\n * The queue state is automatically updated whenever items are added, removed, or reordered in the queue.\n * All queue operations are reflected in the state array returned by the primitive.\n *\n * The queue can be started and stopped to automatically process items at a specified interval,\n * making it useful as a scheduler. When started, it will process one item per tick, with an\n * optional wait time between ticks.\n *\n * The primitive returns a tuple containing:\n * - The current queue state as an array\n * - The queue instance with methods for queue manipulation\n *\n * ## State Management and Selector\n *\n * The primitive uses Solid's reactive state management via the underlying queuer instance.\n * The `selector` parameter allows you to specify which queuer state changes will trigger a re-render,\n * optimizing performance by preventing 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 queuer state properties:\n * - `executionCount`: Number of items that have been processed by the queuer\n * - `expirationCount`: Number of items that have been removed due to expiration\n * - `isEmpty`: Whether the queuer has no items to process\n * - `isFull`: Whether the queuer has reached its maximum capacity\n * - `isIdle`: Whether the queuer is not currently processing any items\n * - `isRunning`: Whether the queuer is active and will process items automatically\n * - `items`: Array of items currently waiting to be processed\n * - `itemTimestamps`: Timestamps when items were added for expiration tracking\n * - `pendingTick`: Whether the queuer has a pending timeout for processing the next item\n * - `rejectionCount`: Number of items that have been rejected from being added\n * - `size`: Number of items currently in the queue\n * - `status`: Current processing status ('idle' | 'running' | 'stopped')\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const [items, addItem, queue] = createQueuedSignal(\n * (item) => console.log('Processing:', item),\n * {\n * initialItems: ['item1', 'item2'],\n * started: true,\n * wait: 1000,\n * getPriority: (item) => item.priority\n * }\n * );\n *\n * // Opt-in to re-render when queue contents change (optimized for displaying queue items)\n * const [items, addItem, queue] = createQueuedSignal(\n * (item) => console.log('Processing:', item),\n * { started: true, wait: 1000 },\n * (state) => ({\n * items: state.items,\n * size: state.size,\n * isEmpty: state.isEmpty\n * })\n * );\n *\n * // Opt-in to re-render when processing state changes (optimized for loading indicators)\n * const [items, addItem, queue] = createQueuedSignal(\n * (item) => console.log('Processing:', item),\n * { started: true, wait: 1000 },\n * (state) => ({\n * isRunning: state.isRunning,\n * isIdle: state.isIdle,\n * status: state.status,\n * pendingTick: state.pendingTick\n * })\n * );\n *\n * // Opt-in to re-render when execution metrics change (optimized for stats display)\n * const [items, addItem, queue] = createQueuedSignal(\n * (item) => console.log('Processing:', item),\n * { started: true, wait: 1000 },\n * (state) => ({\n * executionCount: state.executionCount,\n * expirationCount: state.expirationCount,\n * rejectionCount: state.rejectionCount\n * })\n * );\n *\n * // Add items to queue\n * const handleAdd = (item) => {\n * addItem(item);\n * };\n *\n * // Start automatic processing\n * const startProcessing = () => {\n * queue.start();\n * };\n *\n * // Stop automatic processing\n * const stopProcessing = () => {\n * queue.stop();\n * };\n *\n * // Manual processing still available\n * const handleProcess = () => {\n * const nextItem = queue.getNextItem();\n * if (nextItem) {\n * processItem(nextItem);\n * }\n * };\n *\n * // Access the selected queuer state (will be empty object {} unless selector provided)\n * const { size, isRunning, executionCount } = queue.state;\n * ```\n */\nexport function createQueuedSignal<\n TValue,\n TSelected extends Pick<QueuerState<TValue>, 'items'> = Pick<\n QueuerState<TValue>,\n 'items'\n >,\n>(\n fn: (item: TValue) => void,\n options: QueuerOptions<TValue> = {},\n selector: (state: QueuerState<TValue>) => TSelected = (state) =>\n ({ items: state.items }) as TSelected,\n): [\n () => Array<TValue>,\n SolidQueuer<TValue, TSelected>['addItem'],\n SolidQueuer<TValue, TSelected>,\n] {\n const queue = createQueuer(fn, options, selector)\n\n return [() => queue.state().items, queue.addItem, queue]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsHA,SAAgB,mBAOd,IACA,UAAiC,EAAE,EACnC,YAAuD,WACpD,EAAE,OAAO,MAAM,OAAO,GAKzB;CACA,MAAM,QAAQ,aAAa,IAAI,SAAS,SAAS;AAEjD,QAAO;QAAO,MAAM,OAAO,CAAC;EAAO,MAAM;EAAS;EAAM"}