@tanstack/solid-pacer 0.21.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -6
- package/dist/async-batcher/createAsyncBatcher.d.ts +5 -10
- package/dist/async-batcher/createAsyncBatcher.js +2 -5
- package/dist/async-debouncer/createAsyncDebouncer.d.ts +8 -12
- package/dist/async-debouncer/createAsyncDebouncer.js +5 -7
- package/dist/async-queuer/createAsyncQueuer.d.ts +9 -12
- package/dist/async-queuer/createAsyncQueuer.js +4 -5
- package/dist/async-rate-limiter/createAsyncRateLimiter.d.ts +10 -13
- package/dist/async-rate-limiter/createAsyncRateLimiter.js +7 -8
- package/dist/async-throttler/createAsyncThrottler.d.ts +8 -14
- package/dist/async-throttler/createAsyncThrottler.js +5 -9
- package/dist/batcher/createBatcher.d.ts +11 -15
- package/dist/batcher/createBatcher.js +6 -8
- package/dist/debouncer/createDebouncedSignal.d.ts +2 -5
- package/dist/debouncer/createDebouncedSignal.js +1 -2
- package/dist/debouncer/createDebouncedValue.d.ts +2 -5
- package/dist/debouncer/createDebouncedValue.js +1 -2
- package/dist/debouncer/createDebouncer.d.ts +4 -7
- package/dist/debouncer/createDebouncer.js +1 -2
- package/dist/provider/PacerProvider.d.ts +6 -9
- package/dist/provider/PacerProvider.js +1 -2
- package/dist/queuer/createQueuedSignal.d.ts +2 -5
- package/dist/queuer/createQueuedSignal.js +1 -2
- package/dist/queuer/createQueuer.d.ts +4 -7
- package/dist/queuer/createQueuer.js +1 -2
- package/dist/rate-limiter/createRateLimitedSignal.d.ts +12 -14
- package/dist/rate-limiter/createRateLimitedSignal.js +11 -11
- package/dist/rate-limiter/createRateLimitedValue.d.ts +2 -5
- package/dist/rate-limiter/createRateLimitedValue.js +1 -2
- package/dist/rate-limiter/createRateLimiter.d.ts +8 -10
- package/dist/rate-limiter/createRateLimiter.js +5 -5
- package/dist/throttler/createThrottledSignal.d.ts +2 -7
- package/dist/throttler/createThrottledSignal.js +1 -4
- package/dist/throttler/createThrottledValue.d.ts +2 -7
- package/dist/throttler/createThrottledValue.js +1 -4
- package/dist/throttler/createThrottler.d.ts +4 -9
- package/dist/throttler/createThrottler.js +1 -4
- package/package.json +24 -68
- package/dist/async-batcher/createAsyncBatcher.cjs +0 -166
- package/dist/async-batcher/createAsyncBatcher.cjs.map +0 -1
- package/dist/async-batcher/createAsyncBatcher.d.cts +0 -178
- package/dist/async-batcher/createAsyncBatcher.js.map +0 -1
- package/dist/async-batcher/index.cjs +0 -11
- package/dist/async-batcher/index.d.cts +0 -3
- package/dist/async-debouncer/createAsyncDebouncer.cjs +0 -151
- package/dist/async-debouncer/createAsyncDebouncer.cjs.map +0 -1
- package/dist/async-debouncer/createAsyncDebouncer.d.cts +0 -164
- package/dist/async-debouncer/createAsyncDebouncer.js.map +0 -1
- package/dist/async-debouncer/index.cjs +0 -11
- package/dist/async-debouncer/index.d.cts +0 -3
- package/dist/async-queuer/createAsyncQueuer.cjs +0 -158
- package/dist/async-queuer/createAsyncQueuer.cjs.map +0 -1
- package/dist/async-queuer/createAsyncQueuer.d.cts +0 -170
- package/dist/async-queuer/createAsyncQueuer.js.map +0 -1
- package/dist/async-queuer/index.cjs +0 -11
- package/dist/async-queuer/index.d.cts +0 -3
- package/dist/async-rate-limiter/createAsyncRateLimiter.cjs +0 -193
- package/dist/async-rate-limiter/createAsyncRateLimiter.cjs.map +0 -1
- package/dist/async-rate-limiter/createAsyncRateLimiter.d.cts +0 -209
- package/dist/async-rate-limiter/createAsyncRateLimiter.js.map +0 -1
- package/dist/async-rate-limiter/index.cjs +0 -11
- package/dist/async-rate-limiter/index.d.cts +0 -3
- package/dist/async-throttler/createAsyncThrottler.cjs +0 -151
- package/dist/async-throttler/createAsyncThrottler.cjs.map +0 -1
- package/dist/async-throttler/createAsyncThrottler.d.cts +0 -164
- package/dist/async-throttler/createAsyncThrottler.js.map +0 -1
- package/dist/async-throttler/index.cjs +0 -11
- package/dist/async-throttler/index.d.cts +0 -3
- package/dist/batcher/createBatcher.cjs +0 -132
- package/dist/batcher/createBatcher.cjs.map +0 -1
- package/dist/batcher/createBatcher.d.cts +0 -147
- package/dist/batcher/createBatcher.js.map +0 -1
- package/dist/batcher/index.cjs +0 -11
- package/dist/batcher/index.d.cts +0 -3
- package/dist/debouncer/createDebouncedSignal.cjs +0 -88
- package/dist/debouncer/createDebouncedSignal.cjs.map +0 -1
- package/dist/debouncer/createDebouncedSignal.d.cts +0 -80
- package/dist/debouncer/createDebouncedSignal.js.map +0 -1
- package/dist/debouncer/createDebouncedValue.cjs +0 -77
- package/dist/debouncer/createDebouncedValue.cjs.map +0 -1
- package/dist/debouncer/createDebouncedValue.d.cts +0 -71
- package/dist/debouncer/createDebouncedValue.js.map +0 -1
- package/dist/debouncer/createDebouncer.cjs +0 -129
- package/dist/debouncer/createDebouncer.cjs.map +0 -1
- package/dist/debouncer/createDebouncer.d.cts +0 -145
- package/dist/debouncer/createDebouncer.js.map +0 -1
- package/dist/debouncer/index.cjs +0 -15
- package/dist/debouncer/index.d.cts +0 -5
- package/dist/index.cjs +0 -47
- package/dist/index.d.cts +0 -20
- package/dist/provider/PacerProvider.cjs +0 -27
- package/dist/provider/PacerProvider.cjs.map +0 -1
- package/dist/provider/PacerProvider.d.cts +0 -29
- package/dist/provider/PacerProvider.js.map +0 -1
- package/dist/provider/index.cjs +0 -6
- package/dist/provider/index.d.cts +0 -2
- package/dist/queuer/createQueuedSignal.cjs +0 -129
- package/dist/queuer/createQueuedSignal.cjs.map +0 -1
- package/dist/queuer/createQueuedSignal.d.cts +0 -122
- package/dist/queuer/createQueuedSignal.js.map +0 -1
- package/dist/queuer/createQueuer.cjs +0 -133
- package/dist/queuer/createQueuer.cjs.map +0 -1
- package/dist/queuer/createQueuer.d.cts +0 -148
- package/dist/queuer/createQueuer.js.map +0 -1
- package/dist/queuer/index.cjs +0 -13
- package/dist/queuer/index.d.cts +0 -4
- package/dist/rate-limiter/createRateLimitedSignal.cjs +0 -102
- package/dist/rate-limiter/createRateLimitedSignal.cjs.map +0 -1
- package/dist/rate-limiter/createRateLimitedSignal.d.cts +0 -94
- package/dist/rate-limiter/createRateLimitedSignal.js.map +0 -1
- package/dist/rate-limiter/createRateLimitedValue.cjs +0 -102
- package/dist/rate-limiter/createRateLimitedValue.cjs.map +0 -1
- package/dist/rate-limiter/createRateLimitedValue.d.cts +0 -96
- package/dist/rate-limiter/createRateLimitedValue.js.map +0 -1
- package/dist/rate-limiter/createRateLimiter.cjs +0 -157
- package/dist/rate-limiter/createRateLimiter.cjs.map +0 -1
- package/dist/rate-limiter/createRateLimiter.d.cts +0 -174
- package/dist/rate-limiter/createRateLimiter.js.map +0 -1
- package/dist/rate-limiter/index.cjs +0 -15
- package/dist/rate-limiter/index.d.cts +0 -5
- package/dist/throttler/createThrottledSignal.cjs +0 -79
- package/dist/throttler/createThrottledSignal.cjs.map +0 -1
- package/dist/throttler/createThrottledSignal.d.cts +0 -71
- package/dist/throttler/createThrottledSignal.js.map +0 -1
- package/dist/throttler/createThrottledValue.cjs +0 -74
- package/dist/throttler/createThrottledValue.cjs.map +0 -1
- package/dist/throttler/createThrottledValue.d.cts +0 -68
- package/dist/throttler/createThrottledValue.js.map +0 -1
- package/dist/throttler/createThrottler.cjs +0 -132
- package/dist/throttler/createThrottler.cjs.map +0 -1
- package/dist/throttler/createThrottler.d.cts +0 -148
- package/dist/throttler/createThrottler.js.map +0 -1
- package/dist/throttler/index.cjs +0 -15
- package/dist/throttler/index.d.cts +0 -5
- package/dist/types/index.cjs +0 -9
- package/dist/types/index.d.cts +0 -1
- package/dist/utils/index.cjs +0 -9
- package/dist/utils/index.d.cts +0 -1
- package/src/async-batcher/createAsyncBatcher.ts +0 -234
- package/src/async-batcher/index.ts +0 -3
- package/src/async-debouncer/createAsyncDebouncer.ts +0 -225
- package/src/async-debouncer/index.ts +0 -4
- package/src/async-queuer/createAsyncQueuer.ts +0 -226
- package/src/async-queuer/index.ts +0 -3
- package/src/async-rate-limiter/createAsyncRateLimiter.ts +0 -269
- package/src/async-rate-limiter/index.ts +0 -4
- package/src/async-throttler/createAsyncThrottler.ts +0 -225
- package/src/async-throttler/index.ts +0 -4
- package/src/batcher/createBatcher.ts +0 -199
- package/src/batcher/index.ts +0 -3
- package/src/debouncer/createDebouncedSignal.ts +0 -92
- package/src/debouncer/createDebouncedValue.ts +0 -85
- package/src/debouncer/createDebouncer.ts +0 -201
- package/src/debouncer/index.ts +0 -6
- package/src/index.ts +0 -46
- package/src/provider/PacerProvider.tsx +0 -63
- package/src/provider/index.ts +0 -1
- package/src/queuer/createQueuedSignal.ts +0 -138
- package/src/queuer/createQueuer.ts +0 -199
- package/src/queuer/index.ts +0 -4
- package/src/rate-limiter/createRateLimitedSignal.ts +0 -117
- package/src/rate-limiter/createRateLimitedValue.ts +0 -110
- package/src/rate-limiter/createRateLimiter.ts +0 -226
- package/src/rate-limiter/index.ts +0 -5
- package/src/throttler/createThrottledSignal.ts +0 -81
- package/src/throttler/createThrottledValue.ts +0 -82
- package/src/throttler/createThrottler.ts +0 -204
- package/src/throttler/index.ts +0 -6
- package/src/types/index.ts +0 -1
- package/src/utils/index.ts +0 -1
|
@@ -1,151 +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_async_debouncer = require("@tanstack/pacer/async-debouncer");
|
|
5
|
-
|
|
6
|
-
//#region src/async-debouncer/createAsyncDebouncer.ts
|
|
7
|
-
/**
|
|
8
|
-
* A low-level Solid hook that creates an `AsyncDebouncer` instance to delay execution of an async function.
|
|
9
|
-
*
|
|
10
|
-
* This hook is designed to be flexible and state-management agnostic - it simply returns a debouncer instance that
|
|
11
|
-
* you can integrate with any state management solution (createSignal, etc).
|
|
12
|
-
*
|
|
13
|
-
* Async debouncing ensures that an async function only executes after a specified delay has passed since its last invocation.
|
|
14
|
-
* Each new invocation resets the delay timer. This is useful for handling frequent events like window resizing
|
|
15
|
-
* or input changes where you only want to execute the handler after the events have stopped occurring.
|
|
16
|
-
*
|
|
17
|
-
* Unlike throttling which allows execution at regular intervals, debouncing prevents any execution until
|
|
18
|
-
* the function stops being called for the specified delay period.
|
|
19
|
-
*
|
|
20
|
-
* Unlike the non-async Debouncer, this async version supports returning values from the debounced function,
|
|
21
|
-
* making it ideal for API calls and other async operations where you want the result of the `maybeExecute` call
|
|
22
|
-
* instead of setting the result on a state variable from within the debounced function.
|
|
23
|
-
*
|
|
24
|
-
* Error Handling:
|
|
25
|
-
* - If an `onError` handler is provided, it will be called with the error and debouncer instance
|
|
26
|
-
* - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown
|
|
27
|
-
* - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed
|
|
28
|
-
* - Both onError and throwOnError can be used together - the handler will be called before any error is thrown
|
|
29
|
-
* - The error state can be checked using the underlying AsyncDebouncer instance
|
|
30
|
-
*
|
|
31
|
-
* ## State Management and Selector
|
|
32
|
-
*
|
|
33
|
-
* The hook uses TanStack Store for reactive state management. You can subscribe to state changes
|
|
34
|
-
* in two ways:
|
|
35
|
-
*
|
|
36
|
-
* **1. Using `debouncer.Subscribe` component (Recommended for component tree subscriptions)**
|
|
37
|
-
*
|
|
38
|
-
* Use the `Subscribe` component to subscribe to state changes deep in your component tree without
|
|
39
|
-
* needing to pass a selector to the hook. This is ideal when you want to subscribe to state
|
|
40
|
-
* in child components.
|
|
41
|
-
*
|
|
42
|
-
* **2. Using the `selector` parameter (For hook-level subscriptions)**
|
|
43
|
-
*
|
|
44
|
-
* The `selector` parameter allows you to specify which state changes will trigger reactive updates
|
|
45
|
-
* at the hook level, optimizing performance by preventing unnecessary updates when irrelevant
|
|
46
|
-
* state changes occur.
|
|
47
|
-
*
|
|
48
|
-
* **By default, there will be no reactive state subscriptions** and you must opt-in to state
|
|
49
|
-
* tracking by providing a selector function or using the `Subscribe` component. This prevents unnecessary
|
|
50
|
-
* updates and gives you full control over when your component tracks state changes.
|
|
51
|
-
*
|
|
52
|
-
* Available state properties:
|
|
53
|
-
* - `canLeadingExecute`: Whether the debouncer can execute on the leading edge
|
|
54
|
-
* - `executionCount`: Number of function executions that have been completed
|
|
55
|
-
* - `hasError`: Whether the last execution resulted in an error
|
|
56
|
-
* - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution
|
|
57
|
-
* - `isExecuting`: Whether an async function execution is currently in progress
|
|
58
|
-
* - `lastArgs`: The arguments from the most recent call to maybeExecute
|
|
59
|
-
* - `lastError`: The error from the most recent failed execution (if any)
|
|
60
|
-
* - `lastResult`: The result from the most recent successful execution
|
|
61
|
-
* - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing')
|
|
62
|
-
*
|
|
63
|
-
* ## Unmount behavior
|
|
64
|
-
*
|
|
65
|
-
* By default, the primitive cancels any pending execution and aborts any in-flight execution when the owning component unmounts.
|
|
66
|
-
* Abort only cancels underlying operations (e.g. fetch) when the abort signal from `getAbortSignal()` is passed to them.
|
|
67
|
-
* Use the `onUnmount` option to customize this. For example, to flush pending work instead:
|
|
68
|
-
*
|
|
69
|
-
* ```tsx
|
|
70
|
-
* const debouncer = createAsyncDebouncer(fn, {
|
|
71
|
-
* wait: 500,
|
|
72
|
-
* onUnmount: (d) => d.flush()
|
|
73
|
-
* });
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* Note: For async utils, `flush()` returns a Promise and runs fire-and-forget in the cleanup.
|
|
77
|
-
* If your debounced function updates Solid signals, those updates may run after the component has
|
|
78
|
-
* unmounted, which can cause unexpected reactive updates. Guard your callbacks accordingly when
|
|
79
|
-
* using onUnmount with flush.
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```tsx
|
|
83
|
-
* // Default behavior - no reactive state subscriptions
|
|
84
|
-
* const { maybeExecute } = createAsyncDebouncer(
|
|
85
|
-
* async (query: string) => {
|
|
86
|
-
* const results = await api.search(query);
|
|
87
|
-
* return results;
|
|
88
|
-
* },
|
|
89
|
-
* { wait: 500 }
|
|
90
|
-
* );
|
|
91
|
-
*
|
|
92
|
-
* // Opt-in to track isPending or isExecuting changes (optimized for loading states)
|
|
93
|
-
* const debouncer = createAsyncDebouncer(
|
|
94
|
-
* async (query: string) => {
|
|
95
|
-
* const results = await api.search(query);
|
|
96
|
-
* return results;
|
|
97
|
-
* },
|
|
98
|
-
* { wait: 500 },
|
|
99
|
-
* (state) => ({ isPending: state.isPending, isExecuting: state.isExecuting })
|
|
100
|
-
* );
|
|
101
|
-
*
|
|
102
|
-
* // Opt-in to track error state changes (optimized for error handling)
|
|
103
|
-
* const debouncer = createAsyncDebouncer(
|
|
104
|
-
* async (searchTerm) => {
|
|
105
|
-
* const data = await searchAPI(searchTerm);
|
|
106
|
-
* return data;
|
|
107
|
-
* },
|
|
108
|
-
* {
|
|
109
|
-
* wait: 300,
|
|
110
|
-
* leading: true, // Execute immediately on first call
|
|
111
|
-
* trailing: false, // Skip trailing edge updates
|
|
112
|
-
* onError: (error) => {
|
|
113
|
-
* console.error('API call failed:', error);
|
|
114
|
-
* }
|
|
115
|
-
* },
|
|
116
|
-
* (state) => ({ hasError: state.hasError, lastError: state.lastError })
|
|
117
|
-
* );
|
|
118
|
-
*
|
|
119
|
-
* // Access the selected state (will be empty object {} unless selector provided)
|
|
120
|
-
* const { isPending, isExecuting } = debouncer.state();
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
function createAsyncDebouncer(fn, options, selector = () => ({})) {
|
|
124
|
-
const mergedOptions = {
|
|
125
|
-
...require_PacerProvider.useDefaultPacerOptions().asyncDebouncer,
|
|
126
|
-
...options
|
|
127
|
-
};
|
|
128
|
-
const asyncDebouncer = new _tanstack_pacer_async_debouncer.AsyncDebouncer(fn, mergedOptions);
|
|
129
|
-
asyncDebouncer.Subscribe = function Subscribe(props) {
|
|
130
|
-
const selected = (0, _tanstack_solid_store.useSelector)(asyncDebouncer.store, props.selector, { compare: _tanstack_solid_store.shallow });
|
|
131
|
-
return typeof props.children === "function" ? props.children(selected) : props.children;
|
|
132
|
-
};
|
|
133
|
-
const state = (0, _tanstack_solid_store.useSelector)(asyncDebouncer.store, selector, { compare: _tanstack_solid_store.shallow });
|
|
134
|
-
(0, solid_js.createEffect)(() => {
|
|
135
|
-
(0, solid_js.onCleanup)(() => {
|
|
136
|
-
if (mergedOptions.onUnmount) mergedOptions.onUnmount(asyncDebouncer);
|
|
137
|
-
else {
|
|
138
|
-
asyncDebouncer.cancel();
|
|
139
|
-
asyncDebouncer.abort();
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
return {
|
|
144
|
-
...asyncDebouncer,
|
|
145
|
-
state
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
//#endregion
|
|
150
|
-
exports.createAsyncDebouncer = createAsyncDebouncer;
|
|
151
|
-
//# sourceMappingURL=createAsyncDebouncer.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createAsyncDebouncer.cjs","names":["useDefaultPacerOptions","AsyncDebouncer","shallow"],"sources":["../../src/async-debouncer/createAsyncDebouncer.ts"],"sourcesContent":["import { AsyncDebouncer } from '@tanstack/pacer/async-debouncer'\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 {\n AsyncDebouncerOptions,\n AsyncDebouncerState,\n} from '@tanstack/pacer/async-debouncer'\nimport type { AnyAsyncFunction } from '@tanstack/pacer/types'\n\nexport interface SolidAsyncDebouncerOptions<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n> extends AsyncDebouncerOptions<TFn> {\n /**\n * Optional callback invoked when the owning component unmounts. Receives the debouncer instance.\n * When provided, replaces the default cleanup (cancel + abort); use it to call flush(), reset(), cancel(), add logging, etc.\n */\n onUnmount?: (debouncer: SolidAsyncDebouncer<TFn, TSelected>) => void\n}\n\nexport interface SolidAsyncDebouncer<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n> extends Omit<AsyncDebouncer<TFn>, 'store'> {\n /**\n * A Solid component that allows you to subscribe to the debouncer state.\n *\n * This is useful for tracking specific parts of the debouncer state\n * deep in your component tree without needing to pass a selector to the hook.\n *\n * @example\n * <debouncer.Subscribe selector={(state) => ({ isPending: state.isPending, isExecuting: state.isExecuting })}>\n * {(state) => (\n * <div>{state().isPending ? 'Waiting...' : state().isExecuting ? 'Executing...' : 'Ready'}</div>\n * )}\n * </debouncer.Subscribe>\n */\n Subscribe: <TSelected>(props: {\n selector: (state: AsyncDebouncerState<TFn>) => TSelected\n children: ((state: Accessor<TSelected>) => JSX.Element) | JSX.Element\n }) => JSX.Element\n /**\n * Reactive state that will be updated when the debouncer state changes\n *\n * Use this instead of `debouncer.store.state`\n */\n readonly state: Accessor<Readonly<TSelected>>\n /**\n * @deprecated Use `debouncer.state` instead of `debouncer.store.state` if you want to read reactive state.\n * The state on the store object is not reactive, as it has not been wrapped in a `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<AsyncDebouncerState<TFn>>>\n}\n\n/**\n * A low-level Solid hook that creates an `AsyncDebouncer` instance to delay execution of an async function.\n *\n * This hook is designed to be flexible and state-management agnostic - it simply returns a debouncer instance that\n * you can integrate with any state management solution (createSignal, etc).\n *\n * Async debouncing ensures that an async function only executes after a specified delay has passed since its last invocation.\n * Each new invocation resets the delay timer. This is useful for handling frequent events like window resizing\n * or input changes where you only want to execute the handler after the events have stopped occurring.\n *\n * Unlike throttling which allows execution at regular intervals, debouncing prevents any execution until\n * the function stops being called for the specified delay period.\n *\n * Unlike the non-async Debouncer, this async version supports returning values from the debounced function,\n * making it ideal for API calls and other async operations where you want the result of the `maybeExecute` call\n * instead of setting the result on a state variable from within the debounced function.\n *\n * Error Handling:\n * - If an `onError` handler is provided, it will be called with the error and debouncer instance\n * - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown\n * - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed\n * - Both onError and throwOnError can be used together - the handler will be called before any error is thrown\n * - The error state can be checked using the underlying AsyncDebouncer instance\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. You can subscribe to state changes\n * in two ways:\n *\n * **1. Using `debouncer.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 * - `canLeadingExecute`: Whether the debouncer can execute on the leading edge\n * - `executionCount`: Number of function executions that have been completed\n * - `hasError`: Whether the last execution resulted in an error\n * - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution\n * - `isExecuting`: Whether an async function execution is currently in progress\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `lastError`: The error from the most recent failed execution (if any)\n * - `lastResult`: The result from the most recent successful execution\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing')\n *\n * ## Unmount behavior\n *\n * By default, the primitive cancels any pending execution and aborts any in-flight execution when the owning component unmounts.\n * Abort only cancels underlying operations (e.g. fetch) when the abort signal from `getAbortSignal()` is passed to them.\n * Use the `onUnmount` option to customize this. For example, to flush pending work instead:\n *\n * ```tsx\n * const debouncer = createAsyncDebouncer(fn, {\n * wait: 500,\n * onUnmount: (d) => d.flush()\n * });\n * ```\n *\n * Note: For async utils, `flush()` returns a Promise and runs fire-and-forget in the cleanup.\n * If your debounced function updates Solid signals, those updates may run after the component has\n * unmounted, which can cause unexpected reactive updates. Guard your callbacks accordingly when\n * using onUnmount with flush.\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const { maybeExecute } = createAsyncDebouncer(\n * async (query: string) => {\n * const results = await api.search(query);\n * return results;\n * },\n * { wait: 500 }\n * );\n *\n * // Opt-in to track isPending or isExecuting changes (optimized for loading states)\n * const debouncer = createAsyncDebouncer(\n * async (query: string) => {\n * const results = await api.search(query);\n * return results;\n * },\n * { wait: 500 },\n * (state) => ({ isPending: state.isPending, isExecuting: state.isExecuting })\n * );\n *\n * // Opt-in to track error state changes (optimized for error handling)\n * const debouncer = createAsyncDebouncer(\n * async (searchTerm) => {\n * const data = await searchAPI(searchTerm);\n * return data;\n * },\n * {\n * wait: 300,\n * leading: true, // Execute immediately on first call\n * trailing: false, // Skip trailing edge updates\n * onError: (error) => {\n * console.error('API call failed:', error);\n * }\n * },\n * (state) => ({ hasError: state.hasError, lastError: state.lastError })\n * );\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { isPending, isExecuting } = debouncer.state();\n * ```\n */\nexport function createAsyncDebouncer<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n>(\n fn: TFn,\n options: SolidAsyncDebouncerOptions<TFn, TSelected>,\n selector: (state: AsyncDebouncerState<TFn>) => TSelected = () =>\n ({}) as TSelected,\n): SolidAsyncDebouncer<TFn, TSelected> {\n const mergedOptions = {\n ...useDefaultPacerOptions().asyncDebouncer,\n ...options,\n } as SolidAsyncDebouncerOptions<TFn, TSelected>\n const asyncDebouncer = new AsyncDebouncer<TFn>(\n fn,\n mergedOptions,\n ) as unknown as SolidAsyncDebouncer<TFn, TSelected>\n\n asyncDebouncer.Subscribe = function Subscribe<TSelected>(props: {\n selector: (state: AsyncDebouncerState<TFn>) => TSelected\n children: ((state: Accessor<TSelected>) => JSX.Element) | JSX.Element\n }) {\n const selected = useSelector(asyncDebouncer.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(asyncDebouncer.store, selector, {\n compare: shallow,\n })\n\n createEffect(() => {\n onCleanup(() => {\n if (mergedOptions.onUnmount) {\n mergedOptions.onUnmount(asyncDebouncer)\n } else {\n asyncDebouncer.cancel()\n asyncDebouncer.abort()\n }\n })\n })\n\n return {\n ...asyncDebouncer,\n state,\n } as SolidAsyncDebouncer<TFn, TSelected> // omit `store` in favor of `state`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8KA,SAAgB,qBAId,IACA,SACA,kBACG,EAAE,GACgC;CACrC,MAAM,gBAAgB;EACpB,GAAGA,8CAAwB,CAAC;EAC5B,GAAG;EACJ;CACD,MAAM,iBAAiB,IAAIC,+CACzB,IACA,cACD;CAED,eAAe,YAAY,SAAS,UAAqB,OAGtD;EACD,MAAM,kDAAuB,eAAe,OAAO,MAAM,UAAU,EACjE,SAASC,+BACV,CAAC;EAEF,OAAO,OAAO,MAAM,aAAa,aAC7B,MAAM,SAAS,SAAS,GACxB,MAAM;;CAGZ,MAAM,+CAAoB,eAAe,OAAO,UAAU,EACxD,SAASA,+BACV,CAAC;CAEF,iCAAmB;EACjB,8BAAgB;GACd,IAAI,cAAc,WAChB,cAAc,UAAU,eAAe;QAClC;IACL,eAAe,QAAQ;IACvB,eAAe,OAAO;;IAExB;GACF;CAEF,OAAO;EACL,GAAG;EACH;EACD"}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { Store } from "@tanstack/solid-store";
|
|
2
|
-
import { Accessor, JSX } from "solid-js";
|
|
3
|
-
import { AsyncDebouncer, AsyncDebouncerOptions, AsyncDebouncerState } from "@tanstack/pacer/async-debouncer";
|
|
4
|
-
import { AnyAsyncFunction } from "@tanstack/pacer/types";
|
|
5
|
-
|
|
6
|
-
//#region src/async-debouncer/createAsyncDebouncer.d.ts
|
|
7
|
-
interface SolidAsyncDebouncerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncDebouncerOptions<TFn> {
|
|
8
|
-
/**
|
|
9
|
-
* Optional callback invoked when the owning component unmounts. Receives the debouncer instance.
|
|
10
|
-
* When provided, replaces the default cleanup (cancel + abort); use it to call flush(), reset(), cancel(), add logging, etc.
|
|
11
|
-
*/
|
|
12
|
-
onUnmount?: (debouncer: SolidAsyncDebouncer<TFn, TSelected>) => void;
|
|
13
|
-
}
|
|
14
|
-
interface SolidAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncDebouncer<TFn>, 'store'> {
|
|
15
|
-
/**
|
|
16
|
-
* A Solid component that allows you to subscribe to the debouncer state.
|
|
17
|
-
*
|
|
18
|
-
* This is useful for tracking specific parts of the debouncer state
|
|
19
|
-
* deep in your component tree without needing to pass a selector to the hook.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* <debouncer.Subscribe selector={(state) => ({ isPending: state.isPending, isExecuting: state.isExecuting })}>
|
|
23
|
-
* {(state) => (
|
|
24
|
-
* <div>{state().isPending ? 'Waiting...' : state().isExecuting ? 'Executing...' : 'Ready'}</div>
|
|
25
|
-
* )}
|
|
26
|
-
* </debouncer.Subscribe>
|
|
27
|
-
*/
|
|
28
|
-
Subscribe: <TSelected>(props: {
|
|
29
|
-
selector: (state: AsyncDebouncerState<TFn>) => TSelected;
|
|
30
|
-
children: ((state: Accessor<TSelected>) => JSX.Element) | JSX.Element;
|
|
31
|
-
}) => JSX.Element;
|
|
32
|
-
/**
|
|
33
|
-
* Reactive state that will be updated when the debouncer state changes
|
|
34
|
-
*
|
|
35
|
-
* Use this instead of `debouncer.store.state`
|
|
36
|
-
*/
|
|
37
|
-
readonly state: Accessor<Readonly<TSelected>>;
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated Use `debouncer.state` instead of `debouncer.store.state` if you want to read reactive state.
|
|
40
|
-
* The state on the store object is not reactive, as it has not been wrapped in a `useSelector` hook internally.
|
|
41
|
-
* Although, you can make the state reactive by using the `useSelector` in your own usage.
|
|
42
|
-
*/
|
|
43
|
-
readonly store: Store<Readonly<AsyncDebouncerState<TFn>>>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* A low-level Solid hook that creates an `AsyncDebouncer` instance to delay execution of an async function.
|
|
47
|
-
*
|
|
48
|
-
* This hook is designed to be flexible and state-management agnostic - it simply returns a debouncer instance that
|
|
49
|
-
* you can integrate with any state management solution (createSignal, etc).
|
|
50
|
-
*
|
|
51
|
-
* Async debouncing ensures that an async function only executes after a specified delay has passed since its last invocation.
|
|
52
|
-
* Each new invocation resets the delay timer. This is useful for handling frequent events like window resizing
|
|
53
|
-
* or input changes where you only want to execute the handler after the events have stopped occurring.
|
|
54
|
-
*
|
|
55
|
-
* Unlike throttling which allows execution at regular intervals, debouncing prevents any execution until
|
|
56
|
-
* the function stops being called for the specified delay period.
|
|
57
|
-
*
|
|
58
|
-
* Unlike the non-async Debouncer, this async version supports returning values from the debounced function,
|
|
59
|
-
* making it ideal for API calls and other async operations where you want the result of the `maybeExecute` call
|
|
60
|
-
* instead of setting the result on a state variable from within the debounced function.
|
|
61
|
-
*
|
|
62
|
-
* Error Handling:
|
|
63
|
-
* - If an `onError` handler is provided, it will be called with the error and debouncer instance
|
|
64
|
-
* - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown
|
|
65
|
-
* - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed
|
|
66
|
-
* - Both onError and throwOnError can be used together - the handler will be called before any error is thrown
|
|
67
|
-
* - The error state can be checked using the underlying AsyncDebouncer instance
|
|
68
|
-
*
|
|
69
|
-
* ## State Management and Selector
|
|
70
|
-
*
|
|
71
|
-
* The hook uses TanStack Store for reactive state management. You can subscribe to state changes
|
|
72
|
-
* in two ways:
|
|
73
|
-
*
|
|
74
|
-
* **1. Using `debouncer.Subscribe` component (Recommended for component tree subscriptions)**
|
|
75
|
-
*
|
|
76
|
-
* Use the `Subscribe` component to subscribe to state changes deep in your component tree without
|
|
77
|
-
* needing to pass a selector to the hook. This is ideal when you want to subscribe to state
|
|
78
|
-
* in child components.
|
|
79
|
-
*
|
|
80
|
-
* **2. Using the `selector` parameter (For hook-level subscriptions)**
|
|
81
|
-
*
|
|
82
|
-
* The `selector` parameter allows you to specify which state changes will trigger reactive updates
|
|
83
|
-
* at the hook level, optimizing performance by preventing unnecessary updates when irrelevant
|
|
84
|
-
* state changes occur.
|
|
85
|
-
*
|
|
86
|
-
* **By default, there will be no reactive state subscriptions** and you must opt-in to state
|
|
87
|
-
* tracking by providing a selector function or using the `Subscribe` component. This prevents unnecessary
|
|
88
|
-
* updates and gives you full control over when your component tracks state changes.
|
|
89
|
-
*
|
|
90
|
-
* Available state properties:
|
|
91
|
-
* - `canLeadingExecute`: Whether the debouncer can execute on the leading edge
|
|
92
|
-
* - `executionCount`: Number of function executions that have been completed
|
|
93
|
-
* - `hasError`: Whether the last execution resulted in an error
|
|
94
|
-
* - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution
|
|
95
|
-
* - `isExecuting`: Whether an async function execution is currently in progress
|
|
96
|
-
* - `lastArgs`: The arguments from the most recent call to maybeExecute
|
|
97
|
-
* - `lastError`: The error from the most recent failed execution (if any)
|
|
98
|
-
* - `lastResult`: The result from the most recent successful execution
|
|
99
|
-
* - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing')
|
|
100
|
-
*
|
|
101
|
-
* ## Unmount behavior
|
|
102
|
-
*
|
|
103
|
-
* By default, the primitive cancels any pending execution and aborts any in-flight execution when the owning component unmounts.
|
|
104
|
-
* Abort only cancels underlying operations (e.g. fetch) when the abort signal from `getAbortSignal()` is passed to them.
|
|
105
|
-
* Use the `onUnmount` option to customize this. For example, to flush pending work instead:
|
|
106
|
-
*
|
|
107
|
-
* ```tsx
|
|
108
|
-
* const debouncer = createAsyncDebouncer(fn, {
|
|
109
|
-
* wait: 500,
|
|
110
|
-
* onUnmount: (d) => d.flush()
|
|
111
|
-
* });
|
|
112
|
-
* ```
|
|
113
|
-
*
|
|
114
|
-
* Note: For async utils, `flush()` returns a Promise and runs fire-and-forget in the cleanup.
|
|
115
|
-
* If your debounced function updates Solid signals, those updates may run after the component has
|
|
116
|
-
* unmounted, which can cause unexpected reactive updates. Guard your callbacks accordingly when
|
|
117
|
-
* using onUnmount with flush.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```tsx
|
|
121
|
-
* // Default behavior - no reactive state subscriptions
|
|
122
|
-
* const { maybeExecute } = createAsyncDebouncer(
|
|
123
|
-
* async (query: string) => {
|
|
124
|
-
* const results = await api.search(query);
|
|
125
|
-
* return results;
|
|
126
|
-
* },
|
|
127
|
-
* { wait: 500 }
|
|
128
|
-
* );
|
|
129
|
-
*
|
|
130
|
-
* // Opt-in to track isPending or isExecuting changes (optimized for loading states)
|
|
131
|
-
* const debouncer = createAsyncDebouncer(
|
|
132
|
-
* async (query: string) => {
|
|
133
|
-
* const results = await api.search(query);
|
|
134
|
-
* return results;
|
|
135
|
-
* },
|
|
136
|
-
* { wait: 500 },
|
|
137
|
-
* (state) => ({ isPending: state.isPending, isExecuting: state.isExecuting })
|
|
138
|
-
* );
|
|
139
|
-
*
|
|
140
|
-
* // Opt-in to track error state changes (optimized for error handling)
|
|
141
|
-
* const debouncer = createAsyncDebouncer(
|
|
142
|
-
* async (searchTerm) => {
|
|
143
|
-
* const data = await searchAPI(searchTerm);
|
|
144
|
-
* return data;
|
|
145
|
-
* },
|
|
146
|
-
* {
|
|
147
|
-
* wait: 300,
|
|
148
|
-
* leading: true, // Execute immediately on first call
|
|
149
|
-
* trailing: false, // Skip trailing edge updates
|
|
150
|
-
* onError: (error) => {
|
|
151
|
-
* console.error('API call failed:', error);
|
|
152
|
-
* }
|
|
153
|
-
* },
|
|
154
|
-
* (state) => ({ hasError: state.hasError, lastError: state.lastError })
|
|
155
|
-
* );
|
|
156
|
-
*
|
|
157
|
-
* // Access the selected state (will be empty object {} unless selector provided)
|
|
158
|
-
* const { isPending, isExecuting } = debouncer.state();
|
|
159
|
-
* ```
|
|
160
|
-
*/
|
|
161
|
-
declare function createAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: SolidAsyncDebouncerOptions<TFn, TSelected>, selector?: (state: AsyncDebouncerState<TFn>) => TSelected): SolidAsyncDebouncer<TFn, TSelected>;
|
|
162
|
-
//#endregion
|
|
163
|
-
export { SolidAsyncDebouncer, SolidAsyncDebouncerOptions, createAsyncDebouncer };
|
|
164
|
-
//# sourceMappingURL=createAsyncDebouncer.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createAsyncDebouncer.js","names":[],"sources":["../../src/async-debouncer/createAsyncDebouncer.ts"],"sourcesContent":["import { AsyncDebouncer } from '@tanstack/pacer/async-debouncer'\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 {\n AsyncDebouncerOptions,\n AsyncDebouncerState,\n} from '@tanstack/pacer/async-debouncer'\nimport type { AnyAsyncFunction } from '@tanstack/pacer/types'\n\nexport interface SolidAsyncDebouncerOptions<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n> extends AsyncDebouncerOptions<TFn> {\n /**\n * Optional callback invoked when the owning component unmounts. Receives the debouncer instance.\n * When provided, replaces the default cleanup (cancel + abort); use it to call flush(), reset(), cancel(), add logging, etc.\n */\n onUnmount?: (debouncer: SolidAsyncDebouncer<TFn, TSelected>) => void\n}\n\nexport interface SolidAsyncDebouncer<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n> extends Omit<AsyncDebouncer<TFn>, 'store'> {\n /**\n * A Solid component that allows you to subscribe to the debouncer state.\n *\n * This is useful for tracking specific parts of the debouncer state\n * deep in your component tree without needing to pass a selector to the hook.\n *\n * @example\n * <debouncer.Subscribe selector={(state) => ({ isPending: state.isPending, isExecuting: state.isExecuting })}>\n * {(state) => (\n * <div>{state().isPending ? 'Waiting...' : state().isExecuting ? 'Executing...' : 'Ready'}</div>\n * )}\n * </debouncer.Subscribe>\n */\n Subscribe: <TSelected>(props: {\n selector: (state: AsyncDebouncerState<TFn>) => TSelected\n children: ((state: Accessor<TSelected>) => JSX.Element) | JSX.Element\n }) => JSX.Element\n /**\n * Reactive state that will be updated when the debouncer state changes\n *\n * Use this instead of `debouncer.store.state`\n */\n readonly state: Accessor<Readonly<TSelected>>\n /**\n * @deprecated Use `debouncer.state` instead of `debouncer.store.state` if you want to read reactive state.\n * The state on the store object is not reactive, as it has not been wrapped in a `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<AsyncDebouncerState<TFn>>>\n}\n\n/**\n * A low-level Solid hook that creates an `AsyncDebouncer` instance to delay execution of an async function.\n *\n * This hook is designed to be flexible and state-management agnostic - it simply returns a debouncer instance that\n * you can integrate with any state management solution (createSignal, etc).\n *\n * Async debouncing ensures that an async function only executes after a specified delay has passed since its last invocation.\n * Each new invocation resets the delay timer. This is useful for handling frequent events like window resizing\n * or input changes where you only want to execute the handler after the events have stopped occurring.\n *\n * Unlike throttling which allows execution at regular intervals, debouncing prevents any execution until\n * the function stops being called for the specified delay period.\n *\n * Unlike the non-async Debouncer, this async version supports returning values from the debounced function,\n * making it ideal for API calls and other async operations where you want the result of the `maybeExecute` call\n * instead of setting the result on a state variable from within the debounced function.\n *\n * Error Handling:\n * - If an `onError` handler is provided, it will be called with the error and debouncer instance\n * - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown\n * - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed\n * - Both onError and throwOnError can be used together - the handler will be called before any error is thrown\n * - The error state can be checked using the underlying AsyncDebouncer instance\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. You can subscribe to state changes\n * in two ways:\n *\n * **1. Using `debouncer.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 * - `canLeadingExecute`: Whether the debouncer can execute on the leading edge\n * - `executionCount`: Number of function executions that have been completed\n * - `hasError`: Whether the last execution resulted in an error\n * - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution\n * - `isExecuting`: Whether an async function execution is currently in progress\n * - `lastArgs`: The arguments from the most recent call to maybeExecute\n * - `lastError`: The error from the most recent failed execution (if any)\n * - `lastResult`: The result from the most recent successful execution\n * - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing')\n *\n * ## Unmount behavior\n *\n * By default, the primitive cancels any pending execution and aborts any in-flight execution when the owning component unmounts.\n * Abort only cancels underlying operations (e.g. fetch) when the abort signal from `getAbortSignal()` is passed to them.\n * Use the `onUnmount` option to customize this. For example, to flush pending work instead:\n *\n * ```tsx\n * const debouncer = createAsyncDebouncer(fn, {\n * wait: 500,\n * onUnmount: (d) => d.flush()\n * });\n * ```\n *\n * Note: For async utils, `flush()` returns a Promise and runs fire-and-forget in the cleanup.\n * If your debounced function updates Solid signals, those updates may run after the component has\n * unmounted, which can cause unexpected reactive updates. Guard your callbacks accordingly when\n * using onUnmount with flush.\n *\n * @example\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const { maybeExecute } = createAsyncDebouncer(\n * async (query: string) => {\n * const results = await api.search(query);\n * return results;\n * },\n * { wait: 500 }\n * );\n *\n * // Opt-in to track isPending or isExecuting changes (optimized for loading states)\n * const debouncer = createAsyncDebouncer(\n * async (query: string) => {\n * const results = await api.search(query);\n * return results;\n * },\n * { wait: 500 },\n * (state) => ({ isPending: state.isPending, isExecuting: state.isExecuting })\n * );\n *\n * // Opt-in to track error state changes (optimized for error handling)\n * const debouncer = createAsyncDebouncer(\n * async (searchTerm) => {\n * const data = await searchAPI(searchTerm);\n * return data;\n * },\n * {\n * wait: 300,\n * leading: true, // Execute immediately on first call\n * trailing: false, // Skip trailing edge updates\n * onError: (error) => {\n * console.error('API call failed:', error);\n * }\n * },\n * (state) => ({ hasError: state.hasError, lastError: state.lastError })\n * );\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { isPending, isExecuting } = debouncer.state();\n * ```\n */\nexport function createAsyncDebouncer<\n TFn extends AnyAsyncFunction,\n TSelected = {},\n>(\n fn: TFn,\n options: SolidAsyncDebouncerOptions<TFn, TSelected>,\n selector: (state: AsyncDebouncerState<TFn>) => TSelected = () =>\n ({}) as TSelected,\n): SolidAsyncDebouncer<TFn, TSelected> {\n const mergedOptions = {\n ...useDefaultPacerOptions().asyncDebouncer,\n ...options,\n } as SolidAsyncDebouncerOptions<TFn, TSelected>\n const asyncDebouncer = new AsyncDebouncer<TFn>(\n fn,\n mergedOptions,\n ) as unknown as SolidAsyncDebouncer<TFn, TSelected>\n\n asyncDebouncer.Subscribe = function Subscribe<TSelected>(props: {\n selector: (state: AsyncDebouncerState<TFn>) => TSelected\n children: ((state: Accessor<TSelected>) => JSX.Element) | JSX.Element\n }) {\n const selected = useSelector(asyncDebouncer.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(asyncDebouncer.store, selector, {\n compare: shallow,\n })\n\n createEffect(() => {\n onCleanup(() => {\n if (mergedOptions.onUnmount) {\n mergedOptions.onUnmount(asyncDebouncer)\n } else {\n asyncDebouncer.cancel()\n asyncDebouncer.abort()\n }\n })\n })\n\n return {\n ...asyncDebouncer,\n state,\n } as SolidAsyncDebouncer<TFn, TSelected> // omit `store` in favor of `state`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8KA,SAAgB,qBAId,IACA,SACA,kBACG,EAAE,GACgC;CACrC,MAAM,gBAAgB;EACpB,GAAG,wBAAwB,CAAC;EAC5B,GAAG;EACJ;CACD,MAAM,iBAAiB,IAAI,eACzB,IACA,cACD;CAED,eAAe,YAAY,SAAS,UAAqB,OAGtD;EACD,MAAM,WAAW,YAAY,eAAe,OAAO,MAAM,UAAU,EACjE,SAAS,SACV,CAAC;EAEF,OAAO,OAAO,MAAM,aAAa,aAC7B,MAAM,SAAS,SAAS,GACxB,MAAM;;CAGZ,MAAM,QAAQ,YAAY,eAAe,OAAO,UAAU,EACxD,SAAS,SACV,CAAC;CAEF,mBAAmB;EACjB,gBAAgB;GACd,IAAI,cAAc,WAChB,cAAc,UAAU,eAAe;QAClC;IACL,eAAe,QAAQ;IACvB,eAAe,OAAO;;IAExB;GACF;CAEF,OAAO;EACL,GAAG;EACH;EACD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_createAsyncDebouncer = require('./createAsyncDebouncer.cjs');
|
|
3
|
-
|
|
4
|
-
exports.createAsyncDebouncer = require_createAsyncDebouncer.createAsyncDebouncer;
|
|
5
|
-
var _tanstack_pacer_async_debouncer = require("@tanstack/pacer/async-debouncer");
|
|
6
|
-
Object.keys(_tanstack_pacer_async_debouncer).forEach(function (k) {
|
|
7
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return _tanstack_pacer_async_debouncer[k]; }
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1,158 +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_async_queuer = require("@tanstack/pacer/async-queuer");
|
|
5
|
-
|
|
6
|
-
//#region src/async-queuer/createAsyncQueuer.ts
|
|
7
|
-
/**
|
|
8
|
-
* Creates a Solid-compatible AsyncQueuer instance for managing an asynchronous queue of items, exposing Solid signals for all stateful properties.
|
|
9
|
-
*
|
|
10
|
-
* Features:
|
|
11
|
-
* - Priority queueing via `getPriority` or item `priority` property
|
|
12
|
-
* - Configurable concurrency limit
|
|
13
|
-
* - FIFO (First In First Out) or LIFO (Last In First Out) queue behavior
|
|
14
|
-
* - Pause/resume processing
|
|
15
|
-
* - Task cancellation
|
|
16
|
-
* - Item expiration
|
|
17
|
-
* - Lifecycle callbacks for success, error, settled, items change, etc.
|
|
18
|
-
* - All stateful properties (active items, pending items, counts, etc.) are exposed as Solid signals for reactivity
|
|
19
|
-
*
|
|
20
|
-
* Tasks are processed concurrently up to the configured concurrency limit. When a task completes,
|
|
21
|
-
* the next pending task is processed if the concurrency limit allows.
|
|
22
|
-
*
|
|
23
|
-
* Error Handling:
|
|
24
|
-
* - If an `onError` handler is provided, it will be called with the error and queuer instance
|
|
25
|
-
* - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown
|
|
26
|
-
* - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed
|
|
27
|
-
* - Both onError and throwOnError can be used together; the handler will be called before any error is thrown
|
|
28
|
-
* - The error state can be checked using the underlying AsyncQueuer instance
|
|
29
|
-
*
|
|
30
|
-
* ## State Management and Selector
|
|
31
|
-
*
|
|
32
|
-
* The hook uses TanStack Store for reactive state management. You can subscribe to state changes
|
|
33
|
-
* in two ways:
|
|
34
|
-
*
|
|
35
|
-
* **1. Using `queuer.Subscribe` component (Recommended for component tree subscriptions)**
|
|
36
|
-
*
|
|
37
|
-
* Use the `Subscribe` component to subscribe to state changes deep in your component tree without
|
|
38
|
-
* needing to pass a selector to the hook. This is ideal when you want to subscribe to state
|
|
39
|
-
* in child components.
|
|
40
|
-
*
|
|
41
|
-
* **2. Using the `selector` parameter (For hook-level subscriptions)**
|
|
42
|
-
*
|
|
43
|
-
* The `selector` parameter allows you to specify which state changes will trigger reactive updates
|
|
44
|
-
* at the hook level, optimizing performance by preventing unnecessary updates when irrelevant
|
|
45
|
-
* state changes occur.
|
|
46
|
-
*
|
|
47
|
-
* **By default, there will be no reactive state subscriptions** and you must opt-in to state
|
|
48
|
-
* tracking by providing a selector function or using the `Subscribe` component. This prevents unnecessary
|
|
49
|
-
* updates and gives you full control over when your component tracks state changes.
|
|
50
|
-
*
|
|
51
|
-
* Available state properties:
|
|
52
|
-
* - `activeItems`: Array of items currently being processed
|
|
53
|
-
* - `errorCount`: Number of items that failed processing
|
|
54
|
-
* - `isRunning`: Whether the queuer is currently running (not stopped)
|
|
55
|
-
* - `pendingItems`: Array of items waiting to be processed
|
|
56
|
-
* - `rejectionCount`: Number of items that were rejected (expired or failed validation)
|
|
57
|
-
* - `settleCount`: Number of items that have completed processing (successful or failed)
|
|
58
|
-
* - `successCount`: Number of items that were processed successfully
|
|
59
|
-
*
|
|
60
|
-
* ## Unmount behavior
|
|
61
|
-
*
|
|
62
|
-
* By default, the primitive stops the queuer and aborts any in-flight task executions when the owning component unmounts.
|
|
63
|
-
* Abort only cancels underlying operations (e.g. fetch) when the abort signal from `getAbortSignal()` is passed to them.
|
|
64
|
-
* Use the `onUnmount` option to customize this. For example, to flush pending items instead:
|
|
65
|
-
*
|
|
66
|
-
* ```tsx
|
|
67
|
-
* const queuer = createAsyncQueuer(fn, {
|
|
68
|
-
* concurrency: 2,
|
|
69
|
-
* started: false,
|
|
70
|
-
* onUnmount: (q) => q.flush()
|
|
71
|
-
* });
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* Note: For async utils, `flush()` returns a Promise and runs fire-and-forget in the cleanup.
|
|
75
|
-
* If your task function updates Solid signals, those updates may run after the component has
|
|
76
|
-
* unmounted, which can cause unexpected reactive updates. Guard your callbacks accordingly when
|
|
77
|
-
* using onUnmount with flush.
|
|
78
|
-
*
|
|
79
|
-
* Example usage:
|
|
80
|
-
* ```tsx
|
|
81
|
-
* // Default behavior - no reactive state subscriptions
|
|
82
|
-
* const asyncQueuer = createAsyncQueuer(async (item) => {
|
|
83
|
-
* // process item
|
|
84
|
-
* return await fetchData(item);
|
|
85
|
-
* }, {
|
|
86
|
-
* initialItems: [],
|
|
87
|
-
* concurrency: 2,
|
|
88
|
-
* maxSize: 100,
|
|
89
|
-
* started: false,
|
|
90
|
-
* onSuccess: (result) => {
|
|
91
|
-
* console.log('Item processed:', result);
|
|
92
|
-
* },
|
|
93
|
-
* onError: (error) => {
|
|
94
|
-
* console.error('Processing failed:', error);
|
|
95
|
-
* }
|
|
96
|
-
* });
|
|
97
|
-
*
|
|
98
|
-
* // Opt-in to track queue state changes (optimized for UI updates)
|
|
99
|
-
* const asyncQueuer = createAsyncQueuer(
|
|
100
|
-
* async (item) => await fetchData(item),
|
|
101
|
-
* { concurrency: 2, started: true },
|
|
102
|
-
* (state) => ({
|
|
103
|
-
* pendingItems: state.pendingItems,
|
|
104
|
-
* activeItems: state.activeItems,
|
|
105
|
-
* isRunning: state.isRunning
|
|
106
|
-
* })
|
|
107
|
-
* );
|
|
108
|
-
*
|
|
109
|
-
* // Opt-in to track processing metrics changes (optimized for tracking progress)
|
|
110
|
-
* const asyncQueuer = createAsyncQueuer(
|
|
111
|
-
* async (item) => await fetchData(item),
|
|
112
|
-
* { concurrency: 2, started: true },
|
|
113
|
-
* (state) => ({
|
|
114
|
-
* successCount: state.successCount,
|
|
115
|
-
* errorCount: state.errorCount,
|
|
116
|
-
* settleCount: state.settleCount
|
|
117
|
-
* })
|
|
118
|
-
* );
|
|
119
|
-
*
|
|
120
|
-
* // Add items to queue
|
|
121
|
-
* asyncQueuer.addItem(newItem);
|
|
122
|
-
*
|
|
123
|
-
* // Start processing
|
|
124
|
-
* asyncQueuer.start();
|
|
125
|
-
*
|
|
126
|
-
* // Access the selected state (will be empty object {} unless selector provided)
|
|
127
|
-
* const { pendingItems, activeItems } = asyncQueuer.state();
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
|
-
function createAsyncQueuer(fn, options = {}, selector = () => ({})) {
|
|
131
|
-
const mergedOptions = {
|
|
132
|
-
...require_PacerProvider.useDefaultPacerOptions().asyncQueuer,
|
|
133
|
-
...options
|
|
134
|
-
};
|
|
135
|
-
const asyncQueuer = new _tanstack_pacer_async_queuer.AsyncQueuer(fn, mergedOptions);
|
|
136
|
-
asyncQueuer.Subscribe = function Subscribe(props) {
|
|
137
|
-
const selected = (0, _tanstack_solid_store.useSelector)(asyncQueuer.store, props.selector, { compare: _tanstack_solid_store.shallow });
|
|
138
|
-
return typeof props.children === "function" ? props.children(selected) : props.children;
|
|
139
|
-
};
|
|
140
|
-
const state = (0, _tanstack_solid_store.useSelector)(asyncQueuer.store, selector, { compare: _tanstack_solid_store.shallow });
|
|
141
|
-
(0, solid_js.createEffect)(() => {
|
|
142
|
-
(0, solid_js.onCleanup)(() => {
|
|
143
|
-
if (mergedOptions.onUnmount) mergedOptions.onUnmount(asyncQueuer);
|
|
144
|
-
else {
|
|
145
|
-
asyncQueuer.stop();
|
|
146
|
-
asyncQueuer.abort();
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
return {
|
|
151
|
-
...asyncQueuer,
|
|
152
|
-
state
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
//#endregion
|
|
157
|
-
exports.createAsyncQueuer = createAsyncQueuer;
|
|
158
|
-
//# sourceMappingURL=createAsyncQueuer.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createAsyncQueuer.cjs","names":["useDefaultPacerOptions","AsyncQueuer","shallow"],"sources":["../../src/async-queuer/createAsyncQueuer.ts"],"sourcesContent":["import { AsyncQueuer } from '@tanstack/pacer/async-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 {\n AsyncQueuerOptions,\n AsyncQueuerState,\n} from '@tanstack/pacer/async-queuer'\n\nexport interface SolidAsyncQueuerOptions<\n TValue,\n TSelected = {},\n> extends AsyncQueuerOptions<TValue> {\n /**\n * Optional callback invoked when the owning component unmounts. Receives the queuer instance.\n * When provided, replaces the default cleanup (stop + abort); use it to call flush(), flushAsBatch(), stop(), add logging, etc.\n */\n onUnmount?: (queuer: SolidAsyncQueuer<TValue, TSelected>) => void\n}\n\nexport interface SolidAsyncQueuer<TValue, TSelected = {}> extends Omit<\n AsyncQueuer<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) => ({ pendingItems: state.pendingItems, activeItems: state.activeItems })}>\n * {(state) => (\n * <div>Pending: {state().pendingItems.length}, Active: {state().activeItems.length}</div>\n * )}\n * </queuer.Subscribe>\n */\n Subscribe: <TSelected>(props: {\n selector: (state: AsyncQueuerState<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<AsyncQueuerState<TValue>>>\n}\n\n/**\n * Creates a Solid-compatible AsyncQueuer instance for managing an asynchronous queue of items, exposing Solid signals for all stateful properties.\n *\n * Features:\n * - Priority queueing via `getPriority` or item `priority` property\n * - Configurable concurrency limit\n * - FIFO (First In First Out) or LIFO (Last In First Out) queue behavior\n * - Pause/resume processing\n * - Task cancellation\n * - Item expiration\n * - Lifecycle callbacks for success, error, settled, items change, etc.\n * - All stateful properties (active items, pending items, counts, etc.) are exposed as Solid signals for reactivity\n *\n * Tasks are processed concurrently up to the configured concurrency limit. When a task completes,\n * the next pending task is processed if the concurrency limit allows.\n *\n * Error Handling:\n * - If an `onError` handler is provided, it will be called with the error and queuer instance\n * - If `throwOnError` is true (default when no onError handler is provided), the error will be thrown\n * - If `throwOnError` is false (default when onError handler is provided), the error will be swallowed\n * - Both onError and throwOnError can be used together; the handler will be called before any error is thrown\n * - The error state can be checked using the underlying AsyncQueuer instance\n *\n * ## State Management and Selector\n *\n * The hook uses TanStack Store for reactive state management. 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 * - `activeItems`: Array of items currently being processed\n * - `errorCount`: Number of items that failed processing\n * - `isRunning`: Whether the queuer is currently running (not stopped)\n * - `pendingItems`: Array of items waiting to be processed\n * - `rejectionCount`: Number of items that were rejected (expired or failed validation)\n * - `settleCount`: Number of items that have completed processing (successful or failed)\n * - `successCount`: Number of items that were processed successfully\n *\n * ## Unmount behavior\n *\n * By default, the primitive stops the queuer and aborts any in-flight task executions when the owning component unmounts.\n * Abort only cancels underlying operations (e.g. fetch) when the abort signal from `getAbortSignal()` is passed to them.\n * Use the `onUnmount` option to customize this. For example, to flush pending items instead:\n *\n * ```tsx\n * const queuer = createAsyncQueuer(fn, {\n * concurrency: 2,\n * started: false,\n * onUnmount: (q) => q.flush()\n * });\n * ```\n *\n * Note: For async utils, `flush()` returns a Promise and runs fire-and-forget in the cleanup.\n * If your task function updates Solid signals, those updates may run after the component has\n * unmounted, which can cause unexpected reactive updates. Guard your callbacks accordingly when\n * using onUnmount with flush.\n *\n * Example usage:\n * ```tsx\n * // Default behavior - no reactive state subscriptions\n * const asyncQueuer = createAsyncQueuer(async (item) => {\n * // process item\n * return await fetchData(item);\n * }, {\n * initialItems: [],\n * concurrency: 2,\n * maxSize: 100,\n * started: false,\n * onSuccess: (result) => {\n * console.log('Item processed:', result);\n * },\n * onError: (error) => {\n * console.error('Processing failed:', error);\n * }\n * });\n *\n * // Opt-in to track queue state changes (optimized for UI updates)\n * const asyncQueuer = createAsyncQueuer(\n * async (item) => await fetchData(item),\n * { concurrency: 2, started: true },\n * (state) => ({\n * pendingItems: state.pendingItems,\n * activeItems: state.activeItems,\n * isRunning: state.isRunning\n * })\n * );\n *\n * // Opt-in to track processing metrics changes (optimized for tracking progress)\n * const asyncQueuer = createAsyncQueuer(\n * async (item) => await fetchData(item),\n * { concurrency: 2, started: true },\n * (state) => ({\n * successCount: state.successCount,\n * errorCount: state.errorCount,\n * settleCount: state.settleCount\n * })\n * );\n *\n * // Add items to queue\n * asyncQueuer.addItem(newItem);\n *\n * // Start processing\n * asyncQueuer.start();\n *\n * // Access the selected state (will be empty object {} unless selector provided)\n * const { pendingItems, activeItems } = asyncQueuer.state();\n * ```\n */\nexport function createAsyncQueuer<TValue, TSelected = {}>(\n fn: (value: TValue) => Promise<any>,\n options: SolidAsyncQueuerOptions<TValue, TSelected> = {},\n selector: (state: AsyncQueuerState<TValue>) => TSelected = () =>\n ({}) as TSelected,\n): SolidAsyncQueuer<TValue, TSelected> {\n const mergedOptions = {\n ...useDefaultPacerOptions().asyncQueuer,\n ...options,\n } as SolidAsyncQueuerOptions<TValue, TSelected>\n const asyncQueuer = new AsyncQueuer<TValue>(\n fn,\n mergedOptions,\n ) as unknown as SolidAsyncQueuer<TValue, TSelected>\n\n asyncQueuer.Subscribe = function Subscribe<TSelected>(props: {\n selector: (state: AsyncQueuerState<TValue>) => TSelected\n children: ((state: Accessor<TSelected>) => JSX.Element) | JSX.Element\n }) {\n const selected = useSelector(asyncQueuer.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(asyncQueuer.store, selector, { compare: shallow })\n\n createEffect(() => {\n onCleanup(() => {\n if (mergedOptions.onUnmount) {\n mergedOptions.onUnmount(asyncQueuer)\n } else {\n asyncQueuer.stop()\n asyncQueuer.abort()\n }\n })\n })\n\n return {\n ...asyncQueuer,\n state,\n } as SolidAsyncQueuer<TValue, TSelected> // omit `store` in favor of `state`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoLA,SAAgB,kBACd,IACA,UAAsD,EAAE,EACxD,kBACG,EAAE,GACgC;CACrC,MAAM,gBAAgB;EACpB,GAAGA,8CAAwB,CAAC;EAC5B,GAAG;EACJ;CACD,MAAM,cAAc,IAAIC,yCACtB,IACA,cACD;CAED,YAAY,YAAY,SAAS,UAAqB,OAGnD;EACD,MAAM,kDAAuB,YAAY,OAAO,MAAM,UAAU,EAC9D,SAASC,+BACV,CAAC;EAEF,OAAO,OAAO,MAAM,aAAa,aAC7B,MAAM,SAAS,SAAS,GACxB,MAAM;;CAGZ,MAAM,+CAAoB,YAAY,OAAO,UAAU,EAAE,SAASA,+BAAS,CAAC;CAE5E,iCAAmB;EACjB,8BAAgB;GACd,IAAI,cAAc,WAChB,cAAc,UAAU,YAAY;QAC/B;IACL,YAAY,MAAM;IAClB,YAAY,OAAO;;IAErB;GACF;CAEF,OAAO;EACL,GAAG;EACH;EACD"}
|