@dwelle/excalidraw 0.3.17 → 0.3.21
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 +11 -0
- package/README_NEXT.md +2 -17
- package/dist/excalidraw-assets/image-0db17e06143a31f9772b.js +1 -0
- package/dist/excalidraw-assets/image-6f8d3b9873832b5f7a67.js +1 -0
- package/dist/excalidraw-assets/image-a26261fb8a718f15853e.js +1 -0
- package/dist/excalidraw-assets/vendor-64ea3ed78bc76a895e61.js +2 -0
- package/dist/excalidraw-assets/vendor-64ea3ed78bc76a895e61.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/vendor-e5c6cd57013e8e575a61.js +1 -0
- package/dist/excalidraw-assets-dev/image-469d5bd946743969995a.js +42 -0
- package/dist/excalidraw-assets-dev/image-821afe7d20de2d2ca898.js +42 -0
- package/dist/excalidraw-assets-dev/vendor-a449655791956f151f51.js +344 -0
- package/dist/excalidraw.development.js +252 -91
- package/dist/excalidraw.production.min.js +1 -2
- package/dist/excalidraw.production.min.js.LICENSE.txt +9 -0
- package/package.json +11 -8
- package/types/actions/manager.d.ts +0 -1
- package/types/actions/types.d.ts +0 -1
- package/types/appState.d.ts +5 -5
- package/types/clipboard.d.ts +0 -2
- package/types/components/Actions.d.ts +0 -1
- package/types/components/App.d.ts +0 -1
- package/types/components/Avatar.d.ts +0 -1
- package/types/components/ButtonIconSelect.d.ts +0 -1
- package/types/components/CheckboxItem.d.ts +2 -1
- package/types/components/ClearCanvas.d.ts +0 -1
- package/types/components/ConfirmDialog.d.ts +11 -0
- package/types/components/ContextMenu.d.ts +0 -2
- package/types/components/Dialog.d.ts +4 -2
- package/types/components/Island.d.ts +0 -1
- package/types/components/JSONExportDialog.d.ts +0 -1
- package/types/components/LayerUI.d.ts +0 -1
- 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/MobileMenu.d.ts +0 -1
- package/types/components/Modal.d.ts +1 -0
- package/types/components/PasteChartDialog.d.ts +1 -1
- package/types/components/Popover.d.ts +0 -1
- package/types/components/PublishLibrary.d.ts +17 -0
- package/types/components/Section.d.ts +0 -1
- package/types/components/SingleLibraryItem.d.ts +11 -0
- package/types/components/ToolButton.d.ts +5 -0
- package/types/components/Tooltip.d.ts +2 -1
- package/types/components/icons.d.ts +1 -1
- package/types/constants.d.ts +5 -0
- package/types/data/blob.d.ts +5 -3
- package/types/data/encryption.d.ts +3 -4
- package/types/data/filesystem.d.ts +2 -3
- package/types/data/json.d.ts +2 -2
- package/types/data/library.d.ts +1 -1
- package/types/data/restore.d.ts +2 -1
- package/types/data/types.d.ts +7 -4
- package/types/element/binding.d.ts +0 -2
- package/types/element/bounds.d.ts +8 -1
- package/types/element/image.d.ts +0 -2
- package/types/element/index.d.ts +0 -3
- package/types/element/linearElementEditor.d.ts +0 -1
- package/types/element/mutateElement.d.ts +1 -1
- package/types/element/newElement.d.ts +1 -1
- package/types/element/textWysiwyg.d.ts +0 -2
- package/types/element/types.d.ts +2 -0
- package/types/errors.d.ts +0 -1
- package/types/i18n.d.ts +1 -1
- package/types/keys.d.ts +0 -2
- package/types/packages/excalidraw/dist/excalidraw-assets/image-0db17e06143a31f9772b.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/image-6f8d3b9873832b5f7a67.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/image-a26261fb8a718f15853e.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-64ea3ed78bc76a895e61.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-ce466849186c701b6c48.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-e5c6cd57013e8e575a61.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-469d5bd946743969995a.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-a449655791956f151f51.d.ts +0 -0
- package/types/packages/excalidraw/env.d.ts +1 -0
- package/types/packages/excalidraw/index.d.ts +1 -1
- package/types/packages/excalidraw/webpack.dev.config.d.ts +1 -1
- package/types/packages/excalidraw/webpack.prod.config.d.ts +0 -2
- package/types/packages/utils.d.ts +5 -6
- package/types/renderer/renderElement.d.ts +4 -6
- package/types/renderer/renderScene.d.ts +4 -11
- package/types/renderer/roundRect.d.ts +0 -1
- package/types/scene/export.d.ts +0 -2
- package/types/scene/scroll.d.ts +0 -2
- package/types/scene/types.d.ts +15 -8
- package/types/scene/zoom.d.ts +0 -1
- package/types/types.d.ts +14 -2
- package/types/utils.d.ts +10 -2
|
@@ -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.21",
|
|
4
4
|
"main": "main.js",
|
|
5
5
|
"types": "types/packages/excalidraw/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -40,24 +40,24 @@
|
|
|
40
40
|
"@babel/core": "7.16.0",
|
|
41
41
|
"@babel/plugin-transform-arrow-functions": "7.16.0",
|
|
42
42
|
"@babel/plugin-transform-async-to-generator": "7.16.0",
|
|
43
|
-
"@babel/plugin-transform-runtime": "7.16.
|
|
43
|
+
"@babel/plugin-transform-runtime": "7.16.4",
|
|
44
44
|
"@babel/plugin-transform-typescript": "7.16.1",
|
|
45
|
-
"@babel/preset-env": "7.16.
|
|
45
|
+
"@babel/preset-env": "7.16.4",
|
|
46
46
|
"@babel/preset-react": "7.16.0",
|
|
47
47
|
"@babel/preset-typescript": "7.16.0",
|
|
48
48
|
"autoprefixer": "10.4.0",
|
|
49
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": "6.5.
|
|
52
|
+
"css-loader": "6.5.1",
|
|
53
53
|
"file-loader": "6.2.0",
|
|
54
|
-
"mini-css-extract-plugin": "2.4.
|
|
54
|
+
"mini-css-extract-plugin": "2.4.5",
|
|
55
55
|
"postcss-loader": "6.2.0",
|
|
56
56
|
"sass-loader": "12.3.0",
|
|
57
|
-
"terser-webpack-plugin": "5.2.
|
|
57
|
+
"terser-webpack-plugin": "5.2.5",
|
|
58
58
|
"ts-loader": "9.2.6",
|
|
59
|
-
"typescript": "4.
|
|
60
|
-
"webpack": "5.
|
|
59
|
+
"typescript": "4.5.2",
|
|
60
|
+
"webpack": "5.64.3",
|
|
61
61
|
"webpack-bundle-analyzer": "4.5.0",
|
|
62
62
|
"webpack-cli": "4.9.1"
|
|
63
63
|
},
|
|
@@ -68,5 +68,8 @@
|
|
|
68
68
|
"build:umd": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js && cross-env NODE_ENV=development webpack --config webpack.dev.config.js && yarn gen:types",
|
|
69
69
|
"build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
|
|
70
70
|
"pack": "yarn build:umd && yarn pack"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"dotenv": "10.0.0"
|
|
71
74
|
}
|
|
72
75
|
}
|
package/types/actions/types.d.ts
CHANGED
package/types/appState.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AppState, NormalizedZoomValue } from "./types";
|
|
2
2
|
export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
3
3
|
export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
|
|
4
|
-
|
|
4
|
+
scrollX?: number | undefined;
|
|
5
|
+
scrollY?: number | undefined;
|
|
6
|
+
viewBackgroundColor?: string | undefined;
|
|
5
7
|
zoom?: Readonly<{
|
|
6
8
|
value: NormalizedZoomValue;
|
|
7
9
|
translation: Readonly<{
|
|
@@ -9,8 +11,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
9
11
|
y: number;
|
|
10
12
|
}>;
|
|
11
13
|
}> | undefined;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
15
|
+
theme?: string | undefined;
|
|
14
16
|
name?: string | undefined;
|
|
15
17
|
elementType?: "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "text" | "arrow" | "freedraw" | undefined;
|
|
16
18
|
elementLocked?: boolean | undefined;
|
|
@@ -32,7 +34,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
32
34
|
currentItemStartArrowhead?: import("./element/types").Arrowhead | null | undefined;
|
|
33
35
|
currentItemEndArrowhead?: import("./element/types").Arrowhead | null | undefined;
|
|
34
36
|
currentItemLinearStrokeSharpness?: import("./element/types").StrokeSharpness | undefined;
|
|
35
|
-
viewBackgroundColor?: string | undefined;
|
|
36
37
|
cursorButton?: "up" | "down" | undefined;
|
|
37
38
|
scrolledOutside?: boolean | undefined;
|
|
38
39
|
openMenu?: "canvas" | "shape" | null | undefined;
|
|
@@ -43,7 +44,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
43
44
|
previousSelectedElementIds?: {
|
|
44
45
|
[id: string]: boolean;
|
|
45
46
|
} | undefined;
|
|
46
|
-
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
47
47
|
zenModeEnabled?: boolean | undefined;
|
|
48
48
|
gridSize?: number | null | undefined;
|
|
49
49
|
selectedGroupIds?: {
|
package/types/clipboard.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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"], event: React.MouseEvent) => 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, event: React.MouseEvent) => 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;
|
|
@@ -4,6 +4,7 @@ declare type TooltipProps = {
|
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
label: string;
|
|
6
6
|
long?: boolean;
|
|
7
|
+
style?: React.CSSProperties;
|
|
7
8
|
};
|
|
8
|
-
export declare const Tooltip: ({ children, label, long }: TooltipProps) => JSX.Element;
|
|
9
|
+
export declare const Tooltip: ({ children, label, long, style, }: TooltipProps) => JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="web" />
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { Theme } from "../element/types";
|
|
4
3
|
declare type Opts = {
|
|
@@ -165,5 +164,6 @@ export declare const TextAlignCenterIcon: React.MemoExoticComponent<({ theme }:
|
|
|
165
164
|
export declare const TextAlignRightIcon: React.MemoExoticComponent<({ theme }: {
|
|
166
165
|
theme: Theme;
|
|
167
166
|
}) => JSX.Element>;
|
|
167
|
+
export declare const publishIcon: JSX.Element;
|
|
168
168
|
export declare const home: JSX.Element;
|
|
169
169
|
export {};
|
package/types/constants.d.ts
CHANGED
|
@@ -129,3 +129,8 @@ 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;
|
|
133
|
+
export declare const VERSIONS: {
|
|
134
|
+
readonly excalidraw: 2;
|
|
135
|
+
readonly excalidrawLibrary: 2;
|
|
136
|
+
};
|
package/types/data/blob.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/// <reference types="web" />
|
|
3
1
|
import { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
|
|
4
2
|
import { ExcalidrawElement, FileId } from "../element/types";
|
|
5
3
|
import { AppState, DataURL } from "../types";
|
|
@@ -20,7 +18,11 @@ export declare const canvasToBlob: (canvas: HTMLCanvasElement) => Promise<Blob>;
|
|
|
20
18
|
export declare const generateIdFromFile: (file: File) => Promise<FileId>;
|
|
21
19
|
export declare const getDataURL: (file: Blob | File) => Promise<DataURL>;
|
|
22
20
|
export declare const dataURLToFile: (dataURL: DataURL, filename?: string) => File;
|
|
23
|
-
export declare const resizeImageFile: (file: File,
|
|
21
|
+
export declare const resizeImageFile: (file: File, opts: {
|
|
22
|
+
/** undefined indicates auto */
|
|
23
|
+
outputType?: typeof MIME_TYPES["jpg"];
|
|
24
|
+
maxWidthOrHeight: number;
|
|
25
|
+
}) => Promise<File>;
|
|
24
26
|
export declare const SVGStringToFile: (SVGString: string, filename?: string) => File & {
|
|
25
27
|
type: typeof MIME_TYPES.svg;
|
|
26
28
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/// <reference types="web" />
|
|
2
1
|
export declare const IV_LENGTH_BYTES = 12;
|
|
3
2
|
export declare const createIV: () => Uint8Array;
|
|
4
|
-
export declare const generateEncryptionKey: () => Promise<
|
|
5
|
-
export declare const
|
|
6
|
-
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<{
|
|
7
6
|
encryptedBuffer: ArrayBuffer;
|
|
8
7
|
iv: Uint8Array;
|
|
9
8
|
}>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/// <reference types="web" />
|
|
2
1
|
import { FileWithHandle, FileSystemHandle, supported as nativeFileSystemSupported } from "browser-fs-access";
|
|
3
2
|
declare type FILE_EXTENSION = "gif" | "jpg" | "png" | "svg" | "json" | "excalidraw" | "excalidrawlib";
|
|
4
3
|
export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
|
|
5
4
|
extensions?: FILE_EXTENSION[] | undefined;
|
|
6
|
-
description
|
|
5
|
+
description: string;
|
|
7
6
|
multiple?: M | undefined;
|
|
8
7
|
}) => Promise<M extends false | undefined ? FileWithHandle : FileWithHandle[]>;
|
|
9
8
|
export declare const fileSave: (blob: Blob, opts: {
|
|
@@ -11,7 +10,7 @@ export declare const fileSave: (blob: Blob, opts: {
|
|
|
11
10
|
name: string;
|
|
12
11
|
/** file extension */
|
|
13
12
|
extension: FILE_EXTENSION;
|
|
14
|
-
description
|
|
13
|
+
description: string;
|
|
15
14
|
/** existing FileSystemHandle */
|
|
16
15
|
fileHandle?: FileSystemHandle | null;
|
|
17
16
|
}) => Promise<FileSystemHandle | null>;
|
package/types/data/json.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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;
|
|
@@ -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/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,6 +1,7 @@
|
|
|
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
|
+
import { VERSIONS } from "../constants";
|
|
4
5
|
export interface ExportedDataState {
|
|
5
6
|
type: string;
|
|
6
7
|
version: number;
|
|
@@ -16,14 +17,16 @@ export interface ImportedDataState {
|
|
|
16
17
|
elements?: readonly ExcalidrawElement[] | null;
|
|
17
18
|
appState?: Readonly<Partial<AppState>> | null;
|
|
18
19
|
scrollToContent?: boolean;
|
|
19
|
-
libraryItems?: LibraryItems;
|
|
20
|
+
libraryItems?: LibraryItems | LibraryItems_v1;
|
|
20
21
|
files?: BinaryFiles;
|
|
21
22
|
}
|
|
22
23
|
export interface ExportedLibraryData {
|
|
23
24
|
type: string;
|
|
24
|
-
version:
|
|
25
|
+
version: typeof VERSIONS.excalidrawLibrary;
|
|
25
26
|
source: string;
|
|
26
|
-
|
|
27
|
+
libraryItems: LibraryItems;
|
|
27
28
|
}
|
|
28
29
|
export interface ImportedLibraryData extends Partial<ExportedLibraryData> {
|
|
30
|
+
/** @deprecated v1 */
|
|
31
|
+
library?: LibraryItems;
|
|
29
32
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/// <reference types="web" />
|
|
3
1
|
import { ExcalidrawLinearElement, ExcalidrawBindableElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawElement } from "./types";
|
|
4
2
|
import { AppState } from "../types";
|
|
5
3
|
import Scene from "../scene/Scene";
|
|
@@ -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/image.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/// <reference types="web" />
|
|
3
1
|
import { AppClassProperties, DataURL, BinaryFiles } from "../types";
|
|
4
2
|
import { ExcalidrawElement, FileId, InitializedExcalidrawImageElement } from "./types";
|
|
5
3
|
export declare const loadHTMLImageElement: (dataURL: DataURL) => Promise<HTMLImageElement>;
|
package/types/element/index.d.ts
CHANGED
|
@@ -11,9 +11,6 @@ export { textWysiwyg } from "./textWysiwyg";
|
|
|
11
11
|
export { redrawTextBoundingBox } from "./textElement";
|
|
12
12
|
export { getPerfectElementSize, isInvisiblySmallElement, resizePerfectLineForNWHandler, getNormalizedDimensions, } from "./sizeHelpers";
|
|
13
13
|
export { showSelectedShapeActions } from "./showSelectedShapeActions";
|
|
14
|
-
export declare const getElementMap: (elements: readonly ExcalidrawElement[]) => {
|
|
15
|
-
[key: string]: ExcalidrawElement;
|
|
16
|
-
};
|
|
17
14
|
export declare const getSceneVersion: (elements: readonly ExcalidrawElement[]) => number;
|
|
18
15
|
export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
|
|
19
16
|
export declare const getNonDeletedElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
|
|
@@ -3,7 +3,7 @@ declare type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TE
|
|
|
3
3
|
export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
4
4
|
export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>) => TElement;
|
|
5
5
|
/**
|
|
6
|
-
* Mutates element
|
|
6
|
+
* Mutates element, bumping `version`, `versionNonce`, and `updated`.
|
|
7
7
|
*
|
|
8
8
|
* NOTE: does not trigger re-render.
|
|
9
9
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
|
-
declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted">, "width" | "height" | "angle" | "groupIds" | "boundElementIds" | "seed" | "version" | "versionNonce">;
|
|
3
|
+
declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElementIds" | "seed" | "version" | "versionNonce">;
|
|
4
4
|
export declare const newElement: (opts: {
|
|
5
5
|
type: ExcalidrawGenericElement["type"];
|
|
6
6
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/// <reference types="web" />
|
|
3
1
|
import { ExcalidrawElement } from "./types";
|
|
4
2
|
import { AppState } from "../types";
|
|
5
3
|
export declare const textWysiwyg: ({ id, appState, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, }: {
|
package/types/element/types.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ declare type _ExcalidrawElementBase = Readonly<{
|
|
|
45
45
|
groupIds: readonly GroupId[];
|
|
46
46
|
/** Ids of (linear) elements that are bound to this element. */
|
|
47
47
|
boundElementIds: readonly ExcalidrawLinearElement["id"][] | null;
|
|
48
|
+
/** epoch (ms) timestamp of last element update */
|
|
49
|
+
updated: number;
|
|
48
50
|
}>;
|
|
49
51
|
export declare type ExcalidrawSelectionElement = _ExcalidrawElementBase & {
|
|
50
52
|
type: "selection";
|
package/types/errors.d.ts
CHANGED