@zsviczian/excalidraw 0.14.2-1-obsidian → 0.14.2-obsidian-3

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 (40) hide show
  1. package/dist/excalidraw.development.js +54 -43
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +2 -2
  4. package/types/actions/actionAddToLibrary.d.ts +5 -1
  5. package/types/actions/actionBoundText.d.ts +26 -8
  6. package/types/actions/actionCanvas.d.ts +20 -10
  7. package/types/actions/actionClipboard.d.ts +8 -3
  8. package/types/actions/actionDeleteSelected.d.ts +6 -3
  9. package/types/actions/actionDuplicateSelection.d.ts +1 -1
  10. package/types/actions/actionExport.d.ts +17 -8
  11. package/types/actions/actionFinalize.d.ts +4 -2
  12. package/types/actions/actionLinearEditor.d.ts +3 -1
  13. package/types/actions/actionMenu.d.ts +6 -3
  14. package/types/actions/actionProperties.d.ts +26 -13
  15. package/types/actions/actionStyles.d.ts +2 -1
  16. package/types/actions/actionToggleGridMode.d.ts +2 -1
  17. package/types/actions/actionToggleLock.d.ts +2 -1
  18. package/types/actions/actionToggleStats.d.ts +2 -1
  19. package/types/actions/actionToggleViewMode.d.ts +2 -1
  20. package/types/actions/actionToggleZenMode.d.ts +2 -1
  21. package/types/actions/shortcuts.d.ts +1 -0
  22. package/types/actions/types.d.ts +2 -1
  23. package/types/components/App.d.ts +12 -1
  24. package/types/components/BraveMeasureTextError.d.ts +2 -0
  25. package/types/components/ErrorDialog.d.ts +3 -2
  26. package/types/components/HelpButton.d.ts +0 -1
  27. package/types/constants.d.ts +1 -0
  28. package/types/data/blob.d.ts +1 -0
  29. package/types/element/Hyperlink.d.ts +2 -1
  30. package/types/element/linearElementEditor.d.ts +6 -3
  31. package/types/element/mutateElement.d.ts +1 -0
  32. package/types/element/newElement.d.ts +2 -0
  33. package/types/element/textElement.d.ts +27 -7
  34. package/types/element/typeChecks.d.ts +1 -0
  35. package/types/element/types.d.ts +8 -0
  36. package/types/packages/excalidraw/index.d.ts +1 -0
  37. package/types/packages/utils.d.ts +1 -1
  38. package/types/types.d.ts +4 -2
  39. package/types/utility-types.d.ts +22 -0
  40. package/types/utils.d.ts +20 -0
@@ -14,7 +14,7 @@ export declare const actionToggleCanvasMenu: {
14
14
  } | null;
15
15
  showWelcomeScreen: boolean;
16
16
  isLoading: boolean;
17
- errorMessage: string | null;
17
+ errorMessage: import("react").ReactNode;
18
18
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
19
19
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
20
20
  multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
@@ -120,6 +120,7 @@ export declare const actionToggleCanvasMenu: {
120
120
  customPens?: any[] | undefined;
121
121
  currentStrokeOptions?: any;
122
122
  resetCustomPen?: any;
123
+ gridColor: string;
123
124
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
124
125
  };
125
126
  commitToHistory: false;
@@ -143,7 +144,7 @@ export declare const actionToggleEditMenu: {
143
144
  } | null;
144
145
  showWelcomeScreen: boolean;
145
146
  isLoading: boolean;
146
- errorMessage: string | null;
147
+ errorMessage: import("react").ReactNode;
147
148
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
148
149
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
149
150
  multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
@@ -249,6 +250,7 @@ export declare const actionToggleEditMenu: {
249
250
  customPens?: any[] | undefined;
250
251
  currentStrokeOptions?: any;
251
252
  resetCustomPen?: any;
253
+ gridColor: string;
252
254
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
253
255
  };
254
256
  commitToHistory: false;
@@ -288,7 +290,7 @@ export declare const actionShortcuts: {
288
290
  } | null;
289
291
  showWelcomeScreen: boolean;
290
292
  isLoading: boolean;
291
- errorMessage: string | null;
293
+ errorMessage: import("react").ReactNode;
292
294
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
293
295
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
294
296
  multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
@@ -394,6 +396,7 @@ export declare const actionShortcuts: {
394
396
  customPens?: any[] | undefined;
395
397
  currentStrokeOptions?: any;
396
398
  resetCustomPen?: any;
399
+ gridColor: string;
397
400
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
398
401
  };
399
402
  commitToHistory: false;
@@ -31,7 +31,7 @@ export declare const actionChangeFillStyle: {
31
31
  } | null;
32
32
  showWelcomeScreen: boolean;
33
33
  isLoading: boolean;
34
- errorMessage: string | null;
34
+ errorMessage: import("react").ReactNode;
35
35
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
36
36
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
37
37
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -137,6 +137,7 @@ export declare const actionChangeFillStyle: {
137
137
  customPens?: any[] | undefined;
138
138
  currentStrokeOptions?: any;
139
139
  resetCustomPen?: any;
140
+ gridColor: string;
140
141
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
141
142
  };
142
143
  commitToHistory: true;
@@ -159,7 +160,7 @@ export declare const actionChangeStrokeWidth: {
159
160
  } | null;
160
161
  showWelcomeScreen: boolean;
161
162
  isLoading: boolean;
162
- errorMessage: string | null;
163
+ errorMessage: import("react").ReactNode;
163
164
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
164
165
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
165
166
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -265,6 +266,7 @@ export declare const actionChangeStrokeWidth: {
265
266
  customPens?: any[] | undefined;
266
267
  currentStrokeOptions?: any;
267
268
  resetCustomPen?: any;
269
+ gridColor: string;
268
270
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
269
271
  };
270
272
  commitToHistory: true;
@@ -287,7 +289,7 @@ export declare const actionChangeSloppiness: {
287
289
  } | null;
288
290
  showWelcomeScreen: boolean;
289
291
  isLoading: boolean;
290
- errorMessage: string | null;
292
+ errorMessage: import("react").ReactNode;
291
293
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
292
294
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
293
295
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -393,6 +395,7 @@ export declare const actionChangeSloppiness: {
393
395
  customPens?: any[] | undefined;
394
396
  currentStrokeOptions?: any;
395
397
  resetCustomPen?: any;
398
+ gridColor: string;
396
399
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
397
400
  };
398
401
  commitToHistory: true;
@@ -415,7 +418,7 @@ export declare const actionChangeStrokeStyle: {
415
418
  } | null;
416
419
  showWelcomeScreen: boolean;
417
420
  isLoading: boolean;
418
- errorMessage: string | null;
421
+ errorMessage: import("react").ReactNode;
419
422
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
420
423
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
421
424
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -521,6 +524,7 @@ export declare const actionChangeStrokeStyle: {
521
524
  customPens?: any[] | undefined;
522
525
  currentStrokeOptions?: any;
523
526
  resetCustomPen?: any;
527
+ gridColor: string;
524
528
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
525
529
  };
526
530
  commitToHistory: true;
@@ -543,7 +547,7 @@ export declare const actionChangeOpacity: {
543
547
  } | null;
544
548
  showWelcomeScreen: boolean;
545
549
  isLoading: boolean;
546
- errorMessage: string | null;
550
+ errorMessage: import("react").ReactNode;
547
551
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
548
552
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
549
553
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -649,6 +653,7 @@ export declare const actionChangeOpacity: {
649
653
  customPens?: any[] | undefined;
650
654
  currentStrokeOptions?: any;
651
655
  resetCustomPen?: any;
656
+ gridColor: string;
652
657
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
653
658
  };
654
659
  commitToHistory: true;
@@ -671,7 +676,7 @@ export declare const actionChangeFontSize: {
671
676
  } | null;
672
677
  showWelcomeScreen: boolean;
673
678
  isLoading: boolean;
674
- errorMessage: string | null;
679
+ errorMessage: import("react").ReactNode;
675
680
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
676
681
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
677
682
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -777,6 +782,7 @@ export declare const actionChangeFontSize: {
777
782
  customPens?: any[] | undefined;
778
783
  currentStrokeOptions?: any;
779
784
  resetCustomPen?: any;
785
+ gridColor: string;
780
786
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
781
787
  };
782
788
  commitToHistory: boolean;
@@ -799,7 +805,7 @@ export declare const actionDecreaseFontSize: {
799
805
  } | null;
800
806
  showWelcomeScreen: boolean;
801
807
  isLoading: boolean;
802
- errorMessage: string | null;
808
+ errorMessage: import("react").ReactNode;
803
809
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
804
810
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
805
811
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -905,6 +911,7 @@ export declare const actionDecreaseFontSize: {
905
911
  customPens?: any[] | undefined;
906
912
  currentStrokeOptions?: any;
907
913
  resetCustomPen?: any;
914
+ gridColor: string;
908
915
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
909
916
  };
910
917
  commitToHistory: boolean;
@@ -927,7 +934,7 @@ export declare const actionIncreaseFontSize: {
927
934
  } | null;
928
935
  showWelcomeScreen: boolean;
929
936
  isLoading: boolean;
930
- errorMessage: string | null;
937
+ errorMessage: import("react").ReactNode;
931
938
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
932
939
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
933
940
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -1033,6 +1040,7 @@ export declare const actionIncreaseFontSize: {
1033
1040
  customPens?: any[] | undefined;
1034
1041
  currentStrokeOptions?: any;
1035
1042
  resetCustomPen?: any;
1043
+ gridColor: string;
1036
1044
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1037
1045
  };
1038
1046
  commitToHistory: boolean;
@@ -1055,7 +1063,7 @@ export declare const actionChangeFontFamily: {
1055
1063
  } | null;
1056
1064
  showWelcomeScreen: boolean;
1057
1065
  isLoading: boolean;
1058
- errorMessage: string | null;
1066
+ errorMessage: import("react").ReactNode;
1059
1067
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1060
1068
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1061
1069
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -1161,6 +1169,7 @@ export declare const actionChangeFontFamily: {
1161
1169
  customPens?: any[] | undefined;
1162
1170
  currentStrokeOptions?: any;
1163
1171
  resetCustomPen?: any;
1172
+ gridColor: string;
1164
1173
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1165
1174
  };
1166
1175
  commitToHistory: true;
@@ -1183,7 +1192,7 @@ export declare const actionChangeTextAlign: {
1183
1192
  } | null;
1184
1193
  showWelcomeScreen: boolean;
1185
1194
  isLoading: boolean;
1186
- errorMessage: string | null;
1195
+ errorMessage: import("react").ReactNode;
1187
1196
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1188
1197
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1189
1198
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -1289,6 +1298,7 @@ export declare const actionChangeTextAlign: {
1289
1298
  customPens?: any[] | undefined;
1290
1299
  currentStrokeOptions?: any;
1291
1300
  resetCustomPen?: any;
1301
+ gridColor: string;
1292
1302
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1293
1303
  };
1294
1304
  commitToHistory: true;
@@ -1312,7 +1322,7 @@ export declare const actionChangeVerticalAlign: {
1312
1322
  } | null;
1313
1323
  showWelcomeScreen: boolean;
1314
1324
  isLoading: boolean;
1315
- errorMessage: string | null;
1325
+ errorMessage: import("react").ReactNode;
1316
1326
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1317
1327
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1318
1328
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -1419,6 +1429,7 @@ export declare const actionChangeVerticalAlign: {
1419
1429
  customPens?: any[] | undefined;
1420
1430
  currentStrokeOptions?: any;
1421
1431
  resetCustomPen?: any;
1432
+ gridColor: string;
1422
1433
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1423
1434
  };
1424
1435
  commitToHistory: true;
@@ -1441,7 +1452,7 @@ export declare const actionChangeRoundness: {
1441
1452
  } | null;
1442
1453
  showWelcomeScreen: boolean;
1443
1454
  isLoading: boolean;
1444
- errorMessage: string | null;
1455
+ errorMessage: import("react").ReactNode;
1445
1456
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1446
1457
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1447
1458
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -1547,6 +1558,7 @@ export declare const actionChangeRoundness: {
1547
1558
  customPens?: any[] | undefined;
1548
1559
  currentStrokeOptions?: any;
1549
1560
  resetCustomPen?: any;
1561
+ gridColor: string;
1550
1562
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1551
1563
  };
1552
1564
  commitToHistory: true;
@@ -1571,7 +1583,7 @@ export declare const actionChangeArrowhead: {
1571
1583
  } | null;
1572
1584
  showWelcomeScreen: boolean;
1573
1585
  isLoading: boolean;
1574
- errorMessage: string | null;
1586
+ errorMessage: import("react").ReactNode;
1575
1587
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1576
1588
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1577
1589
  multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
@@ -1678,6 +1690,7 @@ export declare const actionChangeArrowhead: {
1678
1690
  customPens?: any[] | undefined;
1679
1691
  currentStrokeOptions?: any;
1680
1692
  resetCustomPen?: any;
1693
+ gridColor: string;
1681
1694
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1682
1695
  };
1683
1696
  commitToHistory: true;
@@ -17,7 +17,7 @@ export declare const actionCopyStyles: {
17
17
  } | null;
18
18
  showWelcomeScreen: boolean;
19
19
  isLoading: boolean;
20
- errorMessage: string | null;
20
+ errorMessage: import("react").ReactNode;
21
21
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
22
22
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
23
23
  multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
@@ -119,6 +119,7 @@ export declare const actionCopyStyles: {
119
119
  customPens?: any[] | undefined;
120
120
  currentStrokeOptions?: any;
121
121
  resetCustomPen?: any;
122
+ gridColor: string;
122
123
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
123
124
  };
124
125
  commitToHistory: false;
@@ -17,7 +17,7 @@ export declare const actionToggleGridMode: {
17
17
  } | null;
18
18
  showWelcomeScreen: boolean;
19
19
  isLoading: boolean;
20
- errorMessage: string | null;
20
+ errorMessage: import("react").ReactNode;
21
21
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
22
22
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
23
23
  multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
@@ -123,6 +123,7 @@ export declare const actionToggleGridMode: {
123
123
  customPens?: any[] | undefined;
124
124
  currentStrokeOptions?: any;
125
125
  resetCustomPen?: any;
126
+ gridColor: string;
126
127
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
127
128
  };
128
129
  commitToHistory: false;
@@ -16,7 +16,7 @@ export declare const actionToggleLock: {
16
16
  } | null;
17
17
  showWelcomeScreen: boolean;
18
18
  isLoading: boolean;
19
- errorMessage: string | null;
19
+ errorMessage: import("react").ReactNode;
20
20
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
21
21
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
22
22
  multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
@@ -123,6 +123,7 @@ export declare const actionToggleLock: {
123
123
  customPens?: any[] | undefined;
124
124
  currentStrokeOptions?: any;
125
125
  resetCustomPen?: any;
126
+ gridColor: string;
126
127
  };
127
128
  commitToHistory: true;
128
129
  };
@@ -15,7 +15,7 @@ export declare const actionToggleStats: {
15
15
  } | null;
16
16
  showWelcomeScreen: boolean;
17
17
  isLoading: boolean;
18
- errorMessage: string | null;
18
+ errorMessage: import("react").ReactNode;
19
19
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
20
20
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
21
21
  multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
@@ -121,6 +121,7 @@ export declare const actionToggleStats: {
121
121
  customPens?: any[] | undefined;
122
122
  currentStrokeOptions?: any;
123
123
  resetCustomPen?: any;
124
+ gridColor: string;
124
125
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
125
126
  };
126
127
  commitToHistory: false;
@@ -16,7 +16,7 @@ export declare const actionToggleViewMode: {
16
16
  } | null;
17
17
  showWelcomeScreen: boolean;
18
18
  isLoading: boolean;
19
- errorMessage: string | null;
19
+ errorMessage: import("react").ReactNode;
20
20
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
21
21
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
22
22
  multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
@@ -122,6 +122,7 @@ export declare const actionToggleViewMode: {
122
122
  customPens?: any[] | undefined;
123
123
  currentStrokeOptions?: any;
124
124
  resetCustomPen?: any;
125
+ gridColor: string;
125
126
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
126
127
  };
127
128
  commitToHistory: false;
@@ -16,7 +16,7 @@ export declare const actionToggleZenMode: {
16
16
  } | null;
17
17
  showWelcomeScreen: boolean;
18
18
  isLoading: boolean;
19
- errorMessage: string | null;
19
+ errorMessage: import("react").ReactNode;
20
20
  draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
21
21
  resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
22
22
  multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
@@ -122,6 +122,7 @@ export declare const actionToggleZenMode: {
122
122
  customPens?: any[] | undefined;
123
123
  currentStrokeOptions?: any;
124
124
  resetCustomPen?: any;
125
+ gridColor: string;
125
126
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
126
127
  };
127
128
  commitToHistory: false;
@@ -1,3 +1,4 @@
1
+ import { SubtypeOf } from "../utility-types";
1
2
  import { ActionName } from "./types";
2
3
  export declare type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "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"> | "saveScene" | "imageExport";
3
4
  export declare const getShortcutFromShortcutName: (name: ShortcutName) => string;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { ExcalidrawElement } from "../element/types";
3
3
  import { AppClassProperties, AppState, ExcalidrawProps, BinaryFiles } from "../types";
4
+ import { MarkOptional } from "../utility-types";
4
5
  export declare type ActionSource = "ui" | "keyboard" | "contextMenu" | "api";
5
6
  /** if false, the action should be prevented */
6
7
  export declare type ActionResult = {
@@ -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" | "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" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "toggleLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool";
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" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "toggleLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "createContainerFromText";
18
19
  export declare type PanelComponentProps = {
19
20
  elements: readonly ExcalidrawElement[];
20
21
  appState: AppState;
@@ -97,7 +97,18 @@ declare class App extends React.Component<AppProps, AppState> {
97
97
  toggleLock: (source?: "keyboard" | "ui") => void;
98
98
  togglePenMode: () => void;
99
99
  onHandToolToggle: () => void;
100
- scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[]) => void;
100
+ /**
101
+ * Zooms on canvas viewport center
102
+ */
103
+ zoomCanvas: (value: number) => void;
104
+ private cancelInProgresAnimation;
105
+ scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[], opts?: {
106
+ fitToContent?: boolean;
107
+ animate?: boolean;
108
+ duration?: number;
109
+ }) => void;
110
+ /** use when changing scrollX/scrollY/zoom based on user interaction */
111
+ private translateCanvas;
101
112
  zoomToFit: (target?: readonly ExcalidrawElement[], maxZoom?: number, margin?: number) => void;
102
113
  startLineEditor: (el: ExcalidrawLinearElement, selectedPointsIndices?: number[] | null) => void;
103
114
  updateContainerSize: (containers: NonDeletedExcalidrawElement[]) => void;
@@ -0,0 +1,2 @@
1
+ declare const BraveMeasureTextError: () => JSX.Element;
2
+ export default BraveMeasureTextError;
@@ -1,4 +1,5 @@
1
- export declare const ErrorDialog: ({ message, onClose, }: {
2
- message: string;
1
+ import React from "react";
2
+ export declare const ErrorDialog: ({ children, onClose, }: {
3
+ children?: React.ReactNode;
3
4
  onClose?: (() => void) | undefined;
4
5
  }) => JSX.Element;
@@ -1,5 +1,4 @@
1
1
  declare type HelpButtonProps = {
2
- title?: string;
3
2
  name?: string;
4
3
  id?: string;
5
4
  onClick?(): void;
@@ -6,6 +6,7 @@ export declare const isAndroid: boolean;
6
6
  export declare const isFirefox: boolean;
7
7
  export declare const isChrome: boolean;
8
8
  export declare const isSafari: boolean;
9
+ export declare const isBrave: () => boolean;
9
10
  export declare const APP_NAME = "Excalidraw";
10
11
  export declare const DRAGGING_THRESHOLD = 10;
11
12
  export declare const LINE_CONFIRM_THRESHOLD = 8;
@@ -1,6 +1,7 @@
1
1
  import { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
2
2
  import { ExcalidrawElement, FileId } from "../element/types";
3
3
  import { AppState, DataURL, LibraryItem } from "../types";
4
+ import { ValueOf } from "../utility-types";
4
5
  import { FileSystemHandle } from "./filesystem";
5
6
  import { ImportedLibraryData } from "./types";
6
7
  export declare const getMimeType: (blob: Blob | string) => string;
@@ -25,7 +25,7 @@ export declare const actionLink: {
25
25
  } | null;
26
26
  showWelcomeScreen: boolean;
27
27
  isLoading: boolean;
28
- errorMessage: string | null;
28
+ errorMessage: import("react").ReactNode;
29
29
  draggingElement: NonDeletedExcalidrawElement | null;
30
30
  resizingElement: NonDeletedExcalidrawElement | null;
31
31
  multiElement: import("./types").NonDeleted<import("./types").ExcalidrawLinearElement> | null;
@@ -130,6 +130,7 @@ export declare const actionLink: {
130
130
  customPens?: any[] | undefined;
131
131
  currentStrokeOptions?: any;
132
132
  resetCustomPen?: any;
133
+ gridColor: string;
133
134
  selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
134
135
  };
135
136
  commitToHistory: true;
@@ -130,7 +130,7 @@ export declare class LinearElementEditor {
130
130
  } | null;
131
131
  showWelcomeScreen: boolean;
132
132
  isLoading: boolean;
133
- errorMessage: string | null;
133
+ errorMessage: import("react").ReactNode;
134
134
  draggingElement: import("./types").NonDeletedExcalidrawElement | null;
135
135
  resizingElement: import("./types").NonDeletedExcalidrawElement | null;
136
136
  multiElement: NonDeleted<ExcalidrawLinearElement> | null;
@@ -138,7 +138,10 @@ export declare class LinearElementEditor {
138
138
  isBindingEnabled: boolean;
139
139
  startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
140
140
  suggestedBindings: import("./binding").SuggestedBinding[];
141
- editingElement: import("./types").NonDeletedExcalidrawElement | null;
141
+ editingElement: import("./types").NonDeletedExcalidrawElement | null; /**
142
+ * @param id the `elementId` from the instance of this class (so that we can
143
+ * statically guarantee this method returns an ExcalidrawLinearElement)
144
+ */
142
145
  activeTool: {
143
146
  lastActiveTool: import("../types").LastActiveTool;
144
147
  locked: boolean;
@@ -191,7 +194,6 @@ export declare class LinearElementEditor {
191
194
  previousSelectedElementIds: {
192
195
  [id: string]: boolean;
193
196
  };
194
- /** @returns whether point was dragged */
195
197
  shouldCacheIgnoreZoom: boolean;
196
198
  toast: {
197
199
  message: string;
@@ -237,6 +239,7 @@ export declare class LinearElementEditor {
237
239
  customPens?: any[] | undefined;
238
240
  currentStrokeOptions?: any;
239
241
  resetCustomPen?: any;
242
+ gridColor: string;
240
243
  selectedLinearElement: LinearElementEditor | null;
241
244
  };
242
245
  };
@@ -1,4 +1,5 @@
1
1
  import { ExcalidrawElement } from "./types";
2
+ import { Mutable } from "../utility-types";
2
3
  declare type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce">;
3
4
  export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
4
5
  export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>) => TElement;
@@ -1,5 +1,6 @@
1
1
  import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer } from "../element/types";
2
2
  import { AppState } from "../types";
3
+ import { MarkOptional, Mutable } from "../utility-types";
3
4
  declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElements" | "seed" | "version" | "versionNonce" | "link">;
4
5
  export declare const newElement: (opts: {
5
6
  type: ExcalidrawGenericElement["type"];
@@ -12,6 +13,7 @@ export declare const newTextElement: (opts: {
12
13
  textAlign: TextAlign;
13
14
  verticalAlign: VerticalAlign;
14
15
  containerId?: ExcalidrawTextContainer["id"];
16
+ lineHeight?: ExcalidrawTextElement["lineHeight"];
15
17
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
16
18
  export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, text?: string) => {
17
19
  x: number;
@@ -1,24 +1,37 @@
1
- import { ExcalidrawElement, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontString, NonDeletedExcalidrawElement } from "./types";
1
+ import { ExcalidrawElement, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./types";
2
2
  import { MaybeTransformHandleType } from "./transformHandles";
3
3
  import { AppState } from "../types";
4
+ import { ExtractSetType } from "../utility-types";
4
5
  export declare const normalizeText: (text: string) => string;
6
+ export declare const splitIntoLines: (text: string) => string[];
5
7
  export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
6
8
  export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
7
9
  export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType) => void;
8
- export declare const measureText: (text: string, font: FontString) => {
10
+ export declare const measureText: (text: string, font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => {
9
11
  width: number;
10
12
  height: number;
11
13
  };
12
- export declare const getApproxLineHeight: (font: FontString) => number;
14
+ /**
15
+ * To get unitless line-height (if unknown) we can calculate it by dividing
16
+ * height-per-line by fontSize.
17
+ */
18
+ export declare const detectLineHeight: (textElement: ExcalidrawTextElement) => number & {
19
+ _brand: "unitlessLineHeight";
20
+ };
21
+ /**
22
+ * We calculate the line height from the font size and the unitless line height,
23
+ * aligning with the W3C spec.
24
+ */
25
+ export declare const getLineHeightInPx: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
26
+ export declare const getApproxMinLineHeight: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
13
27
  export declare const getTextWidth: (text: string, font: FontString) => number;
14
- export declare const getTextHeight: (text: string, font: FontString) => number;
28
+ export declare const getTextHeight: (text: string, fontSize: number, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
15
29
  export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
16
30
  export declare const charWidth: {
17
31
  calculate: (char: string, font: FontString) => number;
18
32
  getCache: (font: FontString) => number[];
19
33
  };
20
- export declare const getApproxMinLineWidth: (font: FontString) => number;
21
- export declare const getApproxMinLineHeight: (font: FontString) => number;
34
+ export declare const getApproxMinLineWidth: (font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
22
35
  export declare const getMinCharWidth: (font: FontString) => number;
23
36
  export declare const getMaxCharWidth: (font: FontString) => number;
24
37
  export declare const getApproxCharsToFitInWidth: (font: FontString, width: number) => number;
@@ -46,8 +59,15 @@ export declare const getBoundTextElementPosition: (container: ExcalidrawElement,
46
59
  y: number;
47
60
  } | undefined;
48
61
  export declare const shouldAllowVerticalAlign: (selectedElements: NonDeletedExcalidrawElement[]) => boolean;
62
+ export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExcalidrawElement[]) => boolean;
49
63
  export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number) => ExcalidrawTextContainer | null;
64
+ declare const VALID_CONTAINER_TYPES: Set<string>;
50
65
  export declare const isValidTextContainer: (element: ExcalidrawElement) => boolean;
51
- export declare const computeContainerHeightForBoundText: (container: NonDeletedExcalidrawElement, boundTextElementHeight: number) => number;
66
+ export declare const computeContainerDimensionForBoundText: (dimension: number, containerType: ExtractSetType<typeof VALID_CONTAINER_TYPES>, legacy?: boolean) => number;
52
67
  export declare const getMaxContainerWidth: (container: ExcalidrawElement) => number;
53
68
  export declare const getMaxContainerHeight: (container: ExcalidrawElement) => number;
69
+ export declare const isMeasureTextSupported: () => boolean;
70
+ export declare const getDefaultLineHeight: (fontFamily: FontFamilyValues) => number & {
71
+ _brand: "unitlessLineHeight";
72
+ };
73
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { AppState } from "../types";
2
+ import { MarkNonNullable } from "../utility-types";
2
3
  import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, RoundnessType } from "./types";
3
4
  export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
4
5
  export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
@@ -1,5 +1,6 @@
1
1
  import { Point } from "../types";
2
2
  import { FONT_FAMILY, ROUNDNESS, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
3
+ import { MarkNonNullable, ValueOf } from "../utility-types";
3
4
  export declare type ChartType = "bar" | "line";
4
5
  export declare type FillStyle = "hachure" | "cross-hatch" | "solid";
5
6
  export declare type FontFamilyKeys = keyof typeof FONT_FAMILY;
@@ -104,6 +105,13 @@ export declare type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
104
105
  verticalAlign: VerticalAlign;
105
106
  containerId: ExcalidrawGenericElement["id"] | null;
106
107
  originalText: string;
108
+ /**
109
+ * Unitless line height (aligned to W3C). To get line height in px, multiply
110
+ * with font size (using `getLineHeightInPx` helper).
111
+ */
112
+ lineHeight: number & {
113
+ _brand: "unitlessLineHeight";
114
+ };
107
115
  }>;
108
116
  export declare type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement;
109
117
  export declare type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawImageElement | ExcalidrawArrowElement;