@tldraw/editor 3.9.0-internal.7f0e15f4f7d9 → 3.9.0

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 (118) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/index.d.ts +36 -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/Shape.js +0 -7
  9. package/dist-cjs/lib/components/Shape.js.map +2 -2
  10. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +1 -1
  11. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
  12. package/dist-cjs/lib/editor/Editor.js +435 -308
  13. package/dist-cjs/lib/editor/Editor.js.map +3 -3
  14. package/dist-cjs/lib/editor/managers/TextManager.js +17 -23
  15. package/dist-cjs/lib/editor/managers/TextManager.js.map +2 -2
  16. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +7 -13
  17. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  18. package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
  19. package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
  20. package/dist-cjs/lib/exports/FontEmbedder.js +2 -7
  21. package/dist-cjs/lib/exports/FontEmbedder.js.map +2 -2
  22. package/dist-cjs/lib/exports/StyleEmbedder.js +1 -1
  23. package/dist-cjs/lib/exports/StyleEmbedder.js.map +2 -2
  24. package/dist-cjs/lib/exports/exportToSvg.js +2 -3
  25. package/dist-cjs/lib/exports/exportToSvg.js.map +2 -2
  26. package/dist-cjs/lib/exports/getSvgJsx.js +1 -18
  27. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  28. package/dist-cjs/lib/exports/parseCss.js +0 -1
  29. package/dist-cjs/lib/exports/parseCss.js.map +2 -2
  30. package/dist-cjs/lib/hooks/useCanvasEvents.js +2 -2
  31. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  32. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js +1 -1
  33. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
  34. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  35. package/dist-cjs/lib/options.js +1 -2
  36. package/dist-cjs/lib/options.js.map +2 -2
  37. package/dist-cjs/lib/utils/dom.js +1 -1
  38. package/dist-cjs/lib/utils/dom.js.map +2 -2
  39. package/dist-cjs/version.js +3 -3
  40. package/dist-cjs/version.js.map +1 -1
  41. package/dist-esm/index.d.mts +36 -229
  42. package/dist-esm/index.mjs +1 -13
  43. package/dist-esm/index.mjs.map +2 -2
  44. package/dist-esm/lib/TldrawEditor.mjs +7 -34
  45. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  46. package/dist-esm/lib/components/Shape.mjs +1 -8
  47. package/dist-esm/lib/components/Shape.mjs.map +2 -2
  48. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +1 -1
  49. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
  50. package/dist-esm/lib/editor/Editor.mjs +432 -312
  51. package/dist-esm/lib/editor/Editor.mjs.map +3 -3
  52. package/dist-esm/lib/editor/managers/TextManager.mjs +17 -23
  53. package/dist-esm/lib/editor/managers/TextManager.mjs.map +2 -2
  54. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +7 -13
  55. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  56. package/dist-esm/lib/exports/FontEmbedder.mjs +2 -7
  57. package/dist-esm/lib/exports/FontEmbedder.mjs.map +2 -2
  58. package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -1
  59. package/dist-esm/lib/exports/StyleEmbedder.mjs.map +2 -2
  60. package/dist-esm/lib/exports/exportToSvg.mjs +2 -3
  61. package/dist-esm/lib/exports/exportToSvg.mjs.map +2 -2
  62. package/dist-esm/lib/exports/getSvgJsx.mjs +2 -19
  63. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  64. package/dist-esm/lib/exports/parseCss.mjs +0 -1
  65. package/dist-esm/lib/exports/parseCss.mjs.map +2 -2
  66. package/dist-esm/lib/hooks/useCanvasEvents.mjs +2 -2
  67. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  68. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs +1 -1
  69. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
  70. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  71. package/dist-esm/lib/options.mjs +1 -2
  72. package/dist-esm/lib/options.mjs.map +2 -2
  73. package/dist-esm/lib/utils/dom.mjs +1 -1
  74. package/dist-esm/lib/utils/dom.mjs.map +2 -2
  75. package/dist-esm/version.mjs +3 -3
  76. package/dist-esm/version.mjs.map +1 -1
  77. package/editor.css +13 -127
  78. package/package.json +7 -10
  79. package/src/index.ts +2 -15
  80. package/src/lib/TldrawEditor.tsx +4 -52
  81. package/src/lib/components/Shape.tsx +1 -9
  82. package/src/lib/components/default-components/DefaultErrorFallback.tsx +5 -3
  83. package/src/lib/editor/Editor.ts +561 -362
  84. package/src/lib/editor/managers/TextManager.ts +17 -42
  85. package/src/lib/editor/shapes/ShapeUtil.ts +32 -18
  86. package/src/lib/editor/types/emit-types.ts +0 -1
  87. package/src/lib/editor/types/external-content.ts +0 -1
  88. package/src/lib/exports/FontEmbedder.ts +1 -13
  89. package/src/lib/exports/StyleEmbedder.ts +1 -1
  90. package/src/lib/exports/exportToSvg.tsx +3 -4
  91. package/src/lib/exports/getSvgJsx.tsx +3 -22
  92. package/src/lib/exports/parseCss.ts +0 -1
  93. package/src/lib/hooks/useCanvasEvents.ts +1 -2
  94. package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +0 -1
  95. package/src/lib/hooks/usePassThroughWheelEvents.ts +1 -0
  96. package/src/lib/options.ts +0 -7
  97. package/src/lib/utils/dom.ts +1 -1
  98. package/src/version.ts +3 -3
  99. package/dist-cjs/lib/editor/managers/FontManager.js +0 -167
  100. package/dist-cjs/lib/editor/managers/FontManager.js.map +0 -7
  101. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js +0 -48
  102. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +0 -7
  103. package/dist-cjs/lib/hooks/useViewportHeight.js +0 -56
  104. package/dist-cjs/lib/hooks/useViewportHeight.js.map +0 -7
  105. package/dist-cjs/lib/utils/richText.js +0 -46
  106. package/dist-cjs/lib/utils/richText.js.map +0 -7
  107. package/dist-esm/lib/editor/managers/FontManager.mjs +0 -153
  108. package/dist-esm/lib/editor/managers/FontManager.mjs.map +0 -7
  109. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs +0 -28
  110. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +0 -7
  111. package/dist-esm/lib/hooks/useViewportHeight.mjs +0 -36
  112. package/dist-esm/lib/hooks/useViewportHeight.mjs.map +0 -7
  113. package/dist-esm/lib/utils/richText.mjs +0 -26
  114. package/dist-esm/lib/utils/richText.mjs.map +0 -7
  115. package/src/lib/editor/managers/FontManager.ts +0 -252
  116. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +0 -29
  117. package/src/lib/hooks/useViewportHeight.ts +0 -37
  118. 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
 
@@ -6010,10 +5904,6 @@ export declare interface TldrawEditorBaseProps {
6010
5904
  * Camera options for the editor.
6011
5905
  */
6012
5906
  cameraOptions?: Partial<TLCameraOptions>;
6013
- /**
6014
- * Text options for the editor.
6015
- */
6016
- textOptions?: TLTextOptions;
6017
5907
  /**
6018
5908
  * Options for the editor.
6019
5909
  */
@@ -6034,14 +5924,6 @@ export declare interface TldrawEditorBaseProps {
6034
5924
  * remain in the store and participate in all other operations.
6035
5925
  */
6036
5926
  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
5927
  }
6046
5928
 
6047
5929
  /**
@@ -6165,12 +6047,6 @@ export declare interface TldrawOptions {
6165
6047
  * By default, the toolbar items are accessible via number shortcuts according to their order. To disable this, set this option to false.
6166
6048
  */
6167
6049
  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
6050
  }
6175
6051
 
6176
6052
  /** @public */
@@ -6248,12 +6124,8 @@ export declare interface TLEditorOptions {
6248
6124
  * Options for the editor's camera.
6249
6125
  */
6250
6126
  cameraOptions?: Partial<TLCameraOptions>;
6251
- textOptions?: TLTextOptions;
6252
6127
  options?: Partial<TldrawOptions>;
6253
6128
  licenseKey?: string;
6254
- fontAssetUrls?: {
6255
- [key: string]: string | undefined;
6256
- };
6257
6129
  /**
6258
6130
  * A predicate that should return true if the given shape should be hidden.
6259
6131
  * @param shape - The shape to check.
@@ -6368,13 +6240,6 @@ export declare interface TLEventMap {
6368
6240
  'select-all-text': [{
6369
6241
  shapeId: TLShapeId;
6370
6242
  }];
6371
- 'place-caret': [{
6372
- point: {
6373
- x: number;
6374
- y: number;
6375
- };
6376
- shapeId: TLShapeId;
6377
- }];
6378
6243
  }
6379
6244
 
6380
6245
  /** @public */
@@ -6424,70 +6289,13 @@ export declare interface TLFilesExternalContent extends TLBaseExternalContent {
6424
6289
  ignoreParent: boolean;
6425
6290
  }
6426
6291
 
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.
6292
+ /** Additional options for the {@link ShapeUtil.getGeometry} method.
6293
+ *
6481
6294
  * @public
6482
6295
  */
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;
6296
+ export declare interface TLGeometryOpts {
6297
+ /** The context in which the geometry is being requested. */
6298
+ context?: string;
6491
6299
  }
6492
6300
 
6493
6301
  /** @public */
@@ -6954,13 +6762,25 @@ export declare interface TLShapeIndicatorProps {
6954
6762
  hidden?: boolean;
6955
6763
  }
6956
6764
 
6765
+ /**
6766
+ * Options passed to {@link ShapeUtil.canBeLaidOut}.
6767
+ *
6768
+ * @public
6769
+ */
6770
+ export declare interface TLShapeUtilCanBeLaidOutOpts {
6771
+ /** The type of action causing the layout. */
6772
+ type?: 'align' | 'distribute' | 'flip' | 'pack' | 'stack' | 'stretch';
6773
+ /** The other shapes being laid out */
6774
+ shapes?: TLShape[];
6775
+ }
6776
+
6957
6777
  /**
6958
6778
  * Options passed to {@link ShapeUtil.canBind}. A binding that could be made. At least one of
6959
6779
  * `fromShapeType` or `toShapeType` will belong to this shape util.
6960
6780
  *
6961
6781
  * @public
6962
6782
  */
6963
- export declare interface TLShapeUtilCanBindOpts<Shape extends TLUnknownShape = TLShape> {
6783
+ export declare interface TLShapeUtilCanBindOpts<Shape extends TLUnknownShape = TLUnknownShape> {
6964
6784
  /** The type of shape referenced by the `fromId` of the binding. */
6965
6785
  fromShapeType: string;
6966
6786
  /** The type of shape referenced by the `toId` of the binding. */
@@ -7119,7 +6939,6 @@ export declare interface TLSvgTextExternalContent extends TLBaseExternalContent
7119
6939
  export declare interface TLTextExternalContent extends TLBaseExternalContent {
7120
6940
  type: 'text';
7121
6941
  text: string;
7122
- html?: string;
7123
6942
  }
7124
6943
 
7125
6944
  /** @public */
@@ -7129,12 +6948,6 @@ export declare interface TLTextExternalContentSource {
7129
6948
  subtype: 'html' | 'json' | 'text' | 'url';
7130
6949
  }
7131
6950
 
7132
- /** @public */
7133
- export declare interface TLTextOptions {
7134
- tipTapConfig?: EditorProviderProps;
7135
- addFontsFromNode?: RichTextFontVisitor;
7136
- }
7137
-
7138
6951
  /** @public */
7139
6952
  export declare type TLTickEvent = (info: TLTickEventInfo) => void;
7140
6953
 
@@ -7306,9 +7119,6 @@ export declare function useMaybeEditor(): Editor | null;
7306
7119
 
7307
7120
  /* Excluded from this release type: useOnMount */
7308
7121
 
7309
- /** @public */
7310
- export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement>): void;
7311
-
7312
7122
  /** @public */
7313
7123
  export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement>): void;
7314
7124
 
@@ -7420,9 +7230,6 @@ export declare function useUniqueSafeId(suffix?: string): SafeId;
7420
7230
 
7421
7231
  export { useValue }
7422
7232
 
7423
- /** @public */
7424
- export declare function useViewportHeight(): number;
7425
-
7426
7233
  /* Excluded from this release type: ValidLicenseKeyResult */
7427
7234
 
7428
7235
  /** @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.9.0",
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
  };