@tldraw/editor 4.3.0-next.7f179bd04d6c → 4.3.0-next.842fb21476f2

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 (165) hide show
  1. package/dist-cjs/index.d.ts +441 -120
  2. package/dist-cjs/index.js +6 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/components/ErrorBoundary.js.map +1 -1
  5. package/dist-cjs/lib/components/GeometryDebuggingView.js +1 -17
  6. package/dist-cjs/lib/components/GeometryDebuggingView.js.map +2 -2
  7. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +3 -3
  8. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  9. package/dist-cjs/lib/constants.js +1 -3
  10. package/dist-cjs/lib/constants.js.map +2 -2
  11. package/dist-cjs/lib/editor/Editor.js +288 -275
  12. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  13. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js +18 -17
  14. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +3 -3
  15. package/dist-cjs/lib/editor/derivations/parentsToChildren.js +12 -3
  16. package/dist-cjs/lib/editor/derivations/parentsToChildren.js.map +2 -2
  17. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +1 -1
  18. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +2 -2
  19. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +5 -6
  20. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +2 -2
  21. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +591 -0
  22. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +7 -0
  23. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +1 -1
  24. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
  25. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +1 -22
  26. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +2 -2
  27. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +31 -23
  28. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  29. package/dist-cjs/lib/editor/shapes/group/DashedOutlineBox.js +1 -1
  30. package/dist-cjs/lib/editor/shapes/group/DashedOutlineBox.js.map +2 -2
  31. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js +3 -3
  32. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +2 -2
  33. package/dist-cjs/lib/exports/parseCss.js +1 -1
  34. package/dist-cjs/lib/exports/parseCss.js.map +2 -2
  35. package/dist-cjs/lib/globals/environment.js +45 -9
  36. package/dist-cjs/lib/globals/environment.js.map +2 -2
  37. package/dist-cjs/lib/hooks/useCoarsePointer.js +14 -29
  38. package/dist-cjs/lib/hooks/useCoarsePointer.js.map +2 -2
  39. package/dist-cjs/lib/hooks/useEvent.js +1 -1
  40. package/dist-cjs/lib/hooks/useEvent.js.map +2 -2
  41. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
  42. package/dist-cjs/lib/hooks/useGestureEvents.js +1 -1
  43. package/dist-cjs/lib/hooks/useGestureEvents.js.map +2 -2
  44. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +2 -2
  45. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  46. package/dist-cjs/lib/hooks/useScreenBounds.js.map +2 -2
  47. package/dist-cjs/lib/hooks/useStateAttribute.js +4 -1
  48. package/dist-cjs/lib/hooks/useStateAttribute.js.map +2 -2
  49. package/dist-cjs/lib/hooks/useTransform.js.map +1 -1
  50. package/dist-cjs/lib/hooks/useZoomCss.js +4 -8
  51. package/dist-cjs/lib/hooks/useZoomCss.js.map +2 -2
  52. package/dist-cjs/lib/options.js +6 -1
  53. package/dist-cjs/lib/options.js.map +2 -2
  54. package/dist-cjs/lib/primitives/Box.js +3 -0
  55. package/dist-cjs/lib/primitives/Box.js.map +2 -2
  56. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +1 -0
  57. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
  58. package/dist-cjs/lib/utils/rotation.js +1 -1
  59. package/dist-cjs/lib/utils/rotation.js.map +2 -2
  60. package/dist-cjs/version.js +3 -3
  61. package/dist-cjs/version.js.map +1 -1
  62. package/dist-esm/index.d.mts +441 -120
  63. package/dist-esm/index.mjs +7 -2
  64. package/dist-esm/index.mjs.map +2 -2
  65. package/dist-esm/lib/components/ErrorBoundary.mjs.map +1 -1
  66. package/dist-esm/lib/components/GeometryDebuggingView.mjs +1 -17
  67. package/dist-esm/lib/components/GeometryDebuggingView.mjs.map +2 -2
  68. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +3 -3
  69. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  70. package/dist-esm/lib/constants.mjs +1 -3
  71. package/dist-esm/lib/constants.mjs.map +2 -2
  72. package/dist-esm/lib/editor/Editor.mjs +289 -278
  73. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  74. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs +18 -17
  75. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +3 -3
  76. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs +13 -4
  77. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs.map +2 -2
  78. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +1 -1
  79. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +2 -2
  80. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +5 -6
  81. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +2 -2
  82. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +573 -0
  83. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +7 -0
  84. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +1 -1
  85. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
  86. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +1 -22
  87. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +2 -2
  88. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +31 -23
  89. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  90. package/dist-esm/lib/editor/shapes/group/DashedOutlineBox.mjs +1 -1
  91. package/dist-esm/lib/editor/shapes/group/DashedOutlineBox.mjs.map +2 -2
  92. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs +3 -3
  93. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +2 -2
  94. package/dist-esm/lib/exports/parseCss.mjs +1 -1
  95. package/dist-esm/lib/exports/parseCss.mjs.map +2 -2
  96. package/dist-esm/lib/globals/environment.mjs +45 -9
  97. package/dist-esm/lib/globals/environment.mjs.map +2 -2
  98. package/dist-esm/lib/hooks/useCoarsePointer.mjs +15 -30
  99. package/dist-esm/lib/hooks/useCoarsePointer.mjs.map +2 -2
  100. package/dist-esm/lib/hooks/useEvent.mjs +1 -1
  101. package/dist-esm/lib/hooks/useEvent.mjs.map +2 -2
  102. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
  103. package/dist-esm/lib/hooks/useGestureEvents.mjs +1 -1
  104. package/dist-esm/lib/hooks/useGestureEvents.mjs.map +2 -2
  105. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +2 -2
  106. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  107. package/dist-esm/lib/hooks/useScreenBounds.mjs.map +2 -2
  108. package/dist-esm/lib/hooks/useStateAttribute.mjs +4 -1
  109. package/dist-esm/lib/hooks/useStateAttribute.mjs.map +2 -2
  110. package/dist-esm/lib/hooks/useTransform.mjs.map +1 -1
  111. package/dist-esm/lib/hooks/useZoomCss.mjs +4 -8
  112. package/dist-esm/lib/hooks/useZoomCss.mjs.map +2 -2
  113. package/dist-esm/lib/options.mjs +6 -1
  114. package/dist-esm/lib/options.mjs.map +2 -2
  115. package/dist-esm/lib/primitives/Box.mjs +3 -0
  116. package/dist-esm/lib/primitives/Box.mjs.map +2 -2
  117. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +1 -0
  118. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
  119. package/dist-esm/lib/utils/rotation.mjs +1 -1
  120. package/dist-esm/lib/utils/rotation.mjs.map +2 -2
  121. package/dist-esm/version.mjs +3 -3
  122. package/dist-esm/version.mjs.map +1 -1
  123. package/editor.css +14 -12
  124. package/package.json +18 -16
  125. package/src/index.ts +4 -1
  126. package/src/lib/components/ErrorBoundary.tsx +1 -1
  127. package/src/lib/components/GeometryDebuggingView.tsx +1 -19
  128. package/src/lib/components/default-components/DefaultCanvas.tsx +3 -3
  129. package/src/lib/config/TLUserPreferences.test.ts +40 -0
  130. package/src/lib/constants.ts +0 -2
  131. package/src/lib/editor/Editor.test.ts +140 -0
  132. package/src/lib/editor/Editor.ts +374 -321
  133. package/src/lib/editor/derivations/notVisibleShapes.ts +37 -23
  134. package/src/lib/editor/derivations/parentsToChildren.ts +18 -7
  135. package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +17 -31
  136. package/src/lib/editor/managers/ClickManager/ClickManager.ts +1 -1
  137. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +129 -79
  138. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +10 -6
  139. package/src/lib/editor/managers/InputsManager/InputsManager.ts +566 -0
  140. package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +0 -4
  141. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +12 -0
  142. package/src/lib/editor/managers/SnapManager/SnapManager.ts +1 -1
  143. package/src/lib/editor/managers/TickManager/TickManager.test.ts +40 -107
  144. package/src/lib/editor/managers/TickManager/TickManager.ts +2 -32
  145. package/src/lib/editor/shapes/ShapeUtil.ts +67 -24
  146. package/src/lib/editor/shapes/group/DashedOutlineBox.tsx +1 -1
  147. package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +3 -3
  148. package/src/lib/exports/parseCss.test.ts +1 -0
  149. package/src/lib/exports/parseCss.ts +1 -1
  150. package/src/lib/globals/environment.ts +65 -10
  151. package/src/lib/hooks/useCoarsePointer.ts +16 -59
  152. package/src/lib/hooks/useEvent.tsx +1 -1
  153. package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +1 -1
  154. package/src/lib/hooks/useGestureEvents.ts +2 -2
  155. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +1 -1
  156. package/src/lib/hooks/usePassThroughWheelEvents.ts +1 -1
  157. package/src/lib/hooks/useScreenBounds.ts +1 -1
  158. package/src/lib/hooks/useStateAttribute.ts +4 -1
  159. package/src/lib/hooks/useTransform.ts +1 -1
  160. package/src/lib/hooks/useZoomCss.ts +3 -8
  161. package/src/lib/options.ts +32 -0
  162. package/src/lib/primitives/Box.ts +9 -0
  163. package/src/lib/primitives/geometry/Geometry2d.ts +1 -0
  164. package/src/lib/utils/rotation.ts +1 -1
  165. 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';
@@ -9,10 +10,11 @@ import EventEmitter from 'eventemitter3';
9
10
  import { ExoticComponent } from 'react';
10
11
  import { ExtractShapeByProps } from '@tldraw/tlschema';
11
12
  import { ForwardRefExoticComponent } from 'react';
13
+ import { FragmentProps } from 'react';
12
14
  import { HistoryEntry } from '@tldraw/store';
13
15
  import { IndexKey } from '@tldraw/utils';
14
16
  import { JsonObject } from '@tldraw/utils';
15
- import { JSX as JSX_2 } from 'react/jsx-runtime';
17
+ import { JSX } from 'react/jsx-runtime';
16
18
  import { LegacyMigrations } from '@tldraw/store';
17
19
  import { MigrationSequence } from '@tldraw/store';
18
20
  import { NamedExoticComponent } from 'react';
@@ -488,6 +490,7 @@ export declare class Box {
488
490
  get cornersAndCenter(): Vec[];
489
491
  get sides(): Array<[Vec, Vec]>;
490
492
  get size(): Vec;
493
+ isValid(): boolean;
491
494
  toFixed(): this;
492
495
  setTo(B: Box): this;
493
496
  set(x?: number, y?: number, w?: number, h?: number): this;
@@ -655,7 +658,7 @@ export declare function clockwiseAngleDist(a0: number, a1: number): number;
655
658
  * @public
656
659
  * @react
657
660
  */
658
- export declare function ContainerProvider({ container, children }: ContainerProviderProps): JSX_2.Element;
661
+ export declare function ContainerProvider({ container, children }: ContainerProviderProps): JSX.Element;
659
662
 
660
663
  /** @public */
661
664
  export declare interface ContainerProviderProps {
@@ -796,16 +799,16 @@ export declare interface DebugFlagDefaults<T> {
796
799
  /* Excluded from this release type: DEFAULT_CAMERA_OPTIONS */
797
800
 
798
801
  /** @public @react */
799
- export declare function DefaultBackground(): JSX_2.Element;
802
+ export declare function DefaultBackground(): JSX.Element;
800
803
 
801
804
  /** @public @react */
802
- export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX_2.Element;
805
+ export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX.Element;
803
806
 
804
807
  /** @public @react */
805
- export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX_2.Element;
808
+ export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
806
809
 
807
810
  /** @public @react */
808
- 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;
809
812
 
810
813
  /** @public @react */
811
814
  export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
@@ -814,22 +817,22 @@ export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
814
817
  export declare const DefaultErrorFallback: TLErrorFallbackComponent;
815
818
 
816
819
  /** @public @react */
817
- export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX_2.Element;
820
+ export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
818
821
 
819
822
  /** @public @react */
820
- export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX_2.Element;
823
+ export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX.Element;
821
824
 
822
825
  /** @public @react */
823
- export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX_2.Element;
826
+ export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX.Element;
824
827
 
825
828
  /** @public @react */
826
- 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;
827
830
 
828
831
  /** @public @react */
829
- export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX_2.Element;
832
+ export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX.Element;
830
833
 
831
834
  /** @public @react */
832
- export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX_2.Element;
835
+ export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX.Element;
833
836
 
834
837
  /** @public @react */
835
838
  export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicatorProps>;
@@ -841,10 +844,10 @@ export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicat
841
844
  export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
842
845
 
843
846
  /** @public @react */
844
- export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX_2.Element;
847
+ export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX.Element;
845
848
 
846
849
  /** @public @react */
847
- export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX_2.Element;
850
+ export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX.Element;
848
851
 
849
852
  /** @public @react */
850
853
  export declare const DefaultSvgDefs: () => null;
@@ -863,6 +866,8 @@ export declare const defaultTldrawOptions: {
863
866
  readonly collaboratorIdleTimeoutMs: 3000;
864
867
  readonly collaboratorInactiveTimeoutMs: 60000;
865
868
  readonly createTextOnCanvasDoubleClick: true;
869
+ readonly debouncedZoom: true;
870
+ readonly debouncedZoomThreshold: 500;
866
871
  readonly defaultSvgPadding: 32;
867
872
  readonly doubleClickDurationMs: 450;
868
873
  readonly dragDistanceSquared: 16;
@@ -871,9 +876,7 @@ export declare const defaultTldrawOptions: {
871
876
  readonly edgeScrollEaseDuration: 200;
872
877
  readonly edgeScrollSpeed: 25;
873
878
  readonly enableToolbarKeyboardShortcuts: true;
874
- readonly exportProvider: ExoticComponent< {
875
- children?: ReactNode | undefined;
876
- }>;
879
+ readonly exportProvider: ExoticComponent<FragmentProps>;
877
880
  readonly flattenImageBoundsExpand: 64;
878
881
  readonly flattenImageBoundsPadding: 16;
879
882
  readonly followChaseViewportSnap: 2;
@@ -905,11 +908,14 @@ export declare const defaultTldrawOptions: {
905
908
  readonly maxShapesPerPage: 4000;
906
909
  readonly multiClickDurationMs: 200;
907
910
  readonly nonce: undefined;
911
+ readonly snapThreshold: 8;
912
+ readonly spacebarPanning: true;
908
913
  readonly temporaryAssetPreviewLifetimeMs: 180000;
909
914
  readonly textShadowLod: 0.35;
910
915
  readonly tooltipDelayMs: 700;
911
916
  readonly uiCoarseDragDistanceSquared: 625;
912
917
  readonly uiDragDistanceSquared: 16;
918
+ readonly zoomToFitPadding: 128;
913
919
  };
914
920
 
915
921
  /** @public */
@@ -983,6 +989,7 @@ export declare class EdgeScrollManager {
983
989
  constructor(editor: Editor);
984
990
  private _isEdgeScrolling;
985
991
  private _edgeScrollDuration;
992
+ getIsEdgeScrolling(): boolean;
986
993
  /**
987
994
  * Update the camera position when the mouse is close to the edge of the screen.
988
995
  * Run this on every tick when in a state where edge scrolling is enabled.
@@ -1041,7 +1048,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1041
1048
  */
1042
1049
  removeTool(Tool: TLStateNodeConstructor, parent?: StateNode): void;
1043
1050
  /**
1044
- * A set of functions to call when the app is disposed.
1051
+ * A set of functions to call when the editor is disposed.
1045
1052
  *
1046
1053
  * @public
1047
1054
  */
@@ -1054,7 +1061,13 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1054
1061
  isDisposed: boolean;
1055
1062
  /* Excluded from this release type: _tickManager */
1056
1063
  /**
1057
- * A manager for the app's snapping feature.
1064
+ * A manager for the editor's input state.
1065
+ *
1066
+ * @public
1067
+ */
1068
+ readonly inputs: InputsManager;
1069
+ /**
1070
+ * A manager for the editor's snapping feature.
1058
1071
  *
1059
1072
  * @public
1060
1073
  */
@@ -1195,7 +1208,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1195
1208
  } | S): BindingUtil<S>;
1196
1209
  getBindingUtil<T extends BindingUtil>(type: T extends BindingUtil<infer R> ? R['type'] : string): T;
1197
1210
  /**
1198
- * A manager for the app's history.
1211
+ * A manager for the editor's history.
1199
1212
  *
1200
1213
  * @readonly
1201
1214
  */
@@ -1212,10 +1225,11 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1212
1225
  */
1213
1226
  undo(): this;
1214
1227
  /**
1215
- * Whether the app can undo.
1228
+ * Whether the editor can undo.
1216
1229
  *
1217
1230
  * @public
1218
1231
  */
1232
+ canUndo(): boolean;
1219
1233
  getCanUndo(): boolean;
1220
1234
  /**
1221
1235
  * Redo to the next mark.
@@ -1228,13 +1242,14 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1228
1242
  * @public
1229
1243
  */
1230
1244
  redo(): this;
1231
- clearHistory(): this;
1232
1245
  /**
1233
- * Whether the app can redo.
1246
+ * Whether the editor can redo.
1234
1247
  *
1235
1248
  * @public
1236
1249
  */
1250
+ canRedo(): boolean;
1237
1251
  getCanRedo(): boolean;
1252
+ clearHistory(): this;
1238
1253
  /**
1239
1254
  * Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
1240
1255
  * any redos. You typically want to do this just before a user interaction begins or is handled.
@@ -1593,7 +1608,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1593
1608
  */
1594
1609
  selectNone(): this;
1595
1610
  /**
1596
- * The id of the app's only selected shape.
1611
+ * The id of the editor's only selected shape.
1597
1612
  *
1598
1613
  * @returns Null if there is no shape or more than one selected shape, otherwise the selected shape's id.
1599
1614
  *
@@ -1602,7 +1617,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1602
1617
  */
1603
1618
  getOnlySelectedShapeId(): null | TLShapeId;
1604
1619
  /**
1605
- * The app's only selected shape.
1620
+ * The editor's only selected shape.
1606
1621
  *
1607
1622
  * @returns Null if there is no shape or more than one selected shape, otherwise the selected shape.
1608
1623
  *
@@ -1694,6 +1709,16 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1694
1709
  * @public
1695
1710
  */
1696
1711
  getEditingShape(): TLShape | undefined;
1712
+ /**
1713
+ * Whether the shape can be edited.
1714
+ *
1715
+ * @param shape - The shape (or shape id) to check if it can be edited.
1716
+ * @param info - The info about the edit start.
1717
+ *
1718
+ * @public
1719
+ * @returns true if the shape can be edited, false otherwise.
1720
+ */
1721
+ canEditShape<T extends TLShape | TLShapeId>(shape: null | T, info?: TLEditStartInfo): shape is T;
1697
1722
  /**
1698
1723
  * Set the current editing shape.
1699
1724
  *
@@ -1813,6 +1838,15 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1813
1838
  * @public
1814
1839
  */
1815
1840
  getCroppingShapeId(): null | TLShapeId;
1841
+ /**
1842
+ * Whether the shape can be cropped.
1843
+ *
1844
+ * @param shape - The shape (or shape id) to check if it can be cropped.
1845
+ *
1846
+ * @public
1847
+ * @returns true if the shape can be cropped, false otherwise.
1848
+ */
1849
+ canCropShape<T extends TLShape | TLShapeId>(shape: null | T): shape is T;
1816
1850
  /**
1817
1851
  * Set the current cropping shape.
1818
1852
  *
@@ -1855,6 +1889,32 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1855
1889
  * @public
1856
1890
  */
1857
1891
  getZoomLevel(): number;
1892
+ private _debouncedZoomLevel;
1893
+ /**
1894
+ * Get the debounced zoom level. When the camera is moving, this returns the zoom level
1895
+ * from when the camera started moving rather than the current zoom level. This can be
1896
+ * used to avoid expensive re-renders during camera movements.
1897
+ *
1898
+ * This behavior is controlled by the `useDebouncedZoom` option. When `useDebouncedZoom`
1899
+ * is `false`, this method always returns the current zoom level.
1900
+ *
1901
+ * @public
1902
+ */
1903
+ getDebouncedZoomLevel(): number;
1904
+ private _getAboveDebouncedZoomThreshold;
1905
+ /**
1906
+ * Get the efficient zoom level. This returns the current zoom level if there are less than 300 shapes on the page,
1907
+ * otherwise it returns the debounced zoom level. This can be used to avoid expensive re-renders during camera movements.
1908
+ *
1909
+ * @public
1910
+ * @example
1911
+ * ```ts
1912
+ * editor.getEfficientZoomLevel()
1913
+ * ```
1914
+ *
1915
+ * @public
1916
+ */
1917
+ getEfficientZoomLevel(): number;
1858
1918
  /**
1859
1919
  * Get the camera's initial or reset zoom level.
1860
1920
  *
@@ -1969,7 +2029,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1969
2029
  * ```ts
1970
2030
  * editor.zoomIn()
1971
2031
  * editor.zoomIn(editor.getViewportScreenCenter(), { animation: { duration: 200 } })
1972
- * editor.zoomIn(editor.inputs.currentScreenPoint, { animation: { duration: 200 } })
2032
+ * editor.zoomIn(editor.inputs.getCurrentScreenPoint(), { animation: { duration: 200 } })
1973
2033
  * ```
1974
2034
  *
1975
2035
  * @param point - The screen point to zoom in on. Defaults to the screen center
@@ -1985,7 +2045,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1985
2045
  * ```ts
1986
2046
  * editor.zoomOut()
1987
2047
  * editor.zoomOut(editor.getViewportScreenCenter(), { animation: { duration: 120 } })
1988
- * editor.zoomOut(editor.inputs.currentScreenPoint, { animation: { duration: 120 } })
2048
+ * editor.zoomOut(editor.inputs.getCurrentScreenPoint(), { animation: { duration: 120 } })
1989
2049
  * ```
1990
2050
  *
1991
2051
  * @param point - The point to zoom out on. Defaults to the viewport screen center.
@@ -2198,8 +2258,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2198
2258
  /* Excluded from this release type: getUnorderedRenderingShapes */
2199
2259
  private _cameraState;
2200
2260
  private _cameraStateTimeoutRemaining;
2201
- _decayCameraStateTimeout(elapsed: number): void;
2202
- _tickCameraState(): void;
2261
+ private _decayCameraStateTimeout;
2262
+ private _tickCameraState;
2203
2263
  /**
2204
2264
  * Whether the camera is moving or idle.
2205
2265
  *
@@ -3720,59 +3780,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3720
3780
  url: string;
3721
3781
  width: number;
3722
3782
  }>;
3723
- /**
3724
- * The app's current input state.
3725
- *
3726
- * @public
3727
- */
3728
- inputs: {
3729
- /** A set containing the currently pressed buttons. */
3730
- buttons: Set<number>;
3731
- /** A set containing the currently pressed keys. */
3732
- keys: Set<string>;
3733
- /** The most recent pointer down's position in screen space. */
3734
- originScreenPoint: Vec;
3735
- /** The most recent pointer down's position in the current page space. */
3736
- originPagePoint: Vec;
3737
- /** The most recent pointer position in screen space. */
3738
- currentScreenPoint: Vec;
3739
- /** The most recent pointer position in the current page space. */
3740
- currentPagePoint: Vec;
3741
- /** The previous pointer position in screen space. */
3742
- previousScreenPoint: Vec;
3743
- /** The previous pointer position in the current page space. */
3744
- previousPagePoint: Vec;
3745
- /** Velocity of mouse pointer, in pixels per millisecond */
3746
- pointerVelocity: Vec;
3747
- /** Whether the alt or option key is currently pressed. */
3748
- altKey: boolean;
3749
- /** Whether the control or command key is currently pressed. */
3750
- ctrlKey: boolean;
3751
- /** Whether the input is from a pe. */
3752
- isPen: boolean;
3753
- /** Whether the meta key is currently pressed. */
3754
- metaKey: boolean;
3755
- /** Whether the shift key is currently pressed. */
3756
- shiftKey: boolean;
3757
- /** Whether the user is dragging. */
3758
- isDragging: boolean;
3759
- /** Whether the user is editing. */
3760
- isEditing: boolean;
3761
- /** Whether the user is panning. */
3762
- isPanning: boolean;
3763
- /** Whether the user is pinching. */
3764
- isPinching: boolean;
3765
- /** Whether the user is pointing. */
3766
- isPointing: boolean;
3767
- /** Whether the user is spacebar panning. */
3768
- isSpacebarPanning: boolean;
3769
- };
3770
- /**
3771
- * Update the input points from a pointer, pinch, or wheel event.
3772
- *
3773
- * @param info - The event info.
3774
- */
3775
- private _updateInputsFromEvent;
3776
3783
  /**
3777
3784
  * Dispatch a cancel event.
3778
3785
  *
@@ -4018,7 +4025,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
4018
4025
  /* Excluded from this release type: _metaKeyTimeout */
4019
4026
  /* Excluded from this release type: _setMetaKeyTimeout */
4020
4027
  /* Excluded from this release type: _restoreToolId */
4021
- /* Excluded from this release type: _pinchStart */
4022
4028
  /* Excluded from this release type: _didPinch */
4023
4029
  /* Excluded from this release type: _selectedShapeIdsAtPointerDown */
4024
4030
  /* Excluded from this release type: _longPressTimeout */
@@ -4093,7 +4099,7 @@ export declare class EditorAtom<T> {
4093
4099
  export declare const EditorContext: React_3.Context<Editor | null>;
4094
4100
 
4095
4101
  /** @public @react */
4096
- export declare function EditorProvider({ editor, children }: EditorProviderProps): JSX_2.Element;
4102
+ export declare function EditorProvider({ editor, children }: EditorProviderProps): JSX.Element;
4097
4103
 
4098
4104
  /** @public */
4099
4105
  export declare interface EditorProviderProps {
@@ -4124,7 +4130,7 @@ export declare class Ellipse2d extends Geometry2d {
4124
4130
  }
4125
4131
 
4126
4132
  /** @public */
4127
- export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithRef<React_2.PropsWithChildren<TLErrorBoundaryProps>>, {
4133
+ export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithChildren<TLErrorBoundaryProps>, {
4128
4134
  error: Error | null;
4129
4135
  }> {
4130
4136
  static getDerivedStateFromError(error: Error): {
@@ -4134,11 +4140,11 @@ export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithRe
4134
4140
  error: null;
4135
4141
  };
4136
4142
  componentDidCatch(error: unknown): void;
4137
- render(): boolean | JSX_2.Element | Iterable<React_2.ReactNode> | null | number | string | undefined;
4143
+ 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;
4138
4144
  }
4139
4145
 
4140
4146
  /** @public @react */
4141
- export declare function ErrorScreen({ children }: LoadingScreenProps): JSX_2.Element;
4147
+ export declare function ErrorScreen({ children }: LoadingScreenProps): JSX.Element;
4142
4148
 
4143
4149
  /** @public */
4144
4150
  export declare const EVENT_NAME_MAP: Record<Exclude<TLEventName, TLPinchEventName>, keyof TLEventHandlers>;
@@ -4438,8 +4444,8 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
4438
4444
  canResizeChildren(): boolean;
4439
4445
  getDefaultProps(): TLGroupShape['props'];
4440
4446
  getGeometry(shape: TLGroupShape): Geometry2d;
4441
- component(shape: TLGroupShape): JSX_2.Element | null;
4442
- indicator(shape: TLGroupShape): JSX_2.Element;
4447
+ component(shape: TLGroupShape): JSX.Element | null;
4448
+ indicator(shape: TLGroupShape): JSX.Element;
4443
4449
  onChildrenChange(group: TLGroupShape): void;
4444
4450
  }
4445
4451
 
@@ -4543,7 +4549,7 @@ export declare class HistoryManager<R extends UnknownRecord> {
4543
4549
  }
4544
4550
 
4545
4551
  /** @public @react */
4546
- export declare function HTMLContainer({ children, className, ...rest }: HTMLContainerProps): JSX_2.Element;
4552
+ export declare function HTMLContainer({ children, className, ...rest }: HTMLContainerProps): JSX.Element;
4547
4553
 
4548
4554
  /** @public */
4549
4555
  export declare type HTMLContainerProps = React_2.HTMLAttributes<HTMLDivElement>;
@@ -4551,6 +4557,248 @@ export declare type HTMLContainerProps = React_2.HTMLAttributes<HTMLDivElement>;
4551
4557
  /** @public */
4552
4558
  export declare const inlineBase64AssetStore: TLAssetStore;
4553
4559
 
4560
+ /** @public */
4561
+ export declare class InputsManager {
4562
+ private readonly editor;
4563
+ constructor(editor: Editor);
4564
+ private _originPagePoint;
4565
+ /**
4566
+ * The most recent pointer down's position in the current page space.
4567
+ */
4568
+ getOriginPagePoint(): Vec;
4569
+ /**
4570
+ * @deprecated Use `getOriginPagePoint()` instead.
4571
+ */
4572
+ get originPagePoint(): Vec;
4573
+ private _originScreenPoint;
4574
+ /**
4575
+ * The most recent pointer down's position in screen space.
4576
+ */
4577
+ getOriginScreenPoint(): Vec;
4578
+ /**
4579
+ * @deprecated Use `getOriginScreenPoint()` instead.
4580
+ */
4581
+ get originScreenPoint(): Vec;
4582
+ private _previousPagePoint;
4583
+ /**
4584
+ * The previous pointer position in the current page space.
4585
+ */
4586
+ getPreviousPagePoint(): Vec;
4587
+ /**
4588
+ * @deprecated Use `getPreviousPagePoint()` instead.
4589
+ */
4590
+ get previousPagePoint(): Vec;
4591
+ private _previousScreenPoint;
4592
+ /**
4593
+ * The previous pointer position in screen space.
4594
+ */
4595
+ getPreviousScreenPoint(): Vec;
4596
+ /**
4597
+ * @deprecated Use `getPreviousScreenPoint()` instead.
4598
+ */
4599
+ get previousScreenPoint(): Vec;
4600
+ private _currentPagePoint;
4601
+ /**
4602
+ * The most recent pointer position in the current page space.
4603
+ */
4604
+ getCurrentPagePoint(): Vec;
4605
+ /**
4606
+ * @deprecated Use `getCurrentPagePoint()` instead.
4607
+ */
4608
+ get currentPagePoint(): Vec;
4609
+ private _currentScreenPoint;
4610
+ /**
4611
+ * The most recent pointer position in screen space.
4612
+ */
4613
+ getCurrentScreenPoint(): Vec;
4614
+ /**
4615
+ * @deprecated Use `getCurrentScreenPoint()` instead.
4616
+ */
4617
+ get currentScreenPoint(): Vec;
4618
+ private _pointerVelocity;
4619
+ /**
4620
+ * Velocity of mouse pointer, in pixels per millisecond.
4621
+ */
4622
+ getPointerVelocity(): Vec;
4623
+ /**
4624
+ * @deprecated Use `getPointerVelocity()` instead.
4625
+ */
4626
+ get pointerVelocity(): Vec;
4627
+ /* Excluded from this release type: setPointerVelocity */
4628
+ /**
4629
+ * A set containing the currently pressed keys.
4630
+ */
4631
+ readonly keys: AtomSet<string>;
4632
+ /**
4633
+ * A set containing the currently pressed buttons.
4634
+ */
4635
+ readonly buttons: AtomSet<number>;
4636
+ private _isPen;
4637
+ /**
4638
+ * Whether the input is from a pen.
4639
+ */
4640
+ getIsPen(): boolean;
4641
+ /**
4642
+ * @deprecated Use `getIsPen()` instead.
4643
+ */
4644
+ get isPen(): boolean;
4645
+ set isPen(isPen: boolean);
4646
+ /**
4647
+ * @param isPen - Whether the input is from a pen.
4648
+ */
4649
+ setIsPen(isPen: boolean): void;
4650
+ private _shiftKey;
4651
+ /**
4652
+ * Whether the shift key is currently pressed.
4653
+ */
4654
+ getShiftKey(): boolean;
4655
+ /**
4656
+ * @deprecated Use `getShiftKey()` instead.
4657
+ */
4658
+ get shiftKey(): boolean;
4659
+ set shiftKey(shiftKey: boolean);
4660
+ /* Excluded from this release type: setShiftKey */
4661
+ private _metaKey;
4662
+ /**
4663
+ * Whether the meta key is currently pressed.
4664
+ */
4665
+ getMetaKey(): boolean;
4666
+ /**
4667
+ * @deprecated Use `getMetaKey()` instead.
4668
+ */
4669
+ get metaKey(): boolean;
4670
+ set metaKey(metaKey: boolean);
4671
+ /* Excluded from this release type: setMetaKey */
4672
+ private _ctrlKey;
4673
+ /**
4674
+ * Whether the ctrl or command key is currently pressed.
4675
+ */
4676
+ getCtrlKey(): boolean;
4677
+ /**
4678
+ * @deprecated Use `getCtrlKey()` instead.
4679
+ */
4680
+ get ctrlKey(): boolean;
4681
+ set ctrlKey(ctrlKey: boolean);
4682
+ /* Excluded from this release type: setCtrlKey */
4683
+ private _altKey;
4684
+ /**
4685
+ * Whether the alt or option key is currently pressed.
4686
+ */
4687
+ getAltKey(): boolean;
4688
+ /**
4689
+ * @deprecated Use `getAltKey()` instead.
4690
+ */
4691
+ get altKey(): boolean;
4692
+ set altKey(altKey: boolean);
4693
+ /* Excluded from this release type: setAltKey */
4694
+ /**
4695
+ * Is the accelerator key (cmd on mac, ctrl elsewhere) currently pressed.
4696
+ */
4697
+ getAccelKey(): boolean;
4698
+ /**
4699
+ * @deprecated Use `getAccelKey()` instead.
4700
+ */
4701
+ get accelKey(): boolean;
4702
+ private _isDragging;
4703
+ /**
4704
+ * Whether the user is dragging.
4705
+ */
4706
+ getIsDragging(): boolean;
4707
+ /**
4708
+ * Soon to be deprecated, use `getIsDragging()` instead.
4709
+ */
4710
+ get isDragging(): boolean;
4711
+ set isDragging(isDragging: boolean);
4712
+ /**
4713
+ * @param isDragging - Whether the user is dragging.
4714
+ */
4715
+ setIsDragging(isDragging: boolean): void;
4716
+ private _isPointing;
4717
+ /**
4718
+ * Whether the user is pointing.
4719
+ */
4720
+ getIsPointing(): boolean;
4721
+ /**
4722
+ * @deprecated Use `getIsPointing()` instead.
4723
+ */
4724
+ get isPointing(): boolean;
4725
+ set isPointing(isPointing: boolean);
4726
+ /* Excluded from this release type: setIsPointing */
4727
+ private _isPinching;
4728
+ /**
4729
+ * Whether the user is pinching.
4730
+ */
4731
+ getIsPinching(): boolean;
4732
+ /**
4733
+ * @deprecated Use `getIsPinching()` instead.
4734
+ */
4735
+ get isPinching(): boolean;
4736
+ set isPinching(isPinching: boolean);
4737
+ /* Excluded from this release type: setIsPinching */
4738
+ private _isEditing;
4739
+ /**
4740
+ * Whether the user is editing.
4741
+ */
4742
+ getIsEditing(): boolean;
4743
+ /**
4744
+ * @deprecated Use `getIsEditing()` instead.
4745
+ */
4746
+ get isEditing(): boolean;
4747
+ set isEditing(isEditing: boolean);
4748
+ /**
4749
+ * @param isEditing - Whether the user is editing.
4750
+ */
4751
+ setIsEditing(isEditing: boolean): void;
4752
+ private _isPanning;
4753
+ /**
4754
+ * Whether the user is panning.
4755
+ */
4756
+ getIsPanning(): boolean;
4757
+ /**
4758
+ * @deprecated Use `getIsPanning()` instead.
4759
+ */
4760
+ get isPanning(): boolean;
4761
+ set isPanning(isPanning: boolean);
4762
+ /* Excluded from this release type: setIsPanning */
4763
+ private _isSpacebarPanning;
4764
+ /**
4765
+ * Whether the user is spacebar panning.
4766
+ */
4767
+ getIsSpacebarPanning(): boolean;
4768
+ /**
4769
+ * @deprecated Use `getIsSpacebarPanning()` instead.
4770
+ */
4771
+ get isSpacebarPanning(): boolean;
4772
+ set isSpacebarPanning(isSpacebarPanning: boolean);
4773
+ /* Excluded from this release type: setIsSpacebarPanning */
4774
+ private _getHasCollaborators;
4775
+ /* Excluded from this release type: _velocityPrevPoint */
4776
+ /* Excluded from this release type: updatePointerVelocity */
4777
+ /* Excluded from this release type: updateFromEvent */
4778
+ toJson(): {
4779
+ altKey: boolean;
4780
+ buttons: number[];
4781
+ ctrlKey: boolean;
4782
+ currentPagePoint: VecModel;
4783
+ currentScreenPoint: VecModel;
4784
+ isDragging: boolean;
4785
+ isEditing: boolean;
4786
+ isPanning: boolean;
4787
+ isPen: boolean;
4788
+ isPinching: boolean;
4789
+ isPointing: boolean;
4790
+ isSpacebarPanning: boolean;
4791
+ keys: string[];
4792
+ metaKey: boolean;
4793
+ originPagePoint: VecModel;
4794
+ originScreenPoint: VecModel;
4795
+ pointerVelocity: VecModel;
4796
+ previousPagePoint: VecModel;
4797
+ previousScreenPoint: VecModel;
4798
+ shiftKey: boolean;
4799
+ };
4800
+ }
4801
+
4554
4802
  /**
4555
4803
  * Find the intersections between a circle and a circle.
4556
4804
  *
@@ -4680,7 +4928,7 @@ export declare function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeI
4680
4928
  export declare function linesIntersect(A: VecLike, B: VecLike, C: VecLike, D: VecLike): boolean;
4681
4929
 
4682
4930
  /** @public @react */
4683
- export declare function LoadingScreen({ children }: LoadingScreenProps): JSX_2.Element;
4931
+ export declare function LoadingScreen({ children }: LoadingScreenProps): JSX.Element;
4684
4932
 
4685
4933
  /** @public */
4686
4934
  export declare interface LoadingScreenProps {
@@ -4798,7 +5046,7 @@ export declare function maybeSnapToGrid(point: Vec, editor: Editor): Vec;
4798
5046
  *
4799
5047
  * @public @react
4800
5048
  */
4801
- export declare function MenuClickCapture(): false | JSX_2.Element;
5049
+ export declare function MenuClickCapture(): false | JSX.Element;
4802
5050
 
4803
5051
  /* Excluded from this release type: normalizeWheel */
4804
5052
 
@@ -5231,20 +5479,20 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5231
5479
  * @param shape - The shape.
5232
5480
  * @public
5233
5481
  */
5234
- canSnap(_shape: Shape): boolean;
5482
+ canSnap(shape: Shape): boolean;
5235
5483
  /**
5236
5484
  * Whether the shape can be tabbed to.
5237
5485
  *
5238
5486
  * @param shape - The shape.
5239
5487
  * @public
5240
5488
  */
5241
- canTabTo(_shape: Shape): boolean;
5489
+ canTabTo(shape: Shape): boolean;
5242
5490
  /**
5243
5491
  * Whether the shape can be scrolled while editing.
5244
5492
  *
5245
5493
  * @public
5246
5494
  */
5247
- canScroll(_shape: Shape): boolean;
5495
+ canScroll(shape: Shape): boolean;
5248
5496
  /**
5249
5497
  * Whether the shape can be bound to. See {@link TLShapeUtilCanBindOpts} for details.
5250
5498
  *
@@ -5256,31 +5504,37 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5256
5504
  *
5257
5505
  * @public
5258
5506
  */
5259
- canEdit(_shape: Shape): boolean;
5507
+ canEdit(shape: Shape, info: TLEditStartInfo): boolean;
5260
5508
  /**
5261
5509
  * Whether the shape can be resized.
5262
5510
  *
5263
5511
  * @public
5264
5512
  */
5265
- canResize(_shape: Shape): boolean;
5513
+ canResize(shape: Shape): boolean;
5266
5514
  /**
5267
5515
  * When the shape is resized, whether the shape's children should also be resized.
5268
5516
  *
5269
5517
  * @public
5270
5518
  */
5271
- canResizeChildren(_shape: Shape): boolean;
5519
+ canResizeChildren(shape: Shape): boolean;
5272
5520
  /**
5273
5521
  * Whether the shape can be edited in read-only mode.
5274
5522
  *
5275
5523
  * @public
5276
5524
  */
5277
- canEditInReadonly(_shape: Shape): boolean;
5525
+ canEditInReadonly(shape: Shape): boolean;
5526
+ /**
5527
+ * Whether the shape can be edited while locked or while an ancestor is locked.
5528
+ *
5529
+ * @public
5530
+ */
5531
+ canEditWhileLocked(shape: Shape): boolean;
5278
5532
  /**
5279
5533
  * Whether the shape can be cropped.
5280
5534
  *
5281
5535
  * @public
5282
5536
  */
5283
- canCrop(_shape: Shape): boolean;
5537
+ canCrop(shape: Shape): boolean;
5284
5538
  /**
5285
5539
  * Whether the shape can participate in layout functions such as alignment or distribution.
5286
5540
  *
@@ -5290,7 +5544,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5290
5544
  *
5291
5545
  * @public
5292
5546
  */
5293
- canBeLaidOut(_shape: Shape, _info: TLShapeUtilCanBeLaidOutOpts): boolean;
5547
+ canBeLaidOut(shape: Shape, info: TLShapeUtilCanBeLaidOutOpts): boolean;
5294
5548
  /**
5295
5549
  * Whether this shape can be culled. By default, shapes are culled for
5296
5550
  * performance reasons when they are outside of the viewport. Culled shapes are still rendered
@@ -5298,11 +5552,31 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5298
5552
  *
5299
5553
  * @param shape - The shape.
5300
5554
  */
5301
- canCull(_shape: Shape): boolean;
5555
+ canCull(shape: Shape): boolean;
5302
5556
  /* Excluded from this release type: providesBackgroundForChildren */
5303
5557
  /**
5304
5558
  * Get the clip path to apply to this shape's children.
5305
5559
  *
5560
+ * The returned points should define the **inner** clip boundary - the area where
5561
+ * children will be visible. If your shape has a stroke, you should inset the clip
5562
+ * path by half the stroke width so children are clipped to the inner edge of the
5563
+ * stroke rather than its center line.
5564
+ *
5565
+ * @example
5566
+ * ```ts
5567
+ * override getClipPath(shape: MyShape): Vec[] | undefined {
5568
+ * const strokeWidth = 2
5569
+ * const inset = strokeWidth / 2
5570
+ * // Return points inset by half the stroke width
5571
+ * return [
5572
+ * new Vec(inset, inset),
5573
+ * new Vec(shape.props.w - inset, inset),
5574
+ * new Vec(shape.props.w - inset, shape.props.h - inset),
5575
+ * new Vec(inset, shape.props.h - inset),
5576
+ * ]
5577
+ * }
5578
+ * ```
5579
+ *
5306
5580
  * @param shape - The shape to get the clip path for
5307
5581
  * @returns Array of points defining the clipping polygon in local coordinates, or undefined if no clipping
5308
5582
  * @public
@@ -5327,37 +5601,37 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5327
5601
  * @returns boolean indicating if this shape should hide in the minimap
5328
5602
  * @public
5329
5603
  */
5330
- hideInMinimap?(_shape: Shape): boolean;
5604
+ hideInMinimap?(shape: Shape): boolean;
5331
5605
  /**
5332
5606
  * Whether the shape should hide its resize handles when selected.
5333
5607
  *
5334
5608
  * @public
5335
5609
  */
5336
- hideResizeHandles(_shape: Shape): boolean;
5610
+ hideResizeHandles(shape: Shape): boolean;
5337
5611
  /**
5338
5612
  * Whether the shape should hide its rotation handles when selected.
5339
5613
  *
5340
5614
  * @public
5341
5615
  */
5342
- hideRotateHandle(_shape: Shape): boolean;
5616
+ hideRotateHandle(shape: Shape): boolean;
5343
5617
  /**
5344
5618
  * Whether the shape should hide its selection bounds background when selected.
5345
5619
  *
5346
5620
  * @public
5347
5621
  */
5348
- hideSelectionBoundsBg(_shape: Shape): boolean;
5622
+ hideSelectionBoundsBg(shape: Shape): boolean;
5349
5623
  /**
5350
5624
  * Whether the shape should hide its selection bounds foreground when selected.
5351
5625
  *
5352
5626
  * @public
5353
5627
  */
5354
- hideSelectionBoundsFg(_shape: Shape): boolean;
5628
+ hideSelectionBoundsFg(shape: Shape): boolean;
5355
5629
  /**
5356
5630
  * Whether the shape's aspect ratio is locked.
5357
5631
  *
5358
5632
  * @public
5359
5633
  */
5360
- isAspectRatioLocked(_shape: Shape): boolean;
5634
+ isAspectRatioLocked(shape: Shape): boolean;
5361
5635
  /**
5362
5636
  * By default, the bounds of an image export are the bounds of all the shapes it contains, plus
5363
5637
  * some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
@@ -5365,10 +5639,10 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5365
5639
  * useful in cases like annotating on top of an image, where you usually want to avoid extra
5366
5640
  * padding around the image if you don't need it.
5367
5641
  *
5368
- * @param _shape - The shape to check
5642
+ * @param shape - The shape to check
5369
5643
  * @returns True if this shape should be treated as an export bounds container
5370
5644
  */
5371
- isExportBoundsContainer(_shape: Shape): boolean;
5645
+ isExportBoundsContainer(shape: Shape): boolean;
5372
5646
  /* Excluded from this release type: backgroundComponent */
5373
5647
  /**
5374
5648
  * Get the interpolated props for an animating shape. This is an optional method.
@@ -5405,7 +5679,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5405
5679
  * @param type - The shape type.
5406
5680
  * @public
5407
5681
  */
5408
- canReceiveNewChildrenOfType(_shape: Shape, _type: TLShape['type']): boolean;
5682
+ canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
5409
5683
  /**
5410
5684
  * Get the shape as an SVG object.
5411
5685
  *
@@ -5438,14 +5712,14 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5438
5712
  * Get the geometry to use when snapping to this this shape in translate/resize operations. See
5439
5713
  * {@link BoundsSnapGeometry} for details.
5440
5714
  */
5441
- getBoundsSnapGeometry(_shape: Shape): BoundsSnapGeometry;
5715
+ getBoundsSnapGeometry(shape: Shape): BoundsSnapGeometry;
5442
5716
  /**
5443
5717
  * Get the geometry to use when snapping handles to this shape. See {@link HandleSnapGeometry}
5444
5718
  * for details.
5445
5719
  */
5446
- getHandleSnapGeometry(_shape: Shape): HandleSnapGeometry;
5447
- getText(_shape: Shape): string | undefined;
5448
- getAriaDescriptor(_shape: Shape): string | undefined;
5720
+ getHandleSnapGeometry(shape: Shape): HandleSnapGeometry;
5721
+ getText(shape: Shape): string | undefined;
5722
+ getAriaDescriptor(shape: Shape): string | undefined;
5449
5723
  /**
5450
5724
  * A callback called just before a shape is created. This method provides a last chance to modify
5451
5725
  * the created shape.
@@ -5940,7 +6214,7 @@ export declare const stopEventPropagation: (e: any) => any;
5940
6214
  export declare function suffixSafeId(id: SafeId, suffix: string): SafeId;
5941
6215
 
5942
6216
  /** @public @react */
5943
- export declare function SVGContainer({ children, className, ...rest }: SVGContainerProps): JSX_2.Element;
6217
+ export declare function SVGContainer({ children, className, ...rest }: SVGContainerProps): JSX.Element;
5944
6218
 
5945
6219
  /** @public */
5946
6220
  export declare type SVGContainerProps = React_2.ComponentProps<'svg'>;
@@ -6038,6 +6312,8 @@ export declare class TextManager {
6038
6312
  }[];
6039
6313
  }
6040
6314
 
6315
+ /* Excluded from this release type: TickManager */
6316
+
6041
6317
  /**
6042
6318
  * This is the TipTap editor! Docs are {@link https://tiptap.dev/docs}.
6043
6319
  *
@@ -6589,6 +6865,33 @@ export declare interface TldrawOptions {
6589
6865
  * Branding name of the app, currently only used for adding aria-label for the application.
6590
6866
  */
6591
6867
  readonly branding?: string;
6868
+ /**
6869
+ * Whether to use debounced zoom level for certain rendering optimizations. When true,
6870
+ * `editor.getDebouncedZoomLevel()` returns a cached zoom value while the camera is moving,
6871
+ * reducing re-renders. When false, it always returns the current zoom level.
6872
+ */
6873
+ readonly debouncedZoom: boolean;
6874
+ /**
6875
+ * The number of shapes that must be on the page for the debounced zoom level to be used.
6876
+ * Defaults to 300 shapes.
6877
+ */
6878
+ readonly debouncedZoomThreshold: number;
6879
+ /**
6880
+ * Whether to allow spacebar panning. When true, the spacebar will pan the camera when held down.
6881
+ * When false, the spacebar will not pan the camera.
6882
+ */
6883
+ readonly spacebarPanning: boolean;
6884
+ /**
6885
+ * The default padding (in pixels) used when zooming to fit content in the viewport.
6886
+ * This affects methods like `zoomToFit()`, `zoomToSelection()`, and `zoomToBounds()`.
6887
+ * The actual padding used is the minimum of this value and 28% of the viewport width.
6888
+ * Defaults to 128 pixels.
6889
+ */
6890
+ readonly zoomToFitPadding: number;
6891
+ /**
6892
+ * The distance (in screen pixels) at which shapes snap to guides and other shapes.
6893
+ */
6894
+ readonly snapThreshold: number;
6592
6895
  }
6593
6896
 
6594
6897
  /** @public */
@@ -6634,7 +6937,7 @@ export declare interface TLEditorComponents {
6634
6937
  /** @public */
6635
6938
  export declare interface TLEditorOptions {
6636
6939
  /**
6637
- * The Store instance to use for keeping the app's data. This may be prepopulated, e.g. by loading
6940
+ * The Store instance to use for keeping the editor's data. This may be prepopulated, e.g. by loading
6638
6941
  * from a server or database.
6639
6942
  */
6640
6943
  store: TLStore;
@@ -6713,6 +7016,11 @@ export declare interface TLEditorSnapshot {
6713
7016
  session: TLSessionStateSnapshot;
6714
7017
  }
6715
7018
 
7019
+ /** @public */
7020
+ export declare interface TLEditStartInfo {
7021
+ type: 'click-header' | 'click' | 'double-click-corner' | 'double-click-edge' | 'double-click' | 'press_enter' | 'unknown';
7022
+ }
7023
+
6716
7024
  /** @public */
6717
7025
  export declare interface TLEmbedExternalContent<EmbedDefinition> extends TLBaseExternalContent {
6718
7026
  type: 'embed';
@@ -6725,6 +7033,8 @@ export declare type TLEnterEventHandler = (info: any, from: string) => void;
6725
7033
 
6726
7034
  /**
6727
7035
  * An object that contains information about the current device and environment.
7036
+ * This object is not reactive and will not update automatically when the environment changes,
7037
+ * so only include values that are fixed, such as the user's browser and operating system.
6728
7038
  *
6729
7039
  * @public
6730
7040
  */
@@ -6739,6 +7049,17 @@ export declare const tlenv: {
6739
7049
  isWebview: boolean;
6740
7050
  };
6741
7051
 
7052
+ /**
7053
+ * An atom that contains information about the current device and environment.
7054
+ * This object is reactive and will update automatically when the environment changes.
7055
+ * Use it for values that may change over time, such as the pointer type.
7056
+ *
7057
+ * @public
7058
+ */
7059
+ export declare const tlenvReactive: Atom< {
7060
+ isCoarsePointer: boolean;
7061
+ }, unknown>;
7062
+
6742
7063
  /** @public */
6743
7064
  export declare interface TLErrorBoundaryProps {
6744
7065
  children: React_2.ReactNode;
@@ -7915,10 +8236,10 @@ export declare function useMaybeEditor(): Editor | null;
7915
8236
  /* Excluded from this release type: useOnMount */
7916
8237
 
7917
8238
  /** @public */
7918
- export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement>): void;
8239
+ export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement | null>): void;
7919
8240
 
7920
8241
  /** @public */
7921
- export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement>): void;
8242
+ export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
7922
8243
 
7923
8244
  /**
7924
8245
  * @returns The list of peer UserIDs
@@ -8026,7 +8347,7 @@ export declare function useTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreS
8026
8347
  export declare function useTLStore(opts: TLStoreOptions): TLStore;
8027
8348
 
8028
8349
  /** @public */
8029
- export declare function useTransform(ref: React.RefObject<HTMLElement | SVGElement>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
8350
+ export declare function useTransform(ref: React.RefObject<HTMLElement | null | SVGElement>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
8030
8351
 
8031
8352
  /**
8032
8353
  * React's useId hook returns a unique id for the component. However, it uses a colon in the id,