@tldraw/editor 3.16.0-canary.ffdf566dd0a8 → 3.16.0-internal.71f83a8a571b
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 +137 -126
- package/dist-cjs/index.js +6 -6
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +8 -8
- 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 +1 -1
- package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +67 -128
- 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/derivations/parentsToChildren.js.map +2 -2
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +1 -1
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/BaseBoxShapeUtil.js.map +1 -1
- 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/tools/BaseBoxShapeTool/BaseBoxShapeTool.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 +44 -35
- 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 +3 -3
- 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 +4 -4
- package/dist-cjs/lib/hooks/useSelectionEvents.js.map +2 -2
- package/dist-cjs/lib/license/LicenseManager.js +140 -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 +73 -11
- 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 +6 -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/dom.js +12 -1
- package/dist-cjs/lib/utils/dom.js.map +2 -2
- package/dist-cjs/lib/utils/getPointerInfo.js +2 -2
- package/dist-cjs/lib/utils/getPointerInfo.js.map +2 -2
- package/dist-cjs/lib/utils/reparenting.js +2 -35
- package/dist-cjs/lib/utils/reparenting.js.map +3 -3
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +137 -126
- package/dist-esm/index.mjs +9 -7
- 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 +15 -24
- 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 +1 -1
- package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +67 -128
- 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/derivations/parentsToChildren.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +1 -1
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/BaseBoxShapeUtil.mjs.map +1 -1
- 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/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.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 +47 -37
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useDocumentEvents.mjs +11 -6
- package/dist-esm/lib/hooks/useDocumentEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs +2 -3
- 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 +9 -4
- 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 +6 -5
- package/dist-esm/lib/hooks/useSelectionEvents.mjs.map +2 -2
- package/dist-esm/lib/license/LicenseManager.mjs +141 -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 +74 -12
- 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 +6 -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/dom.mjs +12 -1
- package/dist-esm/lib/utils/dom.mjs.map +2 -2
- package/dist-esm/lib/utils/getPointerInfo.mjs +2 -2
- package/dist-esm/lib/utils/getPointerInfo.mjs.map +2 -2
- package/dist-esm/lib/utils/reparenting.mjs +3 -40
- package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +308 -292
- 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 +12 -23
- 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 +1 -1
- package/src/lib/editor/Editor.test.ts +108 -11
- package/src/lib/editor/Editor.ts +112 -195
- package/src/lib/editor/derivations/notVisibleShapes.ts +6 -0
- package/src/lib/editor/derivations/parentsToChildren.ts +1 -1
- 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/FontManager/FontManager.test.ts +38 -27
- 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 +21 -26
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +1 -1
- package/src/lib/editor/shapes/BaseBoxShapeUtil.tsx +2 -2
- package/src/lib/editor/shapes/ShapeUtil.ts +51 -8
- package/src/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.ts +2 -1
- package/src/lib/editor/types/misc-types.ts +0 -6
- package/src/lib/exports/getSvgJsx.test.ts +874 -0
- package/src/lib/exports/getSvgJsx.tsx +78 -21
- package/src/lib/hooks/useCanvasEvents.ts +60 -47
- package/src/lib/hooks/useDocumentEvents.ts +11 -6
- package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +2 -2
- package/src/lib/hooks/useGestureEvents.ts +2 -2
- package/src/lib/hooks/useHandleEvents.ts +9 -4
- package/src/lib/hooks/usePassThroughMouseOverEvents.ts +4 -1
- package/src/lib/hooks/usePassThroughWheelEvents.ts +6 -1
- package/src/lib/hooks/useSelectionEvents.ts +6 -5
- package/src/lib/license/LicenseManager.test.ts +724 -383
- package/src/lib/license/LicenseManager.ts +201 -58
- package/src/lib/license/LicenseProvider.tsx +74 -2
- package/src/lib/license/Watermark.test.tsx +2 -1
- package/src/lib/license/Watermark.tsx +79 -12
- package/src/lib/license/useLicenseManagerState.ts +2 -2
- package/src/lib/options.ts +6 -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/dom.test.ts +94 -0
- package/src/lib/utils/dom.ts +38 -1
- package/src/lib/utils/getPointerInfo.ts +2 -1
- package/src/lib/utils/reparenting.ts +3 -69
- package/src/lib/utils/sync/LocalIndexedDb.test.ts +2 -1
- package/src/lib/utils/sync/TLLocalSyncClient.test.ts +15 -15
- package/src/version.ts +3 -3
- package/dist-cjs/lib/utils/nearestMultiple.js +0 -34
- 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
|
@@ -147,7 +147,7 @@ export declare abstract class BaseBoxShapeTool extends StateNode {
|
|
|
147
147
|
static id: string;
|
|
148
148
|
static initial: string;
|
|
149
149
|
static children(): TLStateNodeConstructor[];
|
|
150
|
-
abstract shapeType:
|
|
150
|
+
abstract shapeType: TLBaseBoxShape['type'];
|
|
151
151
|
onCreate?(_shape: null | TLShape): null | void;
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -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 */
|
|
@@ -890,6 +886,8 @@ export declare const defaultTldrawOptions: {
|
|
|
890
886
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
891
887
|
readonly textShadowLod: 0.35;
|
|
892
888
|
readonly tooltipDelayMs: 700;
|
|
889
|
+
readonly uiCoarseDragDistanceSquared: 625;
|
|
890
|
+
readonly uiDragDistanceSquared: 16;
|
|
893
891
|
};
|
|
894
892
|
|
|
895
893
|
/** @public */
|
|
@@ -981,7 +979,7 @@ export declare class EdgeScrollManager {
|
|
|
981
979
|
/** @public */
|
|
982
980
|
export declare class Editor extends EventEmitter<TLEventMap> {
|
|
983
981
|
readonly id: string;
|
|
984
|
-
constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, textOptions, initialState, autoFocus, inferDarkMode, options,
|
|
982
|
+
constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, textOptions, initialState, autoFocus, inferDarkMode, options, getShapeVisibility, fontAssetUrls, }: TLEditorOptions);
|
|
985
983
|
private readonly _getShapeVisibility?;
|
|
986
984
|
private getIsShapeHiddenCache;
|
|
987
985
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
@@ -1048,22 +1046,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1048
1046
|
* @public
|
|
1049
1047
|
*/
|
|
1050
1048
|
readonly fonts: FontManager;
|
|
1051
|
-
/**
|
|
1052
|
-
* A manager for the editor's environment.
|
|
1053
|
-
*
|
|
1054
|
-
* @deprecated This is deprecated and will be removed in a future version. Use the `tlenv` global export instead.
|
|
1055
|
-
* @public
|
|
1056
|
-
*/
|
|
1057
|
-
readonly environment: {
|
|
1058
|
-
hasCanvasSupport: boolean;
|
|
1059
|
-
isAndroid: boolean;
|
|
1060
|
-
isChromeForIos: boolean;
|
|
1061
|
-
isDarwin: boolean;
|
|
1062
|
-
isFirefox: boolean;
|
|
1063
|
-
isIos: boolean;
|
|
1064
|
-
isSafari: boolean;
|
|
1065
|
-
isWebview: boolean;
|
|
1066
|
-
};
|
|
1067
1049
|
/**
|
|
1068
1050
|
* A manager for the editor's scribbles.
|
|
1069
1051
|
*
|
|
@@ -1106,7 +1088,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1106
1088
|
* @public
|
|
1107
1089
|
*/
|
|
1108
1090
|
shapeUtils: {
|
|
1109
|
-
readonly [K in string]?: ShapeUtil<
|
|
1091
|
+
readonly [K in string]?: ShapeUtil<TLShape>;
|
|
1110
1092
|
};
|
|
1111
1093
|
styleProps: {
|
|
1112
1094
|
[key: string]: Map<StyleProp<any>, string>;
|
|
@@ -1126,16 +1108,16 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1126
1108
|
*
|
|
1127
1109
|
* @public
|
|
1128
1110
|
*/
|
|
1129
|
-
getShapeUtil<S extends
|
|
1130
|
-
getShapeUtil<S extends
|
|
1111
|
+
getShapeUtil<S extends TLShape>(shape: S | TLShapePartial<S>): ShapeUtil<S>;
|
|
1112
|
+
getShapeUtil<S extends TLShape>(type: S['type']): ShapeUtil<S>;
|
|
1131
1113
|
getShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): T;
|
|
1132
1114
|
/**
|
|
1133
1115
|
* Returns true if the editor has a shape util for the given shape / shape type.
|
|
1134
1116
|
*
|
|
1135
1117
|
* @param shape - A shape, shape partial, or shape type.
|
|
1136
1118
|
*/
|
|
1137
|
-
hasShapeUtil
|
|
1138
|
-
hasShapeUtil
|
|
1119
|
+
hasShapeUtil(shape: TLShape | TLShapePartial<TLShape>): boolean;
|
|
1120
|
+
hasShapeUtil(type: TLShape['type']): boolean;
|
|
1139
1121
|
hasShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): boolean;
|
|
1140
1122
|
/**
|
|
1141
1123
|
* A map of shape utility classes (TLShapeUtils) by shape type.
|
|
@@ -1206,22 +1188,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1206
1188
|
* @public
|
|
1207
1189
|
*/
|
|
1208
1190
|
getCanRedo(): boolean;
|
|
1209
|
-
/**
|
|
1210
|
-
* Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
|
|
1211
|
-
* any redos.
|
|
1212
|
-
*
|
|
1213
|
-
* @example
|
|
1214
|
-
* ```ts
|
|
1215
|
-
* editor.mark()
|
|
1216
|
-
* editor.mark('flip shapes')
|
|
1217
|
-
* ```
|
|
1218
|
-
*
|
|
1219
|
-
* @param markId - The mark's id, usually the reason for adding the mark.
|
|
1220
|
-
*
|
|
1221
|
-
* @public
|
|
1222
|
-
* @deprecated use {@link Editor.markHistoryStoppingPoint} instead
|
|
1223
|
-
*/
|
|
1224
|
-
mark(markId?: string): this;
|
|
1225
1191
|
/**
|
|
1226
1192
|
* Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
|
|
1227
1193
|
* any redos. You typically want to do this just before a user interaction begins or is handled.
|
|
@@ -1311,10 +1277,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1311
1277
|
* @public
|
|
1312
1278
|
*/
|
|
1313
1279
|
run(fn: () => void, opts?: TLEditorRunOptions): this;
|
|
1314
|
-
/**
|
|
1315
|
-
* @deprecated Use `Editor.run` instead.
|
|
1316
|
-
*/
|
|
1317
|
-
batch(fn: () => void, opts?: TLEditorRunOptions): this;
|
|
1318
1280
|
/* Excluded from this release type: annotateError */
|
|
1319
1281
|
/* Excluded from this release type: createErrorAnnotations */
|
|
1320
1282
|
/* Excluded from this release type: _crashingError */
|
|
@@ -1436,36 +1398,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1436
1398
|
hasOpenMenus: () => boolean;
|
|
1437
1399
|
isMenuOpen: (id: string) => boolean;
|
|
1438
1400
|
};
|
|
1439
|
-
/**
|
|
1440
|
-
* @deprecated Use `editor.menus.getOpenMenus` instead.
|
|
1441
|
-
*
|
|
1442
|
-
* @public
|
|
1443
|
-
*/
|
|
1444
|
-
getOpenMenus(): string[];
|
|
1445
|
-
/**
|
|
1446
|
-
* @deprecated Use `editor.menus.addOpenMenu` instead.
|
|
1447
|
-
*
|
|
1448
|
-
* @public
|
|
1449
|
-
*/
|
|
1450
|
-
addOpenMenu(id: string): this;
|
|
1451
|
-
/**
|
|
1452
|
-
* @deprecated Use `editor.menus.deleteOpenMenu` instead.
|
|
1453
|
-
*
|
|
1454
|
-
* @public
|
|
1455
|
-
*/
|
|
1456
|
-
deleteOpenMenu(id: string): this;
|
|
1457
|
-
/**
|
|
1458
|
-
* @deprecated Use `editor.menus.clearOpenMenus` instead.
|
|
1459
|
-
*
|
|
1460
|
-
* @public
|
|
1461
|
-
*/
|
|
1462
|
-
clearOpenMenus(): this;
|
|
1463
|
-
/**
|
|
1464
|
-
* @deprecated Use `editor.menus.hasAnyOpenMenus` instead.
|
|
1465
|
-
*
|
|
1466
|
-
* @public
|
|
1467
|
-
*/
|
|
1468
|
-
getIsMenuOpen(): boolean;
|
|
1469
1401
|
/**
|
|
1470
1402
|
* Set the cursor.
|
|
1471
1403
|
*
|
|
@@ -2795,8 +2727,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2795
2727
|
*
|
|
2796
2728
|
* @public
|
|
2797
2729
|
*/
|
|
2798
|
-
isShapeOfType<T extends
|
|
2799
|
-
isShapeOfType<T extends
|
|
2730
|
+
isShapeOfType<T extends TLShape>(shape: TLShape, type: T['type']): shape is T;
|
|
2731
|
+
isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
|
|
2800
2732
|
/**
|
|
2801
2733
|
* Get a shape by its id.
|
|
2802
2734
|
*
|
|
@@ -2914,8 +2846,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2914
2846
|
* @public
|
|
2915
2847
|
*/
|
|
2916
2848
|
getShapeAndDescendantIds(ids: TLShapeId[]): Set<TLShapeId>;
|
|
2917
|
-
/** @deprecated Use {@link Editor.getDraggingOverShape} instead */
|
|
2918
|
-
getDroppingOverShape(point: Vec, droppingShapes: TLShape[]): TLShape | undefined;
|
|
2919
2849
|
/**
|
|
2920
2850
|
* Get the shape that some shapes should be dropped on at a given point.
|
|
2921
2851
|
*
|
|
@@ -3274,7 +3204,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3274
3204
|
*
|
|
3275
3205
|
* @public
|
|
3276
3206
|
*/
|
|
3277
|
-
canCreateShape
|
|
3207
|
+
canCreateShape(shape: OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id']): boolean;
|
|
3278
3208
|
/**
|
|
3279
3209
|
* Get whether the provided shapes can be created.
|
|
3280
3210
|
*
|
|
@@ -3282,7 +3212,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3282
3212
|
*
|
|
3283
3213
|
* @public
|
|
3284
3214
|
*/
|
|
3285
|
-
canCreateShapes
|
|
3215
|
+
canCreateShapes(shapes: (OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id'])[]): boolean;
|
|
3286
3216
|
/**
|
|
3287
3217
|
* Create a single shape.
|
|
3288
3218
|
*
|
|
@@ -3296,7 +3226,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3296
3226
|
*
|
|
3297
3227
|
* @public
|
|
3298
3228
|
*/
|
|
3299
|
-
createShape<
|
|
3229
|
+
createShape<TShape extends TLShape>(shape: OptionalKeys<TLShapePartial<TShape>, 'id'>): this;
|
|
3300
3230
|
/**
|
|
3301
3231
|
* Create shapes.
|
|
3302
3232
|
*
|
|
@@ -3310,7 +3240,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3310
3240
|
*
|
|
3311
3241
|
* @public
|
|
3312
3242
|
*/
|
|
3313
|
-
createShapes<
|
|
3243
|
+
createShapes<TShape extends TLShape = TLShape>(shapes: OptionalKeys<TLShapePartial<TShape>, 'id'>[]): this;
|
|
3314
3244
|
private animatingShapes;
|
|
3315
3245
|
/**
|
|
3316
3246
|
* Animate a shape.
|
|
@@ -3396,7 +3326,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3396
3326
|
*
|
|
3397
3327
|
* @public
|
|
3398
3328
|
*/
|
|
3399
|
-
updateShape<T extends
|
|
3329
|
+
updateShape<T extends TLShape = TLShape>(partial: null | TLShapePartial<T> | undefined): this;
|
|
3400
3330
|
/**
|
|
3401
3331
|
* Update shapes using partials of each shape.
|
|
3402
3332
|
*
|
|
@@ -3409,7 +3339,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3409
3339
|
*
|
|
3410
3340
|
* @public
|
|
3411
3341
|
*/
|
|
3412
|
-
updateShapes<T extends
|
|
3342
|
+
updateShapes<T extends TLShape>(partials: (null | TLShapePartial<T> | undefined)[]): this;
|
|
3413
3343
|
/* Excluded from this release type: _updateShapes */
|
|
3414
3344
|
/* Excluded from this release type: _getUnlockedShapeIds */
|
|
3415
3345
|
/**
|
|
@@ -3627,14 +3557,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3627
3557
|
* 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.
|
|
3628
3558
|
*
|
|
3629
3559
|
* @param info - Info about the external content.
|
|
3560
|
+
* @param opts - Options for handling external content, including force flag to bypass readonly checks.
|
|
3630
3561
|
*/
|
|
3631
|
-
putExternalContent<E>(info: TLExternalContent<E
|
|
3562
|
+
putExternalContent<E>(info: TLExternalContent<E>, opts?: {
|
|
3563
|
+
force?: boolean;
|
|
3564
|
+
}): Promise<void>;
|
|
3632
3565
|
/**
|
|
3633
3566
|
* Handle replacing external content.
|
|
3634
3567
|
*
|
|
3635
3568
|
* @param info - Info about the external content.
|
|
3569
|
+
* @param opts - Options for handling external content, including force flag to bypass readonly checks.
|
|
3636
3570
|
*/
|
|
3637
|
-
replaceExternalContent<E>(info: TLExternalContent<E
|
|
3571
|
+
replaceExternalContent<E>(info: TLExternalContent<E>, opts?: {
|
|
3572
|
+
force?: boolean;
|
|
3573
|
+
}): Promise<void>;
|
|
3638
3574
|
/**
|
|
3639
3575
|
* Get content that can be exported for the given shape ids.
|
|
3640
3576
|
*
|
|
@@ -3690,8 +3626,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3690
3626
|
svg: string;
|
|
3691
3627
|
width: number;
|
|
3692
3628
|
} | undefined>;
|
|
3693
|
-
/** @deprecated Use {@link Editor.getSvgString} or {@link Editor.getSvgElement} instead. */
|
|
3694
|
-
getSvg(shapes: TLShape[] | TLShapeId[], opts?: TLSvgExportOptions): Promise<SVGSVGElement | undefined>;
|
|
3695
3629
|
/**
|
|
3696
3630
|
* Get an exported image of the given shapes.
|
|
3697
3631
|
*
|
|
@@ -3706,6 +3640,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3706
3640
|
height: number;
|
|
3707
3641
|
width: number;
|
|
3708
3642
|
}>;
|
|
3643
|
+
/**
|
|
3644
|
+
* Get an exported image of the given shapes as a data URL.
|
|
3645
|
+
*
|
|
3646
|
+
* @param shapes - The shapes (or shape ids) to export.
|
|
3647
|
+
* @param opts - Options for the export.
|
|
3648
|
+
*
|
|
3649
|
+
* @returns A data URL of the image.
|
|
3650
|
+
* @public
|
|
3651
|
+
*/
|
|
3652
|
+
toImageDataUrl(shapes: TLShape[] | TLShapeId[], opts?: TLImageExportOptions): Promise<{
|
|
3653
|
+
height: number;
|
|
3654
|
+
url: string;
|
|
3655
|
+
width: number;
|
|
3656
|
+
}>;
|
|
3709
3657
|
/**
|
|
3710
3658
|
* The app's current input state.
|
|
3711
3659
|
*
|
|
@@ -4147,6 +4095,7 @@ export declare abstract class Geometry2d {
|
|
|
4147
4095
|
isLabel: boolean;
|
|
4148
4096
|
isEmptyLabel: boolean;
|
|
4149
4097
|
isInternal: boolean;
|
|
4098
|
+
excludeFromShapeBounds: boolean;
|
|
4150
4099
|
debugColor?: string;
|
|
4151
4100
|
ignore?: boolean;
|
|
4152
4101
|
constructor(opts: Geometry2dOptions);
|
|
@@ -4170,12 +4119,14 @@ export declare abstract class Geometry2d {
|
|
|
4170
4119
|
* along the edge it is as a fraction of the total length.
|
|
4171
4120
|
*/
|
|
4172
4121
|
uninterpolateAlongEdge(point: VecLike, _filters?: Geometry2dFilters): number;
|
|
4173
|
-
/** @deprecated Iterate the vertices instead. */
|
|
4174
|
-
nearestPointOnLineSegment(A: VecLike, B: VecLike): Vec;
|
|
4175
4122
|
isPointInBounds(point: VecLike, margin?: number): boolean;
|
|
4123
|
+
overlapsPolygon(_polygon: VecLike[]): boolean;
|
|
4176
4124
|
transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
|
|
4177
4125
|
private _vertices;
|
|
4178
4126
|
get vertices(): Vec[];
|
|
4127
|
+
getBoundsVertices(): Vec[];
|
|
4128
|
+
private _boundsVertices;
|
|
4129
|
+
get boundsVertices(): Vec[];
|
|
4179
4130
|
getBounds(): Box;
|
|
4180
4131
|
private _bounds;
|
|
4181
4132
|
get bounds(): Box;
|
|
@@ -4372,6 +4323,7 @@ export declare class Group2d extends Geometry2d {
|
|
|
4372
4323
|
hitTestLineSegment(A: VecLike, B: VecLike, zoom: number, filters?: Geometry2dFilters): boolean;
|
|
4373
4324
|
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): VecLike[];
|
|
4374
4325
|
intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): VecLike[];
|
|
4326
|
+
getBoundsVertices(): Vec[];
|
|
4375
4327
|
intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
4376
4328
|
intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
4377
4329
|
interpolateAlongEdge(t: number, filters?: Geometry2dFilters): Vec;
|
|
@@ -4381,6 +4333,7 @@ export declare class Group2d extends Geometry2d {
|
|
|
4381
4333
|
toSimpleSvgPath(): string;
|
|
4382
4334
|
getLength(filters?: Geometry2dFilters): number;
|
|
4383
4335
|
getSvgPathData(): string;
|
|
4336
|
+
overlapsPolygon(polygon: VecLike[]): boolean;
|
|
4384
4337
|
}
|
|
4385
4338
|
|
|
4386
4339
|
/** @public */
|
|
@@ -4621,12 +4574,16 @@ export declare function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeI
|
|
|
4621
4574
|
filter?(parent: TLShape): boolean;
|
|
4622
4575
|
}): void;
|
|
4623
4576
|
|
|
4577
|
+
/* Excluded from this release type: LICENSE_TIMEOUT */
|
|
4578
|
+
|
|
4624
4579
|
/* Excluded from this release type: LicenseFromKeyResult */
|
|
4625
4580
|
|
|
4626
4581
|
/* Excluded from this release type: LicenseInfo */
|
|
4627
4582
|
|
|
4628
4583
|
/* Excluded from this release type: LicenseManager */
|
|
4629
4584
|
|
|
4585
|
+
/* Excluded from this release type: LicenseState */
|
|
4586
|
+
|
|
4630
4587
|
/** @public */
|
|
4631
4588
|
export declare function linesIntersect(A: VecLike, B: VecLike, C: VecLike, D: VecLike): boolean;
|
|
4632
4589
|
|
|
@@ -4659,6 +4616,23 @@ export declare function loadSnapshot(store: TLStore, _snapshot: Partial<TLEditor
|
|
|
4659
4616
|
/** @public */
|
|
4660
4617
|
export declare function loopToHtmlElement(elm: Element): HTMLElement;
|
|
4661
4618
|
|
|
4619
|
+
/**
|
|
4620
|
+
* In tldraw, events are sometimes handled by multiple components. For example, the shapes might
|
|
4621
|
+
* have events, but the canvas handles events too. The way that the canvas handles events can
|
|
4622
|
+
* interfere with the with the shapes event handlers - for example, it calls `.preventDefault()` on
|
|
4623
|
+
* `pointerDown`, which also prevents `click` events from firing on the shapes.
|
|
4624
|
+
*
|
|
4625
|
+
* You can use `.stopPropagation()` to prevent the event from propagating to the rest of the DOM,
|
|
4626
|
+
* but that can impact non-tldraw event handlers set up elsewhere. By using `markEventAsHandled`,
|
|
4627
|
+
* you'll stop other parts of tldraw from handling the event without impacting other, non-tldraw
|
|
4628
|
+
* event handlers. See also {@link wasEventAlreadyHandled}.
|
|
4629
|
+
*
|
|
4630
|
+
* @public
|
|
4631
|
+
*/
|
|
4632
|
+
export declare function markEventAsHandled(e: {
|
|
4633
|
+
nativeEvent: Event;
|
|
4634
|
+
} | Event): void;
|
|
4635
|
+
|
|
4662
4636
|
/** @public */
|
|
4663
4637
|
export declare class Mat {
|
|
4664
4638
|
constructor(a: number, b: number, c: number, d: number, e: number, f: number);
|
|
@@ -5077,7 +5051,7 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
|
|
|
5077
5051
|
export declare function setUserPreferences(user: TLUserPreferences): void;
|
|
5078
5052
|
|
|
5079
5053
|
/** @public */
|
|
5080
|
-
export declare abstract class ShapeUtil<Shape extends
|
|
5054
|
+
export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
5081
5055
|
editor: Editor;
|
|
5082
5056
|
/** Configure this shape utils {@link ShapeUtil.options | `options`}. */
|
|
5083
5057
|
static configure<T extends TLShapeUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
|
|
@@ -5232,7 +5206,34 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5232
5206
|
* @public
|
|
5233
5207
|
*/
|
|
5234
5208
|
canBeLaidOut(_shape: Shape, _info: TLShapeUtilCanBeLaidOutOpts): boolean;
|
|
5209
|
+
/**
|
|
5210
|
+
* Whether this shape can be culled. By default, shapes are culled for
|
|
5211
|
+
* performance reasons when they are outside of the viewport. Culled shapes are still rendered
|
|
5212
|
+
* to the DOM, but have their `display` property set to `none`.
|
|
5213
|
+
*
|
|
5214
|
+
* @param shape - The shape.
|
|
5215
|
+
*/
|
|
5216
|
+
canCull(_shape: Shape): boolean;
|
|
5235
5217
|
/* Excluded from this release type: providesBackgroundForChildren */
|
|
5218
|
+
/**
|
|
5219
|
+
* Get the clip path to apply to this shape's children.
|
|
5220
|
+
*
|
|
5221
|
+
* @param shape - The shape to get the clip path for
|
|
5222
|
+
* @returns Array of points defining the clipping polygon in local coordinates, or undefined if no clipping
|
|
5223
|
+
* @public
|
|
5224
|
+
*/
|
|
5225
|
+
getClipPath?(shape: Shape): undefined | Vec[];
|
|
5226
|
+
/**
|
|
5227
|
+
* Whether a specific child shape should be clipped by this shape.
|
|
5228
|
+
* Only called if getClipPath returns a valid polygon.
|
|
5229
|
+
*
|
|
5230
|
+
* If not defined, the default behavior is to clip all children.
|
|
5231
|
+
*
|
|
5232
|
+
* @param child - The child shape to check
|
|
5233
|
+
* @returns boolean indicating if this child should be clipped
|
|
5234
|
+
* @public
|
|
5235
|
+
*/
|
|
5236
|
+
shouldClipChild?(child: TLShape): boolean;
|
|
5236
5237
|
/**
|
|
5237
5238
|
* Whether the shape should hide its resize handles when selected.
|
|
5238
5239
|
*
|
|
@@ -5263,6 +5264,17 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5263
5264
|
* @public
|
|
5264
5265
|
*/
|
|
5265
5266
|
isAspectRatioLocked(_shape: Shape): boolean;
|
|
5267
|
+
/**
|
|
5268
|
+
* By default, the bounds of an image export are the bounds of all the shapes it contains, plus
|
|
5269
|
+
* some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
|
|
5270
|
+
* padding is skipped _if the bounds of that shape contains all the other shapes_. This is
|
|
5271
|
+
* useful in cases like annotating on top of an image, where you usually want to avoid extra
|
|
5272
|
+
* padding around the image if you don't need it.
|
|
5273
|
+
*
|
|
5274
|
+
* @param _shape - The shape to check
|
|
5275
|
+
* @returns True if this shape should be treated as an export bounds container
|
|
5276
|
+
*/
|
|
5277
|
+
isExportBoundsContainer(_shape: Shape): boolean;
|
|
5266
5278
|
/* Excluded from this release type: backgroundComponent */
|
|
5267
5279
|
/**
|
|
5268
5280
|
* Get the interpolated props for an animating shape. This is an optional method.
|
|
@@ -5818,7 +5830,14 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
|
|
|
5818
5830
|
onExit?(info: any, to: string): void;
|
|
5819
5831
|
}
|
|
5820
5832
|
|
|
5821
|
-
/**
|
|
5833
|
+
/**
|
|
5834
|
+
* Calls `event.stopPropagation()`.
|
|
5835
|
+
*
|
|
5836
|
+
* @deprecated Use {@link markEventAsHandled} instead, or manually call `event.stopPropagation()` if
|
|
5837
|
+
* that's what you really want.
|
|
5838
|
+
*
|
|
5839
|
+
* @public
|
|
5840
|
+
*/
|
|
5822
5841
|
export declare const stopEventPropagation: (e: any) => any;
|
|
5823
5842
|
|
|
5824
5843
|
/* Excluded from this release type: StoreName */
|
|
@@ -5950,9 +5969,11 @@ export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
|
|
|
5950
5969
|
export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
|
|
5951
5970
|
|
|
5952
5971
|
/** @public */
|
|
5953
|
-
export declare type TLBaseBoxShape =
|
|
5954
|
-
|
|
5955
|
-
|
|
5972
|
+
export declare type TLBaseBoxShape = Extract<TLShape, {
|
|
5973
|
+
props: {
|
|
5974
|
+
h: number;
|
|
5975
|
+
w: number;
|
|
5976
|
+
};
|
|
5956
5977
|
}>;
|
|
5957
5978
|
|
|
5958
5979
|
/** @public */
|
|
@@ -6309,12 +6330,6 @@ export declare interface TldrawEditorBaseProps {
|
|
|
6309
6330
|
* Options for syncing the editor's camera state with the URL.
|
|
6310
6331
|
*/
|
|
6311
6332
|
deepLinks?: TLDeepLinkOptions | true;
|
|
6312
|
-
/**
|
|
6313
|
-
* Predicate for whether or not a shape should be hidden.
|
|
6314
|
-
*
|
|
6315
|
-
* @deprecated Use {@link TldrawEditorBaseProps#getShapeVisibility} instead.
|
|
6316
|
-
*/
|
|
6317
|
-
isShapeHidden?(shape: TLShape, editor: Editor): boolean;
|
|
6318
6333
|
/**
|
|
6319
6334
|
* Provides a way to hide shapes.
|
|
6320
6335
|
*
|
|
@@ -6422,6 +6437,8 @@ export declare interface TldrawOptions {
|
|
|
6422
6437
|
readonly multiClickDurationMs: number;
|
|
6423
6438
|
readonly coarseDragDistanceSquared: number;
|
|
6424
6439
|
readonly dragDistanceSquared: number;
|
|
6440
|
+
readonly uiDragDistanceSquared: number;
|
|
6441
|
+
readonly uiCoarseDragDistanceSquared: number;
|
|
6425
6442
|
readonly defaultSvgPadding: number;
|
|
6426
6443
|
readonly cameraSlideFriction: number;
|
|
6427
6444
|
readonly gridSteps: readonly {
|
|
@@ -6574,15 +6591,6 @@ export declare interface TLEditorOptions {
|
|
|
6574
6591
|
fontAssetUrls?: {
|
|
6575
6592
|
[key: string]: string | undefined;
|
|
6576
6593
|
};
|
|
6577
|
-
/**
|
|
6578
|
-
* A predicate that should return true if the given shape should be hidden.
|
|
6579
|
-
*
|
|
6580
|
-
* @deprecated Use {@link Editor#getShapeVisibility} instead.
|
|
6581
|
-
*
|
|
6582
|
-
* @param shape - The shape to check.
|
|
6583
|
-
* @param editor - The editor instance.
|
|
6584
|
-
*/
|
|
6585
|
-
isShapeHidden?(shape: TLShape, editor: Editor): boolean;
|
|
6586
6594
|
/**
|
|
6587
6595
|
* Provides a way to hide shapes.
|
|
6588
6596
|
*
|
|
@@ -7419,11 +7427,11 @@ export declare interface TLShapeUtilCanBeLaidOutOpts {
|
|
|
7419
7427
|
*
|
|
7420
7428
|
* @public
|
|
7421
7429
|
*/
|
|
7422
|
-
export declare interface TLShapeUtilCanBindOpts<Shape extends
|
|
7430
|
+
export declare interface TLShapeUtilCanBindOpts<Shape extends TLShape = TLShape> {
|
|
7423
7431
|
/** The type of shape referenced by the `fromId` of the binding. */
|
|
7424
|
-
fromShapeType:
|
|
7432
|
+
fromShapeType: TLShape['type'];
|
|
7425
7433
|
/** The type of shape referenced by the `toId` of the binding. */
|
|
7426
|
-
toShapeType:
|
|
7434
|
+
toShapeType: TLShape['type'];
|
|
7427
7435
|
/** The type of binding. */
|
|
7428
7436
|
bindingType: string;
|
|
7429
7437
|
}
|
|
@@ -7435,7 +7443,7 @@ export declare interface TLShapeUtilCanvasSvgDef {
|
|
|
7435
7443
|
}
|
|
7436
7444
|
|
|
7437
7445
|
/** @public */
|
|
7438
|
-
export declare interface TLShapeUtilConstructor<T extends
|
|
7446
|
+
export declare interface TLShapeUtilConstructor<T extends TLShape, U extends ShapeUtil<T> = ShapeUtil<T>> {
|
|
7439
7447
|
new (editor: Editor): U;
|
|
7440
7448
|
type: T['type'];
|
|
7441
7449
|
props?: RecordProps<T>;
|
|
@@ -7573,12 +7581,6 @@ export declare interface TLSvgExportOptions {
|
|
|
7573
7581
|
preserveAspectRatio?: React.SVGAttributes<SVGSVGElement>['preserveAspectRatio'];
|
|
7574
7582
|
}
|
|
7575
7583
|
|
|
7576
|
-
/**
|
|
7577
|
-
* @public
|
|
7578
|
-
* @deprecated use {@link TLImageExportOptions} instead
|
|
7579
|
-
*/
|
|
7580
|
-
export declare type TLSvgOptions = TLImageExportOptions;
|
|
7581
|
-
|
|
7582
7584
|
/** @public */
|
|
7583
7585
|
export declare interface TLSvgTextExternalContent extends TLBaseExternalContent {
|
|
7584
7586
|
type: 'svg-text';
|
|
@@ -7732,6 +7734,7 @@ export declare class TransformedGeometry2d extends Geometry2d {
|
|
|
7732
7734
|
private readonly decomposed;
|
|
7733
7735
|
constructor(geometry: Geometry2d, matrix: MatModel, opts?: TransformedGeometry2dOptions);
|
|
7734
7736
|
getVertices(filters: Geometry2dFilters): Vec[];
|
|
7737
|
+
getBoundsVertices(): Vec[];
|
|
7735
7738
|
nearestPoint(point: VecLike, filters?: Geometry2dFilters): Vec;
|
|
7736
7739
|
hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean, filters?: Geometry2dFilters): boolean;
|
|
7737
7740
|
distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
@@ -7752,6 +7755,7 @@ export declare interface TransformedGeometry2dOptions {
|
|
|
7752
7755
|
isInternal?: boolean;
|
|
7753
7756
|
debugColor?: string;
|
|
7754
7757
|
ignore?: boolean;
|
|
7758
|
+
excludeFromShapeBounds?: boolean;
|
|
7755
7759
|
}
|
|
7756
7760
|
|
|
7757
7761
|
/** @public */
|
|
@@ -7986,8 +7990,6 @@ export declare class Vec {
|
|
|
7986
7990
|
lrp(B: VecLike, t: number): Vec;
|
|
7987
7991
|
equals(B: VecLike): boolean;
|
|
7988
7992
|
equalsXY(x: number, y: number): boolean;
|
|
7989
|
-
/** @deprecated use `uni` instead */
|
|
7990
|
-
norm(): this;
|
|
7991
7993
|
toFixed(): this;
|
|
7992
7994
|
toString(): string;
|
|
7993
7995
|
toJson(): VecModel;
|
|
@@ -8109,6 +8111,15 @@ export declare class Vec {
|
|
|
8109
8111
|
/** @public */
|
|
8110
8112
|
export declare type VecLike = Vec | VecModel;
|
|
8111
8113
|
|
|
8114
|
+
/**
|
|
8115
|
+
* Checks if an event has already been handled. See {@link markEventAsHandled}.
|
|
8116
|
+
*
|
|
8117
|
+
* @public
|
|
8118
|
+
*/
|
|
8119
|
+
export declare function wasEventAlreadyHandled(e: {
|
|
8120
|
+
nativeEvent: Event;
|
|
8121
|
+
} | Event): boolean;
|
|
8122
|
+
|
|
8112
8123
|
|
|
8113
8124
|
export * from "@tldraw/state";
|
|
8114
8125
|
export * from "@tldraw/state-react";
|
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,
|
|
@@ -268,10 +269,12 @@ import {
|
|
|
268
269
|
import {
|
|
269
270
|
activeElementShouldCaptureKeys,
|
|
270
271
|
loopToHtmlElement,
|
|
272
|
+
markEventAsHandled,
|
|
271
273
|
preventDefault,
|
|
272
274
|
releasePointerCapture,
|
|
273
275
|
setPointerCapture,
|
|
274
|
-
stopEventPropagation
|
|
276
|
+
stopEventPropagation,
|
|
277
|
+
wasEventAlreadyHandled
|
|
275
278
|
} from "./lib/utils/dom.mjs";
|
|
276
279
|
import { EditorAtom } from "./lib/utils/EditorAtom.mjs";
|
|
277
280
|
import { getIncrementedName } from "./lib/utils/getIncrementedName.mjs";
|
|
@@ -298,12 +301,9 @@ import { hardReset } from "./lib/utils/sync/hardReset.mjs";
|
|
|
298
301
|
import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
|
|
299
302
|
import { uniq } from "./lib/utils/uniq.mjs";
|
|
300
303
|
import { openWindow } from "./lib/utils/window-open.mjs";
|
|
301
|
-
function debugEnableLicensing() {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
304
|
registerTldrawLibraryVersion(
|
|
305
305
|
"@tldraw/editor",
|
|
306
|
-
"3.16.0-
|
|
306
|
+
"3.16.0-internal.71f83a8a571b",
|
|
307
307
|
"esm"
|
|
308
308
|
);
|
|
309
309
|
export {
|
|
@@ -358,6 +358,7 @@ export {
|
|
|
358
358
|
HTMLContainer,
|
|
359
359
|
HandleSnaps,
|
|
360
360
|
HistoryManager,
|
|
361
|
+
LICENSE_TIMEOUT,
|
|
361
362
|
LicenseManager,
|
|
362
363
|
LoadingScreen,
|
|
363
364
|
LocalIndexedDb,
|
|
@@ -409,7 +410,6 @@ export {
|
|
|
409
410
|
createTLStore,
|
|
410
411
|
createTLUser,
|
|
411
412
|
dataUrlToFile,
|
|
412
|
-
debugEnableLicensing,
|
|
413
413
|
debugFlags,
|
|
414
414
|
defaultTldrawOptions,
|
|
415
415
|
defaultUserPreferences,
|
|
@@ -454,6 +454,7 @@ export {
|
|
|
454
454
|
loadSessionStateSnapshotIntoStore,
|
|
455
455
|
loadSnapshot,
|
|
456
456
|
loopToHtmlElement,
|
|
457
|
+
markEventAsHandled,
|
|
457
458
|
maybeSnapToGrid,
|
|
458
459
|
normalizeWheel,
|
|
459
460
|
openWindow,
|
|
@@ -517,6 +518,7 @@ export {
|
|
|
517
518
|
useTransform,
|
|
518
519
|
useUniqueSafeId,
|
|
519
520
|
useViewportHeight,
|
|
520
|
-
userTypeValidator
|
|
521
|
+
userTypeValidator,
|
|
522
|
+
wasEventAlreadyHandled
|
|
521
523
|
};
|
|
522
524
|
//# sourceMappingURL=index.mjs.map
|