@stemy/ngx-utils 19.5.20 → 19.5.21

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.
@@ -1,4 +1,4 @@
1
- import { ChangeDetectorRef, ElementRef, OnChanges, Renderer2 } from "@angular/core";
1
+ import { ChangeDetectorRef, ElementRef, OnChanges } from "@angular/core";
2
2
  import { AsyncMethod, IAsyncMessage } from "../common-types";
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class AsyncMethodBase implements OnChanges {
@@ -8,10 +8,10 @@ export declare class AsyncMethodBase implements OnChanges {
8
8
  readonly onError: import("@angular/core").OutputEmitterRef<IAsyncMessage>;
9
9
  readonly toaster: import("../common-types").IToasterService;
10
10
  readonly cdr: ChangeDetectorRef;
11
- readonly renderer: Renderer2;
12
11
  readonly element: ElementRef<HTMLElement>;
13
12
  readonly loading: import("@angular/core").WritableSignal<boolean>;
14
13
  readonly target: import("@angular/core").WritableSignal<HTMLElement>;
14
+ readonly previousTarget: import("@angular/core").Signal<HTMLElement>;
15
15
  constructor();
16
16
  protected getMethod(): AsyncMethod;
17
17
  ngOnChanges(): void;
@@ -1,5 +1,6 @@
1
1
  import { Type, ValueProvider, ɵComponentDef as ComponentDef } from "@angular/core";
2
2
  import { CssSelector, CssSelectorList } from "../common-types";
3
+ export declare function switchClass(elem: HTMLElement, className: string, status?: boolean): void;
3
4
  export declare function getCssVariables(elem: HTMLElement): Record<string, string>;
4
5
  export declare function checkTransitions(el: HTMLElement, cb: () => any): void;
5
6
  export declare function getComponentDef<T>(type: Type<T>): ComponentDef<T>;
@@ -0,0 +1,36 @@
1
+ import { type Signal } from "@angular/core";
2
+ /**
3
+ * Returns a signal that emits the previous value of the given signal.
4
+ * The first time the signal is emitted, the previous value will be the same as the current value.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const value = signal(0);
9
+ * const previous = computedPrevious(value);
10
+ *
11
+ * effect(() => {
12
+ * console.log("Current value:", value());
13
+ * console.log("Previous value:", previous());
14
+ * });
15
+ *
16
+ * Logs:
17
+ * // Current value: 0
18
+ * // Previous value: 0
19
+ *
20
+ * value.set(1);
21
+ *
22
+ * Logs:
23
+ * // Current value: 1
24
+ * // Previous value: 0
25
+ *
26
+ * value.set(2);
27
+ *
28
+ * Logs:
29
+ * // Current value: 2
30
+ * // Previous value: 1
31
+ *```
32
+ *
33
+ * @param s Signal to compute previous value for
34
+ * @returns Signal that emits previous value of `s`
35
+ */
36
+ export declare function computedPrevious<T>(s: Signal<T>): Signal<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stemy/ngx-utils",
3
- "version": "19.5.20",
3
+ "version": "19.5.21",
4
4
  "license": "MIT",
5
5
  "public": true,
6
6
  "repository": "https://github.com/stemyke/ngx-utils.git",
package/public_api.d.ts CHANGED
@@ -18,12 +18,13 @@ export { JSONfn } from "./ngx-utils/utils/jsonfn";
18
18
  export { ReflectUtils } from "./ngx-utils/utils/reflect.utils";
19
19
  export { LoaderUtils } from "./ngx-utils/utils/loader.utils";
20
20
  export { MathUtils } from "./ngx-utils/utils/math.utils";
21
- export { checkTransitions, getComponentDef, parseSelector, selectorMatchesList, provideEntryComponents } from "./ngx-utils/utils/misc";
21
+ export { switchClass, getCssVariables, checkTransitions, getComponentDef, parseSelector, selectorMatchesList, provideEntryComponents } from "./ngx-utils/utils/misc";
22
22
  export { ObjectUtils } from "./ngx-utils/utils/object.utils";
23
23
  export { ObservableUtils, ISubscriberInfo } from "./ngx-utils/utils/observable.utils";
24
24
  export { CancelablePromise, cancelablePromise, impatientPromise } from "./ngx-utils/utils/promise.utils";
25
25
  export { StringUtils, hashCode } from "./ngx-utils/utils/string.utils";
26
26
  export { SetUtils } from "./ngx-utils/utils/set.utils";
27
+ export { computedPrevious } from "./ngx-utils/utils/signal-utils";
27
28
  export { SocketFactory, SocketData, SocketDataValue, SocketDataObj, SocketClient } from "./ngx-utils/utils/socket-client";
28
29
  export { TimerUtils } from "./ngx-utils/utils/timer.utils";
29
30
  export { UniqueUtils } from "./ngx-utils/utils/unique.utils";