@tldraw/editor 3.9.0-canary.fae364b5aba5 → 3.9.0-internal.7f0e15f4f7d9
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.
- package/dist-cjs/index.d.ts +228 -3
- package/dist-cjs/index.js +9 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +33 -6
- package/dist-cjs/lib/TldrawEditor.js.map +2 -2
- package/dist-cjs/lib/components/Shape.js +7 -0
- package/dist-cjs/lib/components/Shape.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +63 -8
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/FontManager.js +167 -0
- package/dist-cjs/lib/editor/managers/FontManager.js.map +7 -0
- package/dist-cjs/lib/editor/managers/TextManager.js +23 -17
- package/dist-cjs/lib/editor/managers/TextManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +11 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
- package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
- package/dist-cjs/lib/exports/FontEmbedder.js +7 -2
- package/dist-cjs/lib/exports/FontEmbedder.js.map +2 -2
- package/dist-cjs/lib/exports/StyleEmbedder.js +1 -1
- package/dist-cjs/lib/exports/StyleEmbedder.js.map +2 -2
- package/dist-cjs/lib/exports/exportToSvg.js +3 -2
- package/dist-cjs/lib/exports/exportToSvg.js.map +2 -2
- package/dist-cjs/lib/exports/getSvgAsImage.js +1 -1
- package/dist-cjs/lib/exports/getSvgAsImage.js.map +2 -2
- package/dist-cjs/lib/exports/getSvgJsx.js +18 -1
- package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
- package/dist-cjs/lib/exports/parseCss.js +1 -0
- package/dist-cjs/lib/exports/parseCss.js.map +2 -2
- package/dist-cjs/lib/globals/environment.js +3 -1
- package/dist-cjs/lib/globals/environment.js.map +2 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js +2 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js +1 -1
- package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js +48 -0
- package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +7 -0
- package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useViewportHeight.js +56 -0
- package/dist-cjs/lib/hooks/useViewportHeight.js.map +7 -0
- package/dist-cjs/lib/license/LicenseManager.js +1 -1
- package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
- package/dist-cjs/lib/options.js +2 -1
- package/dist-cjs/lib/options.js.map +2 -2
- package/dist-cjs/lib/utils/browserCanvasMaxSize.js +104 -28
- package/dist-cjs/lib/utils/browserCanvasMaxSize.js.map +3 -3
- package/dist-cjs/lib/utils/dom.js +1 -1
- package/dist-cjs/lib/utils/dom.js.map +2 -2
- package/dist-cjs/lib/utils/richText.js +46 -0
- package/dist-cjs/lib/utils/richText.js.map +7 -0
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +228 -3
- package/dist-esm/index.mjs +13 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +34 -7
- package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
- package/dist-esm/lib/components/Shape.mjs +8 -1
- package/dist-esm/lib/components/Shape.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +71 -9
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/FontManager.mjs +153 -0
- package/dist-esm/lib/editor/managers/FontManager.mjs.map +7 -0
- package/dist-esm/lib/editor/managers/TextManager.mjs +23 -17
- package/dist-esm/lib/editor/managers/TextManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +11 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/exports/FontEmbedder.mjs +7 -2
- package/dist-esm/lib/exports/FontEmbedder.mjs.map +2 -2
- package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -1
- package/dist-esm/lib/exports/StyleEmbedder.mjs.map +2 -2
- package/dist-esm/lib/exports/exportToSvg.mjs +3 -2
- package/dist-esm/lib/exports/exportToSvg.mjs.map +2 -2
- package/dist-esm/lib/exports/getSvgAsImage.mjs +1 -1
- package/dist-esm/lib/exports/getSvgAsImage.mjs.map +2 -2
- package/dist-esm/lib/exports/getSvgJsx.mjs +19 -2
- package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
- package/dist-esm/lib/exports/parseCss.mjs +1 -0
- package/dist-esm/lib/exports/parseCss.mjs.map +2 -2
- package/dist-esm/lib/globals/environment.mjs +3 -1
- package/dist-esm/lib/globals/environment.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs +1 -1
- package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs +28 -0
- package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +7 -0
- package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useViewportHeight.mjs +36 -0
- package/dist-esm/lib/hooks/useViewportHeight.mjs.map +7 -0
- package/dist-esm/lib/license/LicenseManager.mjs +1 -1
- package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
- package/dist-esm/lib/options.mjs +2 -1
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/lib/utils/browserCanvasMaxSize.mjs +104 -18
- package/dist-esm/lib/utils/browserCanvasMaxSize.mjs.map +2 -2
- package/dist-esm/lib/utils/dom.mjs +1 -1
- package/dist-esm/lib/utils/dom.mjs.map +2 -2
- package/dist-esm/lib/utils/richText.mjs +26 -0
- package/dist-esm/lib/utils/richText.mjs.map +7 -0
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +127 -13
- package/package.json +10 -9
- package/src/index.ts +15 -0
- package/src/lib/TldrawEditor.tsx +52 -4
- package/src/lib/components/Shape.tsx +9 -1
- package/src/lib/editor/Editor.ts +91 -7
- package/src/lib/editor/managers/FontManager.ts +252 -0
- package/src/lib/editor/managers/TextManager.ts +42 -17
- package/src/lib/editor/shapes/ShapeUtil.ts +13 -0
- package/src/lib/editor/types/emit-types.ts +1 -0
- package/src/lib/editor/types/external-content.ts +1 -0
- package/src/lib/exports/FontEmbedder.ts +13 -1
- package/src/lib/exports/StyleEmbedder.ts +1 -1
- package/src/lib/exports/exportToSvg.tsx +4 -3
- package/src/lib/exports/getSvgAsImage.ts +1 -1
- package/src/lib/exports/getSvgJsx.tsx +22 -2
- package/src/lib/exports/parseCss.ts +1 -0
- package/src/lib/globals/environment.ts +3 -0
- package/src/lib/hooks/useCanvasEvents.ts +2 -1
- package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +1 -0
- package/src/lib/hooks/usePassThroughMouseOverEvents.ts +29 -0
- package/src/lib/hooks/usePassThroughWheelEvents.ts +0 -1
- package/src/lib/hooks/useViewportHeight.ts +37 -0
- package/src/lib/license/LicenseManager.test.ts +16 -13
- package/src/lib/license/LicenseManager.ts +2 -2
- package/src/lib/options.ts +7 -0
- package/src/lib/utils/browserCanvasMaxSize.ts +121 -21
- package/src/lib/utils/dom.ts +1 -1
- package/src/lib/utils/richText.ts +72 -0
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -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,7 @@ 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
|
+
constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, textOptions, initialState, autoFocus, inferDarkMode, options, isShapeHidden, fontAssetUrls, }: TLEditorOptions);
|
|
983
988
|
private readonly _isShapeHiddenPredicate?;
|
|
984
989
|
private getIsShapeHiddenCache;
|
|
985
990
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
@@ -1040,6 +1045,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1040
1045
|
* @public
|
|
1041
1046
|
*/
|
|
1042
1047
|
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;
|
|
1043
1054
|
/**
|
|
1044
1055
|
* A manager for the editor's environment.
|
|
1045
1056
|
*
|
|
@@ -1047,6 +1058,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1047
1058
|
* @public
|
|
1048
1059
|
*/
|
|
1049
1060
|
readonly environment: {
|
|
1061
|
+
hasCanvasSupport: boolean;
|
|
1050
1062
|
isAndroid: boolean;
|
|
1051
1063
|
isChromeForIos: boolean;
|
|
1052
1064
|
isDarwin: boolean;
|
|
@@ -1678,6 +1690,26 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1678
1690
|
* @public
|
|
1679
1691
|
*/
|
|
1680
1692
|
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;
|
|
1681
1713
|
/**
|
|
1682
1714
|
* The current hovered shape id.
|
|
1683
1715
|
*
|
|
@@ -1778,6 +1810,17 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1778
1810
|
* @public
|
|
1779
1811
|
*/
|
|
1780
1812
|
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;
|
|
1781
1824
|
/* Excluded from this release type: _unsafe_getCameraId */
|
|
1782
1825
|
/**
|
|
1783
1826
|
* The current camera.
|
|
@@ -3182,7 +3225,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3182
3225
|
* @example
|
|
3183
3226
|
* ```ts
|
|
3184
3227
|
* editor.createShape(myShape)
|
|
3185
|
-
* editor.createShape({ id: 'box1', type: 'text', props: {
|
|
3228
|
+
* editor.createShape({ id: 'box1', type: 'text', props: { richText: toRichText("ok") } })
|
|
3186
3229
|
* ```
|
|
3187
3230
|
*
|
|
3188
3231
|
* @param shape - The shape (or shape partial) to create.
|
|
@@ -3196,7 +3239,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3196
3239
|
* @example
|
|
3197
3240
|
* ```ts
|
|
3198
3241
|
* editor.createShapes([myShape])
|
|
3199
|
-
* editor.createShapes([{ id: 'box1', type: 'text', props: {
|
|
3242
|
+
* editor.createShapes([{ id: 'box1', type: 'text', props: { richText: toRichText("ok") } }])
|
|
3200
3243
|
* ```
|
|
3201
3244
|
*
|
|
3202
3245
|
* @param shapes - The shapes (or shape partials) to create.
|
|
@@ -3955,6 +3998,27 @@ export declare const EVENT_NAME_MAP: Record<Exclude<TLEventName, TLPinchEventNam
|
|
|
3955
3998
|
|
|
3956
3999
|
/* Excluded from this release type: featureFlags */
|
|
3957
4000
|
|
|
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
|
+
|
|
3958
4022
|
/** @public */
|
|
3959
4023
|
export declare interface GapsSnapIndicator {
|
|
3960
4024
|
id: string;
|
|
@@ -4027,6 +4091,9 @@ export declare function getCursor(cursor: TLCursorType, rotation?: number, color
|
|
|
4027
4091
|
/** @public */
|
|
4028
4092
|
export declare function getDefaultCdnBaseUrl(): string;
|
|
4029
4093
|
|
|
4094
|
+
/** @public */
|
|
4095
|
+
export declare function getFontsFromRichText(editor: Editor, richText: TLRichText, initialState: RichTextFontVisitorState): TLFontFace[];
|
|
4096
|
+
|
|
4030
4097
|
/** @public */
|
|
4031
4098
|
export declare function getFreshUserPreferences(): TLUserPreferences;
|
|
4032
4099
|
|
|
@@ -4711,6 +4778,16 @@ export declare function resizeScaled(shape: TLBaseShape<any, {
|
|
|
4711
4778
|
y: number;
|
|
4712
4779
|
};
|
|
4713
4780
|
|
|
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
|
+
|
|
4714
4791
|
/** @public */
|
|
4715
4792
|
export declare const ROTATE_CORNER_TO_SELECTION_CORNER: {
|
|
4716
4793
|
readonly bottom_left_rotate: "bottom_left";
|
|
@@ -4892,6 +4969,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
4892
4969
|
* @public
|
|
4893
4970
|
*/
|
|
4894
4971
|
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[];
|
|
4895
4980
|
/**
|
|
4896
4981
|
* Whether the shape can be snapped to by another shape.
|
|
4897
4982
|
*
|
|
@@ -5544,6 +5629,24 @@ export declare class TextManager {
|
|
|
5544
5629
|
}): BoxModel & {
|
|
5545
5630
|
scrollWidth: number;
|
|
5546
5631
|
};
|
|
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
|
+
};
|
|
5547
5650
|
/**
|
|
5548
5651
|
* Given an html element, measure the position of each span of unbroken
|
|
5549
5652
|
* word/white-space characters within any text nodes it contains.
|
|
@@ -5571,6 +5674,19 @@ export declare class TextManager {
|
|
|
5571
5674
|
}[];
|
|
5572
5675
|
}
|
|
5573
5676
|
|
|
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
|
+
|
|
5574
5690
|
/** @public */
|
|
5575
5691
|
export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
|
|
5576
5692
|
|
|
@@ -5894,6 +6010,10 @@ export declare interface TldrawEditorBaseProps {
|
|
|
5894
6010
|
* Camera options for the editor.
|
|
5895
6011
|
*/
|
|
5896
6012
|
cameraOptions?: Partial<TLCameraOptions>;
|
|
6013
|
+
/**
|
|
6014
|
+
* Text options for the editor.
|
|
6015
|
+
*/
|
|
6016
|
+
textOptions?: TLTextOptions;
|
|
5897
6017
|
/**
|
|
5898
6018
|
* Options for the editor.
|
|
5899
6019
|
*/
|
|
@@ -5914,6 +6034,14 @@ export declare interface TldrawEditorBaseProps {
|
|
|
5914
6034
|
* remain in the store and participate in all other operations.
|
|
5915
6035
|
*/
|
|
5916
6036
|
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
|
+
};
|
|
5917
6045
|
}
|
|
5918
6046
|
|
|
5919
6047
|
/**
|
|
@@ -6037,6 +6165,12 @@ export declare interface TldrawOptions {
|
|
|
6037
6165
|
* By default, the toolbar items are accessible via number shortcuts according to their order. To disable this, set this option to false.
|
|
6038
6166
|
*/
|
|
6039
6167
|
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;
|
|
6040
6174
|
}
|
|
6041
6175
|
|
|
6042
6176
|
/** @public */
|
|
@@ -6114,8 +6248,12 @@ export declare interface TLEditorOptions {
|
|
|
6114
6248
|
* Options for the editor's camera.
|
|
6115
6249
|
*/
|
|
6116
6250
|
cameraOptions?: Partial<TLCameraOptions>;
|
|
6251
|
+
textOptions?: TLTextOptions;
|
|
6117
6252
|
options?: Partial<TldrawOptions>;
|
|
6118
6253
|
licenseKey?: string;
|
|
6254
|
+
fontAssetUrls?: {
|
|
6255
|
+
[key: string]: string | undefined;
|
|
6256
|
+
};
|
|
6119
6257
|
/**
|
|
6120
6258
|
* A predicate that should return true if the given shape should be hidden.
|
|
6121
6259
|
* @param shape - The shape to check.
|
|
@@ -6154,6 +6292,7 @@ export declare type TLEnterEventHandler = (info: any, from: string) => void;
|
|
|
6154
6292
|
* @public
|
|
6155
6293
|
*/
|
|
6156
6294
|
export declare const tlenv: {
|
|
6295
|
+
hasCanvasSupport: boolean;
|
|
6157
6296
|
isAndroid: boolean;
|
|
6158
6297
|
isChromeForIos: boolean;
|
|
6159
6298
|
isDarwin: boolean;
|
|
@@ -6229,6 +6368,13 @@ export declare interface TLEventMap {
|
|
|
6229
6368
|
'select-all-text': [{
|
|
6230
6369
|
shapeId: TLShapeId;
|
|
6231
6370
|
}];
|
|
6371
|
+
'place-caret': [{
|
|
6372
|
+
point: {
|
|
6373
|
+
x: number;
|
|
6374
|
+
y: number;
|
|
6375
|
+
};
|
|
6376
|
+
shapeId: TLShapeId;
|
|
6377
|
+
}];
|
|
6232
6378
|
}
|
|
6233
6379
|
|
|
6234
6380
|
/** @public */
|
|
@@ -6278,6 +6424,72 @@ export declare interface TLFilesExternalContent extends TLBaseExternalContent {
|
|
|
6278
6424
|
ignoreParent: boolean;
|
|
6279
6425
|
}
|
|
6280
6426
|
|
|
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.
|
|
6481
|
+
* @public
|
|
6482
|
+
*/
|
|
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;
|
|
6491
|
+
}
|
|
6492
|
+
|
|
6281
6493
|
/** @public */
|
|
6282
6494
|
export declare interface TLGridProps {
|
|
6283
6495
|
x: number;
|
|
@@ -6907,6 +7119,7 @@ export declare interface TLSvgTextExternalContent extends TLBaseExternalContent
|
|
|
6907
7119
|
export declare interface TLTextExternalContent extends TLBaseExternalContent {
|
|
6908
7120
|
type: 'text';
|
|
6909
7121
|
text: string;
|
|
7122
|
+
html?: string;
|
|
6910
7123
|
}
|
|
6911
7124
|
|
|
6912
7125
|
/** @public */
|
|
@@ -6916,6 +7129,12 @@ export declare interface TLTextExternalContentSource {
|
|
|
6916
7129
|
subtype: 'html' | 'json' | 'text' | 'url';
|
|
6917
7130
|
}
|
|
6918
7131
|
|
|
7132
|
+
/** @public */
|
|
7133
|
+
export declare interface TLTextOptions {
|
|
7134
|
+
tipTapConfig?: EditorProviderProps;
|
|
7135
|
+
addFontsFromNode?: RichTextFontVisitor;
|
|
7136
|
+
}
|
|
7137
|
+
|
|
6919
7138
|
/** @public */
|
|
6920
7139
|
export declare type TLTickEvent = (info: TLTickEventInfo) => void;
|
|
6921
7140
|
|
|
@@ -7087,6 +7306,9 @@ export declare function useMaybeEditor(): Editor | null;
|
|
|
7087
7306
|
|
|
7088
7307
|
/* Excluded from this release type: useOnMount */
|
|
7089
7308
|
|
|
7309
|
+
/** @public */
|
|
7310
|
+
export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement>): void;
|
|
7311
|
+
|
|
7090
7312
|
/** @public */
|
|
7091
7313
|
export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement>): void;
|
|
7092
7314
|
|
|
@@ -7198,6 +7420,9 @@ export declare function useUniqueSafeId(suffix?: string): SafeId;
|
|
|
7198
7420
|
|
|
7199
7421
|
export { useValue }
|
|
7200
7422
|
|
|
7423
|
+
/** @public */
|
|
7424
|
+
export declare function useViewportHeight(): number;
|
|
7425
|
+
|
|
7201
7426
|
/* Excluded from this release type: ValidLicenseKeyResult */
|
|
7202
7427
|
|
|
7203
7428
|
/** @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.9.0-
|
|
377
|
+
"3.9.0-internal.7f0e15f4f7d9",
|
|
370
378
|
"cjs"
|
|
371
379
|
);
|
|
372
380
|
//# sourceMappingURL=index.js.map
|
package/dist-cjs/index.js.map
CHANGED
|
@@ -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 TLHandleDragInfo,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6C;AAC7C,gBAAO;AACP,sBAAO;AACP,kBAAO;AACP,IAAAA,aAAO;AACP,yBAAO;AACP,mBAWO;AACP,yBAQO;AACP,0BAA6B;AAC7B,4BAAsD;AAEtD,0BAAc,
|
|
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 TLHandleDragInfo,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\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_MODULES\n)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6C;AAC7C,gBAAO;AACP,sBAAO;AACP,kBAAO;AACP,IAAAA,aAAO;AACP,yBAAO;AACP,mBAWO;AACP,yBAQO;AACP,0BAA6B;AAC7B,sBAOO;AACP,4BAAsD;AAEtD,0BAAc,0BAtCd;AAwCA,0BAAc,6BAxCd;AA0CA,0BAAc,0BA1Cd;AA4CA,0BAAc,6BA5Cd;AA6CA,0BAYO;AACP,2BAIO;AACP,2BAAuD;AACvD,8BAAiC;AACjC,0BAAqD;AACrD,+BAAkC;AAClC,0BAAgD;AAChD,2BAGO;AACP,qCAGO;AACP,2BAGO;AACP,kCAGO;AACP,yBAA8C;AAC9C,2BAGO;AACP,4BAGO;AACP,6BAGO;AACP,wCAGO;AACP,wCAGO;AAEP,mCAGO;AAEP,oCAAuC;AACvC,iCAGO;AACP,4BAA+B;AAC/B,4BAA+B;AAC/B,8BAKO;AACP,oCAOO;AACP,+BAQO;AACP,2BAQO;AACP,0BAAyD;AAEzD,2BAA2D;AAC3D,uBAAyE;AACzE,oBAMO;AACP,yBASO;AACP,0BAAgD;AAChD,+BAAkC;AAClC,yBAIO;AACP,4BAA+B;AAC/B,6BAAmD;AACnD,yBAIO;AACP,yBAAqD;AACrD,yBAMO;AACP,yBAAwD;AACxD,oCAAuC;AACvC,8BAAsD;AACtD,uBASO;AACP,4BAA+B;AAC/B,iCAAoC;AACpC,uBAAiD;AACjD,8BAAiC;AACjC,sBAAgC;AAChC,uBAAuD;AACvD,8BAKO;AAGP,yBAiCO;AAsCP,2BAA8B;AAC9B,yBAAsB;AACtB,mBAAwB;AACxB,kBAAuB;AACvB,0BAKO;AACP,uBAA0B;AAC1B,uBAAyD;AACzD,iCAAoC;AAEpC,sBAA2C;AAC3C,iCAAoC;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,30 @@ function TldrawEditorWithReadyStore({
|
|
|
303
309
|
},
|
|
304
310
|
[editor, autoFocus]
|
|
305
311
|
);
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
312
|
+
const [_fontLoadingState, setFontLoadingState] = (0, import_react.useState)(null);
|
|
313
|
+
let fontLoadingState = _fontLoadingState;
|
|
314
|
+
if (editor !== fontLoadingState?.editor) {
|
|
315
|
+
const newFontLoadingState = editor ? { editor, isLoaded: false } : null;
|
|
316
|
+
if (fontLoadingState !== newFontLoadingState) setFontLoadingState(newFontLoadingState);
|
|
317
|
+
fontLoadingState = newFontLoadingState;
|
|
318
|
+
}
|
|
319
|
+
(0, import_react.useEffect)(() => {
|
|
320
|
+
if (!editor) return;
|
|
321
|
+
let isCancelled = false;
|
|
322
|
+
editor.fonts.loadRequiredFontsForCurrentPage(editor.options.maxFontsToLoadBeforeRender).finally(() => {
|
|
323
|
+
if (isCancelled) return;
|
|
324
|
+
setFontLoadingState({ editor, isLoaded: true });
|
|
325
|
+
});
|
|
326
|
+
return () => {
|
|
327
|
+
isCancelled = true;
|
|
328
|
+
};
|
|
329
|
+
}, [editor]);
|
|
330
|
+
const { Canvas, LoadingScreen: LoadingScreen2 } = (0, import_useEditorComponents.useEditorComponents)();
|
|
331
|
+
if (!editor || !fontLoadingState?.isLoaded) {
|
|
332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
333
|
+
LoadingScreen2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingScreen2, {}),
|
|
334
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tl-canvas", ref: canvasRef })
|
|
335
|
+
] });
|
|
309
336
|
}
|
|
310
337
|
return (
|
|
311
338
|
// the top-level tldraw component also renders an error boundary almost
|