@zsviczian/excalidraw 0.11.0-obsidian-3 → 0.11.0-obsidian-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/excalidraw.development.js +79 -68
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +3 -3
- package/types/actions/actionCanvas.d.ts +104 -8
- package/types/actions/actionClipboard.d.ts +4 -4
- package/types/actions/actionDeleteSelected.d.ts +2 -2
- package/types/actions/actionExport.d.ts +9 -9
- package/types/actions/actionFinalize.d.ts +2 -2
- package/types/actions/actionMenu.d.ts +3 -3
- package/types/actions/actionProperties.d.ts +13 -13
- package/types/actions/actionStyles.d.ts +1 -1
- package/types/actions/actionToggleGridMode.d.ts +1 -1
- package/types/actions/actionToggleStats.d.ts +1 -1
- package/types/actions/actionToggleViewMode.d.ts +1 -1
- package/types/actions/actionToggleZenMode.d.ts +1 -1
- package/types/actions/types.d.ts +1 -1
- package/types/appState.d.ts +4 -1
- package/types/components/Actions.d.ts +2 -2
- package/types/components/App.d.ts +9 -0
- package/types/components/icons.d.ts +1 -0
- package/types/constants.d.ts +2 -0
- package/types/data/restore.d.ts +1 -1
- package/types/element/Hyperlink.d.ts +1 -1
- package/types/element/dragElements.d.ts +1 -2
- package/types/element/linearElementEditor.d.ts +2 -2
- package/types/element/typeChecks.d.ts +3 -2
- package/types/packages/excalidraw/index.d.ts +1 -1
- package/types/packages/utils.d.ts +1 -0
- package/types/types.d.ts +5 -1
package/types/appState.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AppState, NormalizedZoomValue } from "./types";
|
|
2
2
|
export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
3
3
|
export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
|
|
4
|
+
elementType?: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | undefined;
|
|
4
5
|
scrollX?: number | undefined;
|
|
5
6
|
scrollY?: number | undefined;
|
|
6
7
|
viewBackgroundColor?: string | undefined;
|
|
@@ -10,7 +11,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
10
11
|
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
11
12
|
theme?: string | undefined;
|
|
12
13
|
name?: string | undefined;
|
|
13
|
-
elementType?: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | undefined;
|
|
14
14
|
elementLocked?: boolean | undefined;
|
|
15
15
|
exportBackground?: boolean | undefined;
|
|
16
16
|
exportEmbedScene?: boolean | undefined;
|
|
@@ -57,3 +57,6 @@ export declare const clearAppStateForDatabase: (appState: Partial<AppState>) =>
|
|
|
57
57
|
viewBackgroundColor?: string | undefined;
|
|
58
58
|
gridSize?: number | null | undefined;
|
|
59
59
|
};
|
|
60
|
+
export declare const isEraserActive: ({ elementType, }: {
|
|
61
|
+
elementType: AppState["elementType"];
|
|
62
|
+
}) => boolean;
|
|
@@ -6,11 +6,11 @@ export declare const SelectedShapeActions: ({ appState, elements, renderAction,
|
|
|
6
6
|
appState: AppState;
|
|
7
7
|
elements: readonly ExcalidrawElement[];
|
|
8
8
|
renderAction: ActionManager["renderAction"];
|
|
9
|
-
elementType:
|
|
9
|
+
elementType: AppState["elementType"];
|
|
10
10
|
}) => JSX.Element;
|
|
11
11
|
export declare const ShapesSwitcher: ({ canvas, elementType, setAppState, onImageAction, }: {
|
|
12
12
|
canvas: HTMLCanvasElement | null;
|
|
13
|
-
elementType:
|
|
13
|
+
elementType: AppState["elementType"];
|
|
14
14
|
setAppState: React.Component<any, AppState>["setState"];
|
|
15
15
|
onImageAction: (data: {
|
|
16
16
|
pointerType: PointerType | null;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { RoughCanvas } from "roughjs/bin/canvas";
|
|
3
3
|
import { ActionManager } from "../actions/manager";
|
|
4
|
+
import { RestoredDataState } from "../data/restore";
|
|
4
5
|
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
5
6
|
import History from "../history";
|
|
6
7
|
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData } from "../types";
|
|
8
|
+
import { ImportedDataState } from "../data/types";
|
|
7
9
|
export declare let showFourthFont: boolean;
|
|
8
10
|
export declare const useIsMobile: () => boolean;
|
|
9
11
|
export declare const useExcalidrawContainer: () => {
|
|
@@ -33,6 +35,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
33
35
|
lastPointerDown: React.PointerEvent<HTMLCanvasElement> | null;
|
|
34
36
|
lastPointerUp: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
35
37
|
contextMenuOpen: boolean;
|
|
38
|
+
lastScenePointer: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
} | null;
|
|
36
42
|
constructor(props: AppProps);
|
|
37
43
|
private renderCanvas;
|
|
38
44
|
render(): JSX.Element;
|
|
@@ -78,6 +84,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
78
84
|
scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[]) => void;
|
|
79
85
|
zoomToFit: (target?: readonly ExcalidrawElement[], maxZoom?: number, margin?: number) => void;
|
|
80
86
|
updateContainerSize: (containers: NonDeletedExcalidrawElement[]) => void;
|
|
87
|
+
restore: (data: ImportedDataState) => RestoredDataState;
|
|
81
88
|
clearToast: () => void;
|
|
82
89
|
setToastMessage: (toastMessage: string) => void;
|
|
83
90
|
restoreFileFromShare: () => Promise<void>;
|
|
@@ -114,6 +121,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
114
121
|
private getElementLinkAtPosition;
|
|
115
122
|
private redirectToLink;
|
|
116
123
|
private handleCanvasPointerMove;
|
|
124
|
+
private handleEraser;
|
|
117
125
|
private handleTouchMove;
|
|
118
126
|
private handleCanvasPointerDown;
|
|
119
127
|
private handleCanvasPointerUp;
|
|
@@ -141,6 +149,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
141
149
|
private onPointerMoveFromPointerDownHandler;
|
|
142
150
|
private handlePointerMoveOverScrollbars;
|
|
143
151
|
private onPointerUpFromPointerDownHandler;
|
|
152
|
+
private eraseElements;
|
|
144
153
|
private initializeImage;
|
|
145
154
|
/**
|
|
146
155
|
* inserts image into elements array and rerenders
|
|
@@ -178,4 +178,5 @@ export declare const TextAlignMiddleIcon: React.MemoExoticComponent<({ theme }:
|
|
|
178
178
|
}) => JSX.Element>;
|
|
179
179
|
export declare const publishIcon: JSX.Element;
|
|
180
180
|
export declare const editIcon: JSX.Element;
|
|
181
|
+
export declare const eraser: JSX.Element;
|
|
181
182
|
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 AllowedExcalidrawElementTypes: Record<
|
|
5
|
+
export declare const AllowedExcalidrawElementTypes: Record<AppState["elementType"], boolean>;
|
|
6
6
|
export declare type RestoredDataState = {
|
|
7
7
|
elements: ExcalidrawElement[];
|
|
8
8
|
appState: RestoredAppState;
|
|
@@ -30,7 +30,7 @@ export declare const actionLink: {
|
|
|
30
30
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
31
31
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
32
32
|
editingLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
33
|
-
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw";
|
|
33
|
+
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
34
34
|
elementLocked: boolean;
|
|
35
35
|
penMode: boolean;
|
|
36
36
|
penDetected: boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { SHAPES } from "../shapes";
|
|
2
1
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
3
2
|
import { AppState, PointerDownState } from "../types";
|
|
4
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;
|
|
5
4
|
export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
6
|
-
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType:
|
|
5
|
+
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType: AppState["elementType"], originX: number, originY: number, x: number, y: number, width: number, height: number, shouldMaintainAspectRatio: boolean, shouldResizeFromCenter: boolean, widthAspectRatio?: number | null | undefined) => void;
|
|
@@ -96,7 +96,7 @@ export declare class LinearElementEditor {
|
|
|
96
96
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
97
97
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
98
98
|
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
99
|
-
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw";
|
|
99
|
+
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
100
100
|
elementLocked: boolean;
|
|
101
101
|
penMode: boolean;
|
|
102
102
|
penDetected: boolean;
|
|
@@ -140,7 +140,7 @@ export declare class LinearElementEditor {
|
|
|
140
140
|
};
|
|
141
141
|
shouldCacheIgnoreZoom: boolean;
|
|
142
142
|
showHelpDialog: boolean;
|
|
143
|
-
toastMessage: string | null;
|
|
143
|
+
toastMessage: string | null; /** @returns whether point was dragged */
|
|
144
144
|
zenModeEnabled: boolean;
|
|
145
145
|
theme: string;
|
|
146
146
|
gridSize: number | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AppState } from "../types";
|
|
1
2
|
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer } from "./types";
|
|
2
3
|
export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
|
|
3
4
|
export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
|
|
@@ -6,9 +7,9 @@ export declare const isTextElement: (element: ExcalidrawElement | null) => eleme
|
|
|
6
7
|
export declare const isFreeDrawElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawFreeDrawElement;
|
|
7
8
|
export declare const isFreeDrawElementType: (elementType: ExcalidrawElement["type"]) => boolean;
|
|
8
9
|
export declare const isLinearElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
9
|
-
export declare const isLinearElementType: (elementType:
|
|
10
|
+
export declare const isLinearElementType: (elementType: AppState["elementType"]) => boolean;
|
|
10
11
|
export declare const isBindingElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
11
|
-
export declare const isBindingElementType: (elementType:
|
|
12
|
+
export declare const isBindingElementType: (elementType: AppState["elementType"]) => boolean;
|
|
12
13
|
export declare const isBindableElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
|
|
13
14
|
export declare const isTextBindableContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextContainer;
|
|
14
15
|
export declare const isExcalidrawElement: (element: any) => boolean;
|
|
@@ -9,7 +9,7 @@ export default _default;
|
|
|
9
9
|
export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
|
|
10
10
|
export { defaultLang, languages } from "../../i18n";
|
|
11
11
|
export { restore, restoreAppState, restoreElements } from "../../data/restore";
|
|
12
|
-
export { exportToCanvas, exportToBlob, exportToSvg, serializeAsJSON, loadLibraryFromBlob, loadFromBlob, getFreeDrawSvgPath, getCommonBoundingBox, getMaximumGroups, intersectElementWithLine, determineFocusDistance, } from "../../packages/utils";
|
|
12
|
+
export { exportToCanvas, exportToBlob, exportToSvg, serializeAsJSON, loadLibraryFromBlob, loadFromBlob, getFreeDrawSvgPath, getCommonBoundingBox, getMaximumGroups, intersectElementWithLine, determineFocusDistance, measureText, } from "../../packages/utils";
|
|
13
13
|
export { isLinearElement } from "../../element/typeChecks";
|
|
14
14
|
export { FONT_FAMILY, THEME } from "../../constants";
|
|
15
15
|
export { mutateElement, newElementWith, bumpVersion, } from "../../element/mutateElement";
|
|
@@ -26,3 +26,4 @@ export { getCommonBoundingBox } from "../element/bounds";
|
|
|
26
26
|
export { getMaximumGroups } from "../groups";
|
|
27
27
|
export { intersectElementWithLine } from "../element/collision";
|
|
28
28
|
export { determineFocusDistance } from "../element/collision";
|
|
29
|
+
export { measureText } from "../element/textElement";
|
package/types/types.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare type AppState = {
|
|
|
53
53
|
suggestedBindings: SuggestedBinding[];
|
|
54
54
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
55
55
|
editingLinearElement: LinearElementEditor | null;
|
|
56
|
-
elementType: typeof SHAPES[number]["value"];
|
|
56
|
+
elementType: typeof SHAPES[number]["value"] | "eraser";
|
|
57
57
|
elementLocked: boolean;
|
|
58
58
|
penMode: boolean;
|
|
59
59
|
penDetected: boolean;
|
|
@@ -322,6 +322,9 @@ export declare type PointerDownState = Readonly<{
|
|
|
322
322
|
boxSelection: {
|
|
323
323
|
hasOccurred: boolean;
|
|
324
324
|
};
|
|
325
|
+
elementIdsToErase: {
|
|
326
|
+
[key: ExcalidrawElement["id"]]: boolean;
|
|
327
|
+
};
|
|
325
328
|
}>;
|
|
326
329
|
export declare type ExcalidrawImperativeAPI = {
|
|
327
330
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
@@ -349,5 +352,6 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
349
352
|
bringForward: (elements: readonly ExcalidrawElement[]) => void;
|
|
350
353
|
sendToBack: (elements: readonly ExcalidrawElement[]) => void;
|
|
351
354
|
bringToFront: (elements: readonly ExcalidrawElement[]) => void;
|
|
355
|
+
restore: InstanceType<typeof App>["restore"];
|
|
352
356
|
};
|
|
353
357
|
export {};
|