Skip to content

Commit

Permalink
Partialy functional array support, for selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
vladnicula committed Dec 5, 2023
1 parent 748ee25 commit 3bf6252
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 20 deletions.
28 changes: 28 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,34 @@ export declare class ProxyMutationObjectHandler<T extends object> {
*/
has<K extends keyof T>(target: T, key: K): boolean;
}
export declare class ProxyMutationArrayHandler<T extends Array<any>> {
readonly deleted: Record<string, boolean>;
readonly original: T;
readonly targetRef: T;
/**
* ops are the individual operations happening on this
* object. All the intermediary entities that would
* most probably dissapear with the new change.
*/
readonly dirtyPaths: Set<ProxyMutationArrayHandler<T>>;
readonly proxyfyAccess: ProxyAccessFN;
readonly selectorPointerArray: Array<SelectorTreeBranch>;
readonly writeSelectorPointerArray: Array<SelectorTreeBranch>;
mutationNode: MutationTreeNode;
constructor(params: {
mutationNode: MutationTreeNode;
target: T;
selectorPointerArray: Array<SelectorTreeBranch>;
dirtyPaths: Set<ProxyMutationArrayHandler<T>>;
proxyfyAccess: ProxyAccessFN;
});
get<K extends keyof T>(target: T, prop: K): any;
set<K extends keyof T>(target: T, prop: K, value: T[K]): boolean;
/**
* Proxy trap for delete keyword
*/
deleteProperty<K extends keyof T>(target: T, prop: K): boolean;
}
export declare const pathMatchesSource: (source: string[], target: string[]) => boolean;
export declare class StateTreeSelectorsManager<T extends ObjectTree> {
selectorTrees: WeakMap<T, SelectorTreeBranch>;
Expand Down
Loading

0 comments on commit 3bf6252

Please sign in to comment.