@tldraw/editor 3.10.0-canary.d4dfa96478a4 → 3.10.0-canary.e5f41d07faf1

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 (111) hide show
  1. package/dist-cjs/index.d.ts +227 -3
  2. package/dist-cjs/index.js +9 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +32 -6
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/Shape.js +7 -0
  7. package/dist-cjs/lib/components/Shape.js.map +2 -2
  8. package/dist-cjs/lib/editor/Editor.js +68 -13
  9. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  10. package/dist-cjs/lib/editor/managers/FontManager.js +166 -0
  11. package/dist-cjs/lib/editor/managers/FontManager.js.map +7 -0
  12. package/dist-cjs/lib/editor/managers/TextManager.js +23 -17
  13. package/dist-cjs/lib/editor/managers/TextManager.js.map +2 -2
  14. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +11 -0
  15. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  16. package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
  17. package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
  18. package/dist-cjs/lib/exports/FontEmbedder.js +7 -2
  19. package/dist-cjs/lib/exports/FontEmbedder.js.map +2 -2
  20. package/dist-cjs/lib/exports/StyleEmbedder.js +1 -1
  21. package/dist-cjs/lib/exports/StyleEmbedder.js.map +2 -2
  22. package/dist-cjs/lib/exports/exportToSvg.js +3 -2
  23. package/dist-cjs/lib/exports/exportToSvg.js.map +2 -2
  24. package/dist-cjs/lib/exports/getSvgJsx.js +18 -1
  25. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  26. package/dist-cjs/lib/exports/parseCss.js +1 -0
  27. package/dist-cjs/lib/exports/parseCss.js.map +2 -2
  28. package/dist-cjs/lib/hooks/useCanvasEvents.js +2 -2
  29. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  30. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js +1 -1
  31. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
  32. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js +48 -0
  33. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +7 -0
  34. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  35. package/dist-cjs/lib/hooks/useViewportHeight.js +56 -0
  36. package/dist-cjs/lib/hooks/useViewportHeight.js.map +7 -0
  37. package/dist-cjs/lib/options.js +2 -1
  38. package/dist-cjs/lib/options.js.map +2 -2
  39. package/dist-cjs/lib/utils/dom.js +1 -1
  40. package/dist-cjs/lib/utils/dom.js.map +2 -2
  41. package/dist-cjs/lib/utils/richText.js +46 -0
  42. package/dist-cjs/lib/utils/richText.js.map +7 -0
  43. package/dist-cjs/version.js +3 -3
  44. package/dist-cjs/version.js.map +1 -1
  45. package/dist-esm/index.d.mts +227 -3
  46. package/dist-esm/index.mjs +13 -1
  47. package/dist-esm/index.mjs.map +2 -2
  48. package/dist-esm/lib/TldrawEditor.mjs +33 -7
  49. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  50. package/dist-esm/lib/components/Shape.mjs +8 -1
  51. package/dist-esm/lib/components/Shape.mjs.map +2 -2
  52. package/dist-esm/lib/editor/Editor.mjs +71 -9
  53. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  54. package/dist-esm/lib/editor/managers/FontManager.mjs +152 -0
  55. package/dist-esm/lib/editor/managers/FontManager.mjs.map +7 -0
  56. package/dist-esm/lib/editor/managers/TextManager.mjs +23 -17
  57. package/dist-esm/lib/editor/managers/TextManager.mjs.map +2 -2
  58. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +11 -0
  59. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  60. package/dist-esm/lib/exports/FontEmbedder.mjs +7 -2
  61. package/dist-esm/lib/exports/FontEmbedder.mjs.map +2 -2
  62. package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -1
  63. package/dist-esm/lib/exports/StyleEmbedder.mjs.map +2 -2
  64. package/dist-esm/lib/exports/exportToSvg.mjs +3 -2
  65. package/dist-esm/lib/exports/exportToSvg.mjs.map +2 -2
  66. package/dist-esm/lib/exports/getSvgJsx.mjs +19 -2
  67. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  68. package/dist-esm/lib/exports/parseCss.mjs +1 -0
  69. package/dist-esm/lib/exports/parseCss.mjs.map +2 -2
  70. package/dist-esm/lib/hooks/useCanvasEvents.mjs +2 -2
  71. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  72. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs +1 -1
  73. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
  74. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs +28 -0
  75. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +7 -0
  76. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  77. package/dist-esm/lib/hooks/useViewportHeight.mjs +36 -0
  78. package/dist-esm/lib/hooks/useViewportHeight.mjs.map +7 -0
  79. package/dist-esm/lib/options.mjs +2 -1
  80. package/dist-esm/lib/options.mjs.map +2 -2
  81. package/dist-esm/lib/utils/dom.mjs +1 -1
  82. package/dist-esm/lib/utils/dom.mjs.map +2 -2
  83. package/dist-esm/lib/utils/richText.mjs +26 -0
  84. package/dist-esm/lib/utils/richText.mjs.map +7 -0
  85. package/dist-esm/version.mjs +3 -3
  86. package/dist-esm/version.mjs.map +1 -1
  87. package/editor.css +127 -13
  88. package/package.json +10 -7
  89. package/src/index.ts +15 -0
  90. package/src/lib/TldrawEditor.tsx +52 -4
  91. package/src/lib/components/Shape.tsx +9 -1
  92. package/src/lib/editor/Editor.ts +91 -7
  93. package/src/lib/editor/managers/FontManager.ts +251 -0
  94. package/src/lib/editor/managers/TextManager.ts +42 -17
  95. package/src/lib/editor/shapes/ShapeUtil.ts +13 -0
  96. package/src/lib/editor/types/emit-types.ts +1 -0
  97. package/src/lib/editor/types/external-content.ts +1 -0
  98. package/src/lib/exports/FontEmbedder.ts +13 -1
  99. package/src/lib/exports/StyleEmbedder.ts +1 -1
  100. package/src/lib/exports/exportToSvg.tsx +4 -3
  101. package/src/lib/exports/getSvgJsx.tsx +22 -2
  102. package/src/lib/exports/parseCss.ts +1 -0
  103. package/src/lib/hooks/useCanvasEvents.ts +2 -1
  104. package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +1 -0
  105. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +29 -0
  106. package/src/lib/hooks/usePassThroughWheelEvents.ts +0 -1
  107. package/src/lib/hooks/useViewportHeight.ts +37 -0
  108. package/src/lib/options.ts +7 -0
  109. package/src/lib/utils/dom.ts +1 -1
  110. package/src/lib/utils/richText.ts +72 -0
  111. package/src/version.ts +3 -3
@@ -7,6 +7,8 @@ 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';
10
12
  import { EffectScheduler } from '@tldraw/state';
11
13
  import { EMPTY_ARRAY } from '@tldraw/state';
12
14
  import EventEmitter from 'eventemitter3';
@@ -18,6 +20,7 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
18
20
  import { LegacyMigrations } from '@tldraw/store';
19
21
  import { MigrationSequence } from '@tldraw/store';
20
22
  import { NamedExoticComponent } from 'react';
23
+ import { Node as Node_2 } from '@tiptap/pm/model';
21
24
  import { PerformanceTracker } from '@tldraw/utils';
22
25
  import { PointerEventHandler } from 'react';
23
26
  import { react } from '@tldraw/state';
@@ -66,6 +69,7 @@ import { TLPageId } from '@tldraw/tlschema';
66
69
  import { TLParentId } from '@tldraw/tlschema';
67
70
  import { TLPropsMigrations } from '@tldraw/tlschema';
68
71
  import { TLRecord } from '@tldraw/tlschema';
72
+ import { TLRichText } from '@tldraw/tlschema';
69
73
  import { TLScribble } from '@tldraw/tlschema';
70
74
  import { TLShape } from '@tldraw/tlschema';
71
75
  import { TLShapeCrop } from '@tldraw/tlschema';
@@ -884,6 +888,7 @@ export declare const defaultTldrawOptions: {
884
888
  readonly longPressDurationMs: 500;
885
889
  readonly maxExportDelayMs: 5000;
886
890
  readonly maxFilesAtOnce: 100;
891
+ readonly maxFontsToLoadBeforeRender: number;
887
892
  readonly maxPages: 40;
888
893
  readonly maxShapesPerPage: 4000;
889
894
  readonly multiClickDurationMs: 200;
@@ -979,7 +984,8 @@ export declare class EdgeScrollManager {
979
984
 
980
985
  /** @public */
981
986
  export declare class Editor extends EventEmitter<TLEventMap> {
982
- constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, initialState, autoFocus, inferDarkMode, options, isShapeHidden, }: TLEditorOptions);
987
+ readonly id: string;
988
+ constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, textOptions, initialState, autoFocus, inferDarkMode, options, isShapeHidden, fontAssetUrls, }: TLEditorOptions);
983
989
  private readonly _isShapeHiddenPredicate?;
984
990
  private getIsShapeHiddenCache;
985
991
  isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
@@ -1040,6 +1046,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1040
1046
  * @public
1041
1047
  */
1042
1048
  readonly textMeasure: TextManager;
1049
+ /**
1050
+ * A utility for managing the set of fonts that should be rendered in the document.
1051
+ *
1052
+ * @public
1053
+ */
1054
+ readonly fonts: FontManager;
1043
1055
  /**
1044
1056
  * A manager for the editor's environment.
1045
1057
  *
@@ -1679,6 +1691,26 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1679
1691
  * @public
1680
1692
  */
1681
1693
  setEditingShape(shape: null | TLShape | TLShapeId): this;
1694
+ private _currentRichTextEditor;
1695
+ /**
1696
+ * The current editing shape's text editor.
1697
+ *
1698
+ * @public
1699
+ */
1700
+ getRichTextEditor(): null | TiptapEditor;
1701
+ /**
1702
+ * Set the current editing shape's rich text editor.
1703
+ *
1704
+ * @example
1705
+ * ```ts
1706
+ * editor.setRichTextEditor(richTextEditorView)
1707
+ * ```
1708
+ *
1709
+ * @param textEditor - The text editor to set as the current editing shape's text editor.
1710
+ *
1711
+ * @public
1712
+ */
1713
+ setRichTextEditor(textEditor: null | TiptapEditor): this;
1682
1714
  /**
1683
1715
  * The current hovered shape id.
1684
1716
  *
@@ -1779,6 +1811,17 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1779
1811
  * @public
1780
1812
  */
1781
1813
  setCroppingShape(shape: null | TLShape | TLShapeId): this;
1814
+ private _textOptions;
1815
+ /**
1816
+ * Get the current text options.
1817
+ *
1818
+ * @example
1819
+ * ```ts
1820
+ * editor.getTextOptions()
1821
+ * ```
1822
+ *
1823
+ * @public */
1824
+ getTextOptions(): TLTextOptions;
1782
1825
  /* Excluded from this release type: _unsafe_getCameraId */
1783
1826
  /**
1784
1827
  * The current camera.
@@ -3186,7 +3229,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3186
3229
  * @example
3187
3230
  * ```ts
3188
3231
  * editor.createShape(myShape)
3189
- * editor.createShape({ id: 'box1', type: 'text', props: { text: "ok" } })
3232
+ * editor.createShape({ id: 'box1', type: 'text', props: { richText: toRichText("ok") } })
3190
3233
  * ```
3191
3234
  *
3192
3235
  * @param shape - The shape (or shape partial) to create.
@@ -3200,7 +3243,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3200
3243
  * @example
3201
3244
  * ```ts
3202
3245
  * editor.createShapes([myShape])
3203
- * editor.createShapes([{ id: 'box1', type: 'text', props: { text: "ok" } }])
3246
+ * editor.createShapes([{ id: 'box1', type: 'text', props: { richText: toRichText("ok") } }])
3204
3247
  * ```
3205
3248
  *
3206
3249
  * @param shapes - The shapes (or shape partials) to create.
@@ -3959,6 +4002,27 @@ export declare const EVENT_NAME_MAP: Record<Exclude<TLEventName, TLPinchEventNam
3959
4002
 
3960
4003
  /* Excluded from this release type: featureFlags */
3961
4004
 
4005
+ /** @public */
4006
+ export declare class FontManager {
4007
+ private readonly editor;
4008
+ private readonly assetUrls?;
4009
+ constructor(editor: Editor, assetUrls?: {
4010
+ [key: string]: string | undefined;
4011
+ } | undefined);
4012
+ private readonly shapeFontFacesCache;
4013
+ private readonly shapeFontLoadStateCache;
4014
+ getShapeFontFaces(shape: TLShape | TLShapeId): TLFontFace[];
4015
+ trackFontsForShape(shape: TLShape | TLShapeId): void;
4016
+ loadRequiredFontsForCurrentPage(limit?: number): Promise<void>;
4017
+ private readonly fontStates;
4018
+ private getFontState;
4019
+ ensureFontIsLoaded(font: TLFontFace): Promise<void>;
4020
+ private fontsToLoad;
4021
+ requestFonts(fonts: TLFontFace[]): void;
4022
+ private findOrCreateFontFace;
4023
+ toEmbeddedCssDeclaration(font: TLFontFace): Promise<string>;
4024
+ }
4025
+
3962
4026
  /** @public */
3963
4027
  export declare interface GapsSnapIndicator {
3964
4028
  id: string;
@@ -4031,6 +4095,9 @@ export declare function getCursor(cursor: TLCursorType, rotation?: number, color
4031
4095
  /** @public */
4032
4096
  export declare function getDefaultCdnBaseUrl(): string;
4033
4097
 
4098
+ /** @public */
4099
+ export declare function getFontsFromRichText(editor: Editor, richText: TLRichText, initialState: RichTextFontVisitorState): TLFontFace[];
4100
+
4034
4101
  /** @public */
4035
4102
  export declare function getFreshUserPreferences(): TLUserPreferences;
4036
4103
 
@@ -4715,6 +4782,16 @@ export declare function resizeScaled(shape: TLBaseShape<any, {
4715
4782
  y: number;
4716
4783
  };
4717
4784
 
4785
+ /** @public */
4786
+ export declare type RichTextFontVisitor = (node: TiptapNode, state: RichTextFontVisitorState, addFont: (font: TLFontFace) => void) => RichTextFontVisitorState;
4787
+
4788
+ /** @public */
4789
+ export declare interface RichTextFontVisitorState {
4790
+ readonly family: string;
4791
+ readonly weight: string;
4792
+ readonly style: string;
4793
+ }
4794
+
4718
4795
  /** @public */
4719
4796
  export declare const ROTATE_CORNER_TO_SELECTION_CORNER: {
4720
4797
  readonly bottom_left_rotate: "bottom_left";
@@ -4897,6 +4974,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
4897
4974
  * @public
4898
4975
  */
4899
4976
  abstract indicator(shape: Shape): any;
4977
+ /**
4978
+ * Get the font faces that should be rendered in the document in order for this shape to render
4979
+ * correctly.
4980
+ *
4981
+ * @param shape - The shape.
4982
+ * @public
4983
+ */
4984
+ getFontFaces(shape: Shape): TLFontFace[];
4900
4985
  /**
4901
4986
  * Whether the shape can be snapped to by another shape.
4902
4987
  *
@@ -5554,6 +5639,24 @@ export declare class TextManager {
5554
5639
  }): BoxModel & {
5555
5640
  scrollWidth: number;
5556
5641
  };
5642
+ measureHtml(html: string, opts: {
5643
+ /**
5644
+ * When maxWidth is a number, the text will be wrapped to that maxWidth. When maxWidth
5645
+ * is null, the text will be measured without wrapping, but explicit line breaks and
5646
+ * space are preserved.
5647
+ */
5648
+ maxWidth: null | number;
5649
+ disableOverflowWrapBreaking?: boolean;
5650
+ fontFamily: string;
5651
+ fontSize: number;
5652
+ fontStyle: string;
5653
+ fontWeight: string;
5654
+ lineHeight: number;
5655
+ minWidth?: null | number;
5656
+ padding: string;
5657
+ }): BoxModel & {
5658
+ scrollWidth: number;
5659
+ };
5557
5660
  /**
5558
5661
  * Given an html element, measure the position of each span of unbroken
5559
5662
  * word/white-space characters within any text nodes it contains.
@@ -5581,6 +5684,19 @@ export declare class TextManager {
5581
5684
  }[];
5582
5685
  }
5583
5686
 
5687
+ /**
5688
+ * This is the TipTap editor! Docs are {@link https://tiptap.dev/docs}.
5689
+ *
5690
+ * @public
5691
+ */
5692
+ export declare type TiptapEditor = Editor_2;
5693
+
5694
+ /**
5695
+ * A TipTap node. See {@link https://tiptap.dev/docs}.
5696
+ * @public
5697
+ */
5698
+ export declare type TiptapNode = Node_2;
5699
+
5584
5700
  /** @public */
5585
5701
  export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
5586
5702
 
@@ -5907,6 +6023,10 @@ export declare interface TldrawEditorBaseProps {
5907
6023
  * Camera options for the editor.
5908
6024
  */
5909
6025
  cameraOptions?: Partial<TLCameraOptions>;
6026
+ /**
6027
+ * Text options for the editor.
6028
+ */
6029
+ textOptions?: TLTextOptions;
5910
6030
  /**
5911
6031
  * Options for the editor.
5912
6032
  */
@@ -5927,6 +6047,14 @@ export declare interface TldrawEditorBaseProps {
5927
6047
  * remain in the store and participate in all other operations.
5928
6048
  */
5929
6049
  isShapeHidden?(shape: TLShape, editor: Editor): boolean;
6050
+ /**
6051
+ * The URLs for the fonts to use in the editor.
6052
+ */
6053
+ assetUrls?: {
6054
+ fonts?: {
6055
+ [key: string]: string | undefined;
6056
+ };
6057
+ };
5930
6058
  }
5931
6059
 
5932
6060
  /**
@@ -6050,6 +6178,12 @@ export declare interface TldrawOptions {
6050
6178
  * By default, the toolbar items are accessible via number shortcuts according to their order. To disable this, set this option to false.
6051
6179
  */
6052
6180
  readonly enableToolbarKeyboardShortcuts: boolean;
6181
+ /**
6182
+ * The maximum number of fonts that will be loaded while blocking the main rendering of the
6183
+ * canvas. If there are more than this number of fonts needed, we'll just show the canvas right
6184
+ * away and let the fonts load in in the background.
6185
+ */
6186
+ readonly maxFontsToLoadBeforeRender: number;
6053
6187
  }
6054
6188
 
6055
6189
  /** @public */
@@ -6127,8 +6261,12 @@ export declare interface TLEditorOptions {
6127
6261
  * Options for the editor's camera.
6128
6262
  */
6129
6263
  cameraOptions?: Partial<TLCameraOptions>;
6264
+ textOptions?: TLTextOptions;
6130
6265
  options?: Partial<TldrawOptions>;
6131
6266
  licenseKey?: string;
6267
+ fontAssetUrls?: {
6268
+ [key: string]: string | undefined;
6269
+ };
6132
6270
  /**
6133
6271
  * A predicate that should return true if the given shape should be hidden.
6134
6272
  * @param shape - The shape to check.
@@ -6243,6 +6381,13 @@ export declare interface TLEventMap {
6243
6381
  'select-all-text': [{
6244
6382
  shapeId: TLShapeId;
6245
6383
  }];
6384
+ 'place-caret': [{
6385
+ point: {
6386
+ x: number;
6387
+ y: number;
6388
+ };
6389
+ shapeId: TLShapeId;
6390
+ }];
6246
6391
  }
6247
6392
 
6248
6393
  /** @public */
@@ -6292,6 +6437,72 @@ export declare interface TLFilesExternalContent extends TLBaseExternalContent {
6292
6437
  ignoreParent: boolean;
6293
6438
  }
6294
6439
 
6440
+ /**
6441
+ * A font face that can be used in the editor. The properties of this are largely the same as the
6442
+ * ones in the
6443
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face | css `@font-face` rule}.
6444
+ * @public
6445
+ */
6446
+ export declare interface TLFontFace {
6447
+ /**
6448
+ * How this font can be referred to in CSS.
6449
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-family | `font-family`}.
6450
+ */
6451
+ readonly family: string;
6452
+ /**
6453
+ * The source of the font. This
6454
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src | `src`}.
6455
+ */
6456
+ readonly src: TLFontFaceSource;
6457
+ /**
6458
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/ascent-override | `ascent-override`}.
6459
+ */
6460
+ readonly ascentOverride?: string;
6461
+ /**
6462
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/descent-override | `descent-override`}.
6463
+ */
6464
+ readonly descentOverride?: string;
6465
+ /**
6466
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-stretch | `font-stretch`}.
6467
+ */
6468
+ readonly stretch?: string;
6469
+ /**
6470
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style | `font-style`}.
6471
+ */
6472
+ readonly style?: string;
6473
+ /**
6474
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight | `font-weight`}.
6475
+ */
6476
+ readonly weight?: string;
6477
+ /**
6478
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-feature-settings | `font-feature-settings`}.
6479
+ */
6480
+ readonly featureSettings?: string;
6481
+ /**
6482
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/line-gap-override | `line-gap-override`}.
6483
+ */
6484
+ readonly lineGapOverride?: string;
6485
+ /**
6486
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range | `unicode-range`}.
6487
+ */
6488
+ readonly unicodeRange?: string;
6489
+ }
6490
+
6491
+ /**
6492
+ * Represents the `src` property of a {@link TLFontFace}.
6493
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src | `src`} for details of the properties here.
6494
+ * @public
6495
+ */
6496
+ export declare interface TLFontFaceSource {
6497
+ /**
6498
+ * A URL from which to load the font. If the value here is a key in
6499
+ * {@link tldraw#TLEditorAssetUrls.fonts}, the value from there will be used instead.
6500
+ */
6501
+ url: string;
6502
+ format?: string;
6503
+ tech?: string;
6504
+ }
6505
+
6295
6506
  /** Additional options for the {@link ShapeUtil.getGeometry} method.
6296
6507
  *
6297
6508
  * @public
@@ -6944,6 +7155,7 @@ export declare interface TLSvgTextExternalContent extends TLBaseExternalContent
6944
7155
  export declare interface TLTextExternalContent extends TLBaseExternalContent {
6945
7156
  type: 'text';
6946
7157
  text: string;
7158
+ html?: string;
6947
7159
  }
6948
7160
 
6949
7161
  /** @public */
@@ -6953,6 +7165,12 @@ export declare interface TLTextExternalContentSource {
6953
7165
  subtype: 'html' | 'json' | 'text' | 'url';
6954
7166
  }
6955
7167
 
7168
+ /** @public */
7169
+ export declare interface TLTextOptions {
7170
+ tipTapConfig?: EditorProviderProps;
7171
+ addFontsFromNode?: RichTextFontVisitor;
7172
+ }
7173
+
6956
7174
  /** @public */
6957
7175
  export declare type TLTickEvent = (info: TLTickEventInfo) => void;
6958
7176
 
@@ -7124,6 +7342,9 @@ export declare function useMaybeEditor(): Editor | null;
7124
7342
 
7125
7343
  /* Excluded from this release type: useOnMount */
7126
7344
 
7345
+ /** @public */
7346
+ export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement>): void;
7347
+
7127
7348
  /** @public */
7128
7349
  export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement>): void;
7129
7350
 
@@ -7235,6 +7456,9 @@ export declare function useUniqueSafeId(suffix?: string): SafeId;
7235
7456
 
7236
7457
  export { useValue }
7237
7458
 
7459
+ /** @public */
7460
+ export declare function useViewportHeight(): number;
7461
+
7238
7462
  /* Excluded from this release type: ValidLicenseKeyResult */
7239
7463
 
7240
7464
  /** @public */
package/dist-cjs/index.js CHANGED
@@ -60,6 +60,7 @@ __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,
63
64
  Geometry2d: () => import_Geometry2d.Geometry2d,
64
65
  Group2d: () => import_Group2d.Group2d,
65
66
  GroupShapeUtil: () => import_GroupShapeUtil.GroupShapeUtil,
@@ -129,6 +130,7 @@ __export(index_exports, {
129
130
  getArcMeasure: () => import_utils2.getArcMeasure,
130
131
  getCursor: () => import_useCursor.getCursor,
131
132
  getDefaultCdnBaseUrl: () => import_assets.getDefaultCdnBaseUrl,
133
+ getFontsFromRichText: () => import_richText.getFontsFromRichText,
132
134
  getFreshUserPreferences: () => import_TLUserPreferences.getFreshUserPreferences,
133
135
  getIncrementedName: () => import_getIncrementedName.getIncrementedName,
134
136
  getPerfectDashProps: () => import_getPerfectDashProps.getPerfectDashProps,
@@ -212,6 +214,7 @@ __export(index_exports, {
212
214
  useLocalStore: () => import_useLocalStore.useLocalStore,
213
215
  useMaybeEditor: () => import_useEditor.useMaybeEditor,
214
216
  useOnMount: () => import_TldrawEditor.useOnMount,
217
+ usePassThroughMouseOverEvents: () => import_usePassThroughMouseOverEvents.usePassThroughMouseOverEvents,
215
218
  usePassThroughWheelEvents: () => import_usePassThroughWheelEvents.usePassThroughWheelEvents,
216
219
  usePeerIds: () => import_usePeerIds.usePeerIds,
217
220
  usePresence: () => import_usePresence.usePresence,
@@ -231,6 +234,7 @@ __export(index_exports, {
231
234
  useTransform: () => import_useTransform.useTransform,
232
235
  useUniqueSafeId: () => import_useSafeId.useUniqueSafeId,
233
236
  useValue: () => import_state_react.useValue,
237
+ useViewportHeight: () => import_useViewportHeight.useViewportHeight,
234
238
  userTypeValidator: () => import_TLUserPreferences.userTypeValidator,
235
239
  whyAmIRunning: () => import_state.whyAmIRunning
236
240
  });
@@ -244,6 +248,7 @@ var import_replace_all = require("core-js/stable/string/replace-all.js");
244
248
  var import_state = require("@tldraw/state");
245
249
  var import_state_react = require("@tldraw/state-react");
246
250
  var import_resizeScaled = require("./lib/editor/shapes/shared/resizeScaled");
251
+ var import_richText = require("./lib/utils/richText");
247
252
  var import_LocalIndexedDb = require("./lib/utils/sync/LocalIndexedDb");
248
253
  __reExport(index_exports, require("@tldraw/store"), module.exports);
249
254
  __reExport(index_exports, require("@tldraw/tlschema"), module.exports);
@@ -282,6 +287,7 @@ var import_Editor = require("./lib/editor/Editor");
282
287
  var import_BindingUtil = require("./lib/editor/bindings/BindingUtil");
283
288
  var import_ClickManager = require("./lib/editor/managers/ClickManager");
284
289
  var import_EdgeScrollManager = require("./lib/editor/managers/EdgeScrollManager");
290
+ var import_FontManager = require("./lib/editor/managers/FontManager");
285
291
  var import_HistoryManager = require("./lib/editor/managers/HistoryManager");
286
292
  var import_ScribbleManager = require("./lib/editor/managers/ScribbleManager");
287
293
  var import_BoundsSnaps = require("./lib/editor/managers/SnapManager/BoundsSnaps");
@@ -314,6 +320,7 @@ var import_useIsCropping = require("./lib/hooks/useIsCropping");
314
320
  var import_useIsDarkMode = require("./lib/hooks/useIsDarkMode");
315
321
  var import_useIsEditing = require("./lib/hooks/useIsEditing");
316
322
  var import_useLocalStore = require("./lib/hooks/useLocalStore");
323
+ var import_usePassThroughMouseOverEvents = require("./lib/hooks/usePassThroughMouseOverEvents");
317
324
  var import_usePassThroughWheelEvents = require("./lib/hooks/usePassThroughWheelEvents");
318
325
  var import_usePeerIds = require("./lib/hooks/usePeerIds");
319
326
  var import_usePresence = require("./lib/hooks/usePresence");
@@ -322,6 +329,7 @@ var import_useSafeId = require("./lib/hooks/useSafeId");
322
329
  var import_useSelectionEvents = require("./lib/hooks/useSelectionEvents");
323
330
  var import_useTLStore = require("./lib/hooks/useTLStore");
324
331
  var import_useTransform = require("./lib/hooks/useTransform");
332
+ var import_useViewportHeight = require("./lib/hooks/useViewportHeight");
325
333
  var import_LicenseManager = require("./lib/license/LicenseManager");
326
334
  var import_options = require("./lib/options");
327
335
  var import_Box = require("./lib/primitives/Box");
@@ -366,7 +374,7 @@ function debugEnableLicensing() {
366
374
  }
367
375
  (0, import_utils.registerTldrawLibraryVersion)(
368
376
  "@tldraw/editor",
369
- "3.10.0-canary.d4dfa96478a4",
377
+ "3.10.0-canary.e5f41d07faf1",
370
378
  "cjs"
371
379
  );
372
380
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nimport 'core-js/stable/array/at.js'\nimport 'core-js/stable/array/flat-map.js'\nimport 'core-js/stable/array/flat.js'\nimport 'core-js/stable/string/at.js'\nimport 'core-js/stable/string/replace-all.js'\nexport {\n\tEMPTY_ARRAY,\n\tEffectScheduler,\n\tatom,\n\tcomputed,\n\treact,\n\ttransact,\n\ttransaction,\n\twhyAmIRunning,\n\ttype Atom,\n\ttype Signal,\n} from '@tldraw/state'\nexport {\n\ttrack,\n\tuseAtom,\n\tuseComputed,\n\tuseQuickReactor,\n\tuseReactor,\n\tuseStateTracking,\n\tuseValue,\n} from '@tldraw/state-react'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/validate'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TLOnMountHandler,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n} from './lib/TldrawEditor'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport { DefaultBrush, type TLBrushProps } from './lib/components/default-components/DefaultBrush'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCollaboratorHint,\n\ttype TLCollaboratorHintProps,\n} from './lib/components/default-components/DefaultCollaboratorHint'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport {\n\tDefaultHandle,\n\ttype TLHandleProps,\n} from './lib/components/default-components/DefaultHandle'\nexport {\n\tDefaultHandles,\n\ttype TLHandlesProps,\n} from './lib/components/default-components/DefaultHandles'\nexport {\n\tDefaultScribble,\n\ttype TLScribbleProps,\n} from './lib/components/default-components/DefaultScribble'\nexport {\n\tDefaultSelectionBackground,\n\ttype TLSelectionBackgroundProps,\n} from './lib/components/default-components/DefaultSelectionBackground'\nexport {\n\tDefaultSelectionForeground,\n\ttype TLSelectionForegroundProps,\n} from './lib/components/default-components/DefaultSelectionForeground'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeIndicator,\n\ttype TLShapeIndicatorProps,\n} from './lib/components/default-components/DefaultShapeIndicator'\nexport { type TLShapeIndicatorErrorFallbackComponent } from './lib/components/default-components/DefaultShapeIndicatorErrorFallback'\nexport { DefaultShapeIndicators } from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultSnapIndicator,\n\ttype TLSnapIndicatorProps,\n} from './lib/components/default-components/DefaultSnapIndictor'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tTAB_ID,\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tUSER_COLORS,\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { createTLUser, useTldrawUser, type TLUser } from './lib/config/createTLUser'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager'\nexport { ScribbleManager, type ScribbleItem } from './lib/editor/managers/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport { TextManager, type TLMeasureTextSpanOpts } from './lib/editor/managers/TextManager'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport { getPerfectDashProps } from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLSvgOptions,\n} from './lib/editor/types/misc-types'\nexport { type TLResizeHandle, type TLSelectionHandle } from './lib/editor/types/selection-types'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { getCursor } from './lib/hooks/useCursor'\nexport { EditorContext, useEditor, useMaybeEditor } from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsDarkMode } from './lib/hooks/useIsDarkMode'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useSelectionEvents } from './lib/hooks/useSelectionEvents'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useTransform } from './lib/hooks/useTransform'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype TestEnvironment,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { defaultTldrawOptions, type TldrawOptions } from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { Geometry2d, type Geometry2dOptions } from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport {\n\tHALF_PI,\n\tPI,\n\tPI2,\n\tSIN,\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { hardResetEditor } from './lib/utils/hardResetEditor'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { refreshPage } from './lib/utils/refreshPage'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport { runtime, setRuntimeOverrides } from './lib/utils/runtime'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { uniq } from './lib/utils/uniq'\nexport { openWindow } from './lib/utils/window-open'\n\n/**\n * @deprecated Licensing is now enabled in the tldraw SDK.\n * @public */\nexport function debugEnableLicensing() {\n\t// noop\n\treturn\n}\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AAiD;AACjD,0BAA6B;AAC7B,4BAQO;AACP,qBAAyD;AACzD,iBASO;AACP,iBAAiD;AACjD,iBAAkC;AAClC,qBAAwB;AACxB,mBAAsB;AACtB,sBAAyB;AACzB,2BAA8B;AAC9B,2BAA8B;AAC9B,oBAAuB;AACvB,uBAA0B;AAC1B,wBAAmD;AACnD,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,wBAA2B;AAC3B,yBAA4B;AAC5B,uBAA0B;AAC1B,uBAaO;AACP,IAAAC,gBAgCO;AACP,6BAIO;AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAMO;AACP,uBAKO;AACP,iBAOO;AACP,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,6BAAgC;AAChC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAA4B;AAC5B,sBAIO;AACP,qBAA6C;AAE7C,uBAA0B;AAC1B,kBAAqB;AACrB,yBAA2B;AAKpB,SAAS,uBAAuB;AAEtC;AACD;AAAA,IAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nimport 'core-js/stable/array/at.js'\nimport 'core-js/stable/array/flat-map.js'\nimport 'core-js/stable/array/flat.js'\nimport 'core-js/stable/string/at.js'\nimport 'core-js/stable/string/replace-all.js'\nexport {\n\tEMPTY_ARRAY,\n\tEffectScheduler,\n\tatom,\n\tcomputed,\n\treact,\n\ttransact,\n\ttransaction,\n\twhyAmIRunning,\n\ttype Atom,\n\ttype Signal,\n} from '@tldraw/state'\nexport {\n\ttrack,\n\tuseAtom,\n\tuseComputed,\n\tuseQuickReactor,\n\tuseReactor,\n\tuseStateTracking,\n\tuseValue,\n} from '@tldraw/state-react'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TLTextOptions,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n} from './lib/utils/richText'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/validate'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TLOnMountHandler,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n} from './lib/TldrawEditor'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport { DefaultBrush, type TLBrushProps } from './lib/components/default-components/DefaultBrush'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCollaboratorHint,\n\ttype TLCollaboratorHintProps,\n} from './lib/components/default-components/DefaultCollaboratorHint'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport {\n\tDefaultHandle,\n\ttype TLHandleProps,\n} from './lib/components/default-components/DefaultHandle'\nexport {\n\tDefaultHandles,\n\ttype TLHandlesProps,\n} from './lib/components/default-components/DefaultHandles'\nexport {\n\tDefaultScribble,\n\ttype TLScribbleProps,\n} from './lib/components/default-components/DefaultScribble'\nexport {\n\tDefaultSelectionBackground,\n\ttype TLSelectionBackgroundProps,\n} from './lib/components/default-components/DefaultSelectionBackground'\nexport {\n\tDefaultSelectionForeground,\n\ttype TLSelectionForegroundProps,\n} from './lib/components/default-components/DefaultSelectionForeground'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeIndicator,\n\ttype TLShapeIndicatorProps,\n} from './lib/components/default-components/DefaultShapeIndicator'\nexport { type TLShapeIndicatorErrorFallbackComponent } from './lib/components/default-components/DefaultShapeIndicatorErrorFallback'\nexport { DefaultShapeIndicators } from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultSnapIndicator,\n\ttype TLSnapIndicatorProps,\n} from './lib/components/default-components/DefaultSnapIndictor'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tTAB_ID,\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tUSER_COLORS,\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { createTLUser, useTldrawUser, type TLUser } from './lib/config/createTLUser'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager'\nexport {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} from './lib/editor/managers/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager'\nexport { ScribbleManager, type ScribbleItem } from './lib/editor/managers/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport { TextManager, type TLMeasureTextSpanOpts } from './lib/editor/managers/TextManager'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport { getPerfectDashProps } from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLSvgOptions,\n} from './lib/editor/types/misc-types'\nexport { type TLResizeHandle, type TLSelectionHandle } from './lib/editor/types/selection-types'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { getCursor } from './lib/hooks/useCursor'\nexport { EditorContext, useEditor, useMaybeEditor } from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsDarkMode } from './lib/hooks/useIsDarkMode'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughMouseOverEvents } from './lib/hooks/usePassThroughMouseOverEvents'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useSelectionEvents } from './lib/hooks/useSelectionEvents'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype TestEnvironment,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { defaultTldrawOptions, type TldrawOptions } from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { Geometry2d, type Geometry2dOptions } from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport {\n\tHALF_PI,\n\tPI,\n\tPI2,\n\tSIN,\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { hardResetEditor } from './lib/utils/hardResetEditor'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { refreshPage } from './lib/utils/refreshPage'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport { runtime, setRuntimeOverrides } from './lib/utils/runtime'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { uniq } from './lib/utils/uniq'\nexport { openWindow } from './lib/utils/window-open'\n\n/**\n * @deprecated Licensing is now enabled in the tldraw SDK.\n * @public */\nexport function debugEnableLicensing() {\n\t// noop\n\treturn\n}\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY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C;AACpC,yBAAkE;AAClE,2BAA8B;AAC9B,2BAA8B;AAC9B,0BAA6B;AAC7B,2BAA8B;AAC9B,2CAA8C;AAC9C,uCAA0C;AAC1C,wBAA2B;AAC3B,yBAA4B;AAC5B,yBAA4B;AAC5B,uBAMO;AACP,gCAAmC;AACnC,wBAAiD;AACjD,0BAA6B;AAC7B,+BAAkC;AAClC,4BAQO;AACP,qBAAyD;AACzD,iBASO;AACP,iBAAiD;AACjD,iBAAkC;AAClC,qBAAwB;AACxB,mBAAsB;AACtB,sBAAyB;AACzB,2BAA8B;AAC9B,2BAA8B;AAC9B,oBAAuB;AACvB,uBAA0B;AAC1B,wBAAmD;AACnD,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,wBAA2B;AAC3B,yBAA4B;AAC5B,uBAA0B;AAC1B,uBAaO;AACP,IAAAC,gBAgCO;AACP,6BAIO;AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAMO;AACP,uBAKO;AACP,iBAOO;AACP,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,6BAAgC;AAChC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAA4B;AAC5B,sBAIO;AACP,qBAA6C;AAE7C,uBAA0B;AAC1B,kBAAqB;AACrB,yBAA2B;AAKpB,SAAS,uBAAuB;AAEtC;AACD;AAAA,IAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": ["import_at", "import_utils"]
7
7
  }
@@ -182,10 +182,12 @@ function TldrawEditorWithReadyStore({
182
182
  autoFocus = true,
183
183
  inferDarkMode,
184
184
  cameraOptions,
185
+ textOptions,
185
186
  options,
186
187
  licenseKey,
187
188
  deepLinks: _deepLinks,
188
- isShapeHidden
189
+ isShapeHidden,
190
+ assetUrls
189
191
  }) {
190
192
  const { ErrorFallback } = (0, import_useEditorComponents.useEditorComponents)();
191
193
  const container = (0, import_useContainer.useContainer)();
@@ -225,9 +227,11 @@ function TldrawEditorWithReadyStore({
225
227
  autoFocus: autoFocus2,
226
228
  inferDarkMode: inferDarkMode2,
227
229
  cameraOptions: cameraOptions2,
230
+ textOptions,
228
231
  options,
229
232
  licenseKey,
230
- isShapeHidden
233
+ isShapeHidden,
234
+ fontAssetUrls: assetUrls?.fonts
231
235
  });
232
236
  editor2.updateViewportScreenBounds(canvasRef.current ?? container);
233
237
  if (deepLinks2) {
@@ -253,7 +257,9 @@ function TldrawEditorWithReadyStore({
253
257
  user,
254
258
  setEditor,
255
259
  licenseKey,
256
- isShapeHidden
260
+ isShapeHidden,
261
+ textOptions,
262
+ assetUrls
257
263
  ]
258
264
  );
259
265
  (0, import_react.useLayoutEffect)(() => {
@@ -303,9 +309,29 @@ function TldrawEditorWithReadyStore({
303
309
  },
304
310
  [editor, autoFocus]
305
311
  );
306
- const { Canvas } = (0, import_useEditorComponents.useEditorComponents)();
307
- if (!editor) {
308
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tl-canvas", ref: canvasRef });
312
+ const [_fontLoadingState, setFontLoadingState] = (0, import_react.useState)(null);
313
+ let fontLoadingState = _fontLoadingState;
314
+ if (editor !== fontLoadingState?.editor) {
315
+ fontLoadingState = null;
316
+ }
317
+ (0, import_react.useEffect)(() => {
318
+ if (!editor) return;
319
+ let isCancelled = false;
320
+ setFontLoadingState({ editor, isLoaded: false });
321
+ editor.fonts.loadRequiredFontsForCurrentPage(editor.options.maxFontsToLoadBeforeRender).finally(() => {
322
+ if (isCancelled) return;
323
+ setFontLoadingState({ editor, isLoaded: true });
324
+ });
325
+ return () => {
326
+ isCancelled = true;
327
+ };
328
+ }, [editor]);
329
+ const { Canvas, LoadingScreen: LoadingScreen2 } = (0, import_useEditorComponents.useEditorComponents)();
330
+ if (!editor || !fontLoadingState?.isLoaded) {
331
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
332
+ LoadingScreen2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingScreen2, {}),
333
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tl-canvas", ref: canvasRef })
334
+ ] });
309
335
  }
310
336
  return (
311
337
  // the top-level tldraw component also renders an error boundary almost