@dwelle/excalidraw 0.3.58 → 0.3.60
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/CHANGELOG.md +30 -0
- package/README_NEXT.md +32 -3
- package/dist/excalidraw-assets/vendor-0e2ecbd1f46fc190ec01.js +2 -0
- package/dist/excalidraw-assets/{vendor-8698157b56eb5e0ee549.js.LICENSE.txt → vendor-0e2ecbd1f46fc190ec01.js.LICENSE.txt} +0 -0
- package/dist/excalidraw-assets-dev/vendor-86b56a69e7dddcf8f70d.js +32 -0
- package/dist/excalidraw.development.js +360 -48
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionClipboard.d.ts +13 -0
- package/types/actions/actionFinalize.d.ts +2 -2
- package/types/actions/actionToggleLock.d.ts +17 -0
- package/types/actions/index.d.ts +2 -1
- package/types/actions/shortcuts.d.ts +1 -1
- package/types/actions/types.d.ts +1 -1
- package/types/clipboard.d.ts +1 -1
- package/types/components/App.d.ts +1 -1
- package/types/components/LibraryMenu.d.ts +1 -1
- package/types/components/LoadingMessage.d.ts +3 -1
- package/types/data/blob.d.ts +2 -3
- package/types/data/index.d.ts +1 -1
- package/types/data/json.d.ts +3 -2
- package/types/data/library.d.ts +87 -4
- package/types/data/restore.d.ts +2 -2
- package/types/element/typeChecks.d.ts +3 -3
- package/types/element/types.d.ts +1 -0
- package/types/jotai.d.ts +120 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-0e2ecbd1f46fc190ec01.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-86b56a69e7dddcf8f70d.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw.production.min.d.ts +1 -1
- package/types/packages/excalidraw/entry.d.ts +1 -1
- package/types/packages/excalidraw/index.d.ts +3 -2
- package/types/packages/utils.d.ts +1 -1
- package/types/types.d.ts +4 -4
- package/types/utils.d.ts +1 -0
- package/dist/excalidraw-assets/image-2be1c869cd5bacebdc3c.js +0 -1
- package/dist/excalidraw-assets/vendor-8698157b56eb5e0ee549.js +0 -2
- package/dist/excalidraw-assets-dev/image-eddc6ed66acd3a3f3d46.js +0 -42
- package/dist/excalidraw-assets-dev/vendor-1bc8ceaafd8623c96dd4.js +0 -278
package/package.json
CHANGED
|
@@ -513,3 +513,16 @@ export declare const actionCopyAsPng: {
|
|
|
513
513
|
} & {
|
|
514
514
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
515
515
|
};
|
|
516
|
+
export declare const copyText: {
|
|
517
|
+
name: "copyText";
|
|
518
|
+
trackEvent: {
|
|
519
|
+
category: "element";
|
|
520
|
+
};
|
|
521
|
+
perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
|
|
522
|
+
commitToHistory: false;
|
|
523
|
+
};
|
|
524
|
+
contextItemPredicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState) => boolean;
|
|
525
|
+
contextItemLabel: string;
|
|
526
|
+
} & {
|
|
527
|
+
keyTest?: undefined;
|
|
528
|
+
};
|
|
@@ -6,6 +6,7 @@ export declare const actionFinalize: {
|
|
|
6
6
|
perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, { canvas, focusContainer }: import("../types").AppClassProperties) => {
|
|
7
7
|
elements: import("../element/types").ExcalidrawElement[] | undefined;
|
|
8
8
|
appState: {
|
|
9
|
+
cursorButton: "up";
|
|
9
10
|
editingLinearElement: null;
|
|
10
11
|
isLoading: boolean;
|
|
11
12
|
errorMessage: string | null;
|
|
@@ -45,7 +46,6 @@ export declare const actionFinalize: {
|
|
|
45
46
|
viewBackgroundColor: string;
|
|
46
47
|
scrollX: number;
|
|
47
48
|
scrollY: number;
|
|
48
|
-
cursorButton: "up" | "down";
|
|
49
49
|
scrolledOutside: boolean;
|
|
50
50
|
name: string;
|
|
51
51
|
isResizing: boolean;
|
|
@@ -96,6 +96,7 @@ export declare const actionFinalize: {
|
|
|
96
96
|
} | {
|
|
97
97
|
elements: readonly import("../element/types").ExcalidrawElement[];
|
|
98
98
|
appState: {
|
|
99
|
+
cursorButton: "up";
|
|
99
100
|
activeTool: {
|
|
100
101
|
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
101
102
|
lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
|
|
@@ -139,7 +140,6 @@ export declare const actionFinalize: {
|
|
|
139
140
|
viewBackgroundColor: string;
|
|
140
141
|
scrollX: number;
|
|
141
142
|
scrollY: number;
|
|
142
|
-
cursorButton: "up" | "down";
|
|
143
143
|
scrolledOutside: boolean;
|
|
144
144
|
name: string;
|
|
145
145
|
isResizing: boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ExcalidrawElement } from "../element/types";
|
|
3
|
+
export declare const actionToggleLock: {
|
|
4
|
+
name: "toggleLock";
|
|
5
|
+
trackEvent: {
|
|
6
|
+
category: "element";
|
|
7
|
+
};
|
|
8
|
+
perform: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => false | {
|
|
9
|
+
elements: ExcalidrawElement[];
|
|
10
|
+
appState: Readonly<import("../types").AppState>;
|
|
11
|
+
commitToHistory: true;
|
|
12
|
+
};
|
|
13
|
+
contextItemLabel: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => "labels.elementLock.unlock" | "labels.elementLock.lock" | "labels.elementLock.lockAll" | "labels.elementLock.unlockAll";
|
|
14
|
+
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: import("../types").AppState, elements: readonly ExcalidrawElement[]) => boolean;
|
|
15
|
+
} & {
|
|
16
|
+
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: import("../types").AppState, elements: readonly ExcalidrawElement[]) => boolean) | undefined;
|
|
17
|
+
};
|
package/types/actions/index.d.ts
CHANGED
|
@@ -14,9 +14,10 @@ export { actionAddToLibrary } from "./actionAddToLibrary";
|
|
|
14
14
|
export { actionAlignTop, actionAlignBottom, actionAlignLeft, actionAlignRight, actionAlignVerticallyCentered, actionAlignHorizontallyCentered, } from "./actionAlign";
|
|
15
15
|
export { distributeHorizontally, distributeVertically, } from "./actionDistribute";
|
|
16
16
|
export { actionFlipHorizontal, actionFlipVertical } from "./actionFlip";
|
|
17
|
-
export { actionCopy, actionCut, actionCopyAsPng, actionCopyAsSvg, } from "./actionClipboard";
|
|
17
|
+
export { actionCopy, actionCut, actionCopyAsPng, actionCopyAsSvg, copyText, } from "./actionClipboard";
|
|
18
18
|
export { actionToggleGridMode } from "./actionToggleGridMode";
|
|
19
19
|
export { actionToggleZenMode } from "./actionToggleZenMode";
|
|
20
20
|
export { actionToggleStats } from "./actionToggleStats";
|
|
21
21
|
export { actionUnbindText, actionBindText } from "./actionBoundText";
|
|
22
22
|
export { actionLink } from "../element/Hyperlink";
|
|
23
|
+
export { actionToggleLock } from "./actionToggleLock";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ActionName } from "./types";
|
|
2
|
-
export declare type ShortcutName = SubtypeOf<ActionName, "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink">;
|
|
2
|
+
export declare type ShortcutName = SubtypeOf<ActionName, "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleLock">;
|
|
3
3
|
export declare const getShortcutFromShortcutName: (name: ShortcutName) => string;
|
package/types/actions/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare type ActionResult = {
|
|
|
15
15
|
declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
16
16
|
export declare type UpdaterFn = (res: ActionResult) => void;
|
|
17
17
|
export declare type ActionFilterFn = (action: Action) => void;
|
|
18
|
-
export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser" | "bindText";
|
|
18
|
+
export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser" | "bindText" | "toggleLock";
|
|
19
19
|
export declare type PanelComponentProps = {
|
|
20
20
|
elements: readonly ExcalidrawElement[];
|
|
21
21
|
appState: AppState;
|
package/types/clipboard.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawEl
|
|
|
16
16
|
* Attempts to parse clipboard. Prefers system clipboard.
|
|
17
17
|
*/
|
|
18
18
|
export declare const parseClipboard: (event: ClipboardEvent | null) => Promise<ClipboardData>;
|
|
19
|
-
export declare const copyBlobToClipboardAsPng: (blob: Blob) => Promise<void>;
|
|
19
|
+
export declare const copyBlobToClipboardAsPng: (blob: Blob | Promise<Blob>) => Promise<void>;
|
|
20
20
|
export declare const copyTextToSystemClipboard: (text: string | null) => Promise<void>;
|
|
@@ -89,7 +89,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
89
89
|
appState?: Pick<AppState, K> | null | undefined;
|
|
90
90
|
collaborators?: SceneData["collaborators"];
|
|
91
91
|
commitToHistory?: SceneData["commitToHistory"];
|
|
92
|
-
libraryItems?:
|
|
92
|
+
libraryItems?: LibraryItems | import("../types").LibraryItems_v1 | Promise<LibraryItems | import("../types").LibraryItems_v1> | undefined;
|
|
93
93
|
}) => void;
|
|
94
94
|
private onSceneUpdated;
|
|
95
95
|
private updateCurrentCursorPosition;
|
package/types/data/blob.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
|
|
2
2
|
import { ExcalidrawElement, FileId } from "../element/types";
|
|
3
|
-
import { AppState, DataURL } from "../types";
|
|
3
|
+
import { AppState, DataURL, LibraryItem } from "../types";
|
|
4
4
|
import { FileSystemHandle } from "./filesystem";
|
|
5
|
-
import { ImportedLibraryData } from "./types";
|
|
6
5
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
7
6
|
export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
|
|
8
7
|
export declare const isImageFileHandleType: (type: string | null) => type is "svg" | "png";
|
|
@@ -11,7 +10,7 @@ export declare const isSupportedImageFile: (blob: Blob | null | undefined) => bl
|
|
|
11
10
|
type: typeof ALLOWED_IMAGE_MIME_TYPES[number];
|
|
12
11
|
};
|
|
13
12
|
export declare const loadFromBlob: (blob: Blob, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null) => Promise<import("./restore").RestoredDataState>;
|
|
14
|
-
export declare const loadLibraryFromBlob: (blob: Blob) => Promise<
|
|
13
|
+
export declare const loadLibraryFromBlob: (blob: Blob, defaultStatus?: LibraryItem["status"]) => Promise<LibraryItem[]>;
|
|
15
14
|
export declare const canvasToBlob: (canvas: HTMLCanvasElement) => Promise<Blob>;
|
|
16
15
|
/** generates SHA-1 digest from supplied file (if not supported, falls back
|
|
17
16
|
to a 40-char base64 random id) */
|
package/types/data/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AppState, BinaryFiles } from "../types";
|
|
|
4
4
|
import { FileSystemHandle } from "./filesystem";
|
|
5
5
|
export { loadFromBlob } from "./blob";
|
|
6
6
|
export { loadFromJSON, saveAsJSON } from "./json";
|
|
7
|
-
export declare const exportCanvas: (type: ExportType, elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, }: {
|
|
7
|
+
export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, }: {
|
|
8
8
|
exportBackground: boolean;
|
|
9
9
|
exportPadding?: number | undefined;
|
|
10
10
|
viewBackgroundColor: string;
|
package/types/data/json.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, BinaryFiles, LibraryItems } from "../types";
|
|
3
|
-
import { ImportedDataState } from "./types";
|
|
3
|
+
import { ImportedDataState, ImportedLibraryData } from "./types";
|
|
4
4
|
import Library from "./library";
|
|
5
5
|
export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], appState: Partial<AppState>, files: BinaryFiles, type: "local" | "database") => string;
|
|
6
6
|
export declare const saveAsJSON: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => Promise<{
|
|
@@ -12,6 +12,7 @@ export declare const isValidExcalidrawData: (data?: {
|
|
|
12
12
|
elements?: any;
|
|
13
13
|
appState?: any;
|
|
14
14
|
} | undefined) => data is ImportedDataState;
|
|
15
|
-
export declare const isValidLibrary: (json: any) =>
|
|
15
|
+
export declare const isValidLibrary: (json: any) => json is ImportedLibraryData;
|
|
16
|
+
export declare const serializeLibraryAsJSON: (libraryItems: LibraryItems) => string;
|
|
16
17
|
export declare const saveLibraryAsJSON: (libraryItems: LibraryItems) => Promise<void>;
|
|
17
18
|
export declare const importLibraryFromJSON: (library: Library) => Promise<void>;
|
package/types/data/library.d.ts
CHANGED
|
@@ -1,14 +1,97 @@
|
|
|
1
1
|
import { LibraryItems, LibraryItem } from "../types";
|
|
2
2
|
import type App from "../components/App";
|
|
3
|
+
import { ImportedDataState } from "./types";
|
|
4
|
+
export declare const libraryItemsAtom: import("jotai").Atom<{
|
|
5
|
+
status: "loading";
|
|
6
|
+
libraryItems: null;
|
|
7
|
+
promise: Promise<LibraryItems>;
|
|
8
|
+
} | {
|
|
9
|
+
status: "loaded";
|
|
10
|
+
libraryItems: LibraryItems;
|
|
11
|
+
}> & {
|
|
12
|
+
write: (get: {
|
|
13
|
+
<Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
|
|
14
|
+
<Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
|
|
15
|
+
<Value_2>(atom: import("jotai").Atom<Value_2>): Value_2 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_2;
|
|
16
|
+
} & {
|
|
17
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
|
|
18
|
+
unstable_promise: true;
|
|
19
|
+
}): Value_3 | Promise<Value_3>;
|
|
20
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
|
|
21
|
+
unstable_promise: true;
|
|
22
|
+
}): Value_4 | Promise<Value_4>;
|
|
23
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>, options: {
|
|
24
|
+
unstable_promise: true;
|
|
25
|
+
}): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
|
|
26
|
+
}, set: {
|
|
27
|
+
<Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
|
|
28
|
+
<Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
|
|
29
|
+
}, update: {
|
|
30
|
+
status: "loading";
|
|
31
|
+
libraryItems: null;
|
|
32
|
+
promise: Promise<LibraryItems>;
|
|
33
|
+
} | {
|
|
34
|
+
status: "loaded";
|
|
35
|
+
libraryItems: LibraryItems;
|
|
36
|
+
} | ((prev: {
|
|
37
|
+
status: "loading";
|
|
38
|
+
libraryItems: null;
|
|
39
|
+
promise: Promise<LibraryItems>;
|
|
40
|
+
} | {
|
|
41
|
+
status: "loaded";
|
|
42
|
+
libraryItems: LibraryItems;
|
|
43
|
+
}) => {
|
|
44
|
+
status: "loading";
|
|
45
|
+
libraryItems: null;
|
|
46
|
+
promise: Promise<LibraryItems>;
|
|
47
|
+
} | {
|
|
48
|
+
status: "loaded";
|
|
49
|
+
libraryItems: LibraryItems;
|
|
50
|
+
})) => void;
|
|
51
|
+
onMount?: (<S extends (update: {
|
|
52
|
+
status: "loading";
|
|
53
|
+
libraryItems: null;
|
|
54
|
+
promise: Promise<LibraryItems>;
|
|
55
|
+
} | {
|
|
56
|
+
status: "loaded";
|
|
57
|
+
libraryItems: LibraryItems;
|
|
58
|
+
} | ((prev: {
|
|
59
|
+
status: "loading";
|
|
60
|
+
libraryItems: null;
|
|
61
|
+
promise: Promise<LibraryItems>;
|
|
62
|
+
} | {
|
|
63
|
+
status: "loaded";
|
|
64
|
+
libraryItems: LibraryItems;
|
|
65
|
+
}) => {
|
|
66
|
+
status: "loading";
|
|
67
|
+
libraryItems: null;
|
|
68
|
+
promise: Promise<LibraryItems>;
|
|
69
|
+
} | {
|
|
70
|
+
status: "loaded";
|
|
71
|
+
libraryItems: LibraryItems;
|
|
72
|
+
})) => void>(setAtom: S) => void | (() => void)) | undefined;
|
|
73
|
+
} & {
|
|
74
|
+
init: {
|
|
75
|
+
status: "loading";
|
|
76
|
+
libraryItems: null;
|
|
77
|
+
promise: Promise<LibraryItems>;
|
|
78
|
+
} | {
|
|
79
|
+
status: "loaded";
|
|
80
|
+
libraryItems: LibraryItems;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
3
83
|
declare class Library {
|
|
4
|
-
|
|
84
|
+
/** cache for currently active promise when initializing/updating libaries
|
|
85
|
+
asynchronously */
|
|
86
|
+
private libraryItemsPromise;
|
|
87
|
+
/** last resolved libraryItems */
|
|
88
|
+
private lastLibraryItems;
|
|
5
89
|
private app;
|
|
6
90
|
constructor(app: App);
|
|
7
91
|
resetLibrary: () => Promise<void>;
|
|
8
|
-
restoreLibraryItem: (libraryItem: LibraryItem) => LibraryItem | null;
|
|
9
92
|
/** imports library (currently merges, removing duplicates) */
|
|
10
|
-
importLibrary(
|
|
93
|
+
importLibrary(library: Blob | Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>, defaultStatus?: LibraryItem["status"]): Promise<void>;
|
|
11
94
|
loadLibrary: () => Promise<LibraryItems>;
|
|
12
|
-
saveLibrary: (items: LibraryItems) => Promise<void>;
|
|
95
|
+
saveLibrary: (items: LibraryItems | Promise<LibraryItems>) => Promise<void>;
|
|
13
96
|
}
|
|
14
97
|
export default Library;
|
package/types/data/restore.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export declare type RestoredDataState = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined) => ExcalidrawElement[];
|
|
12
12
|
export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
|
|
13
|
-
export declare const restore: (data: ImportedDataState | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined) => RestoredDataState;
|
|
14
|
-
export declare const restoreLibraryItems: (libraryItems:
|
|
13
|
+
export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined) => RestoredDataState;
|
|
14
|
+
export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
|
|
15
15
|
export {};
|
|
@@ -8,10 +8,10 @@ export declare const isFreeDrawElement: (element?: ExcalidrawElement | null | un
|
|
|
8
8
|
export declare const isFreeDrawElementType: (elementType: ExcalidrawElement["type"]) => boolean;
|
|
9
9
|
export declare const isLinearElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
10
10
|
export declare const isLinearElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
11
|
-
export declare const isBindingElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
11
|
+
export declare const isBindingElement: (element?: ExcalidrawElement | null | undefined, includeLocked?: boolean) => element is ExcalidrawLinearElement;
|
|
12
12
|
export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
13
|
-
export declare const isBindableElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
|
|
14
|
-
export declare const isTextBindableContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextContainer;
|
|
13
|
+
export declare const isBindableElement: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawBindableElement;
|
|
14
|
+
export declare const isTextBindableContainer: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawTextContainer;
|
|
15
15
|
export declare const isExcalidrawElement: (element: any) => boolean;
|
|
16
16
|
export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
|
|
17
17
|
export declare const isBoundToContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextElementWithContainer;
|
package/types/element/types.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ declare type _ExcalidrawElementBase = Readonly<{
|
|
|
52
52
|
/** epoch (ms) timestamp of last element update */
|
|
53
53
|
updated: number;
|
|
54
54
|
link: string | null;
|
|
55
|
+
locked: boolean;
|
|
55
56
|
}>;
|
|
56
57
|
export declare type ExcalidrawSelectionElement = _ExcalidrawElementBase & {
|
|
57
58
|
type: "selection";
|
package/types/jotai.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export declare const jotaiScope: unique symbol;
|
|
2
|
+
export declare const jotaiStore: {
|
|
3
|
+
get: <Value>(atom: import("jotai").Atom<Value>) => (Value extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value) | undefined;
|
|
4
|
+
asyncGet: <Value_1>(atom: import("jotai").Atom<Value_1>) => Promise<Value_1 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_1>;
|
|
5
|
+
set: <Value_2, Update, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_2, Update, Result>, update: Update) => Result;
|
|
6
|
+
sub: (atom: {
|
|
7
|
+
toString: () => string;
|
|
8
|
+
debugLabel?: string | undefined;
|
|
9
|
+
read: (get: {
|
|
10
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
11
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
12
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
13
|
+
}) => unknown;
|
|
14
|
+
}, callback: () => void) => () => void;
|
|
15
|
+
SECRET_INTERNAL_store: {
|
|
16
|
+
r: <Value_6>(readingAtom: import("jotai").Atom<Value_6>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_6>;
|
|
17
|
+
w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom: import("jotai").WritableAtom<Value_1_1, Update_1, Result_1>, update: Update_1, version?: import("jotai/core/store").VersionObject | undefined) => Result_1;
|
|
18
|
+
c: (_atom: {
|
|
19
|
+
toString: () => string;
|
|
20
|
+
debugLabel?: string | undefined;
|
|
21
|
+
read: (get: {
|
|
22
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
23
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
24
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
25
|
+
}) => unknown;
|
|
26
|
+
} | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
27
|
+
s: (atom: {
|
|
28
|
+
toString: () => string;
|
|
29
|
+
debugLabel?: string | undefined;
|
|
30
|
+
read: (get: {
|
|
31
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
32
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
33
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
34
|
+
}) => unknown;
|
|
35
|
+
}, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void) => () => void;
|
|
36
|
+
h: (values: Iterable<readonly [{
|
|
37
|
+
toString: () => string;
|
|
38
|
+
debugLabel?: string | undefined;
|
|
39
|
+
read: (get: {
|
|
40
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
41
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
42
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
43
|
+
}) => unknown;
|
|
44
|
+
}, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
45
|
+
n: (l: () => void) => () => void;
|
|
46
|
+
l: () => IterableIterator<{
|
|
47
|
+
toString: () => string;
|
|
48
|
+
debugLabel?: string | undefined;
|
|
49
|
+
read: (get: {
|
|
50
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
51
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
52
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
53
|
+
}) => unknown;
|
|
54
|
+
}>;
|
|
55
|
+
a: (a: {
|
|
56
|
+
toString: () => string;
|
|
57
|
+
debugLabel?: string | undefined;
|
|
58
|
+
read: (get: {
|
|
59
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
60
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
61
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
62
|
+
}) => unknown;
|
|
63
|
+
}) => import("jotai/core/store").AtomState<unknown> | undefined;
|
|
64
|
+
m: (a: {
|
|
65
|
+
toString: () => string;
|
|
66
|
+
debugLabel?: string | undefined;
|
|
67
|
+
read: (get: {
|
|
68
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
69
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
70
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
71
|
+
}) => unknown;
|
|
72
|
+
}) => {
|
|
73
|
+
l: Set<(version?: import("jotai/core/store").VersionObject | undefined) => void>;
|
|
74
|
+
t: Set<{
|
|
75
|
+
toString: () => string;
|
|
76
|
+
debugLabel?: string | undefined;
|
|
77
|
+
read: (get: {
|
|
78
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
79
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
80
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
81
|
+
}) => unknown;
|
|
82
|
+
}>;
|
|
83
|
+
u?: (() => void) | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
} | {
|
|
86
|
+
r: <Value_7>(readingAtom: import("jotai").Atom<Value_7>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_7>;
|
|
87
|
+
w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom: import("jotai").WritableAtom<Value_1_2, Update_2, Result_2>, update: Update_2, version?: import("jotai/core/store").VersionObject | undefined) => Result_2;
|
|
88
|
+
c: (_atom: {
|
|
89
|
+
toString: () => string;
|
|
90
|
+
debugLabel?: string | undefined;
|
|
91
|
+
read: (get: {
|
|
92
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
93
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
94
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
95
|
+
}) => unknown;
|
|
96
|
+
} | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
97
|
+
s: (atom: {
|
|
98
|
+
toString: () => string;
|
|
99
|
+
debugLabel?: string | undefined;
|
|
100
|
+
read: (get: {
|
|
101
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
102
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
103
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
104
|
+
}) => unknown;
|
|
105
|
+
}, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void) => () => void;
|
|
106
|
+
h: (values: Iterable<readonly [{
|
|
107
|
+
toString: () => string;
|
|
108
|
+
debugLabel?: string | undefined;
|
|
109
|
+
read: (get: {
|
|
110
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
111
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
112
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
113
|
+
}) => unknown;
|
|
114
|
+
}, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
115
|
+
n?: undefined;
|
|
116
|
+
l?: undefined;
|
|
117
|
+
a?: undefined;
|
|
118
|
+
m?: undefined;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -8,11 +8,12 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
|
|
|
8
8
|
export default _default;
|
|
9
9
|
export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
|
|
10
10
|
export { defaultLang, languages } from "../../i18n";
|
|
11
|
-
export { restore, restoreElements,
|
|
12
|
-
export { exportToBlob, exportToCanvas, exportToSvg, serializeAsJSON, loadLibraryFromBlob, loadFromBlob, getFreeDrawSvgPath, } from "../../packages/utils";
|
|
11
|
+
export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "../../data/restore";
|
|
12
|
+
export { exportToBlob, exportToCanvas, exportToSvg, serializeAsJSON, serializeLibraryAsJSON, loadLibraryFromBlob, loadFromBlob, getFreeDrawSvgPath, } from "../../packages/utils";
|
|
13
13
|
export { isLinearElement } from "../../element/typeChecks";
|
|
14
14
|
export { mutateElement, newElementWith, bumpVersion, } from "../../element/mutateElement";
|
|
15
15
|
export { FONT_FAMILY, THEME } from "../../constants";
|
|
16
16
|
export { exportToClipboard } from "../utils";
|
|
17
17
|
export { getDefaultAppState } from "../../appState";
|
|
18
18
|
export { cleanAppStateForExport, clearAppStateForLocalStorage, } from "../../appState";
|
|
19
|
+
export { jotaiScope, jotaiStore } from "../../jotai";
|
|
@@ -19,10 +19,10 @@ export declare const exportToBlob: (opts: ExportOpts & {
|
|
|
19
19
|
export declare const exportToSvg: ({ elements, appState, files, exportPadding, }: Omit<ExportOpts, "getDimensions"> & {
|
|
20
20
|
exportPadding?: number | undefined;
|
|
21
21
|
}) => Promise<SVGSVGElement>;
|
|
22
|
+
export { serializeAsJSON, serializeLibraryAsJSON } from "../data/json";
|
|
22
23
|
export declare const exportToClipboard: (opts: ExportOpts & {
|
|
23
24
|
mimeType?: string;
|
|
24
25
|
quality?: number;
|
|
25
26
|
}) => Promise<void>;
|
|
26
|
-
export { serializeAsJSON } from "../data/json";
|
|
27
27
|
export { loadFromBlob, loadLibraryFromBlob } from "../data/blob";
|
|
28
28
|
export { getFreeDrawSvgPath } from "../renderer/renderElement";
|
package/types/types.d.ts
CHANGED
|
@@ -173,15 +173,16 @@ export declare type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
|
|
|
173
173
|
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
174
174
|
ready?: false;
|
|
175
175
|
};
|
|
176
|
-
declare type
|
|
176
|
+
export declare type ExcalidrawInitialDataState = Merge<ImportedDataState, {
|
|
177
177
|
scrollX?: number;
|
|
178
178
|
scrollY?: number;
|
|
179
|
-
|
|
179
|
+
libraryItems?: Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>;
|
|
180
|
+
}>;
|
|
180
181
|
export interface ExcalidrawProps {
|
|
181
182
|
id?: string | null;
|
|
182
183
|
onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles, id?: string | null) => void;
|
|
184
|
+
initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
|
|
183
185
|
onHomeButtonClick?: () => void;
|
|
184
|
-
initialData?: InitialData | null | Promise<InitialData | null>;
|
|
185
186
|
user?: {
|
|
186
187
|
name?: string | null;
|
|
187
188
|
};
|
|
@@ -352,4 +353,3 @@ export declare type DeviceType = {
|
|
|
352
353
|
isMobile: boolean;
|
|
353
354
|
isTouchScreen: boolean;
|
|
354
355
|
};
|
|
355
|
-
export {};
|
package/types/utils.d.ts
CHANGED
|
@@ -120,3 +120,4 @@ export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) =
|
|
|
120
120
|
export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
|
|
121
121
|
export declare const isPrimitive: (val: any) => boolean;
|
|
122
122
|
export declare const getFrame: () => "top" | "iframe";
|
|
123
|
+
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkExcalidraw=self.webpackChunkExcalidraw||[]).push([[9],{673:(e,t,r)=>{r.r(t),r.d(t,{decodePngMetadata:()=>h,decodeSvgMetadata:()=>E,encodePngMetadata:()=>x,encodeSvgMetadata:()=>A,getTEXtChunk:()=>p});var n=r(2983),a=r.n(n),o=r(1194),c=r(3434),d=r.n(c),i=r(2744),s=r(8288);const w=e=>new Promise(((t,r)=>{const n="string"==typeof e?new Blob([(new TextEncoder).encode(e)]):new Blob([e instanceof Uint8Array?e:new Uint8Array(e)]),a=new FileReader;a.onload=e=>{if(!e.target||"string"!=typeof e.target.result)return r(new Error("couldn't convert to byte string"));t(e.target.result)},a.readAsBinaryString(n)})),l=e=>{const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0,n=e.length;t<n;t++)r[t]=e.charCodeAt(t);return t},y=e=>new TextDecoder("utf-8").decode(l(e)),u=async e=>{let t,{text:r,compress:n}=e;if(!1!==n)try{t=await w((0,i.deflate)(r))}catch(e){console.error("encode: cannot deflate",e)}return{version:"1",encoding:"bstring",compressed:!!t,encoded:t||await w(r)}},f=async e=>{let t;if("bstring"!==e.encoding)throw new Error('decode: unknown encoding "'.concat(e.encoding,'"'));return t=e.compressed?e.encoded:await y(e.encoded),e.compressed?(0,i.inflate)(new Uint8Array(l(t)),{to:"string"}):t};const g=e=>"arrayBuffer"in e?e.arrayBuffer():new Promise(((t,r)=>{const n=new FileReader;n.onload=e=>{var n;if(null===(n=e.target)||void 0===n||!n.result)return r(new Error("couldn't convert blob to ArrayBuffer"));t(e.target.result)},n.readAsArrayBuffer(e)})),p=async e=>{const t=a()(new Uint8Array(await g(e))).find((e=>"tEXt"===e.name));return t?o.decode(t.data):null},x=async e=>{let{blob:t,metadata:r}=e;const n=a()(new Uint8Array(await g(t))),c=o.encode(s.LO.excalidraw,JSON.stringify(await u({text:r,compress:!0})));return n.splice(-1,0,c),new Blob([d()(n)],{type:s.LO.png})},h=async e=>{const t=await p(e);if((null==t?void 0:t.keyword)===s.LO.excalidraw)try{const e=JSON.parse(t.text);if(!("encoded"in e)){if("type"in e&&e.type===s.r8.excalidraw)return t.text;throw new Error("FAILED")}return await f(e)}catch(e){throw console.error(e),new Error("FAILED")}throw new Error("INVALID")},A=async e=>{let{text:t}=e;const r=await async function(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?window.btoa(e):window.btoa(await w(e))}(JSON.stringify(await u({text:t})),!0);let n="";return n+="\x3c!-- payload-type:".concat(s.LO.excalidraw," --\x3e"),n+="\x3c!-- payload-version:2 --\x3e",n+="\x3c!-- payload-start --\x3e",n+=r,n+="\x3c!-- payload-end --\x3e",n},E=async e=>{let{svg:t}=e;if(t.includes("payload-type:".concat(s.LO.excalidraw))){const e=t.match(/<!-- payload-start -->(.+?)<!-- payload-end -->/);if(!e)throw new Error("INVALID");const r=t.match(/<!-- payload-version:(\d+) -->/),n="1"!==((null==r?void 0:r[1])||"1");try{const t=await async function(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?window.atob(e):y(window.atob(e))}(e[1],n),r=JSON.parse(t);if(!("encoded"in r)){if("type"in r&&r.type===s.r8.excalidraw)return t;throw new Error("FAILED")}return await f(r)}catch(e){throw console.error(e),new Error("FAILED")}}throw new Error("INVALID")}}}]);
|