/*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ /** * Base interface for items that can be reconciled * The actual items don't need to implement this - you provide getId function */ export interface IReconcilableItem { [key: string]: any; } /** * Result of list reconciliation */ export interface IReconcileResult { toCreate: T[]; toUpdate: Array<{ oldItem: T; newItem: T; index: number; }>; toRemove: T[]; unchanged: T[]; } /** * Options for reconciliation */ export interface IReconcileOptions { /** * Custom ID extractor */ getId: (item: T) => unknown; /** * Custom equality check */ isEqual?: (a: T, b: T) => boolean; /** * Preserve order of new items */ preserveOrder?: boolean; } /** * Generic list reconciliation utility * Efficiently compares two lists and determines what items need to be created, updated, or removed */ export declare class ListReconciler { /** * Reconcile two lists by comparing items * @param oldItems - Current items * @param newItems - New items to reconcile with * @param options - Reconciliation options */ static reconcile(oldItems: Readonly, newItems: Readonly, options: IReconcileOptions): IReconcileResult; /** * Apply reconciliation result to a mutable array * @param array - Array to mutate * @param result - Reconciliation result * @param callbacks - Callbacks for each operation */ static applyResult(array: T[], result: IReconcileResult, callbacks?: { onCreate?: (item: T, index: number) => void; onUpdate?: (oldItem: T, newItem: T, index: number) => void; onRemove?: (item: T, index: number) => void; }): void; }