@tldraw/editor 4.6.0-canary.f6814b1e22ff → 4.6.0-canary.f6b4d0101ca7

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 (314) hide show
  1. package/dist-cjs/index.d.ts +681 -160
  2. package/dist-cjs/index.js +13 -21
  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/MenuClickCapture.js +99 -38
  7. package/dist-cjs/lib/components/MenuClickCapture.js.map +2 -2
  8. package/dist-cjs/lib/components/default-components/CanvasOverlays.js +180 -0
  9. package/dist-cjs/lib/components/default-components/CanvasOverlays.js.map +7 -0
  10. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +33 -236
  11. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +3 -3
  12. package/dist-cjs/lib/editor/Editor.js +119 -5
  13. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  14. package/dist-cjs/lib/editor/assets/AssetUtil.js +1 -0
  15. package/dist-cjs/lib/editor/assets/AssetUtil.js.map +1 -1
  16. package/dist-cjs/lib/editor/bindings/BindingUtil.js +1 -0
  17. package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +1 -1
  18. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +1 -0
  19. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +1 -1
  20. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +1 -0
  21. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +1 -1
  22. package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js +1 -0
  23. package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js.map +1 -1
  24. package/dist-cjs/lib/editor/managers/FontManager/FontManager.js +2 -0
  25. package/dist-cjs/lib/editor/managers/FontManager/FontManager.js.map +1 -1
  26. package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js +2 -0
  27. package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js.map +1 -1
  28. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +12 -0
  29. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +2 -2
  30. package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.js +80 -0
  31. package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.js.map +7 -0
  32. package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceManager.js +466 -0
  33. package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceManager.js.map +7 -0
  34. package/dist-cjs/lib/{components/default-components/DefaultHandles.js → editor/managers/PerformanceManager/perf-types.js} +3 -14
  35. package/dist-cjs/lib/editor/managers/PerformanceManager/perf-types.js.map +7 -0
  36. package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js +1 -0
  37. package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js.map +1 -1
  38. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js +1 -0
  39. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js.map +1 -1
  40. package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js +1 -0
  41. package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +1 -1
  42. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +2 -1
  43. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
  44. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +1 -0
  45. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +1 -1
  46. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +1 -0
  47. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +1 -1
  48. package/dist-cjs/lib/editor/managers/ThemeManager/ThemeManager.js +1 -0
  49. package/dist-cjs/lib/editor/managers/ThemeManager/ThemeManager.js.map +1 -1
  50. package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js +14 -0
  51. package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js.map +2 -2
  52. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +1 -0
  53. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +1 -1
  54. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +2 -0
  55. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +1 -1
  56. package/dist-cjs/lib/editor/overlays/OverlayManager.js +154 -0
  57. package/dist-cjs/lib/editor/overlays/OverlayManager.js.map +7 -0
  58. package/dist-cjs/lib/editor/overlays/OverlayUtil.js +92 -0
  59. package/dist-cjs/lib/editor/overlays/OverlayUtil.js.map +7 -0
  60. package/dist-cjs/lib/editor/overlays/ShapeIndicatorOverlayUtil.js +180 -0
  61. package/dist-cjs/lib/editor/overlays/ShapeIndicatorOverlayUtil.js.map +7 -0
  62. package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js +76 -0
  63. package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js.map +7 -0
  64. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +20 -24
  65. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  66. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +33 -3
  67. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
  68. package/dist-cjs/lib/editor/shapes/shared/getPerfectDashProps.js +6 -0
  69. package/dist-cjs/lib/editor/shapes/shared/getPerfectDashProps.js.map +2 -2
  70. package/dist-cjs/lib/editor/tools/StateNode.js +15 -17
  71. package/dist-cjs/lib/editor/tools/StateNode.js.map +2 -2
  72. package/dist-cjs/lib/editor/types/event-types.js.map +2 -2
  73. package/dist-cjs/lib/exports/ExportDelay.js +1 -0
  74. package/dist-cjs/lib/exports/ExportDelay.js.map +1 -1
  75. package/dist-cjs/lib/exports/StyleEmbedder.js +1 -0
  76. package/dist-cjs/lib/exports/StyleEmbedder.js.map +1 -1
  77. package/dist-cjs/lib/exports/getSvgJsx.js +2 -1
  78. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  79. package/dist-cjs/lib/hooks/EditorComponentsContext.js.map +2 -2
  80. package/dist-cjs/lib/hooks/useCanvasEvents.js +25 -4
  81. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  82. package/dist-cjs/lib/hooks/useEditorComponents.js +0 -28
  83. package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
  84. package/dist-cjs/lib/hooks/usePeerIds.js +1 -36
  85. package/dist-cjs/lib/hooks/usePeerIds.js.map +2 -2
  86. package/dist-cjs/lib/hooks/useShapeCulling.js +2 -1
  87. package/dist-cjs/lib/hooks/useShapeCulling.js.map +2 -2
  88. package/dist-cjs/lib/options.js +1 -0
  89. package/dist-cjs/lib/options.js.map +2 -2
  90. package/dist-cjs/lib/primitives/Vec.js +3 -0
  91. package/dist-cjs/lib/primitives/Vec.js.map +1 -1
  92. package/dist-cjs/lib/primitives/geometry/Circle2d.js +1 -0
  93. package/dist-cjs/lib/primitives/geometry/Circle2d.js.map +1 -1
  94. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js +1 -0
  95. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js.map +1 -1
  96. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +2 -0
  97. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +1 -1
  98. package/dist-cjs/lib/primitives/geometry/Stadium2d.js +1 -0
  99. package/dist-cjs/lib/primitives/geometry/Stadium2d.js.map +1 -1
  100. package/dist-cjs/lib/utils/EditorAtom.js +2 -0
  101. package/dist-cjs/lib/utils/EditorAtom.js.map +1 -1
  102. package/dist-cjs/lib/utils/runtime.js +2 -1
  103. package/dist-cjs/lib/utils/runtime.js.map +2 -2
  104. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +2 -0
  105. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +1 -1
  106. package/dist-cjs/lib/utils/sync/hardReset.js +0 -8
  107. package/dist-cjs/lib/utils/sync/hardReset.js.map +2 -2
  108. package/dist-cjs/version.js +3 -3
  109. package/dist-cjs/version.js.map +1 -1
  110. package/dist-esm/index.d.mts +681 -160
  111. package/dist-esm/index.mjs +17 -39
  112. package/dist-esm/index.mjs.map +2 -2
  113. package/dist-esm/lib/TldrawEditor.mjs +3 -0
  114. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  115. package/dist-esm/lib/components/MenuClickCapture.mjs +100 -39
  116. package/dist-esm/lib/components/MenuClickCapture.mjs.map +2 -2
  117. package/dist-esm/lib/components/default-components/CanvasOverlays.mjs +160 -0
  118. package/dist-esm/lib/components/default-components/CanvasOverlays.mjs.map +7 -0
  119. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +34 -237
  120. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +3 -3
  121. package/dist-esm/lib/editor/Editor.mjs +123 -6
  122. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  123. package/dist-esm/lib/editor/assets/AssetUtil.mjs +1 -0
  124. package/dist-esm/lib/editor/assets/AssetUtil.mjs.map +1 -1
  125. package/dist-esm/lib/editor/bindings/BindingUtil.mjs +1 -0
  126. package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +1 -1
  127. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +1 -0
  128. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +1 -1
  129. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +1 -0
  130. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +1 -1
  131. package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs +1 -0
  132. package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs.map +1 -1
  133. package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs +2 -0
  134. package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs.map +1 -1
  135. package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs +2 -0
  136. package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs.map +1 -1
  137. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +12 -0
  138. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +2 -2
  139. package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.mjs +60 -0
  140. package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.mjs.map +7 -0
  141. package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceManager.mjs +438 -0
  142. package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceManager.mjs.map +7 -0
  143. package/dist-esm/lib/editor/managers/PerformanceManager/perf-types.mjs +1 -0
  144. package/dist-esm/lib/editor/managers/PerformanceManager/perf-types.mjs.map +7 -0
  145. package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs +1 -0
  146. package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs.map +1 -1
  147. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs +1 -0
  148. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs.map +1 -1
  149. package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs +1 -0
  150. package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +1 -1
  151. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +2 -1
  152. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
  153. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +1 -0
  154. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +1 -1
  155. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +1 -0
  156. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +1 -1
  157. package/dist-esm/lib/editor/managers/ThemeManager/ThemeManager.mjs +1 -0
  158. package/dist-esm/lib/editor/managers/ThemeManager/ThemeManager.mjs.map +1 -1
  159. package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs +14 -0
  160. package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs.map +2 -2
  161. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +1 -0
  162. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +1 -1
  163. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +2 -0
  164. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +1 -1
  165. package/dist-esm/lib/editor/overlays/OverlayManager.mjs +136 -0
  166. package/dist-esm/lib/editor/overlays/OverlayManager.mjs.map +7 -0
  167. package/dist-esm/lib/editor/overlays/OverlayUtil.mjs +72 -0
  168. package/dist-esm/lib/editor/overlays/OverlayUtil.mjs.map +7 -0
  169. package/dist-esm/lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs +160 -0
  170. package/dist-esm/lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs.map +7 -0
  171. package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs +56 -0
  172. package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs.map +7 -0
  173. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +20 -24
  174. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  175. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +33 -3
  176. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
  177. package/dist-esm/lib/editor/shapes/shared/getPerfectDashProps.mjs +6 -0
  178. package/dist-esm/lib/editor/shapes/shared/getPerfectDashProps.mjs.map +2 -2
  179. package/dist-esm/lib/editor/tools/StateNode.mjs +15 -17
  180. package/dist-esm/lib/editor/tools/StateNode.mjs.map +2 -2
  181. package/dist-esm/lib/editor/types/event-types.mjs.map +2 -2
  182. package/dist-esm/lib/exports/ExportDelay.mjs +1 -0
  183. package/dist-esm/lib/exports/ExportDelay.mjs.map +1 -1
  184. package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -0
  185. package/dist-esm/lib/exports/StyleEmbedder.mjs.map +1 -1
  186. package/dist-esm/lib/exports/getSvgJsx.mjs +2 -1
  187. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  188. package/dist-esm/lib/hooks/EditorComponentsContext.mjs.map +2 -2
  189. package/dist-esm/lib/hooks/useCanvasEvents.mjs +25 -4
  190. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  191. package/dist-esm/lib/hooks/useEditorComponents.mjs +0 -28
  192. package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
  193. package/dist-esm/lib/hooks/usePeerIds.mjs +2 -40
  194. package/dist-esm/lib/hooks/usePeerIds.mjs.map +2 -2
  195. package/dist-esm/lib/hooks/useShapeCulling.mjs +2 -1
  196. package/dist-esm/lib/hooks/useShapeCulling.mjs.map +2 -2
  197. package/dist-esm/lib/options.mjs +1 -0
  198. package/dist-esm/lib/options.mjs.map +2 -2
  199. package/dist-esm/lib/primitives/Vec.mjs +3 -0
  200. package/dist-esm/lib/primitives/Vec.mjs.map +1 -1
  201. package/dist-esm/lib/primitives/geometry/Circle2d.mjs +1 -0
  202. package/dist-esm/lib/primitives/geometry/Circle2d.mjs.map +1 -1
  203. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs +1 -0
  204. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs.map +1 -1
  205. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +2 -0
  206. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +1 -1
  207. package/dist-esm/lib/primitives/geometry/Stadium2d.mjs +1 -0
  208. package/dist-esm/lib/primitives/geometry/Stadium2d.mjs.map +1 -1
  209. package/dist-esm/lib/utils/EditorAtom.mjs +2 -0
  210. package/dist-esm/lib/utils/EditorAtom.mjs.map +1 -1
  211. package/dist-esm/lib/utils/runtime.mjs +2 -1
  212. package/dist-esm/lib/utils/runtime.mjs.map +2 -2
  213. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +2 -0
  214. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +1 -1
  215. package/dist-esm/lib/utils/sync/hardReset.mjs +0 -8
  216. package/dist-esm/lib/utils/sync/hardReset.mjs.map +2 -2
  217. package/dist-esm/version.mjs +3 -3
  218. package/dist-esm/version.mjs.map +1 -1
  219. package/editor.css +3 -223
  220. package/package.json +7 -7
  221. package/src/index.ts +27 -38
  222. package/src/lib/TldrawEditor.tsx +9 -0
  223. package/src/lib/components/MenuClickCapture.tsx +129 -49
  224. package/src/lib/components/default-components/CanvasOverlays.tsx +208 -0
  225. package/src/lib/components/default-components/DefaultCanvas.tsx +38 -310
  226. package/src/lib/editor/Editor.test.ts +3 -1
  227. package/src/lib/editor/Editor.ts +169 -14
  228. package/src/lib/editor/managers/InputsManager/InputsManager.ts +12 -0
  229. package/src/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.ts +82 -0
  230. package/src/lib/editor/managers/PerformanceManager/PerformanceManager.test.ts +522 -0
  231. package/src/lib/editor/managers/PerformanceManager/PerformanceManager.ts +583 -0
  232. package/src/lib/editor/managers/PerformanceManager/perf-types.ts +196 -0
  233. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +13 -2
  234. package/src/lib/editor/managers/SnapManager/SnapManager.ts +1 -1
  235. package/src/lib/editor/managers/ThemeManager/defaultThemes.ts +14 -0
  236. package/src/lib/editor/overlays/OverlayManager.ts +183 -0
  237. package/src/lib/editor/overlays/OverlayUtil.ts +143 -0
  238. package/src/lib/editor/overlays/ShapeIndicatorOverlayUtil.ts +230 -0
  239. package/src/lib/editor/shapes/BaseFrameLikeShapeUtil.tsx +123 -0
  240. package/src/lib/editor/shapes/ShapeUtil.ts +28 -27
  241. package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +41 -4
  242. package/src/lib/editor/shapes/shared/getPerfectDashProps.ts +7 -0
  243. package/src/lib/editor/tools/StateNode.ts +16 -18
  244. package/src/lib/editor/types/event-types.ts +2 -0
  245. package/src/lib/exports/getSvgJsx.test.ts +3 -1
  246. package/src/lib/exports/getSvgJsx.tsx +2 -1
  247. package/src/lib/hooks/EditorComponentsContext.tsx +0 -27
  248. package/src/lib/hooks/useCanvasEvents.ts +40 -3
  249. package/src/lib/hooks/useEditorComponents.tsx +0 -28
  250. package/src/lib/hooks/usePeerIds.ts +6 -55
  251. package/src/lib/hooks/useShapeCulling.tsx +3 -1
  252. package/src/lib/options.ts +7 -0
  253. package/src/lib/utils/runtime.ts +3 -1
  254. package/src/lib/utils/sync/hardReset.ts +0 -8
  255. package/src/version.ts +3 -3
  256. package/dist-cjs/lib/components/LiveCollaborators.js +0 -151
  257. package/dist-cjs/lib/components/LiveCollaborators.js.map +0 -7
  258. package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js +0 -227
  259. package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +0 -7
  260. package/dist-cjs/lib/components/default-components/DefaultBrush.js +0 -38
  261. package/dist-cjs/lib/components/default-components/DefaultBrush.js.map +0 -7
  262. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js +0 -71
  263. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +0 -7
  264. package/dist-cjs/lib/components/default-components/DefaultHandle.js +0 -56
  265. package/dist-cjs/lib/components/default-components/DefaultHandle.js.map +0 -7
  266. package/dist-cjs/lib/components/default-components/DefaultHandles.js.map +0 -7
  267. package/dist-cjs/lib/components/default-components/DefaultScribble.js +0 -51
  268. package/dist-cjs/lib/components/default-components/DefaultScribble.js.map +0 -7
  269. package/dist-cjs/lib/components/default-components/DefaultSelectionForeground.js +0 -69
  270. package/dist-cjs/lib/components/default-components/DefaultSelectionForeground.js.map +0 -7
  271. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +0 -107
  272. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +0 -7
  273. package/dist-cjs/lib/components/default-components/DefaultShapeIndicatorErrorFallback.js +0 -28
  274. package/dist-cjs/lib/components/default-components/DefaultShapeIndicatorErrorFallback.js.map +0 -7
  275. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +0 -101
  276. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +0 -7
  277. package/dist-cjs/lib/components/default-components/DefaultSnapIndictor.js +0 -170
  278. package/dist-cjs/lib/components/default-components/DefaultSnapIndictor.js.map +0 -7
  279. package/dist-esm/lib/components/LiveCollaborators.mjs +0 -134
  280. package/dist-esm/lib/components/LiveCollaborators.mjs.map +0 -7
  281. package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs +0 -207
  282. package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +0 -7
  283. package/dist-esm/lib/components/default-components/DefaultBrush.mjs +0 -18
  284. package/dist-esm/lib/components/default-components/DefaultBrush.mjs.map +0 -7
  285. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs +0 -41
  286. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +0 -7
  287. package/dist-esm/lib/components/default-components/DefaultHandle.mjs +0 -26
  288. package/dist-esm/lib/components/default-components/DefaultHandle.mjs.map +0 -7
  289. package/dist-esm/lib/components/default-components/DefaultHandles.mjs +0 -8
  290. package/dist-esm/lib/components/default-components/DefaultHandles.mjs.map +0 -7
  291. package/dist-esm/lib/components/default-components/DefaultScribble.mjs +0 -21
  292. package/dist-esm/lib/components/default-components/DefaultScribble.mjs.map +0 -7
  293. package/dist-esm/lib/components/default-components/DefaultSelectionForeground.mjs +0 -39
  294. package/dist-esm/lib/components/default-components/DefaultSelectionForeground.mjs.map +0 -7
  295. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +0 -77
  296. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +0 -7
  297. package/dist-esm/lib/components/default-components/DefaultShapeIndicatorErrorFallback.mjs +0 -8
  298. package/dist-esm/lib/components/default-components/DefaultShapeIndicatorErrorFallback.mjs.map +0 -7
  299. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +0 -81
  300. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +0 -7
  301. package/dist-esm/lib/components/default-components/DefaultSnapIndictor.mjs +0 -142
  302. package/dist-esm/lib/components/default-components/DefaultSnapIndictor.mjs.map +0 -7
  303. package/src/lib/components/LiveCollaborators.tsx +0 -174
  304. package/src/lib/components/default-components/CanvasShapeIndicators.tsx +0 -289
  305. package/src/lib/components/default-components/DefaultBrush.tsx +0 -35
  306. package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +0 -52
  307. package/src/lib/components/default-components/DefaultHandle.tsx +0 -42
  308. package/src/lib/components/default-components/DefaultHandles.tsx +0 -15
  309. package/src/lib/components/default-components/DefaultScribble.tsx +0 -31
  310. package/src/lib/components/default-components/DefaultSelectionForeground.tsx +0 -50
  311. package/src/lib/components/default-components/DefaultShapeIndicator.tsx +0 -104
  312. package/src/lib/components/default-components/DefaultShapeIndicatorErrorFallback.tsx +0 -9
  313. package/src/lib/components/default-components/DefaultShapeIndicators.tsx +0 -116
  314. package/src/lib/components/default-components/DefaultSnapIndictor.tsx +0 -174
@@ -19,7 +19,6 @@ 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
24
  import { PointerEvent as PointerEvent_2 } from 'react';
@@ -220,6 +219,56 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
220
219
  getInterpolatedProps(startShape: Shape, endShape: Shape, t: number): Shape['props'];
221
220
  }
222
221
 
222
+ /**
223
+ * A base class for frame-like shapes — containers that clip their children,
224
+ * require full-brush selection, block erasure from inside, and support
225
+ * drag-and-drop reparenting.
226
+ *
227
+ * Extending this class is the easiest way to create a custom frame-like shape.
228
+ * It provides sensible defaults for all frame-like behaviors:
229
+ *
230
+ * - `isFrameLike()` returns `true`
231
+ * - `providesBackgroundForChildren()` returns `true`
232
+ * - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
233
+ * - `getClipPath()` returns the shape geometry's vertices
234
+ * - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
235
+ * - `onDragShapesOut()` reparents shapes back to the page
236
+ *
237
+ * All methods can be overridden for custom behavior.
238
+ *
239
+ * @example
240
+ * ```ts
241
+ * class MyContainerUtil extends BaseFrameLikeShapeUtil<MyContainerShape> {
242
+ * static override type = 'my-container' as const
243
+ * static override props = myContainerShapeProps
244
+ *
245
+ * override getDefaultProps() {
246
+ * return { w: 300, h: 200 }
247
+ * }
248
+ *
249
+ * override component(shape: MyContainerShape) {
250
+ * return <SVGContainer>...</SVGContainer>
251
+ * }
252
+ *
253
+ * override getIndicatorPath(shape: MyContainerShape) {
254
+ * const path = new Path2D()
255
+ * path.rect(0, 0, shape.props.w, shape.props.h)
256
+ * return path
257
+ * }
258
+ * }
259
+ * ```
260
+ *
261
+ * @public
262
+ */
263
+ export declare abstract class BaseFrameLikeShapeUtil<Shape extends TLBaseBoxShape> extends BaseBoxShapeUtil<Shape> {
264
+ isFrameLike(_shape: Shape): boolean;
265
+ providesBackgroundForChildren(): boolean;
266
+ canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
267
+ getClipPath(shape: Shape): undefined | Vec[];
268
+ onDragShapesIn(shape: Shape, draggingShapes: TLShape[], { initialParentIds, initialIndices }: TLDragShapesInInfo): void;
269
+ onDragShapesOut(shape: Shape, draggingShapes: TLShape[], info: TLDragShapesOutInfo): void;
270
+ }
271
+
223
272
  /** @public */
224
273
  export declare interface BatchMeasurementRequest {
225
274
  html: string;
@@ -881,51 +930,21 @@ export declare const DEFAULT_THEME: TLTheme;
881
930
  /** @public @react */
882
931
  export declare function DefaultBackground(): JSX.Element;
883
932
 
884
- /** @public @react */
885
- export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX.Element;
886
-
887
933
  /** @public @react */
888
934
  export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
889
935
 
890
- /** @public @react */
891
- export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity }: TLCollaboratorHintProps): JSX.Element;
892
-
893
- /** @public @react */
894
- export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
895
-
896
936
  /** @public @react */
897
937
  export declare const DefaultErrorFallback: TLErrorFallbackComponent;
898
938
 
899
939
  /** @public @react */
900
940
  export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
901
941
 
902
- /** @public @react */
903
- export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX.Element;
904
-
905
- /** @public @react */
906
- export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX.Element;
907
-
908
- /** @public @react */
909
- export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX.Element | null;
910
-
911
942
  /** @public @react */
912
943
  export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX.Element;
913
944
 
914
- /** @public @react */
915
- export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX.Element;
916
-
917
- /** @public @react */
918
- export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicatorProps>;
919
-
920
- /** @public @react */
921
- export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicatorsProps>;
922
-
923
945
  /** @public @react */
924
946
  export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
925
947
 
926
- /** @public @react */
927
- export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX.Element;
928
-
929
948
  /** @public @react */
930
949
  export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX.Element;
931
950
 
@@ -996,6 +1015,7 @@ export declare const defaultTldrawOptions: {
996
1015
  readonly onBeforePasteFromClipboard: undefined;
997
1016
  readonly onClipboardPasteRaw: undefined;
998
1017
  readonly quickZoomPreservesScreenBounds: true;
1018
+ readonly rightClickPanning: true;
999
1019
  readonly snapThreshold: 8;
1000
1020
  readonly spacebarPanning: true;
1001
1021
  readonly temporaryAssetPreviewLifetimeMs: 180000;
@@ -1103,7 +1123,7 @@ export declare class EdgeScrollManager {
1103
1123
  /** @public */
1104
1124
  export declare class Editor extends EventEmitter<TLEventMap> {
1105
1125
  readonly id: string;
1106
- constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
1126
+ constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, overlayUtils: overlayUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
1107
1127
  private readonly _getShapeVisibility?;
1108
1128
  private getIsShapeHiddenCache;
1109
1129
  isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
@@ -1166,6 +1186,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1166
1186
  * @public
1167
1187
  */
1168
1188
  readonly snaps: SnapManager;
1189
+ /**
1190
+ * A manager for performance measurement hooks.
1191
+ *
1192
+ * @public
1193
+ */
1194
+ readonly performance: PerformanceManager;
1169
1195
  /* Excluded from this release type: _spatialIndex */
1170
1196
  /**
1171
1197
  * A manager for the any asynchronous events and making sure they're
@@ -1179,6 +1205,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1179
1205
  setInterval: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
1180
1206
  setTimeout: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
1181
1207
  };
1208
+ /* Excluded from this release type: _collaboratorVisibilityClock */
1182
1209
  /**
1183
1210
  * A manager for the user and their preferences.
1184
1211
  *
@@ -1204,6 +1231,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1204
1231
  * @public
1205
1232
  */
1206
1233
  readonly scribbles: ScribbleManager;
1234
+ /**
1235
+ * A manager for canvas overlay UI elements (selection handles, shape handles, etc.).
1236
+ *
1237
+ * @public
1238
+ */
1239
+ readonly overlays: OverlayManager;
1207
1240
  /**
1208
1241
  * A manager for side effects and correct state enforcement. See {@link @tldraw/store#StoreSideEffects} for details.
1209
1242
  *
@@ -2456,6 +2489,23 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2456
2489
  * @public
2457
2490
  */
2458
2491
  getCollaboratorsOnCurrentPage(): TLInstancePresence[];
2492
+ /**
2493
+ * Returns a list of presence records for peer collaborators who should currently be
2494
+ * shown in the UI. Filters {@link Editor.getCollaborators} by activity state
2495
+ * (active / idle / inactive) and visibility rules such as following and highlighted
2496
+ * users. Re-evaluates on the collaborator visibility clock, so callers don't need to
2497
+ * drive their own activity timer.
2498
+ *
2499
+ * @public
2500
+ */
2501
+ getVisibleCollaborators(): TLInstancePresence[];
2502
+ /**
2503
+ * Returns a list of presence records for peer collaborators who should currently be
2504
+ * shown in the UI, filtered to those on the current page.
2505
+ *
2506
+ * @public
2507
+ */
2508
+ getVisibleCollaboratorsOnCurrentPage(): TLInstancePresence[];
2459
2509
  /**
2460
2510
  * Get the current user's ID for attribution purposes.
2461
2511
  * Also ensures a `user:` record exists in the store for the current user.
@@ -3116,6 +3166,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3116
3166
  type: T['type'];
3117
3167
  }>;
3118
3168
  isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
3169
+ /**
3170
+ * Get whether a shape behaves like a frame — a container that has child
3171
+ * shapes, requires full-brush selection, blocks erasure from inside, etc.
3172
+ *
3173
+ * @example
3174
+ * ```ts
3175
+ * const isFrameLike = editor.isShapeFrameLike(someShape)
3176
+ * ```
3177
+ *
3178
+ * @param shape - The shape (or shape id) to test.
3179
+ *
3180
+ * @public
3181
+ */
3182
+ isShapeFrameLike(shape: TLShape | TLShapeId): boolean;
3119
3183
  /**
3120
3184
  * Get a shape by its id.
3121
3185
  *
@@ -4775,14 +4839,14 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
4775
4839
  static type: "group";
4776
4840
  static props: RecordProps<TLGroupShape>;
4777
4841
  static migrations: TLPropsMigrations;
4778
- hideSelectionBoundsFg(): boolean;
4842
+ hideSelectionBoundsFg(shape: TLGroupShape): boolean;
4779
4843
  canBind(): boolean;
4780
4844
  canResize(): boolean;
4781
4845
  canResizeChildren(): boolean;
4782
4846
  getDefaultProps(): TLGroupShape['props'];
4783
4847
  getGeometry(shape: TLGroupShape): Geometry2d;
4784
4848
  component(shape: TLGroupShape): JSX.Element | null;
4785
- indicator(shape: TLGroupShape): JSX.Element;
4849
+ getIndicatorPath(shape: TLGroupShape): Path2D;
4786
4850
  onChildrenChange(group: TLGroupShape): void;
4787
4851
  }
4788
4852
 
@@ -5061,6 +5125,12 @@ export declare class InputsManager {
5061
5125
  get isPointing(): boolean;
5062
5126
  set isPointing(isPointing: boolean);
5063
5127
  /* Excluded from this release type: setIsPointing */
5128
+ private _isRightPointing;
5129
+ /**
5130
+ * Whether the user is right-click pointing (before drag threshold).
5131
+ */
5132
+ getIsRightPointing(): boolean;
5133
+ /* Excluded from this release type: setIsRightPointing */
5064
5134
  private _isPinching;
5065
5135
  /**
5066
5136
  * Whether the user is pinching.
@@ -5404,6 +5474,179 @@ export declare function openWindow(url: string, target?: string, allowReferrer?:
5404
5474
  /** @public */
5405
5475
  export declare type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
5406
5476
 
5477
+ /** @public */
5478
+ export declare class OverlayManager {
5479
+ readonly editor: Editor;
5480
+ constructor(editor: Editor);
5481
+ /* Excluded from this release type: _overlayUtils */
5482
+ /* Excluded from this release type: registerUtil */
5483
+ /**
5484
+ * Get an overlay util by type string, overlay instance, or by passing
5485
+ * a util class as a generic parameter for type-safe lookup.
5486
+ *
5487
+ * @example
5488
+ * ```ts
5489
+ * const util = editor.overlays.getOverlayUtil('brush')
5490
+ * const util = editor.overlays.getOverlayUtil<BrushOverlayUtil>('brush')
5491
+ * const util = editor.overlays.getOverlayUtil(myOverlay)
5492
+ * ```
5493
+ *
5494
+ * @public
5495
+ */
5496
+ getOverlayUtil<T extends OverlayUtil>(type: T extends OverlayUtil<infer O> ? O['type'] : string): T;
5497
+ getOverlayUtil<O extends TLOverlay>(overlay: O): OverlayUtil<O>;
5498
+ /**
5499
+ * Returns all registered overlay utils in paint order (ascending zIndex).
5500
+ * Utils with the same zIndex preserve their registration order.
5501
+ *
5502
+ * @public
5503
+ */
5504
+ getOverlayUtilsInZOrder(): OverlayUtil[];
5505
+ /**
5506
+ * Reactive list of active overlay utils paired with the overlays they
5507
+ * produced for the current editor state, in paint order (ascending
5508
+ * zIndex). Both the hit-test and render paths read from this single
5509
+ * cached scan instead of each re-deriving the active set. Active utils
5510
+ * are included even when their `getOverlays()` returns an empty array,
5511
+ * since `render()` may still draw non-interactive UI (e.g. the selection
5512
+ * bounding box during brushing).
5513
+ *
5514
+ * @public
5515
+ */
5516
+ getActiveOverlayEntries(): TLOverlayEntry[];
5517
+ /**
5518
+ * Reactively computed list of all currently active overlays, in paint order.
5519
+ * @public
5520
+ */
5521
+ getCurrentOverlays(): TLOverlay[];
5522
+ private _geometryCache;
5523
+ /**
5524
+ * Get hit-test geometry for an overlay, cached by overlay identity. Lets
5525
+ * hit-testing on a pointermove storm skip the per-overlay geometry
5526
+ * allocation that {@link OverlayUtil.getGeometry} would otherwise do on
5527
+ * every call.
5528
+ *
5529
+ * @public
5530
+ */
5531
+ getOverlayGeometry(overlay: TLOverlay): Geometry2d | null;
5532
+ /**
5533
+ * The currently hovered overlay id.
5534
+ * @public
5535
+ */
5536
+ private _hoveredOverlayId;
5537
+ getHoveredOverlayId(): null | string;
5538
+ getHoveredOverlay(): null | TLOverlay;
5539
+ setHoveredOverlay(id: null | string): void;
5540
+ /**
5541
+ * Hit test all active overlays at a given page point.
5542
+ * Returns the topmost overlay whose geometry contains the point, or null.
5543
+ * Utils are walked from highest zIndex to lowest so the overlay painted on
5544
+ * top also wins the hit test. Within a util, overlays are walked in
5545
+ * array order: the first overlay whose geometry contains the point wins,
5546
+ * so utils should place highest-priority overlays first in `getOverlays`.
5547
+ * Interactive overlays (those with geometry) are checked; non-interactive are skipped.
5548
+ *
5549
+ * @param point - Point in page coordinates
5550
+ * @param margin - Hit test margin
5551
+ * @public
5552
+ */
5553
+ getOverlayAtPoint(point: VecLike, margin?: number): null | TLOverlay;
5554
+ }
5555
+
5556
+ /**
5557
+ * Base class for overlay utilities. Overlays are ephemeral UI elements rendered
5558
+ * on top of the canvas (selection handles, rotation corners, shape handles, etc.).
5559
+ *
5560
+ * Each OverlayUtil defines a type of overlay and knows how to:
5561
+ * - Determine when its overlays should be active (predicate)
5562
+ * - Produce overlay instances from current editor state
5563
+ * - Provide hit-test geometry for interactive overlays
5564
+ * - Provide cursor style on hover
5565
+ * - Render into a canvas 2D context
5566
+ *
5567
+ * @public
5568
+ */
5569
+ export declare abstract class OverlayUtil<T extends TLOverlay = TLOverlay> {
5570
+ editor: Editor;
5571
+ constructor(editor: Editor);
5572
+ static type: string;
5573
+ /**
5574
+ * Options for this overlay util. Override this to provide customization options.
5575
+ * Use {@link OverlayUtil.configure} to customize existing overlay utils.
5576
+ *
5577
+ * `zIndex` controls paint and hit-test order across utils — higher numbers
5578
+ * paint on top and are hit-tested first. Ties resolve by registration order.
5579
+ * Defaults to `0`; built-in utils use larger integers (100, 200, …) with
5580
+ * gaps so custom utils can slot between.
5581
+ *
5582
+ * @public
5583
+ */
5584
+ options: {
5585
+ zIndex?: number;
5586
+ };
5587
+ /**
5588
+ * Create a new overlay util class with the given options merged in.
5589
+ *
5590
+ * @example
5591
+ * ```ts
5592
+ * const MyBrush = BrushOverlayUtil.configure({ fill: 'rgba(0,0,255,0.1)' })
5593
+ * ```
5594
+ *
5595
+ * @public
5596
+ */
5597
+ static configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
5598
+ options: infer Options;
5599
+ } ? Partial<Options> : never): T;
5600
+ /**
5601
+ * Whether this overlay util's overlays should currently be active.
5602
+ * Checked reactively to determine which overlays exist at any given time.
5603
+ */
5604
+ abstract isActive(): boolean;
5605
+ /**
5606
+ * Returns the overlay instances that currently exist.
5607
+ * Called only when `isActive()` returns true.
5608
+ */
5609
+ abstract getOverlays(): T[];
5610
+ /**
5611
+ * Returns hit-test geometry for an overlay instance, in page coordinates.
5612
+ * Return null for non-interactive overlays (e.g. snap indicators, scribbles).
5613
+ */
5614
+ getGeometry(_overlay: T): Geometry2d | null;
5615
+ /**
5616
+ * Returns the cursor type to show when hovering this overlay.
5617
+ */
5618
+ getCursor(_overlay: T): TLCursorType | undefined;
5619
+ /**
5620
+ * Called when the user points down on this overlay, before the default
5621
+ * routing runs. Acts as an interrupt: define it to take over the event.
5622
+ *
5623
+ * Return `false` to continue with the default behavior (e.g. the
5624
+ * built-in rotate/resize handle transitions or shape-handle dispatch).
5625
+ * Return `true` — or nothing at all — to skip the default. In other
5626
+ * words, once you override this method you own the event unless you
5627
+ * explicitly opt back in by returning `false`.
5628
+ */
5629
+ onPointerDown?(overlay: T, info: TLPointerEventInfo): boolean | void;
5630
+ /**
5631
+ * Render all active overlays into the canvas context.
5632
+ * The context is already transformed to page space (camera transform applied).
5633
+ * Called reactively when overlays or editor state changes.
5634
+ */
5635
+ render(_ctx: CanvasRenderingContext2D, _overlays: T[]): void;
5636
+ /**
5637
+ * Optional: render all active overlays into the minimap canvas.
5638
+ * The context is already transformed to page space (minimap camera applied),
5639
+ * so overlays can use the same page-space coordinates as in {@link OverlayUtil.render}.
5640
+ *
5641
+ * `zoom` is the minimap's screen-pixels-per-page-unit, analogous to
5642
+ * `editor.getCamera().z`; use `1 / zoom` for one-minimap-pixel line widths.
5643
+ *
5644
+ * Most overlays should leave this blank — only overlays that are meaningful
5645
+ * at minimap scale (e.g. brushes, collaborator cursors) should opt in.
5646
+ */
5647
+ renderMinimap(_ctx: CanvasRenderingContext2D, _overlays: T[], _zoom: number): void;
5648
+ }
5649
+
5407
5650
  /**
5408
5651
  * Parses a string created by {@link createDeepLinkString} back into a deep link descriptor.
5409
5652
  *
@@ -5417,6 +5660,94 @@ export declare function parseDeepLinkString(deepLinkString: string): TLDeepLink;
5417
5660
  /** @public */
5418
5661
  export declare type PerfectDashTerminal = 'none' | 'outset' | 'skip';
5419
5662
 
5663
+ /**
5664
+ * Optional adapter that pipes PerformanceManager events into browser
5665
+ * `performance.mark()` / `performance.measure()` for DevTools integration.
5666
+ *
5667
+ * Tree-shakeable — only included if imported.
5668
+ *
5669
+ * @example
5670
+ * ```ts
5671
+ * const adapter = new PerformanceApiAdapter(editor.performance)
5672
+ * // ... later
5673
+ * adapter.dispose()
5674
+ * ```
5675
+ *
5676
+ * @public
5677
+ */
5678
+ export declare class PerformanceApiAdapter {
5679
+ private cleanups;
5680
+ constructor(perfManager: PerformanceManager);
5681
+ /** Remove all listeners and stop piping events. @public */
5682
+ dispose(): void;
5683
+ }
5684
+
5685
+ /**
5686
+ * Manages performance event subscriptions for the editor. Available as `editor.performance`.
5687
+ *
5688
+ * Listeners are lazy — internal editor hooks (frame, shape events) are only attached while
5689
+ * at least one subscriber exists, so there is zero overhead when unused.
5690
+ *
5691
+ * @example
5692
+ * ```ts
5693
+ * const unsub = editor.performance.on('interaction-end', (event) => {
5694
+ * console.log(`${event.name}: ${event.fps.toFixed(1)} fps, p95=${event.p95FrameTime.toFixed(1)}ms`)
5695
+ * })
5696
+ * ```
5697
+ *
5698
+ * @public
5699
+ */
5700
+ export declare class PerformanceManager {
5701
+ /* Excluded from this release type: emitter */
5702
+ private editor;
5703
+ private activeInteraction;
5704
+ private activeCamera;
5705
+ private frameCleanup;
5706
+ private shapeCreatedCleanup;
5707
+ private shapeEditedCleanup;
5708
+ private shapeDeletedCleanup;
5709
+ private loafObserver;
5710
+ constructor(editor: Editor);
5711
+ /**
5712
+ * Subscribe to a performance event. Returns an unsubscribe function.
5713
+ *
5714
+ * @example
5715
+ * ```ts
5716
+ * const unsub = editor.performance.on('interaction-end', (event) => {
5717
+ * sendToAnalytics({ name: event.name, fps: event.fps, p95: event.p95FrameTime })
5718
+ * })
5719
+ * // later: unsub()
5720
+ * ```
5721
+ *
5722
+ * @public
5723
+ */
5724
+ on<K extends keyof TLPerfEventMap>(event: K, fn: (...args: TLPerfEventMap[K]) => void): () => void;
5725
+ /**
5726
+ * Subscribe to a performance event once. The listener is removed after the first invocation.
5727
+ * Returns an unsubscribe function for early removal.
5728
+ *
5729
+ * @public
5730
+ */
5731
+ once<K extends keyof TLPerfEventMap>(event: K, fn: (...args: TLPerfEventMap[K]) => void): () => void;
5732
+ /* Excluded from this release type: dispose */
5733
+ /* Excluded from this release type: _notifyInteractionStart */
5734
+ /* Excluded from this release type: _notifyInteractionEnd */
5735
+ /* Excluded from this release type: _notifyCameraOperation */
5736
+ /* Excluded from this release type: _notifyUndoRedo */
5737
+ private _startCameraSession;
5738
+ private _endCameraSession;
5739
+ private _onFrame;
5740
+ private _onShapesCreated;
5741
+ private _onShapesEdited;
5742
+ private _onShapesDeleted;
5743
+ private _startLoafObserver;
5744
+ private _stopLoafObserver;
5745
+ private _needsFrameListener;
5746
+ private _needsLoafObserver;
5747
+ private _maybeAttachLazyListeners;
5748
+ private _maybeDetachLazyListeners;
5749
+ }
5750
+
5420
5751
  /**
5421
5752
  * Find the approximate perimeter of an ellipse.
5422
5753
  *
@@ -5848,6 +6179,29 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
5848
6179
  /** @public */
5849
6180
  export declare function setUserPreferences(user: TLUserPreferences): void;
5850
6181
 
6182
+ /**
6183
+ * Overlay util for shape indicators — the selection / hover / hint outlines drawn
6184
+ * under the selection foreground. Paints local indicators in the theme's
6185
+ * selection color and remote collaborator indicators in each peer's color.
6186
+ *
6187
+ * Non-interactive: contributes no hit-test geometry.
6188
+ *
6189
+ * @public
6190
+ */
6191
+ export declare class ShapeIndicatorOverlayUtil extends OverlayUtil<TLShapeIndicatorOverlay> {
6192
+ static type: string;
6193
+ options: {
6194
+ hintedLineWidth: number;
6195
+ lineWidth: number;
6196
+ zIndex: number;
6197
+ };
6198
+ private _instanceFlags$;
6199
+ isActive(): boolean;
6200
+ getOverlays(): TLShapeIndicatorOverlay[];
6201
+ render(ctx: CanvasRenderingContext2D, overlays: TLShapeIndicatorOverlay[]): void;
6202
+ private _strokeIndicatorBatch;
6203
+ }
6204
+
5851
6205
  /** @public */
5852
6206
  export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5853
6207
  editor: Editor;
@@ -5944,37 +6298,30 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5944
6298
  */
5945
6299
  abstract component(shape: Shape): any;
5946
6300
  /**
5947
- * Get JSX describing the shape's indicator (as an SVG element).
5948
- *
5949
- * @param shape - The shape.
5950
- * @public
5951
- */
5952
- abstract indicator(shape: Shape): any;
5953
- /**
5954
- * Whether to use the legacy React-based indicator rendering.
6301
+ * Get a Path2D (or a richer object with clip/additional paths) for rendering the
6302
+ * shape's indicator on the canvas. Shapes that return `undefined` will not render
6303
+ * an indicator.
5955
6304
  *
5956
- * Override this to return `false` if your shape implements {@link ShapeUtil.getIndicatorPath}
5957
- * for canvas-based indicator rendering.
6305
+ * For complex indicators that need clipping (e.g., arrows with labels), return an
6306
+ * object with `path`, `clipPath`, and `additionalPaths` properties.
5958
6307
  *
5959
- * @returns `true` to use SVG indicators (default), `false` to use canvas indicators.
6308
+ * @param shape - The shape.
6309
+ * @returns A Path2D to stroke, or an object with clipping info, or undefined to skip.
5960
6310
  * @public
5961
6311
  */
5962
- useLegacyIndicator(): boolean;
6312
+ abstract getIndicatorPath(shape: Shape): TLIndicatorPath | undefined;
5963
6313
  /**
5964
- * Get a Path2D for rendering the shape's indicator on the canvas.
6314
+ * Get JSX describing the shape's indicator (as an SVG element).
5965
6315
  *
5966
- * When implemented, this is used instead of {@link ShapeUtil.indicator} for more
5967
- * efficient canvas-based indicator rendering. Shapes that return `undefined` will
5968
- * fall back to SVG-based rendering via {@link ShapeUtil.indicator}.
5969
- *
5970
- * For complex indicators that need clipping (e.g., arrows with labels), return an
5971
- * object with `path`, `clipPath`, and `additionalPaths` properties.
6316
+ * @deprecated SVG indicators are no longer rendered. Override
6317
+ * {@link ShapeUtil.getIndicatorPath} instead. This stub is retained so legacy
6318
+ * subclasses that still call `super.indicator()` keep type-checking; new shapes
6319
+ * should not implement it.
5972
6320
  *
5973
6321
  * @param shape - The shape.
5974
- * @returns A Path2D to stroke, or an object with clipping info, or undefined to use SVG fallback.
5975
6322
  * @public
5976
6323
  */
5977
- getIndicatorPath(shape: Shape): TLIndicatorPath | undefined;
6324
+ indicator(_shape: Shape): any;
5978
6325
  /**
5979
6326
  * Get the font faces that should be rendered in the document in order for this shape to render
5980
6327
  * correctly.
@@ -6008,7 +6355,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6008
6355
  *
6009
6356
  * @public
6010
6357
  */
6011
- canBind(_opts: TLShapeUtilCanBindOpts): boolean;
6358
+ canBind(opts: TLShapeUtilCanBindOpts): boolean;
6012
6359
  /**
6013
6360
  * Whether the shape can be double clicked to edit.
6014
6361
  *
@@ -6142,6 +6489,14 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6142
6489
  * @public
6143
6490
  */
6144
6491
  isAspectRatioLocked(shape: Shape): boolean;
6492
+ /**
6493
+ * Whether the shape behaves like a frame — a container that has child shapes,
6494
+ * requires full-brush selection, blocks erasure from inside, etc.
6495
+ *
6496
+ * @param shape - The shape.
6497
+ * @public
6498
+ */
6499
+ isFrameLike(_shape: Shape): boolean;
6145
6500
  /**
6146
6501
  * By default, the bounds of an image export are the bounds of all the shapes it contains, plus
6147
6502
  * some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
@@ -6189,7 +6544,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6189
6544
  * @param type - The shape type.
6190
6545
  * @public
6191
6546
  */
6192
- canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
6547
+ canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
6193
6548
  /**
6194
6549
  * Get the shape as an SVG object.
6195
6550
  *
@@ -6632,6 +6987,8 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
6632
6987
  static children?: () => TLStateNodeConstructor[];
6633
6988
  static isLockable: boolean;
6634
6989
  static useCoalescedEvents: boolean;
6990
+ /** Set to `true` in subclasses to emit interaction-start/end performance events when this state is entered/exited. */
6991
+ static trackPerformance: boolean;
6635
6992
  id: string;
6636
6993
  type: 'branch' | 'leaf' | 'root';
6637
6994
  shapeType?: string;
@@ -6905,6 +7262,9 @@ export declare type TLAnyAssetUtilConstructor = TLAssetUtilConstructor<any>;
6905
7262
  /** @public */
6906
7263
  export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
6907
7264
 
7265
+ /** @public */
7266
+ export declare type TLAnyOverlayUtilConstructor = TLOverlayUtilConstructor<any>;
7267
+
6908
7268
  /** @public */
6909
7269
  export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
6910
7270
 
@@ -6948,15 +7308,6 @@ export declare interface TLBindingUtilConstructor<T extends TLBinding, U extends
6948
7308
  migrations?: TLPropsMigrations;
6949
7309
  }
6950
7310
 
6951
- /** @public */
6952
- export declare interface TLBrushProps {
6953
- userId?: string;
6954
- brush: BoxModel;
6955
- color?: string;
6956
- opacity?: number;
6957
- className?: string;
6958
- }
6959
-
6960
7311
  /** @public */
6961
7312
  export declare interface TLCameraConstraints {
6962
7313
  /** The bounds (in page space) of the constrained space */
@@ -7005,6 +7356,29 @@ export declare interface TLCameraConstraints {
7005
7356
  };
7006
7357
  }
7007
7358
 
7359
+ /**
7360
+ * Emitted when a camera operation ends (after a 50ms debounce), with aggregated frame time stats.
7361
+ * @public
7362
+ */
7363
+ export declare interface TLCameraEndPerfEvent extends TLPerfFrameTimeStats {
7364
+ /** Whether this was a pan or zoom operation. */
7365
+ type: 'panning' | 'zooming';
7366
+ /** Total shapes on the current page. */
7367
+ shapeCount: number;
7368
+ /** Number of shapes visible (not culled) in the viewport. */
7369
+ visibleShapeCount: number;
7370
+ /** Number of shapes culled (off-screen) from rendering. */
7371
+ culledShapeCount: number;
7372
+ /** Viewport width in screen pixels. */
7373
+ viewportWidth: number;
7374
+ /** Viewport height in screen pixels. */
7375
+ viewportHeight: number;
7376
+ /** Camera zoom level (`camera.z`) at session end. */
7377
+ zoomLevel: number;
7378
+ /** `performance.now()` when the camera session ended. */
7379
+ timestamp: number;
7380
+ }
7381
+
7008
7382
  /** @public */
7009
7383
  export declare interface TLCameraMoveOptions {
7010
7384
  /** Whether to move the camera immediately, rather than on the next tick. */
@@ -7043,6 +7417,17 @@ export declare interface TLCameraOptions {
7043
7417
  constraints?: TLCameraConstraints;
7044
7418
  }
7045
7419
 
7420
+ /**
7421
+ * Emitted when a camera operation (pan or zoom) begins.
7422
+ * @public
7423
+ */
7424
+ export declare interface TLCameraStartPerfEvent {
7425
+ /** Whether this is a pan or zoom operation. */
7426
+ type: 'panning' | 'zooming';
7427
+ /** `performance.now()` when the camera session started. */
7428
+ timestamp: number;
7429
+ }
7430
+
7046
7431
  /** @public */
7047
7432
  export declare type TLCancelEvent = (info: TLCancelEventInfo) => void;
7048
7433
 
@@ -7110,17 +7495,6 @@ export declare interface TLClipboardWriteInfo {
7110
7495
  readonly source: 'menu' | 'native';
7111
7496
  }
7112
7497
 
7113
- /** @public */
7114
- export declare interface TLCollaboratorHintProps {
7115
- userId: string;
7116
- className?: string;
7117
- point: VecModel;
7118
- viewport: Box;
7119
- zoom: number;
7120
- opacity?: number;
7121
- color: string;
7122
- }
7123
-
7124
7498
  /** @public */
7125
7499
  export declare type TLCompleteEvent = (info: TLCompleteEventInfo) => void;
7126
7500
 
@@ -7165,17 +7539,6 @@ export declare interface TLCurrentUser {
7165
7539
  readonly setUserPreferences: (userPreferences: TLUserPreferences) => void;
7166
7540
  }
7167
7541
 
7168
- /** @public */
7169
- export declare interface TLCursorProps {
7170
- userId: string;
7171
- className?: string;
7172
- point: null | VecModel;
7173
- zoom: number;
7174
- color?: string;
7175
- name: null | string;
7176
- chatMessage: string;
7177
- }
7178
-
7179
7542
  /** @public */
7180
7543
  export declare type TLDeepLink = {
7181
7544
  bounds: BoxModel;
@@ -7269,6 +7632,10 @@ export declare interface TldrawEditorBaseProps {
7269
7632
  * An array of asset utils to use in the editor.
7270
7633
  */
7271
7634
  assetUtils?: readonly TLAnyAssetUtilConstructor[];
7635
+ /**
7636
+ * An array of overlay utils to use in the editor for canvas overlay UI elements.
7637
+ */
7638
+ overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
7272
7639
  /**
7273
7640
  * An array of tools to add to the editor's state chart.
7274
7641
  */
@@ -7530,6 +7897,12 @@ export declare interface TldrawOptions {
7530
7897
  * When false, the spacebar will not pan the camera.
7531
7898
  */
7532
7899
  readonly spacebarPanning: boolean;
7900
+ /**
7901
+ * Whether to allow right-click + drag to pan the camera. When true, right-click + drag pans the
7902
+ * camera and a static right-click opens the context menu at the release position. When false,
7903
+ * right-click opens the context menu on press (no drag-to-pan).
7904
+ */
7905
+ readonly rightClickPanning: boolean;
7533
7906
  /**
7534
7907
  * The default padding (in pixels) used when zooming to fit content in the viewport.
7535
7908
  * This affects methods like `zoomToFit()`, `zoomToSelection()`, and `zoomToBounds()`.
@@ -7659,34 +8032,17 @@ export declare interface TLDropShapesOverInfo {
7659
8032
  /** @public */
7660
8033
  export declare interface TLEditorComponents {
7661
8034
  Background?: ComponentType | null;
7662
- Brush?: ComponentType<TLBrushProps> | null;
7663
8035
  Canvas?: ComponentType<TLCanvasComponentProps> | null;
7664
- CollaboratorBrush?: ComponentType<TLBrushProps> | null;
7665
- CollaboratorCursor?: ComponentType<TLCursorProps> | null;
7666
- CollaboratorHint?: ComponentType<TLCollaboratorHintProps> | null;
7667
- CollaboratorScribble?: ComponentType<TLScribbleProps> | null;
7668
- CollaboratorShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
7669
- Cursor?: ComponentType<TLCursorProps> | null;
7670
8036
  Grid?: ComponentType<TLGridProps> | null;
7671
- Handle?: ComponentType<TLHandleProps> | null;
7672
- Handles?: ComponentType<TLHandlesProps> | null;
7673
8037
  InFrontOfTheCanvas?: ComponentType | null;
7674
8038
  LoadingScreen?: ComponentType | null;
7675
8039
  OnTheCanvas?: ComponentType | null;
7676
- Overlays?: ComponentType | null;
7677
- Scribble?: ComponentType<TLScribbleProps> | null;
7678
8040
  SelectionBackground?: ComponentType<TLSelectionBackgroundProps> | null;
7679
- SelectionForeground?: ComponentType<TLSelectionForegroundProps> | null;
7680
- ShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
7681
- ShapeIndicators?: ComponentType | null;
7682
8041
  ShapeWrapper?: ComponentType<TLShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
7683
- SnapIndicator?: ComponentType<TLSnapIndicatorProps> | null;
7684
8042
  Spinner?: ComponentType<React.SVGProps<SVGSVGElement>> | null;
7685
8043
  SvgDefs?: ComponentType | null;
7686
- ZoomBrush?: ComponentType<TLBrushProps> | null;
7687
8044
  ErrorFallback?: TLErrorFallbackComponent;
7688
8045
  ShapeErrorFallback?: TLShapeErrorFallbackComponent;
7689
- ShapeIndicatorErrorFallback?: TLShapeIndicatorErrorFallbackComponent;
7690
8046
  }
7691
8047
 
7692
8048
  /** @public */
@@ -7708,6 +8064,11 @@ export declare interface TLEditorOptions {
7708
8064
  * An array of asset utils to use in the editor. These will be used to handle asset-type-specific behavior.
7709
8065
  */
7710
8066
  assetUtils?: readonly TLAnyAssetUtilConstructor[];
8067
+ /**
8068
+ * An array of overlay utils to use in the editor. These define canvas overlay UI elements
8069
+ * like selection handles, rotation corners, shape handles, etc.
8070
+ */
8071
+ overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
7711
8072
  /**
7712
8073
  * An array of tools to use in the editor. These will be used to handle events and manage user interactions in the editor.
7713
8074
  */
@@ -7981,6 +8342,21 @@ export declare interface TLFilesExternalContent extends TLBaseExternalContent {
7981
8342
  ignoreParent?: boolean;
7982
8343
  }
7983
8344
 
8345
+ /**
8346
+ * Emitted every animation frame when at least one `'frame'` listener is registered.
8347
+ * @public
8348
+ */
8349
+ export declare interface TLFramePerfEvent {
8350
+ /** Time since the last frame in ms. */
8351
+ elapsed: number;
8352
+ /** Total shapes on the current page. */
8353
+ shapeCount: number;
8354
+ /** Number of shapes culled (off-screen) from rendering. */
8355
+ culledShapeCount: number;
8356
+ /** Number of shapes visible (not culled) in the viewport. */
8357
+ visibleShapeCount: number;
8358
+ }
8359
+
7984
8360
  /** Additional options for the {@link ShapeUtil.getGeometry} method.
7985
8361
  *
7986
8362
  * @public
@@ -8059,20 +8435,6 @@ export declare interface TLHandleDragInfo<T extends TLShape> {
8059
8435
  initial?: T | undefined;
8060
8436
  }
8061
8437
 
8062
- /** @public */
8063
- export declare interface TLHandleProps {
8064
- shapeId: TLShapeId;
8065
- handle: TLHandle;
8066
- zoom: number;
8067
- isCoarse: boolean;
8068
- className?: string;
8069
- }
8070
-
8071
- /** @public */
8072
- export declare interface TLHandlesProps {
8073
- children: ReactNode;
8074
- }
8075
-
8076
8438
  /** @public */
8077
8439
  export declare interface TLHistoryBatchOptions {
8078
8440
  /**
@@ -8123,6 +8485,38 @@ export declare type TLIndicatorPath = {
8123
8485
  path: Path2D;
8124
8486
  } | Path2D;
8125
8487
 
8488
+ /**
8489
+ * Emitted when an interaction state is exited, with aggregated frame time stats.
8490
+ * @public
8491
+ */
8492
+ export declare interface TLInteractionEndPerfEvent extends TLPerfFrameTimeStats {
8493
+ /** The state node id (e.g. `'translating'`). */
8494
+ name: string;
8495
+ /** Full tool path (e.g. `'select.translating'`). */
8496
+ path: string;
8497
+ /** Total shapes on the current page. */
8498
+ shapeCount: number;
8499
+ /** Breakdown of selected shape types at interaction start (e.g. `{ geo: 2, draw: 1 }`). */
8500
+ selectedShapeTypes: Record<string, number>;
8501
+ /** Camera zoom level (`camera.z`) at interaction end. */
8502
+ zoomLevel: number;
8503
+ /** `performance.now()` when the interaction ended. */
8504
+ timestamp: number;
8505
+ }
8506
+
8507
+ /**
8508
+ * Emitted when an interaction state (e.g. translating, resizing) is entered.
8509
+ * @public
8510
+ */
8511
+ export declare interface TLInteractionStartPerfEvent {
8512
+ /** The state node id (e.g. `'translating'`). */
8513
+ name: string;
8514
+ /** Full tool path (e.g. `'select.translating'`). */
8515
+ path: string;
8516
+ /** `performance.now()` when the interaction started. */
8517
+ timestamp: number;
8518
+ }
8519
+
8126
8520
  /** @public */
8127
8521
  export declare type TLInterruptEvent = (info: TLInterruptEventInfo) => void;
8128
8522
 
@@ -8370,6 +8764,130 @@ export declare const tlmenus: {
8370
8764
  */
8371
8765
  export declare type TLOnMountHandler = (editor: Editor) => (() => undefined | void) | undefined | void;
8372
8766
 
8767
+ /** @public */
8768
+ export declare interface TLOverlay<Props = Record<string, unknown>> {
8769
+ /**
8770
+ * Globally unique id for this overlay instance across all overlay utils.
8771
+ * Hit-test and hover lookup key on `id` alone, so utils must namespace their
8772
+ * ids (e.g. `'selection_fg:top_left'`, `'handle:<shapeId>:<handleId>'`) to
8773
+ * avoid colliding with overlays from other utils.
8774
+ */
8775
+ id: string;
8776
+ /** The overlay util type that owns this instance */
8777
+ type: string;
8778
+ /** Arbitrary props for the overlay (handle id, corner name, etc.) */
8779
+ props: Props;
8780
+ }
8781
+
8782
+ /**
8783
+ * An active overlay util paired with the overlays it produced for the current
8784
+ * editor state. Returned by {@link OverlayManager.getActiveOverlayEntries} so
8785
+ * hit-test, render, and debug paths share a single scan per reactive tick.
8786
+ *
8787
+ * @public
8788
+ */
8789
+ export declare interface TLOverlayEntry {
8790
+ util: OverlayUtil;
8791
+ overlays: TLOverlay[];
8792
+ }
8793
+
8794
+ /** @public */
8795
+ export declare interface TLOverlayUtilConstructor<U extends OverlayUtil = OverlayUtil> {
8796
+ new (editor: Editor): U;
8797
+ type: string;
8798
+ configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
8799
+ options: infer Options;
8800
+ } ? Partial<Options> : never): T;
8801
+ }
8802
+
8803
+ /**
8804
+ * Map of all performance event names to their payload types.
8805
+ * Used with {@link PerformanceManager.on} and {@link PerformanceManager.once}.
8806
+ * @public
8807
+ */
8808
+ export declare interface TLPerfEventMap {
8809
+ /** An interaction state was entered. */
8810
+ 'interaction-start': [TLInteractionStartPerfEvent];
8811
+ /** An interaction state was exited, with aggregated frame time stats. */
8812
+ 'interaction-end': [TLInteractionEndPerfEvent];
8813
+ /** A camera operation (pan/zoom) began. */
8814
+ 'camera-start': [TLCameraStartPerfEvent];
8815
+ /** A camera operation ended (after debounce), with aggregated frame time stats. */
8816
+ 'camera-end': [TLCameraEndPerfEvent];
8817
+ /** Shapes were created. */
8818
+ 'shapes-created': [TLShapeOperationPerfEvent];
8819
+ /** Shapes were updated. */
8820
+ 'shapes-updated': [TLShapeOperationPerfEvent];
8821
+ /** Shapes were deleted. */
8822
+ 'shapes-deleted': [TLShapeOperationPerfEvent];
8823
+ /** An animation frame was rendered. Only fires when listeners are registered. */
8824
+ frame: [TLFramePerfEvent];
8825
+ /** An undo operation was performed. */
8826
+ undo: [TLUndoRedoPerfEvent];
8827
+ /** A redo operation was performed. */
8828
+ redo: [TLUndoRedoPerfEvent];
8829
+ }
8830
+
8831
+ /**
8832
+ * Common frame time statistics shared by interaction and camera end events.
8833
+ * @public
8834
+ */
8835
+ export declare interface TLPerfFrameTimeStats {
8836
+ /** Total duration of the session in ms. */
8837
+ duration: number;
8838
+ /** Average frames per second during the session. */
8839
+ fps: number;
8840
+ /** Total number of frames recorded. */
8841
+ frameCount: number;
8842
+ /** Mean frame duration in ms. */
8843
+ avgFrameTime: number;
8844
+ /** Median (p50) frame duration in ms. */
8845
+ medianFrameTime: number;
8846
+ /** 95th percentile frame duration in ms. */
8847
+ p95FrameTime: number;
8848
+ /** 99th percentile frame duration in ms. */
8849
+ p99FrameTime: number;
8850
+ /** Shortest frame duration in ms. */
8851
+ minFrameTime: number;
8852
+ /** Longest frame duration in ms. */
8853
+ maxFrameTime: number;
8854
+ /** Raw frame durations for local analysis. Exclude when sending to analytics. */
8855
+ frameTimes: number[];
8856
+ /**
8857
+ * Long animation frames observed during this period (Chromium 123+).
8858
+ * Only present when the browser supports the Long Animation Frames API and
8859
+ * at least one long frame was observed.
8860
+ * Exclude when sending to analytics — entries are large and contain script URLs.
8861
+ */
8862
+ longAnimationFrames?: TLPerfLongAnimationFrame[];
8863
+ }
8864
+
8865
+ /**
8866
+ * A long animation frame observed by the browser during an interaction.
8867
+ * Available only in browsers that support the Long Animation Frames API (Chromium 123+).
8868
+ * @public
8869
+ */
8870
+ export declare interface TLPerfLongAnimationFrame {
8871
+ /** Frame start time (relative to timeOrigin). */
8872
+ startTime: number;
8873
+ /** Total frame duration in ms. */
8874
+ duration: number;
8875
+ /** Time the main thread was blocked in ms. */
8876
+ blockingDuration: number;
8877
+ /** Scripts that contributed to the long frame. */
8878
+ scripts: TLPerfLongAnimationFrameScript[];
8879
+ }
8880
+
8881
+ /** A script attribution entry from a long animation frame. @public */
8882
+ export declare interface TLPerfLongAnimationFrameScript {
8883
+ /** The script source URL (may be empty for inline scripts). */
8884
+ sourceURL: string;
8885
+ /** The function name or invoker description. */
8886
+ invoker: string;
8887
+ /** Time spent in this script in ms. */
8888
+ duration: number;
8889
+ }
8890
+
8373
8891
  /** @public */
8374
8892
  export declare type TLPinchEvent = (info: TLPinchEventInfo) => void;
8375
8893
 
@@ -8409,6 +8927,10 @@ export declare type TLPointerEventTarget = {
8409
8927
  handle?: TLSelectionHandle;
8410
8928
  shape?: undefined;
8411
8929
  target: 'selection';
8930
+ } | {
8931
+ overlay: TLOverlay;
8932
+ shape?: undefined;
8933
+ target: 'overlay';
8412
8934
  } | {
8413
8935
  shape: TLShape;
8414
8936
  target: 'shape';
@@ -8479,28 +9001,12 @@ export declare type TLResizeShapeOptions = Partial<{
8479
9001
 
8480
9002
  /* Excluded from this release type: TLRotationSnapshot */
8481
9003
 
8482
- /** @public */
8483
- export declare interface TLScribbleProps {
8484
- userId?: string;
8485
- scribble: TLScribble;
8486
- zoom: number;
8487
- color?: string;
8488
- opacity?: number;
8489
- className?: string;
8490
- }
8491
-
8492
9004
  /** @public */
8493
9005
  export declare interface TLSelectionBackgroundProps {
8494
9006
  bounds: Box;
8495
9007
  rotation: number;
8496
9008
  }
8497
9009
 
8498
- /** @public */
8499
- export declare interface TLSelectionForegroundProps {
8500
- bounds: Box;
8501
- rotation: number;
8502
- }
8503
-
8504
9010
  /** @public */
8505
9011
  export declare type TLSelectionHandle = RotateCorner | SelectionCorner | SelectionEdge;
8506
9012
 
@@ -8535,26 +9041,30 @@ export declare type TLShapeErrorFallbackComponent = ComponentType<{
8535
9041
  }>;
8536
9042
 
8537
9043
  /** @public */
8538
- export declare type TLShapeIndicatorErrorFallbackComponent = ComponentType<{
8539
- error: unknown;
8540
- }>;
8541
-
8542
- /** @public */
8543
- export declare interface TLShapeIndicatorProps {
8544
- userId?: string;
8545
- shapeId: TLShapeId;
8546
- color?: string | undefined;
8547
- opacity?: number;
8548
- className?: string;
8549
- hidden?: boolean;
9044
+ export declare interface TLShapeIndicatorOverlay extends TLOverlay {
9045
+ props: {
9046
+ collaboratorIndicators: Array<{
9047
+ color: string;
9048
+ shapeIds: TLShapeId[];
9049
+ }>;
9050
+ hintingShapeIds: TLShapeId[];
9051
+ idsToDisplay: TLShapeId[];
9052
+ };
8550
9053
  }
8551
9054
 
8552
- /** @public */
8553
- export declare interface TLShapeIndicatorsProps {
8554
- /** Whether to hide all of the indicators */
8555
- hideAll?: boolean;
8556
- /** Whether to show all of the indicators */
8557
- showAll?: boolean;
9055
+ /**
9056
+ * Emitted when shapes are created, updated, or deleted.
9057
+ * @public
9058
+ */
9059
+ export declare interface TLShapeOperationPerfEvent {
9060
+ /** The operation type. */
9061
+ operation: 'create' | 'delete' | 'update';
9062
+ /** Number of shapes affected. */
9063
+ count: number;
9064
+ /** Breakdown by shape type (e.g. `{ geo: 2, draw: 1 }`). */
9065
+ shapeTypes: Record<string, number>;
9066
+ /** `performance.now()` when the operation occurred. */
9067
+ timestamp: number;
8558
9068
  }
8559
9069
 
8560
9070
  /**
@@ -8627,13 +9137,6 @@ export declare interface TLShapeWrapperProps extends React.HTMLAttributes<HTMLDi
8627
9137
  children: ReactNode;
8628
9138
  }
8629
9139
 
8630
- /** @public */
8631
- export declare interface TLSnapIndicatorProps {
8632
- className?: string;
8633
- line: SnapIndicator;
8634
- zoom: number;
8635
- }
8636
-
8637
9140
  /** @public */
8638
9141
  export declare interface TLStateNodeConstructor {
8639
9142
  new (editor: Editor, parent?: StateNode): StateNode;
@@ -8642,6 +9145,7 @@ export declare interface TLStateNodeConstructor {
8642
9145
  children?(): TLStateNodeConstructor[];
8643
9146
  isLockable: boolean;
8644
9147
  useCoalescedEvents: boolean;
9148
+ trackPerformance: boolean;
8645
9149
  }
8646
9150
 
8647
9151
  /** @public */
@@ -8819,6 +9323,19 @@ export declare interface TLTldrawExternalContentSource {
8819
9323
  data: TLContent;
8820
9324
  }
8821
9325
 
9326
+ /**
9327
+ * Emitted after an undo or redo operation.
9328
+ * @public
9329
+ */
9330
+ export declare interface TLUndoRedoPerfEvent {
9331
+ /** Whether this was an undo or redo. */
9332
+ type: 'redo' | 'undo';
9333
+ /** Number of undo steps remaining. */
9334
+ undoDepth: number;
9335
+ /** Number of redo steps remaining. */
9336
+ redoDepth: number;
9337
+ }
9338
+
8822
9339
  /** @public */
8823
9340
  export declare interface TLUpdatePointerOptions {
8824
9341
  /** Whether to update the pointer immediately, rather than on the next tick. */
@@ -9008,6 +9525,10 @@ export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement
9008
9525
  export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
9009
9526
 
9010
9527
  /**
9528
+ * Reactive list of peer user IDs for collaborators currently shown in the UI.
9529
+ * Mirrors {@link Editor.getVisibleCollaborators} — peers fade out as they
9530
+ * transition to idle/inactive, without requiring a manual re-render.
9531
+ *
9011
9532
  * @returns The list of peer UserIDs
9012
9533
  * @public
9013
9534
  */