@tldraw/editor 5.3.0-next.a6e6f66f8517 → 5.3.0-next.aefb8773a7eb

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 (129) hide show
  1. package/dist-cjs/index.d.ts +169 -5
  2. package/dist-cjs/index.js +13 -3
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +30 -20
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/EditorPortal.js +44 -0
  7. package/dist-cjs/lib/components/EditorPortal.js.map +7 -0
  8. package/dist-cjs/lib/components/LiveCollaborators.js +102 -0
  9. package/dist-cjs/lib/components/LiveCollaborators.js.map +7 -0
  10. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +4 -10
  11. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +3 -3
  12. package/dist-cjs/lib/components/default-components/DefaultCursor.js +59 -0
  13. package/dist-cjs/lib/components/default-components/DefaultCursor.js.map +7 -0
  14. package/dist-cjs/lib/editor/Editor.js +72 -15
  15. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  16. package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js +4 -4
  17. package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js.map +2 -2
  18. package/dist-cjs/lib/editor/managers/FontManager/FontManager.js +9 -0
  19. package/dist-cjs/lib/editor/managers/FontManager/FontManager.js.map +2 -2
  20. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +3 -0
  21. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
  22. package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js +3 -0
  23. package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js.map +2 -2
  24. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  25. package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
  26. package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
  27. package/dist-cjs/lib/hooks/EditorComponentsContext.js.map +2 -2
  28. package/dist-cjs/lib/hooks/useCursor.js +1 -0
  29. package/dist-cjs/lib/hooks/useCursor.js.map +2 -2
  30. package/dist-cjs/lib/hooks/useEditorComponents.js +2 -0
  31. package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
  32. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js +25 -1
  33. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  34. package/dist-cjs/lib/hooks/useTransform.js +45 -0
  35. package/dist-cjs/lib/hooks/useTransform.js.map +7 -0
  36. package/dist-cjs/lib/license/LicenseManager.js +65 -7
  37. package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
  38. package/dist-cjs/lib/license/useLicenseManagerState.js +7 -0
  39. package/dist-cjs/lib/license/useLicenseManagerState.js.map +2 -2
  40. package/dist-cjs/lib/options.js +2 -1
  41. package/dist-cjs/lib/options.js.map +2 -2
  42. package/dist-cjs/lib/utils/collaborators.js +27 -0
  43. package/dist-cjs/lib/utils/collaborators.js.map +7 -0
  44. package/dist-cjs/lib/utils/getHtmlLayerTransform.js +33 -0
  45. package/dist-cjs/lib/utils/getHtmlLayerTransform.js.map +7 -0
  46. package/dist-cjs/version.js +3 -3
  47. package/dist-cjs/version.js.map +1 -1
  48. package/dist-esm/index.d.mts +169 -5
  49. package/dist-esm/index.mjs +19 -4
  50. package/dist-esm/index.mjs.map +2 -2
  51. package/dist-esm/lib/TldrawEditor.mjs +29 -19
  52. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  53. package/dist-esm/lib/components/EditorPortal.mjs +24 -0
  54. package/dist-esm/lib/components/EditorPortal.mjs.map +7 -0
  55. package/dist-esm/lib/components/LiveCollaborators.mjs +82 -0
  56. package/dist-esm/lib/components/LiveCollaborators.mjs.map +7 -0
  57. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +5 -11
  58. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  59. package/dist-esm/lib/components/default-components/DefaultCursor.mjs +29 -0
  60. package/dist-esm/lib/components/default-components/DefaultCursor.mjs.map +7 -0
  61. package/dist-esm/lib/editor/Editor.mjs +72 -15
  62. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  63. package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs +5 -5
  64. package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs.map +2 -2
  65. package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs +9 -0
  66. package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs.map +2 -2
  67. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +3 -0
  68. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
  69. package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs +3 -0
  70. package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs.map +2 -2
  71. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  72. package/dist-esm/lib/hooks/EditorComponentsContext.mjs.map +2 -2
  73. package/dist-esm/lib/hooks/useCursor.mjs +1 -0
  74. package/dist-esm/lib/hooks/useCursor.mjs.map +2 -2
  75. package/dist-esm/lib/hooks/useEditorComponents.mjs +2 -0
  76. package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
  77. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs +25 -1
  78. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  79. package/dist-esm/lib/hooks/useTransform.mjs +25 -0
  80. package/dist-esm/lib/hooks/useTransform.mjs.map +7 -0
  81. package/dist-esm/lib/license/LicenseManager.mjs +66 -8
  82. package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
  83. package/dist-esm/lib/license/useLicenseManagerState.mjs +7 -0
  84. package/dist-esm/lib/license/useLicenseManagerState.mjs.map +2 -2
  85. package/dist-esm/lib/options.mjs +2 -1
  86. package/dist-esm/lib/options.mjs.map +2 -2
  87. package/dist-esm/lib/utils/collaborators.mjs +7 -0
  88. package/dist-esm/lib/utils/collaborators.mjs.map +7 -0
  89. package/dist-esm/lib/utils/getHtmlLayerTransform.mjs +13 -0
  90. package/dist-esm/lib/utils/getHtmlLayerTransform.mjs.map +7 -0
  91. package/dist-esm/version.mjs +3 -3
  92. package/dist-esm/version.mjs.map +1 -1
  93. package/editor.css +53 -4
  94. package/package.json +7 -7
  95. package/src/index.ts +14 -2
  96. package/src/lib/TldrawEditor.tsx +31 -14
  97. package/src/lib/components/EditorPortal.tsx +77 -0
  98. package/src/lib/components/LiveCollaborators.tsx +133 -0
  99. package/src/lib/components/default-components/DefaultCanvas.tsx +5 -17
  100. package/src/lib/components/default-components/DefaultCursor.tsx +65 -0
  101. package/src/lib/editor/Editor.ts +111 -20
  102. package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.test.ts +46 -1
  103. package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.ts +10 -5
  104. package/src/lib/editor/managers/FontManager/FontManager.test.ts +66 -0
  105. package/src/lib/editor/managers/FontManager/FontManager.ts +14 -0
  106. package/src/lib/editor/managers/TextManager/TextManager.ts +3 -0
  107. package/src/lib/editor/shapes/BaseFrameLikeShapeUtil.tsx +6 -1
  108. package/src/lib/editor/shapes/ShapeUtil.ts +24 -0
  109. package/src/lib/editor/types/emit-types.ts +1 -0
  110. package/src/lib/editor/types/external-content.ts +5 -0
  111. package/src/lib/hooks/EditorComponentsContext.tsx +2 -0
  112. package/src/lib/hooks/useCursor.ts +1 -0
  113. package/src/lib/hooks/useEditorComponents.tsx +2 -0
  114. package/src/lib/hooks/usePassThroughWheelEvents.ts +44 -2
  115. package/src/lib/hooks/useTransform.ts +38 -0
  116. package/src/lib/license/LicenseManager.test.ts +245 -29
  117. package/src/lib/license/LicenseManager.ts +114 -6
  118. package/src/lib/license/useLicenseManagerState.ts +17 -1
  119. package/src/lib/options.ts +3 -1
  120. package/src/lib/test/EditorPortal.test.tsx +48 -0
  121. package/src/lib/utils/collaborators.test.ts +34 -0
  122. package/src/lib/utils/collaborators.ts +25 -0
  123. package/src/lib/utils/getHtmlLayerTransform.ts +22 -0
  124. package/src/version.ts +3 -3
  125. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js +0 -51
  126. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +0 -7
  127. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs +0 -31
  128. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +0 -7
  129. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +0 -32
@@ -19,12 +19,14 @@ import { JsonObject } from '@tldraw/utils';
19
19
  import { JSX } from 'react/jsx-runtime';
20
20
  import { LegacyMigrations } from '@tldraw/store';
21
21
  import { MigrationSequence } from '@tldraw/store';
22
+ import { NamedExoticComponent } from 'react';
22
23
  import { Node as Node_2 } from '@tiptap/pm/model';
23
24
  import { PerformanceTracker } from '@tldraw/utils';
24
25
  import * as React_2 from 'react';
25
26
  import { default as React_3 } from 'react';
26
27
  import { ReactElement } from 'react';
27
28
  import { ReactNode } from 'react';
29
+ import { ReactPortal } from 'react';
28
30
  import { RecordProps } from '@tldraw/tlschema';
29
31
  import { RecordsDiff } from '@tldraw/store';
30
32
  import { RefAttributes } from 'react';
@@ -219,7 +221,7 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
219
221
  }
220
222
 
221
223
  /**
222
- * A base class for frame-like shapes — containers that clip their children,
224
+ * A base class for frame-like shapes — containers that clip their children except arrows,
223
225
  * require full-brush selection, block erasure from inside, and support
224
226
  * drag-and-drop reparenting.
225
227
  *
@@ -231,6 +233,7 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
231
233
  * - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
232
234
  * - `canRemoveChildrenOfType()` returns `true` unless the container is locked
233
235
  * - `getClipPath()` returns the shape geometry's vertices
236
+ * - `shouldClipChild()` clips all children except arrows
234
237
  * - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
235
238
  * - `onDragShapesOut()` reparents shapes back to the page
236
239
  *
@@ -266,6 +269,7 @@ export declare abstract class BaseFrameLikeShapeUtil<Shape extends TLBaseBoxShap
266
269
  canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
267
270
  canRemoveChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
268
271
  getClipPath(shape: Shape): undefined | Vec[];
272
+ shouldClipChild(child: TLShape): boolean;
269
273
  onDragShapesIn(shape: Shape, draggingShapes: TLShape[], { initialParentIds, initialIndices }: TLDragShapesInInfo): void;
270
274
  onDragShapesOut(shape: Shape, draggingShapes: TLShape[], info: TLDragShapesOutInfo): void;
271
275
  }
@@ -980,6 +984,15 @@ export declare function DefaultBackground(): JSX.Element;
980
984
  /** @public @react */
981
985
  export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
982
986
 
987
+ /**
988
+ * The default collaborator cursor: the arrow glyph plus a name tag or chat bubble. The arrow is a
989
+ * `<use>` of a shared `<defs>` symbol that `LiveCollaborators` renders, so a `DefaultCursor`
990
+ * used outside that layer draws no arrow.
991
+ *
992
+ * @public @react
993
+ */
994
+ export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
995
+
983
996
  /** @public @react */
984
997
  export declare const DefaultErrorFallback: TLErrorFallbackComponent;
985
998
 
@@ -1005,6 +1018,7 @@ export declare const defaultTldrawOptions: {
1005
1018
  readonly cameraSlideFriction: 0.09;
1006
1019
  readonly coarseDragDistanceSquared: 36;
1007
1020
  readonly coarseHandleRadius: 20;
1021
+ readonly coarseHitTestMargin: 4;
1008
1022
  readonly coarsePointerWidth: 12;
1009
1023
  readonly collaboratorCheckIntervalMs: 1200;
1010
1024
  readonly collaboratorIdleTimeoutMs: 3000;
@@ -1044,7 +1058,7 @@ export declare const defaultTldrawOptions: {
1044
1058
  readonly step: 1;
1045
1059
  }];
1046
1060
  readonly handleRadius: 12;
1047
- readonly hitTestMargin: 8;
1061
+ readonly hitTestMargin: 3;
1048
1062
  readonly laserDelayMs: 1200;
1049
1063
  readonly laserFadeoutMs: 500;
1050
1064
  readonly longPressDurationMs: 500;
@@ -1218,6 +1232,19 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1218
1232
  * @public
1219
1233
  */
1220
1234
  isDisposed: boolean;
1235
+ private readonly _isMounted;
1236
+ /**
1237
+ * Whether the editor is currently mounted. This is `true` while the editor's component is
1238
+ * mounted in the DOM (after the `mount` event) and `false` before mount and after `unmount`.
1239
+ *
1240
+ * Unlike disposal, mounting is not terminal: the editor's component can unmount and remount
1241
+ * (for example when the canvas is replaced by an error fallback and restored) without the
1242
+ * editor itself being disposed. To react to the transitions, listen to the editor's `mount`
1243
+ * and `unmount` events.
1244
+ *
1245
+ * @public
1246
+ */
1247
+ getIsMounted(): boolean;
1221
1248
  /* Excluded from this release type: _tickManager */
1222
1249
  /**
1223
1250
  * A manager for the editor's input state.
@@ -3086,6 +3113,17 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3086
3113
  * @public
3087
3114
  */
3088
3115
  getCurrentPageBounds(): Box | undefined;
3116
+ /**
3117
+ * Get the hit-test margin in page space—the distance in page units within which a pointer is
3118
+ * considered to be touching a shape. This resolves to {@link TldrawOptions.hitTestMargin} (or
3119
+ * {@link TldrawOptions.coarseHitTestMargin} when using a coarse pointer) divided by the current
3120
+ * zoom level, so it stays a constant distance in screen space.
3121
+ *
3122
+ * @returns The hit-test margin in page space.
3123
+ *
3124
+ * @public
3125
+ */
3126
+ getHitTestMargin(): number;
3089
3127
  /**
3090
3128
  * Get the top-most selected shape at the given point, ignoring groups.
3091
3129
  *
@@ -4559,6 +4597,52 @@ export declare abstract class EditorManager {
4559
4597
  /* Excluded from this release type: dispose */
4560
4598
  }
4561
4599
 
4600
+ /**
4601
+ * Renders its children into the end of the editor's container, escaping the canvas layer.
4602
+ *
4603
+ * Use this for anything anchored to canvas coordinates that also has to draw over the UI — a
4604
+ * popover on a shape, a comment thread, an annotation panel. The `OnTheCanvas` and
4605
+ * `InFrontOfTheCanvas` slots are fixed layers, each its own stacking context, so content mounted
4606
+ * there can't paint above whatever outranks its layer whatever z-index it asks for. Mount in
4607
+ * whichever slot suits your data flow, wrap the part that needs its own layer in this, and give
4608
+ * that part a z-index.
4609
+ *
4610
+ * This package's own layers stop at 250 (`--tl-layer-canvas-in-front`); above that belongs to
4611
+ * whatever renders the UI. In `tldraw` that's `--tl-layer-panels` (300) and `--tl-layer-menus`
4612
+ * (400), defined by `tldraw`'s stylesheet rather than this one.
4613
+ *
4614
+ * Positioning still resolves against the editor's container, so a `position: absolute` child uses
4615
+ * ordinary container coordinates.
4616
+ *
4617
+ * Prefer this over `createPortal(children, useContainer())`, which picks its DOM position from the
4618
+ * commit that mounts it — landing the node ahead of the UI and of the "skip to main content" link
4619
+ * that only works while nothing precedes it. This host is a real element placed last, so ordering
4620
+ * is fixed rather than dependent on mount timing.
4621
+ *
4622
+ * @example
4623
+ * ```tsx
4624
+ * // 400 clears tldraw's menus layer; the bare editor's own layers stop at 250.
4625
+ * function ShapeAnnotation({ point }: { point: VecLike }) {
4626
+ * return (
4627
+ * <EditorPortal>
4628
+ * <div style={{ position: 'absolute', left: point.x, top: point.y, zIndex: 400 }}>
4629
+ * Above the UI
4630
+ * </div>
4631
+ * </EditorPortal>
4632
+ * )
4633
+ * }
4634
+ * ```
4635
+ *
4636
+ * @public
4637
+ * @react
4638
+ */
4639
+ export declare function EditorPortal({ children }: EditorPortalProps): ReactPortal | null;
4640
+
4641
+ /** @public */
4642
+ export declare interface EditorPortalProps {
4643
+ children: ReactNode;
4644
+ }
4645
+
4562
4646
  /** @public @react */
4563
4647
  export declare function EditorProvider({ editor, children }: EditorProviderProps): JSX.Element;
4564
4648
 
@@ -5422,6 +5506,24 @@ export declare function intersectPolygonPolygon(polygonA: VecLike[], polygonB: V
5422
5506
 
5423
5507
  /* Excluded from this release type: isAccelKey */
5424
5508
 
5509
+ /**
5510
+ * Whether a collaborator's cursor (page coords) is inside the viewport, with a small margin for the
5511
+ * cursor glyph so it isn't culled the instant its hotspot crosses the edge.
5512
+ *
5513
+ * Single source of truth for the cursor/hint split: the DOM cursor layer renders a collaborator
5514
+ * when this is true, and `CollaboratorHintOverlayUtil` draws the viewport-edge hint when it's
5515
+ * false. Sharing the predicate keeps those two exhaustive and mutually exclusive — a margin change
5516
+ * can't open a dead zone (neither renders) or a double-render (both).
5517
+ *
5518
+ * @public
5519
+ */
5520
+ export declare function isCursorInViewport(cursor: VecLike, viewport: {
5521
+ maxX: number;
5522
+ maxY: number;
5523
+ minX: number;
5524
+ minY: number;
5525
+ }, zoom: number): boolean;
5526
+
5425
5527
  /**
5426
5528
  * Check if a float is safe to use. ie: Not too big or small.
5427
5529
  * @public
@@ -5443,6 +5545,8 @@ export declare function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeI
5443
5545
 
5444
5546
  /* Excluded from this release type: LICENSE_TIMEOUT */
5445
5547
 
5548
+ /* Excluded from this release type: LicenseFeatureName */
5549
+
5446
5550
  /* Excluded from this release type: LicenseFromKeyResult */
5447
5551
 
5448
5552
  /* Excluded from this release type: LicenseInfo */
@@ -6766,6 +6870,29 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6766
6870
  * @public
6767
6871
  */
6768
6872
  onBeforeCreate?(next: Shape): Shape | void;
6873
+ /**
6874
+ * A callback called when a shape is reproduced from an existing shape, either by duplicating
6875
+ * ({@link Editor.duplicateShapes}) or by pasting/putting content onto the page
6876
+ * ({@link Editor.putContentOntoCurrentPage}). This provides a last chance to modify the copy
6877
+ * before it's created — for example, to re-stamp attribution so the copy is credited to the
6878
+ * current user rather than the original author. It is not called when content is put with
6879
+ * `preserveIds` (e.g. {@link Editor.moveShapesToPage}), since the shape keeps its identity
6880
+ * and no copy is made.
6881
+ *
6882
+ * @example
6883
+ *
6884
+ * ```ts
6885
+ * onBeforeDuplicate = (source, duplicate) => {
6886
+ * return { ...duplicate, props: { ...duplicate.props, editedBy: this.editor.getAttributionUserId() } }
6887
+ * }
6888
+ * ```
6889
+ *
6890
+ * @param source - The shape being copied from.
6891
+ * @param duplicate - The new copy (with its own id), before it's created.
6892
+ * @returns The next shape or void.
6893
+ * @public
6894
+ */
6895
+ onBeforeDuplicate?(source: Shape, duplicate: Shape): Shape | void;
6769
6896
  /**
6770
6897
  * A callback called just before a shape is updated. This method provides a last chance to modify
6771
6898
  * the updated shape.
@@ -7498,6 +7625,11 @@ export declare interface TLBaseEventInfo {
7498
7625
 
7499
7626
  /** @public */
7500
7627
  export declare interface TLBaseExternalContent {
7628
+ /**
7629
+ * The other content sources found on the clipboard alongside this content. For example, when
7630
+ * pasting an image copied together with HTML and plain text, the `files` content will have
7631
+ * text sources for the HTML and plain text parts.
7632
+ */
7501
7633
  sources?: TLExternalContentSource[];
7502
7634
  point?: VecLike;
7503
7635
  }
@@ -7744,6 +7876,17 @@ export declare interface TLCurrentUser {
7744
7876
  readonly setUserPreferences: (userPreferences: TLUserPreferences) => void;
7745
7877
  }
7746
7878
 
7879
+ /** @public */
7880
+ export declare interface TLCursorProps {
7881
+ userId: string;
7882
+ className?: string;
7883
+ point: null | VecModel;
7884
+ zoom: number;
7885
+ color?: string;
7886
+ name: null | string;
7887
+ chatMessage: string;
7888
+ }
7889
+
7747
7890
  /** @public */
7748
7891
  export declare type TLDeepLink = {
7749
7892
  bounds: BoxModel;
@@ -8032,6 +8175,7 @@ export declare interface TldrawOptions {
8032
8175
  readonly collaboratorCheckIntervalMs: number;
8033
8176
  readonly cameraMovingTimeoutMs: number;
8034
8177
  readonly hitTestMargin: number;
8178
+ readonly coarseHitTestMargin: number;
8035
8179
  readonly edgeScrollDelay: number;
8036
8180
  readonly edgeScrollEaseDuration: number;
8037
8181
  readonly edgeScrollSpeed: number;
@@ -8245,6 +8389,7 @@ export declare interface TLDropShapesOverInfo {
8245
8389
  export declare interface TLEditorComponents {
8246
8390
  Background?: ComponentType | null;
8247
8391
  Canvas?: ComponentType<TLCanvasComponentProps> | null;
8392
+ CollaboratorCursor?: ComponentType<TLCursorProps> | null;
8248
8393
  Grid?: ComponentType<TLGridProps> | null;
8249
8394
  InFrontOfTheCanvas?: ComponentType | null;
8250
8395
  LoadingScreen?: ComponentType | null;
@@ -8462,6 +8607,7 @@ export declare type TLEventInfo = TLCancelEventInfo | TLClickEventInfo | TLCompl
8462
8607
  /** @public */
8463
8608
  export declare interface TLEventMap {
8464
8609
  mount: [];
8610
+ unmount: [];
8465
8611
  'max-shapes': [{
8466
8612
  count: number;
8467
8613
  name: string;
@@ -9699,6 +9845,16 @@ export declare function useEditor(): Editor;
9699
9845
  /** @public */
9700
9846
  export declare function useEditorComponents(): Required<TLEditorComponents>;
9701
9847
 
9848
+ /**
9849
+ * The DOM node that {@link EditorPortal} renders into: an empty `display: contents` element the
9850
+ * editor renders last among its container's children, after the canvas and after the UI.
9851
+ *
9852
+ * Null until the container has mounted, so prefer {@link EditorPortal}, which handles that for you.
9853
+ *
9854
+ * @public
9855
+ */
9856
+ export declare function useEditorPortalHost(): HTMLElement | null;
9857
+
9702
9858
  /* Excluded from this release type: useEvent */
9703
9859
 
9704
9860
  /** @public */
@@ -9710,6 +9866,10 @@ export declare function useIsCropping(shapeId: TLShapeId): boolean;
9710
9866
  /** @public */
9711
9867
  export declare function useIsEditing(shapeId: TLShapeId): boolean;
9712
9868
 
9869
+ /* Excluded from this release type: useLicenseContext */
9870
+
9871
+ /* Excluded from this release type: useLicenseFeatureFlag */
9872
+
9713
9873
  /* Excluded from this release type: useLocalStore */
9714
9874
 
9715
9875
  /** @public */
@@ -9717,9 +9877,6 @@ export declare function useMaybeEditor(): Editor | null;
9717
9877
 
9718
9878
  /* Excluded from this release type: useOnMount */
9719
9879
 
9720
- /** @public */
9721
- export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement | null>): void;
9722
-
9723
9880
  /** @public */
9724
9881
  export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
9725
9882
 
@@ -9846,6 +10003,13 @@ export declare function useTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreS
9846
10003
  /** @public */
9847
10004
  export declare function useTLStore(opts: TLStoreOptions): TLStore;
9848
10005
 
10006
+ /**
10007
+ * Position an element by writing its `transform` directly, outside React's render output — the
10008
+ * cheap path for elements that move at pointer/presence frequency.
10009
+ * @public
10010
+ */
10011
+ export declare function useTransform(ref: React.RefObject<HTMLElement | null | SVGElement>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
10012
+
9849
10013
  /**
9850
10014
  * React's useId hook returns a unique id for the component. However, it uses a colon in the id,
9851
10015
  * which is not valid for CSS selectors. This hook replaces the colon with an underscore.
package/dist-cjs/index.js CHANGED
@@ -38,6 +38,7 @@ __export(index_exports, {
38
38
  DEFAULT_THEME: () => import_defaultThemes.DEFAULT_THEME,
39
39
  DefaultBackground: () => import_DefaultBackground.DefaultBackground,
40
40
  DefaultCanvas: () => import_DefaultCanvas.DefaultCanvas,
41
+ DefaultCursor: () => import_DefaultCursor.DefaultCursor,
41
42
  DefaultErrorFallback: () => import_DefaultErrorFallback.DefaultErrorFallback,
42
43
  DefaultGrid: () => import_DefaultGrid.DefaultGrid,
43
44
  DefaultShapeWrapper: () => import_DefaultShapeWrapper.DefaultShapeWrapper,
@@ -51,6 +52,7 @@ __export(index_exports, {
51
52
  EditorAtom: () => import_EditorAtom.EditorAtom,
52
53
  EditorContext: () => import_useEditor.EditorContext,
53
54
  EditorManager: () => import_EditorManager.EditorManager,
55
+ EditorPortal: () => import_EditorPortal.EditorPortal,
54
56
  EditorProvider: () => import_useEditor.EditorProvider,
55
57
  Ellipse2d: () => import_Ellipse2d.Ellipse2d,
56
58
  ErrorBoundary: () => import_ErrorBoundary.ErrorBoundary,
@@ -171,6 +173,7 @@ __export(index_exports, {
171
173
  intersectPolygonBounds: () => import_intersect.intersectPolygonBounds,
172
174
  intersectPolygonPolygon: () => import_intersect.intersectPolygonPolygon,
173
175
  isAccelKey: () => import_keyboard.isAccelKey,
176
+ isCursorInViewport: () => import_collaborators.isCursorInViewport,
174
177
  isSafeFloat: () => import_utils2.isSafeFloat,
175
178
  kickoutOccludedShapes: () => import_reparenting.kickoutOccludedShapes,
176
179
  linesIntersect: () => import_intersect.linesIntersect,
@@ -221,14 +224,16 @@ __export(index_exports, {
221
224
  useDelaySvgExport: () => import_SvgExportContext.useDelaySvgExport,
222
225
  useEditor: () => import_useEditor.useEditor,
223
226
  useEditorComponents: () => import_useEditorComponents.useEditorComponents,
227
+ useEditorPortalHost: () => import_EditorPortal.useEditorPortalHost,
224
228
  useEvent: () => import_useEvent.useEvent,
225
229
  useGlobalMenuIsOpen: () => import_useGlobalMenuIsOpen.useGlobalMenuIsOpen,
226
230
  useIsCropping: () => import_useIsCropping.useIsCropping,
227
231
  useIsEditing: () => import_useIsEditing.useIsEditing,
232
+ useLicenseContext: () => import_LicenseProvider.useLicenseContext,
233
+ useLicenseFeatureFlag: () => import_useLicenseManagerState.useLicenseFeatureFlag,
228
234
  useLocalStore: () => import_useLocalStore.useLocalStore,
229
235
  useMaybeEditor: () => import_useEditor.useMaybeEditor,
230
236
  useOnMount: () => import_TldrawEditor.useOnMount,
231
- usePassThroughMouseOverEvents: () => import_usePassThroughMouseOverEvents.usePassThroughMouseOverEvents,
232
237
  usePassThroughWheelEvents: () => import_usePassThroughWheelEvents.usePassThroughWheelEvents,
233
238
  usePeerIds: () => import_usePeerIds.usePeerIds,
234
239
  usePresence: () => import_usePresence.usePresence,
@@ -241,6 +246,7 @@ __export(index_exports, {
241
246
  useTLSchemaFromUtils: () => import_useTLStore.useTLSchemaFromUtils,
242
247
  useTLStore: () => import_useTLStore.useTLStore,
243
248
  useTldrawCurrentUser: () => import_createTLCurrentUser.useTldrawCurrentUser,
249
+ useTransform: () => import_useTransform.useTransform,
244
250
  useUniqueSafeId: () => import_useSafeId.useUniqueSafeId,
245
251
  useViewportHeight: () => import_useViewportHeight.useViewportHeight,
246
252
  userTypeValidator: () => import_TLUserPreferences.userTypeValidator
@@ -255,11 +261,13 @@ __reExport(index_exports, require("@tldraw/utils"), module.exports);
255
261
  __reExport(index_exports, require("@tldraw/validate"), module.exports);
256
262
  var import_DefaultBackground = require("./lib/components/default-components/DefaultBackground");
257
263
  var import_DefaultCanvas = require("./lib/components/default-components/DefaultCanvas");
264
+ var import_DefaultCursor = require("./lib/components/default-components/DefaultCursor");
258
265
  var import_DefaultErrorFallback = require("./lib/components/default-components/DefaultErrorFallback");
259
266
  var import_DefaultGrid = require("./lib/components/default-components/DefaultGrid");
260
267
  var import_DefaultShapeWrapper = require("./lib/components/default-components/DefaultShapeWrapper");
261
268
  var import_DefaultSpinner = require("./lib/components/default-components/DefaultSpinner");
262
269
  var import_DefaultSvgDefs = require("./lib/components/default-components/DefaultSvgDefs");
270
+ var import_EditorPortal = require("./lib/components/EditorPortal");
263
271
  var import_ErrorBoundary = require("./lib/components/ErrorBoundary");
264
272
  var import_HTMLContainer = require("./lib/components/HTMLContainer");
265
273
  var import_MenuClickCapture = require("./lib/components/MenuClickCapture");
@@ -325,16 +333,18 @@ var import_useIdentity = require("./lib/hooks/useIdentity");
325
333
  var import_useIsCropping = require("./lib/hooks/useIsCropping");
326
334
  var import_useIsEditing = require("./lib/hooks/useIsEditing");
327
335
  var import_useLocalStore = require("./lib/hooks/useLocalStore");
328
- var import_usePassThroughMouseOverEvents = require("./lib/hooks/usePassThroughMouseOverEvents");
329
336
  var import_usePassThroughWheelEvents = require("./lib/hooks/usePassThroughWheelEvents");
330
337
  var import_usePeerIds = require("./lib/hooks/usePeerIds");
331
338
  var import_usePresence = require("./lib/hooks/usePresence");
332
339
  var import_useRefState = require("./lib/hooks/useRefState");
333
340
  var import_useSafeId = require("./lib/hooks/useSafeId");
341
+ var import_useTransform = require("./lib/hooks/useTransform");
342
+ var import_collaborators = require("./lib/utils/collaborators");
334
343
  var import_useTLStore = require("./lib/hooks/useTLStore");
335
344
  var import_useViewportHeight = require("./lib/hooks/useViewportHeight");
336
345
  var import_LicenseManager = require("./lib/license/LicenseManager");
337
346
  var import_LicenseProvider = require("./lib/license/LicenseProvider");
347
+ var import_useLicenseManagerState = require("./lib/license/useLicenseManagerState");
338
348
  var import_options = require("./lib/options");
339
349
  var import_Box = require("./lib/primitives/Box");
340
350
  var import_easings = require("./lib/primitives/easings");
@@ -379,7 +389,7 @@ var import_uniq = require("./lib/utils/uniq");
379
389
  var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
380
390
  (0, import_utils.registerTldrawLibraryVersion)(
381
391
  "@tldraw/editor",
382
- "5.3.0-next.a6e6f66f8517",
392
+ "5.3.0-next.aefb8773a7eb",
383
393
  "cjs"
384
394
  );
385
395
  //# 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 {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\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 { EditorManager } from './lib/editor/managers/EditorManager'\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\tresolveLineHeightPx,\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 { CollaboratorsManager } from './lib/editor/managers/CollaboratorsManager/CollaboratorsManager'\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\tgetOverlayDisplayValues,\n\ttype OverlayOptionsWithDisplayValues,\n} from './lib/editor/overlays/getOverlayDisplayValues'\nexport { OverlayManager, type TLOverlayEntry } from './lib/editor/overlays/OverlayManager'\nexport {\n\tOverlayUtil,\n\ttype TLAnyOverlayUtilConstructor,\n\ttype TLOverlay,\n\ttype TLOverlayUtilConstructor,\n} from './lib/editor/overlays/OverlayUtil'\nexport { strokeShapeIndicators } from './lib/editor/overlays/strokeShapeIndicators'\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 { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\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\tmoveElementInto,\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;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6C;AAG7C,0BAAc,0BAHd;AAKA,0BAAc,gCALd;AAOA,0BAAc,0BAPd;AASA,0BAAc,6BATd;AAWA,0BAAc,0BAXd;AAaA,0BAAc,6BAbd;AAeA,+BAAkC;AAClC,2BAGO;AACP,kCAGO;AACP,yBAA8C;AAE9C,iCAGO;AACP,4BAA+B;AAC/B,4BAA+B;AAC/B,2BAIO;AACP,2BAAuD;AACvD,8BAAiC;AACjC,0BAAqD;AACrD,iCAIO;AACP,2BASO;AAGP,2BAA2D;AAC3D,8BAKO;AACP,oCAOO;AACP,+BAQO;AACP,uBAAyE;AACzE,uBAAuD;AACvD,yBASO;AACP,oBAMO;AACP,0BAAgD;AAChD,+BAAkC;AAClC,yBAA4B;AAC5B,4BAA+B;AAC/B,2BAA8B;AAC9B,2BAA8B;AAC9B,6BAIO;AACP,yBAIO;AACP,yBAAqD;AACrD,yBAMO;AACP,iCAAoC;AACpC,yBAOO;AACP,2BAA8B;AAC9B,0BAA4C;AAC5C,yBAA4B;AAC5B,kCAAqC;AACrC,mCAAsC;AACtC,gCAAmC;AAcnC,oCAAuC;AACvC,8BAAsD;AACtD,oCAAuC;AACvC,4BAA+B;AAC/B,uBAiBO;AACP,qCAGO;AACP,4BAAoD;AACpD,yBAKO;AACP,mCAAsC;AACtC,iCAGO;AACP,uBAAiD;AACjD,0BAA6B;AAC7B,8BAAiC;AACjC,sBAAgC;AAChC,uBAAuD;AAGvD,yBAiCO;AA4CP,8BAKO;AACP,sBAAiD;AACjD,2BAA8B;AAC9B,yBAAqC;AACrC,mBAAwB;AACxB,kBAAuB;AACvB,0BAKO;AACP,0BAA6B;AAC7B,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,wBAAiD;AACjD,+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,iBAYO;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 {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\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 { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tEditorPortal,\n\tuseEditorPortalHost,\n\ttype EditorPortalProps,\n} from './lib/components/EditorPortal'\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 { EditorManager } from './lib/editor/managers/EditorManager'\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\tresolveLineHeightPx,\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 { CollaboratorsManager } from './lib/editor/managers/CollaboratorsManager/CollaboratorsManager'\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\tgetOverlayDisplayValues,\n\ttype OverlayOptionsWithDisplayValues,\n} from './lib/editor/overlays/getOverlayDisplayValues'\nexport { OverlayManager, type TLOverlayEntry } from './lib/editor/overlays/OverlayManager'\nexport {\n\tOverlayUtil,\n\ttype TLAnyOverlayUtilConstructor,\n\ttype TLOverlay,\n\ttype TLOverlayUtilConstructor,\n} from './lib/editor/overlays/OverlayUtil'\nexport { strokeShapeIndicators } from './lib/editor/overlays/strokeShapeIndicators'\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 { 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 { useTransform } from './lib/hooks/useTransform'\nexport { isCursorInViewport } from './lib/utils/collaborators'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFeatureName,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT, useLicenseContext } from './lib/license/LicenseProvider'\nexport { useLicenseFeatureFlag } from './lib/license/useLicenseManagerState'\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\tmoveElementInto,\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;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6C;AAG7C,0BAAc,0BAHd;AAKA,0BAAc,gCALd;AAOA,0BAAc,0BAPd;AASA,0BAAc,6BATd;AAWA,0BAAc,0BAXd;AAaA,0BAAc,6BAbd;AAeA,+BAAkC;AAClC,2BAGO;AACP,2BAGO;AACP,kCAGO;AACP,yBAA8C;AAE9C,iCAGO;AACP,4BAA+B;AAC/B,4BAA+B;AAC/B,0BAIO;AACP,2BAIO;AACP,2BAAuD;AACvD,8BAAiC;AACjC,0BAAqD;AACrD,iCAIO;AACP,2BASO;AAGP,2BAA2D;AAC3D,8BAKO;AACP,oCAOO;AACP,+BAQO;AACP,uBAAyE;AACzE,uBAAuD;AACvD,yBASO;AACP,oBAMO;AACP,0BAAgD;AAChD,+BAAkC;AAClC,yBAA4B;AAC5B,4BAA+B;AAC/B,2BAA8B;AAC9B,2BAA8B;AAC9B,6BAIO;AACP,yBAIO;AACP,yBAAqD;AACrD,yBAMO;AACP,iCAAoC;AACpC,yBAOO;AACP,2BAA8B;AAC9B,0BAA4C;AAC5C,yBAA4B;AAC5B,kCAAqC;AACrC,mCAAsC;AACtC,gCAAmC;AAcnC,oCAAuC;AACvC,8BAAsD;AACtD,oCAAuC;AACvC,4BAA+B;AAC/B,uBAiBO;AACP,qCAGO;AACP,4BAAoD;AACpD,yBAKO;AACP,mCAAsC;AACtC,iCAGO;AACP,uBAAiD;AACjD,0BAA6B;AAC7B,8BAAiC;AACjC,sBAAgC;AAChC,uBAAuD;AAGvD,yBAiCO;AA4CP,8BAKO;AACP,sBAAiD;AACjD,2BAA8B;AAC9B,yBAAqC;AACrC,mBAAwB;AACxB,kBAAuB;AACvB,0BAKO;AACP,0BAA6B;AAC7B,uBAA0B;AAC1B,uBAMO;AACP,iCAAoC;AAEpC,sBAA2C;AAC3C,iCAAoC;AACpC,yBAAkE;AAClE,2BAA8B;AAC9B,0BAA6B;AAC7B,2BAA8B;AAC9B,uCAA0C;AAC1C,wBAA2B;AAC3B,yBAA4B;AAC5B,yBAA4B;AAC5B,uBAMO;AACP,0BAA6B;AAC7B,2BAAmC;AACnC,wBAAiD;AACjD,+BAAkC;AAClC,4BASO;AACP,6BAAmD;AACnD,oCAAsC;AACtC,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,iBAYO;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
  }
@@ -35,10 +35,7 @@ __export(TldrawEditor_exports, {
35
35
  useOnMount: () => useOnMount
36
36
  });
37
37
  module.exports = __toCommonJS(TldrawEditor_exports);
38
- var import_jsx_runtime = (
39
- // Store is ready to go, whether externally synced or not
40
- require("react/jsx-runtime")
41
- );
38
+ var import_jsx_runtime = require("react/jsx-runtime");
42
39
  var import_store = require("@tldraw/store");
43
40
  var import_tlschema = require("@tldraw/tlschema");
44
41
  var import_utils = require("@tldraw/utils");
@@ -46,6 +43,7 @@ var import_classnames = __toESM(require("classnames"), 1);
46
43
  var import_react = __toESM(require("react"), 1);
47
44
  var import_version = require("../version");
48
45
  var import_DefaultErrorFallback = require("./components/default-components/DefaultErrorFallback");
46
+ var import_EditorPortal = require("./components/EditorPortal");
49
47
  var import_ErrorBoundary = require("./components/ErrorBoundary");
50
48
  var import_createTLCurrentUser = require("./config/createTLCurrentUser");
51
49
  var import_Editor = require("./editor/Editor");
@@ -87,6 +85,7 @@ const TldrawEditor = (0, import_react.memo)(function TldrawEditor2({
87
85
  (0, import_tlschema.registerColorsFromThemes)(resolvedThemes);
88
86
  (0, import_tlschema.registerFontsFromThemes)(resolvedThemes);
89
87
  const [container, setContainer] = (0, import_react.useState)(null);
88
+ const [portalHost, setPortalHost] = (0, import_react.useState)(null);
90
89
  const user = (0, import_react.useMemo)(() => _user ?? (0, import_createTLCurrentUser.createTLCurrentUser)(), [_user]);
91
90
  const ErrorFallback = components?.ErrorFallback === void 0 ? import_DefaultErrorFallback.DefaultErrorFallback : components?.ErrorFallback;
92
91
  const mergedOptions = (0, import_react.useMemo)(() => {
@@ -108,7 +107,7 @@ const TldrawEditor = (0, import_react.memo)(function TldrawEditor2({
108
107
  components,
109
108
  options: (0, import_useIdentity.useShallowObjectIdentity)(mergedOptions)
110
109
  };
111
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
110
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
112
111
  "div",
113
112
  {
114
113
  ref: setContainer,
@@ -118,20 +117,26 @@ const TldrawEditor = (0, import_react.memo)(function TldrawEditor2({
118
117
  tabIndex: -1,
119
118
  role: "application",
120
119
  "aria-label": _options?.branding ?? "tldraw",
121
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
- import_ErrorBoundary.OptionalErrorBoundary,
123
- {
124
- fallback: ErrorFallback,
125
- onError: (error) => (0, import_utils.annotateError)(error, { tags: { origin: "react.tldraw-before-app" } }),
126
- children: container && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LicenseProvider.LicenseProvider, { licenseKey: rest.licenseKey, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useContainer.ContainerProvider, { container, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useEditorComponents.EditorComponentsProvider, { overrides: components, children: store ? store instanceof import_store.Store ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithReadyStore, { ...withDefaults, store, user }) : (
127
- // Store is a synced store, so handle syncing stages internally
128
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithLoadingStore, { ...withDefaults, store, user })
129
- ) : (
130
- // We have no store (it's undefined) so create one and possibly sync it
131
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithOwnStore, { ...withDefaults, store, user })
132
- ) }) }) })
133
- }
134
- )
120
+ children: [
121
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
+ import_ErrorBoundary.OptionalErrorBoundary,
123
+ {
124
+ fallback: ErrorFallback,
125
+ onError: (error) => (0, import_utils.annotateError)(error, { tags: { origin: "react.tldraw-before-app" } }),
126
+ children: container && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LicenseProvider.LicenseProvider, { licenseKey: rest.licenseKey, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useContainer.ContainerProvider, { container, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_EditorPortal.EditorPortalProvider, { host: portalHost, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useEditorComponents.EditorComponentsProvider, { overrides: components, children: store ? store instanceof import_store.Store ? (
127
+ // Store is ready to go, whether externally synced or not
128
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithReadyStore, { ...withDefaults, store, user })
129
+ ) : (
130
+ // Store is a synced store, so handle syncing stages internally
131
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithLoadingStore, { ...withDefaults, store, user })
132
+ ) : (
133
+ // We have no store (it's undefined) so create one and possibly sync it
134
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithOwnStore, { ...withDefaults, store, user })
135
+ ) }) }) }) })
136
+ }
137
+ ),
138
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tl-portal-host", ref: setPortalHost })
139
+ ]
135
140
  }
136
141
  );
137
142
  });
@@ -458,7 +463,12 @@ function useOnMount(onMount) {
458
463
  { history: "ignore" }
459
464
  );
460
465
  window.tldrawReady = true;
461
- return teardown;
466
+ return () => {
467
+ teardown?.();
468
+ if (editor2.getIsMounted() && !editor2.isDisposed) {
469
+ editor2.run(() => editor2.emit("unmount"), { history: "ignore" });
470
+ }
471
+ };
462
472
  });
463
473
  import_react.default.useLayoutEffect(() => {
464
474
  if (editor) return onMountEvent?.(editor);