@tldraw/editor 4.6.0-internal.e29318c66fb0 → 4.6.0-next.0c36db38afea

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 (155) hide show
  1. package/dist-cjs/index.d.ts +184 -24
  2. package/dist-cjs/index.js +5 -4
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +4 -2
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +1 -1
  7. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  8. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js +1 -1
  9. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +2 -2
  10. package/dist-cjs/lib/config/{createTLUser.js → createTLCurrentUser.js} +9 -9
  11. package/dist-cjs/lib/config/createTLCurrentUser.js.map +7 -0
  12. package/dist-cjs/lib/config/createTLStore.js +24 -1
  13. package/dist-cjs/lib/config/createTLStore.js.map +2 -2
  14. package/dist-cjs/lib/config/defaultShapes.js.map +2 -2
  15. package/dist-cjs/lib/editor/Editor.js +115 -8
  16. package/dist-cjs/lib/editor/Editor.js.map +3 -3
  17. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +1 -1
  18. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +2 -2
  19. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js +1 -1
  20. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js.map +2 -2
  21. package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +2 -2
  22. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +4 -4
  23. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +2 -2
  24. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +102 -30
  25. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
  26. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
  27. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +10 -0
  28. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  29. package/dist-cjs/lib/editor/types/clipboard-types.js.map +1 -1
  30. package/dist-cjs/lib/exports/StyleEmbedder.js +1 -1
  31. package/dist-cjs/lib/exports/StyleEmbedder.js.map +2 -2
  32. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  33. package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
  34. package/dist-cjs/lib/hooks/useGestureEvents.js +171 -127
  35. package/dist-cjs/lib/hooks/useGestureEvents.js.map +3 -3
  36. package/dist-cjs/lib/hooks/useLocalStore.js.map +2 -2
  37. package/dist-cjs/lib/options.js +3 -0
  38. package/dist-cjs/lib/options.js.map +2 -2
  39. package/dist-cjs/lib/primitives/Box.js +1 -1
  40. package/dist-cjs/lib/primitives/Box.js.map +2 -2
  41. package/dist-cjs/lib/primitives/geometry/Arc2d.js +2 -2
  42. package/dist-cjs/lib/primitives/geometry/Arc2d.js.map +2 -2
  43. package/dist-cjs/lib/primitives/geometry/Circle2d.js +2 -2
  44. package/dist-cjs/lib/primitives/geometry/Circle2d.js.map +2 -2
  45. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js +2 -2
  46. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js.map +2 -2
  47. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +4 -3
  48. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
  49. package/dist-cjs/lib/primitives/geometry/Polyline2d.js +1 -1
  50. package/dist-cjs/lib/primitives/geometry/Polyline2d.js.map +2 -2
  51. package/dist-cjs/lib/primitives/geometry/Stadium2d.js +1 -1
  52. package/dist-cjs/lib/primitives/geometry/Stadium2d.js.map +2 -2
  53. package/dist-cjs/lib/utils/getSvgPathFromPoints.js.map +2 -2
  54. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +1 -1
  55. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +2 -2
  56. package/dist-cjs/version.js +3 -3
  57. package/dist-cjs/version.js.map +1 -1
  58. package/dist-esm/index.d.mts +184 -24
  59. package/dist-esm/index.mjs +12 -5
  60. package/dist-esm/index.mjs.map +2 -2
  61. package/dist-esm/lib/TldrawEditor.mjs +4 -2
  62. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  63. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +1 -1
  64. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  65. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs +1 -1
  66. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +2 -2
  67. package/dist-esm/lib/config/{createTLUser.mjs → createTLCurrentUser.mjs} +6 -6
  68. package/dist-esm/lib/config/createTLCurrentUser.mjs.map +7 -0
  69. package/dist-esm/lib/config/createTLStore.mjs +28 -2
  70. package/dist-esm/lib/config/createTLStore.mjs.map +2 -2
  71. package/dist-esm/lib/config/defaultShapes.mjs.map +2 -2
  72. package/dist-esm/lib/editor/Editor.mjs +118 -9
  73. package/dist-esm/lib/editor/Editor.mjs.map +3 -3
  74. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +1 -1
  75. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +2 -2
  76. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs +1 -1
  77. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs.map +2 -2
  78. package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +2 -2
  79. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +4 -4
  80. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +2 -2
  81. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +102 -30
  82. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
  83. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
  84. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +10 -0
  85. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  86. package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -1
  87. package/dist-esm/lib/exports/StyleEmbedder.mjs.map +2 -2
  88. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  89. package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
  90. package/dist-esm/lib/hooks/useGestureEvents.mjs +171 -127
  91. package/dist-esm/lib/hooks/useGestureEvents.mjs.map +3 -3
  92. package/dist-esm/lib/hooks/useLocalStore.mjs.map +2 -2
  93. package/dist-esm/lib/options.mjs +3 -0
  94. package/dist-esm/lib/options.mjs.map +2 -2
  95. package/dist-esm/lib/primitives/Box.mjs +1 -1
  96. package/dist-esm/lib/primitives/Box.mjs.map +2 -2
  97. package/dist-esm/lib/primitives/geometry/Arc2d.mjs +2 -2
  98. package/dist-esm/lib/primitives/geometry/Arc2d.mjs.map +2 -2
  99. package/dist-esm/lib/primitives/geometry/Circle2d.mjs +2 -2
  100. package/dist-esm/lib/primitives/geometry/Circle2d.mjs.map +2 -2
  101. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs +2 -2
  102. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs.map +2 -2
  103. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +4 -3
  104. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
  105. package/dist-esm/lib/primitives/geometry/Polyline2d.mjs +1 -1
  106. package/dist-esm/lib/primitives/geometry/Polyline2d.mjs.map +2 -2
  107. package/dist-esm/lib/primitives/geometry/Stadium2d.mjs +1 -1
  108. package/dist-esm/lib/primitives/geometry/Stadium2d.mjs.map +2 -2
  109. package/dist-esm/lib/utils/getSvgPathFromPoints.mjs.map +2 -2
  110. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +1 -1
  111. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +2 -2
  112. package/dist-esm/version.mjs +3 -3
  113. package/dist-esm/version.mjs.map +1 -1
  114. package/editor.css +13 -0
  115. package/package.json +8 -9
  116. package/src/index.ts +14 -2
  117. package/src/lib/TldrawEditor.tsx +9 -7
  118. package/src/lib/components/default-components/DefaultCanvas.tsx +1 -1
  119. package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +1 -1
  120. package/src/lib/config/TLEditorSnapshot.test.ts +1 -1
  121. package/src/lib/config/{createTLUser.ts → createTLCurrentUser.ts} +6 -6
  122. package/src/lib/config/createTLStore.ts +36 -2
  123. package/src/lib/config/defaultShapes.ts +1 -1
  124. package/src/lib/editor/Editor.ts +148 -10
  125. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +1 -1
  126. package/src/lib/editor/managers/SnapManager/BoundsSnaps.ts +1 -1
  127. package/src/lib/editor/managers/SnapManager/HandleSnaps.ts +1 -1
  128. package/src/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.ts +5 -5
  129. package/src/lib/editor/managers/TextManager/TextManager.test.ts +18 -4
  130. package/src/lib/editor/managers/TextManager/TextManager.ts +140 -34
  131. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +2 -2
  132. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +2 -2
  133. package/src/lib/editor/shapes/ShapeUtil.ts +13 -2
  134. package/src/lib/editor/types/clipboard-types.ts +2 -1
  135. package/src/lib/exports/StyleEmbedder.ts +1 -1
  136. package/src/lib/exports/getSvgJsx.tsx +1 -1
  137. package/src/lib/hooks/useEditorComponents.tsx +1 -1
  138. package/src/lib/hooks/useGestureEvents.ts +240 -168
  139. package/src/lib/hooks/useLocalStore.ts +1 -1
  140. package/src/lib/options.ts +108 -0
  141. package/src/lib/primitives/Box.test.ts +30 -0
  142. package/src/lib/primitives/Box.ts +1 -1
  143. package/src/lib/primitives/geometry/Arc2d.ts +2 -2
  144. package/src/lib/primitives/geometry/Circle2d.ts +2 -2
  145. package/src/lib/primitives/geometry/Ellipse2d.ts +2 -2
  146. package/src/lib/primitives/geometry/Geometry2d.test.ts +21 -0
  147. package/src/lib/primitives/geometry/Geometry2d.ts +4 -3
  148. package/src/lib/primitives/geometry/Polyline2d.ts +1 -1
  149. package/src/lib/primitives/geometry/Stadium2d.ts +1 -1
  150. package/src/lib/utils/getSvgPathFromPoints.ts +1 -1
  151. package/src/lib/utils/sync/TLLocalSyncClient.test.ts +1 -1
  152. package/src/lib/utils/sync/TLLocalSyncClient.ts +1 -1
  153. package/src/version.ts +3 -3
  154. package/dist-cjs/lib/config/createTLUser.js.map +0 -7
  155. package/dist-esm/lib/config/createTLUser.mjs.map +0 -7
@@ -1,5 +1,6 @@
1
1
  import { Atom } from '@tldraw/state';
2
2
  import { AtomSet } from '@tldraw/store';
3
+ import { Awaitable } from '@tldraw/utils';
3
4
  import { BoxModel } from '@tldraw/tlschema';
4
5
  import { ComponentType } from 'react';
5
6
  import { Computed } from '@tldraw/state';
@@ -82,6 +83,8 @@ import { TLStoreSchema } from '@tldraw/tlschema';
82
83
  import { TLStoreSnapshot } from '@tldraw/tlschema';
83
84
  import { TLUnknownBinding } from '@tldraw/tlschema';
84
85
  import { TLUnknownShape } from '@tldraw/tlschema';
86
+ import { TLUser } from '@tldraw/tlschema';
87
+ import { TLUserStore } from '@tldraw/tlschema';
85
88
  import { TLVideoAsset } from '@tldraw/tlschema';
86
89
  import { UnknownRecord } from '@tldraw/store';
87
90
  import { VecModel } from '@tldraw/tlschema';
@@ -164,6 +167,12 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
164
167
  getInterpolatedProps(startShape: Shape, endShape: Shape, t: number): Shape['props'];
165
168
  }
166
169
 
170
+ /** @public */
171
+ export declare interface BatchMeasurementRequest {
172
+ html: string;
173
+ opts: TLMeasureTextOpts;
174
+ }
175
+
167
176
  /**
168
177
  * Options passed to {@link BindingUtil.onBeforeChange} and {@link BindingUtil.onAfterChange},
169
178
  * describing the data associated with a binding being changed.
@@ -711,6 +720,12 @@ export declare function createDeepLinkString(deepLink: TLDeepLink): string;
711
720
  */
712
721
  export declare function createSessionStateSnapshotSignal(store: TLStore): Signal<null | TLSessionStateSnapshot>;
713
722
 
723
+ /** @public */
724
+ export declare function createTLCurrentUser(opts?: {
725
+ setUserPreferences?: ((userPreferences: TLUserPreferences) => void) | undefined;
726
+ userPreferences?: Signal<TLUserPreferences, unknown> | undefined;
727
+ }): TLCurrentUser;
728
+
714
729
  /**
715
730
  * A helper for creating a TLStore schema from either an object with shapeUtils, bindingUtils, and
716
731
  * migrations, or a schema.
@@ -728,13 +743,7 @@ export declare function createTLSchemaFromUtils(opts: TLStoreSchemaOptions): Sto
728
743
  *
729
744
  * @public
730
745
  */
731
- export declare function createTLStore({ initialData, defaultName, id, assets, onMount, collaboration, ...rest }?: TLStoreOptions): TLStore;
732
-
733
- /** @public */
734
- export declare function createTLUser(opts?: {
735
- setUserPreferences?: ((userPreferences: TLUserPreferences) => void) | undefined;
736
- userPreferences?: Signal<TLUserPreferences, unknown> | undefined;
737
- }): TLUser;
746
+ export declare function createTLStore({ initialData, defaultName, id, assets, users, onMount, collaboration, ...rest }?: TLStoreOptions): TLStore;
738
747
 
739
748
  /** @public */
740
749
  export declare class CubicBezier2d extends Polyline2d {
@@ -923,6 +932,9 @@ export declare const defaultTldrawOptions: {
923
932
  readonly maxShapesPerPage: 4000;
924
933
  readonly multiClickDurationMs: 200;
925
934
  readonly nonce: undefined;
935
+ readonly onBeforeCopyToClipboard: undefined;
936
+ readonly onBeforePasteFromClipboard: undefined;
937
+ readonly onClipboardPasteRaw: undefined;
926
938
  readonly quickZoomPreservesScreenBounds: true;
927
939
  readonly snapThreshold: 8;
928
940
  readonly spacebarPanning: true;
@@ -953,6 +965,9 @@ export declare const defaultUserPreferences: Readonly<{
953
965
  name: "";
954
966
  }>;
955
967
 
968
+ /** @public */
969
+ export declare const defaultUserStore: TLUserStore;
970
+
956
971
  /**
957
972
  * Convert degrees to radians.
958
973
  *
@@ -2259,6 +2274,32 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2259
2274
  * @public
2260
2275
  */
2261
2276
  getCollaboratorsOnCurrentPage(): TLInstancePresence[];
2277
+ /**
2278
+ * Get the current user's ID for attribution purposes.
2279
+ * Also ensures a `user:` record exists in the store for the current user.
2280
+ * Returns `null` when the user store has no current user.
2281
+ *
2282
+ * @public
2283
+ */
2284
+ getAttributionUserId(): null | string;
2285
+ /* Excluded from this release type: _ensureUserRecord */
2286
+ /**
2287
+ * Resolve a display name for a user ID. Asks the
2288
+ * {@link @tldraw/tlschema#TLUserStore} first (the app's source of truth),
2289
+ * falling back to the `user:` record in the store.
2290
+ *
2291
+ * @public
2292
+ */
2293
+ getAttributionDisplayName(userId: null | string): null | string;
2294
+ /**
2295
+ * Resolve a user record by ID. Asks the
2296
+ * {@link @tldraw/tlschema#TLUserStore} first (the app's source of truth),
2297
+ * falling back to the `user:` record in the store.
2298
+ *
2299
+ * @public
2300
+ */
2301
+ getAttributionUser(userId: null | string): null | TLUser;
2302
+ /* Excluded from this release type: _getReferencedUserIds */
2262
2303
  private _isLockedOnFollowingUser;
2263
2304
  /**
2264
2305
  * Start viewport-following a user.
@@ -5947,6 +5988,14 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5947
5988
  */
5948
5989
  getHandleSnapGeometry(shape: Shape): HandleSnapGeometry;
5949
5990
  getText(shape: Shape): string | undefined;
5991
+ /**
5992
+ * Return user IDs referenced in shape-specific props.
5993
+ * Used when copying shapes to include referenced users on the clipboard.
5994
+ * Override this if your shape stores user IDs in custom props.
5995
+ *
5996
+ * @public
5997
+ */
5998
+ getReferencedUserIds(shape: Shape): string[];
5950
5999
  getAriaDescriptor(shape: Shape): string | undefined;
5951
6000
  /**
5952
6001
  * A callback called just before a shape is created. This method provides a last chance to modify
@@ -6507,15 +6556,18 @@ export declare const TAB_ID: string;
6507
6556
  export declare class TextManager {
6508
6557
  editor: Editor;
6509
6558
  private elm;
6559
+ private poolElms;
6510
6560
  constructor(editor: Editor);
6561
+ private createMeasurementEl;
6562
+ private resetElementStyles;
6511
6563
  private setElementStyles;
6564
+ private getMeasureStyles;
6512
6565
  dispose(): void;
6513
- measureText(textToMeasure: string, opts: TLMeasureTextOpts): BoxModel & {
6514
- scrollWidth: number;
6515
- };
6516
- measureHtml(html: string, opts: TLMeasureTextOpts): BoxModel & {
6517
- scrollWidth: number;
6518
- };
6566
+ private ensurePoolSize;
6567
+ private getPoolItem;
6568
+ measureHtmlBatch(requests: BatchMeasurementRequest[]): TLMeasuredTextSize[];
6569
+ measureText(textToMeasure: string, opts: TLMeasureTextOpts): TLMeasuredTextSize;
6570
+ measureHtml(html: string, opts: TLMeasureTextOpts): TLMeasuredTextSize;
6519
6571
  /**
6520
6572
  * Given an html element, measure the position of each span of unbroken
6521
6573
  * word/white-space characters within any text nodes it contains.
@@ -6727,6 +6779,40 @@ export declare type TLCLickEventName = 'double_click' | 'quadruple_click' | 'tri
6727
6779
  /** @public */
6728
6780
  export declare type TLClickState = 'idle' | 'overflow' | 'pendingDouble' | 'pendingOverflow' | 'pendingQuadruple' | 'pendingTriple';
6729
6781
 
6782
+ /**
6783
+ * Raw clipboard paste payload, before tldraw parses clipboard contents into {@link TLExternalContent}.
6784
+ *
6785
+ * - `native-event`: from the `paste` event — `clipboardData` is available synchronously (unlike async
6786
+ * `navigator.clipboard.read()`).
6787
+ * - `clipboard-read`: from an explicit `navigator.clipboard.read()` call — only `ClipboardItem[]`
6788
+ * exists
6789
+ * (no `DataTransfer`).
6790
+ *
6791
+ * @public
6792
+ */
6793
+ export declare type TLClipboardPasteRawInfo = {
6794
+ readonly clipboardData: DataTransfer | null;
6795
+ readonly editor: Editor;
6796
+ readonly event: ClipboardEvent;
6797
+ readonly point: undefined | VecLike;
6798
+ readonly source: 'native-event';
6799
+ } | {
6800
+ readonly clipboardItems: readonly ClipboardItem[];
6801
+ readonly editor: Editor;
6802
+ readonly point: undefined | VecLike;
6803
+ readonly source: 'clipboard-read';
6804
+ };
6805
+
6806
+ /**
6807
+ * Identifies how a clipboard write was triggered (copy vs cut, keyboard vs menu).
6808
+ *
6809
+ * @public
6810
+ */
6811
+ export declare interface TLClipboardWriteInfo {
6812
+ readonly operation: 'copy' | 'cut';
6813
+ readonly source: 'menu' | 'native';
6814
+ }
6815
+
6730
6816
  /** @public */
6731
6817
  export declare interface TLCollaboratorHintProps {
6732
6818
  userId: string;
@@ -6754,6 +6840,7 @@ export declare interface TLContent {
6754
6840
  rootShapeIds: TLShapeId[];
6755
6841
  assets: TLAsset[];
6756
6842
  schema: SerializedSchema;
6843
+ users?: TLUser[];
6757
6844
  }
6758
6845
 
6759
6846
  /**
@@ -6775,6 +6862,12 @@ export declare interface TLCropInfo<T extends TLShape> {
6775
6862
  aspectRatioLocked?: boolean;
6776
6863
  }
6777
6864
 
6865
+ /** @public */
6866
+ export declare interface TLCurrentUser {
6867
+ readonly userPreferences: Signal<TLUserPreferences>;
6868
+ readonly setUserPreferences: (userPreferences: TLUserPreferences) => void;
6869
+ }
6870
+
6778
6871
  /** @public */
6779
6872
  export declare interface TLCursorProps {
6780
6873
  userId: string;
@@ -6902,7 +6995,7 @@ export declare interface TldrawEditorBaseProps {
6902
6995
  /**
6903
6996
  * The user interacting with the editor.
6904
6997
  */
6905
- user?: TLUser;
6998
+ user?: TLCurrentUser;
6906
6999
  /**
6907
7000
  * Whether to infer dark mode from the user's OS. Defaults to false.
6908
7001
  */
@@ -7166,6 +7259,72 @@ export declare interface TldrawOptions {
7166
7259
  * viewport's page dimensions regardless of overview zoom changes.
7167
7260
  */
7168
7261
  readonly quickZoomPreservesScreenBounds: boolean;
7262
+ /**
7263
+ * Called before content is written to the clipboard during a copy or cut operation.
7264
+ * Receives the serialized content (shapes, bindings, assets) and can filter or transform
7265
+ * it before it reaches the clipboard.
7266
+ *
7267
+ * Return a modified `TLContent` object to change what is copied or cut. Return `false` to
7268
+ * cancel the clipboard write (for cut, the selected shapes are not removed). Return `void`
7269
+ * (or `undefined`) to pass through unchanged. You may return a `Promise` of those values if
7270
+ * the hook is async.
7271
+ *
7272
+ * @example
7273
+ * ```tsx
7274
+ * // Filter out "locked" shapes from copy
7275
+ * onBeforeCopyToClipboard({ content, operation }) {
7276
+ * return {
7277
+ * ...content,
7278
+ * shapes: content.shapes.filter(s => !s.meta.locked),
7279
+ * rootShapeIds: content.rootShapeIds.filter(id =>
7280
+ * content.shapes.find(s => s.id === id && !s.meta.locked)
7281
+ * ),
7282
+ * }
7283
+ * }
7284
+ * ```
7285
+ */
7286
+ onBeforeCopyToClipboard?(info: {
7287
+ content: TLContent;
7288
+ editor: Editor;
7289
+ } & TLClipboardWriteInfo): Awaitable<false | TLContent | void>;
7290
+ /**
7291
+ * Called before pasted content is processed and shapes are created. Receives the parsed
7292
+ * external content from the clipboard and can filter, transform, or cancel it.
7293
+ *
7294
+ * Return `false` to cancel the paste. Return a modified content object to transform it.
7295
+ * Return `void` (or `undefined`) to pass through unchanged. You may return a `Promise` of
7296
+ * those values if the hook is async.
7297
+ *
7298
+ * This only fires for clipboard paste operations (keyboard shortcuts and menu actions),
7299
+ * not for file drops or programmatic `putExternalContent` calls.
7300
+ *
7301
+ * @example
7302
+ * ```tsx
7303
+ * // Block pasting of image files
7304
+ * onBeforePasteFromClipboard({ content }) {
7305
+ * if (content.type === 'files') {
7306
+ * const nonImages = content.files.filter(f => !f.type.startsWith('image/'))
7307
+ * if (nonImages.length === 0) return false
7308
+ * return { ...content, files: nonImages }
7309
+ * }
7310
+ * }
7311
+ * ```
7312
+ */
7313
+ onBeforePasteFromClipboard?(info: {
7314
+ content: TLExternalContent<unknown>;
7315
+ editor: Editor;
7316
+ point?: VecLike;
7317
+ source: 'clipboard-read' | 'native-event';
7318
+ }): Awaitable<false | TLExternalContent<unknown> | void>;
7319
+ /**
7320
+ * Called first for keyboard and menu paste, **before** tldraw handles or parses clipboard data
7321
+ * (and before {@link TldrawOptions.onBeforePasteFromClipboard}).
7322
+ *
7323
+ * Return `false` to cancel tldraw's default paste handling for this gesture (same convention as
7324
+ * {@link TldrawOptions.onBeforePasteFromClipboard}). Use this when you handle paste yourself from
7325
+ * raw clipboard data, or to block the gesture entirely. Return `void` (or `undefined`) to continue.
7326
+ */
7327
+ onClipboardPasteRaw?(info: TLClipboardPasteRawInfo): false | void;
7169
7328
  /**
7170
7329
  * Called when content is dropped on the canvas. Provides the page position
7171
7330
  * where the drop occurred and the underlying drag event object.
@@ -7244,7 +7403,7 @@ export declare interface TLEditorOptions {
7244
7403
  /**
7245
7404
  * A user defined externally to replace the default user.
7246
7405
  */
7247
- user?: TLUser;
7406
+ user?: TLCurrentUser;
7248
7407
  /**
7249
7408
  * The editor's initial active tool (or other state node id).
7250
7409
  */
@@ -7743,6 +7902,11 @@ export declare interface TLLoadSnapshotOptions {
7743
7902
  forceOverwriteSessionState?: boolean;
7744
7903
  }
7745
7904
 
7905
+ /** @public */
7906
+ export declare type TLMeasuredTextSize = BoxModel & {
7907
+ scrollWidth: number;
7908
+ };
7909
+
7746
7910
  /** @public */
7747
7911
  export declare interface TLMeasureTextOpts {
7748
7912
  fontStyle: string;
@@ -8219,6 +8383,8 @@ export declare interface TLStoreBaseOptions {
8219
8383
  defaultName?: string;
8220
8384
  /** How should this store upload & resolve assets? */
8221
8385
  assets?: TLAssetStore;
8386
+ /** How should this store resolve users for attribution? */
8387
+ users?: TLUserStore;
8222
8388
  /** Called when the store is connected to an {@link @tldraw/editor#Editor}. */
8223
8389
  onMount?(editor: Editor): (() => void) | void;
8224
8390
  }
@@ -8406,12 +8572,6 @@ export declare interface TLUrlExternalContent extends TLBaseExternalContent {
8406
8572
  url: string;
8407
8573
  }
8408
8574
 
8409
- /** @public */
8410
- export declare interface TLUser {
8411
- readonly userPreferences: Signal<TLUserPreferences>;
8412
- readonly setUserPreferences: (userPreferences: TLUserPreferences) => void;
8413
- }
8414
-
8415
8575
  /**
8416
8576
  * A user of tldraw
8417
8577
  *
@@ -8594,7 +8754,7 @@ export declare class UserPreferencesManager {
8594
8754
  systemColorScheme: Atom<"dark" | "light", unknown>;
8595
8755
  disposables: Set<() => void>;
8596
8756
  dispose(): void;
8597
- constructor(user: TLUser, inferDarkMode: boolean);
8757
+ constructor(user: TLCurrentUser, inferDarkMode: boolean);
8598
8758
  updateUserPreferences(userPreferences: Partial<TLUserPreferences>): void;
8599
8759
  getUserPreferences(): {
8600
8760
  animationSpeed: number;
@@ -8665,10 +8825,10 @@ export declare function useSvgExportContext(): null | SvgExportContext;
8665
8825
  /**
8666
8826
  * @public
8667
8827
  */
8668
- export declare function useTldrawUser(opts: {
8828
+ export declare function useTldrawCurrentUser(opts: {
8669
8829
  setUserPreferences?: (userPreferences: TLUserPreferences) => void;
8670
8830
  userPreferences?: Signal<TLUserPreferences> | TLUserPreferences;
8671
- }): TLUser;
8831
+ }): TLCurrentUser;
8672
8832
 
8673
8833
  /** @public */
8674
8834
  export declare function useTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreSchema<TLRecord, TLStoreProps>;
@@ -56,12 +56,16 @@ import {
56
56
  import { HTMLContainer } from "./lib/components/HTMLContainer.mjs";
57
57
  import { MenuClickCapture } from "./lib/components/MenuClickCapture.mjs";
58
58
  import { SVGContainer } from "./lib/components/SVGContainer.mjs";
59
+ import {
60
+ createTLCurrentUser,
61
+ useTldrawCurrentUser
62
+ } from "./lib/config/createTLCurrentUser.mjs";
59
63
  import {
60
64
  createTLSchemaFromUtils,
61
65
  createTLStore,
66
+ defaultUserStore,
62
67
  inlineBase64AssetStore
63
68
  } from "./lib/config/createTLStore.mjs";
64
- import { createTLUser, useTldrawUser } from "./lib/config/createTLUser.mjs";
65
69
  import { coreShapes } from "./lib/config/defaultShapes.mjs";
66
70
  import {
67
71
  getSnapshot,
@@ -175,7 +179,9 @@ import {
175
179
  LicenseManager
176
180
  } from "./lib/license/LicenseManager.mjs";
177
181
  import { LICENSE_TIMEOUT } from "./lib/license/LicenseProvider.mjs";
178
- import { defaultTldrawOptions } from "./lib/options.mjs";
182
+ import {
183
+ defaultTldrawOptions
184
+ } from "./lib/options.mjs";
179
185
  import {
180
186
  Box,
181
187
  ROTATE_CORNER_TO_SELECTION_CORNER,
@@ -307,7 +313,7 @@ import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
307
313
  import { uniq } from "./lib/utils/uniq.mjs";
308
314
  registerTldrawLibraryVersion(
309
315
  "@tldraw/editor",
310
- "4.6.0-internal.e29318c66fb0",
316
+ "4.6.0-next.0c36db38afea",
311
317
  "esm"
312
318
  );
313
319
  export {
@@ -414,13 +420,14 @@ export {
414
420
  createDebugValue,
415
421
  createDeepLinkString,
416
422
  createSessionStateSnapshotSignal,
423
+ createTLCurrentUser,
417
424
  createTLSchemaFromUtils,
418
425
  createTLStore,
419
- createTLUser,
420
426
  dataUrlToFile,
421
427
  debugFlags,
422
428
  defaultTldrawOptions,
423
429
  defaultUserPreferences,
430
+ defaultUserStore,
424
431
  degreesToRadians,
425
432
  elementShouldCaptureKeys,
426
433
  extractSessionStateFromLegacySnapshot,
@@ -527,7 +534,7 @@ export {
527
534
  useSvgExportContext,
528
535
  useTLSchemaFromUtils,
529
536
  useTLStore,
530
- useTldrawUser,
537
+ useTldrawCurrentUser,
531
538
  useTransform,
532
539
  useUniqueSafeId,
533
540
  useViewportHeight,
@@ -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\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { createTLUser, useTldrawUser, type TLUser } from './lib/config/createTLUser'\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 {\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 {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} 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 TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\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 { 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 { useIsDarkMode } from './lib/hooks/useIsDarkMode'\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 { defaultTldrawOptions, type TldrawOptions } 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"],
5
- "mappings": "AAAA,SAAS,oCAAoC;AAG7C,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,SAAS,yBAAyB;AAClC,SAAS,oBAAuC;AAChD;AAAA,EACC;AAA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EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB,aAA6B;AAEtD,SAAS,YAAY;AAErB;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 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 {\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 {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} 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 { TickManager } from './lib/editor/managers/TickManager/TickManager'\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 { 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 { useIsDarkMode } from './lib/hooks/useIsDarkMode'\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"],
5
+ "mappings": "AAAA,SAAS,oCAAoC;AAG7C,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,SAAS,yBAAyB;AAClC,SAAS,oBAAuC;AAChD;AAAA,EACC;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AACP,SAAS,mBAAqC;AAC9C;AAAA,EACC;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AAEP;AAAA,EACC;AAAA,OAEM;AAEP;AAAA,EACC;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AACP;AAAA,EACC;AAAA,OAEM;AACP,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,qBAA8C;AACvD,SAAS,wBAAwB;AACjC,SAAS,oBAA4C;AACrD;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKM;AAEP,SAAS,kBAAkD;AAC3D;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,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AACP,SAAS,WAAyB;AAClC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAQM;AACP,SAAS,eAAe,4BAA4B;AACpD,SAAS,mCAAuD;AAChE;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAIM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACM;AACP,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,8BAA8B,6BAA6B;AACpE;AAAA,EACC;AAAA,OAMM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB,aAA6B;AAEtD,SAAS,YAAY;AAErB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
@@ -15,7 +15,7 @@ import React, {
15
15
  import { version } from "../version.mjs";
16
16
  import { DefaultErrorFallback } from "./components/default-components/DefaultErrorFallback.mjs";
17
17
  import { OptionalErrorBoundary } from "./components/ErrorBoundary.mjs";
18
- import { createTLUser } from "./config/createTLUser.mjs";
18
+ import { createTLCurrentUser } from "./config/createTLCurrentUser.mjs";
19
19
  import { Editor } from "./editor/Editor.mjs";
20
20
  import { useEditorComponents } from "./hooks/EditorComponentsContext.mjs";
21
21
  import { ContainerProvider, useContainer } from "./hooks/useContainer.mjs";
@@ -50,7 +50,7 @@ const TldrawEditor = memo(function TldrawEditor2({
50
50
  ...rest
51
51
  }) {
52
52
  const [container, setContainer] = useState(null);
53
- const user = useMemo(() => _user ?? createTLUser(), [_user]);
53
+ const user = useMemo(() => _user ?? createTLCurrentUser(), [_user]);
54
54
  const ErrorFallback = components?.ErrorFallback === void 0 ? DefaultErrorFallback : components?.ErrorFallback;
55
55
  const mergedOptions = useMemo(() => {
56
56
  let result = _options;
@@ -113,6 +113,7 @@ function TldrawEditorWithOwnStore(props) {
113
113
  sessionId,
114
114
  user,
115
115
  assets,
116
+ users,
116
117
  migrations
117
118
  } = props;
118
119
  const syncedStore = useLocalStore({
@@ -124,6 +125,7 @@ function TldrawEditorWithOwnStore(props) {
124
125
  defaultName,
125
126
  snapshot,
126
127
  assets,
128
+ users,
127
129
  migrations
128
130
  });
129
131
  return /* @__PURE__ */ jsx(TldrawEditorWithLoadingStore, { ...props, store: syncedStore, user });