@zsviczian/excalidraw 0.11.0-obsidian-4 → 0.11.0-obsidian-5
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 +75 -64
- 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 +6 -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/types.d.ts +4 -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;
|
|
@@ -35,6 +35,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
35
35
|
lastPointerDown: React.PointerEvent<HTMLCanvasElement> | null;
|
|
36
36
|
lastPointerUp: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
37
37
|
contextMenuOpen: boolean;
|
|
38
|
+
lastScenePointer: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
} | null;
|
|
38
42
|
constructor(props: AppProps);
|
|
39
43
|
private renderCanvas;
|
|
40
44
|
render(): JSX.Element;
|
|
@@ -117,6 +121,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
117
121
|
private getElementLinkAtPosition;
|
|
118
122
|
private redirectToLink;
|
|
119
123
|
private handleCanvasPointerMove;
|
|
124
|
+
private handleEraser;
|
|
120
125
|
private handleTouchMove;
|
|
121
126
|
private handleCanvasPointerDown;
|
|
122
127
|
private handleCanvasPointerUp;
|
|
@@ -144,6 +149,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
144
149
|
private onPointerMoveFromPointerDownHandler;
|
|
145
150
|
private handlePointerMoveOverScrollbars;
|
|
146
151
|
private onPointerUpFromPointerDownHandler;
|
|
152
|
+
private eraseElements;
|
|
147
153
|
private initializeImage;
|
|
148
154
|
/**
|
|
149
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;
|
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"];
|