@zsviczian/excalidraw 0.13.0-obsidian-2 → 0.14.1-obsidian
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +417 -19
- package/dist/excalidraw.development.js +581 -1153
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +0 -102
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +39 -18
- package/types/actions/actionAlign.d.ts +6 -18
- package/types/actions/actionBoundText.d.ts +15 -8
- package/types/actions/actionCanvas.d.ts +246 -76
- package/types/actions/actionClipboard.d.ts +84 -31
- package/types/actions/actionDeleteSelected.d.ts +40 -21
- package/types/actions/actionDistribute.d.ts +2 -6
- package/types/actions/actionDuplicateSelection.d.ts +1 -3
- package/types/actions/actionExport.d.ts +125 -78
- package/types/actions/actionFinalize.d.ts +27 -15
- package/types/actions/actionFlip.d.ts +2 -2
- package/types/actions/actionGroup.d.ts +4 -8
- package/types/actions/actionLinearEditor.d.ts +14 -7
- package/types/actions/actionMenu.d.ts +40 -26
- package/types/actions/actionNavigate.d.ts +1 -3
- package/types/actions/actionProperties.d.ts +182 -117
- package/types/actions/actionStyles.d.ts +13 -6
- package/types/actions/actionToggleGridMode.d.ts +14 -6
- package/types/actions/actionToggleLock.d.ts +13 -6
- package/types/actions/actionToggleStats.d.ts +13 -6
- package/types/actions/actionToggleViewMode.d.ts +14 -6
- package/types/actions/actionToggleZenMode.d.ts +14 -6
- package/types/actions/actionZindex.d.ts +4 -12
- package/types/actions/manager.d.ts +2 -1
- package/types/actions/types.d.ts +3 -5
- package/types/appState.d.ts +8 -6
- package/types/components/ActiveConfirmDialog.d.ts +24 -0
- package/types/components/App.d.ts +8 -50
- package/types/components/Button.d.ts +15 -0
- package/types/components/CollabButton.d.ts +1 -2
- package/types/components/ContextMenu.d.ts +8 -20
- package/types/components/HandButton.d.ts +10 -0
- package/types/components/JSONExportDialog.d.ts +3 -1
- package/types/components/LayerUI.d.ts +3 -3
- package/types/components/LibraryMenuHeaderContent.d.ts +23 -0
- package/types/components/LockButton.d.ts +0 -1
- package/types/components/MobileMenu.d.ts +5 -6
- package/types/components/ToolButton.d.ts +1 -1
- package/types/components/UserList.d.ts +0 -2
- package/types/components/dropdownMenu/DropdownMenu.d.ts +66 -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 +9 -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 +13 -0
- package/types/components/footer/FooterCenter.d.ts +8 -0
- package/types/components/icons.d.ts +2 -1
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +10 -0
- package/types/components/main-menu/DefaultItems.d.ts +44 -0
- package/types/components/main-menu/MainMenu.d.ts +60 -0
- package/types/components/mainMenu/DefaultItems.d.ts +44 -0
- package/types/components/mainMenu/MainMenu.d.ts +63 -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 +6 -4
- package/types/element/Hyperlink.d.ts +15 -10
- package/types/element/linearElementEditor.d.ts +14 -6
- package/types/element/textElement.d.ts +7 -0
- package/types/element/textWysiwyg.d.ts +6 -1
- package/types/excalidraw-app/data/index.d.ts +5 -0
- package/types/excalidraw-app/data/localStorage.d.ts +5 -0
- package/types/keys.d.ts +2 -3
- package/types/packages/excalidraw/example/CustomFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/MobileFooter.d.ts +5 -0
- package/types/packages/excalidraw/index.d.ts +10 -0
- package/types/renderer/easingFunctions.d.ts +6 -0
- package/types/types.d.ts +54 -26
- package/types/utils.d.ts +23 -3
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const Center: {
|
|
3
|
+
({ children }: {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}): JSX.Element;
|
|
6
|
+
displayName: string;
|
|
7
|
+
Logo: {
|
|
8
|
+
({ children }: {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
Heading: {
|
|
14
|
+
({ children }: {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}): JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
Menu: {
|
|
20
|
+
({ children }: {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
}): JSX.Element;
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
25
|
+
MenuItem: {
|
|
26
|
+
({ onSelect, children, icon, shortcut, className, ...props }: {
|
|
27
|
+
onSelect: () => void;
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
icon?: JSX.Element | undefined;
|
|
30
|
+
shortcut?: string | null | undefined;
|
|
31
|
+
} & import("react").ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
|
|
32
|
+
displayName: string;
|
|
33
|
+
};
|
|
34
|
+
MenuItemLink: {
|
|
35
|
+
({ children, href, icon, shortcut, className, ...props }: {
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
href: string;
|
|
38
|
+
icon?: JSX.Element | undefined;
|
|
39
|
+
shortcut?: string | null | undefined;
|
|
40
|
+
} & import("react").AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element;
|
|
41
|
+
displayName: string;
|
|
42
|
+
};
|
|
43
|
+
MenuItemHelp: {
|
|
44
|
+
(): JSX.Element;
|
|
45
|
+
displayName: string;
|
|
46
|
+
};
|
|
47
|
+
MenuItemLoadScene: {
|
|
48
|
+
(): JSX.Element | null;
|
|
49
|
+
displayName: string;
|
|
50
|
+
};
|
|
51
|
+
MenuItemLiveCollaborationTrigger: {
|
|
52
|
+
({ onSelect, }: {
|
|
53
|
+
onSelect: () => any;
|
|
54
|
+
}): JSX.Element;
|
|
55
|
+
displayName: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export { Center };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const MenuHint: {
|
|
2
|
+
({ children }: {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
}): JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
7
|
+
declare const ToolbarHint: {
|
|
8
|
+
({ children }: {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
declare const HelpHint: {
|
|
14
|
+
({ children }: {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}): JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
export { HelpHint, MenuHint, ToolbarHint };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./WelcomeScreen.scss";
|
|
3
|
+
declare const WelcomeScreen: {
|
|
4
|
+
(props: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}): null;
|
|
7
|
+
displayName: string;
|
|
8
|
+
Center: {
|
|
9
|
+
({ children }: {
|
|
10
|
+
children?: import("react").ReactNode;
|
|
11
|
+
}): JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
Logo: {
|
|
14
|
+
({ children }: {
|
|
15
|
+
children?: import("react").ReactNode;
|
|
16
|
+
}): JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
Heading: {
|
|
20
|
+
({ children }: {
|
|
21
|
+
children: import("react").ReactNode;
|
|
22
|
+
}): JSX.Element;
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
25
|
+
Menu: {
|
|
26
|
+
({ children }: {
|
|
27
|
+
children?: import("react").ReactNode;
|
|
28
|
+
}): JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
MenuItem: {
|
|
32
|
+
({ onSelect, children, icon, shortcut, className, ...props }: {
|
|
33
|
+
onSelect: () => void;
|
|
34
|
+
children: import("react").ReactNode;
|
|
35
|
+
icon?: JSX.Element | undefined;
|
|
36
|
+
shortcut?: string | null | undefined;
|
|
37
|
+
} & import("react").ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
|
|
38
|
+
displayName: string;
|
|
39
|
+
};
|
|
40
|
+
MenuItemLink: {
|
|
41
|
+
({ children, href, icon, shortcut, className, ...props }: {
|
|
42
|
+
children: import("react").ReactNode;
|
|
43
|
+
href: string;
|
|
44
|
+
icon?: JSX.Element | undefined;
|
|
45
|
+
shortcut?: string | null | undefined;
|
|
46
|
+
} & import("react").AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element;
|
|
47
|
+
displayName: string;
|
|
48
|
+
};
|
|
49
|
+
MenuItemHelp: {
|
|
50
|
+
(): JSX.Element;
|
|
51
|
+
displayName: string;
|
|
52
|
+
};
|
|
53
|
+
MenuItemLoadScene: {
|
|
54
|
+
(): JSX.Element | null;
|
|
55
|
+
displayName: string;
|
|
56
|
+
};
|
|
57
|
+
MenuItemLiveCollaborationTrigger: {
|
|
58
|
+
({ onSelect, }: {
|
|
59
|
+
onSelect: () => any;
|
|
60
|
+
}): JSX.Element;
|
|
61
|
+
displayName: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
Hints: {
|
|
65
|
+
MenuHint: {
|
|
66
|
+
({ children }: {
|
|
67
|
+
children?: import("react").ReactNode;
|
|
68
|
+
}): JSX.Element;
|
|
69
|
+
displayName: string;
|
|
70
|
+
};
|
|
71
|
+
ToolbarHint: {
|
|
72
|
+
({ children }: {
|
|
73
|
+
children?: import("react").ReactNode;
|
|
74
|
+
}): JSX.Element;
|
|
75
|
+
displayName: string;
|
|
76
|
+
};
|
|
77
|
+
HelpHint: {
|
|
78
|
+
({ children }: {
|
|
79
|
+
children?: import("react").ReactNode;
|
|
80
|
+
}): JSX.Element;
|
|
81
|
+
displayName: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export default WelcomeScreen;
|
package/types/constants.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { AppProps } from "./types";
|
|
2
2
|
import { FontFamilyValues } from "./element/types";
|
|
3
|
+
export declare const isDarwin: boolean;
|
|
4
|
+
export declare const isWindows: boolean;
|
|
5
|
+
export declare const isAndroid: boolean;
|
|
6
|
+
export declare const isFirefox: boolean;
|
|
3
7
|
export declare const APP_NAME = "Excalidraw";
|
|
4
8
|
export declare const DRAGGING_THRESHOLD = 10;
|
|
5
9
|
export declare const LINE_CONFIRM_THRESHOLD = 8;
|
|
@@ -48,7 +52,8 @@ export declare enum EVENT {
|
|
|
48
52
|
HASHCHANGE = "hashchange",
|
|
49
53
|
VISIBILITY_CHANGE = "visibilitychange",
|
|
50
54
|
SCROLL = "scroll",
|
|
51
|
-
EXCALIDRAW_LINK = "excalidraw-link"
|
|
55
|
+
EXCALIDRAW_LINK = "excalidraw-link",
|
|
56
|
+
MENU_ITEM_SELECT = "menu.itemSelect"
|
|
52
57
|
}
|
|
53
58
|
export declare const ENV: {
|
|
54
59
|
TEST: string;
|
|
@@ -154,9 +159,6 @@ export declare const ROUNDNESS: {
|
|
|
154
159
|
readonly PROPORTIONAL_RADIUS: 2;
|
|
155
160
|
readonly ADAPTIVE_RADIUS: 3;
|
|
156
161
|
};
|
|
157
|
-
export declare const COOKIES: {
|
|
158
|
-
readonly AUTH_STATE_COOKIE: "excplus-auth";
|
|
159
|
-
};
|
|
160
162
|
/** key containt id of precedeing elemnt id we use in reconciliation during
|
|
161
163
|
* collaboration */
|
|
162
164
|
export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
|
|
@@ -18,6 +18,11 @@ export declare const actionLink: {
|
|
|
18
18
|
appState: {
|
|
19
19
|
showHyperlinkPopup: "editor";
|
|
20
20
|
openMenu: null;
|
|
21
|
+
contextMenu: {
|
|
22
|
+
items: import("../components/ContextMenu").ContextMenuItems;
|
|
23
|
+
top: number;
|
|
24
|
+
left: number;
|
|
25
|
+
} | null;
|
|
21
26
|
showWelcomeScreen: boolean;
|
|
22
27
|
isLoading: boolean;
|
|
23
28
|
errorMessage: string | null;
|
|
@@ -31,16 +36,15 @@ export declare const actionLink: {
|
|
|
31
36
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
32
37
|
editingLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
33
38
|
activeTool: {
|
|
34
|
-
|
|
35
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
39
|
+
lastActiveTool: import("../types").LastActiveTool;
|
|
36
40
|
locked: boolean;
|
|
41
|
+
} & ({
|
|
42
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | "hand";
|
|
37
43
|
customType: null;
|
|
38
44
|
} | {
|
|
39
45
|
type: "custom";
|
|
40
46
|
customType: string;
|
|
41
|
-
|
|
42
|
-
locked: boolean;
|
|
43
|
-
};
|
|
47
|
+
});
|
|
44
48
|
penMode: boolean;
|
|
45
49
|
penDetected: boolean;
|
|
46
50
|
exportBackground: boolean;
|
|
@@ -73,7 +77,7 @@ export declare const actionLink: {
|
|
|
73
77
|
}>;
|
|
74
78
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
75
79
|
openSidebar: "library" | "customSidebar" | null;
|
|
76
|
-
openDialog: "imageExport" | "help" | null;
|
|
80
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
77
81
|
isSidebarDocked: boolean;
|
|
78
82
|
lastPointerDownWith: import("./types").PointerType;
|
|
79
83
|
selectedElementIds: {
|
|
@@ -91,6 +95,7 @@ export declare const actionLink: {
|
|
|
91
95
|
zenModeEnabled: boolean;
|
|
92
96
|
theme: string;
|
|
93
97
|
gridSize: number | null;
|
|
98
|
+
previousGridSize: number | null;
|
|
94
99
|
viewModeEnabled: boolean;
|
|
95
100
|
selectedGroupIds: {
|
|
96
101
|
[groupId: string]: boolean;
|
|
@@ -119,6 +124,8 @@ export declare const actionLink: {
|
|
|
119
124
|
elementBackground?: string[] | undefined;
|
|
120
125
|
elementStroke?: string[] | undefined;
|
|
121
126
|
};
|
|
127
|
+
allowWheelZoom?: boolean | undefined;
|
|
128
|
+
allowPinchZoom?: boolean | undefined;
|
|
122
129
|
selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
123
130
|
};
|
|
124
131
|
commitToHistory: true;
|
|
@@ -129,10 +136,8 @@ export declare const actionLink: {
|
|
|
129
136
|
};
|
|
130
137
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
131
138
|
contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.edit" | "labels.link.create";
|
|
132
|
-
|
|
133
|
-
PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps
|
|
134
|
-
isInHamburgerMenu: boolean;
|
|
135
|
-
}) => JSX.Element;
|
|
139
|
+
predicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
|
|
140
|
+
PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps) => JSX.Element;
|
|
136
141
|
} & {
|
|
137
142
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
138
143
|
};
|
|
@@ -123,6 +123,11 @@ export declare class LinearElementEditor {
|
|
|
123
123
|
hoverPointIndex: number;
|
|
124
124
|
segmentMidPointHoveredCoords: readonly [number, number] | null;
|
|
125
125
|
};
|
|
126
|
+
contextMenu: {
|
|
127
|
+
items: import("../components/ContextMenu").ContextMenuItems;
|
|
128
|
+
top: number;
|
|
129
|
+
left: number;
|
|
130
|
+
} | null;
|
|
126
131
|
showWelcomeScreen: boolean;
|
|
127
132
|
isLoading: boolean;
|
|
128
133
|
errorMessage: string | null;
|
|
@@ -135,16 +140,15 @@ export declare class LinearElementEditor {
|
|
|
135
140
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
136
141
|
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
137
142
|
activeTool: {
|
|
138
|
-
|
|
139
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
143
|
+
lastActiveTool: import("../types").LastActiveTool;
|
|
140
144
|
locked: boolean;
|
|
145
|
+
} & ({
|
|
146
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | "hand";
|
|
141
147
|
customType: null;
|
|
142
148
|
} | {
|
|
143
149
|
type: "custom";
|
|
144
150
|
customType: string;
|
|
145
|
-
|
|
146
|
-
locked: boolean;
|
|
147
|
-
};
|
|
151
|
+
});
|
|
148
152
|
penMode: boolean;
|
|
149
153
|
penDetected: boolean;
|
|
150
154
|
exportBackground: boolean;
|
|
@@ -178,7 +182,7 @@ export declare class LinearElementEditor {
|
|
|
178
182
|
openMenu: "canvas" | "shape" | null;
|
|
179
183
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
180
184
|
openSidebar: "library" | "customSidebar" | null;
|
|
181
|
-
openDialog: "imageExport" | "help" | null;
|
|
185
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
182
186
|
isSidebarDocked: boolean;
|
|
183
187
|
lastPointerDownWith: import("./types").PointerType;
|
|
184
188
|
selectedElementIds: {
|
|
@@ -187,6 +191,7 @@ export declare class LinearElementEditor {
|
|
|
187
191
|
previousSelectedElementIds: {
|
|
188
192
|
[id: string]: boolean;
|
|
189
193
|
};
|
|
194
|
+
/** @returns whether point was dragged */
|
|
190
195
|
shouldCacheIgnoreZoom: boolean;
|
|
191
196
|
toast: {
|
|
192
197
|
message: string;
|
|
@@ -196,6 +201,7 @@ export declare class LinearElementEditor {
|
|
|
196
201
|
zenModeEnabled: boolean;
|
|
197
202
|
theme: string;
|
|
198
203
|
gridSize: number | null;
|
|
204
|
+
previousGridSize: number | null;
|
|
199
205
|
viewModeEnabled: boolean;
|
|
200
206
|
selectedGroupIds: {
|
|
201
207
|
[groupId: string]: boolean;
|
|
@@ -225,6 +231,8 @@ export declare class LinearElementEditor {
|
|
|
225
231
|
elementBackground?: string[] | undefined;
|
|
226
232
|
elementStroke?: string[] | undefined;
|
|
227
233
|
};
|
|
234
|
+
allowWheelZoom?: boolean | undefined;
|
|
235
|
+
allowPinchZoom?: boolean | undefined;
|
|
228
236
|
selectedLinearElement: LinearElementEditor | null;
|
|
229
237
|
};
|
|
230
238
|
};
|
|
@@ -9,8 +9,15 @@ export declare const measureText: (text: string, font: FontString, maxWidth?: nu
|
|
|
9
9
|
width: number;
|
|
10
10
|
height: number;
|
|
11
11
|
baseline: number;
|
|
12
|
+
container: HTMLDivElement;
|
|
13
|
+
} | {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
baseline: number;
|
|
17
|
+
container?: undefined;
|
|
12
18
|
};
|
|
13
19
|
export declare const getApproxLineHeight: (font: FontString) => number;
|
|
20
|
+
export declare const getTextWidth: (text: string, font: FontString) => number;
|
|
14
21
|
export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
|
|
15
22
|
export declare const charWidth: {
|
|
16
23
|
calculate: (char: string, font: FontString) => number;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawTextElement } from "./types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawTextContainer } from "./types";
|
|
2
2
|
import App from "../components/App";
|
|
3
|
+
export declare const updateOriginalContainerCache: (id: ExcalidrawTextContainer["id"], height: ExcalidrawTextContainer["height"]) => {
|
|
4
|
+
height: ExcalidrawTextContainer["height"];
|
|
5
|
+
};
|
|
6
|
+
export declare const resetOriginalContainerCache: (id: ExcalidrawTextContainer["id"]) => void;
|
|
7
|
+
export declare const getOriginalContainerHeightFromCache: (id: ExcalidrawTextContainer["id"]) => number | null;
|
|
3
8
|
export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, }: {
|
|
4
9
|
id: ExcalidrawElement["id"];
|
|
5
10
|
onChange?: ((text: string) => void) | undefined;
|
|
@@ -91,6 +91,11 @@ export declare const loadScene: (id: string | null, privateKey: string | null, l
|
|
|
91
91
|
lastActiveToolBeforeEraser: import("../../types").LastActiveToolBeforeEraser;
|
|
92
92
|
locked: boolean;
|
|
93
93
|
};
|
|
94
|
+
contextMenu: {
|
|
95
|
+
items: import("../../components/ContextMenu").ContextMenuItems;
|
|
96
|
+
top: number;
|
|
97
|
+
left: number;
|
|
98
|
+
} | null;
|
|
94
99
|
showWelcomeScreen: boolean;
|
|
95
100
|
isLoading: boolean;
|
|
96
101
|
errorMessage: string | null;
|
|
@@ -65,6 +65,11 @@ export declare const importFromLocalStorage: () => {
|
|
|
65
65
|
showStats: boolean;
|
|
66
66
|
currentChartType: import("../../element/types").ChartType;
|
|
67
67
|
selectedLinearElement: import("../../element/linearElementEditor").LinearElementEditor | null;
|
|
68
|
+
contextMenu: {
|
|
69
|
+
items: import("../../components/ContextMenu").ContextMenuItems;
|
|
70
|
+
top: number;
|
|
71
|
+
left: number;
|
|
72
|
+
} | null;
|
|
68
73
|
isLoading: boolean;
|
|
69
74
|
errorMessage: string | null;
|
|
70
75
|
draggingElement: import("../../element/types").NonDeletedExcalidrawElement | null;
|
package/types/keys.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export declare const isDarwin: boolean;
|
|
2
|
-
export declare const isWindows: boolean;
|
|
3
|
-
export declare const isAndroid: boolean;
|
|
4
1
|
export declare const CODES: {
|
|
5
2
|
readonly EQUAL: "Equal";
|
|
6
3
|
readonly MINUS: "Minus";
|
|
@@ -27,6 +24,8 @@ export declare const KEYS: {
|
|
|
27
24
|
readonly ARROW_LEFT: "ArrowLeft";
|
|
28
25
|
readonly ARROW_RIGHT: "ArrowRight";
|
|
29
26
|
readonly ARROW_UP: "ArrowUp";
|
|
27
|
+
readonly PAGE_UP: "PageUp";
|
|
28
|
+
readonly PAGE_DOWN: "PageDown";
|
|
30
29
|
readonly BACKSPACE: "Backspace";
|
|
31
30
|
readonly ALT: "Alt";
|
|
32
31
|
readonly CTRL_OR_CMD: "metaKey" | "ctrlKey";
|
|
@@ -2,6 +2,10 @@ import React from "react";
|
|
|
2
2
|
import "../../css/app.scss";
|
|
3
3
|
import "../../css/styles.scss";
|
|
4
4
|
import { ExcalidrawAPIRefValue, ExcalidrawProps } from "../../types";
|
|
5
|
+
import Footer from "../../components/footer/FooterCenter";
|
|
6
|
+
import MainMenu from "../../components/main-menu/MainMenu";
|
|
7
|
+
import WelcomeScreen from "../../components/welcome-screen/WelcomeScreen";
|
|
8
|
+
import LiveCollaborationTrigger from "../../components/live-collaboration/LiveCollaborationTrigger";
|
|
5
9
|
declare type PublicExcalidrawProps = Omit<ExcalidrawProps, "forwardedRef">;
|
|
6
10
|
export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
|
|
7
11
|
export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
|
|
@@ -22,3 +26,9 @@ export { mutateElement, newElementWith, bumpVersion, } from "../../element/mutat
|
|
|
22
26
|
export { parseLibraryTokensFromUrl, useHandleLibrary, } from "../../data/library";
|
|
23
27
|
export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "../../utils";
|
|
24
28
|
export { Sidebar } from "../../components/Sidebar/Sidebar";
|
|
29
|
+
export { Button } from "../../components/Button";
|
|
30
|
+
export { Footer };
|
|
31
|
+
export { MainMenu };
|
|
32
|
+
export { useDevice } from "../../components/App";
|
|
33
|
+
export { WelcomeScreen };
|
|
34
|
+
export { LiveCollaborationTrigger };
|
package/types/types.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { MaybeTransformHandleType } from "./element/transformHandles";
|
|
|
15
15
|
import Library from "./data/library";
|
|
16
16
|
import type { FileSystemHandle } from "./data/filesystem";
|
|
17
17
|
import type { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
|
18
|
+
import { ContextMenuItems } from "./components/ContextMenu";
|
|
18
19
|
export declare type Point = Readonly<RoughPoint>;
|
|
19
20
|
export declare type Collaborator = {
|
|
20
21
|
pointer?: {
|
|
@@ -54,14 +55,19 @@ export declare type BinaryFileData = {
|
|
|
54
55
|
};
|
|
55
56
|
export declare type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
56
57
|
export declare type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
57
|
-
export declare type
|
|
58
|
-
type: typeof SHAPES[number]["value"] | "eraser";
|
|
58
|
+
export declare type LastActiveTool = {
|
|
59
|
+
type: typeof SHAPES[number]["value"] | "eraser" | "hand";
|
|
59
60
|
customType: null;
|
|
60
61
|
} | {
|
|
61
62
|
type: "custom";
|
|
62
63
|
customType: string;
|
|
63
64
|
} | null;
|
|
64
65
|
export declare type AppState = {
|
|
66
|
+
contextMenu: {
|
|
67
|
+
items: ContextMenuItems;
|
|
68
|
+
top: number;
|
|
69
|
+
left: number;
|
|
70
|
+
} | null;
|
|
65
71
|
showWelcomeScreen: boolean;
|
|
66
72
|
isLoading: boolean;
|
|
67
73
|
errorMessage: string | null;
|
|
@@ -75,16 +81,19 @@ export declare type AppState = {
|
|
|
75
81
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
76
82
|
editingLinearElement: LinearElementEditor | null;
|
|
77
83
|
activeTool: {
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
/**
|
|
85
|
+
* indicates a previous tool we should revert back to if we deselect the
|
|
86
|
+
* currently active tool. At the moment applies to `eraser` and `hand` tool.
|
|
87
|
+
*/
|
|
88
|
+
lastActiveTool: LastActiveTool;
|
|
80
89
|
locked: boolean;
|
|
90
|
+
} & ({
|
|
91
|
+
type: typeof SHAPES[number]["value"] | "eraser" | "hand";
|
|
81
92
|
customType: null;
|
|
82
93
|
} | {
|
|
83
94
|
type: "custom";
|
|
84
95
|
customType: string;
|
|
85
|
-
|
|
86
|
-
locked: boolean;
|
|
87
|
-
};
|
|
96
|
+
});
|
|
88
97
|
penMode: boolean;
|
|
89
98
|
penDetected: boolean;
|
|
90
99
|
exportBackground: boolean;
|
|
@@ -116,7 +125,7 @@ export declare type AppState = {
|
|
|
116
125
|
openMenu: "canvas" | "shape" | null;
|
|
117
126
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
118
127
|
openSidebar: "library" | "customSidebar" | null;
|
|
119
|
-
openDialog: "imageExport" | "help" | null;
|
|
128
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
120
129
|
isSidebarDocked: boolean;
|
|
121
130
|
lastPointerDownWith: PointerType;
|
|
122
131
|
selectedElementIds: {
|
|
@@ -134,6 +143,7 @@ export declare type AppState = {
|
|
|
134
143
|
zenModeEnabled: boolean;
|
|
135
144
|
theme: Theme;
|
|
136
145
|
gridSize: number | null;
|
|
146
|
+
previousGridSize: number | null;
|
|
137
147
|
viewModeEnabled: boolean;
|
|
138
148
|
/** top-most selected groups (i.e. does not include nested groups) */
|
|
139
149
|
selectedGroupIds: {
|
|
@@ -167,6 +177,8 @@ export declare type AppState = {
|
|
|
167
177
|
elementBackground?: string[];
|
|
168
178
|
elementStroke?: string[];
|
|
169
179
|
};
|
|
180
|
+
allowWheelZoom?: boolean;
|
|
181
|
+
allowPinchZoom?: boolean;
|
|
170
182
|
selectedLinearElement: LinearElementEditor | null;
|
|
171
183
|
};
|
|
172
184
|
export declare type NormalizedZoomValue = number & {
|
|
@@ -220,7 +232,6 @@ export interface ExcalidrawProps {
|
|
|
220
232
|
onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
221
233
|
initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
|
|
222
234
|
excalidrawRef?: ForwardRef<ExcalidrawAPIRefValue>;
|
|
223
|
-
onCollabButtonClick?: () => void;
|
|
224
235
|
isCollaborating?: boolean;
|
|
225
236
|
onPointerUpdate?: (payload: {
|
|
226
237
|
pointer: {
|
|
@@ -233,7 +244,6 @@ export interface ExcalidrawProps {
|
|
|
233
244
|
onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
|
|
234
245
|
onDrop?: (event: React.DragEvent<HTMLDivElement>) => Promise<boolean> | boolean;
|
|
235
246
|
renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
|
|
236
|
-
renderFooter?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
|
|
237
247
|
langCode?: Language["code"];
|
|
238
248
|
viewModeEnabled?: boolean;
|
|
239
249
|
zenModeEnabled?: boolean;
|
|
@@ -243,10 +253,7 @@ export interface ExcalidrawProps {
|
|
|
243
253
|
theme?: Theme;
|
|
244
254
|
name?: string;
|
|
245
255
|
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => JSX.Element;
|
|
246
|
-
UIOptions?:
|
|
247
|
-
dockedSidebarBreakpoint?: number;
|
|
248
|
-
canvasActions?: CanvasActions;
|
|
249
|
-
};
|
|
256
|
+
UIOptions?: Partial<UIOptions>;
|
|
250
257
|
detectScroll?: boolean;
|
|
251
258
|
handleKeyboardGlobally?: boolean;
|
|
252
259
|
onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
|
|
@@ -266,6 +273,7 @@ export interface ExcalidrawProps {
|
|
|
266
273
|
* Render function that renders custom <Sidebar /> component.
|
|
267
274
|
*/
|
|
268
275
|
renderSidebar?: () => JSX.Element | null;
|
|
276
|
+
children?: React.ReactNode;
|
|
269
277
|
}
|
|
270
278
|
export declare type SceneData = {
|
|
271
279
|
elements?: ImportedDataState["elements"];
|
|
@@ -283,22 +291,26 @@ export declare type ExportOpts = {
|
|
|
283
291
|
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => void;
|
|
284
292
|
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => JSX.Element;
|
|
285
293
|
};
|
|
286
|
-
declare type CanvasActions = {
|
|
287
|
-
changeViewBackgroundColor
|
|
288
|
-
clearCanvas
|
|
289
|
-
export
|
|
290
|
-
loadScene
|
|
291
|
-
saveToActiveFile
|
|
292
|
-
toggleTheme
|
|
293
|
-
saveAsImage
|
|
294
|
-
}
|
|
294
|
+
declare type CanvasActions = Partial<{
|
|
295
|
+
changeViewBackgroundColor: boolean;
|
|
296
|
+
clearCanvas: boolean;
|
|
297
|
+
export: false | ExportOpts;
|
|
298
|
+
loadScene: boolean;
|
|
299
|
+
saveToActiveFile: boolean;
|
|
300
|
+
toggleTheme: boolean | null;
|
|
301
|
+
saveAsImage: boolean;
|
|
302
|
+
}>;
|
|
303
|
+
declare type UIOptions = Partial<{
|
|
304
|
+
dockedSidebarBreakpoint: number;
|
|
305
|
+
welcomeScreen: boolean;
|
|
306
|
+
canvasActions: CanvasActions;
|
|
307
|
+
}>;
|
|
295
308
|
export declare type AppProps = Merge<ExcalidrawProps, {
|
|
296
|
-
UIOptions: {
|
|
309
|
+
UIOptions: Merge<MarkRequired<UIOptions, "welcomeScreen">, {
|
|
297
310
|
canvasActions: Required<CanvasActions> & {
|
|
298
311
|
export: ExportOpts;
|
|
299
312
|
};
|
|
300
|
-
|
|
301
|
-
};
|
|
313
|
+
}>;
|
|
302
314
|
detectScroll: boolean;
|
|
303
315
|
handleKeyboardGlobally: boolean;
|
|
304
316
|
isCollaborating: boolean;
|
|
@@ -318,6 +330,7 @@ export declare type AppClassProperties = {
|
|
|
318
330
|
files: BinaryFiles;
|
|
319
331
|
device: App["device"];
|
|
320
332
|
scene: App["scene"];
|
|
333
|
+
pasteFromClipboard: App["pasteFromClipboard"];
|
|
321
334
|
};
|
|
322
335
|
export declare type PointerDownState = Readonly<{
|
|
323
336
|
origin: Readonly<{
|
|
@@ -417,4 +430,19 @@ export declare type Device = Readonly<{
|
|
|
417
430
|
isTouchScreen: boolean;
|
|
418
431
|
canDeviceFitSidebar: boolean;
|
|
419
432
|
}>;
|
|
433
|
+
export declare type UIChildrenComponents = {
|
|
434
|
+
[k in "FooterCenter" | "Menu" | "WelcomeScreen"]?: React.ReactElement<{
|
|
435
|
+
children?: React.ReactNode;
|
|
436
|
+
}, React.JSXElementConstructor<any>>;
|
|
437
|
+
};
|
|
438
|
+
export declare type UIWelcomeScreenComponents = {
|
|
439
|
+
[k in "Center" | "MenuHint" | "ToolbarHint" | "HelpHint"]?: React.ReactElement<{
|
|
440
|
+
children?: React.ReactNode;
|
|
441
|
+
}, React.JSXElementConstructor<any>>;
|
|
442
|
+
};
|
|
443
|
+
export declare type UIWelcomeScreenCenterComponents = {
|
|
444
|
+
[k in "Logo" | "Heading" | "Menu" | "MenuItemLoadScene" | "MenuItemHelp"]?: React.ReactElement<{
|
|
445
|
+
children?: React.ReactNode;
|
|
446
|
+
}, React.JSXElementConstructor<any>>;
|
|
447
|
+
};
|
|
420
448
|
export {};
|