@tldraw/editor 4.4.0-canary.cba9b1552dc6 → 4.4.0-canary.cf9dc16ed25a
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 +302 -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/ErrorBoundary.js.map +1 -1
- 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 +60 -30
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +5 -6
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultLoadingScreen.js +2 -2
- package/dist-cjs/lib/components/default-components/DefaultLoadingScreen.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +5 -3
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +15 -3
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +2 -2
- package/dist-cjs/lib/config/createTLStore.js.map +1 -1
- package/dist-cjs/lib/editor/Editor.js +47 -17
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +1 -1
- package/dist-cjs/lib/editor/derivations/bindingsIndex.js.map +1 -1
- 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/FontManager/FontManager.js.map +1 -1
- 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/InputsManager/InputsManager.js.map +1 -1
- 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/SnapManager/BoundsSnaps.js.map +1 -1
- package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +1 -1
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +1 -1
- 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/shapes/shared/resizeBox.js.map +1 -1
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +1 -1
- 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/editor/types/SvgExportContext.js.map +1 -1
- package/dist-cjs/lib/exports/exportToSvg.js.map +1 -1
- package/dist-cjs/lib/exports/getSvgJsx.js.map +1 -1
- package/dist-cjs/lib/{utils/hardResetEditor.js → hooks/EditorComponentsContext.js} +14 -8
- package/dist-cjs/lib/hooks/EditorComponentsContext.js.map +7 -0
- package/dist-cjs/lib/hooks/useCanvasEvents.js +10 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useEditor.js.map +1 -1
- package/dist-cjs/lib/hooks/useEditorComponents.js +4 -10
- package/dist-cjs/lib/hooks/useEditorComponents.js.map +3 -3
- 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/primitives/Vec.js +10 -5
- package/dist-cjs/lib/primitives/Vec.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/deepLinks.js.map +1 -1
- 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/richText.js.map +1 -1
- package/dist-cjs/lib/utils/rotation.js.map +1 -1
- 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 +302 -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/ErrorBoundary.mjs.map +1 -1
- 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 +46 -16
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +2 -3
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultLoadingScreen.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultLoadingScreen.mjs.map +1 -1
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +4 -2
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +14 -2
- package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +2 -2
- package/dist-esm/lib/config/createTLStore.mjs.map +1 -1
- package/dist-esm/lib/editor/Editor.mjs +47 -17
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +1 -1
- package/dist-esm/lib/editor/derivations/bindingsIndex.mjs.map +1 -1
- 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/FontManager/FontManager.mjs.map +1 -1
- 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/InputsManager/InputsManager.mjs.map +1 -1
- 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/SnapManager/BoundsSnaps.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +1 -1
- 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/shapes/shared/resizeBox.mjs.map +1 -1
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +1 -1
- 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/editor/types/SvgExportContext.mjs.map +1 -1
- package/dist-esm/lib/exports/exportToSvg.mjs.map +1 -1
- package/dist-esm/lib/exports/getSvgJsx.mjs.map +1 -1
- package/dist-esm/lib/hooks/EditorComponentsContext.mjs +14 -0
- package/dist-esm/lib/hooks/EditorComponentsContext.mjs.map +7 -0
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +10 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useEditor.mjs.map +1 -1
- package/dist-esm/lib/hooks/useEditorComponents.mjs +12 -36
- package/dist-esm/lib/hooks/useEditorComponents.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/primitives/Vec.mjs +6 -1
- package/dist-esm/lib/primitives/Vec.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/deepLinks.mjs.map +1 -1
- 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/richText.mjs.map +1 -1
- package/dist-esm/lib/utils/rotation.mjs.map +1 -1
- 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/ErrorBoundary.tsx +1 -1
- 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 +40 -4
- package/src/lib/components/default-components/DefaultErrorFallback.tsx +2 -3
- package/src/lib/components/default-components/DefaultLoadingScreen.tsx +1 -1
- package/src/lib/components/default-components/DefaultShapeIndicator.tsx +7 -2
- package/src/lib/components/default-components/DefaultShapeIndicators.tsx +17 -2
- package/src/lib/config/createTLStore.ts +1 -1
- package/src/lib/editor/Editor.ts +78 -19
- package/src/lib/editor/bindings/BindingUtil.ts +1 -1
- package/src/lib/editor/derivations/bindingsIndex.ts +1 -1
- package/src/lib/editor/derivations/notVisibleShapes.ts +40 -18
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +0 -35
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +5 -9
- package/src/lib/editor/managers/FontManager/FontManager.ts +1 -1
- package/src/lib/editor/managers/HistoryManager/HistoryManager.ts +19 -47
- package/src/lib/editor/managers/InputsManager/InputsManager.ts +1 -1
- package/src/lib/editor/managers/ScribbleManager/ScribbleManager.ts +492 -107
- package/src/lib/editor/managers/SnapManager/BoundsSnaps.ts +2 -2
- package/src/lib/editor/managers/SnapManager/HandleSnaps.ts +2 -2
- package/src/lib/editor/managers/TextManager/TextManager.ts +1 -1
- package/src/lib/editor/managers/TickManager/TickManager.ts +1 -1
- package/src/lib/editor/shapes/ShapeUtil.ts +63 -5
- package/src/lib/editor/shapes/shared/resizeBox.ts +1 -1
- package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +2 -2
- package/src/lib/editor/tools/RootState.ts +0 -16
- package/src/lib/editor/types/SvgExportContext.tsx +1 -1
- package/src/lib/exports/exportToSvg.tsx +1 -1
- package/src/lib/exports/getSvgJsx.tsx +1 -1
- package/src/lib/hooks/EditorComponentsContext.tsx +63 -0
- package/src/lib/hooks/useCanvasEvents.ts +13 -2
- package/src/lib/hooks/useEditor.tsx +1 -1
- package/src/lib/hooks/useEditorComponents.tsx +20 -89
- 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/primitives/Vec.ts +7 -1
- 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/deepLinks.ts +1 -1
- 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 +17 -8
- package/src/lib/utils/reparenting.ts +5 -10
- package/src/lib/utils/richText.ts +1 -1
- package/src/lib/utils/rotation.ts +1 -1
- package/src/lib/utils/runtime.ts +26 -1
- package/src/version.ts +3 -3
- 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;
|
|
@@ -1010,7 +1022,7 @@ export declare class EdgeScrollManager {
|
|
|
1010
1022
|
/** @public */
|
|
1011
1023
|
export declare class Editor extends EventEmitter<TLEventMap> {
|
|
1012
1024
|
readonly id: string;
|
|
1013
|
-
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);
|
|
1014
1026
|
private readonly _getShapeVisibility?;
|
|
1015
1027
|
private getIsShapeHiddenCache;
|
|
1016
1028
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
@@ -1905,7 +1917,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1905
1917
|
getDebouncedZoomLevel(): number;
|
|
1906
1918
|
private _getAboveDebouncedZoomThreshold;
|
|
1907
1919
|
/**
|
|
1908
|
-
* 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,
|
|
1909
1921
|
* otherwise it returns the debounced zoom level. This can be used to avoid expensive re-renders during camera movements.
|
|
1910
1922
|
*
|
|
1911
1923
|
* @public
|
|
@@ -2258,10 +2270,10 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2258
2270
|
*/
|
|
2259
2271
|
stopFollowingUser(): this;
|
|
2260
2272
|
/* Excluded from this release type: getUnorderedRenderingShapes */
|
|
2261
|
-
private _cameraState;
|
|
2262
2273
|
private _cameraStateTimeoutRemaining;
|
|
2263
2274
|
private _decayCameraStateTimeout;
|
|
2264
2275
|
private _tickCameraState;
|
|
2276
|
+
private _setCameraState;
|
|
2265
2277
|
/**
|
|
2266
2278
|
* Whether the camera is moving or idle.
|
|
2267
2279
|
*
|
|
@@ -2760,7 +2772,24 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2760
2772
|
hitInside?: boolean;
|
|
2761
2773
|
margin?: number;
|
|
2762
2774
|
}): TLShape[];
|
|
2763
|
-
|
|
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>;
|
|
2764
2793
|
/**
|
|
2765
2794
|
* Test whether a point (in the current page space) will will a shape. This method takes into account masks,
|
|
2766
2795
|
* such as when a shape is the child of a frame and is partially clipped by the frame.
|
|
@@ -3902,7 +3931,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3902
3931
|
/**
|
|
3903
3932
|
* Handles navigating to the content specified by the query param in the given URL.
|
|
3904
3933
|
*
|
|
3905
|
-
* Use {@link Editor
|
|
3934
|
+
* Use {@link Editor.createDeepLink} to create a URL with a deep link query param.
|
|
3906
3935
|
*
|
|
3907
3936
|
* If no URL is provided, it will look for the param in the current `window.location.href`.
|
|
3908
3937
|
*
|
|
@@ -4286,7 +4315,10 @@ export declare function getArcMeasure(A: number, B: number, sweepFlag: number, l
|
|
|
4286
4315
|
/** @public */
|
|
4287
4316
|
export declare function getCursor(cursor: TLCursorType, rotation?: number, color?: string): string;
|
|
4288
4317
|
|
|
4289
|
-
/**
|
|
4318
|
+
/**
|
|
4319
|
+
* Gets the default CDN base URL.
|
|
4320
|
+
* @returns The default CDN base URL.
|
|
4321
|
+
* @public */
|
|
4290
4322
|
export declare function getDefaultCdnBaseUrl(): string;
|
|
4291
4323
|
|
|
4292
4324
|
/**
|
|
@@ -4335,7 +4367,7 @@ export declare function getPerfectDashProps(totalLength: number, strokeWidth: nu
|
|
|
4335
4367
|
};
|
|
4336
4368
|
|
|
4337
4369
|
/** @public */
|
|
4338
|
-
export declare function getPointerInfo(editor: Editor, e: PointerEvent |
|
|
4370
|
+
export declare function getPointerInfo(editor: Editor, e: PointerEvent | React_3.PointerEvent): {
|
|
4339
4371
|
accelKey: boolean;
|
|
4340
4372
|
altKey: boolean;
|
|
4341
4373
|
button: number;
|
|
@@ -4396,7 +4428,7 @@ export declare function getSvgAsImage(svgString: string, options: {
|
|
|
4396
4428
|
}): Promise<Blob | null>;
|
|
4397
4429
|
|
|
4398
4430
|
/**
|
|
4399
|
-
* Turn an array of points into a path of
|
|
4431
|
+
* Turn an array of points into a path of quadratic curves.
|
|
4400
4432
|
*
|
|
4401
4433
|
* @param points - The points returned from perfect-freehand
|
|
4402
4434
|
* @param closed - Whether the stroke is closed
|
|
@@ -4906,7 +4938,6 @@ export declare const isSafeFloat: (n: number) => boolean;
|
|
|
4906
4938
|
|
|
4907
4939
|
/**
|
|
4908
4940
|
* Reparents shapes that are no longer contained within their parent shapes.
|
|
4909
|
-
* todo: rename me to something more descriptive, like `reparentOccludedShapes` or `reparentAutoDroppedShapes`
|
|
4910
4941
|
*
|
|
4911
4942
|
* @param editor - The editor instance.
|
|
4912
4943
|
* @param shapeIds - The IDs of the shapes to reparent.
|
|
@@ -5165,16 +5196,16 @@ export declare function precise(A: VecLike): string;
|
|
|
5165
5196
|
/**
|
|
5166
5197
|
* This function calls `event.preventDefault()` for you. Why is that useful?
|
|
5167
5198
|
*
|
|
5168
|
-
*
|
|
5199
|
+
* Because if you enable `window.preventDefaultLogging = true` it'll log out a message when it
|
|
5169
5200
|
* happens. Because we use console.warn rather than (log) you'll get a stack trace in the inspector
|
|
5170
5201
|
* telling you exactly where it happened. This is important because `e.preventDefault()` is the
|
|
5171
|
-
* 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
|
|
5172
5203
|
* behaviour which doesn't make sense in our UI
|
|
5173
5204
|
*
|
|
5174
5205
|
* @param event - To prevent default on
|
|
5175
5206
|
* @public
|
|
5176
5207
|
*/
|
|
5177
|
-
export declare function preventDefault(event: Event |
|
|
5208
|
+
export declare function preventDefault(event: Event | React.BaseSyntheticEvent): void;
|
|
5178
5209
|
|
|
5179
5210
|
/**
|
|
5180
5211
|
* Convert radians to degrees.
|
|
@@ -5236,7 +5267,7 @@ export declare class Rectangle2d extends Polygon2d {
|
|
|
5236
5267
|
export declare function refreshPage(): void;
|
|
5237
5268
|
|
|
5238
5269
|
/** @public */
|
|
5239
|
-
export declare function releasePointerCapture(element: Element, event: PointerEvent |
|
|
5270
|
+
export declare function releasePointerCapture(element: Element, event: PointerEvent | React.PointerEvent<Element>): void;
|
|
5240
5271
|
|
|
5241
5272
|
/** @public */
|
|
5242
5273
|
export declare type RequiredKeys<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
|
@@ -5304,7 +5335,7 @@ export declare function rotateSelectionHandle(handle: SelectionHandle, rotation:
|
|
|
5304
5335
|
|
|
5305
5336
|
/** @public */
|
|
5306
5337
|
export declare const runtime: {
|
|
5307
|
-
hardReset(): void
|
|
5338
|
+
hardReset(): Promise<void>;
|
|
5308
5339
|
openWindow(url: string, target: string, allowReferrer?: boolean): void;
|
|
5309
5340
|
refreshPage(): void;
|
|
5310
5341
|
};
|
|
@@ -5339,27 +5370,106 @@ export declare interface ScribbleItem {
|
|
|
5339
5370
|
/** @public */
|
|
5340
5371
|
export declare class ScribbleManager {
|
|
5341
5372
|
private editor;
|
|
5342
|
-
|
|
5343
|
-
state: "paused" | "running";
|
|
5373
|
+
private sessions;
|
|
5344
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
|
+
*/
|
|
5345
5441
|
addScribble(scribble: Partial<TLScribble>, id?: string): ScribbleItem;
|
|
5346
|
-
reset(): void;
|
|
5347
5442
|
/**
|
|
5348
|
-
*
|
|
5443
|
+
* Add a point to a scribble. Searches all sessions.
|
|
5349
5444
|
*
|
|
5445
|
+
* @param id - The scribble id
|
|
5446
|
+
* @param x - X coordinate
|
|
5447
|
+
* @param y - Y coordinate
|
|
5448
|
+
* @param z - Z coordinate (pressure)
|
|
5350
5449
|
* @public
|
|
5351
5450
|
*/
|
|
5352
|
-
|
|
5451
|
+
addPoint(id: string, x: number, y: number, z?: number): ScribbleItem;
|
|
5353
5452
|
/**
|
|
5354
|
-
*
|
|
5453
|
+
* Mark a scribble as complete (done being drawn but not yet fading).
|
|
5454
|
+
* Searches all sessions.
|
|
5355
5455
|
*
|
|
5356
|
-
* @param id - The
|
|
5357
|
-
* @param x - The x coordinate of the point.
|
|
5358
|
-
* @param y - The y coordinate of the point.
|
|
5359
|
-
* @param z - The z coordinate of the point.
|
|
5456
|
+
* @param id - The scribble id
|
|
5360
5457
|
* @public
|
|
5361
5458
|
*/
|
|
5362
|
-
|
|
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;
|
|
5363
5473
|
/**
|
|
5364
5474
|
* Update on each animation frame.
|
|
5365
5475
|
*
|
|
@@ -5367,6 +5477,44 @@ export declare class ScribbleManager {
|
|
|
5367
5477
|
* @public
|
|
5368
5478
|
*/
|
|
5369
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;
|
|
5370
5518
|
}
|
|
5371
5519
|
|
|
5372
5520
|
/** @public */
|
|
@@ -5379,7 +5527,7 @@ export declare type SelectionEdge = 'bottom' | 'left' | 'right' | 'top';
|
|
|
5379
5527
|
export declare type SelectionHandle = SelectionCorner | SelectionEdge;
|
|
5380
5528
|
|
|
5381
5529
|
/** @public */
|
|
5382
|
-
export declare function setPointerCapture(element: Element, event: PointerEvent |
|
|
5530
|
+
export declare function setPointerCapture(element: Element, event: PointerEvent | React.PointerEvent<Element>): void;
|
|
5383
5531
|
|
|
5384
5532
|
/** @public */
|
|
5385
5533
|
export declare function setRuntimeOverrides(input: Partial<typeof runtime>): void;
|
|
@@ -5469,6 +5617,31 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5469
5617
|
* @public
|
|
5470
5618
|
*/
|
|
5471
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;
|
|
5472
5645
|
/**
|
|
5473
5646
|
* Get the font faces that should be rendered in the document in order for this shape to render
|
|
5474
5647
|
* correctly.
|
|
@@ -6684,29 +6857,35 @@ export declare interface TldrawEditorBaseProps {
|
|
|
6684
6857
|
inferDarkMode?: boolean;
|
|
6685
6858
|
/**
|
|
6686
6859
|
* Camera options for the editor.
|
|
6860
|
+
*
|
|
6861
|
+
* @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
|
|
6687
6862
|
*/
|
|
6688
6863
|
cameraOptions?: Partial<TLCameraOptions>;
|
|
6689
|
-
/**
|
|
6690
|
-
* Text options for the editor.
|
|
6691
|
-
*/
|
|
6692
|
-
textOptions?: TLTextOptions;
|
|
6693
6864
|
/**
|
|
6694
6865
|
* Options for the editor.
|
|
6695
6866
|
*/
|
|
6696
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;
|
|
6697
6874
|
/**
|
|
6698
6875
|
* The license key.
|
|
6699
6876
|
*/
|
|
6700
6877
|
licenseKey?: string;
|
|
6701
6878
|
/**
|
|
6702
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.
|
|
6703
6882
|
*/
|
|
6704
6883
|
deepLinks?: TLDeepLinkOptions | true;
|
|
6705
6884
|
/**
|
|
6706
6885
|
* Provides a way to hide shapes.
|
|
6707
6886
|
*
|
|
6708
6887
|
* Hidden shapes will not render in the editor, and they will not be eligible for hit test via
|
|
6709
|
-
* {@link Editor
|
|
6888
|
+
* {@link @tldraw/editor#Editor.getShapeAtPoint} and {@link @tldraw/editor#Editor.getShapesAtPoint}. But otherwise they will
|
|
6710
6889
|
* remain in the store and participate in all other operations.
|
|
6711
6890
|
*
|
|
6712
6891
|
* @example
|
|
@@ -6836,6 +7015,12 @@ export declare interface TldrawOptions {
|
|
|
6836
7015
|
readonly flattenImageBoundsExpand: number;
|
|
6837
7016
|
readonly flattenImageBoundsPadding: number;
|
|
6838
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;
|
|
6839
7024
|
readonly maxExportDelayMs: number;
|
|
6840
7025
|
readonly tooltipDelayMs: number;
|
|
6841
7026
|
/**
|
|
@@ -6873,13 +7058,13 @@ export declare interface TldrawOptions {
|
|
|
6873
7058
|
readonly branding?: string;
|
|
6874
7059
|
/**
|
|
6875
7060
|
* Whether to use debounced zoom level for certain rendering optimizations. When true,
|
|
6876
|
-
* `editor.
|
|
7061
|
+
* `editor.getEfficientZoomLevel()` returns a cached zoom value while the camera is moving,
|
|
6877
7062
|
* reducing re-renders. When false, it always returns the current zoom level.
|
|
6878
7063
|
*/
|
|
6879
7064
|
readonly debouncedZoom: boolean;
|
|
6880
7065
|
/**
|
|
6881
7066
|
* The number of shapes that must be on the page for the debounced zoom level to be used.
|
|
6882
|
-
* Defaults to
|
|
7067
|
+
* Defaults to 500 shapes.
|
|
6883
7068
|
*/
|
|
6884
7069
|
readonly debouncedZoomThreshold: number;
|
|
6885
7070
|
/**
|
|
@@ -6898,6 +7083,46 @@ export declare interface TldrawOptions {
|
|
|
6898
7083
|
* The distance (in screen pixels) at which shapes snap to guides and other shapes.
|
|
6899
7084
|
*/
|
|
6900
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;
|
|
6901
7126
|
}
|
|
6902
7127
|
|
|
6903
7128
|
/** @public */
|
|
@@ -6982,10 +7207,17 @@ export declare interface TLEditorOptions {
|
|
|
6982
7207
|
inferDarkMode?: boolean;
|
|
6983
7208
|
/**
|
|
6984
7209
|
* Options for the editor's camera.
|
|
7210
|
+
*
|
|
7211
|
+
* @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
|
|
6985
7212
|
*/
|
|
6986
7213
|
cameraOptions?: Partial<TLCameraOptions>;
|
|
6987
|
-
textOptions?: TLTextOptions;
|
|
6988
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;
|
|
6989
7221
|
licenseKey?: string;
|
|
6990
7222
|
fontAssetUrls?: {
|
|
6991
7223
|
[key: string]: string | undefined;
|
|
@@ -7399,6 +7631,17 @@ export declare interface TLImageExportOptions extends TLSvgExportOptions {
|
|
|
7399
7631
|
format?: TLExportType;
|
|
7400
7632
|
}
|
|
7401
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
|
+
|
|
7402
7645
|
/** @public */
|
|
7403
7646
|
export declare type TLInterruptEvent = (info: TLInterruptEventInfo) => void;
|
|
7404
7647
|
|
|
@@ -7842,17 +8085,35 @@ export declare interface TLShapeUtilCanBeLaidOutOpts {
|
|
|
7842
8085
|
|
|
7843
8086
|
/**
|
|
7844
8087
|
* Options passed to {@link ShapeUtil.canBind}. A binding that could be made. At least one of
|
|
7845
|
-
* `
|
|
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.
|
|
7846
8093
|
*
|
|
7847
8094
|
* @public
|
|
7848
8095
|
*/
|
|
7849
8096
|
export declare interface TLShapeUtilCanBindOpts<Shape extends TLShape = TLShape> {
|
|
7850
|
-
/** The
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
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;
|
|
7854
8105
|
/** The type of binding. */
|
|
7855
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'];
|
|
7856
8117
|
}
|
|
7857
8118
|
|
|
7858
8119
|
/** @public */
|
|
@@ -7906,7 +8167,7 @@ export declare interface TLStoreBaseOptions {
|
|
|
7906
8167
|
defaultName?: string;
|
|
7907
8168
|
/** How should this store upload & resolve assets? */
|
|
7908
8169
|
assets?: TLAssetStore;
|
|
7909
|
-
/** Called when the store is connected to an {@link Editor}. */
|
|
8170
|
+
/** Called when the store is connected to an {@link @tldraw/editor#Editor}. */
|
|
7910
8171
|
onMount?(editor: Editor): (() => void) | void;
|
|
7911
8172
|
}
|
|
7912
8173
|
|
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.cf9dc16ed25a",
|
|
381
373
|
"cjs"
|
|
382
374
|
);
|
|
383
375
|
//# sourceMappingURL=index.js.map
|