@tldraw/editor 4.4.0-canary.3d13b40b6c39 → 4.4.0-canary.3e1f7ed3c557
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 +106 -22
- package/dist-cjs/index.js +4 -7
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +20 -8
- package/dist-cjs/lib/TldrawEditor.js.map +2 -2
- package/dist-cjs/lib/components/Shape.js +12 -17
- package/dist-cjs/lib/components/Shape.js.map +2 -2
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js +26 -1
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +16 -1
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +3 -4
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +34 -6
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/notVisibleShapes.js +32 -13
- package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +2 -2
- package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +2 -3
- package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js +10 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/usePeerIds.js +8 -2
- package/dist-cjs/lib/hooks/usePeerIds.js.map +2 -2
- package/dist-cjs/lib/hooks/useShapeCulling.js +75 -0
- package/dist-cjs/lib/hooks/useShapeCulling.js.map +7 -0
- package/dist-cjs/lib/options.js +7 -1
- package/dist-cjs/lib/options.js.map +2 -2
- package/dist-cjs/lib/utils/areShapesContentEqual.js +3 -1
- package/dist-cjs/lib/utils/areShapesContentEqual.js.map +2 -2
- package/dist-cjs/lib/utils/assets.js +4 -6
- package/dist-cjs/lib/utils/assets.js.map +2 -2
- package/dist-cjs/lib/utils/browserCanvasMaxSize.js +1 -2
- package/dist-cjs/lib/utils/browserCanvasMaxSize.js.map +2 -2
- package/dist-cjs/lib/utils/debug-flags.js.map +2 -2
- package/dist-cjs/lib/utils/dom.js +3 -3
- package/dist-cjs/lib/utils/dom.js.map +2 -2
- package/dist-cjs/lib/utils/getIncrementedName.js +1 -1
- package/dist-cjs/lib/utils/getIncrementedName.js.map +2 -2
- package/dist-cjs/lib/utils/getPointerInfo.js.map +2 -2
- package/dist-cjs/lib/utils/getSvgPathFromPoints.js.map +1 -1
- package/dist-cjs/lib/utils/keyboard.js +2 -2
- package/dist-cjs/lib/utils/keyboard.js.map +2 -2
- package/dist-cjs/lib/utils/normalizeWheel.js +2 -5
- package/dist-cjs/lib/utils/normalizeWheel.js.map +2 -2
- package/dist-cjs/lib/utils/reorderShapes.js +6 -6
- package/dist-cjs/lib/utils/reorderShapes.js.map +2 -2
- package/dist-cjs/lib/utils/reparenting.js +3 -4
- package/dist-cjs/lib/utils/reparenting.js.map +2 -2
- package/dist-cjs/lib/utils/runtime.js +12 -0
- package/dist-cjs/lib/utils/runtime.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +106 -22
- package/dist-esm/index.mjs +8 -5
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +20 -8
- package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
- package/dist-esm/lib/components/Shape.mjs +12 -17
- package/dist-esm/lib/components/Shape.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs +27 -2
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +16 -1
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +1 -2
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +34 -6
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs +32 -13
- package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +2 -3
- package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +10 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePeerIds.mjs +8 -2
- package/dist-esm/lib/hooks/usePeerIds.mjs.map +2 -2
- package/dist-esm/lib/hooks/useShapeCulling.mjs +55 -0
- package/dist-esm/lib/hooks/useShapeCulling.mjs.map +7 -0
- package/dist-esm/lib/options.mjs +7 -1
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/lib/utils/areShapesContentEqual.mjs +3 -1
- package/dist-esm/lib/utils/areShapesContentEqual.mjs.map +2 -2
- package/dist-esm/lib/utils/assets.mjs +4 -6
- package/dist-esm/lib/utils/assets.mjs.map +2 -2
- package/dist-esm/lib/utils/browserCanvasMaxSize.mjs +1 -2
- package/dist-esm/lib/utils/browserCanvasMaxSize.mjs.map +2 -2
- package/dist-esm/lib/utils/debug-flags.mjs.map +2 -2
- package/dist-esm/lib/utils/dom.mjs +3 -3
- package/dist-esm/lib/utils/dom.mjs.map +2 -2
- package/dist-esm/lib/utils/getIncrementedName.mjs +1 -1
- package/dist-esm/lib/utils/getIncrementedName.mjs.map +2 -2
- package/dist-esm/lib/utils/getPointerInfo.mjs.map +2 -2
- package/dist-esm/lib/utils/getSvgPathFromPoints.mjs.map +1 -1
- package/dist-esm/lib/utils/keyboard.mjs +2 -2
- package/dist-esm/lib/utils/keyboard.mjs.map +2 -2
- package/dist-esm/lib/utils/normalizeWheel.mjs +2 -5
- package/dist-esm/lib/utils/normalizeWheel.mjs.map +2 -2
- package/dist-esm/lib/utils/reorderShapes.mjs +6 -6
- package/dist-esm/lib/utils/reorderShapes.mjs.map +2 -2
- package/dist-esm/lib/utils/reparenting.mjs +3 -4
- package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
- package/dist-esm/lib/utils/runtime.mjs +12 -0
- package/dist-esm/lib/utils/runtime.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +13 -2
- package/package.json +9 -9
- package/src/index.ts +7 -4
- package/src/lib/TldrawEditor.tsx +34 -12
- package/src/lib/components/Shape.tsx +15 -16
- package/src/lib/components/default-components/CanvasShapeIndicators.tsx +46 -2
- package/src/lib/components/default-components/DefaultCanvas.tsx +24 -2
- package/src/lib/components/default-components/DefaultErrorFallback.tsx +1 -2
- package/src/lib/editor/Editor.ts +56 -7
- package/src/lib/editor/derivations/notVisibleShapes.ts +39 -17
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +0 -35
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +4 -8
- package/src/lib/editor/shapes/ShapeUtil.ts +19 -5
- package/src/lib/hooks/useCanvasEvents.ts +13 -2
- package/src/lib/hooks/usePeerIds.ts +9 -2
- package/src/lib/hooks/useShapeCulling.tsx +98 -0
- package/src/lib/options.ts +50 -0
- package/src/lib/utils/areShapesContentEqual.ts +9 -2
- package/src/lib/utils/assets.ts +15 -10
- package/src/lib/utils/browserCanvasMaxSize.ts +4 -2
- package/src/lib/utils/debug-flags.ts +0 -20
- package/src/lib/utils/dom.ts +6 -7
- package/src/lib/utils/getIncrementedName.ts +1 -1
- package/src/lib/utils/getPointerInfo.ts +1 -0
- package/src/lib/utils/getSvgPathFromPoints.ts +1 -1
- package/src/lib/utils/keyboard.ts +6 -4
- package/src/lib/utils/normalizeWheel.ts +8 -8
- package/src/lib/utils/reorderShapes.ts +16 -7
- package/src/lib/utils/reparenting.ts +5 -10
- package/src/lib/utils/runtime.ts +26 -1
- package/src/version.ts +3 -3
- package/dist-cjs/lib/utils/hardResetEditor.js +0 -28
- package/dist-cjs/lib/utils/hardResetEditor.js.map +0 -7
- package/dist-cjs/lib/utils/refreshPage.js +0 -28
- package/dist-cjs/lib/utils/refreshPage.js.map +0 -7
- package/dist-cjs/lib/utils/window-open.js +0 -28
- package/dist-cjs/lib/utils/window-open.js.map +0 -7
- package/dist-esm/lib/utils/hardResetEditor.mjs +0 -8
- package/dist-esm/lib/utils/hardResetEditor.mjs.map +0 -7
- package/dist-esm/lib/utils/refreshPage.mjs +0 -8
- package/dist-esm/lib/utils/refreshPage.mjs.map +0 -7
- package/dist-esm/lib/utils/window-open.mjs +0 -8
- package/dist-esm/lib/utils/window-open.mjs.map +0 -7
- package/src/lib/utils/hardResetEditor.ts +0 -6
- package/src/lib/utils/refreshPage.ts +0 -6
- package/src/lib/utils/window-open.ts +0 -16
package/dist-cjs/index.d.ts
CHANGED
|
@@ -769,7 +769,13 @@ export declare class CubicSpline2d extends Geometry2d {
|
|
|
769
769
|
getSvgPathData(): string;
|
|
770
770
|
}
|
|
771
771
|
|
|
772
|
-
/**
|
|
772
|
+
/**
|
|
773
|
+
* Converts a data URL to a file.
|
|
774
|
+
* @param url - The data URL to convert.
|
|
775
|
+
* @param filename - The name of the file.
|
|
776
|
+
* @param mimeType - The MIME type of the file.
|
|
777
|
+
* @returns A promise that resolves to a file.
|
|
778
|
+
* @public */
|
|
773
779
|
export declare function dataUrlToFile(url: string, filename: string, mimeType: string): Promise<File>;
|
|
774
780
|
|
|
775
781
|
/** @public */
|
|
@@ -857,6 +863,7 @@ export declare const defaultTldrawOptions: {
|
|
|
857
863
|
readonly actionShortcutsLocation: "swap";
|
|
858
864
|
readonly adjacentShapeMargin: 10;
|
|
859
865
|
readonly animationMediumMs: 320;
|
|
866
|
+
readonly camera: TLCameraOptions;
|
|
860
867
|
readonly cameraMovingTimeoutMs: 64;
|
|
861
868
|
readonly cameraSlideFriction: 0.09;
|
|
862
869
|
readonly coarseDragDistanceSquared: 36;
|
|
@@ -868,6 +875,7 @@ export declare const defaultTldrawOptions: {
|
|
|
868
875
|
readonly createTextOnCanvasDoubleClick: true;
|
|
869
876
|
readonly debouncedZoom: true;
|
|
870
877
|
readonly debouncedZoomThreshold: 500;
|
|
878
|
+
readonly deepLinks: undefined;
|
|
871
879
|
readonly defaultSvgPadding: 32;
|
|
872
880
|
readonly doubleClickDurationMs: 450;
|
|
873
881
|
readonly dragDistanceSquared: 16;
|
|
@@ -876,6 +884,7 @@ export declare const defaultTldrawOptions: {
|
|
|
876
884
|
readonly edgeScrollEaseDuration: 200;
|
|
877
885
|
readonly edgeScrollSpeed: 25;
|
|
878
886
|
readonly enableToolbarKeyboardShortcuts: true;
|
|
887
|
+
readonly experimental__onDropOnCanvas: undefined;
|
|
879
888
|
readonly exportProvider: ExoticComponent<FragmentProps>;
|
|
880
889
|
readonly flattenImageBoundsExpand: 64;
|
|
881
890
|
readonly flattenImageBoundsPadding: 16;
|
|
@@ -909,9 +918,11 @@ export declare const defaultTldrawOptions: {
|
|
|
909
918
|
readonly maxShapesPerPage: 4000;
|
|
910
919
|
readonly multiClickDurationMs: 200;
|
|
911
920
|
readonly nonce: undefined;
|
|
921
|
+
readonly quickZoomPreservesScreenBounds: true;
|
|
912
922
|
readonly snapThreshold: 8;
|
|
913
923
|
readonly spacebarPanning: true;
|
|
914
924
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
925
|
+
readonly text: {};
|
|
915
926
|
readonly textShadowLod: 0.35;
|
|
916
927
|
readonly tooltipDelayMs: 700;
|
|
917
928
|
readonly uiCoarseDragDistanceSquared: 625;
|
|
@@ -1011,7 +1022,7 @@ export declare class EdgeScrollManager {
|
|
|
1011
1022
|
/** @public */
|
|
1012
1023
|
export declare class Editor extends EventEmitter<TLEventMap> {
|
|
1013
1024
|
readonly id: string;
|
|
1014
|
-
constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions,
|
|
1025
|
+
constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, initialState, autoFocus, inferDarkMode, options: _options, textOptions: _textOptions, getShapeVisibility, fontAssetUrls, }: TLEditorOptions);
|
|
1015
1026
|
private readonly _getShapeVisibility?;
|
|
1016
1027
|
private getIsShapeHiddenCache;
|
|
1017
1028
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
@@ -4304,7 +4315,10 @@ export declare function getArcMeasure(A: number, B: number, sweepFlag: number, l
|
|
|
4304
4315
|
/** @public */
|
|
4305
4316
|
export declare function getCursor(cursor: TLCursorType, rotation?: number, color?: string): string;
|
|
4306
4317
|
|
|
4307
|
-
/**
|
|
4318
|
+
/**
|
|
4319
|
+
* Gets the default CDN base URL.
|
|
4320
|
+
* @returns The default CDN base URL.
|
|
4321
|
+
* @public */
|
|
4308
4322
|
export declare function getDefaultCdnBaseUrl(): string;
|
|
4309
4323
|
|
|
4310
4324
|
/**
|
|
@@ -4353,7 +4367,7 @@ export declare function getPerfectDashProps(totalLength: number, strokeWidth: nu
|
|
|
4353
4367
|
};
|
|
4354
4368
|
|
|
4355
4369
|
/** @public */
|
|
4356
|
-
export declare function getPointerInfo(editor: Editor, e: PointerEvent |
|
|
4370
|
+
export declare function getPointerInfo(editor: Editor, e: PointerEvent | React_3.PointerEvent): {
|
|
4357
4371
|
accelKey: boolean;
|
|
4358
4372
|
altKey: boolean;
|
|
4359
4373
|
button: number;
|
|
@@ -4414,7 +4428,7 @@ export declare function getSvgAsImage(svgString: string, options: {
|
|
|
4414
4428
|
}): Promise<Blob | null>;
|
|
4415
4429
|
|
|
4416
4430
|
/**
|
|
4417
|
-
* Turn an array of points into a path of
|
|
4431
|
+
* Turn an array of points into a path of quadratic curves.
|
|
4418
4432
|
*
|
|
4419
4433
|
* @param points - The points returned from perfect-freehand
|
|
4420
4434
|
* @param closed - Whether the stroke is closed
|
|
@@ -4924,7 +4938,6 @@ export declare const isSafeFloat: (n: number) => boolean;
|
|
|
4924
4938
|
|
|
4925
4939
|
/**
|
|
4926
4940
|
* Reparents shapes that are no longer contained within their parent shapes.
|
|
4927
|
-
* todo: rename me to something more descriptive, like `reparentOccludedShapes` or `reparentAutoDroppedShapes`
|
|
4928
4941
|
*
|
|
4929
4942
|
* @param editor - The editor instance.
|
|
4930
4943
|
* @param shapeIds - The IDs of the shapes to reparent.
|
|
@@ -5183,16 +5196,16 @@ export declare function precise(A: VecLike): string;
|
|
|
5183
5196
|
/**
|
|
5184
5197
|
* This function calls `event.preventDefault()` for you. Why is that useful?
|
|
5185
5198
|
*
|
|
5186
|
-
*
|
|
5199
|
+
* Because if you enable `window.preventDefaultLogging = true` it'll log out a message when it
|
|
5187
5200
|
* happens. Because we use console.warn rather than (log) you'll get a stack trace in the inspector
|
|
5188
5201
|
* telling you exactly where it happened. This is important because `e.preventDefault()` is the
|
|
5189
|
-
* source of many bugs, but
|
|
5202
|
+
* source of many bugs, but unfortunately it can't be avoided because it also stops a lot of default
|
|
5190
5203
|
* behaviour which doesn't make sense in our UI
|
|
5191
5204
|
*
|
|
5192
5205
|
* @param event - To prevent default on
|
|
5193
5206
|
* @public
|
|
5194
5207
|
*/
|
|
5195
|
-
export declare function preventDefault(event: Event |
|
|
5208
|
+
export declare function preventDefault(event: Event | React.BaseSyntheticEvent): void;
|
|
5196
5209
|
|
|
5197
5210
|
/**
|
|
5198
5211
|
* Convert radians to degrees.
|
|
@@ -5254,7 +5267,7 @@ export declare class Rectangle2d extends Polygon2d {
|
|
|
5254
5267
|
export declare function refreshPage(): void;
|
|
5255
5268
|
|
|
5256
5269
|
/** @public */
|
|
5257
|
-
export declare function releasePointerCapture(element: Element, event: PointerEvent |
|
|
5270
|
+
export declare function releasePointerCapture(element: Element, event: PointerEvent | React.PointerEvent<Element>): void;
|
|
5258
5271
|
|
|
5259
5272
|
/** @public */
|
|
5260
5273
|
export declare type RequiredKeys<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
|
@@ -5322,7 +5335,7 @@ export declare function rotateSelectionHandle(handle: SelectionHandle, rotation:
|
|
|
5322
5335
|
|
|
5323
5336
|
/** @public */
|
|
5324
5337
|
export declare const runtime: {
|
|
5325
|
-
hardReset(): void
|
|
5338
|
+
hardReset(): Promise<void>;
|
|
5326
5339
|
openWindow(url: string, target: string, allowReferrer?: boolean): void;
|
|
5327
5340
|
refreshPage(): void;
|
|
5328
5341
|
};
|
|
@@ -5514,7 +5527,7 @@ export declare type SelectionEdge = 'bottom' | 'left' | 'right' | 'top';
|
|
|
5514
5527
|
export declare type SelectionHandle = SelectionCorner | SelectionEdge;
|
|
5515
5528
|
|
|
5516
5529
|
/** @public */
|
|
5517
|
-
export declare function setPointerCapture(element: Element, event: PointerEvent |
|
|
5530
|
+
export declare function setPointerCapture(element: Element, event: PointerEvent | React.PointerEvent<Element>): void;
|
|
5518
5531
|
|
|
5519
5532
|
/** @public */
|
|
5520
5533
|
export declare function setRuntimeOverrides(input: Partial<typeof runtime>): void;
|
|
@@ -6844,22 +6857,28 @@ export declare interface TldrawEditorBaseProps {
|
|
|
6844
6857
|
inferDarkMode?: boolean;
|
|
6845
6858
|
/**
|
|
6846
6859
|
* Camera options for the editor.
|
|
6860
|
+
*
|
|
6861
|
+
* @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
|
|
6847
6862
|
*/
|
|
6848
6863
|
cameraOptions?: Partial<TLCameraOptions>;
|
|
6849
|
-
/**
|
|
6850
|
-
* Text options for the editor.
|
|
6851
|
-
*/
|
|
6852
|
-
textOptions?: TLTextOptions;
|
|
6853
6864
|
/**
|
|
6854
6865
|
* Options for the editor.
|
|
6855
6866
|
*/
|
|
6856
6867
|
options?: Partial<TldrawOptions>;
|
|
6868
|
+
/**
|
|
6869
|
+
* Text options for the editor.
|
|
6870
|
+
*
|
|
6871
|
+
* @deprecated Use `options.text` instead. This prop will be removed in a future release.
|
|
6872
|
+
*/
|
|
6873
|
+
textOptions?: TLTextOptions;
|
|
6857
6874
|
/**
|
|
6858
6875
|
* The license key.
|
|
6859
6876
|
*/
|
|
6860
6877
|
licenseKey?: string;
|
|
6861
6878
|
/**
|
|
6862
6879
|
* Options for syncing the editor's camera state with the URL.
|
|
6880
|
+
*
|
|
6881
|
+
* @deprecated Use `options.deepLinks` instead. This prop will be removed in a future release.
|
|
6863
6882
|
*/
|
|
6864
6883
|
deepLinks?: TLDeepLinkOptions | true;
|
|
6865
6884
|
/**
|
|
@@ -7064,6 +7083,46 @@ export declare interface TldrawOptions {
|
|
|
7064
7083
|
* The distance (in screen pixels) at which shapes snap to guides and other shapes.
|
|
7065
7084
|
*/
|
|
7066
7085
|
readonly snapThreshold: number;
|
|
7086
|
+
/**
|
|
7087
|
+
* Options for the editor's camera. These are the initial camera options.
|
|
7088
|
+
* Use {@link Editor.setCameraOptions} to update camera options at runtime.
|
|
7089
|
+
*/
|
|
7090
|
+
readonly camera: Partial<TLCameraOptions>;
|
|
7091
|
+
/**
|
|
7092
|
+
* Options for the editor's text rendering. These include TipTap configuration and
|
|
7093
|
+
* font handling. These are the initial text options and cannot be changed at runtime.
|
|
7094
|
+
*/
|
|
7095
|
+
readonly text: TLTextOptions;
|
|
7096
|
+
/**
|
|
7097
|
+
* Options for syncing the editor's camera state with the URL. Set to `true` to enable
|
|
7098
|
+
* with default options, or pass an options object to customize behavior.
|
|
7099
|
+
*
|
|
7100
|
+
* @example
|
|
7101
|
+
* ```tsx
|
|
7102
|
+
* // Enable with defaults
|
|
7103
|
+
* <Tldraw options={{ deepLinks: true }} />
|
|
7104
|
+
*
|
|
7105
|
+
* // Enable with custom options
|
|
7106
|
+
* <Tldraw options={{ deepLinks: { param: 'd', debounceMs: 500 } }} />
|
|
7107
|
+
* ```
|
|
7108
|
+
*/
|
|
7109
|
+
readonly deepLinks: TLDeepLinkOptions | true | undefined;
|
|
7110
|
+
/**
|
|
7111
|
+
* Whether the quick-zoom brush preserves its screen-pixel size when the user
|
|
7112
|
+
* zooms the overview. When true, zooming in shrinks the target viewport (higher
|
|
7113
|
+
* return zoom); zooming out expands it. When false, the brush keeps the original
|
|
7114
|
+
* viewport's page dimensions regardless of overview zoom changes.
|
|
7115
|
+
*/
|
|
7116
|
+
readonly quickZoomPreservesScreenBounds: boolean;
|
|
7117
|
+
/**
|
|
7118
|
+
* Called when content is dropped on the canvas. Provides the page position
|
|
7119
|
+
* where the drop occurred and the underlying drag event object.
|
|
7120
|
+
* Return true to prevent default drop handling (files, URLs, etc.)
|
|
7121
|
+
*/
|
|
7122
|
+
experimental__onDropOnCanvas?(options: {
|
|
7123
|
+
event: React.DragEvent<Element>;
|
|
7124
|
+
point: VecLike;
|
|
7125
|
+
}): boolean;
|
|
7067
7126
|
}
|
|
7068
7127
|
|
|
7069
7128
|
/** @public */
|
|
@@ -7148,10 +7207,17 @@ export declare interface TLEditorOptions {
|
|
|
7148
7207
|
inferDarkMode?: boolean;
|
|
7149
7208
|
/**
|
|
7150
7209
|
* Options for the editor's camera.
|
|
7210
|
+
*
|
|
7211
|
+
* @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
|
|
7151
7212
|
*/
|
|
7152
7213
|
cameraOptions?: Partial<TLCameraOptions>;
|
|
7153
|
-
textOptions?: TLTextOptions;
|
|
7154
7214
|
options?: Partial<TldrawOptions>;
|
|
7215
|
+
/**
|
|
7216
|
+
* Text options for the editor.
|
|
7217
|
+
*
|
|
7218
|
+
* @deprecated Use `options.text` instead. This prop will be removed in a future release.
|
|
7219
|
+
*/
|
|
7220
|
+
textOptions?: TLTextOptions;
|
|
7155
7221
|
licenseKey?: string;
|
|
7156
7222
|
fontAssetUrls?: {
|
|
7157
7223
|
[key: string]: string | undefined;
|
|
@@ -8019,17 +8085,35 @@ export declare interface TLShapeUtilCanBeLaidOutOpts {
|
|
|
8019
8085
|
|
|
8020
8086
|
/**
|
|
8021
8087
|
* Options passed to {@link ShapeUtil.canBind}. A binding that could be made. At least one of
|
|
8022
|
-
* `
|
|
8088
|
+
* `fromShape` or `toShape` will belong to this shape util.
|
|
8089
|
+
*
|
|
8090
|
+
* The shapes may be full {@link @tldraw/tlschema#TLShape} objects when available, or just
|
|
8091
|
+
* `{ type }` stubs when the shape hasn't been created yet (e.g. during arrow creation). Use
|
|
8092
|
+
* `'id' in shape` to check whether the full shape is available.
|
|
8023
8093
|
*
|
|
8024
8094
|
* @public
|
|
8025
8095
|
*/
|
|
8026
8096
|
export declare interface TLShapeUtilCanBindOpts<Shape extends TLShape = TLShape> {
|
|
8027
|
-
/** The
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8097
|
+
/** The shape referenced by the `fromId` of the binding, or a `{ type }` stub if unavailable. */
|
|
8098
|
+
fromShape: {
|
|
8099
|
+
type: TLShape['type'];
|
|
8100
|
+
} | TLShape;
|
|
8101
|
+
/** The shape referenced by the `toId` of the binding, or a `{ type }` stub if unavailable. */
|
|
8102
|
+
toShape: {
|
|
8103
|
+
type: TLShape['type'];
|
|
8104
|
+
} | TLShape;
|
|
8031
8105
|
/** The type of binding. */
|
|
8032
8106
|
bindingType: string;
|
|
8107
|
+
/**
|
|
8108
|
+
* The type of shape referenced by the `fromId` of the binding.
|
|
8109
|
+
* @deprecated Use `fromShape.type` instead.
|
|
8110
|
+
*/
|
|
8111
|
+
fromShapeType: TLShape['type'];
|
|
8112
|
+
/**
|
|
8113
|
+
* The type of shape referenced by the `toId` of the binding.
|
|
8114
|
+
* @deprecated Use `toShape.type` instead.
|
|
8115
|
+
*/
|
|
8116
|
+
toShapeType: TLShape['type'];
|
|
8033
8117
|
}
|
|
8034
8118
|
|
|
8035
8119
|
/** @public */
|
package/dist-cjs/index.js
CHANGED
|
@@ -152,7 +152,7 @@ __export(index_exports, {
|
|
|
152
152
|
getUserPreferences: () => import_TLUserPreferences.getUserPreferences,
|
|
153
153
|
getVerticesCountForArcLength: () => import_geometry_constants.getVerticesCountForArcLength,
|
|
154
154
|
hardReset: () => import_hardReset.hardReset,
|
|
155
|
-
hardResetEditor: () =>
|
|
155
|
+
hardResetEditor: () => import_runtime.hardResetEditor,
|
|
156
156
|
inlineBase64AssetStore: () => import_createTLStore.inlineBase64AssetStore,
|
|
157
157
|
intersectCircleCircle: () => import_intersect.intersectCircleCircle,
|
|
158
158
|
intersectCirclePolygon: () => import_intersect.intersectCirclePolygon,
|
|
@@ -172,7 +172,7 @@ __export(index_exports, {
|
|
|
172
172
|
loopToHtmlElement: () => import_dom.loopToHtmlElement,
|
|
173
173
|
maybeSnapToGrid: () => import_Pointing.maybeSnapToGrid,
|
|
174
174
|
normalizeWheel: () => import_normalizeWheel.normalizeWheel,
|
|
175
|
-
openWindow: () =>
|
|
175
|
+
openWindow: () => import_runtime.openWindow,
|
|
176
176
|
parseDeepLinkString: () => import_deepLinks.parseDeepLinkString,
|
|
177
177
|
perimeterOfEllipse: () => import_utils2.perimeterOfEllipse,
|
|
178
178
|
pointInPolygon: () => import_utils2.pointInPolygon,
|
|
@@ -182,7 +182,7 @@ __export(index_exports, {
|
|
|
182
182
|
preventDefault: () => import_dom.preventDefault,
|
|
183
183
|
radiansToDegrees: () => import_utils2.radiansToDegrees,
|
|
184
184
|
rangeIntersection: () => import_utils2.rangeIntersection,
|
|
185
|
-
refreshPage: () =>
|
|
185
|
+
refreshPage: () => import_runtime.refreshPage,
|
|
186
186
|
releasePointerCapture: () => import_dom.releasePointerCapture,
|
|
187
187
|
resizeBox: () => import_resizeBox.resizeBox,
|
|
188
188
|
resizeScaled: () => import_resizeScaled.resizeScaled,
|
|
@@ -357,10 +357,8 @@ var import_EditorAtom = require("./lib/utils/EditorAtom");
|
|
|
357
357
|
var import_getIncrementedName = require("./lib/utils/getIncrementedName");
|
|
358
358
|
var import_getPointerInfo = require("./lib/utils/getPointerInfo");
|
|
359
359
|
var import_getSvgPathFromPoints = require("./lib/utils/getSvgPathFromPoints");
|
|
360
|
-
var import_hardResetEditor = require("./lib/utils/hardResetEditor");
|
|
361
360
|
var import_keyboard = require("./lib/utils/keyboard");
|
|
362
361
|
var import_normalizeWheel = require("./lib/utils/normalizeWheel");
|
|
363
|
-
var import_refreshPage = require("./lib/utils/refreshPage");
|
|
364
362
|
var import_reparenting = require("./lib/utils/reparenting");
|
|
365
363
|
var import_richText = require("./lib/utils/richText");
|
|
366
364
|
var import_rotation = require("./lib/utils/rotation");
|
|
@@ -369,10 +367,9 @@ var import_SharedStylesMap = require("./lib/utils/SharedStylesMap");
|
|
|
369
367
|
var import_hardReset = require("./lib/utils/sync/hardReset");
|
|
370
368
|
var import_LocalIndexedDb = require("./lib/utils/sync/LocalIndexedDb");
|
|
371
369
|
var import_uniq = require("./lib/utils/uniq");
|
|
372
|
-
var import_window_open = require("./lib/utils/window-open");
|
|
373
370
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
374
371
|
"@tldraw/editor",
|
|
375
|
-
"4.4.0-canary.
|
|
372
|
+
"4.4.0-canary.3e1f7ed3c557",
|
|
376
373
|
"cjs"
|
|
377
374
|
);
|
|
378
375
|
//# 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'\n\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state-react'\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'\n\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 {\n\tDefaultShapeIndicators,\n\ttype TLShapeIndicatorsProps,\n} from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\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\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 {\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 {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\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 {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport { InputsManager } from './lib/editor/managers/InputsManager/InputsManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n\ttype ScribbleSessionOptions,\n} from './lib/editor/managers/ScribbleManager/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 { SpatialIndexManager } from './lib/editor/managers/SpatialIndexManager/SpatialIndexManager'\nexport {\n\tTextManager,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLEditStartInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLIndicatorPath,\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 {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\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 { 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 TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\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 TLFileReplaceExternalContent,\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 TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } 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 {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} 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 LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT } from './lib/license/LicenseProvider'\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 { 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 { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} 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 { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\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\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\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 { EditorAtom } from './lib/utils/EditorAtom'\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 { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport { runtime, setRuntimeOverrides } from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\nexport { openWindow } from './lib/utils/window-open'\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;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B;AAC3B,yBAA4B;AAC5B,uBAA0B;AAC1B,uBAaO;AACP,iBAAiD;AACjD,IAAAA,gBAgCO;AACP,iBAAkC;AAClC,0BAYO;AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAOO;AACP,uBAKO;AACP,iBAOO;AACP,wBAA2B;AAC3B,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,
|
|
4
|
+
"sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\n\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state-react'\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'\n\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 {\n\tDefaultShapeIndicators,\n\ttype TLShapeIndicatorsProps,\n} from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\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\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 {\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 {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\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 {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport { InputsManager } from './lib/editor/managers/InputsManager/InputsManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n\ttype ScribbleSessionOptions,\n} from './lib/editor/managers/ScribbleManager/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 { SpatialIndexManager } from './lib/editor/managers/SpatialIndexManager/SpatialIndexManager'\nexport {\n\tTextManager,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLEditStartInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLIndicatorPath,\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 {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\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 { 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 TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\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 TLFileReplaceExternalContent,\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 TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } 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 {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} 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 LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT } from './lib/license/LicenseProvider'\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 { 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 { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} 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 { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\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\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\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 { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport {\n\thardResetEditor,\n\topenWindow,\n\trefreshPage,\n\truntime,\n\tsetRuntimeOverrides,\n} from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\n\nregisterTldrawLib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BAMO;AACP,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,6BAAgC;AAChC,qBAAyD;AACzD,iBASO;AACP,qBAAwB;AACxB,mBAAsB;AACtB,sBAAyB;AACzB,2BAA8B;AAC9B,2BAA8B;AAC9B,oBAAuB;AACvB,uBAA0B;AAC1B,gCAA6C;AAC7C,wBAMO;AACP,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,wBAA2B;AAC3B,yBAA4B;AAC5B,uBAA0B;AAC1B,uBAaO;AACP,iBAAiD;AACjD,IAAAA,gBAgCO;AACP,iBAAkC;AAClC,0BAYO;AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAOO;AACP,uBAKO;AACP,iBAOO;AACP,wBAA2B;AAC3B,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAMO;AACP,6BAIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AAAA,IAErB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": ["import_utils"]
|
|
7
7
|
}
|
|
@@ -72,18 +72,32 @@ const TldrawEditor = (0, import_react.memo)(function TldrawEditor2({
|
|
|
72
72
|
className,
|
|
73
73
|
user: _user,
|
|
74
74
|
options: _options,
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
76
|
+
textOptions: _textOptions,
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
78
|
+
deepLinks: _deepLinks,
|
|
75
79
|
...rest
|
|
76
80
|
}) {
|
|
77
81
|
const [container, setContainer] = (0, import_react.useState)(null);
|
|
78
82
|
const user = (0, import_react.useMemo)(() => _user ?? (0, import_createTLUser.createTLUser)(), [_user]);
|
|
79
83
|
const ErrorFallback = components?.ErrorFallback === void 0 ? import_DefaultErrorFallback.DefaultErrorFallback : components?.ErrorFallback;
|
|
84
|
+
const mergedOptions = (0, import_react.useMemo)(() => {
|
|
85
|
+
let result = _options;
|
|
86
|
+
if (_textOptions) {
|
|
87
|
+
result = { ...result, text: result?.text ?? _textOptions };
|
|
88
|
+
}
|
|
89
|
+
if (_deepLinks !== void 0) {
|
|
90
|
+
result = { ...result, deepLinks: result?.deepLinks ?? _deepLinks };
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
}, [_options, _textOptions, _deepLinks]);
|
|
80
94
|
const withDefaults = {
|
|
81
95
|
...rest,
|
|
82
96
|
shapeUtils: rest.shapeUtils ?? EMPTY_SHAPE_UTILS_ARRAY,
|
|
83
97
|
bindingUtils: rest.bindingUtils ?? EMPTY_BINDING_UTILS_ARRAY,
|
|
84
98
|
tools: rest.tools ?? EMPTY_TOOLS_ARRAY,
|
|
85
99
|
components,
|
|
86
|
-
options: (0, import_useIdentity.useShallowObjectIdentity)(
|
|
100
|
+
options: (0, import_useIdentity.useShallowObjectIdentity)(mergedOptions)
|
|
87
101
|
};
|
|
88
102
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
103
|
"div",
|
|
@@ -182,11 +196,10 @@ function TldrawEditorWithReadyStore({
|
|
|
182
196
|
initialState,
|
|
183
197
|
autoFocus = true,
|
|
184
198
|
inferDarkMode,
|
|
199
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
185
200
|
cameraOptions,
|
|
186
|
-
textOptions,
|
|
187
201
|
options,
|
|
188
202
|
licenseKey,
|
|
189
|
-
deepLinks: _deepLinks,
|
|
190
203
|
getShapeVisibility,
|
|
191
204
|
assetUrls
|
|
192
205
|
}) {
|
|
@@ -194,6 +207,7 @@ function TldrawEditorWithReadyStore({
|
|
|
194
207
|
const container = (0, import_useContainer.useContainer)();
|
|
195
208
|
const [editor, setEditor] = (0, import_useRefState.useRefState)(null);
|
|
196
209
|
const canvasRef = (0, import_react.useRef)(null);
|
|
210
|
+
const _deepLinks = options?.deepLinks;
|
|
197
211
|
const deepLinks = (0, import_useIdentity.useShallowObjectIdentity)(_deepLinks === true ? {} : _deepLinks);
|
|
198
212
|
const editorOptionsRef = (0, import_react.useRef)({
|
|
199
213
|
// for these, it's because they're only used when the editor first mounts:
|
|
@@ -228,7 +242,6 @@ function TldrawEditorWithReadyStore({
|
|
|
228
242
|
autoFocus: autoFocus2,
|
|
229
243
|
inferDarkMode: inferDarkMode2,
|
|
230
244
|
cameraOptions: cameraOptions2,
|
|
231
|
-
textOptions,
|
|
232
245
|
options,
|
|
233
246
|
licenseKey,
|
|
234
247
|
getShapeVisibility,
|
|
@@ -259,7 +272,6 @@ function TldrawEditorWithReadyStore({
|
|
|
259
272
|
setEditor,
|
|
260
273
|
licenseKey,
|
|
261
274
|
getShapeVisibility,
|
|
262
|
-
textOptions,
|
|
263
275
|
assetUrls
|
|
264
276
|
]
|
|
265
277
|
);
|
|
@@ -270,10 +282,10 @@ function TldrawEditorWithReadyStore({
|
|
|
270
282
|
}
|
|
271
283
|
}, [editor, deepLinks]);
|
|
272
284
|
(0, import_react.useLayoutEffect)(() => {
|
|
273
|
-
if (editor && cameraOptions) {
|
|
274
|
-
editor.setCameraOptions(cameraOptions);
|
|
285
|
+
if (editor && (cameraOptions || options?.camera)) {
|
|
286
|
+
editor.setCameraOptions({ ...cameraOptions, ...options?.camera });
|
|
275
287
|
}
|
|
276
|
-
}, [editor, cameraOptions]);
|
|
288
|
+
}, [editor, cameraOptions, options?.camera]);
|
|
277
289
|
const crashingError = (0, import_react.useSyncExternalStore)(
|
|
278
290
|
(0, import_react.useCallback)(
|
|
279
291
|
(onStoreChange) => {
|