@dwelle/excalidraw 0.3.54 → 0.3.57
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 +18 -0
- package/dist/excalidraw-assets-dev/{image-73be8b3c1837ea26950c.js → image-eddc6ed66acd3a3f3d46.js} +0 -0
- package/dist/excalidraw.development.js +63 -63
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +2 -2
- package/types/actions/actionAddToLibrary.d.ts +18 -6
- package/types/actions/actionAlign.d.ts +18 -0
- package/types/actions/actionBoundText.d.ts +116 -0
- package/types/actions/actionCanvas.d.ts +67 -18
- package/types/actions/actionClipboard.d.ts +37 -10
- package/types/actions/actionDeleteSelected.d.ts +19 -6
- package/types/actions/actionDistribute.d.ts +6 -0
- package/types/actions/actionDuplicateSelection.d.ts +3 -0
- package/types/actions/actionExport.d.ts +71 -18
- package/types/actions/actionFinalize.d.ts +11 -4
- package/types/actions/actionFlip.d.ts +6 -0
- package/types/actions/actionGroup.d.ts +6 -0
- package/types/actions/actionMenu.d.ts +29 -6
- package/types/actions/actionNavigate.d.ts +3 -0
- package/types/actions/actionProperties.d.ts +82 -26
- package/types/actions/actionSelectAll.d.ts +3 -0
- package/types/actions/actionStyles.d.ts +11 -2
- package/types/actions/actionToggleGridMode.d.ts +9 -2
- package/types/actions/actionToggleStats.d.ts +8 -2
- package/types/actions/actionToggleViewMode.d.ts +9 -2
- package/types/actions/actionToggleZenMode.d.ts +9 -2
- package/types/actions/actionZindex.d.ts +12 -0
- package/types/actions/index.d.ts +1 -1
- package/types/actions/manager.d.ts +3 -3
- package/types/actions/types.d.ts +7 -9
- package/types/appState.d.ts +9 -4
- package/types/components/Actions.d.ts +4 -4
- package/types/components/App.d.ts +3 -2
- package/types/components/ImageExportDialog.d.ts +2 -2
- package/types/components/JSONExportDialog.d.ts +2 -2
- package/types/components/ToolButton.d.ts +3 -0
- package/types/constants.d.ts +1 -0
- package/types/data/restore.d.ts +1 -1
- package/types/element/Hyperlink.d.ts +9 -3
- package/types/element/dragElements.d.ts +1 -1
- package/types/element/linearElementEditor.d.ts +5 -2
- package/types/element/sizeHelpers.d.ts +2 -1
- package/types/element/textElement.d.ts +1 -2
- package/types/element/typeChecks.d.ts +2 -2
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-eddc6ed66acd3a3f3d46.d.ts +0 -0
- package/types/scene/Scene.d.ts +1 -1
- package/types/types.d.ts +10 -3
- package/types/utils.d.ts +2 -0
|
@@ -74,7 +74,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
74
74
|
private addTextFromPaste;
|
|
75
75
|
setAppState: (obj: any) => void;
|
|
76
76
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
77
|
-
toggleLock: () => void;
|
|
77
|
+
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
78
78
|
togglePenMode: () => void;
|
|
79
79
|
toggleZenMode: () => void;
|
|
80
80
|
toggleStats: () => void;
|
|
@@ -95,7 +95,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
95
95
|
private updateCurrentCursorPosition;
|
|
96
96
|
private onKeyDown;
|
|
97
97
|
private onKeyUp;
|
|
98
|
-
private
|
|
98
|
+
private setActiveTool;
|
|
99
99
|
private onGestureStart;
|
|
100
100
|
private onGestureChange;
|
|
101
101
|
private onGestureEnd;
|
|
@@ -137,6 +137,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
137
137
|
private onPointerMoveFromPointerDownHandler;
|
|
138
138
|
private handlePointerMoveOverScrollbars;
|
|
139
139
|
private onPointerUpFromPointerDownHandler;
|
|
140
|
+
private restoreReadyToEraseElements;
|
|
140
141
|
private eraseElements;
|
|
141
142
|
private initializeImage;
|
|
142
143
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ActionsManagerInterface } from "../actions/types";
|
|
3
2
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
4
3
|
import { AppState, BinaryFiles } from "../types";
|
|
5
4
|
import "./ExportDialog.scss";
|
|
5
|
+
import { ActionManager } from "../actions/manager";
|
|
6
6
|
export declare const ErrorCanvasPreview: () => JSX.Element;
|
|
7
7
|
export declare type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
|
|
8
8
|
export declare const ImageExportDialog: ({ elements, appState, files, exportPadding, actionManager, onExportToPng, onExportToSvg, onExportToClipboard, }: {
|
|
@@ -10,7 +10,7 @@ export declare const ImageExportDialog: ({ elements, appState, files, exportPadd
|
|
|
10
10
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
11
11
|
files: BinaryFiles;
|
|
12
12
|
exportPadding?: number | undefined;
|
|
13
|
-
actionManager:
|
|
13
|
+
actionManager: ActionManager;
|
|
14
14
|
onExportToPng: ExportCB;
|
|
15
15
|
onExportToSvg: ExportCB;
|
|
16
16
|
onExportToClipboard: ExportCB;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ActionsManagerInterface } from "../actions/types";
|
|
3
2
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
4
3
|
import { AppState, CanvasActions, BinaryFiles } from "../types";
|
|
5
4
|
import "./ExportDialog.scss";
|
|
5
|
+
import { ActionManager } from "../actions/manager";
|
|
6
6
|
export declare type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
|
|
7
7
|
export declare const JSONExportDialog: ({ elements, appState, files, actionManager, exportOpts, canvas, }: {
|
|
8
8
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
9
9
|
appState: AppState;
|
|
10
10
|
files: BinaryFiles;
|
|
11
|
-
actionManager:
|
|
11
|
+
actionManager: ActionManager;
|
|
12
12
|
exportOpts: CanvasActions["export"];
|
|
13
13
|
canvas: HTMLCanvasElement | null;
|
|
14
14
|
}) => JSX.Element;
|
|
@@ -38,6 +38,9 @@ declare type ToolButtonProps = (ToolButtonBaseProps & {
|
|
|
38
38
|
onChange?(data: {
|
|
39
39
|
pointerType: PointerType | null;
|
|
40
40
|
}): void;
|
|
41
|
+
onPointerDown?(data: {
|
|
42
|
+
pointerType: PointerType;
|
|
43
|
+
}): void;
|
|
41
44
|
});
|
|
42
45
|
export declare const ToolButton: React.ForwardRefExoticComponent<ToolButtonProps & React.RefAttributes<unknown>>;
|
|
43
46
|
export {};
|
package/types/constants.d.ts
CHANGED
package/types/data/restore.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ExcalidrawElement } from "../element/types";
|
|
|
2
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
|
-
export declare const
|
|
5
|
+
export declare const AllowedExcalidrawActiveTools: Record<AppState["activeTool"]["type"], boolean>;
|
|
6
6
|
export declare type RestoredDataState = {
|
|
7
7
|
elements: ExcalidrawElement[];
|
|
8
8
|
appState: RestoredAppState;
|
|
@@ -30,8 +30,11 @@ export declare const actionLink: {
|
|
|
30
30
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
31
31
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
32
32
|
editingLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
activeTool: {
|
|
34
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
35
|
+
lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
|
|
36
|
+
locked: boolean;
|
|
37
|
+
};
|
|
35
38
|
penMode: boolean;
|
|
36
39
|
penDetected: boolean;
|
|
37
40
|
exportBackground: boolean;
|
|
@@ -102,7 +105,10 @@ export declare const actionLink: {
|
|
|
102
105
|
};
|
|
103
106
|
commitToHistory: true;
|
|
104
107
|
};
|
|
105
|
-
trackEvent:
|
|
108
|
+
trackEvent: {
|
|
109
|
+
category: "hyperlink";
|
|
110
|
+
action: string;
|
|
111
|
+
};
|
|
106
112
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
107
113
|
contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.edit" | "labels.link.create";
|
|
108
114
|
contextItemPredicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
|
|
@@ -2,4 +2,4 @@ import { NonDeletedExcalidrawElement } from "./types";
|
|
|
2
2
|
import { AppState, PointerDownState } from "../types";
|
|
3
3
|
export declare const dragSelectedElements: (pointerDownState: PointerDownState, selectedElements: NonDeletedExcalidrawElement[], pointerX: number, pointerY: number, lockDirection: boolean | undefined, distanceX: number | undefined, distanceY: number | undefined, appState: AppState) => void;
|
|
4
4
|
export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
5
|
-
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType: AppState["
|
|
5
|
+
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType: AppState["activeTool"]["type"], originX: number, originY: number, x: number, y: number, width: number, height: number, shouldMaintainAspectRatio: boolean, shouldResizeFromCenter: boolean, widthAspectRatio?: number | null | undefined) => void;
|
|
@@ -96,8 +96,11 @@ export declare class LinearElementEditor {
|
|
|
96
96
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
97
97
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
98
98
|
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
activeTool: {
|
|
100
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
101
|
+
lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
|
|
102
|
+
locked: boolean;
|
|
103
|
+
};
|
|
101
104
|
penMode: boolean;
|
|
102
105
|
penDetected: boolean;
|
|
103
106
|
exportBackground: boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./types";
|
|
2
|
+
import { AppState } from "../types";
|
|
2
3
|
export declare const isInvisiblySmallElement: (element: ExcalidrawElement) => boolean;
|
|
3
4
|
/**
|
|
4
5
|
* Makes a perfect shape or diagonal/horizontal/vertical line
|
|
5
6
|
*/
|
|
6
|
-
export declare const getPerfectElementSize: (elementType:
|
|
7
|
+
export declare const getPerfectElementSize: (elementType: AppState["activeTool"]["type"], width: number, height: number) => {
|
|
7
8
|
width: number;
|
|
8
9
|
height: number;
|
|
9
10
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
2
2
|
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
|
-
|
|
4
|
-
export declare const redrawTextBoundingBox: (element: ExcalidrawTextElement, container: ExcalidrawElement | null, appState: AppState) => void;
|
|
3
|
+
export declare const redrawTextBoundingBox: (element: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
|
|
5
4
|
export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
6
5
|
export declare const handleBindTextResize: (element: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType) => void;
|
|
7
6
|
export declare const measureText: (text: string, font: FontString, maxWidth?: number | null | undefined) => {
|
|
@@ -7,9 +7,9 @@ export declare const isTextElement: (element: ExcalidrawElement | null) => eleme
|
|
|
7
7
|
export declare const isFreeDrawElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawFreeDrawElement;
|
|
8
8
|
export declare const isFreeDrawElementType: (elementType: ExcalidrawElement["type"]) => boolean;
|
|
9
9
|
export declare const isLinearElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
10
|
-
export declare const isLinearElementType: (elementType: AppState["
|
|
10
|
+
export declare const isLinearElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
11
11
|
export declare const isBindingElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
12
|
-
export declare const isBindingElementType: (elementType: AppState["
|
|
12
|
+
export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
13
13
|
export declare const isBindableElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
|
|
14
14
|
export declare const isTextBindableContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextContainer;
|
|
15
15
|
export declare const isExcalidrawElement: (element: any) => boolean;
|
|
File without changes
|
package/types/scene/Scene.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare class Scene {
|
|
|
15
15
|
private elementsMap;
|
|
16
16
|
getElementsIncludingDeleted(): readonly ExcalidrawElement[];
|
|
17
17
|
getElements(): readonly NonDeletedExcalidrawElement[];
|
|
18
|
-
getElement(id:
|
|
18
|
+
getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
|
|
19
19
|
getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
|
|
20
20
|
getNonDeletedElements(ids: readonly ExcalidrawElement["id"][]): NonDeleted<ExcalidrawElement>[];
|
|
21
21
|
replaceAllElements(nextElements: readonly ExcalidrawElement[]): void;
|
package/types/types.d.ts
CHANGED
|
@@ -54,8 +54,11 @@ export declare type AppState = {
|
|
|
54
54
|
suggestedBindings: SuggestedBinding[];
|
|
55
55
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
56
56
|
editingLinearElement: LinearElementEditor | null;
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
activeTool: {
|
|
58
|
+
type: typeof SHAPES[number]["value"] | "eraser";
|
|
59
|
+
lastActiveToolBeforeEraser: typeof SHAPES[number]["value"] | null;
|
|
60
|
+
locked: boolean;
|
|
61
|
+
};
|
|
59
62
|
penMode: boolean;
|
|
60
63
|
penDetected: boolean;
|
|
61
64
|
exportBackground: boolean;
|
|
@@ -263,6 +266,7 @@ export declare type AppClassProperties = {
|
|
|
263
266
|
mimeType: typeof ALLOWED_IMAGE_MIME_TYPES[number];
|
|
264
267
|
}>;
|
|
265
268
|
files: BinaryFiles;
|
|
269
|
+
deviceType: App["deviceType"];
|
|
266
270
|
};
|
|
267
271
|
export declare type PointerDownState = Readonly<{
|
|
268
272
|
origin: Readonly<{
|
|
@@ -318,7 +322,10 @@ export declare type PointerDownState = Readonly<{
|
|
|
318
322
|
hasOccurred: boolean;
|
|
319
323
|
};
|
|
320
324
|
elementIdsToErase: {
|
|
321
|
-
[key: ExcalidrawElement["id"]]:
|
|
325
|
+
[key: ExcalidrawElement["id"]]: {
|
|
326
|
+
opacity: ExcalidrawElement["opacity"];
|
|
327
|
+
erase: boolean;
|
|
328
|
+
};
|
|
322
329
|
};
|
|
323
330
|
}>;
|
|
324
331
|
export declare type ExcalidrawImperativeAPI = {
|
package/types/utils.d.ts
CHANGED
|
@@ -118,3 +118,5 @@ export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) =
|
|
|
118
118
|
nativeEvent: T;
|
|
119
119
|
}>;
|
|
120
120
|
export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
|
|
121
|
+
export declare const isPrimitive: (val: any) => boolean;
|
|
122
|
+
export declare const getFrame: () => "top" | "iframe";
|