/** * ISC License * * Copyright (c) 2020, Andrea Giammarchi, @WebReflection * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /** * Efficiently diffs and updates the children of a parent node. * * Compares two lists of DOM nodes ([before] and [after]) and applies the minimum * number of DOM operations needed to transform the parent's current children * to match the [after] list. * * This is essential for reactive frameworks like Woby to efficiently update * the DOM when component state changes, avoiding costly re-renders. * * @param parent - The parent DOM node whose children need to be updated * @param before - The current list of child nodes (or a single node) * @param after - The desired list of child nodes (or a single node) * @param nextSibling - The reference node for insertion operations, or null to append * * @example * ```ts * // Update a parent's children from [nodeA, nodeB] to [nodeC, nodeA, nodeD] * diff(parentElement, [nodeA, nodeB], [nodeC, nodeA, nodeD], null) * // This will efficiently insert nodeC before nodeA, and append nodeD * ``` */ export declare const diff: (parent: Node, before: Node | Node[], after: Node | Node[], nextSibling: Node | null) => void; //# sourceMappingURL=diff.d.ts.map