@dwelle/excalidraw 0.4.0-e80989b → 0.4.0-eadd4b9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +458 -0
- package/README.md +16 -1424
- package/dist/excalidraw.development.js +1829 -500
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +20 -0
- package/package.json +3 -3
- package/types/actions/actionAddToLibrary.d.ts +68 -34
- package/types/actions/actionAlign.d.ts +12 -18
- package/types/actions/actionBoundText.d.ts +158 -19
- package/types/actions/actionCanvas.d.ts +430 -118
- package/types/actions/actionClipboard.d.ts +132 -59
- package/types/actions/actionDeleteSelected.d.ts +72 -41
- package/types/actions/actionDistribute.d.ts +2 -6
- package/types/actions/actionDuplicateSelection.d.ts +2 -4
- package/types/actions/actionElementLock.d.ts +254 -0
- package/types/actions/actionExport.d.ts +215 -131
- package/types/actions/actionFinalize.d.ts +47 -27
- package/types/actions/actionFlip.d.ts +2 -4
- package/types/actions/actionFrame.d.ts +397 -0
- package/types/actions/actionGroup.d.ts +6 -10
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +25 -13
- package/types/actions/actionMenu.d.ts +73 -46
- package/types/actions/actionNavigate.d.ts +2 -3
- package/types/actions/actionProperties.d.ts +315 -198
- package/types/actions/actionStyles.d.ts +23 -12
- package/types/actions/actionToggleGridMode.d.ts +25 -12
- package/types/actions/actionToggleStats.d.ts +24 -12
- package/types/actions/actionToggleViewMode.d.ts +25 -12
- package/types/actions/actionToggleZenMode.d.ts +25 -12
- package/types/actions/actionZindex.d.ts +8 -16
- package/types/actions/index.d.ts +1 -1
- package/types/actions/manager.d.ts +3 -2
- package/types/actions/shortcuts.d.ts +2 -1
- package/types/actions/types.d.ts +13 -11
- package/types/appState.d.ts +16 -12
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +5 -6
- package/types/clipboard.d.ts +2 -2
- package/types/colors.d.ts +60 -5
- package/types/components/Actions.d.ts +5 -5
- package/types/components/ActiveConfirmDialog.d.ts +4 -0
- package/types/components/App.d.ts +52 -68
- package/types/components/Avatar.d.ts +1 -2
- package/types/components/BraveMeasureTextError.d.ts +2 -0
- package/types/components/Button.d.ts +17 -0
- package/types/components/ButtonIconSelect.d.ts +11 -3
- package/types/components/Card.d.ts +7 -0
- package/types/components/ColorPicker/ColorInput.d.ts +7 -0
- package/types/components/ColorPicker/ColorPicker.d.ts +19 -0
- package/types/components/ColorPicker/CustomColorList.d.ts +8 -0
- package/types/components/ColorPicker/HotkeyLabel.d.ts +8 -0
- package/types/components/ColorPicker/Picker.d.ts +18 -0
- package/types/components/ColorPicker/PickerColorList.d.ts +10 -0
- package/types/components/ColorPicker/PickerHeading.d.ts +5 -0
- package/types/components/ColorPicker/ShadeList.d.ts +8 -0
- package/types/components/ColorPicker/TopPicks.d.ts +9 -0
- package/types/components/ColorPicker/colorPickerUtils.d.ts +21 -0
- package/types/components/ColorPicker/keyboardNavHandlers.d.ts +21 -0
- package/types/components/ContextMenu.d.ts +9 -22
- package/types/components/DefaultSidebar.d.ts +30 -0
- package/types/components/Dialog.d.ts +2 -4
- package/types/components/ErrorDialog.d.ts +3 -2
- package/types/components/EyeDropper.d.ts +18 -0
- package/types/components/FilledButton.d.ts +16 -0
- package/types/components/FixedSideContainer.d.ts +1 -1
- package/types/components/HandButton.d.ts +10 -0
- package/types/components/HelpButton.d.ts +1 -2
- package/types/components/HintViewer.d.ts +2 -2
- package/types/components/HomeButton.d.ts +1 -1
- package/types/components/ImageExportDialog.d.ts +8 -13
- package/types/components/Island.d.ts +1 -1
- package/types/components/JSONExportDialog.d.ts +6 -4
- package/types/components/LayerUI.d.ts +7 -15
- package/types/components/LibraryMenu.d.ts +13 -14
- package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
- package/types/components/LibraryMenuControlButtons.d.ts +9 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +11 -5
- package/types/components/LibraryMenuItems.d.ts +6 -7
- package/types/components/LibraryMenuSection.d.ts +22 -0
- package/types/components/LibraryUnit.d.ts +7 -3
- package/types/components/LockButton.d.ts +1 -2
- package/types/components/MobileMenu.d.ts +8 -11
- package/types/components/PasteChartDialog.d.ts +4 -5
- package/types/components/PenModeButton.d.ts +1 -1
- package/types/components/Popover.d.ts +1 -1
- package/types/components/ProjectName.d.ts +2 -1
- package/types/components/PublishLibrary.d.ts +2 -2
- package/types/components/RadioGroup.d.ts +12 -0
- package/types/components/Sidebar/Sidebar.d.ts +66 -63
- package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
- package/types/components/Sidebar/SidebarTab.d.ts +9 -0
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +10 -0
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +7 -0
- package/types/components/Sidebar/SidebarTabs.d.ts +7 -0
- package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
- package/types/components/Sidebar/common.d.ts +24 -7
- package/types/components/Spinner.d.ts +2 -1
- package/types/components/Stack.d.ts +4 -3
- package/types/components/Stats.d.ts +3 -3
- package/types/components/Switch.d.ts +9 -0
- package/types/components/ToolButton.d.ts +6 -5
- package/types/components/Tooltip.d.ts +1 -1
- package/types/components/Trans.d.ts +8 -0
- package/types/components/UserList.d.ts +0 -2
- package/types/components/dropdownMenu/DropdownMenu.d.ts +67 -0
- package/types/components/dropdownMenu/DropdownMenuContent.d.ts +15 -0
- package/types/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
- package/types/components/dropdownMenu/DropdownMenuItem.d.ts +12 -0
- package/types/components/dropdownMenu/DropdownMenuItemContent.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +13 -0
- package/types/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +11 -0
- package/types/components/dropdownMenu/common.d.ts +6 -0
- package/types/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -0
- package/types/components/footer/Footer.d.ts +12 -0
- package/types/components/footer/FooterCenter.d.ts +8 -0
- package/types/components/hoc/withInternalFallback.d.ts +4 -0
- package/types/components/icons.d.ts +13 -2
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +10 -0
- package/types/components/main-menu/DefaultItems.d.ts +47 -0
- package/types/components/main-menu/MainMenu.d.ts +61 -0
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +58 -0
- package/types/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
- package/types/components/welcome-screen/WelcomeScreen.d.ts +85 -0
- package/types/constants.d.ts +73 -16
- package/types/context/tunnels.d.ts +18 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/data/blob.d.ts +3 -2
- package/types/data/encode.d.ts +1 -1
- package/types/data/filesystem.d.ts +2 -1
- package/types/data/index.d.ts +1 -1
- package/types/data/library.d.ts +3 -45
- package/types/data/restore.d.ts +10 -4
- package/types/data/types.d.ts +3 -5
- package/types/element/Hyperlink.d.ts +27 -18
- package/types/element/binding.d.ts +3 -3
- package/types/element/bounds.d.ts +32 -7
- package/types/element/collision.d.ts +7 -7
- package/types/element/dragElements.d.ts +2 -1
- package/types/element/image.d.ts +11 -1
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +24 -13
- package/types/element/mutateElement.d.ts +2 -1
- package/types/element/newElement.d.ts +37 -11
- package/types/element/resizeElements.d.ts +1 -0
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/sortElements.d.ts +2 -0
- package/types/element/textElement.d.ts +40 -5
- package/types/element/textWysiwyg.d.ts +6 -1
- package/types/element/transformHandles.d.ts +12 -5
- package/types/element/typeChecks.d.ts +12 -2
- package/types/element/types.d.ts +53 -36
- package/types/emitter.d.ts +1 -1
- package/types/errors.d.ts +1 -1
- package/types/frame.d.ts +40 -0
- package/types/ga.d.ts +5 -5
- package/types/groups.d.ts +4 -0
- package/types/hooks/useCreatePortalContainer.d.ts +4 -0
- package/types/hooks/useLibraryItemSvg.d.ts +11 -0
- package/types/hooks/useOutsideClick.d.ts +19 -1
- package/types/hooks/useScrollPosition.d.ts +2 -0
- package/types/hooks/useTransition.d.ts +2 -0
- package/types/i18n.d.ts +7 -1
- package/types/jotai.d.ts +20 -108
- package/types/keys.d.ts +4 -4
- package/types/math.d.ts +4 -1
- package/types/packages/excalidraw/example/App.d.ts +7 -1
- package/types/packages/excalidraw/example/CustomFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/MobileFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/initialData.d.ts +6 -0
- package/types/packages/excalidraw/index.d.ts +17 -3
- package/types/packages/utils.d.ts +26 -25
- package/types/renderer/renderElement.d.ts +7 -5
- package/types/renderer/renderScene.d.ts +13 -6
- package/types/renderer/roundRect.d.ts +1 -1
- package/types/scene/Scene.d.ts +12 -5
- package/types/scene/comparisons.d.ts +1 -1
- package/types/scene/export.d.ts +157 -10
- package/types/scene/index.d.ts +1 -1
- package/types/scene/selection.d.ts +15 -5
- package/types/scene/types.d.ts +13 -5
- package/types/types.d.ts +126 -77
- package/types/utility-types.d.ts +22 -0
- package/types/utils.d.ts +40 -9
- package/types/zindex.d.ts +4 -4
- package/types/actions/actionToggleLock.d.ts +0 -116
- package/types/components/ActiveFile.d.ts +0 -7
- package/types/components/ClearCanvas.d.ts +0 -4
- package/types/components/CollabButton.d.ts +0 -6
- package/types/components/ColorPicker.d.ts +0 -14
- package/types/components/Footer.d.ts +0 -10
- package/types/components/LibraryButton.d.ts +0 -8
- package/types/components/MenuItem.d.ts +0 -11
- package/types/components/MenuUtils.d.ts +0 -1
- package/types/components/SingleLibraryItem.d.ts +0 -10
- package/types/components/WelcomeScreen.d.ts +0 -10
- package/types/components/WelcomeScreenDecor.d.ts +0 -6
- package/types/components/hoc/withUpstreamOverride.d.ts +0 -10
package/types/appState.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
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
4
|
theme?: string | 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" | "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;
|
|
15
|
+
})) | undefined;
|
|
17
16
|
showWelcomeScreen?: boolean | undefined;
|
|
18
17
|
penMode?: boolean | undefined;
|
|
19
18
|
penDetected?: boolean | undefined;
|
|
@@ -31,21 +30,23 @@ 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
51
|
selectedElementIds?: {
|
|
51
52
|
[id: string]: boolean;
|
|
@@ -75,3 +76,6 @@ export declare const clearAppStateForDatabase: (appState: Partial<AppState>) =>
|
|
|
75
76
|
export declare const isEraserActive: ({ activeTool, }: {
|
|
76
77
|
activeTool: AppState["activeTool"];
|
|
77
78
|
}) => boolean;
|
|
79
|
+
export declare const isHandToolActive: ({ activeTool, }: {
|
|
80
|
+
activeTool: AppState["activeTool"];
|
|
81
|
+
}) => 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;
|
|
@@ -11,7 +11,7 @@ export interface ClipboardData {
|
|
|
11
11
|
export declare const probablySupportsClipboardReadText: boolean;
|
|
12
12
|
export declare const probablySupportsClipboardWriteText: boolean;
|
|
13
13
|
export declare const probablySupportsClipboardBlob: boolean;
|
|
14
|
-
export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[],
|
|
14
|
+
export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null) => Promise<string | undefined>;
|
|
15
15
|
/**
|
|
16
16
|
* Retrieves content from system clipboard (either from ClipboardEvent or
|
|
17
17
|
* 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: string;
|
|
7
|
+
white: string;
|
|
8
|
+
transparent: string;
|
|
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: string;
|
|
38
|
+
readonly white: string;
|
|
39
|
+
readonly gray: ColorTuple;
|
|
40
|
+
readonly black: string;
|
|
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: string;
|
|
55
|
+
readonly white: string;
|
|
56
|
+
readonly gray: ColorTuple;
|
|
57
|
+
readonly black: string;
|
|
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
11
|
export declare const ShapesSwitcher: ({ canvas, activeTool, setAppState, onImageAction, appState, }: {
|
|
12
12
|
canvas: HTMLCanvasElement | null;
|
|
13
|
-
activeTool:
|
|
14
|
-
setAppState: React.Component<any,
|
|
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,26 @@
|
|
|
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";
|
|
10
11
|
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
|
-
};
|
|
12
|
+
export declare const ExcalidrawContainerContext: React.Context<{
|
|
13
|
+
container: HTMLDivElement | null;
|
|
14
|
+
id?: string | null | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const useApp: () => AppClassProperties;
|
|
17
|
+
export declare const useAppProps: () => AppProps;
|
|
57
18
|
export declare const useDevice: () => Readonly<{
|
|
58
19
|
isSmScreen: boolean;
|
|
59
20
|
isMobile: boolean;
|
|
60
21
|
isTouchScreen: boolean;
|
|
61
22
|
canDeviceFitSidebar: boolean;
|
|
23
|
+
isLandscape: boolean;
|
|
62
24
|
}>;
|
|
63
25
|
export declare const useExcalidrawContainer: () => {
|
|
64
26
|
container: HTMLDivElement | null;
|
|
@@ -67,6 +29,7 @@ export declare const useExcalidrawContainer: () => {
|
|
|
67
29
|
export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawElement[];
|
|
68
30
|
export declare const useExcalidrawAppState: () => AppState;
|
|
69
31
|
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;
|
|
32
|
+
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
70
33
|
declare class App extends React.Component<AppProps, AppState> {
|
|
71
34
|
canvas: AppClassProperties["canvas"];
|
|
72
35
|
rc: RoughCanvas | null;
|
|
@@ -82,31 +45,29 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
82
45
|
private nearestScrollableContainer;
|
|
83
46
|
library: AppClassProperties["library"];
|
|
84
47
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
85
|
-
|
|
48
|
+
id: string;
|
|
86
49
|
private history;
|
|
87
50
|
private excalidrawContainerValue;
|
|
88
51
|
files: BinaryFiles;
|
|
89
52
|
imageCache: AppClassProperties["imageCache"];
|
|
90
53
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
91
|
-
lastPointerDown: React.PointerEvent<
|
|
54
|
+
lastPointerDown: React.PointerEvent<HTMLElement> | null;
|
|
92
55
|
lastPointerUp: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
93
|
-
|
|
94
|
-
lastScenePointer: {
|
|
56
|
+
lastViewportPosition: {
|
|
95
57
|
x: number;
|
|
96
58
|
y: number;
|
|
97
|
-
}
|
|
59
|
+
};
|
|
98
60
|
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
|
|
99
61
|
onPointerDownEmitter: Emitter<[activeTool: {
|
|
100
|
-
|
|
101
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
62
|
+
lastActiveTool: import("../types").LastActiveTool;
|
|
102
63
|
locked: boolean;
|
|
64
|
+
} & ({
|
|
65
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
103
66
|
customType: null;
|
|
104
67
|
} | {
|
|
105
68
|
type: "custom";
|
|
106
69
|
customType: string;
|
|
107
|
-
|
|
108
|
-
locked: boolean;
|
|
109
|
-
}, pointerDownState: Readonly<{
|
|
70
|
+
}), pointerDownState: Readonly<{
|
|
110
71
|
origin: Readonly<{
|
|
111
72
|
x: number;
|
|
112
73
|
y: number;
|
|
@@ -172,18 +133,17 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
172
133
|
erase: boolean;
|
|
173
134
|
};
|
|
174
135
|
};
|
|
175
|
-
}>, event: React.PointerEvent<
|
|
136
|
+
}>, event: React.PointerEvent<HTMLElement>]>;
|
|
176
137
|
onPointerUpEmitter: Emitter<[activeTool: {
|
|
177
|
-
|
|
178
|
-
lastActiveToolBeforeEraser: import("../types").LastActiveToolBeforeEraser;
|
|
138
|
+
lastActiveTool: import("../types").LastActiveTool;
|
|
179
139
|
locked: boolean;
|
|
140
|
+
} & ({
|
|
141
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
180
142
|
customType: null;
|
|
181
143
|
} | {
|
|
182
144
|
type: "custom";
|
|
183
145
|
customType: string;
|
|
184
|
-
|
|
185
|
-
locked: boolean;
|
|
186
|
-
}, pointerDownState: Readonly<{
|
|
146
|
+
}), pointerDownState: Readonly<{
|
|
187
147
|
origin: Readonly<{
|
|
188
148
|
x: number;
|
|
189
149
|
y: number;
|
|
@@ -252,10 +212,16 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
252
212
|
}>, event: PointerEvent]>;
|
|
253
213
|
constructor(props: AppProps);
|
|
254
214
|
private renderCanvas;
|
|
215
|
+
private getFrameNameDOMId;
|
|
216
|
+
frameNameBoundsCache: FrameNameBoundsCache;
|
|
217
|
+
private renderFrameNames;
|
|
255
218
|
render(): JSX.Element;
|
|
256
219
|
focusContainer: AppClassProperties["focusContainer"];
|
|
257
220
|
getSceneElementsIncludingDeleted: () => readonly ExcalidrawElement[];
|
|
258
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;
|
|
259
225
|
private syncActionResult;
|
|
260
226
|
private onBlur;
|
|
261
227
|
private onUnload;
|
|
@@ -284,14 +250,27 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
284
250
|
private static resetTapTwice;
|
|
285
251
|
private onTapStart;
|
|
286
252
|
private onTapEnd;
|
|
287
|
-
|
|
253
|
+
pasteFromClipboard: (event: ClipboardEvent | null) => Promise<void>;
|
|
288
254
|
private addElementsFromPasteOrLibrary;
|
|
289
255
|
private addTextFromPaste;
|
|
290
256
|
setAppState: React.Component<any, AppState>["setState"];
|
|
291
257
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
292
258
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
259
|
+
toggleFrameRendering: () => void;
|
|
293
260
|
togglePenMode: () => void;
|
|
294
|
-
|
|
261
|
+
onHandToolToggle: () => void;
|
|
262
|
+
/**
|
|
263
|
+
* Zooms on canvas viewport center
|
|
264
|
+
*/
|
|
265
|
+
zoomCanvas: (value: number) => void;
|
|
266
|
+
private cancelInProgresAnimation;
|
|
267
|
+
scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[], opts?: {
|
|
268
|
+
fitToContent?: boolean;
|
|
269
|
+
animate?: boolean;
|
|
270
|
+
duration?: number;
|
|
271
|
+
}) => void;
|
|
272
|
+
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
273
|
+
private translateCanvas;
|
|
295
274
|
setToast: (toast: {
|
|
296
275
|
message: string;
|
|
297
276
|
closable?: boolean;
|
|
@@ -310,7 +289,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
310
289
|
/**
|
|
311
290
|
* @returns whether the menu was toggled on or off
|
|
312
291
|
*/
|
|
313
|
-
|
|
292
|
+
toggleSidebar: ({ name, tab, force, }: {
|
|
293
|
+
name: SidebarName;
|
|
294
|
+
tab?: string | undefined;
|
|
295
|
+
force?: boolean | undefined;
|
|
296
|
+
}) => boolean;
|
|
314
297
|
private updateCurrentCursorPosition;
|
|
315
298
|
private onKeyDown;
|
|
316
299
|
private onWheel;
|
|
@@ -337,6 +320,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
337
320
|
private handleCanvasDoubleClick;
|
|
338
321
|
private getElementLinkAtPosition;
|
|
339
322
|
private redirectToLink;
|
|
323
|
+
private getTopLayerFrameAtSceneCoords;
|
|
340
324
|
private handleCanvasPointerMove;
|
|
341
325
|
private handleEraser;
|
|
342
326
|
private handleTouchMove;
|
|
@@ -362,6 +346,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
362
346
|
private createImageElement;
|
|
363
347
|
private handleLinearElementOnPointerDown;
|
|
364
348
|
private createGenericElementOnPointerDown;
|
|
349
|
+
private createFrameElementOnPointerDown;
|
|
365
350
|
private onKeyDownFromPointerDownHandler;
|
|
366
351
|
private onKeyUpFromPointerDownHandler;
|
|
367
352
|
private onPointerMoveFromPointerDownHandler;
|
|
@@ -396,8 +381,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
396
381
|
private handleCanvasContextMenu;
|
|
397
382
|
private maybeDragNewGenericElement;
|
|
398
383
|
private maybeHandleResize;
|
|
399
|
-
|
|
400
|
-
private _openContextMenu;
|
|
384
|
+
private getContextMenuItems;
|
|
401
385
|
private handleWheel;
|
|
402
386
|
private getTextWysiwygSnappedToCenterPosition;
|
|
403
387
|
private savePointer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./Button.scss";
|
|
3
|
+
interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
type?: "button" | "submit" | "reset";
|
|
5
|
+
onSelect: () => any;
|
|
6
|
+
/** whether button is in active state */
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A generic button component that follows Excalidraw's design system.
|
|
13
|
+
* Style can be customised using `className` or `style` prop.
|
|
14
|
+
* Accepts all props that a regular `button` element accepts.
|
|
15
|
+
*/
|
|
16
|
+
export declare const Button: ({ type, onSelect, selected, children, className, ...rest }: ButtonProps) => JSX.Element;
|
|
17
|
+
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,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;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ExcalidrawElement } from "../../element/types";
|
|
3
|
+
import { ColorPickerType } from "./colorPickerUtils";
|
|
4
|
+
import { ColorPaletteCustom } from "../../colors";
|
|
5
|
+
interface PickerProps {
|
|
6
|
+
color: string;
|
|
7
|
+
onChange: (color: string) => void;
|
|
8
|
+
label: string;
|
|
9
|
+
type: ColorPickerType;
|
|
10
|
+
elements: readonly ExcalidrawElement[];
|
|
11
|
+
palette: ColorPaletteCustom;
|
|
12
|
+
updateData: (formData?: any) => void;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
onEyeDropperToggle: (force?: boolean) => void;
|
|
15
|
+
onEscape: (event: React.KeyboardEvent | KeyboardEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const Picker: ({ color, onChange, label, type, elements, palette, updateData, children, onEyeDropperToggle, onEscape, }: PickerProps) => JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColorPaletteCustom } from "../../colors";
|
|
2
|
+
interface PickerColorListProps {
|
|
3
|
+
palette: ColorPaletteCustom;
|
|
4
|
+
color: string;
|
|
5
|
+
onChange: (color: string) => void;
|
|
6
|
+
label: string;
|
|
7
|
+
activeShade: number;
|
|
8
|
+
}
|
|
9
|
+
declare const PickerColorList: ({ palette, color, onChange, label, activeShade, }: PickerColorListProps) => JSX.Element;
|
|
10
|
+
export default PickerColorList;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ColorPaletteCustom } from "../../colors";
|
|
2
|
+
interface ShadeListProps {
|
|
3
|
+
hex: string;
|
|
4
|
+
onChange: (color: string) => void;
|
|
5
|
+
palette: ColorPaletteCustom;
|
|
6
|
+
}
|
|
7
|
+
export declare const ShadeList: ({ hex, onChange, palette }: ShadeListProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColorPickerType } from "./colorPickerUtils";
|
|
2
|
+
interface TopPicksProps {
|
|
3
|
+
onChange: (color: string) => void;
|
|
4
|
+
type: ColorPickerType;
|
|
5
|
+
activeColor: string;
|
|
6
|
+
topPicks?: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const TopPicks: ({ onChange, type, activeColor, topPicks, }: TopPicksProps) => JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ExcalidrawElement } from "../../element/types";
|
|
2
|
+
import { ColorPickerColor, ColorPaletteCustom } from "../../colors";
|
|
3
|
+
export declare const getColorNameAndShadeFromColor: ({ palette, color, }: {
|
|
4
|
+
palette: ColorPaletteCustom;
|
|
5
|
+
color: string;
|
|
6
|
+
}) => {
|
|
7
|
+
colorName: ColorPickerColor;
|
|
8
|
+
shade: number | null;
|
|
9
|
+
} | null;
|
|
10
|
+
export declare const colorPickerHotkeyBindings: string[];
|
|
11
|
+
export declare const isCustomColor: ({ color, palette, }: {
|
|
12
|
+
color: string;
|
|
13
|
+
palette: ColorPaletteCustom;
|
|
14
|
+
}) => boolean;
|
|
15
|
+
export declare const getMostUsedCustomColors: (elements: readonly ExcalidrawElement[], type: "elementBackground" | "elementStroke", palette: ColorPaletteCustom) => string[];
|
|
16
|
+
export type ActiveColorPickerSectionAtomType = "custom" | "baseColors" | "shades" | "hex" | null;
|
|
17
|
+
export declare const activeColorPickerSectionAtom: import("jotai").PrimitiveAtom<ActiveColorPickerSectionAtomType> & {
|
|
18
|
+
init: ActiveColorPickerSectionAtomType;
|
|
19
|
+
};
|
|
20
|
+
export declare const getContrastYIQ: (bgHex: string, isCustomColor: boolean) => "white" | "black";
|
|
21
|
+
export type ColorPickerType = "canvasBackground" | "elementBackground" | "elementStroke";
|