@tldraw/editor 3.16.0-next.f9f54ec051f3 → 4.0.0
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 +197 -114
- package/dist-cjs/index.js +5 -5
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +9 -9
- package/dist-cjs/lib/TldrawEditor.js.map +2 -2
- package/dist-cjs/lib/components/MenuClickCapture.js +0 -5
- package/dist-cjs/lib/components/MenuClickCapture.js.map +2 -2
- package/dist-cjs/lib/components/Shape.js +7 -10
- package/dist-cjs/lib/components/Shape.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +14 -23
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +1 -1
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultScribble.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultScribble.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +9 -1
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
- package/dist-cjs/lib/config/TLUserPreferences.js +21 -4
- package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +121 -138
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/notVisibleShapes.js +4 -0
- package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +2 -2
- package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js +4 -2
- package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +14 -4
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +23 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/types/misc-types.js.map +1 -1
- package/dist-cjs/lib/exports/getSvgJsx.js +35 -16
- package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js +47 -38
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useDocumentEvents.js +5 -5
- package/dist-cjs/lib/hooks/useDocumentEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js +1 -2
- package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useGestureEvents.js +1 -1
- package/dist-cjs/lib/hooks/useGestureEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useHandleEvents.js +6 -6
- package/dist-cjs/lib/hooks/useHandleEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js +4 -1
- package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js +4 -1
- package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useSelectionEvents.js +8 -8
- package/dist-cjs/lib/hooks/useSelectionEvents.js.map +2 -2
- package/dist-cjs/lib/{utils/nearestMultiple.js → hooks/useStateAttribute.js} +15 -14
- package/dist-cjs/lib/hooks/useStateAttribute.js.map +7 -0
- package/dist-cjs/lib/license/LicenseManager.js +143 -53
- package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
- package/dist-cjs/lib/license/LicenseProvider.js +39 -1
- package/dist-cjs/lib/license/LicenseProvider.js.map +2 -2
- package/dist-cjs/lib/license/Watermark.js +144 -75
- package/dist-cjs/lib/license/Watermark.js.map +3 -3
- package/dist-cjs/lib/license/useLicenseManagerState.js.map +2 -2
- package/dist-cjs/lib/options.js +7 -0
- package/dist-cjs/lib/options.js.map +2 -2
- package/dist-cjs/lib/primitives/Box.js +3 -0
- package/dist-cjs/lib/primitives/Box.js.map +2 -2
- package/dist-cjs/lib/primitives/Vec.js +0 -4
- package/dist-cjs/lib/primitives/Vec.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js +50 -20
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Group2d.js +8 -1
- package/dist-cjs/lib/primitives/geometry/Group2d.js.map +2 -2
- package/dist-cjs/lib/utils/EditorAtom.js +45 -0
- package/dist-cjs/lib/utils/EditorAtom.js.map +7 -0
- package/dist-cjs/lib/utils/dom.js.map +2 -2
- package/dist-cjs/lib/utils/getPointerInfo.js +2 -3
- package/dist-cjs/lib/utils/getPointerInfo.js.map +2 -2
- package/dist-cjs/lib/utils/reparenting.js +7 -36
- package/dist-cjs/lib/utils/reparenting.js.map +3 -3
- package/dist-cjs/version.js +4 -4
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +197 -114
- package/dist-esm/index.mjs +5 -5
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +9 -9
- package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
- package/dist-esm/lib/components/MenuClickCapture.mjs +0 -5
- package/dist-esm/lib/components/MenuClickCapture.mjs.map +2 -2
- package/dist-esm/lib/components/Shape.mjs +7 -10
- package/dist-esm/lib/components/Shape.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +14 -23
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +1 -1
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultScribble.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultScribble.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +9 -1
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
- package/dist-esm/lib/config/TLUserPreferences.mjs +21 -4
- package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +121 -138
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs +4 -0
- package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs +4 -2
- package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +14 -4
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +23 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/exports/getSvgJsx.mjs +36 -16
- package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +49 -45
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useDocumentEvents.mjs +6 -6
- package/dist-esm/lib/hooks/useDocumentEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs +1 -2
- package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useGestureEvents.mjs +2 -2
- package/dist-esm/lib/hooks/useGestureEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useHandleEvents.mjs +6 -6
- package/dist-esm/lib/hooks/useHandleEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs +4 -1
- package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs +4 -1
- package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useSelectionEvents.mjs +9 -14
- package/dist-esm/lib/hooks/useSelectionEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useStateAttribute.mjs +15 -0
- package/dist-esm/lib/hooks/useStateAttribute.mjs.map +7 -0
- package/dist-esm/lib/license/LicenseManager.mjs +144 -54
- package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
- package/dist-esm/lib/license/LicenseProvider.mjs +39 -2
- package/dist-esm/lib/license/LicenseProvider.mjs.map +2 -2
- package/dist-esm/lib/license/Watermark.mjs +145 -76
- package/dist-esm/lib/license/Watermark.mjs.map +3 -3
- package/dist-esm/lib/license/useLicenseManagerState.mjs.map +2 -2
- package/dist-esm/lib/options.mjs +7 -0
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/lib/primitives/Box.mjs +4 -1
- package/dist-esm/lib/primitives/Box.mjs.map +2 -2
- package/dist-esm/lib/primitives/Vec.mjs +0 -4
- package/dist-esm/lib/primitives/Vec.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +53 -21
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Group2d.mjs +8 -1
- package/dist-esm/lib/primitives/geometry/Group2d.mjs.map +2 -2
- package/dist-esm/lib/utils/EditorAtom.mjs +25 -0
- package/dist-esm/lib/utils/EditorAtom.mjs.map +7 -0
- package/dist-esm/lib/utils/dom.mjs.map +2 -2
- package/dist-esm/lib/utils/getPointerInfo.mjs +2 -3
- package/dist-esm/lib/utils/getPointerInfo.mjs.map +2 -2
- package/dist-esm/lib/utils/reparenting.mjs +8 -41
- package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
- package/dist-esm/version.mjs +4 -4
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +308 -290
- package/package.json +14 -37
- package/src/index.ts +4 -9
- package/src/lib/TldrawEditor.tsx +14 -21
- package/src/lib/components/MenuClickCapture.tsx +0 -8
- package/src/lib/components/Shape.tsx +6 -12
- package/src/lib/components/default-components/DefaultCanvas.tsx +11 -22
- package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +1 -1
- package/src/lib/components/default-components/DefaultErrorFallback.tsx +1 -1
- package/src/lib/components/default-components/DefaultScribble.tsx +1 -1
- package/src/lib/components/default-components/DefaultShapeIndicator.tsx +5 -1
- package/src/lib/config/TLUserPreferences.ts +21 -1
- package/src/lib/editor/Editor.test.ts +102 -11
- package/src/lib/editor/Editor.ts +165 -198
- package/src/lib/editor/derivations/notVisibleShapes.ts +6 -0
- package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +15 -14
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +16 -15
- package/src/lib/editor/managers/FocusManager/FocusManager.test.ts +49 -48
- package/src/lib/editor/managers/FocusManager/FocusManager.ts +6 -2
- package/src/lib/editor/managers/FontManager/FontManager.test.ts +24 -23
- package/src/lib/editor/managers/HistoryManager/HistoryManager.test.ts +7 -6
- package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +12 -11
- package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +57 -50
- package/src/lib/editor/managers/TextManager/TextManager.test.ts +51 -26
- package/src/lib/editor/managers/TickManager/TickManager.test.ts +14 -13
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +56 -26
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +13 -1
- package/src/lib/editor/shapes/ShapeUtil.ts +46 -0
- package/src/lib/editor/types/misc-types.ts +54 -7
- package/src/lib/exports/getSvgJsx.test.ts +868 -0
- package/src/lib/exports/getSvgJsx.tsx +78 -21
- package/src/lib/hooks/useCanvasEvents.ts +62 -55
- package/src/lib/hooks/useDocumentEvents.ts +6 -6
- package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +1 -1
- package/src/lib/hooks/useGestureEvents.ts +2 -2
- package/src/lib/hooks/useHandleEvents.ts +6 -6
- package/src/lib/hooks/usePassThroughMouseOverEvents.ts +4 -1
- package/src/lib/hooks/usePassThroughWheelEvents.ts +6 -1
- package/src/lib/hooks/useSelectionEvents.ts +9 -14
- package/src/lib/hooks/useStateAttribute.ts +15 -0
- package/src/lib/license/LicenseManager.test.ts +724 -383
- package/src/lib/license/LicenseManager.ts +204 -58
- package/src/lib/license/LicenseProvider.tsx +74 -2
- package/src/lib/license/Watermark.test.tsx +2 -1
- package/src/lib/license/Watermark.tsx +152 -77
- package/src/lib/license/useLicenseManagerState.ts +2 -2
- package/src/lib/options.ts +8 -0
- package/src/lib/primitives/Box.test.ts +126 -0
- package/src/lib/primitives/Box.ts +10 -1
- package/src/lib/primitives/Vec.ts +0 -5
- package/src/lib/primitives/geometry/Geometry2d.test.ts +420 -0
- package/src/lib/primitives/geometry/Geometry2d.ts +78 -21
- package/src/lib/primitives/geometry/Group2d.ts +10 -1
- package/src/lib/test/InFrontOfTheCanvas.test.tsx +187 -0
- package/src/lib/utils/EditorAtom.ts +37 -0
- package/src/lib/utils/dom.test.ts +103 -0
- package/src/lib/utils/dom.ts +8 -1
- package/src/lib/utils/getPointerInfo.ts +3 -2
- package/src/lib/utils/reparenting.ts +10 -70
- package/src/lib/utils/sync/LocalIndexedDb.test.ts +2 -1
- package/src/lib/utils/sync/TLLocalSyncClient.test.ts +15 -15
- package/src/version.ts +4 -4
- package/dist-cjs/lib/utils/nearestMultiple.js.map +0 -7
- package/dist-esm/lib/utils/nearestMultiple.mjs +0 -14
- package/dist-esm/lib/utils/nearestMultiple.mjs.map +0 -7
- package/src/lib/utils/nearestMultiple.ts +0 -13
package/dist-esm/index.d.mts
CHANGED
|
@@ -510,6 +510,7 @@ export declare class Box {
|
|
|
510
510
|
static ExpandBy(A: Box, n: number): Box;
|
|
511
511
|
static Collides(A: Box, B: Box): boolean;
|
|
512
512
|
static Contains(A: Box, B: Box): boolean;
|
|
513
|
+
static ContainsApproximately(A: Box, B: Box, precision?: number): boolean;
|
|
513
514
|
static Includes(A: Box, B: Box): boolean;
|
|
514
515
|
static ContainsPoint(A: Box, B: VecLike, margin?: number): boolean;
|
|
515
516
|
static Common(boxes: Box[]): Box;
|
|
@@ -760,11 +761,6 @@ export declare class CubicSpline2d extends Geometry2d {
|
|
|
760
761
|
/** @public */
|
|
761
762
|
export declare function dataUrlToFile(url: string, filename: string, mimeType: string): Promise<File>;
|
|
762
763
|
|
|
763
|
-
/**
|
|
764
|
-
* @deprecated Licensing is now enabled in the tldraw SDK.
|
|
765
|
-
* @public */
|
|
766
|
-
export declare function debugEnableLicensing(): void;
|
|
767
|
-
|
|
768
764
|
/* Excluded from this release type: DebugFlag */
|
|
769
765
|
|
|
770
766
|
/* Excluded from this release type: DebugFlagDef */
|
|
@@ -889,6 +885,9 @@ export declare const defaultTldrawOptions: {
|
|
|
889
885
|
readonly nonce: undefined;
|
|
890
886
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
891
887
|
readonly textShadowLod: 0.35;
|
|
888
|
+
readonly tooltipDelayMs: 700;
|
|
889
|
+
readonly uiCoarseDragDistanceSquared: 625;
|
|
890
|
+
readonly uiDragDistanceSquared: 16;
|
|
892
891
|
};
|
|
893
892
|
|
|
894
893
|
/** @public */
|
|
@@ -898,6 +897,8 @@ export declare const defaultUserPreferences: Readonly<{
|
|
|
898
897
|
color: "#02B1CC" | "#11B3A3" | "#39B178" | "#55B467" | "#7B66DC" | "#9D5BD2" | "#BD54C6" | "#E34BA9" | "#EC5E41" | "#F04F88" | "#F2555A" | "#FF802B";
|
|
899
898
|
colorScheme: "light";
|
|
900
899
|
edgeScrollSpeed: 1;
|
|
900
|
+
enhancedA11yMode: false;
|
|
901
|
+
inputMode: null;
|
|
901
902
|
isDynamicSizeMode: false;
|
|
902
903
|
isPasteAtCursorMode: false;
|
|
903
904
|
isSnapMode: false;
|
|
@@ -979,7 +980,7 @@ export declare class EdgeScrollManager {
|
|
|
979
980
|
/** @public */
|
|
980
981
|
export declare class Editor extends EventEmitter<TLEventMap> {
|
|
981
982
|
readonly id: string;
|
|
982
|
-
constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, textOptions, initialState, autoFocus, inferDarkMode, options,
|
|
983
|
+
constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, textOptions, initialState, autoFocus, inferDarkMode, options, getShapeVisibility, fontAssetUrls, }: TLEditorOptions);
|
|
983
984
|
private readonly _getShapeVisibility?;
|
|
984
985
|
private getIsShapeHiddenCache;
|
|
985
986
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
@@ -1046,22 +1047,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1046
1047
|
* @public
|
|
1047
1048
|
*/
|
|
1048
1049
|
readonly fonts: FontManager;
|
|
1049
|
-
/**
|
|
1050
|
-
* A manager for the editor's environment.
|
|
1051
|
-
*
|
|
1052
|
-
* @deprecated This is deprecated and will be removed in a future version. Use the `tlenv` global export instead.
|
|
1053
|
-
* @public
|
|
1054
|
-
*/
|
|
1055
|
-
readonly environment: {
|
|
1056
|
-
hasCanvasSupport: boolean;
|
|
1057
|
-
isAndroid: boolean;
|
|
1058
|
-
isChromeForIos: boolean;
|
|
1059
|
-
isDarwin: boolean;
|
|
1060
|
-
isFirefox: boolean;
|
|
1061
|
-
isIos: boolean;
|
|
1062
|
-
isSafari: boolean;
|
|
1063
|
-
isWebview: boolean;
|
|
1064
|
-
};
|
|
1065
1050
|
/**
|
|
1066
1051
|
* A manager for the editor's scribbles.
|
|
1067
1052
|
*
|
|
@@ -1204,22 +1189,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1204
1189
|
* @public
|
|
1205
1190
|
*/
|
|
1206
1191
|
getCanRedo(): boolean;
|
|
1207
|
-
/**
|
|
1208
|
-
* Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
|
|
1209
|
-
* any redos.
|
|
1210
|
-
*
|
|
1211
|
-
* @example
|
|
1212
|
-
* ```ts
|
|
1213
|
-
* editor.mark()
|
|
1214
|
-
* editor.mark('flip shapes')
|
|
1215
|
-
* ```
|
|
1216
|
-
*
|
|
1217
|
-
* @param markId - The mark's id, usually the reason for adding the mark.
|
|
1218
|
-
*
|
|
1219
|
-
* @public
|
|
1220
|
-
* @deprecated use {@link Editor.markHistoryStoppingPoint} instead
|
|
1221
|
-
*/
|
|
1222
|
-
mark(markId?: string): this;
|
|
1223
1192
|
/**
|
|
1224
1193
|
* Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
|
|
1225
1194
|
* any redos. You typically want to do this just before a user interaction begins or is handled.
|
|
@@ -1309,10 +1278,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1309
1278
|
* @public
|
|
1310
1279
|
*/
|
|
1311
1280
|
run(fn: () => void, opts?: TLEditorRunOptions): this;
|
|
1312
|
-
/**
|
|
1313
|
-
* @deprecated Use `Editor.run` instead.
|
|
1314
|
-
*/
|
|
1315
|
-
batch(fn: () => void, opts?: TLEditorRunOptions): this;
|
|
1316
1281
|
/* Excluded from this release type: annotateError */
|
|
1317
1282
|
/* Excluded from this release type: createErrorAnnotations */
|
|
1318
1283
|
/* Excluded from this release type: _crashingError */
|
|
@@ -1434,36 +1399,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1434
1399
|
hasOpenMenus: () => boolean;
|
|
1435
1400
|
isMenuOpen: (id: string) => boolean;
|
|
1436
1401
|
};
|
|
1437
|
-
/**
|
|
1438
|
-
* @deprecated Use `editor.menus.getOpenMenus` instead.
|
|
1439
|
-
*
|
|
1440
|
-
* @public
|
|
1441
|
-
*/
|
|
1442
|
-
getOpenMenus(): string[];
|
|
1443
|
-
/**
|
|
1444
|
-
* @deprecated Use `editor.menus.addOpenMenu` instead.
|
|
1445
|
-
*
|
|
1446
|
-
* @public
|
|
1447
|
-
*/
|
|
1448
|
-
addOpenMenu(id: string): this;
|
|
1449
|
-
/**
|
|
1450
|
-
* @deprecated Use `editor.menus.deleteOpenMenu` instead.
|
|
1451
|
-
*
|
|
1452
|
-
* @public
|
|
1453
|
-
*/
|
|
1454
|
-
deleteOpenMenu(id: string): this;
|
|
1455
|
-
/**
|
|
1456
|
-
* @deprecated Use `editor.menus.clearOpenMenus` instead.
|
|
1457
|
-
*
|
|
1458
|
-
* @public
|
|
1459
|
-
*/
|
|
1460
|
-
clearOpenMenus(): this;
|
|
1461
|
-
/**
|
|
1462
|
-
* @deprecated Use `editor.menus.hasAnyOpenMenus` instead.
|
|
1463
|
-
*
|
|
1464
|
-
* @public
|
|
1465
|
-
*/
|
|
1466
|
-
getIsMenuOpen(): boolean;
|
|
1467
1402
|
/**
|
|
1468
1403
|
* Set the cursor.
|
|
1469
1404
|
*
|
|
@@ -2690,15 +2625,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2690
2625
|
*
|
|
2691
2626
|
* @returns The shape at the given point, or undefined if there is no shape at the point.
|
|
2692
2627
|
*/
|
|
2693
|
-
getShapeAtPoint(point: VecLike, opts?:
|
|
2694
|
-
filter?(shape: TLShape): boolean;
|
|
2695
|
-
hitFrameInside?: boolean;
|
|
2696
|
-
hitInside?: boolean;
|
|
2697
|
-
hitLabels?: boolean;
|
|
2698
|
-
hitLocked?: boolean;
|
|
2699
|
-
margin?: number;
|
|
2700
|
-
renderingOnly?: boolean;
|
|
2701
|
-
}): TLShape | undefined;
|
|
2628
|
+
getShapeAtPoint(point: VecLike, opts?: TLGetShapeAtPointOptions): TLShape | undefined;
|
|
2702
2629
|
/**
|
|
2703
2630
|
* Get the shapes, if any, at a given page point.
|
|
2704
2631
|
*
|
|
@@ -2920,8 +2847,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2920
2847
|
* @public
|
|
2921
2848
|
*/
|
|
2922
2849
|
getShapeAndDescendantIds(ids: TLShapeId[]): Set<TLShapeId>;
|
|
2923
|
-
/** @deprecated Use {@link Editor.getDraggingOverShape} instead */
|
|
2924
|
-
getDroppingOverShape(point: Vec, droppingShapes: TLShape[]): TLShape | undefined;
|
|
2925
2850
|
/**
|
|
2926
2851
|
* Get the shape that some shapes should be dropped on at a given point.
|
|
2927
2852
|
*
|
|
@@ -3633,14 +3558,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3633
3558
|
* Handle external content, such as files, urls, embeds, or plain text which has been put into the app, for example by pasting external text or dropping external images onto canvas.
|
|
3634
3559
|
*
|
|
3635
3560
|
* @param info - Info about the external content.
|
|
3561
|
+
* @param opts - Options for handling external content, including force flag to bypass readonly checks.
|
|
3636
3562
|
*/
|
|
3637
|
-
putExternalContent<E>(info: TLExternalContent<E
|
|
3563
|
+
putExternalContent<E>(info: TLExternalContent<E>, opts?: {
|
|
3564
|
+
force?: boolean;
|
|
3565
|
+
}): Promise<void>;
|
|
3638
3566
|
/**
|
|
3639
3567
|
* Handle replacing external content.
|
|
3640
3568
|
*
|
|
3641
3569
|
* @param info - Info about the external content.
|
|
3570
|
+
* @param opts - Options for handling external content, including force flag to bypass readonly checks.
|
|
3642
3571
|
*/
|
|
3643
|
-
replaceExternalContent<E>(info: TLExternalContent<E
|
|
3572
|
+
replaceExternalContent<E>(info: TLExternalContent<E>, opts?: {
|
|
3573
|
+
force?: boolean;
|
|
3574
|
+
}): Promise<void>;
|
|
3644
3575
|
/**
|
|
3645
3576
|
* Get content that can be exported for the given shape ids.
|
|
3646
3577
|
*
|
|
@@ -3696,8 +3627,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3696
3627
|
svg: string;
|
|
3697
3628
|
width: number;
|
|
3698
3629
|
} | undefined>;
|
|
3699
|
-
/** @deprecated Use {@link Editor.getSvgString} or {@link Editor.getSvgElement} instead. */
|
|
3700
|
-
getSvg(shapes: TLShape[] | TLShapeId[], opts?: TLSvgExportOptions): Promise<SVGSVGElement | undefined>;
|
|
3701
3630
|
/**
|
|
3702
3631
|
* Get an exported image of the given shapes.
|
|
3703
3632
|
*
|
|
@@ -3712,6 +3641,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3712
3641
|
height: number;
|
|
3713
3642
|
width: number;
|
|
3714
3643
|
}>;
|
|
3644
|
+
/**
|
|
3645
|
+
* Get an exported image of the given shapes as a data URL.
|
|
3646
|
+
*
|
|
3647
|
+
* @param shapes - The shapes (or shape ids) to export.
|
|
3648
|
+
* @param opts - Options for the export.
|
|
3649
|
+
*
|
|
3650
|
+
* @returns A data URL of the image.
|
|
3651
|
+
* @public
|
|
3652
|
+
*/
|
|
3653
|
+
toImageDataUrl(shapes: TLShape[] | TLShapeId[], opts?: TLImageExportOptions): Promise<{
|
|
3654
|
+
height: number;
|
|
3655
|
+
url: string;
|
|
3656
|
+
width: number;
|
|
3657
|
+
}>;
|
|
3715
3658
|
/**
|
|
3716
3659
|
* The app's current input state.
|
|
3717
3660
|
*
|
|
@@ -4017,6 +3960,31 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
4017
3960
|
/* Excluded from this release type: capturedPointerId */
|
|
4018
3961
|
/* Excluded from this release type: performanceTracker */
|
|
4019
3962
|
/* Excluded from this release type: performanceTrackerTimeout */
|
|
3963
|
+
/* Excluded from this release type: handledEvents */
|
|
3964
|
+
/**
|
|
3965
|
+
* In tldraw, events are sometimes handled by multiple components. For example, the shapes might
|
|
3966
|
+
* have events, but the canvas handles events too. The way that the canvas handles events can
|
|
3967
|
+
* interfere with the with the shapes event handlers - for example, it calls `.preventDefault()`
|
|
3968
|
+
* on `pointerDown`, which also prevents `click` events from firing on the shapes.
|
|
3969
|
+
*
|
|
3970
|
+
* You can use `.stopPropagation()` to prevent the event from propagating to the rest of the
|
|
3971
|
+
* DOM, but that can impact non-tldraw event handlers set up elsewhere. By using
|
|
3972
|
+
* `markEventAsHandled`, you'll stop other parts of tldraw from handling the event without
|
|
3973
|
+
* impacting other, non-tldraw event handlers. See also {@link Editor.wasEventAlreadyHandled}.
|
|
3974
|
+
*
|
|
3975
|
+
* @public
|
|
3976
|
+
*/
|
|
3977
|
+
markEventAsHandled(e: {
|
|
3978
|
+
nativeEvent: Event;
|
|
3979
|
+
} | Event): void;
|
|
3980
|
+
/**
|
|
3981
|
+
* Checks if an event has already been handled. See {@link Editor.markEventAsHandled}.
|
|
3982
|
+
*
|
|
3983
|
+
* @public
|
|
3984
|
+
*/
|
|
3985
|
+
wasEventAlreadyHandled(e: {
|
|
3986
|
+
nativeEvent: Event;
|
|
3987
|
+
} | Event): boolean;
|
|
4020
3988
|
/**
|
|
4021
3989
|
* Dispatch an event to the editor.
|
|
4022
3990
|
*
|
|
@@ -4036,6 +4004,26 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
4036
4004
|
/* Excluded from this release type: maybeTrackPerformance */
|
|
4037
4005
|
}
|
|
4038
4006
|
|
|
4007
|
+
/**
|
|
4008
|
+
* An Atom that is scoped to the lifetime of an Editor.
|
|
4009
|
+
*
|
|
4010
|
+
* This is useful for storing UI state for tldraw applications. Keeping state scoped to an editor
|
|
4011
|
+
* instead of stored in a global atom can prevent issues with state being shared between editors
|
|
4012
|
+
* when navigating between pages, or when multiple editor instances are used on the same page.
|
|
4013
|
+
*
|
|
4014
|
+
* @public
|
|
4015
|
+
*/
|
|
4016
|
+
export declare class EditorAtom<T> {
|
|
4017
|
+
private name;
|
|
4018
|
+
private getInitialState;
|
|
4019
|
+
private states;
|
|
4020
|
+
constructor(name: string, getInitialState: (editor: Editor) => T);
|
|
4021
|
+
getAtom(editor: Editor): Atom<T>;
|
|
4022
|
+
get(editor: Editor): T;
|
|
4023
|
+
update(editor: Editor, update: (state: T) => T): T;
|
|
4024
|
+
set(editor: Editor, state: T): T;
|
|
4025
|
+
}
|
|
4026
|
+
|
|
4039
4027
|
/** @public */
|
|
4040
4028
|
export declare const EditorContext: React_3.Context<Editor | null>;
|
|
4041
4029
|
|
|
@@ -4133,6 +4121,7 @@ export declare abstract class Geometry2d {
|
|
|
4133
4121
|
isLabel: boolean;
|
|
4134
4122
|
isEmptyLabel: boolean;
|
|
4135
4123
|
isInternal: boolean;
|
|
4124
|
+
excludeFromShapeBounds: boolean;
|
|
4136
4125
|
debugColor?: string;
|
|
4137
4126
|
ignore?: boolean;
|
|
4138
4127
|
constructor(opts: Geometry2dOptions);
|
|
@@ -4156,12 +4145,14 @@ export declare abstract class Geometry2d {
|
|
|
4156
4145
|
* along the edge it is as a fraction of the total length.
|
|
4157
4146
|
*/
|
|
4158
4147
|
uninterpolateAlongEdge(point: VecLike, _filters?: Geometry2dFilters): number;
|
|
4159
|
-
/** @deprecated Iterate the vertices instead. */
|
|
4160
|
-
nearestPointOnLineSegment(A: VecLike, B: VecLike): Vec;
|
|
4161
4148
|
isPointInBounds(point: VecLike, margin?: number): boolean;
|
|
4149
|
+
overlapsPolygon(_polygon: VecLike[]): boolean;
|
|
4162
4150
|
transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
|
|
4163
4151
|
private _vertices;
|
|
4164
4152
|
get vertices(): Vec[];
|
|
4153
|
+
getBoundsVertices(): Vec[];
|
|
4154
|
+
private _boundsVertices;
|
|
4155
|
+
get boundsVertices(): Vec[];
|
|
4165
4156
|
getBounds(): Box;
|
|
4166
4157
|
private _bounds;
|
|
4167
4158
|
get bounds(): Box;
|
|
@@ -4269,7 +4260,7 @@ export declare function getPerfectDashProps(totalLength: number, strokeWidth: nu
|
|
|
4269
4260
|
};
|
|
4270
4261
|
|
|
4271
4262
|
/** @public */
|
|
4272
|
-
export declare function getPointerInfo(e: PointerEvent | React.PointerEvent): {
|
|
4263
|
+
export declare function getPointerInfo(editor: Editor, e: PointerEvent | React.PointerEvent): {
|
|
4273
4264
|
accelKey: boolean;
|
|
4274
4265
|
altKey: boolean;
|
|
4275
4266
|
button: number;
|
|
@@ -4358,6 +4349,7 @@ export declare class Group2d extends Geometry2d {
|
|
|
4358
4349
|
hitTestLineSegment(A: VecLike, B: VecLike, zoom: number, filters?: Geometry2dFilters): boolean;
|
|
4359
4350
|
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): VecLike[];
|
|
4360
4351
|
intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): VecLike[];
|
|
4352
|
+
getBoundsVertices(): Vec[];
|
|
4361
4353
|
intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
4362
4354
|
intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
4363
4355
|
interpolateAlongEdge(t: number, filters?: Geometry2dFilters): Vec;
|
|
@@ -4367,6 +4359,7 @@ export declare class Group2d extends Geometry2d {
|
|
|
4367
4359
|
toSimpleSvgPath(): string;
|
|
4368
4360
|
getLength(filters?: Geometry2dFilters): number;
|
|
4369
4361
|
getSvgPathData(): string;
|
|
4362
|
+
overlapsPolygon(polygon: VecLike[]): boolean;
|
|
4370
4363
|
}
|
|
4371
4364
|
|
|
4372
4365
|
/** @public */
|
|
@@ -4607,12 +4600,16 @@ export declare function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeI
|
|
|
4607
4600
|
filter?(parent: TLShape): boolean;
|
|
4608
4601
|
}): void;
|
|
4609
4602
|
|
|
4603
|
+
/* Excluded from this release type: LICENSE_TIMEOUT */
|
|
4604
|
+
|
|
4610
4605
|
/* Excluded from this release type: LicenseFromKeyResult */
|
|
4611
4606
|
|
|
4612
4607
|
/* Excluded from this release type: LicenseInfo */
|
|
4613
4608
|
|
|
4614
4609
|
/* Excluded from this release type: LicenseManager */
|
|
4615
4610
|
|
|
4611
|
+
/* Excluded from this release type: LicenseState */
|
|
4612
|
+
|
|
4616
4613
|
/** @public */
|
|
4617
4614
|
export declare function linesIntersect(A: VecLike, B: VecLike, C: VecLike, D: VecLike): boolean;
|
|
4618
4615
|
|
|
@@ -5218,7 +5215,34 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5218
5215
|
* @public
|
|
5219
5216
|
*/
|
|
5220
5217
|
canBeLaidOut(_shape: Shape, _info: TLShapeUtilCanBeLaidOutOpts): boolean;
|
|
5218
|
+
/**
|
|
5219
|
+
* Whether this shape can be culled. By default, shapes are culled for
|
|
5220
|
+
* performance reasons when they are outside of the viewport. Culled shapes are still rendered
|
|
5221
|
+
* to the DOM, but have their `display` property set to `none`.
|
|
5222
|
+
*
|
|
5223
|
+
* @param shape - The shape.
|
|
5224
|
+
*/
|
|
5225
|
+
canCull(_shape: Shape): boolean;
|
|
5221
5226
|
/* Excluded from this release type: providesBackgroundForChildren */
|
|
5227
|
+
/**
|
|
5228
|
+
* Get the clip path to apply to this shape's children.
|
|
5229
|
+
*
|
|
5230
|
+
* @param shape - The shape to get the clip path for
|
|
5231
|
+
* @returns Array of points defining the clipping polygon in local coordinates, or undefined if no clipping
|
|
5232
|
+
* @public
|
|
5233
|
+
*/
|
|
5234
|
+
getClipPath?(shape: Shape): undefined | Vec[];
|
|
5235
|
+
/**
|
|
5236
|
+
* Whether a specific child shape should be clipped by this shape.
|
|
5237
|
+
* Only called if getClipPath returns a valid polygon.
|
|
5238
|
+
*
|
|
5239
|
+
* If not defined, the default behavior is to clip all children.
|
|
5240
|
+
*
|
|
5241
|
+
* @param child - The child shape to check
|
|
5242
|
+
* @returns boolean indicating if this child should be clipped
|
|
5243
|
+
* @public
|
|
5244
|
+
*/
|
|
5245
|
+
shouldClipChild?(child: TLShape): boolean;
|
|
5222
5246
|
/**
|
|
5223
5247
|
* Whether the shape should hide its resize handles when selected.
|
|
5224
5248
|
*
|
|
@@ -5249,6 +5273,17 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5249
5273
|
* @public
|
|
5250
5274
|
*/
|
|
5251
5275
|
isAspectRatioLocked(_shape: Shape): boolean;
|
|
5276
|
+
/**
|
|
5277
|
+
* By default, the bounds of an image export are the bounds of all the shapes it contains, plus
|
|
5278
|
+
* some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
|
|
5279
|
+
* padding is skipped _if the bounds of that shape contains all the other shapes_. This is
|
|
5280
|
+
* useful in cases like annotating on top of an image, where you usually want to avoid extra
|
|
5281
|
+
* padding around the image if you don't need it.
|
|
5282
|
+
*
|
|
5283
|
+
* @param _shape - The shape to check
|
|
5284
|
+
* @returns True if this shape should be treated as an export bounds container
|
|
5285
|
+
*/
|
|
5286
|
+
isExportBoundsContainer(_shape: Shape): boolean;
|
|
5252
5287
|
/* Excluded from this release type: backgroundComponent */
|
|
5253
5288
|
/**
|
|
5254
5289
|
* Get the interpolated props for an animating shape. This is an optional method.
|
|
@@ -5804,7 +5839,14 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
|
|
|
5804
5839
|
onExit?(info: any, to: string): void;
|
|
5805
5840
|
}
|
|
5806
5841
|
|
|
5807
|
-
/**
|
|
5842
|
+
/**
|
|
5843
|
+
* Calls `event.stopPropagation()`.
|
|
5844
|
+
*
|
|
5845
|
+
* @deprecated Use {@link Editor.markEventAsHandled} instead, or manually call `event.stopPropagation()` if
|
|
5846
|
+
* that's what you really want.
|
|
5847
|
+
*
|
|
5848
|
+
* @public
|
|
5849
|
+
*/
|
|
5808
5850
|
export declare const stopEventPropagation: (e: any) => any;
|
|
5809
5851
|
|
|
5810
5852
|
/* Excluded from this release type: StoreName */
|
|
@@ -6295,12 +6337,6 @@ export declare interface TldrawEditorBaseProps {
|
|
|
6295
6337
|
* Options for syncing the editor's camera state with the URL.
|
|
6296
6338
|
*/
|
|
6297
6339
|
deepLinks?: TLDeepLinkOptions | true;
|
|
6298
|
-
/**
|
|
6299
|
-
* Predicate for whether or not a shape should be hidden.
|
|
6300
|
-
*
|
|
6301
|
-
* @deprecated Use {@link TldrawEditorBaseProps#getShapeVisibility} instead.
|
|
6302
|
-
*/
|
|
6303
|
-
isShapeHidden?(shape: TLShape, editor: Editor): boolean;
|
|
6304
6340
|
/**
|
|
6305
6341
|
* Provides a way to hide shapes.
|
|
6306
6342
|
*
|
|
@@ -6408,6 +6444,8 @@ export declare interface TldrawOptions {
|
|
|
6408
6444
|
readonly multiClickDurationMs: number;
|
|
6409
6445
|
readonly coarseDragDistanceSquared: number;
|
|
6410
6446
|
readonly dragDistanceSquared: number;
|
|
6447
|
+
readonly uiDragDistanceSquared: number;
|
|
6448
|
+
readonly uiCoarseDragDistanceSquared: number;
|
|
6411
6449
|
readonly defaultSvgPadding: number;
|
|
6412
6450
|
readonly cameraSlideFriction: number;
|
|
6413
6451
|
readonly gridSteps: readonly {
|
|
@@ -6434,6 +6472,7 @@ export declare interface TldrawOptions {
|
|
|
6434
6472
|
readonly flattenImageBoundsPadding: number;
|
|
6435
6473
|
readonly laserDelayMs: number;
|
|
6436
6474
|
readonly maxExportDelayMs: number;
|
|
6475
|
+
readonly tooltipDelayMs: number;
|
|
6437
6476
|
/**
|
|
6438
6477
|
* How long should previews created by {@link Editor.createTemporaryAssetPreview} last before
|
|
6439
6478
|
* they expire? Defaults to 3 minutes.
|
|
@@ -6559,15 +6598,6 @@ export declare interface TLEditorOptions {
|
|
|
6559
6598
|
fontAssetUrls?: {
|
|
6560
6599
|
[key: string]: string | undefined;
|
|
6561
6600
|
};
|
|
6562
|
-
/**
|
|
6563
|
-
* A predicate that should return true if the given shape should be hidden.
|
|
6564
|
-
*
|
|
6565
|
-
* @deprecated Use {@link Editor#getShapeVisibility} instead.
|
|
6566
|
-
*
|
|
6567
|
-
* @param shape - The shape to check.
|
|
6568
|
-
* @param editor - The editor instance.
|
|
6569
|
-
*/
|
|
6570
|
-
isShapeHidden?(shape: TLShape, editor: Editor): boolean;
|
|
6571
6601
|
/**
|
|
6572
6602
|
* Provides a way to hide shapes.
|
|
6573
6603
|
*
|
|
@@ -6835,6 +6865,59 @@ export declare interface TLGeometryOpts {
|
|
|
6835
6865
|
context?: string;
|
|
6836
6866
|
}
|
|
6837
6867
|
|
|
6868
|
+
/**
|
|
6869
|
+
* Options to {@link Editor.getShapeAtPoint}.
|
|
6870
|
+
*
|
|
6871
|
+
* @public
|
|
6872
|
+
*/
|
|
6873
|
+
export declare interface TLGetShapeAtPointOptions {
|
|
6874
|
+
/**
|
|
6875
|
+
* The margin to apply to the shape.
|
|
6876
|
+
* If a number, it will be applied to both the inside and outside of the shape.
|
|
6877
|
+
* If an array, the first element will be applied to the inside of the shape, and the second element will be applied to the outside.
|
|
6878
|
+
*
|
|
6879
|
+
* @example
|
|
6880
|
+
* ```ts
|
|
6881
|
+
* // Get the shape at the center of the screen
|
|
6882
|
+
* const shape = editor.getShapeAtProps({
|
|
6883
|
+
* margin: 10,
|
|
6884
|
+
* })
|
|
6885
|
+
*
|
|
6886
|
+
* // Get the shape at the center of the screen with a 10px inner margin and a 5px outer margin
|
|
6887
|
+
* const shape = editor.getShapeAtProps({
|
|
6888
|
+
* margin: [10, 5],
|
|
6889
|
+
* })
|
|
6890
|
+
* ```
|
|
6891
|
+
*/
|
|
6892
|
+
margin?: [number, number] | number;
|
|
6893
|
+
/**
|
|
6894
|
+
* Whether to register hits inside of shapes (beyond the margin), such as the inside of a solid shape.
|
|
6895
|
+
*/
|
|
6896
|
+
hitInside?: boolean;
|
|
6897
|
+
/**
|
|
6898
|
+
* Whether to register hits on locked shapes.
|
|
6899
|
+
*/
|
|
6900
|
+
hitLocked?: boolean;
|
|
6901
|
+
/**
|
|
6902
|
+
* Whether to register hits on labels.
|
|
6903
|
+
*/
|
|
6904
|
+
hitLabels?: boolean;
|
|
6905
|
+
/**
|
|
6906
|
+
* Whether to only return hits on shapes that are currently being rendered.
|
|
6907
|
+
* todo: rename this to hitCulled or hitNotRendering
|
|
6908
|
+
*/
|
|
6909
|
+
renderingOnly?: boolean;
|
|
6910
|
+
/**
|
|
6911
|
+
* Whether to register hits on the inside of frame shapes.
|
|
6912
|
+
* todo: rename this to hitInsideFrames
|
|
6913
|
+
*/
|
|
6914
|
+
hitFrameInside?: boolean;
|
|
6915
|
+
/**
|
|
6916
|
+
* A filter function to apply to the shapes.
|
|
6917
|
+
*/
|
|
6918
|
+
filter?(shape: TLShape): boolean;
|
|
6919
|
+
}
|
|
6920
|
+
|
|
6838
6921
|
/** @public */
|
|
6839
6922
|
export declare interface TLGridProps {
|
|
6840
6923
|
x: number;
|
|
@@ -7505,12 +7588,6 @@ export declare interface TLSvgExportOptions {
|
|
|
7505
7588
|
preserveAspectRatio?: React.SVGAttributes<SVGSVGElement>['preserveAspectRatio'];
|
|
7506
7589
|
}
|
|
7507
7590
|
|
|
7508
|
-
/**
|
|
7509
|
-
* @public
|
|
7510
|
-
* @deprecated use {@link TLImageExportOptions} instead
|
|
7511
|
-
*/
|
|
7512
|
-
export declare type TLSvgOptions = TLImageExportOptions;
|
|
7513
|
-
|
|
7514
7591
|
/** @public */
|
|
7515
7592
|
export declare interface TLSvgTextExternalContent extends TLBaseExternalContent {
|
|
7516
7593
|
type: 'svg-text';
|
|
@@ -7621,6 +7698,8 @@ export declare interface TLUserPreferences {
|
|
|
7621
7698
|
isWrapMode?: boolean | null;
|
|
7622
7699
|
isDynamicSizeMode?: boolean | null;
|
|
7623
7700
|
isPasteAtCursorMode?: boolean | null;
|
|
7701
|
+
enhancedA11yMode?: boolean | null;
|
|
7702
|
+
inputMode?: 'mouse' | 'trackpad' | null;
|
|
7624
7703
|
}
|
|
7625
7704
|
|
|
7626
7705
|
/** @public */
|
|
@@ -7663,6 +7742,7 @@ export declare class TransformedGeometry2d extends Geometry2d {
|
|
|
7663
7742
|
private readonly decomposed;
|
|
7664
7743
|
constructor(geometry: Geometry2d, matrix: MatModel, opts?: TransformedGeometry2dOptions);
|
|
7665
7744
|
getVertices(filters: Geometry2dFilters): Vec[];
|
|
7745
|
+
getBoundsVertices(): Vec[];
|
|
7666
7746
|
nearestPoint(point: VecLike, filters?: Geometry2dFilters): Vec;
|
|
7667
7747
|
hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean, filters?: Geometry2dFilters): boolean;
|
|
7668
7748
|
distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
@@ -7683,6 +7763,7 @@ export declare interface TransformedGeometry2dOptions {
|
|
|
7683
7763
|
isInternal?: boolean;
|
|
7684
7764
|
debugColor?: string;
|
|
7685
7765
|
ignore?: boolean;
|
|
7766
|
+
excludeFromShapeBounds?: boolean;
|
|
7686
7767
|
}
|
|
7687
7768
|
|
|
7688
7769
|
/** @public */
|
|
@@ -7786,7 +7867,9 @@ export declare class UserPreferencesManager {
|
|
|
7786
7867
|
areKeyboardShortcutsEnabled: boolean;
|
|
7787
7868
|
color: string;
|
|
7788
7869
|
colorScheme: "dark" | "light" | "system" | undefined;
|
|
7870
|
+
enhancedA11yMode: boolean;
|
|
7789
7871
|
id: string;
|
|
7872
|
+
inputMode: "mouse" | "trackpad" | null;
|
|
7790
7873
|
isDarkMode: boolean;
|
|
7791
7874
|
isDynamicResizeMode: boolean;
|
|
7792
7875
|
isSnapMode: boolean;
|
|
@@ -7809,6 +7892,8 @@ export declare class UserPreferencesManager {
|
|
|
7809
7892
|
getIsWrapMode(): boolean;
|
|
7810
7893
|
getIsDynamicResizeMode(): boolean;
|
|
7811
7894
|
getIsPasteAtCursorMode(): boolean;
|
|
7895
|
+
getEnhancedA11yMode(): boolean;
|
|
7896
|
+
getInputMode(): "mouse" | "trackpad" | null;
|
|
7812
7897
|
}
|
|
7813
7898
|
|
|
7814
7899
|
/** @public */
|
|
@@ -7915,8 +8000,6 @@ export declare class Vec {
|
|
|
7915
8000
|
lrp(B: VecLike, t: number): Vec;
|
|
7916
8001
|
equals(B: VecLike): boolean;
|
|
7917
8002
|
equalsXY(x: number, y: number): boolean;
|
|
7918
|
-
/** @deprecated use `uni` instead */
|
|
7919
|
-
norm(): this;
|
|
7920
8003
|
toFixed(): this;
|
|
7921
8004
|
toString(): string;
|
|
7922
8005
|
toJson(): VecModel;
|
package/dist-esm/index.mjs
CHANGED
|
@@ -175,6 +175,7 @@ import { useViewportHeight } from "./lib/hooks/useViewportHeight.mjs";
|
|
|
175
175
|
import {
|
|
176
176
|
LicenseManager
|
|
177
177
|
} from "./lib/license/LicenseManager.mjs";
|
|
178
|
+
import { LICENSE_TIMEOUT } from "./lib/license/LicenseProvider.mjs";
|
|
178
179
|
import { defaultTldrawOptions } from "./lib/options.mjs";
|
|
179
180
|
import {
|
|
180
181
|
Box,
|
|
@@ -273,6 +274,7 @@ import {
|
|
|
273
274
|
setPointerCapture,
|
|
274
275
|
stopEventPropagation
|
|
275
276
|
} from "./lib/utils/dom.mjs";
|
|
277
|
+
import { EditorAtom } from "./lib/utils/EditorAtom.mjs";
|
|
276
278
|
import { getIncrementedName } from "./lib/utils/getIncrementedName.mjs";
|
|
277
279
|
import { getPointerInfo } from "./lib/utils/getPointerInfo.mjs";
|
|
278
280
|
import { getSvgPathFromPoints } from "./lib/utils/getSvgPathFromPoints.mjs";
|
|
@@ -297,12 +299,9 @@ import { hardReset } from "./lib/utils/sync/hardReset.mjs";
|
|
|
297
299
|
import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
|
|
298
300
|
import { uniq } from "./lib/utils/uniq.mjs";
|
|
299
301
|
import { openWindow } from "./lib/utils/window-open.mjs";
|
|
300
|
-
function debugEnableLicensing() {
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
302
|
registerTldrawLibraryVersion(
|
|
304
303
|
"@tldraw/editor",
|
|
305
|
-
"
|
|
304
|
+
"4.0.0",
|
|
306
305
|
"esm"
|
|
307
306
|
);
|
|
308
307
|
export {
|
|
@@ -342,6 +341,7 @@ export {
|
|
|
342
341
|
Edge2d,
|
|
343
342
|
EdgeScrollManager,
|
|
344
343
|
Editor,
|
|
344
|
+
EditorAtom,
|
|
345
345
|
EditorContext,
|
|
346
346
|
EditorProvider,
|
|
347
347
|
Ellipse2d,
|
|
@@ -356,6 +356,7 @@ export {
|
|
|
356
356
|
HTMLContainer,
|
|
357
357
|
HandleSnaps,
|
|
358
358
|
HistoryManager,
|
|
359
|
+
LICENSE_TIMEOUT,
|
|
359
360
|
LicenseManager,
|
|
360
361
|
LoadingScreen,
|
|
361
362
|
LocalIndexedDb,
|
|
@@ -407,7 +408,6 @@ export {
|
|
|
407
408
|
createTLStore,
|
|
408
409
|
createTLUser,
|
|
409
410
|
dataUrlToFile,
|
|
410
|
-
debugEnableLicensing,
|
|
411
411
|
debugFlags,
|
|
412
412
|
defaultTldrawOptions,
|
|
413
413
|
defaultUserPreferences,
|