UNPKG

1.16 kBTypeScriptView Raw
1import { ExtendedType, Operation, Path } from '..';
2/**
3 * `Point` objects refer to a specific location in a text node in a Slate
4 * document. Its path refers to the location of the node in the tree, and its
5 * offset refers to the distance into the node's string of text. Points can
6 * only refer to `Text` nodes.
7 */
8export interface BasePoint {
9 path: Path;
10 offset: number;
11}
12export declare type Point = ExtendedType<'Point', BasePoint>;
13export interface PointInterface {
14 compare: (point: Point, another: Point) => -1 | 0 | 1;
15 isAfter: (point: Point, another: Point) => boolean;
16 isBefore: (point: Point, another: Point) => boolean;
17 equals: (point: Point, another: Point) => boolean;
18 isPoint: (value: any) => value is Point;
19 transform: (point: Point, op: Operation, options?: {
20 affinity?: 'forward' | 'backward' | null;
21 }) => Point | null;
22}
23export declare const Point: PointInterface;
24/**
25 * `PointEntry` objects are returned when iterating over `Point` objects that
26 * belong to a range.
27 */
28export declare type PointEntry = [Point, 'anchor' | 'focus'];
29//# sourceMappingURL=point.d.ts.map
\No newline at end of file