@tldraw/editor 4.6.0-next.e390fde97eab → 4.6.0-next.f17381e03ffe

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 (185) hide show
  1. package/dist-cjs/index.d.ts +90 -0
  2. package/dist-cjs/index.js +3 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/components/LiveCollaborators.js +1 -0
  5. package/dist-cjs/lib/components/LiveCollaborators.js.map +2 -2
  6. package/dist-cjs/lib/components/MenuClickCapture.js +93 -47
  7. package/dist-cjs/lib/components/MenuClickCapture.js.map +2 -2
  8. package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js +7 -0
  9. package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +3 -3
  10. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +5 -2
  11. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  12. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +1 -1
  13. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
  14. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +1 -0
  15. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +2 -2
  16. package/dist-cjs/lib/editor/Editor.js +64 -5
  17. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  18. package/dist-cjs/lib/editor/assets/AssetUtil.js +1 -0
  19. package/dist-cjs/lib/editor/assets/AssetUtil.js.map +1 -1
  20. package/dist-cjs/lib/editor/bindings/BindingUtil.js +1 -0
  21. package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +1 -1
  22. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +1 -0
  23. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +1 -1
  24. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +1 -0
  25. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +1 -1
  26. package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js +1 -0
  27. package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js.map +1 -1
  28. package/dist-cjs/lib/editor/managers/FontManager/FontManager.js +2 -0
  29. package/dist-cjs/lib/editor/managers/FontManager/FontManager.js.map +1 -1
  30. package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js +2 -0
  31. package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js.map +1 -1
  32. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +12 -0
  33. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +2 -2
  34. package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js +1 -0
  35. package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js.map +1 -1
  36. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js +1 -0
  37. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js.map +1 -1
  38. package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js +1 -0
  39. package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +1 -1
  40. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +2 -1
  41. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
  42. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +1 -0
  43. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +1 -1
  44. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +1 -0
  45. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +1 -1
  46. package/dist-cjs/lib/editor/managers/ThemeManager/ThemeManager.js +1 -0
  47. package/dist-cjs/lib/editor/managers/ThemeManager/ThemeManager.js.map +1 -1
  48. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +1 -0
  49. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +1 -1
  50. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +2 -0
  51. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +1 -1
  52. package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js +76 -0
  53. package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js.map +7 -0
  54. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +11 -0
  55. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  56. package/dist-cjs/lib/editor/tools/StateNode.js +1 -0
  57. package/dist-cjs/lib/editor/tools/StateNode.js.map +1 -1
  58. package/dist-cjs/lib/exports/ExportDelay.js +1 -0
  59. package/dist-cjs/lib/exports/ExportDelay.js.map +1 -1
  60. package/dist-cjs/lib/exports/StyleEmbedder.js +1 -0
  61. package/dist-cjs/lib/exports/StyleEmbedder.js.map +1 -1
  62. package/dist-cjs/lib/exports/getSvgJsx.js +2 -1
  63. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  64. package/dist-cjs/lib/hooks/useCanvasEvents.js +25 -4
  65. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  66. package/dist-cjs/lib/options.js +2 -0
  67. package/dist-cjs/lib/options.js.map +2 -2
  68. package/dist-cjs/lib/primitives/Vec.js +3 -0
  69. package/dist-cjs/lib/primitives/Vec.js.map +1 -1
  70. package/dist-cjs/lib/primitives/geometry/Circle2d.js +1 -0
  71. package/dist-cjs/lib/primitives/geometry/Circle2d.js.map +1 -1
  72. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js +1 -0
  73. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js.map +1 -1
  74. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +2 -0
  75. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +1 -1
  76. package/dist-cjs/lib/primitives/geometry/Stadium2d.js +1 -0
  77. package/dist-cjs/lib/primitives/geometry/Stadium2d.js.map +1 -1
  78. package/dist-cjs/lib/utils/EditorAtom.js +2 -0
  79. package/dist-cjs/lib/utils/EditorAtom.js.map +1 -1
  80. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +2 -0
  81. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +1 -1
  82. package/dist-cjs/version.js +3 -3
  83. package/dist-cjs/version.js.map +1 -1
  84. package/dist-esm/index.d.mts +90 -0
  85. package/dist-esm/index.mjs +3 -1
  86. package/dist-esm/index.mjs.map +2 -2
  87. package/dist-esm/lib/components/LiveCollaborators.mjs +1 -0
  88. package/dist-esm/lib/components/LiveCollaborators.mjs.map +2 -2
  89. package/dist-esm/lib/components/MenuClickCapture.mjs +94 -48
  90. package/dist-esm/lib/components/MenuClickCapture.mjs.map +2 -2
  91. package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs +7 -0
  92. package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +3 -3
  93. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +5 -2
  94. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  95. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +1 -1
  96. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
  97. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +1 -0
  98. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +2 -2
  99. package/dist-esm/lib/editor/Editor.mjs +65 -6
  100. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  101. package/dist-esm/lib/editor/assets/AssetUtil.mjs +1 -0
  102. package/dist-esm/lib/editor/assets/AssetUtil.mjs.map +1 -1
  103. package/dist-esm/lib/editor/bindings/BindingUtil.mjs +1 -0
  104. package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +1 -1
  105. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +1 -0
  106. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +1 -1
  107. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +1 -0
  108. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +1 -1
  109. package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs +1 -0
  110. package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs.map +1 -1
  111. package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs +2 -0
  112. package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs.map +1 -1
  113. package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs +2 -0
  114. package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs.map +1 -1
  115. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +12 -0
  116. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +2 -2
  117. package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs +1 -0
  118. package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs.map +1 -1
  119. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs +1 -0
  120. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs.map +1 -1
  121. package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs +1 -0
  122. package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +1 -1
  123. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +2 -1
  124. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
  125. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +1 -0
  126. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +1 -1
  127. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +1 -0
  128. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +1 -1
  129. package/dist-esm/lib/editor/managers/ThemeManager/ThemeManager.mjs +1 -0
  130. package/dist-esm/lib/editor/managers/ThemeManager/ThemeManager.mjs.map +1 -1
  131. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +1 -0
  132. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +1 -1
  133. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +2 -0
  134. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +1 -1
  135. package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs +56 -0
  136. package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs.map +7 -0
  137. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +11 -0
  138. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  139. package/dist-esm/lib/editor/tools/StateNode.mjs +1 -0
  140. package/dist-esm/lib/editor/tools/StateNode.mjs.map +1 -1
  141. package/dist-esm/lib/exports/ExportDelay.mjs +1 -0
  142. package/dist-esm/lib/exports/ExportDelay.mjs.map +1 -1
  143. package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -0
  144. package/dist-esm/lib/exports/StyleEmbedder.mjs.map +1 -1
  145. package/dist-esm/lib/exports/getSvgJsx.mjs +2 -1
  146. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  147. package/dist-esm/lib/hooks/useCanvasEvents.mjs +25 -4
  148. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  149. package/dist-esm/lib/options.mjs +2 -0
  150. package/dist-esm/lib/options.mjs.map +2 -2
  151. package/dist-esm/lib/primitives/Vec.mjs +3 -0
  152. package/dist-esm/lib/primitives/Vec.mjs.map +1 -1
  153. package/dist-esm/lib/primitives/geometry/Circle2d.mjs +1 -0
  154. package/dist-esm/lib/primitives/geometry/Circle2d.mjs.map +1 -1
  155. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs +1 -0
  156. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs.map +1 -1
  157. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +2 -0
  158. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +1 -1
  159. package/dist-esm/lib/primitives/geometry/Stadium2d.mjs +1 -0
  160. package/dist-esm/lib/primitives/geometry/Stadium2d.mjs.map +1 -1
  161. package/dist-esm/lib/utils/EditorAtom.mjs +2 -0
  162. package/dist-esm/lib/utils/EditorAtom.mjs.map +1 -1
  163. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +2 -0
  164. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +1 -1
  165. package/dist-esm/version.mjs +3 -3
  166. package/dist-esm/version.mjs.map +1 -1
  167. package/editor.css +0 -4
  168. package/package.json +7 -7
  169. package/src/index.ts +1 -0
  170. package/src/lib/components/LiveCollaborators.tsx +8 -2
  171. package/src/lib/components/MenuClickCapture.tsx +124 -64
  172. package/src/lib/components/default-components/CanvasShapeIndicators.tsx +11 -0
  173. package/src/lib/components/default-components/DefaultCanvas.tsx +6 -2
  174. package/src/lib/components/default-components/DefaultShapeIndicator.tsx +2 -2
  175. package/src/lib/components/default-components/DefaultShapeIndicators.tsx +2 -0
  176. package/src/lib/editor/Editor.ts +87 -14
  177. package/src/lib/editor/managers/InputsManager/InputsManager.ts +12 -0
  178. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +13 -2
  179. package/src/lib/editor/managers/SnapManager/SnapManager.ts +1 -1
  180. package/src/lib/editor/shapes/BaseFrameLikeShapeUtil.tsx +121 -0
  181. package/src/lib/editor/shapes/ShapeUtil.ts +11 -0
  182. package/src/lib/exports/getSvgJsx.tsx +2 -1
  183. package/src/lib/hooks/useCanvasEvents.ts +40 -3
  184. package/src/lib/options.ts +14 -0
  185. package/src/version.ts +3 -3
@@ -220,6 +220,54 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
220
220
  getInterpolatedProps(startShape: Shape, endShape: Shape, t: number): Shape['props'];
221
221
  }
222
222
 
223
+ /**
224
+ * A base class for frame-like shapes — containers that clip their children,
225
+ * require full-brush selection, block erasure from inside, and support
226
+ * drag-and-drop reparenting.
227
+ *
228
+ * Extending this class is the easiest way to create a custom frame-like shape.
229
+ * It provides sensible defaults for all frame-like behaviors:
230
+ *
231
+ * - `isFrameLike()` returns `true`
232
+ * - `providesBackgroundForChildren()` returns `true`
233
+ * - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
234
+ * - `getClipPath()` returns the shape geometry's vertices
235
+ * - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
236
+ * - `onDragShapesOut()` reparents shapes back to the page
237
+ *
238
+ * All methods can be overridden for custom behavior.
239
+ *
240
+ * @example
241
+ * ```ts
242
+ * class MyContainerUtil extends BaseFrameLikeShapeUtil<MyContainerShape> {
243
+ * static override type = 'my-container' as const
244
+ * static override props = myContainerShapeProps
245
+ *
246
+ * override getDefaultProps() {
247
+ * return { w: 300, h: 200 }
248
+ * }
249
+ *
250
+ * override component(shape: MyContainerShape) {
251
+ * return <SVGContainer>...</SVGContainer>
252
+ * }
253
+ *
254
+ * override indicator(shape: MyContainerShape) {
255
+ * return <rect width={shape.props.w} height={shape.props.h} />
256
+ * }
257
+ * }
258
+ * ```
259
+ *
260
+ * @public
261
+ */
262
+ export declare abstract class BaseFrameLikeShapeUtil<Shape extends TLBaseBoxShape> extends BaseBoxShapeUtil<Shape> {
263
+ isFrameLike(_shape: Shape): boolean;
264
+ providesBackgroundForChildren(): boolean;
265
+ canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
266
+ getClipPath(shape: Shape): undefined | Vec[];
267
+ onDragShapesIn(shape: Shape, draggingShapes: TLShape[], { initialParentIds, initialIndices }: TLDragShapesInInfo): void;
268
+ onDragShapesOut(shape: Shape, draggingShapes: TLShape[], info: TLDragShapesOutInfo): void;
269
+ }
270
+
223
271
  /** @public */
224
272
  export declare interface BatchMeasurementRequest {
225
273
  html: string;
@@ -996,6 +1044,7 @@ export declare const defaultTldrawOptions: {
996
1044
  readonly onBeforePasteFromClipboard: undefined;
997
1045
  readonly onClipboardPasteRaw: undefined;
998
1046
  readonly quickZoomPreservesScreenBounds: true;
1047
+ readonly rightClickPanning: true;
999
1048
  readonly snapThreshold: 8;
1000
1049
  readonly spacebarPanning: true;
1001
1050
  readonly temporaryAssetPreviewLifetimeMs: 180000;
@@ -1004,6 +1053,7 @@ export declare const defaultTldrawOptions: {
1004
1053
  readonly tooltipDelayMs: 700;
1005
1054
  readonly uiCoarseDragDistanceSquared: 625;
1006
1055
  readonly uiDragDistanceSquared: 16;
1056
+ readonly useCanvasIndicators: true;
1007
1057
  readonly zoomToFitPadding: 128;
1008
1058
  };
1009
1059
 
@@ -3122,6 +3172,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3122
3172
  type: T['type'];
3123
3173
  }>;
3124
3174
  isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
3175
+ /**
3176
+ * Get whether a shape behaves like a frame — a container that has child
3177
+ * shapes, requires full-brush selection, blocks erasure from inside, etc.
3178
+ *
3179
+ * @example
3180
+ * ```ts
3181
+ * const isFrameLike = editor.isShapeFrameLike(someShape)
3182
+ * ```
3183
+ *
3184
+ * @param shape - The shape (or shape id) to test.
3185
+ *
3186
+ * @public
3187
+ */
3188
+ isShapeFrameLike(shape: TLShape | TLShapeId): boolean;
3125
3189
  /**
3126
3190
  * Get a shape by its id.
3127
3191
  *
@@ -5067,6 +5131,12 @@ export declare class InputsManager {
5067
5131
  get isPointing(): boolean;
5068
5132
  set isPointing(isPointing: boolean);
5069
5133
  /* Excluded from this release type: setIsPointing */
5134
+ private _isRightPointing;
5135
+ /**
5136
+ * Whether the user is right-click pointing (before drag threshold).
5137
+ */
5138
+ getIsRightPointing(): boolean;
5139
+ /* Excluded from this release type: setIsRightPointing */
5070
5140
  private _isPinching;
5071
5141
  /**
5072
5142
  * Whether the user is pinching.
@@ -6236,6 +6306,14 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6236
6306
  * @public
6237
6307
  */
6238
6308
  isAspectRatioLocked(shape: Shape): boolean;
6309
+ /**
6310
+ * Whether the shape behaves like a frame — a container that has child shapes,
6311
+ * requires full-brush selection, blocks erasure from inside, etc.
6312
+ *
6313
+ * @param shape - The shape.
6314
+ * @public
6315
+ */
6316
+ isFrameLike(_shape: Shape): boolean;
6239
6317
  /**
6240
6318
  * By default, the bounds of an image export are the bounds of all the shapes it contains, plus
6241
6319
  * some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
@@ -7660,6 +7738,12 @@ export declare interface TldrawOptions {
7660
7738
  * When false, the spacebar will not pan the camera.
7661
7739
  */
7662
7740
  readonly spacebarPanning: boolean;
7741
+ /**
7742
+ * Whether to allow right-click + drag to pan the camera. When true, right-click + drag pans the
7743
+ * camera and a static right-click opens the context menu at the release position. When false,
7744
+ * right-click opens the context menu on press (no drag-to-pan).
7745
+ */
7746
+ readonly rightClickPanning: boolean;
7663
7747
  /**
7664
7748
  * The default padding (in pixels) used when zooming to fit content in the viewport.
7665
7749
  * This affects methods like `zoomToFit()`, `zoomToSelection()`, and `zoomToBounds()`.
@@ -7702,6 +7786,12 @@ export declare interface TldrawOptions {
7702
7786
  * viewport's page dimensions regardless of overview zoom changes.
7703
7787
  */
7704
7788
  readonly quickZoomPreservesScreenBounds: boolean;
7789
+ /**
7790
+ * Whether to use 2D canvas rendering for shape indicators. When true (default),
7791
+ * shapes that support it will render indicators on a 2D canvas for better
7792
+ * performance. When false, all indicators use legacy SVG rendering.
7793
+ */
7794
+ readonly useCanvasIndicators: boolean;
7705
7795
  /**
7706
7796
  * Called before content is written to the clipboard during a copy or cut operation.
7707
7797
  * Receives the serialized content (shapes, bindings, assets) and can filter or transform
package/dist-cjs/index.js CHANGED
@@ -23,6 +23,7 @@ __export(index_exports, {
23
23
  AssetUtil: () => import_AssetUtil.AssetUtil,
24
24
  BaseBoxShapeTool: () => import_BaseBoxShapeTool.BaseBoxShapeTool,
25
25
  BaseBoxShapeUtil: () => import_BaseBoxShapeUtil.BaseBoxShapeUtil,
26
+ BaseFrameLikeShapeUtil: () => import_BaseFrameLikeShapeUtil.BaseFrameLikeShapeUtil,
26
27
  BindingUtil: () => import_BindingUtil.BindingUtil,
27
28
  BoundsSnaps: () => import_BoundsSnaps.BoundsSnaps,
28
29
  Box: () => import_Box.Box,
@@ -307,6 +308,7 @@ var import_PerformanceApiAdapter = require("./lib/editor/managers/PerformanceMan
307
308
  var import_PerformanceManager = require("./lib/editor/managers/PerformanceManager/PerformanceManager");
308
309
  var import_UserPreferencesManager = require("./lib/editor/managers/UserPreferencesManager/UserPreferencesManager");
309
310
  var import_BaseBoxShapeUtil = require("./lib/editor/shapes/BaseBoxShapeUtil");
311
+ var import_BaseFrameLikeShapeUtil = require("./lib/editor/shapes/BaseFrameLikeShapeUtil");
310
312
  var import_GroupShapeUtil = require("./lib/editor/shapes/group/GroupShapeUtil");
311
313
  var import_ShapeUtil = require("./lib/editor/shapes/ShapeUtil");
312
314
  var import_getPerfectDashProps = require("./lib/editor/shapes/shared/getPerfectDashProps");
@@ -389,7 +391,7 @@ var import_uniq = require("./lib/utils/uniq");
389
391
  var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
390
392
  (0, import_utils.registerTldrawLibraryVersion)(
391
393
  "@tldraw/editor",
392
- "4.6.0-next.e390fde97eab",
394
+ "4.6.0-next.f17381e03ffe",
393
395
  "cjs"
394
396
  );
395
397
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\n\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport { DefaultBrush, type TLBrushProps } from './lib/components/default-components/DefaultBrush'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCollaboratorHint,\n\ttype TLCollaboratorHintProps,\n} from './lib/components/default-components/DefaultCollaboratorHint'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport {\n\tDefaultHandle,\n\ttype TLHandleProps,\n} from './lib/components/default-components/DefaultHandle'\nexport {\n\tDefaultHandles,\n\ttype TLHandlesProps,\n} from './lib/components/default-components/DefaultHandles'\nexport {\n\tDefaultScribble,\n\ttype TLScribbleProps,\n} from './lib/components/default-components/DefaultScribble'\nexport {\n\tDefaultSelectionBackground,\n\ttype TLSelectionBackgroundProps,\n} from './lib/components/default-components/DefaultSelectionBackground'\nexport {\n\tDefaultSelectionForeground,\n\ttype TLSelectionForegroundProps,\n} from './lib/components/default-components/DefaultSelectionForeground'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeIndicator,\n\ttype TLShapeIndicatorProps,\n} from './lib/components/default-components/DefaultShapeIndicator'\nexport { type TLShapeIndicatorErrorFallbackComponent } from './lib/components/default-components/DefaultShapeIndicatorErrorFallback'\nexport {\n\tDefaultShapeIndicators,\n\ttype TLShapeIndicatorsProps,\n} from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport {\n\tDefaultSnapIndicator,\n\ttype TLSnapIndicatorProps,\n} from './lib/components/default-components/DefaultSnapIndictor'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLCurrentUser,\n\tuseTldrawCurrentUser,\n\ttype TLCurrentUser,\n} from './lib/config/createTLCurrentUser'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tdefaultUserStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { type TLAnyAssetUtilConstructor } from './lib/config/defaultAssets'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport { AssetUtil, type TLAssetUtilConstructor } from './lib/editor/assets/AssetUtil'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport { FontManager } from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport { InputsManager } from './lib/editor/managers/InputsManager/InputsManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n\ttype ScribbleSessionOptions,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport { SpatialIndexManager } from './lib/editor/managers/SpatialIndexManager/SpatialIndexManager'\nexport {\n\tTextManager,\n\ttype BatchMeasurementRequest,\n\ttype TLMeasuredTextSize,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { DEFAULT_THEME } from './lib/editor/managers/ThemeManager/defaultThemes'\nexport { ThemeManager, resolveThemes } from './lib/editor/managers/ThemeManager/ThemeManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\nexport { PerformanceApiAdapter } from './lib/editor/managers/PerformanceManager/PerformanceApiAdapter'\nexport { PerformanceManager } from './lib/editor/managers/PerformanceManager/PerformanceManager'\nexport {\n\ttype TLCameraEndPerfEvent,\n\ttype TLCameraStartPerfEvent,\n\ttype TLFramePerfEvent,\n\ttype TLInteractionEndPerfEvent,\n\ttype TLInteractionStartPerfEvent,\n\ttype TLPerfEventMap,\n\ttype TLPerfFrameTimeStats,\n\ttype TLPerfLongAnimationFrame,\n\ttype TLPerfLongAnimationFrameScript,\n\ttype TLShapeOperationPerfEvent,\n\ttype TLUndoRedoPerfEvent,\n} from './lib/editor/managers/PerformanceManager/perf-types'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLEditStartInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLIndicatorPath,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getOwnerDocument, getOwnerWindow } from './lib/exports/domUtils'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { useColorMode } from './lib/hooks/useColorMode'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughMouseOverEvents } from './lib/hooks/usePassThroughMouseOverEvents'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useSelectionEvents } from './lib/hooks/useSelectionEvents'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT } from './lib/license/LicenseProvider'\nexport {\n\tdefaultTldrawOptions,\n\ttype TLClipboardPasteRawInfo,\n\ttype TLClipboardWriteInfo,\n\ttype TldrawOptions,\n} from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\telementShouldCaptureKeys,\n\tgetGlobalDocument,\n\tgetGlobalWindow,\n\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport {\n\thardResetEditor,\n\topenWindow,\n\trefreshPage,\n\truntime,\n\tsetRuntimeOverrides,\n} from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n\nexport { getColorValue } from './lib/editor/managers/ThemeManager/defaultThemes'\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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,kCAAgE;AAChE,yBAOO;AACP,uBAKO;AACP,iBAWO;AACP,wBAA2B;AAC3B,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAMO;AACP,6BAIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AAQrB,IAAAC,wBAA8B;AAAA,IAN9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\n\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport { DefaultBrush, type TLBrushProps } from './lib/components/default-components/DefaultBrush'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCollaboratorHint,\n\ttype TLCollaboratorHintProps,\n} from './lib/components/default-components/DefaultCollaboratorHint'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport {\n\tDefaultHandle,\n\ttype TLHandleProps,\n} from './lib/components/default-components/DefaultHandle'\nexport {\n\tDefaultHandles,\n\ttype TLHandlesProps,\n} from './lib/components/default-components/DefaultHandles'\nexport {\n\tDefaultScribble,\n\ttype TLScribbleProps,\n} from './lib/components/default-components/DefaultScribble'\nexport {\n\tDefaultSelectionBackground,\n\ttype TLSelectionBackgroundProps,\n} from './lib/components/default-components/DefaultSelectionBackground'\nexport {\n\tDefaultSelectionForeground,\n\ttype TLSelectionForegroundProps,\n} from './lib/components/default-components/DefaultSelectionForeground'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeIndicator,\n\ttype TLShapeIndicatorProps,\n} from './lib/components/default-components/DefaultShapeIndicator'\nexport { type TLShapeIndicatorErrorFallbackComponent } from './lib/components/default-components/DefaultShapeIndicatorErrorFallback'\nexport {\n\tDefaultShapeIndicators,\n\ttype TLShapeIndicatorsProps,\n} from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport {\n\tDefaultSnapIndicator,\n\ttype TLSnapIndicatorProps,\n} from './lib/components/default-components/DefaultSnapIndictor'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLCurrentUser,\n\tuseTldrawCurrentUser,\n\ttype TLCurrentUser,\n} from './lib/config/createTLCurrentUser'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tdefaultUserStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { type TLAnyAssetUtilConstructor } from './lib/config/defaultAssets'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport { AssetUtil, type TLAssetUtilConstructor } from './lib/editor/assets/AssetUtil'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport { FontManager } from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport { InputsManager } from './lib/editor/managers/InputsManager/InputsManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n\ttype ScribbleSessionOptions,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport { SpatialIndexManager } from './lib/editor/managers/SpatialIndexManager/SpatialIndexManager'\nexport {\n\tTextManager,\n\ttype BatchMeasurementRequest,\n\ttype TLMeasuredTextSize,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { DEFAULT_THEME } from './lib/editor/managers/ThemeManager/defaultThemes'\nexport { ThemeManager, resolveThemes } from './lib/editor/managers/ThemeManager/ThemeManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\nexport { PerformanceApiAdapter } from './lib/editor/managers/PerformanceManager/PerformanceApiAdapter'\nexport { PerformanceManager } from './lib/editor/managers/PerformanceManager/PerformanceManager'\nexport {\n\ttype TLCameraEndPerfEvent,\n\ttype TLCameraStartPerfEvent,\n\ttype TLFramePerfEvent,\n\ttype TLInteractionEndPerfEvent,\n\ttype TLInteractionStartPerfEvent,\n\ttype TLPerfEventMap,\n\ttype TLPerfFrameTimeStats,\n\ttype TLPerfLongAnimationFrame,\n\ttype TLPerfLongAnimationFrameScript,\n\ttype TLShapeOperationPerfEvent,\n\ttype TLUndoRedoPerfEvent,\n} from './lib/editor/managers/PerformanceManager/perf-types'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { BaseFrameLikeShapeUtil } from './lib/editor/shapes/BaseFrameLikeShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLEditStartInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLIndicatorPath,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getOwnerDocument, getOwnerWindow } from './lib/exports/domUtils'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { useColorMode } from './lib/hooks/useColorMode'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughMouseOverEvents } from './lib/hooks/usePassThroughMouseOverEvents'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useSelectionEvents } from './lib/hooks/useSelectionEvents'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT } from './lib/license/LicenseProvider'\nexport {\n\tdefaultTldrawOptions,\n\ttype TLClipboardPasteRawInfo,\n\ttype TLClipboardWriteInfo,\n\ttype TldrawOptions,\n} from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\telementShouldCaptureKeys,\n\tgetGlobalDocument,\n\tgetGlobalWindow,\n\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport {\n\thardResetEditor,\n\topenWindow,\n\trefreshPage,\n\truntime,\n\tsetRuntimeOverrides,\n} from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n\nexport { getColorValue } from './lib/editor/managers/ThemeManager/defaultThemes'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAA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7B,uBAA0B;AAC1B,uBAMO;AACP,iCAAoC;AAEpC,sBAA2C;AAC3C,iCAAoC;AACpC,yBAAkE;AAClE,2BAA8B;AAC9B,0BAA6B;AAC7B,2BAA8B;AAC9B,2CAA8C;AAC9C,uCAA0C;AAC1C,wBAA2B;AAC3B,yBAA4B;AAC5B,yBAA4B;AAC5B,uBAMO;AACP,gCAAmC;AACnC,wBAAiD;AACjD,0BAA6B;AAC7B,+BAAkC;AAClC,4BAQO;AACP,6BAAgC;AAChC,qBAKO;AACP,iBASO;AACP,qBAAwB;AACxB,mBAAsB;AACtB,sBAAyB;AACzB,2BAA8B;AAC9B,2BAA8B;AAC9B,oBAAuB;AACvB,uBAA0B;AAC1B,gCAA6C;AAC7C,wBAMO;AACP,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,wBAA2B;AAC3B,yBAA4B;AAC5B,uBAA0B;AAC1B,uBAaO;AACP,iBAAiD;AACjD,IAAAA,gBAgCO;AACP,iBAAkC;AAClC,0BAYO;AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAOO;AACP,uBAKO;AACP,iBAWO;AACP,wBAA2B;AAC3B,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAMO;AACP,6BAIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AAQrB,IAAAC,wBAA8B;AAAA,IAN9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": ["import_utils", "import_defaultThemes"]
7
7
  }
@@ -113,6 +113,7 @@ const Collaborator = (0, import_state_react.track)(function Collaborator2({
113
113
  )) }) : null,
114
114
  CollaboratorShapeIndicator && selectedShapeIds.filter((id) => {
115
115
  if (editor.isShapeHidden(id)) return false;
116
+ if (!editor.options.useCanvasIndicators) return true;
116
117
  const shape = editor.getShape(id);
117
118
  if (!shape) return false;
118
119
  const util = editor.getShapeUtil(shape);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/components/LiveCollaborators.tsx"],
4
- "sourcesContent": ["import { track } from '@tldraw/state-react'\nimport { TLInstancePresence } from '@tldraw/tlschema'\nimport { useEffect, useRef, useState } from 'react'\nimport { Editor } from '../editor/Editor'\nimport { useEditorComponents } from '../hooks/EditorComponentsContext'\nimport { useEditor } from '../hooks/useEditor'\nimport { usePeerIds } from '../hooks/usePeerIds'\nimport { usePresence } from '../hooks/usePresence'\nimport {\n\tCollaboratorState,\n\tgetCollaboratorStateFromElapsedTime,\n\tshouldShowCollaborator,\n} from '../utils/collaboratorState'\n\nexport const LiveCollaborators = track(function Collaborators() {\n\tconst peerIds = usePeerIds()\n\treturn peerIds.map((id) => <CollaboratorGuard key={id} collaboratorId={id} />)\n})\n\nconst CollaboratorGuard = track(function CollaboratorGuard({\n\tcollaboratorId,\n}: {\n\tcollaboratorId: string\n}) {\n\tconst editor = useEditor()\n\tconst presence = usePresence(collaboratorId)\n\tconst collaboratorState = useCollaboratorState(editor, presence)\n\n\tif (!(presence && presence.currentPageId === editor.getCurrentPageId())) {\n\t\t// No need to render if we don't have a presence or if they're on a different page\n\t\treturn null\n\t}\n\n\tif (!shouldShowCollaborator(editor, presence, collaboratorState)) {\n\t\treturn null\n\t}\n\n\treturn <Collaborator latestPresence={presence} />\n})\n\nconst Collaborator = track(function Collaborator({\n\tlatestPresence,\n}: {\n\tlatestPresence: TLInstancePresence\n}) {\n\tconst editor = useEditor()\n\n\tconst {\n\t\tCollaboratorBrush,\n\t\tCollaboratorScribble,\n\t\tCollaboratorCursor,\n\t\tCollaboratorHint,\n\t\tCollaboratorShapeIndicator,\n\t} = useEditorComponents()\n\n\tconst zoomLevel = editor.getZoomLevel()\n\tconst viewportPageBounds = editor.getViewportPageBounds()\n\tconst { userId, chatMessage, brush, scribbles, selectedShapeIds, userName, cursor, color } =\n\t\tlatestPresence\n\n\tif (!cursor) return null\n\n\t// Add a little padding to the top-left of the viewport\n\t// so that the cursor doesn't get cut off\n\tconst isCursorInViewport = !(\n\t\tcursor.x < viewportPageBounds.minX - 12 / zoomLevel ||\n\t\tcursor.y < viewportPageBounds.minY - 16 / zoomLevel ||\n\t\tcursor.x > viewportPageBounds.maxX - 12 / zoomLevel ||\n\t\tcursor.y > viewportPageBounds.maxY - 16 / zoomLevel\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t{brush && CollaboratorBrush ? (\n\t\t\t\t<CollaboratorBrush\n\t\t\t\t\tclassName=\"tl-collaborator__brush\"\n\t\t\t\t\tkey={userId + '_brush'}\n\t\t\t\t\tuserId={userId}\n\t\t\t\t\tbrush={brush}\n\t\t\t\t\tcolor={color}\n\t\t\t\t\topacity={0.1}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{isCursorInViewport && CollaboratorCursor ? (\n\t\t\t\t<CollaboratorCursor\n\t\t\t\t\tclassName=\"tl-collaborator__cursor\"\n\t\t\t\t\tkey={userId + '_cursor'}\n\t\t\t\t\tuserId={userId}\n\t\t\t\t\tpoint={cursor}\n\t\t\t\t\tcolor={color}\n\t\t\t\t\tzoom={zoomLevel}\n\t\t\t\t\tname={userName !== 'New User' ? userName : null}\n\t\t\t\t\tchatMessage={chatMessage ?? ''}\n\t\t\t\t/>\n\t\t\t) : CollaboratorHint ? (\n\t\t\t\t<CollaboratorHint\n\t\t\t\t\tclassName=\"tl-collaborator__cursor-hint\"\n\t\t\t\t\tkey={userId + '_cursor_hint'}\n\t\t\t\t\tuserId={userId}\n\t\t\t\t\tpoint={cursor}\n\t\t\t\t\tcolor={color}\n\t\t\t\t\tzoom={zoomLevel}\n\t\t\t\t\tviewport={viewportPageBounds}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{CollaboratorScribble && scribbles.length ? (\n\t\t\t\t<>\n\t\t\t\t\t{scribbles.map((scribble) => (\n\t\t\t\t\t\t<CollaboratorScribble\n\t\t\t\t\t\t\tkey={userId + '_scribble_' + scribble.id}\n\t\t\t\t\t\t\tclassName=\"tl-collaborator__scribble\"\n\t\t\t\t\t\t\tuserId={userId}\n\t\t\t\t\t\t\tscribble={scribble}\n\t\t\t\t\t\t\tcolor={color}\n\t\t\t\t\t\t\tzoom={zoomLevel}\n\t\t\t\t\t\t\topacity={scribble.color === 'laser' ? 0.5 : 0.1}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</>\n\t\t\t) : null}\n\t\t\t{CollaboratorShapeIndicator &&\n\t\t\t\tselectedShapeIds\n\t\t\t\t\t.filter((id) => {\n\t\t\t\t\t\t// Skip hidden shapes\n\t\t\t\t\t\tif (editor.isShapeHidden(id)) return false\n\t\t\t\t\t\t// Only render SVG indicators for shapes that use legacy indicators\n\t\t\t\t\t\t// Canvas-based indicators are handled by CanvasShapeIndicators\n\t\t\t\t\t\tconst shape = editor.getShape(id)\n\t\t\t\t\t\tif (!shape) return false\n\t\t\t\t\t\tconst util = editor.getShapeUtil(shape)\n\t\t\t\t\t\treturn util.useLegacyIndicator()\n\t\t\t\t\t})\n\t\t\t\t\t.map((shapeId) => (\n\t\t\t\t\t\t<CollaboratorShapeIndicator\n\t\t\t\t\t\t\tclassName=\"tl-collaborator__shape-indicator\"\n\t\t\t\t\t\t\tkey={userId + '_' + shapeId}\n\t\t\t\t\t\t\tuserId={userId}\n\t\t\t\t\t\t\tshapeId={shapeId}\n\t\t\t\t\t\t\tcolor={color}\n\t\t\t\t\t\t\topacity={0.5}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t</>\n\t)\n})\n\nfunction useCollaboratorState(\n\teditor: Editor,\n\tlatestPresence: TLInstancePresence | null\n): CollaboratorState {\n\tconst rLastActivityTimestamp = useRef(latestPresence?.lastActivityTimestamp ?? -1)\n\n\tconst [state, setState] = useState<CollaboratorState>(() =>\n\t\tgetCollaboratorStateFromElapsedTime(editor, Date.now() - rLastActivityTimestamp.current)\n\t)\n\n\tuseEffect(() => {\n\t\tconst interval = editor.timers.setInterval(() => {\n\t\t\tsetState(\n\t\t\t\tgetCollaboratorStateFromElapsedTime(editor, Date.now() - rLastActivityTimestamp.current)\n\t\t\t)\n\t\t}, editor.options.collaboratorCheckIntervalMs)\n\n\t\treturn () => clearInterval(interval)\n\t}, [editor])\n\n\tif (latestPresence) {\n\t\t// We can do this on every render, it's free and cheaper than an effect\n\t\t// remember, there can be lots and lots of cursors moving around all the time\n\t\trLastActivityTimestamp.current = latestPresence.lastActivityTimestamp ?? Infinity\n\t}\n\n\treturn state\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgB4B;AAhB5B,yBAAsB;AAEtB,mBAA4C;AAE5C,qCAAoC;AACpC,uBAA0B;AAC1B,wBAA2B;AAC3B,yBAA4B;AAC5B,+BAIO;AAEA,MAAM,wBAAoB,0BAAM,SAAS,gBAAgB;AAC/D,QAAM,cAAU,8BAAW;AAC3B,SAAO,QAAQ,IAAI,CAAC,OAAO,4CAAC,qBAA2B,gBAAgB,MAApB,EAAwB,CAAE;AAC9E,CAAC;AAED,MAAM,wBAAoB,0BAAM,SAASA,mBAAkB;AAAA,EAC1D;AACD,GAEG;AACF,QAAM,aAAS,4BAAU;AACzB,QAAM,eAAW,gCAAY,cAAc;AAC3C,QAAM,oBAAoB,qBAAqB,QAAQ,QAAQ;AAE/D,MAAI,EAAE,YAAY,SAAS,kBAAkB,OAAO,iBAAiB,IAAI;AAExE,WAAO;AAAA,EACR;AAEA,MAAI,KAAC,iDAAuB,QAAQ,UAAU,iBAAiB,GAAG;AACjE,WAAO;AAAA,EACR;AAEA,SAAO,4CAAC,gBAAa,gBAAgB,UAAU;AAChD,CAAC;AAED,MAAM,mBAAe,0BAAM,SAASC,cAAa;AAAA,EAChD;AACD,GAEG;AACF,QAAM,aAAS,4BAAU;AAEzB,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QA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AO;AAGrC,YAAM,QAAQ,OAAO,SAAS,EAAE;AAChC,UAAI,CAAC,MAAO,QAAO;AACnB,YAAM,OAAO,OAAO,aAAa,KAAK;AACtC,aAAO,KAAK,mBAAmB;AAAA,IAChC,CAAC,EACA,IAAI,CAAC,YACL;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QAEV;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAS;AAAA;AAAA,MAJJ,SAAS,MAAM;AAAA,IAKrB,CACA;AAAA,KACJ;AAEF,CAAC;AAED,SAAS,qBACR,QACA,gBACoB;AACpB,QAAM,6BAAyB,qBAAO,gBAAgB,yBAAyB,EAAE;AAEjF,QAAM,CAAC,OAAO,QAAQ,QAAI;AAAA,IAA4B,UACrD,8DAAoC,QAAQ,KAAK,IAAI,IAAI,uBAAuB,OAAO;AAAA,EACxF;AAEA,8BAAU,MAAM;AACf,UAAM,WAAW,OAAO,OAAO,YAAY,MAAM;AAChD;AAAA,YACC,8DAAoC,QAAQ,KAAK,IAAI,IAAI,uBAAuB,OAAO;AAAA,MACxF;AAAA,IACD,GAAG,OAAO,QAAQ,2BAA2B;AAE7C,WAAO,MAAM,cAAc,QAAQ;AAAA,EACpC,GAAG,CAAC,MAAM,CAAC;AAEX,MAAI,gBAAgB;AAGnB,2BAAuB,UAAU,eAAe,yBAAyB;AAAA,EAC1E;AAEA,SAAO;AACR;",
4
+ "sourcesContent": ["import { track } from '@tldraw/state-react'\nimport { TLInstancePresence } from '@tldraw/tlschema'\nimport { useEffect, useRef, useState } from 'react'\nimport { Editor } from '../editor/Editor'\nimport { useEditorComponents } from '../hooks/EditorComponentsContext'\nimport { useEditor } from '../hooks/useEditor'\nimport { usePeerIds } from '../hooks/usePeerIds'\nimport { usePresence } from '../hooks/usePresence'\nimport {\n\tCollaboratorState,\n\tgetCollaboratorStateFromElapsedTime,\n\tshouldShowCollaborator,\n} from '../utils/collaboratorState'\n\nexport const LiveCollaborators = track(function Collaborators() {\n\tconst peerIds = usePeerIds()\n\treturn peerIds.map((id) => <CollaboratorGuard key={id} collaboratorId={id} />)\n})\n\nconst CollaboratorGuard = track(function CollaboratorGuard({\n\tcollaboratorId,\n}: {\n\tcollaboratorId: string\n}) {\n\tconst editor = useEditor()\n\tconst presence = usePresence(collaboratorId)\n\tconst collaboratorState = useCollaboratorState(editor, presence)\n\n\tif (!(presence && presence.currentPageId === editor.getCurrentPageId())) {\n\t\t// No need to render if we don't have a presence or if they're on a different page\n\t\treturn null\n\t}\n\n\tif (!shouldShowCollaborator(editor, presence, collaboratorState)) {\n\t\treturn null\n\t}\n\n\treturn <Collaborator latestPresence={presence} />\n})\n\nconst Collaborator = track(function Collaborator({\n\tlatestPresence,\n}: {\n\tlatestPresence: TLInstancePresence\n}) {\n\tconst editor = useEditor()\n\n\tconst {\n\t\tCollaboratorBrush,\n\t\tCollaboratorScribble,\n\t\tCollaboratorCursor,\n\t\tCollaboratorHint,\n\t\tCollaboratorShapeIndicator,\n\t} = useEditorComponents()\n\n\tconst zoomLevel = editor.getZoomLevel()\n\tconst viewportPageBounds = editor.getViewportPageBounds()\n\tconst { userId, chatMessage, brush, scribbles, selectedShapeIds, userName, cursor, color } =\n\t\tlatestPresence\n\n\tif (!cursor) return null\n\n\t// Add a little padding to the top-left of the viewport\n\t// so that the cursor doesn't get cut off\n\tconst isCursorInViewport = !(\n\t\tcursor.x < viewportPageBounds.minX - 12 / zoomLevel ||\n\t\tcursor.y < viewportPageBounds.minY - 16 / zoomLevel ||\n\t\tcursor.x > viewportPageBounds.maxX - 12 / zoomLevel ||\n\t\tcursor.y > viewportPageBounds.maxY - 16 / zoomLevel\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t{brush && CollaboratorBrush ? (\n\t\t\t\t<CollaboratorBrush\n\t\t\t\t\tclassName=\"tl-collaborator__brush\"\n\t\t\t\t\tkey={userId + '_brush'}\n\t\t\t\t\tuserId={userId}\n\t\t\t\t\tbrush={brush}\n\t\t\t\t\tcolor={color}\n\t\t\t\t\topacity={0.1}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{isCursorInViewport && CollaboratorCursor ? (\n\t\t\t\t<CollaboratorCursor\n\t\t\t\t\tclassName=\"tl-collaborator__cursor\"\n\t\t\t\t\tkey={userId + '_cursor'}\n\t\t\t\t\tuserId={userId}\n\t\t\t\t\tpoint={cursor}\n\t\t\t\t\tcolor={color}\n\t\t\t\t\tzoom={zoomLevel}\n\t\t\t\t\tname={userName !== 'New User' ? userName : null}\n\t\t\t\t\tchatMessage={chatMessage ?? ''}\n\t\t\t\t/>\n\t\t\t) : CollaboratorHint ? (\n\t\t\t\t<CollaboratorHint\n\t\t\t\t\tclassName=\"tl-collaborator__cursor-hint\"\n\t\t\t\t\tkey={userId + '_cursor_hint'}\n\t\t\t\t\tuserId={userId}\n\t\t\t\t\tpoint={cursor}\n\t\t\t\t\tcolor={color}\n\t\t\t\t\tzoom={zoomLevel}\n\t\t\t\t\tviewport={viewportPageBounds}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{CollaboratorScribble && scribbles.length ? (\n\t\t\t\t<>\n\t\t\t\t\t{scribbles.map((scribble) => (\n\t\t\t\t\t\t<CollaboratorScribble\n\t\t\t\t\t\t\tkey={userId + '_scribble_' + scribble.id}\n\t\t\t\t\t\t\tclassName=\"tl-collaborator__scribble\"\n\t\t\t\t\t\t\tuserId={userId}\n\t\t\t\t\t\t\tscribble={scribble}\n\t\t\t\t\t\t\tcolor={color}\n\t\t\t\t\t\t\tzoom={zoomLevel}\n\t\t\t\t\t\t\topacity={scribble.color === 'laser' ? 0.5 : 0.1}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</>\n\t\t\t) : null}\n\t\t\t{CollaboratorShapeIndicator &&\n\t\t\t\tselectedShapeIds\n\t\t\t\t\t.filter((id) => {\n\t\t\t\t\t\t// Skip hidden shapes\n\t\t\t\t\t\tif (editor.isShapeHidden(id)) return false\n\t\t\t\t\t\t// When canvas indicators are disabled, render SVG indicators for\n\t\t\t\t\t\t// every selected shape. Otherwise shapes that opt into the canvas\n\t\t\t\t\t\t// path via useLegacyIndicator() === false would never get a\n\t\t\t\t\t\t// collaborator indicator drawn.\n\t\t\t\t\t\tif (!editor.options.useCanvasIndicators) return true\n\t\t\t\t\t\t// Otherwise, only render SVG indicators for shapes that opt in to\n\t\t\t\t\t\t// the legacy path \u2014 canvas-based indicators are handled by\n\t\t\t\t\t\t// CanvasShapeIndicators.\n\t\t\t\t\t\tconst shape = editor.getShape(id)\n\t\t\t\t\t\tif (!shape) return false\n\t\t\t\t\t\tconst util = editor.getShapeUtil(shape)\n\t\t\t\t\t\treturn util.useLegacyIndicator()\n\t\t\t\t\t})\n\t\t\t\t\t.map((shapeId) => (\n\t\t\t\t\t\t<CollaboratorShapeIndicator\n\t\t\t\t\t\t\tclassName=\"tl-collaborator__shape-indicator\"\n\t\t\t\t\t\t\tkey={userId + '_' + shapeId}\n\t\t\t\t\t\t\tuserId={userId}\n\t\t\t\t\t\t\tshapeId={shapeId}\n\t\t\t\t\t\t\tcolor={color}\n\t\t\t\t\t\t\topacity={0.5}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t</>\n\t)\n})\n\nfunction useCollaboratorState(\n\teditor: Editor,\n\tlatestPresence: TLInstancePresence | null\n): CollaboratorState {\n\tconst rLastActivityTimestamp = useRef(latestPresence?.lastActivityTimestamp ?? -1)\n\n\tconst [state, setState] = useState<CollaboratorState>(() =>\n\t\tgetCollaboratorStateFromElapsedTime(editor, Date.now() - rLastActivityTimestamp.current)\n\t)\n\n\tuseEffect(() => {\n\t\tconst interval = editor.timers.setInterval(() => {\n\t\t\tsetState(\n\t\t\t\tgetCollaboratorStateFromElapsedTime(editor, Date.now() - rLastActivityTimestamp.current)\n\t\t\t)\n\t\t}, editor.options.collaboratorCheckIntervalMs)\n\n\t\treturn () => clearInterval(interval)\n\t}, [editor])\n\n\tif (latestPresence) {\n\t\t// We can do this on every render, it's free and cheaper than an effect\n\t\t// remember, there can be lots and lots of cursors moving around all the time\n\t\trLastActivityTimestamp.current = latestPresence.lastActivityTimestamp ?? Infinity\n\t}\n\n\treturn state\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgB4B;AAhB5B,yBAAsB;AAEtB,mBAA4C;AAE5C,qCAAoC;AACpC,uBAA0B;AAC1B,wBAA2B;AAC3B,yBAA4B;AAC5B,+BAIO;AAEA,MAAM,wBAAoB,0BAAM,SAAS,gBAAgB;AAC/D,QAAM,cAAU,8BAAW;AAC3B,SAAO,QAAQ,IAAI,CAAC,OAAO,4CAAC,qBAA2B,gBAAgB,MAApB,EAAwB,CAAE;AAC9E,CAAC;AAED,MAAM,wBAAoB,0BAAM,SAASA,mBAAkB;AAAA,EAC1D;AACD,GAEG;AACF,QAAM,aAAS,4BAAU;AACzB,QAAM,eAAW,gCAAY,cAAc;AAC3C,QAAM,oBAAoB,qBAAqB,QAAQ,QAAQ;AAE/D,MAAI,EAAE,YAAY,SAAS,kBAAkB,OAAO,iBAAiB,IAAI;AAExE,WAAO;AAAA,EACR;AAEA,MAAI,KAAC,iDAAuB,QAAQ,UAAU,iBAAiB,GAAG;AACjE,WAAO;AAAA,EACR;AAEA,SAAO,4CAAC,gBAAa,gBAAgB,UAAU;AAChD,CAAC;AAED,MAAM,mBAAe,0BAAM,SAASC,cAAa;AAAA,EAChD;AACD,GAEG;AACF,QAAM,aAAS,4BAAU;AAEzB,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,oDAAoB;AAExB,QAAM,YAAY,OAAO,aAAa;AACtC,QAAM,qBAAqB,OAAO,sBAAsB;AACxD,QAAM,EAAE,QAAQ,aAAa,OAAO,WAAW,kBAAkB,UAAU,QAAQ,MAAM,IACxF;AAED,MAAI,CAAC,OAAQ,QAAO;AAIpB,QAAM,qBAAqB,EAC1B,OAAO,IAAI,mBAAmB,OAAO,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AAAA,QACA,WAAU;AAAA,QAEV;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAS;AAAA;AAAA,MAJJ,SAAS,MAAM;AAAA,IAKrB,CACA;AAAA,KACJ;AAEF,CAAC;AAED,SAAS,qBACR,QACA,gBACoB;AACpB,QAAM,6BAAyB,qBAAO,gBAAgB,yBAAyB,EAAE;AAEjF,QAAM,CAAC,OAAO,QAAQ,QAAI;AAAA,IAA4B,UACrD,8DAAoC,QAAQ,KAAK,IAAI,IAAI,uBAAuB,OAAO;AAAA,EACxF;AAEA,8BAAU,MAAM;AACf,UAAM,WAAW,OAAO,OAAO,YAAY,MAAM;AAChD;AAAA,YACC,8DAAoC,QAAQ,KAAK,IAAI,IAAI,uBAAuB,OAAO;AAAA,MACxF;AAAA,IACD,GAAG,OAAO,QAAQ,2BAA2B;AAE7C,WAAO,MAAM,cAAc,QAAQ;AAAA,EACpC,GAAG,CAAC,MAAM,CAAC;AAEX,MAAI,gBAAgB;AAGnB,2BAAuB,UAAU,eAAe,yBAAyB;AAAA,EAC1E;AAEA,SAAO;AACR;",
6
6
  "names": ["CollaboratorGuard", "Collaborator"]
7
7
  }
@@ -24,9 +24,11 @@ module.exports = __toCommonJS(MenuClickCapture_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
25
  var import_state_react = require("@tldraw/state-react");
26
26
  var import_react = require("react");
27
+ var import_react_dom = require("react-dom");
27
28
  var import_useCanvasEvents = require("../hooks/useCanvasEvents");
28
29
  var import_useEditor = require("../hooks/useEditor");
29
30
  var import_Vec = require("../primitives/Vec");
31
+ var import_dom = require("../utils/dom");
30
32
  var import_getPointerInfo = require("../utils/getPointerInfo");
31
33
  function MenuClickCapture() {
32
34
  const editor = (0, import_useEditor.useEditor)();
@@ -37,81 +39,125 @@ function MenuClickCapture() {
37
39
  const rPointerState = (0, import_react.useRef)({
38
40
  isDown: false,
39
41
  isDragging: false,
42
+ button: 0,
40
43
  start: new import_Vec.Vec()
41
44
  });
45
+ const rCancelContextMenuSwallow = (0, import_react.useRef)(null);
46
+ (0, import_react.useEffect)(
47
+ () => () => {
48
+ rCancelContextMenuSwallow.current?.();
49
+ rCancelContextMenuSwallow.current = null;
50
+ },
51
+ []
52
+ );
53
+ const swallowNextNativeContextMenu = (0, import_react.useCallback)(() => {
54
+ rCancelContextMenuSwallow.current?.();
55
+ const doc = editor.getContainerDocument();
56
+ const onContextMenu = (event) => {
57
+ if (!event.isTrusted) return;
58
+ rCancelContextMenuSwallow.current?.();
59
+ rCancelContextMenuSwallow.current = null;
60
+ event.preventDefault();
61
+ event.stopImmediatePropagation();
62
+ };
63
+ const cancel = () => doc.removeEventListener("contextmenu", onContextMenu, true);
64
+ rCancelContextMenuSwallow.current = cancel;
65
+ doc.addEventListener("contextmenu", onContextMenu, true);
66
+ doc.defaultView?.setTimeout(() => {
67
+ if (rCancelContextMenuSwallow.current === cancel) {
68
+ cancel();
69
+ rCancelContextMenuSwallow.current = null;
70
+ }
71
+ }, 0);
72
+ }, [editor]);
42
73
  const handlePointerDown = (0, import_react.useCallback)(
43
74
  (e) => {
44
- if (e.button === 0) {
45
- setIsPointing(true);
46
- rPointerState.current = {
47
- isDown: true,
48
- isDragging: false,
49
- start: new import_Vec.Vec(e.clientX, e.clientY)
50
- };
51
- rDidAPointerDownAndDragWhileMenuWasOpen.current = false;
52
- }
75
+ if (e.button !== 0 && e.button !== 2) return;
76
+ (0, import_react_dom.flushSync)(() => setIsPointing(true));
77
+ (0, import_dom.setPointerCapture)(e.currentTarget, e);
78
+ rPointerState.current = {
79
+ isDown: true,
80
+ isDragging: false,
81
+ button: e.button,
82
+ start: new import_Vec.Vec(e.clientX, e.clientY)
83
+ };
53
84
  if (e.button === 2) {
54
- const ownerDocument = editor.getContainerDocument();
55
- ownerDocument.addEventListener(
56
- "contextmenu",
57
- (event) => {
58
- event.preventDefault();
59
- event.stopImmediatePropagation();
60
- },
61
- { capture: true, once: true }
62
- );
85
+ if (!editor.options.rightClickPanning) {
86
+ swallowNextNativeContextMenu();
87
+ editor.menus.clearOpenMenus();
88
+ return;
89
+ }
90
+ const canvas = editor.getContainer().querySelector(".tl-canvas") ?? e.currentTarget;
91
+ canvasEvents.onPointerDown?.({ ...e, currentTarget: canvas });
92
+ swallowNextNativeContextMenu();
93
+ return;
63
94
  }
64
95
  editor.menus.clearOpenMenus();
65
96
  },
66
- [editor]
97
+ [canvasEvents, editor, swallowNextNativeContextMenu]
67
98
  );
68
- const rDidAPointerDownAndDragWhileMenuWasOpen = (0, import_react.useRef)(false);
69
99
  const handlePointerMove = (0, import_react.useCallback)(
70
100
  (e) => {
71
- if (!rPointerState.current.isDown) return;
72
- const { x, y } = rPointerState.current.start;
73
- if (!rDidAPointerDownAndDragWhileMenuWasOpen.current) {
74
- if (
75
- // We're pointing, but are we dragging?
76
- import_Vec.Vec.Dist2(rPointerState.current.start, new import_Vec.Vec(e.clientX, e.clientY)) > editor.options.dragDistanceSquared
77
- ) {
78
- rDidAPointerDownAndDragWhileMenuWasOpen.current = true;
79
- rPointerState.current = {
80
- ...rPointerState.current,
81
- isDown: true,
82
- isDragging: true
83
- };
84
- canvasEvents.onPointerDown?.({
85
- ...e,
86
- clientX: x,
87
- clientY: y,
88
- button: 0
89
- });
101
+ const state = rPointerState.current;
102
+ if (!state.isDown) return;
103
+ if (state.button !== 2 && !state.isDragging) {
104
+ if (import_Vec.Vec.Dist2(state.start, new import_Vec.Vec(e.clientX, e.clientY)) <= editor.options.dragDistanceSquared) {
105
+ return;
90
106
  }
91
- }
92
- if (rDidAPointerDownAndDragWhileMenuWasOpen.current) {
107
+ state.isDragging = true;
93
108
  editor.dispatch({
94
109
  type: "pointer",
95
110
  target: "canvas",
96
- name: "pointer_move",
97
- ...(0, import_getPointerInfo.getPointerInfo)(editor, e)
111
+ name: "pointer_down",
112
+ ...(0, import_getPointerInfo.getPointerInfo)(editor, { ...e, clientX: state.start.x, clientY: state.start.y })
98
113
  });
99
114
  }
115
+ editor.dispatch({
116
+ type: "pointer",
117
+ target: "canvas",
118
+ name: "pointer_move",
119
+ ...(0, import_getPointerInfo.getPointerInfo)(editor, e)
120
+ });
100
121
  },
101
- [canvasEvents, editor]
122
+ [editor]
102
123
  );
103
124
  const handlePointerUp = (0, import_react.useCallback)(
104
125
  (e) => {
105
- canvasEvents.onPointerUp?.(e);
126
+ const isStaticRightClick = e.button === 2 && !rPointerState.current.isDragging;
127
+ editor.dispatch({
128
+ type: "pointer",
129
+ target: "canvas",
130
+ name: "pointer_up",
131
+ ...(0, import_getPointerInfo.getPointerInfo)(editor, e)
132
+ });
133
+ if (isStaticRightClick && editor.options.rightClickPanning) {
134
+ const canvas = editor.getContainer().querySelector(".tl-canvas");
135
+ const trigger = canvas?.parentElement ?? e.currentTarget;
136
+ editor.timers.requestAnimationFrame(() => {
137
+ trigger.dispatchEvent(
138
+ new PointerEvent("contextmenu", {
139
+ bubbles: true,
140
+ clientX: e.clientX,
141
+ clientY: e.clientY,
142
+ button: 2,
143
+ buttons: 0,
144
+ pointerId: e.pointerId,
145
+ pointerType: e.pointerType,
146
+ isPrimary: e.isPrimary
147
+ })
148
+ );
149
+ });
150
+ }
151
+ (0, import_dom.releasePointerCapture)(e.currentTarget, e);
106
152
  setIsPointing(false);
107
153
  rPointerState.current = {
108
154
  isDown: false,
109
155
  isDragging: false,
156
+ button: 0,
110
157
  start: new import_Vec.Vec(e.clientX, e.clientY)
111
158
  };
112
- rDidAPointerDownAndDragWhileMenuWasOpen.current = false;
113
159
  },
114
- [canvasEvents]
160
+ [editor]
115
161
  );
116
162
  return showElement && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
117
163
  "div",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/components/MenuClickCapture.tsx"],
4
- "sourcesContent": ["import { useValue } from '@tldraw/state-react'\nimport { PointerEvent, useCallback, useRef, useState } from 'react'\nimport { useCanvasEvents } from '../hooks/useCanvasEvents'\nimport { useEditor } from '../hooks/useEditor'\nimport { Vec } from '../primitives/Vec'\nimport { getPointerInfo } from '../utils/getPointerInfo'\n\n/**\n * When a menu is open, this component prevents the user from interacting with the canvas.\n *\n * @public @react\n */\nexport function MenuClickCapture() {\n\tconst editor = useEditor()\n\n\t// Whether any menus are open\n\tconst isMenuOpen = useValue('is menu open', () => editor.menus.hasAnyOpenMenus(), [editor])\n\n\t// Whether we're pointing or not\u2014keep this component visible if we're pointing\n\tconst [isPointing, setIsPointing] = useState(false)\n\n\tconst showElement = isMenuOpen || isPointing\n\n\t// Get the same events that we use on the canvas\n\tconst canvasEvents = useCanvasEvents()\n\n\t// Keep track of the pointer state\n\tconst rPointerState = useRef({\n\t\tisDown: false,\n\t\tisDragging: false,\n\t\tstart: new Vec(),\n\t})\n\n\tconst handlePointerDown = useCallback(\n\t\t(e: PointerEvent) => {\n\t\t\tif (e.button === 0) {\n\t\t\t\tsetIsPointing(true)\n\t\t\t\trPointerState.current = {\n\t\t\t\t\tisDown: true,\n\t\t\t\t\tisDragging: false,\n\t\t\t\t\tstart: new Vec(e.clientX, e.clientY),\n\t\t\t\t}\n\t\t\t\trDidAPointerDownAndDragWhileMenuWasOpen.current = false\n\t\t\t}\n\t\t\tif (e.button === 2) {\n\t\t\t\t// Swallow the contextmenu event that follows this right-click pointerdown.\n\t\t\t\t// clearOpenMenus() below triggers a synchronous render that unmounts this\n\t\t\t\t// component, so our React onContextMenu handler won't be around to catch it.\n\t\t\t\t// Without this, the contextmenu event reaches the Radix Trigger and briefly\n\t\t\t\t// opens a new context menu (which then immediately dismisses \u2014 causing a flash).\n\t\t\t\tconst ownerDocument = editor.getContainerDocument()\n\t\t\t\townerDocument.addEventListener(\n\t\t\t\t\t'contextmenu',\n\t\t\t\t\t(event) => {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\tevent.stopImmediatePropagation()\n\t\t\t\t\t},\n\t\t\t\t\t{ capture: true, once: true }\n\t\t\t\t)\n\t\t\t}\n\t\t\teditor.menus.clearOpenMenus()\n\t\t},\n\t\t[editor]\n\t)\n\n\tconst rDidAPointerDownAndDragWhileMenuWasOpen = useRef(false)\n\n\tconst handlePointerMove = useCallback(\n\t\t(e: PointerEvent) => {\n\t\t\t// Do nothing unless we're pointing\n\t\t\tif (!rPointerState.current.isDown) return\n\n\t\t\t// call the onPointerDown with the original pointer position\n\t\t\tconst { x, y } = rPointerState.current.start\n\n\t\t\tif (!rDidAPointerDownAndDragWhileMenuWasOpen.current) {\n\t\t\t\tif (\n\t\t\t\t\t// We're pointing, but are we dragging?\n\t\t\t\t\tVec.Dist2(rPointerState.current.start, new Vec(e.clientX, e.clientY)) >\n\t\t\t\t\teditor.options.dragDistanceSquared\n\t\t\t\t) {\n\t\t\t\t\trDidAPointerDownAndDragWhileMenuWasOpen.current = true\n\t\t\t\t\t// Wehaddaeventitsadrag\n\t\t\t\t\trPointerState.current = {\n\t\t\t\t\t\t...rPointerState.current,\n\t\t\t\t\t\tisDown: true,\n\t\t\t\t\t\tisDragging: true,\n\t\t\t\t\t}\n\t\t\t\t\tcanvasEvents.onPointerDown?.({\n\t\t\t\t\t\t...e,\n\t\t\t\t\t\tclientX: x,\n\t\t\t\t\t\tclientY: y,\n\t\t\t\t\t\tbutton: 0,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (rDidAPointerDownAndDragWhileMenuWasOpen.current) {\n\t\t\t\teditor.dispatch({\n\t\t\t\t\ttype: 'pointer',\n\t\t\t\t\ttarget: 'canvas',\n\t\t\t\t\tname: 'pointer_move',\n\t\t\t\t\t...getPointerInfo(editor, e),\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[canvasEvents, editor]\n\t)\n\n\tconst handlePointerUp = useCallback(\n\t\t(e: PointerEvent) => {\n\t\t\t// Run the pointer up\n\t\t\tcanvasEvents.onPointerUp?.(e)\n\t\t\t// Then turn off pointing\n\t\t\tsetIsPointing(false)\n\t\t\t// Reset the pointer state\n\t\t\trPointerState.current = {\n\t\t\t\tisDown: false,\n\t\t\t\tisDragging: false,\n\t\t\t\tstart: new Vec(e.clientX, e.clientY),\n\t\t\t}\n\t\t\trDidAPointerDownAndDragWhileMenuWasOpen.current = false\n\t\t},\n\t\t[canvasEvents]\n\t)\n\n\treturn (\n\t\tshowElement && (\n\t\t\t<div\n\t\t\t\tclassName=\"tlui-menu-click-capture\"\n\t\t\t\tdata-testid=\"menu-click-capture.content\"\n\t\t\t\t{...canvasEvents}\n\t\t\t\tonPointerDown={handlePointerDown}\n\t\t\t\tonPointerMove={handlePointerMove}\n\t\t\t\tonPointerUp={handlePointerUp}\n\t\t\t\tonContextMenu={(e) => {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\te.stopPropagation()\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgIG;AAhIH,yBAAyB;AACzB,mBAA4D;AAC5D,6BAAgC;AAChC,uBAA0B;AAC1B,iBAAoB;AACpB,4BAA+B;AAOxB,SAAS,mBAAmB;AAClC,QAAM,aAAS,4BAAU;AAGzB,QAAM,iBAAa,6BAAS,gBAAgB,MAAM,OAAO,MAAM,gBAAgB,GAAG,CAAC,MAAM,CAAC;AAG1F,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,cAAc,cAAc;AAGlC,QAAM,mBAAe,wCAAgB;AAGrC,QAAM,oBAAgB,qBAAO;AAAA,IAC5B,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO,IAAI,eAAI;AAAA,EAChB,CAAC;AAED,QAAM,wBAAoB;AAAA,IACzB,CAAC,MAAoB;AACpB,UAAI,EAAE,WAAW,GAAG;AACnB,sBAAc,IAAI;AAClB,sBAAc,UAAU;AAAA,UACvB,QAAQ;AAAA,UACR,YAAY;AAAA,UACZ,OAAO,IAAI,eAAI,EAAE,SAAS,EAAE,OAAO;AAAA,QACpC;AACA,gDAAwC,UAAU;AAAA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ACR,YAAY;AAAA,QACZ,OAAO,IAAI,eAAI,EAAE,SAAS,EAAE,OAAO;AAAA,MACpC;AACA,8CAAwC,UAAU;AAAA,IACnD;AAAA,IACA,CAAC,YAAY;AAAA,EACd;AAEA,SACC,eACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,eAAY;AAAA,MACX,GAAG;AAAA,MACJ,eAAe;AAAA,MACf,eAAe;AAAA,MACf,aAAa;AAAA,MACb,eAAe,CAAC,MAAM;AACrB,UAAE,eAAe;AACjB,UAAE,gBAAgB;AAAA,MACnB;AAAA;AAAA,EACD;AAGH;",
4
+ "sourcesContent": ["import { useValue } from '@tldraw/state-react'\nimport { type PointerEvent, useCallback, useEffect, useRef, useState } from 'react'\nimport { flushSync } from 'react-dom'\nimport { useCanvasEvents } from '../hooks/useCanvasEvents'\nimport { useEditor } from '../hooks/useEditor'\nimport { Vec } from '../primitives/Vec'\nimport { releasePointerCapture, setPointerCapture } from '../utils/dom'\nimport { getPointerInfo } from '../utils/getPointerInfo'\n\n/**\n * When a menu is open, this component prevents the user from interacting with the canvas.\n *\n * @public @react\n */\nexport function MenuClickCapture() {\n\tconst editor = useEditor()\n\n\tconst isMenuOpen = useValue('is menu open', () => editor.menus.hasAnyOpenMenus(), [editor])\n\n\t// Keep this component mounted while the pointer is down so pointerup/move still\n\t// land here after a synchronous clearOpenMenus() flips isMenuOpen to false.\n\tconst [isPointing, setIsPointing] = useState(false)\n\tconst showElement = isMenuOpen || isPointing\n\n\tconst canvasEvents = useCanvasEvents()\n\n\tconst rPointerState = useRef({\n\t\tisDown: false,\n\t\tisDragging: false,\n\t\tbutton: 0,\n\t\tstart: new Vec(),\n\t})\n\n\t// Swallow the native contextmenu that follows a right-click pointerdown. Without\n\t// this, Radix's trigger catches the native event and opens a menu at the pointer-\n\t// DOWN position \u2014 then our own synthetic contextmenu (fired on pointerup) opens it\n\t// again at the release position, producing a visible flash.\n\tconst rCancelContextMenuSwallow = useRef<null | (() => void)>(null)\n\tuseEffect(\n\t\t() => () => {\n\t\t\trCancelContextMenuSwallow.current?.()\n\t\t\trCancelContextMenuSwallow.current = null\n\t\t},\n\t\t[]\n\t)\n\tconst swallowNextNativeContextMenu = useCallback(() => {\n\t\trCancelContextMenuSwallow.current?.()\n\t\tconst doc = editor.getContainerDocument()\n\t\tconst onContextMenu = (event: MouseEvent) => {\n\t\t\t// Skip our own synthetic contextmenu \u2014 only swallow the real browser one\n\t\t\tif (!event.isTrusted) return\n\t\t\trCancelContextMenuSwallow.current?.()\n\t\t\trCancelContextMenuSwallow.current = null\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopImmediatePropagation()\n\t\t}\n\t\tconst cancel = () => doc.removeEventListener('contextmenu', onContextMenu, true)\n\t\trCancelContextMenuSwallow.current = cancel\n\t\tdoc.addEventListener('contextmenu', onContextMenu, true)\n\t\t// Drop the listener on the next tick if it never fires (e.g. pointer moved off-screen)\n\t\tdoc.defaultView?.setTimeout(() => {\n\t\t\tif (rCancelContextMenuSwallow.current === cancel) {\n\t\t\t\tcancel()\n\t\t\t\trCancelContextMenuSwallow.current = null\n\t\t\t}\n\t\t}, 0)\n\t}, [editor])\n\n\tconst handlePointerDown = useCallback(\n\t\t(e: PointerEvent) => {\n\t\t\tif (e.button !== 0 && e.button !== 2) return\n\n\t\t\tflushSync(() => setIsPointing(true))\n\t\t\tsetPointerCapture(e.currentTarget, e)\n\t\t\trPointerState.current = {\n\t\t\t\tisDown: true,\n\t\t\t\tisDragging: false,\n\t\t\t\tbutton: e.button,\n\t\t\t\tstart: new Vec(e.clientX, e.clientY),\n\t\t\t}\n\n\t\t\tif (e.button === 2) {\n\t\t\t\tif (!editor.options.rightClickPanning) {\n\t\t\t\t\t// Right-click panning off: close the open menu and swallow the native\n\t\t\t\t\t// contextmenu that would otherwise briefly open a new one (causing a flash).\n\t\t\t\t\tswallowNextNativeContextMenu()\n\t\t\t\t\teditor.menus.clearOpenMenus()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// Forward right-click pointerdown through the canvas's own handler so\n\t\t\t\t// pointer capture is also set on the canvas (load-bearing: without this\n\t\t\t\t// the context menu briefly flashes closed during consecutive right-clicks).\n\t\t\t\t// We don't clearOpenMenus() \u2014 Radix's DismissableLayer closes the menu\n\t\t\t\t// via outside-click detection, keeping its internal state in sync.\n\t\t\t\tconst canvas =\n\t\t\t\t\teditor.getContainer().querySelector<HTMLDivElement>('.tl-canvas') ?? e.currentTarget\n\t\t\t\tcanvasEvents.onPointerDown?.({ ...e, currentTarget: canvas })\n\t\t\t\tswallowNextNativeContextMenu()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\teditor.menus.clearOpenMenus()\n\t\t},\n\t\t[canvasEvents, editor, swallowNextNativeContextMenu]\n\t)\n\n\tconst handlePointerMove = useCallback(\n\t\t(e: PointerEvent) => {\n\t\t\tconst state = rPointerState.current\n\t\t\tif (!state.isDown) return\n\n\t\t\t// Left-click: wait for the drag threshold before forwarding anything, then\n\t\t\t// replay pointerdown at the original start so the editor records the\n\t\t\t// correct drag origin. Right-click forwards moves immediately (pointerdown\n\t\t\t// was already dispatched in handlePointerDown).\n\t\t\tif (state.button !== 2 && !state.isDragging) {\n\t\t\t\tif (\n\t\t\t\t\tVec.Dist2(state.start, new Vec(e.clientX, e.clientY)) <=\n\t\t\t\t\teditor.options.dragDistanceSquared\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tstate.isDragging = true\n\t\t\t\teditor.dispatch({\n\t\t\t\t\ttype: 'pointer',\n\t\t\t\t\ttarget: 'canvas',\n\t\t\t\t\tname: 'pointer_down',\n\t\t\t\t\t...getPointerInfo(editor, { ...e, clientX: state.start.x, clientY: state.start.y }),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\teditor.dispatch({\n\t\t\t\ttype: 'pointer',\n\t\t\t\ttarget: 'canvas',\n\t\t\t\tname: 'pointer_move',\n\t\t\t\t...getPointerInfo(editor, e),\n\t\t\t})\n\t\t},\n\t\t[editor]\n\t)\n\n\tconst handlePointerUp = useCallback(\n\t\t(e: PointerEvent) => {\n\t\t\tconst isStaticRightClick = e.button === 2 && !rPointerState.current.isDragging\n\n\t\t\teditor.dispatch({\n\t\t\t\ttype: 'pointer',\n\t\t\t\ttarget: 'canvas',\n\t\t\t\tname: 'pointer_up',\n\t\t\t\t...getPointerInfo(editor, e),\n\t\t\t})\n\n\t\t\tif (isStaticRightClick && editor.options.rightClickPanning) {\n\t\t\t\t// Dispatch contextmenu on the canvas's parent (Radix's trigger) so the\n\t\t\t\t// menu opens at the release position. Bypassing the canvas avoids its\n\t\t\t\t// own onContextMenu handler, which preventDefaults non-synthesized events.\n\t\t\t\tconst canvas = editor.getContainer().querySelector<HTMLDivElement>('.tl-canvas')\n\t\t\t\tconst trigger = canvas?.parentElement ?? e.currentTarget\n\t\t\t\teditor.timers.requestAnimationFrame(() => {\n\t\t\t\t\ttrigger.dispatchEvent(\n\t\t\t\t\t\tnew PointerEvent('contextmenu', {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tclientX: e.clientX,\n\t\t\t\t\t\t\tclientY: e.clientY,\n\t\t\t\t\t\t\tbutton: 2,\n\t\t\t\t\t\t\tbuttons: 0,\n\t\t\t\t\t\t\tpointerId: e.pointerId,\n\t\t\t\t\t\t\tpointerType: e.pointerType,\n\t\t\t\t\t\t\tisPrimary: e.isPrimary,\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treleasePointerCapture(e.currentTarget, e)\n\t\t\tsetIsPointing(false)\n\t\t\trPointerState.current = {\n\t\t\t\tisDown: false,\n\t\t\t\tisDragging: false,\n\t\t\t\tbutton: 0,\n\t\t\t\tstart: new Vec(e.clientX, e.clientY),\n\t\t\t}\n\t\t},\n\t\t[editor]\n\t)\n\n\treturn (\n\t\tshowElement && (\n\t\t\t<div\n\t\t\t\tclassName=\"tlui-menu-click-capture\"\n\t\t\t\tdata-testid=\"menu-click-capture.content\"\n\t\t\t\t{...canvasEvents}\n\t\t\t\tonPointerDown={handlePointerDown}\n\t\t\t\tonPointerMove={handlePointerMove}\n\t\t\t\tonPointerUp={handlePointerUp}\n\t\t\t\tonContextMenu={(e) => {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\te.stopPropagation()\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4LG;AA5LH,yBAAyB;AACzB,mBAA4E;AAC5E,uBAA0B;AAC1B,6BAAgC;AAChC,uBAA0B;AAC1B,iBAAoB;AACpB,iBAAyD;AACzD,4BAA+B;AAOxB,SAAS,mBAAmB;AAClC,QAAM,aAAS,4BAAU;AAEzB,QAAM,iBAAa,6BAAS,gBAAgB,MAAM,OAAO,MAAM,gBAAgB,GAAG,CAAC,MAAM,CAAC;AAI1F,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,cAAc,cAAc;AAElC,QAAM,mBAAe,wCAAgB;AAErC,QAAM,oBAAgB,qBAAO;AAAA,IAC5B,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,OAAO,IAAI,eAAI;AAAA,EAChB,CAAC;AAMD,QAAM,gCAA4B,qBAA4B,IAAI;AAClE;AAAA,IACC,MAAM,MAAM;AACX,gCAA0B,UAAU;AACpC,gCAA0B,UAAU;AAAA,IACrC;AAAA,IACA,CAAC;AAAA,EACF;AACA,QAAM,mCAA+B,0BAAY,MAAM;AACtD,8BAA0B,UAAU;AACpC,UAAM,MAAM,OAAO,qBAAqB;AACxC,UAAM,gBAAgB,CAAC,UAAsB;AAE5C,UAAI,CAAC,MAAM,UAAW;AACtB,gCAA0B,UAAU;AACpC,gCAA0B,UAAU;AACpC,YAAM,eAAe;AACrB,YAAM,yBAAyB;AAAA,IAChC;AACA,UAAM,SAAS,MAAM,IAAI,oBAAoB,eA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C,MAAM;AAAA,EACR;AAEA,SACC,eACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,eAAY;AAAA,MACX,GAAG;AAAA,MACJ,eAAe;AAAA,MACf,eAAe;AAAA,MACf,aAAa;AAAA,MACb,eAAe,CAAC,MAAM;AACrB,UAAE,eAAe;AACjB,UAAE,gBAAgB;AAAA,MACnB;AAAA;AAAA,EACD;AAGH;",
6
6
  "names": []
7
7
  }
@@ -107,6 +107,13 @@ function renderIndicatorPath(ctx, indicatorPath) {
107
107
  }
108
108
  }
109
109
  const CanvasShapeIndicators = (0, import_react.memo)(function CanvasShapeIndicators2() {
110
+ const editor = (0, import_useEditor.useEditor)();
111
+ if (!editor.options.useCanvasIndicators) {
112
+ return null;
113
+ }
114
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CanvasShapeIndicatorsInner, {});
115
+ });
116
+ const CanvasShapeIndicatorsInner = (0, import_react.memo)(function CanvasShapeIndicatorsInner2() {
110
117
  const editor = (0, import_useEditor.useEditor)();
111
118
  const canvasRef = (0, import_react.useRef)(null);
112
119
  const rSelectedColor = (0, import_react.useRef)(null);