@tldraw/editor 3.15.4 → 3.16.0-canary.016d4c2889b7

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 (147) hide show
  1. package/dist-cjs/index.d.ts +180 -9
  2. package/dist-cjs/index.js +5 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +8 -2
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/MenuClickCapture.js +0 -5
  7. package/dist-cjs/lib/components/MenuClickCapture.js.map +2 -2
  8. package/dist-cjs/lib/components/Shape.js +11 -36
  9. package/dist-cjs/lib/components/Shape.js.map +2 -2
  10. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +4 -23
  11. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  12. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js +1 -1
  13. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +1 -1
  14. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +1 -1
  15. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
  16. package/dist-cjs/lib/components/default-components/DefaultScribble.js +1 -1
  17. package/dist-cjs/lib/components/default-components/DefaultScribble.js.map +2 -2
  18. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +9 -1
  19. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
  20. package/dist-cjs/lib/components/default-components/DefaultShapeWrapper.js +53 -0
  21. package/dist-cjs/lib/components/default-components/DefaultShapeWrapper.js.map +7 -0
  22. package/dist-cjs/lib/config/TLUserPreferences.js +9 -3
  23. package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
  24. package/dist-cjs/lib/editor/Editor.js +138 -69
  25. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  26. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +9 -4
  27. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
  28. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +13 -0
  29. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  30. package/dist-cjs/lib/editor/types/misc-types.js.map +1 -1
  31. package/dist-cjs/lib/exports/getSvgJsx.js +35 -16
  32. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  33. package/dist-cjs/lib/hooks/useCanvasEvents.js +31 -25
  34. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  35. package/dist-cjs/lib/hooks/useEditorComponents.js +2 -0
  36. package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
  37. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js +4 -1
  38. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  39. package/dist-cjs/lib/{utils/nearestMultiple.js → hooks/useStateAttribute.js} +15 -14
  40. package/dist-cjs/lib/hooks/useStateAttribute.js.map +7 -0
  41. package/dist-cjs/lib/license/Watermark.js +6 -6
  42. package/dist-cjs/lib/license/Watermark.js.map +1 -1
  43. package/dist-cjs/lib/options.js +7 -0
  44. package/dist-cjs/lib/options.js.map +2 -2
  45. package/dist-cjs/lib/primitives/Box.js +3 -0
  46. package/dist-cjs/lib/primitives/Box.js.map +2 -2
  47. package/dist-cjs/lib/utils/EditorAtom.js +45 -0
  48. package/dist-cjs/lib/utils/EditorAtom.js.map +7 -0
  49. package/dist-cjs/version.js +3 -3
  50. package/dist-cjs/version.js.map +1 -1
  51. package/dist-esm/index.d.mts +180 -9
  52. package/dist-esm/index.mjs +7 -1
  53. package/dist-esm/index.mjs.map +2 -2
  54. package/dist-esm/lib/TldrawEditor.mjs +8 -2
  55. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  56. package/dist-esm/lib/components/MenuClickCapture.mjs +0 -5
  57. package/dist-esm/lib/components/MenuClickCapture.mjs.map +2 -2
  58. package/dist-esm/lib/components/Shape.mjs +11 -36
  59. package/dist-esm/lib/components/Shape.mjs.map +2 -2
  60. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +4 -23
  61. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  62. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs +1 -1
  63. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +1 -1
  64. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +1 -1
  65. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
  66. package/dist-esm/lib/components/default-components/DefaultScribble.mjs +1 -1
  67. package/dist-esm/lib/components/default-components/DefaultScribble.mjs.map +2 -2
  68. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +9 -1
  69. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
  70. package/dist-esm/lib/components/default-components/DefaultShapeWrapper.mjs +23 -0
  71. package/dist-esm/lib/components/default-components/DefaultShapeWrapper.mjs.map +7 -0
  72. package/dist-esm/lib/config/TLUserPreferences.mjs +9 -3
  73. package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
  74. package/dist-esm/lib/editor/Editor.mjs +138 -69
  75. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  76. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +9 -4
  77. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
  78. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +13 -0
  79. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  80. package/dist-esm/lib/exports/getSvgJsx.mjs +36 -16
  81. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  82. package/dist-esm/lib/hooks/useCanvasEvents.mjs +32 -26
  83. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  84. package/dist-esm/lib/hooks/useEditorComponents.mjs +4 -0
  85. package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
  86. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs +4 -1
  87. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  88. package/dist-esm/lib/hooks/useStateAttribute.mjs +15 -0
  89. package/dist-esm/lib/hooks/useStateAttribute.mjs.map +7 -0
  90. package/dist-esm/lib/license/Watermark.mjs +6 -6
  91. package/dist-esm/lib/license/Watermark.mjs.map +1 -1
  92. package/dist-esm/lib/options.mjs +7 -0
  93. package/dist-esm/lib/options.mjs.map +2 -2
  94. package/dist-esm/lib/primitives/Box.mjs +4 -1
  95. package/dist-esm/lib/primitives/Box.mjs.map +2 -2
  96. package/dist-esm/lib/utils/EditorAtom.mjs +25 -0
  97. package/dist-esm/lib/utils/EditorAtom.mjs.map +7 -0
  98. package/dist-esm/version.mjs +3 -3
  99. package/dist-esm/version.mjs.map +1 -1
  100. package/editor.css +305 -311
  101. package/package.json +14 -37
  102. package/src/index.ts +7 -0
  103. package/src/lib/TldrawEditor.tsx +13 -6
  104. package/src/lib/components/MenuClickCapture.tsx +0 -8
  105. package/src/lib/components/Shape.tsx +12 -33
  106. package/src/lib/components/default-components/DefaultCanvas.tsx +5 -22
  107. package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +1 -1
  108. package/src/lib/components/default-components/DefaultErrorFallback.tsx +1 -1
  109. package/src/lib/components/default-components/DefaultScribble.tsx +1 -1
  110. package/src/lib/components/default-components/DefaultShapeIndicator.tsx +5 -1
  111. package/src/lib/components/default-components/DefaultShapeWrapper.tsx +35 -0
  112. package/src/lib/config/TLUserPreferences.ts +8 -1
  113. package/src/lib/editor/Editor.test.ts +12 -11
  114. package/src/lib/editor/Editor.ts +178 -103
  115. package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +15 -14
  116. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +16 -15
  117. package/src/lib/editor/managers/FocusManager/FocusManager.test.ts +49 -48
  118. package/src/lib/editor/managers/FontManager/FontManager.test.ts +24 -23
  119. package/src/lib/editor/managers/HistoryManager/HistoryManager.test.ts +7 -6
  120. package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +12 -11
  121. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +57 -50
  122. package/src/lib/editor/managers/TextManager/TextManager.test.ts +51 -26
  123. package/src/lib/editor/managers/TickManager/TickManager.test.ts +14 -13
  124. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +34 -26
  125. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +6 -1
  126. package/src/lib/editor/shapes/ShapeUtil.ts +36 -0
  127. package/src/lib/editor/types/misc-types.ts +73 -1
  128. package/src/lib/exports/getSvgJsx.test.ts +868 -0
  129. package/src/lib/exports/getSvgJsx.tsx +78 -21
  130. package/src/lib/hooks/useCanvasEvents.ts +45 -38
  131. package/src/lib/hooks/useEditorComponents.tsx +7 -1
  132. package/src/lib/hooks/usePassThroughWheelEvents.ts +6 -1
  133. package/src/lib/hooks/useStateAttribute.ts +15 -0
  134. package/src/lib/license/LicenseManager.test.ts +3 -1
  135. package/src/lib/license/Watermark.test.tsx +2 -1
  136. package/src/lib/license/Watermark.tsx +6 -6
  137. package/src/lib/options.ts +8 -0
  138. package/src/lib/primitives/Box.test.ts +126 -0
  139. package/src/lib/primitives/Box.ts +10 -1
  140. package/src/lib/utils/EditorAtom.ts +37 -0
  141. package/src/lib/utils/sync/LocalIndexedDb.test.ts +2 -1
  142. package/src/lib/utils/sync/TLLocalSyncClient.test.ts +15 -15
  143. package/src/version.ts +3 -3
  144. package/dist-cjs/lib/utils/nearestMultiple.js.map +0 -7
  145. package/dist-esm/lib/utils/nearestMultiple.mjs +0 -14
  146. package/dist-esm/lib/utils/nearestMultiple.mjs.map +0 -7
  147. package/src/lib/utils/nearestMultiple.ts +0 -13
@@ -7,6 +7,7 @@ import { Editor as Editor_2 } from '@tiptap/core';
7
7
  import { EditorProviderProps as EditorProviderProps_2 } from '@tiptap/react';
8
8
  import EventEmitter from 'eventemitter3';
9
9
  import { ExoticComponent } from 'react';
10
+ import { ForwardRefExoticComponent } from 'react';
10
11
  import { HistoryEntry } from '@tldraw/store';
11
12
  import { IndexKey } from '@tldraw/utils';
12
13
  import { JsonObject } from '@tldraw/utils';
@@ -23,6 +24,7 @@ import { ReactElement } from 'react';
23
24
  import { ReactNode } from 'react';
24
25
  import { RecordProps } from '@tldraw/tlschema';
25
26
  import { RecordsDiff } from '@tldraw/store';
27
+ import { RefAttributes } from 'react';
26
28
  import { RefObject } from 'react';
27
29
  import { SerializedSchema } from '@tldraw/store';
28
30
  import { SerializedStore } from '@tldraw/store';
@@ -508,6 +510,7 @@ export declare class Box {
508
510
  static ExpandBy(A: Box, n: number): Box;
509
511
  static Collides(A: Box, B: Box): boolean;
510
512
  static Contains(A: Box, B: Box): boolean;
513
+ static ContainsApproximately(A: Box, B: Box, precision?: number): boolean;
511
514
  static Includes(A: Box, B: Box): boolean;
512
515
  static ContainsPoint(A: Box, B: VecLike, margin?: number): boolean;
513
516
  static Common(boxes: Box[]): Box;
@@ -817,6 +820,9 @@ export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicato
817
820
  /** @public @react */
818
821
  export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicatorsProps>;
819
822
 
823
+ /** @public @react */
824
+ export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
825
+
820
826
  /** @public @react */
821
827
  export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX_2.Element;
822
828
 
@@ -884,6 +890,9 @@ export declare const defaultTldrawOptions: {
884
890
  readonly nonce: undefined;
885
891
  readonly temporaryAssetPreviewLifetimeMs: 180000;
886
892
  readonly textShadowLod: 0.35;
893
+ readonly tooltipDelayMs: 700;
894
+ readonly uiCoarseDragDistanceSquared: 625;
895
+ readonly uiDragDistanceSquared: 16;
887
896
  };
888
897
 
889
898
  /** @public */
@@ -899,6 +908,7 @@ export declare const defaultUserPreferences: Readonly<{
899
908
  isWrapMode: false;
900
909
  locale: "ar" | "bn" | "ca" | "cs" | "da" | "de" | "el" | "en" | "es" | "fa" | "fi" | "fr" | "gl" | "gu-in" | "he" | "hi-in" | "hr" | "hu" | "id" | "it" | "ja" | "km-kh" | "kn" | "ko-kr" | "ml" | "mr" | "ms" | "ne" | "nl" | "no" | "pa" | "pl" | "pt-br" | "pt-pt" | "ro" | "ru" | "sl" | "so" | "sv" | "ta" | "te" | "th" | "tl" | "tr" | "uk" | "ur" | "vi" | "zh-cn" | "zh-tw";
901
910
  name: "";
911
+ showUiLabels: false;
902
912
  }>;
903
913
 
904
914
  /**
@@ -2685,15 +2695,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2685
2695
  *
2686
2696
  * @returns The shape at the given point, or undefined if there is no shape at the point.
2687
2697
  */
2688
- getShapeAtPoint(point: VecLike, opts?: {
2689
- filter?(shape: TLShape): boolean;
2690
- hitFrameInside?: boolean;
2691
- hitInside?: boolean;
2692
- hitLabels?: boolean;
2693
- hitLocked?: boolean;
2694
- margin?: number;
2695
- renderingOnly?: boolean;
2696
- }): TLShape | undefined;
2698
+ getShapeAtPoint(point: VecLike, opts?: TLGetShapeAtPointOptions): TLShape | undefined;
2697
2699
  /**
2698
2700
  * Get the shapes, if any, at a given page point.
2699
2701
  *
@@ -3707,6 +3709,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3707
3709
  height: number;
3708
3710
  width: number;
3709
3711
  }>;
3712
+ /**
3713
+ * Get an exported image of the given shapes as a data URL.
3714
+ *
3715
+ * @param shapes - The shapes (or shape ids) to export.
3716
+ * @param opts - Options for the export.
3717
+ *
3718
+ * @returns A data URL of the image.
3719
+ * @public
3720
+ */
3721
+ toImageDataUrl(shapes: TLShape[] | TLShapeId[], opts?: TLImageExportOptions): Promise<{
3722
+ height: number;
3723
+ url: string;
3724
+ width: number;
3725
+ }>;
3710
3726
  /**
3711
3727
  * The app's current input state.
3712
3728
  *
@@ -3793,6 +3809,21 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3793
3809
  * @public
3794
3810
  */
3795
3811
  complete(): this;
3812
+ /**
3813
+ * Dispatch a pointer move event in the current position of the pointer. This is useful when
3814
+ * external circumstances have changed (e.g. the camera moved or a shape was moved) and you want
3815
+ * the current interaction to respond to that change.
3816
+ *
3817
+ * @example
3818
+ * ```ts
3819
+ * editor.updatePointer()
3820
+ * ```
3821
+ *
3822
+ * @param options - The options for updating the pointer.
3823
+ * @returns The editor instance.
3824
+ * @public
3825
+ */
3826
+ updatePointer(options?: TLUpdatePointerOptions): this;
3796
3827
  /**
3797
3828
  * Puts the editor into focused mode.
3798
3829
  *
@@ -4016,6 +4047,26 @@ export declare class Editor extends EventEmitter<TLEventMap> {
4016
4047
  /* Excluded from this release type: maybeTrackPerformance */
4017
4048
  }
4018
4049
 
4050
+ /**
4051
+ * An Atom that is scoped to the lifetime of an Editor.
4052
+ *
4053
+ * This is useful for storing UI state for tldraw applications. Keeping state scoped to an editor
4054
+ * instead of stored in a global atom can prevent issues with state being shared between editors
4055
+ * when navigating between pages, or when multiple editor instances are used on the same page.
4056
+ *
4057
+ * @public
4058
+ */
4059
+ export declare class EditorAtom<T> {
4060
+ private name;
4061
+ private getInitialState;
4062
+ private states;
4063
+ constructor(name: string, getInitialState: (editor: Editor) => T);
4064
+ getAtom(editor: Editor): Atom<T>;
4065
+ get(editor: Editor): T;
4066
+ update(editor: Editor, update: (state: T) => T): T;
4067
+ set(editor: Editor, state: T): T;
4068
+ }
4069
+
4019
4070
  /** @public */
4020
4071
  export declare const EditorContext: React_3.Context<Editor | null>;
4021
4072
 
@@ -5199,6 +5250,25 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5199
5250
  */
5200
5251
  canBeLaidOut(_shape: Shape, _info: TLShapeUtilCanBeLaidOutOpts): boolean;
5201
5252
  /* Excluded from this release type: providesBackgroundForChildren */
5253
+ /**
5254
+ * Get the clip path to apply to this shape's children.
5255
+ *
5256
+ * @param shape - The shape to get the clip path for
5257
+ * @returns Array of points defining the clipping polygon in local coordinates, or undefined if no clipping
5258
+ * @public
5259
+ */
5260
+ getClipPath?(shape: Shape): undefined | Vec[];
5261
+ /**
5262
+ * Whether a specific child shape should be clipped by this shape.
5263
+ * Only called if getClipPath returns a valid polygon.
5264
+ *
5265
+ * If not defined, the default behavior is to clip all children.
5266
+ *
5267
+ * @param child - The child shape to check
5268
+ * @returns boolean indicating if this child should be clipped
5269
+ * @public
5270
+ */
5271
+ shouldClipChild?(child: TLShape): boolean;
5202
5272
  /**
5203
5273
  * Whether the shape should hide its resize handles when selected.
5204
5274
  *
@@ -5229,6 +5299,17 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5229
5299
  * @public
5230
5300
  */
5231
5301
  isAspectRatioLocked(_shape: Shape): boolean;
5302
+ /**
5303
+ * By default, the bounds of an image export are the bounds of all the shapes it contains, plus
5304
+ * some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
5305
+ * padding is skipped _if the bounds of that shape contains all the other shapes_. This is
5306
+ * useful in cases like annotating on top of an image, where you usually want to avoid extra
5307
+ * padding around the image if you don't need it.
5308
+ *
5309
+ * @param _shape - The shape to check
5310
+ * @returns True if this shape should be treated as an export bounds container
5311
+ */
5312
+ isExportBoundsContainer(_shape: Shape): boolean;
5232
5313
  /* Excluded from this release type: backgroundComponent */
5233
5314
  /**
5234
5315
  * Get the interpolated props for an animating shape. This is an optional method.
@@ -6388,6 +6469,8 @@ export declare interface TldrawOptions {
6388
6469
  readonly multiClickDurationMs: number;
6389
6470
  readonly coarseDragDistanceSquared: number;
6390
6471
  readonly dragDistanceSquared: number;
6472
+ readonly uiDragDistanceSquared: number;
6473
+ readonly uiCoarseDragDistanceSquared: number;
6391
6474
  readonly defaultSvgPadding: number;
6392
6475
  readonly cameraSlideFriction: number;
6393
6476
  readonly gridSteps: readonly {
@@ -6414,6 +6497,7 @@ export declare interface TldrawOptions {
6414
6497
  readonly flattenImageBoundsPadding: number;
6415
6498
  readonly laserDelayMs: number;
6416
6499
  readonly maxExportDelayMs: number;
6500
+ readonly tooltipDelayMs: number;
6417
6501
  /**
6418
6502
  * How long should previews created by {@link Editor.createTemporaryAssetPreview} last before
6419
6503
  * they expire? Defaults to 3 minutes.
@@ -6479,6 +6563,7 @@ export declare interface TLEditorComponents {
6479
6563
  SelectionForeground?: ComponentType<TLSelectionForegroundProps> | null;
6480
6564
  ShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
6481
6565
  ShapeIndicators?: ComponentType | null;
6566
+ ShapeWrapper?: ComponentType<TLShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
6482
6567
  SnapIndicator?: ComponentType<TLSnapIndicatorProps> | null;
6483
6568
  Spinner?: ComponentType<React.SVGProps<SVGSVGElement>> | null;
6484
6569
  SvgDefs?: ComponentType | null;
@@ -6814,6 +6899,59 @@ export declare interface TLGeometryOpts {
6814
6899
  context?: string;
6815
6900
  }
6816
6901
 
6902
+ /**
6903
+ * Options to {@link Editor.getShapeAtPoint}.
6904
+ *
6905
+ * @public
6906
+ */
6907
+ export declare interface TLGetShapeAtPointOptions {
6908
+ /**
6909
+ * The margin to apply to the shape.
6910
+ * If a number, it will be applied to both the inside and outside of the shape.
6911
+ * If an array, the first element will be applied to the inside of the shape, and the second element will be applied to the outside.
6912
+ *
6913
+ * @example
6914
+ * ```ts
6915
+ * // Get the shape at the center of the screen
6916
+ * const shape = editor.getShapeAtProps({
6917
+ * margin: 10,
6918
+ * })
6919
+ *
6920
+ * // Get the shape at the center of the screen with a 10px inner margin and a 5px outer margin
6921
+ * const shape = editor.getShapeAtProps({
6922
+ * margin: [10, 5],
6923
+ * })
6924
+ * ```
6925
+ */
6926
+ margin?: [number, number] | number;
6927
+ /**
6928
+ * Whether to register hits inside of shapes (beyond the margin), such as the inside of a solid shape.
6929
+ */
6930
+ hitInside?: boolean;
6931
+ /**
6932
+ * Whether to register hits on locked shapes.
6933
+ */
6934
+ hitLocked?: boolean;
6935
+ /**
6936
+ * Whether to register hits on labels.
6937
+ */
6938
+ hitLabels?: boolean;
6939
+ /**
6940
+ * Whether to only return hits on shapes that are currently being rendered.
6941
+ * todo: rename this to hitCulled or hitNotRendering
6942
+ */
6943
+ renderingOnly?: boolean;
6944
+ /**
6945
+ * Whether to register hits on the inside of frame shapes.
6946
+ * todo: rename this to hitInsideFrames
6947
+ */
6948
+ hitFrameInside?: boolean;
6949
+ /**
6950
+ * A filter function to apply to the shapes.
6951
+ */
6952
+ filter?(shape: TLShape): boolean;
6953
+ }
6954
+
6817
6955
  /** @public */
6818
6956
  export declare interface TLGridProps {
6819
6957
  x: number;
@@ -6826,6 +6964,7 @@ export declare interface TLGridProps {
6826
6964
  export declare interface TLHandleDragInfo<T extends TLShape> {
6827
6965
  handle: TLHandle;
6828
6966
  isPrecise: boolean;
6967
+ isCreatingShape: boolean;
6829
6968
  initial?: T | undefined;
6830
6969
  }
6831
6970
 
@@ -7352,6 +7491,16 @@ export declare interface TLShapeUtilConstructor<T extends TLUnknownShape, U exte
7352
7491
  migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
7353
7492
  }
7354
7493
 
7494
+ /** @public */
7495
+ export declare interface TLShapeWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
7496
+ /** The shape being rendered. */
7497
+ shape: TLShape;
7498
+ /** Whether this is the shapes regular, or background component. */
7499
+ isBackground: boolean;
7500
+ /** The shape's rendered component. */
7501
+ children: ReactNode;
7502
+ }
7503
+
7355
7504
  /** @public */
7356
7505
  export declare interface TLSnapIndicatorProps {
7357
7506
  className?: string;
@@ -7534,6 +7683,25 @@ export declare interface TLTldrawExternalContentSource {
7534
7683
  data: TLContent;
7535
7684
  }
7536
7685
 
7686
+ /** @public */
7687
+ export declare interface TLUpdatePointerOptions {
7688
+ /** Whether to update the pointer immediately, rather than on the next tick. */
7689
+ immediate?: boolean;
7690
+ /**
7691
+ * The point, in screen-space, to update the pointer to. Defaults to the position of the last
7692
+ * pointer event.
7693
+ */
7694
+ point?: VecLike;
7695
+ pointerId?: number;
7696
+ ctrlKey?: boolean;
7697
+ altKey?: boolean;
7698
+ shiftKey?: boolean;
7699
+ metaKey?: boolean;
7700
+ accelKey?: boolean;
7701
+ isPen?: boolean;
7702
+ button?: number;
7703
+ }
7704
+
7537
7705
  /** @public */
7538
7706
  export declare interface TLUrlExternalAsset {
7539
7707
  type: 'url';
@@ -7570,6 +7738,7 @@ export declare interface TLUserPreferences {
7570
7738
  isWrapMode?: boolean | null;
7571
7739
  isDynamicSizeMode?: boolean | null;
7572
7740
  isPasteAtCursorMode?: boolean | null;
7741
+ showUiLabels?: boolean | null;
7573
7742
  }
7574
7743
 
7575
7744
  /** @public */
@@ -7742,6 +7911,7 @@ export declare class UserPreferencesManager {
7742
7911
  isWrapMode: boolean;
7743
7912
  locale: string;
7744
7913
  name: string;
7914
+ showUiLabels: boolean;
7745
7915
  };
7746
7916
  getIsDarkMode(): boolean;
7747
7917
  /**
@@ -7758,6 +7928,7 @@ export declare class UserPreferencesManager {
7758
7928
  getIsWrapMode(): boolean;
7759
7929
  getIsDynamicResizeMode(): boolean;
7760
7930
  getIsPasteAtCursorMode(): boolean;
7931
+ getShowUiLabels(): boolean;
7761
7932
  }
7762
7933
 
7763
7934
  /** @public */
package/dist-cjs/index.js CHANGED
@@ -46,6 +46,7 @@ __export(index_exports, {
46
46
  DefaultSelectionForeground: () => import_DefaultSelectionForeground.DefaultSelectionForeground,
47
47
  DefaultShapeIndicator: () => import_DefaultShapeIndicator.DefaultShapeIndicator,
48
48
  DefaultShapeIndicators: () => import_DefaultShapeIndicators.DefaultShapeIndicators,
49
+ DefaultShapeWrapper: () => import_DefaultShapeWrapper.DefaultShapeWrapper,
49
50
  DefaultSnapIndicator: () => import_DefaultSnapIndictor.DefaultSnapIndicator,
50
51
  DefaultSpinner: () => import_DefaultSpinner.DefaultSpinner,
51
52
  DefaultSvgDefs: () => import_DefaultSvgDefs.DefaultSvgDefs,
@@ -54,6 +55,7 @@ __export(index_exports, {
54
55
  Edge2d: () => import_Edge2d.Edge2d,
55
56
  EdgeScrollManager: () => import_EdgeScrollManager.EdgeScrollManager,
56
57
  Editor: () => import_Editor.Editor,
58
+ EditorAtom: () => import_EditorAtom.EditorAtom,
57
59
  EditorContext: () => import_useEditor.EditorContext,
58
60
  EditorProvider: () => import_useEditor.EditorProvider,
59
61
  Ellipse2d: () => import_Ellipse2d.Ellipse2d,
@@ -256,6 +258,7 @@ var import_DefaultSelectionBackground = require("./lib/components/default-compon
256
258
  var import_DefaultSelectionForeground = require("./lib/components/default-components/DefaultSelectionForeground");
257
259
  var import_DefaultShapeIndicator = require("./lib/components/default-components/DefaultShapeIndicator");
258
260
  var import_DefaultShapeIndicators = require("./lib/components/default-components/DefaultShapeIndicators");
261
+ var import_DefaultShapeWrapper = require("./lib/components/default-components/DefaultShapeWrapper");
259
262
  var import_DefaultSnapIndictor = require("./lib/components/default-components/DefaultSnapIndictor");
260
263
  var import_DefaultSpinner = require("./lib/components/default-components/DefaultSpinner");
261
264
  var import_DefaultSvgDefs = require("./lib/components/default-components/DefaultSvgDefs");
@@ -346,6 +349,7 @@ var import_browserCanvasMaxSize = require("./lib/utils/browserCanvasMaxSize");
346
349
  var import_debug_flags = require("./lib/utils/debug-flags");
347
350
  var import_deepLinks = require("./lib/utils/deepLinks");
348
351
  var import_dom = require("./lib/utils/dom");
352
+ var import_EditorAtom = require("./lib/utils/EditorAtom");
349
353
  var import_getIncrementedName = require("./lib/utils/getIncrementedName");
350
354
  var import_getPointerInfo = require("./lib/utils/getPointerInfo");
351
355
  var import_getSvgPathFromPoints = require("./lib/utils/getSvgPathFromPoints");
@@ -367,7 +371,7 @@ function debugEnableLicensing() {
367
371
  }
368
372
  (0, import_utils.registerTldrawLibraryVersion)(
369
373
  "@tldraw/editor",
370
- "3.15.4",
374
+ "3.16.0-canary.016d4c2889b7",
371
375
  "cjs"
372
376
  );
373
377
  //# 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'\nimport 'core-js/stable/array/at.js'\nimport 'core-js/stable/array/flat-map.js'\nimport 'core-js/stable/array/flat.js'\nimport 'core-js/stable/string/at.js'\nimport 'core-js/stable/string/replace-all.js'\n\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line local/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\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 {\n\tScribbleManager,\n\ttype ScribbleItem,\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 {\n\tTextManager,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\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 TLGeometryOpts,\n\ttype TLHandleDragInfo,\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 TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLSvgOptions,\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 { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv } 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 TestEnvironment,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\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\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\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { hardResetEditor } from './lib/utils/hardResetEditor'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { refreshPage } from './lib/utils/refreshPage'\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 { runtime, setRuntimeOverrides } 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'\nexport { openWindow } from './lib/utils/window-open'\n\n/**\n * @deprecated Licensing is now enabled in the tldraw SDK.\n * @public */\nexport function debugEnableLicensing() {\n\t// noop\n\treturn\n}\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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yD;AACzD,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,IAAAC,gBAgCO;AACP,iBAAkC;AAClC,0BAYO;AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAMO;AACP,uBAKO;AACP,iBAOO;AACP,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,6BAAgC;AAChC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAA4B;AAC5B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAA6C;AAC7C,6BAIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AACrB,yBAA2B;AAKpB,SAAS,uBAAuB;AAEtC;AACD;AAAA,IAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nimport 'core-js/stable/array/at.js'\nimport 'core-js/stable/array/flat-map.js'\nimport 'core-js/stable/array/flat.js'\nimport 'core-js/stable/string/at.js'\nimport 'core-js/stable/string/replace-all.js'\n\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line local/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 {\n\tScribbleManager,\n\ttype ScribbleItem,\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 {\n\tTextManager,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\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 TLGeometryOpts,\n\ttype TLHandleDragInfo,\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 TLSvgOptions,\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 { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv } 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 TestEnvironment,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\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\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\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\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 { hardResetEditor } from './lib/utils/hardResetEditor'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { refreshPage } from './lib/utils/refreshPage'\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 { runtime, setRuntimeOverrides } 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'\nexport { openWindow } from './lib/utils/window-open'\n\n/**\n * @deprecated Licensing is now enabled in the tldraw SDK.\n * @public */\nexport function debugEnableLicensing() {\n\t// noop\n\treturn\n}\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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C/B,yBAA4B;AAC5B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAA6C;AAC7C,6BAIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AACrB,yBAA2B;AAKpB,SAAS,uBAAuB;AAEtC;AACD;AAAA,IAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": ["import_at", "import_utils"]
7
7
  }
@@ -44,8 +44,8 @@ var import_utils = require("@tldraw/utils");
44
44
  var import_react = __toESM(require("react"));
45
45
  var import_classnames = __toESM(require("classnames"));
46
46
  var import_version = require("../version");
47
- var import_ErrorBoundary = require("./components/ErrorBoundary");
48
47
  var import_DefaultErrorFallback = require("./components/default-components/DefaultErrorFallback");
48
+ var import_ErrorBoundary = require("./components/ErrorBoundary");
49
49
  var import_createTLUser = require("./config/createTLUser");
50
50
  var import_Editor = require("./editor/Editor");
51
51
  var import_useContainer = require("./hooks/useContainer");
@@ -58,6 +58,7 @@ var import_useForceUpdate = require("./hooks/useForceUpdate");
58
58
  var import_useIdentity = require("./hooks/useIdentity");
59
59
  var import_useLocalStore = require("./hooks/useLocalStore");
60
60
  var import_useRefState = require("./hooks/useRefState");
61
+ var import_useStateAttribute = require("./hooks/useStateAttribute");
61
62
  var import_useZoomCss = require("./hooks/useZoomCss");
62
63
  var import_LicenseProvider = require("./license/LicenseProvider");
63
64
  var import_Watermark = require("./license/Watermark");
@@ -320,8 +321,12 @@ function TldrawEditorWithReadyStore({
320
321
  if (editor !== fontLoadingState?.editor) {
321
322
  fontLoadingState = null;
322
323
  }
323
- (0, import_react.useEffect)(() => {
324
+ (0, import_react.useLayoutEffect)(() => {
324
325
  if (!editor) return;
326
+ if (editor.options.maxFontsToLoadBeforeRender === 0) {
327
+ setFontLoadingState({ editor, isLoaded: true });
328
+ return;
329
+ }
325
330
  let isCancelled = false;
326
331
  setFontLoadingState({ editor, isLoaded: false });
327
332
  editor.fonts.loadRequiredFontsForCurrentPage(editor.options.maxFontsToLoadBeforeRender).finally(() => {
@@ -364,6 +369,7 @@ function Layout({ children, onMount }) {
364
369
  (0, import_useCursor.useCursor)();
365
370
  (0, import_useDarkMode.useDarkMode)();
366
371
  (0, import_useForceUpdate.useForceUpdate)();
372
+ (0, import_useStateAttribute.useStateAttribute)();
367
373
  useOnMount((editor) => {
368
374
  const teardownStore = editor.store.props.onMount(editor);
369
375
  const teardownCallback = onMount?.(editor);