@dwelle/excalidraw 0.4.0-d8d86cf → 0.4.0-e03b600
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 +458 -0
- package/README.md +18 -1422
- package/dist/excalidraw.development.js +1882 -498
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +20 -0
- package/package.json +3 -3
- package/types/actions/actionAddToLibrary.d.ts +68 -34
- package/types/actions/actionAlign.d.ts +12 -18
- package/types/actions/actionBoundText.d.ts +158 -19
- package/types/actions/actionCanvas.d.ts +544 -118
- package/types/actions/actionClipboard.d.ts +132 -59
- package/types/actions/actionDeleteSelected.d.ts +72 -41
- package/types/actions/actionDistribute.d.ts +2 -6
- package/types/actions/actionDuplicateSelection.d.ts +2 -4
- package/types/actions/actionElementLock.d.ts +254 -0
- package/types/actions/actionExport.d.ts +215 -131
- package/types/actions/actionFinalize.d.ts +47 -27
- package/types/actions/actionFlip.d.ts +2 -4
- package/types/actions/actionFrame.d.ts +397 -0
- package/types/actions/actionGroup.d.ts +6 -10
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +25 -13
- package/types/actions/actionMenu.d.ts +73 -46
- package/types/actions/actionNavigate.d.ts +2 -3
- package/types/actions/actionProperties.d.ts +315 -198
- package/types/actions/actionStyles.d.ts +23 -12
- package/types/actions/actionToggleGridMode.d.ts +25 -12
- package/types/actions/actionToggleStats.d.ts +24 -12
- package/types/actions/actionToggleViewMode.d.ts +25 -12
- package/types/actions/actionToggleZenMode.d.ts +25 -12
- package/types/actions/actionZindex.d.ts +8 -16
- package/types/actions/index.d.ts +1 -1
- package/types/actions/manager.d.ts +3 -2
- package/types/actions/shortcuts.d.ts +2 -1
- package/types/actions/types.d.ts +13 -11
- package/types/appState.d.ts +16 -12
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +5 -6
- package/types/clipboard.d.ts +2 -2
- package/types/colors.d.ts +60 -5
- package/types/components/Actions.d.ts +5 -5
- package/types/components/ActiveConfirmDialog.d.ts +4 -0
- package/types/components/App.d.ts +58 -68
- package/types/components/Avatar.d.ts +1 -2
- package/types/components/BraveMeasureTextError.d.ts +2 -0
- package/types/components/Button.d.ts +17 -0
- package/types/components/ButtonIconSelect.d.ts +11 -3
- package/types/components/Card.d.ts +7 -0
- package/types/components/ColorPicker/ColorInput.d.ts +7 -0
- package/types/components/ColorPicker/ColorPicker.d.ts +19 -0
- package/types/components/ColorPicker/CustomColorList.d.ts +8 -0
- package/types/components/ColorPicker/HotkeyLabel.d.ts +8 -0
- package/types/components/ColorPicker/Picker.d.ts +18 -0
- package/types/components/ColorPicker/PickerColorList.d.ts +10 -0
- package/types/components/ColorPicker/PickerHeading.d.ts +5 -0
- package/types/components/ColorPicker/ShadeList.d.ts +8 -0
- package/types/components/ColorPicker/TopPicks.d.ts +9 -0
- package/types/components/ColorPicker/colorPickerUtils.d.ts +21 -0
- package/types/components/ColorPicker/keyboardNavHandlers.d.ts +21 -0
- package/types/components/ContextMenu.d.ts +9 -22
- package/types/components/DefaultSidebar.d.ts +30 -0
- package/types/components/Dialog.d.ts +3 -4
- package/types/components/ErrorDialog.d.ts +3 -2
- package/types/components/EyeDropper.d.ts +18 -0
- package/types/components/FilledButton.d.ts +17 -0
- package/types/components/FixedSideContainer.d.ts +1 -1
- package/types/components/HandButton.d.ts +10 -0
- package/types/components/HelpButton.d.ts +1 -2
- package/types/components/HintViewer.d.ts +2 -2
- package/types/components/HomeButton.d.ts +1 -1
- package/types/components/ImageExportDialog.d.ts +8 -13
- package/types/components/Island.d.ts +1 -1
- package/types/components/JSONExportDialog.d.ts +6 -4
- package/types/components/LayerUI.d.ts +7 -15
- package/types/components/LibraryMenu.d.ts +13 -14
- package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
- package/types/components/LibraryMenuControlButtons.d.ts +9 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +11 -5
- package/types/components/LibraryMenuItems.d.ts +6 -7
- package/types/components/LibraryMenuSection.d.ts +22 -0
- package/types/components/LibraryUnit.d.ts +7 -3
- package/types/components/LockButton.d.ts +1 -2
- package/types/components/MobileMenu.d.ts +8 -11
- package/types/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
- package/types/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
- package/types/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
- package/types/components/PasteChartDialog.d.ts +4 -5
- package/types/components/PenModeButton.d.ts +1 -1
- package/types/components/Popover.d.ts +1 -1
- package/types/components/ProjectName.d.ts +2 -1
- package/types/components/PublishLibrary.d.ts +2 -2
- package/types/components/RadioGroup.d.ts +12 -0
- package/types/components/Sidebar/Sidebar.d.ts +66 -63
- package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
- package/types/components/Sidebar/SidebarTab.d.ts +9 -0
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +10 -0
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +7 -0
- package/types/components/Sidebar/SidebarTabs.d.ts +7 -0
- package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
- package/types/components/Sidebar/common.d.ts +24 -7
- package/types/components/Spinner.d.ts +2 -1
- package/types/components/Stack.d.ts +4 -3
- package/types/components/Stats.d.ts +3 -3
- package/types/components/Switch.d.ts +9 -0
- package/types/components/ToolButton.d.ts +6 -5
- package/types/components/Tooltip.d.ts +1 -1
- package/types/components/Trans.d.ts +8 -0
- package/types/components/UserList.d.ts +0 -2
- package/types/components/dropdownMenu/DropdownMenu.d.ts +67 -0
- package/types/components/dropdownMenu/DropdownMenuContent.d.ts +15 -0
- package/types/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
- package/types/components/dropdownMenu/DropdownMenuItem.d.ts +12 -0
- package/types/components/dropdownMenu/DropdownMenuItemContent.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +13 -0
- package/types/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +11 -0
- package/types/components/dropdownMenu/common.d.ts +6 -0
- package/types/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -0
- package/types/components/footer/Footer.d.ts +12 -0
- package/types/components/footer/FooterCenter.d.ts +8 -0
- package/types/components/hoc/withInternalFallback.d.ts +4 -0
- package/types/components/icons.d.ts +14 -2
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +10 -0
- package/types/components/main-menu/DefaultItems.d.ts +47 -0
- package/types/components/main-menu/MainMenu.d.ts +61 -0
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +58 -0
- package/types/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
- package/types/components/welcome-screen/WelcomeScreen.d.ts +85 -0
- package/types/constants.d.ts +73 -16
- package/types/context/tunnels.d.ts +19 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/data/blob.d.ts +3 -2
- package/types/data/encode.d.ts +1 -1
- package/types/data/filesystem.d.ts +2 -1
- package/types/data/index.d.ts +1 -1
- package/types/data/library.d.ts +3 -45
- package/types/data/restore.d.ts +10 -4
- package/types/data/types.d.ts +3 -5
- package/types/element/Hyperlink.d.ts +27 -18
- package/types/element/binding.d.ts +3 -3
- package/types/element/bounds.d.ts +32 -7
- package/types/element/collision.d.ts +7 -7
- package/types/element/dragElements.d.ts +2 -1
- package/types/element/image.d.ts +11 -1
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +24 -13
- package/types/element/mutateElement.d.ts +2 -1
- package/types/element/newElement.d.ts +37 -11
- package/types/element/resizeElements.d.ts +1 -0
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/sortElements.d.ts +2 -0
- package/types/element/textElement.d.ts +40 -5
- package/types/element/textWysiwyg.d.ts +6 -1
- package/types/element/transformHandles.d.ts +12 -5
- package/types/element/typeChecks.d.ts +12 -2
- package/types/element/types.d.ts +53 -36
- package/types/emitter.d.ts +1 -1
- package/types/errors.d.ts +1 -1
- package/types/frame.d.ts +40 -0
- package/types/ga.d.ts +5 -5
- package/types/groups.d.ts +4 -0
- package/types/hooks/useCreatePortalContainer.d.ts +4 -0
- package/types/hooks/useLibraryItemSvg.d.ts +11 -0
- package/types/hooks/useOutsideClick.d.ts +19 -1
- package/types/hooks/useScrollPosition.d.ts +2 -0
- package/types/hooks/useTransition.d.ts +2 -0
- package/types/i18n.d.ts +7 -1
- package/types/jotai.d.ts +20 -108
- package/types/keys.d.ts +4 -4
- package/types/math.d.ts +4 -1
- package/types/packages/excalidraw/example/App.d.ts +7 -1
- package/types/packages/excalidraw/example/CustomFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/MobileFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/initialData.d.ts +6 -0
- package/types/packages/excalidraw/index.d.ts +17 -3
- package/types/packages/utils.d.ts +26 -25
- package/types/renderer/renderElement.d.ts +7 -5
- package/types/renderer/renderScene.d.ts +13 -6
- package/types/renderer/roundRect.d.ts +1 -1
- package/types/scene/Scene.d.ts +12 -5
- package/types/scene/comparisons.d.ts +1 -1
- package/types/scene/export.d.ts +157 -10
- package/types/scene/index.d.ts +1 -1
- package/types/scene/selection.d.ts +15 -5
- package/types/scene/types.d.ts +13 -5
- package/types/types.d.ts +126 -77
- package/types/utility-types.d.ts +22 -0
- package/types/utils.d.ts +30 -9
- package/types/zindex.d.ts +4 -4
- package/types/actions/actionToggleLock.d.ts +0 -116
- package/types/components/ActiveFile.d.ts +0 -7
- package/types/components/ClearCanvas.d.ts +0 -4
- package/types/components/CollabButton.d.ts +0 -6
- package/types/components/ColorPicker.d.ts +0 -14
- package/types/components/Footer.d.ts +0 -10
- package/types/components/LibraryButton.d.ts +0 -8
- package/types/components/MenuItem.d.ts +0 -11
- package/types/components/MenuUtils.d.ts +0 -1
- package/types/components/SingleLibraryItem.d.ts +0 -10
- package/types/components/WelcomeScreen.d.ts +0 -10
- package/types/components/WelcomeScreenDecor.d.ts +0 -6
- package/types/components/hoc/withUpstreamOverride.d.ts +0 -10
package/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, ExcalidrawImageElement, Theme } from "./element/types";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawFrameElement } from "./element/types";
|
|
3
3
|
import { SHAPES } from "./shapes";
|
|
4
4
|
import { Point as RoughPoint } from "roughjs/bin/geometry";
|
|
5
5
|
import { LinearElementEditor } from "./element/linearElementEditor";
|
|
@@ -14,9 +14,11 @@ import { isOverScrollBars } from "./scene";
|
|
|
14
14
|
import { MaybeTransformHandleType } from "./element/transformHandles";
|
|
15
15
|
import Library from "./data/library";
|
|
16
16
|
import type { FileSystemHandle } from "./data/filesystem";
|
|
17
|
-
import type {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
|
18
|
+
import { ContextMenuItems } from "./components/ContextMenu";
|
|
19
|
+
import { Merge, ForwardRef, ValueOf } from "./utility-types";
|
|
20
|
+
export type Point = Readonly<RoughPoint>;
|
|
21
|
+
export type Collaborator = {
|
|
20
22
|
pointer?: {
|
|
21
23
|
x: number;
|
|
22
24
|
y: number;
|
|
@@ -32,11 +34,11 @@ export declare type Collaborator = {
|
|
|
32
34
|
avatarUrl?: string;
|
|
33
35
|
id?: string;
|
|
34
36
|
};
|
|
35
|
-
export
|
|
37
|
+
export type DataURL = string & {
|
|
36
38
|
_brand: "DataURL";
|
|
37
39
|
};
|
|
38
|
-
export
|
|
39
|
-
mimeType: typeof
|
|
40
|
+
export type BinaryFileData = {
|
|
41
|
+
mimeType: ValueOf<typeof IMAGE_MIME_TYPES> | typeof MIME_TYPES.binary;
|
|
40
42
|
id: FileId;
|
|
41
43
|
dataURL: DataURL;
|
|
42
44
|
/**
|
|
@@ -52,19 +54,26 @@ export declare type BinaryFileData = {
|
|
|
52
54
|
*/
|
|
53
55
|
lastRetrieved?: number;
|
|
54
56
|
};
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
type: typeof SHAPES[number]["value"] | "eraser";
|
|
57
|
+
export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
58
|
+
export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
59
|
+
export type LastActiveTool = {
|
|
60
|
+
type: typeof SHAPES[number]["value"] | "eraser" | "hand" | "frame";
|
|
59
61
|
customType: null;
|
|
60
62
|
} | {
|
|
61
63
|
type: "custom";
|
|
62
64
|
customType: string;
|
|
63
65
|
} | null;
|
|
64
|
-
export
|
|
66
|
+
export type SidebarName = string;
|
|
67
|
+
export type SidebarTabName = string;
|
|
68
|
+
export type AppState = {
|
|
69
|
+
contextMenu: {
|
|
70
|
+
items: ContextMenuItems;
|
|
71
|
+
top: number;
|
|
72
|
+
left: number;
|
|
73
|
+
} | null;
|
|
65
74
|
showWelcomeScreen: boolean;
|
|
66
75
|
isLoading: boolean;
|
|
67
|
-
errorMessage:
|
|
76
|
+
errorMessage: React.ReactNode;
|
|
68
77
|
draggingElement: NonDeletedExcalidrawElement | null;
|
|
69
78
|
resizingElement: NonDeletedExcalidrawElement | null;
|
|
70
79
|
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
@@ -72,19 +81,26 @@ export declare type AppState = {
|
|
|
72
81
|
isBindingEnabled: boolean;
|
|
73
82
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
74
83
|
suggestedBindings: SuggestedBinding[];
|
|
84
|
+
frameToHighlight: NonDeleted<ExcalidrawFrameElement> | null;
|
|
85
|
+
shouldRenderFrames: boolean;
|
|
86
|
+
editingFrame: string | null;
|
|
87
|
+
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
75
88
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
76
89
|
editingLinearElement: LinearElementEditor | null;
|
|
77
90
|
activeTool: {
|
|
78
|
-
|
|
79
|
-
|
|
91
|
+
/**
|
|
92
|
+
* indicates a previous tool we should revert back to if we deselect the
|
|
93
|
+
* currently active tool. At the moment applies to `eraser` and `hand` tool.
|
|
94
|
+
*/
|
|
95
|
+
lastActiveTool: LastActiveTool;
|
|
80
96
|
locked: boolean;
|
|
97
|
+
} & ({
|
|
98
|
+
type: typeof SHAPES[number]["value"] | "eraser" | "hand" | "frame";
|
|
81
99
|
customType: null;
|
|
82
100
|
} | {
|
|
83
101
|
type: "custom";
|
|
84
102
|
customType: string;
|
|
85
|
-
|
|
86
|
-
locked: boolean;
|
|
87
|
-
};
|
|
103
|
+
});
|
|
88
104
|
penMode: boolean;
|
|
89
105
|
penDetected: boolean;
|
|
90
106
|
exportBackground: boolean;
|
|
@@ -101,10 +117,9 @@ export declare type AppState = {
|
|
|
101
117
|
currentItemFontFamily: FontFamilyValues;
|
|
102
118
|
currentItemFontSize: number;
|
|
103
119
|
currentItemTextAlign: TextAlign;
|
|
104
|
-
currentItemStrokeSharpness: ExcalidrawElement["strokeSharpness"];
|
|
105
120
|
currentItemStartArrowhead: Arrowhead | null;
|
|
106
121
|
currentItemEndArrowhead: Arrowhead | null;
|
|
107
|
-
|
|
122
|
+
currentItemRoundness: StrokeRoundness;
|
|
108
123
|
viewBackgroundColor: string;
|
|
109
124
|
scrollX: number;
|
|
110
125
|
scrollY: number;
|
|
@@ -115,10 +130,20 @@ export declare type AppState = {
|
|
|
115
130
|
isRotating: boolean;
|
|
116
131
|
zoom: Zoom;
|
|
117
132
|
openMenu: "canvas" | "shape" | null;
|
|
118
|
-
openPopup: "
|
|
119
|
-
openSidebar:
|
|
120
|
-
|
|
121
|
-
|
|
133
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
134
|
+
openSidebar: {
|
|
135
|
+
name: SidebarName;
|
|
136
|
+
tab?: SidebarTabName;
|
|
137
|
+
} | null;
|
|
138
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
139
|
+
/**
|
|
140
|
+
* Reflects user preference for whether the default sidebar should be docked.
|
|
141
|
+
*
|
|
142
|
+
* NOTE this is only a user preference and does not reflect the actual docked
|
|
143
|
+
* state of the sidebar, because the host apps can override this through
|
|
144
|
+
* a DefaultSidebar prop, which is not reflected back to the appState.
|
|
145
|
+
*/
|
|
146
|
+
defaultSidebarDockedPreference: boolean;
|
|
122
147
|
lastPointerDownWith: PointerType;
|
|
123
148
|
selectedElementIds: {
|
|
124
149
|
[id: string]: boolean;
|
|
@@ -126,6 +151,7 @@ export declare type AppState = {
|
|
|
126
151
|
previousSelectedElementIds: {
|
|
127
152
|
[id: string]: boolean;
|
|
128
153
|
};
|
|
154
|
+
selectedElementsAreBeingDragged: boolean;
|
|
129
155
|
shouldCacheIgnoreZoom: boolean;
|
|
130
156
|
toast: {
|
|
131
157
|
message: string;
|
|
@@ -163,17 +189,18 @@ export declare type AppState = {
|
|
|
163
189
|
showHyperlinkPopup: false | "info" | "editor";
|
|
164
190
|
selectedLinearElement: LinearElementEditor | null;
|
|
165
191
|
};
|
|
166
|
-
export
|
|
192
|
+
export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
|
|
193
|
+
export type NormalizedZoomValue = number & {
|
|
167
194
|
_brand: "normalizedZoom";
|
|
168
195
|
};
|
|
169
|
-
export
|
|
196
|
+
export type Zoom = Readonly<{
|
|
170
197
|
value: NormalizedZoomValue;
|
|
171
198
|
}>;
|
|
172
|
-
export
|
|
199
|
+
export type PointerCoords = Readonly<{
|
|
173
200
|
x: number;
|
|
174
201
|
y: number;
|
|
175
202
|
}>;
|
|
176
|
-
export
|
|
203
|
+
export type Gesture = {
|
|
177
204
|
pointers: Map<number, PointerCoords>;
|
|
178
205
|
lastCenter: {
|
|
179
206
|
x: number;
|
|
@@ -187,11 +214,11 @@ export declare class GestureEvent extends UIEvent {
|
|
|
187
214
|
readonly scale: number;
|
|
188
215
|
}
|
|
189
216
|
/** @deprecated legacy: do not use outside of migration paths */
|
|
190
|
-
export
|
|
217
|
+
export type LibraryItem_v1 = readonly NonDeleted<ExcalidrawElement>[];
|
|
191
218
|
/** @deprecated legacy: do not use outside of migration paths */
|
|
192
|
-
|
|
219
|
+
type LibraryItems_v1 = readonly LibraryItem_v1[];
|
|
193
220
|
/** v2 library item */
|
|
194
|
-
export
|
|
221
|
+
export type LibraryItem = {
|
|
195
222
|
id: string;
|
|
196
223
|
status: "published" | "unpublished";
|
|
197
224
|
elements: readonly NonDeleted<ExcalidrawElement>[];
|
|
@@ -200,14 +227,14 @@ export declare type LibraryItem = {
|
|
|
200
227
|
name?: string;
|
|
201
228
|
error?: string;
|
|
202
229
|
};
|
|
203
|
-
export
|
|
204
|
-
export
|
|
205
|
-
export
|
|
206
|
-
export
|
|
230
|
+
export type LibraryItems = readonly LibraryItem[];
|
|
231
|
+
export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
|
|
232
|
+
export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>) | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>;
|
|
233
|
+
export type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
|
|
207
234
|
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
208
235
|
ready?: false;
|
|
209
236
|
};
|
|
210
|
-
export
|
|
237
|
+
export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
|
|
211
238
|
scrollX?: number;
|
|
212
239
|
scrollY?: number;
|
|
213
240
|
libraryItems?: Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>;
|
|
@@ -216,13 +243,11 @@ export interface ExcalidrawProps {
|
|
|
216
243
|
id?: string | null;
|
|
217
244
|
onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles, id?: string | null) => void;
|
|
218
245
|
initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
|
|
219
|
-
onHomeButtonClick
|
|
220
|
-
onThemeToggle: (theme: Theme) => void;
|
|
246
|
+
onHomeButtonClick?: () => void;
|
|
221
247
|
user?: {
|
|
222
248
|
name?: string | null;
|
|
223
249
|
};
|
|
224
250
|
excalidrawRef?: ForwardRef<ExcalidrawAPIRefValue>;
|
|
225
|
-
onCollabButtonClick?: () => void;
|
|
226
251
|
isCollaborating?: boolean;
|
|
227
252
|
onPointerUpdate?: (payload: {
|
|
228
253
|
pointer: {
|
|
@@ -233,8 +258,7 @@ export interface ExcalidrawProps {
|
|
|
233
258
|
pointersMap: Gesture["pointers"];
|
|
234
259
|
}) => void;
|
|
235
260
|
onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
|
|
236
|
-
renderTopRightUI?: (isMobile: boolean, appState:
|
|
237
|
-
renderFooter?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
|
|
261
|
+
renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
238
262
|
langCode?: Language["code"];
|
|
239
263
|
viewModeEnabled?: boolean;
|
|
240
264
|
zenModeEnabled?: boolean;
|
|
@@ -242,27 +266,21 @@ export interface ExcalidrawProps {
|
|
|
242
266
|
libraryReturnUrl?: string;
|
|
243
267
|
theme?: Theme;
|
|
244
268
|
name?: string;
|
|
245
|
-
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState:
|
|
246
|
-
UIOptions?:
|
|
247
|
-
dockedSidebarBreakpoint?: number;
|
|
248
|
-
canvasActions?: CanvasActions;
|
|
249
|
-
};
|
|
269
|
+
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
|
|
270
|
+
UIOptions?: Partial<UIOptions>;
|
|
250
271
|
detectScroll?: boolean;
|
|
251
272
|
handleKeyboardGlobally?: boolean;
|
|
252
273
|
onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
|
|
253
274
|
autoFocus?: boolean;
|
|
254
275
|
generateIdForFile?: (file: File) => string | Promise<string>;
|
|
255
276
|
onLinkOpen?: (element: NonDeletedExcalidrawElement, event: CustomEvent<{
|
|
256
|
-
nativeEvent: MouseEvent | React.PointerEvent<
|
|
277
|
+
nativeEvent: MouseEvent | React.PointerEvent<HTMLElement>;
|
|
257
278
|
}>) => void;
|
|
258
279
|
onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
|
|
259
280
|
onScrollChange?: (scrollX: number, scrollY: number) => void;
|
|
260
|
-
|
|
261
|
-
* Render function that renders custom <Sidebar /> component.
|
|
262
|
-
*/
|
|
263
|
-
renderSidebar?: () => JSX.Element | null;
|
|
281
|
+
children?: React.ReactNode;
|
|
264
282
|
}
|
|
265
|
-
export
|
|
283
|
+
export type SceneData = {
|
|
266
284
|
elements?: ImportedDataState["elements"];
|
|
267
285
|
appState?: ImportedDataState["appState"];
|
|
268
286
|
collaborators?: Map<string, Collaborator>;
|
|
@@ -273,27 +291,32 @@ export declare enum UserIdleState {
|
|
|
273
291
|
AWAY = "away",
|
|
274
292
|
IDLE = "idle"
|
|
275
293
|
}
|
|
276
|
-
export
|
|
294
|
+
export type ExportOpts = {
|
|
277
295
|
saveFileToDisk?: boolean;
|
|
278
|
-
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState:
|
|
279
|
-
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState:
|
|
280
|
-
};
|
|
281
|
-
declare type CanvasActions = {
|
|
282
|
-
changeViewBackgroundColor?: boolean;
|
|
283
|
-
clearCanvas?: boolean;
|
|
284
|
-
export?: false | ExportOpts;
|
|
285
|
-
loadScene?: boolean;
|
|
286
|
-
saveToActiveFile?: boolean;
|
|
287
|
-
toggleTheme?: boolean | null;
|
|
288
|
-
saveAsImage?: boolean;
|
|
296
|
+
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => void;
|
|
297
|
+
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => JSX.Element;
|
|
289
298
|
};
|
|
290
|
-
|
|
291
|
-
|
|
299
|
+
type CanvasActions = Partial<{
|
|
300
|
+
changeViewBackgroundColor: boolean;
|
|
301
|
+
clearCanvas: boolean;
|
|
302
|
+
export: false | ExportOpts;
|
|
303
|
+
loadScene: boolean;
|
|
304
|
+
saveToActiveFile: boolean;
|
|
305
|
+
toggleTheme: boolean | null;
|
|
306
|
+
saveAsImage: boolean;
|
|
307
|
+
}>;
|
|
308
|
+
type UIOptions = Partial<{
|
|
309
|
+
dockedSidebarBreakpoint: number;
|
|
310
|
+
canvasActions: CanvasActions;
|
|
311
|
+
/** @deprecated does nothing. Will be removed in 0.15 */
|
|
312
|
+
welcomeScreen?: boolean;
|
|
313
|
+
}>;
|
|
314
|
+
export type AppProps = Merge<ExcalidrawProps, {
|
|
315
|
+
UIOptions: Merge<UIOptions, {
|
|
292
316
|
canvasActions: Required<CanvasActions> & {
|
|
293
317
|
export: ExportOpts;
|
|
294
318
|
};
|
|
295
|
-
|
|
296
|
-
};
|
|
319
|
+
}>;
|
|
297
320
|
detectScroll: boolean;
|
|
298
321
|
handleKeyboardGlobally: boolean;
|
|
299
322
|
isCollaborating: boolean;
|
|
@@ -301,20 +324,25 @@ export declare type AppProps = Merge<ExcalidrawProps, {
|
|
|
301
324
|
}>;
|
|
302
325
|
/** A subset of App class properties that we need to use elsewhere
|
|
303
326
|
* in the app, eg Manager. Factored out into a separate type to keep DRY. */
|
|
304
|
-
export
|
|
327
|
+
export type AppClassProperties = {
|
|
305
328
|
props: AppProps;
|
|
306
329
|
canvas: HTMLCanvasElement | null;
|
|
307
330
|
focusContainer(): void;
|
|
308
331
|
library: Library;
|
|
309
332
|
imageCache: Map<FileId, {
|
|
310
333
|
image: HTMLImageElement | Promise<HTMLImageElement>;
|
|
311
|
-
mimeType: typeof
|
|
334
|
+
mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
312
335
|
}>;
|
|
313
336
|
files: BinaryFiles;
|
|
314
337
|
device: App["device"];
|
|
315
338
|
scene: App["scene"];
|
|
339
|
+
pasteFromClipboard: App["pasteFromClipboard"];
|
|
340
|
+
id: App["id"];
|
|
341
|
+
onInsertElements: App["onInsertElements"];
|
|
342
|
+
onExportImage: App["onExportImage"];
|
|
343
|
+
lastViewportPosition: App["lastViewportPosition"];
|
|
316
344
|
};
|
|
317
|
-
export
|
|
345
|
+
export type PointerDownState = Readonly<{
|
|
318
346
|
origin: Readonly<{
|
|
319
347
|
x: number;
|
|
320
348
|
y: number;
|
|
@@ -373,8 +401,8 @@ export declare type PointerDownState = Readonly<{
|
|
|
373
401
|
};
|
|
374
402
|
};
|
|
375
403
|
}>;
|
|
376
|
-
|
|
377
|
-
export
|
|
404
|
+
type UnsubscribeCallback = () => void;
|
|
405
|
+
export type ExcalidrawImperativeAPI = {
|
|
378
406
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
379
407
|
updateLibrary: InstanceType<typeof Library>["updateLibrary"];
|
|
380
408
|
resetScene: InstanceType<typeof App>["resetScene"];
|
|
@@ -395,16 +423,37 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
395
423
|
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
396
424
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
397
425
|
resetCursor: InstanceType<typeof App>["resetCursor"];
|
|
398
|
-
|
|
426
|
+
toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
|
|
399
427
|
app: InstanceType<typeof App>;
|
|
400
428
|
onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
|
|
401
|
-
onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<
|
|
429
|
+
onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
|
|
402
430
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
431
|
+
/**
|
|
432
|
+
* Disables rendering of frames (including element clipping), but currently
|
|
433
|
+
* the frames are still interactive in edit mode. As such, this API should be
|
|
434
|
+
* used in conjunction with view mode (props.viewModeEnabled).
|
|
435
|
+
*/
|
|
436
|
+
toggleFrameRendering: InstanceType<typeof App>["toggleFrameRendering"];
|
|
403
437
|
};
|
|
404
|
-
export
|
|
438
|
+
export type Device = Readonly<{
|
|
405
439
|
isSmScreen: boolean;
|
|
406
440
|
isMobile: boolean;
|
|
407
441
|
isTouchScreen: boolean;
|
|
408
442
|
canDeviceFitSidebar: boolean;
|
|
443
|
+
isLandscape: boolean;
|
|
409
444
|
}>;
|
|
445
|
+
type FrameNameBounds = {
|
|
446
|
+
x: number;
|
|
447
|
+
y: number;
|
|
448
|
+
width: number;
|
|
449
|
+
height: number;
|
|
450
|
+
angle: number;
|
|
451
|
+
};
|
|
452
|
+
export type FrameNameBoundsCache = {
|
|
453
|
+
get: (frameElement: ExcalidrawFrameElement) => FrameNameBounds | null;
|
|
454
|
+
_cache: Map<string, FrameNameBounds & {
|
|
455
|
+
zoom: AppState["zoom"]["value"];
|
|
456
|
+
versionNonce: ExcalidrawFrameElement["versionNonce"];
|
|
457
|
+
}>;
|
|
458
|
+
};
|
|
410
459
|
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type Mutable<T> = {
|
|
3
|
+
-readonly [P in keyof T]: T[P];
|
|
4
|
+
};
|
|
5
|
+
export type ValueOf<T> = T[keyof T];
|
|
6
|
+
export type Merge<M, N> = Omit<M, keyof N> & N;
|
|
7
|
+
/** utility type to assert that the second type is a subtype of the first type.
|
|
8
|
+
* Returns the subtype. */
|
|
9
|
+
export type SubtypeOf<Supertype, Subtype extends Supertype> = Subtype;
|
|
10
|
+
export type ResolutionType<T extends (...args: any) => any> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
11
|
+
export type MarkOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
12
|
+
export type MarkRequired<T, RK extends keyof T> = Exclude<T, RK> & Required<Pick<T, RK>>;
|
|
13
|
+
export type MarkNonNullable<T, K extends keyof T> = {
|
|
14
|
+
[P in K]-?: P extends K ? NonNullable<T[P]> : T[P];
|
|
15
|
+
} & {
|
|
16
|
+
[P in keyof T]: T[P];
|
|
17
|
+
};
|
|
18
|
+
export type NonOptional<T> = Exclude<T, undefined>;
|
|
19
|
+
export type SignatureType<T> = T extends (...args: infer R) => any ? R : never;
|
|
20
|
+
export type CallableType<T extends (...args: any[]) => any> = (...args: SignatureType<T>) => ReturnType<T>;
|
|
21
|
+
export type ForwardRef<T, P = any> = Parameters<CallableType<React.ForwardRefRenderFunction<T, P>>>[1];
|
|
22
|
+
export type ExtractSetType<T extends Set<any>> = T extends Set<infer U> ? U : never;
|
package/types/utils.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { EVENT } from "./constants";
|
|
2
|
-
import { FontFamilyValues, FontString } from "./element/types";
|
|
3
|
-
import { AppState,
|
|
2
|
+
import { FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./element/types";
|
|
3
|
+
import { AppState, LastActiveTool, Zoom } from "./types";
|
|
4
4
|
import { SHAPES } from "./shapes";
|
|
5
5
|
export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
6
6
|
export declare const getDateTime: () => string;
|
|
7
7
|
export declare const capitalizeString: (str: string) => string;
|
|
8
8
|
export declare const isToolIcon: (target: Element | EventTarget | null) => target is HTMLElement;
|
|
9
|
-
export declare const isInputLike: (target: Element | EventTarget | null) => target is
|
|
10
|
-
export declare const
|
|
9
|
+
export declare const isInputLike: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLBRElement | HTMLDivElement;
|
|
10
|
+
export declare const isInteractive: (target: Element | EventTarget | null) => boolean;
|
|
11
|
+
export declare const isWritableElement: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLTextAreaElement | HTMLBRElement | HTMLDivElement;
|
|
11
12
|
export declare const getFontFamilyString: ({ fontFamily, }: {
|
|
12
13
|
fontFamily: FontFamilyValues;
|
|
13
14
|
}) => string;
|
|
@@ -28,22 +29,34 @@ export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void, op
|
|
|
28
29
|
flush(): void;
|
|
29
30
|
cancel(): void;
|
|
30
31
|
};
|
|
32
|
+
export declare const easeToValuesRAF: <T extends Record<keyof T, number>>({ fromValues, toValues, onStep, duration, easeFn, onStart, onEnd, onCancel, }: {
|
|
33
|
+
fromValues: T;
|
|
34
|
+
toValues: T;
|
|
35
|
+
onStep: (values: T) => void;
|
|
36
|
+
duration?: number | undefined;
|
|
37
|
+
easeFn?: ((value: number) => number) | undefined;
|
|
38
|
+
onStart?: (() => void) | undefined;
|
|
39
|
+
onEnd?: (() => void) | undefined;
|
|
40
|
+
onCancel?: (() => void) | undefined;
|
|
41
|
+
}) => () => void;
|
|
31
42
|
export declare const chunk: <T extends unknown>(array: readonly T[], size: number) => T[][];
|
|
32
43
|
export declare const selectNode: (node: Element) => void;
|
|
33
44
|
export declare const removeSelection: () => void;
|
|
34
45
|
export declare const distance: (x: number, y: number) => number;
|
|
35
46
|
export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: ({
|
|
36
|
-
type: (typeof SHAPES)[number]["value"] | "eraser";
|
|
47
|
+
type: (typeof SHAPES)[number]["value"] | "eraser" | "hand" | "frame";
|
|
48
|
+
locked?: boolean;
|
|
37
49
|
} | {
|
|
38
50
|
type: "custom";
|
|
39
51
|
customType: string;
|
|
52
|
+
locked?: boolean;
|
|
40
53
|
}) & {
|
|
41
|
-
lastActiveToolBeforeEraser?:
|
|
54
|
+
lastActiveToolBeforeEraser?: LastActiveTool;
|
|
42
55
|
}) => AppState["activeTool"];
|
|
43
56
|
export declare const resetCursor: (canvas: HTMLCanvasElement | null) => void;
|
|
44
57
|
export declare const setCursor: (canvas: HTMLCanvasElement | null, cursor: string) => void;
|
|
45
58
|
export declare const setEraserCursor: (canvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
|
|
46
|
-
export declare const setCursorForShape: (canvas: HTMLCanvasElement | null, appState: AppState) => void;
|
|
59
|
+
export declare const setCursorForShape: (canvas: HTMLCanvasElement | null, appState: Pick<AppState, "activeTool" | "theme">) => void;
|
|
47
60
|
export declare const isFullScreen: () => boolean;
|
|
48
61
|
export declare const allowFullScreen: () => Promise<void>;
|
|
49
62
|
export declare const exitFullScreen: () => Promise<void>;
|
|
@@ -91,7 +104,7 @@ export declare const muteFSAbortError: (error?: Error) => void;
|
|
|
91
104
|
export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
92
105
|
export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
93
106
|
export declare const isTransparent: (color: string) => boolean;
|
|
94
|
-
export
|
|
107
|
+
export type ResolvablePromise<T> = Promise<T> & {
|
|
95
108
|
resolve: [T] extends [undefined] ? (value?: T) => void : (value: T) => void;
|
|
96
109
|
reject: (error: Error) => void;
|
|
97
110
|
};
|
|
@@ -124,13 +137,21 @@ export declare const getUpdatedTimestamp: () => number;
|
|
|
124
137
|
export declare const arrayToMap: <T extends string | {
|
|
125
138
|
id: string;
|
|
126
139
|
}>(items: readonly T[]) => Map<string, T>;
|
|
140
|
+
export declare const arrayToMapWithIndex: <T extends {
|
|
141
|
+
id: string;
|
|
142
|
+
}>(elements: readonly T[]) => Map<string, [element: T, index: number]>;
|
|
127
143
|
export declare const isTestEnv: () => boolean;
|
|
128
|
-
export declare const isProdEnv: () => boolean;
|
|
129
144
|
export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) => CustomEvent<{
|
|
130
145
|
nativeEvent: T;
|
|
131
146
|
}>;
|
|
132
147
|
export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
|
|
133
148
|
export declare const isPrimitive: (val: any) => boolean;
|
|
134
149
|
export declare const getFrame: () => "top" | "iframe";
|
|
150
|
+
export declare const isRunningInIframe: () => boolean;
|
|
135
151
|
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
136
152
|
export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
|
|
153
|
+
export declare const isShallowEqual: <T extends Record<string, any>, I extends keyof T>(objA: T, objB: T, comparators?: Record<I, (a: T[I], b: T[I]) => boolean> | undefined, debug?: boolean) => boolean;
|
|
154
|
+
export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E) => void) | undefined, ourEventHandler?: ((event: E) => void) | undefined, { checkForDefaultPrevented }?: {
|
|
155
|
+
checkForDefaultPrevented?: boolean | undefined;
|
|
156
|
+
}) => (event: E) => void;
|
|
157
|
+
export declare const isOnlyExportingSingleFrame: (elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
package/types/zindex.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./element/types";
|
|
2
2
|
import { AppState } from "./types";
|
|
3
|
-
export declare const moveOneLeft: (elements: readonly ExcalidrawElement[], appState: AppState
|
|
4
|
-
export declare const moveOneRight: (elements: readonly ExcalidrawElement[], appState: AppState
|
|
5
|
-
export declare const moveAllLeft: (elements: readonly ExcalidrawElement[], appState: AppState
|
|
6
|
-
export declare const moveAllRight: (elements: readonly ExcalidrawElement[], appState: AppState
|
|
3
|
+
export declare const moveOneLeft: (elements: readonly ExcalidrawElement[], appState: AppState, elementsToBeMoved?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
4
|
+
export declare const moveOneRight: (elements: readonly ExcalidrawElement[], appState: AppState, elementsToBeMoved?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
5
|
+
export declare const moveAllLeft: (elements: readonly ExcalidrawElement[], appState: AppState, elementsToBeMoved?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
6
|
+
export declare const moveAllRight: (elements: readonly ExcalidrawElement[], appState: AppState, elementsToBeMoved?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ExcalidrawElement } from "../element/types";
|
|
3
|
-
export declare const actionToggleLock: {
|
|
4
|
-
name: "toggleLock";
|
|
5
|
-
trackEvent: {
|
|
6
|
-
category: "element";
|
|
7
|
-
};
|
|
8
|
-
perform: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => false | {
|
|
9
|
-
elements: ExcalidrawElement[];
|
|
10
|
-
appState: {
|
|
11
|
-
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
12
|
-
showWelcomeScreen: boolean;
|
|
13
|
-
isLoading: boolean;
|
|
14
|
-
errorMessage: string | null;
|
|
15
|
-
draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
16
|
-
resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
17
|
-
multiElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawLinearElement> | null;
|
|
18
|
-
selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
19
|
-
isBindingEnabled: boolean;
|
|
20
|
-
startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
|
|
21
|
-
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
22
|
-
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
23
|
-
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
24
|
-
activeTool: {
|
|
25
|
-
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
26
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
27
|
-
locked: boolean;
|
|
28
|
-
customType: null;
|
|
29
|
-
} | {
|
|
30
|
-
type: "custom";
|
|
31
|
-
customType: string;
|
|
32
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
33
|
-
locked: boolean;
|
|
34
|
-
};
|
|
35
|
-
penMode: boolean;
|
|
36
|
-
penDetected: boolean;
|
|
37
|
-
exportBackground: boolean;
|
|
38
|
-
exportEmbedScene: boolean;
|
|
39
|
-
exportWithDarkMode: boolean;
|
|
40
|
-
exportScale: number;
|
|
41
|
-
currentItemStrokeColor: string;
|
|
42
|
-
currentItemBackgroundColor: string;
|
|
43
|
-
currentItemFillStyle: import("../element/types").FillStyle;
|
|
44
|
-
currentItemStrokeWidth: number;
|
|
45
|
-
currentItemStrokeStyle: import("../element/types").StrokeStyle;
|
|
46
|
-
currentItemRoughness: number;
|
|
47
|
-
currentItemOpacity: number;
|
|
48
|
-
currentItemFontFamily: number;
|
|
49
|
-
currentItemFontSize: number;
|
|
50
|
-
currentItemTextAlign: string;
|
|
51
|
-
currentItemStrokeSharpness: import("../element/types").StrokeSharpness;
|
|
52
|
-
currentItemStartArrowhead: import("../element/types").Arrowhead | null;
|
|
53
|
-
currentItemEndArrowhead: import("../element/types").Arrowhead | null;
|
|
54
|
-
currentItemLinearStrokeSharpness: import("../element/types").StrokeSharpness;
|
|
55
|
-
viewBackgroundColor: string;
|
|
56
|
-
scrollX: number;
|
|
57
|
-
scrollY: number;
|
|
58
|
-
cursorButton: "up" | "down";
|
|
59
|
-
scrolledOutside: boolean;
|
|
60
|
-
name: string;
|
|
61
|
-
isResizing: boolean;
|
|
62
|
-
isRotating: boolean;
|
|
63
|
-
zoom: Readonly<{
|
|
64
|
-
value: import("../types").NormalizedZoomValue;
|
|
65
|
-
}>;
|
|
66
|
-
openMenu: "canvas" | "shape" | null;
|
|
67
|
-
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
68
|
-
openSidebar: "library" | "customSidebar" | null;
|
|
69
|
-
openDialog: "imageExport" | "help" | null;
|
|
70
|
-
isSidebarDocked: boolean;
|
|
71
|
-
lastPointerDownWith: import("../element/types").PointerType;
|
|
72
|
-
selectedElementIds: {
|
|
73
|
-
[id: string]: boolean;
|
|
74
|
-
};
|
|
75
|
-
previousSelectedElementIds: {
|
|
76
|
-
[id: string]: boolean;
|
|
77
|
-
};
|
|
78
|
-
shouldCacheIgnoreZoom: boolean;
|
|
79
|
-
toast: {
|
|
80
|
-
message: string;
|
|
81
|
-
closable?: boolean | undefined;
|
|
82
|
-
duration?: number | undefined;
|
|
83
|
-
} | null;
|
|
84
|
-
zenModeEnabled: boolean;
|
|
85
|
-
theme: string;
|
|
86
|
-
gridSize: number | null;
|
|
87
|
-
viewModeEnabled: boolean;
|
|
88
|
-
selectedGroupIds: {
|
|
89
|
-
[groupId: string]: boolean;
|
|
90
|
-
};
|
|
91
|
-
editingGroupId: string | null;
|
|
92
|
-
width: number;
|
|
93
|
-
height: number;
|
|
94
|
-
offsetTop: number;
|
|
95
|
-
offsetLeft: number;
|
|
96
|
-
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
97
|
-
collaborators: Map<string, import("../types").Collaborator>;
|
|
98
|
-
showStats: boolean;
|
|
99
|
-
currentChartType: import("../element/types").ChartType;
|
|
100
|
-
pasteDialog: {
|
|
101
|
-
shown: false;
|
|
102
|
-
data: null;
|
|
103
|
-
} | {
|
|
104
|
-
shown: true;
|
|
105
|
-
data: import("../charts").Spreadsheet;
|
|
106
|
-
};
|
|
107
|
-
pendingImageElementId: string | null;
|
|
108
|
-
showHyperlinkPopup: false | "info" | "editor";
|
|
109
|
-
};
|
|
110
|
-
commitToHistory: true;
|
|
111
|
-
};
|
|
112
|
-
contextItemLabel: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => "labels.elementLock.unlock" | "labels.elementLock.lock" | "labels.elementLock.lockAll" | "labels.elementLock.unlockAll";
|
|
113
|
-
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: import("../types").AppState, elements: readonly ExcalidrawElement[]) => boolean;
|
|
114
|
-
} & {
|
|
115
|
-
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: import("../types").AppState, elements: readonly ExcalidrawElement[]) => boolean) | undefined;
|
|
116
|
-
};
|