@excalidraw/excalidraw 0.16.0-f8b3692 → 0.16.1-26ff399
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 +22 -0
- package/dist/excalidraw.development.js +149 -39
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +24 -24
- package/types/actions/actionAlign.d.ts +8 -8
- package/types/actions/actionBoundText.d.ts +16 -16
- package/types/actions/actionCanvas.d.ts +112 -112
- package/types/actions/actionClipboard.d.ts +44 -44
- package/types/actions/actionDeleteSelected.d.ts +26 -26
- package/types/actions/actionDistribute.d.ts +4 -4
- package/types/actions/actionDuplicateSelection.d.ts +2 -2
- package/types/actions/actionElementLock.d.ts +18 -18
- package/types/actions/actionExport.d.ts +87 -87
- package/types/actions/actionFinalize.d.ts +18 -18
- package/types/actions/actionFlip.d.ts +4 -4
- package/types/actions/actionFrame.d.ts +26 -26
- package/types/actions/actionGroup.d.ts +20 -20
- package/types/actions/actionLinearEditor.d.ts +8 -8
- package/types/actions/actionMenu.d.ts +26 -26
- package/types/actions/actionProperties.d.ts +108 -108
- package/types/actions/actionSelectAll.d.ts +10 -10
- package/types/actions/actionStyles.d.ts +12 -12
- package/types/actions/actionToggleGridMode.d.ts +10 -10
- package/types/actions/actionToggleObjectsSnapMode.d.ts +137 -0
- package/types/actions/actionToggleStats.d.ts +10 -10
- package/types/actions/actionToggleViewMode.d.ts +10 -10
- package/types/actions/actionToggleZenMode.d.ts +10 -10
- package/types/actions/actionZindex.d.ts +8 -8
- package/types/actions/index.d.ts +1 -0
- package/types/actions/shortcuts.d.ts +1 -1
- package/types/actions/types.d.ts +1 -1
- package/types/appState.d.ts +6 -11
- package/types/components/Actions.d.ts +3 -4
- package/types/components/App.d.ts +14 -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 -1
- 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 +10 -10
- package/types/element/bounds.d.ts +4 -5
- package/types/element/dragElements.d.ts +11 -2
- package/types/element/embeddable.d.ts +8 -8
- package/types/element/linearElementEditor.d.ts +8 -8
- package/types/element/resizeElements.d.ts +2 -2
- package/types/keys.d.ts +1 -0
- package/types/math.d.ts +2 -0
- package/types/renderer/renderSnaps.d.ts +2 -0
- package/types/scene/selection.d.ts +1 -0
- package/types/snapping.d.ts +108 -0
- package/types/types.d.ts +31 -16
- package/types/utils.d.ts +3 -8
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export declare const actionToggleObjectsSnapMode: {
|
|
2
|
+
name: "objectsSnapMode";
|
|
3
|
+
viewMode: true;
|
|
4
|
+
trackEvent: {
|
|
5
|
+
category: "canvas";
|
|
6
|
+
predicate: (appState: Readonly<import("../types").AppState>) => boolean;
|
|
7
|
+
};
|
|
8
|
+
perform(elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>): {
|
|
9
|
+
appState: {
|
|
10
|
+
objectsSnapModeEnabled: boolean;
|
|
11
|
+
gridSize: null;
|
|
12
|
+
contextMenu: {
|
|
13
|
+
items: import("../components/ContextMenu").ContextMenuItems;
|
|
14
|
+
top: number;
|
|
15
|
+
left: number;
|
|
16
|
+
} | null;
|
|
17
|
+
showWelcomeScreen: boolean;
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
errorMessage: import("react").ReactNode;
|
|
20
|
+
activeEmbeddable: {
|
|
21
|
+
element: import("../element/types").NonDeletedExcalidrawElement;
|
|
22
|
+
state: "active" | "hover";
|
|
23
|
+
} | null;
|
|
24
|
+
draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
25
|
+
resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
26
|
+
multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
|
|
27
|
+
selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
28
|
+
isBindingEnabled: boolean;
|
|
29
|
+
startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
|
|
30
|
+
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
31
|
+
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
|
|
32
|
+
frameRendering: {
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
name: boolean;
|
|
35
|
+
outline: boolean;
|
|
36
|
+
clip: boolean;
|
|
37
|
+
};
|
|
38
|
+
editingFrame: string | null;
|
|
39
|
+
elementsToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | null;
|
|
40
|
+
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
41
|
+
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
42
|
+
activeTool: {
|
|
43
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
44
|
+
locked: boolean;
|
|
45
|
+
} & import("../types").ActiveTool;
|
|
46
|
+
penMode: boolean;
|
|
47
|
+
penDetected: boolean;
|
|
48
|
+
exportBackground: boolean;
|
|
49
|
+
exportEmbedScene: boolean;
|
|
50
|
+
exportWithDarkMode: boolean;
|
|
51
|
+
exportScale: number;
|
|
52
|
+
currentItemStrokeColor: string;
|
|
53
|
+
currentItemBackgroundColor: string;
|
|
54
|
+
currentItemFillStyle: import("../element/types").FillStyle;
|
|
55
|
+
currentItemStrokeWidth: number;
|
|
56
|
+
currentItemStrokeStyle: import("../element/types").StrokeStyle;
|
|
57
|
+
currentItemRoughness: number;
|
|
58
|
+
currentItemOpacity: number;
|
|
59
|
+
currentItemFontFamily: number;
|
|
60
|
+
currentItemFontSize: number;
|
|
61
|
+
currentItemTextAlign: string;
|
|
62
|
+
currentItemStartArrowhead: import("../element/types").Arrowhead | null;
|
|
63
|
+
currentItemEndArrowhead: import("../element/types").Arrowhead | null;
|
|
64
|
+
currentItemRoundness: import("../element/types").StrokeRoundness;
|
|
65
|
+
viewBackgroundColor: string;
|
|
66
|
+
scrollX: number;
|
|
67
|
+
scrollY: number;
|
|
68
|
+
cursorButton: "up" | "down";
|
|
69
|
+
scrolledOutside: boolean;
|
|
70
|
+
name: string;
|
|
71
|
+
isResizing: boolean;
|
|
72
|
+
isRotating: boolean;
|
|
73
|
+
zoom: Readonly<{
|
|
74
|
+
value: import("../types").NormalizedZoomValue;
|
|
75
|
+
}>;
|
|
76
|
+
openMenu: "canvas" | "shape" | null;
|
|
77
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
78
|
+
openSidebar: {
|
|
79
|
+
name: string;
|
|
80
|
+
tab?: string | undefined;
|
|
81
|
+
} | null;
|
|
82
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
83
|
+
defaultSidebarDockedPreference: boolean;
|
|
84
|
+
lastPointerDownWith: import("../element/types").PointerType;
|
|
85
|
+
selectedElementIds: Readonly<{
|
|
86
|
+
[id: string]: true;
|
|
87
|
+
}>;
|
|
88
|
+
previousSelectedElementIds: {
|
|
89
|
+
[id: string]: true;
|
|
90
|
+
};
|
|
91
|
+
selectedElementsAreBeingDragged: boolean;
|
|
92
|
+
shouldCacheIgnoreZoom: boolean;
|
|
93
|
+
toast: {
|
|
94
|
+
message: string;
|
|
95
|
+
closable?: boolean | undefined;
|
|
96
|
+
duration?: number | undefined;
|
|
97
|
+
} | null;
|
|
98
|
+
zenModeEnabled: boolean;
|
|
99
|
+
theme: import("../element/types").Theme;
|
|
100
|
+
viewModeEnabled: boolean;
|
|
101
|
+
selectedGroupIds: {
|
|
102
|
+
[groupId: string]: boolean;
|
|
103
|
+
};
|
|
104
|
+
editingGroupId: string | null;
|
|
105
|
+
width: number;
|
|
106
|
+
height: number;
|
|
107
|
+
offsetTop: number;
|
|
108
|
+
offsetLeft: number;
|
|
109
|
+
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
110
|
+
collaborators: Map<string, import("../types").Collaborator>;
|
|
111
|
+
showStats: boolean;
|
|
112
|
+
currentChartType: import("../element/types").ChartType;
|
|
113
|
+
pasteDialog: {
|
|
114
|
+
shown: false;
|
|
115
|
+
data: null;
|
|
116
|
+
} | {
|
|
117
|
+
shown: true;
|
|
118
|
+
data: import("../charts").Spreadsheet;
|
|
119
|
+
};
|
|
120
|
+
pendingImageElementId: string | null;
|
|
121
|
+
showHyperlinkPopup: false | "editor" | "info";
|
|
122
|
+
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
123
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
124
|
+
originSnapOffset: {
|
|
125
|
+
x: number;
|
|
126
|
+
y: number;
|
|
127
|
+
} | null;
|
|
128
|
+
};
|
|
129
|
+
commitToHistory: false;
|
|
130
|
+
};
|
|
131
|
+
checked: (appState: Readonly<import("../types").AppState>) => boolean;
|
|
132
|
+
predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps) => boolean;
|
|
133
|
+
contextItemLabel: string;
|
|
134
|
+
keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
|
|
135
|
+
} & {
|
|
136
|
+
keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
|
|
137
|
+
};
|
|
@@ -38,15 +38,9 @@ export declare const actionToggleStats: {
|
|
|
38
38
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
39
39
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
40
40
|
activeTool: {
|
|
41
|
-
lastActiveTool: import("../types").
|
|
41
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
42
42
|
locked: boolean;
|
|
43
|
-
} & (
|
|
44
|
-
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
45
|
-
customType: null;
|
|
46
|
-
} | {
|
|
47
|
-
type: "custom";
|
|
48
|
-
customType: string;
|
|
49
|
-
});
|
|
43
|
+
} & import("../types").ActiveTool;
|
|
50
44
|
penMode: boolean;
|
|
51
45
|
penDetected: boolean;
|
|
52
46
|
exportBackground: boolean;
|
|
@@ -124,12 +118,18 @@ export declare const actionToggleStats: {
|
|
|
124
118
|
pendingImageElementId: string | null;
|
|
125
119
|
showHyperlinkPopup: false | "editor" | "info";
|
|
126
120
|
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
121
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
122
|
+
originSnapOffset: {
|
|
123
|
+
x: number;
|
|
124
|
+
y: number;
|
|
125
|
+
} | null;
|
|
126
|
+
objectsSnapModeEnabled: boolean;
|
|
127
127
|
};
|
|
128
128
|
commitToHistory: false;
|
|
129
129
|
};
|
|
130
130
|
checked: (appState: Readonly<import("../types").AppState>) => boolean;
|
|
131
131
|
contextItemLabel: string;
|
|
132
|
-
keyTest: (event:
|
|
132
|
+
keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
|
|
133
133
|
} & {
|
|
134
|
-
keyTest?: ((event:
|
|
134
|
+
keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
|
|
135
135
|
};
|
|
@@ -39,15 +39,9 @@ export declare const actionToggleViewMode: {
|
|
|
39
39
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
40
40
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
41
41
|
activeTool: {
|
|
42
|
-
lastActiveTool: import("../types").
|
|
42
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
43
43
|
locked: boolean;
|
|
44
|
-
} & (
|
|
45
|
-
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
46
|
-
customType: null;
|
|
47
|
-
} | {
|
|
48
|
-
type: "custom";
|
|
49
|
-
customType: string;
|
|
50
|
-
});
|
|
44
|
+
} & import("../types").ActiveTool;
|
|
51
45
|
penMode: boolean;
|
|
52
46
|
penDetected: boolean;
|
|
53
47
|
exportBackground: boolean;
|
|
@@ -125,13 +119,19 @@ export declare const actionToggleViewMode: {
|
|
|
125
119
|
pendingImageElementId: string | null;
|
|
126
120
|
showHyperlinkPopup: false | "editor" | "info";
|
|
127
121
|
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
122
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
123
|
+
originSnapOffset: {
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
} | null;
|
|
127
|
+
objectsSnapModeEnabled: boolean;
|
|
128
128
|
};
|
|
129
129
|
commitToHistory: false;
|
|
130
130
|
};
|
|
131
131
|
checked: (appState: Readonly<import("../types").AppState>) => boolean;
|
|
132
132
|
predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps) => boolean;
|
|
133
133
|
contextItemLabel: string;
|
|
134
|
-
keyTest: (event:
|
|
134
|
+
keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
|
|
135
135
|
} & {
|
|
136
|
-
keyTest?: ((event:
|
|
136
|
+
keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
|
|
137
137
|
};
|
|
@@ -39,15 +39,9 @@ export declare const actionToggleZenMode: {
|
|
|
39
39
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
40
40
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
41
41
|
activeTool: {
|
|
42
|
-
lastActiveTool: import("../types").
|
|
42
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
43
43
|
locked: boolean;
|
|
44
|
-
} & (
|
|
45
|
-
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
46
|
-
customType: null;
|
|
47
|
-
} | {
|
|
48
|
-
type: "custom";
|
|
49
|
-
customType: string;
|
|
50
|
-
});
|
|
44
|
+
} & import("../types").ActiveTool;
|
|
51
45
|
penMode: boolean;
|
|
52
46
|
penDetected: boolean;
|
|
53
47
|
exportBackground: boolean;
|
|
@@ -125,13 +119,19 @@ export declare const actionToggleZenMode: {
|
|
|
125
119
|
pendingImageElementId: string | null;
|
|
126
120
|
showHyperlinkPopup: false | "editor" | "info";
|
|
127
121
|
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
122
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
123
|
+
originSnapOffset: {
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
} | null;
|
|
127
|
+
objectsSnapModeEnabled: boolean;
|
|
128
128
|
};
|
|
129
129
|
commitToHistory: false;
|
|
130
130
|
};
|
|
131
131
|
checked: (appState: Readonly<import("../types").AppState>) => boolean;
|
|
132
132
|
predicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps) => boolean;
|
|
133
133
|
contextItemLabel: string;
|
|
134
|
-
keyTest: (event:
|
|
134
|
+
keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
|
|
135
135
|
} & {
|
|
136
|
-
keyTest?: ((event:
|
|
136
|
+
keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
|
|
137
137
|
};
|
|
@@ -11,10 +11,10 @@ export declare const actionSendBackward: {
|
|
|
11
11
|
};
|
|
12
12
|
contextItemLabel: string;
|
|
13
13
|
keyPriority: number;
|
|
14
|
-
keyTest: (event:
|
|
14
|
+
keyTest: (event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean;
|
|
15
15
|
PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => JSX.Element;
|
|
16
16
|
} & {
|
|
17
|
-
keyTest?: ((event:
|
|
17
|
+
keyTest?: ((event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
|
|
18
18
|
};
|
|
19
19
|
export declare const actionBringForward: {
|
|
20
20
|
name: "bringForward";
|
|
@@ -28,10 +28,10 @@ export declare const actionBringForward: {
|
|
|
28
28
|
};
|
|
29
29
|
contextItemLabel: string;
|
|
30
30
|
keyPriority: number;
|
|
31
|
-
keyTest: (event:
|
|
31
|
+
keyTest: (event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean;
|
|
32
32
|
PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => JSX.Element;
|
|
33
33
|
} & {
|
|
34
|
-
keyTest?: ((event:
|
|
34
|
+
keyTest?: ((event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
|
|
35
35
|
};
|
|
36
36
|
export declare const actionSendToBack: {
|
|
37
37
|
name: "sendToBack";
|
|
@@ -44,10 +44,10 @@ export declare const actionSendToBack: {
|
|
|
44
44
|
commitToHistory: true;
|
|
45
45
|
};
|
|
46
46
|
contextItemLabel: string;
|
|
47
|
-
keyTest: (event:
|
|
47
|
+
keyTest: (event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean;
|
|
48
48
|
PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => JSX.Element;
|
|
49
49
|
} & {
|
|
50
|
-
keyTest?: ((event:
|
|
50
|
+
keyTest?: ((event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
|
|
51
51
|
};
|
|
52
52
|
export declare const actionBringToFront: {
|
|
53
53
|
name: "bringToFront";
|
|
@@ -60,8 +60,8 @@ export declare const actionBringToFront: {
|
|
|
60
60
|
commitToHistory: true;
|
|
61
61
|
};
|
|
62
62
|
contextItemLabel: string;
|
|
63
|
-
keyTest: (event:
|
|
63
|
+
keyTest: (event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean;
|
|
64
64
|
PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => JSX.Element;
|
|
65
65
|
} & {
|
|
66
|
-
keyTest?: ((event:
|
|
66
|
+
keyTest?: ((event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
|
|
67
67
|
};
|
package/types/actions/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { actionFlipHorizontal, actionFlipVertical } from "./actionFlip";
|
|
|
17
17
|
export { actionCopy, actionCut, actionCopyAsPng, actionCopyAsSvg, copyText, } from "./actionClipboard";
|
|
18
18
|
export { actionToggleGridMode } from "./actionToggleGridMode";
|
|
19
19
|
export { actionToggleZenMode } from "./actionToggleZenMode";
|
|
20
|
+
export { actionToggleObjectsSnapMode } from "./actionToggleObjectsSnapMode";
|
|
20
21
|
export { actionToggleStats } from "./actionToggleStats";
|
|
21
22
|
export { actionUnbindText, actionBindText } from "./actionBoundText";
|
|
22
23
|
export { actionLink } from "../element/Hyperlink";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SubtypeOf } from "../utility-types";
|
|
2
2
|
import { ActionName } from "./types";
|
|
3
|
-
export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock"> | "saveScene" | "imageExport";
|
|
3
|
+
export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock"> | "saveScene" | "imageExport";
|
|
4
4
|
export declare const getShortcutFromShortcutName: (name: ShortcutName) => string;
|
package/types/actions/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type ActionResult = {
|
|
|
15
15
|
type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
16
16
|
export type UpdaterFn = (res: ActionResult) => void;
|
|
17
17
|
export type ActionFilterFn = (action: Action) => void;
|
|
18
|
-
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "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" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer";
|
|
18
|
+
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "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" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer";
|
|
19
19
|
export type PanelComponentProps = {
|
|
20
20
|
elements: readonly ExcalidrawElement[];
|
|
21
21
|
appState: AppState;
|
package/types/appState.d.ts
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
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
|
-
theme?: import("./element/types").Theme | undefined;
|
|
5
|
-
name?: string | undefined;
|
|
6
4
|
activeTool?: ({
|
|
7
|
-
lastActiveTool: import("./types").
|
|
5
|
+
lastActiveTool: import("./types").ActiveTool | null;
|
|
8
6
|
locked: boolean;
|
|
9
|
-
} & (
|
|
10
|
-
|
|
11
|
-
customType: null;
|
|
12
|
-
} | {
|
|
13
|
-
type: "custom";
|
|
14
|
-
customType: string;
|
|
15
|
-
})) | undefined;
|
|
16
|
-
penMode?: boolean | undefined;
|
|
7
|
+
} & import("./types").ActiveTool) | undefined;
|
|
8
|
+
name?: string | undefined;
|
|
17
9
|
showWelcomeScreen?: boolean | undefined;
|
|
10
|
+
penMode?: boolean | undefined;
|
|
18
11
|
penDetected?: boolean | undefined;
|
|
19
12
|
exportBackground?: boolean | undefined;
|
|
20
13
|
exportEmbedScene?: boolean | undefined;
|
|
@@ -56,6 +49,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
56
49
|
} | undefined;
|
|
57
50
|
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
58
51
|
zenModeEnabled?: boolean | undefined;
|
|
52
|
+
theme?: import("./element/types").Theme | undefined;
|
|
59
53
|
gridSize?: number | null | undefined;
|
|
60
54
|
selectedGroupIds?: {
|
|
61
55
|
[groupId: string]: boolean;
|
|
@@ -64,6 +58,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
64
58
|
showStats?: boolean | undefined;
|
|
65
59
|
currentChartType?: import("./element/types").ChartType | undefined;
|
|
66
60
|
selectedLinearElement?: import("./element/linearElementEditor").LinearElementEditor | null | undefined;
|
|
61
|
+
objectsSnapModeEnabled?: boolean | undefined;
|
|
67
62
|
};
|
|
68
63
|
export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
|
|
69
64
|
viewBackgroundColor?: string | undefined;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { ActionManager } from "../actions/manager";
|
|
3
2
|
import { ExcalidrawElement, PointerType } from "../element/types";
|
|
4
|
-
import { UIAppState, Zoom } from "../types";
|
|
3
|
+
import { AppClassProperties, UIAppState, Zoom } from "../types";
|
|
5
4
|
import "./Actions.scss";
|
|
6
5
|
export declare const SelectedShapeActions: ({ appState, elements, renderAction, }: {
|
|
7
6
|
appState: UIAppState;
|
|
8
7
|
elements: readonly ExcalidrawElement[];
|
|
9
8
|
renderAction: ActionManager["renderAction"];
|
|
10
9
|
}) => JSX.Element;
|
|
11
|
-
export declare const ShapesSwitcher: ({ interactiveCanvas, activeTool,
|
|
10
|
+
export declare const ShapesSwitcher: ({ interactiveCanvas, activeTool, onImageAction, appState, app, }: {
|
|
12
11
|
interactiveCanvas: HTMLCanvasElement | null;
|
|
13
12
|
activeTool: UIAppState["activeTool"];
|
|
14
|
-
setAppState: React.Component<any, UIAppState>["setState"];
|
|
15
13
|
onImageAction: (data: {
|
|
16
14
|
pointerType: PointerType | null;
|
|
17
15
|
}) => void;
|
|
18
16
|
appState: UIAppState;
|
|
17
|
+
app: AppClassProperties;
|
|
19
18
|
}) => JSX.Element;
|
|
20
19
|
export declare const ZoomActions: ({ renderAction, zoom, }: {
|
|
21
20
|
renderAction: ActionManager["renderAction"];
|
|
@@ -6,9 +6,10 @@ import { LinearElementEditor } from "../element/linearElementEditor";
|
|
|
6
6
|
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
7
7
|
import History from "../history";
|
|
8
8
|
import Scene from "../scene/Scene";
|
|
9
|
-
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName } from "../types";
|
|
9
|
+
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType } from "../types";
|
|
10
10
|
import { FileSystemHandle } from "../data/filesystem";
|
|
11
11
|
import { Renderer } from "../scene/Renderer";
|
|
12
|
+
import { LaserPathManager } from "./LaserTool/LaserPathManager";
|
|
12
13
|
export declare const ExcalidrawContainerContext: React.Context<{
|
|
13
14
|
container: HTMLDivElement | null;
|
|
14
15
|
id: string | null;
|
|
@@ -54,12 +55,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
54
55
|
imageCache: AppClassProperties["imageCache"];
|
|
55
56
|
private iFrameRefs;
|
|
56
57
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
59
|
+
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
59
60
|
lastViewportPosition: {
|
|
60
61
|
x: number;
|
|
61
62
|
y: number;
|
|
62
63
|
};
|
|
64
|
+
laserPathManager: LaserPathManager;
|
|
63
65
|
constructor(props: AppProps);
|
|
64
66
|
private onWindowMessage;
|
|
65
67
|
private updateEmbeddableRef;
|
|
@@ -117,7 +119,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
117
119
|
outline: boolean;
|
|
118
120
|
clip: boolean;
|
|
119
121
|
}> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
120
|
-
togglePenMode: () => void;
|
|
122
|
+
togglePenMode: (force?: boolean) => void;
|
|
121
123
|
onHandToolToggle: () => void;
|
|
122
124
|
/**
|
|
123
125
|
* Zooms on canvas viewport center
|
|
@@ -169,7 +171,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
169
171
|
private onKeyDown;
|
|
170
172
|
private onWheel;
|
|
171
173
|
private onKeyUp;
|
|
172
|
-
|
|
174
|
+
setActiveTool: (tool: {
|
|
175
|
+
type: ToolType;
|
|
176
|
+
} | {
|
|
177
|
+
type: "custom";
|
|
178
|
+
customType: string;
|
|
179
|
+
}) => void;
|
|
173
180
|
private setCursor;
|
|
174
181
|
private resetCursor;
|
|
175
182
|
/**
|
|
@@ -220,6 +227,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
220
227
|
private getCurrentItemRoundness;
|
|
221
228
|
private createGenericElementOnPointerDown;
|
|
222
229
|
private createFrameElementOnPointerDown;
|
|
230
|
+
private maybeCacheReferenceSnapPoints;
|
|
231
|
+
private maybeCacheVisibleGaps;
|
|
223
232
|
private onKeyDownFromPointerDownHandler;
|
|
224
233
|
private onKeyUpFromPointerDownHandler;
|
|
225
234
|
private onPointerMoveFromPointerDownHandler;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LaserPointer } from "@excalidraw/laser-pointer";
|
|
2
|
+
import App from "../App";
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
LPM: LaserPathManager;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare class LaserPathManager {
|
|
9
|
+
private app;
|
|
10
|
+
private ownState;
|
|
11
|
+
private collaboratorsState;
|
|
12
|
+
private rafId;
|
|
13
|
+
private isDrawing;
|
|
14
|
+
private container;
|
|
15
|
+
constructor(app: App);
|
|
16
|
+
destroy(): void;
|
|
17
|
+
startPath(x: number, y: number): void;
|
|
18
|
+
addPointToPath(x: number, y: number): void;
|
|
19
|
+
endPath(): void;
|
|
20
|
+
private updatePath;
|
|
21
|
+
private isRunning;
|
|
22
|
+
start(svg?: SVGSVGElement): void;
|
|
23
|
+
stop(): void;
|
|
24
|
+
loop(): void;
|
|
25
|
+
draw(path: LaserPointer): string;
|
|
26
|
+
updateCollabolatorsState(): void;
|
|
27
|
+
update(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "../ToolIcon.scss";
|
|
2
|
+
type LaserPointerIconProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
checked: boolean;
|
|
6
|
+
onChange?(): void;
|
|
7
|
+
isMobile?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const LaserPointerButton: (props: LaserPointerIconProps) => JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -28,6 +28,7 @@ interface LayerUIProps {
|
|
|
28
28
|
renderWelcomeScreen: boolean;
|
|
29
29
|
children?: React.ReactNode;
|
|
30
30
|
app: AppClassProperties;
|
|
31
|
+
isCollaborating: boolean;
|
|
31
32
|
}
|
|
32
|
-
declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, interactiveCanvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, onExportImage, renderWelcomeScreen, children, app, }: LayerUIProps) => JSX.Element>;
|
|
33
|
+
declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, interactiveCanvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, onExportImage, renderWelcomeScreen, children, app, isCollaborating, }: LayerUIProps) => JSX.Element>;
|
|
33
34
|
export default _default;
|
|
@@ -22,7 +22,7 @@ export declare const SidebarInner: React.ForwardRefExoticComponent<Pick<{
|
|
|
22
22
|
docked?: boolean | undefined;
|
|
23
23
|
className?: string | undefined;
|
|
24
24
|
__fallback?: boolean | undefined;
|
|
25
|
-
} & Omit<React.RefAttributes<HTMLDivElement>, "onSelect">, "
|
|
25
|
+
} & Omit<React.RefAttributes<HTMLDivElement>, "onSelect">, "name" | "children" | "key" | "className" | "onDock" | "docked" | "onStateChange" | "__fallback"> & React.RefAttributes<HTMLDivElement>>;
|
|
26
26
|
export declare const Sidebar: React.ForwardRefExoticComponent<{
|
|
27
27
|
name: string;
|
|
28
28
|
children: React.ReactNode;
|
|
@@ -10,7 +10,7 @@ type StackProps = {
|
|
|
10
10
|
ref: React.RefObject<HTMLDivElement>;
|
|
11
11
|
};
|
|
12
12
|
declare const _default: {
|
|
13
|
-
Row: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "
|
|
14
|
-
Col: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "
|
|
13
|
+
Row: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "children" | "align" | "gap" | "className" | "justifyContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
Col: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "children" | "align" | "gap" | "className" | "justifyContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
15
|
};
|
|
16
16
|
export default _default;
|
|
@@ -25,29 +25,32 @@ declare const DropdownMenu: {
|
|
|
25
25
|
displayName: string;
|
|
26
26
|
};
|
|
27
27
|
Item: {
|
|
28
|
-
({ icon, onSelect, children, shortcut, className, ...rest }: {
|
|
28
|
+
({ icon, onSelect, children, shortcut, className, selected, ...rest }: {
|
|
29
29
|
icon?: JSX.Element | undefined;
|
|
30
30
|
onSelect: (event: Event) => void;
|
|
31
31
|
children: React.ReactNode;
|
|
32
32
|
shortcut?: string | undefined;
|
|
33
|
+
selected?: boolean | undefined;
|
|
33
34
|
className?: string | undefined;
|
|
34
35
|
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onSelect">): JSX.Element;
|
|
35
36
|
displayName: string;
|
|
36
37
|
};
|
|
37
38
|
ItemLink: {
|
|
38
|
-
({ icon, shortcut, href, children, onSelect, className, ...rest }: {
|
|
39
|
+
({ icon, shortcut, href, children, onSelect, className, selected, ...rest }: {
|
|
39
40
|
href: string;
|
|
40
41
|
icon?: JSX.Element | undefined;
|
|
41
42
|
children: React.ReactNode;
|
|
42
43
|
shortcut?: string | undefined;
|
|
43
44
|
className?: string | undefined;
|
|
45
|
+
selected?: boolean | undefined;
|
|
44
46
|
onSelect?: ((event: Event) => void) | undefined;
|
|
45
47
|
} & React.AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element;
|
|
46
48
|
displayName: string;
|
|
47
49
|
};
|
|
48
|
-
ItemCustom: ({ children, className, ...rest }: {
|
|
50
|
+
ItemCustom: ({ children, className, selected, ...rest }: {
|
|
49
51
|
children: React.ReactNode;
|
|
50
52
|
className?: string | undefined;
|
|
53
|
+
selected?: boolean | undefined;
|
|
51
54
|
} & React.HTMLAttributes<HTMLDivElement>) => JSX.Element;
|
|
52
55
|
Group: {
|
|
53
56
|
({ children, className, style, title, }: {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
declare const DropdownMenuItem: {
|
|
3
|
-
({ icon, onSelect, children, shortcut, className, ...rest }: {
|
|
3
|
+
({ icon, onSelect, children, shortcut, className, selected, ...rest }: {
|
|
4
4
|
icon?: JSX.Element | undefined;
|
|
5
5
|
onSelect: (event: Event) => void;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
shortcut?: string | undefined;
|
|
8
|
+
selected?: boolean | undefined;
|
|
8
9
|
className?: string | undefined;
|
|
9
10
|
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onSelect">): JSX.Element;
|
|
10
11
|
displayName: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
declare const DropdownMenuItemCustom: ({ children, className, ...rest }: {
|
|
2
|
+
declare const DropdownMenuItemCustom: ({ children, className, selected, ...rest }: {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
className?: string | undefined;
|
|
5
|
+
selected?: boolean | undefined;
|
|
5
6
|
} & React.HTMLAttributes<HTMLDivElement>) => JSX.Element;
|
|
6
7
|
export default DropdownMenuItemCustom;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
declare const DropdownMenuItemLink: {
|
|
3
|
-
({ icon, shortcut, href, children, onSelect, className, ...rest }: {
|
|
3
|
+
({ icon, shortcut, href, children, onSelect, className, selected, ...rest }: {
|
|
4
4
|
href: string;
|
|
5
5
|
icon?: JSX.Element | undefined;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
shortcut?: string | undefined;
|
|
8
8
|
className?: string | undefined;
|
|
9
|
+
selected?: boolean | undefined;
|
|
9
10
|
onSelect?: ((event: Event) => void) | undefined;
|
|
10
11
|
} & React.AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element;
|
|
11
12
|
displayName: string;
|
|
@@ -2,5 +2,5 @@ import React from "react";
|
|
|
2
2
|
export declare const DropdownMenuContentPropsContext: React.Context<{
|
|
3
3
|
onSelect?: ((event: Event) => void) | undefined;
|
|
4
4
|
}>;
|
|
5
|
-
export declare const getDropdownMenuItemClassName: (className?: string) => string;
|
|
5
|
+
export declare const getDropdownMenuItemClassName: (className?: string, selected?: boolean) => string;
|
|
6
6
|
export declare const useHandleDropdownMenuItemClick: (origOnClick: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement> | undefined, onSelect: ((event: Event) => void) | undefined) => (event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>) => void;
|