@excalidraw/excalidraw 0.16.1-6920-3a6028b → 0.16.1-7251-baadf54

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.
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-7251-baadf54",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -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
  } & {
@@ -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
  */
@@ -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 {};
@@ -18,11 +18,15 @@ export declare const ExcalidrawContainerContext: React.Context<{
18
18
  export declare const useApp: () => AppClassProperties;
19
19
  export declare const useAppProps: () => AppProps;
20
20
  export declare const useDevice: () => Readonly<{
21
- isSmScreen: boolean;
22
- isMobile: boolean;
21
+ viewport: {
22
+ isMobile: boolean;
23
+ isLandscape: boolean;
24
+ };
25
+ editor: {
26
+ isMobile: boolean;
27
+ canFitSidebar: boolean;
28
+ };
23
29
  isTouchScreen: boolean;
24
- canDeviceFitSidebar: boolean;
25
- isLandscape: boolean;
26
30
  }>;
27
31
  export declare const useExcalidrawContainer: () => {
28
32
  container: HTMLDivElement | null;
@@ -39,7 +43,6 @@ declare class App extends React.Component<AppProps, AppState> {
39
43
  unmounted: boolean;
40
44
  actionManager: ActionManager;
41
45
  device: Device;
42
- detachIsMobileMqHandler?: () => void;
43
46
  private excalidrawContainerRef;
44
47
  static defaultProps: Partial<AppProps>;
45
48
  scene: Scene;
@@ -233,7 +236,9 @@ declare class App extends React.Component<AppProps, AppState> {
233
236
  */
234
237
  private resetScene;
235
238
  private initializeScene;
236
- private refreshDeviceState;
239
+ private isMobileBreakpoint;
240
+ private refreshViewportBreakpoints;
241
+ private refreshEditorBreakpoints;
237
242
  componentDidMount(): Promise<void>;
238
243
  componentWillUnmount(): void;
239
244
  private onResize;
@@ -244,12 +249,10 @@ declare class App extends React.Component<AppProps, AppState> {
244
249
  private onScroll;
245
250
  private onCut;
246
251
  private onCopy;
247
- private cutAll;
248
- private copyAll;
249
252
  private static resetTapTwice;
250
253
  private onTouchStart;
251
254
  private onTouchEnd;
252
- pasteFromClipboard: (event: ClipboardEvent | null) => Promise<void>;
255
+ pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
253
256
  addElementsFromPasteOrLibrary: (opts: {
254
257
  elements: readonly ExcalidrawElement[];
255
258
  files: BinaryFiles | null;
@@ -414,7 +417,6 @@ declare class App extends React.Component<AppProps, AppState> {
414
417
  private maybeSuggestBindingAtCursor;
415
418
  private maybeSuggestBindingsForLinearElementAtCoords;
416
419
  private maybeSuggestBindingForAll;
417
- setSelection(elements: readonly NonDeletedExcalidrawElement[]): void;
418
420
  private clearSelection;
419
421
  private handleInteractiveCanvasRef;
420
422
  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 {};
@@ -122,6 +122,7 @@ export declare const IMAGE_MIME_TYPES: {
122
122
  readonly avif: "image/avif";
123
123
  readonly jfif: "image/jfif";
124
124
  };
125
+ export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html"];
125
126
  export declare const MIME_TYPES: {
126
127
  readonly svg: "image/svg+xml";
127
128
  readonly png: "image/png";
@@ -170,7 +171,6 @@ export declare const URL_HASH_KEYS: {
170
171
  readonly addLibrary: "addLibrary";
171
172
  };
172
173
  export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
173
- export declare const MQ_SM_MAX_WIDTH = 640;
174
174
  export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
175
175
  export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
176
176
  export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
@@ -52,7 +52,7 @@ export type ValidContainer = {
52
52
  verticalAlign?: VerticalAlign;
53
53
  } & MarkOptional<ElementConstructorOpts, "x" | "y">;
54
54
  } & ElementConstructorOpts;
55
- export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawEmbeddableElement | ExcalidrawFreeDrawElement | ExcalidrawFrameElement> | ({
55
+ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawEmbeddableElement | ExcalidrawFreeDrawElement> | ({
56
56
  type: Extract<ExcalidrawLinearElement["type"], "line">;
57
57
  x: number;
58
58
  y: number;
@@ -67,7 +67,11 @@ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, Excal
67
67
  x: number;
68
68
  y: number;
69
69
  fileId: FileId;
70
- } & Partial<ExcalidrawImageElement>);
70
+ } & Partial<ExcalidrawImageElement>) | ({
71
+ type: "frame";
72
+ children: readonly ExcalidrawElement["id"][];
73
+ name?: string;
74
+ } & Partial<ExcalidrawFrameElement>);
71
75
  export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
72
76
  regenerateIds: boolean;
73
77
  }) => ExcalidrawElement[];
@@ -9,7 +9,9 @@ export declare const newEmbeddableElement: (opts: {
9
9
  type: "embeddable";
10
10
  validated: ExcalidrawEmbeddableElement["validated"];
11
11
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawEmbeddableElement>;
12
- export declare const newFrameElement: (opts: ElementConstructorOpts) => NonDeleted<ExcalidrawFrameElement>;
12
+ export declare const newFrameElement: (opts: {
13
+ name?: string;
14
+ } & ElementConstructorOpts) => NonDeleted<ExcalidrawFrameElement>;
13
15
  export declare const newTextElement: (opts: {
14
16
  text: string;
15
17
  fontSize?: number;
@@ -1,13 +1,12 @@
1
1
  import React from "react";
2
2
  import "../../css/app.scss";
3
3
  import "../../css/styles.scss";
4
- import { ExcalidrawAPIRefValue, ExcalidrawProps } from "../../types";
4
+ import { ExcalidrawProps } from "../../types";
5
5
  import Footer from "../../components/footer/FooterCenter";
6
6
  import MainMenu from "../../components/main-menu/MainMenu";
7
7
  import WelcomeScreen from "../../components/welcome-screen/WelcomeScreen";
8
8
  import LiveCollaborationTrigger from "../../components/live-collaboration/LiveCollaborationTrigger";
9
- type PublicExcalidrawProps = Omit<ExcalidrawProps, "forwardedRef">;
10
- export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
9
+ export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawProps) => JSX.Element>;
11
10
  export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
12
11
  export { defaultLang, useI18n, languages } from "../../i18n";
13
12
  export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "../../data/restore";
@@ -27,4 +26,5 @@ export { LiveCollaborationTrigger };
27
26
  export { DefaultSidebar } from "../../components/DefaultSidebar";
28
27
  export { normalizeLink } from "../../data/url";
29
28
  export { convertToExcalidrawElements } from "../../data/transform";
29
+ export { getCommonBounds } from "../../element/bounds";
30
30
  export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "../withinBounds";
@@ -1,7 +1,6 @@
1
1
  import { NonDeletedExcalidrawElement } from "../element/types";
2
2
  import { AppState, BinaryFiles } from "../types";
3
3
  import { serializeAsJSON } from "../data/json";
4
- export declare const SVG_EXPORT_TAG = "<!-- svg-source:excalidraw -->";
5
4
  export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, }: {
6
5
  exportBackground: boolean;
7
6
  exportPadding?: number | undefined;
package/types/types.d.ts CHANGED
@@ -16,7 +16,7 @@ import type { FileSystemHandle } from "./data/filesystem";
16
16
  import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
17
17
  import { ContextMenuItems } from "./components/ContextMenu";
18
18
  import { SnapLine } from "./snapping";
19
- import { Merge, ForwardRef, ValueOf } from "./utility-types";
19
+ import { Merge, ValueOf } from "./utility-types";
20
20
  export type Point = Readonly<RoughPoint>;
21
21
  export type Collaborator = {
22
22
  pointer?: CollaboratorPointer;
@@ -283,17 +283,13 @@ export type LibraryItem = {
283
283
  export type LibraryItems = readonly LibraryItem[];
284
284
  export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
285
285
  export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>) | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>;
286
- export type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
287
- readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
288
- ready?: false;
289
- };
290
286
  export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
291
287
  libraryItems?: Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>;
292
288
  }>;
293
289
  export interface ExcalidrawProps {
294
290
  onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
295
291
  initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
296
- excalidrawRef?: ForwardRef<ExcalidrawAPIRefValue>;
292
+ excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
297
293
  isCollaborating?: boolean;
298
294
  onPointerUpdate?: (payload: {
299
295
  pointer: {
@@ -395,7 +391,6 @@ export type AppClassProperties = {
395
391
  lastViewportPosition: App["lastViewportPosition"];
396
392
  scrollToContent: App["scrollToContent"];
397
393
  addFiles: App["addFiles"];
398
- setSelection: App["setSelection"];
399
394
  addElementsFromPasteOrLibrary: App["addElementsFromPasteOrLibrary"];
400
395
  togglePenMode: App["togglePenMode"];
401
396
  setActiveTool: App["setActiveTool"];
@@ -494,11 +489,15 @@ export type ExcalidrawImperativeAPI = {
494
489
  onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
495
490
  };
496
491
  export type Device = Readonly<{
497
- isSmScreen: boolean;
498
- isMobile: boolean;
492
+ viewport: {
493
+ isMobile: boolean;
494
+ isLandscape: boolean;
495
+ };
496
+ editor: {
497
+ isMobile: boolean;
498
+ canFitSidebar: boolean;
499
+ };
499
500
  isTouchScreen: boolean;
500
- canDeviceFitSidebar: boolean;
501
- isLandscape: boolean;
502
501
  }>;
503
502
  type FrameNameBounds = {
504
503
  x: number;
package/types/utils.d.ts CHANGED
@@ -195,3 +195,5 @@ export declare const memoize: <T extends Record<string, any>, R extends unknown>
195
195
  clear: () => void;
196
196
  };
197
197
  export declare const isRenderThrottlingEnabled: () => boolean;
198
+ /** Checks if value is inside given collection. Useful for type-safety. */
199
+ export declare const isMemberOf: <T extends string>(collection: Set<T> | Record<T, any> | Map<T, any> | readonly T[], value: string) => value is T;