@dereekb/dbx-core 13.0.4 → 13.0.6

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/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-core",
3
- "version": "13.0.4",
3
+ "version": "13.0.6",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0",
7
7
  "@angular/router": "^21.0.0",
8
- "@dereekb/date": "13.0.4",
9
- "@dereekb/rxjs": "13.0.4",
10
- "@dereekb/util": "13.0.4",
8
+ "@dereekb/date": "13.0.6",
9
+ "@dereekb/rxjs": "13.0.6",
10
+ "@dereekb/util": "13.0.6",
11
11
  "@ngrx/component-store": "^21.0.0",
12
12
  "@ngrx/effects": "^21.0.0",
13
13
  "@ngrx/store": "^21.0.0",
@@ -3482,6 +3482,15 @@ declare function provideDbxStorage(): EnvironmentProviders;
3482
3482
  * when the DestroyRef is destroyed in the context.
3483
3483
  *
3484
3484
  * Must be run in an Angular injection context.
3485
+ *
3486
+ * @example
3487
+ * // Clean up a Destroyable object (e.g., SubscriptionObject, LockSet):
3488
+ * const sub = new SubscriptionObject(obs$.subscribe(handler));
3489
+ * clean(sub);
3490
+ *
3491
+ * @example
3492
+ * // Clean up a destroy function directly:
3493
+ * clean(() => resource.release());
3485
3494
  */
3486
3495
  declare function clean<T extends Destroyable | DestroyFunction>(input: T): T;
3487
3496
  /**
@@ -3489,6 +3498,14 @@ declare function clean<T extends Destroyable | DestroyFunction>(input: T): T;
3489
3498
  * when the DestroyRef is destroyed in the context.
3490
3499
  *
3491
3500
  * Must be run in an Angular injection context.
3501
+ *
3502
+ * @example
3503
+ * // Complete a BehaviorSubject when the component is destroyed:
3504
+ * readonly value$ = completeOnDestroy(new BehaviorSubject<string>('initial'));
3505
+ *
3506
+ * @example
3507
+ * // Complete a ReplaySubject when the component is destroyed:
3508
+ * readonly events$ = completeOnDestroy(new ReplaySubject<Event>(1));
3492
3509
  */
3493
3510
  declare function completeOnDestroy<T extends Pick<Subject<any>, 'complete' | 'error'>>(input: T): T;
3494
3511
 
@@ -3514,7 +3531,17 @@ type CleanLockSet = LockSet & {
3514
3531
  *
3515
3532
  * Must be run within an Angular injection context.
3516
3533
  *
3517
- * @param onLockSetDestroy Optional callback to run when the lockset is unlocked.
3534
+ * @param config Optional configuration for destruction behavior and callbacks.
3535
+ *
3536
+ * @example
3537
+ * // Create a simple lockset:
3538
+ * readonly lockSet = cleanLockSet();
3539
+ *
3540
+ * @example
3541
+ * // Create with a callback when the lockset is destroyed:
3542
+ * readonly lockSet = cleanLockSet({
3543
+ * onLockSetDestroy: () => console.log('lockset destroyed')
3544
+ * });
3518
3545
  */
3519
3546
  declare function cleanLockSet(config?: Maybe<CleanLockSetConfig>): CleanLockSet;
3520
3547
  /**
@@ -3524,6 +3551,10 @@ declare function cleanLockSet(config?: Maybe<CleanLockSetConfig>): CleanLockSet;
3524
3551
  *
3525
3552
  * @param lockSet The lockset to use.
3526
3553
  * @param onDestroy The function to run when the lockset is unlocked.
3554
+ *
3555
+ * @example
3556
+ * // Defer cleanup until the lockset unlocks after component destroy:
3557
+ * cleanWithLockSet(this.lockSet, () => resource.release());
3527
3558
  */
3528
3559
  declare function cleanWithLockSet(lockSet: LockSet, onDestroy: DestroyFunction): void;
3529
3560
  /**
@@ -3537,6 +3568,18 @@ interface CleanSubscriptionWithLockSetConfig<T extends Unsubscribable = Unsubscr
3537
3568
  * Creates a new SubscriptionObject that is automatically destroyed when the context is destroyed, and the lock set's next unlock occurs.
3538
3569
  *
3539
3570
  * Must be run within an Angular injection context.
3571
+ *
3572
+ * @example
3573
+ * // Pass a subscription that waits for the lockset to unlock before cleanup:
3574
+ * readonly _sub = cleanSubscriptionWithLockSet({
3575
+ * lockSet: this.lockSet,
3576
+ * sub: obs$.subscribe(handler)
3577
+ * });
3578
+ *
3579
+ * @example
3580
+ * // Create first, then set the subscription later:
3581
+ * readonly _sub = cleanSubscriptionWithLockSet({ lockSet: this.lockSet });
3582
+ * this._sub.subscription = obs$.subscribe(handler);
3540
3583
  */
3541
3584
  declare function cleanSubscriptionWithLockSet<T extends Unsubscribable = Unsubscribable>(input: CleanSubscriptionWithLockSetConfig<T>): SubscriptionObject<T>;
3542
3585
 
@@ -3544,6 +3587,14 @@ declare function cleanSubscriptionWithLockSet<T extends Unsubscribable = Unsubsc
3544
3587
  * Creates a new SubscriptionObject that is automatically destroyed when the context is destroyed.
3545
3588
  *
3546
3589
  * Must be run within an Angular injection context.
3590
+ *
3591
+ * @example
3592
+ * // Pass a subscription directly - it will be cleaned up automatically:
3593
+ * cleanSubscription(obs$.subscribe(handler));
3594
+ *
3595
+ * // Or create first, then set the subscription later:
3596
+ * readonly _sub = cleanSubscription();
3597
+ * this._sub.subscription = obs$.subscribe(handler);
3547
3598
  */
3548
3599
  declare function cleanSubscription<T extends Unsubscribable = Unsubscribable>(sub?: Maybe<GetterOrValue<T>>): SubscriptionObject<T>;
3549
3600
 
@@ -3551,12 +3602,30 @@ declare function cleanSubscription<T extends Unsubscribable = Unsubscribable>(su
3551
3602
  * Creates a new LoadingStateContext that is automatically destroyed when the context is destroyed.
3552
3603
  *
3553
3604
  * Must be run within an Angular injection context.
3605
+ *
3606
+ * @example
3607
+ * // Create with an observable source:
3608
+ * readonly context = cleanLoadingContext<MyData>(this.data$);
3609
+ *
3610
+ * @example
3611
+ * // Create empty, then set the observable source later:
3612
+ * readonly context = cleanLoadingContext<MyData>();
3613
+ * this.context.obs = this.data$;
3554
3614
  */
3555
3615
  declare function cleanLoadingContext<T = unknown, S extends LoadingState<T> = LoadingState<T>, E extends LoadingContextEvent = LoadingContextEvent & S>(input?: LoadingStateContextInput<T, S, E>): MutableLoadingStateContext<T, S, E>;
3556
3616
  /**
3557
3617
  * Creates a new ListLoadingStateContext that is automatically destroyed when the context is destroyed.
3558
3618
  *
3559
3619
  * Must be run within an Angular injection context.
3620
+ *
3621
+ * @example
3622
+ * // Create with an observable source:
3623
+ * readonly listContext = cleanListLoadingContext<MyItem>(this.items$);
3624
+ *
3625
+ * @example
3626
+ * // Create empty, then set the observable source later:
3627
+ * readonly listContext = cleanListLoadingContext<MyItem>();
3628
+ * this.listContext.obs = this.items$;
3560
3629
  */
3561
3630
  declare function cleanListLoadingContext<L = unknown, S extends ListLoadingState<L> = ListLoadingState<L>>(input?: ListLoadingStateContextInput<L, S>): MutableListLoadingStateContext<L, S>;
3562
3631
 
@@ -3564,6 +3633,15 @@ declare function cleanListLoadingContext<L = unknown, S extends ListLoadingState
3564
3633
  * Creates a new DestroyFunctionObject that is automatically destroyed when the context is destroyed.
3565
3634
  *
3566
3635
  * Must be run within an Angular injection context.
3636
+ *
3637
+ * @example
3638
+ * // Pass a destroy function directly:
3639
+ * cleanDestroy(() => resource.release());
3640
+ *
3641
+ * @example
3642
+ * // Create first, then set the destroy function later:
3643
+ * readonly _destroy = cleanDestroy();
3644
+ * this._destroy.setDestroyFunction(() => resource.release());
3567
3645
  */
3568
3646
  declare function cleanDestroy(input?: Maybe<DestroyFunction>): DestroyFunctionObject;
3569
3647