@zsviczian/excalidraw 0.9.0-obsidian-9 → 0.9.0-obsidian-image-support-2
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 +3 -2
- package/dist/excalidraw-assets-dev/{image-cacb3d0c02eb2e346ecc.js → image-2767e46ad3f3f29617ea.js} +0 -10
- package/dist/excalidraw-assets-dev/vendor-b648d92c35e91de1648e.js +323 -0
- package/dist/excalidraw.development.js +327 -42
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +115 -0
- package/package.json +1 -1
- package/types/actions/actionCanvas.d.ts +3 -1
- package/types/actions/manager.d.ts +3 -11
- package/types/actions/types.d.ts +2 -8
- package/types/appState.d.ts +59 -4
- package/types/components/Actions.d.ts +5 -2
- package/types/components/App.d.ts +20 -5
- package/types/components/LayerUI.d.ts +4 -1
- package/types/components/LibraryUnit.d.ts +3 -2
- package/types/components/MobileMenu.d.ts +4 -1
- package/types/components/Spinner.d.ts +7 -0
- package/types/components/ToolButton.d.ts +5 -2
- package/types/constants.d.ts +1 -0
- package/types/createInverseContext.d.ts +1 -0
- package/types/data/blob.d.ts +3 -1
- package/types/data/encode.d.ts +2 -1
- package/types/data/json.d.ts +1 -1
- package/types/element/collision.d.ts +2 -2
- package/types/element/dragElements.d.ts +1 -1
- package/types/element/image.d.ts +13 -0
- package/types/element/index.d.ts +2 -1
- package/types/element/mutateElement.d.ts +1 -1
- package/types/element/newElement.d.ts +6 -2
- package/types/element/resizeElements.d.ts +3 -3
- package/types/element/typeChecks.d.ts +2 -1
- package/types/element/types.d.ts +14 -2
- package/types/errors.d.ts +3 -0
- package/types/excalidraw-app/app_constants.d.ts +19 -0
- package/types/excalidraw-app/collab/CollabWrapper.d.ts +92 -0
- package/types/excalidraw-app/collab/Portal.d.ts +28 -0
- package/types/excalidraw-app/collab/RoomDialog.d.ts +14 -0
- package/types/excalidraw-app/data/FileSync.d.ts +39 -0
- package/types/excalidraw-app/data/firebase.d.ts +22 -0
- package/types/excalidraw-app/data/index.d.ts +161 -0
- package/types/excalidraw-app/data/localStorage.d.ts +98 -0
- package/types/keys.d.ts +4 -3
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-2767e46ad3f3f29617ea.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-b648d92c35e91de1648e.d.ts +0 -0
- package/types/packages/utils.d.ts +1 -1
- package/types/renderer/renderElement.d.ts +3 -2
- package/types/renderer/renderScene.d.ts +3 -2
- package/types/scene/export.d.ts +2 -1
- package/types/scene/types.d.ts +4 -3
- package/types/shapes.d.ts +5 -1
- package/types/types.d.ts +23 -1
- package/types/zindex.d.ts +2 -2
- package/dist/excalidraw-assets-dev/vendor-7ad6c104c3421ae6511d.js +0 -356
|
@@ -1 +1,116 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
/*! *****************************************************************************
|
|
17
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
19
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
20
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
|
|
22
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
23
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
24
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
25
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
26
|
+
|
|
27
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
28
|
+
and limitations under the License.
|
|
29
|
+
***************************************************************************** */
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @license
|
|
33
|
+
* Copyright 2017 Google LLC
|
|
34
|
+
*
|
|
35
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
36
|
+
* you may not use this file except in compliance with the License.
|
|
37
|
+
* You may obtain a copy of the License at
|
|
38
|
+
*
|
|
39
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
40
|
+
*
|
|
41
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
42
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
43
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
|
+
* See the License for the specific language governing permissions and
|
|
45
|
+
* limitations under the License.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @license
|
|
50
|
+
* Copyright 2018 Google LLC
|
|
51
|
+
*
|
|
52
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
53
|
+
* you may not use this file except in compliance with the License.
|
|
54
|
+
* You may obtain a copy of the License at
|
|
55
|
+
*
|
|
56
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
57
|
+
*
|
|
58
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
59
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
60
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
61
|
+
* See the License for the specific language governing permissions and
|
|
62
|
+
* limitations under the License.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @license
|
|
67
|
+
* Copyright 2019 Google LLC
|
|
68
|
+
*
|
|
69
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
70
|
+
* you may not use this file except in compliance with the License.
|
|
71
|
+
* You may obtain a copy of the License at
|
|
72
|
+
*
|
|
73
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
74
|
+
*
|
|
75
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
76
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
77
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
78
|
+
* See the License for the specific language governing permissions and
|
|
79
|
+
* limitations under the License.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @license
|
|
84
|
+
* Copyright 2020 Google LLC
|
|
85
|
+
*
|
|
86
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
87
|
+
* you may not use this file except in compliance with the License.
|
|
88
|
+
* You may obtain a copy of the License at
|
|
89
|
+
*
|
|
90
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
91
|
+
*
|
|
92
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
93
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
94
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
95
|
+
* See the License for the specific language governing permissions and
|
|
96
|
+
* limitations under the License.
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @license
|
|
101
|
+
* Copyright 2021 Google LLC
|
|
102
|
+
*
|
|
103
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
104
|
+
* you may not use this file except in compliance with the License.
|
|
105
|
+
* You may obtain a copy of the License at
|
|
106
|
+
*
|
|
107
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
108
|
+
*
|
|
109
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
110
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
111
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
112
|
+
* See the License for the specific language governing permissions and
|
|
113
|
+
* limitations under the License.
|
|
114
|
+
*/
|
|
115
|
+
|
|
1
116
|
// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
|
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ export declare const zoomToFitElements: (elements: readonly ExcalidrawElement[],
|
|
|
16
16
|
}>;
|
|
17
17
|
scrollX: number;
|
|
18
18
|
scrollY: number;
|
|
19
|
+
files: Record<string, import("../types").BinaryFileData>;
|
|
19
20
|
isLoading: boolean;
|
|
20
21
|
errorMessage: string | null;
|
|
21
22
|
draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
@@ -27,7 +28,7 @@ export declare const zoomToFitElements: (elements: readonly ExcalidrawElement[],
|
|
|
27
28
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
28
29
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
29
30
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
30
|
-
elementType: "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "text" | "arrow" | "freedraw";
|
|
31
|
+
elementType: "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "text" | "arrow" | "freedraw";
|
|
31
32
|
elementLocked: boolean;
|
|
32
33
|
exportBackground: boolean;
|
|
33
34
|
exportEmbedScene: boolean;
|
|
@@ -89,6 +90,7 @@ export declare const zoomToFitElements: (elements: readonly ExcalidrawElement[],
|
|
|
89
90
|
shown: true;
|
|
90
91
|
data: import("../charts").Spreadsheet;
|
|
91
92
|
};
|
|
93
|
+
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
92
94
|
};
|
|
93
95
|
commitToHistory: boolean;
|
|
94
96
|
};
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Action, ActionsManagerInterface, UpdaterFn, ActionName, ActionResult, PanelComponentProps } from "./types";
|
|
3
3
|
import { ExcalidrawElement } from "../element/types";
|
|
4
|
-
import {
|
|
5
|
-
import Library from "../data/library";
|
|
6
|
-
declare type App = {
|
|
7
|
-
canvas: HTMLCanvasElement | null;
|
|
8
|
-
focusContainer: () => void;
|
|
9
|
-
props: AppProps;
|
|
10
|
-
library: Library;
|
|
11
|
-
};
|
|
4
|
+
import { AppClassProperties, AppState } from "../types";
|
|
12
5
|
export declare class ActionManager implements ActionsManagerInterface {
|
|
13
6
|
actions: Record<ActionName, Action>;
|
|
14
7
|
updater: (actionResult: ActionResult | Promise<ActionResult>) => void;
|
|
15
8
|
getAppState: () => Readonly<AppState>;
|
|
16
9
|
getElementsIncludingDeleted: () => readonly ExcalidrawElement[];
|
|
17
|
-
app:
|
|
18
|
-
constructor(updater: UpdaterFn, getAppState: () => AppState, getElementsIncludingDeleted: () => readonly ExcalidrawElement[], app:
|
|
10
|
+
app: AppClassProperties;
|
|
11
|
+
constructor(updater: UpdaterFn, getAppState: () => AppState, getElementsIncludingDeleted: () => readonly ExcalidrawElement[], app: AppClassProperties);
|
|
19
12
|
registerAction(action: Action): void;
|
|
20
13
|
registerAll(actions: readonly Action[]): void;
|
|
21
14
|
handleKeyDown(event: React.KeyboardEvent | KeyboardEvent): boolean;
|
|
@@ -25,4 +18,3 @@ export declare class ActionManager implements ActionsManagerInterface {
|
|
|
25
18
|
*/
|
|
26
19
|
renderAction: (name: ActionName, data?: PanelComponentProps["data"]) => JSX.Element | null;
|
|
27
20
|
}
|
|
28
|
-
export {};
|
package/types/actions/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ExcalidrawElement } from "../element/types";
|
|
3
|
-
import { AppState, ExcalidrawProps } from "../types";
|
|
4
|
-
import Library from "../data/library";
|
|
3
|
+
import { AppClassProperties, AppState, ExcalidrawProps } from "../types";
|
|
5
4
|
import { ToolButtonSize } from "../components/ToolButton";
|
|
6
5
|
/** if false, the action should be prevented */
|
|
7
6
|
export declare type ActionResult = {
|
|
@@ -10,12 +9,7 @@ export declare type ActionResult = {
|
|
|
10
9
|
commitToHistory: boolean;
|
|
11
10
|
syncHistory?: boolean;
|
|
12
11
|
} | false;
|
|
13
|
-
declare type
|
|
14
|
-
canvas: HTMLCanvasElement | null;
|
|
15
|
-
focusContainer(): void;
|
|
16
|
-
library: Library;
|
|
17
|
-
};
|
|
18
|
-
declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppAPI) => ActionResult | Promise<ActionResult>;
|
|
12
|
+
declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
19
13
|
export declare type UpdaterFn = (res: ActionResult) => void;
|
|
20
14
|
export declare type ActionFilterFn = (action: Action) => void;
|
|
21
15
|
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" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme";
|
package/types/appState.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ExcalidrawElement } from "./element/types";
|
|
1
2
|
import { AppState, NormalizedZoomValue } from "./types";
|
|
2
3
|
export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
3
|
-
export declare const clearAppStateForLocalStorage: (appState: Partial<AppState
|
|
4
|
+
export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>, elements: readonly ExcalidrawElement[]) => {
|
|
5
|
+
theme?: "light" | "dark" | undefined;
|
|
4
6
|
zoom?: Readonly<{
|
|
5
7
|
value: NormalizedZoomValue;
|
|
6
8
|
translation: Readonly<{
|
|
@@ -10,7 +12,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
10
12
|
}> | undefined;
|
|
11
13
|
scrollX?: number | undefined;
|
|
12
14
|
scrollY?: number | undefined;
|
|
13
|
-
elementType?: "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "text" | "arrow" | "freedraw" | undefined;
|
|
15
|
+
elementType?: "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "text" | "arrow" | "freedraw" | undefined;
|
|
14
16
|
elementLocked?: boolean | undefined;
|
|
15
17
|
exportBackground?: boolean | undefined;
|
|
16
18
|
exportEmbedScene?: boolean | undefined;
|
|
@@ -44,7 +46,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
44
46
|
} | undefined;
|
|
45
47
|
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
46
48
|
zenModeEnabled?: boolean | undefined;
|
|
47
|
-
theme?: "light" | "dark" | undefined;
|
|
48
49
|
gridSize?: number | null | undefined;
|
|
49
50
|
selectedGroupIds?: {
|
|
50
51
|
[groupId: string]: boolean;
|
|
@@ -53,7 +54,61 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
53
54
|
showStats?: boolean | undefined;
|
|
54
55
|
currentChartType?: import("./element/types").ChartType | undefined;
|
|
55
56
|
};
|
|
56
|
-
export declare const cleanAppStateForExport: (appState: Partial<AppState
|
|
57
|
+
export declare const cleanAppStateForExport: (appState: Partial<AppState>, elements: readonly ExcalidrawElement[]) => {
|
|
58
|
+
files?: Record<string, import("./types").BinaryFileData> | undefined;
|
|
57
59
|
viewBackgroundColor?: string | undefined;
|
|
58
60
|
gridSize?: number | null | undefined;
|
|
59
61
|
};
|
|
62
|
+
export declare const clearAppStateForDatabase: (appState: Partial<AppState>, elements: readonly ExcalidrawElement[]) => {
|
|
63
|
+
theme?: "light" | "dark" | undefined;
|
|
64
|
+
zoom?: Readonly<{
|
|
65
|
+
value: NormalizedZoomValue;
|
|
66
|
+
translation: Readonly<{
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
}>;
|
|
70
|
+
}> | undefined;
|
|
71
|
+
scrollX?: number | undefined;
|
|
72
|
+
scrollY?: number | undefined;
|
|
73
|
+
elementType?: "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "text" | "arrow" | "freedraw" | undefined;
|
|
74
|
+
elementLocked?: boolean | undefined;
|
|
75
|
+
exportBackground?: boolean | undefined;
|
|
76
|
+
exportEmbedScene?: boolean | undefined;
|
|
77
|
+
exportWithDarkMode?: boolean | undefined;
|
|
78
|
+
exportScale?: number | undefined;
|
|
79
|
+
currentItemStrokeColor?: string | undefined;
|
|
80
|
+
currentItemBackgroundColor?: string | undefined;
|
|
81
|
+
currentItemFillStyle?: import("./element/types").FillStyle | undefined;
|
|
82
|
+
currentItemStrokeWidth?: number | undefined;
|
|
83
|
+
currentItemStrokeStyle?: import("./element/types").StrokeStyle | undefined;
|
|
84
|
+
currentItemRoughness?: number | undefined;
|
|
85
|
+
currentItemOpacity?: number | undefined;
|
|
86
|
+
currentItemFontFamily?: number | undefined;
|
|
87
|
+
currentItemFontSize?: number | undefined;
|
|
88
|
+
currentItemTextAlign?: import("./element/types").TextAlign | undefined;
|
|
89
|
+
currentItemStrokeSharpness?: import("./element/types").StrokeSharpness | undefined;
|
|
90
|
+
currentItemStartArrowhead?: import("./element/types").Arrowhead | null | undefined;
|
|
91
|
+
currentItemEndArrowhead?: import("./element/types").Arrowhead | null | undefined;
|
|
92
|
+
currentItemLinearStrokeSharpness?: import("./element/types").StrokeSharpness | undefined;
|
|
93
|
+
viewBackgroundColor?: string | undefined;
|
|
94
|
+
cursorButton?: "up" | "down" | undefined;
|
|
95
|
+
scrolledOutside?: boolean | undefined;
|
|
96
|
+
name?: string | undefined;
|
|
97
|
+
openMenu?: "canvas" | "shape" | null | undefined;
|
|
98
|
+
lastPointerDownWith?: import("./element/types").PointerType | undefined;
|
|
99
|
+
selectedElementIds?: {
|
|
100
|
+
[id: string]: boolean;
|
|
101
|
+
} | undefined;
|
|
102
|
+
previousSelectedElementIds?: {
|
|
103
|
+
[id: string]: boolean;
|
|
104
|
+
} | undefined;
|
|
105
|
+
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
106
|
+
zenModeEnabled?: boolean | undefined;
|
|
107
|
+
gridSize?: number | null | undefined;
|
|
108
|
+
selectedGroupIds?: {
|
|
109
|
+
[groupId: string]: boolean;
|
|
110
|
+
} | undefined;
|
|
111
|
+
editingGroupId?: string | null | undefined;
|
|
112
|
+
showStats?: boolean | undefined;
|
|
113
|
+
currentChartType?: import("./element/types").ChartType | undefined;
|
|
114
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ActionManager } from "../actions/manager";
|
|
3
|
-
import { ExcalidrawElement } from "../element/types";
|
|
3
|
+
import { ExcalidrawElement, PointerType } from "../element/types";
|
|
4
4
|
import { AppState, Zoom } from "../types";
|
|
5
5
|
export declare const SelectedShapeActions: ({ appState, elements, renderAction, elementType, }: {
|
|
6
6
|
appState: AppState;
|
|
@@ -8,10 +8,13 @@ export declare const SelectedShapeActions: ({ appState, elements, renderAction,
|
|
|
8
8
|
renderAction: ActionManager["renderAction"];
|
|
9
9
|
elementType: ExcalidrawElement["type"];
|
|
10
10
|
}) => JSX.Element;
|
|
11
|
-
export declare const ShapesSwitcher: ({ canvas, elementType, setAppState, }: {
|
|
11
|
+
export declare const ShapesSwitcher: ({ canvas, elementType, setAppState, onImageAction, }: {
|
|
12
12
|
canvas: HTMLCanvasElement | null;
|
|
13
13
|
elementType: ExcalidrawElement["type"];
|
|
14
14
|
setAppState: React.Component<any, AppState>["setState"];
|
|
15
|
+
onImageAction: (data: {
|
|
16
|
+
pointerType: PointerType | null;
|
|
17
|
+
}) => void;
|
|
15
18
|
}) => JSX.Element;
|
|
16
19
|
export declare const ZoomActions: ({ renderAction, zoom, }: {
|
|
17
20
|
renderAction: ActionManager["renderAction"];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { RoughCanvas } from "roughjs/bin/canvas";
|
|
3
3
|
import { ActionManager } from "../actions/manager";
|
|
4
|
-
import Library from "../data/library";
|
|
5
4
|
import { ExcalidrawElement } from "../element/types";
|
|
6
5
|
import History from "../history";
|
|
7
|
-
import { AppProps, AppState, LibraryItems, SceneData } from "../types";
|
|
6
|
+
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, LibraryItems, SceneData } from "../types";
|
|
8
7
|
export declare const useIsMobile: () => boolean;
|
|
9
8
|
export declare const useExcalidrawContainer: () => {
|
|
10
9
|
container: HTMLDivElement | null;
|
|
11
10
|
id: string | null;
|
|
12
11
|
};
|
|
13
12
|
declare class App extends React.Component<AppProps, AppState> {
|
|
14
|
-
canvas:
|
|
13
|
+
canvas: AppClassProperties["canvas"];
|
|
15
14
|
rc: RoughCanvas | null;
|
|
16
15
|
unmounted: boolean;
|
|
17
16
|
actionManager: ActionManager;
|
|
@@ -22,15 +21,16 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
22
21
|
private scene;
|
|
23
22
|
private resizeObserver;
|
|
24
23
|
private nearestScrollableContainer;
|
|
25
|
-
library:
|
|
24
|
+
library: AppClassProperties["library"];
|
|
26
25
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
27
26
|
private id;
|
|
28
27
|
private history;
|
|
29
28
|
private excalidrawContainerValue;
|
|
29
|
+
imageCache: AppClassProperties["imageCache"];
|
|
30
30
|
constructor(props: AppProps);
|
|
31
31
|
private renderCanvas;
|
|
32
32
|
render(): JSX.Element;
|
|
33
|
-
focusContainer:
|
|
33
|
+
focusContainer: AppClassProperties["focusContainer"];
|
|
34
34
|
getSceneElementsIncludingDeleted: () => readonly ExcalidrawElement[];
|
|
35
35
|
getSceneElements: () => readonly import("../element/types").NonDeletedExcalidrawElement[];
|
|
36
36
|
private syncActionResult;
|
|
@@ -73,6 +73,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
73
73
|
clearToast: () => void;
|
|
74
74
|
setToastMessage: (toastMessage: string) => void;
|
|
75
75
|
restoreFileFromShare: () => Promise<void>;
|
|
76
|
+
setFiles: ExcalidrawImperativeAPI["setFiles"];
|
|
76
77
|
updateScene: <K extends keyof AppState>(sceneData: {
|
|
77
78
|
elements?: SceneData["elements"];
|
|
78
79
|
appState?: Pick<AppState, K> | null | undefined;
|
|
@@ -112,6 +113,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
112
113
|
private isHittingCommonBoundingBoxOfSelectedElements;
|
|
113
114
|
private handleTextOnPointerDown;
|
|
114
115
|
private handleFreeDrawElementOnPointerDown;
|
|
116
|
+
private createImageElement;
|
|
115
117
|
private handleLinearElementOnPointerDown;
|
|
116
118
|
private createGenericElementOnPointerDown;
|
|
117
119
|
private onKeyDownFromPointerDownHandler;
|
|
@@ -119,6 +121,19 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
119
121
|
private onPointerMoveFromPointerDownHandler;
|
|
120
122
|
private handlePointerMoveOverScrollbars;
|
|
121
123
|
private onPointerUpFromPointerDownHandler;
|
|
124
|
+
private initializeImage;
|
|
125
|
+
/**
|
|
126
|
+
* inserts image into elements array and rerenders
|
|
127
|
+
*/
|
|
128
|
+
private insertImageElement;
|
|
129
|
+
private setImagePreviewCursor;
|
|
130
|
+
private onImageAction;
|
|
131
|
+
private initializeImageDimensions;
|
|
132
|
+
/** populates image cache and re-renders if needed */
|
|
133
|
+
private refreshImages;
|
|
134
|
+
/** generally you should use `renderImages()` directly if you need to render
|
|
135
|
+
* new images. This is just a failsafe */
|
|
136
|
+
private scheduleImageRefresh;
|
|
122
137
|
private updateBindingEnabledOnPointerMove;
|
|
123
138
|
private maybeSuggestBindingAtCursor;
|
|
124
139
|
private maybeSuggestBindingForLinearElementAtCursor;
|
|
@@ -28,6 +28,9 @@ interface LayerUIProps {
|
|
|
28
28
|
focusContainer: () => void;
|
|
29
29
|
library: Library;
|
|
30
30
|
id: string;
|
|
31
|
+
onImageAction: (data: {
|
|
32
|
+
insertOnCanvasDirectly: boolean;
|
|
33
|
+
}) => void;
|
|
31
34
|
}
|
|
32
|
-
declare const _default: React.MemoExoticComponent<({ actionManager, appState, setAppState, canvas, elements, onCollabButtonClick, onLockToggle, onInsertElements, zenModeEnabled, showExitZenModeBtn, showThemeBtn, toggleZenMode, isCollaborating, renderTopRightUI, renderCustomFooter, viewModeEnabled, libraryReturnUrl, UIOptions, focusContainer, library, id, }: LayerUIProps) => JSX.Element>;
|
|
35
|
+
declare const _default: React.MemoExoticComponent<({ actionManager, appState, setAppState, canvas, elements, onCollabButtonClick, onLockToggle, onInsertElements, zenModeEnabled, showExitZenModeBtn, showThemeBtn, toggleZenMode, isCollaborating, renderTopRightUI, renderCustomFooter, viewModeEnabled, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, }: LayerUIProps) => JSX.Element>;
|
|
33
36
|
export default _default;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { LibraryItem } from "../types";
|
|
2
|
+
import { AppState, LibraryItem } from "../types";
|
|
3
3
|
import "./LibraryUnit.scss";
|
|
4
|
-
export declare const LibraryUnit: ({ elements, pendingElements, onRemoveFromLibrary, onClick, }: {
|
|
4
|
+
export declare const LibraryUnit: ({ elements, files, pendingElements, onRemoveFromLibrary, onClick, }: {
|
|
5
5
|
elements?: LibraryItem | undefined;
|
|
6
|
+
files: AppState["files"];
|
|
6
7
|
pendingElements?: LibraryItem | undefined;
|
|
7
8
|
onRemoveFromLibrary: () => void;
|
|
8
9
|
onClick: () => void;
|
|
@@ -17,6 +17,9 @@ declare type MobileMenuProps = {
|
|
|
17
17
|
renderCustomFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
|
18
18
|
viewModeEnabled: boolean;
|
|
19
19
|
showThemeBtn: boolean;
|
|
20
|
+
onImageAction: (data: {
|
|
21
|
+
insertOnCanvasDirectly: boolean;
|
|
22
|
+
}) => void;
|
|
20
23
|
};
|
|
21
|
-
export declare const MobileMenu: ({ appState, elements, libraryMenu, actionManager, renderJSONExportDialog, renderImageExportDialog, setAppState, onCollabButtonClick, onLockToggle, canvas, isCollaborating, renderCustomFooter, viewModeEnabled, showThemeBtn, }: MobileMenuProps) => JSX.Element;
|
|
24
|
+
export declare const MobileMenu: ({ appState, elements, libraryMenu, actionManager, renderJSONExportDialog, renderImageExportDialog, setAppState, onCollabButtonClick, onLockToggle, canvas, isCollaborating, renderCustomFooter, viewModeEnabled, showThemeBtn, onImageAction, }: MobileMenuProps) => JSX.Element;
|
|
22
25
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./ToolIcon.scss";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { PointerType } from "../element/types";
|
|
3
4
|
export declare type ToolButtonSize = "small" | "medium";
|
|
4
5
|
declare type ToolButtonBaseProps = {
|
|
5
6
|
icon?: React.ReactNode;
|
|
@@ -21,7 +22,7 @@ declare type ToolButtonBaseProps = {
|
|
|
21
22
|
declare type ToolButtonProps = (ToolButtonBaseProps & {
|
|
22
23
|
type: "button";
|
|
23
24
|
children?: React.ReactNode;
|
|
24
|
-
onClick?(): void;
|
|
25
|
+
onClick?(event: React.MouseEvent): void;
|
|
25
26
|
}) | (ToolButtonBaseProps & {
|
|
26
27
|
type: "icon";
|
|
27
28
|
children?: React.ReactNode;
|
|
@@ -29,7 +30,9 @@ declare type ToolButtonProps = (ToolButtonBaseProps & {
|
|
|
29
30
|
}) | (ToolButtonBaseProps & {
|
|
30
31
|
type: "radio";
|
|
31
32
|
checked: boolean;
|
|
32
|
-
onChange?(
|
|
33
|
+
onChange?(data: {
|
|
34
|
+
pointerType: PointerType | null;
|
|
35
|
+
}): void;
|
|
33
36
|
});
|
|
34
37
|
export declare const ToolButton: React.ForwardRefExoticComponent<ToolButtonProps & React.RefAttributes<unknown>>;
|
|
35
38
|
export {};
|
package/types/constants.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ export declare const EXPORT_SOURCE: string;
|
|
|
81
81
|
export declare const STORAGE_KEYS: {
|
|
82
82
|
readonly LOCAL_STORAGE_LIBRARY: "excalidraw-library";
|
|
83
83
|
};
|
|
84
|
+
export declare const IMAGE_RENDER_TIMEOUT = 500;
|
|
84
85
|
export declare const TAP_TWICE_TIMEOUT = 300;
|
|
85
86
|
export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
|
|
86
87
|
export declare const TITLE_TIMEOUT = 10000;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createInverseContext: <T extends unknown = null>(initialValue: T) => any;
|
package/types/data/blob.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { FileSystemHandle } from "browser-fs-access";
|
|
2
|
-
import { ExcalidrawElement } from "../element/types";
|
|
2
|
+
import { ExcalidrawElement, ImageId } from "../element/types";
|
|
3
3
|
import { AppState } from "../types";
|
|
4
4
|
import { ImportedLibraryData } from "./types";
|
|
5
5
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
6
6
|
export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
|
|
7
7
|
export declare const isImageFileHandleType: (type: string | null) => type is "svg" | "png";
|
|
8
8
|
export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boolean;
|
|
9
|
+
export declare const isImageFile: (blob: Blob | null | undefined) => blob is File;
|
|
9
10
|
export declare const loadFromBlob: (blob: Blob, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null) => Promise<import("./restore").RestoredDataState>;
|
|
10
11
|
export declare const loadLibraryFromBlob: (blob: Blob) => Promise<ImportedLibraryData>;
|
|
11
12
|
export declare const canvasToBlob: (canvas: HTMLCanvasElement) => Promise<Blob>;
|
|
13
|
+
export declare const generateIdFromFile: (file: File) => Promise<ImageId>;
|
package/types/data/encode.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export declare const toByteString: (data: string | Uint8Array) => Promise<string>;
|
|
1
|
+
export declare const toByteString: (data: string | Uint8Array | ArrayBuffer) => Promise<string>;
|
|
2
2
|
/**
|
|
3
3
|
* @param isByteString set to true if already byte string to prevent bloat
|
|
4
4
|
* due to reencoding
|
|
5
5
|
*/
|
|
6
6
|
export declare const stringToBase64: (str: string, isByteString?: boolean) => Promise<string>;
|
|
7
|
+
export declare const toBase64: (data: string | Uint8Array | ArrayBuffer) => Promise<string>;
|
|
7
8
|
export declare const base64ToString: (base64: string, isByteString?: boolean) => Promise<string>;
|
|
8
9
|
declare type EncodedData = {
|
|
9
10
|
encoded: string;
|
package/types/data/json.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ExcalidrawElement } from "../element/types";
|
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import { ImportedDataState } from "./types";
|
|
4
4
|
import Library from "./library";
|
|
5
|
-
export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], appState: Partial<AppState
|
|
5
|
+
export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], appState: Partial<AppState>, type: "local" | "database") => string;
|
|
6
6
|
export declare const saveAsJSON: (elements: readonly ExcalidrawElement[], appState: AppState) => Promise<{
|
|
7
7
|
fileHandle: import("browser-fs-access").FileSystemHandle;
|
|
8
8
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as GA from "../ga";
|
|
2
|
-
import { NonDeletedExcalidrawElement, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawRectangleElement, ExcalidrawDiamondElement, ExcalidrawTextElement, ExcalidrawEllipseElement, NonDeleted } from "./types";
|
|
2
|
+
import { NonDeletedExcalidrawElement, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawRectangleElement, ExcalidrawDiamondElement, ExcalidrawTextElement, ExcalidrawEllipseElement, NonDeleted, ExcalidrawImageElement } from "./types";
|
|
3
3
|
import { Point } from "../types";
|
|
4
4
|
import { AppState } from "../types";
|
|
5
5
|
export declare const hitTest: (element: NonDeletedExcalidrawElement, appState: AppState, x: number, y: number) => boolean;
|
|
@@ -16,4 +16,4 @@ export declare const determineFocusPoint: (element: ExcalidrawBindableElement, f
|
|
|
16
16
|
export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap?: number) => Point[];
|
|
17
17
|
export declare const getCircleIntersections: (center: readonly [number, number, number, number, number, number, number, number], radius: number, line: readonly [number, number, number, number, number, number, number, number]) => GA.Point[];
|
|
18
18
|
export declare const findFocusPointForEllipse: (ellipse: ExcalidrawEllipseElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
19
|
-
export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawTextElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
19
|
+
export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
@@ -4,4 +4,4 @@ import { NonDeletedExcalidrawElement } from "./types";
|
|
|
4
4
|
import { PointerDownState } from "../types";
|
|
5
5
|
export declare const dragSelectedElements: (pointerDownState: PointerDownState, selectedElements: NonDeletedExcalidrawElement[], pointerX: number, pointerY: number, scene: Scene, lockDirection?: boolean, distanceX?: number, distanceY?: number) => void;
|
|
6
6
|
export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
7
|
-
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType: typeof SHAPES[number]["value"], originX: number, originY: number, x: number, y: number, width: number, height: number,
|
|
7
|
+
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType: typeof SHAPES[number]["value"], originX: number, originY: number, x: number, y: number, width: number, height: number, shouldMaintainAspectRatio: boolean, shouldResizeFromCenter: boolean, widthAspectRatio?: number | null | undefined) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AppState } from "../types";
|
|
2
|
+
import { ExcalidrawElement, ImageId, InitializedExcalidrawImageElement } from "./types";
|
|
3
|
+
/** NOTE: updates cache even if already populated with given image. Thus,
|
|
4
|
+
* you should filter out the images upstream if you want to optimize this. */
|
|
5
|
+
export declare const updateImageCache: ({ imageElements, files, imageCache, }: {
|
|
6
|
+
imageElements: readonly InitializedExcalidrawImageElement[];
|
|
7
|
+
files: AppState["files"];
|
|
8
|
+
imageCache: Map<ImageId, HTMLImageElement>;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
imageCache: Map<ImageId, HTMLImageElement>;
|
|
11
|
+
didUpdate: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const getInitializedImageElements: (elements: readonly ExcalidrawElement[]) => InitializedExcalidrawImageElement[];
|
package/types/element/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
|
|
2
|
-
export { newElement, newTextElement, updateTextElement, newLinearElement, duplicateElement, } from "./newElement";
|
|
2
|
+
export { newElement, newTextElement, updateTextElement, newLinearElement, newImageElement, duplicateElement, } from "./newElement";
|
|
3
3
|
export { getElementAbsoluteCoords, getElementBounds, getCommonBounds, getDiamondPoints, getArrowheadPoints, getClosestElementBounds, } from "./bounds";
|
|
4
4
|
export { OMIT_SIDES_FOR_MULTIPLE_ELEMENTS, getTransformHandlesFromCoords, getTransformHandles, } from "./transformHandles";
|
|
5
5
|
export { hitTest, isHittingElementBoundingBoxWithoutHittingElement, } from "./collision";
|
|
@@ -18,5 +18,6 @@ export declare const getSceneVersion: (elements: readonly ExcalidrawElement[]) =
|
|
|
18
18
|
export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
|
|
19
19
|
export declare const getNonDeletedElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
|
|
20
20
|
export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element: T) => element is NonDeleted<T>;
|
|
21
|
+
export declare const clearElementsForDatabase: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
21
22
|
export declare const clearElementsForExport: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
22
23
|
export declare const clearElementsForLocalStorage: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./types";
|
|
2
2
|
declare type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce">;
|
|
3
|
-
export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement
|
|
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
6
|
* Mutates element and updates `version` & `versionNonce`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues } from "../element/types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted">, "width" | "height" | "angle" | "groupIds" | "boundElementIds" | "seed" | "version" | "versionNonce">;
|
|
4
4
|
export declare const newElement: (opts: {
|
|
@@ -12,8 +12,9 @@ export declare const newTextElement: (opts: {
|
|
|
12
12
|
textAlign: TextAlign;
|
|
13
13
|
verticalAlign: VerticalAlign;
|
|
14
14
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
15
|
-
export declare const updateTextElement: (element: ExcalidrawTextElement, { text, isDeleted }: {
|
|
15
|
+
export declare const updateTextElement: (element: ExcalidrawTextElement, { text, rawText, isDeleted, }: {
|
|
16
16
|
text: string;
|
|
17
|
+
rawText?: string | undefined;
|
|
17
18
|
isDeleted?: boolean | undefined;
|
|
18
19
|
}) => ExcalidrawTextElement;
|
|
19
20
|
export declare const newFreeDrawElement: (opts: {
|
|
@@ -27,6 +28,9 @@ export declare const newLinearElement: (opts: {
|
|
|
27
28
|
endArrowhead: Arrowhead | null;
|
|
28
29
|
points?: ExcalidrawLinearElement["points"];
|
|
29
30
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawLinearElement>;
|
|
31
|
+
export declare const newImageElement: (opts: {
|
|
32
|
+
type: ExcalidrawImageElement["type"];
|
|
33
|
+
} & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
|
|
30
34
|
export declare const deepCopyElement: (val: any, depth?: number) => any;
|
|
31
35
|
/**
|
|
32
36
|
* Duplicate an element, often used in the alt-drag operation.
|
|
@@ -2,8 +2,8 @@ import { ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted } from
|
|
|
2
2
|
import { MaybeTransformHandleType, TransformHandleDirection } from "./transformHandles";
|
|
3
3
|
import { PointerDownState } from "../types";
|
|
4
4
|
export declare const normalizeAngle: (angle: number) => number;
|
|
5
|
-
export declare const transformElements: (pointerDownState: PointerDownState, transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], resizeArrowDirection: "origin" | "end",
|
|
6
|
-
export declare const reshapeSingleTwoPointElement: (element: NonDeleted<ExcalidrawLinearElement>, resizeArrowDirection: "origin" | "end",
|
|
7
|
-
export declare const resizeSingleElement: (stateAtResizeStart: NonDeletedExcalidrawElement,
|
|
5
|
+
export declare const transformElements: (pointerDownState: PointerDownState, transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], resizeArrowDirection: "origin" | "end", shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
|
|
6
|
+
export declare const reshapeSingleTwoPointElement: (element: NonDeleted<ExcalidrawLinearElement>, resizeArrowDirection: "origin" | "end", shouldRotateWithDiscreteAngle: boolean, pointerX: number, pointerY: number) => void;
|
|
7
|
+
export declare const resizeSingleElement: (stateAtResizeStart: NonDeletedExcalidrawElement, shouldMaintainAspectRatio: boolean, element: NonDeletedExcalidrawElement, transformHandleDirection: TransformHandleDirection, shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
|
|
8
8
|
export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
9
9
|
export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
|