@dwelle/excalidraw 0.4.0-d8d86cf → 0.4.0-da7ef3e
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 +706 -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 +3035 -1464
- 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 +130 -52
- package/types/actions/actionAlign.d.ts +25 -32
- package/types/actions/actionBoundText.d.ts +191 -22
- package/types/actions/actionCanvas.d.ts +774 -174
- package/types/actions/actionClipboard.d.ts +232 -88
- package/types/actions/actionDeleteSelected.d.ts +129 -57
- package/types/actions/actionDistribute.d.ts +7 -12
- package/types/actions/actionDuplicateSelection.d.ts +2 -5
- package/types/actions/actionElementLock.d.ts +283 -0
- package/types/actions/actionExport.d.ts +448 -229
- package/types/actions/actionFinalize.d.ts +87 -41
- package/types/actions/actionFlip.d.ts +4 -7
- package/types/actions/actionFrame.d.ts +441 -0
- package/types/actions/actionGroup.d.ts +260 -15
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +46 -20
- package/types/actions/actionMenu.d.ts +136 -65
- package/types/actions/actionNavigate.d.ts +2 -3
- package/types/actions/actionProperties.d.ts +590 -277
- package/types/actions/actionSelectAll.d.ts +127 -2
- package/types/actions/actionStyles.d.ts +44 -19
- package/types/actions/actionToggleGridMode.d.ts +46 -19
- package/types/actions/{actionToggleLock.d.ts → actionToggleObjectsSnapMode.d.ts} +58 -31
- package/types/actions/actionToggleStats.d.ts +45 -19
- package/types/actions/actionToggleViewMode.d.ts +46 -19
- package/types/actions/actionToggleZenMode.d.ts +46 -19
- package/types/actions/actionZindex.d.ts +8 -16
- 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 +23 -18
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +5 -6
- package/types/clipboard.d.ts +3 -2
- package/types/colors.d.ts +60 -5
- package/types/components/Actions.d.ts +7 -7
- package/types/components/ActiveConfirmDialog.d.ts +4 -0
- package/types/components/App.d.ts +88 -74
- 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/LayerUI.d.ts +10 -16
- 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 +10 -12
- 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 +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 +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 +15 -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 +61 -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 +94 -18
- 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/transform.d.ts +71 -0
- package/types/data/types.d.ts +3 -5
- package/types/data/url.d.ts +7 -0
- package/types/element/Hyperlink.d.ts +57 -30
- package/types/element/binding.d.ts +4 -3
- package/types/element/bounds.d.ts +31 -7
- package/types/element/collision.d.ts +7 -7
- package/types/element/dragElements.d.ts +12 -2
- package/types/element/embeddable.d.ts +159 -0
- package/types/element/image.d.ts +11 -1
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +49 -24
- package/types/element/mutateElement.d.ts +2 -1
- package/types/element/newElement.d.ts +48 -15
- package/types/element/resizeElements.d.ts +3 -2
- 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 +44 -11
- package/types/element/textWysiwyg.d.ts +7 -2
- package/types/element/transformHandles.d.ts +15 -8
- package/types/element/typeChecks.d.ts +13 -2
- package/types/element/types.d.ts +64 -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 +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 +6 -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 +182 -64
- package/types/packages/excalidraw/index.d.ts +19 -3
- 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 +28 -24
- package/types/renderer/renderElement.d.ts +12 -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/Renderer.d.ts +25 -0
- package/types/scene/Scene.d.ts +27 -5
- package/types/scene/Shape.d.ts +12 -0
- package/types/scene/ShapeCache.d.ts +20 -0
- package/types/scene/comparisons.d.ts +1 -1
- package/types/scene/export.d.ts +182 -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 +69 -26
- package/types/snapping.d.ts +108 -0
- package/types/types.d.ts +196 -81
- package/types/utility-types.d.ts +24 -0
- package/types/utils.d.ts +78 -12
- 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,21 +1,20 @@
|
|
|
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
|
-
theme?:
|
|
4
|
+
theme?: import("./element/types").Theme | undefined;
|
|
5
5
|
name?: string | undefined;
|
|
6
|
-
activeTool?: {
|
|
7
|
-
|
|
8
|
-
lastActiveToolBeforeEraser: import("./types").LastActiveToolBeforeEraser;
|
|
6
|
+
activeTool?: ({
|
|
7
|
+
lastActiveTool: import("./types").LastActiveTool;
|
|
9
8
|
locked: boolean;
|
|
9
|
+
} & ({
|
|
10
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
10
11
|
customType: null;
|
|
11
12
|
} | {
|
|
12
13
|
type: "custom";
|
|
13
14
|
customType: string;
|
|
14
|
-
|
|
15
|
-
locked: boolean;
|
|
16
|
-
} | undefined;
|
|
17
|
-
showWelcomeScreen?: boolean | undefined;
|
|
15
|
+
})) | undefined;
|
|
18
16
|
penMode?: boolean | undefined;
|
|
17
|
+
showWelcomeScreen?: boolean | undefined;
|
|
19
18
|
penDetected?: boolean | undefined;
|
|
20
19
|
exportBackground?: boolean | undefined;
|
|
21
20
|
exportEmbedScene?: boolean | undefined;
|
|
@@ -31,27 +30,29 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
31
30
|
currentItemFontFamily?: number | undefined;
|
|
32
31
|
currentItemFontSize?: number | undefined;
|
|
33
32
|
currentItemTextAlign?: string | undefined;
|
|
34
|
-
currentItemStrokeSharpness?: import("./element/types").StrokeSharpness | undefined;
|
|
35
33
|
currentItemStartArrowhead?: import("./element/types").Arrowhead | null | undefined;
|
|
36
34
|
currentItemEndArrowhead?: import("./element/types").Arrowhead | null | undefined;
|
|
37
|
-
|
|
35
|
+
currentItemRoundness?: import("./element/types").StrokeRoundness | undefined;
|
|
38
36
|
viewBackgroundColor?: string | undefined;
|
|
39
37
|
scrollX?: number | undefined;
|
|
40
38
|
scrollY?: number | undefined;
|
|
41
39
|
cursorButton?: "up" | "down" | undefined;
|
|
42
40
|
scrolledOutside?: boolean | undefined;
|
|
43
41
|
zoom?: Readonly<{
|
|
44
|
-
value: NormalizedZoomValue;
|
|
42
|
+
value: import("./types").NormalizedZoomValue;
|
|
45
43
|
}> | undefined;
|
|
46
44
|
openMenu?: "canvas" | "shape" | null | undefined;
|
|
47
|
-
openSidebar?:
|
|
48
|
-
|
|
45
|
+
openSidebar?: {
|
|
46
|
+
name: string;
|
|
47
|
+
tab?: string | undefined;
|
|
48
|
+
} | null | undefined;
|
|
49
|
+
defaultSidebarDockedPreference?: boolean | undefined;
|
|
49
50
|
lastPointerDownWith?: import("./element/types").PointerType | undefined;
|
|
50
|
-
selectedElementIds?: {
|
|
51
|
-
[id: string]:
|
|
52
|
-
} | undefined;
|
|
51
|
+
selectedElementIds?: Readonly<{
|
|
52
|
+
[id: string]: true;
|
|
53
|
+
}> | undefined;
|
|
53
54
|
previousSelectedElementIds?: {
|
|
54
|
-
[id: string]:
|
|
55
|
+
[id: string]: true;
|
|
55
56
|
} | undefined;
|
|
56
57
|
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
57
58
|
zenModeEnabled?: boolean | undefined;
|
|
@@ -63,6 +64,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
63
64
|
showStats?: boolean | undefined;
|
|
64
65
|
currentChartType?: import("./element/types").ChartType | undefined;
|
|
65
66
|
selectedLinearElement?: import("./element/linearElementEditor").LinearElementEditor | null | undefined;
|
|
67
|
+
objectsSnapModeEnabled?: boolean | undefined;
|
|
66
68
|
};
|
|
67
69
|
export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
|
|
68
70
|
viewBackgroundColor?: string | undefined;
|
|
@@ -75,3 +77,6 @@ export declare const clearAppStateForDatabase: (appState: Partial<AppState>) =>
|
|
|
75
77
|
export declare const isEraserActive: ({ activeTool, }: {
|
|
76
78
|
activeTool: AppState["activeTool"];
|
|
77
79
|
}) => boolean;
|
|
80
|
+
export declare const isHandToolActive: ({ activeTool, }: {
|
|
81
|
+
activeTool: AppState["activeTool"];
|
|
82
|
+
}) => 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,5 +1,5 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
-
import {
|
|
2
|
+
import { BinaryFiles } from "./types";
|
|
3
3
|
import { Spreadsheet } from "./charts";
|
|
4
4
|
export interface ClipboardData {
|
|
5
5
|
spreadsheet?: Spreadsheet;
|
|
@@ -7,11 +7,12 @@ export interface ClipboardData {
|
|
|
7
7
|
files?: BinaryFiles;
|
|
8
8
|
text?: string;
|
|
9
9
|
errorMessage?: string;
|
|
10
|
+
programmaticAPI?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare const probablySupportsClipboardReadText: boolean;
|
|
12
13
|
export declare const probablySupportsClipboardWriteText: boolean;
|
|
13
14
|
export declare const probablySupportsClipboardBlob: boolean;
|
|
14
|
-
export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[],
|
|
15
|
+
export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null) => Promise<string | undefined>;
|
|
15
16
|
/**
|
|
16
17
|
* Retrieves content from system clipboard (either from ClipboardEvent or
|
|
17
18
|
* via async clipboard API if supported)
|
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,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ActionManager } from "../actions/manager";
|
|
3
3
|
import { ExcalidrawElement, PointerType } from "../element/types";
|
|
4
|
-
import {
|
|
4
|
+
import { UIAppState, Zoom } from "../types";
|
|
5
5
|
import "./Actions.scss";
|
|
6
6
|
export declare const SelectedShapeActions: ({ appState, elements, renderAction, }: {
|
|
7
|
-
appState:
|
|
7
|
+
appState: UIAppState;
|
|
8
8
|
elements: readonly ExcalidrawElement[];
|
|
9
9
|
renderAction: ActionManager["renderAction"];
|
|
10
10
|
}) => JSX.Element;
|
|
11
|
-
export declare const ShapesSwitcher: ({
|
|
12
|
-
|
|
13
|
-
activeTool:
|
|
14
|
-
setAppState: React.Component<any,
|
|
11
|
+
export declare const ShapesSwitcher: ({ interactiveCanvas, activeTool, setAppState, onImageAction, appState, }: {
|
|
12
|
+
interactiveCanvas: HTMLCanvasElement | null;
|
|
13
|
+
activeTool: UIAppState["activeTool"];
|
|
14
|
+
setAppState: React.Component<any, UIAppState>["setState"];
|
|
15
15
|
onImageAction: (data: {
|
|
16
16
|
pointerType: PointerType | null;
|
|
17
17
|
}) => void;
|
|
18
|
-
appState:
|
|
18
|
+
appState: UIAppState;
|
|
19
19
|
}) => JSX.Element;
|
|
20
20
|
export declare const ZoomActions: ({ renderAction, zoom, }: {
|
|
21
21
|
renderAction: ActionManager["renderAction"];
|
|
@@ -1,64 +1,27 @@
|
|
|
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 } from "../types";
|
|
9
10
|
import { FileSystemHandle } from "../data/filesystem";
|
|
11
|
+
import { Renderer } from "../scene/Renderer";
|
|
10
12
|
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
|
-
};
|
|
13
|
+
export declare const ExcalidrawContainerContext: React.Context<{
|
|
14
|
+
container: HTMLDivElement | null;
|
|
15
|
+
id?: string | null | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const useApp: () => AppClassProperties;
|
|
18
|
+
export declare const useAppProps: () => AppProps;
|
|
57
19
|
export declare const useDevice: () => Readonly<{
|
|
58
20
|
isSmScreen: boolean;
|
|
59
21
|
isMobile: boolean;
|
|
60
22
|
isTouchScreen: boolean;
|
|
61
23
|
canDeviceFitSidebar: boolean;
|
|
24
|
+
isLandscape: boolean;
|
|
62
25
|
}>;
|
|
63
26
|
export declare const useExcalidrawContainer: () => {
|
|
64
27
|
container: HTMLDivElement | null;
|
|
@@ -67,9 +30,11 @@ export declare const useExcalidrawContainer: () => {
|
|
|
67
30
|
export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawElement[];
|
|
68
31
|
export declare const useExcalidrawAppState: () => AppState;
|
|
69
32
|
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;
|
|
33
|
+
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
70
34
|
declare class App extends React.Component<AppProps, AppState> {
|
|
71
35
|
canvas: AppClassProperties["canvas"];
|
|
72
|
-
|
|
36
|
+
interactiveCanvas: AppClassProperties["interactiveCanvas"];
|
|
37
|
+
rc: RoughCanvas;
|
|
73
38
|
unmounted: boolean;
|
|
74
39
|
actionManager: ActionManager;
|
|
75
40
|
device: Device;
|
|
@@ -77,36 +42,36 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
77
42
|
private excalidrawContainerRef;
|
|
78
43
|
static defaultProps: Partial<AppProps>;
|
|
79
44
|
scene: Scene;
|
|
45
|
+
renderer: Renderer;
|
|
80
46
|
private fonts;
|
|
81
47
|
private resizeObserver;
|
|
82
48
|
private nearestScrollableContainer;
|
|
83
49
|
library: AppClassProperties["library"];
|
|
84
50
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
85
|
-
|
|
51
|
+
id: string;
|
|
86
52
|
private history;
|
|
87
53
|
private excalidrawContainerValue;
|
|
88
54
|
files: BinaryFiles;
|
|
89
55
|
imageCache: AppClassProperties["imageCache"];
|
|
56
|
+
private iFrameRefs;
|
|
90
57
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
91
|
-
lastPointerDown: React.PointerEvent<
|
|
58
|
+
lastPointerDown: React.PointerEvent<HTMLElement> | null;
|
|
92
59
|
lastPointerUp: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
93
|
-
|
|
94
|
-
lastScenePointer: {
|
|
60
|
+
lastViewportPosition: {
|
|
95
61
|
x: number;
|
|
96
62
|
y: number;
|
|
97
|
-
}
|
|
63
|
+
};
|
|
98
64
|
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
|
|
99
65
|
onPointerDownEmitter: Emitter<[activeTool: {
|
|
100
|
-
|
|
101
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
66
|
+
lastActiveTool: import("../types").LastActiveTool;
|
|
102
67
|
locked: boolean;
|
|
68
|
+
} & ({
|
|
69
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
103
70
|
customType: null;
|
|
104
71
|
} | {
|
|
105
72
|
type: "custom";
|
|
106
73
|
customType: string;
|
|
107
|
-
|
|
108
|
-
locked: boolean;
|
|
109
|
-
}, pointerDownState: Readonly<{
|
|
74
|
+
}), pointerDownState: Readonly<{
|
|
110
75
|
origin: Readonly<{
|
|
111
76
|
x: number;
|
|
112
77
|
y: number;
|
|
@@ -172,18 +137,17 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
172
137
|
erase: boolean;
|
|
173
138
|
};
|
|
174
139
|
};
|
|
175
|
-
}>, event: React.PointerEvent<
|
|
140
|
+
}>, event: React.PointerEvent<HTMLElement>]>;
|
|
176
141
|
onPointerUpEmitter: Emitter<[activeTool: {
|
|
177
|
-
|
|
178
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
142
|
+
lastActiveTool: import("../types").LastActiveTool;
|
|
179
143
|
locked: boolean;
|
|
144
|
+
} & ({
|
|
145
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
180
146
|
customType: null;
|
|
181
147
|
} | {
|
|
182
148
|
type: "custom";
|
|
183
149
|
customType: string;
|
|
184
|
-
|
|
185
|
-
locked: boolean;
|
|
186
|
-
}, pointerDownState: Readonly<{
|
|
150
|
+
}), pointerDownState: Readonly<{
|
|
187
151
|
origin: Readonly<{
|
|
188
152
|
x: number;
|
|
189
153
|
y: number;
|
|
@@ -251,11 +215,23 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
251
215
|
};
|
|
252
216
|
}>, event: PointerEvent]>;
|
|
253
217
|
constructor(props: AppProps);
|
|
254
|
-
private
|
|
218
|
+
private onWindowMessage;
|
|
219
|
+
private updateEmbeddableRef;
|
|
220
|
+
private getHTMLIFrameElement;
|
|
221
|
+
private handleEmbeddableCenterClick;
|
|
222
|
+
private isEmbeddableCenter;
|
|
223
|
+
private updateEmbeddables;
|
|
224
|
+
private renderEmbeddables;
|
|
225
|
+
private getFrameNameDOMId;
|
|
226
|
+
frameNameBoundsCache: FrameNameBoundsCache;
|
|
227
|
+
private renderFrameNames;
|
|
255
228
|
render(): JSX.Element;
|
|
256
229
|
focusContainer: AppClassProperties["focusContainer"];
|
|
257
230
|
getSceneElementsIncludingDeleted: () => readonly ExcalidrawElement[];
|
|
258
231
|
getSceneElements: () => readonly NonDeletedExcalidrawElement[];
|
|
232
|
+
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
233
|
+
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: readonly NonDeletedExcalidrawElement[]) => Promise<void>;
|
|
234
|
+
private openEyeDropper;
|
|
259
235
|
private syncActionResult;
|
|
260
236
|
private onBlur;
|
|
261
237
|
private onUnload;
|
|
@@ -275,23 +251,52 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
275
251
|
private onFontsLoadingDone;
|
|
276
252
|
private addEventListeners;
|
|
277
253
|
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
|
|
278
|
-
private
|
|
254
|
+
private renderInteractiveSceneCallback;
|
|
279
255
|
private onScroll;
|
|
280
256
|
private onCut;
|
|
281
257
|
private onCopy;
|
|
282
258
|
private cutAll;
|
|
283
259
|
private copyAll;
|
|
284
260
|
private static resetTapTwice;
|
|
285
|
-
private
|
|
286
|
-
private
|
|
287
|
-
|
|
261
|
+
private onTouchStart;
|
|
262
|
+
private onTouchEnd;
|
|
263
|
+
pasteFromClipboard: (event: ClipboardEvent | null) => Promise<void>;
|
|
288
264
|
private addElementsFromPasteOrLibrary;
|
|
289
265
|
private addTextFromPaste;
|
|
290
266
|
setAppState: React.Component<any, AppState>["setState"];
|
|
291
267
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
292
268
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
269
|
+
updateFrameRendering: (opts: Partial<{
|
|
270
|
+
enabled: boolean;
|
|
271
|
+
name: boolean;
|
|
272
|
+
outline: boolean;
|
|
273
|
+
clip: boolean;
|
|
274
|
+
}> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
293
275
|
togglePenMode: () => void;
|
|
294
|
-
|
|
276
|
+
onHandToolToggle: () => void;
|
|
277
|
+
/**
|
|
278
|
+
* Zooms on canvas viewport center
|
|
279
|
+
*/
|
|
280
|
+
zoomCanvas: (value: number) => void;
|
|
281
|
+
private cancelInProgresAnimation;
|
|
282
|
+
scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[], opts?: {
|
|
283
|
+
fitToContent?: boolean;
|
|
284
|
+
fitToViewport?: never;
|
|
285
|
+
viewportZoomFactor?: never;
|
|
286
|
+
animate?: boolean;
|
|
287
|
+
duration?: number;
|
|
288
|
+
} | {
|
|
289
|
+
fitToContent?: never;
|
|
290
|
+
fitToViewport?: boolean;
|
|
291
|
+
/** when fitToViewport=true, how much screen should the content cover,
|
|
292
|
+
* between 0.1 (10%) and 1 (100%)
|
|
293
|
+
*/
|
|
294
|
+
viewportZoomFactor?: number;
|
|
295
|
+
animate?: boolean;
|
|
296
|
+
duration?: number;
|
|
297
|
+
}) => void;
|
|
298
|
+
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
299
|
+
private translateCanvas;
|
|
295
300
|
setToast: (toast: {
|
|
296
301
|
message: string;
|
|
297
302
|
closable?: boolean;
|
|
@@ -310,7 +315,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
310
315
|
/**
|
|
311
316
|
* @returns whether the menu was toggled on or off
|
|
312
317
|
*/
|
|
313
|
-
|
|
318
|
+
toggleSidebar: ({ name, tab, force, }: {
|
|
319
|
+
name: SidebarName;
|
|
320
|
+
tab?: string | undefined;
|
|
321
|
+
force?: boolean | undefined;
|
|
322
|
+
}) => boolean;
|
|
314
323
|
private updateCurrentCursorPosition;
|
|
315
324
|
private onKeyDown;
|
|
316
325
|
private onWheel;
|
|
@@ -337,6 +346,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
337
346
|
private handleCanvasDoubleClick;
|
|
338
347
|
private getElementLinkAtPosition;
|
|
339
348
|
private redirectToLink;
|
|
349
|
+
private getTopLayerFrameAtSceneCoords;
|
|
340
350
|
private handleCanvasPointerMove;
|
|
341
351
|
private handleEraser;
|
|
342
352
|
private handleTouchMove;
|
|
@@ -359,9 +369,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
359
369
|
private isHittingCommonBoundingBoxOfSelectedElements;
|
|
360
370
|
private handleTextOnPointerDown;
|
|
361
371
|
private handleFreeDrawElementOnPointerDown;
|
|
372
|
+
private insertEmbeddableElement;
|
|
362
373
|
private createImageElement;
|
|
363
374
|
private handleLinearElementOnPointerDown;
|
|
375
|
+
private getCurrentItemRoundness;
|
|
364
376
|
private createGenericElementOnPointerDown;
|
|
377
|
+
private createFrameElementOnPointerDown;
|
|
378
|
+
private maybeCacheReferenceSnapPoints;
|
|
379
|
+
private maybeCacheVisibleGaps;
|
|
365
380
|
private onKeyDownFromPointerDownHandler;
|
|
366
381
|
private onKeyUpFromPointerDownHandler;
|
|
367
382
|
private onPointerMoveFromPointerDownHandler;
|
|
@@ -390,14 +405,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
390
405
|
private maybeSuggestBindingsForLinearElementAtCoords;
|
|
391
406
|
private maybeSuggestBindingForAll;
|
|
392
407
|
private clearSelection;
|
|
393
|
-
private
|
|
408
|
+
private handleInteractiveCanvasRef;
|
|
394
409
|
private handleAppOnDrop;
|
|
395
410
|
loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
|
|
396
411
|
private handleCanvasContextMenu;
|
|
397
412
|
private maybeDragNewGenericElement;
|
|
398
413
|
private maybeHandleResize;
|
|
399
|
-
|
|
400
|
-
private _openContextMenu;
|
|
414
|
+
private getContextMenuItems;
|
|
401
415
|
private handleWheel;
|
|
402
416
|
private getTextWysiwygSnappedToCenterPosition;
|
|
403
417
|
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 {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ExcalidrawElement } from "../../element/types";
|
|
2
|
+
import { AppState } from "../../types";
|
|
3
|
+
import { ColorPickerType } from "./colorPickerUtils";
|
|
4
|
+
import { ColorTuple, ColorPaletteCustom } from "../../colors";
|
|
5
|
+
import "./ColorPicker.scss";
|
|
6
|
+
export declare const getColor: (color: string) => string | null;
|
|
7
|
+
interface ColorPickerProps {
|
|
8
|
+
type: ColorPickerType;
|
|
9
|
+
color: string;
|
|
10
|
+
onChange: (color: string) => void;
|
|
11
|
+
label: string;
|
|
12
|
+
elements: readonly ExcalidrawElement[];
|
|
13
|
+
appState: AppState;
|
|
14
|
+
palette?: ColorPaletteCustom | null;
|
|
15
|
+
topPicks?: ColorTuple;
|
|
16
|
+
updateData: (formData?: any) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const ColorPicker: ({ type, color, onChange, label, elements, palette, topPicks, updateData, appState, }: ColorPickerProps) => JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface HotkeyLabelProps {
|
|
2
|
+
color: string;
|
|
3
|
+
keyLabel: string | number;
|
|
4
|
+
isCustomColor?: boolean;
|
|
5
|
+
isShade?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const HotkeyLabel: ({ color, keyLabel, isCustomColor, isShade, }: HotkeyLabelProps) => JSX.Element;
|
|
8
|
+
export default HotkeyLabel;
|