point.d.ts 1.1 KB

1234567891011121314151617181920212223242526272829
  1. import { 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. */
  8. export interface BasePoint {
  9. path: Path;
  10. offset: number;
  11. }
  12. export declare type Point = ExtendedType<'Point', BasePoint>;
  13. export 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. }
  23. export declare const Point: PointInterface;
  24. /**
  25. * `PointEntry` objects are returned when iterating over `Point` objects that
  26. * belong to a range.
  27. */
  28. export declare type PointEntry = [Point, 'anchor' | 'focus'];
  29. //# sourceMappingURL=point.d.ts.map