Skip to content

API reference / Common / Engine types / ShapeSelection

Type Alias: ShapeSelection ​

ts
type ShapeSelection = 
  | {
  shapes: ShapeNodeId[];
}
  | {
  shapeText: [ShapeNodeId, TextSelection];
}
  | {
  shapeTable: [ShapeNodeId, TableSelection];
};

What is selected within one shape tree — object(s), or a caret / range inside one shape's text.

Entities are named by id, not index: ids are minted once and shared by every replica, so a selection survives a concurrent reorder untouched, and a concurrently deleted shape simply stops resolving (consumers skip it). There is no empty variant — emptiness is the embedding doc-type selection's None; a ShapeSelection always names at least one shape.