/** * A differ that tracks changes made to an object over time. * * */ export interface KeyValueDiffer { /** * Compute a difference between the previous state and the new `object` state. * * @param object containing the new value. * @returns an object describing the difference. The return value is only valid until the next * `diff()` invocation. */ diff(object: Map): KeyValueChanges | null; /** * Compute a difference between the previous state and the new `object` state. * * @param object containing the new value. * @returns an object describing the difference. The return value is only valid until the next * `diff()` invocation. */ diff(object: { [key: string]: V; }): KeyValueChanges | null; } /** * An object describing the changes in the `Map` or `{[k:string]: string}` since last time * `KeyValueDiffer#diff()` was invoked. * * */ export interface KeyValueChanges { /** * Iterate over all changes. `KeyValueChangeRecord` will contain information about changes * to each item. */ forEachItem(fn: (r: KeyValueChangeRecord) => void): void; /** * Iterate over changes in the order of original Map showing where the original items * have moved. */ forEachPreviousItem(fn: (r: KeyValueChangeRecord) => void): void; /** * Iterate over all keys for which values have changed. */ forEachChangedItem(fn: (r: KeyValueChangeRecord) => void): void; /** * Iterate over all added items. */ forEachAddedItem(fn: (r: KeyValueChangeRecord) => void): void; /** * Iterate over all removed items. */ forEachRemovedItem(fn: (r: KeyValueChangeRecord) => void): void; } /** * Record representing the item change information. * * */ export interface KeyValueChangeRecord { /** * Current key in the Map. */ readonly key: K; /** * Current value for the key or `null` if removed. */ readonly currentValue: V | null; /** * Previous value for the key or `null` if added. */ readonly previousValue: V | null; } /** * Provides a factory for {@link KeyValueDiffer}. * * */ export interface KeyValueDifferFactory { /** * Test to see if the differ knows how to diff this kind of object. */ supports(objects: any): boolean; /** * Create a `KeyValueDiffer`. */ create(): KeyValueDiffer; } /** * A repository of different Map diffing strategies used by NgClass, NgStyle, and others. * */ export declare class KeyValueDiffers { /** * @deprecated v4.0.0 - Should be private. */ factories: KeyValueDifferFactory[]; constructor(factories: KeyValueDifferFactory[]); static create(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers; find(kv: any): KeyValueDifferFactory; }