UNPKG

@adpt/core

Version:
22 lines 1.3 kB
import { Logger } from "@adpt/utils"; import { AdaptElement, AdaptMountedElement } from "./jsx"; export interface DomDiff<E extends AdaptMountedElement = AdaptMountedElement> { added: Set<E>; deleted: Set<E>; commonOld: Set<E>; commonNew: Set<E>; } export declare function domForEach<E extends AdaptMountedElement = AdaptMountedElement>(dom: E | null, f: (el: E) => void): void; export declare function domMap<T, E extends AdaptMountedElement = AdaptMountedElement>(dom: E | null, f: (el: E) => T): T[]; export declare type DomDiffIdFunc = (el: AdaptMountedElement) => string; export declare const defaultDomDiffId: DomDiffIdFunc; export declare function domDiff<E extends AdaptMountedElement = AdaptMountedElement>(oldDom: E | null, newDom: E | null, idFunc?: DomDiffIdFunc): DomDiff<E>; /** * Given a DomDiff, generated from an old and new DOM, returns an Array of * the Elements that will be active if this DomDiff is deployed. That means * all of the Elements in the new DOM plus the deleted Elements from the * old DOM. */ export declare function domActiveElems<E extends AdaptMountedElement = AdaptMountedElement>(diff: DomDiff<E>): E[]; export declare function logElements(msg: string, elements: AdaptElement[], logger: Logger): void; //# sourceMappingURL=dom_utils.d.ts.map