@tanstack/angular-pacer 0.21.0 → 0.22.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 (27) hide show
  1. package/README.md +7 -7
  2. package/dist/async-queuer/injectAsyncQueuedSignal.cjs.map +1 -1
  3. package/dist/async-queuer/injectAsyncQueuedSignal.d.cts +5 -10
  4. package/dist/async-queuer/injectAsyncQueuedSignal.d.ts +5 -10
  5. package/dist/async-queuer/injectAsyncQueuedSignal.js.map +1 -1
  6. package/dist/debouncer/injectDebouncedSignal.cjs.map +1 -1
  7. package/dist/debouncer/injectDebouncedSignal.d.cts +5 -10
  8. package/dist/debouncer/injectDebouncedSignal.d.ts +5 -10
  9. package/dist/debouncer/injectDebouncedSignal.js.map +1 -1
  10. package/dist/queuer/injectQueuedSignal.cjs.map +1 -1
  11. package/dist/queuer/injectQueuedSignal.d.cts +5 -10
  12. package/dist/queuer/injectQueuedSignal.d.ts +5 -10
  13. package/dist/queuer/injectQueuedSignal.js.map +1 -1
  14. package/dist/rate-limiter/injectRateLimitedSignal.cjs.map +1 -1
  15. package/dist/rate-limiter/injectRateLimitedSignal.d.cts +5 -10
  16. package/dist/rate-limiter/injectRateLimitedSignal.d.ts +5 -10
  17. package/dist/rate-limiter/injectRateLimitedSignal.js.map +1 -1
  18. package/dist/throttler/injectThrottledSignal.cjs.map +1 -1
  19. package/dist/throttler/injectThrottledSignal.d.cts +5 -10
  20. package/dist/throttler/injectThrottledSignal.d.ts +5 -10
  21. package/dist/throttler/injectThrottledSignal.js.map +1 -1
  22. package/package.json +5 -5
  23. package/src/async-queuer/injectAsyncQueuedSignal.ts +4 -12
  24. package/src/debouncer/injectDebouncedSignal.ts +4 -11
  25. package/src/queuer/injectQueuedSignal.ts +4 -9
  26. package/src/rate-limiter/injectRateLimitedSignal.ts +4 -11
  27. package/src/throttler/injectThrottledSignal.ts +4 -11
package/README.md CHANGED
@@ -106,21 +106,21 @@ A lightweight timing and scheduling library for debouncing, throttling, rate lim
106
106
 
107
107
  <table align="center">
108
108
  <tr>
109
- <td>
109
+ <td>
110
110
  <a href="https://www.coderabbit.ai/?via=tanstack&dub_id=aCcEEdAOqqutX6OS" >
111
111
  <picture>
112
- <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/coderabbit-dark-CMcuvjEy.svg" height="40" />
113
- <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/coderabbit-light-DVMJ2jHi.svg" height="40" />
114
- <img src="https://tanstack.com/assets/coderabbit-light-DVMJ2jHi.svg" height="40" alt="CodeRabbit" />
112
+ <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/coderabbit-dark-D643Zkrv.svg" />
113
+ <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/coderabbit-light-CIzGLYU_.svg" />
114
+ <img src="https://tanstack.com/assets/coderabbit-light-CIzGLYU_.svg" height="40" alt="CodeRabbit" />
115
115
  </picture>
116
116
  </a>
117
117
  </td>
118
118
  <td>
119
119
  <a href="https://www.cloudflare.com?utm_source=tanstack">
120
120
  <picture>
121
- <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/cloudflare-white-DQDB7UaL.svg" height="60" />
122
- <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/cloudflare-black-CPufaW0B.svg" height="60" />
123
- <img src="https://tanstack.com/assets/cloudflare-black-CPufaW0B.svg" height="60" alt="Cloudflare" />
121
+ <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/cloudflare-white-Co-Tyjbl.svg" />
122
+ <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/cloudflare-black-6Ojsn8yh.svg" />
123
+ <img src="https://tanstack.com/assets/cloudflare-white-Co-Tyjbl.svg" height="60" alt="Cloudflare" />
124
124
  </picture>
125
125
  </a>
126
126
  </td>
@@ -1 +1 @@
1
- {"version":3,"file":"injectAsyncQueuedSignal.cjs","names":["injectAsyncQueuer"],"sources":["../../src/async-queuer/injectAsyncQueuedSignal.ts"],"sourcesContent":["import { computed } from '@angular/core'\nimport { injectAsyncQueuer } from './injectAsyncQueuer'\nimport type { AngularAsyncQueuer } from './injectAsyncQueuer'\nimport type {\n AsyncQueuerOptions,\n AsyncQueuerState,\n} from '@tanstack/pacer/async-queuer'\n\nexport type AsyncQueuedSignal<\n TValue,\n TSelected = {},\n> = (() => Array<TValue>) & {\n /**\n * Add an item to the queue.\n */\n readonly addItem: AngularAsyncQueuer<TValue, TSelected>['addItem']\n /**\n * The queuer instance with additional control methods and state signals.\n */\n readonly queuer: AngularAsyncQueuer<TValue, TSelected>\n}\n\n/**\n * An Angular function that creates an async queuer with managed state, combining Angular's signals with async queuing functionality.\n * This function provides both the current queue state and queue control methods.\n *\n * The queue state is automatically updated whenever items are added, removed, or processed in the queue.\n * All queue operations are reflected in the state array returned by the function.\n *\n * The function returns a callable object:\n * - `queued()`: Get the current queue items as an array\n * - `queued.addItem(...)`: Add an item to the queue\n * - `queued.queue`: The queuer instance with additional control methods\n *\n * @example\n * ```ts\n * // Default behavior - track items\n * const queued = injectAsyncQueuedSignal(\n * async (item) => {\n * const response = await fetch('/api/process', {\n * method: 'POST',\n * body: JSON.stringify(item)\n * });\n * return response.json();\n * },\n * { concurrency: 2, wait: 1000 }\n * );\n *\n * // Add items\n * queued.addItem(data1);\n *\n * // Access items\n * console.log(queued()); // [data1, ...]\n *\n * // Control the queue\n * queued.queuer.start();\n * queued.queuer.stop();\n * ```\n */\nexport function injectAsyncQueuedSignal<\n TValue,\n TSelected extends Pick<AsyncQueuerState<TValue>, 'items'> = Pick<\n AsyncQueuerState<TValue>,\n 'items'\n >,\n>(\n fn: (value: TValue) => Promise<any>,\n options: AsyncQueuerOptions<TValue> = {},\n selector: (state: AsyncQueuerState<TValue>) => TSelected = (state) =>\n ({ items: state.items }) as TSelected,\n): AsyncQueuedSignal<TValue, TSelected> {\n const queuer = injectAsyncQueuer(fn, options, selector)\n\n const items = computed(() => queuer.state().items as Array<TValue>)\n\n const queued = Object.assign(items, {\n addItem: queuer.addItem.bind(queuer),\n queuer,\n }) as AsyncQueuedSignal<TValue, TSelected>\n\n return queued\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgB,wBAOd,IACA,UAAsC,EAAE,EACxC,YAA4D,WACzD,EAAE,OAAO,MAAM,OAAO,GACa;CACtC,MAAM,SAASA,4CAAkB,IAAI,SAAS,SAAS;CAEvD,MAAM,0CAAuB,OAAO,OAAO,CAAC,MAAuB;AAOnE,QALe,OAAO,OAAO,OAAO;EAClC,SAAS,OAAO,QAAQ,KAAK,OAAO;EACpC;EACD,CAAC"}
1
+ {"version":3,"file":"injectAsyncQueuedSignal.cjs","names":["injectAsyncQueuer"],"sources":["../../src/async-queuer/injectAsyncQueuedSignal.ts"],"sourcesContent":["import { computed } from '@angular/core'\nimport { injectAsyncQueuer } from './injectAsyncQueuer'\nimport type { AngularAsyncQueuer } from './injectAsyncQueuer'\nimport type {\n AsyncQueuerOptions,\n AsyncQueuerState,\n} from '@tanstack/pacer/async-queuer'\n\nexport interface AsyncQueuedSignal<TValue, TSelected = {}> {\n (): Array<TValue>\n addItem: AngularAsyncQueuer<TValue, TSelected>['addItem']\n queuer: AngularAsyncQueuer<TValue, TSelected>\n}\n\n/**\n * An Angular function that creates an async queuer with managed state, combining Angular's signals with async queuing functionality.\n * This function provides both the current queue state and queue control methods.\n *\n * The queue state is automatically updated whenever items are added, removed, or processed in the queue.\n * All queue operations are reflected in the state array returned by the function.\n *\n * The function returns a callable object:\n * - `queued()`: Get the current queue items as an array\n * - `queued.addItem(...)`: Add an item to the queue\n * - `queued.queue`: The queuer instance with additional control methods\n *\n * @example\n * ```ts\n * // Default behavior - track items\n * const queued = injectAsyncQueuedSignal(\n * async (item) => {\n * const response = await fetch('/api/process', {\n * method: 'POST',\n * body: JSON.stringify(item)\n * });\n * return response.json();\n * },\n * { concurrency: 2, wait: 1000 }\n * );\n *\n * // Add items\n * queued.addItem(data1);\n *\n * // Access items\n * console.log(queued()); // [data1, ...]\n *\n * // Control the queue\n * queued.queuer.start();\n * queued.queuer.stop();\n * ```\n */\nexport function injectAsyncQueuedSignal<\n TValue,\n TSelected extends Pick<AsyncQueuerState<TValue>, 'items'> = Pick<\n AsyncQueuerState<TValue>,\n 'items'\n >,\n>(\n fn: (value: TValue) => Promise<any>,\n options: AsyncQueuerOptions<TValue> = {},\n selector: (state: AsyncQueuerState<TValue>) => TSelected = (state) =>\n ({ items: state.items }) as TSelected,\n): AsyncQueuedSignal<TValue, TSelected> {\n const queuer = injectAsyncQueuer(fn, options, selector)\n\n const items = computed(() => queuer.state().items as Array<TValue>)\n\n const queued = Object.assign(items, {\n addItem: queuer.addItem.bind(queuer),\n queuer,\n }) as AsyncQueuedSignal<TValue, TSelected>\n\n return queued\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgB,wBAOd,IACA,UAAsC,EAAE,EACxC,YAA4D,WACzD,EAAE,OAAO,MAAM,OAAO,GACa;CACtC,MAAM,SAASA,4CAAkB,IAAI,SAAS,SAAS;CAEvD,MAAM,0CAAuB,OAAO,OAAO,CAAC,MAAuB;AAOnE,QALe,OAAO,OAAO,OAAO;EAClC,SAAS,OAAO,QAAQ,KAAK,OAAO;EACpC;EACD,CAAC"}
@@ -2,16 +2,11 @@ import { AngularAsyncQueuer } from "./injectAsyncQueuer.cjs";
2
2
  import { AsyncQueuerOptions, AsyncQueuerState } from "@tanstack/pacer/async-queuer";
3
3
 
4
4
  //#region src/async-queuer/injectAsyncQueuedSignal.d.ts
5
- type AsyncQueuedSignal<TValue, TSelected = {}> = (() => Array<TValue>) & {
6
- /**
7
- * Add an item to the queue.
8
- */
9
- readonly addItem: AngularAsyncQueuer<TValue, TSelected>['addItem'];
10
- /**
11
- * The queuer instance with additional control methods and state signals.
12
- */
13
- readonly queuer: AngularAsyncQueuer<TValue, TSelected>;
14
- };
5
+ interface AsyncQueuedSignal<TValue, TSelected = {}> {
6
+ (): Array<TValue>;
7
+ addItem: AngularAsyncQueuer<TValue, TSelected>['addItem'];
8
+ queuer: AngularAsyncQueuer<TValue, TSelected>;
9
+ }
15
10
  /**
16
11
  * An Angular function that creates an async queuer with managed state, combining Angular's signals with async queuing functionality.
17
12
  * This function provides both the current queue state and queue control methods.
@@ -2,16 +2,11 @@ import { AngularAsyncQueuer } from "./injectAsyncQueuer.js";
2
2
  import { AsyncQueuerOptions, AsyncQueuerState } from "@tanstack/pacer/async-queuer";
3
3
 
4
4
  //#region src/async-queuer/injectAsyncQueuedSignal.d.ts
5
- type AsyncQueuedSignal<TValue, TSelected = {}> = (() => Array<TValue>) & {
6
- /**
7
- * Add an item to the queue.
8
- */
9
- readonly addItem: AngularAsyncQueuer<TValue, TSelected>['addItem'];
10
- /**
11
- * The queuer instance with additional control methods and state signals.
12
- */
13
- readonly queuer: AngularAsyncQueuer<TValue, TSelected>;
14
- };
5
+ interface AsyncQueuedSignal<TValue, TSelected = {}> {
6
+ (): Array<TValue>;
7
+ addItem: AngularAsyncQueuer<TValue, TSelected>['addItem'];
8
+ queuer: AngularAsyncQueuer<TValue, TSelected>;
9
+ }
15
10
  /**
16
11
  * An Angular function that creates an async queuer with managed state, combining Angular's signals with async queuing functionality.
17
12
  * This function provides both the current queue state and queue control methods.
@@ -1 +1 @@
1
- {"version":3,"file":"injectAsyncQueuedSignal.js","names":[],"sources":["../../src/async-queuer/injectAsyncQueuedSignal.ts"],"sourcesContent":["import { computed } from '@angular/core'\nimport { injectAsyncQueuer } from './injectAsyncQueuer'\nimport type { AngularAsyncQueuer } from './injectAsyncQueuer'\nimport type {\n AsyncQueuerOptions,\n AsyncQueuerState,\n} from '@tanstack/pacer/async-queuer'\n\nexport type AsyncQueuedSignal<\n TValue,\n TSelected = {},\n> = (() => Array<TValue>) & {\n /**\n * Add an item to the queue.\n */\n readonly addItem: AngularAsyncQueuer<TValue, TSelected>['addItem']\n /**\n * The queuer instance with additional control methods and state signals.\n */\n readonly queuer: AngularAsyncQueuer<TValue, TSelected>\n}\n\n/**\n * An Angular function that creates an async queuer with managed state, combining Angular's signals with async queuing functionality.\n * This function provides both the current queue state and queue control methods.\n *\n * The queue state is automatically updated whenever items are added, removed, or processed in the queue.\n * All queue operations are reflected in the state array returned by the function.\n *\n * The function returns a callable object:\n * - `queued()`: Get the current queue items as an array\n * - `queued.addItem(...)`: Add an item to the queue\n * - `queued.queue`: The queuer instance with additional control methods\n *\n * @example\n * ```ts\n * // Default behavior - track items\n * const queued = injectAsyncQueuedSignal(\n * async (item) => {\n * const response = await fetch('/api/process', {\n * method: 'POST',\n * body: JSON.stringify(item)\n * });\n * return response.json();\n * },\n * { concurrency: 2, wait: 1000 }\n * );\n *\n * // Add items\n * queued.addItem(data1);\n *\n * // Access items\n * console.log(queued()); // [data1, ...]\n *\n * // Control the queue\n * queued.queuer.start();\n * queued.queuer.stop();\n * ```\n */\nexport function injectAsyncQueuedSignal<\n TValue,\n TSelected extends Pick<AsyncQueuerState<TValue>, 'items'> = Pick<\n AsyncQueuerState<TValue>,\n 'items'\n >,\n>(\n fn: (value: TValue) => Promise<any>,\n options: AsyncQueuerOptions<TValue> = {},\n selector: (state: AsyncQueuerState<TValue>) => TSelected = (state) =>\n ({ items: state.items }) as TSelected,\n): AsyncQueuedSignal<TValue, TSelected> {\n const queuer = injectAsyncQueuer(fn, options, selector)\n\n const items = computed(() => queuer.state().items as Array<TValue>)\n\n const queued = Object.assign(items, {\n addItem: queuer.addItem.bind(queuer),\n queuer,\n }) as AsyncQueuedSignal<TValue, TSelected>\n\n return queued\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgB,wBAOd,IACA,UAAsC,EAAE,EACxC,YAA4D,WACzD,EAAE,OAAO,MAAM,OAAO,GACa;CACtC,MAAM,SAAS,kBAAkB,IAAI,SAAS,SAAS;CAEvD,MAAM,QAAQ,eAAe,OAAO,OAAO,CAAC,MAAuB;AAOnE,QALe,OAAO,OAAO,OAAO;EAClC,SAAS,OAAO,QAAQ,KAAK,OAAO;EACpC;EACD,CAAC"}
1
+ {"version":3,"file":"injectAsyncQueuedSignal.js","names":[],"sources":["../../src/async-queuer/injectAsyncQueuedSignal.ts"],"sourcesContent":["import { computed } from '@angular/core'\nimport { injectAsyncQueuer } from './injectAsyncQueuer'\nimport type { AngularAsyncQueuer } from './injectAsyncQueuer'\nimport type {\n AsyncQueuerOptions,\n AsyncQueuerState,\n} from '@tanstack/pacer/async-queuer'\n\nexport interface AsyncQueuedSignal<TValue, TSelected = {}> {\n (): Array<TValue>\n addItem: AngularAsyncQueuer<TValue, TSelected>['addItem']\n queuer: AngularAsyncQueuer<TValue, TSelected>\n}\n\n/**\n * An Angular function that creates an async queuer with managed state, combining Angular's signals with async queuing functionality.\n * This function provides both the current queue state and queue control methods.\n *\n * The queue state is automatically updated whenever items are added, removed, or processed in the queue.\n * All queue operations are reflected in the state array returned by the function.\n *\n * The function returns a callable object:\n * - `queued()`: Get the current queue items as an array\n * - `queued.addItem(...)`: Add an item to the queue\n * - `queued.queue`: The queuer instance with additional control methods\n *\n * @example\n * ```ts\n * // Default behavior - track items\n * const queued = injectAsyncQueuedSignal(\n * async (item) => {\n * const response = await fetch('/api/process', {\n * method: 'POST',\n * body: JSON.stringify(item)\n * });\n * return response.json();\n * },\n * { concurrency: 2, wait: 1000 }\n * );\n *\n * // Add items\n * queued.addItem(data1);\n *\n * // Access items\n * console.log(queued()); // [data1, ...]\n *\n * // Control the queue\n * queued.queuer.start();\n * queued.queuer.stop();\n * ```\n */\nexport function injectAsyncQueuedSignal<\n TValue,\n TSelected extends Pick<AsyncQueuerState<TValue>, 'items'> = Pick<\n AsyncQueuerState<TValue>,\n 'items'\n >,\n>(\n fn: (value: TValue) => Promise<any>,\n options: AsyncQueuerOptions<TValue> = {},\n selector: (state: AsyncQueuerState<TValue>) => TSelected = (state) =>\n ({ items: state.items }) as TSelected,\n): AsyncQueuedSignal<TValue, TSelected> {\n const queuer = injectAsyncQueuer(fn, options, selector)\n\n const items = computed(() => queuer.state().items as Array<TValue>)\n\n const queued = Object.assign(items, {\n addItem: queuer.addItem.bind(queuer),\n queuer,\n }) as AsyncQueuedSignal<TValue, TSelected>\n\n return queued\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgB,wBAOd,IACA,UAAsC,EAAE,EACxC,YAA4D,WACzD,EAAE,OAAO,MAAM,OAAO,GACa;CACtC,MAAM,SAAS,kBAAkB,IAAI,SAAS,SAAS;CAEvD,MAAM,QAAQ,eAAe,OAAO,OAAO,CAAC,MAAuB;AAOnE,QALe,OAAO,OAAO,OAAO;EAClC,SAAS,OAAO,QAAQ,KAAK,OAAO;EACpC;EACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"injectDebouncedSignal.cjs","names":["injectDebouncer"],"sources":["../../src/debouncer/injectDebouncedSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectDebouncer } from './injectDebouncer'\nimport type { AngularDebouncer } from './injectDebouncer'\nimport type {\n DebouncerOptions,\n DebouncerState,\n} from '@tanstack/pacer/debouncer'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport type DebouncedSignal<TValue, TSelected = {}> = ((\n ...args: []\n) => TValue) & {\n /**\n * Set or update the debounced value. This calls `debouncer.maybeExecute(...)`.\n */\n readonly set: Setter<TValue>\n /**\n * The debouncer instance with additional control methods and state signals.\n */\n readonly debouncer: AngularDebouncer<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a debounced state signal, combining Angular's signal with debouncing functionality.\n * This function provides both the current debounced value and methods to update it.\n *\n * The state value is only updated after the specified wait time has elapsed since the last update attempt.\n * If another update is attempted before the wait time expires, the timer resets and starts waiting again.\n * This is useful for handling frequent state updates that should be throttled, like search input values\n * or window resize dimensions.\n *\n * The function returns a callable object:\n * - `debounced()`: Get the current debounced value\n * - `debounced.set(...)`: Set or update the debounced value (debounced via maybeExecute)\n * - `debounced.debouncer`: The debouncer instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying debouncer instance.\n * The `selector` parameter allows you to specify which debouncer state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes. Only when you provide a selector will\n * the reactive system track the selected state values.\n *\n * Available debouncer state properties:\n * - `canLeadingExecute`: Whether the debouncer can execute on the leading edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```ts\n * const debouncedQuery = injectDebouncedSignal('', { wait: 500 })\n *\n * // Get value\n * console.log(debouncedQuery())\n *\n * // Set/update value (debounced)\n * debouncedQuery.set('hello')\n *\n * // Access debouncer\n * console.log(debouncedQuery.debouncer.state().isPending)\n * ```\n */\nexport function injectDebouncedSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: DebouncerOptions<Setter<TValue>>,\n selector?: (state: DebouncerState<Setter<TValue>>) => TSelected,\n): DebouncedSignal<TValue, TSelected> {\n const debouncedValue = signal<TValue>(value)\n\n const debouncer = injectDebouncer(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n debouncedValue.update(newValue as (prev: TValue) => TValue)\n } else {\n debouncedValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n debouncer.maybeExecute(newValue)\n }\n\n const debounced = Object.assign(() => debouncedValue(), {\n set,\n debouncer,\n }) as DebouncedSignal<TValue, TSelected>\n\n return debounced\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,SAAgB,sBACd,OACA,gBACA,UACoC;CACpC,MAAM,2CAAgC,MAAM;CAE5C,MAAM,YAAYA,yCACf,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,gBAAe,OAAO,SAAqC;MAE3D,gBAAe,IAAI,SAAS;IAGhC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,YAAU,aAAa,SAAS;;AAQlC,QALkB,OAAO,aAAa,gBAAgB,EAAE;EACtD;EACA;EACD,CAAC"}
1
+ {"version":3,"file":"injectDebouncedSignal.cjs","names":["injectDebouncer"],"sources":["../../src/debouncer/injectDebouncedSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectDebouncer } from './injectDebouncer'\nimport type { AngularDebouncer } from './injectDebouncer'\nimport type {\n DebouncerOptions,\n DebouncerState,\n} from '@tanstack/pacer/debouncer'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport interface DebouncedSignal<TValue, TSelected = {}> {\n (): TValue\n set: Setter<TValue>\n debouncer: AngularDebouncer<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a debounced state signal, combining Angular's signal with debouncing functionality.\n * This function provides both the current debounced value and methods to update it.\n *\n * The state value is only updated after the specified wait time has elapsed since the last update attempt.\n * If another update is attempted before the wait time expires, the timer resets and starts waiting again.\n * This is useful for handling frequent state updates that should be throttled, like search input values\n * or window resize dimensions.\n *\n * The function returns a callable object:\n * - `debounced()`: Get the current debounced value\n * - `debounced.set(...)`: Set or update the debounced value (debounced via maybeExecute)\n * - `debounced.debouncer`: The debouncer instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying debouncer instance.\n * The `selector` parameter allows you to specify which debouncer state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes. Only when you provide a selector will\n * the reactive system track the selected state values.\n *\n * Available debouncer state properties:\n * - `canLeadingExecute`: Whether the debouncer can execute on the leading edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```ts\n * const debouncedQuery = injectDebouncedSignal('', { wait: 500 })\n *\n * // Get value\n * console.log(debouncedQuery())\n *\n * // Set/update value (debounced)\n * debouncedQuery.set('hello')\n *\n * // Access debouncer\n * console.log(debouncedQuery.debouncer.state().isPending)\n * ```\n */\nexport function injectDebouncedSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: DebouncerOptions<Setter<TValue>>,\n selector?: (state: DebouncerState<Setter<TValue>>) => TSelected,\n): DebouncedSignal<TValue, TSelected> {\n const debouncedValue = signal<TValue>(value)\n\n const debouncer = injectDebouncer(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n debouncedValue.update(newValue as (prev: TValue) => TValue)\n } else {\n debouncedValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n debouncer.maybeExecute(newValue)\n }\n\n const debounced = Object.assign(() => debouncedValue(), {\n set,\n debouncer,\n }) as DebouncedSignal<TValue, TSelected>\n\n return debounced\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,sBACd,OACA,gBACA,UACoC;CACpC,MAAM,2CAAgC,MAAM;CAE5C,MAAM,YAAYA,yCACf,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,gBAAe,OAAO,SAAqC;MAE3D,gBAAe,IAAI,SAAS;IAGhC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,YAAU,aAAa,SAAS;;AAQlC,QALkB,OAAO,aAAa,gBAAgB,EAAE;EACtD;EACA;EACD,CAAC"}
@@ -3,16 +3,11 @@ import { DebouncerOptions, DebouncerState } from "@tanstack/pacer/debouncer";
3
3
 
4
4
  //#region src/debouncer/injectDebouncedSignal.d.ts
5
5
  type Setter<T> = (value: T | ((prev: T) => T)) => void;
6
- type DebouncedSignal<TValue, TSelected = {}> = ((...args: []) => TValue) & {
7
- /**
8
- * Set or update the debounced value. This calls `debouncer.maybeExecute(...)`.
9
- */
10
- readonly set: Setter<TValue>;
11
- /**
12
- * The debouncer instance with additional control methods and state signals.
13
- */
14
- readonly debouncer: AngularDebouncer<Setter<TValue>, TSelected>;
15
- };
6
+ interface DebouncedSignal<TValue, TSelected = {}> {
7
+ (): TValue;
8
+ set: Setter<TValue>;
9
+ debouncer: AngularDebouncer<Setter<TValue>, TSelected>;
10
+ }
16
11
  /**
17
12
  * An Angular function that creates a debounced state signal, combining Angular's signal with debouncing functionality.
18
13
  * This function provides both the current debounced value and methods to update it.
@@ -3,16 +3,11 @@ import { DebouncerOptions, DebouncerState } from "@tanstack/pacer/debouncer";
3
3
 
4
4
  //#region src/debouncer/injectDebouncedSignal.d.ts
5
5
  type Setter<T> = (value: T | ((prev: T) => T)) => void;
6
- type DebouncedSignal<TValue, TSelected = {}> = ((...args: []) => TValue) & {
7
- /**
8
- * Set or update the debounced value. This calls `debouncer.maybeExecute(...)`.
9
- */
10
- readonly set: Setter<TValue>;
11
- /**
12
- * The debouncer instance with additional control methods and state signals.
13
- */
14
- readonly debouncer: AngularDebouncer<Setter<TValue>, TSelected>;
15
- };
6
+ interface DebouncedSignal<TValue, TSelected = {}> {
7
+ (): TValue;
8
+ set: Setter<TValue>;
9
+ debouncer: AngularDebouncer<Setter<TValue>, TSelected>;
10
+ }
16
11
  /**
17
12
  * An Angular function that creates a debounced state signal, combining Angular's signal with debouncing functionality.
18
13
  * This function provides both the current debounced value and methods to update it.
@@ -1 +1 @@
1
- {"version":3,"file":"injectDebouncedSignal.js","names":[],"sources":["../../src/debouncer/injectDebouncedSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectDebouncer } from './injectDebouncer'\nimport type { AngularDebouncer } from './injectDebouncer'\nimport type {\n DebouncerOptions,\n DebouncerState,\n} from '@tanstack/pacer/debouncer'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport type DebouncedSignal<TValue, TSelected = {}> = ((\n ...args: []\n) => TValue) & {\n /**\n * Set or update the debounced value. This calls `debouncer.maybeExecute(...)`.\n */\n readonly set: Setter<TValue>\n /**\n * The debouncer instance with additional control methods and state signals.\n */\n readonly debouncer: AngularDebouncer<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a debounced state signal, combining Angular's signal with debouncing functionality.\n * This function provides both the current debounced value and methods to update it.\n *\n * The state value is only updated after the specified wait time has elapsed since the last update attempt.\n * If another update is attempted before the wait time expires, the timer resets and starts waiting again.\n * This is useful for handling frequent state updates that should be throttled, like search input values\n * or window resize dimensions.\n *\n * The function returns a callable object:\n * - `debounced()`: Get the current debounced value\n * - `debounced.set(...)`: Set or update the debounced value (debounced via maybeExecute)\n * - `debounced.debouncer`: The debouncer instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying debouncer instance.\n * The `selector` parameter allows you to specify which debouncer state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes. Only when you provide a selector will\n * the reactive system track the selected state values.\n *\n * Available debouncer state properties:\n * - `canLeadingExecute`: Whether the debouncer can execute on the leading edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```ts\n * const debouncedQuery = injectDebouncedSignal('', { wait: 500 })\n *\n * // Get value\n * console.log(debouncedQuery())\n *\n * // Set/update value (debounced)\n * debouncedQuery.set('hello')\n *\n * // Access debouncer\n * console.log(debouncedQuery.debouncer.state().isPending)\n * ```\n */\nexport function injectDebouncedSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: DebouncerOptions<Setter<TValue>>,\n selector?: (state: DebouncerState<Setter<TValue>>) => TSelected,\n): DebouncedSignal<TValue, TSelected> {\n const debouncedValue = signal<TValue>(value)\n\n const debouncer = injectDebouncer(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n debouncedValue.update(newValue as (prev: TValue) => TValue)\n } else {\n debouncedValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n debouncer.maybeExecute(newValue)\n }\n\n const debounced = Object.assign(() => debouncedValue(), {\n set,\n debouncer,\n }) as DebouncedSignal<TValue, TSelected>\n\n return debounced\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,SAAgB,sBACd,OACA,gBACA,UACoC;CACpC,MAAM,iBAAiB,OAAe,MAAM;CAE5C,MAAM,YAAY,iBACf,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,gBAAe,OAAO,SAAqC;MAE3D,gBAAe,IAAI,SAAS;IAGhC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,YAAU,aAAa,SAAS;;AAQlC,QALkB,OAAO,aAAa,gBAAgB,EAAE;EACtD;EACA;EACD,CAAC"}
1
+ {"version":3,"file":"injectDebouncedSignal.js","names":[],"sources":["../../src/debouncer/injectDebouncedSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectDebouncer } from './injectDebouncer'\nimport type { AngularDebouncer } from './injectDebouncer'\nimport type {\n DebouncerOptions,\n DebouncerState,\n} from '@tanstack/pacer/debouncer'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport interface DebouncedSignal<TValue, TSelected = {}> {\n (): TValue\n set: Setter<TValue>\n debouncer: AngularDebouncer<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a debounced state signal, combining Angular's signal with debouncing functionality.\n * This function provides both the current debounced value and methods to update it.\n *\n * The state value is only updated after the specified wait time has elapsed since the last update attempt.\n * If another update is attempted before the wait time expires, the timer resets and starts waiting again.\n * This is useful for handling frequent state updates that should be throttled, like search input values\n * or window resize dimensions.\n *\n * The function returns a callable object:\n * - `debounced()`: Get the current debounced value\n * - `debounced.set(...)`: Set or update the debounced value (debounced via maybeExecute)\n * - `debounced.debouncer`: The debouncer instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying debouncer instance.\n * The `selector` parameter allows you to specify which debouncer state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes. Only when you provide a selector will\n * the reactive system track the selected state values.\n *\n * Available debouncer state properties:\n * - `canLeadingExecute`: Whether the debouncer can execute on the leading edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```ts\n * const debouncedQuery = injectDebouncedSignal('', { wait: 500 })\n *\n * // Get value\n * console.log(debouncedQuery())\n *\n * // Set/update value (debounced)\n * debouncedQuery.set('hello')\n *\n * // Access debouncer\n * console.log(debouncedQuery.debouncer.state().isPending)\n * ```\n */\nexport function injectDebouncedSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: DebouncerOptions<Setter<TValue>>,\n selector?: (state: DebouncerState<Setter<TValue>>) => TSelected,\n): DebouncedSignal<TValue, TSelected> {\n const debouncedValue = signal<TValue>(value)\n\n const debouncer = injectDebouncer(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n debouncedValue.update(newValue as (prev: TValue) => TValue)\n } else {\n debouncedValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n debouncer.maybeExecute(newValue)\n }\n\n const debounced = Object.assign(() => debouncedValue(), {\n set,\n debouncer,\n }) as DebouncedSignal<TValue, TSelected>\n\n return debounced\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,sBACd,OACA,gBACA,UACoC;CACpC,MAAM,iBAAiB,OAAe,MAAM;CAE5C,MAAM,YAAY,iBACf,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,gBAAe,OAAO,SAAqC;MAE3D,gBAAe,IAAI,SAAS;IAGhC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,YAAU,aAAa,SAAS;;AAQlC,QALkB,OAAO,aAAa,gBAAgB,EAAE;EACtD;EACA;EACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"injectQueuedSignal.cjs","names":["injectQueuer"],"sources":["../../src/queuer/injectQueuedSignal.ts"],"sourcesContent":["import { computed } from '@angular/core'\nimport { injectQueuer } from './injectQueuer'\nimport type { AngularQueuer } from './injectQueuer'\nimport type { QueuerOptions, QueuerState } from '@tanstack/pacer/queuer'\n\nexport type QueuedSignal<TValue, TSelected = {}> = (() => Array<TValue>) & {\n /**\n * Add an item to the queue.\n */\n readonly addItem: AngularQueuer<TValue, TSelected>['addItem']\n /**\n * The queuer instance with additional control methods and state signals.\n */\n readonly queuer: AngularQueuer<TValue, TSelected>\n}\n\n/**\n * An Angular function that creates a queuer with managed state, combining Angular's signals with queuing functionality.\n * This function 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 function.\n *\n * The function returns a callable object:\n * - `queued()`: Get the current queue items as an array\n * - `queued.addItem(...)`: Add an item to the queue\n * - `queued.queue`: The queuer instance with additional control methods\n *\n * @example\n * ```ts\n * // Default behavior - track items\n * const queued = injectQueuedSignal(\n * (item) => console.log('Processing:', item),\n * { started: true, wait: 1000 }\n * );\n *\n * // Add items\n * queued.addItem('task1');\n *\n * // Access items\n * console.log(queued()); // ['task1']\n *\n * // Control the queue\n * queued.queuer.start();\n * queued.queuer.stop();\n * ```\n */\nexport function injectQueuedSignal<\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): QueuedSignal<TValue, TSelected> {\n const queuer = injectQueuer(fn, options, selector)\n\n const items = computed(() => queuer.state().items as Array<TValue>)\n\n const queued = Object.assign(items, {\n addItem: queuer.addItem.bind(queuer),\n queuer,\n }) as QueuedSignal<TValue, TSelected>\n\n return queued\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,mBAOd,IACA,UAAiC,EAAE,EACnC,YAAuD,WACpD,EAAE,OAAO,MAAM,OAAO,GACQ;CACjC,MAAM,SAASA,kCAAa,IAAI,SAAS,SAAS;CAElD,MAAM,0CAAuB,OAAO,OAAO,CAAC,MAAuB;AAOnE,QALe,OAAO,OAAO,OAAO;EAClC,SAAS,OAAO,QAAQ,KAAK,OAAO;EACpC;EACD,CAAC"}
1
+ {"version":3,"file":"injectQueuedSignal.cjs","names":["injectQueuer"],"sources":["../../src/queuer/injectQueuedSignal.ts"],"sourcesContent":["import { computed } from '@angular/core'\nimport { injectQueuer } from './injectQueuer'\nimport type { AngularQueuer } from './injectQueuer'\nimport type { QueuerOptions, QueuerState } from '@tanstack/pacer/queuer'\n\nexport interface QueuedSignal<TValue, TSelected = {}> {\n (): Array<TValue>\n addItem: AngularQueuer<TValue, TSelected>['addItem']\n queuer: AngularQueuer<TValue, TSelected>\n}\n\n/**\n * An Angular function that creates a queuer with managed state, combining Angular's signals with queuing functionality.\n * This function 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 function.\n *\n * The function returns a callable object:\n * - `queued()`: Get the current queue items as an array\n * - `queued.addItem(...)`: Add an item to the queue\n * - `queued.queue`: The queuer instance with additional control methods\n *\n * @example\n * ```ts\n * // Default behavior - track items\n * const queued = injectQueuedSignal(\n * (item) => console.log('Processing:', item),\n * { started: true, wait: 1000 }\n * );\n *\n * // Add items\n * queued.addItem('task1');\n *\n * // Access items\n * console.log(queued()); // ['task1']\n *\n * // Control the queue\n * queued.queuer.start();\n * queued.queuer.stop();\n * ```\n */\nexport function injectQueuedSignal<\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): QueuedSignal<TValue, TSelected> {\n const queuer = injectQueuer(fn, options, selector)\n\n const items = computed(() => queuer.state().items as Array<TValue>)\n\n const queued = Object.assign(items, {\n addItem: queuer.addItem.bind(queuer),\n queuer,\n }) as QueuedSignal<TValue, TSelected>\n\n return queued\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,mBAOd,IACA,UAAiC,EAAE,EACnC,YAAuD,WACpD,EAAE,OAAO,MAAM,OAAO,GACQ;CACjC,MAAM,SAASA,kCAAa,IAAI,SAAS,SAAS;CAElD,MAAM,0CAAuB,OAAO,OAAO,CAAC,MAAuB;AAOnE,QALe,OAAO,OAAO,OAAO;EAClC,SAAS,OAAO,QAAQ,KAAK,OAAO;EACpC;EACD,CAAC"}
@@ -2,16 +2,11 @@ import { AngularQueuer } from "./injectQueuer.cjs";
2
2
  import { QueuerOptions, QueuerState } from "@tanstack/pacer/queuer";
3
3
 
4
4
  //#region src/queuer/injectQueuedSignal.d.ts
5
- type QueuedSignal<TValue, TSelected = {}> = (() => Array<TValue>) & {
6
- /**
7
- * Add an item to the queue.
8
- */
9
- readonly addItem: AngularQueuer<TValue, TSelected>['addItem'];
10
- /**
11
- * The queuer instance with additional control methods and state signals.
12
- */
13
- readonly queuer: AngularQueuer<TValue, TSelected>;
14
- };
5
+ interface QueuedSignal<TValue, TSelected = {}> {
6
+ (): Array<TValue>;
7
+ addItem: AngularQueuer<TValue, TSelected>['addItem'];
8
+ queuer: AngularQueuer<TValue, TSelected>;
9
+ }
15
10
  /**
16
11
  * An Angular function that creates a queuer with managed state, combining Angular's signals with queuing functionality.
17
12
  * This function provides both the current queue state and queue control methods.
@@ -2,16 +2,11 @@ import { AngularQueuer } from "./injectQueuer.js";
2
2
  import { QueuerOptions, QueuerState } from "@tanstack/pacer/queuer";
3
3
 
4
4
  //#region src/queuer/injectQueuedSignal.d.ts
5
- type QueuedSignal<TValue, TSelected = {}> = (() => Array<TValue>) & {
6
- /**
7
- * Add an item to the queue.
8
- */
9
- readonly addItem: AngularQueuer<TValue, TSelected>['addItem'];
10
- /**
11
- * The queuer instance with additional control methods and state signals.
12
- */
13
- readonly queuer: AngularQueuer<TValue, TSelected>;
14
- };
5
+ interface QueuedSignal<TValue, TSelected = {}> {
6
+ (): Array<TValue>;
7
+ addItem: AngularQueuer<TValue, TSelected>['addItem'];
8
+ queuer: AngularQueuer<TValue, TSelected>;
9
+ }
15
10
  /**
16
11
  * An Angular function that creates a queuer with managed state, combining Angular's signals with queuing functionality.
17
12
  * This function provides both the current queue state and queue control methods.
@@ -1 +1 @@
1
- {"version":3,"file":"injectQueuedSignal.js","names":[],"sources":["../../src/queuer/injectQueuedSignal.ts"],"sourcesContent":["import { computed } from '@angular/core'\nimport { injectQueuer } from './injectQueuer'\nimport type { AngularQueuer } from './injectQueuer'\nimport type { QueuerOptions, QueuerState } from '@tanstack/pacer/queuer'\n\nexport type QueuedSignal<TValue, TSelected = {}> = (() => Array<TValue>) & {\n /**\n * Add an item to the queue.\n */\n readonly addItem: AngularQueuer<TValue, TSelected>['addItem']\n /**\n * The queuer instance with additional control methods and state signals.\n */\n readonly queuer: AngularQueuer<TValue, TSelected>\n}\n\n/**\n * An Angular function that creates a queuer with managed state, combining Angular's signals with queuing functionality.\n * This function 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 function.\n *\n * The function returns a callable object:\n * - `queued()`: Get the current queue items as an array\n * - `queued.addItem(...)`: Add an item to the queue\n * - `queued.queue`: The queuer instance with additional control methods\n *\n * @example\n * ```ts\n * // Default behavior - track items\n * const queued = injectQueuedSignal(\n * (item) => console.log('Processing:', item),\n * { started: true, wait: 1000 }\n * );\n *\n * // Add items\n * queued.addItem('task1');\n *\n * // Access items\n * console.log(queued()); // ['task1']\n *\n * // Control the queue\n * queued.queuer.start();\n * queued.queuer.stop();\n * ```\n */\nexport function injectQueuedSignal<\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): QueuedSignal<TValue, TSelected> {\n const queuer = injectQueuer(fn, options, selector)\n\n const items = computed(() => queuer.state().items as Array<TValue>)\n\n const queued = Object.assign(items, {\n addItem: queuer.addItem.bind(queuer),\n queuer,\n }) as QueuedSignal<TValue, TSelected>\n\n return queued\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,mBAOd,IACA,UAAiC,EAAE,EACnC,YAAuD,WACpD,EAAE,OAAO,MAAM,OAAO,GACQ;CACjC,MAAM,SAAS,aAAa,IAAI,SAAS,SAAS;CAElD,MAAM,QAAQ,eAAe,OAAO,OAAO,CAAC,MAAuB;AAOnE,QALe,OAAO,OAAO,OAAO;EAClC,SAAS,OAAO,QAAQ,KAAK,OAAO;EACpC;EACD,CAAC"}
1
+ {"version":3,"file":"injectQueuedSignal.js","names":[],"sources":["../../src/queuer/injectQueuedSignal.ts"],"sourcesContent":["import { computed } from '@angular/core'\nimport { injectQueuer } from './injectQueuer'\nimport type { AngularQueuer } from './injectQueuer'\nimport type { QueuerOptions, QueuerState } from '@tanstack/pacer/queuer'\n\nexport interface QueuedSignal<TValue, TSelected = {}> {\n (): Array<TValue>\n addItem: AngularQueuer<TValue, TSelected>['addItem']\n queuer: AngularQueuer<TValue, TSelected>\n}\n\n/**\n * An Angular function that creates a queuer with managed state, combining Angular's signals with queuing functionality.\n * This function 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 function.\n *\n * The function returns a callable object:\n * - `queued()`: Get the current queue items as an array\n * - `queued.addItem(...)`: Add an item to the queue\n * - `queued.queue`: The queuer instance with additional control methods\n *\n * @example\n * ```ts\n * // Default behavior - track items\n * const queued = injectQueuedSignal(\n * (item) => console.log('Processing:', item),\n * { started: true, wait: 1000 }\n * );\n *\n * // Add items\n * queued.addItem('task1');\n *\n * // Access items\n * console.log(queued()); // ['task1']\n *\n * // Control the queue\n * queued.queuer.start();\n * queued.queuer.stop();\n * ```\n */\nexport function injectQueuedSignal<\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): QueuedSignal<TValue, TSelected> {\n const queuer = injectQueuer(fn, options, selector)\n\n const items = computed(() => queuer.state().items as Array<TValue>)\n\n const queued = Object.assign(items, {\n addItem: queuer.addItem.bind(queuer),\n queuer,\n }) as QueuedSignal<TValue, TSelected>\n\n return queued\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,mBAOd,IACA,UAAiC,EAAE,EACnC,YAAuD,WACpD,EAAE,OAAO,MAAM,OAAO,GACQ;CACjC,MAAM,SAAS,aAAa,IAAI,SAAS,SAAS;CAElD,MAAM,QAAQ,eAAe,OAAO,OAAO,CAAC,MAAuB;AAOnE,QALe,OAAO,OAAO,OAAO;EAClC,SAAS,OAAO,QAAQ,KAAK,OAAO;EACpC;EACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"injectRateLimitedSignal.cjs","names":["injectRateLimiter"],"sources":["../../src/rate-limiter/injectRateLimitedSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectRateLimiter } from './injectRateLimiter'\nimport type { AngularRateLimiter } from './injectRateLimiter'\nimport type {\n RateLimiterOptions,\n RateLimiterState,\n} from '@tanstack/pacer/rate-limiter'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport type RateLimitedSignal<TValue, TSelected = {}> = ((\n ...args: []\n) => TValue) & {\n /**\n * Set or update the rate-limited value. This calls `rateLimiter.maybeExecute(...)`.\n */\n readonly set: Setter<TValue>\n /**\n * The rate limiter instance with additional control methods and state signals.\n */\n readonly rateLimiter: AngularRateLimiter<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a rate-limited state signal, combining Angular's signal with rate limiting functionality.\n * This function provides both the current rate-limited value and methods to update it.\n *\n * Rate limiting is a simple \"hard limit\" approach - it allows all updates until the limit is reached, then blocks\n * subsequent updates until the window resets. Unlike throttling or debouncing, it does not attempt to space out\n * or intelligently collapse updates.\n *\n * The function returns a callable object:\n * - `rateLimited()`: Get the current rate-limited value\n * - `rateLimited.set(...)`: Set or update the rate-limited value (rate-limited via maybeExecute)\n * - `rateLimited.rateLimiter`: The rate limiter instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying rate limiter instance.\n * The `selector` parameter allows you to specify which rate limiter state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes.\n *\n * @example\n * ```ts\n * // Default behavior - no reactive state subscriptions\n * const rateLimited = injectRateLimitedSignal(0, {\n * limit: 5,\n * window: 60000,\n * windowType: 'sliding'\n * });\n *\n * // Opt-in to reactive updates when limit state changes\n * const rateLimited = injectRateLimitedSignal(\n * 0,\n * { limit: 5, window: 60000 },\n * (state) => ({ rejectionCount: state.rejectionCount })\n * );\n * ```\n */\nexport function injectRateLimitedSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: RateLimiterOptions<Setter<TValue>>,\n selector?: (state: RateLimiterState) => TSelected,\n): RateLimitedSignal<TValue, TSelected> {\n const rateLimitedValue = signal<TValue>(value)\n\n const rateLimiter = injectRateLimiter(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n rateLimitedValue.update(newValue as (prev: TValue) => TValue)\n } else {\n rateLimitedValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n rateLimiter.maybeExecute(newValue)\n }\n\n const rateLimited = Object.assign(() => rateLimitedValue(), {\n set,\n rateLimiter,\n }) as RateLimitedSignal<TValue, TSelected>\n\n return rateLimited\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,SAAgB,wBACd,OACA,gBACA,UACsC;CACtC,MAAM,6CAAkC,MAAM;CAE9C,MAAM,cAAcA,6CACjB,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,kBAAiB,OAAO,SAAqC;MAE7D,kBAAiB,IAAI,SAAS;IAGlC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,cAAY,aAAa,SAAS;;AAQpC,QALoB,OAAO,aAAa,kBAAkB,EAAE;EAC1D;EACA;EACD,CAAC"}
1
+ {"version":3,"file":"injectRateLimitedSignal.cjs","names":["injectRateLimiter"],"sources":["../../src/rate-limiter/injectRateLimitedSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectRateLimiter } from './injectRateLimiter'\nimport type { AngularRateLimiter } from './injectRateLimiter'\nimport type {\n RateLimiterOptions,\n RateLimiterState,\n} from '@tanstack/pacer/rate-limiter'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport interface RateLimitedSignal<TValue, TSelected = {}> {\n (): TValue\n set: Setter<TValue>\n rateLimiter: AngularRateLimiter<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a rate-limited state signal, combining Angular's signal with rate limiting functionality.\n * This function provides both the current rate-limited value and methods to update it.\n *\n * Rate limiting is a simple \"hard limit\" approach - it allows all updates until the limit is reached, then blocks\n * subsequent updates until the window resets. Unlike throttling or debouncing, it does not attempt to space out\n * or intelligently collapse updates.\n *\n * The function returns a callable object:\n * - `rateLimited()`: Get the current rate-limited value\n * - `rateLimited.set(...)`: Set or update the rate-limited value (rate-limited via maybeExecute)\n * - `rateLimited.rateLimiter`: The rate limiter instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying rate limiter instance.\n * The `selector` parameter allows you to specify which rate limiter state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes.\n *\n * @example\n * ```ts\n * // Default behavior - no reactive state subscriptions\n * const rateLimited = injectRateLimitedSignal(0, {\n * limit: 5,\n * window: 60000,\n * windowType: 'sliding'\n * });\n *\n * // Opt-in to reactive updates when limit state changes\n * const rateLimited = injectRateLimitedSignal(\n * 0,\n * { limit: 5, window: 60000 },\n * (state) => ({ rejectionCount: state.rejectionCount })\n * );\n * ```\n */\nexport function injectRateLimitedSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: RateLimiterOptions<Setter<TValue>>,\n selector?: (state: RateLimiterState) => TSelected,\n): RateLimitedSignal<TValue, TSelected> {\n const rateLimitedValue = signal<TValue>(value)\n\n const rateLimiter = injectRateLimiter(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n rateLimitedValue.update(newValue as (prev: TValue) => TValue)\n } else {\n rateLimitedValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n rateLimiter.maybeExecute(newValue)\n }\n\n const rateLimited = Object.assign(() => rateLimitedValue(), {\n set,\n rateLimiter,\n }) as RateLimitedSignal<TValue, TSelected>\n\n return rateLimited\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,SAAgB,wBACd,OACA,gBACA,UACsC;CACtC,MAAM,6CAAkC,MAAM;CAE9C,MAAM,cAAcA,6CACjB,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,kBAAiB,OAAO,SAAqC;MAE7D,kBAAiB,IAAI,SAAS;IAGlC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,cAAY,aAAa,SAAS;;AAQpC,QALoB,OAAO,aAAa,kBAAkB,EAAE;EAC1D;EACA;EACD,CAAC"}
@@ -3,16 +3,11 @@ import { RateLimiterOptions, RateLimiterState } from "@tanstack/pacer/rate-limit
3
3
 
4
4
  //#region src/rate-limiter/injectRateLimitedSignal.d.ts
5
5
  type Setter<T> = (value: T | ((prev: T) => T)) => void;
6
- type RateLimitedSignal<TValue, TSelected = {}> = ((...args: []) => TValue) & {
7
- /**
8
- * Set or update the rate-limited value. This calls `rateLimiter.maybeExecute(...)`.
9
- */
10
- readonly set: Setter<TValue>;
11
- /**
12
- * The rate limiter instance with additional control methods and state signals.
13
- */
14
- readonly rateLimiter: AngularRateLimiter<Setter<TValue>, TSelected>;
15
- };
6
+ interface RateLimitedSignal<TValue, TSelected = {}> {
7
+ (): TValue;
8
+ set: Setter<TValue>;
9
+ rateLimiter: AngularRateLimiter<Setter<TValue>, TSelected>;
10
+ }
16
11
  /**
17
12
  * An Angular function that creates a rate-limited state signal, combining Angular's signal with rate limiting functionality.
18
13
  * This function provides both the current rate-limited value and methods to update it.
@@ -3,16 +3,11 @@ import { RateLimiterOptions, RateLimiterState } from "@tanstack/pacer/rate-limit
3
3
 
4
4
  //#region src/rate-limiter/injectRateLimitedSignal.d.ts
5
5
  type Setter<T> = (value: T | ((prev: T) => T)) => void;
6
- type RateLimitedSignal<TValue, TSelected = {}> = ((...args: []) => TValue) & {
7
- /**
8
- * Set or update the rate-limited value. This calls `rateLimiter.maybeExecute(...)`.
9
- */
10
- readonly set: Setter<TValue>;
11
- /**
12
- * The rate limiter instance with additional control methods and state signals.
13
- */
14
- readonly rateLimiter: AngularRateLimiter<Setter<TValue>, TSelected>;
15
- };
6
+ interface RateLimitedSignal<TValue, TSelected = {}> {
7
+ (): TValue;
8
+ set: Setter<TValue>;
9
+ rateLimiter: AngularRateLimiter<Setter<TValue>, TSelected>;
10
+ }
16
11
  /**
17
12
  * An Angular function that creates a rate-limited state signal, combining Angular's signal with rate limiting functionality.
18
13
  * This function provides both the current rate-limited value and methods to update it.
@@ -1 +1 @@
1
- {"version":3,"file":"injectRateLimitedSignal.js","names":[],"sources":["../../src/rate-limiter/injectRateLimitedSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectRateLimiter } from './injectRateLimiter'\nimport type { AngularRateLimiter } from './injectRateLimiter'\nimport type {\n RateLimiterOptions,\n RateLimiterState,\n} from '@tanstack/pacer/rate-limiter'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport type RateLimitedSignal<TValue, TSelected = {}> = ((\n ...args: []\n) => TValue) & {\n /**\n * Set or update the rate-limited value. This calls `rateLimiter.maybeExecute(...)`.\n */\n readonly set: Setter<TValue>\n /**\n * The rate limiter instance with additional control methods and state signals.\n */\n readonly rateLimiter: AngularRateLimiter<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a rate-limited state signal, combining Angular's signal with rate limiting functionality.\n * This function provides both the current rate-limited value and methods to update it.\n *\n * Rate limiting is a simple \"hard limit\" approach - it allows all updates until the limit is reached, then blocks\n * subsequent updates until the window resets. Unlike throttling or debouncing, it does not attempt to space out\n * or intelligently collapse updates.\n *\n * The function returns a callable object:\n * - `rateLimited()`: Get the current rate-limited value\n * - `rateLimited.set(...)`: Set or update the rate-limited value (rate-limited via maybeExecute)\n * - `rateLimited.rateLimiter`: The rate limiter instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying rate limiter instance.\n * The `selector` parameter allows you to specify which rate limiter state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes.\n *\n * @example\n * ```ts\n * // Default behavior - no reactive state subscriptions\n * const rateLimited = injectRateLimitedSignal(0, {\n * limit: 5,\n * window: 60000,\n * windowType: 'sliding'\n * });\n *\n * // Opt-in to reactive updates when limit state changes\n * const rateLimited = injectRateLimitedSignal(\n * 0,\n * { limit: 5, window: 60000 },\n * (state) => ({ rejectionCount: state.rejectionCount })\n * );\n * ```\n */\nexport function injectRateLimitedSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: RateLimiterOptions<Setter<TValue>>,\n selector?: (state: RateLimiterState) => TSelected,\n): RateLimitedSignal<TValue, TSelected> {\n const rateLimitedValue = signal<TValue>(value)\n\n const rateLimiter = injectRateLimiter(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n rateLimitedValue.update(newValue as (prev: TValue) => TValue)\n } else {\n rateLimitedValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n rateLimiter.maybeExecute(newValue)\n }\n\n const rateLimited = Object.assign(() => rateLimitedValue(), {\n set,\n rateLimiter,\n }) as RateLimitedSignal<TValue, TSelected>\n\n return rateLimited\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,SAAgB,wBACd,OACA,gBACA,UACsC;CACtC,MAAM,mBAAmB,OAAe,MAAM;CAE9C,MAAM,cAAc,mBACjB,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,kBAAiB,OAAO,SAAqC;MAE7D,kBAAiB,IAAI,SAAS;IAGlC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,cAAY,aAAa,SAAS;;AAQpC,QALoB,OAAO,aAAa,kBAAkB,EAAE;EAC1D;EACA;EACD,CAAC"}
1
+ {"version":3,"file":"injectRateLimitedSignal.js","names":[],"sources":["../../src/rate-limiter/injectRateLimitedSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectRateLimiter } from './injectRateLimiter'\nimport type { AngularRateLimiter } from './injectRateLimiter'\nimport type {\n RateLimiterOptions,\n RateLimiterState,\n} from '@tanstack/pacer/rate-limiter'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport interface RateLimitedSignal<TValue, TSelected = {}> {\n (): TValue\n set: Setter<TValue>\n rateLimiter: AngularRateLimiter<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a rate-limited state signal, combining Angular's signal with rate limiting functionality.\n * This function provides both the current rate-limited value and methods to update it.\n *\n * Rate limiting is a simple \"hard limit\" approach - it allows all updates until the limit is reached, then blocks\n * subsequent updates until the window resets. Unlike throttling or debouncing, it does not attempt to space out\n * or intelligently collapse updates.\n *\n * The function returns a callable object:\n * - `rateLimited()`: Get the current rate-limited value\n * - `rateLimited.set(...)`: Set or update the rate-limited value (rate-limited via maybeExecute)\n * - `rateLimited.rateLimiter`: The rate limiter instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying rate limiter instance.\n * The `selector` parameter allows you to specify which rate limiter state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes.\n *\n * @example\n * ```ts\n * // Default behavior - no reactive state subscriptions\n * const rateLimited = injectRateLimitedSignal(0, {\n * limit: 5,\n * window: 60000,\n * windowType: 'sliding'\n * });\n *\n * // Opt-in to reactive updates when limit state changes\n * const rateLimited = injectRateLimitedSignal(\n * 0,\n * { limit: 5, window: 60000 },\n * (state) => ({ rejectionCount: state.rejectionCount })\n * );\n * ```\n */\nexport function injectRateLimitedSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: RateLimiterOptions<Setter<TValue>>,\n selector?: (state: RateLimiterState) => TSelected,\n): RateLimitedSignal<TValue, TSelected> {\n const rateLimitedValue = signal<TValue>(value)\n\n const rateLimiter = injectRateLimiter(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n rateLimitedValue.update(newValue as (prev: TValue) => TValue)\n } else {\n rateLimitedValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n rateLimiter.maybeExecute(newValue)\n }\n\n const rateLimited = Object.assign(() => rateLimitedValue(), {\n set,\n rateLimiter,\n }) as RateLimitedSignal<TValue, TSelected>\n\n return rateLimited\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,SAAgB,wBACd,OACA,gBACA,UACsC;CACtC,MAAM,mBAAmB,OAAe,MAAM;CAE9C,MAAM,cAAc,mBACjB,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,kBAAiB,OAAO,SAAqC;MAE7D,kBAAiB,IAAI,SAAS;IAGlC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,cAAY,aAAa,SAAS;;AAQpC,QALoB,OAAO,aAAa,kBAAkB,EAAE;EAC1D;EACA;EACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"injectThrottledSignal.cjs","names":["injectThrottler"],"sources":["../../src/throttler/injectThrottledSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectThrottler } from './injectThrottler'\nimport type { AngularThrottler } from './injectThrottler'\nimport type {\n ThrottlerOptions,\n ThrottlerState,\n} from '@tanstack/pacer/throttler'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport type ThrottledSignal<TValue, TSelected = {}> = ((\n ...args: []\n) => TValue) & {\n /**\n * Set or update the throttled value. This calls `throttler.maybeExecute(...)`.\n */\n readonly set: Setter<TValue>\n /**\n * The throttler instance with additional control methods and state signals.\n */\n readonly throttler: AngularThrottler<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a throttled state signal, combining Angular's signal with throttling functionality.\n * This function provides both the current throttled value and methods to update it.\n *\n * The state value is updated at most once within the specified wait time.\n * This is useful for handling frequent state updates that should be rate-limited, like scroll positions\n * or mouse movements.\n *\n * The function returns a callable object:\n * - `throttled()`: Get the current throttled value\n * - `throttled.set(...)`: Set or update the throttled value (throttled via maybeExecute)\n * - `throttled.throttler`: The throttler instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying throttler instance.\n * The `selector` parameter allows you to specify which throttler state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes.\n *\n * Available throttler state properties:\n * - `canLeadingExecute`: Whether the throttler can execute on the leading edge\n * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the throttler is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `lastExecutionTime`: Timestamp of the last execution\n * - `nextExecutionTime`: Timestamp of the next allowed execution\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```ts\n * const throttledScrollY = injectThrottledSignal(0, { wait: 100 })\n *\n * // Get value\n * console.log(throttledScrollY())\n *\n * // Set/update value (throttled)\n * throttledScrollY.set(window.scrollY)\n *\n * // Access throttler\n * console.log(throttledScrollY.throttler.state().isPending)\n * ```\n */\nexport function injectThrottledSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: ThrottlerOptions<Setter<TValue>>,\n selector?: (state: ThrottlerState<Setter<TValue>>) => TSelected,\n): ThrottledSignal<TValue, TSelected> {\n const throttledValue = signal<TValue>(value)\n\n const throttler = injectThrottler(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n throttledValue.update(newValue as (prev: TValue) => TValue)\n } else {\n throttledValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n throttler.maybeExecute(newValue)\n }\n\n const throttled = Object.assign(() => throttledValue(), {\n set,\n throttler,\n }) as ThrottledSignal<TValue, TSelected>\n\n return throttled\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,SAAgB,sBACd,OACA,gBACA,UACoC;CACpC,MAAM,2CAAgC,MAAM;CAE5C,MAAM,YAAYA,yCACf,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,gBAAe,OAAO,SAAqC;MAE3D,gBAAe,IAAI,SAAS;IAGhC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,YAAU,aAAa,SAAS;;AAQlC,QALkB,OAAO,aAAa,gBAAgB,EAAE;EACtD;EACA;EACD,CAAC"}
1
+ {"version":3,"file":"injectThrottledSignal.cjs","names":["injectThrottler"],"sources":["../../src/throttler/injectThrottledSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectThrottler } from './injectThrottler'\nimport type { AngularThrottler } from './injectThrottler'\nimport type {\n ThrottlerOptions,\n ThrottlerState,\n} from '@tanstack/pacer/throttler'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport interface ThrottledSignal<TValue, TSelected = {}> {\n (): TValue\n set: Setter<TValue>\n throttler: AngularThrottler<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a throttled state signal, combining Angular's signal with throttling functionality.\n * This function provides both the current throttled value and methods to update it.\n *\n * The state value is updated at most once within the specified wait time.\n * This is useful for handling frequent state updates that should be rate-limited, like scroll positions\n * or mouse movements.\n *\n * The function returns a callable object:\n * - `throttled()`: Get the current throttled value\n * - `throttled.set(...)`: Set or update the throttled value (throttled via maybeExecute)\n * - `throttled.throttler`: The throttler instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying throttler instance.\n * The `selector` parameter allows you to specify which throttler state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes.\n *\n * Available throttler state properties:\n * - `canLeadingExecute`: Whether the throttler can execute on the leading edge\n * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the throttler is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `lastExecutionTime`: Timestamp of the last execution\n * - `nextExecutionTime`: Timestamp of the next allowed execution\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```ts\n * const throttledScrollY = injectThrottledSignal(0, { wait: 100 })\n *\n * // Get value\n * console.log(throttledScrollY())\n *\n * // Set/update value (throttled)\n * throttledScrollY.set(window.scrollY)\n *\n * // Access throttler\n * console.log(throttledScrollY.throttler.state().isPending)\n * ```\n */\nexport function injectThrottledSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: ThrottlerOptions<Setter<TValue>>,\n selector?: (state: ThrottlerState<Setter<TValue>>) => TSelected,\n): ThrottledSignal<TValue, TSelected> {\n const throttledValue = signal<TValue>(value)\n\n const throttler = injectThrottler(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n throttledValue.update(newValue as (prev: TValue) => TValue)\n } else {\n throttledValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n throttler.maybeExecute(newValue)\n }\n\n const throttled = Object.assign(() => throttledValue(), {\n set,\n throttler,\n }) as ThrottledSignal<TValue, TSelected>\n\n return throttled\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,SAAgB,sBACd,OACA,gBACA,UACoC;CACpC,MAAM,2CAAgC,MAAM;CAE5C,MAAM,YAAYA,yCACf,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,gBAAe,OAAO,SAAqC;MAE3D,gBAAe,IAAI,SAAS;IAGhC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,YAAU,aAAa,SAAS;;AAQlC,QALkB,OAAO,aAAa,gBAAgB,EAAE;EACtD;EACA;EACD,CAAC"}
@@ -3,16 +3,11 @@ import { ThrottlerOptions, ThrottlerState } from "@tanstack/pacer/throttler";
3
3
 
4
4
  //#region src/throttler/injectThrottledSignal.d.ts
5
5
  type Setter<T> = (value: T | ((prev: T) => T)) => void;
6
- type ThrottledSignal<TValue, TSelected = {}> = ((...args: []) => TValue) & {
7
- /**
8
- * Set or update the throttled value. This calls `throttler.maybeExecute(...)`.
9
- */
10
- readonly set: Setter<TValue>;
11
- /**
12
- * The throttler instance with additional control methods and state signals.
13
- */
14
- readonly throttler: AngularThrottler<Setter<TValue>, TSelected>;
15
- };
6
+ interface ThrottledSignal<TValue, TSelected = {}> {
7
+ (): TValue;
8
+ set: Setter<TValue>;
9
+ throttler: AngularThrottler<Setter<TValue>, TSelected>;
10
+ }
16
11
  /**
17
12
  * An Angular function that creates a throttled state signal, combining Angular's signal with throttling functionality.
18
13
  * This function provides both the current throttled value and methods to update it.
@@ -3,16 +3,11 @@ import { ThrottlerOptions, ThrottlerState } from "@tanstack/pacer/throttler";
3
3
 
4
4
  //#region src/throttler/injectThrottledSignal.d.ts
5
5
  type Setter<T> = (value: T | ((prev: T) => T)) => void;
6
- type ThrottledSignal<TValue, TSelected = {}> = ((...args: []) => TValue) & {
7
- /**
8
- * Set or update the throttled value. This calls `throttler.maybeExecute(...)`.
9
- */
10
- readonly set: Setter<TValue>;
11
- /**
12
- * The throttler instance with additional control methods and state signals.
13
- */
14
- readonly throttler: AngularThrottler<Setter<TValue>, TSelected>;
15
- };
6
+ interface ThrottledSignal<TValue, TSelected = {}> {
7
+ (): TValue;
8
+ set: Setter<TValue>;
9
+ throttler: AngularThrottler<Setter<TValue>, TSelected>;
10
+ }
16
11
  /**
17
12
  * An Angular function that creates a throttled state signal, combining Angular's signal with throttling functionality.
18
13
  * This function provides both the current throttled value and methods to update it.
@@ -1 +1 @@
1
- {"version":3,"file":"injectThrottledSignal.js","names":[],"sources":["../../src/throttler/injectThrottledSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectThrottler } from './injectThrottler'\nimport type { AngularThrottler } from './injectThrottler'\nimport type {\n ThrottlerOptions,\n ThrottlerState,\n} from '@tanstack/pacer/throttler'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport type ThrottledSignal<TValue, TSelected = {}> = ((\n ...args: []\n) => TValue) & {\n /**\n * Set or update the throttled value. This calls `throttler.maybeExecute(...)`.\n */\n readonly set: Setter<TValue>\n /**\n * The throttler instance with additional control methods and state signals.\n */\n readonly throttler: AngularThrottler<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a throttled state signal, combining Angular's signal with throttling functionality.\n * This function provides both the current throttled value and methods to update it.\n *\n * The state value is updated at most once within the specified wait time.\n * This is useful for handling frequent state updates that should be rate-limited, like scroll positions\n * or mouse movements.\n *\n * The function returns a callable object:\n * - `throttled()`: Get the current throttled value\n * - `throttled.set(...)`: Set or update the throttled value (throttled via maybeExecute)\n * - `throttled.throttler`: The throttler instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying throttler instance.\n * The `selector` parameter allows you to specify which throttler state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes.\n *\n * Available throttler state properties:\n * - `canLeadingExecute`: Whether the throttler can execute on the leading edge\n * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the throttler is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `lastExecutionTime`: Timestamp of the last execution\n * - `nextExecutionTime`: Timestamp of the next allowed execution\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```ts\n * const throttledScrollY = injectThrottledSignal(0, { wait: 100 })\n *\n * // Get value\n * console.log(throttledScrollY())\n *\n * // Set/update value (throttled)\n * throttledScrollY.set(window.scrollY)\n *\n * // Access throttler\n * console.log(throttledScrollY.throttler.state().isPending)\n * ```\n */\nexport function injectThrottledSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: ThrottlerOptions<Setter<TValue>>,\n selector?: (state: ThrottlerState<Setter<TValue>>) => TSelected,\n): ThrottledSignal<TValue, TSelected> {\n const throttledValue = signal<TValue>(value)\n\n const throttler = injectThrottler(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n throttledValue.update(newValue as (prev: TValue) => TValue)\n } else {\n throttledValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n throttler.maybeExecute(newValue)\n }\n\n const throttled = Object.assign(() => throttledValue(), {\n set,\n throttler,\n }) as ThrottledSignal<TValue, TSelected>\n\n return throttled\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,SAAgB,sBACd,OACA,gBACA,UACoC;CACpC,MAAM,iBAAiB,OAAe,MAAM;CAE5C,MAAM,YAAY,iBACf,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,gBAAe,OAAO,SAAqC;MAE3D,gBAAe,IAAI,SAAS;IAGhC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,YAAU,aAAa,SAAS;;AAQlC,QALkB,OAAO,aAAa,gBAAgB,EAAE;EACtD;EACA;EACD,CAAC"}
1
+ {"version":3,"file":"injectThrottledSignal.js","names":[],"sources":["../../src/throttler/injectThrottledSignal.ts"],"sourcesContent":["import { signal } from '@angular/core'\nimport { injectThrottler } from './injectThrottler'\nimport type { AngularThrottler } from './injectThrottler'\nimport type {\n ThrottlerOptions,\n ThrottlerState,\n} from '@tanstack/pacer/throttler'\n\ntype Setter<T> = (value: T | ((prev: T) => T)) => void\n\nexport interface ThrottledSignal<TValue, TSelected = {}> {\n (): TValue\n set: Setter<TValue>\n throttler: AngularThrottler<Setter<TValue>, TSelected>\n}\n\n/**\n * An Angular function that creates a throttled state signal, combining Angular's signal with throttling functionality.\n * This function provides both the current throttled value and methods to update it.\n *\n * The state value is updated at most once within the specified wait time.\n * This is useful for handling frequent state updates that should be rate-limited, like scroll positions\n * or mouse movements.\n *\n * The function returns a callable object:\n * - `throttled()`: Get the current throttled value\n * - `throttled.set(...)`: Set or update the throttled value (throttled via maybeExecute)\n * - `throttled.throttler`: The throttler instance with additional control methods and state signals\n *\n * ## State Management and Selector\n *\n * The function uses TanStack Store for reactive state management via the underlying throttler instance.\n * The `selector` parameter allows you to specify which throttler state changes will trigger signal updates,\n * optimizing performance by preventing unnecessary subscriptions when irrelevant state changes occur.\n *\n * **By default, there will be no reactive state subscriptions** and you must opt-in to state\n * tracking by providing a selector function. This prevents unnecessary updates and gives you\n * full control over when your component tracks state changes.\n *\n * Available throttler state properties:\n * - `canLeadingExecute`: Whether the throttler can execute on the leading edge\n * - `canTrailingExecute`: Whether the throttler can execute on the trailing edge\n * - `executionCount`: Number of function executions that have been completed\n * - `isPending`: Whether the throttler is waiting for the timeout to trigger execution\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `lastExecutionTime`: Timestamp of the last execution\n * - `nextExecutionTime`: Timestamp of the next allowed execution\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending')\n *\n * @example\n * ```ts\n * const throttledScrollY = injectThrottledSignal(0, { wait: 100 })\n *\n * // Get value\n * console.log(throttledScrollY())\n *\n * // Set/update value (throttled)\n * throttledScrollY.set(window.scrollY)\n *\n * // Access throttler\n * console.log(throttledScrollY.throttler.state().isPending)\n * ```\n */\nexport function injectThrottledSignal<TValue, TSelected = {}>(\n value: TValue,\n initialOptions: ThrottlerOptions<Setter<TValue>>,\n selector?: (state: ThrottlerState<Setter<TValue>>) => TSelected,\n): ThrottledSignal<TValue, TSelected> {\n const throttledValue = signal<TValue>(value)\n\n const throttler = injectThrottler(\n (newValue: TValue | ((prev: TValue) => TValue)) => {\n if (typeof newValue === 'function') {\n throttledValue.update(newValue as (prev: TValue) => TValue)\n } else {\n throttledValue.set(newValue)\n }\n },\n initialOptions,\n selector,\n )\n\n const set: Setter<TValue> = (\n newValue: TValue | ((prev: TValue) => TValue),\n ) => {\n throttler.maybeExecute(newValue)\n }\n\n const throttled = Object.assign(() => throttledValue(), {\n set,\n throttler,\n }) as ThrottledSignal<TValue, TSelected>\n\n return throttled\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,SAAgB,sBACd,OACA,gBACA,UACoC;CACpC,MAAM,iBAAiB,OAAe,MAAM;CAE5C,MAAM,YAAY,iBACf,aAAkD;AACjD,MAAI,OAAO,aAAa,WACtB,gBAAe,OAAO,SAAqC;MAE3D,gBAAe,IAAI,SAAS;IAGhC,gBACA,SACD;CAED,MAAM,OACJ,aACG;AACH,YAAU,aAAa,SAAS;;AAQlC,QALkB,OAAO,aAAa,gBAAgB,EAAE;EACtD;EACA;EACD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/angular-pacer",
3
- "version": "0.21.0",
3
+ "version": "0.22.1",
4
4
  "description": "Utilities for debouncing and throttling functions in Angular.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -99,12 +99,12 @@
99
99
  "src"
100
100
  ],
101
101
  "dependencies": {
102
- "@tanstack/angular-store": "^0.8.1",
103
- "@tanstack/pacer": "0.19.0"
102
+ "@tanstack/angular-store": "^0.9.3",
103
+ "@tanstack/pacer": "0.20.1"
104
104
  },
105
105
  "devDependencies": {
106
- "@angular/core": "^21.1.4",
107
- "@types/node": "^25.2.3"
106
+ "@angular/core": "^21.2.6",
107
+ "@types/node": "^25.5.0"
108
108
  },
109
109
  "peerDependencies": {
110
110
  "@angular/core": ">=17.0.0"
@@ -6,18 +6,10 @@ import type {
6
6
  AsyncQueuerState,
7
7
  } from '@tanstack/pacer/async-queuer'
8
8
 
9
- export type AsyncQueuedSignal<
10
- TValue,
11
- TSelected = {},
12
- > = (() => Array<TValue>) & {
13
- /**
14
- * Add an item to the queue.
15
- */
16
- readonly addItem: AngularAsyncQueuer<TValue, TSelected>['addItem']
17
- /**
18
- * The queuer instance with additional control methods and state signals.
19
- */
20
- readonly queuer: AngularAsyncQueuer<TValue, TSelected>
9
+ export interface AsyncQueuedSignal<TValue, TSelected = {}> {
10
+ (): Array<TValue>
11
+ addItem: AngularAsyncQueuer<TValue, TSelected>['addItem']
12
+ queuer: AngularAsyncQueuer<TValue, TSelected>
21
13
  }
22
14
 
23
15
  /**
@@ -8,17 +8,10 @@ import type {
8
8
 
9
9
  type Setter<T> = (value: T | ((prev: T) => T)) => void
10
10
 
11
- export type DebouncedSignal<TValue, TSelected = {}> = ((
12
- ...args: []
13
- ) => TValue) & {
14
- /**
15
- * Set or update the debounced value. This calls `debouncer.maybeExecute(...)`.
16
- */
17
- readonly set: Setter<TValue>
18
- /**
19
- * The debouncer instance with additional control methods and state signals.
20
- */
21
- readonly debouncer: AngularDebouncer<Setter<TValue>, TSelected>
11
+ export interface DebouncedSignal<TValue, TSelected = {}> {
12
+ (): TValue
13
+ set: Setter<TValue>
14
+ debouncer: AngularDebouncer<Setter<TValue>, TSelected>
22
15
  }
23
16
 
24
17
  /**
@@ -3,15 +3,10 @@ import { injectQueuer } from './injectQueuer'
3
3
  import type { AngularQueuer } from './injectQueuer'
4
4
  import type { QueuerOptions, QueuerState } from '@tanstack/pacer/queuer'
5
5
 
6
- export type QueuedSignal<TValue, TSelected = {}> = (() => Array<TValue>) & {
7
- /**
8
- * Add an item to the queue.
9
- */
10
- readonly addItem: AngularQueuer<TValue, TSelected>['addItem']
11
- /**
12
- * The queuer instance with additional control methods and state signals.
13
- */
14
- readonly queuer: AngularQueuer<TValue, TSelected>
6
+ export interface QueuedSignal<TValue, TSelected = {}> {
7
+ (): Array<TValue>
8
+ addItem: AngularQueuer<TValue, TSelected>['addItem']
9
+ queuer: AngularQueuer<TValue, TSelected>
15
10
  }
16
11
 
17
12
  /**
@@ -8,17 +8,10 @@ import type {
8
8
 
9
9
  type Setter<T> = (value: T | ((prev: T) => T)) => void
10
10
 
11
- export type RateLimitedSignal<TValue, TSelected = {}> = ((
12
- ...args: []
13
- ) => TValue) & {
14
- /**
15
- * Set or update the rate-limited value. This calls `rateLimiter.maybeExecute(...)`.
16
- */
17
- readonly set: Setter<TValue>
18
- /**
19
- * The rate limiter instance with additional control methods and state signals.
20
- */
21
- readonly rateLimiter: AngularRateLimiter<Setter<TValue>, TSelected>
11
+ export interface RateLimitedSignal<TValue, TSelected = {}> {
12
+ (): TValue
13
+ set: Setter<TValue>
14
+ rateLimiter: AngularRateLimiter<Setter<TValue>, TSelected>
22
15
  }
23
16
 
24
17
  /**
@@ -8,17 +8,10 @@ import type {
8
8
 
9
9
  type Setter<T> = (value: T | ((prev: T) => T)) => void
10
10
 
11
- export type ThrottledSignal<TValue, TSelected = {}> = ((
12
- ...args: []
13
- ) => TValue) & {
14
- /**
15
- * Set or update the throttled value. This calls `throttler.maybeExecute(...)`.
16
- */
17
- readonly set: Setter<TValue>
18
- /**
19
- * The throttler instance with additional control methods and state signals.
20
- */
21
- readonly throttler: AngularThrottler<Setter<TValue>, TSelected>
11
+ export interface ThrottledSignal<TValue, TSelected = {}> {
12
+ (): TValue
13
+ set: Setter<TValue>
14
+ throttler: AngularThrottler<Setter<TValue>, TSelected>
22
15
  }
23
16
 
24
17
  /**