@zsviczian/excalidraw 0.15.2-obsidian-2 → 0.15.2-obsidian-4
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/dist/excalidraw.development.js +1022 -158
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +2 -2
- package/types/actions/actionAddToLibrary.d.ts +33 -18
- package/types/actions/actionBoundText.d.ts +22 -12
- package/types/actions/actionCanvas.d.ts +110 -60
- package/types/actions/actionClipboard.d.ts +55 -30
- package/types/actions/actionDeleteSelected.d.ts +33 -18
- package/types/actions/actionElementLock.d.ts +287 -0
- package/types/actions/actionExport.d.ts +100 -55
- package/types/actions/actionFinalize.d.ts +22 -12
- package/types/actions/actionFlip.d.ts +2 -4
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +11 -6
- package/types/actions/actionMenu.d.ts +33 -18
- package/types/actions/actionProperties.d.ts +145 -80
- package/types/actions/actionStyles.d.ts +11 -6
- package/types/actions/actionToggleGridMode.d.ts +11 -6
- package/types/actions/actionToggleStats.d.ts +11 -6
- package/types/actions/actionToggleViewMode.d.ts +11 -6
- package/types/actions/actionToggleZenMode.d.ts +11 -6
- package/types/actions/index.d.ts +1 -1
- package/types/actions/manager.d.ts +1 -1
- package/types/actions/shortcuts.d.ts +1 -1
- package/types/actions/types.d.ts +7 -7
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +4 -1
- package/types/colors.d.ts +60 -5
- package/types/components/ActiveConfirmDialog.d.ts +1 -21
- package/types/components/App.d.ts +6 -2
- package/types/components/Avatar.d.ts +1 -1
- 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 +3 -3
- package/types/components/Dialog.d.ts +2 -4
- 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 +1 -1
- package/types/components/HelpButton.d.ts +1 -1
- package/types/components/ImageExportDialog.d.ts +7 -12
- package/types/components/Island.d.ts +1 -1
- package/types/components/JSONExportDialog.d.ts +1 -1
- package/types/components/LayerUI.d.ts +3 -2
- package/types/components/LibraryMenu.d.ts +3 -23
- package/types/components/LibraryMenuControlButtons.d.ts +4 -4
- package/types/components/LibraryMenuHeaderContent.d.ts +3 -1
- package/types/components/LibraryMenuItems.d.ts +4 -5
- package/types/components/LibraryMenuSection.d.ts +22 -0
- package/types/components/LibraryUnit.d.ts +7 -3
- package/types/components/LockButton.d.ts +1 -1
- package/types/components/MobileMenu.d.ts +1 -1
- 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/RadioGroup.d.ts +12 -0
- package/types/components/Sidebar/Sidebar.d.ts +1 -21
- package/types/components/Sidebar/common.d.ts +3 -3
- package/types/components/Spinner.d.ts +2 -1
- package/types/components/Stack.d.ts +4 -3
- package/types/components/Switch.d.ts +9 -0
- package/types/components/ToolButton.d.ts +3 -3
- package/types/components/Tooltip.d.ts +1 -1
- package/types/components/icons.d.ts +8 -1
- package/types/constants.d.ts +6 -0
- package/types/context/tunnels.d.ts +2 -2
- package/types/data/encode.d.ts +1 -1
- package/types/data/filesystem.d.ts +1 -1
- package/types/data/library.d.ts +3 -45
- package/types/data/restore.d.ts +2 -2
- package/types/data/types.d.ts +1 -1
- package/types/element/Hyperlink.d.ts +11 -6
- package/types/element/binding.d.ts +2 -2
- package/types/element/bounds.d.ts +1 -1
- package/types/element/linearElementEditor.d.ts +11 -6
- package/types/element/mutateElement.d.ts +1 -1
- package/types/element/newElement.d.ts +1 -1
- package/types/element/resizeElements.d.ts +1 -0
- package/types/element/transformHandles.d.ts +5 -5
- package/types/element/types.d.ts +35 -35
- package/types/errors.d.ts +1 -1
- package/types/ga.d.ts +5 -5
- package/types/hooks/useCreatePortalContainer.d.ts +5 -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 +2 -2
- package/types/jotai.d.ts +16 -104
- package/types/keys.d.ts +1 -1
- package/types/packages/excalidraw/index.d.ts +1 -1
- package/types/packages/utils.d.ts +2 -2
- package/types/renderer/easingFunctions.d.ts +1 -1
- package/types/renderer/renderElement.d.ts +2 -2
- package/types/scene/Scene.d.ts +4 -4
- package/types/scene/types.d.ts +4 -4
- package/types/types.d.ts +46 -37
- package/types/utility-types.d.ts +13 -13
- package/types/utils.d.ts +3 -3
|
@@ -68,7 +68,7 @@ export declare const actionCopyStyles: {
|
|
|
68
68
|
value: import("../types").NormalizedZoomValue;
|
|
69
69
|
}>;
|
|
70
70
|
openMenu: "canvas" | "shape" | null;
|
|
71
|
-
openPopup: "
|
|
71
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
72
72
|
openSidebar: {
|
|
73
73
|
name: string;
|
|
74
74
|
tab?: string | undefined;
|
|
@@ -111,11 +111,16 @@ export declare const actionCopyStyles: {
|
|
|
111
111
|
showHyperlinkPopup: false | "info" | "editor";
|
|
112
112
|
linkOpacity: number;
|
|
113
113
|
trayModeEnabled: boolean;
|
|
114
|
-
colorPalette
|
|
115
|
-
canvasBackground
|
|
116
|
-
elementBackground
|
|
117
|
-
elementStroke
|
|
118
|
-
|
|
114
|
+
colorPalette?: {
|
|
115
|
+
canvasBackground: import("../colors").ColorPaletteCustom;
|
|
116
|
+
elementBackground: import("../colors").ColorPaletteCustom;
|
|
117
|
+
elementStroke: import("../colors").ColorPaletteCustom;
|
|
118
|
+
topPicks: {
|
|
119
|
+
canvasBackground: [string, string, string, string, string];
|
|
120
|
+
elementStroke: [string, string, string, string, string];
|
|
121
|
+
elementBackground: [string, string, string, string, string];
|
|
122
|
+
};
|
|
123
|
+
} | undefined;
|
|
119
124
|
allowWheelZoom?: boolean | undefined;
|
|
120
125
|
allowPinchZoom?: boolean | undefined;
|
|
121
126
|
pinnedScripts?: string[] | undefined;
|
|
@@ -68,7 +68,7 @@ export declare const actionToggleGridMode: {
|
|
|
68
68
|
value: import("../types").NormalizedZoomValue;
|
|
69
69
|
}>;
|
|
70
70
|
openMenu: "canvas" | "shape" | null;
|
|
71
|
-
openPopup: "
|
|
71
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
72
72
|
openSidebar: {
|
|
73
73
|
name: string;
|
|
74
74
|
tab?: string | undefined;
|
|
@@ -115,11 +115,16 @@ export declare const actionToggleGridMode: {
|
|
|
115
115
|
showHyperlinkPopup: false | "info" | "editor";
|
|
116
116
|
linkOpacity: number;
|
|
117
117
|
trayModeEnabled: boolean;
|
|
118
|
-
colorPalette
|
|
119
|
-
canvasBackground
|
|
120
|
-
elementBackground
|
|
121
|
-
elementStroke
|
|
122
|
-
|
|
118
|
+
colorPalette?: {
|
|
119
|
+
canvasBackground: import("../colors").ColorPaletteCustom;
|
|
120
|
+
elementBackground: import("../colors").ColorPaletteCustom;
|
|
121
|
+
elementStroke: import("../colors").ColorPaletteCustom;
|
|
122
|
+
topPicks: {
|
|
123
|
+
canvasBackground: [string, string, string, string, string];
|
|
124
|
+
elementStroke: [string, string, string, string, string];
|
|
125
|
+
elementBackground: [string, string, string, string, string];
|
|
126
|
+
};
|
|
127
|
+
} | undefined;
|
|
123
128
|
allowWheelZoom?: boolean | undefined;
|
|
124
129
|
allowPinchZoom?: boolean | undefined;
|
|
125
130
|
pinnedScripts?: string[] | undefined;
|
|
@@ -66,7 +66,7 @@ export declare const actionToggleStats: {
|
|
|
66
66
|
value: import("../types").NormalizedZoomValue;
|
|
67
67
|
}>;
|
|
68
68
|
openMenu: "canvas" | "shape" | null;
|
|
69
|
-
openPopup: "
|
|
69
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
70
70
|
openSidebar: {
|
|
71
71
|
name: string;
|
|
72
72
|
tab?: string | undefined;
|
|
@@ -113,11 +113,16 @@ export declare const actionToggleStats: {
|
|
|
113
113
|
showHyperlinkPopup: false | "info" | "editor";
|
|
114
114
|
linkOpacity: number;
|
|
115
115
|
trayModeEnabled: boolean;
|
|
116
|
-
colorPalette
|
|
117
|
-
canvasBackground
|
|
118
|
-
elementBackground
|
|
119
|
-
elementStroke
|
|
120
|
-
|
|
116
|
+
colorPalette?: {
|
|
117
|
+
canvasBackground: import("../colors").ColorPaletteCustom;
|
|
118
|
+
elementBackground: import("../colors").ColorPaletteCustom;
|
|
119
|
+
elementStroke: import("../colors").ColorPaletteCustom;
|
|
120
|
+
topPicks: {
|
|
121
|
+
canvasBackground: [string, string, string, string, string];
|
|
122
|
+
elementStroke: [string, string, string, string, string];
|
|
123
|
+
elementBackground: [string, string, string, string, string];
|
|
124
|
+
};
|
|
125
|
+
} | undefined;
|
|
121
126
|
allowWheelZoom?: boolean | undefined;
|
|
122
127
|
allowPinchZoom?: boolean | undefined;
|
|
123
128
|
pinnedScripts?: string[] | undefined;
|
|
@@ -67,7 +67,7 @@ export declare const actionToggleViewMode: {
|
|
|
67
67
|
value: import("../types").NormalizedZoomValue;
|
|
68
68
|
}>;
|
|
69
69
|
openMenu: "canvas" | "shape" | null;
|
|
70
|
-
openPopup: "
|
|
70
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
71
71
|
openSidebar: {
|
|
72
72
|
name: string;
|
|
73
73
|
tab?: string | undefined;
|
|
@@ -114,11 +114,16 @@ export declare const actionToggleViewMode: {
|
|
|
114
114
|
showHyperlinkPopup: false | "info" | "editor";
|
|
115
115
|
linkOpacity: number;
|
|
116
116
|
trayModeEnabled: boolean;
|
|
117
|
-
colorPalette
|
|
118
|
-
canvasBackground
|
|
119
|
-
elementBackground
|
|
120
|
-
elementStroke
|
|
121
|
-
|
|
117
|
+
colorPalette?: {
|
|
118
|
+
canvasBackground: import("../colors").ColorPaletteCustom;
|
|
119
|
+
elementBackground: import("../colors").ColorPaletteCustom;
|
|
120
|
+
elementStroke: import("../colors").ColorPaletteCustom;
|
|
121
|
+
topPicks: {
|
|
122
|
+
canvasBackground: [string, string, string, string, string];
|
|
123
|
+
elementStroke: [string, string, string, string, string];
|
|
124
|
+
elementBackground: [string, string, string, string, string];
|
|
125
|
+
};
|
|
126
|
+
} | undefined;
|
|
122
127
|
allowWheelZoom?: boolean | undefined;
|
|
123
128
|
allowPinchZoom?: boolean | undefined;
|
|
124
129
|
pinnedScripts?: string[] | undefined;
|
|
@@ -67,7 +67,7 @@ export declare const actionToggleZenMode: {
|
|
|
67
67
|
value: import("../types").NormalizedZoomValue;
|
|
68
68
|
}>;
|
|
69
69
|
openMenu: "canvas" | "shape" | null;
|
|
70
|
-
openPopup: "
|
|
70
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
71
71
|
openSidebar: {
|
|
72
72
|
name: string;
|
|
73
73
|
tab?: string | undefined;
|
|
@@ -114,11 +114,16 @@ export declare const actionToggleZenMode: {
|
|
|
114
114
|
showHyperlinkPopup: false | "info" | "editor";
|
|
115
115
|
linkOpacity: number;
|
|
116
116
|
trayModeEnabled: boolean;
|
|
117
|
-
colorPalette
|
|
118
|
-
canvasBackground
|
|
119
|
-
elementBackground
|
|
120
|
-
elementStroke
|
|
121
|
-
|
|
117
|
+
colorPalette?: {
|
|
118
|
+
canvasBackground: import("../colors").ColorPaletteCustom;
|
|
119
|
+
elementBackground: import("../colors").ColorPaletteCustom;
|
|
120
|
+
elementStroke: import("../colors").ColorPaletteCustom;
|
|
121
|
+
topPicks: {
|
|
122
|
+
canvasBackground: [string, string, string, string, string];
|
|
123
|
+
elementStroke: [string, string, string, string, string];
|
|
124
|
+
elementBackground: [string, string, string, string, string];
|
|
125
|
+
};
|
|
126
|
+
} | undefined;
|
|
122
127
|
allowWheelZoom?: boolean | undefined;
|
|
123
128
|
allowPinchZoom?: boolean | undefined;
|
|
124
129
|
pinnedScripts?: string[] | undefined;
|
package/types/actions/index.d.ts
CHANGED
|
@@ -20,5 +20,5 @@ export { actionToggleZenMode } from "./actionToggleZenMode";
|
|
|
20
20
|
export { actionToggleStats } from "./actionToggleStats";
|
|
21
21
|
export { actionUnbindText, actionBindText } from "./actionBoundText";
|
|
22
22
|
export { actionLink } from "../element/Hyperlink";
|
|
23
|
-
export {
|
|
23
|
+
export { actionToggleElementLock } from "./actionElementLock";
|
|
24
24
|
export { actionToggleLinearEditor } from "./actionLinearEditor";
|
|
@@ -12,7 +12,7 @@ export declare class ActionManager {
|
|
|
12
12
|
registerAction(action: Action): void;
|
|
13
13
|
registerAll(actions: readonly Action[]): void;
|
|
14
14
|
handleKeyDown(event: React.KeyboardEvent | KeyboardEvent): boolean;
|
|
15
|
-
executeAction(action: Action, source?: ActionSource): void;
|
|
15
|
+
executeAction(action: Action, source?: ActionSource, value?: any): void;
|
|
16
16
|
/**
|
|
17
17
|
* @param data additional data sent to the PanelComponent
|
|
18
18
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SubtypeOf } from "../utility-types";
|
|
2
2
|
import { ActionName } from "./types";
|
|
3
|
-
export
|
|
3
|
+
export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock"> | "saveScene" | "imageExport";
|
|
4
4
|
export declare const getShortcutFromShortcutName: (name: ShortcutName) => string;
|
package/types/actions/types.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import React from "react";
|
|
|
2
2
|
import { ExcalidrawElement } from "../element/types";
|
|
3
3
|
import { AppClassProperties, AppState, ExcalidrawProps, BinaryFiles } from "../types";
|
|
4
4
|
import { MarkOptional } from "../utility-types";
|
|
5
|
-
export
|
|
5
|
+
export type ActionSource = "ui" | "keyboard" | "contextMenu" | "api";
|
|
6
6
|
/** if false, the action should be prevented */
|
|
7
|
-
export
|
|
7
|
+
export type ActionResult = {
|
|
8
8
|
elements?: readonly ExcalidrawElement[] | null;
|
|
9
9
|
appState?: MarkOptional<AppState, "offsetTop" | "offsetLeft" | "width" | "height"> | null;
|
|
10
10
|
files?: BinaryFiles | null;
|
|
@@ -12,11 +12,11 @@ export declare type ActionResult = {
|
|
|
12
12
|
syncHistory?: boolean;
|
|
13
13
|
replaceFiles?: boolean;
|
|
14
14
|
} | false;
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
15
|
+
type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
16
|
+
export type UpdaterFn = (res: ActionResult) => void;
|
|
17
|
+
export type ActionFilterFn = (action: Action) => void;
|
|
18
|
+
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "wrapTextInContainer";
|
|
19
|
+
export type PanelComponentProps = {
|
|
20
20
|
elements: readonly ExcalidrawElement[];
|
|
21
21
|
appState: AppState;
|
|
22
22
|
updateData: (formData?: any) => void;
|
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
|
@@ -3,4 +3,7 @@ export declare const getClientColors: (clientId: string, appState: AppState) =>
|
|
|
3
3
|
background: string;
|
|
4
4
|
stroke: string;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* returns first char, capitalized
|
|
8
|
+
*/
|
|
9
|
+
export declare const getNameInitial: (name?: string | null) => string;
|
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,24 +1,4 @@
|
|
|
1
|
-
export declare const activeConfirmDialogAtom: import("jotai").
|
|
2
|
-
write: (get: {
|
|
3
|
-
<Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
|
|
4
|
-
<Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
|
|
5
|
-
<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;
|
|
6
|
-
} & {
|
|
7
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
|
|
8
|
-
unstable_promise: true;
|
|
9
|
-
}): Value_3 | Promise<Value_3>;
|
|
10
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
|
|
11
|
-
unstable_promise: true;
|
|
12
|
-
}): Value_4 | Promise<Value_4>;
|
|
13
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>, options: {
|
|
14
|
-
unstable_promise: true;
|
|
15
|
-
}): (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>;
|
|
16
|
-
}, set: {
|
|
17
|
-
<Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
|
|
18
|
-
<Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
|
|
19
|
-
}, update: "clearCanvas" | ((prev: "clearCanvas" | null) => "clearCanvas" | null) | null) => void;
|
|
20
|
-
onMount?: (<S extends (update: "clearCanvas" | ((prev: "clearCanvas" | null) => "clearCanvas" | null) | null) => void>(setAtom: S) => void | (() => void)) | undefined;
|
|
21
|
-
} & {
|
|
1
|
+
export declare const activeConfirmDialogAtom: import("jotai").PrimitiveAtom<"clearCanvas" | null> & {
|
|
22
2
|
init: "clearCanvas" | null;
|
|
23
3
|
};
|
|
24
4
|
export declare const ActiveConfirmDialog: () => JSX.Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
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 { RestoredDataState } from "../data/restore";
|
|
5
6
|
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
6
7
|
import { ExcalidrawElement, ExcalidrawLinearElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
@@ -21,6 +22,7 @@ export declare const useDevice: () => Readonly<{
|
|
|
21
22
|
isMobile: boolean;
|
|
22
23
|
isTouchScreen: boolean;
|
|
23
24
|
canDeviceFitSidebar: boolean;
|
|
25
|
+
isLandscape: boolean;
|
|
24
26
|
}>;
|
|
25
27
|
export declare const useExcalidrawContainer: () => {
|
|
26
28
|
container: HTMLDivElement | null;
|
|
@@ -53,10 +55,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
53
55
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
54
56
|
lastPointerDown: React.PointerEvent<HTMLCanvasElement> | null;
|
|
55
57
|
lastPointerUp: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
56
|
-
|
|
58
|
+
lastViewportPosition: {
|
|
57
59
|
x: number;
|
|
58
60
|
y: number;
|
|
59
|
-
}
|
|
61
|
+
};
|
|
60
62
|
allowMobileMode: boolean;
|
|
61
63
|
constructor(props: AppProps);
|
|
62
64
|
private renderCanvas;
|
|
@@ -65,6 +67,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
65
67
|
getSceneElementsIncludingDeleted: () => readonly ExcalidrawElement[];
|
|
66
68
|
getSceneElements: () => readonly NonDeletedExcalidrawElement[];
|
|
67
69
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
70
|
+
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: readonly NonDeletedExcalidrawElement[]) => Promise<void>;
|
|
71
|
+
private openEyeDropper;
|
|
68
72
|
private syncActionResult;
|
|
69
73
|
private onBlur;
|
|
70
74
|
private onUnload;
|
|
@@ -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";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ColorPaletteCustom } from "../../colors";
|
|
3
|
+
import { ActiveColorPickerSectionAtomType } from "./colorPickerUtils";
|
|
4
|
+
interface ColorPickerKeyNavHandlerProps {
|
|
5
|
+
event: React.KeyboardEvent;
|
|
6
|
+
activeColorPickerSection: ActiveColorPickerSectionAtomType;
|
|
7
|
+
palette: ColorPaletteCustom;
|
|
8
|
+
color: string;
|
|
9
|
+
onChange: (color: string) => void;
|
|
10
|
+
customColors: string[];
|
|
11
|
+
setActiveColorPickerSection: (update: React.SetStateAction<ActiveColorPickerSectionAtomType>) => void;
|
|
12
|
+
updateData: (formData?: any) => void;
|
|
13
|
+
activeShade: number;
|
|
14
|
+
onEyeDropperToggle: (force?: boolean) => void;
|
|
15
|
+
onEscape: (event: React.KeyboardEvent | KeyboardEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @returns true if the event was handled
|
|
19
|
+
*/
|
|
20
|
+
export declare const colorPickerKeyNavHandler: ({ event, activeColorPickerSection, palette, color, onChange, customColors, setActiveColorPickerSection, updateData, activeShade, onEyeDropperToggle, onEscape, }: ColorPickerKeyNavHandlerProps) => boolean;
|
|
21
|
+
export {};
|
|
@@ -2,9 +2,9 @@ import "./ContextMenu.scss";
|
|
|
2
2
|
import { Action } from "../actions/types";
|
|
3
3
|
import { ActionManager } from "../actions/manager";
|
|
4
4
|
import React from "react";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
|
|
5
|
+
export type ContextMenuItem = typeof CONTEXT_MENU_SEPARATOR | Action;
|
|
6
|
+
export type ContextMenuItems = (ContextMenuItem | false | null | undefined)[];
|
|
7
|
+
type ContextMenuProps = {
|
|
8
8
|
actionManager: ActionManager;
|
|
9
9
|
items: ContextMenuItems;
|
|
10
10
|
top: number;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./Dialog.scss";
|
|
3
|
-
import { AppState } from "../types";
|
|
4
3
|
export interface DialogProps {
|
|
5
4
|
children: React.ReactNode;
|
|
6
5
|
className?: string;
|
|
7
|
-
|
|
6
|
+
size?: "small" | "regular" | "wide";
|
|
8
7
|
onCloseRequest(): void;
|
|
9
|
-
title: React.ReactNode;
|
|
8
|
+
title: React.ReactNode | false;
|
|
10
9
|
autofocus?: boolean;
|
|
11
|
-
theme?: AppState["theme"];
|
|
12
10
|
closeOnClickOutside?: boolean;
|
|
13
11
|
}
|
|
14
12
|
export declare const Dialog: (props: DialogProps) => JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./EyeDropper.scss";
|
|
3
|
+
type EyeDropperProperties = {
|
|
4
|
+
keepOpenOnAlt: boolean;
|
|
5
|
+
swapPreviewOnAlt?: boolean;
|
|
6
|
+
onSelect?: (color: string, event: PointerEvent) => void;
|
|
7
|
+
previewType?: "strokeColor" | "backgroundColor";
|
|
8
|
+
};
|
|
9
|
+
export declare const activeEyeDropperAtom: import("jotai").PrimitiveAtom<EyeDropperProperties | null> & {
|
|
10
|
+
init: EyeDropperProperties | null;
|
|
11
|
+
};
|
|
12
|
+
export declare const EyeDropper: React.FC<{
|
|
13
|
+
onCancel: () => void;
|
|
14
|
+
onSelect: Required<EyeDropperProperties>["onSelect"];
|
|
15
|
+
swapPreviewOnAlt?: EyeDropperProperties["swapPreviewOnAlt"];
|
|
16
|
+
previewType?: EyeDropperProperties["previewType"];
|
|
17
|
+
}>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./FilledButton.scss";
|
|
3
|
+
export type ButtonVariant = "filled" | "outlined" | "icon";
|
|
4
|
+
export type ButtonColor = "primary" | "danger";
|
|
5
|
+
export type ButtonSize = "medium" | "large";
|
|
6
|
+
export type FilledButtonProps = {
|
|
7
|
+
label: string;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
color?: ButtonColor;
|
|
12
|
+
size?: ButtonSize;
|
|
13
|
+
className?: string;
|
|
14
|
+
startIcon?: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export declare const FilledButton: React.ForwardRefExoticComponent<FilledButtonProps & React.RefAttributes<HTMLButtonElement>>;
|