@excalidraw/math 0.18.0-2874f9e → 0.18.0-2b0e4c9
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/dist/types/common/src/appEventBus.d.ts +27 -0
- package/dist/types/common/src/colors.d.ts +1 -1
- package/dist/types/common/src/index.d.ts +2 -0
- package/dist/types/common/src/utils.d.ts +1 -3
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +2 -0
- package/dist/types/element/src/arrowheads.d.ts +3 -0
- package/dist/types/element/src/binding.d.ts +3 -4
- package/dist/types/element/src/bounds.d.ts +1 -1
- package/dist/types/element/src/elbowArrow.d.ts +2 -0
- package/dist/types/element/src/index.d.ts +1 -0
- package/dist/types/element/src/linearElementEditor.d.ts +3 -0
- package/dist/types/element/src/mutateElement.d.ts +2 -0
- package/dist/types/element/src/types.d.ts +5 -2
- package/dist/types/element/src/utils.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +23 -29
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +16 -20
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +96 -120
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +16 -20
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +24 -30
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +4 -10
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +16 -20
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionExport.d.ts +59 -343
- package/dist/types/excalidraw/actions/actionFrame.d.ts +32 -40
- package/dist/types/excalidraw/actions/actionGroup.d.ts +16 -20
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionLink.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionMenu.d.ts +4 -10
- package/dist/types/excalidraw/actions/actionProperties.d.ts +16 -20
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionStyles.d.ts +7 -9
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +172 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +172 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +4 -10
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +8 -10
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +8 -10
- package/dist/types/excalidraw/actions/index.d.ts +2 -0
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/appState.d.ts +3 -1
- package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
- package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
- package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
- package/dist/types/excalidraw/charts/index.d.ts +7 -0
- package/dist/types/excalidraw/clipboard.d.ts +2 -5
- package/dist/types/excalidraw/components/App.d.ts +33 -11
- package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +4 -1
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
- package/dist/types/excalidraw/components/Toast.d.ts +8 -4
- package/dist/types/excalidraw/components/icons.d.ts +17 -8
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -0
- package/dist/types/excalidraw/data/blob.d.ts +23 -28
- package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
- package/dist/types/excalidraw/data/index.d.ts +2 -3
- package/dist/types/excalidraw/data/json.d.ts +27 -21
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/types.d.ts +83 -13
- package/package.json +2 -2
- package/dist/types/excalidraw/charts.d.ts +0 -27
- package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -15
- package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +0 -24
- package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -11
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -84
- package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
- package/dist/types/excalidraw/index.d.ts +0 -47
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
|
@@ -2,12 +2,11 @@ import { IMAGE_MIME_TYPES, MIME_TYPES } from "@excalidraw/common";
|
|
|
2
2
|
import type { ValueOf } from "@excalidraw/common/utility-types";
|
|
3
3
|
import type { ExcalidrawElement, FileId } from "@excalidraw/element/types";
|
|
4
4
|
import type { AppState, DataURL, LibraryItem } from "../types";
|
|
5
|
-
import type { FileSystemHandle } from "browser-fs-access";
|
|
6
5
|
import type { ImportedLibraryData } from "./types";
|
|
7
6
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
8
|
-
export declare const getFileHandleType: (handle:
|
|
7
|
+
export declare const getFileHandleType: (handle: FileSystemFileHandle | null) => string | null;
|
|
9
8
|
export declare const isImageFileHandleType: (type: string | null) => type is "png" | "svg";
|
|
10
|
-
export declare const isImageFileHandle: (handle:
|
|
9
|
+
export declare const isImageFileHandle: (handle: FileSystemFileHandle | null) => handle is FileSystemFileHandle;
|
|
11
10
|
export declare const isSupportedImageFileType: (type: string | null | undefined) => boolean;
|
|
12
11
|
export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
|
|
13
12
|
type: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
@@ -15,8 +14,8 @@ export declare const isSupportedImageFile: (blob: Blob | null | undefined) => bl
|
|
|
15
14
|
export declare const loadSceneOrLibraryFromBlob: (blob: Blob | File,
|
|
16
15
|
/** @see restore.localAppState */
|
|
17
16
|
localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null,
|
|
18
|
-
/**
|
|
19
|
-
fileHandle?:
|
|
17
|
+
/** FileSystemFileHandle. Defaults to `blob.handle` if defined, otherwise null. */
|
|
18
|
+
fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
20
19
|
type: "application/vnd.excalidraw+json";
|
|
21
20
|
data: {
|
|
22
21
|
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
@@ -46,6 +45,10 @@ fileHandle?: FileSystemHandle | null) => Promise<{
|
|
|
46
45
|
} | {
|
|
47
46
|
name: "elementLinkSelector";
|
|
48
47
|
sourceElementId: ExcalidrawElement["id"];
|
|
48
|
+
} | {
|
|
49
|
+
name: "charts";
|
|
50
|
+
data: import("../charts").Spreadsheet;
|
|
51
|
+
rawText: string;
|
|
49
52
|
};
|
|
50
53
|
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
51
54
|
selectedElementIds: Readonly<{
|
|
@@ -69,6 +72,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
|
|
|
69
72
|
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
70
73
|
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
71
74
|
isBindingEnabled: boolean;
|
|
75
|
+
isMidpointSnappingEnabled: boolean;
|
|
72
76
|
suggestedBinding: {
|
|
73
77
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
74
78
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
@@ -103,6 +107,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
|
|
|
103
107
|
isLoading: boolean;
|
|
104
108
|
errorMessage: React.ReactNode;
|
|
105
109
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
110
|
+
bindingPreference: "enabled" | "disabled";
|
|
106
111
|
startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
107
112
|
editingFrame: string | null;
|
|
108
113
|
preferredSelectionTool: {
|
|
@@ -144,25 +149,17 @@ fileHandle?: FileSystemHandle | null) => Promise<{
|
|
|
144
149
|
};
|
|
145
150
|
selectedElementsAreBeingDragged: boolean;
|
|
146
151
|
toast: {
|
|
147
|
-
message:
|
|
152
|
+
message: React.ReactNode;
|
|
148
153
|
closable?: boolean;
|
|
149
154
|
duration?: number;
|
|
150
155
|
} | null;
|
|
151
156
|
gridStep: number;
|
|
152
157
|
gridModeEnabled: boolean;
|
|
153
|
-
fileHandle:
|
|
158
|
+
fileHandle: FileSystemFileHandle | null;
|
|
154
159
|
stats: {
|
|
155
160
|
open: boolean;
|
|
156
161
|
panels: number;
|
|
157
162
|
};
|
|
158
|
-
currentChartType: import("@excalidraw/element/types").ChartType;
|
|
159
|
-
pasteDialog: {
|
|
160
|
-
shown: false;
|
|
161
|
-
data: null;
|
|
162
|
-
} | {
|
|
163
|
-
shown: true;
|
|
164
|
-
data: import("../charts").Spreadsheet;
|
|
165
|
-
};
|
|
166
163
|
showHyperlinkPopup: false | "info" | "editor";
|
|
167
164
|
originSnapOffset: {
|
|
168
165
|
x: number;
|
|
@@ -184,8 +181,8 @@ fileHandle?: FileSystemHandle | null) => Promise<{
|
|
|
184
181
|
export declare const loadFromBlob: (blob: Blob,
|
|
185
182
|
/** @see restore.localAppState */
|
|
186
183
|
localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null,
|
|
187
|
-
/**
|
|
188
|
-
fileHandle?:
|
|
184
|
+
/** FileSystemFileHandle. Defaults to `blob.handle` if defined, otherwise null. */
|
|
185
|
+
fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
189
186
|
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
190
187
|
appState: {
|
|
191
188
|
viewBackgroundColor: string;
|
|
@@ -213,6 +210,10 @@ fileHandle?: FileSystemHandle | null) => Promise<{
|
|
|
213
210
|
} | {
|
|
214
211
|
name: "elementLinkSelector";
|
|
215
212
|
sourceElementId: ExcalidrawElement["id"];
|
|
213
|
+
} | {
|
|
214
|
+
name: "charts";
|
|
215
|
+
data: import("../charts").Spreadsheet;
|
|
216
|
+
rawText: string;
|
|
216
217
|
};
|
|
217
218
|
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
218
219
|
selectedElementIds: Readonly<{
|
|
@@ -236,6 +237,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
|
|
|
236
237
|
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
237
238
|
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
238
239
|
isBindingEnabled: boolean;
|
|
240
|
+
isMidpointSnappingEnabled: boolean;
|
|
239
241
|
suggestedBinding: {
|
|
240
242
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
241
243
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
@@ -270,6 +272,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
|
|
|
270
272
|
isLoading: boolean;
|
|
271
273
|
errorMessage: React.ReactNode;
|
|
272
274
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
275
|
+
bindingPreference: "enabled" | "disabled";
|
|
273
276
|
startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
274
277
|
editingFrame: string | null;
|
|
275
278
|
preferredSelectionTool: {
|
|
@@ -311,25 +314,17 @@ fileHandle?: FileSystemHandle | null) => Promise<{
|
|
|
311
314
|
};
|
|
312
315
|
selectedElementsAreBeingDragged: boolean;
|
|
313
316
|
toast: {
|
|
314
|
-
message:
|
|
317
|
+
message: React.ReactNode;
|
|
315
318
|
closable?: boolean;
|
|
316
319
|
duration?: number;
|
|
317
320
|
} | null;
|
|
318
321
|
gridStep: number;
|
|
319
322
|
gridModeEnabled: boolean;
|
|
320
|
-
fileHandle:
|
|
323
|
+
fileHandle: FileSystemFileHandle | null;
|
|
321
324
|
stats: {
|
|
322
325
|
open: boolean;
|
|
323
326
|
panels: number;
|
|
324
327
|
};
|
|
325
|
-
currentChartType: import("@excalidraw/element/types").ChartType;
|
|
326
|
-
pasteDialog: {
|
|
327
|
-
shown: false;
|
|
328
|
-
data: null;
|
|
329
|
-
} | {
|
|
330
|
-
shown: true;
|
|
331
|
-
data: import("../charts").Spreadsheet;
|
|
332
|
-
};
|
|
333
328
|
showHyperlinkPopup: false | "info" | "editor";
|
|
334
329
|
originSnapOffset: {
|
|
335
330
|
x: number;
|
|
@@ -364,7 +359,7 @@ export declare const SVGStringToFile: (SVGString: string, filename?: string) =>
|
|
|
364
359
|
type: typeof MIME_TYPES.svg;
|
|
365
360
|
};
|
|
366
361
|
export declare const ImageURLToFile: (imageUrl: string, filename?: string) => Promise<File | undefined>;
|
|
367
|
-
export declare const getFileHandle: (event: DragEvent | React.DragEvent | DataTransferItem) => Promise<
|
|
362
|
+
export declare const getFileHandle: (event: DragEvent | React.DragEvent | DataTransferItem) => Promise<FileSystemFileHandle | null>;
|
|
368
363
|
export declare const createFile: (blob: File | Blob | ArrayBuffer, mimeType: string, name: string | undefined) => File;
|
|
369
364
|
/** attempts to detect correct mimeType if none is set, or if an image
|
|
370
365
|
* has an incorrect extension.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { supported as nativeFileSystemSupported } from "browser-fs-access";
|
|
2
2
|
import { MIME_TYPES } from "@excalidraw/common";
|
|
3
|
-
import type { FileSystemHandle } from "browser-fs-access";
|
|
4
3
|
type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
|
|
5
4
|
export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
|
|
6
5
|
extensions?: FILE_EXTENSION[];
|
|
@@ -14,8 +13,7 @@ export declare const fileSave: (blob: Blob | Promise<Blob>, opts: {
|
|
|
14
13
|
extension: FILE_EXTENSION;
|
|
15
14
|
mimeTypes?: string[];
|
|
16
15
|
description: string;
|
|
17
|
-
/** existing
|
|
18
|
-
fileHandle?:
|
|
19
|
-
}) => Promise<
|
|
16
|
+
/** existing FileSystemFileHandle */
|
|
17
|
+
fileHandle?: FileSystemFileHandle | null;
|
|
18
|
+
}) => Promise<FileSystemFileHandle | null>;
|
|
20
19
|
export { nativeFileSystemSupported };
|
|
21
|
-
export type { FileSystemHandle };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
import type { FileSystemHandle } from "./filesystem";
|
|
3
2
|
import type { ExportType } from "../scene/types";
|
|
4
3
|
import type { AppState, BinaryFiles } from "../types";
|
|
5
4
|
export { loadFromBlob } from "./blob";
|
|
@@ -17,6 +16,6 @@ export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements:
|
|
|
17
16
|
viewBackgroundColor: string;
|
|
18
17
|
/** filename, if applicable */
|
|
19
18
|
name?: string;
|
|
20
|
-
fileHandle?:
|
|
19
|
+
fileHandle?: FileSystemFileHandle | null;
|
|
21
20
|
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
22
|
-
}) => Promise<
|
|
21
|
+
}) => Promise<FileSystemFileHandle | null | undefined>;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
1
|
+
import type { ExcalidrawElement, NonDeleted } from "@excalidraw/element/types";
|
|
2
|
+
import type { MaybePromise } from "@excalidraw/common/utility-types";
|
|
2
3
|
import type { AppState, BinaryFiles, LibraryItems } from "../types";
|
|
3
4
|
import type { ImportedDataState, ImportedLibraryData } from "./types";
|
|
5
|
+
export type JSONExportData = {
|
|
6
|
+
elements: readonly NonDeleted<ExcalidrawElement>[];
|
|
7
|
+
appState: AppState;
|
|
8
|
+
files: BinaryFiles;
|
|
9
|
+
};
|
|
4
10
|
export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], appState: Partial<AppState>, files: BinaryFiles, type: "local" | "database") => string;
|
|
5
|
-
export declare const saveAsJSON: (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
fileHandle:
|
|
11
|
+
export declare const saveAsJSON: ({ data, filename, fileHandle, }: {
|
|
12
|
+
data: MaybePromise<JSONExportData>;
|
|
13
|
+
filename: string;
|
|
14
|
+
fileHandle: AppState["fileHandle"];
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
fileHandle: FileSystemFileHandle | null;
|
|
9
17
|
}>;
|
|
10
18
|
export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<{
|
|
11
19
|
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
@@ -35,12 +43,16 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
35
43
|
} | {
|
|
36
44
|
name: "elementLinkSelector";
|
|
37
45
|
sourceElementId: ExcalidrawElement["id"];
|
|
46
|
+
} | {
|
|
47
|
+
name: "charts";
|
|
48
|
+
data: import("../charts").Spreadsheet;
|
|
49
|
+
rawText: string;
|
|
38
50
|
};
|
|
39
51
|
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
40
52
|
selectedElementIds: Readonly<{
|
|
41
53
|
[id: string]: true;
|
|
42
54
|
}>;
|
|
43
|
-
frameToHighlight:
|
|
55
|
+
frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
44
56
|
activeTool: {
|
|
45
57
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
46
58
|
locked: boolean;
|
|
@@ -55,15 +67,16 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
55
67
|
[groupId: string]: boolean;
|
|
56
68
|
};
|
|
57
69
|
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
58
|
-
multiElement:
|
|
59
|
-
newElement:
|
|
70
|
+
multiElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
71
|
+
newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
60
72
|
isBindingEnabled: boolean;
|
|
73
|
+
isMidpointSnappingEnabled: boolean;
|
|
61
74
|
suggestedBinding: {
|
|
62
|
-
element:
|
|
75
|
+
element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
63
76
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
64
77
|
} | null;
|
|
65
78
|
isRotating: boolean;
|
|
66
|
-
elementsToHighlight:
|
|
79
|
+
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
67
80
|
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
68
81
|
snapLines: readonly import("../snapping").SnapLine[];
|
|
69
82
|
zenModeEnabled: boolean;
|
|
@@ -92,7 +105,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
92
105
|
isLoading: boolean;
|
|
93
106
|
errorMessage: React.ReactNode;
|
|
94
107
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
95
|
-
|
|
108
|
+
bindingPreference: "enabled" | "disabled";
|
|
109
|
+
startBoundElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
96
110
|
editingFrame: string | null;
|
|
97
111
|
preferredSelectionTool: {
|
|
98
112
|
type: "selection" | "lasso";
|
|
@@ -133,25 +147,17 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
133
147
|
};
|
|
134
148
|
selectedElementsAreBeingDragged: boolean;
|
|
135
149
|
toast: {
|
|
136
|
-
message:
|
|
150
|
+
message: React.ReactNode;
|
|
137
151
|
closable?: boolean;
|
|
138
152
|
duration?: number;
|
|
139
153
|
} | null;
|
|
140
154
|
gridStep: number;
|
|
141
155
|
gridModeEnabled: boolean;
|
|
142
|
-
fileHandle:
|
|
156
|
+
fileHandle: FileSystemFileHandle | null;
|
|
143
157
|
stats: {
|
|
144
158
|
open: boolean;
|
|
145
159
|
panels: number;
|
|
146
160
|
};
|
|
147
|
-
currentChartType: import("@excalidraw/element/types").ChartType;
|
|
148
|
-
pasteDialog: {
|
|
149
|
-
shown: false;
|
|
150
|
-
data: null;
|
|
151
|
-
} | {
|
|
152
|
-
shown: true;
|
|
153
|
-
data: import("../charts").Spreadsheet;
|
|
154
|
-
};
|
|
155
161
|
showHyperlinkPopup: false | "info" | "editor";
|
|
156
162
|
originSnapOffset: {
|
|
157
163
|
x: number;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { MaybePromise } from "@excalidraw/common/utility-types";
|
|
1
2
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
3
|
import type { AppState, BinaryFiles } from "../types";
|
|
3
|
-
export declare const resaveAsImageWithScene: (
|
|
4
|
-
|
|
4
|
+
export declare const resaveAsImageWithScene: (data: MaybePromise<{
|
|
5
|
+
elements: readonly ExcalidrawElement[];
|
|
6
|
+
appState: AppState;
|
|
7
|
+
files: BinaryFiles;
|
|
8
|
+
}>, fileHandle: FileSystemFileHandle, filename: string) => Promise<{
|
|
9
|
+
fileHandle: FileSystemFileHandle;
|
|
5
10
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, EditorInterface } from "@excalidraw/common";
|
|
2
2
|
import type { LinearElementEditor } from "@excalidraw/element";
|
|
3
3
|
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
4
|
-
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead,
|
|
4
|
+
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode } from "@excalidraw/element/types";
|
|
5
5
|
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
|
|
6
6
|
import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
|
|
7
7
|
import type { GlobalPoint } from "@excalidraw/math";
|
|
@@ -10,7 +10,6 @@ import type { Spreadsheet } from "./charts";
|
|
|
10
10
|
import type { ClipboardData } from "./clipboard";
|
|
11
11
|
import type App from "./components/App";
|
|
12
12
|
import type Library from "./data/library";
|
|
13
|
-
import type { FileSystemHandle } from "./data/filesystem";
|
|
14
13
|
import type { ContextMenuItems } from "./components/ContextMenu";
|
|
15
14
|
import type { SnapLine } from "./snapping";
|
|
16
15
|
import type { ImportedDataState } from "./data/types";
|
|
@@ -138,6 +137,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
138
137
|
multiElement: AppState["multiElement"];
|
|
139
138
|
newElement: AppState["newElement"];
|
|
140
139
|
isBindingEnabled: AppState["isBindingEnabled"];
|
|
140
|
+
isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
|
|
141
141
|
suggestedBinding: AppState["suggestedBinding"];
|
|
142
142
|
isRotating: AppState["isRotating"];
|
|
143
143
|
elementsToHighlight: AppState["elementsToHighlight"];
|
|
@@ -205,7 +205,15 @@ export interface AppState {
|
|
|
205
205
|
* - set on pointer down, updated during pointer move
|
|
206
206
|
*/
|
|
207
207
|
selectionElement: NonDeletedExcalidrawElement | null;
|
|
208
|
+
/**
|
|
209
|
+
* tracking current arrow binding editor state (takes into account
|
|
210
|
+
* `bindingPreference` and keyboard modifiers (ctrl/alt)
|
|
211
|
+
*/
|
|
208
212
|
isBindingEnabled: boolean;
|
|
213
|
+
/** user arrow binding preference */
|
|
214
|
+
bindingPreference: "enabled" | "disabled";
|
|
215
|
+
/** user preference whether arrow snap to midpoints while binding */
|
|
216
|
+
isMidpointSnappingEnabled: boolean;
|
|
209
217
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
210
218
|
suggestedBinding: {
|
|
211
219
|
element: NonDeleted<ExcalidrawBindableElement>;
|
|
@@ -285,6 +293,10 @@ export interface AppState {
|
|
|
285
293
|
} | {
|
|
286
294
|
name: "elementLinkSelector";
|
|
287
295
|
sourceElementId: ExcalidrawElement["id"];
|
|
296
|
+
} | {
|
|
297
|
+
name: "charts";
|
|
298
|
+
data: Spreadsheet;
|
|
299
|
+
rawText: string;
|
|
288
300
|
};
|
|
289
301
|
/**
|
|
290
302
|
* Reflects user preference for whether the default sidebar should be docked.
|
|
@@ -307,7 +319,7 @@ export interface AppState {
|
|
|
307
319
|
selectedElementsAreBeingDragged: boolean;
|
|
308
320
|
shouldCacheIgnoreZoom: boolean;
|
|
309
321
|
toast: {
|
|
310
|
-
message:
|
|
322
|
+
message: React.ReactNode;
|
|
311
323
|
closable?: boolean;
|
|
312
324
|
duration?: number;
|
|
313
325
|
} | null;
|
|
@@ -329,21 +341,13 @@ export interface AppState {
|
|
|
329
341
|
height: number;
|
|
330
342
|
offsetTop: number;
|
|
331
343
|
offsetLeft: number;
|
|
332
|
-
fileHandle:
|
|
344
|
+
fileHandle: FileSystemFileHandle | null;
|
|
333
345
|
collaborators: Map<SocketId, Collaborator>;
|
|
334
346
|
stats: {
|
|
335
347
|
open: boolean;
|
|
336
348
|
/** bitmap. Use `STATS_PANELS` bit values */
|
|
337
349
|
panels: number;
|
|
338
350
|
};
|
|
339
|
-
currentChartType: ChartType;
|
|
340
|
-
pasteDialog: {
|
|
341
|
-
shown: false;
|
|
342
|
-
data: null;
|
|
343
|
-
} | {
|
|
344
|
-
shown: true;
|
|
345
|
-
data: Spreadsheet;
|
|
346
|
-
};
|
|
347
351
|
showHyperlinkPopup: false | "info" | "editor";
|
|
348
352
|
selectedLinearElement: LinearElementEditor | null;
|
|
349
353
|
snapLines: readonly SnapLine[];
|
|
@@ -430,11 +434,36 @@ export type OnUserFollowedPayload = {
|
|
|
430
434
|
userToFollow: UserToFollow;
|
|
431
435
|
action: "FOLLOW" | "UNFOLLOW";
|
|
432
436
|
};
|
|
437
|
+
export type OnExportProgress = {
|
|
438
|
+
type: "progress";
|
|
439
|
+
message?: React.ReactNode;
|
|
440
|
+
/** 0-1 range */
|
|
441
|
+
progress?: number;
|
|
442
|
+
};
|
|
433
443
|
export interface ExcalidrawProps {
|
|
434
444
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
445
|
+
/**
|
|
446
|
+
* note: only subscribes if the props.onIncrement is defined on initial render
|
|
447
|
+
*/
|
|
435
448
|
onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
|
|
436
449
|
initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
|
|
437
|
-
|
|
450
|
+
/**
|
|
451
|
+
* Invoked as soon as the Excalidraw API is available
|
|
452
|
+
* NOTE editor is not yet mounted, and state is not yet initialized
|
|
453
|
+
*/
|
|
454
|
+
onExcalidrawAPI?: (api: ExcalidrawImperativeAPI | null) => void;
|
|
455
|
+
/**
|
|
456
|
+
* Invoked once the editor root is mounted.
|
|
457
|
+
*/
|
|
458
|
+
onMount?: (payload: ExcalidrawMountPayload) => void;
|
|
459
|
+
/**
|
|
460
|
+
* Invoked when the editor root is unmounted.
|
|
461
|
+
*/
|
|
462
|
+
onUnmount?: () => void;
|
|
463
|
+
/**
|
|
464
|
+
* Invoked once the initial scene is loaded.
|
|
465
|
+
*/
|
|
466
|
+
onInitialize?: (api: ExcalidrawImperativeAPI) => void;
|
|
438
467
|
isCollaborating?: boolean;
|
|
439
468
|
onPointerUpdate?: (payload: {
|
|
440
469
|
pointer: {
|
|
@@ -491,6 +520,29 @@ export interface ExcalidrawProps {
|
|
|
491
520
|
aiEnabled?: boolean;
|
|
492
521
|
showDeprecatedFonts?: boolean;
|
|
493
522
|
renderScrollbars?: boolean;
|
|
523
|
+
/**
|
|
524
|
+
* Called before exporting to a file.
|
|
525
|
+
*
|
|
526
|
+
* Allows the host app to intercept and delay saving until async operations
|
|
527
|
+
* (e.g., images are loaded) complete.
|
|
528
|
+
*
|
|
529
|
+
* If Promise/AsyncGenerator is returned, a progress toast will be shown
|
|
530
|
+
* until the operation completes. Generator can yield progress updates.
|
|
531
|
+
*/
|
|
532
|
+
onExport?: (
|
|
533
|
+
/** type of export. Currently we only call for JSON exports or
|
|
534
|
+
* JSON-embedded PNG (which is also identified as `json` type here)*/
|
|
535
|
+
type: "json", data: {
|
|
536
|
+
elements: readonly ExcalidrawElement[];
|
|
537
|
+
appState: AppState;
|
|
538
|
+
files: BinaryFiles;
|
|
539
|
+
}, options: {
|
|
540
|
+
/** signal that gets aborted if user cancels the export (e.g. closes
|
|
541
|
+
* the native file picker dialog). In that case, you can either
|
|
542
|
+
* return immediately, or throw AbortError.
|
|
543
|
+
*/
|
|
544
|
+
signal: AbortSignal;
|
|
545
|
+
}) => MaybePromise<void> | AsyncGenerator<OnExportProgress, void>;
|
|
494
546
|
}
|
|
495
547
|
export type SceneData = {
|
|
496
548
|
elements?: ImportedDataState["elements"];
|
|
@@ -543,6 +595,8 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
543
595
|
export type AppClassProperties = {
|
|
544
596
|
props: AppProps;
|
|
545
597
|
state: AppState;
|
|
598
|
+
api: App["api"];
|
|
599
|
+
sessionExportThemeOverride: App["sessionExportThemeOverride"];
|
|
546
600
|
interactiveCanvas: HTMLCanvasElement | null;
|
|
547
601
|
/** static canvas */
|
|
548
602
|
canvas: HTMLCanvasElement;
|
|
@@ -583,8 +637,11 @@ export type AppClassProperties = {
|
|
|
583
637
|
onPointerUpEmitter: App["onPointerUpEmitter"];
|
|
584
638
|
updateEditorAtom: App["updateEditorAtom"];
|
|
585
639
|
onPointerDownEmitter: App["onPointerDownEmitter"];
|
|
640
|
+
onEvent: App["onEvent"];
|
|
641
|
+
onStateChange: App["onStateChange"];
|
|
586
642
|
lastPointerMoveCoords: App["lastPointerMoveCoords"];
|
|
587
643
|
bindModeHandler: App["bindModeHandler"];
|
|
644
|
+
setAppState: App["setAppState"];
|
|
588
645
|
};
|
|
589
646
|
export type PointerDownState = Readonly<{
|
|
590
647
|
origin: Readonly<{
|
|
@@ -645,7 +702,18 @@ export type PointerDownState = Readonly<{
|
|
|
645
702
|
};
|
|
646
703
|
}>;
|
|
647
704
|
export type UnsubscribeCallback = () => void;
|
|
705
|
+
export type ExcalidrawMountPayload = {
|
|
706
|
+
excalidrawAPI: ExcalidrawImperativeAPI;
|
|
707
|
+
container: HTMLDivElement | null;
|
|
708
|
+
};
|
|
709
|
+
export type ExcalidrawImperativeAPIEventMap = {
|
|
710
|
+
"editor:mount": [payload: ExcalidrawMountPayload];
|
|
711
|
+
"editor:initialize": [api: ExcalidrawImperativeAPI];
|
|
712
|
+
"editor:unmount": [];
|
|
713
|
+
};
|
|
648
714
|
export interface ExcalidrawImperativeAPI {
|
|
715
|
+
/** Whether the editor has been unmounted and the API is no longer usable. */
|
|
716
|
+
isDestroyed: boolean;
|
|
649
717
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
650
718
|
applyDeltas: InstanceType<typeof App>["applyDeltas"];
|
|
651
719
|
mutateElement: InstanceType<typeof App>["mutateElement"];
|
|
@@ -683,6 +751,8 @@ export interface ExcalidrawImperativeAPI {
|
|
|
683
751
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
684
752
|
onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
|
|
685
753
|
onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
|
|
754
|
+
onStateChange: InstanceType<typeof App>["onStateChange"];
|
|
755
|
+
onEvent: InstanceType<typeof App>["onEvent"];
|
|
686
756
|
}
|
|
687
757
|
export type FrameNameBounds = {
|
|
688
758
|
x: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@excalidraw/math",
|
|
3
|
-
"version": "0.18.0-
|
|
3
|
+
"version": "0.18.0-2b0e4c9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/math/src/index.d.ts",
|
|
6
6
|
"main": "./dist/prod/index.js",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@excalidraw/common": "0.18.0-
|
|
64
|
+
"@excalidraw/common": "0.18.0-2b0e4c9"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
export type ChartElements = readonly NonDeletedExcalidrawElement[];
|
|
3
|
-
export interface Spreadsheet {
|
|
4
|
-
title: string | null;
|
|
5
|
-
labels: string[] | null;
|
|
6
|
-
values: number[];
|
|
7
|
-
}
|
|
8
|
-
export declare const NOT_SPREADSHEET = "NOT_SPREADSHEET";
|
|
9
|
-
export declare const VALID_SPREADSHEET = "VALID_SPREADSHEET";
|
|
10
|
-
type ParseSpreadsheetResult = {
|
|
11
|
-
type: typeof NOT_SPREADSHEET;
|
|
12
|
-
reason: string;
|
|
13
|
-
} | {
|
|
14
|
-
type: typeof VALID_SPREADSHEET;
|
|
15
|
-
spreadsheet: Spreadsheet;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* @private exported for testing
|
|
19
|
-
*/
|
|
20
|
-
export declare const tryParseNumber: (s: string) => number | null;
|
|
21
|
-
/**
|
|
22
|
-
* @private exported for testing
|
|
23
|
-
*/
|
|
24
|
-
export declare const tryParseCells: (cells: string[][]) => ParseSpreadsheetResult;
|
|
25
|
-
export declare const tryParseSpreadsheet: (text: string) => ParseSpreadsheetResult;
|
|
26
|
-
export declare const renderSpreadsheet: (chartType: string, spreadsheet: Spreadsheet, x: number, y: number) => ChartElements;
|
|
27
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./ExcalidrawLogo.scss";
|
|
2
|
-
type LogoSize = "xs" | "small" | "normal" | "large" | "custom" | "mobile";
|
|
3
|
-
interface LogoProps {
|
|
4
|
-
size?: LogoSize;
|
|
5
|
-
withText?: boolean;
|
|
6
|
-
style?: React.CSSProperties;
|
|
7
|
-
/**
|
|
8
|
-
* If true, the logo will not be wrapped in a Link component.
|
|
9
|
-
* The link prop will be ignored as well.
|
|
10
|
-
* It will merely be a plain div.
|
|
11
|
-
*/
|
|
12
|
-
isNotLink?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare const ExcalidrawLogo: ({ style, size, withText, }: LogoProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { Theme } from "@excalidraw/element/types";
|
|
3
|
-
import type { Language } from "../i18n";
|
|
4
|
-
interface Props {
|
|
5
|
-
langCode: Language["code"];
|
|
6
|
-
children: React.ReactElement;
|
|
7
|
-
theme?: Theme;
|
|
8
|
-
}
|
|
9
|
-
export declare const InitializeApp: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { LLMMessage, TTTDDialog } from "@excalidraw/excalidraw/components/TTDDialog/types";
|
|
2
|
-
interface StreamingOptions {
|
|
3
|
-
url: string;
|
|
4
|
-
messages: readonly LLMMessage[];
|
|
5
|
-
onChunk?: (chunk: string) => void;
|
|
6
|
-
extractRateLimits?: boolean;
|
|
7
|
-
signal?: AbortSignal;
|
|
8
|
-
onStreamCreated?: () => void;
|
|
9
|
-
}
|
|
10
|
-
export type StreamChunk = {
|
|
11
|
-
type: "content";
|
|
12
|
-
delta: string;
|
|
13
|
-
} | {
|
|
14
|
-
type: "done";
|
|
15
|
-
finishReason: "stop" | "length" | "content_filter" | "tool_calls" | null;
|
|
16
|
-
} | {
|
|
17
|
-
type: "error";
|
|
18
|
-
error: {
|
|
19
|
-
message: string;
|
|
20
|
-
status?: number;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export declare function TTDStreamFetch(options: StreamingOptions): Promise<TTTDDialog.OnTextSubmitRetValue>;
|
|
24
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type EditorInterface } from "@excalidraw/common";
|
|
2
|
-
import "./LiveCollaborationTrigger.scss";
|
|
3
|
-
declare const LiveCollaborationTrigger: {
|
|
4
|
-
({ isCollaborating, onSelect, editorInterface, ...rest }: {
|
|
5
|
-
isCollaborating: boolean;
|
|
6
|
-
onSelect: () => void;
|
|
7
|
-
editorInterface?: EditorInterface;
|
|
8
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
displayName: string;
|
|
10
|
-
};
|
|
11
|
-
export default LiveCollaborationTrigger;
|