@dwelle/excalidraw 0.3.15 → 0.3.19
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/0adeb55dfbca17fad22e.woff2 +1 -0
- package/dist/be42d56e500bdd14ae50.woff2 +1 -0
- package/dist/d9454a7bea9e32f0c282.woff2 +1 -0
- package/dist/edf7912ad1921efb0e5c.woff2 +1 -0
- package/dist/excalidraw-assets/image-a26261fb8a718f15853e.js +1 -0
- package/dist/excalidraw-assets/vendor-405364e1fdefedf5d3d7.js +2 -0
- package/dist/excalidraw-assets/vendor-405364e1fdefedf5d3d7.js.LICENSE.txt +14 -0
- package/dist/excalidraw-assets/vendor-807e23d7531555236936.js +2 -0
- package/dist/excalidraw-assets/vendor-807e23d7531555236936.js.LICENSE.txt +14 -0
- package/dist/excalidraw-assets/vendor-ce466849186c701b6c48.js +2 -0
- package/dist/excalidraw-assets/vendor-ce466849186c701b6c48.js.LICENSE.txt +14 -0
- package/dist/excalidraw-assets-dev/image-664005f0b02c93342b89.js +42 -0
- package/dist/excalidraw-assets-dev/image-821afe7d20de2d2ca898.js +42 -0
- package/dist/excalidraw-assets-dev/vendor-7fcb99cece261da4983f.js +344 -0
- package/dist/excalidraw-assets-dev/vendor-a449655791956f151f51.js +344 -0
- package/dist/excalidraw-assets-dev/vendor-ec7db14ff9ba640888c4.js +344 -0
- package/dist/excalidraw.development.js +399 -203
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +9 -0
- package/package.json +21 -21
- package/types/appState.d.ts +1 -1
- package/types/components/CheckboxItem.d.ts +1 -0
- package/types/components/ClearCanvas.d.ts +0 -1
- package/types/components/ConfirmDialog.d.ts +11 -0
- package/types/components/Dialog.d.ts +4 -2
- package/types/components/HintViewer.d.ts +3 -2
- package/types/components/LibraryMenu.d.ts +18 -0
- package/types/components/LibraryMenuItems.d.ts +22 -0
- package/types/components/LibraryUnit.d.ts +6 -4
- package/types/components/Modal.d.ts +1 -0
- package/types/components/PasteChartDialog.d.ts +1 -1
- package/types/components/PublishLibrary.d.ts +17 -0
- package/types/components/SingleLibraryItem.d.ts +11 -0
- package/types/components/ToolButton.d.ts +5 -0
- package/types/components/icons.d.ts +5 -0
- package/types/constants.d.ts +1 -0
- package/types/data/encryption.d.ts +3 -3
- package/types/data/filesystem.d.ts +3 -3
- package/types/data/json.d.ts +3 -3
- package/types/data/library.d.ts +1 -1
- package/types/data/resave.d.ts +1 -1
- package/types/data/restore.d.ts +2 -1
- package/types/data/types.d.ts +6 -4
- package/types/element/bounds.d.ts +8 -1
- package/types/element/types.d.ts +1 -1
- package/types/i18n.d.ts +1 -1
- package/types/packages/excalidraw/dist/excalidraw-assets/image-a26261fb8a718f15853e.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-405364e1fdefedf5d3d7.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-807e23d7531555236936.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-ce466849186c701b6c48.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-664005f0b02c93342b89.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-821afe7d20de2d2ca898.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-7fcb99cece261da4983f.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-a449655791956f151f51.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-ec7db14ff9ba640888c4.d.ts +0 -0
- package/types/packages/excalidraw/webpack.prod.config.d.ts +1 -1
- package/types/packages/utils.d.ts +2 -2
- package/types/types.d.ts +14 -1
- package/types/utils.d.ts +2 -0
|
@@ -4,6 +4,15 @@ object-assign
|
|
|
4
4
|
@license MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Lodash <https://lodash.com/>
|
|
10
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
11
|
+
* Released under MIT license <https://lodash.com/license>
|
|
12
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
13
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
14
|
+
*/
|
|
15
|
+
|
|
7
16
|
/** @license React v17.0.2
|
|
8
17
|
* react-jsx-runtime.production.min.js
|
|
9
18
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dwelle/excalidraw",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"main": "main.js",
|
|
5
5
|
"types": "types/packages/excalidraw/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -37,29 +37,29 @@
|
|
|
37
37
|
"react-dom": "^17.0.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@babel/core": "7.
|
|
41
|
-
"@babel/plugin-transform-arrow-functions": "7.
|
|
42
|
-
"@babel/plugin-transform-async-to-generator": "7.
|
|
43
|
-
"@babel/plugin-transform-runtime": "7.
|
|
44
|
-
"@babel/plugin-transform-typescript": "7.
|
|
45
|
-
"@babel/preset-env": "7.
|
|
46
|
-
"@babel/preset-react": "7.
|
|
47
|
-
"@babel/preset-typescript": "7.
|
|
48
|
-
"autoprefixer": "10.
|
|
49
|
-
"babel-loader": "8.2.
|
|
40
|
+
"@babel/core": "7.16.0",
|
|
41
|
+
"@babel/plugin-transform-arrow-functions": "7.16.0",
|
|
42
|
+
"@babel/plugin-transform-async-to-generator": "7.16.0",
|
|
43
|
+
"@babel/plugin-transform-runtime": "7.16.0",
|
|
44
|
+
"@babel/plugin-transform-typescript": "7.16.1",
|
|
45
|
+
"@babel/preset-env": "7.16.0",
|
|
46
|
+
"@babel/preset-react": "7.16.0",
|
|
47
|
+
"@babel/preset-typescript": "7.16.0",
|
|
48
|
+
"autoprefixer": "10.4.0",
|
|
49
|
+
"babel-loader": "8.2.3",
|
|
50
50
|
"babel-plugin-transform-class-properties": "6.24.1",
|
|
51
51
|
"cross-env": "7.0.3",
|
|
52
|
-
"css-loader": "5.
|
|
52
|
+
"css-loader": "6.5.1",
|
|
53
53
|
"file-loader": "6.2.0",
|
|
54
|
-
"mini-css-extract-plugin": "
|
|
55
|
-
"postcss-loader": "6.
|
|
56
|
-
"sass-loader": "12.
|
|
57
|
-
"terser-webpack-plugin": "5.
|
|
58
|
-
"ts-loader": "9.2.
|
|
59
|
-
"typescript": "4.
|
|
60
|
-
"webpack": "5.
|
|
61
|
-
"webpack-bundle-analyzer": "4.
|
|
62
|
-
"webpack-cli": "4.
|
|
54
|
+
"mini-css-extract-plugin": "2.4.4",
|
|
55
|
+
"postcss-loader": "6.2.0",
|
|
56
|
+
"sass-loader": "12.3.0",
|
|
57
|
+
"terser-webpack-plugin": "5.2.5",
|
|
58
|
+
"ts-loader": "9.2.6",
|
|
59
|
+
"typescript": "4.5.2",
|
|
60
|
+
"webpack": "5.64.0",
|
|
61
|
+
"webpack-bundle-analyzer": "4.5.0",
|
|
62
|
+
"webpack-cli": "4.9.1"
|
|
63
63
|
},
|
|
64
64
|
"repository": "https://github.com/dwelle/excalidraw",
|
|
65
65
|
"homepage": "https://github.com/excalidraw/excalidraw/tree/master/src/packages/excalidraw",
|
package/types/appState.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
11
11
|
}> | undefined;
|
|
12
12
|
scrollX?: number | undefined;
|
|
13
13
|
scrollY?: number | undefined;
|
|
14
|
+
name?: string | undefined;
|
|
14
15
|
elementType?: "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "text" | "arrow" | "freedraw" | undefined;
|
|
15
16
|
elementLocked?: boolean | undefined;
|
|
16
17
|
exportBackground?: boolean | undefined;
|
|
@@ -34,7 +35,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
34
35
|
viewBackgroundColor?: string | undefined;
|
|
35
36
|
cursorButton?: "up" | "down" | undefined;
|
|
36
37
|
scrolledOutside?: boolean | undefined;
|
|
37
|
-
name?: string | undefined;
|
|
38
38
|
openMenu?: "canvas" | "shape" | null | undefined;
|
|
39
39
|
lastPointerDownWith?: import("./element/types").PointerType | undefined;
|
|
40
40
|
selectedElementIds?: {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DialogProps } from "./Dialog";
|
|
3
|
+
import "./ConfirmDialog.scss";
|
|
4
|
+
interface Props extends Omit<DialogProps, "onCloseRequest"> {
|
|
5
|
+
onConfirm: () => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
confirmText?: string;
|
|
8
|
+
cancelText?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const ConfirmDialog: (props: Props) => JSX.Element;
|
|
11
|
+
export default ConfirmDialog;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./Dialog.scss";
|
|
3
3
|
import { AppState } from "../types";
|
|
4
|
-
export
|
|
4
|
+
export interface DialogProps {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
className?: string;
|
|
7
7
|
small?: boolean;
|
|
@@ -9,4 +9,6 @@ export declare const Dialog: (props: {
|
|
|
9
9
|
title: React.ReactNode;
|
|
10
10
|
autofocus?: boolean;
|
|
11
11
|
theme?: AppState["theme"];
|
|
12
|
-
|
|
12
|
+
closeOnClickOutside?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const Dialog: (props: DialogProps) => JSX.Element;
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
3
3
|
import "./HintViewer.scss";
|
|
4
4
|
import { AppState } from "../types";
|
|
5
|
-
interface
|
|
5
|
+
interface HintViewerProps {
|
|
6
6
|
appState: AppState;
|
|
7
7
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
8
|
+
isMobile: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare const HintViewer: ({ appState, elements }:
|
|
10
|
+
export declare const HintViewer: ({ appState, elements, isMobile, }: HintViewerProps) => JSX.Element | null;
|
|
10
11
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import Library from "../data/library";
|
|
3
|
+
import { LibraryItem, AppState, BinaryFiles, ExcalidrawProps } from "../types";
|
|
4
|
+
import "./LibraryMenu.scss";
|
|
5
|
+
export declare const LibraryMenu: ({ onClose, onInsertShape, pendingElements, onAddToLibrary, theme, setAppState, files, libraryReturnUrl, focusContainer, library, id, appState, }: {
|
|
6
|
+
pendingElements: LibraryItem["elements"];
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
onInsertShape: (elements: LibraryItem["elements"]) => void;
|
|
9
|
+
onAddToLibrary: () => void;
|
|
10
|
+
theme: AppState["theme"];
|
|
11
|
+
files: BinaryFiles;
|
|
12
|
+
setAppState: React.Component<any, AppState>["setState"];
|
|
13
|
+
libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
|
|
14
|
+
focusContainer: () => void;
|
|
15
|
+
library: Library;
|
|
16
|
+
id: string;
|
|
17
|
+
appState: AppState;
|
|
18
|
+
}) => JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import Library from "../data/library";
|
|
3
|
+
import { AppState, BinaryFiles, ExcalidrawProps, LibraryItem, LibraryItems } from "../types";
|
|
4
|
+
import "./LibraryMenuItems.scss";
|
|
5
|
+
declare const LibraryMenuItems: ({ libraryItems, onRemoveFromLibrary, onAddToLibrary, onInsertShape, pendingElements, theme, setAppState, libraryReturnUrl, library, files, id, selectedItems, onToggle, onPublish, resetLibrary, }: {
|
|
6
|
+
libraryItems: LibraryItems;
|
|
7
|
+
pendingElements: LibraryItem["elements"];
|
|
8
|
+
onRemoveFromLibrary: () => void;
|
|
9
|
+
onInsertShape: (elements: LibraryItem["elements"]) => void;
|
|
10
|
+
onAddToLibrary: (elements: LibraryItem["elements"]) => void;
|
|
11
|
+
theme: AppState["theme"];
|
|
12
|
+
files: BinaryFiles;
|
|
13
|
+
setAppState: React.Component<any, AppState>["setState"];
|
|
14
|
+
libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
|
|
15
|
+
library: Library;
|
|
16
|
+
id: string;
|
|
17
|
+
selectedItems: LibraryItem["id"][];
|
|
18
|
+
onToggle: (id: LibraryItem["id"]) => void;
|
|
19
|
+
onPublish: () => void;
|
|
20
|
+
resetLibrary: () => void;
|
|
21
|
+
}) => JSX.Element;
|
|
22
|
+
export default LibraryMenuItems;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BinaryFiles, LibraryItem } from "../types";
|
|
3
3
|
import "./LibraryUnit.scss";
|
|
4
|
-
export declare const LibraryUnit: ({ elements, files,
|
|
5
|
-
|
|
4
|
+
export declare const LibraryUnit: ({ id, elements, files, isPending, onClick, selected, onToggle, }: {
|
|
5
|
+
id: LibraryItem["id"] | /** for pending item */ null;
|
|
6
|
+
elements?: readonly import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | undefined;
|
|
6
7
|
files: BinaryFiles;
|
|
7
|
-
|
|
8
|
-
onRemoveFromLibrary: () => void;
|
|
8
|
+
isPending?: boolean | undefined;
|
|
9
9
|
onClick: () => void;
|
|
10
|
+
selected: boolean;
|
|
11
|
+
onToggle: (id: string) => void;
|
|
10
12
|
}) => JSX.Element;
|
|
@@ -5,5 +5,5 @@ export declare const PasteChartDialog: ({ setAppState, appState, onClose, onInse
|
|
|
5
5
|
appState: AppState;
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
setAppState: React.Component<any, AppState>["setState"];
|
|
8
|
-
onInsertChart: (elements: LibraryItem) => void;
|
|
8
|
+
onInsertChart: (elements: LibraryItem["elements"]) => void;
|
|
9
9
|
}) => JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AppState, LibraryItems } from "../types";
|
|
3
|
+
import "./PublishLibrary.scss";
|
|
4
|
+
declare const PublishLibrary: ({ onClose, libraryItems, appState, onSuccess, onError, updateItemsInStorage, onRemove, }: {
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
libraryItems: LibraryItems;
|
|
7
|
+
appState: AppState;
|
|
8
|
+
onSuccess: (data: {
|
|
9
|
+
url: string;
|
|
10
|
+
authorName: string;
|
|
11
|
+
items: LibraryItems;
|
|
12
|
+
}) => void;
|
|
13
|
+
onError: (error: Error) => void;
|
|
14
|
+
updateItemsInStorage: (items: LibraryItems) => void;
|
|
15
|
+
onRemove: (id: string) => void;
|
|
16
|
+
}) => JSX.Element;
|
|
17
|
+
export default PublishLibrary;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AppState, LibraryItem } from "../types";
|
|
3
|
+
import "./SingleLibraryItem.scss";
|
|
4
|
+
declare const SingleLibraryItem: ({ libItem, appState, index, onChange, onRemove, }: {
|
|
5
|
+
libItem: LibraryItem;
|
|
6
|
+
appState: AppState;
|
|
7
|
+
index: number;
|
|
8
|
+
onChange: (val: string, index: number) => void;
|
|
9
|
+
onRemove: (id: string) => void;
|
|
10
|
+
}) => JSX.Element;
|
|
11
|
+
export default SingleLibraryItem;
|
|
@@ -18,11 +18,16 @@ declare type ToolButtonBaseProps = {
|
|
|
18
18
|
visible?: boolean;
|
|
19
19
|
selected?: boolean;
|
|
20
20
|
className?: string;
|
|
21
|
+
isLoading?: boolean;
|
|
21
22
|
};
|
|
22
23
|
declare type ToolButtonProps = (ToolButtonBaseProps & {
|
|
23
24
|
type: "button";
|
|
24
25
|
children?: React.ReactNode;
|
|
25
26
|
onClick?(event: React.MouseEvent): void;
|
|
27
|
+
}) | (ToolButtonBaseProps & {
|
|
28
|
+
type: "submit";
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
onClick?(event: React.MouseEvent): void;
|
|
26
31
|
}) | (ToolButtonBaseProps & {
|
|
27
32
|
type: "icon";
|
|
28
33
|
children?: React.ReactNode;
|
|
@@ -130,6 +130,10 @@ export declare const ArrowheadBarIcon: React.MemoExoticComponent<({ theme, flip
|
|
|
130
130
|
theme: Theme;
|
|
131
131
|
flip?: boolean | undefined;
|
|
132
132
|
}) => JSX.Element>;
|
|
133
|
+
export declare const ArrowheadTriangleIcon: React.MemoExoticComponent<({ theme, flip }: {
|
|
134
|
+
theme: Theme;
|
|
135
|
+
flip?: boolean | undefined;
|
|
136
|
+
}) => JSX.Element>;
|
|
133
137
|
export declare const FontSizeSmallIcon: React.MemoExoticComponent<({ theme }: {
|
|
134
138
|
theme: Theme;
|
|
135
139
|
}) => JSX.Element>;
|
|
@@ -160,5 +164,6 @@ export declare const TextAlignCenterIcon: React.MemoExoticComponent<({ theme }:
|
|
|
160
164
|
export declare const TextAlignRightIcon: React.MemoExoticComponent<({ theme }: {
|
|
161
165
|
theme: Theme;
|
|
162
166
|
}) => JSX.Element>;
|
|
167
|
+
export declare const publishIcon: JSX.Element;
|
|
163
168
|
export declare const home: JSX.Element;
|
|
164
169
|
export {};
|
package/types/constants.d.ts
CHANGED
|
@@ -129,3 +129,4 @@ export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
|
|
|
129
129
|
export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif"];
|
|
130
130
|
export declare const MAX_ALLOWED_FILE_BYTES: number;
|
|
131
131
|
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
132
|
+
export declare const ENCRYPTION_KEY_BITS = 128;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const IV_LENGTH_BYTES = 12;
|
|
2
2
|
export declare const createIV: () => Uint8Array;
|
|
3
|
-
export declare const generateEncryptionKey: () => Promise<
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const encryptData: (key: string, data: Uint8Array | ArrayBuffer | Blob | File | string) => Promise<{
|
|
3
|
+
export declare const generateEncryptionKey: <T extends "string" | "cryptoKey" = "string">(returnAs?: T | undefined) => Promise<T extends "cryptoKey" ? CryptoKey : string>;
|
|
4
|
+
export declare const getCryptoKey: (key: string, usage: KeyUsage) => Promise<CryptoKey>;
|
|
5
|
+
export declare const encryptData: (key: string | CryptoKey, data: Uint8Array | ArrayBuffer | Blob | File | string) => Promise<{
|
|
6
6
|
encryptedBuffer: ArrayBuffer;
|
|
7
7
|
iv: Uint8Array;
|
|
8
8
|
}>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FileWithHandle, FileSystemHandle, supported as nativeFileSystemSupported } from "
|
|
1
|
+
import { FileWithHandle, FileSystemHandle, supported as nativeFileSystemSupported } from "browser-fs-access";
|
|
2
2
|
declare type FILE_EXTENSION = "gif" | "jpg" | "png" | "svg" | "json" | "excalidraw" | "excalidrawlib";
|
|
3
3
|
export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
|
|
4
4
|
extensions?: FILE_EXTENSION[] | undefined;
|
|
5
|
-
description
|
|
5
|
+
description: string;
|
|
6
6
|
multiple?: M | undefined;
|
|
7
7
|
}) => Promise<M extends false | undefined ? FileWithHandle : FileWithHandle[]>;
|
|
8
8
|
export declare const fileSave: (blob: Blob, opts: {
|
|
@@ -10,7 +10,7 @@ export declare const fileSave: (blob: Blob, opts: {
|
|
|
10
10
|
name: string;
|
|
11
11
|
/** file extension */
|
|
12
12
|
extension: FILE_EXTENSION;
|
|
13
|
-
description
|
|
13
|
+
description: string;
|
|
14
14
|
/** existing FileSystemHandle */
|
|
15
15
|
fileHandle?: FileSystemHandle | null;
|
|
16
16
|
}) => Promise<FileSystemHandle | null>;
|
package/types/data/json.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState, BinaryFiles } from "../types";
|
|
2
|
+
import { AppState, BinaryFiles, LibraryItems } from "../types";
|
|
3
3
|
import { ImportedDataState } 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<{
|
|
7
|
-
fileHandle: import("
|
|
7
|
+
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
8
8
|
}>;
|
|
9
9
|
export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<import("./restore").RestoredDataState>;
|
|
10
10
|
export declare const isValidExcalidrawData: (data?: {
|
|
@@ -13,5 +13,5 @@ export declare const isValidExcalidrawData: (data?: {
|
|
|
13
13
|
appState?: any;
|
|
14
14
|
} | undefined) => data is ImportedDataState;
|
|
15
15
|
export declare const isValidLibrary: (json: any) => any;
|
|
16
|
-
export declare const saveLibraryAsJSON: (
|
|
16
|
+
export declare const saveLibraryAsJSON: (libraryItems: LibraryItems) => Promise<void>;
|
|
17
17
|
export declare const importLibraryFromJSON: (library: Library) => Promise<void>;
|
package/types/data/library.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare class Library {
|
|
|
7
7
|
resetLibrary: () => Promise<void>;
|
|
8
8
|
restoreLibraryItem: (libraryItem: LibraryItem) => LibraryItem | null;
|
|
9
9
|
/** imports library (currently merges, removing duplicates) */
|
|
10
|
-
importLibrary(blob: Blob): Promise<void>;
|
|
10
|
+
importLibrary(blob: Blob, defaultStatus?: string): Promise<void>;
|
|
11
11
|
loadLibrary: () => Promise<LibraryItems>;
|
|
12
12
|
saveLibrary: (items: LibraryItems) => Promise<void>;
|
|
13
13
|
}
|
package/types/data/resave.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, BinaryFiles } from "../types";
|
|
3
3
|
export declare const resaveAsImageWithScene: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => Promise<{
|
|
4
|
-
fileHandle: import("
|
|
4
|
+
fileHandle: import("browser-fs-access").FileSystemHandle;
|
|
5
5
|
}>;
|
package/types/data/restore.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState, BinaryFiles } from "../types";
|
|
2
|
+
import { AppState, BinaryFiles, LibraryItem } from "../types";
|
|
3
3
|
import { ImportedDataState } from "./types";
|
|
4
4
|
declare type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
5
5
|
export declare const AllowedExcalidrawElementTypes: Record<ExcalidrawElement["type"], true>;
|
|
@@ -11,4 +11,5 @@ export declare type RestoredDataState = {
|
|
|
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
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: NonOptional<ImportedDataState["libraryItems"]>, defaultStatus: LibraryItem["status"]) => LibraryItem[];
|
|
14
15
|
export {};
|
package/types/data/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState, BinaryFiles, LibraryItems } from "../types";
|
|
2
|
+
import { AppState, BinaryFiles, LibraryItems, LibraryItems_v1 } from "../types";
|
|
3
3
|
import type { cleanAppStateForExport } from "../appState";
|
|
4
4
|
export interface ExportedDataState {
|
|
5
5
|
type: string;
|
|
@@ -16,14 +16,16 @@ export interface ImportedDataState {
|
|
|
16
16
|
elements?: readonly ExcalidrawElement[] | null;
|
|
17
17
|
appState?: Readonly<Partial<AppState>> | null;
|
|
18
18
|
scrollToContent?: boolean;
|
|
19
|
-
libraryItems?: LibraryItems;
|
|
19
|
+
libraryItems?: LibraryItems | LibraryItems_v1;
|
|
20
20
|
files?: BinaryFiles;
|
|
21
21
|
}
|
|
22
22
|
export interface ExportedLibraryData {
|
|
23
23
|
type: string;
|
|
24
|
-
version:
|
|
24
|
+
version: 2;
|
|
25
25
|
source: string;
|
|
26
|
-
|
|
26
|
+
libraryItems: LibraryItems;
|
|
27
27
|
}
|
|
28
28
|
export interface ImportedLibraryData extends Partial<ExportedLibraryData> {
|
|
29
|
+
/** @deprecated v1 */
|
|
30
|
+
library?: LibraryItems;
|
|
29
31
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead } from "./types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, NonDeleted } from "./types";
|
|
2
2
|
import { Drawable, Op } from "roughjs/bin/core";
|
|
3
3
|
export declare type Bounds = readonly [number, number, number, number];
|
|
4
4
|
export declare const getElementAbsoluteCoords: (element: ExcalidrawElement) => Bounds;
|
|
@@ -14,3 +14,10 @@ export declare const getClosestElementBounds: (elements: readonly ExcalidrawElem
|
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
16
16
|
}) => [number, number, number, number];
|
|
17
|
+
export interface Box {
|
|
18
|
+
minX: number;
|
|
19
|
+
minY: number;
|
|
20
|
+
maxX: number;
|
|
21
|
+
maxY: number;
|
|
22
|
+
}
|
|
23
|
+
export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => Box;
|
package/types/element/types.d.ts
CHANGED
|
@@ -96,7 +96,7 @@ export declare type PointBinding = {
|
|
|
96
96
|
focus: number;
|
|
97
97
|
gap: number;
|
|
98
98
|
};
|
|
99
|
-
export declare type Arrowhead = "arrow" | "bar" | "dot";
|
|
99
|
+
export declare type Arrowhead = "arrow" | "bar" | "dot" | "triangle";
|
|
100
100
|
export declare type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
|
|
101
101
|
type: "line" | "arrow";
|
|
102
102
|
points: readonly Point[];
|
package/types/i18n.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export declare const languages: Language[];
|
|
|
11
11
|
export declare const setLanguage: (lang: Language) => Promise<void>;
|
|
12
12
|
export declare const getLanguage: () => Language;
|
|
13
13
|
export declare const t: (path: string, replacement?: {
|
|
14
|
-
[key: string]: string;
|
|
14
|
+
[key: string]: string | number;
|
|
15
15
|
} | undefined) => string;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -65,7 +65,7 @@ export namespace module {
|
|
|
65
65
|
}
|
|
66
66
|
export namespace optimization {
|
|
67
67
|
const minimize: boolean;
|
|
68
|
-
const minimizer:
|
|
68
|
+
const minimizer: import("terser-webpack-plugin/types").default<import("terser").MinifyOptions>[];
|
|
69
69
|
namespace splitChunks {
|
|
70
70
|
const chunks: string;
|
|
71
71
|
namespace cacheGroups {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppState, BinaryFiles } from "../types";
|
|
2
|
-
import { ExcalidrawElement } from "../element/types";
|
|
2
|
+
import { ExcalidrawElement, NonDeleted } from "../element/types";
|
|
3
3
|
declare type ExportOpts = {
|
|
4
|
-
elements: readonly ExcalidrawElement[];
|
|
4
|
+
elements: readonly NonDeleted<ExcalidrawElement>[];
|
|
5
5
|
appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
|
|
6
6
|
files: BinaryFiles | null;
|
|
7
7
|
getDimensions?: (width: number, height: number) => {
|
package/types/types.d.ts
CHANGED
|
@@ -152,7 +152,20 @@ export declare class GestureEvent extends UIEvent {
|
|
|
152
152
|
readonly rotation: number;
|
|
153
153
|
readonly scale: number;
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
/** @deprecated legacy: do not use outside of migration paths */
|
|
156
|
+
export declare type LibraryItem_v1 = readonly NonDeleted<ExcalidrawElement>[];
|
|
157
|
+
/** @deprecated legacy: do not use outside of migration paths */
|
|
158
|
+
export declare type LibraryItems_v1 = readonly LibraryItem_v1[];
|
|
159
|
+
/** v2 library item */
|
|
160
|
+
export declare type LibraryItem = {
|
|
161
|
+
id: string;
|
|
162
|
+
status: "published" | "unpublished";
|
|
163
|
+
elements: readonly NonDeleted<ExcalidrawElement>[];
|
|
164
|
+
/** timestamp in epoch (ms) */
|
|
165
|
+
created: number;
|
|
166
|
+
name?: string;
|
|
167
|
+
error?: string;
|
|
168
|
+
};
|
|
156
169
|
export declare type LibraryItems = readonly LibraryItem[];
|
|
157
170
|
export declare type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
|
|
158
171
|
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
package/types/utils.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeo
|
|
|
24
24
|
flush(): void;
|
|
25
25
|
cancel(): void;
|
|
26
26
|
};
|
|
27
|
+
export declare const chunk: <T extends unknown>(array: T[], size: number) => T[][];
|
|
27
28
|
export declare const selectNode: (node: Element) => void;
|
|
28
29
|
export declare const removeSelection: () => void;
|
|
29
30
|
export declare const distance: (x: number, y: number) => number;
|
|
@@ -92,3 +93,4 @@ export declare const supportsEmoji: () => boolean;
|
|
|
92
93
|
export declare const getNearestScrollableContainer: (element: HTMLElement) => HTMLElement | Document;
|
|
93
94
|
export declare const focusNearestParent: (element: HTMLInputElement) => void;
|
|
94
95
|
export declare const preventUnload: (event: BeforeUnloadEvent) => void;
|
|
96
|
+
export declare const bytesToHexString: (bytes: Uint8Array) => string;
|