@excalidraw/common 0.18.0-b7aac689a → 0.18.0-b9d27d3

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 (53) hide show
  1. package/dist/dev/index.js +15 -3
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +3 -3
  4. package/dist/types/common/src/constants.d.ts +13 -3
  5. package/dist/types/element/src/Scene.d.ts +6 -2
  6. package/dist/types/element/src/align.d.ts +2 -1
  7. package/dist/types/element/src/bounds.d.ts +1 -1
  8. package/dist/types/element/src/delta.d.ts +16 -4
  9. package/dist/types/element/src/distribute.d.ts +2 -1
  10. package/dist/types/element/src/groups.d.ts +1 -0
  11. package/dist/types/element/src/index.d.ts +1 -0
  12. package/dist/types/element/src/linearElementEditor.d.ts +2 -1
  13. package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
  14. package/dist/types/element/src/store.d.ts +6 -1
  15. package/dist/types/element/src/textElement.d.ts +1 -1
  16. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +0 -3
  17. package/dist/types/excalidraw/actions/actionBoundText.d.ts +0 -2
  18. package/dist/types/excalidraw/actions/actionCanvas.d.ts +15 -14
  19. package/dist/types/excalidraw/actions/actionClipboard.d.ts +3 -8
  20. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +0 -1
  21. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -6
  22. package/dist/types/excalidraw/actions/actionElementLink.d.ts +0 -1
  23. package/dist/types/excalidraw/actions/actionElementLock.d.ts +0 -2
  24. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -1
  25. package/dist/types/excalidraw/actions/actionExport.d.ts +0 -9
  26. package/dist/types/excalidraw/actions/actionFinalize.d.ts +2 -3
  27. package/dist/types/excalidraw/actions/actionFrame.d.ts +0 -4
  28. package/dist/types/excalidraw/actions/actionGroup.d.ts +0 -2
  29. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +33 -3
  30. package/dist/types/excalidraw/actions/actionLink.d.ts +0 -1
  31. package/dist/types/excalidraw/actions/actionMenu.d.ts +0 -3
  32. package/dist/types/excalidraw/actions/actionNavigate.d.ts +0 -2
  33. package/dist/types/excalidraw/actions/actionProperties.d.ts +0 -15
  34. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +0 -1
  35. package/dist/types/excalidraw/actions/actionStyles.d.ts +0 -1
  36. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +0 -1
  37. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +0 -1
  38. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +0 -1
  39. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +0 -1
  40. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +0 -1
  41. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +0 -1
  42. package/dist/types/excalidraw/clipboard.d.ts +62 -1
  43. package/dist/types/excalidraw/components/Actions.d.ts +0 -4
  44. package/dist/types/excalidraw/components/App.d.ts +11 -8
  45. package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
  46. package/dist/types/excalidraw/components/shapes.d.ts +129 -1
  47. package/dist/types/excalidraw/data/blob.d.ts +1 -5
  48. package/dist/types/excalidraw/data/reconcile.d.ts +1 -0
  49. package/dist/types/excalidraw/data/restore.d.ts +6 -1
  50. package/dist/types/excalidraw/index.d.ts +2 -1
  51. package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
  52. package/dist/types/excalidraw/types.d.ts +7 -4
  53. package/package.json +1 -1
@@ -39,7 +39,6 @@ export declare const actionGoToCollaborator: {
39
39
  editingFrame: string | null;
40
40
  elementsToHighlight: import("../../element/src/types").NonDeleted<import("../../element/src/types").ExcalidrawElement>[] | null;
41
41
  editingTextElement: import("../../element/src/types").NonDeletedExcalidrawElement | null;
42
- editingLinearElement: import("@excalidraw/element").LinearElementEditor | null;
43
42
  activeTool: {
44
43
  lastActiveTool: import("../types").ActiveTool | null;
45
44
  locked: boolean;
@@ -216,7 +215,6 @@ export declare const actionGoToCollaborator: {
216
215
  editingFrame: string | null;
217
216
  elementsToHighlight: import("../../element/src/types").NonDeleted<import("../../element/src/types").ExcalidrawElement>[] | null;
218
217
  editingTextElement: import("../../element/src/types").NonDeletedExcalidrawElement | null;
219
- editingLinearElement: import("@excalidraw/element").LinearElementEditor | null;
220
218
  activeTool: {
221
219
  lastActiveTool: import("../types").ActiveTool | null;
222
220
  locked: boolean;
@@ -67,7 +67,6 @@ export declare const actionChangeFillStyle: {
67
67
  editingFrame: string | null;
68
68
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
69
69
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
70
- editingLinearElement: LinearElementEditor | null;
71
70
  activeTool: {
72
71
  lastActiveTool: import("../types").ActiveTool | null;
73
72
  locked: boolean;
@@ -250,7 +249,6 @@ export declare const actionChangeStrokeWidth: {
250
249
  editingFrame: string | null;
251
250
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
252
251
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
253
- editingLinearElement: LinearElementEditor | null;
254
252
  activeTool: {
255
253
  lastActiveTool: import("../types").ActiveTool | null;
256
254
  locked: boolean;
@@ -433,7 +431,6 @@ export declare const actionChangeSloppiness: {
433
431
  editingFrame: string | null;
434
432
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
435
433
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
436
- editingLinearElement: LinearElementEditor | null;
437
434
  activeTool: {
438
435
  lastActiveTool: import("../types").ActiveTool | null;
439
436
  locked: boolean;
@@ -616,7 +613,6 @@ export declare const actionChangeStrokeStyle: {
616
613
  editingFrame: string | null;
617
614
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
618
615
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
619
- editingLinearElement: LinearElementEditor | null;
620
616
  activeTool: {
621
617
  lastActiveTool: import("../types").ActiveTool | null;
622
618
  locked: boolean;
@@ -799,7 +795,6 @@ export declare const actionChangeOpacity: {
799
795
  editingFrame: string | null;
800
796
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
801
797
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
802
- editingLinearElement: LinearElementEditor | null;
803
798
  activeTool: {
804
799
  lastActiveTool: import("../types").ActiveTool | null;
805
800
  locked: boolean;
@@ -982,7 +977,6 @@ export declare const actionChangeFontSize: {
982
977
  editingFrame: string | null;
983
978
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
984
979
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
985
- editingLinearElement: LinearElementEditor | null;
986
980
  activeTool: {
987
981
  lastActiveTool: import("../types").ActiveTool | null;
988
982
  locked: boolean;
@@ -1166,7 +1160,6 @@ export declare const actionDecreaseFontSize: {
1166
1160
  editingFrame: string | null;
1167
1161
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
1168
1162
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
1169
- editingLinearElement: LinearElementEditor | null;
1170
1163
  activeTool: {
1171
1164
  lastActiveTool: import("../types").ActiveTool | null;
1172
1165
  locked: boolean;
@@ -1350,7 +1343,6 @@ export declare const actionIncreaseFontSize: {
1350
1343
  editingFrame: string | null;
1351
1344
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
1352
1345
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
1353
- editingLinearElement: LinearElementEditor | null;
1354
1346
  activeTool: {
1355
1347
  lastActiveTool: import("../types").ActiveTool | null;
1356
1348
  locked: boolean;
@@ -1534,7 +1526,6 @@ export declare const actionChangeFontFamily: {
1534
1526
  editingFrame: string | null;
1535
1527
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
1536
1528
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
1537
- editingLinearElement: LinearElementEditor | null;
1538
1529
  activeTool: {
1539
1530
  lastActiveTool: import("../types").ActiveTool | null;
1540
1531
  locked: boolean;
@@ -1708,7 +1699,6 @@ export declare const actionChangeFontFamily: {
1708
1699
  editingFrame: string | null;
1709
1700
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
1710
1701
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
1711
- editingLinearElement: LinearElementEditor | null;
1712
1702
  activeTool: {
1713
1703
  lastActiveTool: import("../types").ActiveTool | null;
1714
1704
  locked: boolean;
@@ -1889,7 +1879,6 @@ export declare const actionChangeTextAlign: {
1889
1879
  editingFrame: string | null;
1890
1880
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
1891
1881
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
1892
- editingLinearElement: LinearElementEditor | null;
1893
1882
  activeTool: {
1894
1883
  lastActiveTool: import("../types").ActiveTool | null;
1895
1884
  locked: boolean;
@@ -2073,7 +2062,6 @@ export declare const actionChangeVerticalAlign: {
2073
2062
  editingFrame: string | null;
2074
2063
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
2075
2064
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
2076
- editingLinearElement: LinearElementEditor | null;
2077
2065
  activeTool: {
2078
2066
  lastActiveTool: import("../types").ActiveTool | null;
2079
2067
  locked: boolean;
@@ -2257,7 +2245,6 @@ export declare const actionChangeRoundness: {
2257
2245
  editingFrame: string | null;
2258
2246
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
2259
2247
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
2260
- editingLinearElement: LinearElementEditor | null;
2261
2248
  activeTool: {
2262
2249
  lastActiveTool: import("../types").ActiveTool | null;
2263
2250
  locked: boolean;
@@ -2442,7 +2429,6 @@ export declare const actionChangeArrowhead: {
2442
2429
  editingFrame: string | null;
2443
2430
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
2444
2431
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
2445
- editingLinearElement: LinearElementEditor | null;
2446
2432
  activeTool: {
2447
2433
  lastActiveTool: import("../types").ActiveTool | null;
2448
2434
  locked: boolean;
@@ -2626,7 +2612,6 @@ export declare const actionChangeArrowType: {
2626
2612
  editingFrame: string | null;
2627
2613
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
2628
2614
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
2629
- editingLinearElement: LinearElementEditor | null;
2630
2615
  activeTool: {
2631
2616
  lastActiveTool: import("../types").ActiveTool | null;
2632
2617
  locked: boolean;
@@ -48,7 +48,6 @@ export declare const actionSelectAll: {
48
48
  editingFrame: string | null;
49
49
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
50
50
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
51
- editingLinearElement: LinearElementEditor | null;
52
51
  activeTool: {
53
52
  lastActiveTool: import("../types").ActiveTool | null;
54
53
  locked: boolean;
@@ -41,7 +41,6 @@ export declare const actionCopyStyles: {
41
41
  editingFrame: string | null;
42
42
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawElement>[] | null;
43
43
  editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
44
- editingLinearElement: import("@excalidraw/element").LinearElementEditor | null;
45
44
  activeTool: {
46
45
  lastActiveTool: import("../types").ActiveTool | null;
47
46
  locked: boolean;
@@ -43,7 +43,6 @@ export declare const actionToggleGridMode: {
43
43
  editingFrame: string | null;
44
44
  elementsToHighlight: import("../../element/src/types").NonDeleted<import("../../element/src/types").ExcalidrawElement>[] | null;
45
45
  editingTextElement: import("../../element/src/types").NonDeletedExcalidrawElement | null;
46
- editingLinearElement: import("@excalidraw/element").LinearElementEditor | null;
47
46
  activeTool: {
48
47
  lastActiveTool: import("../types").ActiveTool | null;
49
48
  locked: boolean;
@@ -41,7 +41,6 @@ export declare const actionToggleObjectsSnapMode: {
41
41
  editingFrame: string | null;
42
42
  elementsToHighlight: import("../../element/src/types").NonDeleted<import("../../element/src/types").ExcalidrawElement>[] | null;
43
43
  editingTextElement: import("../../element/src/types").NonDeletedExcalidrawElement | null;
44
- editingLinearElement: import("@excalidraw/element").LinearElementEditor | null;
45
44
  activeTool: {
46
45
  lastActiveTool: import("../types").ActiveTool | null;
47
46
  locked: boolean;
@@ -47,7 +47,6 @@ export declare const actionToggleSearchMenu: {
47
47
  editingFrame: string | null;
48
48
  elementsToHighlight: import("../../element/src/types").NonDeleted<import("../../element/src/types").ExcalidrawElement>[] | null;
49
49
  editingTextElement: import("../../element/src/types").NonDeletedExcalidrawElement | null;
50
- editingLinearElement: import("@excalidraw/element").LinearElementEditor | null;
51
50
  activeTool: {
52
51
  lastActiveTool: import("../types").ActiveTool | null;
53
52
  locked: boolean;
@@ -43,7 +43,6 @@ export declare const actionToggleStats: {
43
43
  editingFrame: string | null;
44
44
  elementsToHighlight: import("../../element/src/types").NonDeleted<import("../../element/src/types").ExcalidrawElement>[] | null;
45
45
  editingTextElement: import("../../element/src/types").NonDeletedExcalidrawElement | null;
46
- editingLinearElement: import("@excalidraw/element").LinearElementEditor | null;
47
46
  activeTool: {
48
47
  lastActiveTool: import("../types").ActiveTool | null;
49
48
  locked: boolean;
@@ -40,7 +40,6 @@ export declare const actionToggleViewMode: {
40
40
  editingFrame: string | null;
41
41
  elementsToHighlight: import("../../element/src/types").NonDeleted<import("../../element/src/types").ExcalidrawElement>[] | null;
42
42
  editingTextElement: import("../../element/src/types").NonDeletedExcalidrawElement | null;
43
- editingLinearElement: import("@excalidraw/element").LinearElementEditor | null;
44
43
  activeTool: {
45
44
  lastActiveTool: import("../types").ActiveTool | null;
46
45
  locked: boolean;
@@ -40,7 +40,6 @@ export declare const actionToggleZenMode: {
40
40
  editingFrame: string | null;
41
41
  elementsToHighlight: import("../../element/src/types").NonDeleted<import("../../element/src/types").ExcalidrawElement>[] | null;
42
42
  editingTextElement: import("../../element/src/types").NonDeletedExcalidrawElement | null;
43
- editingLinearElement: import("@excalidraw/element").LinearElementEditor | null;
44
43
  activeTool: {
45
44
  lastActiveTool: import("../types").ActiveTool | null;
46
45
  locked: boolean;
@@ -1,5 +1,8 @@
1
1
  import { ALLOWED_PASTE_MIME_TYPES } from "@excalidraw/common";
2
+ import type { ValueOf } from "@excalidraw/common/utility-types";
3
+ import type { IMAGE_MIME_TYPES, STRING_MIME_TYPES } from "@excalidraw/common";
2
4
  import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
5
+ import type { FileSystemHandle } from "./data/filesystem";
3
6
  import type { Spreadsheet } from "./charts";
4
7
  import type { BinaryFiles } from "./types";
5
8
  export type PastedMixedContent = {
@@ -57,10 +60,68 @@ export declare const readSystemClipboard: () => Promise<{
57
60
  "image/avif"?: string | File | undefined;
58
61
  "image/jfif"?: string | File | undefined;
59
62
  }>;
63
+ type AllowedParsedDataTransferItem = {
64
+ type: ValueOf<typeof IMAGE_MIME_TYPES>;
65
+ kind: "file";
66
+ file: File;
67
+ fileHandle: FileSystemHandle | null;
68
+ } | {
69
+ type: ValueOf<typeof STRING_MIME_TYPES>;
70
+ kind: "string";
71
+ value: string;
72
+ };
73
+ type ParsedDataTransferItem = {
74
+ type: string;
75
+ kind: "file";
76
+ file: File;
77
+ fileHandle: FileSystemHandle | null;
78
+ } | {
79
+ type: string;
80
+ kind: "string";
81
+ value: string;
82
+ };
83
+ type ParsedDataTransferItemType<T extends AllowedParsedDataTransferItem["type"]> = AllowedParsedDataTransferItem & {
84
+ type: T;
85
+ };
86
+ export type ParsedDataTransferFile = Extract<AllowedParsedDataTransferItem, {
87
+ kind: "file";
88
+ }>;
89
+ type ParsedDataTranferList = ParsedDataTransferItem[] & {
90
+ /**
91
+ * Only allows filtering by known `string` data types, since `file`
92
+ * types can have multiple items of the same type (e.g. multiple image files)
93
+ * unlike `string` data transfer items.
94
+ */
95
+ findByType: typeof findDataTransferItemType;
96
+ /**
97
+ * Only allows filtering by known `string` data types, since `file`
98
+ * types can have multiple items of the same type (e.g. multiple image files)
99
+ * unlike `string` data transfer items.
100
+ */
101
+ getData: typeof getDataTransferItemData;
102
+ getFiles: typeof getDataTransferFiles;
103
+ };
104
+ declare const findDataTransferItemType: <T extends ValueOf<{
105
+ readonly text: "text/plain";
106
+ readonly html: "text/html";
107
+ readonly json: "application/json";
108
+ readonly excalidraw: "application/vnd.excalidraw+json";
109
+ readonly excalidrawlib: "application/vnd.excalidrawlib+json";
110
+ }>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<T> | null;
111
+ declare const getDataTransferItemData: <T extends ValueOf<{
112
+ readonly text: "text/plain";
113
+ readonly html: "text/html";
114
+ readonly json: "application/json";
115
+ readonly excalidraw: "application/vnd.excalidraw+json";
116
+ readonly excalidrawlib: "application/vnd.excalidrawlib+json";
117
+ }>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<ValueOf<typeof STRING_MIME_TYPES>>["value"] | null;
118
+ declare const getDataTransferFiles: (this: ParsedDataTranferList) => ParsedDataTransferFile[];
119
+ export declare const parseDataTransferEvent: (event: ClipboardEvent | DragEvent | React.DragEvent<HTMLDivElement>) => Promise<ParsedDataTranferList>;
60
120
  /**
61
121
  * Attempts to parse clipboard event.
62
122
  */
63
- export declare const parseClipboard: (event: ClipboardEvent, isPlainPaste?: boolean) => Promise<ClipboardData>;
123
+ export declare const parseClipboard: (dataList: ParsedDataTranferList, isPlainPaste?: boolean) => Promise<ClipboardData>;
64
124
  export declare const copyBlobToClipboardAsPng: (blob: Blob | Promise<Blob>) => Promise<void>;
65
125
  export declare const copyTextToSystemClipboard: (text: string | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
126
+ export declare const isClipboardEvent: (event: React.SyntheticEvent | Event) => event is ClipboardEvent;
66
127
  export {};
@@ -28,7 +28,3 @@ export declare const ExitZenModeAction: ({ actionManager, showExitZenModeBtn, }:
28
28
  actionManager: ActionManager;
29
29
  showExitZenModeBtn: boolean;
30
30
  }) => import("react/jsx-runtime").JSX.Element;
31
- export declare const FinalizeAction: ({ renderAction, className, }: {
32
- renderAction: ActionManager["renderAction"];
33
- className?: string | undefined;
34
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
3
- import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate } from "@excalidraw/element";
4
- import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "@excalidraw/element/types";
3
+ import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
4
+ import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
5
5
  import type { Mutable } from "@excalidraw/common/utility-types";
6
6
  import { ActionManager } from "../actions/manager";
7
7
  import { AnimationFrameHandler } from "../animation-frame-handler";
@@ -153,6 +153,7 @@ declare class App extends React.Component<AppProps, AppState> {
153
153
  x: number;
154
154
  y: number;
155
155
  };
156
+ blockDragging: boolean;
156
157
  };
157
158
  eventListeners: {
158
159
  onMove: {
@@ -222,6 +223,7 @@ declare class App extends React.Component<AppProps, AppState> {
222
223
  x: number;
223
224
  y: number;
224
225
  };
226
+ blockDragging: boolean;
225
227
  };
226
228
  eventListeners: {
227
229
  onMove: {
@@ -243,6 +245,7 @@ declare class App extends React.Component<AppProps, AppState> {
243
245
  }>]>;
244
246
  missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
245
247
  onRemoveEventListenersEmitter: Emitter<[]>;
248
+ defaultSelectionTool: "selection" | "lasso";
246
249
  constructor(props: AppProps);
247
250
  updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
248
251
  private onWindowMessage;
@@ -297,6 +300,7 @@ declare class App extends React.Component<AppProps, AppState> {
297
300
  */
298
301
  private resetScene;
299
302
  private initializeScene;
303
+ private isMobileOrTablet;
300
304
  private isMobileBreakpoint;
301
305
  private refreshViewportBreakpoints;
302
306
  private refreshEditorBreakpoints;
@@ -316,6 +320,7 @@ declare class App extends React.Component<AppProps, AppState> {
316
320
  private static resetTapTwice;
317
321
  private onTouchStart;
318
322
  private onTouchEnd;
323
+ private insertClipboardContent;
319
324
  pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
320
325
  addElementsFromPasteOrLibrary: (opts: {
321
326
  elements: readonly ExcalidrawElement[];
@@ -397,6 +402,7 @@ declare class App extends React.Component<AppProps, AppState> {
397
402
  */
398
403
  captureUpdate?: SceneData["captureUpdate"];
399
404
  }) => void;
405
+ applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
400
406
  mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
401
407
  private triggerRender;
402
408
  /**
@@ -488,7 +494,7 @@ declare class App extends React.Component<AppProps, AppState> {
488
494
  sceneY: number;
489
495
  link: string;
490
496
  }) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
491
- private createImageElement;
497
+ private newImagePlaceholder;
492
498
  private handleLinearElementOnPointerDown;
493
499
  private getCurrentItemRoundness;
494
500
  private createGenericElementOnPointerDown;
@@ -509,11 +515,7 @@ declare class App extends React.Component<AppProps, AppState> {
509
515
  * and when you don't want to loose those modifications
510
516
  */
511
517
  private getLatestInitializedImageElement;
512
- /**
513
- * inserts image into elements array and rerenders
514
- */
515
- private insertImageElement;
516
- private onImageAction;
518
+ private onImageToolbarButtonClick;
517
519
  private getImageNaturalDimensions;
518
520
  /** updates image cache, refreshing updated elements and/or setting status
519
521
  to error for images that fail during <img> element creation */
@@ -527,6 +529,7 @@ declare class App extends React.Component<AppProps, AppState> {
527
529
  private maybeSuggestBindingAtCursor;
528
530
  private clearSelection;
529
531
  private handleInteractiveCanvasRef;
532
+ private insertImages;
530
533
  private handleAppOnDrop;
531
534
  loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
532
535
  private handleCanvasContextMenu;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const Ellipsify: ({ children, ...rest }: {
3
+ children: React.ReactNode;
4
+ } & import("react").HTMLAttributes<HTMLSpanElement>) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
+ import type { AppClassProperties } from "../types";
1
2
  export declare const SHAPES: readonly [{
2
3
  readonly icon: import("react/jsx-runtime").JSX.Element;
3
4
  readonly value: "selection";
@@ -59,4 +60,131 @@ export declare const SHAPES: readonly [{
59
60
  readonly numericKey: "0";
60
61
  readonly fillable: false;
61
62
  }];
62
- export declare const findShapeByKey: (key: string) => "text" | "line" | "ellipse" | "rectangle" | "diamond" | "image" | "selection" | "arrow" | "freedraw" | "eraser" | null;
63
+ export declare const getToolbarTools: (app: AppClassProperties) => readonly [{
64
+ readonly icon: import("react/jsx-runtime").JSX.Element;
65
+ readonly value: "selection";
66
+ readonly key: "v";
67
+ readonly numericKey: "1";
68
+ readonly fillable: true;
69
+ }, {
70
+ readonly icon: import("react/jsx-runtime").JSX.Element;
71
+ readonly value: "rectangle";
72
+ readonly key: "r";
73
+ readonly numericKey: "2";
74
+ readonly fillable: true;
75
+ }, {
76
+ readonly icon: import("react/jsx-runtime").JSX.Element;
77
+ readonly value: "diamond";
78
+ readonly key: "d";
79
+ readonly numericKey: "3";
80
+ readonly fillable: true;
81
+ }, {
82
+ readonly icon: import("react/jsx-runtime").JSX.Element;
83
+ readonly value: "ellipse";
84
+ readonly key: "o";
85
+ readonly numericKey: "4";
86
+ readonly fillable: true;
87
+ }, {
88
+ readonly icon: import("react/jsx-runtime").JSX.Element;
89
+ readonly value: "arrow";
90
+ readonly key: "a";
91
+ readonly numericKey: "5";
92
+ readonly fillable: true;
93
+ }, {
94
+ readonly icon: import("react/jsx-runtime").JSX.Element;
95
+ readonly value: "line";
96
+ readonly key: "l";
97
+ readonly numericKey: "6";
98
+ readonly fillable: true;
99
+ }, {
100
+ readonly icon: import("react/jsx-runtime").JSX.Element;
101
+ readonly value: "freedraw";
102
+ readonly key: readonly ["p", "x"];
103
+ readonly numericKey: "7";
104
+ readonly fillable: false;
105
+ }, {
106
+ readonly icon: import("react/jsx-runtime").JSX.Element;
107
+ readonly value: "text";
108
+ readonly key: "t";
109
+ readonly numericKey: "8";
110
+ readonly fillable: false;
111
+ }, {
112
+ readonly icon: import("react/jsx-runtime").JSX.Element;
113
+ readonly value: "image";
114
+ readonly key: null;
115
+ readonly numericKey: "9";
116
+ readonly fillable: false;
117
+ }, {
118
+ readonly icon: import("react/jsx-runtime").JSX.Element;
119
+ readonly value: "eraser";
120
+ readonly key: "e";
121
+ readonly numericKey: "0";
122
+ readonly fillable: false;
123
+ }] | readonly [{
124
+ readonly value: "lasso";
125
+ readonly icon: import("react/jsx-runtime").JSX.Element;
126
+ readonly key: "v";
127
+ readonly numericKey: "1";
128
+ readonly fillable: true;
129
+ }, ...({
130
+ readonly icon: import("react/jsx-runtime").JSX.Element;
131
+ readonly value: "selection";
132
+ readonly key: "v";
133
+ readonly numericKey: "1";
134
+ readonly fillable: true;
135
+ } | {
136
+ readonly icon: import("react/jsx-runtime").JSX.Element;
137
+ readonly value: "rectangle";
138
+ readonly key: "r";
139
+ readonly numericKey: "2";
140
+ readonly fillable: true;
141
+ } | {
142
+ readonly icon: import("react/jsx-runtime").JSX.Element;
143
+ readonly value: "diamond";
144
+ readonly key: "d";
145
+ readonly numericKey: "3";
146
+ readonly fillable: true;
147
+ } | {
148
+ readonly icon: import("react/jsx-runtime").JSX.Element;
149
+ readonly value: "ellipse";
150
+ readonly key: "o";
151
+ readonly numericKey: "4";
152
+ readonly fillable: true;
153
+ } | {
154
+ readonly icon: import("react/jsx-runtime").JSX.Element;
155
+ readonly value: "arrow";
156
+ readonly key: "a";
157
+ readonly numericKey: "5";
158
+ readonly fillable: true;
159
+ } | {
160
+ readonly icon: import("react/jsx-runtime").JSX.Element;
161
+ readonly value: "line";
162
+ readonly key: "l";
163
+ readonly numericKey: "6";
164
+ readonly fillable: true;
165
+ } | {
166
+ readonly icon: import("react/jsx-runtime").JSX.Element;
167
+ readonly value: "freedraw";
168
+ readonly key: readonly ["p", "x"];
169
+ readonly numericKey: "7";
170
+ readonly fillable: false;
171
+ } | {
172
+ readonly icon: import("react/jsx-runtime").JSX.Element;
173
+ readonly value: "text";
174
+ readonly key: "t";
175
+ readonly numericKey: "8";
176
+ readonly fillable: false;
177
+ } | {
178
+ readonly icon: import("react/jsx-runtime").JSX.Element;
179
+ readonly value: "image";
180
+ readonly key: null;
181
+ readonly numericKey: "9";
182
+ readonly fillable: false;
183
+ } | {
184
+ readonly icon: import("react/jsx-runtime").JSX.Element;
185
+ readonly value: "eraser";
186
+ readonly key: "e";
187
+ readonly numericKey: "0";
188
+ readonly fillable: false;
189
+ })[]];
190
+ export declare const findShapeByKey: (key: string, app: AppClassProperties) => "text" | "line" | "ellipse" | "rectangle" | "diamond" | "image" | "selection" | "arrow" | "freedraw" | "lasso" | "eraser" | null;
@@ -40,11 +40,7 @@ export declare const SVGStringToFile: (SVGString: string, filename?: string) =>
40
40
  type: typeof MIME_TYPES.svg;
41
41
  };
42
42
  export declare const ImageURLToFile: (imageUrl: string, filename?: string) => Promise<File | undefined>;
43
- export declare const getFileFromEvent: (event: React.DragEvent<HTMLDivElement>) => Promise<{
44
- file: File | null;
45
- fileHandle: FileSystemHandle | null;
46
- }>;
47
- export declare const getFileHandle: (event: React.DragEvent<HTMLDivElement>) => Promise<FileSystemHandle | null>;
43
+ export declare const getFileHandle: (event: DragEvent | React.DragEvent | DataTransferItem) => Promise<FileSystemHandle | null>;
48
44
  export declare const createFile: (blob: File | Blob | ArrayBuffer, mimeType: ValueOf<typeof MIME_TYPES>, name: string | undefined) => File;
49
45
  /** attempts to detect correct mimeType if none is set, or if an image
50
46
  * has an incorrect extension.
@@ -3,4 +3,5 @@ import type { MakeBrand } from "@excalidraw/common/utility-types";
3
3
  import type { AppState } from "../types";
4
4
  export type ReconciledExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"ReconciledElement">;
5
5
  export type RemoteExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"RemoteExcalidrawElement">;
6
+ export declare const shouldDiscardRemoteElement: (localAppState: AppState, local: OrderedExcalidrawElement | undefined, remote: RemoteExcalidrawElement) => boolean;
6
7
  export declare const reconcileElements: (localElements: readonly OrderedExcalidrawElement[], remoteElements: readonly RemoteExcalidrawElement[], localAppState: AppState) => ReconciledExcalidrawElement[];
@@ -1,4 +1,4 @@
1
- import type { ExcalidrawElement, OrderedExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ExcalidrawArrowElement, ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawSelectionElement, ExcalidrawTextElement, OrderedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { AppState, BinaryFiles, LibraryItem } from "../types";
3
3
  import type { ImportedDataState } from "./types";
4
4
  type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
@@ -8,14 +8,19 @@ export type RestoredDataState = {
8
8
  appState: RestoredAppState;
9
9
  files: BinaryFiles;
10
10
  };
11
+ export declare const restoreElement: (element: Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, opts?: {
12
+ deleteInvisibleElements?: boolean;
13
+ }) => ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | ExcalidrawLinearElement | ExcalidrawArrowElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | null;
11
14
  export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, opts?: {
12
15
  refreshDimensions?: boolean;
13
16
  repairBindings?: boolean;
17
+ deleteInvisibleElements?: boolean;
14
18
  } | undefined) => OrderedExcalidrawElement[];
15
19
  export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
16
20
  export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined, elementsConfig?: {
17
21
  refreshDimensions?: boolean;
18
22
  repairBindings?: boolean;
23
+ deleteInvisibleElements?: boolean;
19
24
  }) => RestoredDataState;
20
25
  export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
21
26
  export {};
@@ -12,7 +12,7 @@ export { getSceneVersion, hashElementsVersion, hashString, getNonDeletedElements
12
12
  export { getTextFromElements } from "@excalidraw/element";
13
13
  export { isInvisiblySmallElement } from "@excalidraw/element";
14
14
  export { defaultLang, useI18n, languages } from "./i18n";
15
- export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "./data/restore";
15
+ export { restore, restoreAppState, restoreElement, restoreElements, restoreLibraryItems, } from "./data/restore";
16
16
  export { reconcileElements } from "./data/reconcile";
17
17
  export { exportToCanvas, exportToBlob, exportToSvg, exportToClipboard, } from "@excalidraw/utils/export";
18
18
  export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
@@ -29,6 +29,7 @@ export { Sidebar } from "./components/Sidebar/Sidebar";
29
29
  export { Button } from "./components/Button";
30
30
  export { Footer };
31
31
  export { MainMenu };
32
+ export { Ellipsify } from "./components/Ellipsify";
32
33
  export { useDevice } from "./components/App";
33
34
  export { WelcomeScreen };
34
35
  export { LiveCollaborationTrigger };
@@ -1,4 +1,7 @@
1
- import type { StaticSceneRenderConfig } from "../scene/types";
1
+ import type { ExcalidrawFrameLikeElement } from "@excalidraw/element/types";
2
+ import type { StaticCanvasRenderConfig, StaticSceneRenderConfig } from "../scene/types";
3
+ import type { StaticCanvasAppState } from "../types";
4
+ export declare const frameClip: (frame: ExcalidrawFrameLikeElement, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
2
5
  /** throttled to animation framerate */
3
6
  export declare const renderStaticSceneThrottled: {
4
7
  (config: StaticSceneRenderConfig): void;