@zsviczian/excalidraw 0.11.0-obsidian-19 → 0.11.0-obsidian-20
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/excalidraw.development.js +37 -37
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/appState.d.ts +1 -1
- package/types/charts.d.ts +8 -0
- package/types/components/App.d.ts +2 -3
- package/types/components/LibraryMenu.d.ts +3 -3
- package/types/components/LibraryMenuItems.d.ts +4 -4
- package/types/components/LibraryUnit.d.ts +2 -1
- package/types/data/blob.d.ts +21 -1
- package/types/data/json.d.ts +0 -2
- package/types/data/library.d.ts +18 -7
- package/types/data/types.d.ts +2 -2
- package/types/distribute.d.ts +6 -0
- package/types/packages/excalidraw/index.d.ts +2 -1
- package/types/packages/utils.d.ts +3 -1
- package/types/scene/Scene.d.ts +1 -2
- package/types/types.d.ts +8 -4
package/package.json
CHANGED
package/types/appState.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "off
|
|
|
3
3
|
export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
|
|
4
4
|
activeTool?: {
|
|
5
5
|
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
6
|
-
lastActiveToolBeforeEraser: import("./types").LastActiveToolBeforeEraser;
|
|
6
|
+
lastActiveToolBeforeEraser: import("./types").LastActiveToolBeforeEraser;
|
|
7
7
|
locked: boolean;
|
|
8
8
|
customType: null;
|
|
9
9
|
} | {
|
package/types/charts.d.ts
CHANGED
|
@@ -14,6 +14,14 @@ declare type ParseSpreadsheetResult = {
|
|
|
14
14
|
type: typeof VALID_SPREADSHEET;
|
|
15
15
|
spreadsheet: Spreadsheet;
|
|
16
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;
|
|
17
25
|
export declare const tryParseSpreadsheet: (text: string) => ParseSpreadsheetResult;
|
|
18
26
|
export declare const renderSpreadsheet: (chartType: string, spreadsheet: Spreadsheet, x: number, y: number) => ChartElements;
|
|
19
27
|
export {};
|
|
@@ -5,6 +5,7 @@ import { RestoredDataState } from "../data/restore";
|
|
|
5
5
|
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
6
6
|
import History from "../history";
|
|
7
7
|
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, DeviceType } from "../types";
|
|
8
|
+
import { FileSystemHandle } from "../data/filesystem";
|
|
8
9
|
import { ImportedDataState } from "../data/types";
|
|
9
10
|
export declare let showFourthFont: boolean;
|
|
10
11
|
export declare const useDeviceType: () => DeviceType;
|
|
@@ -51,7 +52,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
51
52
|
private onUnload;
|
|
52
53
|
private disableEvent;
|
|
53
54
|
private onFontLoaded;
|
|
54
|
-
private importLibraryFromUrl;
|
|
55
55
|
private resetHistory;
|
|
56
56
|
/**
|
|
57
57
|
* Resets scene & history.
|
|
@@ -103,7 +103,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
103
103
|
appState?: Pick<AppState, K> | null | undefined;
|
|
104
104
|
collaborators?: SceneData["collaborators"];
|
|
105
105
|
commitToHistory?: SceneData["commitToHistory"];
|
|
106
|
-
libraryItems?: LibraryItems | import("../types").LibraryItems_v1 | Promise<LibraryItems | import("../types").LibraryItems_v1> | ((currentLibraryItems: LibraryItems) => Required<SceneData>["libraryItems"] | Promise<Required<SceneData>["libraryItems"]>) | undefined;
|
|
107
106
|
}) => void;
|
|
108
107
|
private onSceneUpdated;
|
|
109
108
|
private updateCurrentCursorPosition;
|
|
@@ -176,7 +175,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
176
175
|
private clearSelection;
|
|
177
176
|
private handleCanvasRef;
|
|
178
177
|
private handleAppOnDrop;
|
|
179
|
-
loadFileToCanvas: (file:
|
|
178
|
+
loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
|
|
180
179
|
private handleCanvasContextMenu;
|
|
181
180
|
private maybeDragNewGenericElement;
|
|
182
181
|
private maybeHandleResize;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import Library from "../data/library";
|
|
3
|
-
import { LibraryItem, AppState, BinaryFiles, ExcalidrawProps } from "../types";
|
|
3
|
+
import { LibraryItems, LibraryItem, AppState, BinaryFiles, ExcalidrawProps } from "../types";
|
|
4
4
|
import "./LibraryMenu.scss";
|
|
5
|
-
export declare const LibraryMenu: ({ onClose,
|
|
5
|
+
export declare const LibraryMenu: ({ onClose, onInsertLibraryItems, pendingElements, onAddToLibrary, theme, setAppState, files, libraryReturnUrl, focusContainer, library, id, appState, }: {
|
|
6
6
|
pendingElements: LibraryItem["elements"];
|
|
7
7
|
onClose: () => void;
|
|
8
|
-
|
|
8
|
+
onInsertLibraryItems: (libraryItems: LibraryItems) => void;
|
|
9
9
|
onAddToLibrary: () => void;
|
|
10
10
|
theme: AppState["theme"];
|
|
11
11
|
files: BinaryFiles;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import Library from "../data/library";
|
|
3
3
|
import { AppState, BinaryFiles, ExcalidrawProps, LibraryItem, LibraryItems } from "../types";
|
|
4
4
|
import "./LibraryMenuItems.scss";
|
|
5
|
-
declare const LibraryMenuItems: ({ isLoading, libraryItems, onRemoveFromLibrary, onAddToLibrary,
|
|
5
|
+
declare const LibraryMenuItems: ({ isLoading, libraryItems, onRemoveFromLibrary, onAddToLibrary, onInsertLibraryItems, pendingElements, theme, setAppState, libraryReturnUrl, library, files, id, selectedItems, onSelectItems, onPublish, resetLibrary, }: {
|
|
6
6
|
isLoading: boolean;
|
|
7
7
|
libraryItems: LibraryItems;
|
|
8
8
|
pendingElements: LibraryItem["elements"];
|
|
9
9
|
onRemoveFromLibrary: () => void;
|
|
10
|
-
|
|
10
|
+
onInsertLibraryItems: (libraryItems: LibraryItems) => void;
|
|
11
11
|
onAddToLibrary: (elements: LibraryItem["elements"]) => void;
|
|
12
12
|
theme: AppState["theme"];
|
|
13
13
|
files: BinaryFiles;
|
|
@@ -16,7 +16,7 @@ declare const LibraryMenuItems: ({ isLoading, libraryItems, onRemoveFromLibrary,
|
|
|
16
16
|
library: Library;
|
|
17
17
|
id: string;
|
|
18
18
|
selectedItems: LibraryItem["id"][];
|
|
19
|
-
|
|
19
|
+
onSelectItems: (id: LibraryItem["id"][]) => void;
|
|
20
20
|
onPublish: () => void;
|
|
21
21
|
resetLibrary: () => void;
|
|
22
22
|
}) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BinaryFiles, LibraryItem } from "../types";
|
|
3
3
|
import "./LibraryUnit.scss";
|
|
4
|
-
export declare const LibraryUnit: ({ id, elements, files, isPending, onClick, selected, onToggle, }: {
|
|
4
|
+
export declare const LibraryUnit: ({ id, elements, files, isPending, onClick, selected, onToggle, onDrag, }: {
|
|
5
5
|
id: LibraryItem["id"] | /** for pending item */ null;
|
|
6
6
|
elements?: readonly import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | undefined;
|
|
7
7
|
files: BinaryFiles;
|
|
@@ -9,4 +9,5 @@ export declare const LibraryUnit: ({ id, elements, files, isPending, onClick, se
|
|
|
9
9
|
onClick: () => void;
|
|
10
10
|
selected: boolean;
|
|
11
11
|
onToggle: (id: string, event: React.MouseEvent) => void;
|
|
12
|
+
onDrag: (id: string, event: React.DragEvent) => void;
|
|
12
13
|
}) => JSX.Element;
|
package/types/data/blob.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
|
|
|
2
2
|
import { ExcalidrawElement, FileId } from "../element/types";
|
|
3
3
|
import { AppState, DataURL, LibraryItem } from "../types";
|
|
4
4
|
import { FileSystemHandle } from "./filesystem";
|
|
5
|
+
import { ImportedLibraryData } from "./types";
|
|
5
6
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
6
7
|
export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
|
|
7
8
|
export declare const isImageFileHandleType: (type: string | null) => type is "svg" | "png";
|
|
@@ -9,7 +10,15 @@ export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boo
|
|
|
9
10
|
export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
|
|
10
11
|
type: typeof ALLOWED_IMAGE_MIME_TYPES[number];
|
|
11
12
|
};
|
|
12
|
-
export declare const
|
|
13
|
+
export declare const loadSceneOrLibraryFromBlob: (blob: Blob | File, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null, fileHandle?: FileSystemHandle | null | undefined) => Promise<{
|
|
14
|
+
type: "application/vnd.excalidraw+json";
|
|
15
|
+
data: import("./restore").RestoredDataState;
|
|
16
|
+
} | {
|
|
17
|
+
type: "application/vnd.excalidrawlib+json";
|
|
18
|
+
data: ImportedLibraryData;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const loadFromBlob: (blob: Blob, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null, fileHandle?: FileSystemHandle | null | undefined) => Promise<import("./restore").RestoredDataState>;
|
|
21
|
+
export declare const parseLibraryJSON: (json: string, defaultStatus?: LibraryItem["status"]) => LibraryItem[];
|
|
13
22
|
export declare const loadLibraryFromBlob: (blob: Blob, defaultStatus?: LibraryItem["status"]) => Promise<LibraryItem[]>;
|
|
14
23
|
export declare const canvasToBlob: (canvas: HTMLCanvasElement) => Promise<Blob>;
|
|
15
24
|
/** generates SHA-1 digest from supplied file (if not supported, falls back
|
|
@@ -25,3 +34,14 @@ export declare const resizeImageFile: (file: File, opts: {
|
|
|
25
34
|
export declare const SVGStringToFile: (SVGString: string, filename?: string) => File & {
|
|
26
35
|
type: typeof MIME_TYPES.svg;
|
|
27
36
|
};
|
|
37
|
+
export declare const getFileFromEvent: (event: React.DragEvent<HTMLDivElement>) => Promise<{
|
|
38
|
+
file: File | null;
|
|
39
|
+
fileHandle: FileSystemHandle | null;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const getFileHandle: (event: React.DragEvent<HTMLDivElement>) => Promise<FileSystemHandle | null>;
|
|
42
|
+
export declare const createFile: (blob: File | Blob | ArrayBuffer, mimeType: ValueOf<typeof MIME_TYPES>, name: string | undefined) => File;
|
|
43
|
+
/** attemps to detect correct mimeType if none is set, or if an image
|
|
44
|
+
* has an incorrect extension.
|
|
45
|
+
* Note: doesn't handle missing .excalidraw/.excalidrawlib extension */
|
|
46
|
+
export declare const normalizeFile: (file: File) => Promise<File>;
|
|
47
|
+
export declare const blobToArrayBuffer: (blob: Blob) => Promise<ArrayBuffer>;
|
package/types/data/json.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, BinaryFiles, LibraryItems } from "../types";
|
|
3
3
|
import { ImportedDataState, ImportedLibraryData } from "./types";
|
|
4
|
-
import Library from "./library";
|
|
5
4
|
export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], appState: Partial<AppState>, files: BinaryFiles, type: "local" | "database") => string;
|
|
6
5
|
export declare const saveAsJSON: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => Promise<{
|
|
7
6
|
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
@@ -15,4 +14,3 @@ export declare const isValidExcalidrawData: (data?: {
|
|
|
15
14
|
export declare const isValidLibrary: (json: any) => json is ImportedLibraryData;
|
|
16
15
|
export declare const serializeLibraryAsJSON: (libraryItems: LibraryItems) => string;
|
|
17
16
|
export declare const saveLibraryAsJSON: (libraryItems: LibraryItems) => Promise<void>;
|
|
18
|
-
export declare const importLibraryFromJSON: (library: Library) => Promise<void>;
|
package/types/data/library.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LibraryItems,
|
|
1
|
+
import { LibraryItems, ExcalidrawImperativeAPI, LibraryItemsSource } from "../types";
|
|
2
2
|
import type App from "../components/App";
|
|
3
|
-
import {
|
|
3
|
+
import { ExcalidrawElement } from "../element/types";
|
|
4
4
|
export declare const libraryItemsAtom: import("jotai").Atom<{
|
|
5
5
|
status: "loading" | "loaded";
|
|
6
6
|
isInitialized: boolean;
|
|
@@ -71,15 +71,26 @@ declare class Library {
|
|
|
71
71
|
private getLastUpdateTask;
|
|
72
72
|
private notifyListeners;
|
|
73
73
|
resetLibrary: () => Promise<LibraryItems>;
|
|
74
|
-
/**
|
|
75
|
-
* imports library (from blob or libraryItems), merging with current library
|
|
76
|
-
* (attempting to remove duplicates)
|
|
77
|
-
*/
|
|
78
|
-
importLibrary(library: Blob | Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>, defaultStatus?: LibraryItem["status"]): Promise<LibraryItems>;
|
|
79
74
|
/**
|
|
80
75
|
* @returns latest cloned libraryItems. Awaits all in-progress updates first.
|
|
81
76
|
*/
|
|
82
77
|
getLatestLibrary: () => Promise<LibraryItems>;
|
|
78
|
+
updateLibrary: ({ libraryItems, prompt, merge, openLibraryMenu, defaultStatus, }: {
|
|
79
|
+
libraryItems: LibraryItemsSource;
|
|
80
|
+
merge?: boolean | undefined;
|
|
81
|
+
prompt?: boolean | undefined;
|
|
82
|
+
openLibraryMenu?: boolean | undefined;
|
|
83
|
+
defaultStatus?: "published" | "unpublished" | undefined;
|
|
84
|
+
}) => Promise<LibraryItems>;
|
|
83
85
|
setLibrary: (libraryItems: LibraryItems | Promise<LibraryItems> | ((latestLibraryItems: LibraryItems) => LibraryItems | Promise<LibraryItems>)) => Promise<LibraryItems>;
|
|
84
86
|
}
|
|
85
87
|
export default Library;
|
|
88
|
+
export declare const distributeLibraryItemsOnSquareGrid: (libraryItems: LibraryItems) => ExcalidrawElement[];
|
|
89
|
+
export declare const parseLibraryTokensFromUrl: () => {
|
|
90
|
+
libraryUrl: string;
|
|
91
|
+
idToken: string | null;
|
|
92
|
+
} | null;
|
|
93
|
+
export declare const useHandleLibrary: ({ excalidrawAPI, getInitialLibraryItems, }: {
|
|
94
|
+
excalidrawAPI: ExcalidrawImperativeAPI | null;
|
|
95
|
+
getInitialLibraryItems?: (() => LibraryItemsSource) | undefined;
|
|
96
|
+
}) => void;
|
package/types/data/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState, BinaryFiles, LibraryItems,
|
|
2
|
+
import { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion } from "../types";
|
|
3
3
|
import type { cleanAppStateForExport } from "../appState";
|
|
4
4
|
import { VERSIONS } from "../constants";
|
|
5
5
|
export interface ExportedDataState {
|
|
@@ -17,7 +17,7 @@ export interface ImportedDataState {
|
|
|
17
17
|
elements?: readonly ExcalidrawElement[] | null;
|
|
18
18
|
appState?: Readonly<Partial<AppState>> | null;
|
|
19
19
|
scrollToContent?: boolean;
|
|
20
|
-
libraryItems?:
|
|
20
|
+
libraryItems?: LibraryItems_anyVersion;
|
|
21
21
|
files?: BinaryFiles;
|
|
22
22
|
}
|
|
23
23
|
export interface ExportedLibraryData {
|
|
@@ -8,7 +8,7 @@ export default _default;
|
|
|
8
8
|
export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
|
|
9
9
|
export { defaultLang, languages } from "../../i18n";
|
|
10
10
|
export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "../../data/restore";
|
|
11
|
-
export { exportToCanvas, exportToBlob, exportToSvg, serializeAsJSON, serializeLibraryAsJSON, loadLibraryFromBlob, loadFromBlob, getFreeDrawSvgPath, getCommonBoundingBox, //zsviczian
|
|
11
|
+
export { exportToCanvas, exportToBlob, exportToSvg, serializeAsJSON, serializeLibraryAsJSON, loadLibraryFromBlob, loadFromBlob, loadSceneOrLibraryFromBlob, getFreeDrawSvgPath, getCommonBoundingBox, //zsviczian
|
|
12
12
|
getMaximumGroups, //zsviczian
|
|
13
13
|
intersectElementWithLine, //zsviczian
|
|
14
14
|
determineFocusDistance, //zsviczian
|
|
@@ -17,3 +17,4 @@ exportToClipboard, mergeLibraryItems, } from "../../packages/utils";
|
|
|
17
17
|
export { isLinearElement } from "../../element/typeChecks";
|
|
18
18
|
export { FONT_FAMILY, THEME, MIME_TYPES } from "../../constants";
|
|
19
19
|
export { mutateElement, newElementWith, bumpVersion, } from "../../element/mutateElement";
|
|
20
|
+
export { parseLibraryTokensFromUrl, useHandleLibrary, } from "../../data/library";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AppState, BinaryFiles } from "../types";
|
|
2
2
|
import { ExcalidrawElement, NonDeleted } from "../element/types";
|
|
3
|
+
import { MIME_TYPES } from "../constants";
|
|
4
|
+
export { MIME_TYPES };
|
|
3
5
|
declare type ExportOpts = {
|
|
4
6
|
elements: readonly NonDeleted<ExcalidrawElement>[];
|
|
5
7
|
appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
|
|
@@ -25,7 +27,7 @@ export declare const exportToClipboard: (opts: ExportOpts & {
|
|
|
25
27
|
type: "png" | "svg" | "json";
|
|
26
28
|
}) => Promise<void>;
|
|
27
29
|
export { serializeAsJSON, serializeLibraryAsJSON } from "../data/json";
|
|
28
|
-
export { loadFromBlob, loadLibraryFromBlob } from "../data/blob";
|
|
30
|
+
export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "../data/blob";
|
|
29
31
|
export { getFreeDrawSvgPath } from "../renderer/renderElement";
|
|
30
32
|
export { getCommonBoundingBox } from "../element/bounds";
|
|
31
33
|
export { getMaximumGroups } from "../groups";
|
package/types/scene/Scene.d.ts
CHANGED
|
@@ -14,10 +14,9 @@ declare class Scene {
|
|
|
14
14
|
private elements;
|
|
15
15
|
private elementsMap;
|
|
16
16
|
getElementsIncludingDeleted(): readonly ExcalidrawElement[];
|
|
17
|
-
|
|
17
|
+
getNonDeletedElements(): readonly NonDeletedExcalidrawElement[];
|
|
18
18
|
getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
|
|
19
19
|
getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
|
|
20
|
-
getNonDeletedElements(ids: readonly ExcalidrawElement["id"][]): NonDeleted<ExcalidrawElement>[];
|
|
21
20
|
replaceAllElements(nextElements: readonly ExcalidrawElement[]): void;
|
|
22
21
|
informMutation(): void;
|
|
23
22
|
addCallback(cb: SceneStateCallback): SceneStateCallbackRemover;
|
package/types/types.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare type Collaborator = {
|
|
|
29
29
|
background: string;
|
|
30
30
|
stroke: string;
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
avatarUrl?: string;
|
|
33
33
|
};
|
|
34
34
|
export declare type DataURL = string & {
|
|
35
35
|
_brand: "DataURL";
|
|
@@ -177,7 +177,7 @@ export declare class GestureEvent extends UIEvent {
|
|
|
177
177
|
/** @deprecated legacy: do not use outside of migration paths */
|
|
178
178
|
export declare type LibraryItem_v1 = readonly NonDeleted<ExcalidrawElement>[];
|
|
179
179
|
/** @deprecated legacy: do not use outside of migration paths */
|
|
180
|
-
|
|
180
|
+
declare type LibraryItems_v1 = readonly LibraryItem_v1[];
|
|
181
181
|
/** v2 library item */
|
|
182
182
|
export declare type LibraryItem = {
|
|
183
183
|
id: string;
|
|
@@ -189,6 +189,8 @@ export declare type LibraryItem = {
|
|
|
189
189
|
error?: string;
|
|
190
190
|
};
|
|
191
191
|
export declare type LibraryItems = readonly LibraryItem[];
|
|
192
|
+
export declare type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
|
|
193
|
+
export declare type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>) | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>;
|
|
192
194
|
export declare type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
|
|
193
195
|
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
194
196
|
ready?: false;
|
|
@@ -236,13 +238,14 @@ export interface ExcalidrawProps {
|
|
|
236
238
|
nativeEvent: MouseEvent | React.PointerEvent<HTMLCanvasElement>;
|
|
237
239
|
}>) => void;
|
|
238
240
|
onLinkHover?: (element: NonDeletedExcalidrawElement, event: React.PointerEvent<HTMLCanvasElement>) => void;
|
|
241
|
+
onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
|
|
242
|
+
onScrollChange?: (scrollX: number, scrollY: number) => void;
|
|
239
243
|
}
|
|
240
244
|
export declare type SceneData = {
|
|
241
245
|
elements?: ImportedDataState["elements"];
|
|
242
246
|
appState?: ImportedDataState["appState"];
|
|
243
247
|
collaborators?: Map<string, Collaborator>;
|
|
244
248
|
commitToHistory?: boolean;
|
|
245
|
-
libraryItems?: LibraryItems | LibraryItems_v1;
|
|
246
249
|
};
|
|
247
250
|
export declare enum UserIdleState {
|
|
248
251
|
ACTIVE = "active",
|
|
@@ -352,6 +355,7 @@ export declare type PointerDownState = Readonly<{
|
|
|
352
355
|
}>;
|
|
353
356
|
export declare type ExcalidrawImperativeAPI = {
|
|
354
357
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
358
|
+
updateLibrary: InstanceType<typeof Library>["updateLibrary"];
|
|
355
359
|
resetScene: InstanceType<typeof App>["resetScene"];
|
|
356
360
|
getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
|
|
357
361
|
history: {
|
|
@@ -363,7 +367,6 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
363
367
|
getAppState: () => InstanceType<typeof App>["state"];
|
|
364
368
|
getFiles: () => InstanceType<typeof App>["files"];
|
|
365
369
|
refresh: InstanceType<typeof App>["refresh"];
|
|
366
|
-
importLibrary: InstanceType<typeof App>["importLibraryFromUrl"];
|
|
367
370
|
setToastMessage: InstanceType<typeof App>["setToastMessage"];
|
|
368
371
|
addFiles: (data: BinaryFileData[]) => void;
|
|
369
372
|
updateContainerSize: InstanceType<typeof App>["updateContainerSize"];
|
|
@@ -378,6 +381,7 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
378
381
|
bringToFront: (elements: readonly ExcalidrawElement[]) => void;
|
|
379
382
|
restore: InstanceType<typeof App>["restore"];
|
|
380
383
|
setMobileModeAllowed: (allow: boolean) => void;
|
|
384
|
+
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
381
385
|
};
|
|
382
386
|
export declare type DeviceType = {
|
|
383
387
|
isMobile: boolean;
|