@dwelle/excalidraw 0.3.57 → 0.3.59
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 +1 -0
- package/README_NEXT.md +11 -0
- package/dist/excalidraw.development.js +38 -27
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionCanvas.d.ts +2 -2
- package/types/actions/actionClipboard.d.ts +13 -0
- package/types/actions/actionFinalize.d.ts +2 -2
- package/types/actions/actionToggleLock.d.ts +17 -0
- package/types/actions/index.d.ts +2 -1
- package/types/actions/shortcuts.d.ts +1 -1
- package/types/actions/types.d.ts +1 -1
- package/types/clipboard.d.ts +1 -1
- package/types/data/index.d.ts +1 -1
- package/types/data/json.d.ts +1 -0
- package/types/element/typeChecks.d.ts +3 -3
- package/types/element/types.d.ts +1 -0
- package/types/packages/excalidraw/index.d.ts +1 -1
- package/types/packages/utils.d.ts +1 -1
- package/types/utils.d.ts +1 -0
package/package.json
CHANGED
|
@@ -798,8 +798,8 @@ export declare const actionErase: {
|
|
|
798
798
|
};
|
|
799
799
|
commitToHistory: true;
|
|
800
800
|
};
|
|
801
|
-
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element
|
|
801
|
+
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
802
802
|
PanelComponent: ({ elements, appState, updateData, data }: import("react").PropsWithChildren<import("./types").PanelComponentProps>) => JSX.Element;
|
|
803
803
|
} & {
|
|
804
|
-
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element
|
|
804
|
+
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
805
805
|
};
|
|
@@ -513,3 +513,16 @@ export declare const actionCopyAsPng: {
|
|
|
513
513
|
} & {
|
|
514
514
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
515
515
|
};
|
|
516
|
+
export declare const copyText: {
|
|
517
|
+
name: "copyText";
|
|
518
|
+
trackEvent: {
|
|
519
|
+
category: "element";
|
|
520
|
+
};
|
|
521
|
+
perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
|
|
522
|
+
commitToHistory: false;
|
|
523
|
+
};
|
|
524
|
+
contextItemPredicate: (elements: readonly import("../element/types").ExcalidrawElement[], appState: import("../types").AppState) => boolean;
|
|
525
|
+
contextItemLabel: string;
|
|
526
|
+
} & {
|
|
527
|
+
keyTest?: undefined;
|
|
528
|
+
};
|
|
@@ -6,6 +6,7 @@ export declare const actionFinalize: {
|
|
|
6
6
|
perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, { canvas, focusContainer }: import("../types").AppClassProperties) => {
|
|
7
7
|
elements: import("../element/types").ExcalidrawElement[] | undefined;
|
|
8
8
|
appState: {
|
|
9
|
+
cursorButton: "up";
|
|
9
10
|
editingLinearElement: null;
|
|
10
11
|
isLoading: boolean;
|
|
11
12
|
errorMessage: string | null;
|
|
@@ -45,7 +46,6 @@ export declare const actionFinalize: {
|
|
|
45
46
|
viewBackgroundColor: string;
|
|
46
47
|
scrollX: number;
|
|
47
48
|
scrollY: number;
|
|
48
|
-
cursorButton: "up" | "down";
|
|
49
49
|
scrolledOutside: boolean;
|
|
50
50
|
name: string;
|
|
51
51
|
isResizing: boolean;
|
|
@@ -96,6 +96,7 @@ export declare const actionFinalize: {
|
|
|
96
96
|
} | {
|
|
97
97
|
elements: readonly import("../element/types").ExcalidrawElement[];
|
|
98
98
|
appState: {
|
|
99
|
+
cursorButton: "up";
|
|
99
100
|
activeTool: {
|
|
100
101
|
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
101
102
|
lastActiveToolBeforeEraser: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
|
|
@@ -139,7 +140,6 @@ export declare const actionFinalize: {
|
|
|
139
140
|
viewBackgroundColor: string;
|
|
140
141
|
scrollX: number;
|
|
141
142
|
scrollY: number;
|
|
142
|
-
cursorButton: "up" | "down";
|
|
143
143
|
scrolledOutside: boolean;
|
|
144
144
|
name: string;
|
|
145
145
|
isResizing: boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ExcalidrawElement } from "../element/types";
|
|
3
|
+
export declare const actionToggleLock: {
|
|
4
|
+
name: "toggleLock";
|
|
5
|
+
trackEvent: {
|
|
6
|
+
category: "element";
|
|
7
|
+
};
|
|
8
|
+
perform: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => false | {
|
|
9
|
+
elements: ExcalidrawElement[];
|
|
10
|
+
appState: Readonly<import("../types").AppState>;
|
|
11
|
+
commitToHistory: true;
|
|
12
|
+
};
|
|
13
|
+
contextItemLabel: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>) => "labels.elementLock.unlock" | "labels.elementLock.lock" | "labels.elementLock.lockAll" | "labels.elementLock.unlockAll";
|
|
14
|
+
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: import("../types").AppState, elements: readonly ExcalidrawElement[]) => boolean;
|
|
15
|
+
} & {
|
|
16
|
+
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>, appState: import("../types").AppState, elements: readonly ExcalidrawElement[]) => boolean) | undefined;
|
|
17
|
+
};
|
package/types/actions/index.d.ts
CHANGED
|
@@ -14,9 +14,10 @@ export { actionAddToLibrary } from "./actionAddToLibrary";
|
|
|
14
14
|
export { actionAlignTop, actionAlignBottom, actionAlignLeft, actionAlignRight, actionAlignVerticallyCentered, actionAlignHorizontallyCentered, } from "./actionAlign";
|
|
15
15
|
export { distributeHorizontally, distributeVertically, } from "./actionDistribute";
|
|
16
16
|
export { actionFlipHorizontal, actionFlipVertical } from "./actionFlip";
|
|
17
|
-
export { actionCopy, actionCut, actionCopyAsPng, actionCopyAsSvg, } from "./actionClipboard";
|
|
17
|
+
export { actionCopy, actionCut, actionCopyAsPng, actionCopyAsSvg, copyText, } from "./actionClipboard";
|
|
18
18
|
export { actionToggleGridMode } from "./actionToggleGridMode";
|
|
19
19
|
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 { actionToggleLock } from "./actionToggleLock";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ActionName } from "./types";
|
|
2
|
-
export declare type ShortcutName = SubtypeOf<ActionName, "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink">;
|
|
2
|
+
export declare type ShortcutName = SubtypeOf<ActionName, "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleLock">;
|
|
3
3
|
export declare const getShortcutFromShortcutName: (name: ShortcutName) => string;
|
package/types/actions/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare type ActionResult = {
|
|
|
15
15
|
declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
16
16
|
export declare type UpdaterFn = (res: ActionResult) => void;
|
|
17
17
|
export declare type ActionFilterFn = (action: Action) => void;
|
|
18
|
-
export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "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" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser" | "bindText";
|
|
18
|
+
export declare 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" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser" | "bindText" | "toggleLock";
|
|
19
19
|
export declare type PanelComponentProps = {
|
|
20
20
|
elements: readonly ExcalidrawElement[];
|
|
21
21
|
appState: AppState;
|
package/types/clipboard.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawEl
|
|
|
16
16
|
* Attempts to parse clipboard. Prefers system clipboard.
|
|
17
17
|
*/
|
|
18
18
|
export declare const parseClipboard: (event: ClipboardEvent | null) => Promise<ClipboardData>;
|
|
19
|
-
export declare const copyBlobToClipboardAsPng: (blob: Blob) => Promise<void>;
|
|
19
|
+
export declare const copyBlobToClipboardAsPng: (blob: Blob | Promise<Blob>) => Promise<void>;
|
|
20
20
|
export declare const copyTextToSystemClipboard: (text: string | null) => Promise<void>;
|
package/types/data/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AppState, BinaryFiles } from "../types";
|
|
|
4
4
|
import { FileSystemHandle } from "./filesystem";
|
|
5
5
|
export { loadFromBlob } from "./blob";
|
|
6
6
|
export { loadFromJSON, saveAsJSON } from "./json";
|
|
7
|
-
export declare const exportCanvas: (type: ExportType, elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, }: {
|
|
7
|
+
export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, }: {
|
|
8
8
|
exportBackground: boolean;
|
|
9
9
|
exportPadding?: number | undefined;
|
|
10
10
|
viewBackgroundColor: string;
|
package/types/data/json.d.ts
CHANGED
|
@@ -13,5 +13,6 @@ export declare const isValidExcalidrawData: (data?: {
|
|
|
13
13
|
appState?: any;
|
|
14
14
|
} | undefined) => data is ImportedDataState;
|
|
15
15
|
export declare const isValidLibrary: (json: any) => any;
|
|
16
|
+
export declare const serializeLibraryAsJSON: (libraryItems: LibraryItems) => string;
|
|
16
17
|
export declare const saveLibraryAsJSON: (libraryItems: LibraryItems) => Promise<void>;
|
|
17
18
|
export declare const importLibraryFromJSON: (library: Library) => Promise<void>;
|
|
@@ -8,10 +8,10 @@ export declare const isFreeDrawElement: (element?: ExcalidrawElement | null | un
|
|
|
8
8
|
export declare const isFreeDrawElementType: (elementType: ExcalidrawElement["type"]) => boolean;
|
|
9
9
|
export declare const isLinearElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
10
10
|
export declare const isLinearElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
11
|
-
export declare const isBindingElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
11
|
+
export declare const isBindingElement: (element?: ExcalidrawElement | null | undefined, includeLocked?: boolean) => element is ExcalidrawLinearElement;
|
|
12
12
|
export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
13
|
-
export declare const isBindableElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
|
|
14
|
-
export declare const isTextBindableContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextContainer;
|
|
13
|
+
export declare const isBindableElement: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawBindableElement;
|
|
14
|
+
export declare const isTextBindableContainer: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawTextContainer;
|
|
15
15
|
export declare const isExcalidrawElement: (element: any) => boolean;
|
|
16
16
|
export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
|
|
17
17
|
export declare const isBoundToContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextElementWithContainer;
|
package/types/element/types.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ declare type _ExcalidrawElementBase = Readonly<{
|
|
|
52
52
|
/** epoch (ms) timestamp of last element update */
|
|
53
53
|
updated: number;
|
|
54
54
|
link: string | null;
|
|
55
|
+
locked: boolean;
|
|
55
56
|
}>;
|
|
56
57
|
export declare type ExcalidrawSelectionElement = _ExcalidrawElementBase & {
|
|
57
58
|
type: "selection";
|
|
@@ -9,7 +9,7 @@ export default _default;
|
|
|
9
9
|
export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
|
|
10
10
|
export { defaultLang, languages } from "../../i18n";
|
|
11
11
|
export { restore, restoreElements, restoreAppState } from "../../data/restore";
|
|
12
|
-
export { exportToBlob, exportToCanvas, exportToSvg, serializeAsJSON, loadLibraryFromBlob, loadFromBlob, getFreeDrawSvgPath, } from "../../packages/utils";
|
|
12
|
+
export { exportToBlob, exportToCanvas, exportToSvg, serializeAsJSON, serializeLibraryAsJSON, loadLibraryFromBlob, loadFromBlob, getFreeDrawSvgPath, } from "../../packages/utils";
|
|
13
13
|
export { isLinearElement } from "../../element/typeChecks";
|
|
14
14
|
export { mutateElement, newElementWith, bumpVersion, } from "../../element/mutateElement";
|
|
15
15
|
export { FONT_FAMILY, THEME } from "../../constants";
|
|
@@ -19,10 +19,10 @@ export declare const exportToBlob: (opts: ExportOpts & {
|
|
|
19
19
|
export declare const exportToSvg: ({ elements, appState, files, exportPadding, }: Omit<ExportOpts, "getDimensions"> & {
|
|
20
20
|
exportPadding?: number | undefined;
|
|
21
21
|
}) => Promise<SVGSVGElement>;
|
|
22
|
+
export { serializeAsJSON, serializeLibraryAsJSON } from "../data/json";
|
|
22
23
|
export declare const exportToClipboard: (opts: ExportOpts & {
|
|
23
24
|
mimeType?: string;
|
|
24
25
|
quality?: number;
|
|
25
26
|
}) => Promise<void>;
|
|
26
|
-
export { serializeAsJSON } from "../data/json";
|
|
27
27
|
export { loadFromBlob, loadLibraryFromBlob } from "../data/blob";
|
|
28
28
|
export { getFreeDrawSvgPath } from "../renderer/renderElement";
|
package/types/utils.d.ts
CHANGED
|
@@ -120,3 +120,4 @@ export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) =
|
|
|
120
120
|
export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
|
|
121
121
|
export declare const isPrimitive: (val: any) => boolean;
|
|
122
122
|
export declare const getFrame: () => "top" | "iframe";
|
|
123
|
+
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|