@zsviczian/excalidraw 0.11.0-obsidian-8 → 0.11.0-obsidian-11

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 (65) hide show
  1. package/dist/excalidraw.development.js +86 -75
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +3 -3
  4. package/types/actions/actionAddToLibrary.d.ts +18 -6
  5. package/types/actions/actionAlign.d.ts +18 -0
  6. package/types/actions/actionBoundText.d.ts +123 -0
  7. package/types/actions/actionCanvas.d.ts +72 -19
  8. package/types/actions/actionClipboard.d.ts +50 -10
  9. package/types/actions/actionDeleteSelected.d.ts +19 -6
  10. package/types/actions/actionDistribute.d.ts +6 -0
  11. package/types/actions/actionDuplicateSelection.d.ts +3 -0
  12. package/types/actions/actionExport.d.ts +71 -18
  13. package/types/actions/actionFinalize.d.ts +13 -6
  14. package/types/actions/actionFlip.d.ts +6 -0
  15. package/types/actions/actionGroup.d.ts +6 -0
  16. package/types/actions/actionMenu.d.ts +29 -6
  17. package/types/actions/actionNavigate.d.ts +3 -0
  18. package/types/actions/actionProperties.d.ts +82 -26
  19. package/types/actions/actionSelectAll.d.ts +3 -0
  20. package/types/actions/actionStyles.d.ts +11 -2
  21. package/types/actions/actionToggleGridMode.d.ts +9 -2
  22. package/types/actions/actionToggleLock.d.ts +17 -0
  23. package/types/actions/actionToggleStats.d.ts +8 -2
  24. package/types/actions/actionToggleViewMode.d.ts +9 -2
  25. package/types/actions/actionToggleZenMode.d.ts +9 -2
  26. package/types/actions/actionZindex.d.ts +12 -0
  27. package/types/actions/index.d.ts +3 -2
  28. package/types/actions/manager.d.ts +3 -3
  29. package/types/actions/shortcuts.d.ts +1 -1
  30. package/types/actions/types.d.ts +7 -9
  31. package/types/appState.d.ts +9 -4
  32. package/types/clipboard.d.ts +1 -1
  33. package/types/components/Actions.d.ts +4 -4
  34. package/types/components/App.d.ts +3 -2
  35. package/types/components/ImageExportDialog.d.ts +2 -2
  36. package/types/components/JSONExportDialog.d.ts +2 -2
  37. package/types/components/ToolButton.d.ts +3 -0
  38. package/types/constants.d.ts +1 -0
  39. package/types/createInverseContext.d.ts +20 -1
  40. package/types/data/index.d.ts +1 -1
  41. package/types/data/json.d.ts +1 -0
  42. package/types/data/library.d.ts +1 -2
  43. package/types/data/restore.d.ts +1 -1
  44. package/types/element/Hyperlink.d.ts +9 -3
  45. package/types/element/dragElements.d.ts +1 -1
  46. package/types/element/linearElementEditor.d.ts +6 -3
  47. package/types/element/sizeHelpers.d.ts +2 -1
  48. package/types/element/textElement.d.ts +1 -2
  49. package/types/element/typeChecks.d.ts +5 -5
  50. package/types/element/types.d.ts +1 -0
  51. package/types/excalidraw-app/app_constants.d.ts +13 -1
  52. package/types/excalidraw-app/collab/CollabWrapper.d.ts +20 -8
  53. package/types/excalidraw-app/collab/Portal.d.ts +2 -2
  54. package/types/excalidraw-app/collab/reconciliation.d.ts +9 -0
  55. package/types/excalidraw-app/data/FileManager.d.ts +66 -0
  56. package/types/excalidraw-app/data/firebase.d.ts +11 -11
  57. package/types/excalidraw-app/data/index.d.ts +32 -27
  58. package/types/excalidraw-app/data/localStorage.d.ts +19 -19
  59. package/types/excalidraw-app/data/tabSync.d.ts +9 -0
  60. package/types/packages/excalidraw/index.d.ts +2 -2
  61. package/types/packages/utils.d.ts +1 -1
  62. package/types/scene/Scene.d.ts +1 -1
  63. package/types/shapes.d.ts +1 -1
  64. package/types/types.d.ts +10 -3
  65. package/types/utils.d.ts +3 -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;
@@ -118,6 +124,7 @@ export declare const actionChangeFillStyle: {
118
124
  };
119
125
  export declare const actionChangeStrokeWidth: {
120
126
  name: "changeStrokeWidth";
127
+ trackEvent: false;
121
128
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
122
129
  elements: ExcalidrawElement[];
123
130
  appState: {
@@ -133,8 +140,11 @@ export declare const actionChangeStrokeWidth: {
133
140
  suggestedBindings: import("../element/binding").SuggestedBinding[];
134
141
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
135
142
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
136
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
137
- elementLocked: boolean;
143
+ activeTool: {
144
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
145
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
146
+ locked: boolean;
147
+ };
138
148
  penMode: boolean;
139
149
  penDetected: boolean;
140
150
  exportBackground: boolean;
@@ -219,6 +229,7 @@ export declare const actionChangeStrokeWidth: {
219
229
  };
220
230
  export declare const actionChangeSloppiness: {
221
231
  name: "changeSloppiness";
232
+ trackEvent: false;
222
233
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
223
234
  elements: ExcalidrawElement[];
224
235
  appState: {
@@ -234,8 +245,11 @@ export declare const actionChangeSloppiness: {
234
245
  suggestedBindings: import("../element/binding").SuggestedBinding[];
235
246
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
236
247
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
237
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
238
- elementLocked: boolean;
248
+ activeTool: {
249
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
250
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
251
+ locked: boolean;
252
+ };
239
253
  penMode: boolean;
240
254
  penDetected: boolean;
241
255
  exportBackground: boolean;
@@ -320,6 +334,7 @@ export declare const actionChangeSloppiness: {
320
334
  };
321
335
  export declare const actionChangeStrokeStyle: {
322
336
  name: "changeStrokeStyle";
337
+ trackEvent: false;
323
338
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
324
339
  elements: ExcalidrawElement[];
325
340
  appState: {
@@ -335,8 +350,11 @@ export declare const actionChangeStrokeStyle: {
335
350
  suggestedBindings: import("../element/binding").SuggestedBinding[];
336
351
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
337
352
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
338
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
339
- elementLocked: boolean;
353
+ activeTool: {
354
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
355
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
356
+ locked: boolean;
357
+ };
340
358
  penMode: boolean;
341
359
  penDetected: boolean;
342
360
  exportBackground: boolean;
@@ -421,6 +439,7 @@ export declare const actionChangeStrokeStyle: {
421
439
  };
422
440
  export declare const actionChangeOpacity: {
423
441
  name: "changeOpacity";
442
+ trackEvent: false;
424
443
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
425
444
  elements: ExcalidrawElement[];
426
445
  appState: {
@@ -436,8 +455,11 @@ export declare const actionChangeOpacity: {
436
455
  suggestedBindings: import("../element/binding").SuggestedBinding[];
437
456
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
438
457
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
439
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
440
- elementLocked: boolean;
458
+ activeTool: {
459
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
460
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
461
+ locked: boolean;
462
+ };
441
463
  penMode: boolean;
442
464
  penDetected: boolean;
443
465
  exportBackground: boolean;
@@ -522,6 +544,7 @@ export declare const actionChangeOpacity: {
522
544
  };
523
545
  export declare const actionChangeFontSize: {
524
546
  name: "changeFontSize";
547
+ trackEvent: false;
525
548
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
526
549
  elements: ExcalidrawElement[];
527
550
  appState: {
@@ -537,8 +560,11 @@ export declare const actionChangeFontSize: {
537
560
  suggestedBindings: import("../element/binding").SuggestedBinding[];
538
561
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
539
562
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
540
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
541
- elementLocked: boolean;
563
+ activeTool: {
564
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
565
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
566
+ locked: boolean;
567
+ };
542
568
  penMode: boolean;
543
569
  penDetected: boolean;
544
570
  exportBackground: boolean;
@@ -623,6 +649,7 @@ export declare const actionChangeFontSize: {
623
649
  };
624
650
  export declare const actionDecreaseFontSize: {
625
651
  name: "decreaseFontSize";
652
+ trackEvent: false;
626
653
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
627
654
  elements: ExcalidrawElement[];
628
655
  appState: {
@@ -638,8 +665,11 @@ export declare const actionDecreaseFontSize: {
638
665
  suggestedBindings: import("../element/binding").SuggestedBinding[];
639
666
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
640
667
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
641
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
642
- elementLocked: boolean;
668
+ activeTool: {
669
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
670
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
671
+ locked: boolean;
672
+ };
643
673
  penMode: boolean;
644
674
  penDetected: boolean;
645
675
  exportBackground: boolean;
@@ -724,6 +754,7 @@ export declare const actionDecreaseFontSize: {
724
754
  };
725
755
  export declare const actionIncreaseFontSize: {
726
756
  name: "increaseFontSize";
757
+ trackEvent: false;
727
758
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
728
759
  elements: ExcalidrawElement[];
729
760
  appState: {
@@ -739,8 +770,11 @@ export declare const actionIncreaseFontSize: {
739
770
  suggestedBindings: import("../element/binding").SuggestedBinding[];
740
771
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
741
772
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
742
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
743
- elementLocked: boolean;
773
+ activeTool: {
774
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
775
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
776
+ locked: boolean;
777
+ };
744
778
  penMode: boolean;
745
779
  penDetected: boolean;
746
780
  exportBackground: boolean;
@@ -825,6 +859,7 @@ export declare const actionIncreaseFontSize: {
825
859
  };
826
860
  export declare const actionChangeFontFamily: {
827
861
  name: "changeFontFamily";
862
+ trackEvent: false;
828
863
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
829
864
  elements: ExcalidrawElement[];
830
865
  appState: {
@@ -840,8 +875,11 @@ export declare const actionChangeFontFamily: {
840
875
  suggestedBindings: import("../element/binding").SuggestedBinding[];
841
876
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
842
877
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
843
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
844
- elementLocked: boolean;
878
+ activeTool: {
879
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
880
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
881
+ locked: boolean;
882
+ };
845
883
  penMode: boolean;
846
884
  penDetected: boolean;
847
885
  exportBackground: boolean;
@@ -926,6 +964,7 @@ export declare const actionChangeFontFamily: {
926
964
  };
927
965
  export declare const actionChangeTextAlign: {
928
966
  name: "changeTextAlign";
967
+ trackEvent: false;
929
968
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
930
969
  elements: ExcalidrawElement[];
931
970
  appState: {
@@ -941,8 +980,11 @@ export declare const actionChangeTextAlign: {
941
980
  suggestedBindings: import("../element/binding").SuggestedBinding[];
942
981
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
943
982
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
944
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
945
- elementLocked: boolean;
983
+ activeTool: {
984
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
985
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
986
+ locked: boolean;
987
+ };
946
988
  penMode: boolean;
947
989
  penDetected: boolean;
948
990
  exportBackground: boolean;
@@ -1027,6 +1069,9 @@ export declare const actionChangeTextAlign: {
1027
1069
  };
1028
1070
  export declare const actionChangeVerticalAlign: {
1029
1071
  name: "changeVerticalAlign";
1072
+ trackEvent: {
1073
+ category: "element";
1074
+ };
1030
1075
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
1031
1076
  elements: ExcalidrawElement[];
1032
1077
  appState: {
@@ -1041,8 +1086,11 @@ export declare const actionChangeVerticalAlign: {
1041
1086
  suggestedBindings: import("../element/binding").SuggestedBinding[];
1042
1087
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1043
1088
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1044
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1045
- elementLocked: boolean;
1089
+ activeTool: {
1090
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1091
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
1092
+ locked: boolean;
1093
+ };
1046
1094
  penMode: boolean;
1047
1095
  penDetected: boolean;
1048
1096
  exportBackground: boolean;
@@ -1128,6 +1176,7 @@ export declare const actionChangeVerticalAlign: {
1128
1176
  };
1129
1177
  export declare const actionChangeSharpness: {
1130
1178
  name: "changeSharpness";
1179
+ trackEvent: false;
1131
1180
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
1132
1181
  elements: ExcalidrawElement[];
1133
1182
  appState: {
@@ -1144,8 +1193,11 @@ export declare const actionChangeSharpness: {
1144
1193
  suggestedBindings: import("../element/binding").SuggestedBinding[];
1145
1194
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1146
1195
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1147
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1148
- elementLocked: boolean;
1196
+ activeTool: {
1197
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1198
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
1199
+ locked: boolean;
1200
+ };
1149
1201
  penMode: boolean;
1150
1202
  penDetected: boolean;
1151
1203
  exportBackground: boolean;
@@ -1229,6 +1281,7 @@ export declare const actionChangeSharpness: {
1229
1281
  };
1230
1282
  export declare const actionChangeArrowhead: {
1231
1283
  name: "changeArrowhead";
1284
+ trackEvent: false;
1232
1285
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: {
1233
1286
  position: "start" | "end";
1234
1287
  type: Arrowhead;
@@ -1246,8 +1299,11 @@ export declare const actionChangeArrowhead: {
1246
1299
  suggestedBindings: import("../element/binding").SuggestedBinding[];
1247
1300
  editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1248
1301
  editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1249
- elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1250
- elementLocked: boolean;
1302
+ activeTool: {
1303
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
1304
+ lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
1305
+ locked: boolean;
1306
+ };
1251
1307
  penMode: boolean;
1252
1308
  penDetected: boolean;
1253
1309
  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;
@@ -103,6 +109,9 @@ export declare const actionCopyStyles: {
103
109
  };
104
110
  export declare const actionPasteStyles: {
105
111
  name: "pasteStyles";
112
+ trackEvent: {
113
+ category: "element";
114
+ };
106
115
  perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
107
116
  elements: readonly import("../element/types").ExcalidrawElement[];
108
117
  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;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { ExcalidrawElement } from "../element/types";
3
+ export declare const actionToggleLock: {
4
+ name: "toggleLock";
5
+ trackEvent: {
6
+ category: "element";
7
+ };
8
+ perform: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => false | {
9
+ elements: ExcalidrawElement[];
10
+ appState: Readonly<import("../types").AppState>;
11
+ commitToHistory: true;
12
+ };
13
+ contextItemLabel: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => "labels.elementLock.unlock" | "labels.elementLock.lock" | "labels.elementLock.lockAll" | "labels.elementLock.unlockAll";
14
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: import("../types").AppState, elements: readonly ExcalidrawElement[]) => boolean;
15
+ } & {
16
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: import("../types").AppState, elements: readonly ExcalidrawElement[]) => boolean) | undefined;
17
+ };
@@ -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>, _: any, app: import("../types").AppClassProperties): {
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>;
@@ -14,9 +14,10 @@ export { actionAddToLibrary } from "./actionAddToLibrary";
14
14
  export { actionAlignTop, actionAlignBottom, actionAlignLeft, actionAlignRight, actionAlignVerticallyCentered, actionAlignHorizontallyCentered, } from "./actionAlign";
15
15
  export { distributeHorizontally, distributeVertically, } from "./actionDistribute";
16
16
  export { actionFlipHorizontal, actionFlipVertical } from "./actionFlip";
17
- export { actionCopy, actionCut, actionCopyAsPng, actionCopyAsSvg, } from "./actionClipboard";
17
+ export { actionCopy, actionCut, actionCopyAsPng, actionCopyAsSvg, copyText, } from "./actionClipboard";
18
18
  export { actionToggleGridMode } from "./actionToggleGridMode";
19
19
  export { actionToggleZenMode } from "./actionToggleZenMode";
20
20
  export { actionToggleStats } from "./actionToggleStats";
21
- export { actionUnbindText } from "./actionUnbindText";
21
+ export { actionUnbindText, actionBindText } from "./actionBoundText";
22
22
  export { actionLink } from "../element/Hyperlink";
23
+ export { actionToggleLock } from "./actionToggleLock";
@@ -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
  */
@@ -1,3 +1,3 @@
1
1
  import { ActionName } from "./types";
2
- export declare type ShortcutName = SubtypeOf<ActionName, "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink">;
2
+ export declare type ShortcutName = SubtypeOf<ActionName, "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleLock">;
3
3
  export declare const getShortcutFromShortcutName: (name: ShortcutName) => string;
@@ -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;
@@ -14,7 +15,7 @@ export declare type ActionResult = {
14
15
  declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
15
16
  export declare type UpdaterFn = (res: ActionResult) => void;
16
17
  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";
18
+ export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "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" | "toggleLock";
18
19
  export declare type PanelComponentProps = {
19
20
  elements: readonly ExcalidrawElement[];
20
21
  appState: AppState;
@@ -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;