import * as i0 from '@angular/core'; import { ErrorHandler } from '@angular/core'; import { Observable, OperatorFunction } from 'rxjs'; type ValuesOf = O[keyof O]; type InstanceOrType = T extends abstract new (...args: any) => infer R ? R : T; type InferArguments = T extends (...args: infer R) => any ? R : never; type Select = K extends keyof U ? U[K] : never; type ExtractString = Extract; type FunctionParamsOrValueType = InferArguments> extends never ? [F] : InferArguments>; type Actions = object; type ActionTransforms = Partial<{ [K in keyof T]: (...args: any[]) => T[K]; }>; type ActionDispatchFn = (...value: InstanceOrType) => void; type ActionDispatchers = { [K in keyof T]: ActionDispatchFn>>; }; type ActionObservables = { [K in ExtractString as `${K}$`]: Observable>; }; type ActionEffects = { [K in ExtractString as `on${Capitalize}`]: (fn: OperatorFunction, sideEffectFn?: (value: R) => void) => () => void; }; type RxActions = ActionDispatchers & ActionObservables & ActionEffects & ((slice: Partial) => void) & { $: (props: (keyof T)[]) => Observable>; }; /** * @deprecated - use rxActions instead * * This class creates RxActions bound to Angular's DI life-cycles. This prevents memory leaks and optionally makes the instance reusable across the app. * The function has to be used inside an injection context. * If the consumer gets destroyed also the actions get destroyed automatically. * * @example * @Component({ * standalone: true, * template: `...`, * }) * export class AnyComponent { * ui = rxActions<{search: string, refresh: void}>(); * } */ declare class RxActionFactory> { private readonly errorHandler?; private readonly subjects; constructor(errorHandler?: ErrorHandler | undefined); create = object>(transforms?: U): RxActions; destroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration, [{ optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration>; } /** * Manage events in components and services in a single place * * @example * * interface UI { * search: string, * submit: void * }; * * import { rxActions } from '@rx-angular/state/actions'; * * @Component({...}) * export class Component { * ui = rxActions<{ name: string }>(({transforms}) => transforms({name: v => v})); * * name$ = this.ui.name$; // Observable - listens to name changes * emitName = this.ui.name; // (name: string) => void - emits name change * sub = this.ui.onName(o$ => o$.pipe(), console.log) // () => void - stops side effect * * onInit() { * const name$ = this.ui.name$; // Observable - listens to name changes * const emitName = this.ui.name; // (name: string) => void - emits name change * const stop = this.ui.onName(o$ => o$.pipe(), console.log) // () => void - stops side effect * stop(); * } * * } * */ declare function rxActions, U extends ActionTransforms = object>(setupFn?: (cfg: { transforms: (t: U) => void; }) => void): RxActions; /** * @description * This transform is a side effecting operation applying `preventDefault` to a passed Event * @param e */ declare function preventDefault(e: Event): Event; /** * @description * This transform is a side effecting operation applying `stopPropagation` to a passed Event * @param e */ declare function stopPropagation(e: Event): Event; /** * @description * This transform is a side effecting operation applying `preventDefault` and `stopPropagation` to a passed Event * @param e */ declare function preventDefaultStopPropagation(e: Event): Event; /** * @description * This transform is helps to pluck values from DOM `Event` or forward the value directly. * @param e */ declare function eventValue(e: Event | T): T; export { RxActionFactory, eventValue, preventDefault, preventDefaultStopPropagation, rxActions, stopPropagation }; export type { ActionDispatchFn, ActionDispatchers, ActionObservables, ActionTransforms, RxActions }; //# sourceMappingURL=rx-angular-state-actions.d.ts.map