@excalidraw/excalidraw 0.16.1-4c35eba → 0.16.1-aaf73c8
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 +6 -0
- package/dist/excalidraw.development.js +140 -63
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +9 -27
- package/types/actions/actionAlign.d.ts +8 -8
- package/types/actions/actionBoundText.d.ts +6 -18
- package/types/actions/actionCanvas.d.ts +57 -123
- package/types/actions/actionClipboard.d.ts +19 -49
- package/types/actions/actionDeleteSelected.d.ts +11 -29
- package/types/actions/actionDistribute.d.ts +4 -4
- package/types/actions/actionDuplicateSelection.d.ts +2 -2
- package/types/actions/actionElementLock.d.ts +8 -20
- package/types/actions/actionExport.d.ts +42 -96
- package/types/actions/actionFinalize.d.ts +8 -20
- package/types/actions/actionFlip.d.ts +4 -4
- package/types/actions/actionFrame.d.ts +11 -29
- package/types/actions/actionGroup.d.ts +10 -22
- package/types/actions/actionLinearEditor.d.ts +3 -9
- package/types/actions/actionMenu.d.ts +11 -29
- package/types/actions/actionProperties.d.ts +43 -121
- package/types/actions/actionSelectAll.d.ts +5 -11
- package/types/actions/actionStyles.d.ts +7 -13
- package/types/actions/actionToggleGridMode.d.ts +5 -11
- package/types/actions/actionToggleObjectsSnapMode.d.ts +5 -11
- package/types/actions/actionToggleStats.d.ts +5 -11
- package/types/actions/actionToggleViewMode.d.ts +5 -11
- package/types/actions/actionToggleZenMode.d.ts +5 -11
- package/types/actions/actionZindex.d.ts +8 -8
- package/types/appState.d.ts +5 -11
- package/types/components/Actions.d.ts +4 -9
- package/types/components/App.d.ts +15 -5
- package/types/components/LaserTool/LaserPathManager.d.ts +28 -0
- package/types/components/LaserTool/LaserPointerButton.d.ts +10 -0
- package/types/components/LaserTool/LaserTool.d.ts +7 -0
- package/types/components/LayerUI.d.ts +2 -5
- package/types/components/MobileMenu.d.ts +1 -5
- package/types/components/Sidebar/Sidebar.d.ts +1 -1
- package/types/components/Stack.d.ts +2 -2
- package/types/components/dropdownMenu/DropdownMenu.d.ts +6 -3
- package/types/components/dropdownMenu/DropdownMenuItem.d.ts +2 -1
- package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -1
- package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +2 -1
- package/types/components/dropdownMenu/common.d.ts +1 -1
- package/types/components/icons.d.ts +2 -0
- package/types/components/main-menu/MainMenu.d.ts +6 -3
- package/types/cursor.d.ts +5 -0
- package/types/element/Hyperlink.d.ts +5 -11
- package/types/element/embeddable.d.ts +3 -9
- package/types/element/linearElementEditor.d.ts +3 -9
- package/types/element/mutateElement.d.ts +1 -1
- package/types/frame.d.ts +5 -0
- package/types/types.d.ts +16 -17
- package/types/utils.d.ts +3 -8
|
@@ -8,5 +8,5 @@ export declare const newElementWith: <TElement extends ExcalidrawElement>(elemen
|
|
|
8
8
|
*
|
|
9
9
|
* NOTE: does not trigger re-render.
|
|
10
10
|
*/
|
|
11
|
-
export declare const bumpVersion:
|
|
11
|
+
export declare const bumpVersion: <T extends Mutable<ExcalidrawElement>>(element: T, version?: ExcalidrawElement["version"]) => T;
|
|
12
12
|
export {};
|
package/types/frame.d.ts
CHANGED
|
@@ -21,6 +21,11 @@ export declare const getFrameElements: (allElements: ExcalidrawElementsIncluding
|
|
|
21
21
|
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
|
22
22
|
export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
23
23
|
export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) => ExcalidrawFrameElement | null;
|
|
24
|
+
/**
|
|
25
|
+
* Retains (or repairs for target frame) the ordering invriant where children
|
|
26
|
+
* elements come right before the parent frame:
|
|
27
|
+
* [el, el, child, child, frame, el]
|
|
28
|
+
*/
|
|
24
29
|
export declare const addElementsToFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToAdd: NonDeletedExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
25
30
|
export declare const removeElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToRemove: NonDeletedExcalidrawElement[], appState: AppState) => ExcalidrawElement[];
|
|
26
31
|
export declare const removeAllElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
package/types/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawFrameElement, ExcalidrawEmbeddableElement } from "./element/types";
|
|
3
|
-
import { SHAPES } from "./shapes";
|
|
4
3
|
import { Point as RoughPoint } from "roughjs/bin/geometry";
|
|
5
4
|
import { LinearElementEditor } from "./element/linearElementEditor";
|
|
6
5
|
import { SuggestedBinding } from "./element/binding";
|
|
@@ -20,10 +19,7 @@ import { SnapLine } from "./snapping";
|
|
|
20
19
|
import { Merge, ForwardRef, ValueOf } from "./utility-types";
|
|
21
20
|
export type Point = Readonly<RoughPoint>;
|
|
22
21
|
export type Collaborator = {
|
|
23
|
-
pointer?:
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
};
|
|
22
|
+
pointer?: CollaboratorPointer;
|
|
27
23
|
button?: "up" | "down";
|
|
28
24
|
selectedElementIds?: AppState["selectedElementIds"];
|
|
29
25
|
username?: string | null;
|
|
@@ -35,6 +31,11 @@ export type Collaborator = {
|
|
|
35
31
|
avatarUrl?: string;
|
|
36
32
|
id?: string;
|
|
37
33
|
};
|
|
34
|
+
export type CollaboratorPointer = {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
tool: "pointer" | "laser";
|
|
38
|
+
};
|
|
38
39
|
export type DataURL = string & {
|
|
39
40
|
_brand: "DataURL";
|
|
40
41
|
};
|
|
@@ -57,13 +58,14 @@ export type BinaryFileData = {
|
|
|
57
58
|
};
|
|
58
59
|
export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
59
60
|
export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
60
|
-
export type
|
|
61
|
-
|
|
61
|
+
export type ToolType = "selection" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "embeddable" | "laser";
|
|
62
|
+
export type ActiveTool = {
|
|
63
|
+
type: ToolType;
|
|
62
64
|
customType: null;
|
|
63
65
|
} | {
|
|
64
66
|
type: "custom";
|
|
65
67
|
customType: string;
|
|
66
|
-
}
|
|
68
|
+
};
|
|
67
69
|
export type SidebarName = string;
|
|
68
70
|
export type SidebarTabName = string;
|
|
69
71
|
type _CommonCanvasAppState = {
|
|
@@ -143,15 +145,9 @@ export type AppState = {
|
|
|
143
145
|
* indicates a previous tool we should revert back to if we deselect the
|
|
144
146
|
* currently active tool. At the moment applies to `eraser` and `hand` tool.
|
|
145
147
|
*/
|
|
146
|
-
lastActiveTool:
|
|
148
|
+
lastActiveTool: ActiveTool | null;
|
|
147
149
|
locked: boolean;
|
|
148
|
-
} &
|
|
149
|
-
type: typeof SHAPES[number]["value"] | "eraser" | "hand" | "frame" | "embeddable";
|
|
150
|
-
customType: null;
|
|
151
|
-
} | {
|
|
152
|
-
type: "custom";
|
|
153
|
-
customType: string;
|
|
154
|
-
});
|
|
150
|
+
} & ActiveTool;
|
|
155
151
|
penMode: boolean;
|
|
156
152
|
penDetected: boolean;
|
|
157
153
|
exportBackground: boolean;
|
|
@@ -239,7 +235,7 @@ export type AppState = {
|
|
|
239
235
|
pendingImageElementId: ExcalidrawImageElement["id"] | null;
|
|
240
236
|
showHyperlinkPopup: false | "info" | "editor";
|
|
241
237
|
selectedLinearElement: LinearElementEditor | null;
|
|
242
|
-
snapLines: SnapLine[];
|
|
238
|
+
snapLines: readonly SnapLine[];
|
|
243
239
|
originSnapOffset: {
|
|
244
240
|
x: number;
|
|
245
241
|
y: number;
|
|
@@ -303,6 +299,7 @@ export interface ExcalidrawProps {
|
|
|
303
299
|
pointer: {
|
|
304
300
|
x: number;
|
|
305
301
|
y: number;
|
|
302
|
+
tool: "pointer" | "laser";
|
|
306
303
|
};
|
|
307
304
|
button: "down" | "up";
|
|
308
305
|
pointersMap: Gesture["pointers"];
|
|
@@ -396,6 +393,8 @@ export type AppClassProperties = {
|
|
|
396
393
|
onInsertElements: App["onInsertElements"];
|
|
397
394
|
onExportImage: App["onExportImage"];
|
|
398
395
|
lastViewportPosition: App["lastViewportPosition"];
|
|
396
|
+
togglePenMode: App["togglePenMode"];
|
|
397
|
+
setActiveTool: App["setActiveTool"];
|
|
399
398
|
};
|
|
400
399
|
export type PointerDownState = Readonly<{
|
|
401
400
|
origin: Readonly<{
|
package/types/utils.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EVENT } from "./constants";
|
|
2
2
|
import { FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./element/types";
|
|
3
|
-
import { AppState,
|
|
4
|
-
import { SHAPES } from "./shapes";
|
|
3
|
+
import { ActiveTool, AppState, ToolType, Zoom } from "./types";
|
|
5
4
|
export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
6
5
|
export declare const getDateTime: () => string;
|
|
7
6
|
export declare const capitalizeString: (str: string) => string;
|
|
@@ -81,17 +80,13 @@ export declare const selectNode: (node: Element) => void;
|
|
|
81
80
|
export declare const removeSelection: () => void;
|
|
82
81
|
export declare const distance: (x: number, y: number) => number;
|
|
83
82
|
export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: ({
|
|
84
|
-
type:
|
|
83
|
+
type: ToolType;
|
|
85
84
|
} | {
|
|
86
85
|
type: "custom";
|
|
87
86
|
customType: string;
|
|
88
87
|
}) & {
|
|
89
|
-
lastActiveToolBeforeEraser?:
|
|
88
|
+
lastActiveToolBeforeEraser?: ActiveTool | null;
|
|
90
89
|
}) => AppState["activeTool"];
|
|
91
|
-
export declare const resetCursor: (interactiveCanvas: HTMLCanvasElement | null) => void;
|
|
92
|
-
export declare const setCursor: (interactiveCanvas: HTMLCanvasElement | null, cursor: string) => void;
|
|
93
|
-
export declare const setEraserCursor: (interactiveCanvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
|
|
94
|
-
export declare const setCursorForShape: (interactiveCanvas: HTMLCanvasElement | null, appState: Pick<AppState, "activeTool" | "theme">) => void;
|
|
95
90
|
export declare const isFullScreen: () => boolean;
|
|
96
91
|
export declare const allowFullScreen: () => Promise<void>;
|
|
97
92
|
export declare const exitFullScreen: () => Promise<void>;
|