@tldraw/editor 4.6.0-canary.7effedd9627e → 4.6.0-canary.7fbf8e167ce9

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 (245) hide show
  1. package/dist-cjs/index.d.ts +520 -4
  2. package/dist-cjs/index.js +9 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +7 -0
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/LiveCollaborators.js +1 -0
  7. package/dist-cjs/lib/components/LiveCollaborators.js.map +2 -2
  8. package/dist-cjs/lib/components/MenuClickCapture.js +99 -38
  9. package/dist-cjs/lib/components/MenuClickCapture.js.map +2 -2
  10. package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js +7 -0
  11. package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +3 -3
  12. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +5 -2
  13. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  14. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +1 -1
  15. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
  16. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +1 -0
  17. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +2 -2
  18. package/dist-cjs/lib/config/createTLStore.js +2 -0
  19. package/dist-cjs/lib/config/createTLStore.js.map +2 -2
  20. package/dist-cjs/lib/config/defaultAssets.js +36 -0
  21. package/dist-cjs/lib/config/defaultAssets.js.map +7 -0
  22. package/dist-cjs/lib/editor/Editor.js +149 -5
  23. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  24. package/dist-cjs/lib/editor/assets/AssetUtil.js +67 -0
  25. package/dist-cjs/lib/editor/assets/AssetUtil.js.map +7 -0
  26. package/dist-cjs/lib/editor/bindings/BindingUtil.js +1 -0
  27. package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +1 -1
  28. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +1 -0
  29. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +1 -1
  30. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +1 -0
  31. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +1 -1
  32. package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js +1 -0
  33. package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js.map +1 -1
  34. package/dist-cjs/lib/editor/managers/FontManager/FontManager.js +2 -0
  35. package/dist-cjs/lib/editor/managers/FontManager/FontManager.js.map +1 -1
  36. package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js +2 -0
  37. package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js.map +1 -1
  38. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +12 -0
  39. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +2 -2
  40. package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.js +80 -0
  41. package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.js.map +7 -0
  42. package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceManager.js +466 -0
  43. package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceManager.js.map +7 -0
  44. package/dist-cjs/lib/editor/managers/PerformanceManager/perf-types.js +17 -0
  45. package/dist-cjs/lib/editor/managers/PerformanceManager/perf-types.js.map +7 -0
  46. package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js +1 -0
  47. package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js.map +1 -1
  48. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js +1 -0
  49. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js.map +1 -1
  50. package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js +1 -0
  51. package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +1 -1
  52. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +2 -1
  53. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
  54. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +1 -0
  55. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +1 -1
  56. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +1 -0
  57. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +1 -1
  58. package/dist-cjs/lib/editor/managers/ThemeManager/ThemeManager.js +1 -0
  59. package/dist-cjs/lib/editor/managers/ThemeManager/ThemeManager.js.map +1 -1
  60. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +1 -0
  61. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +1 -1
  62. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +2 -0
  63. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +1 -1
  64. package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js +76 -0
  65. package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js.map +7 -0
  66. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +22 -2
  67. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  68. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +1 -1
  69. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
  70. package/dist-cjs/lib/editor/shapes/shared/getPerfectDashProps.js +6 -0
  71. package/dist-cjs/lib/editor/shapes/shared/getPerfectDashProps.js.map +2 -2
  72. package/dist-cjs/lib/editor/tools/StateNode.js +15 -17
  73. package/dist-cjs/lib/editor/tools/StateNode.js.map +2 -2
  74. package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
  75. package/dist-cjs/lib/exports/ExportDelay.js +1 -0
  76. package/dist-cjs/lib/exports/ExportDelay.js.map +1 -1
  77. package/dist-cjs/lib/exports/StyleEmbedder.js +1 -0
  78. package/dist-cjs/lib/exports/StyleEmbedder.js.map +1 -1
  79. package/dist-cjs/lib/exports/getSvgJsx.js +2 -1
  80. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  81. package/dist-cjs/lib/hooks/useCanvasEvents.js +25 -4
  82. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  83. package/dist-cjs/lib/options.js +2 -0
  84. package/dist-cjs/lib/options.js.map +2 -2
  85. package/dist-cjs/lib/primitives/Vec.js +3 -0
  86. package/dist-cjs/lib/primitives/Vec.js.map +1 -1
  87. package/dist-cjs/lib/primitives/geometry/Circle2d.js +1 -0
  88. package/dist-cjs/lib/primitives/geometry/Circle2d.js.map +1 -1
  89. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js +1 -0
  90. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js.map +1 -1
  91. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +2 -0
  92. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +1 -1
  93. package/dist-cjs/lib/primitives/geometry/Stadium2d.js +1 -0
  94. package/dist-cjs/lib/primitives/geometry/Stadium2d.js.map +1 -1
  95. package/dist-cjs/lib/utils/EditorAtom.js +2 -0
  96. package/dist-cjs/lib/utils/EditorAtom.js.map +1 -1
  97. package/dist-cjs/lib/utils/reparenting.js +2 -1
  98. package/dist-cjs/lib/utils/reparenting.js.map +2 -2
  99. package/dist-cjs/lib/utils/runtime.js +2 -1
  100. package/dist-cjs/lib/utils/runtime.js.map +2 -2
  101. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +2 -0
  102. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +1 -1
  103. package/dist-cjs/lib/utils/sync/hardReset.js +0 -8
  104. package/dist-cjs/lib/utils/sync/hardReset.js.map +2 -2
  105. package/dist-cjs/version.js +3 -3
  106. package/dist-cjs/version.js.map +1 -1
  107. package/dist-esm/index.d.mts +520 -4
  108. package/dist-esm/index.mjs +9 -1
  109. package/dist-esm/index.mjs.map +2 -2
  110. package/dist-esm/lib/TldrawEditor.mjs +7 -0
  111. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  112. package/dist-esm/lib/components/LiveCollaborators.mjs +1 -0
  113. package/dist-esm/lib/components/LiveCollaborators.mjs.map +2 -2
  114. package/dist-esm/lib/components/MenuClickCapture.mjs +100 -39
  115. package/dist-esm/lib/components/MenuClickCapture.mjs.map +2 -2
  116. package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs +7 -0
  117. package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +3 -3
  118. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +5 -2
  119. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  120. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +1 -1
  121. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
  122. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +1 -0
  123. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +2 -2
  124. package/dist-esm/lib/config/createTLStore.mjs +2 -0
  125. package/dist-esm/lib/config/createTLStore.mjs.map +2 -2
  126. package/dist-esm/lib/config/defaultAssets.mjs +16 -0
  127. package/dist-esm/lib/config/defaultAssets.mjs.map +7 -0
  128. package/dist-esm/lib/editor/Editor.mjs +150 -6
  129. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  130. package/dist-esm/lib/editor/assets/AssetUtil.mjs +47 -0
  131. package/dist-esm/lib/editor/assets/AssetUtil.mjs.map +7 -0
  132. package/dist-esm/lib/editor/bindings/BindingUtil.mjs +1 -0
  133. package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +1 -1
  134. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +1 -0
  135. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +1 -1
  136. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +1 -0
  137. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +1 -1
  138. package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs +1 -0
  139. package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs.map +1 -1
  140. package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs +2 -0
  141. package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs.map +1 -1
  142. package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs +2 -0
  143. package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs.map +1 -1
  144. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +12 -0
  145. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +2 -2
  146. package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.mjs +60 -0
  147. package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.mjs.map +7 -0
  148. package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceManager.mjs +438 -0
  149. package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceManager.mjs.map +7 -0
  150. package/dist-esm/lib/editor/managers/PerformanceManager/perf-types.mjs +1 -0
  151. package/dist-esm/lib/editor/managers/PerformanceManager/perf-types.mjs.map +7 -0
  152. package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs +1 -0
  153. package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs.map +1 -1
  154. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs +1 -0
  155. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs.map +1 -1
  156. package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs +1 -0
  157. package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +1 -1
  158. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +2 -1
  159. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
  160. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +1 -0
  161. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +1 -1
  162. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +1 -0
  163. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +1 -1
  164. package/dist-esm/lib/editor/managers/ThemeManager/ThemeManager.mjs +1 -0
  165. package/dist-esm/lib/editor/managers/ThemeManager/ThemeManager.mjs.map +1 -1
  166. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +1 -0
  167. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +1 -1
  168. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +2 -0
  169. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +1 -1
  170. package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs +56 -0
  171. package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs.map +7 -0
  172. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +22 -2
  173. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  174. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +1 -1
  175. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
  176. package/dist-esm/lib/editor/shapes/shared/getPerfectDashProps.mjs +6 -0
  177. package/dist-esm/lib/editor/shapes/shared/getPerfectDashProps.mjs.map +2 -2
  178. package/dist-esm/lib/editor/tools/StateNode.mjs +15 -17
  179. package/dist-esm/lib/editor/tools/StateNode.mjs.map +2 -2
  180. package/dist-esm/lib/exports/ExportDelay.mjs +1 -0
  181. package/dist-esm/lib/exports/ExportDelay.mjs.map +1 -1
  182. package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -0
  183. package/dist-esm/lib/exports/StyleEmbedder.mjs.map +1 -1
  184. package/dist-esm/lib/exports/getSvgJsx.mjs +2 -1
  185. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  186. package/dist-esm/lib/hooks/useCanvasEvents.mjs +25 -4
  187. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  188. package/dist-esm/lib/options.mjs +2 -0
  189. package/dist-esm/lib/options.mjs.map +2 -2
  190. package/dist-esm/lib/primitives/Vec.mjs +3 -0
  191. package/dist-esm/lib/primitives/Vec.mjs.map +1 -1
  192. package/dist-esm/lib/primitives/geometry/Circle2d.mjs +1 -0
  193. package/dist-esm/lib/primitives/geometry/Circle2d.mjs.map +1 -1
  194. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs +1 -0
  195. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs.map +1 -1
  196. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +2 -0
  197. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +1 -1
  198. package/dist-esm/lib/primitives/geometry/Stadium2d.mjs +1 -0
  199. package/dist-esm/lib/primitives/geometry/Stadium2d.mjs.map +1 -1
  200. package/dist-esm/lib/utils/EditorAtom.mjs +2 -0
  201. package/dist-esm/lib/utils/EditorAtom.mjs.map +1 -1
  202. package/dist-esm/lib/utils/reparenting.mjs +2 -1
  203. package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
  204. package/dist-esm/lib/utils/runtime.mjs +2 -1
  205. package/dist-esm/lib/utils/runtime.mjs.map +2 -2
  206. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +2 -0
  207. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +1 -1
  208. package/dist-esm/lib/utils/sync/hardReset.mjs +0 -8
  209. package/dist-esm/lib/utils/sync/hardReset.mjs.map +2 -2
  210. package/dist-esm/version.mjs +3 -3
  211. package/dist-esm/version.mjs.map +1 -1
  212. package/editor.css +0 -4
  213. package/package.json +7 -7
  214. package/src/index.ts +18 -0
  215. package/src/lib/TldrawEditor.tsx +16 -3
  216. package/src/lib/components/LiveCollaborators.tsx +8 -2
  217. package/src/lib/components/MenuClickCapture.tsx +129 -49
  218. package/src/lib/components/default-components/CanvasShapeIndicators.tsx +11 -0
  219. package/src/lib/components/default-components/DefaultCanvas.tsx +6 -2
  220. package/src/lib/components/default-components/DefaultShapeIndicator.tsx +2 -2
  221. package/src/lib/components/default-components/DefaultShapeIndicators.tsx +2 -0
  222. package/src/lib/config/createTLStore.ts +7 -1
  223. package/src/lib/config/defaultAssets.ts +19 -0
  224. package/src/lib/editor/Editor.ts +197 -14
  225. package/src/lib/editor/assets/AssetUtil.ts +85 -0
  226. package/src/lib/editor/managers/InputsManager/InputsManager.ts +12 -0
  227. package/src/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.ts +82 -0
  228. package/src/lib/editor/managers/PerformanceManager/PerformanceManager.test.ts +522 -0
  229. package/src/lib/editor/managers/PerformanceManager/PerformanceManager.ts +583 -0
  230. package/src/lib/editor/managers/PerformanceManager/perf-types.ts +196 -0
  231. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +13 -2
  232. package/src/lib/editor/managers/SnapManager/SnapManager.ts +1 -1
  233. package/src/lib/editor/shapes/BaseFrameLikeShapeUtil.tsx +121 -0
  234. package/src/lib/editor/shapes/ShapeUtil.ts +38 -2
  235. package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +1 -1
  236. package/src/lib/editor/shapes/shared/getPerfectDashProps.ts +7 -0
  237. package/src/lib/editor/tools/StateNode.ts +16 -18
  238. package/src/lib/editor/types/external-content.ts +1 -0
  239. package/src/lib/exports/getSvgJsx.tsx +2 -1
  240. package/src/lib/hooks/useCanvasEvents.ts +40 -3
  241. package/src/lib/options.ts +14 -0
  242. package/src/lib/utils/reparenting.ts +6 -2
  243. package/src/lib/utils/runtime.ts +3 -1
  244. package/src/lib/utils/sync/hardReset.ts +0 -8
  245. package/src/version.ts +3 -3
@@ -88,6 +88,7 @@ import { TLTheme } from '@tldraw/tlschema';
88
88
  import { TLThemeColors } from '@tldraw/tlschema';
89
89
  import { TLThemeId } from '@tldraw/tlschema';
90
90
  import { TLThemes } from '@tldraw/tlschema';
91
+ import { TLUnknownAsset } from '@tldraw/tlschema';
91
92
  import { TLUnknownBinding } from '@tldraw/tlschema';
92
93
  import { TLUnknownShape } from '@tldraw/tlschema';
93
94
  import { TLUser } from '@tldraw/tlschema';
@@ -154,6 +155,51 @@ export declare class Arc2d extends Geometry2d {
154
155
  */
155
156
  export declare function areAnglesCompatible(a: number, b: number): boolean;
156
157
 
158
+ /**
159
+ * Abstract base class for defining asset-type-specific behavior.
160
+ *
161
+ * Each asset type (image, video, bookmark, etc.) has a corresponding AssetUtil that handles
162
+ * type-specific operations like determining supported MIME types and creating assets from files.
163
+ *
164
+ * @public
165
+ */
166
+ export declare abstract class AssetUtil<Asset extends TLAsset = TLAsset> {
167
+ editor: Editor;
168
+ /** Configure this asset util's {@link AssetUtil.options | `options`}. */
169
+ static configure<T extends TLAssetUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
170
+ options: infer Options;
171
+ } ? Partial<Options> : never): T;
172
+ constructor(editor: Editor);
173
+ /**
174
+ * Options for this asset util. Override this to provide customization options for your asset.
175
+ * Use {@link AssetUtil.configure} to customize existing asset utils.
176
+ */
177
+ options: {};
178
+ static props?: RecordProps<TLUnknownAsset>;
179
+ static migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
180
+ /**
181
+ * The type of the asset util, which should match the asset's type.
182
+ */
183
+ static type: string;
184
+ /**
185
+ * Get the default props for an asset of this type.
186
+ */
187
+ abstract getDefaultProps(): Asset['props'];
188
+ /**
189
+ * Get the MIME types that this asset type supports.
190
+ * Return an empty array if this asset type doesn't support files (e.g. bookmarks).
191
+ */
192
+ getSupportedMimeTypes(): readonly string[];
193
+ /**
194
+ * Check whether this asset type accepts a given MIME type.
195
+ */
196
+ acceptsMimeType(mimeType: string): boolean;
197
+ /**
198
+ * Create an asset from a file. Return null if this asset type can't handle the file.
199
+ */
200
+ getAssetFromFile(_file: File, _assetId: TLAssetId): Promise<Asset | null>;
201
+ }
202
+
157
203
  /** @public */
158
204
  export declare function average(A: VecLike, B: VecLike): string;
159
205
 
@@ -174,6 +220,54 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
174
220
  getInterpolatedProps(startShape: Shape, endShape: Shape, t: number): Shape['props'];
175
221
  }
176
222
 
223
+ /**
224
+ * A base class for frame-like shapes — containers that clip their children,
225
+ * require full-brush selection, block erasure from inside, and support
226
+ * drag-and-drop reparenting.
227
+ *
228
+ * Extending this class is the easiest way to create a custom frame-like shape.
229
+ * It provides sensible defaults for all frame-like behaviors:
230
+ *
231
+ * - `isFrameLike()` returns `true`
232
+ * - `providesBackgroundForChildren()` returns `true`
233
+ * - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
234
+ * - `getClipPath()` returns the shape geometry's vertices
235
+ * - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
236
+ * - `onDragShapesOut()` reparents shapes back to the page
237
+ *
238
+ * All methods can be overridden for custom behavior.
239
+ *
240
+ * @example
241
+ * ```ts
242
+ * class MyContainerUtil extends BaseFrameLikeShapeUtil<MyContainerShape> {
243
+ * static override type = 'my-container' as const
244
+ * static override props = myContainerShapeProps
245
+ *
246
+ * override getDefaultProps() {
247
+ * return { w: 300, h: 200 }
248
+ * }
249
+ *
250
+ * override component(shape: MyContainerShape) {
251
+ * return <SVGContainer>...</SVGContainer>
252
+ * }
253
+ *
254
+ * override indicator(shape: MyContainerShape) {
255
+ * return <rect width={shape.props.w} height={shape.props.h} />
256
+ * }
257
+ * }
258
+ * ```
259
+ *
260
+ * @public
261
+ */
262
+ export declare abstract class BaseFrameLikeShapeUtil<Shape extends TLBaseBoxShape> extends BaseBoxShapeUtil<Shape> {
263
+ isFrameLike(_shape: Shape): boolean;
264
+ providesBackgroundForChildren(): boolean;
265
+ canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
266
+ getClipPath(shape: Shape): undefined | Vec[];
267
+ onDragShapesIn(shape: Shape, draggingShapes: TLShape[], { initialParentIds, initialIndices }: TLDragShapesInInfo): void;
268
+ onDragShapesOut(shape: Shape, draggingShapes: TLShape[], info: TLDragShapesOutInfo): void;
269
+ }
270
+
177
271
  /** @public */
178
272
  export declare interface BatchMeasurementRequest {
179
273
  html: string;
@@ -950,6 +1044,7 @@ export declare const defaultTldrawOptions: {
950
1044
  readonly onBeforePasteFromClipboard: undefined;
951
1045
  readonly onClipboardPasteRaw: undefined;
952
1046
  readonly quickZoomPreservesScreenBounds: true;
1047
+ readonly rightClickPanning: true;
953
1048
  readonly snapThreshold: 8;
954
1049
  readonly spacebarPanning: true;
955
1050
  readonly temporaryAssetPreviewLifetimeMs: 180000;
@@ -958,6 +1053,7 @@ export declare const defaultTldrawOptions: {
958
1053
  readonly tooltipDelayMs: 700;
959
1054
  readonly uiCoarseDragDistanceSquared: 625;
960
1055
  readonly uiDragDistanceSquared: 16;
1056
+ readonly useCanvasIndicators: true;
961
1057
  readonly zoomToFitPadding: 128;
962
1058
  };
963
1059
 
@@ -1057,7 +1153,7 @@ export declare class EdgeScrollManager {
1057
1153
  /** @public */
1058
1154
  export declare class Editor extends EventEmitter<TLEventMap> {
1059
1155
  readonly id: string;
1060
- constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
1156
+ constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
1061
1157
  private readonly _getShapeVisibility?;
1062
1158
  private getIsShapeHiddenCache;
1063
1159
  isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
@@ -1120,6 +1216,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1120
1216
  * @public
1121
1217
  */
1122
1218
  readonly snaps: SnapManager;
1219
+ /**
1220
+ * A manager for performance measurement hooks.
1221
+ *
1222
+ * @public
1223
+ */
1224
+ readonly performance: PerformanceManager;
1123
1225
  /* Excluded from this release type: _spatialIndex */
1124
1226
  /**
1125
1227
  * A manager for the any asynchronous events and making sure they're
@@ -1275,6 +1377,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1275
1377
  shapeUtils: {
1276
1378
  readonly [K in string]?: ShapeUtil<TLShape>;
1277
1379
  };
1380
+ /* Excluded from this release type: _shapeUtilsByAssetType */
1278
1381
  styleProps: {
1279
1382
  [key: string]: Map<StyleProp<any>, string>;
1280
1383
  };
@@ -1306,6 +1409,15 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1306
1409
  hasShapeUtil(shape: TLShape | TLShapePartial<TLShape>): boolean;
1307
1410
  hasShapeUtil(type: TLShape['type']): boolean;
1308
1411
  hasShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): boolean;
1412
+ /**
1413
+ * Get the shape util that handles the given asset type.
1414
+ * Returns the shape util whose {@link ShapeUtil.handledAssetTypes} includes
1415
+ * the given asset type, or undefined if none matches.
1416
+ *
1417
+ * @param assetType - The asset type string.
1418
+ * @public
1419
+ */
1420
+ getShapeUtilForAssetType(assetType: string): ShapeUtil | undefined;
1309
1421
  /**
1310
1422
  * A map of shape utility classes (TLShapeUtils) by shape type.
1311
1423
  *
@@ -1336,6 +1448,40 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1336
1448
  type: S['type'];
1337
1449
  } | S): BindingUtil<S>;
1338
1450
  getBindingUtil<T extends BindingUtil>(type: T extends BindingUtil<infer R> ? R['type'] : string): T;
1451
+ /**
1452
+ * A map of asset utility classes by asset type.
1453
+ *
1454
+ * @public
1455
+ */
1456
+ assetUtils: {
1457
+ readonly [K in string]?: AssetUtil<TLAsset>;
1458
+ };
1459
+ /**
1460
+ * Get an asset util from an asset or asset type.
1461
+ *
1462
+ * @param arg - An asset, asset type string, or object with type.
1463
+ *
1464
+ * @public
1465
+ */
1466
+ getAssetUtil<S extends TLAsset>(asset: {
1467
+ type: S['type'];
1468
+ } | S): AssetUtil<S>;
1469
+ getAssetUtil(type: string): AssetUtil;
1470
+ /**
1471
+ * Returns true if the editor has an asset util for the given asset type.
1472
+ *
1473
+ * @public
1474
+ */
1475
+ hasAssetUtil(arg: {
1476
+ type: string;
1477
+ } | string): boolean;
1478
+ /**
1479
+ * Get the asset util that accepts the given MIME type.
1480
+ * Returns null if no registered asset util accepts the MIME type.
1481
+ *
1482
+ * @public
1483
+ */
1484
+ getAssetUtilForMimeType(mimeType: string): AssetUtil | null;
1339
1485
  /**
1340
1486
  * A manager for the editor's history.
1341
1487
  *
@@ -3026,6 +3172,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3026
3172
  type: T['type'];
3027
3173
  }>;
3028
3174
  isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
3175
+ /**
3176
+ * Get whether a shape behaves like a frame — a container that has child
3177
+ * shapes, requires full-brush selection, blocks erasure from inside, etc.
3178
+ *
3179
+ * @example
3180
+ * ```ts
3181
+ * const isFrameLike = editor.isShapeFrameLike(someShape)
3182
+ * ```
3183
+ *
3184
+ * @param shape - The shape (or shape id) to test.
3185
+ *
3186
+ * @public
3187
+ */
3188
+ isShapeFrameLike(shape: TLShape | TLShapeId): boolean;
3029
3189
  /**
3030
3190
  * Get a shape by its id.
3031
3191
  *
@@ -4685,7 +4845,7 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
4685
4845
  static type: "group";
4686
4846
  static props: RecordProps<TLGroupShape>;
4687
4847
  static migrations: TLPropsMigrations;
4688
- hideSelectionBoundsFg(): boolean;
4848
+ hideSelectionBoundsFg(shape: TLGroupShape): boolean;
4689
4849
  canBind(): boolean;
4690
4850
  canResize(): boolean;
4691
4851
  canResizeChildren(): boolean;
@@ -4971,6 +5131,12 @@ export declare class InputsManager {
4971
5131
  get isPointing(): boolean;
4972
5132
  set isPointing(isPointing: boolean);
4973
5133
  /* Excluded from this release type: setIsPointing */
5134
+ private _isRightPointing;
5135
+ /**
5136
+ * Whether the user is right-click pointing (before drag threshold).
5137
+ */
5138
+ getIsRightPointing(): boolean;
5139
+ /* Excluded from this release type: setIsRightPointing */
4974
5140
  private _isPinching;
4975
5141
  /**
4976
5142
  * Whether the user is pinching.
@@ -5327,6 +5493,94 @@ export declare function parseDeepLinkString(deepLinkString: string): TLDeepLink;
5327
5493
  /** @public */
5328
5494
  export declare type PerfectDashTerminal = 'none' | 'outset' | 'skip';
5329
5495
 
5496
+ /**
5497
+ * Optional adapter that pipes PerformanceManager events into browser
5498
+ * `performance.mark()` / `performance.measure()` for DevTools integration.
5499
+ *
5500
+ * Tree-shakeable — only included if imported.
5501
+ *
5502
+ * @example
5503
+ * ```ts
5504
+ * const adapter = new PerformanceApiAdapter(editor.performance)
5505
+ * // ... later
5506
+ * adapter.dispose()
5507
+ * ```
5508
+ *
5509
+ * @public
5510
+ */
5511
+ export declare class PerformanceApiAdapter {
5512
+ private cleanups;
5513
+ constructor(perfManager: PerformanceManager);
5514
+ /** Remove all listeners and stop piping events. @public */
5515
+ dispose(): void;
5516
+ }
5517
+
5518
+ /**
5519
+ * Manages performance event subscriptions for the editor. Available as `editor.performance`.
5520
+ *
5521
+ * Listeners are lazy — internal editor hooks (frame, shape events) are only attached while
5522
+ * at least one subscriber exists, so there is zero overhead when unused.
5523
+ *
5524
+ * @example
5525
+ * ```ts
5526
+ * const unsub = editor.performance.on('interaction-end', (event) => {
5527
+ * console.log(`${event.name}: ${event.fps.toFixed(1)} fps, p95=${event.p95FrameTime.toFixed(1)}ms`)
5528
+ * })
5529
+ * ```
5530
+ *
5531
+ * @public
5532
+ */
5533
+ export declare class PerformanceManager {
5534
+ /* Excluded from this release type: emitter */
5535
+ private editor;
5536
+ private activeInteraction;
5537
+ private activeCamera;
5538
+ private frameCleanup;
5539
+ private shapeCreatedCleanup;
5540
+ private shapeEditedCleanup;
5541
+ private shapeDeletedCleanup;
5542
+ private loafObserver;
5543
+ constructor(editor: Editor);
5544
+ /**
5545
+ * Subscribe to a performance event. Returns an unsubscribe function.
5546
+ *
5547
+ * @example
5548
+ * ```ts
5549
+ * const unsub = editor.performance.on('interaction-end', (event) => {
5550
+ * sendToAnalytics({ name: event.name, fps: event.fps, p95: event.p95FrameTime })
5551
+ * })
5552
+ * // later: unsub()
5553
+ * ```
5554
+ *
5555
+ * @public
5556
+ */
5557
+ on<K extends keyof TLPerfEventMap>(event: K, fn: (...args: TLPerfEventMap[K]) => void): () => void;
5558
+ /**
5559
+ * Subscribe to a performance event once. The listener is removed after the first invocation.
5560
+ * Returns an unsubscribe function for early removal.
5561
+ *
5562
+ * @public
5563
+ */
5564
+ once<K extends keyof TLPerfEventMap>(event: K, fn: (...args: TLPerfEventMap[K]) => void): () => void;
5565
+ /* Excluded from this release type: dispose */
5566
+ /* Excluded from this release type: _notifyInteractionStart */
5567
+ /* Excluded from this release type: _notifyInteractionEnd */
5568
+ /* Excluded from this release type: _notifyCameraOperation */
5569
+ /* Excluded from this release type: _notifyUndoRedo */
5570
+ private _startCameraSession;
5571
+ private _endCameraSession;
5572
+ private _onFrame;
5573
+ private _onShapesCreated;
5574
+ private _onShapesEdited;
5575
+ private _onShapesDeleted;
5576
+ private _startLoafObserver;
5577
+ private _stopLoafObserver;
5578
+ private _needsFrameListener;
5579
+ private _needsLoafObserver;
5580
+ private _maybeAttachLazyListeners;
5581
+ private _maybeDetachLazyListeners;
5582
+ }
5583
+
5330
5584
  /**
5331
5585
  * Find the approximate perimeter of an ellipse.
5332
5586
  *
@@ -5812,12 +6066,32 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5812
6066
  * @public
5813
6067
  */
5814
6068
  static type: string;
6069
+ /**
6070
+ * The asset types that this shape can be created from.
6071
+ * When a file is dropped on the canvas, the editor finds the shape util
6072
+ * whose `handledAssetTypes` includes the asset's type and calls
6073
+ * {@link ShapeUtil.createShapeForAsset} to produce the shape.
6074
+ *
6075
+ * @public
6076
+ */
6077
+ static handledAssetTypes?: readonly string[];
5815
6078
  /**
5816
6079
  * Get the default props for a shape.
5817
6080
  *
5818
6081
  * @public
5819
6082
  */
5820
6083
  abstract getDefaultProps(): Shape['props'];
6084
+ /**
6085
+ * Create a shape partial for placing an asset on the canvas.
6086
+ * Only called for shapes whose constructor declares matching
6087
+ * {@link ShapeUtil.handledAssetTypes | `handledAssetTypes`}.
6088
+ *
6089
+ * @param asset - The asset to create a shape for.
6090
+ * @param position - Where to place the shape.
6091
+ * @returns A shape partial, or null if this shape can't be created for the asset.
6092
+ * @public
6093
+ */
6094
+ createShapeForAsset?(asset: TLAsset, position: VecModel): null | TLShapePartial;
5821
6095
  /**
5822
6096
  * Get the shape's geometry.
5823
6097
  *
@@ -5898,7 +6172,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5898
6172
  *
5899
6173
  * @public
5900
6174
  */
5901
- canBind(_opts: TLShapeUtilCanBindOpts): boolean;
6175
+ canBind(opts: TLShapeUtilCanBindOpts): boolean;
5902
6176
  /**
5903
6177
  * Whether the shape can be double clicked to edit.
5904
6178
  *
@@ -6032,6 +6306,14 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6032
6306
  * @public
6033
6307
  */
6034
6308
  isAspectRatioLocked(shape: Shape): boolean;
6309
+ /**
6310
+ * Whether the shape behaves like a frame — a container that has child shapes,
6311
+ * requires full-brush selection, blocks erasure from inside, etc.
6312
+ *
6313
+ * @param shape - The shape.
6314
+ * @public
6315
+ */
6316
+ isFrameLike(_shape: Shape): boolean;
6035
6317
  /**
6036
6318
  * By default, the bounds of an image export are the bounds of all the shapes it contains, plus
6037
6319
  * some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
@@ -6079,7 +6361,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6079
6361
  * @param type - The shape type.
6080
6362
  * @public
6081
6363
  */
6082
- canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
6364
+ canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
6083
6365
  /**
6084
6366
  * Get the shape as an SVG object.
6085
6367
  *
@@ -6522,6 +6804,8 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
6522
6804
  static children?: () => TLStateNodeConstructor[];
6523
6805
  static isLockable: boolean;
6524
6806
  static useCoalescedEvents: boolean;
6807
+ /** Set to `true` in subclasses to emit interaction-start/end performance events when this state is entered/exited. */
6808
+ static trackPerformance: boolean;
6525
6809
  id: string;
6526
6810
  type: 'branch' | 'leaf' | 'root';
6527
6811
  shapeType?: string;
@@ -6789,12 +7073,23 @@ export declare type TiptapNode = Node_2;
6789
7073
  /** @public */
6790
7074
  export declare type TLAdjacentDirection = 'down' | 'left' | 'next' | 'prev' | 'right' | 'up';
6791
7075
 
7076
+ /** @public */
7077
+ export declare type TLAnyAssetUtilConstructor = TLAssetUtilConstructor<any>;
7078
+
6792
7079
  /** @public */
6793
7080
  export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
6794
7081
 
6795
7082
  /** @public */
6796
7083
  export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
6797
7084
 
7085
+ /** @public */
7086
+ export declare interface TLAssetUtilConstructor<T extends TLAsset = TLAsset, U extends AssetUtil<T> = AssetUtil<T>> {
7087
+ new (editor: Editor): U;
7088
+ type: T['type'];
7089
+ props?: RecordProps<T>;
7090
+ migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
7091
+ }
7092
+
6798
7093
  /** @public */
6799
7094
  export declare type TLBaseBoxShape = ExtractShapeByProps<{
6800
7095
  h: number;
@@ -6884,6 +7179,29 @@ export declare interface TLCameraConstraints {
6884
7179
  };
6885
7180
  }
6886
7181
 
7182
+ /**
7183
+ * Emitted when a camera operation ends (after a 50ms debounce), with aggregated frame time stats.
7184
+ * @public
7185
+ */
7186
+ export declare interface TLCameraEndPerfEvent extends TLPerfFrameTimeStats {
7187
+ /** Whether this was a pan or zoom operation. */
7188
+ type: 'panning' | 'zooming';
7189
+ /** Total shapes on the current page. */
7190
+ shapeCount: number;
7191
+ /** Number of shapes visible (not culled) in the viewport. */
7192
+ visibleShapeCount: number;
7193
+ /** Number of shapes culled (off-screen) from rendering. */
7194
+ culledShapeCount: number;
7195
+ /** Viewport width in screen pixels. */
7196
+ viewportWidth: number;
7197
+ /** Viewport height in screen pixels. */
7198
+ viewportHeight: number;
7199
+ /** Camera zoom level (`camera.z`) at session end. */
7200
+ zoomLevel: number;
7201
+ /** `performance.now()` when the camera session ended. */
7202
+ timestamp: number;
7203
+ }
7204
+
6887
7205
  /** @public */
6888
7206
  export declare interface TLCameraMoveOptions {
6889
7207
  /** Whether to move the camera immediately, rather than on the next tick. */
@@ -6922,6 +7240,17 @@ export declare interface TLCameraOptions {
6922
7240
  constraints?: TLCameraConstraints;
6923
7241
  }
6924
7242
 
7243
+ /**
7244
+ * Emitted when a camera operation (pan or zoom) begins.
7245
+ * @public
7246
+ */
7247
+ export declare interface TLCameraStartPerfEvent {
7248
+ /** Whether this is a pan or zoom operation. */
7249
+ type: 'panning' | 'zooming';
7250
+ /** `performance.now()` when the camera session started. */
7251
+ timestamp: number;
7252
+ }
7253
+
6925
7254
  /** @public */
6926
7255
  export declare type TLCancelEvent = (info: TLCancelEventInfo) => void;
6927
7256
 
@@ -7144,6 +7473,10 @@ export declare interface TldrawEditorBaseProps {
7144
7473
  * An array of binding utils to use in the editor.
7145
7474
  */
7146
7475
  bindingUtils?: readonly TLAnyBindingUtilConstructor[];
7476
+ /**
7477
+ * An array of asset utils to use in the editor.
7478
+ */
7479
+ assetUtils?: readonly TLAnyAssetUtilConstructor[];
7147
7480
  /**
7148
7481
  * An array of tools to add to the editor's state chart.
7149
7482
  */
@@ -7405,6 +7738,12 @@ export declare interface TldrawOptions {
7405
7738
  * When false, the spacebar will not pan the camera.
7406
7739
  */
7407
7740
  readonly spacebarPanning: boolean;
7741
+ /**
7742
+ * Whether to allow right-click + drag to pan the camera. When true, right-click + drag pans the
7743
+ * camera and a static right-click opens the context menu at the release position. When false,
7744
+ * right-click opens the context menu on press (no drag-to-pan).
7745
+ */
7746
+ readonly rightClickPanning: boolean;
7408
7747
  /**
7409
7748
  * The default padding (in pixels) used when zooming to fit content in the viewport.
7410
7749
  * This affects methods like `zoomToFit()`, `zoomToSelection()`, and `zoomToBounds()`.
@@ -7447,6 +7786,12 @@ export declare interface TldrawOptions {
7447
7786
  * viewport's page dimensions regardless of overview zoom changes.
7448
7787
  */
7449
7788
  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;
7450
7795
  /**
7451
7796
  * Called before content is written to the clipboard during a copy or cut operation.
7452
7797
  * Receives the serialized content (shapes, bindings, assets) and can filter or transform
@@ -7579,6 +7924,10 @@ export declare interface TLEditorOptions {
7579
7924
  * An array of bindings to use in the editor. These will be used to create and manage bindings in the editor.
7580
7925
  */
7581
7926
  bindingUtils: readonly TLAnyBindingUtilConstructor[];
7927
+ /**
7928
+ * An array of asset utils to use in the editor. These will be used to handle asset-type-specific behavior.
7929
+ */
7930
+ assetUtils?: readonly TLAnyAssetUtilConstructor[];
7582
7931
  /**
7583
7932
  * An array of tools to use in the editor. These will be used to handle events and manage user interactions in the editor.
7584
7933
  */
@@ -7841,6 +8190,7 @@ export declare interface TLFileReplaceExternalContent extends TLBaseExternalCont
7841
8190
  type: 'file-replace';
7842
8191
  file: File;
7843
8192
  shapeId: TLShapeId;
8193
+ /** @deprecated This field is no longer used by the default handler. It may be removed in a future version. */
7844
8194
  isImage: boolean;
7845
8195
  }
7846
8196
 
@@ -7851,6 +8201,21 @@ export declare interface TLFilesExternalContent extends TLBaseExternalContent {
7851
8201
  ignoreParent?: boolean;
7852
8202
  }
7853
8203
 
8204
+ /**
8205
+ * Emitted every animation frame when at least one `'frame'` listener is registered.
8206
+ * @public
8207
+ */
8208
+ export declare interface TLFramePerfEvent {
8209
+ /** Time since the last frame in ms. */
8210
+ elapsed: number;
8211
+ /** Total shapes on the current page. */
8212
+ shapeCount: number;
8213
+ /** Number of shapes culled (off-screen) from rendering. */
8214
+ culledShapeCount: number;
8215
+ /** Number of shapes visible (not culled) in the viewport. */
8216
+ visibleShapeCount: number;
8217
+ }
8218
+
7854
8219
  /** Additional options for the {@link ShapeUtil.getGeometry} method.
7855
8220
  *
7856
8221
  * @public
@@ -7993,6 +8358,38 @@ export declare type TLIndicatorPath = {
7993
8358
  path: Path2D;
7994
8359
  } | Path2D;
7995
8360
 
8361
+ /**
8362
+ * Emitted when an interaction state is exited, with aggregated frame time stats.
8363
+ * @public
8364
+ */
8365
+ export declare interface TLInteractionEndPerfEvent extends TLPerfFrameTimeStats {
8366
+ /** The state node id (e.g. `'translating'`). */
8367
+ name: string;
8368
+ /** Full tool path (e.g. `'select.translating'`). */
8369
+ path: string;
8370
+ /** Total shapes on the current page. */
8371
+ shapeCount: number;
8372
+ /** Breakdown of selected shape types at interaction start (e.g. `{ geo: 2, draw: 1 }`). */
8373
+ selectedShapeTypes: Record<string, number>;
8374
+ /** Camera zoom level (`camera.z`) at interaction end. */
8375
+ zoomLevel: number;
8376
+ /** `performance.now()` when the interaction ended. */
8377
+ timestamp: number;
8378
+ }
8379
+
8380
+ /**
8381
+ * Emitted when an interaction state (e.g. translating, resizing) is entered.
8382
+ * @public
8383
+ */
8384
+ export declare interface TLInteractionStartPerfEvent {
8385
+ /** The state node id (e.g. `'translating'`). */
8386
+ name: string;
8387
+ /** Full tool path (e.g. `'select.translating'`). */
8388
+ path: string;
8389
+ /** `performance.now()` when the interaction started. */
8390
+ timestamp: number;
8391
+ }
8392
+
7996
8393
  /** @public */
7997
8394
  export declare type TLInterruptEvent = (info: TLInterruptEventInfo) => void;
7998
8395
 
@@ -8240,6 +8637,94 @@ export declare const tlmenus: {
8240
8637
  */
8241
8638
  export declare type TLOnMountHandler = (editor: Editor) => (() => undefined | void) | undefined | void;
8242
8639
 
8640
+ /**
8641
+ * Map of all performance event names to their payload types.
8642
+ * Used with {@link PerformanceManager.on} and {@link PerformanceManager.once}.
8643
+ * @public
8644
+ */
8645
+ export declare interface TLPerfEventMap {
8646
+ /** An interaction state was entered. */
8647
+ 'interaction-start': [TLInteractionStartPerfEvent];
8648
+ /** An interaction state was exited, with aggregated frame time stats. */
8649
+ 'interaction-end': [TLInteractionEndPerfEvent];
8650
+ /** A camera operation (pan/zoom) began. */
8651
+ 'camera-start': [TLCameraStartPerfEvent];
8652
+ /** A camera operation ended (after debounce), with aggregated frame time stats. */
8653
+ 'camera-end': [TLCameraEndPerfEvent];
8654
+ /** Shapes were created. */
8655
+ 'shapes-created': [TLShapeOperationPerfEvent];
8656
+ /** Shapes were updated. */
8657
+ 'shapes-updated': [TLShapeOperationPerfEvent];
8658
+ /** Shapes were deleted. */
8659
+ 'shapes-deleted': [TLShapeOperationPerfEvent];
8660
+ /** An animation frame was rendered. Only fires when listeners are registered. */
8661
+ frame: [TLFramePerfEvent];
8662
+ /** An undo operation was performed. */
8663
+ undo: [TLUndoRedoPerfEvent];
8664
+ /** A redo operation was performed. */
8665
+ redo: [TLUndoRedoPerfEvent];
8666
+ }
8667
+
8668
+ /**
8669
+ * Common frame time statistics shared by interaction and camera end events.
8670
+ * @public
8671
+ */
8672
+ export declare interface TLPerfFrameTimeStats {
8673
+ /** Total duration of the session in ms. */
8674
+ duration: number;
8675
+ /** Average frames per second during the session. */
8676
+ fps: number;
8677
+ /** Total number of frames recorded. */
8678
+ frameCount: number;
8679
+ /** Mean frame duration in ms. */
8680
+ avgFrameTime: number;
8681
+ /** Median (p50) frame duration in ms. */
8682
+ medianFrameTime: number;
8683
+ /** 95th percentile frame duration in ms. */
8684
+ p95FrameTime: number;
8685
+ /** 99th percentile frame duration in ms. */
8686
+ p99FrameTime: number;
8687
+ /** Shortest frame duration in ms. */
8688
+ minFrameTime: number;
8689
+ /** Longest frame duration in ms. */
8690
+ maxFrameTime: number;
8691
+ /** Raw frame durations for local analysis. Exclude when sending to analytics. */
8692
+ frameTimes: number[];
8693
+ /**
8694
+ * Long animation frames observed during this period (Chromium 123+).
8695
+ * Only present when the browser supports the Long Animation Frames API and
8696
+ * at least one long frame was observed.
8697
+ * Exclude when sending to analytics — entries are large and contain script URLs.
8698
+ */
8699
+ longAnimationFrames?: TLPerfLongAnimationFrame[];
8700
+ }
8701
+
8702
+ /**
8703
+ * A long animation frame observed by the browser during an interaction.
8704
+ * Available only in browsers that support the Long Animation Frames API (Chromium 123+).
8705
+ * @public
8706
+ */
8707
+ export declare interface TLPerfLongAnimationFrame {
8708
+ /** Frame start time (relative to timeOrigin). */
8709
+ startTime: number;
8710
+ /** Total frame duration in ms. */
8711
+ duration: number;
8712
+ /** Time the main thread was blocked in ms. */
8713
+ blockingDuration: number;
8714
+ /** Scripts that contributed to the long frame. */
8715
+ scripts: TLPerfLongAnimationFrameScript[];
8716
+ }
8717
+
8718
+ /** A script attribution entry from a long animation frame. @public */
8719
+ export declare interface TLPerfLongAnimationFrameScript {
8720
+ /** The script source URL (may be empty for inline scripts). */
8721
+ sourceURL: string;
8722
+ /** The function name or invoker description. */
8723
+ invoker: string;
8724
+ /** Time spent in this script in ms. */
8725
+ duration: number;
8726
+ }
8727
+
8243
8728
  /** @public */
8244
8729
  export declare type TLPinchEvent = (info: TLPinchEventInfo) => void;
8245
8730
 
@@ -8427,6 +8912,21 @@ export declare interface TLShapeIndicatorsProps {
8427
8912
  showAll?: boolean;
8428
8913
  }
8429
8914
 
8915
+ /**
8916
+ * Emitted when shapes are created, updated, or deleted.
8917
+ * @public
8918
+ */
8919
+ export declare interface TLShapeOperationPerfEvent {
8920
+ /** The operation type. */
8921
+ operation: 'create' | 'delete' | 'update';
8922
+ /** Number of shapes affected. */
8923
+ count: number;
8924
+ /** Breakdown by shape type (e.g. `{ geo: 2, draw: 1 }`). */
8925
+ shapeTypes: Record<string, number>;
8926
+ /** `performance.now()` when the operation occurred. */
8927
+ timestamp: number;
8928
+ }
8929
+
8430
8930
  /**
8431
8931
  * Options passed to {@link ShapeUtil.canBeLaidOut}.
8432
8932
  *
@@ -8484,6 +8984,7 @@ export declare interface TLShapeUtilConstructor<T extends TLShape, U extends Sha
8484
8984
  type: T['type'];
8485
8985
  props?: RecordProps<T>;
8486
8986
  migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
8987
+ handledAssetTypes?: readonly string[];
8487
8988
  }
8488
8989
 
8489
8990
  /** @public */
@@ -8511,6 +9012,7 @@ export declare interface TLStateNodeConstructor {
8511
9012
  children?(): TLStateNodeConstructor[];
8512
9013
  isLockable: boolean;
8513
9014
  useCoalescedEvents: boolean;
9015
+ trackPerformance: boolean;
8514
9016
  }
8515
9017
 
8516
9018
  /** @public */
@@ -8550,6 +9052,7 @@ export declare type TLStoreOptions = TLStoreBaseOptions & {
8550
9052
 
8551
9053
  /** @public */
8552
9054
  export declare type TLStoreSchemaOptions = {
9055
+ assetUtils?: readonly TLAnyAssetUtilConstructor[];
8553
9056
  bindingUtils?: readonly TLAnyBindingUtilConstructor[];
8554
9057
  migrations?: readonly MigrationSequence[];
8555
9058
  records?: Record<string, CustomRecordInfo>;
@@ -8687,6 +9190,19 @@ export declare interface TLTldrawExternalContentSource {
8687
9190
  data: TLContent;
8688
9191
  }
8689
9192
 
9193
+ /**
9194
+ * Emitted after an undo or redo operation.
9195
+ * @public
9196
+ */
9197
+ export declare interface TLUndoRedoPerfEvent {
9198
+ /** Whether this was an undo or redo. */
9199
+ type: 'redo' | 'undo';
9200
+ /** Number of undo steps remaining. */
9201
+ undoDepth: number;
9202
+ /** Number of redo steps remaining. */
9203
+ redoDepth: number;
9204
+ }
9205
+
8690
9206
  /** @public */
8691
9207
  export declare interface TLUpdatePointerOptions {
8692
9208
  /** Whether to update the pointer immediately, rather than on the next tick. */