@dwelle/excalidraw 0.4.0-e1bdbb6 → 0.4.0-e587816
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 +714 -0
- package/README.md +18 -1422
- package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js → vendor-d415b28e9024dee4bb1b.js} +2 -2
- package/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.js → vendor-a14cd58fa2db417e42b2.js} +6 -6
- package/dist/excalidraw.development.js +3257 -1444
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +20 -0
- package/main.js +1 -8
- package/package.json +9 -4
- package/types/actions/actionAddToLibrary.d.ts +124 -64
- package/types/actions/actionAlign.d.ts +33 -40
- package/types/actions/actionBoundText.d.ts +182 -25
- package/types/actions/actionCanvas.d.ts +754 -220
- package/types/actions/actionClipboard.d.ts +236 -115
- package/types/actions/actionDeleteSelected.d.ts +133 -72
- package/types/actions/actionDistribute.d.ts +11 -16
- package/types/actions/actionDuplicateSelection.d.ts +4 -7
- package/types/actions/actionElementLock.d.ts +271 -0
- package/types/actions/actionExport.d.ts +440 -277
- package/types/actions/actionFinalize.d.ts +85 -51
- package/types/actions/actionFlip.d.ts +8 -11
- package/types/actions/actionFrame.d.ts +423 -0
- package/types/actions/actionGroup.d.ts +252 -19
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +44 -24
- package/types/actions/actionMenu.d.ts +132 -79
- package/types/actions/actionNavigate.d.ts +2 -3
- package/types/actions/actionProperties.d.ts +569 -334
- package/types/actions/actionSelectAll.d.ts +123 -4
- package/types/actions/actionStyles.d.ts +46 -27
- package/types/actions/actionToggleGridMode.d.ts +46 -25
- package/types/actions/{actionToggleLock.d.ts → actionToggleObjectsSnapMode.d.ts} +56 -35
- package/types/actions/actionToggleStats.d.ts +45 -25
- package/types/actions/actionToggleViewMode.d.ts +46 -25
- package/types/actions/actionToggleZenMode.d.ts +46 -25
- package/types/actions/actionZindex.d.ts +16 -24
- package/types/actions/index.d.ts +2 -1
- package/types/actions/manager.d.ts +3 -2
- package/types/actions/shortcuts.d.ts +2 -1
- package/types/actions/types.d.ts +16 -13
- package/types/appState.d.ts +27 -28
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +5 -6
- package/types/clipboard.d.ts +9 -3
- package/types/colors.d.ts +60 -5
- package/types/components/Actions.d.ts +7 -12
- package/types/components/ActiveConfirmDialog.d.ts +4 -0
- package/types/components/App.d.ts +102 -86
- package/types/components/Avatar.d.ts +1 -2
- package/types/components/BraveMeasureTextError.d.ts +2 -0
- package/types/components/Button.d.ts +16 -0
- package/types/components/ButtonIconSelect.d.ts +11 -3
- package/types/components/Card.d.ts +6 -0
- package/types/components/ColorPicker/ColorInput.d.ts +9 -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 +20 -0
- package/types/components/ContextMenu.d.ts +9 -22
- package/types/components/DefaultSidebar.d.ts +29 -0
- package/types/components/Dialog.d.ts +3 -4
- package/types/components/ErrorDialog.d.ts +3 -2
- package/types/components/ExcalidrawLogo.d.ts +15 -0
- package/types/components/EyeDropper.d.ts +28 -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 +4 -5
- 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 +7 -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 +11 -19
- 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 +10 -5
- package/types/components/LibraryMenuItems.d.ts +6 -7
- package/types/components/LibraryMenuSection.d.ts +22 -0
- package/types/components/LibraryUnit.d.ts +6 -3
- package/types/components/LoadingMessage.d.ts +0 -1
- package/types/components/LockButton.d.ts +1 -2
- package/types/components/MobileMenu.d.ts +9 -15
- 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/Section.d.ts +1 -1
- 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 +8 -0
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +9 -0
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +6 -0
- package/types/components/Sidebar/SidebarTabs.d.ts +6 -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 +9 -0
- package/types/components/UserList.d.ts +0 -2
- package/types/components/canvases/InteractiveCanvas.d.ts +27 -0
- package/types/components/canvases/StaticCanvas.d.ts +18 -0
- package/types/components/canvases/index.d.ts +3 -0
- package/types/components/dropdownMenu/DropdownMenu.d.ts +70 -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 +13 -0
- package/types/components/dropdownMenu/DropdownMenuItemContent.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +7 -0
- package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +14 -0
- package/types/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +10 -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 +17 -2
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +9 -0
- package/types/components/main-menu/DefaultItems.d.ts +47 -0
- package/types/components/main-menu/MainMenu.d.ts +64 -0
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +57 -0
- package/types/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
- package/types/components/welcome-screen/WelcomeScreen.d.ts +84 -0
- package/types/constants.d.ts +105 -18
- package/types/context/tunnels.d.ts +19 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/cursor.d.ts +5 -0
- package/types/data/blob.d.ts +5 -3
- 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/transform.d.ts +73 -0
- package/types/data/types.d.ts +3 -5
- package/types/data/url.d.ts +7 -0
- package/types/element/Hyperlink.d.ts +57 -36
- package/types/element/binding.d.ts +4 -3
- package/types/element/bounds.d.ts +41 -10
- package/types/element/collision.d.ts +7 -7
- package/types/element/dragElements.d.ts +12 -2
- package/types/element/embeddable.d.ts +153 -0
- package/types/element/image.d.ts +11 -1
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +77 -30
- package/types/element/mutateElement.d.ts +3 -2
- package/types/element/newElement.d.ts +48 -15
- package/types/element/resizeElements.d.ts +3 -3
- package/types/element/resizeTest.d.ts +2 -1
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/sizeHelpers.d.ts +8 -1
- package/types/element/sortElements.d.ts +2 -0
- package/types/element/textElement.d.ts +57 -9
- package/types/element/textWysiwyg.d.ts +7 -2
- package/types/element/transformHandles.d.ts +15 -8
- package/types/element/typeChecks.d.ts +14 -2
- package/types/element/types.d.ts +66 -35
- package/types/emitter.d.ts +1 -2
- package/types/errors.d.ts +1 -1
- package/types/frame.d.ts +46 -0
- package/types/ga.d.ts +5 -5
- package/types/groups.d.ts +15 -11
- package/types/history.d.ts +3 -3
- package/types/hooks/useCreatePortalContainer.d.ts +4 -0
- package/types/hooks/useLibraryItemSvg.d.ts +11 -0
- package/types/hooks/useOutsideClick.d.ts +19 -2
- package/types/hooks/useScrollPosition.d.ts +1 -0
- package/types/hooks/useStable.d.ts +1 -0
- package/types/hooks/useTransition.d.ts +2 -0
- package/types/i18n.d.ts +11 -2
- package/types/jotai.d.ts +20 -108
- package/types/keys.d.ts +7 -4
- package/types/math.d.ts +7 -1
- package/types/packages/bbox.d.ts +11 -0
- 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 +182 -64
- package/types/packages/excalidraw/index.d.ts +22 -4
- package/types/packages/excalidraw/main.d.ts +3 -1
- package/types/packages/excalidraw/webpack.dev.config.d.ts +5 -2
- package/types/packages/excalidraw/webpack.prod.config.d.ts +3 -0
- package/types/packages/utils.d.ts +30 -24
- package/types/packages/withinBounds.d.ts +19 -0
- package/types/renderer/renderElement.d.ts +13 -22
- package/types/renderer/renderScene.d.ts +19 -29
- package/types/renderer/renderSnaps.d.ts +2 -0
- package/types/renderer/roundRect.d.ts +1 -1
- package/types/scene/Fonts.d.ts +21 -0
- package/types/scene/Renderer.d.ts +25 -0
- package/types/scene/Scene.d.ts +42 -5
- package/types/scene/Shape.d.ts +12 -0
- package/types/scene/ShapeCache.d.ts +20 -0
- package/types/scene/comparisons.d.ts +2 -4
- package/types/scene/export.d.ts +183 -10
- package/types/scene/index.d.ts +1 -1
- package/types/scene/scroll.d.ts +1 -1
- package/types/scene/scrollbars.d.ts +2 -6
- package/types/scene/selection.d.ts +27 -6
- package/types/scene/types.d.ts +70 -26
- package/types/snapping.d.ts +108 -0
- package/types/types.d.ts +227 -91
- package/types/utility-types.d.ts +24 -0
- package/types/utils.d.ts +75 -14
- package/types/zindex.d.ts +4 -4
- 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/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js.LICENSE.txt → vendor-d415b28e9024dee4bb1b.js.LICENSE.txt} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.d.ts → vendor-d415b28e9024dee4bb1b.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.d.ts → vendor-a14cd58fa2db417e42b2.d.ts} +0 -0
package/types/appState.d.ts
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
import { AppState
|
|
1
|
+
import { AppState } from "./types";
|
|
2
2
|
export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
3
3
|
export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
activeTool?: {
|
|
7
|
-
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
8
|
-
lastActiveToolBeforeEraser: import("./types").LastActiveToolBeforeEraser;
|
|
9
|
-
locked: boolean;
|
|
10
|
-
customType: null;
|
|
11
|
-
} | {
|
|
12
|
-
type: "custom";
|
|
13
|
-
customType: string;
|
|
14
|
-
lastActiveToolBeforeEraser: import("./types").LastActiveToolBeforeEraser;
|
|
4
|
+
activeTool?: ({
|
|
5
|
+
lastActiveTool: import("./types").ActiveTool | null;
|
|
15
6
|
locked: boolean;
|
|
16
|
-
} | undefined;
|
|
17
|
-
|
|
18
|
-
scrollY?: number | undefined;
|
|
19
|
-
viewBackgroundColor?: string | undefined;
|
|
20
|
-
zoom?: Readonly<{
|
|
21
|
-
value: NormalizedZoomValue;
|
|
22
|
-
}> | undefined;
|
|
23
|
-
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
7
|
+
} & import("./types").ActiveTool) | undefined;
|
|
8
|
+
name?: string | undefined;
|
|
24
9
|
showWelcomeScreen?: boolean | undefined;
|
|
25
10
|
penMode?: boolean | undefined;
|
|
26
11
|
penDetected?: boolean | undefined;
|
|
@@ -38,23 +23,33 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
38
23
|
currentItemFontFamily?: number | undefined;
|
|
39
24
|
currentItemFontSize?: number | undefined;
|
|
40
25
|
currentItemTextAlign?: string | undefined;
|
|
41
|
-
currentItemStrokeSharpness?: import("./element/types").StrokeSharpness | undefined;
|
|
42
26
|
currentItemStartArrowhead?: import("./element/types").Arrowhead | null | undefined;
|
|
43
27
|
currentItemEndArrowhead?: import("./element/types").Arrowhead | null | undefined;
|
|
44
|
-
|
|
28
|
+
currentItemRoundness?: import("./element/types").StrokeRoundness | undefined;
|
|
29
|
+
viewBackgroundColor?: string | undefined;
|
|
30
|
+
scrollX?: number | undefined;
|
|
31
|
+
scrollY?: number | undefined;
|
|
45
32
|
cursorButton?: "up" | "down" | undefined;
|
|
46
33
|
scrolledOutside?: boolean | undefined;
|
|
34
|
+
zoom?: Readonly<{
|
|
35
|
+
value: import("./types").NormalizedZoomValue;
|
|
36
|
+
}> | undefined;
|
|
47
37
|
openMenu?: "canvas" | "shape" | null | undefined;
|
|
48
|
-
openSidebar?:
|
|
49
|
-
|
|
38
|
+
openSidebar?: {
|
|
39
|
+
name: string;
|
|
40
|
+
tab?: string | undefined;
|
|
41
|
+
} | null | undefined;
|
|
42
|
+
defaultSidebarDockedPreference?: boolean | undefined;
|
|
50
43
|
lastPointerDownWith?: import("./element/types").PointerType | undefined;
|
|
51
|
-
selectedElementIds?: {
|
|
52
|
-
[id: string]:
|
|
53
|
-
} | undefined;
|
|
44
|
+
selectedElementIds?: Readonly<{
|
|
45
|
+
[id: string]: true;
|
|
46
|
+
}> | undefined;
|
|
54
47
|
previousSelectedElementIds?: {
|
|
55
|
-
[id: string]:
|
|
48
|
+
[id: string]: true;
|
|
56
49
|
} | undefined;
|
|
50
|
+
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
57
51
|
zenModeEnabled?: boolean | undefined;
|
|
52
|
+
theme?: import("./element/types").Theme | undefined;
|
|
58
53
|
gridSize?: number | null | undefined;
|
|
59
54
|
selectedGroupIds?: {
|
|
60
55
|
[groupId: string]: boolean;
|
|
@@ -63,6 +58,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
63
58
|
showStats?: boolean | undefined;
|
|
64
59
|
currentChartType?: import("./element/types").ChartType | undefined;
|
|
65
60
|
selectedLinearElement?: import("./element/linearElementEditor").LinearElementEditor | null | undefined;
|
|
61
|
+
objectsSnapModeEnabled?: boolean | undefined;
|
|
66
62
|
};
|
|
67
63
|
export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
|
|
68
64
|
viewBackgroundColor?: string | undefined;
|
|
@@ -75,3 +71,6 @@ export declare const clearAppStateForDatabase: (appState: Partial<AppState>) =>
|
|
|
75
71
|
export declare const isEraserActive: ({ activeTool, }: {
|
|
76
72
|
activeTool: AppState["activeTool"];
|
|
77
73
|
}) => boolean;
|
|
74
|
+
export declare const isHandToolActive: ({ activeTool, }: {
|
|
75
|
+
activeTool: AppState["activeTool"];
|
|
76
|
+
}) => boolean;
|
package/types/charts.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
-
export
|
|
2
|
+
export type ChartElements = readonly NonDeletedExcalidrawElement[];
|
|
3
3
|
export interface Spreadsheet {
|
|
4
4
|
title: string | null;
|
|
5
5
|
labels: string[] | null;
|
|
@@ -7,7 +7,7 @@ export interface Spreadsheet {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const NOT_SPREADSHEET = "NOT_SPREADSHEET";
|
|
9
9
|
export declare const VALID_SPREADSHEET = "VALID_SPREADSHEET";
|
|
10
|
-
|
|
10
|
+
type ParseSpreadsheetResult = {
|
|
11
11
|
type: typeof NOT_SPREADSHEET;
|
|
12
12
|
reason: string;
|
|
13
13
|
} | {
|
package/types/clients.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const getClientInitials: (userName?: string | null) => string;
|
|
1
|
+
export declare const getClientColor: (id: string) => string;
|
|
2
|
+
/**
|
|
3
|
+
* returns first char, capitalized
|
|
4
|
+
*/
|
|
5
|
+
export declare const getNameInitial: (name?: string | null) => string;
|
package/types/clipboard.d.ts
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
-
import {
|
|
2
|
+
import { BinaryFiles } from "./types";
|
|
3
3
|
import { Spreadsheet } from "./charts";
|
|
4
|
+
export type PastedMixedContent = {
|
|
5
|
+
type: "text" | "imageUrl";
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
4
8
|
export interface ClipboardData {
|
|
5
9
|
spreadsheet?: Spreadsheet;
|
|
6
10
|
elements?: readonly ExcalidrawElement[];
|
|
7
11
|
files?: BinaryFiles;
|
|
8
12
|
text?: string;
|
|
13
|
+
mixedContent?: PastedMixedContent;
|
|
9
14
|
errorMessage?: string;
|
|
15
|
+
programmaticAPI?: boolean;
|
|
10
16
|
}
|
|
11
17
|
export declare const probablySupportsClipboardReadText: boolean;
|
|
12
18
|
export declare const probablySupportsClipboardWriteText: boolean;
|
|
13
19
|
export declare const probablySupportsClipboardBlob: boolean;
|
|
14
|
-
export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[],
|
|
20
|
+
export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null) => Promise<string | undefined>;
|
|
15
21
|
/**
|
|
16
22
|
* Attempts to parse clipboard. Prefers system clipboard.
|
|
17
23
|
*/
|
|
18
|
-
export declare const parseClipboard: (event: ClipboardEvent | null) => Promise<ClipboardData>;
|
|
24
|
+
export declare const parseClipboard: (event: ClipboardEvent | null, isPlainPaste?: boolean) => Promise<ClipboardData>;
|
|
19
25
|
export declare const copyBlobToClipboardAsPng: (blob: Blob | Promise<Blob>) => Promise<void>;
|
|
20
26
|
export declare const copyTextToSystemClipboard: (text: string | null) => Promise<void>;
|
package/types/colors.d.ts
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import oc from "open-color";
|
|
2
|
+
import { Merge } from "./utility-types";
|
|
3
|
+
export type ColorPickerColor = Exclude<keyof oc, "indigo" | "lime"> | "transparent" | "bronze";
|
|
4
|
+
export type ColorTuple = readonly [string, string, string, string, string];
|
|
5
|
+
export type ColorPalette = Merge<Record<ColorPickerColor, ColorTuple>, {
|
|
6
|
+
black: "#1e1e1e";
|
|
7
|
+
white: "#ffffff";
|
|
8
|
+
transparent: "transparent";
|
|
9
|
+
}>;
|
|
10
|
+
export type ColorPaletteCustom = {
|
|
11
|
+
[key: string]: ColorTuple | string;
|
|
5
12
|
};
|
|
6
|
-
export
|
|
13
|
+
export type ColorShadesIndexes = [number, number, number, number, number];
|
|
14
|
+
export declare const MAX_CUSTOM_COLORS_USED_IN_CANVAS = 5;
|
|
15
|
+
export declare const COLORS_PER_ROW = 5;
|
|
16
|
+
export declare const DEFAULT_CHART_COLOR_INDEX = 4;
|
|
17
|
+
export declare const DEFAULT_ELEMENT_STROKE_COLOR_INDEX = 4;
|
|
18
|
+
export declare const DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX = 1;
|
|
19
|
+
export declare const ELEMENTS_PALETTE_SHADE_INDEXES: readonly [0, 2, 4, 6, 8];
|
|
20
|
+
export declare const CANVAS_PALETTE_SHADE_INDEXES: readonly [0, 1, 2, 3, 4];
|
|
21
|
+
export declare const getSpecificColorShades: (color: Exclude<ColorPickerColor, "transparent" | "white" | "black" | "bronze">, indexArr: readonly [number, number, number, number, number]) => ColorTuple;
|
|
22
|
+
export declare const COLOR_PALETTE: ColorPalette;
|
|
23
|
+
export declare const DEFAULT_ELEMENT_STROKE_PICKS: ColorTuple;
|
|
24
|
+
export declare const DEFAULT_ELEMENT_BACKGROUND_PICKS: ColorTuple;
|
|
25
|
+
export declare const DEFAULT_CANVAS_BACKGROUND_PICKS: ColorTuple;
|
|
26
|
+
export declare const DEFAULT_ELEMENT_STROKE_COLOR_PALETTE: {
|
|
27
|
+
readonly red: ColorTuple;
|
|
28
|
+
readonly pink: ColorTuple;
|
|
29
|
+
readonly grape: ColorTuple;
|
|
30
|
+
readonly violet: ColorTuple;
|
|
31
|
+
readonly blue: ColorTuple;
|
|
32
|
+
readonly cyan: ColorTuple;
|
|
33
|
+
readonly teal: ColorTuple;
|
|
34
|
+
readonly green: ColorTuple;
|
|
35
|
+
readonly yellow: ColorTuple;
|
|
36
|
+
readonly orange: ColorTuple;
|
|
37
|
+
readonly transparent: "transparent";
|
|
38
|
+
readonly white: "#ffffff";
|
|
39
|
+
readonly gray: ColorTuple;
|
|
40
|
+
readonly black: "#1e1e1e";
|
|
41
|
+
readonly bronze: ColorTuple;
|
|
42
|
+
};
|
|
43
|
+
export declare const DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE: {
|
|
44
|
+
readonly red: ColorTuple;
|
|
45
|
+
readonly pink: ColorTuple;
|
|
46
|
+
readonly grape: ColorTuple;
|
|
47
|
+
readonly violet: ColorTuple;
|
|
48
|
+
readonly blue: ColorTuple;
|
|
49
|
+
readonly cyan: ColorTuple;
|
|
50
|
+
readonly teal: ColorTuple;
|
|
51
|
+
readonly green: ColorTuple;
|
|
52
|
+
readonly yellow: ColorTuple;
|
|
53
|
+
readonly orange: ColorTuple;
|
|
54
|
+
readonly transparent: "transparent";
|
|
55
|
+
readonly white: "#ffffff";
|
|
56
|
+
readonly gray: ColorTuple;
|
|
57
|
+
readonly black: "#1e1e1e";
|
|
58
|
+
readonly bronze: ColorTuple;
|
|
59
|
+
};
|
|
60
|
+
export declare const getAllColorsSpecificShade: (index: 0 | 1 | 2 | 3 | 4) => readonly [string, string, string, string, string, string, string, string, string, string];
|
|
61
|
+
export declare const rgbToHex: (r: number, g: number, b: number) => string;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { ActionManager } from "../actions/manager";
|
|
3
|
-
import { ExcalidrawElement
|
|
4
|
-
import {
|
|
2
|
+
import { ExcalidrawElement } from "../element/types";
|
|
3
|
+
import { AppClassProperties, UIAppState, Zoom } from "../types";
|
|
5
4
|
import "./Actions.scss";
|
|
6
5
|
export declare const SelectedShapeActions: ({ appState, elements, renderAction, }: {
|
|
7
|
-
appState:
|
|
6
|
+
appState: UIAppState;
|
|
8
7
|
elements: readonly ExcalidrawElement[];
|
|
9
8
|
renderAction: ActionManager["renderAction"];
|
|
10
9
|
}) => JSX.Element;
|
|
11
|
-
export declare const ShapesSwitcher: ({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
onImageAction: (data: {
|
|
16
|
-
pointerType: PointerType | null;
|
|
17
|
-
}) => void;
|
|
18
|
-
appState: AppState;
|
|
10
|
+
export declare const ShapesSwitcher: ({ activeTool, appState, app, }: {
|
|
11
|
+
activeTool: UIAppState["activeTool"];
|
|
12
|
+
appState: UIAppState;
|
|
13
|
+
app: AppClassProperties;
|
|
19
14
|
}) => JSX.Element;
|
|
20
15
|
export declare const ZoomActions: ({ renderAction, zoom, }: {
|
|
21
16
|
renderAction: ActionManager["renderAction"];
|
|
@@ -1,64 +1,28 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { RoughCanvas } from "roughjs/bin/canvas";
|
|
3
3
|
import { ActionManager } from "../actions/manager";
|
|
4
|
+
import { EXPORT_IMAGE_TYPES } from "../constants";
|
|
4
5
|
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
5
6
|
import { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement } from "../element/types";
|
|
6
7
|
import History from "../history";
|
|
7
8
|
import Scene from "../scene/Scene";
|
|
8
|
-
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device } from "../types";
|
|
9
|
+
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType } from "../types";
|
|
9
10
|
import { FileSystemHandle } from "../data/filesystem";
|
|
11
|
+
import { Renderer } from "../scene/Renderer";
|
|
12
|
+
import { LaserPathManager } from "./LaserTool/LaserPathManager";
|
|
10
13
|
import { Emitter } from "../emitter";
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
|
|
18
|
-
unstable_promise: true;
|
|
19
|
-
}): Value_3 | Promise<Value_3>;
|
|
20
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
|
|
21
|
-
unstable_promise: true;
|
|
22
|
-
}): Value_4 | Promise<Value_4>;
|
|
23
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>, options: {
|
|
24
|
-
unstable_promise: true;
|
|
25
|
-
}): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
|
|
26
|
-
}, set: {
|
|
27
|
-
<Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
|
|
28
|
-
<Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
|
|
29
|
-
}, update: boolean | ((prev: boolean) => boolean)) => void;
|
|
30
|
-
onMount?: (<S extends (update: boolean | ((prev: boolean) => boolean)) => void>(setAtom: S) => void | (() => void)) | undefined;
|
|
31
|
-
} & {
|
|
32
|
-
init: boolean;
|
|
33
|
-
};
|
|
34
|
-
export declare const isDropdownOpenAtom: import("jotai").Atom<boolean> & {
|
|
35
|
-
write: (get: {
|
|
36
|
-
<Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
|
|
37
|
-
<Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
|
|
38
|
-
<Value_2>(atom: import("jotai").Atom<Value_2>): Value_2 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_2;
|
|
39
|
-
} & {
|
|
40
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
|
|
41
|
-
unstable_promise: true;
|
|
42
|
-
}): Value_3 | Promise<Value_3>;
|
|
43
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
|
|
44
|
-
unstable_promise: true;
|
|
45
|
-
}): Value_4 | Promise<Value_4>;
|
|
46
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>, options: {
|
|
47
|
-
unstable_promise: true;
|
|
48
|
-
}): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
|
|
49
|
-
}, set: {
|
|
50
|
-
<Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
|
|
51
|
-
<Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
|
|
52
|
-
}, update: boolean | ((prev: boolean) => boolean)) => void;
|
|
53
|
-
onMount?: (<S extends (update: boolean | ((prev: boolean) => boolean)) => void>(setAtom: S) => void | (() => void)) | undefined;
|
|
54
|
-
} & {
|
|
55
|
-
init: boolean;
|
|
56
|
-
};
|
|
14
|
+
export declare const ExcalidrawContainerContext: React.Context<{
|
|
15
|
+
container: HTMLDivElement | null;
|
|
16
|
+
id?: string | null | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const useApp: () => AppClassProperties;
|
|
19
|
+
export declare const useAppProps: () => AppProps;
|
|
57
20
|
export declare const useDevice: () => Readonly<{
|
|
58
21
|
isSmScreen: boolean;
|
|
59
22
|
isMobile: boolean;
|
|
60
23
|
isTouchScreen: boolean;
|
|
61
24
|
canDeviceFitSidebar: boolean;
|
|
25
|
+
isLandscape: boolean;
|
|
62
26
|
}>;
|
|
63
27
|
export declare const useExcalidrawContainer: () => {
|
|
64
28
|
container: HTMLDivElement | null;
|
|
@@ -67,9 +31,11 @@ export declare const useExcalidrawContainer: () => {
|
|
|
67
31
|
export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawElement[];
|
|
68
32
|
export declare const useExcalidrawAppState: () => AppState;
|
|
69
33
|
export declare const useExcalidrawSetAppState: () => <K extends keyof AppState>(state: AppState | ((prevState: Readonly<AppState>, props: Readonly<any>) => AppState | Pick<AppState, K> | null) | Pick<AppState, K> | null, callback?: (() => void) | undefined) => void;
|
|
34
|
+
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
70
35
|
declare class App extends React.Component<AppProps, AppState> {
|
|
71
36
|
canvas: AppClassProperties["canvas"];
|
|
72
|
-
|
|
37
|
+
interactiveCanvas: AppClassProperties["interactiveCanvas"];
|
|
38
|
+
rc: RoughCanvas;
|
|
73
39
|
unmounted: boolean;
|
|
74
40
|
actionManager: ActionManager;
|
|
75
41
|
device: Device;
|
|
@@ -77,35 +43,31 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
77
43
|
private excalidrawContainerRef;
|
|
78
44
|
static defaultProps: Partial<AppProps>;
|
|
79
45
|
scene: Scene;
|
|
46
|
+
renderer: Renderer;
|
|
47
|
+
private fonts;
|
|
80
48
|
private resizeObserver;
|
|
81
49
|
private nearestScrollableContainer;
|
|
82
50
|
library: AppClassProperties["library"];
|
|
83
51
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
84
|
-
|
|
52
|
+
id: string;
|
|
85
53
|
private history;
|
|
86
54
|
private excalidrawContainerValue;
|
|
87
55
|
files: BinaryFiles;
|
|
88
56
|
imageCache: AppClassProperties["imageCache"];
|
|
57
|
+
private iFrameRefs;
|
|
89
58
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
lastScenePointer: {
|
|
59
|
+
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
60
|
+
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
61
|
+
lastViewportPosition: {
|
|
94
62
|
x: number;
|
|
95
63
|
y: number;
|
|
96
|
-
}
|
|
64
|
+
};
|
|
65
|
+
laserPathManager: LaserPathManager;
|
|
97
66
|
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
|
|
98
67
|
onPointerDownEmitter: Emitter<[activeTool: {
|
|
99
|
-
|
|
100
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
101
|
-
locked: boolean;
|
|
102
|
-
customType: null;
|
|
103
|
-
} | {
|
|
104
|
-
type: "custom";
|
|
105
|
-
customType: string;
|
|
106
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
68
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
107
69
|
locked: boolean;
|
|
108
|
-
}, pointerDownState: Readonly<{
|
|
70
|
+
} & import("../types").ActiveTool, pointerDownState: Readonly<{
|
|
109
71
|
origin: Readonly<{
|
|
110
72
|
x: number;
|
|
111
73
|
y: number;
|
|
@@ -171,18 +133,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
171
133
|
erase: boolean;
|
|
172
134
|
};
|
|
173
135
|
};
|
|
174
|
-
}>, event: React.PointerEvent<
|
|
136
|
+
}>, event: React.PointerEvent<HTMLElement>]>;
|
|
175
137
|
onPointerUpEmitter: Emitter<[activeTool: {
|
|
176
|
-
|
|
177
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
138
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
178
139
|
locked: boolean;
|
|
179
|
-
|
|
180
|
-
} | {
|
|
181
|
-
type: "custom";
|
|
182
|
-
customType: string;
|
|
183
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
184
|
-
locked: boolean;
|
|
185
|
-
}, pointerDownState: Readonly<{
|
|
140
|
+
} & import("../types").ActiveTool, pointerDownState: Readonly<{
|
|
186
141
|
origin: Readonly<{
|
|
187
142
|
x: number;
|
|
188
143
|
y: number;
|
|
@@ -250,16 +205,27 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
250
205
|
};
|
|
251
206
|
}>, event: PointerEvent]>;
|
|
252
207
|
constructor(props: AppProps);
|
|
253
|
-
private
|
|
208
|
+
private onWindowMessage;
|
|
209
|
+
private updateEmbeddableRef;
|
|
210
|
+
private getHTMLIFrameElement;
|
|
211
|
+
private handleEmbeddableCenterClick;
|
|
212
|
+
private isEmbeddableCenter;
|
|
213
|
+
private updateEmbeddables;
|
|
214
|
+
private renderEmbeddables;
|
|
215
|
+
private getFrameNameDOMId;
|
|
216
|
+
frameNameBoundsCache: FrameNameBoundsCache;
|
|
217
|
+
private renderFrameNames;
|
|
254
218
|
render(): JSX.Element;
|
|
255
219
|
focusContainer: AppClassProperties["focusContainer"];
|
|
256
220
|
getSceneElementsIncludingDeleted: () => readonly ExcalidrawElement[];
|
|
257
221
|
getSceneElements: () => readonly NonDeletedExcalidrawElement[];
|
|
222
|
+
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
223
|
+
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: readonly NonDeletedExcalidrawElement[]) => Promise<void>;
|
|
224
|
+
private openEyeDropper;
|
|
258
225
|
private syncActionResult;
|
|
259
226
|
private onBlur;
|
|
260
227
|
private onUnload;
|
|
261
228
|
private disableEvent;
|
|
262
|
-
private onFontLoaded;
|
|
263
229
|
private resetHistory;
|
|
264
230
|
/**
|
|
265
231
|
* Resets scene & history.
|
|
@@ -272,25 +238,56 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
272
238
|
componentWillUnmount(): void;
|
|
273
239
|
private onResize;
|
|
274
240
|
private removeEventListeners;
|
|
241
|
+
private onFontsLoadingDone;
|
|
275
242
|
private addEventListeners;
|
|
276
243
|
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
|
|
277
|
-
private
|
|
244
|
+
private renderInteractiveSceneCallback;
|
|
278
245
|
private onScroll;
|
|
279
246
|
private onCut;
|
|
280
247
|
private onCopy;
|
|
281
248
|
private cutAll;
|
|
282
249
|
private copyAll;
|
|
283
250
|
private static resetTapTwice;
|
|
284
|
-
private
|
|
285
|
-
private
|
|
286
|
-
|
|
251
|
+
private onTouchStart;
|
|
252
|
+
private onTouchEnd;
|
|
253
|
+
pasteFromClipboard: (event: ClipboardEvent | null) => Promise<void>;
|
|
287
254
|
private addElementsFromPasteOrLibrary;
|
|
255
|
+
private addElementsFromMixedContentPaste;
|
|
288
256
|
private addTextFromPaste;
|
|
289
257
|
setAppState: React.Component<any, AppState>["setState"];
|
|
290
258
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
291
259
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
292
|
-
|
|
293
|
-
|
|
260
|
+
updateFrameRendering: (opts: Partial<{
|
|
261
|
+
enabled: boolean;
|
|
262
|
+
name: boolean;
|
|
263
|
+
outline: boolean;
|
|
264
|
+
clip: boolean;
|
|
265
|
+
}> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
266
|
+
togglePenMode: (force?: boolean) => void;
|
|
267
|
+
onHandToolToggle: () => void;
|
|
268
|
+
/**
|
|
269
|
+
* Zooms on canvas viewport center
|
|
270
|
+
*/
|
|
271
|
+
zoomCanvas: (value: number) => void;
|
|
272
|
+
private cancelInProgresAnimation;
|
|
273
|
+
scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[], opts?: {
|
|
274
|
+
fitToContent?: boolean;
|
|
275
|
+
fitToViewport?: never;
|
|
276
|
+
viewportZoomFactor?: never;
|
|
277
|
+
animate?: boolean;
|
|
278
|
+
duration?: number;
|
|
279
|
+
} | {
|
|
280
|
+
fitToContent?: never;
|
|
281
|
+
fitToViewport?: boolean;
|
|
282
|
+
/** when fitToViewport=true, how much screen should the content cover,
|
|
283
|
+
* between 0.1 (10%) and 1 (100%)
|
|
284
|
+
*/
|
|
285
|
+
viewportZoomFactor?: number;
|
|
286
|
+
animate?: boolean;
|
|
287
|
+
duration?: number;
|
|
288
|
+
}) => void;
|
|
289
|
+
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
290
|
+
private translateCanvas;
|
|
294
291
|
setToast: (toast: {
|
|
295
292
|
message: string;
|
|
296
293
|
closable?: boolean;
|
|
@@ -309,12 +306,26 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
309
306
|
/**
|
|
310
307
|
* @returns whether the menu was toggled on or off
|
|
311
308
|
*/
|
|
312
|
-
|
|
309
|
+
toggleSidebar: ({ name, tab, force, }: {
|
|
310
|
+
name: SidebarName;
|
|
311
|
+
tab?: string | undefined;
|
|
312
|
+
force?: boolean | undefined;
|
|
313
|
+
}) => boolean;
|
|
313
314
|
private updateCurrentCursorPosition;
|
|
314
315
|
private onKeyDown;
|
|
315
316
|
private onWheel;
|
|
316
317
|
private onKeyUp;
|
|
317
|
-
|
|
318
|
+
setActiveTool: (tool: (({
|
|
319
|
+
type: Exclude<ToolType, "image">;
|
|
320
|
+
} | {
|
|
321
|
+
type: Extract<ToolType, "image">;
|
|
322
|
+
insertOnCanvasDirectly?: boolean;
|
|
323
|
+
}) | {
|
|
324
|
+
type: "custom";
|
|
325
|
+
customType: string;
|
|
326
|
+
}) & {
|
|
327
|
+
locked?: boolean;
|
|
328
|
+
}) => void;
|
|
318
329
|
private setCursor;
|
|
319
330
|
private resetCursor;
|
|
320
331
|
/**
|
|
@@ -336,6 +347,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
336
347
|
private handleCanvasDoubleClick;
|
|
337
348
|
private getElementLinkAtPosition;
|
|
338
349
|
private redirectToLink;
|
|
350
|
+
private getTopLayerFrameAtSceneCoords;
|
|
339
351
|
private handleCanvasPointerMove;
|
|
340
352
|
private handleEraser;
|
|
341
353
|
private handleTouchMove;
|
|
@@ -358,9 +370,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
358
370
|
private isHittingCommonBoundingBoxOfSelectedElements;
|
|
359
371
|
private handleTextOnPointerDown;
|
|
360
372
|
private handleFreeDrawElementOnPointerDown;
|
|
373
|
+
private insertEmbeddableElement;
|
|
361
374
|
private createImageElement;
|
|
362
375
|
private handleLinearElementOnPointerDown;
|
|
376
|
+
private getCurrentItemRoundness;
|
|
363
377
|
private createGenericElementOnPointerDown;
|
|
378
|
+
private createFrameElementOnPointerDown;
|
|
379
|
+
private maybeCacheReferenceSnapPoints;
|
|
380
|
+
private maybeCacheVisibleGaps;
|
|
364
381
|
private onKeyDownFromPointerDownHandler;
|
|
365
382
|
private onKeyUpFromPointerDownHandler;
|
|
366
383
|
private onPointerMoveFromPointerDownHandler;
|
|
@@ -389,14 +406,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
389
406
|
private maybeSuggestBindingsForLinearElementAtCoords;
|
|
390
407
|
private maybeSuggestBindingForAll;
|
|
391
408
|
private clearSelection;
|
|
392
|
-
private
|
|
409
|
+
private handleInteractiveCanvasRef;
|
|
393
410
|
private handleAppOnDrop;
|
|
394
411
|
loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
|
|
395
412
|
private handleCanvasContextMenu;
|
|
396
413
|
private maybeDragNewGenericElement;
|
|
397
414
|
private maybeHandleResize;
|
|
398
|
-
|
|
399
|
-
private _openContextMenu;
|
|
415
|
+
private getContextMenuItems;
|
|
400
416
|
private handleWheel;
|
|
401
417
|
private getTextWysiwygSnappedToCenterPosition;
|
|
402
418
|
private savePointer;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "./Button.scss";
|
|
2
|
+
interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
type?: "button" | "submit" | "reset";
|
|
4
|
+
onSelect: () => any;
|
|
5
|
+
/** whether button is in active state */
|
|
6
|
+
selected?: boolean;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A generic button component that follows Excalidraw's design system.
|
|
12
|
+
* Style can be customised using `className` or `style` prop.
|
|
13
|
+
* Accepts all props that a regular `button` element accepts.
|
|
14
|
+
*/
|
|
15
|
+
export declare const Button: ({ type, onSelect, selected, children, className, ...rest }: ButtonProps) => JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
export declare const ButtonIconSelect: <T extends Object>(
|
|
1
|
+
export declare const ButtonIconSelect: <T extends Object>(props: {
|
|
2
2
|
options: {
|
|
3
3
|
value: T;
|
|
4
4
|
text: string;
|
|
5
5
|
icon: JSX.Element;
|
|
6
6
|
testId?: string | undefined;
|
|
7
|
+
/** if not supplied, defaults to value identity check */
|
|
8
|
+
active?: boolean | undefined;
|
|
7
9
|
}[];
|
|
8
10
|
value: T | null;
|
|
9
|
-
|
|
11
|
+
type?: "button" | "radio" | undefined;
|
|
12
|
+
} & ({
|
|
13
|
+
type?: "radio" | undefined;
|
|
10
14
|
group: string;
|
|
11
|
-
|
|
15
|
+
onChange: (value: T) => void;
|
|
16
|
+
} | {
|
|
17
|
+
type: "button";
|
|
18
|
+
onClick: (value: T, event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
19
|
+
})) => JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColorPickerType } from "./colorPickerUtils";
|
|
2
|
+
interface ColorInputProps {
|
|
3
|
+
color: string;
|
|
4
|
+
onChange: (color: string) => void;
|
|
5
|
+
label: string;
|
|
6
|
+
colorPickerType: ColorPickerType;
|
|
7
|
+
}
|
|
8
|
+
export declare const ColorInput: ({ color, onChange, label, colorPickerType, }: ColorInputProps) => JSX.Element;
|
|
9
|
+
export {};
|