@tldraw/editor 4.6.0-next.fe1474dc57d8 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/dist-cjs/index.d.ts +412 -179
  2. package/dist-cjs/index.js +12 -23
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +3 -0
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/default-components/CanvasOverlays.js +180 -0
  7. package/dist-cjs/lib/components/default-components/CanvasOverlays.js.map +7 -0
  8. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +44 -249
  9. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +3 -3
  10. package/dist-cjs/lib/editor/Editor.js +78 -28
  11. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  12. package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js +98 -0
  13. package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js.map +7 -0
  14. package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js +14 -0
  15. package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js.map +2 -2
  16. package/dist-cjs/lib/editor/overlays/OverlayManager.js +154 -0
  17. package/dist-cjs/lib/editor/overlays/OverlayManager.js.map +7 -0
  18. package/dist-cjs/lib/editor/overlays/OverlayUtil.js +92 -0
  19. package/dist-cjs/lib/editor/overlays/OverlayUtil.js.map +7 -0
  20. package/dist-cjs/lib/editor/overlays/ShapeIndicatorOverlayUtil.js +161 -0
  21. package/dist-cjs/lib/editor/overlays/ShapeIndicatorOverlayUtil.js.map +7 -0
  22. package/dist-cjs/lib/editor/overlays/getOverlayDisplayValues.js +39 -0
  23. package/dist-cjs/lib/editor/overlays/getOverlayDisplayValues.js.map +7 -0
  24. package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js +3 -0
  25. package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js.map +2 -2
  26. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +25 -23
  27. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  28. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +32 -2
  29. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
  30. package/dist-cjs/lib/editor/types/event-types.js.map +2 -2
  31. package/dist-cjs/lib/exports/fetchCache.js +1 -1
  32. package/dist-cjs/lib/exports/fetchCache.js.map +2 -2
  33. package/dist-cjs/lib/hooks/EditorComponentsContext.js.map +2 -2
  34. package/dist-cjs/lib/hooks/useCanvasEvents.js +3 -3
  35. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  36. package/dist-cjs/lib/hooks/useEditorComponents.js +0 -28
  37. package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
  38. package/dist-cjs/lib/hooks/usePeerIds.js +1 -36
  39. package/dist-cjs/lib/hooks/usePeerIds.js.map +2 -2
  40. package/dist-cjs/lib/hooks/useShapeCulling.js +2 -1
  41. package/dist-cjs/lib/hooks/useShapeCulling.js.map +2 -2
  42. package/dist-cjs/lib/options.js +0 -1
  43. package/dist-cjs/lib/options.js.map +2 -2
  44. package/dist-cjs/lib/utils/reparenting.js +20 -7
  45. package/dist-cjs/lib/utils/reparenting.js.map +2 -2
  46. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +3 -0
  47. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +2 -2
  48. package/dist-cjs/version.js +4 -4
  49. package/dist-cjs/version.js.map +1 -1
  50. package/dist-esm/index.d.mts +412 -179
  51. package/dist-esm/index.mjs +19 -41
  52. package/dist-esm/index.mjs.map +2 -2
  53. package/dist-esm/lib/TldrawEditor.mjs +3 -0
  54. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  55. package/dist-esm/lib/components/default-components/CanvasOverlays.mjs +160 -0
  56. package/dist-esm/lib/components/default-components/CanvasOverlays.mjs.map +7 -0
  57. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +45 -250
  58. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +3 -3
  59. package/dist-esm/lib/editor/Editor.mjs +78 -29
  60. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  61. package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs +83 -0
  62. package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs.map +7 -0
  63. package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs +14 -0
  64. package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs.map +2 -2
  65. package/dist-esm/lib/editor/overlays/OverlayManager.mjs +136 -0
  66. package/dist-esm/lib/editor/overlays/OverlayManager.mjs.map +7 -0
  67. package/dist-esm/lib/editor/overlays/OverlayUtil.mjs +72 -0
  68. package/dist-esm/lib/editor/overlays/OverlayUtil.mjs.map +7 -0
  69. package/dist-esm/lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs +141 -0
  70. package/dist-esm/lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs.map +7 -0
  71. package/dist-esm/lib/editor/overlays/getOverlayDisplayValues.mjs +19 -0
  72. package/dist-esm/lib/editor/overlays/getOverlayDisplayValues.mjs.map +7 -0
  73. package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs +3 -0
  74. package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs.map +2 -2
  75. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +25 -23
  76. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  77. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +32 -2
  78. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
  79. package/dist-esm/lib/editor/types/event-types.mjs.map +2 -2
  80. package/dist-esm/lib/exports/fetchCache.mjs +2 -2
  81. package/dist-esm/lib/exports/fetchCache.mjs.map +2 -2
  82. package/dist-esm/lib/hooks/EditorComponentsContext.mjs.map +2 -2
  83. package/dist-esm/lib/hooks/useCanvasEvents.mjs +3 -3
  84. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  85. package/dist-esm/lib/hooks/useEditorComponents.mjs +0 -28
  86. package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
  87. package/dist-esm/lib/hooks/usePeerIds.mjs +2 -40
  88. package/dist-esm/lib/hooks/usePeerIds.mjs.map +2 -2
  89. package/dist-esm/lib/hooks/useShapeCulling.mjs +2 -1
  90. package/dist-esm/lib/hooks/useShapeCulling.mjs.map +2 -2
  91. package/dist-esm/lib/options.mjs +0 -1
  92. package/dist-esm/lib/options.mjs.map +2 -2
  93. package/dist-esm/lib/utils/reparenting.mjs +20 -7
  94. package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
  95. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +3 -0
  96. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +2 -2
  97. package/dist-esm/version.mjs +4 -4
  98. package/dist-esm/version.mjs.map +1 -1
  99. package/editor.css +4 -239
  100. package/package.json +7 -7
  101. package/src/index.ts +17 -39
  102. package/src/lib/TldrawEditor.tsx +9 -0
  103. package/src/lib/components/default-components/CanvasOverlays.tsx +208 -0
  104. package/src/lib/components/default-components/DefaultCanvas.tsx +49 -324
  105. package/src/lib/editor/Editor.test.ts +3 -1
  106. package/src/lib/editor/Editor.ts +80 -24
  107. package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.ts +98 -0
  108. package/src/lib/editor/managers/ThemeManager/defaultThemes.ts +14 -0
  109. package/src/lib/editor/overlays/OverlayManager.ts +183 -0
  110. package/src/lib/editor/overlays/OverlayUtil.ts +143 -0
  111. package/src/lib/editor/overlays/ShapeIndicatorOverlayUtil.ts +216 -0
  112. package/src/lib/editor/overlays/getOverlayDisplayValues.ts +51 -0
  113. package/src/lib/editor/shapes/BaseFrameLikeShapeUtil.tsx +9 -2
  114. package/src/lib/editor/shapes/ShapeUtil.ts +34 -26
  115. package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +40 -3
  116. package/src/lib/editor/types/event-types.ts +2 -0
  117. package/src/lib/exports/fetchCache.ts +2 -4
  118. package/src/lib/exports/getSvgJsx.test.ts +3 -1
  119. package/src/lib/hooks/EditorComponentsContext.tsx +0 -27
  120. package/src/lib/hooks/useCanvasEvents.ts +13 -8
  121. package/src/lib/hooks/useEditorComponents.tsx +0 -28
  122. package/src/lib/hooks/usePeerIds.ts +6 -55
  123. package/src/lib/hooks/useShapeCulling.tsx +3 -1
  124. package/src/lib/options.ts +0 -7
  125. package/src/lib/utils/reparenting.ts +22 -9
  126. package/src/lib/utils/sync/TLLocalSyncClient.ts +3 -0
  127. package/src/version.ts +4 -4
  128. package/dist-cjs/lib/components/GeometryDebuggingView.js +0 -115
  129. package/dist-cjs/lib/components/GeometryDebuggingView.js.map +0 -7
  130. package/dist-cjs/lib/components/LiveCollaborators.js +0 -152
  131. package/dist-cjs/lib/components/LiveCollaborators.js.map +0 -7
  132. package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js +0 -234
  133. package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +0 -7
  134. package/dist-cjs/lib/components/default-components/DefaultBrush.js +0 -38
  135. package/dist-cjs/lib/components/default-components/DefaultBrush.js.map +0 -7
  136. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js +0 -71
  137. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +0 -7
  138. package/dist-cjs/lib/components/default-components/DefaultCursor.js +0 -59
  139. package/dist-cjs/lib/components/default-components/DefaultCursor.js.map +0 -7
  140. package/dist-cjs/lib/components/default-components/DefaultHandle.js +0 -56
  141. package/dist-cjs/lib/components/default-components/DefaultHandle.js.map +0 -7
  142. package/dist-cjs/lib/components/default-components/DefaultHandles.js +0 -28
  143. package/dist-cjs/lib/components/default-components/DefaultHandles.js.map +0 -7
  144. package/dist-cjs/lib/components/default-components/DefaultScribble.js +0 -51
  145. package/dist-cjs/lib/components/default-components/DefaultScribble.js.map +0 -7
  146. package/dist-cjs/lib/components/default-components/DefaultSelectionForeground.js +0 -69
  147. package/dist-cjs/lib/components/default-components/DefaultSelectionForeground.js.map +0 -7
  148. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +0 -107
  149. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +0 -7
  150. package/dist-cjs/lib/components/default-components/DefaultShapeIndicatorErrorFallback.js +0 -28
  151. package/dist-cjs/lib/components/default-components/DefaultShapeIndicatorErrorFallback.js.map +0 -7
  152. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +0 -102
  153. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +0 -7
  154. package/dist-cjs/lib/components/default-components/DefaultSnapIndictor.js +0 -170
  155. package/dist-cjs/lib/components/default-components/DefaultSnapIndictor.js.map +0 -7
  156. package/dist-cjs/lib/hooks/useHandleEvents.js +0 -100
  157. package/dist-cjs/lib/hooks/useHandleEvents.js.map +0 -7
  158. package/dist-cjs/lib/hooks/useSelectionEvents.js +0 -98
  159. package/dist-cjs/lib/hooks/useSelectionEvents.js.map +0 -7
  160. package/dist-esm/lib/components/GeometryDebuggingView.mjs +0 -95
  161. package/dist-esm/lib/components/GeometryDebuggingView.mjs.map +0 -7
  162. package/dist-esm/lib/components/LiveCollaborators.mjs +0 -135
  163. package/dist-esm/lib/components/LiveCollaborators.mjs.map +0 -7
  164. package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs +0 -214
  165. package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +0 -7
  166. package/dist-esm/lib/components/default-components/DefaultBrush.mjs +0 -18
  167. package/dist-esm/lib/components/default-components/DefaultBrush.mjs.map +0 -7
  168. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs +0 -41
  169. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +0 -7
  170. package/dist-esm/lib/components/default-components/DefaultCursor.mjs +0 -29
  171. package/dist-esm/lib/components/default-components/DefaultCursor.mjs.map +0 -7
  172. package/dist-esm/lib/components/default-components/DefaultHandle.mjs +0 -26
  173. package/dist-esm/lib/components/default-components/DefaultHandle.mjs.map +0 -7
  174. package/dist-esm/lib/components/default-components/DefaultHandles.mjs +0 -8
  175. package/dist-esm/lib/components/default-components/DefaultHandles.mjs.map +0 -7
  176. package/dist-esm/lib/components/default-components/DefaultScribble.mjs +0 -21
  177. package/dist-esm/lib/components/default-components/DefaultScribble.mjs.map +0 -7
  178. package/dist-esm/lib/components/default-components/DefaultSelectionForeground.mjs +0 -39
  179. package/dist-esm/lib/components/default-components/DefaultSelectionForeground.mjs.map +0 -7
  180. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +0 -77
  181. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +0 -7
  182. package/dist-esm/lib/components/default-components/DefaultShapeIndicatorErrorFallback.mjs +0 -8
  183. package/dist-esm/lib/components/default-components/DefaultShapeIndicatorErrorFallback.mjs.map +0 -7
  184. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +0 -82
  185. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +0 -7
  186. package/dist-esm/lib/components/default-components/DefaultSnapIndictor.mjs +0 -142
  187. package/dist-esm/lib/components/default-components/DefaultSnapIndictor.mjs.map +0 -7
  188. package/dist-esm/lib/hooks/useHandleEvents.mjs +0 -70
  189. package/dist-esm/lib/hooks/useHandleEvents.mjs.map +0 -7
  190. package/dist-esm/lib/hooks/useSelectionEvents.mjs +0 -78
  191. package/dist-esm/lib/hooks/useSelectionEvents.mjs.map +0 -7
  192. package/src/lib/components/GeometryDebuggingView.tsx +0 -108
  193. package/src/lib/components/LiveCollaborators.tsx +0 -180
  194. package/src/lib/components/default-components/CanvasShapeIndicators.tsx +0 -300
  195. package/src/lib/components/default-components/DefaultBrush.tsx +0 -35
  196. package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +0 -52
  197. package/src/lib/components/default-components/DefaultCursor.tsx +0 -59
  198. package/src/lib/components/default-components/DefaultHandle.tsx +0 -42
  199. package/src/lib/components/default-components/DefaultHandles.tsx +0 -15
  200. package/src/lib/components/default-components/DefaultScribble.tsx +0 -31
  201. package/src/lib/components/default-components/DefaultSelectionForeground.tsx +0 -50
  202. package/src/lib/components/default-components/DefaultShapeIndicator.tsx +0 -104
  203. package/src/lib/components/default-components/DefaultShapeIndicatorErrorFallback.tsx +0 -9
  204. package/src/lib/components/default-components/DefaultShapeIndicators.tsx +0 -118
  205. package/src/lib/components/default-components/DefaultSnapIndictor.tsx +0 -174
  206. package/src/lib/hooks/useHandleEvents.ts +0 -88
  207. package/src/lib/hooks/useSelectionEvents.ts +0 -97
@@ -19,11 +19,8 @@ import { JsonObject } from '@tldraw/utils';
19
19
  import { JSX } from 'react/jsx-runtime';
20
20
  import { LegacyMigrations } from '@tldraw/store';
21
21
  import { MigrationSequence } from '@tldraw/store';
22
- import { NamedExoticComponent } from 'react';
23
22
  import { Node as Node_2 } from '@tiptap/pm/model';
24
23
  import { PerformanceTracker } from '@tldraw/utils';
25
- import { PointerEvent as PointerEvent_2 } from 'react';
26
- import { PointerEventHandler } from 'react';
27
24
  import * as React_2 from 'react';
28
25
  import { default as React_3 } from 'react';
29
26
  import { ReactElement } from 'react';
@@ -231,6 +228,7 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
231
228
  * - `isFrameLike()` returns `true`
232
229
  * - `providesBackgroundForChildren()` returns `true`
233
230
  * - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
231
+ * - `canRemoveChildrenOfType()` returns `true` unless the container is locked
234
232
  * - `getClipPath()` returns the shape geometry's vertices
235
233
  * - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
236
234
  * - `onDragShapesOut()` reparents shapes back to the page
@@ -251,8 +249,10 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
251
249
  * return <SVGContainer>...</SVGContainer>
252
250
  * }
253
251
  *
254
- * override indicator(shape: MyContainerShape) {
255
- * return <rect width={shape.props.w} height={shape.props.h} />
252
+ * override getIndicatorPath(shape: MyContainerShape) {
253
+ * const path = new Path2D()
254
+ * path.rect(0, 0, shape.props.w, shape.props.h)
255
+ * return path
256
256
  * }
257
257
  * }
258
258
  * ```
@@ -263,6 +263,7 @@ export declare abstract class BaseFrameLikeShapeUtil<Shape extends TLBaseBoxShap
263
263
  isFrameLike(_shape: Shape): boolean;
264
264
  providesBackgroundForChildren(): boolean;
265
265
  canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
266
+ canRemoveChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
266
267
  getClipPath(shape: Shape): undefined | Vec[];
267
268
  onDragShapesIn(shape: Shape, draggingShapes: TLShape[], { initialParentIds, initialIndices }: TLDragShapesInInfo): void;
268
269
  onDragShapesOut(shape: Shape, draggingShapes: TLShape[], info: TLDragShapesOutInfo): void;
@@ -767,6 +768,49 @@ export declare class ClickManager {
767
768
  */
768
769
  export declare function clockwiseAngleDist(a0: number, a1: number): number;
769
770
 
771
+ /**
772
+ * Tracks remote peers and exposes the collaborator-related queries used by the
773
+ * editor and its overlays. Encapsulates the visibility clock that periodically
774
+ * re-evaluates which collaborators should be visible based on activity.
775
+ *
776
+ * Accessed via {@link Editor.collaborators}.
777
+ *
778
+ * @public
779
+ */
780
+ export declare class CollaboratorsManager {
781
+ private readonly editor;
782
+ constructor(editor: Editor);
783
+ /**
784
+ * Drives reactive re-evaluation of {@link CollaboratorsManager.getVisibleCollaborators}.
785
+ * Ticked on a fixed interval so callers don't need to manage their own activity timers.
786
+ */
787
+ private readonly _visibilityClock;
788
+ private _getCollaboratorsQuery;
789
+ /**
790
+ * Returns a list of presence records for all peer collaborators.
791
+ * This will return the latest presence record for each connected user.
792
+ */
793
+ getCollaborators(): TLInstancePresence[];
794
+ /**
795
+ * Returns a list of presence records for all peer collaborators on the current page.
796
+ * This will return the latest presence record for each connected user.
797
+ */
798
+ getCollaboratorsOnCurrentPage(): TLInstancePresence[];
799
+ /**
800
+ * Returns a list of presence records for peer collaborators who should currently be
801
+ * shown in the UI. Filters {@link CollaboratorsManager.getCollaborators} by activity
802
+ * state (active / idle / inactive) and visibility rules such as following and
803
+ * highlighted users. Re-evaluates on the visibility clock, so callers don't need to
804
+ * drive their own activity timer.
805
+ */
806
+ getVisibleCollaborators(): TLInstancePresence[];
807
+ /**
808
+ * Returns a list of presence records for peer collaborators who should currently be
809
+ * shown in the UI, filtered to those on the current page.
810
+ */
811
+ getVisibleCollaboratorsOnCurrentPage(): TLInstancePresence[];
812
+ }
813
+
770
814
  /**
771
815
  * @public
772
816
  * @react
@@ -929,51 +973,21 @@ export declare const DEFAULT_THEME: TLTheme;
929
973
  /** @public @react */
930
974
  export declare function DefaultBackground(): JSX.Element;
931
975
 
932
- /** @public @react */
933
- export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX.Element;
934
-
935
976
  /** @public @react */
936
977
  export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
937
978
 
938
- /** @public @react */
939
- export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity }: TLCollaboratorHintProps): JSX.Element;
940
-
941
- /** @public @react */
942
- export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
943
-
944
979
  /** @public @react */
945
980
  export declare const DefaultErrorFallback: TLErrorFallbackComponent;
946
981
 
947
982
  /** @public @react */
948
983
  export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
949
984
 
950
- /** @public @react */
951
- export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX.Element;
952
-
953
- /** @public @react */
954
- export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX.Element;
955
-
956
- /** @public @react */
957
- export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX.Element | null;
958
-
959
985
  /** @public @react */
960
986
  export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX.Element;
961
987
 
962
- /** @public @react */
963
- export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX.Element;
964
-
965
- /** @public @react */
966
- export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicatorProps>;
967
-
968
- /** @public @react */
969
- export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicatorsProps>;
970
-
971
988
  /** @public @react */
972
989
  export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
973
990
 
974
- /** @public @react */
975
- export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX.Element;
976
-
977
991
  /** @public @react */
978
992
  export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX.Element;
979
993
 
@@ -1053,7 +1067,6 @@ export declare const defaultTldrawOptions: {
1053
1067
  readonly tooltipDelayMs: 700;
1054
1068
  readonly uiCoarseDragDistanceSquared: 625;
1055
1069
  readonly uiDragDistanceSquared: 16;
1056
- readonly useCanvasIndicators: true;
1057
1070
  readonly zoomToFitPadding: 128;
1058
1071
  };
1059
1072
 
@@ -1153,7 +1166,7 @@ export declare class EdgeScrollManager {
1153
1166
  /** @public */
1154
1167
  export declare class Editor extends EventEmitter<TLEventMap> {
1155
1168
  readonly id: string;
1156
- constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
1169
+ constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, overlayUtils: overlayUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
1157
1170
  private readonly _getShapeVisibility?;
1158
1171
  private getIsShapeHiddenCache;
1159
1172
  isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
@@ -1235,6 +1248,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1235
1248
  setInterval: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
1236
1249
  setTimeout: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
1237
1250
  };
1251
+ /**
1252
+ * A manager for remote peer collaborators connected to this editor.
1253
+ *
1254
+ * @public
1255
+ */
1256
+ readonly collaborators: CollaboratorsManager;
1238
1257
  /**
1239
1258
  * A manager for the user and their preferences.
1240
1259
  *
@@ -1260,6 +1279,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1260
1279
  * @public
1261
1280
  */
1262
1281
  readonly scribbles: ScribbleManager;
1282
+ /**
1283
+ * A manager for canvas overlay UI elements (selection handles, shape handles, etc.).
1284
+ *
1285
+ * @public
1286
+ */
1287
+ readonly overlays: OverlayManager;
1263
1288
  /**
1264
1289
  * A manager for side effects and correct state enforcement. See {@link @tldraw/store#StoreSideEffects} for details.
1265
1290
  *
@@ -1738,6 +1763,11 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1738
1763
  /**
1739
1764
  * Set the cursor.
1740
1765
  *
1766
+ * No-op when the partial wouldn't change the current cursor — `setCursor`
1767
+ * is called from pointer-move hot paths (see `updateHoveredOverlayId`,
1768
+ * various tool states) and skipping redundant writes avoids needlessly
1769
+ * dirtying instance state.
1770
+ *
1741
1771
  * @param cursor - The cursor to set.
1742
1772
  * @public
1743
1773
  */
@@ -2497,11 +2527,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2497
2527
  * @public
2498
2528
  */
2499
2529
  pageToViewport(point: VecLike): Vec;
2500
- private _getCollaboratorsQuery;
2501
2530
  /**
2502
2531
  * Returns a list of presence records for all peer collaborators.
2503
2532
  * This will return the latest presence record for each connected user.
2504
2533
  *
2534
+ * Convenience wrapper for {@link CollaboratorsManager.getCollaborators}.
2535
+ *
2505
2536
  * @public
2506
2537
  */
2507
2538
  getCollaborators(): TLInstancePresence[];
@@ -2509,9 +2540,32 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2509
2540
  * Returns a list of presence records for all peer collaborators on the current page.
2510
2541
  * This will return the latest presence record for each connected user.
2511
2542
  *
2543
+ * Convenience wrapper for {@link CollaboratorsManager.getCollaboratorsOnCurrentPage}.
2544
+ *
2512
2545
  * @public
2513
2546
  */
2514
2547
  getCollaboratorsOnCurrentPage(): TLInstancePresence[];
2548
+ /**
2549
+ * Returns a list of presence records for peer collaborators who should currently be
2550
+ * shown in the UI. Filters {@link Editor.getCollaborators} by activity state
2551
+ * (active / idle / inactive) and visibility rules such as following and highlighted
2552
+ * users. Re-evaluates on the collaborator visibility clock, so callers don't need to
2553
+ * drive their own activity timer.
2554
+ *
2555
+ * Convenience wrapper for {@link CollaboratorsManager.getVisibleCollaborators}.
2556
+ *
2557
+ * @public
2558
+ */
2559
+ getVisibleCollaborators(): TLInstancePresence[];
2560
+ /**
2561
+ * Returns a list of presence records for peer collaborators who should currently be
2562
+ * shown in the UI, filtered to those on the current page.
2563
+ *
2564
+ * Convenience wrapper for {@link CollaboratorsManager.getVisibleCollaboratorsOnCurrentPage}.
2565
+ *
2566
+ * @public
2567
+ */
2568
+ getVisibleCollaboratorsOnCurrentPage(): TLInstancePresence[];
2515
2569
  /**
2516
2570
  * Get the current user's ID for attribution purposes.
2517
2571
  * Also ensures a `user:` record exists in the store for the current user.
@@ -4719,6 +4773,16 @@ export declare function getFreshUserPreferences(): TLUserPreferences;
4719
4773
  */
4720
4774
  export declare function getIncrementedName(name: string, others: string[]): string;
4721
4775
 
4776
+ /**
4777
+ * Get the resolved display values for an overlay, merging the base values with any overrides.
4778
+ *
4779
+ * @public
4780
+ */
4781
+ export declare function getOverlayDisplayValues<Overlay extends TLOverlay, DisplayValues extends object>(util: {
4782
+ editor: Editor;
4783
+ options: OverlayOptionsWithDisplayValues<Overlay, DisplayValues>;
4784
+ }, overlay: Overlay, colorMode?: 'dark' | 'light'): DisplayValues;
4785
+
4722
4786
  /* Excluded from this release type: getOwnerDocument */
4723
4787
 
4724
4788
  /* Excluded from this release type: getOwnerWindow */
@@ -4852,7 +4916,7 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
4852
4916
  getDefaultProps(): TLGroupShape['props'];
4853
4917
  getGeometry(shape: TLGroupShape): Geometry2d;
4854
4918
  component(shape: TLGroupShape): JSX.Element | null;
4855
- indicator(shape: TLGroupShape): JSX.Element;
4919
+ getIndicatorPath(shape: TLGroupShape): Path2D;
4856
4920
  onChildrenChange(group: TLGroupShape): void;
4857
4921
  }
4858
4922
 
@@ -5480,6 +5544,185 @@ export declare function openWindow(url: string, target?: string, allowReferrer?:
5480
5544
  /** @public */
5481
5545
  export declare type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
5482
5546
 
5547
+ /** @public */
5548
+ export declare class OverlayManager {
5549
+ readonly editor: Editor;
5550
+ constructor(editor: Editor);
5551
+ /* Excluded from this release type: _overlayUtils */
5552
+ /* Excluded from this release type: registerUtil */
5553
+ /**
5554
+ * Get an overlay util by type string, overlay instance, or by passing
5555
+ * a util class as a generic parameter for type-safe lookup.
5556
+ *
5557
+ * @example
5558
+ * ```ts
5559
+ * const util = editor.overlays.getOverlayUtil('brush')
5560
+ * const util = editor.overlays.getOverlayUtil<BrushOverlayUtil>('brush')
5561
+ * const util = editor.overlays.getOverlayUtil(myOverlay)
5562
+ * ```
5563
+ *
5564
+ * @public
5565
+ */
5566
+ getOverlayUtil<T extends OverlayUtil>(type: T extends OverlayUtil<infer O> ? O['type'] : string): T;
5567
+ getOverlayUtil<O extends TLOverlay>(overlay: O): OverlayUtil<O>;
5568
+ /**
5569
+ * Returns all registered overlay utils in paint order (ascending zIndex).
5570
+ * Utils with the same zIndex preserve their registration order.
5571
+ *
5572
+ * @public
5573
+ */
5574
+ getOverlayUtilsInZOrder(): OverlayUtil[];
5575
+ /**
5576
+ * Reactive list of active overlay utils paired with the overlays they
5577
+ * produced for the current editor state, in paint order (ascending
5578
+ * zIndex). Both the hit-test and render paths read from this single
5579
+ * cached scan instead of each re-deriving the active set. Active utils
5580
+ * are included even when their `getOverlays()` returns an empty array,
5581
+ * since `render()` may still draw non-interactive UI (e.g. the selection
5582
+ * bounding box during brushing).
5583
+ *
5584
+ * @public
5585
+ */
5586
+ getActiveOverlayEntries(): TLOverlayEntry[];
5587
+ /**
5588
+ * Reactively computed list of all currently active overlays, in paint order.
5589
+ * @public
5590
+ */
5591
+ getCurrentOverlays(): TLOverlay[];
5592
+ private _geometryCache;
5593
+ /**
5594
+ * Get hit-test geometry for an overlay, cached by overlay identity. Lets
5595
+ * hit-testing on a pointermove storm skip the per-overlay geometry
5596
+ * allocation that {@link OverlayUtil.getGeometry} would otherwise do on
5597
+ * every call.
5598
+ *
5599
+ * @public
5600
+ */
5601
+ getOverlayGeometry(overlay: TLOverlay): Geometry2d | null;
5602
+ /**
5603
+ * The currently hovered overlay id.
5604
+ * @public
5605
+ */
5606
+ private _hoveredOverlayId;
5607
+ getHoveredOverlayId(): null | string;
5608
+ getHoveredOverlay(): null | TLOverlay;
5609
+ setHoveredOverlay(id: null | string): void;
5610
+ /**
5611
+ * Hit test all active overlays at a given page point.
5612
+ * Returns the topmost overlay whose geometry contains the point, or null.
5613
+ * Utils are walked from highest zIndex to lowest so the overlay painted on
5614
+ * top also wins the hit test. Within a util, overlays are walked in
5615
+ * array order: the first overlay whose geometry contains the point wins,
5616
+ * so utils should place highest-priority overlays first in `getOverlays`.
5617
+ * Interactive overlays (those with geometry) are checked; non-interactive are skipped.
5618
+ *
5619
+ * @param point - Point in page coordinates
5620
+ * @param margin - Hit test margin
5621
+ * @public
5622
+ */
5623
+ getOverlayAtPoint(point: VecLike, margin?: number): null | TLOverlay;
5624
+ }
5625
+
5626
+ /** @public */
5627
+ export declare interface OverlayOptionsWithDisplayValues<Overlay extends TLOverlay, DisplayValues extends object> {
5628
+ getDefaultDisplayValues(editor: Editor, overlay: Overlay, theme: TLTheme, colorMode: 'dark' | 'light'): DisplayValues;
5629
+ getCustomDisplayValues(editor: Editor, overlay: Overlay, theme: TLTheme, colorMode: 'dark' | 'light'): Partial<DisplayValues>;
5630
+ }
5631
+
5632
+ /**
5633
+ * Base class for overlay utilities. Overlays are ephemeral UI elements rendered
5634
+ * on top of the canvas (selection handles, rotation corners, shape handles, etc.).
5635
+ *
5636
+ * Each OverlayUtil defines a type of overlay and knows how to:
5637
+ * - Determine when its overlays should be active (predicate)
5638
+ * - Produce overlay instances from current editor state
5639
+ * - Provide hit-test geometry for interactive overlays
5640
+ * - Provide cursor style on hover
5641
+ * - Render into a canvas 2D context
5642
+ *
5643
+ * @public
5644
+ */
5645
+ export declare abstract class OverlayUtil<T extends TLOverlay = TLOverlay> {
5646
+ editor: Editor;
5647
+ constructor(editor: Editor);
5648
+ static type: string;
5649
+ /**
5650
+ * Options for this overlay util. Override this to provide customization options.
5651
+ * Use {@link OverlayUtil.configure} to customize existing overlay utils.
5652
+ *
5653
+ * `zIndex` controls paint and hit-test order across utils — higher numbers
5654
+ * paint on top and are hit-tested first. Ties resolve by registration order.
5655
+ * Defaults to `0`; built-in utils use larger integers (100, 200, …) with
5656
+ * gaps so custom utils can slot between.
5657
+ *
5658
+ * @public
5659
+ */
5660
+ options: {
5661
+ zIndex?: number;
5662
+ };
5663
+ /**
5664
+ * Create a new overlay util class with the given options merged in.
5665
+ *
5666
+ * @example
5667
+ * ```ts
5668
+ * const MyBrush = BrushOverlayUtil.configure({ fill: 'rgba(0,0,255,0.1)' })
5669
+ * ```
5670
+ *
5671
+ * @public
5672
+ */
5673
+ static configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
5674
+ options: infer Options;
5675
+ } ? Partial<Options> : never): T;
5676
+ /**
5677
+ * Whether this overlay util's overlays should currently be active.
5678
+ * Checked reactively to determine which overlays exist at any given time.
5679
+ */
5680
+ abstract isActive(): boolean;
5681
+ /**
5682
+ * Returns the overlay instances that currently exist.
5683
+ * Called only when `isActive()` returns true.
5684
+ */
5685
+ abstract getOverlays(): T[];
5686
+ /**
5687
+ * Returns hit-test geometry for an overlay instance, in page coordinates.
5688
+ * Return null for non-interactive overlays (e.g. snap indicators, scribbles).
5689
+ */
5690
+ getGeometry(_overlay: T): Geometry2d | null;
5691
+ /**
5692
+ * Returns the cursor type to show when hovering this overlay.
5693
+ */
5694
+ getCursor(_overlay: T): TLCursorType | undefined;
5695
+ /**
5696
+ * Called when the user points down on this overlay, before the default
5697
+ * routing runs. Acts as an interrupt: define it to take over the event.
5698
+ *
5699
+ * Return `false` to continue with the default behavior (e.g. the
5700
+ * built-in rotate/resize handle transitions or shape-handle dispatch).
5701
+ * Return `true` — or nothing at all — to skip the default. In other
5702
+ * words, once you override this method you own the event unless you
5703
+ * explicitly opt back in by returning `false`.
5704
+ */
5705
+ onPointerDown?(overlay: T, info: TLPointerEventInfo): boolean | void;
5706
+ /**
5707
+ * Render all active overlays into the canvas context.
5708
+ * The context is already transformed to page space (camera transform applied).
5709
+ * Called reactively when overlays or editor state changes.
5710
+ */
5711
+ render(_ctx: CanvasRenderingContext2D, _overlays: T[]): void;
5712
+ /**
5713
+ * Optional: render all active overlays into the minimap canvas.
5714
+ * The context is already transformed to page space (minimap camera applied),
5715
+ * so overlays can use the same page-space coordinates as in {@link OverlayUtil.render}.
5716
+ *
5717
+ * `zoom` is the minimap's screen-pixels-per-page-unit, analogous to
5718
+ * `editor.getCamera().z`; use `1 / zoom` for one-minimap-pixel line widths.
5719
+ *
5720
+ * Most overlays should leave this blank — only overlays that are meaningful
5721
+ * at minimap scale (e.g. brushes, collaborator cursors) should opt in.
5722
+ */
5723
+ renderMinimap(_ctx: CanvasRenderingContext2D, _overlays: T[], _zoom: number): void;
5724
+ }
5725
+
5483
5726
  /**
5484
5727
  * Parses a string created by {@link createDeepLinkString} back into a deep link descriptor.
5485
5728
  *
@@ -6012,6 +6255,32 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
6012
6255
  /** @public */
6013
6256
  export declare function setUserPreferences(user: TLUserPreferences): void;
6014
6257
 
6258
+ /**
6259
+ * Overlay util for shape indicators — the selection / hover / hint outlines drawn
6260
+ * under the selection foreground. Paints local indicators in the theme's
6261
+ * selection color.
6262
+ *
6263
+ * Remote collaborator selection indicators are drawn by a separate overlay util
6264
+ * (e.g. `CollaboratorShapeIndicatorOverlayUtil` from `tldraw`) that runs at a
6265
+ * lower z-index so peer selections appear under the local indicators.
6266
+ *
6267
+ * Non-interactive: contributes no hit-test geometry.
6268
+ *
6269
+ * @public
6270
+ */
6271
+ export declare class ShapeIndicatorOverlayUtil extends OverlayUtil<TLShapeIndicatorOverlay> {
6272
+ static type: string;
6273
+ options: {
6274
+ hintedLineWidth: number;
6275
+ lineWidth: number;
6276
+ zIndex: number;
6277
+ };
6278
+ private _instanceFlags$;
6279
+ isActive(): boolean;
6280
+ getOverlays(): TLShapeIndicatorOverlay[];
6281
+ render(ctx: CanvasRenderingContext2D, overlays: TLShapeIndicatorOverlay[]): void;
6282
+ }
6283
+
6015
6284
  /** @public */
6016
6285
  export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6017
6286
  editor: Editor;
@@ -6108,37 +6377,30 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6108
6377
  */
6109
6378
  abstract component(shape: Shape): any;
6110
6379
  /**
6111
- * Get JSX describing the shape's indicator (as an SVG element).
6112
- *
6113
- * @param shape - The shape.
6114
- * @public
6115
- */
6116
- abstract indicator(shape: Shape): any;
6117
- /**
6118
- * Whether to use the legacy React-based indicator rendering.
6380
+ * Get a Path2D (or a richer object with clip/additional paths) for rendering the
6381
+ * shape's indicator on the canvas. Shapes that return `undefined` will not render
6382
+ * an indicator.
6119
6383
  *
6120
- * Override this to return `false` if your shape implements {@link ShapeUtil.getIndicatorPath}
6121
- * for canvas-based indicator rendering.
6384
+ * For complex indicators that need clipping (e.g., arrows with labels), return an
6385
+ * object with `path`, `clipPath`, and `additionalPaths` properties.
6122
6386
  *
6123
- * @returns `true` to use SVG indicators (default), `false` to use canvas indicators.
6387
+ * @param shape - The shape.
6388
+ * @returns A Path2D to stroke, or an object with clipping info, or undefined to skip.
6124
6389
  * @public
6125
6390
  */
6126
- useLegacyIndicator(): boolean;
6391
+ abstract getIndicatorPath(shape: Shape): TLIndicatorPath | undefined;
6127
6392
  /**
6128
- * Get a Path2D for rendering the shape's indicator on the canvas.
6129
- *
6130
- * When implemented, this is used instead of {@link ShapeUtil.indicator} for more
6131
- * efficient canvas-based indicator rendering. Shapes that return `undefined` will
6132
- * fall back to SVG-based rendering via {@link ShapeUtil.indicator}.
6393
+ * Get JSX describing the shape's indicator (as an SVG element).
6133
6394
  *
6134
- * For complex indicators that need clipping (e.g., arrows with labels), return an
6135
- * object with `path`, `clipPath`, and `additionalPaths` properties.
6395
+ * @deprecated SVG indicators are no longer rendered. Override
6396
+ * {@link ShapeUtil.getIndicatorPath} instead. This stub is retained so legacy
6397
+ * subclasses that still call `super.indicator()` keep type-checking; new shapes
6398
+ * should not implement it.
6136
6399
  *
6137
6400
  * @param shape - The shape.
6138
- * @returns A Path2D to stroke, or an object with clipping info, or undefined to use SVG fallback.
6139
6401
  * @public
6140
6402
  */
6141
- getIndicatorPath(shape: Shape): TLIndicatorPath | undefined;
6403
+ indicator(_shape: Shape): any;
6142
6404
  /**
6143
6405
  * Get the font faces that should be rendered in the document in order for this shape to render
6144
6406
  * correctly.
@@ -6355,13 +6617,28 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6355
6617
  */
6356
6618
  getHandles?(shape: Shape): TLHandle[];
6357
6619
  /**
6358
- * Get whether the shape can receive children of a given type.
6620
+ * Get whether the shape can receive children of a given type. Used by the drag and drop system
6621
+ * to decide whether {@link ShapeUtil.onDragShapesIn} should fire when a shape of the given type
6622
+ * is dragged over this one.
6359
6623
  *
6360
6624
  * @param shape - The shape.
6361
6625
  * @param type - The shape type.
6362
6626
  * @public
6363
6627
  */
6364
6628
  canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
6629
+ /**
6630
+ * Get whether children of a given type can be removed from this shape. Used by the drag and
6631
+ * drop system to decide whether {@link ShapeUtil.onDragShapesOut} should fire when a child of
6632
+ * the given type is dragged out of this shape, and by `kickoutOccludedShapes` to decide
6633
+ * whether to auto-reparent a child of the given type when it has moved outside this shape's
6634
+ * geometry. Returning `false` therefore "pins" matching children — they stay parented to this
6635
+ * shape even when dragged or moved outside it. Defaults to `true`.
6636
+ *
6637
+ * @param shape - The shape.
6638
+ * @param type - The shape type.
6639
+ * @public
6640
+ */
6641
+ canRemoveChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
6365
6642
  /**
6366
6643
  * Get the shape as an SVG object.
6367
6644
  *
@@ -6905,6 +7182,19 @@ export declare const stopEventPropagation: (e: any) => any;
6905
7182
 
6906
7183
  /* Excluded from this release type: StoreName */
6907
7184
 
7185
+ /**
7186
+ * Combine every batchable shape indicator into a single page-space `Path2D` and
7187
+ * emit one stroke call. Shapes whose indicator needs an evenodd clip (e.g.
7188
+ * arrows with labels or complex arrowheads) can't be batched — they still
7189
+ * stroke individually inside a save/restore with `ctx.clip` applied.
7190
+ *
7191
+ * Shared by {@link ShapeIndicatorOverlayUtil} and any overlay util that paints
7192
+ * shape indicators (e.g. collaborator selections).
7193
+ *
7194
+ * @public
7195
+ */
7196
+ export declare function strokeShapeIndicators(editor: Editor, ctx: CanvasRenderingContext2D, shapeIds: TLShapeId[]): void;
7197
+
6908
7198
  /** @public */
6909
7199
  export declare function suffixSafeId(id: SafeId, suffix: string): SafeId;
6910
7200
 
@@ -7079,6 +7369,9 @@ export declare type TLAnyAssetUtilConstructor = TLAssetUtilConstructor<any>;
7079
7369
  /** @public */
7080
7370
  export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
7081
7371
 
7372
+ /** @public */
7373
+ export declare type TLAnyOverlayUtilConstructor = TLOverlayUtilConstructor<any>;
7374
+
7082
7375
  /** @public */
7083
7376
  export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
7084
7377
 
@@ -7122,15 +7415,6 @@ export declare interface TLBindingUtilConstructor<T extends TLBinding, U extends
7122
7415
  migrations?: TLPropsMigrations;
7123
7416
  }
7124
7417
 
7125
- /** @public */
7126
- export declare interface TLBrushProps {
7127
- userId?: string;
7128
- brush: BoxModel;
7129
- color?: string;
7130
- opacity?: number;
7131
- className?: string;
7132
- }
7133
-
7134
7418
  /** @public */
7135
7419
  export declare interface TLCameraConstraints {
7136
7420
  /** The bounds (in page space) of the constrained space */
@@ -7318,17 +7602,6 @@ export declare interface TLClipboardWriteInfo {
7318
7602
  readonly source: 'menu' | 'native';
7319
7603
  }
7320
7604
 
7321
- /** @public */
7322
- export declare interface TLCollaboratorHintProps {
7323
- userId: string;
7324
- className?: string;
7325
- point: VecModel;
7326
- viewport: Box;
7327
- zoom: number;
7328
- opacity?: number;
7329
- color: string;
7330
- }
7331
-
7332
7605
  /** @public */
7333
7606
  export declare type TLCompleteEvent = (info: TLCompleteEventInfo) => void;
7334
7607
 
@@ -7373,17 +7646,6 @@ export declare interface TLCurrentUser {
7373
7646
  readonly setUserPreferences: (userPreferences: TLUserPreferences) => void;
7374
7647
  }
7375
7648
 
7376
- /** @public */
7377
- export declare interface TLCursorProps {
7378
- userId: string;
7379
- className?: string;
7380
- point: null | VecModel;
7381
- zoom: number;
7382
- color?: string;
7383
- name: null | string;
7384
- chatMessage: string;
7385
- }
7386
-
7387
7649
  /** @public */
7388
7650
  export declare type TLDeepLink = {
7389
7651
  bounds: BoxModel;
@@ -7477,6 +7739,10 @@ export declare interface TldrawEditorBaseProps {
7477
7739
  * An array of asset utils to use in the editor.
7478
7740
  */
7479
7741
  assetUtils?: readonly TLAnyAssetUtilConstructor[];
7742
+ /**
7743
+ * An array of overlay utils to use in the editor for canvas overlay UI elements.
7744
+ */
7745
+ overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
7480
7746
  /**
7481
7747
  * An array of tools to add to the editor's state chart.
7482
7748
  */
@@ -7786,12 +8052,6 @@ export declare interface TldrawOptions {
7786
8052
  * viewport's page dimensions regardless of overview zoom changes.
7787
8053
  */
7788
8054
  readonly quickZoomPreservesScreenBounds: boolean;
7789
- /**
7790
- * Whether to use 2D canvas rendering for shape indicators. When true (default),
7791
- * shapes that support it will render indicators on a 2D canvas for better
7792
- * performance. When false, all indicators use legacy SVG rendering.
7793
- */
7794
- readonly useCanvasIndicators: boolean;
7795
8055
  /**
7796
8056
  * Called before content is written to the clipboard during a copy or cut operation.
7797
8057
  * Receives the serialized content (shapes, bindings, assets) and can filter or transform
@@ -7879,34 +8139,17 @@ export declare interface TLDropShapesOverInfo {
7879
8139
  /** @public */
7880
8140
  export declare interface TLEditorComponents {
7881
8141
  Background?: ComponentType | null;
7882
- Brush?: ComponentType<TLBrushProps> | null;
7883
8142
  Canvas?: ComponentType<TLCanvasComponentProps> | null;
7884
- CollaboratorBrush?: ComponentType<TLBrushProps> | null;
7885
- CollaboratorCursor?: ComponentType<TLCursorProps> | null;
7886
- CollaboratorHint?: ComponentType<TLCollaboratorHintProps> | null;
7887
- CollaboratorScribble?: ComponentType<TLScribbleProps> | null;
7888
- CollaboratorShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
7889
- Cursor?: ComponentType<TLCursorProps> | null;
7890
8143
  Grid?: ComponentType<TLGridProps> | null;
7891
- Handle?: ComponentType<TLHandleProps> | null;
7892
- Handles?: ComponentType<TLHandlesProps> | null;
7893
8144
  InFrontOfTheCanvas?: ComponentType | null;
7894
8145
  LoadingScreen?: ComponentType | null;
7895
8146
  OnTheCanvas?: ComponentType | null;
7896
- Overlays?: ComponentType | null;
7897
- Scribble?: ComponentType<TLScribbleProps> | null;
7898
8147
  SelectionBackground?: ComponentType<TLSelectionBackgroundProps> | null;
7899
- SelectionForeground?: ComponentType<TLSelectionForegroundProps> | null;
7900
- ShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
7901
- ShapeIndicators?: ComponentType | null;
7902
8148
  ShapeWrapper?: ComponentType<TLShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
7903
- SnapIndicator?: ComponentType<TLSnapIndicatorProps> | null;
7904
8149
  Spinner?: ComponentType<React.SVGProps<SVGSVGElement>> | null;
7905
8150
  SvgDefs?: ComponentType | null;
7906
- ZoomBrush?: ComponentType<TLBrushProps> | null;
7907
8151
  ErrorFallback?: TLErrorFallbackComponent;
7908
8152
  ShapeErrorFallback?: TLShapeErrorFallbackComponent;
7909
- ShapeIndicatorErrorFallback?: TLShapeIndicatorErrorFallbackComponent;
7910
8153
  }
7911
8154
 
7912
8155
  /** @public */
@@ -7928,6 +8171,11 @@ export declare interface TLEditorOptions {
7928
8171
  * An array of asset utils to use in the editor. These will be used to handle asset-type-specific behavior.
7929
8172
  */
7930
8173
  assetUtils?: readonly TLAnyAssetUtilConstructor[];
8174
+ /**
8175
+ * An array of overlay utils to use in the editor. These define canvas overlay UI elements
8176
+ * like selection handles, rotation corners, shape handles, etc.
8177
+ */
8178
+ overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
7931
8179
  /**
7932
8180
  * An array of tools to use in the editor. These will be used to handle events and manage user interactions in the editor.
7933
8181
  */
@@ -8294,20 +8542,6 @@ export declare interface TLHandleDragInfo<T extends TLShape> {
8294
8542
  initial?: T | undefined;
8295
8543
  }
8296
8544
 
8297
- /** @public */
8298
- export declare interface TLHandleProps {
8299
- shapeId: TLShapeId;
8300
- handle: TLHandle;
8301
- zoom: number;
8302
- isCoarse: boolean;
8303
- className?: string;
8304
- }
8305
-
8306
- /** @public */
8307
- export declare interface TLHandlesProps {
8308
- children: ReactNode;
8309
- }
8310
-
8311
8545
  /** @public */
8312
8546
  export declare interface TLHistoryBatchOptions {
8313
8547
  /**
@@ -8637,6 +8871,42 @@ export declare const tlmenus: {
8637
8871
  */
8638
8872
  export declare type TLOnMountHandler = (editor: Editor) => (() => undefined | void) | undefined | void;
8639
8873
 
8874
+ /** @public */
8875
+ export declare interface TLOverlay<Props = Record<string, unknown>> {
8876
+ /**
8877
+ * Globally unique id for this overlay instance across all overlay utils.
8878
+ * Hit-test and hover lookup key on `id` alone, so utils must namespace their
8879
+ * ids (e.g. `'selection_fg:top_left'`, `'handle:<shapeId>:<handleId>'`) to
8880
+ * avoid colliding with overlays from other utils.
8881
+ */
8882
+ id: string;
8883
+ /** The overlay util type that owns this instance */
8884
+ type: string;
8885
+ /** Arbitrary props for the overlay (handle id, corner name, etc.) */
8886
+ props: Props;
8887
+ }
8888
+
8889
+ /**
8890
+ * An active overlay util paired with the overlays it produced for the current
8891
+ * editor state. Returned by {@link OverlayManager.getActiveOverlayEntries} so
8892
+ * hit-test, render, and debug paths share a single scan per reactive tick.
8893
+ *
8894
+ * @public
8895
+ */
8896
+ export declare interface TLOverlayEntry {
8897
+ util: OverlayUtil;
8898
+ overlays: TLOverlay[];
8899
+ }
8900
+
8901
+ /** @public */
8902
+ export declare interface TLOverlayUtilConstructor<U extends OverlayUtil = OverlayUtil> {
8903
+ new (editor: Editor): U;
8904
+ type: string;
8905
+ configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
8906
+ options: infer Options;
8907
+ } ? Partial<Options> : never): T;
8908
+ }
8909
+
8640
8910
  /**
8641
8911
  * Map of all performance event names to their payload types.
8642
8912
  * Used with {@link PerformanceManager.on} and {@link PerformanceManager.once}.
@@ -8764,6 +9034,10 @@ export declare type TLPointerEventTarget = {
8764
9034
  handle?: TLSelectionHandle;
8765
9035
  shape?: undefined;
8766
9036
  target: 'selection';
9037
+ } | {
9038
+ overlay: TLOverlay;
9039
+ shape?: undefined;
9040
+ target: 'overlay';
8767
9041
  } | {
8768
9042
  shape: TLShape;
8769
9043
  target: 'shape';
@@ -8834,28 +9108,12 @@ export declare type TLResizeShapeOptions = Partial<{
8834
9108
 
8835
9109
  /* Excluded from this release type: TLRotationSnapshot */
8836
9110
 
8837
- /** @public */
8838
- export declare interface TLScribbleProps {
8839
- userId?: string;
8840
- scribble: TLScribble;
8841
- zoom: number;
8842
- color?: string;
8843
- opacity?: number;
8844
- className?: string;
8845
- }
8846
-
8847
9111
  /** @public */
8848
9112
  export declare interface TLSelectionBackgroundProps {
8849
9113
  bounds: Box;
8850
9114
  rotation: number;
8851
9115
  }
8852
9116
 
8853
- /** @public */
8854
- export declare interface TLSelectionForegroundProps {
8855
- bounds: Box;
8856
- rotation: number;
8857
- }
8858
-
8859
9117
  /** @public */
8860
9118
  export declare type TLSelectionHandle = RotateCorner | SelectionCorner | SelectionEdge;
8861
9119
 
@@ -8890,26 +9148,11 @@ export declare type TLShapeErrorFallbackComponent = ComponentType<{
8890
9148
  }>;
8891
9149
 
8892
9150
  /** @public */
8893
- export declare type TLShapeIndicatorErrorFallbackComponent = ComponentType<{
8894
- error: unknown;
8895
- }>;
8896
-
8897
- /** @public */
8898
- export declare interface TLShapeIndicatorProps {
8899
- userId?: string;
8900
- shapeId: TLShapeId;
8901
- color?: string | undefined;
8902
- opacity?: number;
8903
- className?: string;
8904
- hidden?: boolean;
8905
- }
8906
-
8907
- /** @public */
8908
- export declare interface TLShapeIndicatorsProps {
8909
- /** Whether to hide all of the indicators */
8910
- hideAll?: boolean;
8911
- /** Whether to show all of the indicators */
8912
- showAll?: boolean;
9151
+ export declare interface TLShapeIndicatorOverlay extends TLOverlay {
9152
+ props: {
9153
+ hintingShapeIds: TLShapeId[];
9154
+ idsToDisplay: TLShapeId[];
9155
+ };
8913
9156
  }
8914
9157
 
8915
9158
  /**
@@ -8997,13 +9240,6 @@ export declare interface TLShapeWrapperProps extends React.HTMLAttributes<HTMLDi
8997
9240
  children: ReactNode;
8998
9241
  }
8999
9242
 
9000
- /** @public */
9001
- export declare interface TLSnapIndicatorProps {
9002
- className?: string;
9003
- line: SnapIndicator;
9004
- zoom: number;
9005
- }
9006
-
9007
9243
  /** @public */
9008
9244
  export declare interface TLStateNodeConstructor {
9009
9245
  new (editor: Editor, parent?: StateNode): StateNode;
@@ -9392,6 +9628,10 @@ export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement
9392
9628
  export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
9393
9629
 
9394
9630
  /**
9631
+ * Reactive list of peer user IDs for collaborators currently shown in the UI.
9632
+ * Mirrors {@link Editor.getVisibleCollaborators} — peers fade out as they
9633
+ * transition to idle/inactive, without requiring a manual re-render.
9634
+ *
9395
9635
  * @returns The list of peer UserIDs
9396
9636
  * @public
9397
9637
  */
@@ -9457,13 +9697,6 @@ export declare class UserPreferencesManager {
9457
9697
  /** @public */
9458
9698
  export declare const userTypeValidator: T.Validator<TLUserPreferences>;
9459
9699
 
9460
- /** @public */
9461
- export declare function useSelectionEvents(handle: TLSelectionHandle): {
9462
- onPointerDown: PointerEventHandler<Element>;
9463
- onPointerMove: (e: PointerEvent_2<Element>) => void;
9464
- onPointerUp: PointerEventHandler<Element>;
9465
- };
9466
-
9467
9700
  /* Excluded from this release type: useShallowArrayIdentity */
9468
9701
 
9469
9702
  /* Excluded from this release type: useShallowObjectIdentity */