1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { NamedNode, Node } from './snap/Node';
|
18 | import { ImmutableTree } from './util/ImmutableTree';
|
19 | import { Path } from './util/Path';
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | export declare class CompoundWrite {
|
27 | writeTree_: ImmutableTree<Node>;
|
28 | constructor(writeTree_: ImmutableTree<Node>);
|
29 | static empty(): CompoundWrite;
|
30 | }
|
31 | export declare function compoundWriteAddWrite(compoundWrite: CompoundWrite, path: Path, node: Node): CompoundWrite;
|
32 | export declare function compoundWriteAddWrites(compoundWrite: CompoundWrite, path: Path, updates: {
|
33 | [name: string]: Node;
|
34 | }): CompoundWrite;
|
35 | /**
|
36 | * Will remove a write at the given path and deeper paths. This will <em>not</em> modify a write at a higher
|
37 | * location, which must be removed by calling this method with that path.
|
38 | *
|
39 | * @param compoundWrite - The CompoundWrite to remove.
|
40 | * @param path - The path at which a write and all deeper writes should be removed
|
41 | * @returns The new CompoundWrite with the removed path
|
42 | */
|
43 | export declare function compoundWriteRemoveWrite(compoundWrite: CompoundWrite, path: Path): CompoundWrite;
|
44 | /**
|
45 | * Returns whether this CompoundWrite will fully overwrite a node at a given location and can therefore be
|
46 | * considered "complete".
|
47 | *
|
48 | * @param compoundWrite - The CompoundWrite to check.
|
49 | * @param path - The path to check for
|
50 | * @returns Whether there is a complete write at that path
|
51 | */
|
52 | export declare function compoundWriteHasCompleteWrite(compoundWrite: CompoundWrite, path: Path): boolean;
|
53 | /**
|
54 | * Returns a node for a path if and only if the node is a "complete" overwrite at that path. This will not aggregate
|
55 | * writes from deeper paths, but will return child nodes from a more shallow path.
|
56 | *
|
57 | * @param compoundWrite - The CompoundWrite to get the node from.
|
58 | * @param path - The path to get a complete write
|
59 | * @returns The node if complete at that path, or null otherwise.
|
60 | */
|
61 | export declare function compoundWriteGetCompleteNode(compoundWrite: CompoundWrite, path: Path): Node | null;
|
62 | /**
|
63 | * Returns all children that are guaranteed to be a complete overwrite.
|
64 | *
|
65 | * @param compoundWrite - The CompoundWrite to get children from.
|
66 | * @returns A list of all complete children.
|
67 | */
|
68 | export declare function compoundWriteGetCompleteChildren(compoundWrite: CompoundWrite): NamedNode[];
|
69 | export declare function compoundWriteChildCompoundWrite(compoundWrite: CompoundWrite, path: Path): CompoundWrite;
|
70 | /**
|
71 | * Returns true if this CompoundWrite is empty and therefore does not modify any nodes.
|
72 | * @returns Whether this CompoundWrite is empty
|
73 | */
|
74 | export declare function compoundWriteIsEmpty(compoundWrite: CompoundWrite): boolean;
|
75 | /**
|
76 | * Applies this CompoundWrite to a node. The node is returned with all writes from this CompoundWrite applied to the
|
77 | * node
|
78 | * @param node - The node to apply this CompoundWrite to
|
79 | * @returns The node with all writes applied
|
80 | */
|
81 | export declare function compoundWriteApply(compoundWrite: CompoundWrite, node: Node): Node;
|