@estjs/signals 0.0.15 → 0.0.16-beta.2

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/signals.d.ts CHANGED
@@ -125,17 +125,11 @@ interface Link {
125
125
  * Examples: Effect, Computed
126
126
  */
127
127
  subNode: ReactiveNode;
128
- /**
129
- * Connects multiple subscribers of the same depNode.
130
- * Previous subscriber Link
131
- */
128
+ /** Previous subscriber Link */
132
129
  prevSubLink?: Link;
133
130
  /** Next subscriber Link */
134
131
  nextSubLink?: Link;
135
- /**
136
- * Connects multiple dependencies of the same subNode.
137
- * Previous dependency Link
138
- */
132
+ /** Previous dependency Link */
139
133
  prevDepLink?: Link;
140
134
  /** Next dependency Link */
141
135
  nextDepLink?: Link;
@@ -216,21 +210,34 @@ interface ReactiveNode {
216
210
  * @see ReactiveFlags
217
211
  */
218
212
  flag: ReactiveFlags;
219
- _triggerVersion?: number;
213
+ /**
214
+ * Optional debugging hook called when dependencies are tracked
215
+ */
220
216
  onTrack?: (event: DebuggerEvent) => void;
217
+ /**
218
+ * Optional debugging hook called when reactive changes are triggered.
219
+ */
221
220
  onTrigger?: (event: DebuggerEvent) => void;
221
+ /**
222
+ * When true, this node is a pure dependency (leaf); it should not receive
223
+ * a DIRTY flag during invalidation because it has no derived value to recompute.
224
+ */
225
+ isDep?: boolean;
226
+ /**
227
+ * Deduplication stamp used during batch notification.
228
+ * Prevents the same effect from being pushed into the pending queue twice.
229
+ */
230
+ _triggerVersion?: number;
222
231
  }
223
232
  /**
224
- * Execute function with tracking disabled
233
+ * Execute function with tracking disabled.
225
234
  *
226
- * During function execution, accessing Signals won't establish dependencies.
227
- *
228
- * @param fn - The function to execute
229
- * @returns The function's return value
235
+ * @param fn - The function to execute.
236
+ * @returns {T} The function's return value.
230
237
  */
231
238
  declare function untrack<T>(fn: () => T): T;
232
239
  /**
233
- * Trigger updates for subscribers of a reactive object property
240
+ * Trigger updates for subscribers of a reactive object property.
234
241
  *
235
242
  * This function notifies all subscribers (effects/computed) that depend on a specific
236
243
  * property of a reactive object that the property has changed.
@@ -251,11 +258,11 @@ declare function untrack<T>(fn: () => T): T;
251
258
  * - **CLEAR**: Collection cleared (affects iteration)
252
259
  *
253
260
  * ## Iteration Dependencies
254
-
255
- * @param target - The reactive object that changed
256
- * @param type - The type of operation: 'SET' | 'ADD' | 'DELETE' | 'CLEAR'
257
- * @param key - The property key that changed (optional for CLEAR operations)
258
- * @param newValue - The new value (optional, used for debugging)
261
+ *
262
+ * @param target - The reactive object that changed.
263
+ * @param type - The type of operation: 'SET' | 'ADD' | 'DELETE' | 'CLEAR'.
264
+ * @param key - The property key that changed (optional for CLEAR operations).
265
+ * @param newValue - The new value.
259
266
  *
260
267
  * @example
261
268
  * ```typescript
@@ -277,6 +284,15 @@ declare function untrack<T>(fn: () => T): T;
277
284
  * // trigger(state.items, 'ADD', '3', 4)
278
285
  * ```
279
286
  */
287
+ /**
288
+ * Trigger updates for subscribers of a reactive object property.
289
+ *
290
+ * @param target - The reactive object that changed.
291
+ * @param type - The type of operation: 'SET' | 'ADD' | 'DELETE' | 'CLEAR'.
292
+ * @param key - The property key that changed (optional for CLEAR operations).
293
+ * @param newValue - The new value.
294
+ * @returns {void}
295
+ */
280
296
  declare function trigger(target: object, type: string, key?: string | symbol | (string | symbol)[], newValue?: unknown): void;
281
297
 
282
298
  /**
@@ -338,9 +354,9 @@ type SignalType<T> = T extends Signal<infer V> ? V : never;
338
354
  * Create a new signal with the given initial value.
339
355
  * The signal will track all nested properties of object values.
340
356
  *
341
- * @template T - The type of value to store in the signal
342
- * @param value - Initial value (defaults to undefined)
343
- * @returns A new signal instance
357
+ * @template T - The type of value to store in the signal.
358
+ * @param value - Initial value (defaults to undefined).
359
+ * @returns A new signal instance.
344
360
  *
345
361
  * @example
346
362
  * ```typescript
@@ -349,15 +365,14 @@ type SignalType<T> = T extends Signal<infer V> ? V : never;
349
365
  * const empty = signal(); // undefined
350
366
  * ```
351
367
  */
352
- declare function signal<T>(value: Signal<T>): Signal<T>;
353
368
  declare function signal<T>(value?: T): Signal<T>;
354
369
  /**
355
370
  * Create a new shallow signal with the given initial value.
356
371
  * Only the top-level properties of object values are reactive.
357
372
  *
358
- * @template T - The type of value to store in the signal
359
- * @param value - Initial value (defaults to undefined)
360
- * @returns A new shallow signal instance
373
+ * @template T - The type of value to store in the signal.
374
+ * @param value - Initial value (defaults to undefined).
375
+ * @returns A new shallow signal instance.
361
376
  *
362
377
  * @example
363
378
  * ```typescript
@@ -369,9 +384,9 @@ declare function shallowSignal<T>(value?: T): Signal<T>;
369
384
  /**
370
385
  * Type guard to check if a value is a Signal instance.
371
386
  *
372
- * @template T - The type of value held by the signal
373
- * @param value - The value to check
374
- * @returns true if the value is a Signal instance
387
+ * @template T - The type of value held by the signal.
388
+ * @param value - The value to check.
389
+ * @returns true if the value is a Signal instance.
375
390
  */
376
391
  declare function isSignal<T>(value: unknown): value is Signal<T>;
377
392
 
@@ -451,31 +466,36 @@ declare class ComputedImpl<T = any> implements Computed<T>, ReactiveNode {
451
466
  readonly onTrigger?: (event: DebuggerEvent) => void;
452
467
  private _value;
453
468
  /**
454
- * Create a Computed instance
469
+ * Create a Computed instance.
455
470
  *
456
- * @param getter - The computation function
457
- * @param setter - Optional setter function
458
- * @param onTrack - Optional debug callback for dependency tracking
459
- * @param onTrigger - Optional debug callback for triggers
471
+ * @param getter - The computation function.
472
+ * @param setter - Optional setter function.
473
+ * @param onTrack - Optional debug callback for dependency tracking.
474
+ * @param onTrigger - Optional debug callback for triggers.
460
475
  */
461
476
  constructor(getter: ComputedGetter<T>, setter?: ComputedSetter<T>, onTrack?: (event: DebuggerEvent) => void, onTrigger?: (event: DebuggerEvent) => void);
477
+ /**
478
+ * Returns the current value.
479
+ *
480
+ * @returns {T} The current value.
481
+ */
462
482
  get value(): T;
463
483
  /**
464
- * Set value (only effective when setter is provided)
484
+ * Set value (only effective when setter is provided).
465
485
  *
466
- * @param newValue - The new value
486
+ * @param newValue - The new value.
467
487
  */
468
488
  set value(newValue: T);
469
489
  /**
470
- * Read value without tracking dependencies
490
+ * Read value without tracking dependencies.
471
491
  *
472
- * @returns Current value
492
+ * @returns {T} The current value.
473
493
  */
474
494
  peek(): T;
475
495
  /**
476
496
  * Recompute the value
477
497
  *
478
- * computation logic:
498
+ * computation logic:
479
499
  * 1. Start tracking dependencies
480
500
  * 2. Execute getter function
481
501
  * 3. Check if value changed using optimized comparison
@@ -485,19 +505,19 @@ declare class ComputedImpl<T = any> implements Computed<T>, ReactiveNode {
485
505
  */
486
506
  private recompute;
487
507
  /**
488
- * Check if update is needed
508
+ * Check if update is needed.
489
509
  *
490
510
  * Internal use, called by reactive system.
491
511
  *
492
- * @returns true if value changed
512
+ * @returns {boolean} True if value changed.
493
513
  */
494
514
  shouldUpdate(): boolean;
495
515
  }
496
516
  /**
497
- * Create a Computed value
517
+ * Create a Computed value.
498
518
  *
499
- * @param getterOrOptions - Computation function or configuration object
500
- * @returns Computed instance
519
+ * @param getterOrOptions - Computation function or configuration object.
520
+ * @returns {ComputedImpl<T>} Computed instance.
501
521
  *
502
522
  * @example
503
523
  * ```typescript
@@ -528,10 +548,11 @@ declare class ComputedImpl<T = any> implements Computed<T>, ReactiveNode {
528
548
  */
529
549
  declare function computed<T>(getterOrOptions: ComputedGetter<T> | ComputedOptions<T>): ComputedImpl<T>;
530
550
  /**
531
- * Type guard - Check if value is Computed
551
+ * Type guard - Check if value is a Computed instance.
532
552
  *
533
- * @param value - The value to check
534
- * @returns true if value is Computed
553
+ * @template T - The type of value held by the computed instance.
554
+ * @param value - The value to check.
555
+ * @returns {boolean} True if value is a Computed instance.
535
556
  */
536
557
  declare function isComputed<T>(value: unknown): value is Computed<T>;
537
558
 
@@ -540,22 +561,22 @@ declare function isComputed<T>(value: unknown): value is Computed<T>;
540
561
  * Recursively unwraps nested reactive objects and arrays.
541
562
  *
542
563
  * @param value - Reactive or signal value.
543
- * @returns Raw value without any reactive wrapping.
564
+ * @returns {T} Raw value without any reactive wrapping.
544
565
  */
545
566
  declare function toRaw<T>(value: T): T;
546
567
  /**
547
568
  * Check if the target object is reactive.
548
569
  *
549
570
  * @param target - The object to check.
550
- * @returns True if the object is reactive, false otherwise.
571
+ * @returns {boolean} True if the object is reactive, false otherwise.
551
572
  */
552
573
  declare function isReactive(target: unknown): boolean;
553
574
  /**
554
575
  * Create a reactive proxy for the given target object. If the object is already reactive, return directly.
555
576
  *
556
- * @template T - The type of the object to make reactive
557
- * @param target - The object to make reactive
558
- * @returns The reactive proxy of the target object
577
+ * @template T - The type of the object to make reactive.
578
+ * @param target - The object to make reactive.
579
+ * @returns {T} The reactive proxy of the target object.
559
580
  *
560
581
  * @example
561
582
  * ```typescript
@@ -567,9 +588,9 @@ declare function reactive<T extends object>(target: T): T;
567
588
  /**
568
589
  * Create a shallow reactive proxy for the given object. Only root-level properties are reactive.
569
590
  *
570
- * @template T - The type of the object to make shallow reactive
571
- * @param target - The object to make shallow reactive
572
- * @returns The shallow reactive proxy of the object
591
+ * @template T - The type of the object to make shallow reactive.
592
+ * @param target - The object to make shallow reactive.
593
+ * @returns {T} The shallow reactive proxy of the object.
573
594
  *
574
595
  * @example
575
596
  * ```typescript
@@ -582,7 +603,7 @@ declare function shallowReactive<T extends object>(target: T): T;
582
603
  * Check if the target object is a shallow reactive proxy.
583
604
  *
584
605
  * @param value - The object to check.
585
- * @returns True if the object is shallow reactive, false otherwise.
606
+ * @returns {boolean} True if the object is shallow reactive, false otherwise.
586
607
  */
587
608
  declare function isShallow(value: unknown): boolean;
588
609
  /**
@@ -590,6 +611,7 @@ declare function isShallow(value: unknown): boolean;
590
611
  * If the given value is not an object, return the original value itself.
591
612
  *
592
613
  * @param value - The value that needs a reactive proxy created for it.
614
+ * @returns {T} The reactive proxy of the value, or the original value.
593
615
  */
594
616
  declare const toReactive: <T extends unknown>(value: T) => T;
595
617
  /**
@@ -616,30 +638,22 @@ type PreFlushCallback = () => void;
616
638
  */
617
639
  type FlushTiming = 'pre' | 'post' | 'sync';
618
640
  /**
619
- * Schedules a function to be executed in the next microtask
620
- *
621
- * Returns a Promise that resolves in the next microtask.
622
- * Passing fn chains it onto the shared resolved promise — cheaper than
623
- * constructing a new Promise + queueMicrotask pair.
641
+ * Schedules a function to be executed in the next microtask.
624
642
  *
625
- * @param fn - Optional function to execute
626
- * @returns A Promise that resolves after the function execution
643
+ * @param fn - Optional function to execute.
644
+ * @returns A Promise that resolves after the function execution.
627
645
  */
628
646
  declare function nextTick(fn?: () => void): Promise<void>;
629
647
  /**
630
- * Adds a job to the main queue and ensures it will be executed
648
+ * Adds a job to the main queue and ensures it will be executed.
631
649
  *
632
- * Jobs are automatically deduplicated - the same job reference won't be added multiple times.
633
- * This is useful for batching updates and avoiding redundant work.
634
- * @param job - The job to enqueue
650
+ * @param job - The job to enqueue.
635
651
  */
636
652
  declare function queueJob(job: Job): void;
637
653
  /**
638
- * Adds a callback to be executed before the main queue processing
654
+ * Adds a callback to be executed before the main queue processing.
639
655
  *
640
- * Pre-flush callbacks are useful for setup work that needs to run before effects,
641
- * such as computing derived values or preparing state.
642
- * @param cb - The callback to execute before the main queue
656
+ * @param cb - The callback to execute before the main queue.
643
657
  */
644
658
  declare function queuePreFlushCb(cb: PreFlushCallback): void;
645
659
 
@@ -751,80 +765,66 @@ declare class EffectImpl<T = any> implements ReactiveNode {
751
765
  flag: ReactiveFlags;
752
766
  private readonly [SignalFlags.IS_EFFECT];
753
767
  readonly fn: EffectFunction<T>;
768
+ readonly options?: EffectOptions;
754
769
  private _flushScheduler?;
755
- _active: boolean;
756
770
  onTrack?: (event: DebuggerEvent) => void;
757
771
  onTrigger?: (event: DebuggerEvent) => void;
758
- onStop?: () => void;
772
+ private _active;
759
773
  /**
760
- * Create an Effect instance
774
+ * Create an Effect instance.
761
775
  *
762
- * @param fn - The effect function
763
- * @param options - Configuration options
776
+ * @param fn - The effect function.
777
+ * @param options - Configuration options.
764
778
  */
765
779
  constructor(fn: EffectFunction<T>, options?: EffectOptions);
766
780
  /**
767
- * Check if the Effect is active
781
+ * Check if the Effect is active.
782
+ *
783
+ * @returns {boolean} True if the effect is active.
768
784
  */
769
785
  get active(): boolean;
770
786
  /**
771
- * Check if the Effect is dirty (needs re-execution)
787
+ * Check if the Effect is dirty (needs re-execution).
788
+ *
789
+ * @returns {boolean} True if the effect is dirty.
772
790
  */
773
791
  get dirty(): boolean;
774
792
  /**
775
- * Pause Effect execution
793
+ * Pause Effect execution.
776
794
  *
777
795
  * When an effect is paused:
778
- * - It stops responding to dependency changes
779
- * - Notifications are ignored (see notify method)
780
- * - DIRTY and PENDING flags are still set when dependencies change
781
- * - The effect remains active and maintains its dependency links
796
+ * - It stops responding to dependency changes.
797
+ * - Notifications are ignored (see notify method).
798
+ * - DIRTY and PENDING flags are still set when dependencies change.
799
+ * - The effect remains active and maintains its dependency links.
782
800
  *
783
801
  * Use cases:
784
- * - Temporarily disable effects during bulk updates
785
- * - Prevent effects from running during initialization
786
- * - Control when side effects should execute
802
+ * - Temporarily disable effects during bulk updates.
803
+ * - Prevent effects from running during initialization.
804
+ * - Control when side effects should execute.
787
805
  *
788
- * @example
789
- * ```typescript
790
- * const count = signal(0);
791
- * const runner = effect(() => console.log(count.value));
792
- *
793
- * runner.effect.pause();
794
- * count.value = 1; // Effect won't run
795
- * count.value = 2; // Effect won't run
796
- * runner.effect.resume(); // Effect runs once with latest value
797
- * ```
806
+ * @returns {void}
798
807
  */
799
808
  pause(): void;
800
809
  /**
801
- * Resume Effect execution
810
+ * Resume Effect execution.
802
811
  *
803
812
  * When an effect is resumed:
804
- * - The PAUSED flag is cleared
813
+ * - The PAUSED flag is cleared.
805
814
  * - If dependencies changed during pause (DIRTY or PENDING flags set),
806
- * the effect executes immediately via notify()
807
- * - If no changes occurred, the effect simply becomes active again
815
+ * the effect executes immediately via notify().
816
+ * - If no changes occurred, the effect simply becomes active again.
808
817
  *
809
818
  * State management:
810
- * - Clears PAUSED flag atomically
811
- * - Checks for accumulated DIRTY/PENDING flags
812
- * - Triggers execution if needed
813
- *
814
- * @example
815
- * ```typescript
816
- * const count = signal(0);
817
- * const runner = effect(() => console.log(count.value));
819
+ * - Clears PAUSED flag atomically.
820
+ * - Checks for accumulated DIRTY/PENDING flags.
821
+ * - Triggers execution if needed.
818
822
  *
819
- * runner.effect.pause();
820
- * count.value = 1; // Queued
821
- * count.value = 2; // Queued
822
- * runner.effect.resume(); // Executes once with count.value = 2
823
- * ```
823
+ * @returns {void}
824
824
  */
825
825
  resume(): void;
826
826
  /**
827
- * Execute the Effect function
827
+ * Execute the Effect function.
828
828
  *
829
829
  * Core execution flow:
830
830
  * 1. Check if active
@@ -832,40 +832,46 @@ declare class EffectImpl<T = any> implements ReactiveNode {
832
832
  * 3. Start tracking dependencies
833
833
  * 4. Execute user function
834
834
  * 5. End tracking, clean up stale dependencies
835
-
836
- * @returns The return value of the effect function
835
+ *
836
+ * @returns {T} The return value of the effect function.
837
837
  */
838
838
  run(): T;
839
839
  private _job?;
840
840
  /**
841
- * Get or create the job function for this effect
841
+ * Get or create the job function for this effect.
842
+ *
843
+ * @returns {() => void} The job function.
842
844
  */
843
845
  private getJob;
844
846
  /**
845
- * Notify that the Effect needs to execute
847
+ * Notify that the Effect needs to execute.
846
848
  *
847
849
  * Called by dependent reactive values.
848
850
  * Decides whether to execute immediately or defer based on scheduling strategy.
851
+ *
852
+ * @returns {void}
849
853
  */
850
854
  notify(): void;
851
855
  /**
852
- * Stop the Effect
856
+ * Stop the Effect.
853
857
  *
854
858
  * After stopping:
855
- * - No longer responds to dependency changes
856
- * - Disconnects all dependency links
857
- * - Clears cached job function
858
- * - Calls onStop callback
859
- * - Verifies complete cleanup in development mode
859
+ * - No longer responds to dependency changes.
860
+ * - Disconnects all dependency links.
861
+ * - Clears cached job function.
862
+ * - Calls onStop callback.
863
+ * - Verifies complete cleanup in development mode.
864
+ *
865
+ * @returns {void}
860
866
  */
861
867
  stop(): void;
862
868
  }
863
869
  /**
864
- * Create and immediately execute an Effect
870
+ * Create and immediately execute an Effect.
865
871
  *
866
- * @param fn - The effect function
867
- * @param options - Configuration options
868
- * @returns Effect runner
872
+ * @param fn - The effect function.
873
+ * @param options - Configuration options.
874
+ * @returns {EffectRunner<T>} Effect runner.
869
875
  *
870
876
  * @example
871
877
  * ```typescript
@@ -896,16 +902,17 @@ declare class EffectImpl<T = any> implements ReactiveNode {
896
902
  */
897
903
  declare function effect<T = any>(fn: EffectFunction<T>, options?: EffectOptions): EffectRunner<T>;
898
904
  /**
899
- * Stop Effect execution
905
+ * Stop Effect execution.
900
906
  *
901
- * @param runner - The effect runner
907
+ * @param runner - The effect runner to stop.
908
+ * @returns {void}
902
909
  */
903
910
  declare function stop(runner: EffectRunner): void;
904
911
  /**
905
- * Type guard - Check if value is an Effect
912
+ * Type guard - Check if value is an Effect instance.
906
913
  *
907
- * @param value - The value to check
908
- * @returns true if value is an Effect
914
+ * @param value - The value to check.
915
+ * @returns {boolean} True if value is an Effect instance.
909
916
  */
910
917
  declare function isEffect(value: any): value is EffectImpl;
911
918
  /**
@@ -917,21 +924,15 @@ declare function isEffect(value: any): value is EffectImpl;
917
924
  */
918
925
  type MemoEffectFn<T> = (prevState: T) => T;
919
926
  /**
920
- * Create a memoized Effect
927
+ * Create a memoized Effect.
921
928
  *
922
929
  * A memoized effect remembers the return value from the previous execution
923
930
  * and passes it as a parameter on the next execution.
924
931
  *
925
- * Use cases:
926
- * - Incremental DOM updates
927
- * - Avoiding duplicate operations
928
- * - State persistence
929
- * - Difference detection
930
- *
931
- * @param fn - The memoized function
932
- * @param initialState - Initial state
933
- * @param options - Configuration options
934
- * @returns Effect runner
932
+ * @param fn - The memoized function.
933
+ * @param initialState - Initial state.
934
+ * @param options - Configuration options.
935
+ * @returns {EffectRunner<void>} Effect runner.
935
936
  *
936
937
  * @example
937
938
  * ```typescript
@@ -953,13 +954,10 @@ type MemoEffectFn<T> = (prevState: T) => T;
953
954
  declare function memoEffect<T>(fn: MemoEffectFn<T>, initialState: T, options?: EffectOptions): EffectRunner<void>;
954
955
 
955
956
  /**
956
- * Execute a function in batch mode
957
- *
958
- * Executes the function in a batch context, where all Signal changes
959
- * are deferred and processed together after the batch ends.
957
+ * Execute a function in batch mode.
960
958
  *
961
- * @param fn - The function to execute in batch mode
962
- * @returns The return value of the function
959
+ * @param fn - The function to execute in batch mode.
960
+ * @returns The return value of the function.
963
961
  *
964
962
  * @example
965
963
  * ```typescript
@@ -983,45 +981,27 @@ declare function memoEffect<T>(fn: MemoEffectFn<T>, initialState: T, options?: E
983
981
  */
984
982
  declare function batch<T>(fn: () => T): T;
985
983
  /**
986
- * Start batch update
984
+ * Start batch update.
987
985
  *
988
- * Increases batch depth.
989
- * During batch, Effects won't execute immediately.
986
+ * @returns {void}
990
987
  */
991
988
  declare function startBatch(): void;
992
989
  /**
993
- * End batch update
990
+ * End batch update.
994
991
  *
995
- * Decreases batch depth.
996
- * When depth reaches zero, flush all queued Effects.
997
- *
998
- * ## Cleanup Process
999
- *
1000
- * When the outermost batch ends:
1001
- * 1. Flush all queued jobs (effects execute)
1002
- * 2. Job queue is automatically cleared by flushJobs()
1003
- * 3. Temporary flags (QUEUED, DIRTY) are cleared by effect execution
1004
- *
1005
- * ## Development Mode Checks
1006
- *
1007
- * In development mode, this function performs additional validation:
1008
- * - Detects unbalanced batch calls (endBatch without startBatch)
1009
- * - Prevents batchDepth from becoming negative
1010
- * - Provides clear error messages to help debug batch management issues
992
+ * @returns {void}
1011
993
  */
1012
994
  declare function endBatch(): void;
1013
995
  /**
1014
- * Check if currently in batch update mode
996
+ * Check if currently in batch update mode.
1015
997
  *
1016
- * @returns true if currently in batch
998
+ * @returns True if currently in batch mode.
1017
999
  */
1018
1000
  declare function isBatching(): boolean;
1019
1001
  /**
1020
- * Get current batch depth
1002
+ * Get current batch depth.
1021
1003
  *
1022
- * Mainly used for debugging.
1023
- *
1024
- * @returns Current batch nesting depth
1004
+ * @returns Current batch nesting depth.
1025
1005
  */
1026
1006
  declare function getBatchDepth(): number;
1027
1007
 
@@ -1097,6 +1077,12 @@ interface StoreActions<S extends State> {
1097
1077
  * @param callback - Function to call on action execution
1098
1078
  */
1099
1079
  onAction$: (callback: StoreCallback<S>) => void;
1080
+ /**
1081
+ * Removes a previously registered action callback.
1082
+ *
1083
+ * @param callback - The callback to remove.
1084
+ */
1085
+ offAction$: (callback: StoreCallback<S>) => void;
1100
1086
  /**
1101
1087
  * Resets the store state to its initial values.
1102
1088
  */
@@ -1122,11 +1108,11 @@ type StoreDefinition<S extends State, G extends Getters<S>, A extends Actions> =
1122
1108
  * Creates a new store with the given definition.
1123
1109
  * The store can be defined either as a class or as an options object.
1124
1110
  *
1125
- * @template S - The type of the store's state
1126
- * @template G - The type of the store's getters
1127
- * @template A - The type of the store's actions
1128
- * @param storeDefinition - The store definition (class or options)
1129
- * @returns A function that creates a new store instance
1111
+ * @template S - The type of the store's state.
1112
+ * @template G - The type of the store's getters.
1113
+ * @template A - The type of the store's actions.
1114
+ * @param storeDefinition - The store definition (class or options).
1115
+ * @returns A function that creates a new store instance.
1130
1116
  *
1131
1117
  * @example
1132
1118
  * ```ts
@@ -1180,9 +1166,9 @@ interface Ref<T> extends Signal<T> {
1180
1166
  * Creates a new ref with the given initial value.
1181
1167
  * Unlike signals, refs don't create reactive proxies for object values.
1182
1168
  *
1183
- * @template T - The type of value to store in the ref
1184
- * @param value - The initial value
1185
- * @returns A new ref instance
1169
+ * @template T - The type of value to store in the ref.
1170
+ * @param value - The initial value.
1171
+ * @returns A new ref instance.
1186
1172
  *
1187
1173
  * @example
1188
1174
  * ```ts
@@ -1194,9 +1180,9 @@ declare function ref<T>(value?: T): Ref<T>;
1194
1180
  /**
1195
1181
  * Type guard to check if a value is a Ref instance.
1196
1182
  *
1197
- * @template T - The type of value held by the ref
1198
- * @param value - The value to check
1199
- * @returns True if the value is a Ref instance
1183
+ * @template T - The type of value held by the ref.
1184
+ * @param value - The value to check.
1185
+ * @returns True if the value is a Ref instance.
1200
1186
  */
1201
1187
  declare function isRef<T>(value: unknown): value is Ref<T>;
1202
1188
 
@@ -1204,17 +1190,17 @@ interface WatchOptions {
1204
1190
  immediate?: boolean;
1205
1191
  deep?: boolean;
1206
1192
  }
1207
- /** Watch source type, can be value, ref/signal, getter function or array. */
1208
1193
  type WatchSource<T = any> = T | {
1209
1194
  value: T;
1210
1195
  } | (() => T);
1211
1196
  type WatchCallback<T = any> = (newValue: T, oldValue: T | undefined) => void;
1212
1197
  /**
1213
1198
  * Watch one or more reactive data sources and execute callback when sources change.
1199
+ *
1214
1200
  * @param source - The source(s) to watch.
1215
1201
  * @param callback - The callback function to execute when source changes.
1216
1202
  * @param options - Configuration options like immediate and deep.
1217
- * @returns A function to stop watching.
1203
+ * @returns {Function} A function to stop watching.
1218
1204
  */
1219
1205
  declare function watch<T = any>(source: WatchSource<T>, callback: WatchCallback<T>, options?: WatchOptions): () => void;
1220
1206