@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
package/CHANGELOG.md CHANGED
@@ -1,3 +1,93 @@
1
+ # v3.9.0 (Mon Mar 03 2025)
2
+
3
+ ### Release Notes
4
+
5
+ #### Fix issue with duplicating bound arrows. ([#5495](https://github.com/tldraw/tldraw/pull/5495))
6
+
7
+ - Fix a bug with duplicating bound arrows.
8
+
9
+ #### Add `AtomMap` & refactor store ([#5496](https://github.com/tldraw/tldraw/pull/5496))
10
+
11
+ - **BREAKING**. `store.createSelectedComputedCache` has been removed. Use `store.createCache` and create your own selector `computed` instead.
12
+ - **BREAKING**. `createComputerCache` no longer accepts a single `isEqual` fn as its 3rd argument. Instead, pass in an options object, with the `isEqual` fn named `areRecordsEqual`. You can now pass `areResultsEqual`, too.
13
+
14
+ #### [botcom] Fix slow export menu in big files ([#5435](https://github.com/tldraw/tldraw/pull/5435))
15
+
16
+ - Fixed a bug with export menu performance.
17
+
18
+ #### Improve / fix layout methods: alignment, distribute, flip, stack. ([#5479](https://github.com/tldraw/tldraw/pull/5479))
19
+
20
+ - Fixes several bugs when aligning / flipping / distributing / stretching / stacking a selection that included with arrows.
21
+ - Fixed a bug with distribution with overlapping shapes
22
+ - Fixed a bug with distribution that could lead to changed selection.
23
+ - Fixed a bug preventing rotated shapes from being stretched.
24
+
25
+ #### Fix text padding, add context to shape geometry ([#5487](https://github.com/tldraw/tldraw/pull/5487))
26
+
27
+ - Improved horizontal padding for arrows bound to text shapes
28
+
29
+ #### Remove canvas size dependency ([#5488](https://github.com/tldraw/tldraw/pull/5488))
30
+
31
+ - API: removes canvas-size dependency.
32
+
33
+ #### fix svg image export mime type ([#5427](https://github.com/tldraw/tldraw/pull/5427))
34
+
35
+ - Fix `<TldrawImage />` not rendering correctly with `format=svg`
36
+
37
+ ---
38
+
39
+ #### 🐛 Bug Fix
40
+
41
+ - Update discord links [#5500](https://github.com/tldraw/tldraw/pull/5500) ([@SomeHats](https://github.com/SomeHats) [@huppy-bot[bot]](https://github.com/huppy-bot[bot]) [@steveruizok](https://github.com/steveruizok) [@TodePond](https://github.com/TodePond))
42
+ - Consider `https://localhost` to be development [#5471](https://github.com/tldraw/tldraw/pull/5471) ([@jamesbvaughan](https://github.com/jamesbvaughan) [@steveruizok](https://github.com/steveruizok))
43
+
44
+ #### 🐛 Bug Fixes
45
+
46
+ - Fix issue with duplicating bound arrows. [#5495](https://github.com/tldraw/tldraw/pull/5495) ([@MitjaBezensek](https://github.com/MitjaBezensek))
47
+ - [botcom] Fix slow export menu in big files [#5435](https://github.com/tldraw/tldraw/pull/5435) ([@steveruizok](https://github.com/steveruizok))
48
+ - Improve / fix layout methods: alignment, distribute, flip, stack. [#5479](https://github.com/tldraw/tldraw/pull/5479) ([@steveruizok](https://github.com/steveruizok))
49
+ - fix svg image export mime type [#5427](https://github.com/tldraw/tldraw/pull/5427) ([@SomeHats](https://github.com/SomeHats))
50
+
51
+ #### 💄 Product Improvements
52
+
53
+ - Fix text padding, add context to shape geometry [#5487](https://github.com/tldraw/tldraw/pull/5487) ([@steveruizok](https://github.com/steveruizok))
54
+ - Remove canvas size dependency [#5488](https://github.com/tldraw/tldraw/pull/5488) ([@steveruizok](https://github.com/steveruizok))
55
+
56
+ #### 🛠️ API Changes
57
+
58
+ - Add `AtomMap` & refactor store [#5496](https://github.com/tldraw/tldraw/pull/5496) ([@SomeHats](https://github.com/SomeHats))
59
+
60
+ #### Authors: 6
61
+
62
+ - [@huppy-bot[bot]](https://github.com/huppy-bot[bot])
63
+ - alex ([@SomeHats](https://github.com/SomeHats))
64
+ - James Vaughan ([@jamesbvaughan](https://github.com/jamesbvaughan))
65
+ - Lu Wilson ([@TodePond](https://github.com/TodePond))
66
+ - Mitja Bezenšek ([@MitjaBezensek](https://github.com/MitjaBezensek))
67
+ - Steve Ruiz ([@steveruizok](https://github.com/steveruizok))
68
+
69
+ ---
70
+
71
+ # v3.8.1 (Thu Feb 13 2025)
72
+
73
+ ### Release Notes
74
+
75
+ #### 3.8.1 ([#5429](https://github.com/tldraw/tldraw/pull/5429))
76
+
77
+ - Fix `TldrawImage` not working with `format=png`
78
+
79
+ ---
80
+
81
+ #### 🐛 Bug Fix
82
+
83
+ - 3.8.1 [#5429](https://github.com/tldraw/tldraw/pull/5429) ([@SomeHats](https://github.com/SomeHats))
84
+
85
+ #### Authors: 1
86
+
87
+ - alex ([@SomeHats](https://github.com/SomeHats))
88
+
89
+ ---
90
+
1
91
  # v3.8.0 (Wed Feb 12 2025)
2
92
 
3
93
  ### Release Notes
package/README.md CHANGED
@@ -24,7 +24,7 @@ Please see our [contributing guide](https://github.com/tldraw/tldraw/blob/main/C
24
24
 
25
25
  ## Community
26
26
 
27
- Have questions, comments or feedback? [Join our discord](https://discord.gg/rhsyWMUJxd) or [start a discussion](https://github.com/tldraw/tldraw/discussions/new). For the latest news and release notes, visit [tldraw.dev](https://tldraw.dev).
27
+ Have questions, comments or feedback? [Join our discord](https://discord.tldraw.com/?utm_source=github&utm_medium=social&utm_campaign=sociallink). For the latest news and release notes, visit [tldraw.dev](https://tldraw.dev).
28
28
 
29
29
  ## Contact
30
30
 
@@ -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 */
package/dist-cjs/index.js CHANGED
@@ -60,7 +60,6 @@ __export(index_exports, {
60
60
  Ellipse2d: () => import_Ellipse2d.Ellipse2d,
61
61
  ErrorBoundary: () => import_ErrorBoundary.ErrorBoundary,
62
62
  ErrorScreen: () => import_TldrawEditor.ErrorScreen,
63
- FontManager: () => import_FontManager.FontManager,
64
63
  Geometry2d: () => import_Geometry2d.Geometry2d,
65
64
  Group2d: () => import_Group2d.Group2d,
66
65
  GroupShapeUtil: () => import_GroupShapeUtil.GroupShapeUtil,
@@ -130,7 +129,6 @@ __export(index_exports, {
130
129
  getArcMeasure: () => import_utils2.getArcMeasure,
131
130
  getCursor: () => import_useCursor.getCursor,
132
131
  getDefaultCdnBaseUrl: () => import_assets.getDefaultCdnBaseUrl,
133
- getFontsFromRichText: () => import_richText.getFontsFromRichText,
134
132
  getFreshUserPreferences: () => import_TLUserPreferences.getFreshUserPreferences,
135
133
  getIncrementedName: () => import_getIncrementedName.getIncrementedName,
136
134
  getPerfectDashProps: () => import_getPerfectDashProps.getPerfectDashProps,
@@ -214,7 +212,6 @@ __export(index_exports, {
214
212
  useLocalStore: () => import_useLocalStore.useLocalStore,
215
213
  useMaybeEditor: () => import_useEditor.useMaybeEditor,
216
214
  useOnMount: () => import_TldrawEditor.useOnMount,
217
- usePassThroughMouseOverEvents: () => import_usePassThroughMouseOverEvents.usePassThroughMouseOverEvents,
218
215
  usePassThroughWheelEvents: () => import_usePassThroughWheelEvents.usePassThroughWheelEvents,
219
216
  usePeerIds: () => import_usePeerIds.usePeerIds,
220
217
  usePresence: () => import_usePresence.usePresence,
@@ -234,7 +231,6 @@ __export(index_exports, {
234
231
  useTransform: () => import_useTransform.useTransform,
235
232
  useUniqueSafeId: () => import_useSafeId.useUniqueSafeId,
236
233
  useValue: () => import_state_react.useValue,
237
- useViewportHeight: () => import_useViewportHeight.useViewportHeight,
238
234
  userTypeValidator: () => import_TLUserPreferences.userTypeValidator,
239
235
  whyAmIRunning: () => import_state.whyAmIRunning
240
236
  });
@@ -248,7 +244,6 @@ var import_replace_all = require("core-js/stable/string/replace-all.js");
248
244
  var import_state = require("@tldraw/state");
249
245
  var import_state_react = require("@tldraw/state-react");
250
246
  var import_resizeScaled = require("./lib/editor/shapes/shared/resizeScaled");
251
- var import_richText = require("./lib/utils/richText");
252
247
  var import_LocalIndexedDb = require("./lib/utils/sync/LocalIndexedDb");
253
248
  __reExport(index_exports, require("@tldraw/store"), module.exports);
254
249
  __reExport(index_exports, require("@tldraw/tlschema"), module.exports);
@@ -287,7 +282,6 @@ var import_Editor = require("./lib/editor/Editor");
287
282
  var import_BindingUtil = require("./lib/editor/bindings/BindingUtil");
288
283
  var import_ClickManager = require("./lib/editor/managers/ClickManager");
289
284
  var import_EdgeScrollManager = require("./lib/editor/managers/EdgeScrollManager");
290
- var import_FontManager = require("./lib/editor/managers/FontManager");
291
285
  var import_HistoryManager = require("./lib/editor/managers/HistoryManager");
292
286
  var import_ScribbleManager = require("./lib/editor/managers/ScribbleManager");
293
287
  var import_BoundsSnaps = require("./lib/editor/managers/SnapManager/BoundsSnaps");
@@ -320,7 +314,6 @@ var import_useIsCropping = require("./lib/hooks/useIsCropping");
320
314
  var import_useIsDarkMode = require("./lib/hooks/useIsDarkMode");
321
315
  var import_useIsEditing = require("./lib/hooks/useIsEditing");
322
316
  var import_useLocalStore = require("./lib/hooks/useLocalStore");
323
- var import_usePassThroughMouseOverEvents = require("./lib/hooks/usePassThroughMouseOverEvents");
324
317
  var import_usePassThroughWheelEvents = require("./lib/hooks/usePassThroughWheelEvents");
325
318
  var import_usePeerIds = require("./lib/hooks/usePeerIds");
326
319
  var import_usePresence = require("./lib/hooks/usePresence");
@@ -329,7 +322,6 @@ var import_useSafeId = require("./lib/hooks/useSafeId");
329
322
  var import_useSelectionEvents = require("./lib/hooks/useSelectionEvents");
330
323
  var import_useTLStore = require("./lib/hooks/useTLStore");
331
324
  var import_useTransform = require("./lib/hooks/useTransform");
332
- var import_useViewportHeight = require("./lib/hooks/useViewportHeight");
333
325
  var import_LicenseManager = require("./lib/license/LicenseManager");
334
326
  var import_options = require("./lib/options");
335
327
  var import_Box = require("./lib/primitives/Box");
@@ -374,7 +366,7 @@ function debugEnableLicensing() {
374
366
  }
375
367
  (0, import_utils.registerTldrawLibraryVersion)(
376
368
  "@tldraw/editor",
377
- "3.9.0-internal.7f0e15f4f7d9",
369
+ "3.9.0",
378
370
  "cjs"
379
371
  );
380
372
  //# sourceMappingURL=index.js.map