@dwelle/excalidraw 0.3.55 → 0.3.58

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/excalidraw-assets-dev/{image-73be8b3c1837ea26950c.js → image-eddc6ed66acd3a3f3d46.js} +0 -0
  3. package/dist/excalidraw.development.js +50 -50
  4. package/dist/excalidraw.production.min.js +1 -1
  5. package/package.json +2 -2
  6. package/types/actions/actionAddToLibrary.d.ts +18 -6
  7. package/types/actions/actionAlign.d.ts +18 -0
  8. package/types/actions/actionBoundText.d.ts +11 -2
  9. package/types/actions/actionCanvas.d.ts +65 -16
  10. package/types/actions/actionClipboard.d.ts +37 -10
  11. package/types/actions/actionDeleteSelected.d.ts +19 -6
  12. package/types/actions/actionDistribute.d.ts +6 -0
  13. package/types/actions/actionDuplicateSelection.d.ts +3 -0
  14. package/types/actions/actionExport.d.ts +71 -18
  15. package/types/actions/actionFinalize.d.ts +11 -4
  16. package/types/actions/actionFlip.d.ts +6 -0
  17. package/types/actions/actionGroup.d.ts +6 -0
  18. package/types/actions/actionMenu.d.ts +29 -6
  19. package/types/actions/actionNavigate.d.ts +3 -0
  20. package/types/actions/actionProperties.d.ts +82 -26
  21. package/types/actions/actionSelectAll.d.ts +3 -0
  22. package/types/actions/actionStyles.d.ts +11 -2
  23. package/types/actions/actionToggleGridMode.d.ts +9 -2
  24. package/types/actions/actionToggleStats.d.ts +8 -2
  25. package/types/actions/actionToggleViewMode.d.ts +9 -2
  26. package/types/actions/actionToggleZenMode.d.ts +9 -2
  27. package/types/actions/actionZindex.d.ts +12 -0
  28. package/types/actions/manager.d.ts +3 -3
  29. package/types/actions/types.d.ts +6 -8
  30. package/types/appState.d.ts +9 -4
  31. package/types/components/Actions.d.ts +4 -4
  32. package/types/components/App.d.ts +3 -2
  33. package/types/components/ImageExportDialog.d.ts +2 -2
  34. package/types/components/JSONExportDialog.d.ts +2 -2
  35. package/types/components/ToolButton.d.ts +3 -0
  36. package/types/constants.d.ts +1 -0
  37. package/types/data/restore.d.ts +1 -1
  38. package/types/element/Hyperlink.d.ts +9 -3
  39. package/types/element/dragElements.d.ts +1 -1
  40. package/types/element/linearElementEditor.d.ts +5 -2
  41. package/types/element/sizeHelpers.d.ts +2 -1
  42. package/types/element/typeChecks.d.ts +2 -2
  43. package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-eddc6ed66acd3a3f3d46.d.ts +0 -0
  44. package/types/scene/Scene.d.ts +1 -1
  45. package/types/types.d.ts +10 -3
  46. package/types/utils.d.ts +2 -0
@@ -3,6 +3,7 @@ import { AppState } from "../../src/types";
3
3
  import { Arrowhead, ExcalidrawElement, ExcalidrawLinearElement, TextAlign } from "../element/types";
4
4
  export declare const actionChangeStrokeColor: {
5
5
  name: "changeStrokeColor";
6
+ trackEvent: false;
6
7
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => any;
7
8
  PanelComponent: ({ elements, appState, updateData }: import("react").PropsWithChildren<import("./types").PanelComponentProps>) => JSX.Element;
8
9
  } & {
@@ -10,6 +11,7 @@ export declare const actionChangeStrokeColor: {
10
11
  };
11
12
  export declare const actionChangeBackgroundColor: {
12
13
  name: "changeBackgroundColor";
14
+ trackEvent: false;
13
15
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => any;
14
16
  PanelComponent: ({ elements, appState, updateData }: import("react").PropsWithChildren<import("./types").PanelComponentProps>) => JSX.Element;
15
17
  } & {
@@ -17,6 +19,7 @@ export declare const actionChangeBackgroundColor: {
17
19
  };
18
20
  export declare const actionChangeFillStyle: {
19
21
  name: "changeFillStyle";
22
+ trackEvent: false;
20
23
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
21
24
  elements: ExcalidrawElement[];
22
25
  appState: {
@@ -32,8 +35,11 @@ export declare const actionChangeFillStyle: {
32
35
  suggestedBindings: import("../element/binding").SuggestedBinding[];
33
36
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
34
37
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
35
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
36
- elementLocked: boolean;
38
+ activeTool: {
39
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
40
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
41
+ locked: boolean;
42
+ };
37
43
  penMode: boolean;
38
44
  penDetected: boolean;
39
45
  exportBackground: boolean;
@@ -111,6 +117,7 @@ export declare const actionChangeFillStyle: {
111
117
  };
112
118
  export declare const actionChangeStrokeWidth: {
113
119
  name: "changeStrokeWidth";
120
+ trackEvent: false;
114
121
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
115
122
  elements: ExcalidrawElement[];
116
123
  appState: {
@@ -126,8 +133,11 @@ export declare const actionChangeStrokeWidth: {
126
133
  suggestedBindings: import("../element/binding").SuggestedBinding[];
127
134
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
128
135
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
129
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
130
- elementLocked: boolean;
136
+ activeTool: {
137
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
138
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
139
+ locked: boolean;
140
+ };
131
141
  penMode: boolean;
132
142
  penDetected: boolean;
133
143
  exportBackground: boolean;
@@ -205,6 +215,7 @@ export declare const actionChangeStrokeWidth: {
205
215
  };
206
216
  export declare const actionChangeSloppiness: {
207
217
  name: "changeSloppiness";
218
+ trackEvent: false;
208
219
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
209
220
  elements: ExcalidrawElement[];
210
221
  appState: {
@@ -220,8 +231,11 @@ export declare const actionChangeSloppiness: {
220
231
  suggestedBindings: import("../element/binding").SuggestedBinding[];
221
232
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
222
233
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
223
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
224
- elementLocked: boolean;
234
+ activeTool: {
235
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
236
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
237
+ locked: boolean;
238
+ };
225
239
  penMode: boolean;
226
240
  penDetected: boolean;
227
241
  exportBackground: boolean;
@@ -299,6 +313,7 @@ export declare const actionChangeSloppiness: {
299
313
  };
300
314
  export declare const actionChangeStrokeStyle: {
301
315
  name: "changeStrokeStyle";
316
+ trackEvent: false;
302
317
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
303
318
  elements: ExcalidrawElement[];
304
319
  appState: {
@@ -314,8 +329,11 @@ export declare const actionChangeStrokeStyle: {
314
329
  suggestedBindings: import("../element/binding").SuggestedBinding[];
315
330
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
316
331
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
317
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
318
- elementLocked: boolean;
332
+ activeTool: {
333
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
334
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
335
+ locked: boolean;
336
+ };
319
337
  penMode: boolean;
320
338
  penDetected: boolean;
321
339
  exportBackground: boolean;
@@ -393,6 +411,7 @@ export declare const actionChangeStrokeStyle: {
393
411
  };
394
412
  export declare const actionChangeOpacity: {
395
413
  name: "changeOpacity";
414
+ trackEvent: false;
396
415
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
397
416
  elements: ExcalidrawElement[];
398
417
  appState: {
@@ -408,8 +427,11 @@ export declare const actionChangeOpacity: {
408
427
  suggestedBindings: import("../element/binding").SuggestedBinding[];
409
428
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
410
429
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
411
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
412
- elementLocked: boolean;
430
+ activeTool: {
431
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
432
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
433
+ locked: boolean;
434
+ };
413
435
  penMode: boolean;
414
436
  penDetected: boolean;
415
437
  exportBackground: boolean;
@@ -487,6 +509,7 @@ export declare const actionChangeOpacity: {
487
509
  };
488
510
  export declare const actionChangeFontSize: {
489
511
  name: "changeFontSize";
512
+ trackEvent: false;
490
513
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
491
514
  elements: ExcalidrawElement[];
492
515
  appState: {
@@ -502,8 +525,11 @@ export declare const actionChangeFontSize: {
502
525
  suggestedBindings: import("../element/binding").SuggestedBinding[];
503
526
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
504
527
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
505
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
506
- elementLocked: boolean;
528
+ activeTool: {
529
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
530
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
531
+ locked: boolean;
532
+ };
507
533
  penMode: boolean;
508
534
  penDetected: boolean;
509
535
  exportBackground: boolean;
@@ -581,6 +607,7 @@ export declare const actionChangeFontSize: {
581
607
  };
582
608
  export declare const actionDecreaseFontSize: {
583
609
  name: "decreaseFontSize";
610
+ trackEvent: false;
584
611
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
585
612
  elements: ExcalidrawElement[];
586
613
  appState: {
@@ -596,8 +623,11 @@ export declare const actionDecreaseFontSize: {
596
623
  suggestedBindings: import("../element/binding").SuggestedBinding[];
597
624
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
598
625
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
599
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
600
- elementLocked: boolean;
626
+ activeTool: {
627
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
628
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
629
+ locked: boolean;
630
+ };
601
631
  penMode: boolean;
602
632
  penDetected: boolean;
603
633
  exportBackground: boolean;
@@ -675,6 +705,7 @@ export declare const actionDecreaseFontSize: {
675
705
  };
676
706
  export declare const actionIncreaseFontSize: {
677
707
  name: "increaseFontSize";
708
+ trackEvent: false;
678
709
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
679
710
  elements: ExcalidrawElement[];
680
711
  appState: {
@@ -690,8 +721,11 @@ export declare const actionIncreaseFontSize: {
690
721
  suggestedBindings: import("../element/binding").SuggestedBinding[];
691
722
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
692
723
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
693
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
694
- elementLocked: boolean;
724
+ activeTool: {
725
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
726
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
727
+ locked: boolean;
728
+ };
695
729
  penMode: boolean;
696
730
  penDetected: boolean;
697
731
  exportBackground: boolean;
@@ -769,6 +803,7 @@ export declare const actionIncreaseFontSize: {
769
803
  };
770
804
  export declare const actionChangeFontFamily: {
771
805
  name: "changeFontFamily";
806
+ trackEvent: false;
772
807
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
773
808
  elements: ExcalidrawElement[];
774
809
  appState: {
@@ -784,8 +819,11 @@ export declare const actionChangeFontFamily: {
784
819
  suggestedBindings: import("../element/binding").SuggestedBinding[];
785
820
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
786
821
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
787
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
788
- elementLocked: boolean;
822
+ activeTool: {
823
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
824
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
825
+ locked: boolean;
826
+ };
789
827
  penMode: boolean;
790
828
  penDetected: boolean;
791
829
  exportBackground: boolean;
@@ -863,6 +901,7 @@ export declare const actionChangeFontFamily: {
863
901
  };
864
902
  export declare const actionChangeTextAlign: {
865
903
  name: "changeTextAlign";
904
+ trackEvent: false;
866
905
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
867
906
  elements: ExcalidrawElement[];
868
907
  appState: {
@@ -878,8 +917,11 @@ export declare const actionChangeTextAlign: {
878
917
  suggestedBindings: import("../element/binding").SuggestedBinding[];
879
918
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
880
919
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
881
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
882
- elementLocked: boolean;
920
+ activeTool: {
921
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
922
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
923
+ locked: boolean;
924
+ };
883
925
  penMode: boolean;
884
926
  penDetected: boolean;
885
927
  exportBackground: boolean;
@@ -957,6 +999,9 @@ export declare const actionChangeTextAlign: {
957
999
  };
958
1000
  export declare const actionChangeVerticalAlign: {
959
1001
  name: "changeVerticalAlign";
1002
+ trackEvent: {
1003
+ category: "element";
1004
+ };
960
1005
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
961
1006
  elements: ExcalidrawElement[];
962
1007
  appState: {
@@ -971,8 +1016,11 @@ export declare const actionChangeVerticalAlign: {
971
1016
  suggestedBindings: import("../element/binding").SuggestedBinding[];
972
1017
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
973
1018
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
974
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
975
- elementLocked: boolean;
1019
+ activeTool: {
1020
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1021
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
1022
+ locked: boolean;
1023
+ };
976
1024
  penMode: boolean;
977
1025
  penDetected: boolean;
978
1026
  exportBackground: boolean;
@@ -1051,6 +1099,7 @@ export declare const actionChangeVerticalAlign: {
1051
1099
  };
1052
1100
  export declare const actionChangeSharpness: {
1053
1101
  name: "changeSharpness";
1102
+ trackEvent: false;
1054
1103
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
1055
1104
  elements: ExcalidrawElement[];
1056
1105
  appState: {
@@ -1067,8 +1116,11 @@ export declare const actionChangeSharpness: {
1067
1116
  suggestedBindings: import("../element/binding").SuggestedBinding[];
1068
1117
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1069
1118
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1070
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1071
- elementLocked: boolean;
1119
+ activeTool: {
1120
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1121
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
1122
+ locked: boolean;
1123
+ };
1072
1124
  penMode: boolean;
1073
1125
  penDetected: boolean;
1074
1126
  exportBackground: boolean;
@@ -1145,6 +1197,7 @@ export declare const actionChangeSharpness: {
1145
1197
  };
1146
1198
  export declare const actionChangeArrowhead: {
1147
1199
  name: "changeArrowhead";
1200
+ trackEvent: false;
1148
1201
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: {
1149
1202
  position: "start" | "end";
1150
1203
  type: Arrowhead;
@@ -1162,8 +1215,11 @@ export declare const actionChangeArrowhead: {
1162
1215
  suggestedBindings: import("../element/binding").SuggestedBinding[];
1163
1216
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1164
1217
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1165
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1166
- elementLocked: boolean;
1218
+ activeTool: {
1219
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1220
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
1221
+ locked: boolean;
1222
+ };
1167
1223
  penMode: boolean;
1168
1224
  penDetected: boolean;
1169
1225
  exportBackground: boolean;
@@ -1,6 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  export declare const actionSelectAll: {
3
3
  name: "selectAll";
4
+ trackEvent: {
5
+ category: "canvas";
6
+ };
4
7
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => false | {
5
8
  appState: import("../types").AppState;
6
9
  commitToHistory: true;
@@ -2,6 +2,9 @@
2
2
  export declare let copiedStyles: string;
3
3
  export declare const actionCopyStyles: {
4
4
  name: "copyStyles";
5
+ trackEvent: {
6
+ category: "element";
7
+ };
5
8
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
6
9
  appState: {
7
10
  toastMessage: string;
@@ -16,8 +19,11 @@ export declare const actionCopyStyles: {
16
19
  suggestedBindings: import("../element/binding").SuggestedBinding[];
17
20
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
18
21
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
19
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
20
- elementLocked: boolean;
22
+ activeTool: {
23
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
24
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
25
+ locked: boolean;
26
+ };
21
27
  penMode: boolean;
22
28
  penDetected: boolean;
23
29
  exportBackground: boolean;
@@ -96,6 +102,9 @@ export declare const actionCopyStyles: {
96
102
  };
97
103
  export declare const actionPasteStyles: {
98
104
  name: "pasteStyles";
105
+ trackEvent: {
106
+ category: "element";
107
+ };
99
108
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
100
109
  elements: readonly import("../element/types").ExcalidrawElement[];
101
110
  commitToHistory: false;
@@ -2,6 +2,10 @@
2
2
  import { AppState } from "../types";
3
3
  export declare const actionToggleGridMode: {
4
4
  name: "gridMode";
5
+ trackEvent: {
6
+ category: "canvas";
7
+ predicate: (appState: Readonly<AppState>) => boolean;
8
+ };
5
9
  perform(elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<AppState>): {
6
10
  appState: {
7
11
  gridSize: number | null;
@@ -16,8 +20,11 @@ export declare const actionToggleGridMode: {
16
20
  suggestedBindings: import("../element/binding").SuggestedBinding[];
17
21
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
18
22
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
19
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
20
- elementLocked: boolean;
23
+ activeTool: {
24
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
25
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
26
+ locked: boolean;
27
+ };
21
28
  penMode: boolean;
22
29
  penDetected: boolean;
23
30
  exportBackground: boolean;
@@ -1,6 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  export declare const actionToggleStats: {
3
3
  name: "stats";
4
+ trackEvent: {
5
+ category: "menu";
6
+ };
4
7
  perform(elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>): {
5
8
  appState: {
6
9
  showStats: boolean;
@@ -15,8 +18,11 @@ export declare const actionToggleStats: {
15
18
  suggestedBindings: import("../element/binding").SuggestedBinding[];
16
19
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
17
20
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
18
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
19
- elementLocked: boolean;
21
+ activeTool: {
22
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
23
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
24
+ locked: boolean;
25
+ };
20
26
  penMode: boolean;
21
27
  penDetected: boolean;
22
28
  exportBackground: boolean;
@@ -1,6 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  export declare const actionToggleViewMode: {
3
3
  name: "viewMode";
4
+ trackEvent: {
5
+ category: "canvas";
6
+ predicate: (appState: Readonly<import("../types").AppState>) => boolean;
7
+ };
4
8
  perform(elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>): {
5
9
  appState: {
6
10
  viewModeEnabled: boolean;
@@ -15,8 +19,11 @@ export declare const actionToggleViewMode: {
15
19
  suggestedBindings: import("../element/binding").SuggestedBinding[];
16
20
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
17
21
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
18
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
19
- elementLocked: boolean;
22
+ activeTool: {
23
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
24
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
25
+ locked: boolean;
26
+ };
20
27
  penMode: boolean;
21
28
  penDetected: boolean;
22
29
  exportBackground: boolean;
@@ -1,6 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  export declare const actionToggleZenMode: {
3
3
  name: "zenMode";
4
+ trackEvent: {
5
+ category: "canvas";
6
+ predicate: (appState: Readonly<import("../types").AppState>) => boolean;
7
+ };
4
8
  perform(elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>): {
5
9
  appState: {
6
10
  zenModeEnabled: boolean;
@@ -15,8 +19,11 @@ export declare const actionToggleZenMode: {
15
19
  suggestedBindings: import("../element/binding").SuggestedBinding[];
16
20
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
17
21
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
18
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
19
- elementLocked: boolean;
22
+ activeTool: {
23
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
24
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
25
+ locked: boolean;
26
+ };
20
27
  penMode: boolean;
21
28
  penDetected: boolean;
22
29
  exportBackground: boolean;
@@ -1,6 +1,9 @@
1
1
  import React from "react";
2
2
  export declare const actionSendBackward: {
3
3
  name: "sendBackward";
4
+ trackEvent: {
5
+ category: "element";
6
+ };
4
7
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
5
8
  elements: (import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawSelectionElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement)[];
6
9
  appState: Readonly<import("../types").AppState>;
@@ -15,6 +18,9 @@ export declare const actionSendBackward: {
15
18
  };
16
19
  export declare const actionBringForward: {
17
20
  name: "bringForward";
21
+ trackEvent: {
22
+ category: "element";
23
+ };
18
24
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
19
25
  elements: (import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawSelectionElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement)[];
20
26
  appState: Readonly<import("../types").AppState>;
@@ -29,6 +35,9 @@ export declare const actionBringForward: {
29
35
  };
30
36
  export declare const actionSendToBack: {
31
37
  name: "sendToBack";
38
+ trackEvent: {
39
+ category: "element";
40
+ };
32
41
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
33
42
  elements: readonly import("../element/types").ExcalidrawElement[];
34
43
  appState: Readonly<import("../types").AppState>;
@@ -42,6 +51,9 @@ export declare const actionSendToBack: {
42
51
  };
43
52
  export declare const actionBringToFront: {
44
53
  name: "bringToFront";
54
+ trackEvent: {
55
+ category: "element";
56
+ };
45
57
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
46
58
  elements: readonly import("../element/types").ExcalidrawElement[];
47
59
  appState: Readonly<import("../types").AppState>;
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
- import { Action, ActionsManagerInterface, UpdaterFn, ActionName, ActionResult, PanelComponentProps } from "./types";
2
+ import { Action, UpdaterFn, ActionName, ActionResult, PanelComponentProps, ActionSource } from "./types";
3
3
  import { ExcalidrawElement } from "../element/types";
4
4
  import { AppClassProperties, AppState } from "../types";
5
- export declare class ActionManager implements ActionsManagerInterface {
5
+ export declare class ActionManager {
6
6
  actions: Record<ActionName, Action>;
7
7
  updater: (actionResult: ActionResult | Promise<ActionResult>) => void;
8
8
  getAppState: () => Readonly<AppState>;
@@ -12,7 +12,7 @@ export declare class ActionManager implements ActionsManagerInterface {
12
12
  registerAction(action: Action): void;
13
13
  registerAll(actions: readonly Action[]): void;
14
14
  handleKeyDown(event: React.KeyboardEvent | KeyboardEvent): boolean;
15
- executeAction(action: Action): void;
15
+ executeAction(action: Action, source?: ActionSource): void;
16
16
  /**
17
17
  * @param data additional data sent to the PanelComponent
18
18
  */
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { ExcalidrawElement } from "../element/types";
3
3
  import { AppClassProperties, AppState, ExcalidrawProps, BinaryFiles } from "../types";
4
4
  import { ToolButtonSize } from "../components/ToolButton";
5
+ export declare type ActionSource = "ui" | "keyboard" | "contextMenu" | "api";
5
6
  /** if false, the action should be prevented */
6
7
  export declare type ActionResult = {
7
8
  elements?: readonly ExcalidrawElement[] | null;
@@ -34,13 +35,10 @@ export interface Action {
34
35
  contextItemLabel?: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => string);
35
36
  contextItemPredicate?: (elements: readonly ExcalidrawElement[], appState: AppState) => boolean;
36
37
  checked?: (appState: Readonly<AppState>) => boolean;
37
- trackEvent?: boolean | ((action: Action, type: "ui" | "keyboard" | "api", value: any) => void);
38
- }
39
- export interface ActionsManagerInterface {
40
- actions: Record<ActionName, Action>;
41
- registerAction: (action: Action) => void;
42
- handleKeyDown: (event: React.KeyboardEvent | KeyboardEvent) => boolean;
43
- renderAction: (name: ActionName) => React.ReactElement | null;
44
- executeAction: (action: Action) => void;
38
+ trackEvent: false | {
39
+ category: "toolbar" | "element" | "canvas" | "export" | "history" | "menu" | "collab" | "hyperlink";
40
+ action?: string;
41
+ predicate?: (appState: Readonly<AppState>, elements: readonly ExcalidrawElement[], value: any) => boolean;
42
+ };
45
43
  }
46
44
  export {};
@@ -1,7 +1,11 @@
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
- elementType?: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | undefined;
4
+ activeTool?: {
5
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
6
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
7
+ locked: boolean;
8
+ } | undefined;
5
9
  scrollX?: number | undefined;
6
10
  scrollY?: number | undefined;
7
11
  viewBackgroundColor?: string | undefined;
@@ -11,7 +15,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
11
15
  shouldCacheIgnoreZoom?: boolean | undefined;
12
16
  theme?: string | undefined;
13
17
  name?: string | undefined;
14
- elementLocked?: boolean | undefined;
18
+ penMode?: boolean | undefined;
19
+ penDetected?: boolean | undefined;
15
20
  exportBackground?: boolean | undefined;
16
21
  exportEmbedScene?: boolean | undefined;
17
22
  exportWithDarkMode?: boolean | undefined;
@@ -57,6 +62,6 @@ export declare const clearAppStateForDatabase: (appState: Partial<AppState>) =>
57
62
  viewBackgroundColor?: string | undefined;
58
63
  gridSize?: number | null | undefined;
59
64
  };
60
- export declare const isEraserActive: ({ elementType, }: {
61
- elementType: AppState["elementType"];
65
+ export declare const isEraserActive: ({ activeTool, }: {
66
+ activeTool: AppState["activeTool"];
62
67
  }) => boolean;
@@ -2,15 +2,15 @@ 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, elementType, }: {
5
+ export declare const SelectedShapeActions: ({ appState, elements, renderAction, activeTool, }: {
6
6
  appState: AppState;
7
7
  elements: readonly ExcalidrawElement[];
8
8
  renderAction: ActionManager["renderAction"];
9
- elementType: AppState["elementType"];
9
+ activeTool: AppState["activeTool"]["type"];
10
10
  }) => JSX.Element;
11
- export declare const ShapesSwitcher: ({ canvas, elementType, setAppState, onImageAction, appState, }: {
11
+ export declare const ShapesSwitcher: ({ canvas, activeTool, setAppState, onImageAction, appState, }: {
12
12
  canvas: HTMLCanvasElement | null;
13
- elementType: AppState["elementType"];
13
+ activeTool: AppState["activeTool"];
14
14
  setAppState: React.Component<any, AppState>["setState"];
15
15
  onImageAction: (data: {
16
16
  pointerType: PointerType | null;
@@ -74,7 +74,7 @@ declare class App extends React.Component<AppProps, AppState> {
74
74
  private addTextFromPaste;
75
75
  setAppState: (obj: any) => void;
76
76
  removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
77
- toggleLock: () => void;
77
+ toggleLock: (source?: "keyboard" | "ui") => void;
78
78
  togglePenMode: () => void;
79
79
  toggleZenMode: () => void;
80
80
  toggleStats: () => void;
@@ -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 selectShapeTool;
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
  /**
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { ActionsManagerInterface } from "../actions/types";
3
2
  import { NonDeletedExcalidrawElement } from "../element/types";
4
3
  import { AppState, BinaryFiles } from "../types";
5
4
  import "./ExportDialog.scss";
5
+ import { ActionManager } from "../actions/manager";
6
6
  export declare const ErrorCanvasPreview: () => JSX.Element;
7
7
  export declare type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
8
8
  export declare const ImageExportDialog: ({ elements, appState, files, exportPadding, actionManager, onExportToPng, onExportToSvg, onExportToClipboard, }: {
@@ -10,7 +10,7 @@ export declare const ImageExportDialog: ({ elements, appState, files, exportPadd
10
10
  elements: readonly NonDeletedExcalidrawElement[];
11
11
  files: BinaryFiles;
12
12
  exportPadding?: number | undefined;
13
- actionManager: ActionsManagerInterface;
13
+ actionManager: ActionManager;
14
14
  onExportToPng: ExportCB;
15
15
  onExportToSvg: ExportCB;
16
16
  onExportToClipboard: ExportCB;