@zsviczian/excalidraw 0.14.2-obsidian-5 → 0.15.2-obsidian-2
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/README.md +2 -2
- package/dist/excalidraw.development.js +469 -226
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +18 -6
- package/types/actions/actionBoundText.d.ts +14 -6
- package/types/actions/actionCanvas.d.ts +60 -20
- package/types/actions/actionClipboard.d.ts +30 -10
- package/types/actions/actionDeleteSelected.d.ts +18 -6
- package/types/actions/actionExport.d.ts +54 -18
- package/types/actions/actionFinalize.d.ts +12 -4
- package/types/actions/actionLinearEditor.d.ts +6 -2
- package/types/actions/actionMenu.d.ts +20 -8
- package/types/actions/actionProperties.d.ts +78 -26
- package/types/actions/actionStyles.d.ts +6 -2
- package/types/actions/actionToggleGridMode.d.ts +6 -2
- package/types/actions/actionToggleLock.d.ts +6 -2
- package/types/actions/actionToggleStats.d.ts +6 -2
- package/types/actions/actionToggleViewMode.d.ts +6 -2
- package/types/actions/actionToggleZenMode.d.ts +6 -2
- package/types/actions/types.d.ts +1 -1
- package/types/appState.d.ts +5 -2
- package/types/clipboard.d.ts +2 -2
- package/types/components/Actions.d.ts +5 -5
- package/types/components/App.d.ts +10 -3
- package/types/components/Button.d.ts +3 -1
- package/types/components/DefaultSidebar.d.ts +30 -0
- package/types/components/HintViewer.d.ts +2 -2
- package/types/components/ImageExportDialog.d.ts +4 -4
- package/types/components/JSONExportDialog.d.ts +3 -3
- package/types/components/LayerUI.d.ts +3 -10
- package/types/components/LibraryMenu.d.ts +32 -13
- package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
- package/types/components/LibraryMenuControlButtons.d.ts +9 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +9 -28
- package/types/components/LibraryMenuItems.d.ts +2 -2
- package/types/components/MobileMenu.d.ts +3 -3
- package/types/components/PasteChartDialog.d.ts +4 -5
- package/types/components/PublishLibrary.d.ts +2 -2
- package/types/components/Sidebar/Sidebar.d.ts +68 -45
- 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 +23 -6
- package/types/components/Stats.d.ts +3 -3
- package/types/components/Trans.d.ts +8 -0
- package/types/components/footer/Footer.d.ts +2 -2
- package/types/constants.d.ts +34 -7
- package/types/context/tunnels.d.ts +18 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/data/blob.d.ts +2 -2
- package/types/data/filesystem.d.ts +2 -1
- package/types/data/types.d.ts +2 -4
- package/types/element/Hyperlink.d.ts +8 -4
- package/types/element/image.d.ts +11 -1
- package/types/element/linearElementEditor.d.ts +7 -6
- package/types/element/newElement.d.ts +31 -7
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/textElement.d.ts +3 -2
- package/types/hooks/useOutsideClick.d.ts +1 -1
- package/types/packages/excalidraw/index.d.ts +2 -1
- package/types/packages/utils.d.ts +1 -1
- package/types/renderer/renderElement.d.ts +1 -0
- package/types/scene/export.d.ts +4 -1
- package/types/scene/selection.d.ts +4 -4
- package/types/types.d.ts +28 -16
- package/types/utils.d.ts +2 -2
|
@@ -9,6 +9,7 @@ export interface ExcalidrawElementWithCanvas {
|
|
|
9
9
|
canvas: HTMLCanvasElement;
|
|
10
10
|
theme: RenderConfig["theme"];
|
|
11
11
|
scale: number;
|
|
12
|
+
zoomValue: RenderConfig["zoom"]["value"];
|
|
12
13
|
canvasOffsetX: number;
|
|
13
14
|
canvasOffsetY: number;
|
|
14
15
|
boundTextElementVersion: number | null;
|
package/types/scene/export.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, BinaryFiles } from "../types";
|
|
3
|
+
import { serializeAsJSON } from "../data/json";
|
|
3
4
|
export declare const SVG_EXPORT_TAG = "<!-- svg-source:excalidraw -->";
|
|
4
5
|
export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, }: {
|
|
5
6
|
exportBackground: boolean;
|
|
@@ -16,5 +17,7 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
16
17
|
viewBackgroundColor: string;
|
|
17
18
|
exportWithDarkMode?: boolean;
|
|
18
19
|
exportEmbedScene?: boolean;
|
|
19
|
-
}, files: BinaryFiles | null
|
|
20
|
+
}, files: BinaryFiles | null, opts?: {
|
|
21
|
+
serializeAsJSON?: () => string;
|
|
22
|
+
}) => Promise<SVGSVGElement>;
|
|
20
23
|
export declare const getExportSize: (elements: readonly NonDeletedExcalidrawElement[], exportPadding: number, scale: number) => [number, number];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
export declare const getElementsWithinSelection: (elements: readonly NonDeletedExcalidrawElement[], selection: NonDeletedExcalidrawElement) => NonDeletedExcalidrawElement[];
|
|
4
|
-
export declare const isSomeElementSelected: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => boolean;
|
|
4
|
+
export declare const isSomeElementSelected: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">) => boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Returns common attribute (picked by `getAttribute` callback) of selected
|
|
7
7
|
* elements. If elements don't share the same value, returns `null`.
|
|
8
8
|
*/
|
|
9
|
-
export declare const getCommonAttributeOfSelectedElements: <T>(elements: readonly NonDeletedExcalidrawElement[], appState: AppState, getAttribute: (element: ExcalidrawElement) => T) => T | null;
|
|
10
|
-
export declare const getSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, includeBoundTextElement?: boolean) => NonDeletedExcalidrawElement[];
|
|
11
|
-
export declare const getTargetElements: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => NonDeletedExcalidrawElement[];
|
|
9
|
+
export declare const getCommonAttributeOfSelectedElements: <T>(elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">, getAttribute: (element: ExcalidrawElement) => T) => T | null;
|
|
10
|
+
export declare const getSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">, includeBoundTextElement?: boolean) => NonDeletedExcalidrawElement[];
|
|
11
|
+
export declare const getTargetElements: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds" | "editingElement">) => NonDeletedExcalidrawElement[];
|
package/types/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness } from "./element/types";
|
|
2
3
|
import { SHAPES } from "./shapes";
|
|
3
4
|
import { Point as RoughPoint } from "roughjs/bin/geometry";
|
|
@@ -13,10 +14,9 @@ import { isOverScrollBars } from "./scene";
|
|
|
13
14
|
import { MaybeTransformHandleType } from "./element/transformHandles";
|
|
14
15
|
import Library from "./data/library";
|
|
15
16
|
import type { FileSystemHandle } from "./data/filesystem";
|
|
16
|
-
import type {
|
|
17
|
+
import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
|
17
18
|
import { ContextMenuItems } from "./components/ContextMenu";
|
|
18
|
-
import { Merge, ForwardRef } from "./utility-types";
|
|
19
|
-
import React from "react";
|
|
19
|
+
import { Merge, ForwardRef, ValueOf } from "./utility-types";
|
|
20
20
|
export declare type Point = Readonly<RoughPoint>;
|
|
21
21
|
export declare type Collaborator = {
|
|
22
22
|
pointer?: {
|
|
@@ -38,7 +38,7 @@ export declare type DataURL = string & {
|
|
|
38
38
|
_brand: "DataURL";
|
|
39
39
|
};
|
|
40
40
|
export declare type BinaryFileData = {
|
|
41
|
-
mimeType: typeof
|
|
41
|
+
mimeType: ValueOf<typeof IMAGE_MIME_TYPES> | typeof MIME_TYPES.binary;
|
|
42
42
|
id: FileId;
|
|
43
43
|
dataURL: DataURL;
|
|
44
44
|
/**
|
|
@@ -63,6 +63,8 @@ export declare type LastActiveTool = {
|
|
|
63
63
|
type: "custom";
|
|
64
64
|
customType: string;
|
|
65
65
|
} | null;
|
|
66
|
+
export declare type SidebarName = string;
|
|
67
|
+
export declare type SidebarTabName = string;
|
|
66
68
|
export declare type AppState = {
|
|
67
69
|
contextMenu: {
|
|
68
70
|
items: ContextMenuItems;
|
|
@@ -125,9 +127,19 @@ export declare type AppState = {
|
|
|
125
127
|
zoom: Zoom;
|
|
126
128
|
openMenu: "canvas" | "shape" | null;
|
|
127
129
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
128
|
-
openSidebar:
|
|
130
|
+
openSidebar: {
|
|
131
|
+
name: SidebarName;
|
|
132
|
+
tab?: SidebarTabName;
|
|
133
|
+
} | null;
|
|
129
134
|
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
130
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Reflects user preference for whether the default sidebar should be docked.
|
|
137
|
+
*
|
|
138
|
+
* NOTE this is only a user preference and does not reflect the actual docked
|
|
139
|
+
* state of the sidebar, because the host apps can override this through
|
|
140
|
+
* a DefaultSidebar prop, which is not reflected back to the appState.
|
|
141
|
+
*/
|
|
142
|
+
defaultSidebarDockedPreference: boolean;
|
|
131
143
|
lastPointerDownWith: PointerType;
|
|
132
144
|
selectedElementIds: {
|
|
133
145
|
[id: string]: boolean;
|
|
@@ -186,8 +198,10 @@ export declare type AppState = {
|
|
|
186
198
|
resetCustomPen?: any;
|
|
187
199
|
gridColor: string;
|
|
188
200
|
dynamicStyle: string;
|
|
201
|
+
invertBindingBehaviour: boolean;
|
|
189
202
|
selectedLinearElement: LinearElementEditor | null;
|
|
190
203
|
};
|
|
204
|
+
export declare type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
|
|
191
205
|
export declare type NormalizedZoomValue = number & {
|
|
192
206
|
_brand: "normalizedZoom";
|
|
193
207
|
};
|
|
@@ -250,7 +264,7 @@ export interface ExcalidrawProps {
|
|
|
250
264
|
}) => void;
|
|
251
265
|
onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
|
|
252
266
|
onDrop?: (event: React.DragEvent<HTMLDivElement>) => Promise<boolean> | boolean;
|
|
253
|
-
renderTopRightUI?: (isMobile: boolean, appState:
|
|
267
|
+
renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
254
268
|
langCode?: Language["code"];
|
|
255
269
|
viewModeEnabled?: boolean;
|
|
256
270
|
zenModeEnabled?: boolean;
|
|
@@ -259,7 +273,7 @@ export interface ExcalidrawProps {
|
|
|
259
273
|
initState?: AppState;
|
|
260
274
|
theme?: Theme;
|
|
261
275
|
name?: string;
|
|
262
|
-
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState:
|
|
276
|
+
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
|
|
263
277
|
UIOptions?: Partial<UIOptions>;
|
|
264
278
|
detectScroll?: boolean;
|
|
265
279
|
handleKeyboardGlobally?: boolean;
|
|
@@ -276,10 +290,6 @@ export interface ExcalidrawProps {
|
|
|
276
290
|
onLinkHover?: (element: NonDeletedExcalidrawElement, event: React.PointerEvent<HTMLCanvasElement>) => void;
|
|
277
291
|
onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
|
|
278
292
|
onScrollChange?: (scrollX: number, scrollY: number) => void;
|
|
279
|
-
/**
|
|
280
|
-
* Render function that renders custom <Sidebar /> component.
|
|
281
|
-
*/
|
|
282
|
-
renderSidebar?: () => JSX.Element | null;
|
|
283
293
|
children?: React.ReactNode;
|
|
284
294
|
}
|
|
285
295
|
export declare type SceneData = {
|
|
@@ -295,8 +305,8 @@ export declare enum UserIdleState {
|
|
|
295
305
|
}
|
|
296
306
|
export declare type ExportOpts = {
|
|
297
307
|
saveFileToDisk?: boolean;
|
|
298
|
-
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState:
|
|
299
|
-
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState:
|
|
308
|
+
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => void;
|
|
309
|
+
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => JSX.Element;
|
|
300
310
|
};
|
|
301
311
|
declare type CanvasActions = Partial<{
|
|
302
312
|
changeViewBackgroundColor: boolean;
|
|
@@ -333,12 +343,14 @@ export declare type AppClassProperties = {
|
|
|
333
343
|
library: Library;
|
|
334
344
|
imageCache: Map<FileId, {
|
|
335
345
|
image: HTMLImageElement | Promise<HTMLImageElement>;
|
|
336
|
-
mimeType: typeof
|
|
346
|
+
mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
337
347
|
}>;
|
|
338
348
|
files: BinaryFiles;
|
|
339
349
|
device: App["device"];
|
|
340
350
|
scene: App["scene"];
|
|
341
351
|
pasteFromClipboard: App["pasteFromClipboard"];
|
|
352
|
+
id: App["id"];
|
|
353
|
+
onInsertElements: App["onInsertElements"];
|
|
342
354
|
};
|
|
343
355
|
export declare type PointerDownState = Readonly<{
|
|
344
356
|
origin: Readonly<{
|
|
@@ -431,7 +443,7 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
431
443
|
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
432
444
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
433
445
|
resetCursor: InstanceType<typeof App>["resetCursor"];
|
|
434
|
-
|
|
446
|
+
toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
|
|
435
447
|
};
|
|
436
448
|
export declare type Device = Readonly<{
|
|
437
449
|
isSmScreen: boolean;
|
package/types/utils.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">,
|
|
|
63
63
|
export declare const resetCursor: (canvas: HTMLCanvasElement | null) => void;
|
|
64
64
|
export declare const setCursor: (canvas: HTMLCanvasElement | null, cursor: string) => void;
|
|
65
65
|
export declare const setEraserCursor: (canvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
|
|
66
|
-
export declare const setCursorForShape: (canvas: HTMLCanvasElement | null, appState: AppState) => void;
|
|
66
|
+
export declare const setCursorForShape: (canvas: HTMLCanvasElement | null, appState: Pick<AppState, "activeTool" | "theme">) => void;
|
|
67
67
|
export declare const isFullScreen: () => boolean;
|
|
68
68
|
export declare const allowFullScreen: () => Promise<void>;
|
|
69
69
|
export declare const exitFullScreen: () => Promise<void>;
|
|
@@ -156,7 +156,7 @@ export declare const isPrimitive: (val: any) => boolean;
|
|
|
156
156
|
export declare const getFrame: () => "top" | "iframe";
|
|
157
157
|
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
158
158
|
export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
|
|
159
|
-
export declare const isShallowEqual: <T extends Record<string, any
|
|
159
|
+
export declare const isShallowEqual: <T extends Record<string, any>, I extends keyof T>(objA: T, objB: T, comparators?: Record<I, (a: T[I], b: T[I]) => boolean> | undefined, debug?: boolean) => boolean;
|
|
160
160
|
export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E) => void) | undefined, ourEventHandler?: ((event: E) => void) | undefined, { checkForDefaultPrevented }?: {
|
|
161
161
|
checkForDefaultPrevented?: boolean | undefined;
|
|
162
162
|
}) => (event: E) => void;
|