@but212/atom-effect 0.19.0 → 0.19.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.
package/dist/index.d.ts CHANGED
@@ -54,13 +54,6 @@ export declare type Branded<T, Brand> = T & {
54
54
  readonly __brand: Brand;
55
55
  };
56
56
 
57
- /**
58
- * Computation context.
59
- */
60
- export declare interface ComputationContext {
61
- links: DependencyLink[];
62
- }
63
-
64
57
  /**
65
58
  * Creates a computed value.
66
59
  * @param fn - Computation function
@@ -143,8 +136,6 @@ export declare interface Dependency {
143
136
  flags: number;
144
137
  /** Last validated epoch. */
145
138
  _lastSeenEpoch: number;
146
- /** Temporary unsubscribe. */
147
- _tempUnsub?: (() => void) | undefined;
148
139
  /** Last modified epoch. */
149
140
  _modifiedAtEpoch?: number;
150
141
  /**
@@ -158,30 +149,11 @@ export declare interface Dependency {
158
149
  value?: unknown;
159
150
  }
160
151
 
161
- /**
162
- * Graph entry.
163
- */
164
- export declare interface DependencyEntry<T extends object = Dependency> {
165
- /** Dependency reference. */
166
- ref: WeakRef<T>;
167
- unsubscribe: () => void;
168
- }
169
-
170
152
  /**
171
153
  * Dependency ID.
172
154
  */
173
155
  export declare type DependencyId = Branded<number, 'DependencyId'>;
174
156
 
175
- /**
176
- * Dependency graph edge.
177
- */
178
- declare class DependencyLink {
179
- node: Dependency;
180
- version: number;
181
- unsub: (() => void) | undefined;
182
- constructor(node: Dependency, version: number, unsub?: (() => void) | undefined);
183
- }
184
-
185
157
  /**
186
158
  * Creates and starts an effect.
187
159
  *
@@ -196,11 +168,6 @@ export declare class EffectError extends AtomError {
196
168
  constructor(message: string, cause?: Error | null);
197
169
  }
198
170
 
199
- export declare interface EffectExecutionContext {
200
- prevLinks: DependencyLink[];
201
- nextLinks: DependencyLink[];
202
- }
203
-
204
171
  /**
205
172
  * Effect return type.
206
173
  */
@@ -221,16 +188,6 @@ export declare interface EffectOptions {
221
188
  onError?: (error: unknown) => void;
222
189
  }
223
190
 
224
- /**
225
- * Scheduler atom interface.
226
- */
227
- export declare interface IAtom {
228
- readonly id: number;
229
- version: number;
230
- _internalNotifySubscribers(): void;
231
- recompute?(): void;
232
- }
233
-
234
191
  /**
235
192
  * Readonly atom check.
236
193
  *
@@ -238,11 +195,6 @@ export declare interface IAtom {
238
195
  */
239
196
  export declare function isAtom(obj: unknown): obj is ReadonlyAtom;
240
197
 
241
- export declare interface IScheduler<T> {
242
- markDirty(atom: T): void;
243
- scheduleNotify(atom: T): void;
244
- }
245
-
246
198
  /**
247
199
  * Computed atom check.
248
200
  */
@@ -262,13 +214,6 @@ export declare const POOL_CONFIG: {
262
214
  readonly ENABLE_STATS: false;
263
215
  };
264
216
 
265
- /**
266
- * Poolable interface.
267
- */
268
- export declare interface Poolable {
269
- reset(): void;
270
- }
271
-
272
217
  export declare interface PoolStats {
273
218
  acquired: number;
274
219
  released: number;
@@ -302,7 +247,7 @@ export declare interface ReadonlyAtom<T = unknown> {
302
247
  /**
303
248
  * Scheduler implementation.
304
249
  */
305
- export declare const scheduler: {
250
+ declare class Scheduler {
306
251
  /** Queue buffer */
307
252
  _queueBuffer: [SchedulerJob[], SchedulerJob[]];
308
253
  _bufferIndex: number;
@@ -319,9 +264,13 @@ export declare const scheduler: {
319
264
  _batchQueueSize: number;
320
265
  /** Config */
321
266
  _maxFlushIterations: number;
322
- readonly phase: SchedulerPhase;
323
- readonly queueSize: number;
324
- readonly isBatching: boolean;
267
+ /** Overflow callback */
268
+ onOverflow: ((droppedCount: number) => void) | null;
269
+ /** Bound run loop for microtask */
270
+ private readonly _boundRunLoop;
271
+ get phase(): SchedulerPhase;
272
+ get queueSize(): number;
273
+ get isBatching(): boolean;
325
274
  /**
326
275
  * Schedules job.
327
276
  */
@@ -333,18 +282,18 @@ export declare const scheduler: {
333
282
  /**
334
283
  * Scheduler loop.
335
284
  */
336
- _runLoop: () => void;
285
+ private _runLoop;
337
286
  _flushSync(): void;
338
287
  _mergeBatchQueue(): void;
339
288
  _drainQueue(): void;
340
289
  _processQueue(): void;
341
- /** Overflow callback */
342
- onOverflow: ((droppedCount: number) => void) | null;
343
- _handleFlushOverflow(): void;
290
+ private _handleFlushOverflow;
344
291
  startBatch(): void;
345
292
  endBatch(): void;
346
293
  setMaxFlushIterations(max: number): void;
347
- };
294
+ }
295
+
296
+ export declare const scheduler: Scheduler;
348
297
 
349
298
  /**
350
299
  * Scheduler configuration.
@@ -380,8 +329,6 @@ export declare interface Subscriber {
380
329
  execute(): void;
381
330
  }
382
331
 
383
- export declare type TransformFunction<T, U> = (value: T) => U;
384
-
385
332
  /**
386
333
  * Untracked execution.
387
334
  *