@dwelle/excalidraw 0.3.53 → 0.3.56
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/CHANGELOG.md +12 -0
- package/dist/excalidraw-assets-dev/{image-73be8b3c1837ea26950c.js → image-eddc6ed66acd3a3f3d46.js} +0 -0
- package/dist/excalidraw.development.js +51 -51
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +4 -4
- package/types/actions/actionAddToLibrary.d.ts +9 -3
- package/types/actions/actionBoundText.d.ts +109 -0
- package/types/actions/actionCanvas.d.ts +26 -9
- package/types/actions/actionClipboard.d.ts +15 -5
- package/types/actions/actionDeleteSelected.d.ts +9 -3
- package/types/actions/actionExport.d.ts +27 -9
- package/types/actions/actionFinalize.d.ts +7 -3
- package/types/actions/actionMenu.d.ts +9 -3
- package/types/actions/actionProperties.d.ts +39 -13
- package/types/actions/actionStyles.d.ts +3 -1
- package/types/actions/actionToggleGridMode.d.ts +3 -1
- package/types/actions/actionToggleStats.d.ts +3 -1
- package/types/actions/actionToggleViewMode.d.ts +3 -1
- package/types/actions/actionToggleZenMode.d.ts +3 -1
- package/types/actions/index.d.ts +1 -1
- package/types/actions/types.d.ts +1 -1
- package/types/appState.d.ts +7 -3
- package/types/components/Actions.d.ts +5 -4
- package/types/components/App.d.ts +5 -4
- package/types/components/ToolButton.d.ts +3 -0
- package/types/constants.d.ts +1 -0
- package/types/data/restore.d.ts +1 -1
- package/types/element/Hyperlink.d.ts +3 -1
- package/types/element/dragElements.d.ts +1 -1
- package/types/element/linearElementEditor.d.ts +3 -1
- package/types/element/sizeHelpers.d.ts +2 -1
- package/types/element/textElement.d.ts +1 -2
- package/types/element/typeChecks.d.ts +2 -2
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-eddc6ed66acd3a3f3d46.d.ts +0 -0
- package/types/shapes.d.ts +1 -1
- package/types/types.d.ts +11 -2
- package/types/utils.d.ts +4 -2
|
@@ -32,7 +32,9 @@ export declare const actionChangeFillStyle: {
|
|
|
32
32
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
33
33
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
34
34
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
35
|
-
|
|
35
|
+
activeTool: {
|
|
36
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
37
|
+
};
|
|
36
38
|
elementLocked: boolean;
|
|
37
39
|
penMode: boolean;
|
|
38
40
|
penDetected: boolean;
|
|
@@ -126,7 +128,9 @@ export declare const actionChangeStrokeWidth: {
|
|
|
126
128
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
127
129
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
128
130
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
129
|
-
|
|
131
|
+
activeTool: {
|
|
132
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
133
|
+
};
|
|
130
134
|
elementLocked: boolean;
|
|
131
135
|
penMode: boolean;
|
|
132
136
|
penDetected: boolean;
|
|
@@ -220,7 +224,9 @@ export declare const actionChangeSloppiness: {
|
|
|
220
224
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
221
225
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
222
226
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
223
|
-
|
|
227
|
+
activeTool: {
|
|
228
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
229
|
+
};
|
|
224
230
|
elementLocked: boolean;
|
|
225
231
|
penMode: boolean;
|
|
226
232
|
penDetected: boolean;
|
|
@@ -314,7 +320,9 @@ export declare const actionChangeStrokeStyle: {
|
|
|
314
320
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
315
321
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
316
322
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
317
|
-
|
|
323
|
+
activeTool: {
|
|
324
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
325
|
+
};
|
|
318
326
|
elementLocked: boolean;
|
|
319
327
|
penMode: boolean;
|
|
320
328
|
penDetected: boolean;
|
|
@@ -408,7 +416,9 @@ export declare const actionChangeOpacity: {
|
|
|
408
416
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
409
417
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
410
418
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
411
|
-
|
|
419
|
+
activeTool: {
|
|
420
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
421
|
+
};
|
|
412
422
|
elementLocked: boolean;
|
|
413
423
|
penMode: boolean;
|
|
414
424
|
penDetected: boolean;
|
|
@@ -502,7 +512,9 @@ export declare const actionChangeFontSize: {
|
|
|
502
512
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
503
513
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
504
514
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
505
|
-
|
|
515
|
+
activeTool: {
|
|
516
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
517
|
+
};
|
|
506
518
|
elementLocked: boolean;
|
|
507
519
|
penMode: boolean;
|
|
508
520
|
penDetected: boolean;
|
|
@@ -596,7 +608,9 @@ export declare const actionDecreaseFontSize: {
|
|
|
596
608
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
597
609
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
598
610
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
599
|
-
|
|
611
|
+
activeTool: {
|
|
612
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
613
|
+
};
|
|
600
614
|
elementLocked: boolean;
|
|
601
615
|
penMode: boolean;
|
|
602
616
|
penDetected: boolean;
|
|
@@ -690,7 +704,9 @@ export declare const actionIncreaseFontSize: {
|
|
|
690
704
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
691
705
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
692
706
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
693
|
-
|
|
707
|
+
activeTool: {
|
|
708
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
709
|
+
};
|
|
694
710
|
elementLocked: boolean;
|
|
695
711
|
penMode: boolean;
|
|
696
712
|
penDetected: boolean;
|
|
@@ -784,7 +800,9 @@ export declare const actionChangeFontFamily: {
|
|
|
784
800
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
785
801
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
786
802
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
787
|
-
|
|
803
|
+
activeTool: {
|
|
804
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
805
|
+
};
|
|
788
806
|
elementLocked: boolean;
|
|
789
807
|
penMode: boolean;
|
|
790
808
|
penDetected: boolean;
|
|
@@ -878,7 +896,9 @@ export declare const actionChangeTextAlign: {
|
|
|
878
896
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
879
897
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
880
898
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
881
|
-
|
|
899
|
+
activeTool: {
|
|
900
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
901
|
+
};
|
|
882
902
|
elementLocked: boolean;
|
|
883
903
|
penMode: boolean;
|
|
884
904
|
penDetected: boolean;
|
|
@@ -971,7 +991,9 @@ export declare const actionChangeVerticalAlign: {
|
|
|
971
991
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
972
992
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
973
993
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
974
|
-
|
|
994
|
+
activeTool: {
|
|
995
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
996
|
+
};
|
|
975
997
|
elementLocked: boolean;
|
|
976
998
|
penMode: boolean;
|
|
977
999
|
penDetected: boolean;
|
|
@@ -1067,7 +1089,9 @@ export declare const actionChangeSharpness: {
|
|
|
1067
1089
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
1068
1090
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
1069
1091
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
1070
|
-
|
|
1092
|
+
activeTool: {
|
|
1093
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
1094
|
+
};
|
|
1071
1095
|
elementLocked: boolean;
|
|
1072
1096
|
penMode: boolean;
|
|
1073
1097
|
penDetected: boolean;
|
|
@@ -1162,7 +1186,9 @@ export declare const actionChangeArrowhead: {
|
|
|
1162
1186
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
1163
1187
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
1164
1188
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
1165
|
-
|
|
1189
|
+
activeTool: {
|
|
1190
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
1191
|
+
};
|
|
1166
1192
|
elementLocked: boolean;
|
|
1167
1193
|
penMode: boolean;
|
|
1168
1194
|
penDetected: boolean;
|
|
@@ -16,7 +16,9 @@ export declare const actionCopyStyles: {
|
|
|
16
16
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
17
17
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
18
18
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
19
|
-
|
|
19
|
+
activeTool: {
|
|
20
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
21
|
+
};
|
|
20
22
|
elementLocked: boolean;
|
|
21
23
|
penMode: boolean;
|
|
22
24
|
penDetected: boolean;
|
|
@@ -16,7 +16,9 @@ export declare const actionToggleGridMode: {
|
|
|
16
16
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
17
17
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
18
18
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
19
|
-
|
|
19
|
+
activeTool: {
|
|
20
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
21
|
+
};
|
|
20
22
|
elementLocked: boolean;
|
|
21
23
|
penMode: boolean;
|
|
22
24
|
penDetected: boolean;
|
|
@@ -15,7 +15,9 @@ export declare const actionToggleStats: {
|
|
|
15
15
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
16
16
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
17
17
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
18
|
-
|
|
18
|
+
activeTool: {
|
|
19
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
20
|
+
};
|
|
19
21
|
elementLocked: boolean;
|
|
20
22
|
penMode: boolean;
|
|
21
23
|
penDetected: boolean;
|
|
@@ -15,7 +15,9 @@ export declare const actionToggleViewMode: {
|
|
|
15
15
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
16
16
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
17
17
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
18
|
-
|
|
18
|
+
activeTool: {
|
|
19
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
20
|
+
};
|
|
19
21
|
elementLocked: boolean;
|
|
20
22
|
penMode: boolean;
|
|
21
23
|
penDetected: boolean;
|
|
@@ -15,7 +15,9 @@ export declare const actionToggleZenMode: {
|
|
|
15
15
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
16
16
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
17
17
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
18
|
-
|
|
18
|
+
activeTool: {
|
|
19
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
20
|
+
};
|
|
19
21
|
elementLocked: boolean;
|
|
20
22
|
penMode: boolean;
|
|
21
23
|
penDetected: boolean;
|
package/types/actions/index.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export { actionCopy, actionCut, actionCopyAsPng, actionCopyAsSvg, } from "./acti
|
|
|
18
18
|
export { actionToggleGridMode } from "./actionToggleGridMode";
|
|
19
19
|
export { actionToggleZenMode } from "./actionToggleZenMode";
|
|
20
20
|
export { actionToggleStats } from "./actionToggleStats";
|
|
21
|
-
export { actionUnbindText } from "./
|
|
21
|
+
export { actionUnbindText, actionBindText } from "./actionBoundText";
|
|
22
22
|
export { actionLink } from "../element/Hyperlink";
|
package/types/actions/types.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare type ActionResult = {
|
|
|
14
14
|
declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
15
15
|
export declare type UpdaterFn = (res: ActionResult) => void;
|
|
16
16
|
export declare type ActionFilterFn = (action: Action) => void;
|
|
17
|
-
export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser";
|
|
17
|
+
export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser" | "bindText";
|
|
18
18
|
export declare type PanelComponentProps = {
|
|
19
19
|
elements: readonly ExcalidrawElement[];
|
|
20
20
|
appState: AppState;
|
package/types/appState.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AppState, NormalizedZoomValue } from "./types";
|
|
2
2
|
export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
3
3
|
export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
|
|
4
|
-
|
|
4
|
+
activeTool?: {
|
|
5
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
6
|
+
} | undefined;
|
|
5
7
|
scrollX?: number | undefined;
|
|
6
8
|
scrollY?: number | undefined;
|
|
7
9
|
viewBackgroundColor?: string | undefined;
|
|
@@ -12,6 +14,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
12
14
|
theme?: string | undefined;
|
|
13
15
|
name?: string | undefined;
|
|
14
16
|
elementLocked?: boolean | undefined;
|
|
17
|
+
penMode?: boolean | undefined;
|
|
18
|
+
penDetected?: boolean | undefined;
|
|
15
19
|
exportBackground?: boolean | undefined;
|
|
16
20
|
exportEmbedScene?: boolean | undefined;
|
|
17
21
|
exportWithDarkMode?: boolean | undefined;
|
|
@@ -57,6 +61,6 @@ export declare const clearAppStateForDatabase: (appState: Partial<AppState>) =>
|
|
|
57
61
|
viewBackgroundColor?: string | undefined;
|
|
58
62
|
gridSize?: number | null | undefined;
|
|
59
63
|
};
|
|
60
|
-
export declare const isEraserActive: ({
|
|
61
|
-
|
|
64
|
+
export declare const isEraserActive: ({ activeTool, }: {
|
|
65
|
+
activeTool: AppState["activeTool"];
|
|
62
66
|
}) => boolean;
|
|
@@ -2,19 +2,20 @@ import React from "react";
|
|
|
2
2
|
import { ActionManager } from "../actions/manager";
|
|
3
3
|
import { ExcalidrawElement, PointerType } from "../element/types";
|
|
4
4
|
import { AppState, Zoom } from "../types";
|
|
5
|
-
export declare const SelectedShapeActions: ({ appState, elements, renderAction,
|
|
5
|
+
export declare const SelectedShapeActions: ({ appState, elements, renderAction, activeTool, }: {
|
|
6
6
|
appState: AppState;
|
|
7
7
|
elements: readonly ExcalidrawElement[];
|
|
8
8
|
renderAction: ActionManager["renderAction"];
|
|
9
|
-
|
|
9
|
+
activeTool: AppState["activeTool"]["type"];
|
|
10
10
|
}) => JSX.Element;
|
|
11
|
-
export declare const ShapesSwitcher: ({ canvas,
|
|
11
|
+
export declare const ShapesSwitcher: ({ canvas, activeTool, setAppState, onImageAction, appState, }: {
|
|
12
12
|
canvas: HTMLCanvasElement | null;
|
|
13
|
-
|
|
13
|
+
activeTool: AppState["activeTool"];
|
|
14
14
|
setAppState: React.Component<any, AppState>["setState"];
|
|
15
15
|
onImageAction: (data: {
|
|
16
16
|
pointerType: PointerType | null;
|
|
17
17
|
}) => void;
|
|
18
|
+
appState: AppState;
|
|
18
19
|
}) => JSX.Element;
|
|
19
20
|
export declare const ZoomActions: ({ renderAction, zoom, }: {
|
|
20
21
|
renderAction: ActionManager["renderAction"];
|
|
@@ -3,8 +3,8 @@ import { RoughCanvas } from "roughjs/bin/canvas";
|
|
|
3
3
|
import { ActionManager } from "../actions/manager";
|
|
4
4
|
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
5
5
|
import History from "../history";
|
|
6
|
-
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData } from "../types";
|
|
7
|
-
export declare const
|
|
6
|
+
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, DeviceType } from "../types";
|
|
7
|
+
export declare const useDeviceType: () => DeviceType;
|
|
8
8
|
export declare const useExcalidrawContainer: () => {
|
|
9
9
|
container: HTMLDivElement | null;
|
|
10
10
|
id?: string | null | undefined;
|
|
@@ -14,7 +14,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
14
14
|
rc: RoughCanvas | null;
|
|
15
15
|
unmounted: boolean;
|
|
16
16
|
actionManager: ActionManager;
|
|
17
|
-
|
|
17
|
+
deviceType: DeviceType;
|
|
18
18
|
detachIsMobileMqHandler?: () => void;
|
|
19
19
|
private excalidrawContainerRef;
|
|
20
20
|
static defaultProps: Partial<AppProps>;
|
|
@@ -95,7 +95,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
95
95
|
private updateCurrentCursorPosition;
|
|
96
96
|
private onKeyDown;
|
|
97
97
|
private onKeyUp;
|
|
98
|
-
private
|
|
98
|
+
private setActiveTool;
|
|
99
99
|
private onGestureStart;
|
|
100
100
|
private onGestureChange;
|
|
101
101
|
private onGestureEnd;
|
|
@@ -137,6 +137,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
137
137
|
private onPointerMoveFromPointerDownHandler;
|
|
138
138
|
private handlePointerMoveOverScrollbars;
|
|
139
139
|
private onPointerUpFromPointerDownHandler;
|
|
140
|
+
private restoreReadyToEraseElements;
|
|
140
141
|
private eraseElements;
|
|
141
142
|
private initializeImage;
|
|
142
143
|
/**
|
|
@@ -38,6 +38,9 @@ declare type ToolButtonProps = (ToolButtonBaseProps & {
|
|
|
38
38
|
onChange?(data: {
|
|
39
39
|
pointerType: PointerType | null;
|
|
40
40
|
}): void;
|
|
41
|
+
onPointerDown?(data: {
|
|
42
|
+
pointerType: PointerType;
|
|
43
|
+
}): void;
|
|
41
44
|
});
|
|
42
45
|
export declare const ToolButton: React.ForwardRefExoticComponent<ToolButtonProps & React.RefAttributes<unknown>>;
|
|
43
46
|
export {};
|
package/types/constants.d.ts
CHANGED
package/types/data/restore.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ExcalidrawElement } from "../element/types";
|
|
|
2
2
|
import { AppState, BinaryFiles, LibraryItem } from "../types";
|
|
3
3
|
import { ImportedDataState } from "./types";
|
|
4
4
|
declare type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const AllowedExcalidrawActiveTools: Record<AppState["activeTool"]["type"], boolean>;
|
|
6
6
|
export declare type RestoredDataState = {
|
|
7
7
|
elements: ExcalidrawElement[];
|
|
8
8
|
appState: RestoredAppState;
|
|
@@ -30,7 +30,9 @@ export declare const actionLink: {
|
|
|
30
30
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
31
31
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
32
32
|
editingLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
33
|
-
|
|
33
|
+
activeTool: {
|
|
34
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
35
|
+
};
|
|
34
36
|
elementLocked: boolean;
|
|
35
37
|
penMode: boolean;
|
|
36
38
|
penDetected: boolean;
|
|
@@ -2,4 +2,4 @@ import { NonDeletedExcalidrawElement } from "./types";
|
|
|
2
2
|
import { AppState, PointerDownState } from "../types";
|
|
3
3
|
export declare const dragSelectedElements: (pointerDownState: PointerDownState, selectedElements: NonDeletedExcalidrawElement[], pointerX: number, pointerY: number, lockDirection: boolean | undefined, distanceX: number | undefined, distanceY: number | undefined, appState: AppState) => void;
|
|
4
4
|
export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
5
|
-
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType: AppState["
|
|
5
|
+
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType: AppState["activeTool"]["type"], originX: number, originY: number, x: number, y: number, width: number, height: number, shouldMaintainAspectRatio: boolean, shouldResizeFromCenter: boolean, widthAspectRatio?: number | null | undefined) => void;
|
|
@@ -96,7 +96,9 @@ export declare class LinearElementEditor {
|
|
|
96
96
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
97
97
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
98
98
|
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
99
|
-
|
|
99
|
+
activeTool: {
|
|
100
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
101
|
+
};
|
|
100
102
|
elementLocked: boolean;
|
|
101
103
|
penMode: boolean;
|
|
102
104
|
penDetected: boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./types";
|
|
2
|
+
import { AppState } from "../types";
|
|
2
3
|
export declare const isInvisiblySmallElement: (element: ExcalidrawElement) => boolean;
|
|
3
4
|
/**
|
|
4
5
|
* Makes a perfect shape or diagonal/horizontal/vertical line
|
|
5
6
|
*/
|
|
6
|
-
export declare const getPerfectElementSize: (elementType:
|
|
7
|
+
export declare const getPerfectElementSize: (elementType: AppState["activeTool"]["type"], width: number, height: number) => {
|
|
7
8
|
width: number;
|
|
8
9
|
height: number;
|
|
9
10
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
2
2
|
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
|
-
|
|
4
|
-
export declare const redrawTextBoundingBox: (element: ExcalidrawTextElement, container: ExcalidrawElement | null, appState: AppState) => void;
|
|
3
|
+
export declare const redrawTextBoundingBox: (element: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
|
|
5
4
|
export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
6
5
|
export declare const handleBindTextResize: (element: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType) => void;
|
|
7
6
|
export declare const measureText: (text: string, font: FontString, maxWidth?: number | null | undefined) => {
|
|
@@ -7,9 +7,9 @@ export declare const isTextElement: (element: ExcalidrawElement | null) => eleme
|
|
|
7
7
|
export declare const isFreeDrawElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawFreeDrawElement;
|
|
8
8
|
export declare const isFreeDrawElementType: (elementType: ExcalidrawElement["type"]) => boolean;
|
|
9
9
|
export declare const isLinearElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
10
|
-
export declare const isLinearElementType: (elementType: AppState["
|
|
10
|
+
export declare const isLinearElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
11
11
|
export declare const isBindingElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
12
|
-
export declare const isBindingElementType: (elementType: AppState["
|
|
12
|
+
export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
13
13
|
export declare const isBindableElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
|
|
14
14
|
export declare const isTextBindableContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextContainer;
|
|
15
15
|
export declare const isExcalidrawElement: (element: any) => boolean;
|
|
File without changes
|
package/types/shapes.d.ts
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -54,7 +54,9 @@ export declare type AppState = {
|
|
|
54
54
|
suggestedBindings: SuggestedBinding[];
|
|
55
55
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
56
56
|
editingLinearElement: LinearElementEditor | null;
|
|
57
|
-
|
|
57
|
+
activeTool: {
|
|
58
|
+
type: typeof SHAPES[number]["value"] | "eraser";
|
|
59
|
+
};
|
|
58
60
|
elementLocked: boolean;
|
|
59
61
|
penMode: boolean;
|
|
60
62
|
penDetected: boolean;
|
|
@@ -318,7 +320,10 @@ export declare type PointerDownState = Readonly<{
|
|
|
318
320
|
hasOccurred: boolean;
|
|
319
321
|
};
|
|
320
322
|
elementIdsToErase: {
|
|
321
|
-
[key: ExcalidrawElement["id"]]:
|
|
323
|
+
[key: ExcalidrawElement["id"]]: {
|
|
324
|
+
opacity: ExcalidrawElement["opacity"];
|
|
325
|
+
erase: boolean;
|
|
326
|
+
};
|
|
322
327
|
};
|
|
323
328
|
}>;
|
|
324
329
|
export declare type ExcalidrawImperativeAPI = {
|
|
@@ -341,4 +346,8 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
341
346
|
id: string;
|
|
342
347
|
app: InstanceType<typeof App>;
|
|
343
348
|
};
|
|
349
|
+
export declare type DeviceType = {
|
|
350
|
+
isMobile: boolean;
|
|
351
|
+
isTouchScreen: boolean;
|
|
352
|
+
};
|
|
344
353
|
export {};
|
package/types/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EVENT } from "./constants";
|
|
2
2
|
import { FontFamilyValues, FontString } from "./element/types";
|
|
3
|
-
import { Zoom } from "./types";
|
|
3
|
+
import { AppState, Zoom } from "./types";
|
|
4
4
|
export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
5
5
|
export declare const getDateTime: () => string;
|
|
6
6
|
export declare const capitalizeString: (str: string) => string;
|
|
@@ -31,7 +31,8 @@ export declare const removeSelection: () => void;
|
|
|
31
31
|
export declare const distance: (x: number, y: number) => number;
|
|
32
32
|
export declare const resetCursor: (canvas: HTMLCanvasElement | null) => void;
|
|
33
33
|
export declare const setCursor: (canvas: HTMLCanvasElement | null, cursor: string) => void;
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const setEraserCursor: (canvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
|
|
35
|
+
export declare const setCursorForShape: (canvas: HTMLCanvasElement | null, appState: AppState) => void;
|
|
35
36
|
export declare const isFullScreen: () => boolean;
|
|
36
37
|
export declare const allowFullScreen: () => Promise<void>;
|
|
37
38
|
export declare const exitFullScreen: () => Promise<void>;
|
|
@@ -116,3 +117,4 @@ export declare const isTestEnv: () => boolean;
|
|
|
116
117
|
export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) => CustomEvent<{
|
|
117
118
|
nativeEvent: T;
|
|
118
119
|
}>;
|
|
120
|
+
export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
|