@excalidraw/excalidraw 0.15.2-6546-3398d86 → 0.15.2-6690-6186765

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 (37) hide show
  1. package/dist/excalidraw.development.js +213 -191
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/excalidraw.production.min.js.LICENSE.txt +0 -25
  4. package/package.json +1 -1
  5. package/types/actions/actionFinalize.d.ts +1 -1
  6. package/types/actions/actionGroup.d.ts +241 -3
  7. package/types/actions/actionSelectAll.d.ts +121 -1
  8. package/types/components/Actions.d.ts +2 -2
  9. package/types/components/App.d.ts +8 -6
  10. package/types/components/JSONExportDialog.d.ts +1 -1
  11. package/types/components/LayerUI.d.ts +3 -2
  12. package/types/components/MobileMenu.d.ts +2 -2
  13. package/types/components/canvases/InteractiveCanvas.d.ts +27 -0
  14. package/types/components/canvases/StaticCanvas.d.ts +18 -0
  15. package/types/components/canvases/index.d.ts +3 -0
  16. package/types/element/Hyperlink.d.ts +1 -1
  17. package/types/element/linearElementEditor.d.ts +4 -4
  18. package/types/element/sizeHelpers.d.ts +8 -1
  19. package/types/element/textWysiwyg.d.ts +1 -1
  20. package/types/element/transformHandles.d.ts +2 -2
  21. package/types/frame.d.ts +3 -3
  22. package/types/groups.d.ts +11 -11
  23. package/types/packages/excalidraw/dist/excalidraw.development.d.ts +2 -2
  24. package/types/packages/excalidraw/webpack.dev.config.d.ts +12 -0
  25. package/types/packages/excalidraw/webpack.prod.config.d.ts +12 -0
  26. package/types/renderer/renderElement.d.ts +9 -21
  27. package/types/renderer/renderScene.d.ts +16 -36
  28. package/types/scene/Renderer.d.ts +25 -0
  29. package/types/scene/Scene.d.ts +2 -0
  30. package/types/scene/Shape.d.ts +12 -0
  31. package/types/scene/ShapeCache.d.ts +20 -0
  32. package/types/scene/scroll.d.ts +1 -1
  33. package/types/scene/scrollbars.d.ts +2 -6
  34. package/types/scene/selection.d.ts +2 -2
  35. package/types/scene/types.d.ts +57 -24
  36. package/types/types.d.ts +43 -3
  37. package/types/utils.d.ts +11 -4
@@ -1,21 +1,5 @@
1
- /*
2
- object-assign
3
- (c) Sindre Sorhus
4
- @license MIT
5
- */
6
-
7
1
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
8
2
 
9
- /**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */
18
-
19
3
  /**
20
4
  * @license React
21
5
  * use-sync-external-store-shim.production.min.js
@@ -35,12 +19,3 @@ object-assign
35
19
  * This source code is licensed under the MIT license found in the
36
20
  * LICENSE file in the root directory of this source tree.
37
21
  */
38
-
39
- /** @license React v17.0.2
40
- * react-jsx-runtime.production.min.js
41
- *
42
- * Copyright (c) Facebook, Inc. and its affiliates.
43
- *
44
- * This source code is licensed under the MIT license found in the
45
- * LICENSE file in the root directory of this source tree.
46
- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/excalidraw",
3
- "version": "0.15.2-6546-3398d86",
3
+ "version": "0.15.2-6690-6186765",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -3,7 +3,7 @@ import { AppState } from "../types";
3
3
  export declare const actionFinalize: {
4
4
  name: "finalize";
5
5
  trackEvent: false;
6
- perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<AppState>, _: any, { canvas, focusContainer, scene }: import("../types").AppClassProperties) => {
6
+ perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<AppState>, _: any, { interactiveCanvas, focusContainer, scene }: import("../types").AppClassProperties) => {
7
7
  elements: import("../element/types").ExcalidrawElement[] | undefined;
8
8
  appState: {
9
9
  cursorButton: "up";
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement } from "../element/types";
1
+ import { ExcalidrawElement, ExcalidrawFrameElement } from "../element/types";
2
2
  import { AppClassProperties, AppState } from "../types";
3
3
  export declare const actionGroup: {
4
4
  name: "group";
@@ -10,7 +10,126 @@ export declare const actionGroup: {
10
10
  elements: readonly ExcalidrawElement[];
11
11
  commitToHistory: false;
12
12
  } | {
13
- appState: AppState;
13
+ appState: {
14
+ selectedElementIds: Readonly<{
15
+ [id: string]: true;
16
+ }>;
17
+ selectedGroupIds: {
18
+ [groupId: string]: boolean;
19
+ };
20
+ editingGroupId: string | null;
21
+ contextMenu: {
22
+ items: import("../components/ContextMenu").ContextMenuItems;
23
+ top: number;
24
+ left: number;
25
+ } | null;
26
+ showWelcomeScreen: boolean;
27
+ isLoading: boolean;
28
+ errorMessage: import("react").ReactNode;
29
+ activeEmbeddable: {
30
+ element: import("../element/types").NonDeletedExcalidrawElement;
31
+ state: "active" | "hover";
32
+ } | null;
33
+ draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
34
+ resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
35
+ multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
36
+ selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
37
+ isBindingEnabled: boolean;
38
+ startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
39
+ suggestedBindings: import("../element/binding").SuggestedBinding[];
40
+ frameToHighlight: import("../element/types").NonDeleted<ExcalidrawFrameElement> | null;
41
+ frameRendering: {
42
+ enabled: boolean;
43
+ name: boolean;
44
+ outline: boolean;
45
+ clip: boolean;
46
+ };
47
+ editingFrame: string | null;
48
+ elementsToHighlight: import("../element/types").NonDeleted<ExcalidrawElement>[] | null;
49
+ editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
50
+ editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
51
+ activeTool: {
52
+ lastActiveTool: import("../types").LastActiveTool;
53
+ locked: boolean;
54
+ } & ({
55
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
56
+ customType: null;
57
+ } | {
58
+ type: "custom";
59
+ customType: string;
60
+ });
61
+ penMode: boolean;
62
+ penDetected: boolean;
63
+ exportBackground: boolean;
64
+ exportEmbedScene: boolean;
65
+ exportWithDarkMode: boolean;
66
+ exportScale: number;
67
+ currentItemStrokeColor: string;
68
+ currentItemBackgroundColor: string;
69
+ currentItemFillStyle: import("../element/types").FillStyle;
70
+ currentItemStrokeWidth: number;
71
+ currentItemStrokeStyle: import("../element/types").StrokeStyle;
72
+ currentItemRoughness: number;
73
+ currentItemOpacity: number;
74
+ currentItemFontFamily: number;
75
+ currentItemFontSize: number;
76
+ currentItemTextAlign: string;
77
+ currentItemStartArrowhead: import("../element/types").Arrowhead | null;
78
+ currentItemEndArrowhead: import("../element/types").Arrowhead | null;
79
+ currentItemRoundness: import("../element/types").StrokeRoundness;
80
+ viewBackgroundColor: string;
81
+ scrollX: number;
82
+ scrollY: number;
83
+ cursorButton: "up" | "down";
84
+ scrolledOutside: boolean;
85
+ name: string;
86
+ isResizing: boolean;
87
+ isRotating: boolean;
88
+ zoom: Readonly<{
89
+ value: import("../types").NormalizedZoomValue;
90
+ }>;
91
+ openMenu: "canvas" | "shape" | null;
92
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
93
+ openSidebar: {
94
+ name: string;
95
+ tab?: string | undefined;
96
+ } | null;
97
+ openDialog: "imageExport" | "help" | "jsonExport" | null;
98
+ defaultSidebarDockedPreference: boolean;
99
+ lastPointerDownWith: import("../element/types").PointerType;
100
+ previousSelectedElementIds: {
101
+ [id: string]: true;
102
+ };
103
+ selectedElementsAreBeingDragged: boolean;
104
+ shouldCacheIgnoreZoom: boolean;
105
+ toast: {
106
+ message: string;
107
+ closable?: boolean | undefined;
108
+ duration?: number | undefined;
109
+ } | null;
110
+ zenModeEnabled: boolean;
111
+ theme: import("../element/types").Theme;
112
+ gridSize: number | null;
113
+ viewModeEnabled: boolean;
114
+ width: number;
115
+ height: number;
116
+ offsetTop: number;
117
+ offsetLeft: number;
118
+ fileHandle: import("browser-fs-access").FileSystemHandle | null;
119
+ collaborators: Map<string, import("../types").Collaborator>;
120
+ showStats: boolean;
121
+ currentChartType: import("../element/types").ChartType;
122
+ pasteDialog: {
123
+ shown: false;
124
+ data: null;
125
+ } | {
126
+ shown: true;
127
+ data: import("../charts").Spreadsheet;
128
+ };
129
+ pendingImageElementId: string | null;
130
+ showHyperlinkPopup: false | "editor" | "info";
131
+ selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
132
+ };
14
133
  elements: ExcalidrawElement[];
15
134
  commitToHistory: true;
16
135
  };
@@ -31,7 +150,126 @@ export declare const actionUngroup: {
31
150
  elements: readonly ExcalidrawElement[];
32
151
  commitToHistory: false;
33
152
  } | {
34
- appState: AppState;
153
+ appState: {
154
+ selectedElementIds: Readonly<{
155
+ [id: string]: true;
156
+ }>;
157
+ selectedGroupIds: {
158
+ [groupId: string]: boolean;
159
+ };
160
+ editingGroupId: string | null;
161
+ contextMenu: {
162
+ items: import("../components/ContextMenu").ContextMenuItems;
163
+ top: number;
164
+ left: number;
165
+ } | null;
166
+ showWelcomeScreen: boolean;
167
+ isLoading: boolean;
168
+ errorMessage: import("react").ReactNode;
169
+ activeEmbeddable: {
170
+ element: import("../element/types").NonDeletedExcalidrawElement;
171
+ state: "active" | "hover";
172
+ } | null;
173
+ draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
174
+ resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
175
+ multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
176
+ selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
177
+ isBindingEnabled: boolean;
178
+ startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
179
+ suggestedBindings: import("../element/binding").SuggestedBinding[];
180
+ frameToHighlight: import("../element/types").NonDeleted<ExcalidrawFrameElement> | null;
181
+ frameRendering: {
182
+ enabled: boolean;
183
+ name: boolean;
184
+ outline: boolean;
185
+ clip: boolean;
186
+ };
187
+ editingFrame: string | null;
188
+ elementsToHighlight: import("../element/types").NonDeleted<ExcalidrawElement>[] | null;
189
+ editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
190
+ editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
191
+ activeTool: {
192
+ lastActiveTool: import("../types").LastActiveTool;
193
+ locked: boolean;
194
+ } & ({
195
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
196
+ customType: null;
197
+ } | {
198
+ type: "custom";
199
+ customType: string;
200
+ });
201
+ penMode: boolean;
202
+ penDetected: boolean;
203
+ exportBackground: boolean;
204
+ exportEmbedScene: boolean;
205
+ exportWithDarkMode: boolean;
206
+ exportScale: number;
207
+ currentItemStrokeColor: string;
208
+ currentItemBackgroundColor: string;
209
+ currentItemFillStyle: import("../element/types").FillStyle;
210
+ currentItemStrokeWidth: number;
211
+ currentItemStrokeStyle: import("../element/types").StrokeStyle;
212
+ currentItemRoughness: number;
213
+ currentItemOpacity: number;
214
+ currentItemFontFamily: number;
215
+ currentItemFontSize: number;
216
+ currentItemTextAlign: string;
217
+ currentItemStartArrowhead: import("../element/types").Arrowhead | null;
218
+ currentItemEndArrowhead: import("../element/types").Arrowhead | null;
219
+ currentItemRoundness: import("../element/types").StrokeRoundness;
220
+ viewBackgroundColor: string;
221
+ scrollX: number;
222
+ scrollY: number;
223
+ cursorButton: "up" | "down";
224
+ scrolledOutside: boolean;
225
+ name: string;
226
+ isResizing: boolean;
227
+ isRotating: boolean;
228
+ zoom: Readonly<{
229
+ value: import("../types").NormalizedZoomValue;
230
+ }>;
231
+ openMenu: "canvas" | "shape" | null;
232
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
233
+ openSidebar: {
234
+ name: string;
235
+ tab?: string | undefined;
236
+ } | null;
237
+ openDialog: "imageExport" | "help" | "jsonExport" | null;
238
+ defaultSidebarDockedPreference: boolean;
239
+ lastPointerDownWith: import("../element/types").PointerType;
240
+ previousSelectedElementIds: {
241
+ [id: string]: true;
242
+ };
243
+ selectedElementsAreBeingDragged: boolean;
244
+ shouldCacheIgnoreZoom: boolean;
245
+ toast: {
246
+ message: string;
247
+ closable?: boolean | undefined;
248
+ duration?: number | undefined;
249
+ } | null;
250
+ zenModeEnabled: boolean;
251
+ theme: import("../element/types").Theme;
252
+ gridSize: number | null;
253
+ viewModeEnabled: boolean;
254
+ width: number;
255
+ height: number;
256
+ offsetTop: number;
257
+ offsetLeft: number;
258
+ fileHandle: import("browser-fs-access").FileSystemHandle | null;
259
+ collaborators: Map<string, import("../types").Collaborator>;
260
+ showStats: boolean;
261
+ currentChartType: import("../element/types").ChartType;
262
+ pasteDialog: {
263
+ shown: false;
264
+ data: null;
265
+ } | {
266
+ shown: true;
267
+ data: import("../charts").Spreadsheet;
268
+ };
269
+ pendingImageElementId: string | null;
270
+ showHyperlinkPopup: false | "editor" | "info";
271
+ selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
272
+ };
35
273
  elements: ExcalidrawElement[];
36
274
  commitToHistory: true;
37
275
  };
@@ -1,11 +1,131 @@
1
1
  import { ExcalidrawElement } from "../element/types";
2
+ import { LinearElementEditor } from "../element/linearElementEditor";
2
3
  export declare const actionSelectAll: {
3
4
  name: "selectAll";
4
5
  trackEvent: {
5
6
  category: "canvas";
6
7
  };
7
8
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>, value: any, app: import("../types").AppClassProperties) => false | {
8
- appState: import("../types").AppState;
9
+ appState: {
10
+ selectedLinearElement: LinearElementEditor | null;
11
+ selectedElementIds: Readonly<{
12
+ [id: string]: true;
13
+ }>;
14
+ selectedGroupIds: {
15
+ [groupId: string]: boolean;
16
+ };
17
+ editingGroupId: string | null;
18
+ contextMenu: {
19
+ items: import("../components/ContextMenu").ContextMenuItems;
20
+ top: number;
21
+ left: number;
22
+ } | null;
23
+ showWelcomeScreen: boolean;
24
+ isLoading: boolean;
25
+ errorMessage: import("react").ReactNode;
26
+ activeEmbeddable: {
27
+ element: import("../element/types").NonDeletedExcalidrawElement;
28
+ state: "active" | "hover";
29
+ } | null;
30
+ draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
31
+ resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
32
+ multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
33
+ selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
34
+ isBindingEnabled: boolean;
35
+ startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
36
+ suggestedBindings: import("../element/binding").SuggestedBinding[];
37
+ frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
38
+ frameRendering: {
39
+ enabled: boolean;
40
+ name: boolean;
41
+ outline: boolean;
42
+ clip: boolean;
43
+ };
44
+ editingFrame: string | null;
45
+ elementsToHighlight: import("../element/types").NonDeleted<ExcalidrawElement>[] | null;
46
+ editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
47
+ editingLinearElement: LinearElementEditor | null;
48
+ activeTool: {
49
+ lastActiveTool: import("../types").LastActiveTool;
50
+ locked: boolean;
51
+ } & ({
52
+ type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
53
+ customType: null;
54
+ } | {
55
+ type: "custom";
56
+ customType: string;
57
+ });
58
+ penMode: boolean;
59
+ penDetected: boolean;
60
+ exportBackground: boolean;
61
+ exportEmbedScene: boolean;
62
+ exportWithDarkMode: boolean;
63
+ exportScale: number;
64
+ currentItemStrokeColor: string;
65
+ currentItemBackgroundColor: string;
66
+ currentItemFillStyle: import("../element/types").FillStyle;
67
+ currentItemStrokeWidth: number;
68
+ currentItemStrokeStyle: import("../element/types").StrokeStyle;
69
+ currentItemRoughness: number;
70
+ currentItemOpacity: number;
71
+ currentItemFontFamily: number;
72
+ currentItemFontSize: number;
73
+ currentItemTextAlign: string;
74
+ currentItemStartArrowhead: import("../element/types").Arrowhead | null;
75
+ currentItemEndArrowhead: import("../element/types").Arrowhead | null;
76
+ currentItemRoundness: import("../element/types").StrokeRoundness;
77
+ viewBackgroundColor: string;
78
+ scrollX: number;
79
+ scrollY: number;
80
+ cursorButton: "up" | "down";
81
+ scrolledOutside: boolean;
82
+ name: string;
83
+ isResizing: boolean;
84
+ isRotating: boolean;
85
+ zoom: Readonly<{
86
+ value: import("../types").NormalizedZoomValue;
87
+ }>;
88
+ openMenu: "canvas" | "shape" | null;
89
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
90
+ openSidebar: {
91
+ name: string;
92
+ tab?: string | undefined;
93
+ } | null;
94
+ openDialog: "imageExport" | "help" | "jsonExport" | null;
95
+ defaultSidebarDockedPreference: boolean;
96
+ lastPointerDownWith: import("../element/types").PointerType;
97
+ previousSelectedElementIds: {
98
+ [id: string]: true;
99
+ };
100
+ selectedElementsAreBeingDragged: boolean;
101
+ shouldCacheIgnoreZoom: boolean;
102
+ toast: {
103
+ message: string;
104
+ closable?: boolean | undefined;
105
+ duration?: number | undefined;
106
+ } | null;
107
+ zenModeEnabled: boolean;
108
+ theme: import("../element/types").Theme;
109
+ gridSize: number | null;
110
+ viewModeEnabled: boolean;
111
+ width: number;
112
+ height: number;
113
+ offsetTop: number;
114
+ offsetLeft: number;
115
+ fileHandle: import("browser-fs-access").FileSystemHandle | null;
116
+ collaborators: Map<string, import("../types").Collaborator>;
117
+ showStats: boolean;
118
+ currentChartType: import("../element/types").ChartType;
119
+ pasteDialog: {
120
+ shown: false;
121
+ data: null;
122
+ } | {
123
+ shown: true;
124
+ data: import("../charts").Spreadsheet;
125
+ };
126
+ pendingImageElementId: string | null;
127
+ showHyperlinkPopup: false | "editor" | "info";
128
+ };
9
129
  commitToHistory: true;
10
130
  };
11
131
  contextItemLabel: string;
@@ -8,8 +8,8 @@ export declare const SelectedShapeActions: ({ appState, elements, renderAction,
8
8
  elements: readonly ExcalidrawElement[];
9
9
  renderAction: ActionManager["renderAction"];
10
10
  }) => JSX.Element;
11
- export declare const ShapesSwitcher: ({ canvas, activeTool, setAppState, onImageAction, appState, }: {
12
- canvas: HTMLCanvasElement | null;
11
+ export declare const ShapesSwitcher: ({ interactiveCanvas, activeTool, setAppState, onImageAction, appState, }: {
12
+ interactiveCanvas: HTMLCanvasElement | null;
13
13
  activeTool: UIAppState["activeTool"];
14
14
  setAppState: React.Component<any, UIAppState>["setState"];
15
15
  onImageAction: (data: {
@@ -8,6 +8,7 @@ import History from "../history";
8
8
  import Scene from "../scene/Scene";
9
9
  import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName } from "../types";
10
10
  import { FileSystemHandle } from "../data/filesystem";
11
+ import { Renderer } from "../scene/Renderer";
11
12
  export declare const ExcalidrawContainerContext: React.Context<{
12
13
  container: HTMLDivElement | null;
13
14
  id: string | null;
@@ -31,7 +32,8 @@ export declare const useExcalidrawSetAppState: () => <K extends keyof AppState>(
31
32
  export declare const useExcalidrawActionManager: () => ActionManager;
32
33
  declare class App extends React.Component<AppProps, AppState> {
33
34
  canvas: AppClassProperties["canvas"];
34
- rc: RoughCanvas | null;
35
+ interactiveCanvas: AppClassProperties["interactiveCanvas"];
36
+ rc: RoughCanvas;
35
37
  unmounted: boolean;
36
38
  actionManager: ActionManager;
37
39
  device: Device;
@@ -39,6 +41,7 @@ declare class App extends React.Component<AppProps, AppState> {
39
41
  private excalidrawContainerRef;
40
42
  static defaultProps: Partial<AppProps>;
41
43
  scene: Scene;
44
+ renderer: Renderer;
42
45
  private fonts;
43
46
  private resizeObserver;
44
47
  private nearestScrollableContainer;
@@ -58,7 +61,6 @@ declare class App extends React.Component<AppProps, AppState> {
58
61
  y: number;
59
62
  };
60
63
  constructor(props: AppProps);
61
- private renderCanvas;
62
64
  private onWindowMessage;
63
65
  private updateEmbeddableRef;
64
66
  private getHTMLIFrameElement;
@@ -94,15 +96,15 @@ declare class App extends React.Component<AppProps, AppState> {
94
96
  private removeEventListeners;
95
97
  private addEventListeners;
96
98
  componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
97
- private renderScene;
99
+ private renderInteractiveSceneCallback;
98
100
  private onScroll;
99
101
  private onCut;
100
102
  private onCopy;
101
103
  private cutAll;
102
104
  private copyAll;
103
105
  private static resetTapTwice;
104
- private onTapStart;
105
- private onTapEnd;
106
+ private onTouchStart;
107
+ private onTouchEnd;
106
108
  pasteFromClipboard: (event: ClipboardEvent | null) => Promise<void>;
107
109
  private addElementsFromPasteOrLibrary;
108
110
  private addTextFromPaste;
@@ -246,7 +248,7 @@ declare class App extends React.Component<AppProps, AppState> {
246
248
  private maybeSuggestBindingsForLinearElementAtCoords;
247
249
  private maybeSuggestBindingForAll;
248
250
  private clearSelection;
249
- private handleCanvasRef;
251
+ private handleInteractiveCanvasRef;
250
252
  private handleAppOnDrop;
251
253
  loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
252
254
  private handleCanvasContextMenu;
@@ -10,6 +10,6 @@ export declare const JSONExportDialog: ({ elements, appState, files, actionManag
10
10
  files: BinaryFiles;
11
11
  actionManager: ActionManager;
12
12
  exportOpts: ExportOpts;
13
- canvas: HTMLCanvasElement | null;
13
+ canvas: HTMLCanvasElement;
14
14
  setAppState: React.Component<any, UIAppState>["setState"];
15
15
  }) => JSX.Element;
@@ -9,7 +9,8 @@ interface LayerUIProps {
9
9
  actionManager: ActionManager;
10
10
  appState: UIAppState;
11
11
  files: BinaryFiles;
12
- canvas: HTMLCanvasElement | null;
12
+ canvas: HTMLCanvasElement;
13
+ interactiveCanvas: HTMLCanvasElement | null;
13
14
  setAppState: React.Component<any, AppState>["setState"];
14
15
  elements: readonly NonDeletedExcalidrawElement[];
15
16
  onLockToggle: () => void;
@@ -28,5 +29,5 @@ interface LayerUIProps {
28
29
  children?: React.ReactNode;
29
30
  app: AppClassProperties;
30
31
  }
31
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, onExportImage, renderWelcomeScreen, children, app, }: LayerUIProps) => JSX.Element>;
32
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, interactiveCanvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, onExportImage, renderWelcomeScreen, children, app, }: LayerUIProps) => JSX.Element>;
32
33
  export default _default;
@@ -12,7 +12,7 @@ type MobileMenuProps = {
12
12
  onLockToggle: () => void;
13
13
  onHandToolToggle: () => void;
14
14
  onPenModeToggle: () => void;
15
- canvas: HTMLCanvasElement | null;
15
+ interactiveCanvas: HTMLCanvasElement | null;
16
16
  onImageAction: (data: {
17
17
  insertOnCanvasDirectly: boolean;
18
18
  }) => void;
@@ -23,5 +23,5 @@ type MobileMenuProps = {
23
23
  renderWelcomeScreen: boolean;
24
24
  app: AppClassProperties;
25
25
  };
26
- export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, canvas, onImageAction, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, app, }: MobileMenuProps) => JSX.Element;
26
+ export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, interactiveCanvas, onImageAction, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, app, }: MobileMenuProps) => JSX.Element;
27
27
  export {};
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import type { DOMAttributes } from "react";
3
+ import type { InteractiveCanvasAppState } from "../../types";
4
+ import type { RenderInteractiveSceneCallback } from "../../scene/types";
5
+ import type { NonDeletedExcalidrawElement } from "../../element/types";
6
+ type InteractiveCanvasProps = {
7
+ containerRef: React.RefObject<HTMLDivElement>;
8
+ canvas: HTMLCanvasElement | null;
9
+ elements: readonly NonDeletedExcalidrawElement[];
10
+ visibleElements: readonly NonDeletedExcalidrawElement[];
11
+ selectedElements: readonly NonDeletedExcalidrawElement[];
12
+ versionNonce: number | undefined;
13
+ selectionNonce: number | undefined;
14
+ scale: number;
15
+ appState: InteractiveCanvasAppState;
16
+ renderInteractiveSceneCallback: (data: RenderInteractiveSceneCallback) => void;
17
+ handleCanvasRef: (canvas: HTMLCanvasElement | null) => void;
18
+ onContextMenu: Exclude<DOMAttributes<HTMLCanvasElement | HTMLDivElement>["onContextMenu"], undefined>;
19
+ onPointerMove: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerMove"], undefined>;
20
+ onPointerUp: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerUp"], undefined>;
21
+ onPointerCancel: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerCancel"], undefined>;
22
+ onTouchMove: Exclude<DOMAttributes<HTMLCanvasElement>["onTouchMove"], undefined>;
23
+ onPointerDown: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerDown"], undefined>;
24
+ onDoubleClick: Exclude<DOMAttributes<HTMLCanvasElement>["onDoubleClick"], undefined>;
25
+ };
26
+ declare const _default: React.MemoExoticComponent<(props: InteractiveCanvasProps) => JSX.Element>;
27
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { RoughCanvas } from "roughjs/bin/canvas";
3
+ import type { StaticCanvasAppState } from "../../types";
4
+ import type { StaticCanvasRenderConfig } from "../../scene/types";
5
+ import type { NonDeletedExcalidrawElement } from "../../element/types";
6
+ type StaticCanvasProps = {
7
+ canvas: HTMLCanvasElement;
8
+ rc: RoughCanvas;
9
+ elements: readonly NonDeletedExcalidrawElement[];
10
+ visibleElements: readonly NonDeletedExcalidrawElement[];
11
+ versionNonce: number | undefined;
12
+ selectionNonce: number | undefined;
13
+ scale: number;
14
+ appState: StaticCanvasAppState;
15
+ renderConfig: StaticCanvasRenderConfig;
16
+ };
17
+ declare const _default: React.MemoExoticComponent<(props: StaticCanvasProps) => JSX.Element>;
18
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import InteractiveCanvas from "./InteractiveCanvas";
2
+ import StaticCanvas from "./StaticCanvas";
3
+ export { InteractiveCanvas, StaticCanvas };
@@ -151,7 +151,7 @@ export declare const actionLink: {
151
151
  keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
152
152
  };
153
153
  export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
154
- export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: UIAppState) => [x: number, y: number, width: number, height: number];
154
+ export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: Pick<UIAppState, "zoom">) => [x: number, y: number, width: number, height: number];
155
155
  export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number]) => boolean;
156
156
  export declare const isPointHittingLink: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number], isMobile: boolean) => boolean;
157
157
  export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState) => void;
@@ -1,5 +1,5 @@
1
1
  import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer } from "./types";
2
- import { Point, AppState, PointerCoords } from "../types";
2
+ import { Point, AppState, PointerCoords, InteractiveCanvasAppState } from "../types";
3
3
  import History from "../history";
4
4
  import Scene from "../scene/Scene";
5
5
  declare const editorMidPointsCache: {
@@ -52,8 +52,8 @@ export declare class LinearElementEditor {
52
52
  y: number;
53
53
  }[]) => void, linearElementEditor: LinearElementEditor): boolean;
54
54
  static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
55
- static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, appState: AppState) => (typeof editorMidPointsCache)["points"];
56
- static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState: AppState) => void;
55
+ static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, appState: InteractiveCanvasAppState) => (typeof editorMidPointsCache)["points"];
56
+ static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState: InteractiveCanvasAppState) => void;
57
57
  static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
58
58
  x: number;
59
59
  y: number;
@@ -179,7 +179,7 @@ export declare class LinearElementEditor {
179
179
  currentItemTextAlign: string;
180
180
  currentItemStartArrowhead: import("./types").Arrowhead | null;
181
181
  currentItemEndArrowhead: import("./types").Arrowhead | null;
182
- currentItemRoundness: import("./types").StrokeRoundness; /** @returns whether point was dragged */
182
+ currentItemRoundness: import("./types").StrokeRoundness;
183
183
  viewBackgroundColor: string;
184
184
  scrollX: number;
185
185
  scrollY: number;