import { Atom, AtomActions, AtomOptions } from "./types.mjs"; //#region ../@mongez/atom/src/atom-collection.d.ts type IndexOrCallback = number | ((value: Value, index: number, list: Value[]) => boolean); interface AtomCollectionActions extends AtomActions { /** * Add items to the end of the array */ push(this: Atom, ...items: Value[]): void; /** * Add items to the beginning of the array */ unshift(this: Atom, ...items: Value[]): void; /** * Remove the last item from the array */ pop(this: Atom): void; /** * Remove the first item from the array */ shift(this: Atom): void; /** * Remove item from array either by index or callback */ remove(this: Atom, indexOrCallback: IndexOrCallback): void; /** * Remove item from array by value */ removeItem(this: Atom, item: Value): void; /** * Remove all occurrences of an item from the array */ removeAll(this: Atom, item: Value): void; /** * Get item from array either by index or callback */ get(this: Atom, indexOrCallback: IndexOrCallback): Value | undefined; /** * Find index of item in array by callback */ index(this: Atom, callback: (item: Value, index: number, array: Value[]) => boolean): number; /** * Map array items * This will update the array with the new mapped array and trigger update */ map(this: Atom, callback: (item: Value, index: number, array: Value[]) => Value): Value[]; /** * Loop through array items */ forEach(this: Atom, callback: (item: Value, index: number, array: Value[]) => void): void; /** * Replace item in array by index */ replace(this: Atom, index: number, item: Value): void; /** * Get array length */ length: number; } type CollectionOptions = Omit>, 'default'> & { default?: Value[]; }; /** * Create an atom collection */ declare function atomCollection(options: CollectionOptions): Atom>; //#endregion export { AtomCollectionActions, CollectionOptions, IndexOrCallback, atomCollection }; //# sourceMappingURL=atom-collection.d.mts.map