@zsviczian/excalidraw 0.11.0-obsidian-2 → 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/README.md +2 -2
- package/dist/excalidraw.development.js +98 -87
- 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 +105 -9
- 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 +113 -12
- 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 +2 -2
- package/types/actions/actionToggleZenMode.d.ts +1 -1
- package/types/actions/index.d.ts +1 -1
- package/types/actions/types.d.ts +1 -1
- package/types/appState.d.ts +4 -1
- package/types/clipboard.d.ts +1 -1
- package/types/components/Actions.d.ts +2 -2
- package/types/components/App.d.ts +9 -0
- package/types/components/ColorPicker.d.ts +6 -1
- package/types/components/icons.d.ts +10 -0
- package/types/constants.d.ts +7 -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/textElement.d.ts +1 -1
- package/types/element/typeChecks.d.ts +5 -4
- package/types/element/types.d.ts +5 -3
- package/types/galines.d.ts +1 -1
- package/types/scene/comparisons.d.ts +2 -2
- package/types/scene/index.d.ts +1 -1
- package/types/types.d.ts +5 -1
|
@@ -16,7 +16,7 @@ export declare const actionCopyStyles: {
|
|
|
16
16
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
17
17
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
18
18
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
19
|
-
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw";
|
|
19
|
+
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
20
20
|
elementLocked: boolean;
|
|
21
21
|
penMode: boolean;
|
|
22
22
|
penDetected: boolean;
|
|
@@ -16,7 +16,7 @@ export declare const actionToggleGridMode: {
|
|
|
16
16
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
17
17
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
18
18
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
19
|
-
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw";
|
|
19
|
+
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
20
20
|
elementLocked: boolean;
|
|
21
21
|
penMode: boolean;
|
|
22
22
|
penDetected: boolean;
|
|
@@ -15,7 +15,7 @@ export declare const actionToggleStats: {
|
|
|
15
15
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
16
16
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
17
17
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
18
|
-
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw";
|
|
18
|
+
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
19
19
|
elementLocked: boolean;
|
|
20
20
|
penMode: boolean;
|
|
21
21
|
penDetected: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const actionToggleViewMode: {
|
|
3
3
|
name: "viewMode";
|
|
4
|
-
perform(elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, app:
|
|
4
|
+
perform(elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties): {
|
|
5
5
|
appState: {
|
|
6
6
|
viewModeEnabled: boolean;
|
|
7
7
|
isLoading: boolean;
|
|
@@ -15,7 +15,7 @@ export declare const actionToggleViewMode: {
|
|
|
15
15
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
16
16
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
17
17
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
18
|
-
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw";
|
|
18
|
+
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
19
19
|
elementLocked: boolean;
|
|
20
20
|
penMode: boolean;
|
|
21
21
|
penDetected: boolean;
|
|
@@ -15,7 +15,7 @@ export declare const actionToggleZenMode: {
|
|
|
15
15
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
16
16
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
17
17
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
18
|
-
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw";
|
|
18
|
+
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
19
19
|
elementLocked: boolean;
|
|
20
20
|
penMode: boolean;
|
|
21
21
|
penDetected: boolean;
|
package/types/actions/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { actionDeleteSelected } from "./actionDeleteSelected";
|
|
|
2
2
|
export { actionBringForward, actionBringToFront, actionSendBackward, actionSendToBack, } from "./actionZindex";
|
|
3
3
|
export { actionSelectAll } from "./actionSelectAll";
|
|
4
4
|
export { actionDuplicateSelection } from "./actionDuplicateSelection";
|
|
5
|
-
export { actionChangeStrokeColor, actionChangeBackgroundColor, actionChangeStrokeWidth, actionChangeFillStyle, actionChangeSloppiness, actionChangeOpacity, actionChangeFontSize, actionChangeFontFamily, actionChangeTextAlign, } from "./actionProperties";
|
|
5
|
+
export { actionChangeStrokeColor, actionChangeBackgroundColor, actionChangeStrokeWidth, actionChangeFillStyle, actionChangeSloppiness, actionChangeOpacity, actionChangeFontSize, actionChangeFontFamily, actionChangeTextAlign, actionChangeVerticalAlign, } from "./actionProperties";
|
|
6
6
|
export { actionChangeViewBackgroundColor, actionClearCanvas, actionZoomIn, actionZoomOut, actionResetZoom, actionZoomToFit, actionToggleTheme, zoomToFitElements, } from "./actionCanvas";
|
|
7
7
|
export { actionFinalize } from "./actionFinalize";
|
|
8
8
|
export { actionChangeProjectName, actionChangeExportBackground, actionSaveToActiveFile, actionSaveFileToDisk, actionLoadScene, } from "./actionExport";
|
package/types/actions/types.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare type ActionResult = {
|
|
|
14
14
|
declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
15
15
|
export declare type UpdaterFn = (res: ActionResult) => void;
|
|
16
16
|
export declare type ActionFilterFn = (action: Action) => void;
|
|
17
|
-
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" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink";
|
|
17
|
+
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" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser";
|
|
18
18
|
export declare type PanelComponentProps = {
|
|
19
19
|
elements: readonly ExcalidrawElement[];
|
|
20
20
|
appState: AppState;
|
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;
|
package/types/clipboard.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const probablySupportsClipboardWriteText: boolean;
|
|
|
13
13
|
export declare const probablySupportsClipboardBlob: boolean;
|
|
14
14
|
export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles) => Promise<void>;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Attempts to parse clipboard. Prefers system clipboard.
|
|
17
17
|
*/
|
|
18
18
|
export declare const parseClipboard: (event: ClipboardEvent | null) => Promise<ClipboardData>;
|
|
19
19
|
export declare const copyBlobToClipboardAsPng: (blob: Blob) => Promise<void>;
|
|
@@ -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
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./ColorPicker.scss";
|
|
3
|
-
|
|
3
|
+
import { ExcalidrawElement } from "../element/types";
|
|
4
|
+
import { AppState } from "../types";
|
|
5
|
+
export declare const getCustomColors: (elements: readonly ExcalidrawElement[], type: "elementBackground" | "elementStroke", colors: string[]) => string[];
|
|
6
|
+
export declare const ColorPicker: ({ type, color, onChange, label, isActive, setActive, colorPalette, elements, appState, }: {
|
|
4
7
|
type: "canvasBackground" | "elementBackground" | "elementStroke";
|
|
5
8
|
color: string | null;
|
|
6
9
|
onChange: (color: string) => void;
|
|
@@ -12,4 +15,6 @@ export declare const ColorPicker: ({ type, color, onChange, label, isActive, set
|
|
|
12
15
|
elementBackground?: string[];
|
|
13
16
|
elementStroke?: string[];
|
|
14
17
|
};
|
|
18
|
+
elements: readonly ExcalidrawElement[];
|
|
19
|
+
appState: AppState;
|
|
15
20
|
}) => JSX.Element;
|
|
@@ -167,6 +167,16 @@ export declare const TextAlignCenterIcon: React.MemoExoticComponent<({ theme }:
|
|
|
167
167
|
export declare const TextAlignRightIcon: React.MemoExoticComponent<({ theme }: {
|
|
168
168
|
theme: Theme;
|
|
169
169
|
}) => JSX.Element>;
|
|
170
|
+
export declare const TextAlignTopIcon: React.MemoExoticComponent<({ theme }: {
|
|
171
|
+
theme: Theme;
|
|
172
|
+
}) => JSX.Element>;
|
|
173
|
+
export declare const TextAlignBottomIcon: React.MemoExoticComponent<({ theme }: {
|
|
174
|
+
theme: Theme;
|
|
175
|
+
}) => JSX.Element>;
|
|
176
|
+
export declare const TextAlignMiddleIcon: React.MemoExoticComponent<({ theme }: {
|
|
177
|
+
theme: Theme;
|
|
178
|
+
}) => JSX.Element>;
|
|
170
179
|
export declare const publishIcon: JSX.Element;
|
|
171
180
|
export declare const editIcon: JSX.Element;
|
|
181
|
+
export declare const eraser: JSX.Element;
|
|
172
182
|
export {};
|
package/types/constants.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ export declare const ENV: {
|
|
|
56
56
|
};
|
|
57
57
|
export declare const CLASSES: {
|
|
58
58
|
SHAPE_ACTIONS_MENU: string;
|
|
59
|
+
SHAPE_ACTIONS_MOBILE_MENU: string;
|
|
60
|
+
MOBILE_TOOLBAR: string;
|
|
59
61
|
};
|
|
60
62
|
export declare const FONT_FAMILY: {
|
|
61
63
|
Virgil: number;
|
|
@@ -131,3 +133,8 @@ export declare const VERSIONS: {
|
|
|
131
133
|
readonly excalidrawLibrary: 2;
|
|
132
134
|
};
|
|
133
135
|
export declare const BOUND_TEXT_PADDING = 5;
|
|
136
|
+
export declare const VERTICAL_ALIGN: {
|
|
137
|
+
TOP: string;
|
|
138
|
+
MIDDLE: string;
|
|
139
|
+
BOTTOM: string;
|
|
140
|
+
};
|
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;
|
|
@@ -20,7 +20,7 @@ export declare const getApproxMinLineHeight: (font: FontString) => number;
|
|
|
20
20
|
export declare const getMinCharWidth: (font: FontString) => number;
|
|
21
21
|
export declare const getMaxCharWidth: (font: FontString) => number;
|
|
22
22
|
export declare const getApproxCharsToFitInWidth: (font: FontString, width: number) => number;
|
|
23
|
-
export declare const getBoundTextElementId: (container: ExcalidrawElement | null) => string |
|
|
23
|
+
export declare const getBoundTextElementId: (container: ExcalidrawElement | null) => string | null;
|
|
24
24
|
export declare const getBoundTextElement: (element: ExcalidrawElement | null) => ExcalidrawTextElementWithContainer | null;
|
|
25
25
|
export declare const getContainerElement: (element: (ExcalidrawElement & {
|
|
26
26
|
containerId: ExcalidrawElement["id"] | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppState } from "../types";
|
|
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;
|
|
4
5
|
export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
|
|
@@ -6,11 +7,11 @@ 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
|
-
export declare const isTextBindableContainer: (element: ExcalidrawElement | null) =>
|
|
14
|
+
export declare const isTextBindableContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextContainer;
|
|
14
15
|
export declare const isExcalidrawElement: (element: any) => boolean;
|
|
15
16
|
export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
|
|
16
17
|
export declare const isBoundToContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextElementWithContainer;
|
package/types/element/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Point } from "../types";
|
|
2
|
-
import { FONT_FAMILY, THEME } from "../constants";
|
|
2
|
+
import { FONT_FAMILY, THEME, VERTICAL_ALIGN } from "../constants";
|
|
3
3
|
export declare type ChartType = "bar" | "line";
|
|
4
4
|
export declare type FillStyle = "hachure" | "cross-hatch" | "solid";
|
|
5
5
|
export declare type FontFamilyKeys = keyof typeof FONT_FAMILY;
|
|
@@ -13,7 +13,8 @@ export declare type PointerType = "mouse" | "pen" | "touch";
|
|
|
13
13
|
export declare type StrokeSharpness = "round" | "sharp";
|
|
14
14
|
export declare type StrokeStyle = "solid" | "dashed" | "dotted";
|
|
15
15
|
export declare type TextAlign = "left" | "center" | "right";
|
|
16
|
-
|
|
16
|
+
declare type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
|
|
17
|
+
export declare type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
|
|
17
18
|
declare type _ExcalidrawElementBase = Readonly<{
|
|
18
19
|
id: string;
|
|
19
20
|
x: number;
|
|
@@ -100,8 +101,9 @@ export declare type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
|
100
101
|
originalText: string;
|
|
101
102
|
}>;
|
|
102
103
|
export declare type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement;
|
|
104
|
+
export declare type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawImageElement;
|
|
103
105
|
export declare type ExcalidrawTextElementWithContainer = {
|
|
104
|
-
containerId:
|
|
106
|
+
containerId: ExcalidrawTextContainer["id"];
|
|
105
107
|
} & ExcalidrawTextElement;
|
|
106
108
|
export declare type PointBinding = {
|
|
107
109
|
elementId: ExcalidrawBindableElement["id"];
|
package/types/galines.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This maps to a standard formula `a * x + b * y + c`.
|
|
6
6
|
*
|
|
7
|
-
* `(-b, a)`
|
|
7
|
+
* `(-b, a)` corresponds to a 2D vector parallel to the line. The lines
|
|
8
8
|
* have a natural orientation, corresponding to that vector.
|
|
9
9
|
*
|
|
10
10
|
* The magnitude ("norm") of the line is `sqrt(a ^ 2 + b ^ 2)`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawTextContainer, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
export declare const hasBackground: (type: string) => boolean;
|
|
3
3
|
export declare const hasStrokeColor: (type: string) => boolean;
|
|
4
4
|
export declare const hasStrokeWidth: (type: string) => boolean;
|
|
@@ -8,4 +8,4 @@ export declare const hasText: (type: string) => boolean;
|
|
|
8
8
|
export declare const canHaveArrowheads: (type: string) => boolean;
|
|
9
9
|
export declare const getElementAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement | null;
|
|
10
10
|
export declare const getElementsAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement[];
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], x: number, y: number) => ExcalidrawTextContainer | null;
|
package/types/scene/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { isOverScrollBars } from "./scrollbars";
|
|
2
2
|
export { isSomeElementSelected, getElementsWithinSelection, getCommonAttributeOfSelectedElements, getSelectedElements, getTargetElements, } from "./selection";
|
|
3
3
|
export { calculateScrollCenter } from "./scroll";
|
|
4
|
-
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeSharpness, getElementAtPosition,
|
|
4
|
+
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeSharpness, getElementAtPosition, getTextBindableContainerAtPosition, hasText, getElementsAtPosition, } from "./comparisons";
|
|
5
5
|
export { getNormalizedZoom } from "./zoom";
|
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 {};
|