Files
SnowLuma/.pnpm-store/v11/files/7b/67377a032018ee1848ea5349ab0ba59c328b0878fc8a0e60c7be01a3620fc7f575fd99f1d7cf9c8cfb17ccc574d048eea601109f18d01a2ead899239f8d0ee
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

26 lines
635 B
Plaintext

import { addUniqueItem, removeItem } from 'motion-utils';
import { compareByDepth } from './compare-by-depth.mjs';
class FlatTree {
constructor() {
this.children = [];
this.isDirty = false;
}
add(child) {
addUniqueItem(this.children, child);
this.isDirty = true;
}
remove(child) {
removeItem(this.children, child);
this.isDirty = true;
}
forEach(callback) {
this.isDirty && this.children.sort(compareByDepth);
this.isDirty = false;
this.children.forEach(callback);
}
}
export { FlatTree };
//# sourceMappingURL=flat-tree.mjs.map