@excalidraw/excalidraw 0.16.1-6920-3a6028b → 0.16.1-7248-caa89f0

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 (50) hide show
  1. package/CHANGELOG.md +46 -2
  2. package/dist/excalidraw-assets/{vendor-2846daa016c867f96ee4.js → vendor-0452b0f95a04b9622103.js} +2 -2
  3. package/dist/excalidraw-assets-dev/{vendor-537f046869926dc3235f.js → vendor-0245ced0183e80375e32.js} +7 -7
  4. package/dist/excalidraw-with-preact.development.js +5883 -0
  5. package/dist/excalidraw-with-preact.production.min.js +2 -0
  6. package/dist/excalidraw-with-preact.production.min.js.LICENSE.txt +21 -0
  7. package/dist/excalidraw.development.js +166 -177
  8. package/dist/excalidraw.production.min.js +1 -1
  9. package/dist/excalidraw.production.min.js.LICENSE.txt +0 -10
  10. package/main.js +7 -1
  11. package/package.json +2 -2
  12. package/types/actions/actionCanvas.d.ts +1 -1
  13. package/types/actions/actionClipboard.d.ts +251 -8
  14. package/types/actions/actionExport.d.ts +1 -1
  15. package/types/actions/actionGroup.d.ts +3 -3
  16. package/types/actions/actionMenu.d.ts +0 -13
  17. package/types/actions/index.d.ts +1 -1
  18. package/types/actions/manager.d.ts +1 -1
  19. package/types/appState.d.ts +1 -1
  20. package/types/clipboard.d.ts +21 -3
  21. package/types/components/Actions.d.ts +3 -2
  22. package/types/components/App.d.ts +19 -13
  23. package/types/components/ContextMenu.d.ts +2 -1
  24. package/types/components/ImageExportDialog.d.ts +1 -1
  25. package/types/components/LayerUI.d.ts +1 -1
  26. package/types/components/MobileMenu.d.ts +4 -3
  27. package/types/constants.d.ts +7 -1
  28. package/types/data/index.d.ts +10 -2
  29. package/types/data/transform.d.ts +6 -2
  30. package/types/element/embeddable.d.ts +1 -1
  31. package/types/element/newElement.d.ts +3 -1
  32. package/types/element/typeChecks.d.ts +1 -1
  33. package/types/errors.d.ts +5 -0
  34. package/types/frame.d.ts +11 -1
  35. package/types/packages/excalidraw/dist/excalidraw-with-preact.development.d.ts +2 -0
  36. package/types/packages/excalidraw/dist/excalidraw-with-preact.production.min.d.ts +1 -0
  37. package/types/packages/excalidraw/dist/excalidraw.development.d.ts +2 -2
  38. package/types/packages/excalidraw/index.d.ts +3 -3
  39. package/types/packages/excalidraw/webpack.preact.config.d.ts +171 -0
  40. package/types/packages/utils.d.ts +4 -3
  41. package/types/packages/withinBounds.d.ts +2 -2
  42. package/types/renderer/renderElement.d.ts +5 -1
  43. package/types/renderer/renderScene.d.ts +5 -5
  44. package/types/scene/Scene.d.ts +7 -2
  45. package/types/scene/export.d.ts +5 -6
  46. package/types/types.d.ts +16 -16
  47. package/types/utils.d.ts +8 -1
  48. /package/dist/excalidraw-assets/{vendor-2846daa016c867f96ee4.js.LICENSE.txt → vendor-0452b0f95a04b9622103.js.LICENSE.txt} +0 -0
  49. /package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-2846daa016c867f96ee4.d.ts → vendor-0452b0f95a04b9622103.d.ts} +0 -0
  50. /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-537f046869926dc3235f.d.ts → vendor-0245ced0183e80375e32.d.ts} +0 -0
@@ -1,15 +1,5 @@
1
1
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
2
2
 
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.min.js
6
- *
7
- * Copyright (c) Facebook, Inc. and its affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
-
13
3
  /**
14
4
  * @license React
15
5
  * use-sync-external-store-shim.production.min.js
package/main.js CHANGED
@@ -1,4 +1,10 @@
1
- if (process.env.NODE_ENV === "production") {
1
+ if (process.env.IS_PREACT === "true") {
2
+ if (process.env.NODE_ENV === "production") {
3
+ module.exports = require("./dist/excalidraw-with-preact.production.min.js");
4
+ } else {
5
+ module.exports = require("./dist/excalidraw-with-preact.development.js");
6
+ }
7
+ } else if (process.env.NODE_ENV === "production") {
2
8
  module.exports = require("./dist/excalidraw.production.min.js");
3
9
  } else {
4
10
  module.exports = require("./dist/excalidraw.development.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/excalidraw",
3
- "version": "0.16.1-6920-3a6028b",
3
+ "version": "0.16.1-7248-caa89f0",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -78,7 +78,7 @@
78
78
  "homepage": "https://github.com/excalidraw/excalidraw/tree/master/src/packages/excalidraw",
79
79
  "scripts": {
80
80
  "gen:types": "tsc --project ../../../tsconfig-types.json",
81
- "build:umd": "rm -rf dist && cross-env NODE_ENV=production webpack --config webpack.prod.config.js && cross-env NODE_ENV=development webpack --config webpack.dev.config.js && yarn gen:types",
81
+ "build:umd": "rm -rf dist && cross-env NODE_ENV=production webpack --config webpack.prod.config.js && cross-env NODE_ENV=development webpack --config webpack.dev.config.js && NODE_ENV=development webpack --config webpack.preact.config.js && NODE_ENV=production webpack --config webpack.preact.config.js && yarn gen:types",
82
82
  "build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
83
83
  "pack": "yarn build:umd && yarn pack",
84
84
  "start": "webpack serve --config webpack.dev-server.config.js",
@@ -40,7 +40,6 @@ export declare const actionClearCanvas: {
40
40
  lastActiveTool: import("../types").ActiveTool | null;
41
41
  locked: boolean;
42
42
  } & import("../types").ActiveTool;
43
- name: string;
44
43
  contextMenu: {
45
44
  items: import("../components/ContextMenu").ContextMenuItems;
46
45
  top: number;
@@ -91,6 +90,7 @@ export declare const actionClearCanvas: {
91
90
  scrollY: number;
92
91
  cursorButton: "up" | "down";
93
92
  scrolledOutside: boolean;
93
+ name: string;
94
94
  isResizing: boolean;
95
95
  isRotating: boolean;
96
96
  zoom: Readonly<{
@@ -3,10 +3,132 @@ export declare const actionCopy: {
3
3
  trackEvent: {
4
4
  category: "element";
5
5
  };
6
- perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties) => {
6
+ perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, event: ClipboardEvent | null, app: import("../types").AppClassProperties) => Promise<{
7
7
  commitToHistory: false;
8
- };
9
- predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
8
+ appState: {
9
+ errorMessage: any;
10
+ contextMenu: {
11
+ items: import("../components/ContextMenu").ContextMenuItems;
12
+ top: number;
13
+ left: number;
14
+ } | null;
15
+ showWelcomeScreen: boolean;
16
+ isLoading: boolean;
17
+ activeEmbeddable: {
18
+ element: import("../element/types").NonDeletedExcalidrawElement;
19
+ state: "active" | "hover";
20
+ } | null;
21
+ draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
22
+ resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
23
+ multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
24
+ selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
25
+ isBindingEnabled: boolean;
26
+ startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
27
+ suggestedBindings: import("../element/binding").SuggestedBinding[];
28
+ frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
29
+ frameRendering: {
30
+ enabled: boolean;
31
+ name: boolean;
32
+ outline: boolean;
33
+ clip: boolean;
34
+ };
35
+ editingFrame: string | null;
36
+ elementsToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | null;
37
+ editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
38
+ editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
39
+ activeTool: {
40
+ lastActiveTool: import("../types").ActiveTool | null;
41
+ locked: boolean;
42
+ } & import("../types").ActiveTool;
43
+ penMode: boolean;
44
+ penDetected: boolean;
45
+ exportBackground: boolean;
46
+ exportEmbedScene: boolean;
47
+ exportWithDarkMode: boolean;
48
+ exportScale: number;
49
+ currentItemStrokeColor: string;
50
+ currentItemBackgroundColor: string;
51
+ currentItemFillStyle: import("../element/types").FillStyle;
52
+ currentItemStrokeWidth: number;
53
+ currentItemStrokeStyle: import("../element/types").StrokeStyle;
54
+ currentItemRoughness: number;
55
+ currentItemOpacity: number;
56
+ currentItemFontFamily: number;
57
+ currentItemFontSize: number;
58
+ currentItemTextAlign: string;
59
+ currentItemStartArrowhead: import("../element/types").Arrowhead | null;
60
+ currentItemEndArrowhead: import("../element/types").Arrowhead | null;
61
+ currentItemRoundness: import("../element/types").StrokeRoundness;
62
+ viewBackgroundColor: string;
63
+ scrollX: number;
64
+ scrollY: number;
65
+ cursorButton: "up" | "down";
66
+ scrolledOutside: boolean;
67
+ name: string;
68
+ isResizing: boolean;
69
+ isRotating: boolean;
70
+ zoom: Readonly<{
71
+ value: import("../types").NormalizedZoomValue;
72
+ }>;
73
+ openMenu: "canvas" | "shape" | null;
74
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
75
+ openSidebar: {
76
+ name: string;
77
+ tab?: string | undefined;
78
+ } | null;
79
+ openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
80
+ defaultSidebarDockedPreference: boolean;
81
+ lastPointerDownWith: import("../element/types").PointerType;
82
+ selectedElementIds: Readonly<{
83
+ [id: string]: true;
84
+ }>;
85
+ previousSelectedElementIds: {
86
+ [id: string]: true;
87
+ };
88
+ selectedElementsAreBeingDragged: boolean;
89
+ shouldCacheIgnoreZoom: boolean;
90
+ toast: {
91
+ message: string;
92
+ closable?: boolean | undefined;
93
+ duration?: number | undefined;
94
+ } | null;
95
+ zenModeEnabled: boolean;
96
+ theme: import("../element/types").Theme;
97
+ gridSize: number | null;
98
+ viewModeEnabled: boolean;
99
+ selectedGroupIds: {
100
+ [groupId: string]: boolean;
101
+ };
102
+ editingGroupId: string | null;
103
+ width: number;
104
+ height: number;
105
+ offsetTop: number;
106
+ offsetLeft: number;
107
+ fileHandle: import("browser-fs-access").FileSystemHandle | null;
108
+ collaborators: Map<string, import("../types").Collaborator>;
109
+ showStats: boolean;
110
+ currentChartType: import("../element/types").ChartType;
111
+ pasteDialog: {
112
+ shown: false;
113
+ data: null;
114
+ } | {
115
+ shown: true;
116
+ data: import("../charts").Spreadsheet;
117
+ };
118
+ pendingImageElementId: string | null;
119
+ showHyperlinkPopup: false | "editor" | "info";
120
+ selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
121
+ snapLines: readonly import("../snapping").SnapLine[];
122
+ originSnapOffset: {
123
+ x: number;
124
+ y: number;
125
+ } | null;
126
+ objectsSnapModeEnabled: boolean;
127
+ };
128
+ } | {
129
+ commitToHistory: false;
130
+ appState?: undefined;
131
+ }>;
10
132
  contextItemLabel: string;
11
133
  keyTest: undefined;
12
134
  } & {
@@ -17,10 +139,132 @@ export declare const actionPaste: {
17
139
  trackEvent: {
18
140
  category: "element";
19
141
  };
20
- perform: (elements: any, appStates: any, data: any, app: import("../types").AppClassProperties) => {
142
+ perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, data: any, app: import("../types").AppClassProperties) => Promise<false | {
21
143
  commitToHistory: false;
22
- };
23
- predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
144
+ appState: {
145
+ errorMessage: string;
146
+ contextMenu: {
147
+ items: import("../components/ContextMenu").ContextMenuItems;
148
+ top: number;
149
+ left: number;
150
+ } | null;
151
+ showWelcomeScreen: boolean;
152
+ isLoading: boolean;
153
+ activeEmbeddable: {
154
+ element: import("../element/types").NonDeletedExcalidrawElement;
155
+ state: "active" | "hover";
156
+ } | null;
157
+ draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
158
+ resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
159
+ multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
160
+ selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
161
+ isBindingEnabled: boolean;
162
+ startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
163
+ suggestedBindings: import("../element/binding").SuggestedBinding[];
164
+ frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
165
+ frameRendering: {
166
+ enabled: boolean;
167
+ name: boolean;
168
+ outline: boolean;
169
+ clip: boolean;
170
+ };
171
+ editingFrame: string | null;
172
+ elementsToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | null;
173
+ editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
174
+ editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
175
+ activeTool: {
176
+ lastActiveTool: import("../types").ActiveTool | null;
177
+ locked: boolean;
178
+ } & import("../types").ActiveTool;
179
+ penMode: boolean;
180
+ penDetected: boolean;
181
+ exportBackground: boolean;
182
+ exportEmbedScene: boolean;
183
+ exportWithDarkMode: boolean;
184
+ exportScale: number;
185
+ currentItemStrokeColor: string;
186
+ currentItemBackgroundColor: string;
187
+ currentItemFillStyle: import("../element/types").FillStyle;
188
+ currentItemStrokeWidth: number;
189
+ currentItemStrokeStyle: import("../element/types").StrokeStyle;
190
+ currentItemRoughness: number;
191
+ currentItemOpacity: number;
192
+ currentItemFontFamily: number;
193
+ currentItemFontSize: number;
194
+ currentItemTextAlign: string;
195
+ currentItemStartArrowhead: import("../element/types").Arrowhead | null;
196
+ currentItemEndArrowhead: import("../element/types").Arrowhead | null;
197
+ currentItemRoundness: import("../element/types").StrokeRoundness;
198
+ viewBackgroundColor: string;
199
+ scrollX: number;
200
+ scrollY: number;
201
+ cursorButton: "up" | "down";
202
+ scrolledOutside: boolean;
203
+ name: string;
204
+ isResizing: boolean;
205
+ isRotating: boolean;
206
+ zoom: Readonly<{
207
+ value: import("../types").NormalizedZoomValue;
208
+ }>;
209
+ openMenu: "canvas" | "shape" | null;
210
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
211
+ openSidebar: {
212
+ name: string;
213
+ tab?: string | undefined;
214
+ } | null;
215
+ openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
216
+ defaultSidebarDockedPreference: boolean;
217
+ lastPointerDownWith: import("../element/types").PointerType;
218
+ selectedElementIds: Readonly<{
219
+ [id: string]: true;
220
+ }>;
221
+ previousSelectedElementIds: {
222
+ [id: string]: true;
223
+ };
224
+ selectedElementsAreBeingDragged: boolean;
225
+ shouldCacheIgnoreZoom: boolean;
226
+ toast: {
227
+ message: string;
228
+ closable?: boolean | undefined;
229
+ duration?: number | undefined;
230
+ } | null;
231
+ zenModeEnabled: boolean;
232
+ theme: import("../element/types").Theme;
233
+ gridSize: number | null;
234
+ viewModeEnabled: boolean;
235
+ selectedGroupIds: {
236
+ [groupId: string]: boolean;
237
+ };
238
+ editingGroupId: string | null;
239
+ width: number;
240
+ height: number;
241
+ offsetTop: number;
242
+ offsetLeft: number;
243
+ fileHandle: import("browser-fs-access").FileSystemHandle | null;
244
+ collaborators: Map<string, import("../types").Collaborator>;
245
+ showStats: boolean;
246
+ currentChartType: import("../element/types").ChartType;
247
+ pasteDialog: {
248
+ shown: false;
249
+ data: null;
250
+ } | {
251
+ shown: true;
252
+ data: import("../charts").Spreadsheet;
253
+ };
254
+ pendingImageElementId: string | null;
255
+ showHyperlinkPopup: false | "editor" | "info";
256
+ selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
257
+ snapLines: readonly import("../snapping").SnapLine[];
258
+ originSnapOffset: {
259
+ x: number;
260
+ y: number;
261
+ } | null;
262
+ objectsSnapModeEnabled: boolean;
263
+ };
264
+ } | {
265
+ commitToHistory: false;
266
+ appState?: undefined;
267
+ }>;
24
268
  contextItemLabel: string;
25
269
  keyTest: undefined;
26
270
  } & {
@@ -31,7 +275,7 @@ export declare const actionCut: {
31
275
  trackEvent: {
32
276
  category: "element";
33
277
  };
34
- perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, data: any, app: import("../types").AppClassProperties) => false | {
278
+ perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, event: ClipboardEvent | null, app: import("../types").AppClassProperties) => false | {
35
279
  elements: import("../element/types").ExcalidrawElement[];
36
280
  appState: {
37
281
  editingLinearElement: null;
@@ -422,7 +666,6 @@ export declare const actionCut: {
422
666
  };
423
667
  commitToHistory: boolean;
424
668
  };
425
- predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
426
669
  contextItemLabel: string;
427
670
  keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
428
671
  } & {
@@ -811,7 +811,6 @@ export declare const actionLoadScene: {
811
811
  lastActiveTool: import("../types").ActiveTool | null;
812
812
  locked: boolean;
813
813
  } & import("../types").ActiveTool;
814
- name: string;
815
814
  contextMenu: {
816
815
  items: import("../components/ContextMenu").ContextMenuItems;
817
816
  top: number;
@@ -866,6 +865,7 @@ export declare const actionLoadScene: {
866
865
  scrollY: number;
867
866
  cursorButton: "up" | "down";
868
867
  scrolledOutside: boolean;
868
+ name: string;
869
869
  isResizing: boolean;
870
870
  isRotating: boolean;
871
871
  zoom: Readonly<{
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, ExcalidrawFrameElement } from "../element/types";
1
+ import { ExcalidrawElement } from "../element/types";
2
2
  import { AppClassProperties, AppState } from "../types";
3
3
  export declare const actionGroup: {
4
4
  name: "group";
@@ -37,7 +37,7 @@ export declare const actionGroup: {
37
37
  isBindingEnabled: boolean;
38
38
  startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
39
39
  suggestedBindings: import("../element/binding").SuggestedBinding[];
40
- frameToHighlight: import("../element/types").NonDeleted<ExcalidrawFrameElement> | null;
40
+ frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
41
41
  frameRendering: {
42
42
  enabled: boolean;
43
43
  name: boolean;
@@ -177,7 +177,7 @@ export declare const actionUngroup: {
177
177
  isBindingEnabled: boolean;
178
178
  startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
179
179
  suggestedBindings: import("../element/binding").SuggestedBinding[];
180
- frameToHighlight: import("../element/types").NonDeleted<ExcalidrawFrameElement> | null;
180
+ frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
181
181
  frameRendering: {
182
182
  enabled: boolean;
183
183
  name: boolean;
@@ -262,19 +262,6 @@ export declare const actionToggleEditMenu: {
262
262
  } & {
263
263
  keyTest?: undefined;
264
264
  };
265
- export declare const actionFullScreen: {
266
- name: "toggleFullScreen";
267
- viewMode: true;
268
- trackEvent: {
269
- category: "canvas";
270
- predicate: (appState: Readonly<import("../types").AppState>) => boolean;
271
- };
272
- perform: () => {
273
- commitToHistory: false;
274
- };
275
- } & {
276
- keyTest?: undefined;
277
- };
278
265
  export declare const actionShortcuts: {
279
266
  name: "toggleShortcuts";
280
267
  viewMode: true;
@@ -7,7 +7,7 @@ export { actionChangeViewBackgroundColor, actionClearCanvas, actionZoomIn, actio
7
7
  export { actionFinalize } from "./actionFinalize";
8
8
  export { actionChangeProjectName, actionChangeExportBackground, actionSaveToActiveFile, actionSaveFileToDisk, actionLoadScene, } from "./actionExport";
9
9
  export { actionCopyStyles, actionPasteStyles } from "./actionStyles";
10
- export { actionToggleCanvasMenu, actionToggleEditMenu, actionFullScreen, actionShortcuts, } from "./actionMenu";
10
+ export { actionToggleCanvasMenu, actionToggleEditMenu, actionShortcuts, } from "./actionMenu";
11
11
  export { actionGroup, actionUngroup } from "./actionGroup";
12
12
  export { actionGoToCollaborator } from "./actionNavigate";
13
13
  export { actionAddToLibrary } from "./actionAddToLibrary";
@@ -12,7 +12,7 @@ export declare class ActionManager {
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, source?: ActionSource, value?: any): void;
15
+ executeAction<T extends Action>(action: T, source?: ActionSource, value?: Parameters<T["perform"]>[2]): void;
16
16
  /**
17
17
  * @param data additional data sent to the PanelComponent
18
18
  */
@@ -5,7 +5,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
5
5
  lastActiveTool: import("./types").ActiveTool | null;
6
6
  locked: boolean;
7
7
  } & import("./types").ActiveTool) | undefined;
8
- name?: string | undefined;
9
8
  showWelcomeScreen?: boolean | undefined;
10
9
  penMode?: boolean | undefined;
11
10
  penDetected?: boolean | undefined;
@@ -31,6 +30,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
31
30
  scrollY?: number | undefined;
32
31
  cursorButton?: "up" | "down" | undefined;
33
32
  scrolledOutside?: boolean | undefined;
33
+ name?: string | undefined;
34
34
  zoom?: Readonly<{
35
35
  value: NormalizedZoomValue;
36
36
  }> | undefined;
@@ -1,6 +1,7 @@
1
1
  import { ExcalidrawElement, NonDeletedExcalidrawElement } from "./element/types";
2
2
  import { BinaryFiles } from "./types";
3
3
  import { Spreadsheet } from "./charts";
4
+ import { ALLOWED_PASTE_MIME_TYPES } from "./constants";
4
5
  export type PastedMixedContent = {
5
6
  type: "text" | "imageUrl";
6
7
  value: string;
@@ -14,13 +15,30 @@ export interface ClipboardData {
14
15
  errorMessage?: string;
15
16
  programmaticAPI?: boolean;
16
17
  }
18
+ type AllowedPasteMimeTypes = typeof ALLOWED_PASTE_MIME_TYPES[number];
17
19
  export declare const probablySupportsClipboardReadText: boolean;
18
20
  export declare const probablySupportsClipboardWriteText: boolean;
19
21
  export declare const probablySupportsClipboardBlob: boolean;
20
- export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null) => Promise<string | undefined>;
22
+ export declare const createPasteEvent: ({ types, files, }: {
23
+ types?: {
24
+ "text/plain"?: string | undefined;
25
+ "text/html"?: string | undefined;
26
+ } | undefined;
27
+ files?: File[] | undefined;
28
+ }) => ClipboardEvent;
29
+ export declare const serializeAsClipboardJSON: ({ elements, files, }: {
30
+ elements: readonly NonDeletedExcalidrawElement[];
31
+ files: BinaryFiles | null;
32
+ }) => string;
33
+ export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
34
+ export declare const readSystemClipboard: () => Promise<{
35
+ "text/plain"?: string | undefined;
36
+ "text/html"?: string | undefined;
37
+ }>;
21
38
  /**
22
39
  * Attempts to parse clipboard. Prefers system clipboard.
23
40
  */
24
- export declare const parseClipboard: (event: ClipboardEvent | null, isPlainPaste?: boolean) => Promise<ClipboardData>;
41
+ export declare const parseClipboard: (event: ClipboardEvent, isPlainPaste?: boolean) => Promise<ClipboardData>;
25
42
  export declare const copyBlobToClipboardAsPng: (blob: Blob | Promise<Blob>) => Promise<void>;
26
- export declare const copyTextToSystemClipboard: (text: string | null) => Promise<void>;
43
+ export declare const copyTextToSystemClipboard: (text: string | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
44
+ export {};
@@ -1,16 +1,17 @@
1
1
  import { ActionManager } from "../actions/manager";
2
2
  import { ExcalidrawElement } from "../element/types";
3
- import { AppClassProperties, UIAppState, Zoom } from "../types";
3
+ import { AppClassProperties, AppProps, UIAppState, Zoom } from "../types";
4
4
  import "./Actions.scss";
5
5
  export declare const SelectedShapeActions: ({ appState, elements, renderAction, }: {
6
6
  appState: UIAppState;
7
7
  elements: readonly ExcalidrawElement[];
8
8
  renderAction: ActionManager["renderAction"];
9
9
  }) => JSX.Element;
10
- export declare const ShapesSwitcher: ({ activeTool, appState, app, }: {
10
+ export declare const ShapesSwitcher: ({ activeTool, appState, app, UIOptions, }: {
11
11
  activeTool: UIAppState["activeTool"];
12
12
  appState: UIAppState;
13
13
  app: AppClassProperties;
14
+ UIOptions: AppProps["UIOptions"];
14
15
  }) => JSX.Element;
15
16
  export declare const ZoomActions: ({ renderAction, zoom, }: {
16
17
  renderAction: ActionManager["renderAction"];
@@ -2,8 +2,9 @@ import React from "react";
2
2
  import { RoughCanvas } from "roughjs/bin/canvas";
3
3
  import { ActionManager } from "../actions/manager";
4
4
  import { EXPORT_IMAGE_TYPES } from "../constants";
5
+ import { ExportedElements } from "../data";
5
6
  import { LinearElementEditor } from "../element/linearElementEditor";
6
- import { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement } from "../element/types";
7
+ import { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameElement } from "../element/types";
7
8
  import History from "../history";
8
9
  import Scene from "../scene/Scene";
9
10
  import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType } from "../types";
@@ -18,11 +19,15 @@ export declare const ExcalidrawContainerContext: React.Context<{
18
19
  export declare const useApp: () => AppClassProperties;
19
20
  export declare const useAppProps: () => AppProps;
20
21
  export declare const useDevice: () => Readonly<{
21
- isSmScreen: boolean;
22
- isMobile: boolean;
22
+ viewport: {
23
+ isMobile: boolean;
24
+ isLandscape: boolean;
25
+ };
26
+ editor: {
27
+ isMobile: boolean;
28
+ canFitSidebar: boolean;
29
+ };
23
30
  isTouchScreen: boolean;
24
- canDeviceFitSidebar: boolean;
25
- isLandscape: boolean;
26
31
  }>;
27
32
  export declare const useExcalidrawContainer: () => {
28
33
  container: HTMLDivElement | null;
@@ -39,7 +44,6 @@ declare class App extends React.Component<AppProps, AppState> {
39
44
  unmounted: boolean;
40
45
  actionManager: ActionManager;
41
46
  device: Device;
42
- detachIsMobileMqHandler?: () => void;
43
47
  private excalidrawContainerRef;
44
48
  static defaultProps: Partial<AppProps>;
45
49
  scene: Scene;
@@ -220,7 +224,9 @@ declare class App extends React.Component<AppProps, AppState> {
220
224
  getSceneElementsIncludingDeleted: () => readonly ExcalidrawElement[];
221
225
  getSceneElements: () => readonly NonDeletedExcalidrawElement[];
222
226
  onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
223
- onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: readonly NonDeletedExcalidrawElement[]) => Promise<void>;
227
+ onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
228
+ exportingFrame: ExcalidrawFrameElement | null;
229
+ }) => Promise<void>;
224
230
  private openEyeDropper;
225
231
  private syncActionResult;
226
232
  private onBlur;
@@ -233,7 +239,9 @@ declare class App extends React.Component<AppProps, AppState> {
233
239
  */
234
240
  private resetScene;
235
241
  private initializeScene;
236
- private refreshDeviceState;
242
+ private isMobileBreakpoint;
243
+ private refreshViewportBreakpoints;
244
+ private refreshEditorBreakpoints;
237
245
  componentDidMount(): Promise<void>;
238
246
  componentWillUnmount(): void;
239
247
  private onResize;
@@ -244,12 +252,10 @@ declare class App extends React.Component<AppProps, AppState> {
244
252
  private onScroll;
245
253
  private onCut;
246
254
  private onCopy;
247
- private cutAll;
248
- private copyAll;
249
255
  private static resetTapTwice;
250
256
  private onTouchStart;
251
257
  private onTouchEnd;
252
- pasteFromClipboard: (event: ClipboardEvent | null) => Promise<void>;
258
+ pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
253
259
  addElementsFromPasteOrLibrary: (opts: {
254
260
  elements: readonly ExcalidrawElement[];
255
261
  files: BinaryFiles | null;
@@ -271,7 +277,7 @@ declare class App extends React.Component<AppProps, AppState> {
271
277
  outline: boolean;
272
278
  clip: boolean;
273
279
  }> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
274
- togglePenMode: (force?: boolean) => void;
280
+ togglePenMode: (force: boolean | null) => void;
275
281
  onHandToolToggle: () => void;
276
282
  /**
277
283
  * Zooms on canvas viewport center
@@ -323,6 +329,7 @@ declare class App extends React.Component<AppProps, AppState> {
323
329
  private onKeyDown;
324
330
  private onWheel;
325
331
  private onKeyUp;
332
+ private isToolSupported;
326
333
  setActiveTool: (tool: (({
327
334
  type: Exclude<ToolType, "image">;
328
335
  } | {
@@ -414,7 +421,6 @@ declare class App extends React.Component<AppProps, AppState> {
414
421
  private maybeSuggestBindingAtCursor;
415
422
  private maybeSuggestBindingsForLinearElementAtCoords;
416
423
  private maybeSuggestBindingForAll;
417
- setSelection(elements: readonly NonDeletedExcalidrawElement[]): void;
418
424
  private clearSelection;
419
425
  private handleInteractiveCanvasRef;
420
426
  private handleAppOnDrop;
@@ -9,7 +9,8 @@ type ContextMenuProps = {
9
9
  items: ContextMenuItems;
10
10
  top: number;
11
11
  left: number;
12
+ onClose: (callback?: () => void) => void;
12
13
  };
13
14
  export declare const CONTEXT_MENU_SEPARATOR = "separator";
14
- export declare const ContextMenu: React.MemoExoticComponent<({ actionManager, items, top, left }: ContextMenuProps) => JSX.Element>;
15
+ export declare const ContextMenu: React.MemoExoticComponent<({ actionManager, items, top, left, onClose }: ContextMenuProps) => JSX.Element>;
15
16
  export {};
@@ -10,4 +10,4 @@ export declare const ImageExportDialog: ({ elements, appState, files, actionMana
10
10
  actionManager: ActionManager;
11
11
  onExportImage: AppClassProperties["onExportImage"];
12
12
  onCloseRequest: () => void;
13
- }) => JSX.Element | null;
13
+ }) => JSX.Element;
@@ -14,7 +14,7 @@ interface LayerUIProps {
14
14
  elements: readonly NonDeletedExcalidrawElement[];
15
15
  onLockToggle: () => void;
16
16
  onHandToolToggle: () => void;
17
- onPenModeToggle: () => void;
17
+ onPenModeToggle: AppClassProperties["togglePenMode"];
18
18
  showExitZenModeBtn: boolean;
19
19
  langCode: Language["code"];
20
20
  renderTopRightUI?: ExcalidrawProps["renderTopRightUI"];