@zsviczian/excalidraw 0.9.0-obsidian-10 → 0.9.0-obsidian-image-support-3
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/Cascadia.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Virgil.woff2 +0 -0
- package/dist/excalidraw-assets-dev/i18n-ar-SA-json-8617476a4caf18fc0371.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-bg-BG-json-709d1cdbcdd08cb4196e.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-ca-ES-json-00e9a306a6883ffbbe57.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-cs-CZ-json-bc9a303ff98ced90903d.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-da-DK-json-43287c62e4e654a62e4b.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-de-DE-json-32a0c6840217959c613d.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-el-GR-json-f03c81650fc237c5cf4a.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-es-ES-json-e9fa5e81b395ea04cf35.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-fa-IR-json-c234b5e54cd2a1672898.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-fi-FI-json-29106b8736c3568b0e7a.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-fr-FR-json-b4382269051ef449f22a.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-he-IL-json-9f9592408d2171d94d28.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-hi-IN-json-dfd30ffcd688b76d247b.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-hu-HU-json-385ed66ee674f14883ce.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-id-ID-json-8606e52f65cda64f84de.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-it-IT-json-47d0eb1c1ca8ffcc6a8c.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-ja-JP-json-041d339b6d1c6c40a696.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-kab-KAB-json-bc3faead75b6f428fa0e.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-kk-KZ-json-a7087f74220ab6202b31.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-ko-KR-json-e3fba288c9957c8010cf.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-lv-LV-json-08034ebe84bb974c35c3.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-my-MM-json-cc0225c53edbf917e21f.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-nb-NO-json-34f0bfcf72c71d33376d.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-nl-NL-json-62820376fea0b9d31fc3.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-nn-NO-json-a3f47aba453d847cc65a.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-oc-FR-json-d731d0c7c25481aef3c8.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-pa-IN-json-1ccfa9e432207fa34d73.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-pl-PL-json-2c3192cda97bcdfaed27.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-pt-BR-json-8b1f19303a882e28bcb8.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-pt-PT-json-8c9d24df4db900d7eed1.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-ro-RO-json-8ad16b7ee2c00730a103.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-ru-RU-json-d0767891cb65e644f458.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-sk-SK-json-e786dadba6fac2b1625b.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-sv-SE-json-35b10171080a427d71a5.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-tr-TR-json-a15ed70331602c0a16f7.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-uk-UA-json-df1cdfae3f8aa58d22bb.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-zh-CN-json-342311fa1d0fa30c6828.js +22 -0
- package/dist/excalidraw-assets-dev/i18n-zh-TW-json-819e494f1f38cb9ef099.js +22 -0
- package/dist/excalidraw-assets-dev/image-2767e46ad3f3f29617ea.js +22 -0
- package/dist/excalidraw-assets-dev/image-48c09dc0a5119be6727d.js +32 -0
- package/dist/excalidraw-assets-dev/vendor-8ea1c8aa2827c2e56522.js +367 -0
- package/dist/excalidraw-assets-dev/vendor-b648d92c35e91de1648e.js +323 -0
- package/dist/excalidraw.development.js +3175 -0
- package/dist/excalidraw.production.min.js +2 -0
- package/dist/excalidraw.production.min.js.LICENSE.txt +1 -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 +5 -2
- 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 +4 -1
- 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/image-48c09dc0a5119be6727d.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-8ea1c8aa2827c2e56522.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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// @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,14 @@
|
|
|
1
1
|
import { FileSystemHandle } from "browser-fs-access";
|
|
2
|
-
import { ExcalidrawElement } from "../element/types";
|
|
3
|
-
import { AppState } from "../types";
|
|
2
|
+
import { ExcalidrawElement, ImageId } from "../element/types";
|
|
3
|
+
import { AppState, DataURL } 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>;
|
|
14
|
+
export declare const getDataURL: (file: File) => Promise<DataURL>;
|
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: {
|
|
@@ -28,6 +28,9 @@ export declare const newLinearElement: (opts: {
|
|
|
28
28
|
endArrowhead: Arrowhead | null;
|
|
29
29
|
points?: ExcalidrawLinearElement["points"];
|
|
30
30
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawLinearElement>;
|
|
31
|
+
export declare const newImageElement: (opts: {
|
|
32
|
+
type: ExcalidrawImageElement["type"];
|
|
33
|
+
} & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
|
|
31
34
|
export declare const deepCopyElement: (val: any, depth?: number) => any;
|
|
32
35
|
/**
|
|
33
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";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement } from "./types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement } from "./types";
|
|
2
2
|
export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
|
|
3
|
+
export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
|
|
3
4
|
export declare const isTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawTextElement;
|
|
4
5
|
export declare const isFreeDrawElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawFreeDrawElement;
|
|
5
6
|
export declare const isFreeDrawElementType: (elementType: ExcalidrawElement["type"]) => boolean;
|
package/types/element/types.d.ts
CHANGED
|
@@ -57,6 +57,15 @@ export declare type ExcalidrawDiamondElement = _ExcalidrawElementBase & {
|
|
|
57
57
|
export declare type ExcalidrawEllipseElement = _ExcalidrawElementBase & {
|
|
58
58
|
type: "ellipse";
|
|
59
59
|
};
|
|
60
|
+
export declare type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
|
61
|
+
type: "image";
|
|
62
|
+
imageId: ImageId | null;
|
|
63
|
+
/** whether respective file is persisted */
|
|
64
|
+
status: "pending" | "saved";
|
|
65
|
+
/** X and Y scale factors <-1, 1>, used for image axis flipping */
|
|
66
|
+
scale: [number, number];
|
|
67
|
+
}>;
|
|
68
|
+
export declare type InitializedExcalidrawImageElement = MarkNonNullable<ExcalidrawImageElement, "imageId">;
|
|
60
69
|
/**
|
|
61
70
|
* These are elements that don't have any additional properties.
|
|
62
71
|
*/
|
|
@@ -66,7 +75,7 @@ export declare type ExcalidrawGenericElement = ExcalidrawSelectionElement | Exca
|
|
|
66
75
|
* no computed data. The list of all ExcalidrawElements should be shareable
|
|
67
76
|
* between peers and contain no state local to the peer.
|
|
68
77
|
*/
|
|
69
|
-
export declare type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement;
|
|
78
|
+
export declare type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement;
|
|
70
79
|
export declare type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
|
|
71
80
|
isDeleted: false;
|
|
72
81
|
};
|
|
@@ -81,7 +90,7 @@ export declare type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
|
81
90
|
textAlign: TextAlign;
|
|
82
91
|
verticalAlign: VerticalAlign;
|
|
83
92
|
}>;
|
|
84
|
-
export declare type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement;
|
|
93
|
+
export declare type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement;
|
|
85
94
|
export declare type PointBinding = {
|
|
86
95
|
elementId: ExcalidrawBindableElement["id"];
|
|
87
96
|
focus: number;
|
|
@@ -104,4 +113,7 @@ export declare type ExcalidrawFreeDrawElement = _ExcalidrawElementBase & Readonl
|
|
|
104
113
|
simulatePressure: boolean;
|
|
105
114
|
lastCommittedPoint: Point | null;
|
|
106
115
|
}>;
|
|
116
|
+
export declare type ImageId = string & {
|
|
117
|
+
_brand: "ImageId";
|
|
118
|
+
};
|
|
107
119
|
export {};
|
package/types/errors.d.ts
CHANGED
|
@@ -2,4 +2,7 @@ declare type CANVAS_ERROR_NAMES = "CANVAS_ERROR" | "CANVAS_POSSIBLY_TOO_BIG";
|
|
|
2
2
|
export declare class CanvasError extends Error {
|
|
3
3
|
constructor(message?: string, name?: CANVAS_ERROR_NAMES);
|
|
4
4
|
}
|
|
5
|
+
export declare class AbortError extends DOMException {
|
|
6
|
+
constructor(message?: string);
|
|
7
|
+
}
|
|
5
8
|
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const SAVE_TO_LOCAL_STORAGE_TIMEOUT = 300;
|
|
2
|
+
export declare const INITIAL_SCENE_UPDATE_TIMEOUT = 5000;
|
|
3
|
+
export declare const FILE_UPLOAD_TIMEOUT = 300;
|
|
4
|
+
export declare const LOAD_IMAGES_TIMEOUT = 500;
|
|
5
|
+
export declare const SYNC_FULL_SCENE_INTERVAL_MS = 20000;
|
|
6
|
+
export declare const FILE_UPLOAD_MAX_BYTES: number;
|
|
7
|
+
export declare const FILE_CACHE_MAX_AGE_SEC = 2592000;
|
|
8
|
+
export declare const BROADCAST: {
|
|
9
|
+
SERVER_VOLATILE: string;
|
|
10
|
+
SERVER: string;
|
|
11
|
+
};
|
|
12
|
+
export declare enum SCENE {
|
|
13
|
+
INIT = "SCENE_INIT",
|
|
14
|
+
UPDATE = "SCENE_UPDATE"
|
|
15
|
+
}
|
|
16
|
+
export declare const FIREBASE_STORAGE_PREFIXES: {
|
|
17
|
+
shareLinkFiles: string;
|
|
18
|
+
collabFiles: string;
|
|
19
|
+
};
|