@tldraw/editor 4.3.0-next.f4772c19540d → 4.4.0-canary.15cff7ea86f8

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 (217) hide show
  1. package/README.md +1 -1
  2. package/dist-cjs/index.d.ts +507 -155
  3. package/dist-cjs/index.js +8 -1
  4. package/dist-cjs/index.js.map +2 -2
  5. package/dist-cjs/lib/components/ErrorBoundary.js.map +1 -1
  6. package/dist-cjs/lib/components/GeometryDebuggingView.js +1 -17
  7. package/dist-cjs/lib/components/GeometryDebuggingView.js.map +2 -2
  8. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +4 -5
  9. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  10. package/dist-cjs/lib/config/TLUserPreferences.js +9 -3
  11. package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
  12. package/dist-cjs/lib/constants.js +1 -3
  13. package/dist-cjs/lib/constants.js.map +2 -2
  14. package/dist-cjs/lib/editor/Editor.js +350 -292
  15. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  16. package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +2 -2
  17. package/dist-cjs/lib/editor/derivations/bindingsIndex.js.map +2 -2
  18. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js +16 -23
  19. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +3 -3
  20. package/dist-cjs/lib/editor/derivations/parentsToChildren.js +12 -3
  21. package/dist-cjs/lib/editor/derivations/parentsToChildren.js.map +2 -2
  22. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +1 -1
  23. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +2 -2
  24. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +5 -6
  25. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +2 -2
  26. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +591 -0
  27. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +7 -0
  28. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +1 -1
  29. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
  30. package/dist-cjs/lib/editor/managers/SpatialIndexManager/RBushIndex.js +144 -0
  31. package/dist-cjs/lib/editor/managers/SpatialIndexManager/RBushIndex.js.map +7 -0
  32. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +180 -0
  33. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +7 -0
  34. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +1 -22
  35. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +2 -2
  36. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +8 -3
  37. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
  38. package/dist-cjs/lib/editor/shapes/BaseBoxShapeUtil.js.map +1 -1
  39. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +31 -23
  40. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  41. package/dist-cjs/lib/editor/shapes/group/DashedOutlineBox.js +1 -1
  42. package/dist-cjs/lib/editor/shapes/group/DashedOutlineBox.js.map +2 -2
  43. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
  44. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.js.map +2 -2
  45. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js +3 -3
  46. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +2 -2
  47. package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
  48. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  49. package/dist-cjs/lib/exports/parseCss.js +1 -1
  50. package/dist-cjs/lib/exports/parseCss.js.map +2 -2
  51. package/dist-cjs/lib/globals/environment.js +45 -9
  52. package/dist-cjs/lib/globals/environment.js.map +2 -2
  53. package/dist-cjs/lib/globals/menus.js +1 -1
  54. package/dist-cjs/lib/globals/menus.js.map +2 -2
  55. package/dist-cjs/lib/hooks/useCoarsePointer.js +14 -29
  56. package/dist-cjs/lib/hooks/useCoarsePointer.js.map +2 -2
  57. package/dist-cjs/lib/hooks/useEvent.js +1 -1
  58. package/dist-cjs/lib/hooks/useEvent.js.map +2 -2
  59. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
  60. package/dist-cjs/lib/hooks/useGestureEvents.js +1 -1
  61. package/dist-cjs/lib/hooks/useGestureEvents.js.map +2 -2
  62. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +2 -2
  63. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  64. package/dist-cjs/lib/hooks/useScreenBounds.js.map +2 -2
  65. package/dist-cjs/lib/hooks/useStateAttribute.js +4 -1
  66. package/dist-cjs/lib/hooks/useStateAttribute.js.map +2 -2
  67. package/dist-cjs/lib/hooks/useTransform.js.map +1 -1
  68. package/dist-cjs/lib/hooks/useZoomCss.js +4 -8
  69. package/dist-cjs/lib/hooks/useZoomCss.js.map +2 -2
  70. package/dist-cjs/lib/options.js +6 -1
  71. package/dist-cjs/lib/options.js.map +2 -2
  72. package/dist-cjs/lib/primitives/Box.js +3 -0
  73. package/dist-cjs/lib/primitives/Box.js.map +2 -2
  74. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +1 -0
  75. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
  76. package/dist-cjs/lib/utils/reparenting.js.map +2 -2
  77. package/dist-cjs/lib/utils/rotation.js +1 -1
  78. package/dist-cjs/lib/utils/rotation.js.map +2 -2
  79. package/dist-cjs/version.js +3 -3
  80. package/dist-cjs/version.js.map +1 -1
  81. package/dist-esm/index.d.mts +507 -155
  82. package/dist-esm/index.mjs +9 -2
  83. package/dist-esm/index.mjs.map +2 -2
  84. package/dist-esm/lib/components/ErrorBoundary.mjs.map +1 -1
  85. package/dist-esm/lib/components/GeometryDebuggingView.mjs +1 -17
  86. package/dist-esm/lib/components/GeometryDebuggingView.mjs.map +2 -2
  87. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +4 -5
  88. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  89. package/dist-esm/lib/config/TLUserPreferences.mjs +9 -3
  90. package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
  91. package/dist-esm/lib/constants.mjs +1 -3
  92. package/dist-esm/lib/constants.mjs.map +2 -2
  93. package/dist-esm/lib/editor/Editor.mjs +351 -295
  94. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  95. package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +2 -2
  96. package/dist-esm/lib/editor/derivations/bindingsIndex.mjs.map +2 -2
  97. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs +16 -23
  98. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +3 -3
  99. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs +13 -4
  100. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs.map +2 -2
  101. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +1 -1
  102. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +2 -2
  103. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +5 -6
  104. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +2 -2
  105. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +573 -0
  106. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +7 -0
  107. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +1 -1
  108. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
  109. package/dist-esm/lib/editor/managers/SpatialIndexManager/RBushIndex.mjs +114 -0
  110. package/dist-esm/lib/editor/managers/SpatialIndexManager/RBushIndex.mjs.map +7 -0
  111. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +160 -0
  112. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +7 -0
  113. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +1 -22
  114. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +2 -2
  115. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +8 -3
  116. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
  117. package/dist-esm/lib/editor/shapes/BaseBoxShapeUtil.mjs.map +1 -1
  118. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +31 -23
  119. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  120. package/dist-esm/lib/editor/shapes/group/DashedOutlineBox.mjs +1 -1
  121. package/dist-esm/lib/editor/shapes/group/DashedOutlineBox.mjs.map +2 -2
  122. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
  123. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.mjs.map +2 -2
  124. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs +3 -3
  125. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +2 -2
  126. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  127. package/dist-esm/lib/exports/parseCss.mjs +1 -1
  128. package/dist-esm/lib/exports/parseCss.mjs.map +2 -2
  129. package/dist-esm/lib/globals/environment.mjs +45 -9
  130. package/dist-esm/lib/globals/environment.mjs.map +2 -2
  131. package/dist-esm/lib/globals/menus.mjs +1 -1
  132. package/dist-esm/lib/globals/menus.mjs.map +2 -2
  133. package/dist-esm/lib/hooks/useCoarsePointer.mjs +15 -30
  134. package/dist-esm/lib/hooks/useCoarsePointer.mjs.map +2 -2
  135. package/dist-esm/lib/hooks/useEvent.mjs +1 -1
  136. package/dist-esm/lib/hooks/useEvent.mjs.map +2 -2
  137. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
  138. package/dist-esm/lib/hooks/useGestureEvents.mjs +1 -1
  139. package/dist-esm/lib/hooks/useGestureEvents.mjs.map +2 -2
  140. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +2 -2
  141. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  142. package/dist-esm/lib/hooks/useScreenBounds.mjs.map +2 -2
  143. package/dist-esm/lib/hooks/useStateAttribute.mjs +4 -1
  144. package/dist-esm/lib/hooks/useStateAttribute.mjs.map +2 -2
  145. package/dist-esm/lib/hooks/useTransform.mjs.map +1 -1
  146. package/dist-esm/lib/hooks/useZoomCss.mjs +4 -8
  147. package/dist-esm/lib/hooks/useZoomCss.mjs.map +2 -2
  148. package/dist-esm/lib/options.mjs +6 -1
  149. package/dist-esm/lib/options.mjs.map +2 -2
  150. package/dist-esm/lib/primitives/Box.mjs +3 -0
  151. package/dist-esm/lib/primitives/Box.mjs.map +2 -2
  152. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +1 -0
  153. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
  154. package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
  155. package/dist-esm/lib/utils/rotation.mjs +1 -1
  156. package/dist-esm/lib/utils/rotation.mjs.map +2 -2
  157. package/dist-esm/version.mjs +3 -3
  158. package/dist-esm/version.mjs.map +1 -1
  159. package/editor.css +14 -12
  160. package/package.json +21 -17
  161. package/src/index.ts +5 -1
  162. package/src/lib/components/ErrorBoundary.tsx +1 -1
  163. package/src/lib/components/GeometryDebuggingView.tsx +1 -19
  164. package/src/lib/components/default-components/DefaultCanvas.tsx +5 -8
  165. package/src/lib/config/TLUserPreferences.test.ts +41 -0
  166. package/src/lib/config/TLUserPreferences.ts +8 -0
  167. package/src/lib/constants.ts +0 -2
  168. package/src/lib/editor/Editor.test.ts +150 -10
  169. package/src/lib/editor/Editor.ts +543 -385
  170. package/src/lib/editor/bindings/BindingUtil.ts +15 -9
  171. package/src/lib/editor/derivations/bindingsIndex.ts +2 -2
  172. package/src/lib/editor/derivations/notVisibleShapes.ts +21 -33
  173. package/src/lib/editor/derivations/parentsToChildren.ts +18 -7
  174. package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +17 -31
  175. package/src/lib/editor/managers/ClickManager/ClickManager.ts +1 -1
  176. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +129 -79
  177. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +10 -6
  178. package/src/lib/editor/managers/FontManager/FontManager.test.ts +14 -4
  179. package/src/lib/editor/managers/InputsManager/InputsManager.ts +566 -0
  180. package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +0 -4
  181. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +12 -0
  182. package/src/lib/editor/managers/SnapManager/SnapManager.ts +4 -4
  183. package/src/lib/editor/managers/SpatialIndexManager/RBushIndex.ts +144 -0
  184. package/src/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.ts +214 -0
  185. package/src/lib/editor/managers/TickManager/TickManager.test.ts +40 -107
  186. package/src/lib/editor/managers/TickManager/TickManager.ts +2 -32
  187. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +24 -0
  188. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +8 -0
  189. package/src/lib/editor/shapes/BaseBoxShapeUtil.tsx +2 -2
  190. package/src/lib/editor/shapes/ShapeUtil.ts +72 -32
  191. package/src/lib/editor/shapes/group/DashedOutlineBox.tsx +1 -1
  192. package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +1 -3
  193. package/src/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.ts +2 -1
  194. package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +6 -6
  195. package/src/lib/editor/types/emit-types.ts +3 -1
  196. package/src/lib/exports/getSvgJsx.test.ts +10 -19
  197. package/src/lib/exports/getSvgJsx.tsx +2 -5
  198. package/src/lib/exports/parseCss.test.ts +1 -0
  199. package/src/lib/exports/parseCss.ts +1 -1
  200. package/src/lib/globals/environment.ts +65 -10
  201. package/src/lib/globals/menus.ts +1 -1
  202. package/src/lib/hooks/useCoarsePointer.ts +16 -59
  203. package/src/lib/hooks/useEvent.tsx +1 -1
  204. package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +1 -1
  205. package/src/lib/hooks/useGestureEvents.ts +2 -2
  206. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +1 -1
  207. package/src/lib/hooks/usePassThroughWheelEvents.ts +1 -1
  208. package/src/lib/hooks/useScreenBounds.ts +1 -1
  209. package/src/lib/hooks/useStateAttribute.ts +4 -1
  210. package/src/lib/hooks/useTransform.ts +1 -1
  211. package/src/lib/hooks/useZoomCss.ts +3 -8
  212. package/src/lib/options.ts +32 -0
  213. package/src/lib/primitives/Box.ts +9 -0
  214. package/src/lib/primitives/geometry/Geometry2d.ts +1 -0
  215. package/src/lib/utils/reparenting.ts +5 -5
  216. package/src/lib/utils/rotation.ts +1 -1
  217. package/src/version.ts +3 -3
@@ -1,4 +1,5 @@
1
1
  import { Atom } from '@tldraw/state';
2
+ import { AtomSet } from '@tldraw/store';
2
3
  import { BoxModel } from '@tldraw/tlschema';
3
4
  import { ComponentType } from 'react';
4
5
  import { Computed } from '@tldraw/state';
@@ -7,11 +8,13 @@ import { Editor as Editor_2 } from '@tiptap/core';
7
8
  import { EditorProviderProps as EditorProviderProps_2 } from '@tiptap/react';
8
9
  import EventEmitter from 'eventemitter3';
9
10
  import { ExoticComponent } from 'react';
11
+ import { ExtractShapeByProps } from '@tldraw/tlschema';
10
12
  import { ForwardRefExoticComponent } from 'react';
13
+ import { FragmentProps } from 'react';
11
14
  import { HistoryEntry } from '@tldraw/store';
12
15
  import { IndexKey } from '@tldraw/utils';
13
16
  import { JsonObject } from '@tldraw/utils';
14
- import { JSX as JSX_2 } from 'react/jsx-runtime';
17
+ import { JSX } from 'react/jsx-runtime';
15
18
  import { LegacyMigrations } from '@tldraw/store';
16
19
  import { MigrationSequence } from '@tldraw/store';
17
20
  import { NamedExoticComponent } from 'react';
@@ -48,6 +51,7 @@ import { TLBindingId } from '@tldraw/tlschema';
48
51
  import { TLBindingUpdate } from '@tldraw/tlschema';
49
52
  import { TLBookmarkAsset } from '@tldraw/tlschema';
50
53
  import { TLCamera } from '@tldraw/tlschema';
54
+ import { TLCreateShapePartial } from '@tldraw/tlschema';
51
55
  import { TLCursor } from '@tldraw/tlschema';
52
56
  import { TLCursorType } from '@tldraw/tlschema';
53
57
  import { TLDefaultDashStyle } from '@tldraw/tlschema';
@@ -147,7 +151,7 @@ export declare abstract class BaseBoxShapeTool extends StateNode {
147
151
  static id: string;
148
152
  static initial: string;
149
153
  static children(): TLStateNodeConstructor[];
150
- abstract shapeType: string;
154
+ abstract shapeType: TLBaseBoxShape['type'];
151
155
  onCreate?(_shape: null | TLShape): null | void;
152
156
  }
153
157
 
@@ -165,7 +169,7 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
165
169
  *
166
170
  * @public
167
171
  */
168
- export declare interface BindingOnChangeOptions<Binding extends TLUnknownBinding> {
172
+ export declare interface BindingOnChangeOptions<Binding extends TLBinding = TLBinding> {
169
173
  /** The binding record before the change is made. */
170
174
  bindingBefore: Binding;
171
175
  /** The binding record after the change is made. */
@@ -178,7 +182,7 @@ export declare interface BindingOnChangeOptions<Binding extends TLUnknownBinding
178
182
  *
179
183
  * @public
180
184
  */
181
- export declare interface BindingOnCreateOptions<Binding extends TLUnknownBinding> {
185
+ export declare interface BindingOnCreateOptions<Binding extends TLBinding = TLBinding> {
182
186
  /** The binding being created. */
183
187
  binding: Binding;
184
188
  }
@@ -189,7 +193,7 @@ export declare interface BindingOnCreateOptions<Binding extends TLUnknownBinding
189
193
  *
190
194
  * @public
191
195
  */
192
- export declare interface BindingOnDeleteOptions<Binding extends TLUnknownBinding> {
196
+ export declare interface BindingOnDeleteOptions<Binding extends TLBinding = TLBinding> {
193
197
  /** The binding being deleted. */
194
198
  binding: Binding;
195
199
  }
@@ -200,7 +204,7 @@ export declare interface BindingOnDeleteOptions<Binding extends TLUnknownBinding
200
204
  *
201
205
  * @public
202
206
  */
203
- export declare interface BindingOnShapeChangeOptions<Binding extends TLUnknownBinding> {
207
+ export declare interface BindingOnShapeChangeOptions<Binding extends TLBinding = TLBinding> {
204
208
  /** The binding record linking these two shapes. */
205
209
  binding: Binding;
206
210
  /** The shape record before the change is made. */
@@ -224,7 +228,7 @@ export declare interface BindingOnShapeChangeOptions<Binding extends TLUnknownBi
224
228
  *
225
229
  * @public
226
230
  */
227
- export declare interface BindingOnShapeDeleteOptions<Binding extends TLUnknownBinding> {
231
+ export declare interface BindingOnShapeDeleteOptions<Binding extends TLBinding = TLBinding> {
228
232
  /** The binding record that refers to the shape in question. */
229
233
  binding: Binding;
230
234
  /** The shape that is about to be deleted. */
@@ -256,7 +260,7 @@ export declare interface BindingOnShapeDeleteOptions<Binding extends TLUnknownBi
256
260
  *
257
261
  * @public
258
262
  */
259
- export declare interface BindingOnShapeIsolateOptions<Binding extends TLUnknownBinding> {
263
+ export declare interface BindingOnShapeIsolateOptions<Binding extends TLBinding = TLBinding> {
260
264
  /** The binding record that refers to the shape in question. */
261
265
  binding: Binding;
262
266
  /**
@@ -267,7 +271,7 @@ export declare interface BindingOnShapeIsolateOptions<Binding extends TLUnknownB
267
271
  }
268
272
 
269
273
  /** @public */
270
- export declare abstract class BindingUtil<Binding extends TLUnknownBinding = TLUnknownBinding> {
274
+ export declare abstract class BindingUtil<Binding extends TLBinding = TLBinding> {
271
275
  editor: Editor;
272
276
  constructor(editor: Editor);
273
277
  static props?: RecordProps<TLUnknownBinding>;
@@ -486,6 +490,7 @@ export declare class Box {
486
490
  get cornersAndCenter(): Vec[];
487
491
  get sides(): Array<[Vec, Vec]>;
488
492
  get size(): Vec;
493
+ isValid(): boolean;
489
494
  toFixed(): this;
490
495
  setTo(B: Box): this;
491
496
  set(x?: number, y?: number, w?: number, h?: number): this;
@@ -653,7 +658,7 @@ export declare function clockwiseAngleDist(a0: number, a1: number): number;
653
658
  * @public
654
659
  * @react
655
660
  */
656
- export declare function ContainerProvider({ container, children }: ContainerProviderProps): JSX_2.Element;
661
+ export declare function ContainerProvider({ container, children }: ContainerProviderProps): JSX.Element;
657
662
 
658
663
  /** @public */
659
664
  export declare interface ContainerProviderProps {
@@ -794,16 +799,16 @@ export declare interface DebugFlagDefaults<T> {
794
799
  /* Excluded from this release type: DEFAULT_CAMERA_OPTIONS */
795
800
 
796
801
  /** @public @react */
797
- export declare function DefaultBackground(): JSX_2.Element;
802
+ export declare function DefaultBackground(): JSX.Element;
798
803
 
799
804
  /** @public @react */
800
- export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX_2.Element;
805
+ export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX.Element;
801
806
 
802
807
  /** @public @react */
803
- export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX_2.Element;
808
+ export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
804
809
 
805
810
  /** @public @react */
806
- export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity, }: TLCollaboratorHintProps): JSX_2.Element;
811
+ export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity, }: TLCollaboratorHintProps): JSX.Element;
807
812
 
808
813
  /** @public @react */
809
814
  export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
@@ -812,22 +817,22 @@ export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
812
817
  export declare const DefaultErrorFallback: TLErrorFallbackComponent;
813
818
 
814
819
  /** @public @react */
815
- export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX_2.Element;
820
+ export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
816
821
 
817
822
  /** @public @react */
818
- export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX_2.Element;
823
+ export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX.Element;
819
824
 
820
825
  /** @public @react */
821
- export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX_2.Element;
826
+ export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX.Element;
822
827
 
823
828
  /** @public @react */
824
- export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX_2.Element | null;
829
+ export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX.Element | null;
825
830
 
826
831
  /** @public @react */
827
- export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX_2.Element;
832
+ export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX.Element;
828
833
 
829
834
  /** @public @react */
830
- export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX_2.Element;
835
+ export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX.Element;
831
836
 
832
837
  /** @public @react */
833
838
  export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicatorProps>;
@@ -839,10 +844,10 @@ export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicat
839
844
  export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
840
845
 
841
846
  /** @public @react */
842
- export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX_2.Element;
847
+ export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX.Element;
843
848
 
844
849
  /** @public @react */
845
- export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX_2.Element;
850
+ export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX.Element;
846
851
 
847
852
  /** @public @react */
848
853
  export declare const DefaultSvgDefs: () => null;
@@ -861,6 +866,8 @@ export declare const defaultTldrawOptions: {
861
866
  readonly collaboratorIdleTimeoutMs: 3000;
862
867
  readonly collaboratorInactiveTimeoutMs: 60000;
863
868
  readonly createTextOnCanvasDoubleClick: true;
869
+ readonly debouncedZoom: true;
870
+ readonly debouncedZoomThreshold: 500;
864
871
  readonly defaultSvgPadding: 32;
865
872
  readonly doubleClickDurationMs: 450;
866
873
  readonly dragDistanceSquared: 16;
@@ -869,9 +876,7 @@ export declare const defaultTldrawOptions: {
869
876
  readonly edgeScrollEaseDuration: 200;
870
877
  readonly edgeScrollSpeed: 25;
871
878
  readonly enableToolbarKeyboardShortcuts: true;
872
- readonly exportProvider: ExoticComponent< {
873
- children?: ReactNode | undefined;
874
- }>;
879
+ readonly exportProvider: ExoticComponent<FragmentProps>;
875
880
  readonly flattenImageBoundsExpand: 64;
876
881
  readonly flattenImageBoundsPadding: 16;
877
882
  readonly followChaseViewportSnap: 2;
@@ -903,11 +908,14 @@ export declare const defaultTldrawOptions: {
903
908
  readonly maxShapesPerPage: 4000;
904
909
  readonly multiClickDurationMs: 200;
905
910
  readonly nonce: undefined;
911
+ readonly snapThreshold: 8;
912
+ readonly spacebarPanning: true;
906
913
  readonly temporaryAssetPreviewLifetimeMs: 180000;
907
914
  readonly textShadowLod: 0.35;
908
915
  readonly tooltipDelayMs: 700;
909
916
  readonly uiCoarseDragDistanceSquared: 625;
910
917
  readonly uiDragDistanceSquared: 16;
918
+ readonly zoomToFitPadding: 128;
911
919
  };
912
920
 
913
921
  /** @public */
@@ -923,6 +931,7 @@ export declare const defaultUserPreferences: Readonly<{
923
931
  isPasteAtCursorMode: false;
924
932
  isSnapMode: false;
925
933
  isWrapMode: false;
934
+ isZoomDirectionInverted: false;
926
935
  locale: "ar" | "bn" | "ca" | "cs" | "da" | "de" | "el" | "en" | "es" | "fa" | "fi" | "fr" | "gl" | "gu-in" | "he" | "hi-in" | "hr" | "hu" | "id" | "it" | "ja" | "km-kh" | "kn" | "ko-kr" | "ml" | "mr" | "ms" | "ne" | "nl" | "no" | "pa" | "pl" | "pt-br" | "pt-pt" | "ro" | "ru" | "sl" | "so" | "sv" | "ta" | "te" | "th" | "tl" | "tr" | "uk" | "ur" | "vi" | "zh-cn" | "zh-tw";
927
936
  name: "";
928
937
  }>;
@@ -981,6 +990,7 @@ export declare class EdgeScrollManager {
981
990
  constructor(editor: Editor);
982
991
  private _isEdgeScrolling;
983
992
  private _edgeScrollDuration;
993
+ getIsEdgeScrolling(): boolean;
984
994
  /**
985
995
  * Update the camera position when the mouse is close to the edge of the screen.
986
996
  * Run this on every tick when in a state where edge scrolling is enabled.
@@ -1039,7 +1049,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1039
1049
  */
1040
1050
  removeTool(Tool: TLStateNodeConstructor, parent?: StateNode): void;
1041
1051
  /**
1042
- * A set of functions to call when the app is disposed.
1052
+ * A set of functions to call when the editor is disposed.
1043
1053
  *
1044
1054
  * @public
1045
1055
  */
@@ -1052,11 +1062,18 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1052
1062
  isDisposed: boolean;
1053
1063
  /* Excluded from this release type: _tickManager */
1054
1064
  /**
1055
- * A manager for the app's snapping feature.
1065
+ * A manager for the editor's input state.
1066
+ *
1067
+ * @public
1068
+ */
1069
+ readonly inputs: InputsManager;
1070
+ /**
1071
+ * A manager for the editor's snapping feature.
1056
1072
  *
1057
1073
  * @public
1058
1074
  */
1059
1075
  readonly snaps: SnapManager;
1076
+ private readonly _spatialIndex;
1060
1077
  /**
1061
1078
  * A manager for the any asynchronous events and making sure they're
1062
1079
  * cleaned up upon disposal.
@@ -1129,7 +1146,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1129
1146
  * @public
1130
1147
  */
1131
1148
  shapeUtils: {
1132
- readonly [K in string]?: ShapeUtil<TLUnknownShape>;
1149
+ readonly [K in string]?: ShapeUtil<TLShape>;
1133
1150
  };
1134
1151
  styleProps: {
1135
1152
  [key: string]: Map<StyleProp<any>, string>;
@@ -1149,16 +1166,18 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1149
1166
  *
1150
1167
  * @public
1151
1168
  */
1152
- getShapeUtil<S extends TLUnknownShape>(shape: S | TLShapePartial<S>): ShapeUtil<S>;
1153
- getShapeUtil<S extends TLUnknownShape>(type: S['type']): ShapeUtil<S>;
1169
+ getShapeUtil<K extends TLShape['type']>(type: K): ShapeUtil<Extract<TLShape, {
1170
+ type: K;
1171
+ }>>;
1172
+ getShapeUtil<S extends TLShape>(shape: S | S['type'] | TLShapePartial<S>): ShapeUtil<S>;
1154
1173
  getShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): T;
1155
1174
  /**
1156
1175
  * Returns true if the editor has a shape util for the given shape / shape type.
1157
1176
  *
1158
1177
  * @param shape - A shape, shape partial, or shape type.
1159
1178
  */
1160
- hasShapeUtil<S extends TLUnknownShape>(shape: S | TLShapePartial<S>): boolean;
1161
- hasShapeUtil<S extends TLUnknownShape>(type: S['type']): boolean;
1179
+ hasShapeUtil(shape: TLShape | TLShapePartial<TLShape>): boolean;
1180
+ hasShapeUtil(type: TLShape['type']): boolean;
1162
1181
  hasShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): boolean;
1163
1182
  /**
1164
1183
  * A map of shape utility classes (TLShapeUtils) by shape type.
@@ -1166,7 +1185,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1166
1185
  * @public
1167
1186
  */
1168
1187
  bindingUtils: {
1169
- readonly [K in string]?: BindingUtil<TLUnknownBinding>;
1188
+ readonly [K in string]?: BindingUtil<TLBinding>;
1170
1189
  };
1171
1190
  /**
1172
1191
  * Get a binding util from a binding itself.
@@ -1183,13 +1202,15 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1183
1202
  *
1184
1203
  * @public
1185
1204
  */
1186
- getBindingUtil<S extends TLUnknownBinding>(binding: {
1205
+ getBindingUtil<K extends TLBinding['type']>(type: K): BindingUtil<Extract<TLBinding, {
1206
+ type: K;
1207
+ }>>;
1208
+ getBindingUtil<S extends TLBinding>(binding: {
1187
1209
  type: S['type'];
1188
1210
  } | S): BindingUtil<S>;
1189
- getBindingUtil<S extends TLUnknownBinding>(type: S['type']): BindingUtil<S>;
1190
1211
  getBindingUtil<T extends BindingUtil>(type: T extends BindingUtil<infer R> ? R['type'] : string): T;
1191
1212
  /**
1192
- * A manager for the app's history.
1213
+ * A manager for the editor's history.
1193
1214
  *
1194
1215
  * @readonly
1195
1216
  */
@@ -1206,10 +1227,11 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1206
1227
  */
1207
1228
  undo(): this;
1208
1229
  /**
1209
- * Whether the app can undo.
1230
+ * Whether the editor can undo.
1210
1231
  *
1211
1232
  * @public
1212
1233
  */
1234
+ canUndo(): boolean;
1213
1235
  getCanUndo(): boolean;
1214
1236
  /**
1215
1237
  * Redo to the next mark.
@@ -1222,13 +1244,14 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1222
1244
  * @public
1223
1245
  */
1224
1246
  redo(): this;
1225
- clearHistory(): this;
1226
1247
  /**
1227
- * Whether the app can redo.
1248
+ * Whether the editor can redo.
1228
1249
  *
1229
1250
  * @public
1230
1251
  */
1252
+ canRedo(): boolean;
1231
1253
  getCanRedo(): boolean;
1254
+ clearHistory(): this;
1232
1255
  /**
1233
1256
  * Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
1234
1257
  * any redos. You typically want to do this just before a user interaction begins or is handled.
@@ -1587,7 +1610,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1587
1610
  */
1588
1611
  selectNone(): this;
1589
1612
  /**
1590
- * The id of the app's only selected shape.
1613
+ * The id of the editor's only selected shape.
1591
1614
  *
1592
1615
  * @returns Null if there is no shape or more than one selected shape, otherwise the selected shape's id.
1593
1616
  *
@@ -1596,7 +1619,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1596
1619
  */
1597
1620
  getOnlySelectedShapeId(): null | TLShapeId;
1598
1621
  /**
1599
- * The app's only selected shape.
1622
+ * The editor's only selected shape.
1600
1623
  *
1601
1624
  * @returns Null if there is no shape or more than one selected shape, otherwise the selected shape.
1602
1625
  *
@@ -1688,6 +1711,16 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1688
1711
  * @public
1689
1712
  */
1690
1713
  getEditingShape(): TLShape | undefined;
1714
+ /**
1715
+ * Whether the shape can be edited.
1716
+ *
1717
+ * @param shape - The shape (or shape id) to check if it can be edited.
1718
+ * @param info - The info about the edit start.
1719
+ *
1720
+ * @public
1721
+ * @returns true if the shape can be edited, false otherwise.
1722
+ */
1723
+ canEditShape<T extends TLShape | TLShapeId>(shape: null | T, info?: TLEditStartInfo): shape is T;
1691
1724
  /**
1692
1725
  * Set the current editing shape.
1693
1726
  *
@@ -1807,6 +1840,15 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1807
1840
  * @public
1808
1841
  */
1809
1842
  getCroppingShapeId(): null | TLShapeId;
1843
+ /**
1844
+ * Whether the shape can be cropped.
1845
+ *
1846
+ * @param shape - The shape (or shape id) to check if it can be cropped.
1847
+ *
1848
+ * @public
1849
+ * @returns true if the shape can be cropped, false otherwise.
1850
+ */
1851
+ canCropShape<T extends TLShape | TLShapeId>(shape: null | T): shape is T;
1810
1852
  /**
1811
1853
  * Set the current cropping shape.
1812
1854
  *
@@ -1849,6 +1891,32 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1849
1891
  * @public
1850
1892
  */
1851
1893
  getZoomLevel(): number;
1894
+ private _debouncedZoomLevel;
1895
+ /**
1896
+ * Get the debounced zoom level. When the camera is moving, this returns the zoom level
1897
+ * from when the camera started moving rather than the current zoom level. This can be
1898
+ * used to avoid expensive re-renders during camera movements.
1899
+ *
1900
+ * This behavior is controlled by the `useDebouncedZoom` option. When `useDebouncedZoom`
1901
+ * is `false`, this method always returns the current zoom level.
1902
+ *
1903
+ * @public
1904
+ */
1905
+ getDebouncedZoomLevel(): number;
1906
+ private _getAboveDebouncedZoomThreshold;
1907
+ /**
1908
+ * Get the efficient zoom level. This returns the current zoom level if there are less than 300 shapes on the page,
1909
+ * otherwise it returns the debounced zoom level. This can be used to avoid expensive re-renders during camera movements.
1910
+ *
1911
+ * @public
1912
+ * @example
1913
+ * ```ts
1914
+ * editor.getEfficientZoomLevel()
1915
+ * ```
1916
+ *
1917
+ * @public
1918
+ */
1919
+ getEfficientZoomLevel(): number;
1852
1920
  /**
1853
1921
  * Get the camera's initial or reset zoom level.
1854
1922
  *
@@ -1963,7 +2031,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1963
2031
  * ```ts
1964
2032
  * editor.zoomIn()
1965
2033
  * editor.zoomIn(editor.getViewportScreenCenter(), { animation: { duration: 200 } })
1966
- * editor.zoomIn(editor.inputs.currentScreenPoint, { animation: { duration: 200 } })
2034
+ * editor.zoomIn(editor.inputs.getCurrentScreenPoint(), { animation: { duration: 200 } })
1967
2035
  * ```
1968
2036
  *
1969
2037
  * @param point - The screen point to zoom in on. Defaults to the screen center
@@ -1979,7 +2047,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1979
2047
  * ```ts
1980
2048
  * editor.zoomOut()
1981
2049
  * editor.zoomOut(editor.getViewportScreenCenter(), { animation: { duration: 120 } })
1982
- * editor.zoomOut(editor.inputs.currentScreenPoint, { animation: { duration: 120 } })
2050
+ * editor.zoomOut(editor.inputs.getCurrentScreenPoint(), { animation: { duration: 120 } })
1983
2051
  * ```
1984
2052
  *
1985
2053
  * @param point - The point to zoom out on. Defaults to the viewport screen center.
@@ -2192,8 +2260,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2192
2260
  /* Excluded from this release type: getUnorderedRenderingShapes */
2193
2261
  private _cameraState;
2194
2262
  private _cameraStateTimeoutRemaining;
2195
- _decayCameraStateTimeout(elapsed: number): void;
2196
- _tickCameraState(): void;
2263
+ private _decayCameraStateTimeout;
2264
+ private _tickCameraState;
2197
2265
  /**
2198
2266
  * Whether the camera is moving or idle.
2199
2267
  *
@@ -2642,6 +2710,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2642
2710
  */
2643
2711
  getNotVisibleShapes(): Set<TLShapeId>;
2644
2712
  private _notVisibleShapes;
2713
+ private _culledShapesCache;
2645
2714
  /**
2646
2715
  * Get culled shapes (those that should not render), taking into account which shapes are selected or editing.
2647
2716
  *
@@ -2691,6 +2760,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2691
2760
  hitInside?: boolean;
2692
2761
  margin?: number;
2693
2762
  }): TLShape[];
2763
+ /* Excluded from this release type: getShapeIdsInsideBounds */
2694
2764
  /**
2695
2765
  * Test whether a point (in the current page space) will will a shape. This method takes into account masks,
2696
2766
  * such as when a shape is the child of a frame and is partially clipped by the frame.
@@ -2765,7 +2835,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2765
2835
  *
2766
2836
  * @example
2767
2837
  * ```ts
2768
- * const isArrowShape = isShapeOfType<TLArrowShape>(someShape, 'arrow')
2838
+ * const isArrowShape = isShapeOfType(someShape, 'arrow')
2769
2839
  * ```
2770
2840
  *
2771
2841
  * @param util - the TLShapeUtil constructor to test against
@@ -2773,8 +2843,13 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2773
2843
  *
2774
2844
  * @public
2775
2845
  */
2776
- isShapeOfType<T extends TLUnknownShape>(shape: TLUnknownShape, type: T['type']): shape is T;
2777
- isShapeOfType<T extends TLUnknownShape>(shapeId: TLUnknownShape['id'], type: T['type']): shapeId is T['id'];
2846
+ isShapeOfType<K extends TLShape['type']>(shape: TLShape, type: K): shape is Extract<TLShape, {
2847
+ type: K;
2848
+ }>;
2849
+ isShapeOfType<T extends TLShape>(shape: TLShape, type: T['type']): shape is Extract<TLShape, {
2850
+ type: T['type'];
2851
+ }>;
2852
+ isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
2778
2853
  /**
2779
2854
  * Get a shape by its id.
2780
2855
  *
@@ -2925,17 +3000,26 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2925
3000
  * Get all bindings of a certain type _from_ a particular shape. These are the bindings whose
2926
3001
  * `fromId` matched the shape's ID.
2927
3002
  */
2928
- getBindingsFromShape<Binding extends TLUnknownBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
3003
+ getBindingsFromShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
3004
+ type: K;
3005
+ }>[];
3006
+ getBindingsFromShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
2929
3007
  /**
2930
3008
  * Get all bindings of a certain type _to_ a particular shape. These are the bindings whose
2931
3009
  * `toId` matches the shape's ID.
2932
3010
  */
2933
- getBindingsToShape<Binding extends TLUnknownBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
3011
+ getBindingsToShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
3012
+ type: K;
3013
+ }>[];
3014
+ getBindingsToShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
2934
3015
  /**
2935
3016
  * Get all bindings involving a particular shape. This includes bindings where the shape is the
2936
3017
  * `fromId` or `toId`. If a type is provided, only bindings of that type are returned.
2937
3018
  */
2938
- getBindingsInvolvingShape<Binding extends TLUnknownBinding = TLBinding>(shape: TLShape | TLShapeId, type?: Binding['type']): Binding[];
3019
+ getBindingsInvolvingShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
3020
+ type: K;
3021
+ }>[];
3022
+ getBindingsInvolvingShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type?: Binding['type']): Binding[];
2939
3023
  /**
2940
3024
  * Create bindings from a list of partial bindings. You can omit the ID and most props of a
2941
3025
  * binding, but the `type`, `toId`, and `fromId` must all be provided.
@@ -3250,7 +3334,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3250
3334
  *
3251
3335
  * @public
3252
3336
  */
3253
- canCreateShape<T extends TLUnknownShape>(shape: OptionalKeys<TLShapePartial<T>, 'id'> | T['id']): boolean;
3337
+ canCreateShape(shape: OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id']): boolean;
3254
3338
  /**
3255
3339
  * Get whether the provided shapes can be created.
3256
3340
  *
@@ -3258,7 +3342,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3258
3342
  *
3259
3343
  * @public
3260
3344
  */
3261
- canCreateShapes<T extends TLUnknownShape>(shapes: (OptionalKeys<TLShapePartial<T>, 'id'> | T['id'])[]): boolean;
3345
+ canCreateShapes(shapes: (OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id'])[]): boolean;
3262
3346
  /**
3263
3347
  * Create a single shape.
3264
3348
  *
@@ -3272,7 +3356,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3272
3356
  *
3273
3357
  * @public
3274
3358
  */
3275
- createShape<T extends TLUnknownShape>(shape: OptionalKeys<TLShapePartial<T>, 'id'>): this;
3359
+ createShape<TShape extends TLShape>(shape: TLCreateShapePartial<TShape>): this;
3276
3360
  /**
3277
3361
  * Create shapes.
3278
3362
  *
@@ -3286,7 +3370,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3286
3370
  *
3287
3371
  * @public
3288
3372
  */
3289
- createShapes<T extends TLUnknownShape>(shapes: OptionalKeys<TLShapePartial<T>, 'id'>[]): this;
3373
+ createShapes<TShape extends TLShape = TLShape>(shapes: TLCreateShapePartial<TShape>[]): this;
3290
3374
  private animatingShapes;
3291
3375
  /**
3292
3376
  * Animate a shape.
@@ -3372,7 +3456,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3372
3456
  *
3373
3457
  * @public
3374
3458
  */
3375
- updateShape<T extends TLUnknownShape>(partial: null | TLShapePartial<T> | undefined): this;
3459
+ updateShape<T extends TLShape = TLShape>(partial: null | TLShapePartial<T> | undefined): this;
3376
3460
  /**
3377
3461
  * Update shapes using partials of each shape.
3378
3462
  *
@@ -3385,7 +3469,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3385
3469
  *
3386
3470
  * @public
3387
3471
  */
3388
- updateShapes<T extends TLUnknownShape>(partials: (null | TLShapePartial<T> | undefined)[]): this;
3472
+ updateShapes<T extends TLShape>(partials: (null | TLShapePartial<T> | undefined)[]): this;
3389
3473
  /* Excluded from this release type: _updateShapes */
3390
3474
  /* Excluded from this release type: _getUnlockedShapeIds */
3391
3475
  /**
@@ -3700,59 +3784,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3700
3784
  url: string;
3701
3785
  width: number;
3702
3786
  }>;
3703
- /**
3704
- * The app's current input state.
3705
- *
3706
- * @public
3707
- */
3708
- inputs: {
3709
- /** A set containing the currently pressed buttons. */
3710
- buttons: Set<number>;
3711
- /** A set containing the currently pressed keys. */
3712
- keys: Set<string>;
3713
- /** The most recent pointer down's position in screen space. */
3714
- originScreenPoint: Vec;
3715
- /** The most recent pointer down's position in the current page space. */
3716
- originPagePoint: Vec;
3717
- /** The most recent pointer position in screen space. */
3718
- currentScreenPoint: Vec;
3719
- /** The most recent pointer position in the current page space. */
3720
- currentPagePoint: Vec;
3721
- /** The previous pointer position in screen space. */
3722
- previousScreenPoint: Vec;
3723
- /** The previous pointer position in the current page space. */
3724
- previousPagePoint: Vec;
3725
- /** Velocity of mouse pointer, in pixels per millisecond */
3726
- pointerVelocity: Vec;
3727
- /** Whether the alt or option key is currently pressed. */
3728
- altKey: boolean;
3729
- /** Whether the control or command key is currently pressed. */
3730
- ctrlKey: boolean;
3731
- /** Whether the input is from a pe. */
3732
- isPen: boolean;
3733
- /** Whether the meta key is currently pressed. */
3734
- metaKey: boolean;
3735
- /** Whether the shift key is currently pressed. */
3736
- shiftKey: boolean;
3737
- /** Whether the user is dragging. */
3738
- isDragging: boolean;
3739
- /** Whether the user is editing. */
3740
- isEditing: boolean;
3741
- /** Whether the user is panning. */
3742
- isPanning: boolean;
3743
- /** Whether the user is pinching. */
3744
- isPinching: boolean;
3745
- /** Whether the user is pointing. */
3746
- isPointing: boolean;
3747
- /** Whether the user is spacebar panning. */
3748
- isSpacebarPanning: boolean;
3749
- };
3750
- /**
3751
- * Update the input points from a pointer, pinch, or wheel event.
3752
- *
3753
- * @param info - The event info.
3754
- */
3755
- private _updateInputsFromEvent;
3756
3787
  /**
3757
3788
  * Dispatch a cancel event.
3758
3789
  *
@@ -3998,7 +4029,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3998
4029
  /* Excluded from this release type: _metaKeyTimeout */
3999
4030
  /* Excluded from this release type: _setMetaKeyTimeout */
4000
4031
  /* Excluded from this release type: _restoreToolId */
4001
- /* Excluded from this release type: _pinchStart */
4002
4032
  /* Excluded from this release type: _didPinch */
4003
4033
  /* Excluded from this release type: _selectedShapeIdsAtPointerDown */
4004
4034
  /* Excluded from this release type: _longPressTimeout */
@@ -4073,7 +4103,7 @@ export declare class EditorAtom<T> {
4073
4103
  export declare const EditorContext: React_3.Context<Editor | null>;
4074
4104
 
4075
4105
  /** @public @react */
4076
- export declare function EditorProvider({ editor, children }: EditorProviderProps): JSX_2.Element;
4106
+ export declare function EditorProvider({ editor, children }: EditorProviderProps): JSX.Element;
4077
4107
 
4078
4108
  /** @public */
4079
4109
  export declare interface EditorProviderProps {
@@ -4104,7 +4134,7 @@ export declare class Ellipse2d extends Geometry2d {
4104
4134
  }
4105
4135
 
4106
4136
  /** @public */
4107
- export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithRef<React_2.PropsWithChildren<TLErrorBoundaryProps>>, {
4137
+ export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithChildren<TLErrorBoundaryProps>, {
4108
4138
  error: Error | null;
4109
4139
  }> {
4110
4140
  static getDerivedStateFromError(error: Error): {
@@ -4114,11 +4144,11 @@ export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithRe
4114
4144
  error: null;
4115
4145
  };
4116
4146
  componentDidCatch(error: unknown): void;
4117
- render(): boolean | JSX_2.Element | Iterable<React_2.ReactNode> | null | number | string | undefined;
4147
+ render(): bigint | boolean | JSX.Element | Iterable<React_2.ReactNode> | null | number | Promise<bigint | boolean | Iterable<React_2.ReactNode> | null | number | React_2.ReactElement<unknown, React_2.JSXElementConstructor<any> | string> | React_2.ReactPortal | string | undefined> | string | undefined;
4118
4148
  }
4119
4149
 
4120
4150
  /** @public @react */
4121
- export declare function ErrorScreen({ children }: LoadingScreenProps): JSX_2.Element;
4151
+ export declare function ErrorScreen({ children }: LoadingScreenProps): JSX.Element;
4122
4152
 
4123
4153
  /** @public */
4124
4154
  export declare const EVENT_NAME_MAP: Record<Exclude<TLEventName, TLPinchEventName>, keyof TLEventHandlers>;
@@ -4418,8 +4448,8 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
4418
4448
  canResizeChildren(): boolean;
4419
4449
  getDefaultProps(): TLGroupShape['props'];
4420
4450
  getGeometry(shape: TLGroupShape): Geometry2d;
4421
- component(shape: TLGroupShape): JSX_2.Element | null;
4422
- indicator(shape: TLGroupShape): JSX_2.Element;
4451
+ component(shape: TLGroupShape): JSX.Element | null;
4452
+ indicator(shape: TLGroupShape): JSX.Element;
4423
4453
  onChildrenChange(group: TLGroupShape): void;
4424
4454
  }
4425
4455
 
@@ -4523,7 +4553,7 @@ export declare class HistoryManager<R extends UnknownRecord> {
4523
4553
  }
4524
4554
 
4525
4555
  /** @public @react */
4526
- export declare function HTMLContainer({ children, className, ...rest }: HTMLContainerProps): JSX_2.Element;
4556
+ export declare function HTMLContainer({ children, className, ...rest }: HTMLContainerProps): JSX.Element;
4527
4557
 
4528
4558
  /** @public */
4529
4559
  export declare type HTMLContainerProps = React_2.HTMLAttributes<HTMLDivElement>;
@@ -4531,6 +4561,248 @@ export declare type HTMLContainerProps = React_2.HTMLAttributes<HTMLDivElement>;
4531
4561
  /** @public */
4532
4562
  export declare const inlineBase64AssetStore: TLAssetStore;
4533
4563
 
4564
+ /** @public */
4565
+ export declare class InputsManager {
4566
+ private readonly editor;
4567
+ constructor(editor: Editor);
4568
+ private _originPagePoint;
4569
+ /**
4570
+ * The most recent pointer down's position in the current page space.
4571
+ */
4572
+ getOriginPagePoint(): Vec;
4573
+ /**
4574
+ * @deprecated Use `getOriginPagePoint()` instead.
4575
+ */
4576
+ get originPagePoint(): Vec;
4577
+ private _originScreenPoint;
4578
+ /**
4579
+ * The most recent pointer down's position in screen space.
4580
+ */
4581
+ getOriginScreenPoint(): Vec;
4582
+ /**
4583
+ * @deprecated Use `getOriginScreenPoint()` instead.
4584
+ */
4585
+ get originScreenPoint(): Vec;
4586
+ private _previousPagePoint;
4587
+ /**
4588
+ * The previous pointer position in the current page space.
4589
+ */
4590
+ getPreviousPagePoint(): Vec;
4591
+ /**
4592
+ * @deprecated Use `getPreviousPagePoint()` instead.
4593
+ */
4594
+ get previousPagePoint(): Vec;
4595
+ private _previousScreenPoint;
4596
+ /**
4597
+ * The previous pointer position in screen space.
4598
+ */
4599
+ getPreviousScreenPoint(): Vec;
4600
+ /**
4601
+ * @deprecated Use `getPreviousScreenPoint()` instead.
4602
+ */
4603
+ get previousScreenPoint(): Vec;
4604
+ private _currentPagePoint;
4605
+ /**
4606
+ * The most recent pointer position in the current page space.
4607
+ */
4608
+ getCurrentPagePoint(): Vec;
4609
+ /**
4610
+ * @deprecated Use `getCurrentPagePoint()` instead.
4611
+ */
4612
+ get currentPagePoint(): Vec;
4613
+ private _currentScreenPoint;
4614
+ /**
4615
+ * The most recent pointer position in screen space.
4616
+ */
4617
+ getCurrentScreenPoint(): Vec;
4618
+ /**
4619
+ * @deprecated Use `getCurrentScreenPoint()` instead.
4620
+ */
4621
+ get currentScreenPoint(): Vec;
4622
+ private _pointerVelocity;
4623
+ /**
4624
+ * Velocity of mouse pointer, in pixels per millisecond.
4625
+ */
4626
+ getPointerVelocity(): Vec;
4627
+ /**
4628
+ * @deprecated Use `getPointerVelocity()` instead.
4629
+ */
4630
+ get pointerVelocity(): Vec;
4631
+ /* Excluded from this release type: setPointerVelocity */
4632
+ /**
4633
+ * A set containing the currently pressed keys.
4634
+ */
4635
+ readonly keys: AtomSet<string>;
4636
+ /**
4637
+ * A set containing the currently pressed buttons.
4638
+ */
4639
+ readonly buttons: AtomSet<number>;
4640
+ private _isPen;
4641
+ /**
4642
+ * Whether the input is from a pen.
4643
+ */
4644
+ getIsPen(): boolean;
4645
+ /**
4646
+ * @deprecated Use `getIsPen()` instead.
4647
+ */
4648
+ get isPen(): boolean;
4649
+ set isPen(isPen: boolean);
4650
+ /**
4651
+ * @param isPen - Whether the input is from a pen.
4652
+ */
4653
+ setIsPen(isPen: boolean): void;
4654
+ private _shiftKey;
4655
+ /**
4656
+ * Whether the shift key is currently pressed.
4657
+ */
4658
+ getShiftKey(): boolean;
4659
+ /**
4660
+ * @deprecated Use `getShiftKey()` instead.
4661
+ */
4662
+ get shiftKey(): boolean;
4663
+ set shiftKey(shiftKey: boolean);
4664
+ /* Excluded from this release type: setShiftKey */
4665
+ private _metaKey;
4666
+ /**
4667
+ * Whether the meta key is currently pressed.
4668
+ */
4669
+ getMetaKey(): boolean;
4670
+ /**
4671
+ * @deprecated Use `getMetaKey()` instead.
4672
+ */
4673
+ get metaKey(): boolean;
4674
+ set metaKey(metaKey: boolean);
4675
+ /* Excluded from this release type: setMetaKey */
4676
+ private _ctrlKey;
4677
+ /**
4678
+ * Whether the ctrl or command key is currently pressed.
4679
+ */
4680
+ getCtrlKey(): boolean;
4681
+ /**
4682
+ * @deprecated Use `getCtrlKey()` instead.
4683
+ */
4684
+ get ctrlKey(): boolean;
4685
+ set ctrlKey(ctrlKey: boolean);
4686
+ /* Excluded from this release type: setCtrlKey */
4687
+ private _altKey;
4688
+ /**
4689
+ * Whether the alt or option key is currently pressed.
4690
+ */
4691
+ getAltKey(): boolean;
4692
+ /**
4693
+ * @deprecated Use `getAltKey()` instead.
4694
+ */
4695
+ get altKey(): boolean;
4696
+ set altKey(altKey: boolean);
4697
+ /* Excluded from this release type: setAltKey */
4698
+ /**
4699
+ * Is the accelerator key (cmd on mac, ctrl elsewhere) currently pressed.
4700
+ */
4701
+ getAccelKey(): boolean;
4702
+ /**
4703
+ * @deprecated Use `getAccelKey()` instead.
4704
+ */
4705
+ get accelKey(): boolean;
4706
+ private _isDragging;
4707
+ /**
4708
+ * Whether the user is dragging.
4709
+ */
4710
+ getIsDragging(): boolean;
4711
+ /**
4712
+ * Soon to be deprecated, use `getIsDragging()` instead.
4713
+ */
4714
+ get isDragging(): boolean;
4715
+ set isDragging(isDragging: boolean);
4716
+ /**
4717
+ * @param isDragging - Whether the user is dragging.
4718
+ */
4719
+ setIsDragging(isDragging: boolean): void;
4720
+ private _isPointing;
4721
+ /**
4722
+ * Whether the user is pointing.
4723
+ */
4724
+ getIsPointing(): boolean;
4725
+ /**
4726
+ * @deprecated Use `getIsPointing()` instead.
4727
+ */
4728
+ get isPointing(): boolean;
4729
+ set isPointing(isPointing: boolean);
4730
+ /* Excluded from this release type: setIsPointing */
4731
+ private _isPinching;
4732
+ /**
4733
+ * Whether the user is pinching.
4734
+ */
4735
+ getIsPinching(): boolean;
4736
+ /**
4737
+ * @deprecated Use `getIsPinching()` instead.
4738
+ */
4739
+ get isPinching(): boolean;
4740
+ set isPinching(isPinching: boolean);
4741
+ /* Excluded from this release type: setIsPinching */
4742
+ private _isEditing;
4743
+ /**
4744
+ * Whether the user is editing.
4745
+ */
4746
+ getIsEditing(): boolean;
4747
+ /**
4748
+ * @deprecated Use `getIsEditing()` instead.
4749
+ */
4750
+ get isEditing(): boolean;
4751
+ set isEditing(isEditing: boolean);
4752
+ /**
4753
+ * @param isEditing - Whether the user is editing.
4754
+ */
4755
+ setIsEditing(isEditing: boolean): void;
4756
+ private _isPanning;
4757
+ /**
4758
+ * Whether the user is panning.
4759
+ */
4760
+ getIsPanning(): boolean;
4761
+ /**
4762
+ * @deprecated Use `getIsPanning()` instead.
4763
+ */
4764
+ get isPanning(): boolean;
4765
+ set isPanning(isPanning: boolean);
4766
+ /* Excluded from this release type: setIsPanning */
4767
+ private _isSpacebarPanning;
4768
+ /**
4769
+ * Whether the user is spacebar panning.
4770
+ */
4771
+ getIsSpacebarPanning(): boolean;
4772
+ /**
4773
+ * @deprecated Use `getIsSpacebarPanning()` instead.
4774
+ */
4775
+ get isSpacebarPanning(): boolean;
4776
+ set isSpacebarPanning(isSpacebarPanning: boolean);
4777
+ /* Excluded from this release type: setIsSpacebarPanning */
4778
+ private _getHasCollaborators;
4779
+ /* Excluded from this release type: _velocityPrevPoint */
4780
+ /* Excluded from this release type: updatePointerVelocity */
4781
+ /* Excluded from this release type: updateFromEvent */
4782
+ toJson(): {
4783
+ altKey: boolean;
4784
+ buttons: number[];
4785
+ ctrlKey: boolean;
4786
+ currentPagePoint: VecModel;
4787
+ currentScreenPoint: VecModel;
4788
+ isDragging: boolean;
4789
+ isEditing: boolean;
4790
+ isPanning: boolean;
4791
+ isPen: boolean;
4792
+ isPinching: boolean;
4793
+ isPointing: boolean;
4794
+ isSpacebarPanning: boolean;
4795
+ keys: string[];
4796
+ metaKey: boolean;
4797
+ originPagePoint: VecModel;
4798
+ originScreenPoint: VecModel;
4799
+ pointerVelocity: VecModel;
4800
+ previousPagePoint: VecModel;
4801
+ previousScreenPoint: VecModel;
4802
+ shiftKey: boolean;
4803
+ };
4804
+ }
4805
+
4534
4806
  /**
4535
4807
  * Find the intersections between a circle and a circle.
4536
4808
  *
@@ -4660,7 +4932,7 @@ export declare function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeI
4660
4932
  export declare function linesIntersect(A: VecLike, B: VecLike, C: VecLike, D: VecLike): boolean;
4661
4933
 
4662
4934
  /** @public @react */
4663
- export declare function LoadingScreen({ children }: LoadingScreenProps): JSX_2.Element;
4935
+ export declare function LoadingScreen({ children }: LoadingScreenProps): JSX.Element;
4664
4936
 
4665
4937
  /** @public */
4666
4938
  export declare interface LoadingScreenProps {
@@ -4778,7 +5050,7 @@ export declare function maybeSnapToGrid(point: Vec, editor: Editor): Vec;
4778
5050
  *
4779
5051
  * @public @react
4780
5052
  */
4781
- export declare function MenuClickCapture(): false | JSX_2.Element;
5053
+ export declare function MenuClickCapture(): false | JSX.Element;
4782
5054
 
4783
5055
  /* Excluded from this release type: normalizeWheel */
4784
5056
 
@@ -5116,7 +5388,7 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
5116
5388
  export declare function setUserPreferences(user: TLUserPreferences): void;
5117
5389
 
5118
5390
  /** @public */
5119
- export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
5391
+ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5120
5392
  editor: Editor;
5121
5393
  /** Configure this shape utils {@link ShapeUtil.options | `options`}. */
5122
5394
  static configure<T extends TLShapeUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
@@ -5211,20 +5483,20 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5211
5483
  * @param shape - The shape.
5212
5484
  * @public
5213
5485
  */
5214
- canSnap(_shape: Shape): boolean;
5486
+ canSnap(shape: Shape): boolean;
5215
5487
  /**
5216
5488
  * Whether the shape can be tabbed to.
5217
5489
  *
5218
5490
  * @param shape - The shape.
5219
5491
  * @public
5220
5492
  */
5221
- canTabTo(_shape: Shape): boolean;
5493
+ canTabTo(shape: Shape): boolean;
5222
5494
  /**
5223
5495
  * Whether the shape can be scrolled while editing.
5224
5496
  *
5225
5497
  * @public
5226
5498
  */
5227
- canScroll(_shape: Shape): boolean;
5499
+ canScroll(shape: Shape): boolean;
5228
5500
  /**
5229
5501
  * Whether the shape can be bound to. See {@link TLShapeUtilCanBindOpts} for details.
5230
5502
  *
@@ -5236,31 +5508,37 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5236
5508
  *
5237
5509
  * @public
5238
5510
  */
5239
- canEdit(_shape: Shape): boolean;
5511
+ canEdit(shape: Shape, info: TLEditStartInfo): boolean;
5240
5512
  /**
5241
5513
  * Whether the shape can be resized.
5242
5514
  *
5243
5515
  * @public
5244
5516
  */
5245
- canResize(_shape: Shape): boolean;
5517
+ canResize(shape: Shape): boolean;
5246
5518
  /**
5247
5519
  * When the shape is resized, whether the shape's children should also be resized.
5248
5520
  *
5249
5521
  * @public
5250
5522
  */
5251
- canResizeChildren(_shape: Shape): boolean;
5523
+ canResizeChildren(shape: Shape): boolean;
5252
5524
  /**
5253
5525
  * Whether the shape can be edited in read-only mode.
5254
5526
  *
5255
5527
  * @public
5256
5528
  */
5257
- canEditInReadonly(_shape: Shape): boolean;
5529
+ canEditInReadonly(shape: Shape): boolean;
5530
+ /**
5531
+ * Whether the shape can be edited while locked or while an ancestor is locked.
5532
+ *
5533
+ * @public
5534
+ */
5535
+ canEditWhileLocked(shape: Shape): boolean;
5258
5536
  /**
5259
5537
  * Whether the shape can be cropped.
5260
5538
  *
5261
5539
  * @public
5262
5540
  */
5263
- canCrop(_shape: Shape): boolean;
5541
+ canCrop(shape: Shape): boolean;
5264
5542
  /**
5265
5543
  * Whether the shape can participate in layout functions such as alignment or distribution.
5266
5544
  *
@@ -5270,7 +5548,7 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5270
5548
  *
5271
5549
  * @public
5272
5550
  */
5273
- canBeLaidOut(_shape: Shape, _info: TLShapeUtilCanBeLaidOutOpts): boolean;
5551
+ canBeLaidOut(shape: Shape, info: TLShapeUtilCanBeLaidOutOpts): boolean;
5274
5552
  /**
5275
5553
  * Whether this shape can be culled. By default, shapes are culled for
5276
5554
  * performance reasons when they are outside of the viewport. Culled shapes are still rendered
@@ -5278,11 +5556,31 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5278
5556
  *
5279
5557
  * @param shape - The shape.
5280
5558
  */
5281
- canCull(_shape: Shape): boolean;
5559
+ canCull(shape: Shape): boolean;
5282
5560
  /* Excluded from this release type: providesBackgroundForChildren */
5283
5561
  /**
5284
5562
  * Get the clip path to apply to this shape's children.
5285
5563
  *
5564
+ * The returned points should define the **inner** clip boundary - the area where
5565
+ * children will be visible. If your shape has a stroke, you should inset the clip
5566
+ * path by half the stroke width so children are clipped to the inner edge of the
5567
+ * stroke rather than its center line.
5568
+ *
5569
+ * @example
5570
+ * ```ts
5571
+ * override getClipPath(shape: MyShape): Vec[] | undefined {
5572
+ * const strokeWidth = 2
5573
+ * const inset = strokeWidth / 2
5574
+ * // Return points inset by half the stroke width
5575
+ * return [
5576
+ * new Vec(inset, inset),
5577
+ * new Vec(shape.props.w - inset, inset),
5578
+ * new Vec(shape.props.w - inset, shape.props.h - inset),
5579
+ * new Vec(inset, shape.props.h - inset),
5580
+ * ]
5581
+ * }
5582
+ * ```
5583
+ *
5286
5584
  * @param shape - The shape to get the clip path for
5287
5585
  * @returns Array of points defining the clipping polygon in local coordinates, or undefined if no clipping
5288
5586
  * @public
@@ -5307,37 +5605,37 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5307
5605
  * @returns boolean indicating if this shape should hide in the minimap
5308
5606
  * @public
5309
5607
  */
5310
- hideInMinimap?(_shape: Shape): boolean;
5608
+ hideInMinimap?(shape: Shape): boolean;
5311
5609
  /**
5312
5610
  * Whether the shape should hide its resize handles when selected.
5313
5611
  *
5314
5612
  * @public
5315
5613
  */
5316
- hideResizeHandles(_shape: Shape): boolean;
5614
+ hideResizeHandles(shape: Shape): boolean;
5317
5615
  /**
5318
5616
  * Whether the shape should hide its rotation handles when selected.
5319
5617
  *
5320
5618
  * @public
5321
5619
  */
5322
- hideRotateHandle(_shape: Shape): boolean;
5620
+ hideRotateHandle(shape: Shape): boolean;
5323
5621
  /**
5324
5622
  * Whether the shape should hide its selection bounds background when selected.
5325
5623
  *
5326
5624
  * @public
5327
5625
  */
5328
- hideSelectionBoundsBg(_shape: Shape): boolean;
5626
+ hideSelectionBoundsBg(shape: Shape): boolean;
5329
5627
  /**
5330
5628
  * Whether the shape should hide its selection bounds foreground when selected.
5331
5629
  *
5332
5630
  * @public
5333
5631
  */
5334
- hideSelectionBoundsFg(_shape: Shape): boolean;
5632
+ hideSelectionBoundsFg(shape: Shape): boolean;
5335
5633
  /**
5336
5634
  * Whether the shape's aspect ratio is locked.
5337
5635
  *
5338
5636
  * @public
5339
5637
  */
5340
- isAspectRatioLocked(_shape: Shape): boolean;
5638
+ isAspectRatioLocked(shape: Shape): boolean;
5341
5639
  /**
5342
5640
  * By default, the bounds of an image export are the bounds of all the shapes it contains, plus
5343
5641
  * some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
@@ -5345,10 +5643,10 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5345
5643
  * useful in cases like annotating on top of an image, where you usually want to avoid extra
5346
5644
  * padding around the image if you don't need it.
5347
5645
  *
5348
- * @param _shape - The shape to check
5646
+ * @param shape - The shape to check
5349
5647
  * @returns True if this shape should be treated as an export bounds container
5350
5648
  */
5351
- isExportBoundsContainer(_shape: Shape): boolean;
5649
+ isExportBoundsContainer(shape: Shape): boolean;
5352
5650
  /* Excluded from this release type: backgroundComponent */
5353
5651
  /**
5354
5652
  * Get the interpolated props for an animating shape. This is an optional method.
@@ -5385,7 +5683,7 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5385
5683
  * @param type - The shape type.
5386
5684
  * @public
5387
5685
  */
5388
- canReceiveNewChildrenOfType(_shape: Shape, _type: TLShape['type']): boolean;
5686
+ canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
5389
5687
  /**
5390
5688
  * Get the shape as an SVG object.
5391
5689
  *
@@ -5418,14 +5716,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5418
5716
  * Get the geometry to use when snapping to this this shape in translate/resize operations. See
5419
5717
  * {@link BoundsSnapGeometry} for details.
5420
5718
  */
5421
- getBoundsSnapGeometry(_shape: Shape): BoundsSnapGeometry;
5719
+ getBoundsSnapGeometry(shape: Shape): BoundsSnapGeometry;
5422
5720
  /**
5423
5721
  * Get the geometry to use when snapping handles to this shape. See {@link HandleSnapGeometry}
5424
5722
  * for details.
5425
5723
  */
5426
- getHandleSnapGeometry(_shape: Shape): HandleSnapGeometry;
5427
- getText(_shape: Shape): string | undefined;
5428
- getAriaDescriptor(_shape: Shape): string | undefined;
5724
+ getHandleSnapGeometry(shape: Shape): HandleSnapGeometry;
5725
+ getText(shape: Shape): string | undefined;
5726
+ getAriaDescriptor(shape: Shape): string | undefined;
5429
5727
  /**
5430
5728
  * A callback called just before a shape is created. This method provides a last chance to modify
5431
5729
  * the created shape.
@@ -5783,6 +6081,8 @@ export declare class SnapManager {
5783
6081
  getCurrentCommonAncestor(): TLShapeId | undefined;
5784
6082
  }
5785
6083
 
6084
+ /* Excluded from this release type: SpatialIndexManager */
6085
+
5786
6086
  /** @public */
5787
6087
  export declare class Stadium2d extends Geometry2d {
5788
6088
  config: Omit<Geometry2dOptions, 'isClosed'> & {
@@ -5920,7 +6220,7 @@ export declare const stopEventPropagation: (e: any) => any;
5920
6220
  export declare function suffixSafeId(id: SafeId, suffix: string): SafeId;
5921
6221
 
5922
6222
  /** @public @react */
5923
- export declare function SVGContainer({ children, className, ...rest }: SVGContainerProps): JSX_2.Element;
6223
+ export declare function SVGContainer({ children, className, ...rest }: SVGContainerProps): JSX.Element;
5924
6224
 
5925
6225
  /** @public */
5926
6226
  export declare type SVGContainerProps = React_2.ComponentProps<'svg'>;
@@ -6018,6 +6318,8 @@ export declare class TextManager {
6018
6318
  }[];
6019
6319
  }
6020
6320
 
6321
+ /* Excluded from this release type: TickManager */
6322
+
6021
6323
  /**
6022
6324
  * This is the TipTap editor! Docs are {@link https://tiptap.dev/docs}.
6023
6325
  *
@@ -6041,7 +6343,7 @@ export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
6041
6343
  export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
6042
6344
 
6043
6345
  /** @public */
6044
- export declare type TLBaseBoxShape = TLBaseShape<string, {
6346
+ export declare type TLBaseBoxShape = ExtractShapeByProps<{
6045
6347
  h: number;
6046
6348
  w: number;
6047
6349
  }>;
@@ -6063,7 +6365,7 @@ export declare interface TLBaseExternalContent {
6063
6365
  }
6064
6366
 
6065
6367
  /** @public */
6066
- export declare interface TLBindingUtilConstructor<T extends TLUnknownBinding, U extends BindingUtil<T> = BindingUtil<T>> {
6368
+ export declare interface TLBindingUtilConstructor<T extends TLBinding, U extends BindingUtil<T> = BindingUtil<T>> {
6067
6369
  new (editor: Editor): U;
6068
6370
  type: T['type'];
6069
6371
  /** Validations for this binding's props. */
@@ -6569,6 +6871,33 @@ export declare interface TldrawOptions {
6569
6871
  * Branding name of the app, currently only used for adding aria-label for the application.
6570
6872
  */
6571
6873
  readonly branding?: string;
6874
+ /**
6875
+ * Whether to use debounced zoom level for certain rendering optimizations. When true,
6876
+ * `editor.getDebouncedZoomLevel()` returns a cached zoom value while the camera is moving,
6877
+ * reducing re-renders. When false, it always returns the current zoom level.
6878
+ */
6879
+ readonly debouncedZoom: boolean;
6880
+ /**
6881
+ * The number of shapes that must be on the page for the debounced zoom level to be used.
6882
+ * Defaults to 300 shapes.
6883
+ */
6884
+ readonly debouncedZoomThreshold: number;
6885
+ /**
6886
+ * Whether to allow spacebar panning. When true, the spacebar will pan the camera when held down.
6887
+ * When false, the spacebar will not pan the camera.
6888
+ */
6889
+ readonly spacebarPanning: boolean;
6890
+ /**
6891
+ * The default padding (in pixels) used when zooming to fit content in the viewport.
6892
+ * This affects methods like `zoomToFit()`, `zoomToSelection()`, and `zoomToBounds()`.
6893
+ * The actual padding used is the minimum of this value and 28% of the viewport width.
6894
+ * Defaults to 128 pixels.
6895
+ */
6896
+ readonly zoomToFitPadding: number;
6897
+ /**
6898
+ * The distance (in screen pixels) at which shapes snap to guides and other shapes.
6899
+ */
6900
+ readonly snapThreshold: number;
6572
6901
  }
6573
6902
 
6574
6903
  /** @public */
@@ -6614,7 +6943,7 @@ export declare interface TLEditorComponents {
6614
6943
  /** @public */
6615
6944
  export declare interface TLEditorOptions {
6616
6945
  /**
6617
- * The Store instance to use for keeping the app's data. This may be prepopulated, e.g. by loading
6946
+ * The Store instance to use for keeping the editor's data. This may be prepopulated, e.g. by loading
6618
6947
  * from a server or database.
6619
6948
  */
6620
6949
  store: TLStore;
@@ -6693,6 +7022,11 @@ export declare interface TLEditorSnapshot {
6693
7022
  session: TLSessionStateSnapshot;
6694
7023
  }
6695
7024
 
7025
+ /** @public */
7026
+ export declare interface TLEditStartInfo {
7027
+ type: 'click-header' | 'click' | 'double-click-corner' | 'double-click-edge' | 'double-click' | 'press_enter' | 'unknown';
7028
+ }
7029
+
6696
7030
  /** @public */
6697
7031
  export declare interface TLEmbedExternalContent<EmbedDefinition> extends TLBaseExternalContent {
6698
7032
  type: 'embed';
@@ -6705,6 +7039,8 @@ export declare type TLEnterEventHandler = (info: any, from: string) => void;
6705
7039
 
6706
7040
  /**
6707
7041
  * An object that contains information about the current device and environment.
7042
+ * This object is not reactive and will not update automatically when the environment changes,
7043
+ * so only include values that are fixed, such as the user's browser and operating system.
6708
7044
  *
6709
7045
  * @public
6710
7046
  */
@@ -6719,6 +7055,17 @@ export declare const tlenv: {
6719
7055
  isWebview: boolean;
6720
7056
  };
6721
7057
 
7058
+ /**
7059
+ * An atom that contains information about the current device and environment.
7060
+ * This object is reactive and will update automatically when the environment changes.
7061
+ * Use it for values that may change over time, such as the pointer type.
7062
+ *
7063
+ * @public
7064
+ */
7065
+ export declare const tlenvReactive: Atom< {
7066
+ isCoarsePointer: boolean;
7067
+ }, unknown>;
7068
+
6722
7069
  /** @public */
6723
7070
  export declare interface TLErrorBoundaryProps {
6724
7071
  children: React_2.ReactNode;
@@ -6782,6 +7129,7 @@ export declare interface TLEventMap {
6782
7129
  event: [TLEventInfo];
6783
7130
  tick: [number];
6784
7131
  frame: [number];
7132
+ resize: [BoxModel];
6785
7133
  'select-all-text': [{
6786
7134
  shapeId: TLShapeId;
6787
7135
  }];
@@ -6796,6 +7144,7 @@ export declare interface TLEventMap {
6796
7144
  'edited-shapes': [TLRecord[]];
6797
7145
  'deleted-shapes': [TLShapeId[]];
6798
7146
  edit: [];
7147
+ dispose: [];
6799
7148
  }
6800
7149
 
6801
7150
  /** @public */
@@ -7497,11 +7846,11 @@ export declare interface TLShapeUtilCanBeLaidOutOpts {
7497
7846
  *
7498
7847
  * @public
7499
7848
  */
7500
- export declare interface TLShapeUtilCanBindOpts<Shape extends TLUnknownShape = TLUnknownShape> {
7849
+ export declare interface TLShapeUtilCanBindOpts<Shape extends TLShape = TLShape> {
7501
7850
  /** The type of shape referenced by the `fromId` of the binding. */
7502
- fromShapeType: string;
7851
+ fromShapeType: TLShape['type'];
7503
7852
  /** The type of shape referenced by the `toId` of the binding. */
7504
- toShapeType: string;
7853
+ toShapeType: TLShape['type'];
7505
7854
  /** The type of binding. */
7506
7855
  bindingType: string;
7507
7856
  }
@@ -7513,7 +7862,7 @@ export declare interface TLShapeUtilCanvasSvgDef {
7513
7862
  }
7514
7863
 
7515
7864
  /** @public */
7516
- export declare interface TLShapeUtilConstructor<T extends TLUnknownShape, U extends ShapeUtil<T> = ShapeUtil<T>> {
7865
+ export declare interface TLShapeUtilConstructor<T extends TLShape, U extends ShapeUtil<T> = ShapeUtil<T>> {
7517
7866
  new (editor: Editor): U;
7518
7867
  type: T['type'];
7519
7868
  props?: RecordProps<T>;
@@ -7763,6 +8112,7 @@ export declare interface TLUserPreferences {
7763
8112
  isPasteAtCursorMode?: boolean | null;
7764
8113
  enhancedA11yMode?: boolean | null;
7765
8114
  inputMode?: 'mouse' | 'trackpad' | null;
8115
+ isZoomDirectionInverted?: boolean | null;
7766
8116
  }
7767
8117
 
7768
8118
  /** @public */
@@ -7893,10 +8243,10 @@ export declare function useMaybeEditor(): Editor | null;
7893
8243
  /* Excluded from this release type: useOnMount */
7894
8244
 
7895
8245
  /** @public */
7896
- export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement>): void;
8246
+ export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement | null>): void;
7897
8247
 
7898
8248
  /** @public */
7899
- export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement>): void;
8249
+ export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
7900
8250
 
7901
8251
  /**
7902
8252
  * @returns The list of peer UserIDs
@@ -7937,6 +8287,7 @@ export declare class UserPreferencesManager {
7937
8287
  isDynamicResizeMode: boolean;
7938
8288
  isSnapMode: boolean;
7939
8289
  isWrapMode: boolean;
8290
+ isZoomDirectionInverted: boolean;
7940
8291
  locale: string;
7941
8292
  name: string;
7942
8293
  };
@@ -7957,6 +8308,7 @@ export declare class UserPreferencesManager {
7957
8308
  getIsPasteAtCursorMode(): boolean;
7958
8309
  getEnhancedA11yMode(): boolean;
7959
8310
  getInputMode(): "mouse" | "trackpad" | null;
8311
+ getIsZoomDirectionInverted(): boolean;
7960
8312
  }
7961
8313
 
7962
8314
  /** @public */
@@ -8004,7 +8356,7 @@ export declare function useTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreS
8004
8356
  export declare function useTLStore(opts: TLStoreOptions): TLStore;
8005
8357
 
8006
8358
  /** @public */
8007
- export declare function useTransform(ref: React.RefObject<HTMLElement | SVGElement>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
8359
+ export declare function useTransform(ref: React.RefObject<HTMLElement | null | SVGElement>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
8008
8360
 
8009
8361
  /**
8010
8362
  * React's useId hook returns a unique id for the component. However, it uses a colon in the id,