@dwelle/excalidraw 0.4.0-cfd6fb7 → 0.4.0-e1bdbb6
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 +100 -756
- package/README.md +85 -25
- package/dist/excalidraw-assets/Assistant-Bold.woff2 +0 -0
- package/dist/excalidraw-assets/Assistant-Medium.woff2 +0 -0
- package/dist/excalidraw-assets/Assistant-Regular.woff2 +0 -0
- package/dist/excalidraw-assets/Assistant-SemiBold.woff2 +0 -0
- package/dist/excalidraw-assets/vendor-2002fe1b8862917b36c1.js +2 -0
- package/dist/excalidraw-assets/{vendor-52b1f3361986b6c6a4fe.js.LICENSE.txt → vendor-2002fe1b8862917b36c1.js.LICENSE.txt} +0 -0
- package/dist/excalidraw-assets-dev/Assistant-Bold.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Assistant-Medium.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Assistant-Regular.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Assistant-SemiBold.woff2 +0 -0
- package/dist/excalidraw-assets-dev/{vendor-c0592035c3911af79359.js → vendor-e6df8519da951026ff69.js} +1 -1
- package/dist/excalidraw.development.js +441 -203
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +1 -8
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +15 -12
- package/types/actions/actionAlign.d.ts +18 -6
- package/types/actions/actionBoundText.d.ts +5 -4
- package/types/actions/actionCanvas.d.ts +62 -40
- package/types/actions/actionClipboard.d.ts +26 -21
- package/types/actions/actionDeleteSelected.d.ts +19 -14
- package/types/actions/actionDistribute.d.ts +6 -2
- package/types/actions/actionDuplicateSelection.d.ts +3 -1
- package/types/actions/actionExport.d.ts +71 -46
- package/types/actions/actionFinalize.d.ts +13 -9
- package/types/actions/actionGroup.d.ts +6 -2
- package/types/actions/actionLinearEditor.d.ts +115 -0
- package/types/actions/actionMenu.d.ts +24 -15
- package/types/actions/actionNavigate.d.ts +3 -1
- package/types/actions/actionProperties.d.ts +104 -65
- package/types/actions/actionStyles.d.ts +5 -4
- package/types/actions/actionToggleGridMode.d.ts +5 -4
- package/types/actions/actionToggleLock.d.ts +5 -4
- package/types/actions/actionToggleStats.d.ts +5 -4
- package/types/actions/actionToggleViewMode.d.ts +5 -4
- package/types/actions/actionToggleZenMode.d.ts +5 -4
- package/types/actions/actionZindex.d.ts +12 -4
- package/types/actions/index.d.ts +1 -0
- package/types/actions/manager.d.ts +1 -1
- package/types/actions/shortcuts.d.ts +1 -1
- package/types/actions/types.d.ts +4 -2
- package/types/appState.d.ts +6 -5
- package/types/clients.d.ts +1 -1
- package/types/components/Actions.d.ts +13 -0
- package/types/components/App.d.ts +52 -1
- package/types/components/Avatar.d.ts +1 -1
- package/types/components/CollabButton.d.ts +2 -3
- package/types/components/DialogActionButton.d.ts +10 -0
- package/types/components/Footer.d.ts +10 -0
- package/types/components/HelpButton.d.ts +8 -0
- package/types/components/HintViewer.d.ts +3 -2
- package/types/components/HomeButton.d.ts +5 -0
- package/types/components/ImageExportDialog.d.ts +3 -1
- package/types/components/InitializeApp.d.ts +2 -0
- package/types/components/JSONExportDialog.d.ts +2 -2
- package/types/components/LayerUI.d.ts +6 -4
- package/types/components/LibraryButton.d.ts +1 -0
- package/types/components/LibraryMenu.d.ts +14 -5
- package/types/components/LibraryMenuBrowseButton.d.ts +7 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +12 -0
- package/types/components/LibraryMenuItems.d.ts +5 -14
- package/types/components/LibraryUnit.d.ts +2 -3
- package/types/components/LoadingMessage.d.ts +2 -0
- package/types/components/MenuItem.d.ts +11 -0
- package/types/components/MenuUtils.d.ts +1 -0
- package/types/components/MobileMenu.d.ts +10 -9
- package/types/components/Sidebar/Sidebar.d.ts +73 -0
- package/types/components/Sidebar/SidebarHeader.d.ts +20 -0
- package/types/components/Sidebar/common.d.ts +16 -0
- package/types/components/Stats.d.ts +1 -1
- package/types/components/UserList.d.ts +0 -1
- package/types/components/WelcomeScreen.d.ts +10 -0
- package/types/components/WelcomeScreenDecor.d.ts +6 -0
- package/types/components/hoc/withUpstreamOverride.d.ts +10 -0
- package/types/components/icons.d.ts +81 -122
- package/types/constants.d.ts +15 -7
- package/types/data/blob.d.ts +1 -1
- package/types/data/restore.d.ts +1 -1
- package/types/data/types.d.ts +16 -1
- package/types/element/Hyperlink.d.ts +8 -5
- package/types/element/image.d.ts +1 -1
- package/types/element/index.d.ts +1 -1
- package/types/element/linearElementEditor.d.ts +24 -11
- package/types/element/newElement.d.ts +14 -1
- package/types/element/textElement.d.ts +6 -2
- package/types/element/transformHandles.d.ts +1 -1
- package/types/element/types.d.ts +2 -2
- package/types/hooks/useOutsideClick.d.ts +2 -0
- package/types/keys.d.ts +13 -3
- package/types/math.d.ts +8 -1
- package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-52b1f3361986b6c6a4fe.d.ts → vendor-2002fe1b8862917b36c1.d.ts} +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-c0592035c3911af79359.d.ts → vendor-e6df8519da951026ff69.d.ts} +0 -0
- package/types/packages/excalidraw/example/App.d.ts +2 -1
- package/types/packages/excalidraw/example/sidebar/{Sidebar.d.ts → ExampleSidebar.d.ts} +1 -1
- package/types/packages/excalidraw/index.d.ts +2 -1
- package/types/packages/utils.d.ts +4 -1
- package/types/renderer/renderScene.d.ts +1 -1
- package/types/scene/types.d.ts +1 -0
- package/types/shapes.d.ts +27 -3
- package/types/types.d.ts +32 -14
- package/dist/excalidraw-assets/vendor-52b1f3361986b6c6a4fe.js +0 -2
- package/types/components/BackgroundPickerAndDarkModeToggle.d.ts +0 -9
- package/types/components/Card.d.ts +0 -7
- package/types/components/HelpIcon.d.ts +0 -8
- package/types/components/SidebarLockButton.d.ts +0 -8
package/types/constants.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppProps
|
|
1
|
+
import { AppProps } from "./types";
|
|
2
2
|
import { FontFamilyValues } from "./element/types";
|
|
3
3
|
export declare const APP_NAME = "Excalidraw";
|
|
4
4
|
export declare const DRAGGING_THRESHOLD = 10;
|
|
@@ -84,6 +84,9 @@ export declare const MIME_TYPES: {
|
|
|
84
84
|
readonly "excalidraw.png": "image/png";
|
|
85
85
|
readonly jpg: "image/jpeg";
|
|
86
86
|
readonly gif: "image/gif";
|
|
87
|
+
readonly webp: "image/webp";
|
|
88
|
+
readonly bmp: "image/bmp";
|
|
89
|
+
readonly ico: "image/x-icon";
|
|
87
90
|
readonly binary: "application/octet-stream";
|
|
88
91
|
};
|
|
89
92
|
export declare const EXPORT_DATA_TYPES: {
|
|
@@ -99,6 +102,7 @@ export declare const TITLE_TIMEOUT = 10000;
|
|
|
99
102
|
export declare const VERSION_TIMEOUT = 30000;
|
|
100
103
|
export declare const SCROLL_TIMEOUT = 100;
|
|
101
104
|
export declare const ZOOM_STEP = 0.1;
|
|
105
|
+
export declare const MIN_ZOOM = 0.1;
|
|
102
106
|
export declare const HYPERLINK_TOOLTIP_DELAY = 300;
|
|
103
107
|
export declare const IDLE_THRESHOLD = 60000;
|
|
104
108
|
export declare const ACTIVE_THRESHOLD = 3000;
|
|
@@ -114,11 +118,7 @@ export declare const URL_QUERY_KEYS: {
|
|
|
114
118
|
export declare const URL_HASH_KEYS: {
|
|
115
119
|
readonly addLibrary: "addLibrary";
|
|
116
120
|
};
|
|
117
|
-
export declare const DEFAULT_UI_OPTIONS:
|
|
118
|
-
canvasActions: Merge<Required<CanvasActions>, {
|
|
119
|
-
export: ExportOpts;
|
|
120
|
-
}>;
|
|
121
|
-
}>;
|
|
121
|
+
export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
|
|
122
122
|
export declare const MQ_SM_MAX_WIDTH = 640;
|
|
123
123
|
export declare const MQ_MAX_WIDTH_PORTRAIT = 800;
|
|
124
124
|
export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
|
|
@@ -129,7 +129,7 @@ export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
|
129
129
|
export declare const EXPORT_SCALES: number[];
|
|
130
130
|
export declare const DEFAULT_EXPORT_PADDING = 10;
|
|
131
131
|
export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
|
|
132
|
-
export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif"];
|
|
132
|
+
export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif", "image/webp", "image/bmp", "image/x-icon"];
|
|
133
133
|
export declare const MAX_ALLOWED_FILE_BYTES: number;
|
|
134
134
|
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
135
135
|
export declare const ENCRYPTION_KEY_BITS = 128;
|
|
@@ -143,7 +143,15 @@ export declare const VERTICAL_ALIGN: {
|
|
|
143
143
|
MIDDLE: string;
|
|
144
144
|
BOTTOM: string;
|
|
145
145
|
};
|
|
146
|
+
export declare const TEXT_ALIGN: {
|
|
147
|
+
LEFT: string;
|
|
148
|
+
CENTER: string;
|
|
149
|
+
RIGHT: string;
|
|
150
|
+
};
|
|
146
151
|
export declare const ELEMENT_READY_TO_ERASE_OPACITY = 20;
|
|
147
152
|
export declare const COOKIES: {
|
|
148
153
|
readonly AUTH_STATE_COOKIE: "excplus-auth";
|
|
149
154
|
};
|
|
155
|
+
/** key containt id of precedeing elemnt id we use in reconciliation during
|
|
156
|
+
* collaboration */
|
|
157
|
+
export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
|
package/types/data/blob.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare const getFileFromEvent: (event: React.DragEvent<HTMLDivElement>)
|
|
|
40
40
|
}>;
|
|
41
41
|
export declare const getFileHandle: (event: React.DragEvent<HTMLDivElement>) => Promise<FileSystemHandle | null>;
|
|
42
42
|
export declare const createFile: (blob: File | Blob | ArrayBuffer, mimeType: ValueOf<typeof MIME_TYPES>, name: string | undefined) => File;
|
|
43
|
-
/**
|
|
43
|
+
/** attempts to detect correct mimeType if none is set, or if an image
|
|
44
44
|
* has an incorrect extension.
|
|
45
45
|
* Note: doesn't handle missing .excalidraw/.excalidrawlib extension */
|
|
46
46
|
export declare const normalizeFile: (file: File) => Promise<File>;
|
package/types/data/restore.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare type RestoredDataState = {
|
|
|
8
8
|
appState: RestoredAppState;
|
|
9
9
|
files: BinaryFiles;
|
|
10
10
|
};
|
|
11
|
-
export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined) => ExcalidrawElement[];
|
|
11
|
+
export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, refreshDimensions?: boolean) => ExcalidrawElement[];
|
|
12
12
|
export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
|
|
13
13
|
export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined) => RestoredDataState;
|
|
14
14
|
export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
|
package/types/data/types.d.ts
CHANGED
|
@@ -10,12 +10,27 @@ export interface ExportedDataState {
|
|
|
10
10
|
appState: ReturnType<typeof cleanAppStateForExport>;
|
|
11
11
|
files: BinaryFiles | undefined;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Map of legacy AppState keys, with values of:
|
|
15
|
+
* [<legacy type>, <new AppState proeprty>]
|
|
16
|
+
*
|
|
17
|
+
* This is a helper type used in downstream abstractions.
|
|
18
|
+
* Don't consume on its own.
|
|
19
|
+
*/
|
|
20
|
+
export declare type LegacyAppState = {
|
|
21
|
+
/** @deprecated #5663 TODO remove 22-12-15 */
|
|
22
|
+
isLibraryOpen: [boolean, "openSidebar"];
|
|
23
|
+
/** @deprecated #5663 TODO remove 22-12-15 */
|
|
24
|
+
isLibraryMenuDocked: [boolean, "isSidebarDocked"];
|
|
25
|
+
};
|
|
13
26
|
export interface ImportedDataState {
|
|
14
27
|
type?: string;
|
|
15
28
|
version?: number;
|
|
16
29
|
source?: string;
|
|
17
30
|
elements?: readonly ExcalidrawElement[] | null;
|
|
18
|
-
appState?: Readonly<Partial<AppState
|
|
31
|
+
appState?: Readonly<Partial<AppState & {
|
|
32
|
+
[T in keyof LegacyAppState]: LegacyAppState[T][0];
|
|
33
|
+
}>> | null;
|
|
19
34
|
scrollToContent?: boolean;
|
|
20
35
|
libraryItems?: LibraryItems_anyVersion;
|
|
21
36
|
files?: BinaryFiles;
|
|
@@ -18,6 +18,7 @@ export declare const actionLink: {
|
|
|
18
18
|
appState: {
|
|
19
19
|
showHyperlinkPopup: "editor";
|
|
20
20
|
openMenu: null;
|
|
21
|
+
showWelcomeScreen: boolean;
|
|
21
22
|
isLoading: boolean;
|
|
22
23
|
errorMessage: string | null;
|
|
23
24
|
draggingElement: NonDeletedExcalidrawElement | null;
|
|
@@ -55,7 +56,7 @@ export declare const actionLink: {
|
|
|
55
56
|
currentItemOpacity: number;
|
|
56
57
|
currentItemFontFamily: number;
|
|
57
58
|
currentItemFontSize: number;
|
|
58
|
-
currentItemTextAlign:
|
|
59
|
+
currentItemTextAlign: string;
|
|
59
60
|
currentItemStrokeSharpness: import("./types").StrokeSharpness;
|
|
60
61
|
currentItemStartArrowhead: import("./types").Arrowhead | null;
|
|
61
62
|
currentItemEndArrowhead: import("./types").Arrowhead | null;
|
|
@@ -72,6 +73,9 @@ export declare const actionLink: {
|
|
|
72
73
|
value: import("../types").NormalizedZoomValue;
|
|
73
74
|
}>;
|
|
74
75
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
76
|
+
openSidebar: "library" | "customSidebar" | null;
|
|
77
|
+
openDialog: "imageExport" | "help" | null;
|
|
78
|
+
isSidebarDocked: boolean;
|
|
75
79
|
lastPointerDownWith: import("./types").PointerType;
|
|
76
80
|
selectedElementIds: {
|
|
77
81
|
[id: string]: boolean;
|
|
@@ -80,7 +84,6 @@ export declare const actionLink: {
|
|
|
80
84
|
[id: string]: boolean;
|
|
81
85
|
};
|
|
82
86
|
shouldCacheIgnoreZoom: boolean;
|
|
83
|
-
showHelpDialog: boolean;
|
|
84
87
|
toast: {
|
|
85
88
|
message: string;
|
|
86
89
|
closable?: boolean | undefined;
|
|
@@ -98,8 +101,6 @@ export declare const actionLink: {
|
|
|
98
101
|
height: number;
|
|
99
102
|
offsetTop: number;
|
|
100
103
|
offsetLeft: number;
|
|
101
|
-
isLibraryOpen: boolean;
|
|
102
|
-
isLibraryMenuDocked: boolean;
|
|
103
104
|
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
104
105
|
collaborators: Map<string, import("../types").Collaborator>;
|
|
105
106
|
showStats: boolean;
|
|
@@ -123,7 +124,9 @@ export declare const actionLink: {
|
|
|
123
124
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
124
125
|
contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.edit" | "labels.link.create";
|
|
125
126
|
contextItemPredicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
|
|
126
|
-
PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps
|
|
127
|
+
PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps & {
|
|
128
|
+
isInHamburgerMenu: boolean;
|
|
129
|
+
}) => JSX.Element;
|
|
127
130
|
} & {
|
|
128
131
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
129
132
|
};
|
package/types/element/image.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const updateImageCache: ({ fileIds, files, imageCache, }: {
|
|
|
10
10
|
}) => Promise<{
|
|
11
11
|
imageCache: Map<FileId, {
|
|
12
12
|
image: HTMLImageElement | Promise<HTMLImageElement>;
|
|
13
|
-
mimeType: "image/svg+xml" | "image/png" | "image/jpeg" | "image/gif";
|
|
13
|
+
mimeType: "image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon";
|
|
14
14
|
}>;
|
|
15
15
|
/** includes errored files because they cache was updated nonetheless */
|
|
16
16
|
updatedFiles: Map<FileId, true>;
|
package/types/element/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
|
|
2
|
-
export { newElement, newTextElement, updateTextElement, newLinearElement, newImageElement, duplicateElement, } from "./newElement";
|
|
2
|
+
export { newElement, newTextElement, updateTextElement, refreshTextDimensions, newLinearElement, newImageElement, duplicateElement, } from "./newElement";
|
|
3
3
|
export { getElementAbsoluteCoords, getElementBounds, getCommonBounds, getDiamondPoints, getArrowheadPoints, getClosestElementBounds, } from "./bounds";
|
|
4
4
|
export { OMIT_SIDES_FOR_MULTIPLE_ELEMENTS, getTransformHandlesFromCoords, getTransformHandles, } from "./transformHandles";
|
|
5
5
|
export { hitTest, isHittingElementBoundingBoxWithoutHittingElement, } from "./collision";
|
|
@@ -3,6 +3,11 @@ import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, E
|
|
|
3
3
|
import { Point, AppState } from "../types";
|
|
4
4
|
import History from "../history";
|
|
5
5
|
import Scene from "../scene/Scene";
|
|
6
|
+
declare const editorMidPointsCache: {
|
|
7
|
+
version: number | null;
|
|
8
|
+
points: (Point | null)[];
|
|
9
|
+
zoom: number | null;
|
|
10
|
+
};
|
|
6
11
|
export declare class LinearElementEditor {
|
|
7
12
|
readonly elementId: ExcalidrawElement["id"] & {
|
|
8
13
|
_brand: "excalidrawLinearElementId";
|
|
@@ -24,7 +29,7 @@ export declare class LinearElementEditor {
|
|
|
24
29
|
readonly startBindingElement: ExcalidrawBindableElement | null | "keep";
|
|
25
30
|
readonly endBindingElement: ExcalidrawBindableElement | null | "keep";
|
|
26
31
|
readonly hoverPointIndex: number;
|
|
27
|
-
readonly
|
|
32
|
+
readonly segmentMidPointHoveredCoords: Point | null;
|
|
28
33
|
constructor(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene);
|
|
29
34
|
static POINT_HANDLE_SIZE: number;
|
|
30
35
|
/**
|
|
@@ -39,11 +44,15 @@ export declare class LinearElementEditor {
|
|
|
39
44
|
y: number;
|
|
40
45
|
}[]) => void, linearElementEditor: LinearElementEditor): boolean;
|
|
41
46
|
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
|
|
42
|
-
static
|
|
47
|
+
static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, appState: AppState) => (typeof editorMidPointsCache)["points"];
|
|
48
|
+
static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState: AppState) => void;
|
|
49
|
+
static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
|
|
43
50
|
x: number;
|
|
44
51
|
y: number;
|
|
45
|
-
}, appState: AppState) =>
|
|
46
|
-
static
|
|
52
|
+
}, appState: AppState) => readonly [number, number] | null;
|
|
53
|
+
static isSegmentTooShort(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, zoom: AppState["zoom"]): boolean;
|
|
54
|
+
static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number): readonly [number, number];
|
|
55
|
+
static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: Point): number;
|
|
47
56
|
static handlePointerDown(event: React.PointerEvent<HTMLCanvasElement>, appState: AppState, history: History, scenePointer: {
|
|
48
57
|
x: number;
|
|
49
58
|
y: number;
|
|
@@ -53,7 +62,8 @@ export declare class LinearElementEditor {
|
|
|
53
62
|
linearElementEditor: LinearElementEditor | null;
|
|
54
63
|
isMidPoint: boolean;
|
|
55
64
|
};
|
|
56
|
-
static
|
|
65
|
+
static arePointsEqual(point1: Point | null, point2: Point | null): boolean;
|
|
66
|
+
static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, appState: AppState): LinearElementEditor | null;
|
|
57
67
|
/** scene coords */
|
|
58
68
|
static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, point: Point): readonly [number, number];
|
|
59
69
|
/** scene coords */
|
|
@@ -94,8 +104,9 @@ export declare class LinearElementEditor {
|
|
|
94
104
|
startBindingElement: ExcalidrawBindableElement | "keep" | null;
|
|
95
105
|
endBindingElement: ExcalidrawBindableElement | "keep" | null;
|
|
96
106
|
hoverPointIndex: number;
|
|
97
|
-
|
|
107
|
+
segmentMidPointHoveredCoords: readonly [number, number] | null;
|
|
98
108
|
};
|
|
109
|
+
showWelcomeScreen: boolean;
|
|
99
110
|
isLoading: boolean;
|
|
100
111
|
errorMessage: string | null;
|
|
101
112
|
draggingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
@@ -132,7 +143,7 @@ export declare class LinearElementEditor {
|
|
|
132
143
|
currentItemOpacity: number;
|
|
133
144
|
currentItemFontFamily: number;
|
|
134
145
|
currentItemFontSize: number;
|
|
135
|
-
currentItemTextAlign:
|
|
146
|
+
currentItemTextAlign: string;
|
|
136
147
|
currentItemStrokeSharpness: import("./types").StrokeSharpness;
|
|
137
148
|
currentItemStartArrowhead: import("./types").Arrowhead | null;
|
|
138
149
|
currentItemEndArrowhead: import("./types").Arrowhead | null;
|
|
@@ -149,7 +160,11 @@ export declare class LinearElementEditor {
|
|
|
149
160
|
value: import("../types").NormalizedZoomValue;
|
|
150
161
|
}>;
|
|
151
162
|
openMenu: "canvas" | "shape" | null;
|
|
163
|
+
/** @returns whether point was dragged */
|
|
152
164
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
165
|
+
openSidebar: "library" | "customSidebar" | null;
|
|
166
|
+
openDialog: "imageExport" | "help" | null;
|
|
167
|
+
isSidebarDocked: boolean;
|
|
153
168
|
lastPointerDownWith: import("./types").PointerType;
|
|
154
169
|
selectedElementIds: {
|
|
155
170
|
[id: string]: boolean;
|
|
@@ -158,7 +173,6 @@ export declare class LinearElementEditor {
|
|
|
158
173
|
[id: string]: boolean;
|
|
159
174
|
};
|
|
160
175
|
shouldCacheIgnoreZoom: boolean;
|
|
161
|
-
showHelpDialog: boolean;
|
|
162
176
|
toast: {
|
|
163
177
|
message: string;
|
|
164
178
|
closable?: boolean | undefined;
|
|
@@ -176,8 +190,6 @@ export declare class LinearElementEditor {
|
|
|
176
190
|
height: number;
|
|
177
191
|
offsetTop: number;
|
|
178
192
|
offsetLeft: number;
|
|
179
|
-
isLibraryOpen: boolean;
|
|
180
|
-
isLibraryMenuDocked: boolean;
|
|
181
193
|
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
182
194
|
collaborators: Map<string, import("../types").Collaborator>;
|
|
183
195
|
showStats: boolean;
|
|
@@ -195,7 +207,7 @@ export declare class LinearElementEditor {
|
|
|
195
207
|
};
|
|
196
208
|
};
|
|
197
209
|
static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
|
|
198
|
-
static addPoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
|
|
210
|
+
static addPoints(element: NonDeleted<ExcalidrawLinearElement>, appState: AppState, targetPoints: {
|
|
199
211
|
point: Point;
|
|
200
212
|
}[]): void;
|
|
201
213
|
static movePoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
|
|
@@ -209,3 +221,4 @@ export declare class LinearElementEditor {
|
|
|
209
221
|
private static _updatePoints;
|
|
210
222
|
private static _getShiftLockedDelta;
|
|
211
223
|
}
|
|
224
|
+
export {};
|
|
@@ -12,7 +12,17 @@ export declare const newTextElement: (opts: {
|
|
|
12
12
|
verticalAlign: VerticalAlign;
|
|
13
13
|
containerId?: ExcalidrawRectangleElement["id"];
|
|
14
14
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, text?: string) => {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
baseline: number;
|
|
21
|
+
text: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const getMaxContainerWidth: (container: ExcalidrawElement) => number;
|
|
24
|
+
export declare const getMaxContainerHeight: (container: ExcalidrawElement) => number;
|
|
25
|
+
export declare const updateTextElement: (textElement: ExcalidrawTextElement, { text, isDeleted, originalText, }: {
|
|
16
26
|
text: string;
|
|
17
27
|
isDeleted?: boolean | undefined;
|
|
18
28
|
originalText: string;
|
|
@@ -30,6 +40,9 @@ export declare const newLinearElement: (opts: {
|
|
|
30
40
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawLinearElement>;
|
|
31
41
|
export declare const newImageElement: (opts: {
|
|
32
42
|
type: ExcalidrawImageElement["type"];
|
|
43
|
+
status?: ExcalidrawImageElement["status"];
|
|
44
|
+
fileId?: ExcalidrawImageElement["fileId"];
|
|
45
|
+
scale?: ExcalidrawImageElement["scale"];
|
|
33
46
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
|
|
34
47
|
export declare const deepCopyElement: (val: any, depth?: number) => any;
|
|
35
48
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
2
2
|
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
|
-
export declare const redrawTextBoundingBox: (
|
|
3
|
+
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
|
|
4
4
|
export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
5
5
|
export declare const handleBindTextResize: (element: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType) => void;
|
|
6
6
|
export declare const measureText: (text: string, font: FontString, maxWidth?: number | null) => {
|
|
@@ -9,7 +9,7 @@ export declare const measureText: (text: string, font: FontString, maxWidth?: nu
|
|
|
9
9
|
baseline: number;
|
|
10
10
|
};
|
|
11
11
|
export declare const getApproxLineHeight: (font: FontString) => number;
|
|
12
|
-
export declare const wrapText: (text: string, font: FontString,
|
|
12
|
+
export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
|
|
13
13
|
export declare const charWidth: {
|
|
14
14
|
calculate: (char: string, font: FontString) => number;
|
|
15
15
|
getCache: (font: FontString) => number[];
|
|
@@ -24,3 +24,7 @@ export declare const getBoundTextElement: (element: ExcalidrawElement | null) =>
|
|
|
24
24
|
export declare const getContainerElement: (element: (ExcalidrawElement & {
|
|
25
25
|
containerId: ExcalidrawElement["id"] | null;
|
|
26
26
|
}) | null) => ExcalidrawElement | null;
|
|
27
|
+
export declare const getContainerDims: (element: ExcalidrawElement) => {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
@@ -15,8 +15,8 @@ export declare const OMIT_SIDES_FOR_MULTIPLE_ELEMENTS: {
|
|
|
15
15
|
w: boolean;
|
|
16
16
|
};
|
|
17
17
|
export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, zoom: Zoom, pointerType: PointerType, omitSides?: {
|
|
18
|
-
e?: boolean | undefined;
|
|
19
18
|
s?: boolean | undefined;
|
|
19
|
+
e?: boolean | undefined;
|
|
20
20
|
w?: boolean | undefined;
|
|
21
21
|
n?: boolean | undefined;
|
|
22
22
|
nw?: boolean | undefined;
|
package/types/element/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Point } from "../types";
|
|
2
|
-
import { FONT_FAMILY, THEME, VERTICAL_ALIGN } from "../constants";
|
|
2
|
+
import { FONT_FAMILY, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
|
|
3
3
|
export declare type ChartType = "bar" | "line";
|
|
4
4
|
export declare type FillStyle = "hachure" | "cross-hatch" | "solid";
|
|
5
5
|
export declare type FontFamilyKeys = keyof typeof FONT_FAMILY;
|
|
@@ -12,7 +12,7 @@ export declare type GroupId = string;
|
|
|
12
12
|
export declare type PointerType = "mouse" | "pen" | "touch";
|
|
13
13
|
export declare type StrokeSharpness = "round" | "sharp";
|
|
14
14
|
export declare type StrokeStyle = "solid" | "dashed" | "dotted";
|
|
15
|
-
export declare type TextAlign =
|
|
15
|
+
export declare type TextAlign = typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
|
|
16
16
|
declare type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
|
|
17
17
|
export declare type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
|
|
18
18
|
declare type _ExcalidrawElementBase = Readonly<{
|
package/types/keys.d.ts
CHANGED
|
@@ -17,11 +17,8 @@ export declare const CODES: {
|
|
|
17
17
|
readonly SLASH: "Slash";
|
|
18
18
|
readonly C: "KeyC";
|
|
19
19
|
readonly D: "KeyD";
|
|
20
|
-
readonly G: "KeyG";
|
|
21
|
-
readonly F: "KeyF";
|
|
22
20
|
readonly H: "KeyH";
|
|
23
21
|
readonly V: "KeyV";
|
|
24
|
-
readonly X: "KeyX";
|
|
25
22
|
readonly Z: "KeyZ";
|
|
26
23
|
readonly R: "KeyR";
|
|
27
24
|
};
|
|
@@ -44,9 +41,12 @@ export declare const KEYS: {
|
|
|
44
41
|
readonly PERIOD: ".";
|
|
45
42
|
readonly COMMA: ",";
|
|
46
43
|
readonly A: "a";
|
|
44
|
+
readonly C: "c";
|
|
47
45
|
readonly D: "d";
|
|
48
46
|
readonly E: "e";
|
|
47
|
+
readonly F: "f";
|
|
49
48
|
readonly G: "g";
|
|
49
|
+
readonly H: "h";
|
|
50
50
|
readonly I: "i";
|
|
51
51
|
readonly L: "l";
|
|
52
52
|
readonly O: "o";
|
|
@@ -60,6 +60,16 @@ export declare const KEYS: {
|
|
|
60
60
|
readonly Y: "y";
|
|
61
61
|
readonly Z: "z";
|
|
62
62
|
readonly K: "k";
|
|
63
|
+
readonly 0: "0";
|
|
64
|
+
readonly 1: "1";
|
|
65
|
+
readonly 2: "2";
|
|
66
|
+
readonly 3: "3";
|
|
67
|
+
readonly 4: "4";
|
|
68
|
+
readonly 5: "5";
|
|
69
|
+
readonly 6: "6";
|
|
70
|
+
readonly 7: "7";
|
|
71
|
+
readonly 8: "8";
|
|
72
|
+
readonly 9: "9";
|
|
63
73
|
};
|
|
64
74
|
export declare type Key = keyof typeof KEYS;
|
|
65
75
|
export declare const isArrowKey: (key: string) => boolean;
|
package/types/math.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Point, Zoom } from "./types";
|
|
2
|
-
import { ExcalidrawLinearElement } from "./element/types";
|
|
2
|
+
import { ExcalidrawLinearElement, NonDeleted } from "./element/types";
|
|
3
3
|
export declare const rotate: (x1: number, y1: number, x2: number, y2: number, angle: number) => [number, number];
|
|
4
4
|
export declare const rotatePoint: (point: readonly [number, number], center: readonly [number, number], angle: number) => [number, number];
|
|
5
5
|
export declare const adjustXYWithRotation: (sides: {
|
|
@@ -18,3 +18,10 @@ export declare const centerPoint: (a: readonly [number, number], b: readonly [nu
|
|
|
18
18
|
export declare const isPathALoop: (points: ExcalidrawLinearElement["points"], zoomValue?: Zoom["value"]) => boolean;
|
|
19
19
|
export declare const isPointInPolygon: (points: Point[], x: number, y: number) => boolean;
|
|
20
20
|
export declare const getGridPoint: (x: number, y: number, gridSize: number | null) => [number, number];
|
|
21
|
+
export declare const getControlPointsForBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][] | null;
|
|
22
|
+
export declare const getBezierXY: (p0: readonly [number, number], p1: readonly [number, number], p2: readonly [number, number], p3: readonly [number, number], t: number) => number[];
|
|
23
|
+
export declare const getPointsInBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][];
|
|
24
|
+
export declare const getBezierCurveArcLengths: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => number[];
|
|
25
|
+
export declare const getBezierCurveLength: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => number;
|
|
26
|
+
export declare const mapIntervalToBezierT: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number], interval: number) => number;
|
|
27
|
+
export declare const arePointsEqual: (p1: readonly [number, number], p2: readonly [number, number]) => boolean;
|
|
File without changes
|
|
File without changes
|
|
@@ -7,12 +7,13 @@ export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoti
|
|
|
7
7
|
export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
|
|
8
8
|
export { defaultLang, languages } from "../../i18n";
|
|
9
9
|
export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "../../data/restore";
|
|
10
|
-
export {
|
|
10
|
+
export { exportToCanvas, exportToBlob, exportToSvg, serializeAsJSON, serializeLibraryAsJSON, loadLibraryFromBlob, loadFromBlob, loadSceneOrLibraryFromBlob, getFreeDrawSvgPath, exportToClipboard, mergeLibraryItems, } from "../../packages/utils";
|
|
11
11
|
export { isLinearElement } from "../../element/typeChecks";
|
|
12
12
|
export { FONT_FAMILY, THEME, MIME_TYPES } from "../../constants";
|
|
13
13
|
export { mutateElement, newElementWith, bumpVersion, } from "../../element/mutateElement";
|
|
14
14
|
export { parseLibraryTokensFromUrl, useHandleLibrary, } from "../../data/library";
|
|
15
15
|
export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "../../utils";
|
|
16
|
+
export { Sidebar } from "../../components/Sidebar/Sidebar";
|
|
16
17
|
export { getDefaultAppState, cleanAppStateForExport, clearAppStateForLocalStorage, } from "../../appState";
|
|
17
18
|
export { jotaiScope, jotaiStore } from "../../jotai";
|
|
18
19
|
export { libraryItemsAtom } from "../../data/library";
|
|
@@ -13,10 +13,13 @@ declare type ExportOpts = {
|
|
|
13
13
|
scale?: number;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
-
export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, }: ExportOpts
|
|
16
|
+
export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, exportPadding, }: ExportOpts & {
|
|
17
|
+
exportPadding?: number | undefined;
|
|
18
|
+
}) => Promise<HTMLCanvasElement>;
|
|
17
19
|
export declare const exportToBlob: (opts: ExportOpts & {
|
|
18
20
|
mimeType?: string;
|
|
19
21
|
quality?: number;
|
|
22
|
+
exportPadding?: number;
|
|
20
23
|
}) => Promise<Blob>;
|
|
21
24
|
export declare const exportToSvg: ({ elements, appState, files, exportPadding, }: Omit<ExportOpts, "getDimensions"> & {
|
|
22
25
|
exportPadding?: number | undefined;
|
|
@@ -3,7 +3,7 @@ import { RoughSVG } from "roughjs/bin/svg";
|
|
|
3
3
|
import { AppState, BinaryFiles } from "../types";
|
|
4
4
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
5
5
|
import { RenderConfig } from "../scene/types";
|
|
6
|
-
export declare const DEFAULT_SPACING =
|
|
6
|
+
export declare const DEFAULT_SPACING = 2;
|
|
7
7
|
export declare const _renderScene: ({ elements, appState, scale, rc, canvas, renderConfig, }: {
|
|
8
8
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
9
9
|
appState: AppState;
|
package/types/scene/types.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare type RenderConfig = {
|
|
|
33
33
|
/** when exporting the behavior is slightly different (e.g. we can't use
|
|
34
34
|
CSS filters), and we disable render optimizations for best output */
|
|
35
35
|
isExporting: boolean;
|
|
36
|
+
selectionColor?: string;
|
|
36
37
|
};
|
|
37
38
|
export declare type SceneScroll = {
|
|
38
39
|
scrollX: number;
|
package/types/shapes.d.ts
CHANGED
|
@@ -2,37 +2,61 @@ export declare const SHAPES: readonly [{
|
|
|
2
2
|
readonly icon: JSX.Element;
|
|
3
3
|
readonly value: "selection";
|
|
4
4
|
readonly key: "v";
|
|
5
|
+
readonly numericKey: "1";
|
|
6
|
+
readonly fillable: true;
|
|
5
7
|
}, {
|
|
6
8
|
readonly icon: JSX.Element;
|
|
7
9
|
readonly value: "rectangle";
|
|
8
10
|
readonly key: "r";
|
|
11
|
+
readonly numericKey: "2";
|
|
12
|
+
readonly fillable: true;
|
|
9
13
|
}, {
|
|
10
14
|
readonly icon: JSX.Element;
|
|
11
15
|
readonly value: "diamond";
|
|
12
16
|
readonly key: "d";
|
|
17
|
+
readonly numericKey: "3";
|
|
18
|
+
readonly fillable: true;
|
|
13
19
|
}, {
|
|
14
20
|
readonly icon: JSX.Element;
|
|
15
21
|
readonly value: "ellipse";
|
|
16
22
|
readonly key: "o";
|
|
23
|
+
readonly numericKey: "4";
|
|
24
|
+
readonly fillable: true;
|
|
17
25
|
}, {
|
|
18
26
|
readonly icon: JSX.Element;
|
|
19
27
|
readonly value: "arrow";
|
|
20
28
|
readonly key: "a";
|
|
29
|
+
readonly numericKey: "5";
|
|
30
|
+
readonly fillable: true;
|
|
21
31
|
}, {
|
|
22
32
|
readonly icon: JSX.Element;
|
|
23
33
|
readonly value: "line";
|
|
24
|
-
readonly key:
|
|
34
|
+
readonly key: "l";
|
|
35
|
+
readonly numericKey: "6";
|
|
36
|
+
readonly fillable: true;
|
|
25
37
|
}, {
|
|
26
38
|
readonly icon: JSX.Element;
|
|
27
39
|
readonly value: "freedraw";
|
|
28
|
-
readonly key: readonly ["
|
|
40
|
+
readonly key: readonly ["p", "x"];
|
|
41
|
+
readonly numericKey: "7";
|
|
42
|
+
readonly fillable: false;
|
|
29
43
|
}, {
|
|
30
44
|
readonly icon: JSX.Element;
|
|
31
45
|
readonly value: "text";
|
|
32
46
|
readonly key: "t";
|
|
47
|
+
readonly numericKey: "8";
|
|
48
|
+
readonly fillable: false;
|
|
33
49
|
}, {
|
|
34
50
|
readonly icon: JSX.Element;
|
|
35
51
|
readonly value: "image";
|
|
36
52
|
readonly key: null;
|
|
53
|
+
readonly numericKey: "9";
|
|
54
|
+
readonly fillable: false;
|
|
55
|
+
}, {
|
|
56
|
+
readonly icon: JSX.Element;
|
|
57
|
+
readonly value: "eraser";
|
|
58
|
+
readonly key: "e";
|
|
59
|
+
readonly numericKey: "0";
|
|
60
|
+
readonly fillable: false;
|
|
37
61
|
}];
|
|
38
|
-
export declare const findShapeByKey: (key: string) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
|
|
62
|
+
export declare const findShapeByKey: (key: string) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | null;
|