import { BehaviorSubject, Observable } from 'rxjs'; import { Primitive } from '../reflection/primitives'; /** * Basic reactive state implementation using a {@link BehaviorSubject} to hold and observe any * changes to the states value */ export declare class BehaviorState { protected readonly subject: BehaviorSubject; /** Gets a snapshot of the current state value */ get snapshot(): T; constructor(initialValue?: T); /** Gets the behavior state changes as {@link Observable} instance */ asObservable(): Observable; /** * Patches the current state value with a partially providable schema matching the states model. * Any other value will stay unchanged * * @param value The object value to be used for patching */ patch(value: Partial): T; } /** * Basic reactive array behavior state implementation using the {@link BehaviorState} as its base. * Support for patching, pushing, removing and resetting is provided out of the box */ export declare class ArrayBehaviorState extends BehaviorState { /** Gets the length of the current value */ get length(): number; /** Gets the first element within the current state snapshot */ get first(): T | null; /** Gets the last element within the current state snapshot */ get last(): T | null; constructor(initialValue?: Iterable); /** * Patches the behavior state value at the given index using one or more values * * @param value The value used for patching the state * @param index Optional index value. Defaults to `0` */ patch(value: T[], index?: number): T[]; /** * Pushes one or more values to the current behavior state value * * @param values The values that should be added to the state */ push(...values: T[]): T[]; /** * Removes one or more values from the current behavior state value by their respective indices * * @param indices The indices of the values that should be removed */ removeAt(...indices: number[]): T[]; /** * Resets the current behavior state value using a optional value to reset to * * @param values Optional values to set as new behavior state value */ reset(...values: T[]): T[]; } /** Basic reactive state implementation for primitive values */ export declare class PrimitiveBehaviorState extends BehaviorState { patch(value: T): T; }