UNPKG

1.74 kBTypeScriptView Raw
1import { Operation } from '..';
2/**
3 * `Path` arrays are a list of indexes that describe a node's exact position in
4 * a Slate node tree. Although they are usually relative to the root `Editor`
5 * object, they can be relative to any `Node` object.
6 */
7export declare type Path = number[];
8export interface PathInterface {
9 ancestors: (path: Path, options?: {
10 reverse?: boolean;
11 }) => Path[];
12 common: (path: Path, another: Path) => Path;
13 compare: (path: Path, another: Path) => -1 | 0 | 1;
14 endsAfter: (path: Path, another: Path) => boolean;
15 endsAt: (path: Path, another: Path) => boolean;
16 endsBefore: (path: Path, another: Path) => boolean;
17 equals: (path: Path, another: Path) => boolean;
18 hasPrevious: (path: Path) => boolean;
19 isAfter: (path: Path, another: Path) => boolean;
20 isAncestor: (path: Path, another: Path) => boolean;
21 isBefore: (path: Path, another: Path) => boolean;
22 isChild: (path: Path, another: Path) => boolean;
23 isCommon: (path: Path, another: Path) => boolean;
24 isDescendant: (path: Path, another: Path) => boolean;
25 isParent: (path: Path, another: Path) => boolean;
26 isPath: (value: any) => value is Path;
27 isSibling: (path: Path, another: Path) => boolean;
28 levels: (path: Path, options?: {
29 reverse?: boolean;
30 }) => Path[];
31 next: (path: Path) => Path;
32 parent: (path: Path) => Path;
33 previous: (path: Path) => Path;
34 relative: (path: Path, ancestor: Path) => Path;
35 transform: (path: Path, operation: Operation, options?: {
36 affinity?: 'forward' | 'backward' | null;
37 }) => Path | null;
38}
39export declare const Path: PathInterface;
40//# sourceMappingURL=path.d.ts.map
\No newline at end of file