@tldraw/editor 4.4.0-canary.f929c9caec2f → 4.4.0-canary.fcefa58e986b
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 +306 -41
- package/dist-cjs/index.js +4 -12
- package/dist-cjs/index.js.map +3 -3
- package/dist-cjs/lib/TldrawEditor.js +20 -8
- package/dist-cjs/lib/TldrawEditor.js.map +2 -2
- package/dist-cjs/lib/components/LiveCollaborators.js +14 -24
- package/dist-cjs/lib/components/LiveCollaborators.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 +226 -0
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +7 -0
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +45 -15
- 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/components/default-components/DefaultShapeIndicator.js +3 -1
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +13 -1
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +2 -2
- package/dist-cjs/lib/config/TLUserPreferences.js +9 -3
- package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
- package/dist-cjs/lib/config/createTLStore.js.map +1 -1
- package/dist-cjs/lib/editor/Editor.js +39 -18
- 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/managers/HistoryManager/HistoryManager.js +13 -38
- package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js.map +3 -3
- package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js +378 -89
- package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +8 -3
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +29 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/tools/RootState.js +0 -13
- package/dist-cjs/lib/editor/tools/RootState.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 +35 -0
- 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/license/LicenseManager.js +6 -6
- package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
- package/dist-cjs/lib/options.js +8 -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/collaboratorState.js +42 -0
- package/dist-cjs/lib/utils/collaboratorState.js.map +7 -0
- 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 +306 -41
- package/dist-esm/index.mjs +8 -10
- 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/LiveCollaborators.mjs +17 -24
- package/dist-esm/lib/components/LiveCollaborators.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 +206 -0
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +7 -0
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +45 -15
- 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/components/default-components/DefaultShapeIndicator.mjs +3 -1
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +13 -1
- package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +2 -2
- package/dist-esm/lib/config/TLUserPreferences.mjs +9 -3
- package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
- package/dist-esm/lib/config/createTLStore.mjs.map +1 -1
- package/dist-esm/lib/editor/Editor.mjs +39 -18
- 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/managers/HistoryManager/HistoryManager.mjs +14 -39
- package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs +378 -89
- package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +8 -3
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +29 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/RootState.mjs +0 -13
- package/dist-esm/lib/editor/tools/RootState.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 +39 -1
- 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/license/LicenseManager.mjs +6 -6
- package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
- package/dist-esm/lib/options.mjs +8 -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/collaboratorState.mjs +22 -0
- package/dist-esm/lib/utils/collaboratorState.mjs.map +7 -0
- 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 +28 -11
- package/package.json +10 -13
- package/src/index.ts +9 -9
- package/src/lib/TldrawEditor.tsx +35 -13
- package/src/lib/components/LiveCollaborators.tsx +26 -37
- package/src/lib/components/Shape.tsx +15 -16
- package/src/lib/components/default-components/CanvasShapeIndicators.tsx +288 -0
- package/src/lib/components/default-components/DefaultCanvas.tsx +39 -3
- package/src/lib/components/default-components/DefaultErrorFallback.tsx +1 -2
- package/src/lib/components/default-components/DefaultShapeIndicator.tsx +6 -1
- package/src/lib/components/default-components/DefaultShapeIndicators.tsx +16 -1
- package/src/lib/config/TLUserPreferences.test.ts +1 -0
- package/src/lib/config/TLUserPreferences.ts +8 -0
- package/src/lib/config/createTLStore.ts +1 -1
- package/src/lib/editor/Editor.ts +73 -20
- 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/managers/HistoryManager/HistoryManager.ts +19 -47
- package/src/lib/editor/managers/ScribbleManager/ScribbleManager.ts +491 -106
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +24 -0
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +8 -0
- package/src/lib/editor/shapes/ShapeUtil.ts +63 -5
- package/src/lib/editor/tools/RootState.ts +0 -16
- package/src/lib/hooks/useCanvasEvents.ts +13 -2
- package/src/lib/hooks/usePeerIds.ts +53 -1
- package/src/lib/hooks/useShapeCulling.tsx +98 -0
- package/src/lib/license/LicenseManager.ts +6 -6
- package/src/lib/options.ts +59 -2
- 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/collaboratorState.ts +54 -0
- 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/editor/managers/ScribbleManager/ScribbleManager.test.ts +0 -621
- 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;
|
|
@@ -900,6 +909,7 @@ export declare const defaultTldrawOptions: {
|
|
|
900
909
|
readonly handleRadius: 12;
|
|
901
910
|
readonly hitTestMargin: 8;
|
|
902
911
|
readonly laserDelayMs: 1200;
|
|
912
|
+
readonly laserFadeoutMs: 500;
|
|
903
913
|
readonly longPressDurationMs: 500;
|
|
904
914
|
readonly maxExportDelayMs: 5000;
|
|
905
915
|
readonly maxFilesAtOnce: 100;
|
|
@@ -908,9 +918,11 @@ export declare const defaultTldrawOptions: {
|
|
|
908
918
|
readonly maxShapesPerPage: 4000;
|
|
909
919
|
readonly multiClickDurationMs: 200;
|
|
910
920
|
readonly nonce: undefined;
|
|
921
|
+
readonly quickZoomPreservesScreenBounds: true;
|
|
911
922
|
readonly snapThreshold: 8;
|
|
912
923
|
readonly spacebarPanning: true;
|
|
913
924
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
925
|
+
readonly text: {};
|
|
914
926
|
readonly textShadowLod: 0.35;
|
|
915
927
|
readonly tooltipDelayMs: 700;
|
|
916
928
|
readonly uiCoarseDragDistanceSquared: 625;
|
|
@@ -931,6 +943,7 @@ export declare const defaultUserPreferences: Readonly<{
|
|
|
931
943
|
isPasteAtCursorMode: false;
|
|
932
944
|
isSnapMode: false;
|
|
933
945
|
isWrapMode: false;
|
|
946
|
+
isZoomDirectionInverted: false;
|
|
934
947
|
locale: "ar" | "bn" | "ca" | "cs" | "da" | "de" | "el" | "en" | "es" | "fa" | "fi" | "fr" | "gl" | "gu-in" | "he" | "hi-in" | "hr" | "hu" | "id" | "it" | "ja" | "km-kh" | "kn" | "ko-kr" | "ml" | "mr" | "ms" | "ne" | "nl" | "no" | "pa" | "pl" | "pt-br" | "pt-pt" | "ro" | "ru" | "sl" | "so" | "sv" | "ta" | "te" | "th" | "tl" | "tr" | "uk" | "ur" | "vi" | "zh-cn" | "zh-tw";
|
|
935
948
|
name: "";
|
|
936
949
|
}>;
|
|
@@ -1009,7 +1022,7 @@ export declare class EdgeScrollManager {
|
|
|
1009
1022
|
/** @public */
|
|
1010
1023
|
export declare class Editor extends EventEmitter<TLEventMap> {
|
|
1011
1024
|
readonly id: string;
|
|
1012
|
-
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);
|
|
1013
1026
|
private readonly _getShapeVisibility?;
|
|
1014
1027
|
private getIsShapeHiddenCache;
|
|
1015
1028
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
@@ -1904,7 +1917,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1904
1917
|
getDebouncedZoomLevel(): number;
|
|
1905
1918
|
private _getAboveDebouncedZoomThreshold;
|
|
1906
1919
|
/**
|
|
1907
|
-
* Get the efficient zoom level. This returns the current zoom level if there are less than
|
|
1920
|
+
* Get the efficient zoom level. This returns the current zoom level if there are less than a certain number of shapes on the page,
|
|
1908
1921
|
* otherwise it returns the debounced zoom level. This can be used to avoid expensive re-renders during camera movements.
|
|
1909
1922
|
*
|
|
1910
1923
|
* @public
|
|
@@ -2257,10 +2270,10 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2257
2270
|
*/
|
|
2258
2271
|
stopFollowingUser(): this;
|
|
2259
2272
|
/* Excluded from this release type: getUnorderedRenderingShapes */
|
|
2260
|
-
private _cameraState;
|
|
2261
2273
|
private _cameraStateTimeoutRemaining;
|
|
2262
2274
|
private _decayCameraStateTimeout;
|
|
2263
2275
|
private _tickCameraState;
|
|
2276
|
+
private _setCameraState;
|
|
2264
2277
|
/**
|
|
2265
2278
|
* Whether the camera is moving or idle.
|
|
2266
2279
|
*
|
|
@@ -2759,7 +2772,24 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2759
2772
|
hitInside?: boolean;
|
|
2760
2773
|
margin?: number;
|
|
2761
2774
|
}): TLShape[];
|
|
2762
|
-
|
|
2775
|
+
/**
|
|
2776
|
+
* Get shape IDs within the given bounds.
|
|
2777
|
+
*
|
|
2778
|
+
* Note: Uses shape page bounds only. Frames with labels outside their bounds
|
|
2779
|
+
* may not be included even if the label is within the search bounds.
|
|
2780
|
+
*
|
|
2781
|
+
* Note: Results are unordered. If you need z-order, combine with sorted shapes:
|
|
2782
|
+
* ```ts
|
|
2783
|
+
* const candidates = editor.getShapeIdsInsideBounds(bounds)
|
|
2784
|
+
* const sorted = editor.getCurrentPageShapesSorted().filter(s => candidates.has(s.id))
|
|
2785
|
+
* ```
|
|
2786
|
+
*
|
|
2787
|
+
* @param bounds - The bounds to search within.
|
|
2788
|
+
* @returns Unordered set of shape IDs within the given bounds.
|
|
2789
|
+
*
|
|
2790
|
+
* @public
|
|
2791
|
+
*/
|
|
2792
|
+
getShapeIdsInsideBounds(bounds: Box): Set<TLShapeId>;
|
|
2763
2793
|
/**
|
|
2764
2794
|
* Test whether a point (in the current page space) will will a shape. This method takes into account masks,
|
|
2765
2795
|
* such as when a shape is the child of a frame and is partially clipped by the frame.
|
|
@@ -3901,7 +3931,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3901
3931
|
/**
|
|
3902
3932
|
* Handles navigating to the content specified by the query param in the given URL.
|
|
3903
3933
|
*
|
|
3904
|
-
* Use {@link Editor
|
|
3934
|
+
* Use {@link Editor.createDeepLink} to create a URL with a deep link query param.
|
|
3905
3935
|
*
|
|
3906
3936
|
* If no URL is provided, it will look for the param in the current `window.location.href`.
|
|
3907
3937
|
*
|
|
@@ -4285,7 +4315,10 @@ export declare function getArcMeasure(A: number, B: number, sweepFlag: number, l
|
|
|
4285
4315
|
/** @public */
|
|
4286
4316
|
export declare function getCursor(cursor: TLCursorType, rotation?: number, color?: string): string;
|
|
4287
4317
|
|
|
4288
|
-
/**
|
|
4318
|
+
/**
|
|
4319
|
+
* Gets the default CDN base URL.
|
|
4320
|
+
* @returns The default CDN base URL.
|
|
4321
|
+
* @public */
|
|
4289
4322
|
export declare function getDefaultCdnBaseUrl(): string;
|
|
4290
4323
|
|
|
4291
4324
|
/**
|
|
@@ -4334,7 +4367,7 @@ export declare function getPerfectDashProps(totalLength: number, strokeWidth: nu
|
|
|
4334
4367
|
};
|
|
4335
4368
|
|
|
4336
4369
|
/** @public */
|
|
4337
|
-
export declare function getPointerInfo(editor: Editor, e: PointerEvent |
|
|
4370
|
+
export declare function getPointerInfo(editor: Editor, e: PointerEvent | React_3.PointerEvent): {
|
|
4338
4371
|
accelKey: boolean;
|
|
4339
4372
|
altKey: boolean;
|
|
4340
4373
|
button: number;
|
|
@@ -4395,7 +4428,7 @@ export declare function getSvgAsImage(svgString: string, options: {
|
|
|
4395
4428
|
}): Promise<Blob | null>;
|
|
4396
4429
|
|
|
4397
4430
|
/**
|
|
4398
|
-
* Turn an array of points into a path of
|
|
4431
|
+
* Turn an array of points into a path of quadratic curves.
|
|
4399
4432
|
*
|
|
4400
4433
|
* @param points - The points returned from perfect-freehand
|
|
4401
4434
|
* @param closed - Whether the stroke is closed
|
|
@@ -4905,7 +4938,6 @@ export declare const isSafeFloat: (n: number) => boolean;
|
|
|
4905
4938
|
|
|
4906
4939
|
/**
|
|
4907
4940
|
* Reparents shapes that are no longer contained within their parent shapes.
|
|
4908
|
-
* todo: rename me to something more descriptive, like `reparentOccludedShapes` or `reparentAutoDroppedShapes`
|
|
4909
4941
|
*
|
|
4910
4942
|
* @param editor - The editor instance.
|
|
4911
4943
|
* @param shapeIds - The IDs of the shapes to reparent.
|
|
@@ -5164,16 +5196,16 @@ export declare function precise(A: VecLike): string;
|
|
|
5164
5196
|
/**
|
|
5165
5197
|
* This function calls `event.preventDefault()` for you. Why is that useful?
|
|
5166
5198
|
*
|
|
5167
|
-
*
|
|
5199
|
+
* Because if you enable `window.preventDefaultLogging = true` it'll log out a message when it
|
|
5168
5200
|
* happens. Because we use console.warn rather than (log) you'll get a stack trace in the inspector
|
|
5169
5201
|
* telling you exactly where it happened. This is important because `e.preventDefault()` is the
|
|
5170
|
-
* 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
|
|
5171
5203
|
* behaviour which doesn't make sense in our UI
|
|
5172
5204
|
*
|
|
5173
5205
|
* @param event - To prevent default on
|
|
5174
5206
|
* @public
|
|
5175
5207
|
*/
|
|
5176
|
-
export declare function preventDefault(event: Event |
|
|
5208
|
+
export declare function preventDefault(event: Event | React.BaseSyntheticEvent): void;
|
|
5177
5209
|
|
|
5178
5210
|
/**
|
|
5179
5211
|
* Convert radians to degrees.
|
|
@@ -5235,7 +5267,7 @@ export declare class Rectangle2d extends Polygon2d {
|
|
|
5235
5267
|
export declare function refreshPage(): void;
|
|
5236
5268
|
|
|
5237
5269
|
/** @public */
|
|
5238
|
-
export declare function releasePointerCapture(element: Element, event: PointerEvent |
|
|
5270
|
+
export declare function releasePointerCapture(element: Element, event: PointerEvent | React.PointerEvent<Element>): void;
|
|
5239
5271
|
|
|
5240
5272
|
/** @public */
|
|
5241
5273
|
export declare type RequiredKeys<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
|
@@ -5303,7 +5335,7 @@ export declare function rotateSelectionHandle(handle: SelectionHandle, rotation:
|
|
|
5303
5335
|
|
|
5304
5336
|
/** @public */
|
|
5305
5337
|
export declare const runtime: {
|
|
5306
|
-
hardReset(): void
|
|
5338
|
+
hardReset(): Promise<void>;
|
|
5307
5339
|
openWindow(url: string, target: string, allowReferrer?: boolean): void;
|
|
5308
5340
|
refreshPage(): void;
|
|
5309
5341
|
};
|
|
@@ -5338,27 +5370,106 @@ export declare interface ScribbleItem {
|
|
|
5338
5370
|
/** @public */
|
|
5339
5371
|
export declare class ScribbleManager {
|
|
5340
5372
|
private editor;
|
|
5341
|
-
|
|
5342
|
-
state: "paused" | "running";
|
|
5373
|
+
private sessions;
|
|
5343
5374
|
constructor(editor: Editor);
|
|
5375
|
+
/**
|
|
5376
|
+
* Start a new session for grouping scribbles.
|
|
5377
|
+
* Returns a session ID that can be used with other session methods.
|
|
5378
|
+
*
|
|
5379
|
+
* @param options - Session configuration
|
|
5380
|
+
* @returns Session ID
|
|
5381
|
+
* @public
|
|
5382
|
+
*/
|
|
5383
|
+
startSession(options?: ScribbleSessionOptions): string;
|
|
5384
|
+
/**
|
|
5385
|
+
* Add a scribble to a session.
|
|
5386
|
+
*
|
|
5387
|
+
* @param sessionId - The session ID
|
|
5388
|
+
* @param scribble - Partial scribble properties
|
|
5389
|
+
* @param scribbleId - Optional scribble ID
|
|
5390
|
+
* @public
|
|
5391
|
+
*/
|
|
5392
|
+
addScribbleToSession(sessionId: string, scribble: Partial<TLScribble>, scribbleId?: string): ScribbleItem;
|
|
5393
|
+
/**
|
|
5394
|
+
* Add a point to a scribble in a session.
|
|
5395
|
+
*
|
|
5396
|
+
* @param sessionId - The session ID
|
|
5397
|
+
* @param scribbleId - The scribble ID
|
|
5398
|
+
* @param x - X coordinate
|
|
5399
|
+
* @param y - Y coordinate
|
|
5400
|
+
* @param z - Z coordinate (pressure)
|
|
5401
|
+
* @public
|
|
5402
|
+
*/
|
|
5403
|
+
addPointToSession(sessionId: string, scribbleId: string, x: number, y: number, z?: number): ScribbleItem;
|
|
5404
|
+
/**
|
|
5405
|
+
* Extend a session, resetting its idle timeout.
|
|
5406
|
+
*
|
|
5407
|
+
* @param sessionId - The session ID
|
|
5408
|
+
* @public
|
|
5409
|
+
*/
|
|
5410
|
+
extendSession(sessionId: string): void;
|
|
5411
|
+
/**
|
|
5412
|
+
* Stop a session, triggering fade-out.
|
|
5413
|
+
*
|
|
5414
|
+
* @param sessionId - The session ID
|
|
5415
|
+
* @public
|
|
5416
|
+
*/
|
|
5417
|
+
stopSession(sessionId: string): void;
|
|
5418
|
+
/**
|
|
5419
|
+
* Clear all scribbles in a session immediately.
|
|
5420
|
+
*
|
|
5421
|
+
* @param sessionId - The session ID
|
|
5422
|
+
* @public
|
|
5423
|
+
*/
|
|
5424
|
+
clearSession(sessionId: string): void;
|
|
5425
|
+
/**
|
|
5426
|
+
* Check if a session is active.
|
|
5427
|
+
*
|
|
5428
|
+
* @param sessionId - The session ID
|
|
5429
|
+
* @public
|
|
5430
|
+
*/
|
|
5431
|
+
isSessionActive(sessionId: string): boolean;
|
|
5432
|
+
/**
|
|
5433
|
+
* Add a scribble using the default self-consuming behavior.
|
|
5434
|
+
* Creates an implicit session for the scribble.
|
|
5435
|
+
*
|
|
5436
|
+
* @param scribble - Partial scribble properties
|
|
5437
|
+
* @param id - Optional scribble id
|
|
5438
|
+
* @returns The created scribble item
|
|
5439
|
+
* @public
|
|
5440
|
+
*/
|
|
5344
5441
|
addScribble(scribble: Partial<TLScribble>, id?: string): ScribbleItem;
|
|
5345
|
-
reset(): void;
|
|
5346
5442
|
/**
|
|
5347
|
-
*
|
|
5443
|
+
* Add a point to a scribble. Searches all sessions.
|
|
5348
5444
|
*
|
|
5445
|
+
* @param id - The scribble id
|
|
5446
|
+
* @param x - X coordinate
|
|
5447
|
+
* @param y - Y coordinate
|
|
5448
|
+
* @param z - Z coordinate (pressure)
|
|
5349
5449
|
* @public
|
|
5350
5450
|
*/
|
|
5351
|
-
|
|
5451
|
+
addPoint(id: string, x: number, y: number, z?: number): ScribbleItem;
|
|
5352
5452
|
/**
|
|
5353
|
-
*
|
|
5453
|
+
* Mark a scribble as complete (done being drawn but not yet fading).
|
|
5454
|
+
* Searches all sessions.
|
|
5354
5455
|
*
|
|
5355
|
-
* @param id - The
|
|
5356
|
-
* @param x - The x coordinate of the point.
|
|
5357
|
-
* @param y - The y coordinate of the point.
|
|
5358
|
-
* @param z - The z coordinate of the point.
|
|
5456
|
+
* @param id - The scribble id
|
|
5359
5457
|
* @public
|
|
5360
5458
|
*/
|
|
5361
|
-
|
|
5459
|
+
complete(id: string): ScribbleItem;
|
|
5460
|
+
/**
|
|
5461
|
+
* Stop a scribble. Searches all sessions.
|
|
5462
|
+
*
|
|
5463
|
+
* @param id - The scribble id
|
|
5464
|
+
* @public
|
|
5465
|
+
*/
|
|
5466
|
+
stop(id: string): ScribbleItem;
|
|
5467
|
+
/**
|
|
5468
|
+
* Stop and remove all sessions.
|
|
5469
|
+
*
|
|
5470
|
+
* @public
|
|
5471
|
+
*/
|
|
5472
|
+
reset(): void;
|
|
5362
5473
|
/**
|
|
5363
5474
|
* Update on each animation frame.
|
|
5364
5475
|
*
|
|
@@ -5366,6 +5477,44 @@ export declare class ScribbleManager {
|
|
|
5366
5477
|
* @public
|
|
5367
5478
|
*/
|
|
5368
5479
|
tick(elapsed: number): void;
|
|
5480
|
+
private resetIdleTimeout;
|
|
5481
|
+
private clearIdleTimeout;
|
|
5482
|
+
private tickSession;
|
|
5483
|
+
private tickSessionItems;
|
|
5484
|
+
private tickPersistentItem;
|
|
5485
|
+
private tickSelfConsumingItem;
|
|
5486
|
+
private tickGroupedFade;
|
|
5487
|
+
}
|
|
5488
|
+
|
|
5489
|
+
/** @public */
|
|
5490
|
+
export declare interface ScribbleSessionOptions {
|
|
5491
|
+
/** Session id. Auto-generated if not provided. */
|
|
5492
|
+
id?: string;
|
|
5493
|
+
/**
|
|
5494
|
+
* Whether scribbles self-consume (shrink from start) while drawing.
|
|
5495
|
+
* - true: scribbles eat their own tail as you draw (default, used for eraser/select)
|
|
5496
|
+
* - false: scribbles persist until session stops (used for laser)
|
|
5497
|
+
*/
|
|
5498
|
+
selfConsume?: boolean;
|
|
5499
|
+
/**
|
|
5500
|
+
* How long to wait after last activity before auto-stopping the session.
|
|
5501
|
+
* Only applies when selfConsume is false.
|
|
5502
|
+
*/
|
|
5503
|
+
idleTimeoutMs?: number;
|
|
5504
|
+
/**
|
|
5505
|
+
* How scribbles fade when stopping.
|
|
5506
|
+
* - 'individual': each scribble fades on its own (default)
|
|
5507
|
+
* - 'grouped': all scribbles fade together as one sequence
|
|
5508
|
+
*/
|
|
5509
|
+
fadeMode?: 'grouped' | 'individual';
|
|
5510
|
+
/**
|
|
5511
|
+
* Easing for grouped fade.
|
|
5512
|
+
*/
|
|
5513
|
+
fadeEasing?: 'ease-in' | 'linear';
|
|
5514
|
+
/**
|
|
5515
|
+
* Duration of the fade in milliseconds.
|
|
5516
|
+
*/
|
|
5517
|
+
fadeDurationMs?: number;
|
|
5369
5518
|
}
|
|
5370
5519
|
|
|
5371
5520
|
/** @public */
|
|
@@ -5378,7 +5527,7 @@ export declare type SelectionEdge = 'bottom' | 'left' | 'right' | 'top';
|
|
|
5378
5527
|
export declare type SelectionHandle = SelectionCorner | SelectionEdge;
|
|
5379
5528
|
|
|
5380
5529
|
/** @public */
|
|
5381
|
-
export declare function setPointerCapture(element: Element, event: PointerEvent |
|
|
5530
|
+
export declare function setPointerCapture(element: Element, event: PointerEvent | React.PointerEvent<Element>): void;
|
|
5382
5531
|
|
|
5383
5532
|
/** @public */
|
|
5384
5533
|
export declare function setRuntimeOverrides(input: Partial<typeof runtime>): void;
|
|
@@ -5468,6 +5617,31 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5468
5617
|
* @public
|
|
5469
5618
|
*/
|
|
5470
5619
|
abstract indicator(shape: Shape): any;
|
|
5620
|
+
/**
|
|
5621
|
+
* Whether to use the legacy React-based indicator rendering.
|
|
5622
|
+
*
|
|
5623
|
+
* Override this to return `false` if your shape implements {@link ShapeUtil.getIndicatorPath}
|
|
5624
|
+
* for canvas-based indicator rendering.
|
|
5625
|
+
*
|
|
5626
|
+
* @returns `true` to use SVG indicators (default), `false` to use canvas indicators.
|
|
5627
|
+
* @public
|
|
5628
|
+
*/
|
|
5629
|
+
useLegacyIndicator(): boolean;
|
|
5630
|
+
/**
|
|
5631
|
+
* Get a Path2D for rendering the shape's indicator on the canvas.
|
|
5632
|
+
*
|
|
5633
|
+
* When implemented, this is used instead of {@link ShapeUtil.indicator} for more
|
|
5634
|
+
* efficient canvas-based indicator rendering. Shapes that return `undefined` will
|
|
5635
|
+
* fall back to SVG-based rendering via {@link ShapeUtil.indicator}.
|
|
5636
|
+
*
|
|
5637
|
+
* For complex indicators that need clipping (e.g., arrows with labels), return an
|
|
5638
|
+
* object with `path`, `clipPath`, and `additionalPaths` properties.
|
|
5639
|
+
*
|
|
5640
|
+
* @param shape - The shape.
|
|
5641
|
+
* @returns A Path2D to stroke, or an object with clipping info, or undefined to use SVG fallback.
|
|
5642
|
+
* @public
|
|
5643
|
+
*/
|
|
5644
|
+
getIndicatorPath(shape: Shape): TLIndicatorPath | undefined;
|
|
5471
5645
|
/**
|
|
5472
5646
|
* Get the font faces that should be rendered in the document in order for this shape to render
|
|
5473
5647
|
* correctly.
|
|
@@ -6683,29 +6857,35 @@ export declare interface TldrawEditorBaseProps {
|
|
|
6683
6857
|
inferDarkMode?: boolean;
|
|
6684
6858
|
/**
|
|
6685
6859
|
* Camera options for the editor.
|
|
6860
|
+
*
|
|
6861
|
+
* @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
|
|
6686
6862
|
*/
|
|
6687
6863
|
cameraOptions?: Partial<TLCameraOptions>;
|
|
6688
|
-
/**
|
|
6689
|
-
* Text options for the editor.
|
|
6690
|
-
*/
|
|
6691
|
-
textOptions?: TLTextOptions;
|
|
6692
6864
|
/**
|
|
6693
6865
|
* Options for the editor.
|
|
6694
6866
|
*/
|
|
6695
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;
|
|
6696
6874
|
/**
|
|
6697
6875
|
* The license key.
|
|
6698
6876
|
*/
|
|
6699
6877
|
licenseKey?: string;
|
|
6700
6878
|
/**
|
|
6701
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.
|
|
6702
6882
|
*/
|
|
6703
6883
|
deepLinks?: TLDeepLinkOptions | true;
|
|
6704
6884
|
/**
|
|
6705
6885
|
* Provides a way to hide shapes.
|
|
6706
6886
|
*
|
|
6707
6887
|
* Hidden shapes will not render in the editor, and they will not be eligible for hit test via
|
|
6708
|
-
* {@link Editor
|
|
6888
|
+
* {@link @tldraw/editor#Editor.getShapeAtPoint} and {@link @tldraw/editor#Editor.getShapesAtPoint}. But otherwise they will
|
|
6709
6889
|
* remain in the store and participate in all other operations.
|
|
6710
6890
|
*
|
|
6711
6891
|
* @example
|
|
@@ -6835,6 +7015,12 @@ export declare interface TldrawOptions {
|
|
|
6835
7015
|
readonly flattenImageBoundsExpand: number;
|
|
6836
7016
|
readonly flattenImageBoundsPadding: number;
|
|
6837
7017
|
readonly laserDelayMs: number;
|
|
7018
|
+
/**
|
|
7019
|
+
* How long (in milliseconds) to fade all laser scribbles after the session ends.
|
|
7020
|
+
* The total points across all scribbles will be removed proportionally over this duration.
|
|
7021
|
+
* Defaults to 500ms (0.5 seconds).
|
|
7022
|
+
*/
|
|
7023
|
+
readonly laserFadeoutMs: number;
|
|
6838
7024
|
readonly maxExportDelayMs: number;
|
|
6839
7025
|
readonly tooltipDelayMs: number;
|
|
6840
7026
|
/**
|
|
@@ -6872,13 +7058,13 @@ export declare interface TldrawOptions {
|
|
|
6872
7058
|
readonly branding?: string;
|
|
6873
7059
|
/**
|
|
6874
7060
|
* Whether to use debounced zoom level for certain rendering optimizations. When true,
|
|
6875
|
-
* `editor.
|
|
7061
|
+
* `editor.getEfficientZoomLevel()` returns a cached zoom value while the camera is moving,
|
|
6876
7062
|
* reducing re-renders. When false, it always returns the current zoom level.
|
|
6877
7063
|
*/
|
|
6878
7064
|
readonly debouncedZoom: boolean;
|
|
6879
7065
|
/**
|
|
6880
7066
|
* The number of shapes that must be on the page for the debounced zoom level to be used.
|
|
6881
|
-
* Defaults to
|
|
7067
|
+
* Defaults to 500 shapes.
|
|
6882
7068
|
*/
|
|
6883
7069
|
readonly debouncedZoomThreshold: number;
|
|
6884
7070
|
/**
|
|
@@ -6897,6 +7083,46 @@ export declare interface TldrawOptions {
|
|
|
6897
7083
|
* The distance (in screen pixels) at which shapes snap to guides and other shapes.
|
|
6898
7084
|
*/
|
|
6899
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;
|
|
6900
7126
|
}
|
|
6901
7127
|
|
|
6902
7128
|
/** @public */
|
|
@@ -6981,10 +7207,17 @@ export declare interface TLEditorOptions {
|
|
|
6981
7207
|
inferDarkMode?: boolean;
|
|
6982
7208
|
/**
|
|
6983
7209
|
* Options for the editor's camera.
|
|
7210
|
+
*
|
|
7211
|
+
* @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
|
|
6984
7212
|
*/
|
|
6985
7213
|
cameraOptions?: Partial<TLCameraOptions>;
|
|
6986
|
-
textOptions?: TLTextOptions;
|
|
6987
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;
|
|
6988
7221
|
licenseKey?: string;
|
|
6989
7222
|
fontAssetUrls?: {
|
|
6990
7223
|
[key: string]: string | undefined;
|
|
@@ -7398,6 +7631,17 @@ export declare interface TLImageExportOptions extends TLSvgExportOptions {
|
|
|
7398
7631
|
format?: TLExportType;
|
|
7399
7632
|
}
|
|
7400
7633
|
|
|
7634
|
+
/**
|
|
7635
|
+
* Return type for {@link ShapeUtil.getIndicatorPath}. Can be either a simple Path2D
|
|
7636
|
+
* or an object with additional rendering info like clip paths for complex indicators.
|
|
7637
|
+
* @public
|
|
7638
|
+
*/
|
|
7639
|
+
export declare type TLIndicatorPath = {
|
|
7640
|
+
additionalPaths?: Path2D[];
|
|
7641
|
+
clipPath?: Path2D;
|
|
7642
|
+
path: Path2D;
|
|
7643
|
+
} | Path2D;
|
|
7644
|
+
|
|
7401
7645
|
/** @public */
|
|
7402
7646
|
export declare type TLInterruptEvent = (info: TLInterruptEventInfo) => void;
|
|
7403
7647
|
|
|
@@ -7841,17 +8085,35 @@ export declare interface TLShapeUtilCanBeLaidOutOpts {
|
|
|
7841
8085
|
|
|
7842
8086
|
/**
|
|
7843
8087
|
* Options passed to {@link ShapeUtil.canBind}. A binding that could be made. At least one of
|
|
7844
|
-
* `
|
|
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.
|
|
7845
8093
|
*
|
|
7846
8094
|
* @public
|
|
7847
8095
|
*/
|
|
7848
8096
|
export declare interface TLShapeUtilCanBindOpts<Shape extends TLShape = TLShape> {
|
|
7849
|
-
/** The
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
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;
|
|
7853
8105
|
/** The type of binding. */
|
|
7854
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'];
|
|
7855
8117
|
}
|
|
7856
8118
|
|
|
7857
8119
|
/** @public */
|
|
@@ -7905,7 +8167,7 @@ export declare interface TLStoreBaseOptions {
|
|
|
7905
8167
|
defaultName?: string;
|
|
7906
8168
|
/** How should this store upload & resolve assets? */
|
|
7907
8169
|
assets?: TLAssetStore;
|
|
7908
|
-
/** Called when the store is connected to an {@link Editor}. */
|
|
8170
|
+
/** Called when the store is connected to an {@link @tldraw/editor#Editor}. */
|
|
7909
8171
|
onMount?(editor: Editor): (() => void) | void;
|
|
7910
8172
|
}
|
|
7911
8173
|
|
|
@@ -8111,6 +8373,7 @@ export declare interface TLUserPreferences {
|
|
|
8111
8373
|
isPasteAtCursorMode?: boolean | null;
|
|
8112
8374
|
enhancedA11yMode?: boolean | null;
|
|
8113
8375
|
inputMode?: 'mouse' | 'trackpad' | null;
|
|
8376
|
+
isZoomDirectionInverted?: boolean | null;
|
|
8114
8377
|
}
|
|
8115
8378
|
|
|
8116
8379
|
/** @public */
|
|
@@ -8285,6 +8548,7 @@ export declare class UserPreferencesManager {
|
|
|
8285
8548
|
isDynamicResizeMode: boolean;
|
|
8286
8549
|
isSnapMode: boolean;
|
|
8287
8550
|
isWrapMode: boolean;
|
|
8551
|
+
isZoomDirectionInverted: boolean;
|
|
8288
8552
|
locale: string;
|
|
8289
8553
|
name: string;
|
|
8290
8554
|
};
|
|
@@ -8305,6 +8569,7 @@ export declare class UserPreferencesManager {
|
|
|
8305
8569
|
getIsPasteAtCursorMode(): boolean;
|
|
8306
8570
|
getEnhancedA11yMode(): boolean;
|
|
8307
8571
|
getInputMode(): "mouse" | "trackpad" | null;
|
|
8572
|
+
getIsZoomDirectionInverted(): boolean;
|
|
8308
8573
|
}
|
|
8309
8574
|
|
|
8310
8575
|
/** @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,
|
|
@@ -238,11 +238,6 @@ __export(index_exports, {
|
|
|
238
238
|
});
|
|
239
239
|
module.exports = __toCommonJS(index_exports);
|
|
240
240
|
var import_utils = require("@tldraw/utils");
|
|
241
|
-
var import_at = require("core-js/stable/array/at.js");
|
|
242
|
-
var import_flat_map = require("core-js/stable/array/flat-map.js");
|
|
243
|
-
var import_flat = require("core-js/stable/array/flat.js");
|
|
244
|
-
var import_at2 = require("core-js/stable/string/at.js");
|
|
245
|
-
var import_replace_all = require("core-js/stable/string/replace-all.js");
|
|
246
241
|
__reExport(index_exports, require("@tldraw/state"), module.exports);
|
|
247
242
|
__reExport(index_exports, require("@tldraw/state-react"), module.exports);
|
|
248
243
|
__reExport(index_exports, require("@tldraw/store"), module.exports);
|
|
@@ -362,10 +357,8 @@ var import_EditorAtom = require("./lib/utils/EditorAtom");
|
|
|
362
357
|
var import_getIncrementedName = require("./lib/utils/getIncrementedName");
|
|
363
358
|
var import_getPointerInfo = require("./lib/utils/getPointerInfo");
|
|
364
359
|
var import_getSvgPathFromPoints = require("./lib/utils/getSvgPathFromPoints");
|
|
365
|
-
var import_hardResetEditor = require("./lib/utils/hardResetEditor");
|
|
366
360
|
var import_keyboard = require("./lib/utils/keyboard");
|
|
367
361
|
var import_normalizeWheel = require("./lib/utils/normalizeWheel");
|
|
368
|
-
var import_refreshPage = require("./lib/utils/refreshPage");
|
|
369
362
|
var import_reparenting = require("./lib/utils/reparenting");
|
|
370
363
|
var import_richText = require("./lib/utils/richText");
|
|
371
364
|
var import_rotation = require("./lib/utils/rotation");
|
|
@@ -374,10 +367,9 @@ var import_SharedStylesMap = require("./lib/utils/SharedStylesMap");
|
|
|
374
367
|
var import_hardReset = require("./lib/utils/sync/hardReset");
|
|
375
368
|
var import_LocalIndexedDb = require("./lib/utils/sync/LocalIndexedDb");
|
|
376
369
|
var import_uniq = require("./lib/utils/uniq");
|
|
377
|
-
var import_window_open = require("./lib/utils/window-open");
|
|
378
370
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
379
371
|
"@tldraw/editor",
|
|
380
|
-
"4.4.0-canary.
|
|
372
|
+
"4.4.0-canary.fcefa58e986b",
|
|
381
373
|
"cjs"
|
|
382
374
|
);
|
|
383
375
|
//# sourceMappingURL=index.js.map
|