@tanstack/solid-pacer 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/README.md +4 -4
  2. package/dist/async-batcher/createAsyncBatcher.d.ts +5 -9
  3. package/dist/async-batcher/createAsyncBatcher.js +2 -5
  4. package/dist/async-debouncer/createAsyncDebouncer.d.ts +8 -11
  5. package/dist/async-debouncer/createAsyncDebouncer.js +5 -7
  6. package/dist/async-queuer/createAsyncQueuer.d.ts +9 -11
  7. package/dist/async-queuer/createAsyncQueuer.js +4 -5
  8. package/dist/async-rate-limiter/createAsyncRateLimiter.d.ts +10 -12
  9. package/dist/async-rate-limiter/createAsyncRateLimiter.js +7 -8
  10. package/dist/async-throttler/createAsyncThrottler.d.ts +8 -13
  11. package/dist/async-throttler/createAsyncThrottler.js +5 -9
  12. package/dist/batcher/createBatcher.d.ts +11 -14
  13. package/dist/batcher/createBatcher.js +6 -8
  14. package/dist/debouncer/createDebouncedSignal.d.ts +2 -4
  15. package/dist/debouncer/createDebouncedSignal.js +1 -2
  16. package/dist/debouncer/createDebouncedValue.d.ts +2 -4
  17. package/dist/debouncer/createDebouncedValue.js +1 -2
  18. package/dist/debouncer/createDebouncer.d.ts +4 -6
  19. package/dist/debouncer/createDebouncer.js +1 -2
  20. package/dist/provider/PacerProvider.d.ts +6 -8
  21. package/dist/provider/PacerProvider.js +1 -2
  22. package/dist/queuer/createQueuedSignal.d.ts +2 -4
  23. package/dist/queuer/createQueuedSignal.js +1 -2
  24. package/dist/queuer/createQueuer.d.ts +4 -6
  25. package/dist/queuer/createQueuer.js +1 -2
  26. package/dist/rate-limiter/createRateLimitedSignal.d.ts +12 -13
  27. package/dist/rate-limiter/createRateLimitedSignal.js +11 -11
  28. package/dist/rate-limiter/createRateLimitedValue.d.ts +2 -4
  29. package/dist/rate-limiter/createRateLimitedValue.js +1 -2
  30. package/dist/rate-limiter/createRateLimiter.d.ts +8 -9
  31. package/dist/rate-limiter/createRateLimiter.js +5 -5
  32. package/dist/throttler/createThrottledSignal.d.ts +2 -6
  33. package/dist/throttler/createThrottledSignal.js +1 -4
  34. package/dist/throttler/createThrottledValue.d.ts +2 -6
  35. package/dist/throttler/createThrottledValue.js +1 -4
  36. package/dist/throttler/createThrottler.d.ts +4 -8
  37. package/dist/throttler/createThrottler.js +1 -4
  38. package/package.json +23 -67
  39. package/dist/async-batcher/createAsyncBatcher.cjs +0 -166
  40. package/dist/async-batcher/createAsyncBatcher.cjs.map +0 -1
  41. package/dist/async-batcher/createAsyncBatcher.d.cts +0 -177
  42. package/dist/async-batcher/createAsyncBatcher.js.map +0 -1
  43. package/dist/async-batcher/index.cjs +0 -11
  44. package/dist/async-batcher/index.d.cts +0 -3
  45. package/dist/async-debouncer/createAsyncDebouncer.cjs +0 -151
  46. package/dist/async-debouncer/createAsyncDebouncer.cjs.map +0 -1
  47. package/dist/async-debouncer/createAsyncDebouncer.d.cts +0 -163
  48. package/dist/async-debouncer/createAsyncDebouncer.js.map +0 -1
  49. package/dist/async-debouncer/index.cjs +0 -11
  50. package/dist/async-debouncer/index.d.cts +0 -3
  51. package/dist/async-queuer/createAsyncQueuer.cjs +0 -158
  52. package/dist/async-queuer/createAsyncQueuer.cjs.map +0 -1
  53. package/dist/async-queuer/createAsyncQueuer.d.cts +0 -169
  54. package/dist/async-queuer/createAsyncQueuer.js.map +0 -1
  55. package/dist/async-queuer/index.cjs +0 -11
  56. package/dist/async-queuer/index.d.cts +0 -3
  57. package/dist/async-rate-limiter/createAsyncRateLimiter.cjs +0 -193
  58. package/dist/async-rate-limiter/createAsyncRateLimiter.cjs.map +0 -1
  59. package/dist/async-rate-limiter/createAsyncRateLimiter.d.cts +0 -208
  60. package/dist/async-rate-limiter/createAsyncRateLimiter.js.map +0 -1
  61. package/dist/async-rate-limiter/index.cjs +0 -11
  62. package/dist/async-rate-limiter/index.d.cts +0 -3
  63. package/dist/async-throttler/createAsyncThrottler.cjs +0 -151
  64. package/dist/async-throttler/createAsyncThrottler.cjs.map +0 -1
  65. package/dist/async-throttler/createAsyncThrottler.d.cts +0 -163
  66. package/dist/async-throttler/createAsyncThrottler.js.map +0 -1
  67. package/dist/async-throttler/index.cjs +0 -11
  68. package/dist/async-throttler/index.d.cts +0 -3
  69. package/dist/batcher/createBatcher.cjs +0 -132
  70. package/dist/batcher/createBatcher.cjs.map +0 -1
  71. package/dist/batcher/createBatcher.d.cts +0 -146
  72. package/dist/batcher/createBatcher.js.map +0 -1
  73. package/dist/batcher/index.cjs +0 -11
  74. package/dist/batcher/index.d.cts +0 -3
  75. package/dist/debouncer/createDebouncedSignal.cjs +0 -88
  76. package/dist/debouncer/createDebouncedSignal.cjs.map +0 -1
  77. package/dist/debouncer/createDebouncedSignal.d.cts +0 -79
  78. package/dist/debouncer/createDebouncedSignal.js.map +0 -1
  79. package/dist/debouncer/createDebouncedValue.cjs +0 -77
  80. package/dist/debouncer/createDebouncedValue.cjs.map +0 -1
  81. package/dist/debouncer/createDebouncedValue.d.cts +0 -70
  82. package/dist/debouncer/createDebouncedValue.js.map +0 -1
  83. package/dist/debouncer/createDebouncer.cjs +0 -129
  84. package/dist/debouncer/createDebouncer.cjs.map +0 -1
  85. package/dist/debouncer/createDebouncer.d.cts +0 -144
  86. package/dist/debouncer/createDebouncer.js.map +0 -1
  87. package/dist/debouncer/index.cjs +0 -15
  88. package/dist/debouncer/index.d.cts +0 -5
  89. package/dist/index.cjs +0 -47
  90. package/dist/index.d.cts +0 -20
  91. package/dist/provider/PacerProvider.cjs +0 -27
  92. package/dist/provider/PacerProvider.cjs.map +0 -1
  93. package/dist/provider/PacerProvider.d.cts +0 -28
  94. package/dist/provider/PacerProvider.js.map +0 -1
  95. package/dist/provider/index.cjs +0 -6
  96. package/dist/provider/index.d.cts +0 -2
  97. package/dist/queuer/createQueuedSignal.cjs +0 -129
  98. package/dist/queuer/createQueuedSignal.cjs.map +0 -1
  99. package/dist/queuer/createQueuedSignal.d.cts +0 -121
  100. package/dist/queuer/createQueuedSignal.js.map +0 -1
  101. package/dist/queuer/createQueuer.cjs +0 -133
  102. package/dist/queuer/createQueuer.cjs.map +0 -1
  103. package/dist/queuer/createQueuer.d.cts +0 -147
  104. package/dist/queuer/createQueuer.js.map +0 -1
  105. package/dist/queuer/index.cjs +0 -13
  106. package/dist/queuer/index.d.cts +0 -4
  107. package/dist/rate-limiter/createRateLimitedSignal.cjs +0 -102
  108. package/dist/rate-limiter/createRateLimitedSignal.cjs.map +0 -1
  109. package/dist/rate-limiter/createRateLimitedSignal.d.cts +0 -93
  110. package/dist/rate-limiter/createRateLimitedSignal.js.map +0 -1
  111. package/dist/rate-limiter/createRateLimitedValue.cjs +0 -102
  112. package/dist/rate-limiter/createRateLimitedValue.cjs.map +0 -1
  113. package/dist/rate-limiter/createRateLimitedValue.d.cts +0 -95
  114. package/dist/rate-limiter/createRateLimitedValue.js.map +0 -1
  115. package/dist/rate-limiter/createRateLimiter.cjs +0 -157
  116. package/dist/rate-limiter/createRateLimiter.cjs.map +0 -1
  117. package/dist/rate-limiter/createRateLimiter.d.cts +0 -173
  118. package/dist/rate-limiter/createRateLimiter.js.map +0 -1
  119. package/dist/rate-limiter/index.cjs +0 -15
  120. package/dist/rate-limiter/index.d.cts +0 -5
  121. package/dist/throttler/createThrottledSignal.cjs +0 -79
  122. package/dist/throttler/createThrottledSignal.cjs.map +0 -1
  123. package/dist/throttler/createThrottledSignal.d.cts +0 -70
  124. package/dist/throttler/createThrottledSignal.js.map +0 -1
  125. package/dist/throttler/createThrottledValue.cjs +0 -74
  126. package/dist/throttler/createThrottledValue.cjs.map +0 -1
  127. package/dist/throttler/createThrottledValue.d.cts +0 -67
  128. package/dist/throttler/createThrottledValue.js.map +0 -1
  129. package/dist/throttler/createThrottler.cjs +0 -132
  130. package/dist/throttler/createThrottler.cjs.map +0 -1
  131. package/dist/throttler/createThrottler.d.cts +0 -147
  132. package/dist/throttler/createThrottler.js.map +0 -1
  133. package/dist/throttler/index.cjs +0 -15
  134. package/dist/throttler/index.d.cts +0 -5
  135. package/dist/types/index.cjs +0 -8
  136. package/dist/types/index.d.cts +0 -1
  137. package/dist/utils/index.cjs +0 -8
  138. package/dist/utils/index.d.cts +0 -1
  139. package/src/async-batcher/createAsyncBatcher.ts +0 -234
  140. package/src/async-batcher/index.ts +0 -3
  141. package/src/async-debouncer/createAsyncDebouncer.ts +0 -225
  142. package/src/async-debouncer/index.ts +0 -4
  143. package/src/async-queuer/createAsyncQueuer.ts +0 -226
  144. package/src/async-queuer/index.ts +0 -3
  145. package/src/async-rate-limiter/createAsyncRateLimiter.ts +0 -269
  146. package/src/async-rate-limiter/index.ts +0 -4
  147. package/src/async-throttler/createAsyncThrottler.ts +0 -225
  148. package/src/async-throttler/index.ts +0 -4
  149. package/src/batcher/createBatcher.ts +0 -199
  150. package/src/batcher/index.ts +0 -3
  151. package/src/debouncer/createDebouncedSignal.ts +0 -92
  152. package/src/debouncer/createDebouncedValue.ts +0 -85
  153. package/src/debouncer/createDebouncer.ts +0 -201
  154. package/src/debouncer/index.ts +0 -6
  155. package/src/index.ts +0 -46
  156. package/src/provider/PacerProvider.tsx +0 -63
  157. package/src/provider/index.ts +0 -1
  158. package/src/queuer/createQueuedSignal.ts +0 -138
  159. package/src/queuer/createQueuer.ts +0 -199
  160. package/src/queuer/index.ts +0 -4
  161. package/src/rate-limiter/createRateLimitedSignal.ts +0 -117
  162. package/src/rate-limiter/createRateLimitedValue.ts +0 -110
  163. package/src/rate-limiter/createRateLimiter.ts +0 -226
  164. package/src/rate-limiter/index.ts +0 -5
  165. package/src/throttler/createThrottledSignal.ts +0 -81
  166. package/src/throttler/createThrottledValue.ts +0 -82
  167. package/src/throttler/createThrottler.ts +0 -204
  168. package/src/throttler/index.ts +0 -6
  169. package/src/types/index.ts +0 -1
  170. package/src/utils/index.ts +0 -1
package/dist/index.cjs DELETED
@@ -1,47 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_PacerProvider = require('./provider/PacerProvider.cjs');
3
- const require_createAsyncBatcher = require('./async-batcher/createAsyncBatcher.cjs');
4
- const require_createAsyncDebouncer = require('./async-debouncer/createAsyncDebouncer.cjs');
5
- const require_createAsyncQueuer = require('./async-queuer/createAsyncQueuer.cjs');
6
- const require_createAsyncRateLimiter = require('./async-rate-limiter/createAsyncRateLimiter.cjs');
7
- const require_createAsyncThrottler = require('./async-throttler/createAsyncThrottler.cjs');
8
- const require_createBatcher = require('./batcher/createBatcher.cjs');
9
- const require_createDebouncer = require('./debouncer/createDebouncer.cjs');
10
- const require_createDebouncedSignal = require('./debouncer/createDebouncedSignal.cjs');
11
- const require_createDebouncedValue = require('./debouncer/createDebouncedValue.cjs');
12
- const require_createQueuer = require('./queuer/createQueuer.cjs');
13
- const require_createQueuedSignal = require('./queuer/createQueuedSignal.cjs');
14
- const require_createRateLimiter = require('./rate-limiter/createRateLimiter.cjs');
15
- const require_createRateLimitedSignal = require('./rate-limiter/createRateLimitedSignal.cjs');
16
- const require_createRateLimitedValue = require('./rate-limiter/createRateLimitedValue.cjs');
17
- const require_createThrottler = require('./throttler/createThrottler.cjs');
18
- const require_createThrottledSignal = require('./throttler/createThrottledSignal.cjs');
19
- const require_createThrottledValue = require('./throttler/createThrottledValue.cjs');
20
-
21
- exports.PacerProvider = require_PacerProvider.PacerProvider;
22
- exports.createAsyncBatcher = require_createAsyncBatcher.createAsyncBatcher;
23
- exports.createAsyncDebouncer = require_createAsyncDebouncer.createAsyncDebouncer;
24
- exports.createAsyncQueuer = require_createAsyncQueuer.createAsyncQueuer;
25
- exports.createAsyncRateLimiter = require_createAsyncRateLimiter.createAsyncRateLimiter;
26
- exports.createAsyncThrottler = require_createAsyncThrottler.createAsyncThrottler;
27
- exports.createBatcher = require_createBatcher.createBatcher;
28
- exports.createDebouncedSignal = require_createDebouncedSignal.createDebouncedSignal;
29
- exports.createDebouncedValue = require_createDebouncedValue.createDebouncedValue;
30
- exports.createDebouncer = require_createDebouncer.createDebouncer;
31
- exports.createQueuedSignal = require_createQueuedSignal.createQueuedSignal;
32
- exports.createQueuer = require_createQueuer.createQueuer;
33
- exports.createRateLimitedSignal = require_createRateLimitedSignal.createRateLimitedSignal;
34
- exports.createRateLimitedValue = require_createRateLimitedValue.createRateLimitedValue;
35
- exports.createRateLimiter = require_createRateLimiter.createRateLimiter;
36
- exports.createThrottledSignal = require_createThrottledSignal.createThrottledSignal;
37
- exports.createThrottledValue = require_createThrottledValue.createThrottledValue;
38
- exports.createThrottler = require_createThrottler.createThrottler;
39
- exports.useDefaultPacerOptions = require_PacerProvider.useDefaultPacerOptions;
40
- exports.usePacerContext = require_PacerProvider.usePacerContext;
41
- var _tanstack_pacer = require("@tanstack/pacer");
42
- Object.keys(_tanstack_pacer).forEach(function (k) {
43
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
44
- enumerable: true,
45
- get: function () { return _tanstack_pacer[k]; }
46
- });
47
- });
package/dist/index.d.cts DELETED
@@ -1,20 +0,0 @@
1
- import { SolidAsyncBatcher, SolidAsyncBatcherOptions, createAsyncBatcher } from "./async-batcher/createAsyncBatcher.cjs";
2
- import { SolidAsyncDebouncer, SolidAsyncDebouncerOptions, createAsyncDebouncer } from "./async-debouncer/createAsyncDebouncer.cjs";
3
- import { SolidAsyncQueuer, SolidAsyncQueuerOptions, createAsyncQueuer } from "./async-queuer/createAsyncQueuer.cjs";
4
- import { SolidAsyncRateLimiter, SolidAsyncRateLimiterOptions, createAsyncRateLimiter } from "./async-rate-limiter/createAsyncRateLimiter.cjs";
5
- import { SolidAsyncThrottler, SolidAsyncThrottlerOptions, createAsyncThrottler } from "./async-throttler/createAsyncThrottler.cjs";
6
- import { SolidBatcher, SolidBatcherOptions, createBatcher } from "./batcher/createBatcher.cjs";
7
- import { SolidDebouncer, SolidDebouncerOptions, createDebouncer } from "./debouncer/createDebouncer.cjs";
8
- import { createDebouncedSignal } from "./debouncer/createDebouncedSignal.cjs";
9
- import { createDebouncedValue } from "./debouncer/createDebouncedValue.cjs";
10
- import { PacerProvider, PacerProviderOptions, PacerProviderProps, useDefaultPacerOptions, usePacerContext } from "./provider/PacerProvider.cjs";
11
- import { SolidQueuer, SolidQueuerOptions, createQueuer } from "./queuer/createQueuer.cjs";
12
- import { createQueuedSignal } from "./queuer/createQueuedSignal.cjs";
13
- import { SolidRateLimiter, SolidRateLimiterOptions, createRateLimiter } from "./rate-limiter/createRateLimiter.cjs";
14
- import { createRateLimitedSignal } from "./rate-limiter/createRateLimitedSignal.cjs";
15
- import { createRateLimitedValue } from "./rate-limiter/createRateLimitedValue.cjs";
16
- import { SolidThrottler, SolidThrottlerOptions, createThrottler } from "./throttler/createThrottler.cjs";
17
- import { createThrottledSignal } from "./throttler/createThrottledSignal.cjs";
18
- import { createThrottledValue } from "./throttler/createThrottledValue.cjs";
19
- export * from "@tanstack/pacer";
20
- export { PacerProvider, PacerProviderOptions, PacerProviderProps, SolidAsyncBatcher, SolidAsyncBatcherOptions, SolidAsyncDebouncer, SolidAsyncDebouncerOptions, SolidAsyncQueuer, SolidAsyncQueuerOptions, SolidAsyncRateLimiter, SolidAsyncRateLimiterOptions, SolidAsyncThrottler, SolidAsyncThrottlerOptions, SolidBatcher, SolidBatcherOptions, SolidDebouncer, SolidDebouncerOptions, SolidQueuer, SolidQueuerOptions, SolidRateLimiter, SolidRateLimiterOptions, SolidThrottler, SolidThrottlerOptions, createAsyncBatcher, createAsyncDebouncer, createAsyncQueuer, createAsyncRateLimiter, createAsyncThrottler, createBatcher, createDebouncedSignal, createDebouncedValue, createDebouncer, createQueuedSignal, createQueuer, createRateLimitedSignal, createRateLimitedValue, createRateLimiter, createThrottledSignal, createThrottledValue, createThrottler, useDefaultPacerOptions, usePacerContext };
@@ -1,27 +0,0 @@
1
- let solid_js_web = require("solid-js/web");
2
- let solid_js = require("solid-js");
3
-
4
- //#region src/provider/PacerProvider.tsx
5
- const PacerContext = (0, solid_js.createContext)(null);
6
- const DEFAULT_OPTIONS = {};
7
- function PacerProvider(props) {
8
- const contextValue = { defaultOptions: props.defaultOptions ?? DEFAULT_OPTIONS };
9
- return (0, solid_js_web.createComponent)(PacerContext.Provider, {
10
- value: contextValue,
11
- get children() {
12
- return props.children;
13
- }
14
- });
15
- }
16
- function usePacerContext() {
17
- return (0, solid_js.useContext)(PacerContext);
18
- }
19
- function useDefaultPacerOptions() {
20
- return (0, solid_js.useContext)(PacerContext)?.defaultOptions ?? {};
21
- }
22
-
23
- //#endregion
24
- exports.PacerProvider = PacerProvider;
25
- exports.useDefaultPacerOptions = useDefaultPacerOptions;
26
- exports.usePacerContext = usePacerContext;
27
- //# sourceMappingURL=PacerProvider.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PacerProvider.cjs","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,mBAAe7B,wBAAwC,IAAI;AAOjE,MAAMiC,kBAAwC,CAAC;AAE/C,SAAgBC,cAAcC,OAA2B;CACvD,MAAMC,eAAkC,EACtCR,gBAAgBO,MAAMP,kBAAkBK,gBAC1C;CAEA,WAAAI,8BACGR,aAAaS,UAAQ;EAACC,OAAOH;EAAY,IAAAL,WAAA;GAAA,OACvCI,MAAMJ;EAAQ;CAAA,CAAA;AAGrB;AAEA,SAAgBS,kBAAkB;CAChC,WAAOvC,qBAAW4B,YAAY;AAChC;AAEA,SAAgBY,yBAAyB;CAEvC,WADgBxC,qBAAW4B,YACpBa,CAAO,EAAEd,kBAAkB,CAAC;AACrC"}
@@ -1,28 +0,0 @@
1
- import { JSX } from "solid-js";
2
- import { AnyAsyncFunction, AnyFunction, AsyncBatcherOptions, AsyncDebouncerOptions, AsyncQueuerOptions, AsyncRateLimiterOptions, AsyncThrottlerOptions, BatcherOptions, DebouncerOptions, QueuerOptions, RateLimiterOptions, ThrottlerOptions } from "@tanstack/pacer";
3
- //#region src/provider/PacerProvider.d.ts
4
- interface PacerProviderOptions {
5
- asyncBatcher?: Partial<AsyncBatcherOptions<any>>;
6
- asyncDebouncer?: Partial<AsyncDebouncerOptions<AnyAsyncFunction>>;
7
- asyncQueuer?: Partial<AsyncQueuerOptions<any>>;
8
- asyncRateLimiter?: Partial<AsyncRateLimiterOptions<AnyAsyncFunction>>;
9
- asyncThrottler?: Partial<AsyncThrottlerOptions<AnyAsyncFunction>>;
10
- batcher?: Partial<BatcherOptions<any>>;
11
- debouncer?: Partial<DebouncerOptions<AnyFunction>>;
12
- queuer?: Partial<QueuerOptions<any>>;
13
- rateLimiter?: Partial<RateLimiterOptions<AnyFunction>>;
14
- throttler?: Partial<ThrottlerOptions<AnyFunction>>;
15
- }
16
- interface PacerContextValue {
17
- defaultOptions: PacerProviderOptions;
18
- }
19
- interface PacerProviderProps {
20
- children: JSX.Element;
21
- defaultOptions?: PacerProviderOptions;
22
- }
23
- declare function PacerProvider(props: PacerProviderProps): JSX.Element;
24
- declare function usePacerContext(): PacerContextValue | null;
25
- declare function useDefaultPacerOptions(): PacerProviderOptions;
26
- //#endregion
27
- export { PacerProvider, PacerProviderOptions, PacerProviderProps, useDefaultPacerOptions, usePacerContext };
28
- //# sourceMappingURL=PacerProvider.d.cts.map
@@ -1 +0,0 @@
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,IAAI;AAOjE,MAAMiC,kBAAwC,CAAC;AAE/C,SAAgBC,cAAcC,OAA2B;CACvD,MAAMC,eAAkC,EACtCR,gBAAgBO,MAAMP,kBAAkBK,gBAC1C;CAEA,OAAAI,gBACGR,aAAaS,UAAQ;EAACC,OAAOH;EAAY,IAAAL,WAAA;GAAA,OACvCI,MAAMJ;EAAQ;CAAA,CAAA;AAGrB;AAEA,SAAgBS,kBAAkB;CAChC,OAAOvC,WAAW4B,YAAY;AAChC;AAEA,SAAgBY,yBAAyB;CAEvC,OADgBxC,WAAW4B,YACpBa,CAAO,EAAEd,kBAAkB,CAAC;AACrC"}
@@ -1,6 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_PacerProvider = require('./PacerProvider.cjs');
3
-
4
- exports.PacerProvider = require_PacerProvider.PacerProvider;
5
- exports.useDefaultPacerOptions = require_PacerProvider.useDefaultPacerOptions;
6
- exports.usePacerContext = require_PacerProvider.usePacerContext;
@@ -1,2 +0,0 @@
1
- import { PacerProvider, PacerProviderOptions, PacerProviderProps, useDefaultPacerOptions, usePacerContext } from "./PacerProvider.cjs";
2
- export { PacerProvider, PacerProviderOptions, PacerProviderProps, useDefaultPacerOptions, usePacerContext };
@@ -1,129 +0,0 @@
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 reactive updates,
23
- * optimizing performance by preventing unnecessary updates 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 updates and gives you
27
- * full control over when your component tracks state changes. Only when you provide a selector will the
28
- * component track changes to the selected state values.
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 track queue contents changes (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 track 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 track execution metrics changes (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
@@ -1 +0,0 @@
1
- {"version":3,"file":"createQueuedSignal.cjs","names":["createQueuer"],"sources":["../../src/queuer/createQueuedSignal.ts"],"sourcesContent":["import { createQueuer } from './createQueuer'\nimport type { SolidQueuer, SolidQueuerOptions } from './createQueuer'\nimport type { 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 reactive updates,\n * optimizing performance by preventing unnecessary updates 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 updates and gives you\n * full control over when your component tracks state changes. Only when you provide a selector will the\n * component track changes to the selected state values.\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 track queue contents changes (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 track 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 track execution metrics changes (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: SolidQueuerOptions<TValue, TSelected> = {},\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,UAAiD,CAAC,GAClD,YAAuD,WACpD,EAAE,OAAO,MAAM,MAAM,IAKxB;CACA,MAAM,QAAQA,kCAAa,IAAI,SAAS,QAAQ;CAEhD,OAAO;QAAO,MAAM,MAAM,CAAC,CAAC;EAAO,MAAM;EAAS;CAAK;AACzD"}
@@ -1,121 +0,0 @@
1
- import { SolidQueuer, SolidQueuerOptions } from "./createQueuer.cjs";
2
- import { QueuerState } from "@tanstack/pacer/queuer";
3
- //#region src/queuer/createQueuedSignal.d.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 reactive updates,
23
- * optimizing performance by preventing unnecessary updates 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 updates and gives you
27
- * full control over when your component tracks state changes. Only when you provide a selector will the
28
- * component track changes to the selected state values.
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 track queue contents changes (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 track 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 track execution metrics changes (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
- declare function createQueuedSignal<TValue, TSelected extends Pick<QueuerState<TValue>, 'items'> = Pick<QueuerState<TValue>, 'items'>>(fn: (item: TValue) => void, options?: SolidQueuerOptions<TValue, TSelected>, selector?: (state: QueuerState<TValue>) => TSelected): [() => Array<TValue>, SolidQueuer<TValue, TSelected>['addItem'], SolidQueuer<TValue, TSelected>];
119
- //#endregion
120
- export { createQueuedSignal };
121
- //# sourceMappingURL=createQueuedSignal.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createQueuedSignal.js","names":[],"sources":["../../src/queuer/createQueuedSignal.ts"],"sourcesContent":["import { createQueuer } from './createQueuer'\nimport type { SolidQueuer, SolidQueuerOptions } from './createQueuer'\nimport type { 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 reactive updates,\n * optimizing performance by preventing unnecessary updates 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 updates and gives you\n * full control over when your component tracks state changes. Only when you provide a selector will the\n * component track changes to the selected state values.\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 track queue contents changes (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 track 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 track execution metrics changes (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: SolidQueuerOptions<TValue, TSelected> = {},\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,UAAiD,CAAC,GAClD,YAAuD,WACpD,EAAE,OAAO,MAAM,MAAM,IAKxB;CACA,MAAM,QAAQ,aAAa,IAAI,SAAS,QAAQ;CAEhD,OAAO;QAAO,MAAM,MAAM,CAAC,CAAC;EAAO,MAAM;EAAS;CAAK;AACzD"}
@@ -1,133 +0,0 @@
1
- const require_PacerProvider = require('../provider/PacerProvider.cjs');
2
- let solid_js = require("solid-js");
3
- let _tanstack_solid_store = require("@tanstack/solid-store");
4
- let _tanstack_pacer_queuer = require("@tanstack/pacer/queuer");
5
-
6
- //#region src/queuer/createQueuer.ts
7
- /**
8
- * Creates a Solid-compatible Queuer instance for managing a synchronous queue of items, exposing Solid signals for all stateful properties.
9
- *
10
- * Features:
11
- * - Synchronous processing of items using the provided `fn` function
12
- * - FIFO (First In First Out) or LIFO (Last In First Out) queue behavior
13
- * - Priority queueing via `getPriority` or item `priority` property
14
- * - Item expiration and removal of stale items
15
- * - Configurable wait time between processing items
16
- * - Pause/resume processing
17
- * - Callbacks for queue state changes, execution, rejection, and expiration
18
- * - All stateful properties (items, counts, etc.) are exposed as Solid signals for reactivity
19
- *
20
- * 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()`.
21
- *
22
- * 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.
23
- *
24
- * ## State Management and Selector
25
- *
26
- * The hook uses TanStack Store for reactive state management. You can subscribe to state changes
27
- * in two ways:
28
- *
29
- * **1. Using `queuer.Subscribe` component (Recommended for component tree subscriptions)**
30
- *
31
- * Use the `Subscribe` component to subscribe to state changes deep in your component tree without
32
- * needing to pass a selector to the hook. This is ideal when you want to subscribe to state
33
- * in child components.
34
- *
35
- * **2. Using the `selector` parameter (For hook-level subscriptions)**
36
- *
37
- * The `selector` parameter allows you to specify which state changes will trigger reactive updates
38
- * at the hook level, optimizing performance by preventing unnecessary updates when irrelevant
39
- * state changes occur.
40
- *
41
- * **By default, there will be no reactive state subscriptions** and you must opt-in to state
42
- * tracking by providing a selector function or using the `Subscribe` component. This prevents unnecessary
43
- * updates and gives you full control over when your component tracks state changes.
44
- *
45
- * Available state properties:
46
- * - `executionCount`: Number of items that have been processed
47
- * - `isRunning`: Whether the queuer is currently running (not stopped)
48
- * - `items`: Array of items currently queued for processing
49
- * - `rejectionCount`: Number of items that were rejected (expired or failed validation)
50
- *
51
- * ## Unmount behavior
52
- *
53
- * By default, the primitive stops the queuer when the owning component unmounts.
54
- * Use the `onUnmount` option to customize this. For example, to flush pending items instead:
55
- *
56
- * ```tsx
57
- * const queue = createQueuer(fn, {
58
- * started: true,
59
- * wait: 1000,
60
- * onUnmount: (q) => q.flush()
61
- * });
62
- * ```
63
- *
64
- * Example usage:
65
- * ```tsx
66
- * // Default behavior - no reactive state subscriptions
67
- * const queue = createQueuer(
68
- * (item) => {
69
- * // process item synchronously
70
- * console.log('Processing', item);
71
- * },
72
- * {
73
- * started: true, // Start processing immediately
74
- * wait: 1000, // Process one item every second
75
- * getPriority: (item) => item.priority // Process higher priority items first
76
- * }
77
- * );
78
- *
79
- * // Opt-in to track items or isRunning changes (optimized for UI updates)
80
- * const queue = createQueuer(
81
- * (item) => console.log('Processing', item),
82
- * { started: true, wait: 1000 },
83
- * (state) => ({ items: state.items, isRunning: state.isRunning })
84
- * );
85
- *
86
- * // Opt-in to track execution metrics changes (optimized for tracking progress)
87
- * const queue = createQueuer(
88
- * (item) => console.log('Processing', item),
89
- * { started: true, wait: 1000 },
90
- * (state) => ({
91
- * executionCount: state.executionCount,
92
- * rejectionCount: state.rejectionCount
93
- * })
94
- * );
95
- *
96
- * // Add items to process - they'll be handled automatically
97
- * queue.addItem('task1');
98
- * queue.addItem('task2');
99
- *
100
- * // Control the scheduler
101
- * queue.stop(); // Pause processing
102
- * queue.start(); // Resume processing
103
- *
104
- * // Access the selected state (will be empty object {} unless selector provided)
105
- * const { items, isRunning } = queue.state();
106
- * ```
107
- */
108
- function createQueuer(fn, options = {}, selector = () => ({})) {
109
- const mergedOptions = {
110
- ...require_PacerProvider.useDefaultPacerOptions().queuer,
111
- ...options
112
- };
113
- const queuer = new _tanstack_pacer_queuer.Queuer(fn, mergedOptions);
114
- queuer.Subscribe = function Subscribe(props) {
115
- const selected = (0, _tanstack_solid_store.useSelector)(queuer.store, props.selector, { compare: _tanstack_solid_store.shallow });
116
- return typeof props.children === "function" ? props.children(selected) : props.children;
117
- };
118
- const state = (0, _tanstack_solid_store.useSelector)(queuer.store, selector, { compare: _tanstack_solid_store.shallow });
119
- (0, solid_js.createEffect)(() => {
120
- (0, solid_js.onCleanup)(() => {
121
- if (mergedOptions.onUnmount) mergedOptions.onUnmount(queuer);
122
- else queuer.stop();
123
- });
124
- });
125
- return {
126
- ...queuer,
127
- state
128
- };
129
- }
130
-
131
- //#endregion
132
- exports.createQueuer = createQueuer;
133
- //# sourceMappingURL=createQueuer.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createQueuer.cjs","names":["useDefaultPacerOptions","Queuer","useSelector","shallow"],"sources":["../../src/queuer/createQueuer.ts"],"sourcesContent":["import { Queuer } from '@tanstack/pacer/queuer'\nimport { shallow, useSelector } from '@tanstack/solid-store'\nimport { createEffect, onCleanup } from 'solid-js'\nimport { useDefaultPacerOptions } from '../provider/PacerProvider'\nimport type { Store } from '@tanstack/solid-store'\nimport type { Accessor, JSX } from 'solid-js'\nimport type { QueuerOptions, QueuerState } from '@tanstack/pacer/queuer'\n\nexport interface SolidQueuerOptions<\n TValue,\n TSelected = {},\n> extends QueuerOptions<TValue> {\n /**\n * Optional callback invoked when the owning component unmounts. Receives the queuer instance.\n * When provided, replaces the default cleanup (stop); use it to call flush(), flushAsBatch(), stop(), add logging, etc.\n */\n onUnmount?: (queuer: SolidQueuer<TValue, TSelected>) => void\n}\n\nexport interface SolidQueuer<TValue, TSelected = {}> extends Omit<\n Queuer<TValue>,\n 'store'\n> {\n /**\n * A Solid component that allows you to subscribe to the queuer state.\n *\n * This is useful for tracking specific parts of the queuer state\n * deep in your component tree without needing to pass a selector to the hook.\n *\n * @example\n * <queuer.Subscribe selector={(state) => ({ size: state.size, isRunning: state.isRunning })}>\n * {(state) => (\n * <div>Queue: {state().size} items, {state().isRunning ? 'Processing' : 'Idle'}</div>\n * )}\n * </queuer.Subscribe>\n */\n Subscribe: <TSelected>(props: {\n selector: (state: QueuerState<TValue>) => TSelected\n children: ((state: Accessor<TSelected>) => JSX.Element) | JSX.Element\n }) => JSX.Element\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 `useSelector` hook internally.\n * Although, you can make the state reactive by using the `useSelector` 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. You can subscribe to state changes\n * in two ways:\n *\n * **1. Using `queuer.Subscribe` component (Recommended for component tree subscriptions)**\n *\n * Use the `Subscribe` component to subscribe to state changes deep in your component tree without\n * needing to pass a selector to the hook. This is ideal when you want to subscribe to state\n * in child components.\n *\n * **2. Using the `selector` parameter (For hook-level subscriptions)**\n *\n * The `selector` parameter allows you to specify which state changes will trigger reactive updates\n * at the hook level, optimizing performance by preventing unnecessary updates when irrelevant\n * 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 or using the `Subscribe` component. This prevents unnecessary\n * updates and gives you full control over when your component tracks state changes.\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 * ## Unmount behavior\n *\n * By default, the primitive stops the queuer when the owning component unmounts.\n * Use the `onUnmount` option to customize this. For example, to flush pending items instead:\n *\n * ```tsx\n * const queue = createQueuer(fn, {\n * started: true,\n * wait: 1000,\n * onUnmount: (q) => q.flush()\n * });\n * ```\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 track 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 track execution metrics changes (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 options: SolidQueuerOptions<TValue, TSelected> = {},\n selector: (state: QueuerState<TValue>) => TSelected = () => ({}) as TSelected,\n): SolidQueuer<TValue, TSelected> {\n const mergedOptions = {\n ...useDefaultPacerOptions().queuer,\n ...options,\n } as SolidQueuerOptions<TValue, TSelected>\n const queuer = new Queuer(fn, mergedOptions) as unknown as SolidQueuer<\n TValue,\n TSelected\n >\n\n queuer.Subscribe = function Subscribe<TSelected>(props: {\n selector: (state: QueuerState<TValue>) => TSelected\n children: ((state: Accessor<TSelected>) => JSX.Element) | JSX.Element\n }) {\n const selected = useSelector(queuer.store, props.selector, {\n compare: shallow,\n })\n\n return typeof props.children === 'function'\n ? props.children(selected)\n : props.children\n }\n\n const state = useSelector(queuer.store, selector, { compare: shallow })\n\n createEffect(() => {\n onCleanup(() => {\n if (mergedOptions.onUnmount) {\n mergedOptions.onUnmount(queuer)\n } else {\n queuer.stop()\n }\n })\n })\n\n return {\n ...queuer,\n state,\n } as SolidQueuer<TValue, TSelected> // omit `store` in favor of `state`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2JA,SAAgB,aACd,IACA,UAAiD,CAAC,GAClD,kBAA6D,CAAC,IAC9B;CAChC,MAAM,gBAAgB;EACpB,GAAGA,6CAAuB,CAAC,CAAC;EAC5B,GAAG;CACL;CACA,MAAM,SAAS,IAAIC,8BAAO,IAAI,aAAa;CAK3C,OAAO,YAAY,SAAS,UAAqB,OAG9C;EACD,MAAM,eAAWC,mCAAY,OAAO,OAAO,MAAM,UAAU,EACzD,SAASC,8BACX,CAAC;EAED,OAAO,OAAO,MAAM,aAAa,aAC7B,MAAM,SAAS,QAAQ,IACvB,MAAM;CACZ;CAEA,MAAM,YAAQD,mCAAY,OAAO,OAAO,UAAU,EAAE,SAASC,8BAAQ,CAAC;CAEtE,iCAAmB;EACjB,8BAAgB;GACd,IAAI,cAAc,WAChB,cAAc,UAAU,MAAM;QAE9B,OAAO,KAAK;EAEhB,CAAC;CACH,CAAC;CAED,OAAO;EACL,GAAG;EACH;CACF;AACF"}