@tldraw/editor 3.9.0-internal.7f0e15f4f7d9 → 3.10.0-canary.d4dfa96478a4

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 (138) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/index.d.ts +41 -229
  4. package/dist-cjs/index.js +1 -9
  5. package/dist-cjs/index.js.map +2 -2
  6. package/dist-cjs/lib/TldrawEditor.js +6 -33
  7. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  8. package/dist-cjs/lib/components/LiveCollaborators.js +5 -0
  9. package/dist-cjs/lib/components/LiveCollaborators.js.map +2 -2
  10. package/dist-cjs/lib/components/Shape.js +0 -7
  11. package/dist-cjs/lib/components/Shape.js.map +2 -2
  12. package/dist-cjs/lib/components/default-components/DefaultBrush.js.map +2 -2
  13. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +2 -2
  14. package/dist-cjs/lib/components/default-components/DefaultCursor.js.map +2 -2
  15. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +1 -1
  16. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
  17. package/dist-cjs/lib/components/default-components/DefaultScribble.js.map +2 -2
  18. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
  19. package/dist-cjs/lib/editor/Editor.js +435 -308
  20. package/dist-cjs/lib/editor/Editor.js.map +3 -3
  21. package/dist-cjs/lib/editor/managers/TextManager.js +17 -23
  22. package/dist-cjs/lib/editor/managers/TextManager.js.map +2 -2
  23. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +7 -13
  24. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  25. package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
  26. package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
  27. package/dist-cjs/lib/exports/FontEmbedder.js +2 -7
  28. package/dist-cjs/lib/exports/FontEmbedder.js.map +2 -2
  29. package/dist-cjs/lib/exports/StyleEmbedder.js +1 -1
  30. package/dist-cjs/lib/exports/StyleEmbedder.js.map +2 -2
  31. package/dist-cjs/lib/exports/exportToSvg.js +2 -3
  32. package/dist-cjs/lib/exports/exportToSvg.js.map +2 -2
  33. package/dist-cjs/lib/exports/getSvgJsx.js +1 -18
  34. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  35. package/dist-cjs/lib/exports/parseCss.js +0 -1
  36. package/dist-cjs/lib/exports/parseCss.js.map +2 -2
  37. package/dist-cjs/lib/hooks/useCanvasEvents.js +2 -2
  38. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  39. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js +1 -1
  40. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
  41. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  42. package/dist-cjs/lib/options.js +1 -2
  43. package/dist-cjs/lib/options.js.map +2 -2
  44. package/dist-cjs/lib/utils/dom.js +1 -1
  45. package/dist-cjs/lib/utils/dom.js.map +2 -2
  46. package/dist-cjs/version.js +3 -3
  47. package/dist-cjs/version.js.map +1 -1
  48. package/dist-esm/index.d.mts +41 -229
  49. package/dist-esm/index.mjs +1 -13
  50. package/dist-esm/index.mjs.map +2 -2
  51. package/dist-esm/lib/TldrawEditor.mjs +7 -34
  52. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  53. package/dist-esm/lib/components/LiveCollaborators.mjs +5 -0
  54. package/dist-esm/lib/components/LiveCollaborators.mjs.map +2 -2
  55. package/dist-esm/lib/components/Shape.mjs +1 -8
  56. package/dist-esm/lib/components/Shape.mjs.map +2 -2
  57. package/dist-esm/lib/components/default-components/DefaultBrush.mjs.map +2 -2
  58. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +2 -2
  59. package/dist-esm/lib/components/default-components/DefaultCursor.mjs.map +2 -2
  60. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +1 -1
  61. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
  62. package/dist-esm/lib/components/default-components/DefaultScribble.mjs.map +2 -2
  63. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
  64. package/dist-esm/lib/editor/Editor.mjs +432 -312
  65. package/dist-esm/lib/editor/Editor.mjs.map +3 -3
  66. package/dist-esm/lib/editor/managers/TextManager.mjs +17 -23
  67. package/dist-esm/lib/editor/managers/TextManager.mjs.map +2 -2
  68. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +7 -13
  69. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  70. package/dist-esm/lib/exports/FontEmbedder.mjs +2 -7
  71. package/dist-esm/lib/exports/FontEmbedder.mjs.map +2 -2
  72. package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -1
  73. package/dist-esm/lib/exports/StyleEmbedder.mjs.map +2 -2
  74. package/dist-esm/lib/exports/exportToSvg.mjs +2 -3
  75. package/dist-esm/lib/exports/exportToSvg.mjs.map +2 -2
  76. package/dist-esm/lib/exports/getSvgJsx.mjs +2 -19
  77. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  78. package/dist-esm/lib/exports/parseCss.mjs +0 -1
  79. package/dist-esm/lib/exports/parseCss.mjs.map +2 -2
  80. package/dist-esm/lib/hooks/useCanvasEvents.mjs +2 -2
  81. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  82. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs +1 -1
  83. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
  84. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  85. package/dist-esm/lib/options.mjs +1 -2
  86. package/dist-esm/lib/options.mjs.map +2 -2
  87. package/dist-esm/lib/utils/dom.mjs +1 -1
  88. package/dist-esm/lib/utils/dom.mjs.map +2 -2
  89. package/dist-esm/version.mjs +3 -3
  90. package/dist-esm/version.mjs.map +1 -1
  91. package/editor.css +13 -127
  92. package/package.json +7 -10
  93. package/src/index.ts +2 -15
  94. package/src/lib/TldrawEditor.tsx +4 -52
  95. package/src/lib/components/LiveCollaborators.tsx +5 -0
  96. package/src/lib/components/Shape.tsx +1 -9
  97. package/src/lib/components/default-components/DefaultBrush.tsx +1 -0
  98. package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +1 -0
  99. package/src/lib/components/default-components/DefaultCursor.tsx +1 -0
  100. package/src/lib/components/default-components/DefaultErrorFallback.tsx +5 -3
  101. package/src/lib/components/default-components/DefaultScribble.tsx +1 -0
  102. package/src/lib/components/default-components/DefaultShapeIndicator.tsx +1 -0
  103. package/src/lib/editor/Editor.ts +561 -362
  104. package/src/lib/editor/managers/TextManager.ts +17 -42
  105. package/src/lib/editor/shapes/ShapeUtil.ts +32 -18
  106. package/src/lib/editor/types/emit-types.ts +0 -1
  107. package/src/lib/editor/types/external-content.ts +0 -1
  108. package/src/lib/exports/FontEmbedder.ts +1 -13
  109. package/src/lib/exports/StyleEmbedder.ts +1 -1
  110. package/src/lib/exports/exportToSvg.tsx +3 -4
  111. package/src/lib/exports/getSvgJsx.tsx +3 -22
  112. package/src/lib/exports/parseCss.ts +0 -1
  113. package/src/lib/hooks/useCanvasEvents.ts +1 -2
  114. package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +0 -1
  115. package/src/lib/hooks/usePassThroughWheelEvents.ts +1 -0
  116. package/src/lib/options.ts +0 -7
  117. package/src/lib/utils/dom.ts +1 -1
  118. package/src/version.ts +3 -3
  119. package/dist-cjs/lib/editor/managers/FontManager.js +0 -167
  120. package/dist-cjs/lib/editor/managers/FontManager.js.map +0 -7
  121. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js +0 -48
  122. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +0 -7
  123. package/dist-cjs/lib/hooks/useViewportHeight.js +0 -56
  124. package/dist-cjs/lib/hooks/useViewportHeight.js.map +0 -7
  125. package/dist-cjs/lib/utils/richText.js +0 -46
  126. package/dist-cjs/lib/utils/richText.js.map +0 -7
  127. package/dist-esm/lib/editor/managers/FontManager.mjs +0 -153
  128. package/dist-esm/lib/editor/managers/FontManager.mjs.map +0 -7
  129. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs +0 -28
  130. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +0 -7
  131. package/dist-esm/lib/hooks/useViewportHeight.mjs +0 -36
  132. package/dist-esm/lib/hooks/useViewportHeight.mjs.map +0 -7
  133. package/dist-esm/lib/utils/richText.mjs +0 -26
  134. package/dist-esm/lib/utils/richText.mjs.map +0 -7
  135. package/src/lib/editor/managers/FontManager.ts +0 -252
  136. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +0 -29
  137. package/src/lib/hooks/useViewportHeight.ts +0 -37
  138. package/src/lib/utils/richText.ts +0 -72
@@ -7,8 +7,6 @@ import { ComponentType } from 'react';
7
7
  import { Computed } from '@tldraw/state';
8
8
  import { computed } from '@tldraw/state';
9
9
  import { Dispatch } from 'react';
10
- import { Editor as Editor_2 } from '@tiptap/core';
11
- import { EditorProviderProps } from '@tiptap/react';
12
10
  import { EffectScheduler } from '@tldraw/state';
13
11
  import { EMPTY_ARRAY } from '@tldraw/state';
14
12
  import EventEmitter from 'eventemitter3';
@@ -20,7 +18,6 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
20
18
  import { LegacyMigrations } from '@tldraw/store';
21
19
  import { MigrationSequence } from '@tldraw/store';
22
20
  import { NamedExoticComponent } from 'react';
23
- import { Node as Node_2 } from '@tiptap/pm/model';
24
21
  import { PerformanceTracker } from '@tldraw/utils';
25
22
  import { PointerEventHandler } from 'react';
26
23
  import { react } from '@tldraw/state';
@@ -69,7 +66,6 @@ import { TLPageId } from '@tldraw/tlschema';
69
66
  import { TLParentId } from '@tldraw/tlschema';
70
67
  import { TLPropsMigrations } from '@tldraw/tlschema';
71
68
  import { TLRecord } from '@tldraw/tlschema';
72
- import { TLRichText } from '@tldraw/tlschema';
73
69
  import { TLScribble } from '@tldraw/tlschema';
74
70
  import { TLShape } from '@tldraw/tlschema';
75
71
  import { TLShapeCrop } from '@tldraw/tlschema';
@@ -888,7 +884,6 @@ export declare const defaultTldrawOptions: {
888
884
  readonly longPressDurationMs: 500;
889
885
  readonly maxExportDelayMs: 5000;
890
886
  readonly maxFilesAtOnce: 100;
891
- readonly maxFontsToLoadBeforeRender: number;
892
887
  readonly maxPages: 40;
893
888
  readonly maxShapesPerPage: 4000;
894
889
  readonly multiClickDurationMs: 200;
@@ -984,7 +979,7 @@ export declare class EdgeScrollManager {
984
979
 
985
980
  /** @public */
986
981
  export declare class Editor extends EventEmitter<TLEventMap> {
987
- constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, textOptions, initialState, autoFocus, inferDarkMode, options, isShapeHidden, fontAssetUrls, }: TLEditorOptions);
982
+ constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, initialState, autoFocus, inferDarkMode, options, isShapeHidden, }: TLEditorOptions);
988
983
  private readonly _isShapeHiddenPredicate?;
989
984
  private getIsShapeHiddenCache;
990
985
  isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
@@ -1045,12 +1040,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1045
1040
  * @public
1046
1041
  */
1047
1042
  readonly textMeasure: TextManager;
1048
- /**
1049
- * A utility for managing the set of fonts that should be rendered in the document.
1050
- *
1051
- * @public
1052
- */
1053
- readonly fonts: FontManager;
1054
1043
  /**
1055
1044
  * A manager for the editor's environment.
1056
1045
  *
@@ -1690,26 +1679,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1690
1679
  * @public
1691
1680
  */
1692
1681
  setEditingShape(shape: null | TLShape | TLShapeId): this;
1693
- private _currentRichTextEditor;
1694
- /**
1695
- * The current editing shape's text editor.
1696
- *
1697
- * @public
1698
- */
1699
- getRichTextEditor(): null | TiptapEditor;
1700
- /**
1701
- * Set the current editing shape's rich text editor.
1702
- *
1703
- * @example
1704
- * ```ts
1705
- * editor.setRichTextEditor(richTextEditorView)
1706
- * ```
1707
- *
1708
- * @param textEditor - The text editor to set as the current editing shape's text editor.
1709
- *
1710
- * @public
1711
- */
1712
- setRichTextEditor(textEditor: null | TiptapEditor): this;
1713
1682
  /**
1714
1683
  * The current hovered shape id.
1715
1684
  *
@@ -1810,17 +1779,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1810
1779
  * @public
1811
1780
  */
1812
1781
  setCroppingShape(shape: null | TLShape | TLShapeId): this;
1813
- private _textOptions;
1814
- /**
1815
- * Get the current text options.
1816
- *
1817
- * @example
1818
- * ```ts
1819
- * editor.getTextOptions()
1820
- * ```
1821
- *
1822
- * @public */
1823
- getTextOptions(): TLTextOptions;
1824
1782
  /* Excluded from this release type: _unsafe_getCameraId */
1825
1783
  /**
1826
1784
  * The current camera.
@@ -2418,7 +2376,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2418
2376
  meta?: JsonObject;
2419
2377
  src: string;
2420
2378
  }>;
2421
- private _getShapeGeometryCache;
2379
+ private _shapeGeometryCaches;
2422
2380
  /**
2423
2381
  * Get the geometry of a shape.
2424
2382
  *
@@ -2426,13 +2384,15 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2426
2384
  * ```ts
2427
2385
  * editor.getShapeGeometry(myShape)
2428
2386
  * editor.getShapeGeometry(myShapeId)
2387
+ * editor.getShapeGeometry(myShapeId, { context: "arrow" })
2429
2388
  * ```
2430
2389
  *
2431
2390
  * @param shape - The shape (or shape id) to get the geometry for.
2391
+ * @param opts - Additional options about the request for geometry. Passed to {@link ShapeUtil.getGeometry}.
2432
2392
  *
2433
2393
  * @public
2434
2394
  */
2435
- getShapeGeometry<T extends Geometry2d>(shape: TLShape | TLShapeId): T;
2395
+ getShapeGeometry<T extends Geometry2d>(shape: TLShape | TLShapeId, opts?: TLGeometryOpts): T;
2436
2396
  /* Excluded from this release type: _getShapeHandlesCache */
2437
2397
  /**
2438
2398
  * Get the handles (if any) for a shape.
@@ -3100,6 +3060,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3100
3060
  * @public
3101
3061
  */
3102
3062
  bringToFront(shapes: TLShape[] | TLShapeId[]): this;
3063
+ /* Excluded from this release type: collectShapesViaArrowBindings */
3103
3064
  /**
3104
3065
  * Flip shape positions.
3105
3066
  *
@@ -3225,7 +3186,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3225
3186
  * @example
3226
3187
  * ```ts
3227
3188
  * editor.createShape(myShape)
3228
- * editor.createShape({ id: 'box1', type: 'text', props: { richText: toRichText("ok") } })
3189
+ * editor.createShape({ id: 'box1', type: 'text', props: { text: "ok" } })
3229
3190
  * ```
3230
3191
  *
3231
3192
  * @param shape - The shape (or shape partial) to create.
@@ -3239,7 +3200,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3239
3200
  * @example
3240
3201
  * ```ts
3241
3202
  * editor.createShapes([myShape])
3242
- * editor.createShapes([{ id: 'box1', type: 'text', props: { richText: toRichText("ok") } }])
3203
+ * editor.createShapes([{ id: 'box1', type: 'text', props: { text: "ok" } }])
3243
3204
  * ```
3244
3205
  *
3245
3206
  * @param shapes - The shapes (or shape partials) to create.
@@ -3998,27 +3959,6 @@ export declare const EVENT_NAME_MAP: Record<Exclude<TLEventName, TLPinchEventNam
3998
3959
 
3999
3960
  /* Excluded from this release type: featureFlags */
4000
3961
 
4001
- /** @public */
4002
- export declare class FontManager {
4003
- private readonly editor;
4004
- private readonly assetUrls?;
4005
- constructor(editor: Editor, assetUrls?: {
4006
- [key: string]: string | undefined;
4007
- } | undefined);
4008
- private readonly shapeFontFacesCache;
4009
- private readonly shapeFontLoadStateCache;
4010
- getShapeFontFaces(shape: TLShape | TLShapeId): TLFontFace[];
4011
- trackFontsForShape(shape: TLShape | TLShapeId): void;
4012
- loadRequiredFontsForCurrentPage(limit?: number): Promise<void>;
4013
- private readonly fontStates;
4014
- private getFontState;
4015
- ensureFontIsLoaded(font: TLFontFace): Promise<void>;
4016
- private fontsToLoad;
4017
- requestFonts(fonts: TLFontFace[]): void;
4018
- private findOrCreateFontFace;
4019
- toEmbeddedCssDeclaration(font: TLFontFace): Promise<string>;
4020
- }
4021
-
4022
3962
  /** @public */
4023
3963
  export declare interface GapsSnapIndicator {
4024
3964
  id: string;
@@ -4091,9 +4031,6 @@ export declare function getCursor(cursor: TLCursorType, rotation?: number, color
4091
4031
  /** @public */
4092
4032
  export declare function getDefaultCdnBaseUrl(): string;
4093
4033
 
4094
- /** @public */
4095
- export declare function getFontsFromRichText(editor: Editor, richText: TLRichText, initialState: RichTextFontVisitorState): TLFontFace[];
4096
-
4097
4034
  /** @public */
4098
4035
  export declare function getFreshUserPreferences(): TLUserPreferences;
4099
4036
 
@@ -4778,16 +4715,6 @@ export declare function resizeScaled(shape: TLBaseShape<any, {
4778
4715
  y: number;
4779
4716
  };
4780
4717
 
4781
- /** @public */
4782
- export declare type RichTextFontVisitor = (node: TiptapNode, state: RichTextFontVisitorState, addFont: (font: TLFontFace) => void) => RichTextFontVisitorState;
4783
-
4784
- /** @public */
4785
- export declare interface RichTextFontVisitorState {
4786
- readonly family: string;
4787
- readonly weight: string;
4788
- readonly style: string;
4789
- }
4790
-
4791
4718
  /** @public */
4792
4719
  export declare const ROTATE_CORNER_TO_SELECTION_CORNER: {
4793
4720
  readonly bottom_left_rotate: "bottom_left";
@@ -4952,9 +4879,10 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
4952
4879
  * Get the shape's geometry.
4953
4880
  *
4954
4881
  * @param shape - The shape.
4882
+ * @param opts - Additional options for the request.
4955
4883
  * @public
4956
4884
  */
4957
- abstract getGeometry(shape: Shape): Geometry2d;
4885
+ abstract getGeometry(shape: Shape, opts?: TLGeometryOpts): Geometry2d;
4958
4886
  /**
4959
4887
  * Get a JSX element for the shape (as an HTML element).
4960
4888
  *
@@ -4969,17 +4897,10 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
4969
4897
  * @public
4970
4898
  */
4971
4899
  abstract indicator(shape: Shape): any;
4972
- /**
4973
- * Get the font faces that should be rendered in the document in order for this shape to render
4974
- * correctly.
4975
- *
4976
- * @param shape - The shape.
4977
- * @public
4978
- */
4979
- getFontFaces(shape: Shape): TLFontFace[];
4980
4900
  /**
4981
4901
  * Whether the shape can be snapped to by another shape.
4982
4902
  *
4903
+ * @param shape - The shape.
4983
4904
  * @public
4984
4905
  */
4985
4906
  canSnap(_shape: Shape): boolean;
@@ -4994,7 +4915,7 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
4994
4915
  *
4995
4916
  * @public
4996
4917
  */
4997
- canBind(_opts: TLShapeUtilCanBindOpts<Shape>): boolean;
4918
+ canBind(_opts: TLShapeUtilCanBindOpts): boolean;
4998
4919
  /**
4999
4920
  * Whether the shape can be double clicked to edit.
5000
4921
  *
@@ -5020,11 +4941,15 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5020
4941
  */
5021
4942
  canCrop(_shape: Shape): boolean;
5022
4943
  /**
5023
- * Whether the shape participates in stacking, aligning, and distributing.
4944
+ * Whether the shape can participate in layout functions such as alignment or distribution.
4945
+ *
4946
+ * @param shape - The shape.
4947
+ * @param info - Additional context information: the type of action causing the layout and the
4948
+ * @public
5024
4949
  *
5025
4950
  * @public
5026
4951
  */
5027
- canBeLaidOut(_shape: Shape): boolean;
4952
+ canBeLaidOut(_shape: Shape, _info: TLShapeUtilCanBeLaidOutOpts): boolean;
5028
4953
  /* Excluded from this release type: providesBackgroundForChildren */
5029
4954
  /**
5030
4955
  * Whether the shape should hide its resize handles when selected.
@@ -5629,24 +5554,6 @@ export declare class TextManager {
5629
5554
  }): BoxModel & {
5630
5555
  scrollWidth: number;
5631
5556
  };
5632
- measureHtml(html: string, opts: {
5633
- /**
5634
- * When maxWidth is a number, the text will be wrapped to that maxWidth. When maxWidth
5635
- * is null, the text will be measured without wrapping, but explicit line breaks and
5636
- * space are preserved.
5637
- */
5638
- maxWidth: null | number;
5639
- disableOverflowWrapBreaking?: boolean;
5640
- fontFamily: string;
5641
- fontSize: number;
5642
- fontStyle: string;
5643
- fontWeight: string;
5644
- lineHeight: number;
5645
- minWidth?: null | number;
5646
- padding: string;
5647
- }): BoxModel & {
5648
- scrollWidth: number;
5649
- };
5650
5557
  /**
5651
5558
  * Given an html element, measure the position of each span of unbroken
5652
5559
  * word/white-space characters within any text nodes it contains.
@@ -5674,19 +5581,6 @@ export declare class TextManager {
5674
5581
  }[];
5675
5582
  }
5676
5583
 
5677
- /**
5678
- * This is the TipTap editor! Docs are {@link https://tiptap.dev/docs}.
5679
- *
5680
- * @public
5681
- */
5682
- export declare type TiptapEditor = Editor_2;
5683
-
5684
- /**
5685
- * A TipTap node. See {@link https://tiptap.dev/docs}.
5686
- * @public
5687
- */
5688
- export declare type TiptapNode = Node_2;
5689
-
5690
5584
  /** @public */
5691
5585
  export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
5692
5586
 
@@ -5727,6 +5621,7 @@ export declare interface TLBindingUtilConstructor<T extends TLUnknownBinding, U
5727
5621
 
5728
5622
  /** @public */
5729
5623
  export declare interface TLBrushProps {
5624
+ userId?: string;
5730
5625
  brush: BoxModel;
5731
5626
  color?: string;
5732
5627
  opacity?: number;
@@ -5854,6 +5749,7 @@ export declare type TLClickState = 'idle' | 'overflow' | 'pendingDouble' | 'pend
5854
5749
 
5855
5750
  /** @public */
5856
5751
  export declare interface TLCollaboratorHintProps {
5752
+ userId: string;
5857
5753
  className?: string;
5858
5754
  point: VecModel;
5859
5755
  viewport: Box;
@@ -5900,6 +5796,7 @@ export declare interface TLCropInfo<T extends TLShape> {
5900
5796
 
5901
5797
  /** @public */
5902
5798
  export declare interface TLCursorProps {
5799
+ userId: string;
5903
5800
  className?: string;
5904
5801
  point: null | VecModel;
5905
5802
  zoom: number;
@@ -6010,10 +5907,6 @@ export declare interface TldrawEditorBaseProps {
6010
5907
  * Camera options for the editor.
6011
5908
  */
6012
5909
  cameraOptions?: Partial<TLCameraOptions>;
6013
- /**
6014
- * Text options for the editor.
6015
- */
6016
- textOptions?: TLTextOptions;
6017
5910
  /**
6018
5911
  * Options for the editor.
6019
5912
  */
@@ -6034,14 +5927,6 @@ export declare interface TldrawEditorBaseProps {
6034
5927
  * remain in the store and participate in all other operations.
6035
5928
  */
6036
5929
  isShapeHidden?(shape: TLShape, editor: Editor): boolean;
6037
- /**
6038
- * The URLs for the fonts to use in the editor.
6039
- */
6040
- assetUrls?: {
6041
- fonts?: {
6042
- [key: string]: string | undefined;
6043
- };
6044
- };
6045
5930
  }
6046
5931
 
6047
5932
  /**
@@ -6165,12 +6050,6 @@ export declare interface TldrawOptions {
6165
6050
  * By default, the toolbar items are accessible via number shortcuts according to their order. To disable this, set this option to false.
6166
6051
  */
6167
6052
  readonly enableToolbarKeyboardShortcuts: boolean;
6168
- /**
6169
- * The maximum number of fonts that will be loaded while blocking the main rendering of the
6170
- * canvas. If there are more than this number of fonts needed, we'll just show the canvas right
6171
- * away and let the fonts load in in the background.
6172
- */
6173
- readonly maxFontsToLoadBeforeRender: number;
6174
6053
  }
6175
6054
 
6176
6055
  /** @public */
@@ -6248,12 +6127,8 @@ export declare interface TLEditorOptions {
6248
6127
  * Options for the editor's camera.
6249
6128
  */
6250
6129
  cameraOptions?: Partial<TLCameraOptions>;
6251
- textOptions?: TLTextOptions;
6252
6130
  options?: Partial<TldrawOptions>;
6253
6131
  licenseKey?: string;
6254
- fontAssetUrls?: {
6255
- [key: string]: string | undefined;
6256
- };
6257
6132
  /**
6258
6133
  * A predicate that should return true if the given shape should be hidden.
6259
6134
  * @param shape - The shape to check.
@@ -6368,13 +6243,6 @@ export declare interface TLEventMap {
6368
6243
  'select-all-text': [{
6369
6244
  shapeId: TLShapeId;
6370
6245
  }];
6371
- 'place-caret': [{
6372
- point: {
6373
- x: number;
6374
- y: number;
6375
- };
6376
- shapeId: TLShapeId;
6377
- }];
6378
6246
  }
6379
6247
 
6380
6248
  /** @public */
@@ -6424,70 +6292,13 @@ export declare interface TLFilesExternalContent extends TLBaseExternalContent {
6424
6292
  ignoreParent: boolean;
6425
6293
  }
6426
6294
 
6427
- /**
6428
- * A font face that can be used in the editor. The properties of this are largely the same as the
6429
- * ones in the
6430
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face | css `@font-face` rule}.
6431
- * @public
6432
- */
6433
- export declare interface TLFontFace {
6434
- /**
6435
- * How this font can be referred to in CSS.
6436
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-family | `font-family`}.
6437
- */
6438
- readonly family: string;
6439
- /**
6440
- * The source of the font. This
6441
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src | `src`}.
6442
- */
6443
- readonly src: TLFontFaceSource;
6444
- /**
6445
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/ascent-override | `ascent-override`}.
6446
- */
6447
- readonly ascentOverride?: string;
6448
- /**
6449
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/descent-override | `descent-override`}.
6450
- */
6451
- readonly descentOverride?: string;
6452
- /**
6453
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-stretch | `font-stretch`}.
6454
- */
6455
- readonly stretch?: string;
6456
- /**
6457
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style | `font-style`}.
6458
- */
6459
- readonly style?: string;
6460
- /**
6461
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight | `font-weight`}.
6462
- */
6463
- readonly weight?: string;
6464
- /**
6465
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-feature-settings | `font-feature-settings`}.
6466
- */
6467
- readonly featureSettings?: string;
6468
- /**
6469
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/line-gap-override | `line-gap-override`}.
6470
- */
6471
- readonly lineGapOverride?: string;
6472
- /**
6473
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range | `unicode-range`}.
6474
- */
6475
- readonly unicodeRange?: string;
6476
- }
6477
-
6478
- /**
6479
- * Represents the `src` property of a {@link TLFontFace}.
6480
- * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src | `src`} for details of the properties here.
6295
+ /** Additional options for the {@link ShapeUtil.getGeometry} method.
6296
+ *
6481
6297
  * @public
6482
6298
  */
6483
- export declare interface TLFontFaceSource {
6484
- /**
6485
- * A URL from which to load the font. If the value here is a key in
6486
- * {@link tldraw#TLEditorAssetUrls.fonts}, the value from there will be used instead.
6487
- */
6488
- url: string;
6489
- format?: string;
6490
- tech?: string;
6299
+ export declare interface TLGeometryOpts {
6300
+ /** The context in which the geometry is being requested. */
6301
+ context?: string;
6491
6302
  }
6492
6303
 
6493
6304
  /** @public */
@@ -6888,6 +6699,7 @@ export declare type TLResizeShapeOptions = Partial<{
6888
6699
 
6889
6700
  /** @public */
6890
6701
  export declare interface TLScribbleProps {
6702
+ userId?: string;
6891
6703
  scribble: TLScribble;
6892
6704
  zoom: number;
6893
6705
  color?: string;
@@ -6947,6 +6759,7 @@ export declare type TLShapeIndicatorErrorFallbackComponent = ComponentType<{
6947
6759
 
6948
6760
  /** @public */
6949
6761
  export declare interface TLShapeIndicatorProps {
6762
+ userId?: string;
6950
6763
  shapeId: TLShapeId;
6951
6764
  color?: string | undefined;
6952
6765
  opacity?: number;
@@ -6954,13 +6767,25 @@ export declare interface TLShapeIndicatorProps {
6954
6767
  hidden?: boolean;
6955
6768
  }
6956
6769
 
6770
+ /**
6771
+ * Options passed to {@link ShapeUtil.canBeLaidOut}.
6772
+ *
6773
+ * @public
6774
+ */
6775
+ export declare interface TLShapeUtilCanBeLaidOutOpts {
6776
+ /** The type of action causing the layout. */
6777
+ type?: 'align' | 'distribute' | 'flip' | 'pack' | 'stack' | 'stretch';
6778
+ /** The other shapes being laid out */
6779
+ shapes?: TLShape[];
6780
+ }
6781
+
6957
6782
  /**
6958
6783
  * Options passed to {@link ShapeUtil.canBind}. A binding that could be made. At least one of
6959
6784
  * `fromShapeType` or `toShapeType` will belong to this shape util.
6960
6785
  *
6961
6786
  * @public
6962
6787
  */
6963
- export declare interface TLShapeUtilCanBindOpts<Shape extends TLUnknownShape = TLShape> {
6788
+ export declare interface TLShapeUtilCanBindOpts<Shape extends TLUnknownShape = TLUnknownShape> {
6964
6789
  /** The type of shape referenced by the `fromId` of the binding. */
6965
6790
  fromShapeType: string;
6966
6791
  /** The type of shape referenced by the `toId` of the binding. */
@@ -7119,7 +6944,6 @@ export declare interface TLSvgTextExternalContent extends TLBaseExternalContent
7119
6944
  export declare interface TLTextExternalContent extends TLBaseExternalContent {
7120
6945
  type: 'text';
7121
6946
  text: string;
7122
- html?: string;
7123
6947
  }
7124
6948
 
7125
6949
  /** @public */
@@ -7129,12 +6953,6 @@ export declare interface TLTextExternalContentSource {
7129
6953
  subtype: 'html' | 'json' | 'text' | 'url';
7130
6954
  }
7131
6955
 
7132
- /** @public */
7133
- export declare interface TLTextOptions {
7134
- tipTapConfig?: EditorProviderProps;
7135
- addFontsFromNode?: RichTextFontVisitor;
7136
- }
7137
-
7138
6956
  /** @public */
7139
6957
  export declare type TLTickEvent = (info: TLTickEventInfo) => void;
7140
6958
 
@@ -7306,9 +7124,6 @@ export declare function useMaybeEditor(): Editor | null;
7306
7124
 
7307
7125
  /* Excluded from this release type: useOnMount */
7308
7126
 
7309
- /** @public */
7310
- export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement>): void;
7311
-
7312
7127
  /** @public */
7313
7128
  export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement>): void;
7314
7129
 
@@ -7420,9 +7235,6 @@ export declare function useUniqueSafeId(suffix?: string): SafeId;
7420
7235
 
7421
7236
  export { useValue }
7422
7237
 
7423
- /** @public */
7424
- export declare function useViewportHeight(): number;
7425
-
7426
7238
  /* Excluded from this release type: ValidLicenseKeyResult */
7427
7239
 
7428
7240
  /** @public */
@@ -24,9 +24,6 @@ import {
24
24
  useValue
25
25
  } from "@tldraw/state-react";
26
26
  import { resizeScaled } from "./lib/editor/shapes/shared/resizeScaled.mjs";
27
- import {
28
- getFontsFromRichText
29
- } from "./lib/utils/richText.mjs";
30
27
  import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
31
28
  export * from "@tldraw/store";
32
29
  export * from "@tldraw/tlschema";
@@ -118,9 +115,6 @@ import {
118
115
  } from "./lib/editor/bindings/BindingUtil.mjs";
119
116
  import { ClickManager } from "./lib/editor/managers/ClickManager.mjs";
120
117
  import { EdgeScrollManager } from "./lib/editor/managers/EdgeScrollManager.mjs";
121
- import {
122
- FontManager
123
- } from "./lib/editor/managers/FontManager.mjs";
124
118
  import { HistoryManager } from "./lib/editor/managers/HistoryManager.mjs";
125
119
  import { ScribbleManager } from "./lib/editor/managers/ScribbleManager.mjs";
126
120
  import {
@@ -168,7 +162,6 @@ import { useIsCropping } from "./lib/hooks/useIsCropping.mjs";
168
162
  import { useIsDarkMode } from "./lib/hooks/useIsDarkMode.mjs";
169
163
  import { useIsEditing } from "./lib/hooks/useIsEditing.mjs";
170
164
  import { useLocalStore } from "./lib/hooks/useLocalStore.mjs";
171
- import { usePassThroughMouseOverEvents } from "./lib/hooks/usePassThroughMouseOverEvents.mjs";
172
165
  import { usePassThroughWheelEvents } from "./lib/hooks/usePassThroughWheelEvents.mjs";
173
166
  import { usePeerIds } from "./lib/hooks/usePeerIds.mjs";
174
167
  import { usePresence } from "./lib/hooks/usePresence.mjs";
@@ -182,7 +175,6 @@ import {
182
175
  import { useSelectionEvents } from "./lib/hooks/useSelectionEvents.mjs";
183
176
  import { useTLSchemaFromUtils, useTLStore } from "./lib/hooks/useTLStore.mjs";
184
177
  import { useTransform } from "./lib/hooks/useTransform.mjs";
185
- import { useViewportHeight } from "./lib/hooks/useViewportHeight.mjs";
186
178
  import {
187
179
  LicenseManager
188
180
  } from "./lib/license/LicenseManager.mjs";
@@ -297,7 +289,7 @@ function debugEnableLicensing() {
297
289
  }
298
290
  registerTldrawLibraryVersion(
299
291
  "@tldraw/editor",
300
- "3.9.0-internal.7f0e15f4f7d9",
292
+ "3.10.0-canary.d4dfa96478a4",
301
293
  "esm"
302
294
  );
303
295
  export {
@@ -342,7 +334,6 @@ export {
342
334
  Ellipse2d,
343
335
  ErrorBoundary,
344
336
  ErrorScreen,
345
- FontManager,
346
337
  Geometry2d,
347
338
  Group2d,
348
339
  GroupShapeUtil,
@@ -412,7 +403,6 @@ export {
412
403
  getArcMeasure,
413
404
  getCursor,
414
405
  getDefaultCdnBaseUrl,
415
- getFontsFromRichText,
416
406
  getFreshUserPreferences,
417
407
  getIncrementedName,
418
408
  getPerfectDashProps,
@@ -496,7 +486,6 @@ export {
496
486
  useLocalStore,
497
487
  useMaybeEditor,
498
488
  useOnMount,
499
- usePassThroughMouseOverEvents,
500
489
  usePassThroughWheelEvents,
501
490
  usePeerIds,
502
491
  usePresence,
@@ -516,7 +505,6 @@ export {
516
505
  useTransform,
517
506
  useUniqueSafeId,
518
507
  useValue,
519
- useViewportHeight,
520
508
  userTypeValidator,
521
509
  whyAmIRunning
522
510
  };