@excalidraw/excalidraw 0.16.1-6920-3a6028b → 0.16.1-7248-caa89f0
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 +46 -2
- package/dist/excalidraw-assets/{vendor-2846daa016c867f96ee4.js → vendor-0452b0f95a04b9622103.js} +2 -2
- package/dist/excalidraw-assets-dev/{vendor-537f046869926dc3235f.js → vendor-0245ced0183e80375e32.js} +7 -7
- package/dist/excalidraw-with-preact.development.js +5883 -0
- package/dist/excalidraw-with-preact.production.min.js +2 -0
- package/dist/excalidraw-with-preact.production.min.js.LICENSE.txt +21 -0
- package/dist/excalidraw.development.js +166 -177
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +0 -10
- package/main.js +7 -1
- package/package.json +2 -2
- package/types/actions/actionCanvas.d.ts +1 -1
- package/types/actions/actionClipboard.d.ts +251 -8
- package/types/actions/actionExport.d.ts +1 -1
- package/types/actions/actionGroup.d.ts +3 -3
- package/types/actions/actionMenu.d.ts +0 -13
- package/types/actions/index.d.ts +1 -1
- package/types/actions/manager.d.ts +1 -1
- package/types/appState.d.ts +1 -1
- package/types/clipboard.d.ts +21 -3
- package/types/components/Actions.d.ts +3 -2
- package/types/components/App.d.ts +19 -13
- package/types/components/ContextMenu.d.ts +2 -1
- package/types/components/ImageExportDialog.d.ts +1 -1
- package/types/components/LayerUI.d.ts +1 -1
- package/types/components/MobileMenu.d.ts +4 -3
- package/types/constants.d.ts +7 -1
- package/types/data/index.d.ts +10 -2
- package/types/data/transform.d.ts +6 -2
- package/types/element/embeddable.d.ts +1 -1
- package/types/element/newElement.d.ts +3 -1
- package/types/element/typeChecks.d.ts +1 -1
- package/types/errors.d.ts +5 -0
- package/types/frame.d.ts +11 -1
- package/types/packages/excalidraw/dist/excalidraw-with-preact.development.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-with-preact.production.min.d.ts +1 -0
- package/types/packages/excalidraw/dist/excalidraw.development.d.ts +2 -2
- package/types/packages/excalidraw/index.d.ts +3 -3
- package/types/packages/excalidraw/webpack.preact.config.d.ts +171 -0
- package/types/packages/utils.d.ts +4 -3
- package/types/packages/withinBounds.d.ts +2 -2
- package/types/renderer/renderElement.d.ts +5 -1
- package/types/renderer/renderScene.d.ts +5 -5
- package/types/scene/Scene.d.ts +7 -2
- package/types/scene/export.d.ts +5 -6
- package/types/types.d.ts +16 -16
- package/types/utils.d.ts +8 -1
- /package/dist/excalidraw-assets/{vendor-2846daa016c867f96ee4.js.LICENSE.txt → vendor-0452b0f95a04b9622103.js.LICENSE.txt} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-2846daa016c867f96ee4.d.ts → vendor-0452b0f95a04b9622103.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-537f046869926dc3235f.d.ts → vendor-0245ced0183e80375e32.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { AppClassProperties, AppState, Device, ExcalidrawProps, UIAppState } from "../types";
|
|
2
|
+
import { AppClassProperties, AppProps, AppState, Device, ExcalidrawProps, UIAppState } from "../types";
|
|
3
3
|
import { ActionManager } from "../actions/manager";
|
|
4
4
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
5
5
|
type MobileMenuProps = {
|
|
@@ -11,13 +11,14 @@ type MobileMenuProps = {
|
|
|
11
11
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
12
12
|
onLockToggle: () => void;
|
|
13
13
|
onHandToolToggle: () => void;
|
|
14
|
-
onPenModeToggle:
|
|
14
|
+
onPenModeToggle: AppClassProperties["togglePenMode"];
|
|
15
15
|
renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
16
16
|
renderCustomStats?: ExcalidrawProps["renderCustomStats"];
|
|
17
17
|
renderSidebars: () => JSX.Element | null;
|
|
18
18
|
device: Device;
|
|
19
19
|
renderWelcomeScreen: boolean;
|
|
20
|
+
UIOptions: AppProps["UIOptions"];
|
|
20
21
|
app: AppClassProperties;
|
|
21
22
|
};
|
|
22
|
-
export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, app, }: MobileMenuProps) => JSX.Element;
|
|
23
|
+
export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, UIOptions, app, }: MobileMenuProps) => JSX.Element;
|
|
23
24
|
export {};
|
package/types/constants.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export declare const FONT_FAMILY: {
|
|
|
84
84
|
Virgil: number;
|
|
85
85
|
Helvetica: number;
|
|
86
86
|
Cascadia: number;
|
|
87
|
+
Assistant: number;
|
|
87
88
|
};
|
|
88
89
|
export declare const THEME: {
|
|
89
90
|
readonly LIGHT: "light";
|
|
@@ -101,6 +102,11 @@ export declare const FRAME_STYLE: {
|
|
|
101
102
|
} | null;
|
|
102
103
|
backgroundColor: string;
|
|
103
104
|
radius: number;
|
|
105
|
+
nameOffsetY: number;
|
|
106
|
+
nameColorLightTheme: string;
|
|
107
|
+
nameColorDarkTheme: string;
|
|
108
|
+
nameFontSize: number;
|
|
109
|
+
nameLineHeight: number;
|
|
104
110
|
};
|
|
105
111
|
export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
|
|
106
112
|
export declare const MIN_FONT_SIZE = 1;
|
|
@@ -122,6 +128,7 @@ export declare const IMAGE_MIME_TYPES: {
|
|
|
122
128
|
readonly avif: "image/avif";
|
|
123
129
|
readonly jfif: "image/jfif";
|
|
124
130
|
};
|
|
131
|
+
export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html"];
|
|
125
132
|
export declare const MIME_TYPES: {
|
|
126
133
|
readonly svg: "image/svg+xml";
|
|
127
134
|
readonly png: "image/png";
|
|
@@ -170,7 +177,6 @@ export declare const URL_HASH_KEYS: {
|
|
|
170
177
|
readonly addLibrary: "addLibrary";
|
|
171
178
|
};
|
|
172
179
|
export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
|
|
173
|
-
export declare const MQ_SM_MAX_WIDTH = 640;
|
|
174
180
|
export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
|
|
175
181
|
export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
|
|
176
182
|
export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
|
package/types/data/index.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawFrameElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { ExportType } from "../scene/types";
|
|
3
3
|
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
|
|
7
|
+
export type ExportedElements = readonly NonDeletedExcalidrawElement[] & {
|
|
8
|
+
_brand: "exportedElements";
|
|
9
|
+
};
|
|
10
|
+
export declare const prepareElementsForExport: (elements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
|
|
11
|
+
exportingFrame: ExcalidrawFrameElement | null;
|
|
12
|
+
exportedElements: ExportedElements;
|
|
13
|
+
};
|
|
14
|
+
export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, exportingFrame, }: {
|
|
8
15
|
exportBackground: boolean;
|
|
9
16
|
exportPadding?: number | undefined;
|
|
10
17
|
viewBackgroundColor: string;
|
|
11
18
|
name: string;
|
|
12
19
|
fileHandle?: FileSystemHandle | null | undefined;
|
|
20
|
+
exportingFrame: ExcalidrawFrameElement | null;
|
|
13
21
|
}) => Promise<FileSystemHandle | null | undefined>;
|
|
@@ -52,7 +52,7 @@ export type ValidContainer = {
|
|
|
52
52
|
verticalAlign?: VerticalAlign;
|
|
53
53
|
} & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
54
54
|
} & ElementConstructorOpts;
|
|
55
|
-
export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawEmbeddableElement | ExcalidrawFreeDrawElement
|
|
55
|
+
export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawEmbeddableElement | ExcalidrawFreeDrawElement> | ({
|
|
56
56
|
type: Extract<ExcalidrawLinearElement["type"], "line">;
|
|
57
57
|
x: number;
|
|
58
58
|
y: number;
|
|
@@ -67,7 +67,11 @@ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, Excal
|
|
|
67
67
|
x: number;
|
|
68
68
|
y: number;
|
|
69
69
|
fileId: FileId;
|
|
70
|
-
} & Partial<ExcalidrawImageElement>)
|
|
70
|
+
} & Partial<ExcalidrawImageElement>) | ({
|
|
71
|
+
type: "frame";
|
|
72
|
+
children: readonly ExcalidrawElement["id"][];
|
|
73
|
+
name?: string;
|
|
74
|
+
} & Partial<ExcalidrawFrameElement>);
|
|
71
75
|
export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
|
|
72
76
|
regenerateIds: boolean;
|
|
73
77
|
}) => ExcalidrawElement[];
|
|
@@ -14,7 +14,7 @@ type EmbeddedLink = ({
|
|
|
14
14
|
srcdoc: (theme: Theme) => string;
|
|
15
15
|
})) | null;
|
|
16
16
|
export declare const getEmbedLink: (link: string | null | undefined) => EmbeddedLink;
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const isEmbeddableOrLabel: (element: NonDeletedExcalidrawElement) => Boolean;
|
|
18
18
|
export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawEmbeddableElement) => ExcalidrawElement;
|
|
19
19
|
export declare const actionSetEmbeddableAsActiveTool: {
|
|
20
20
|
name: "setEmbeddableAsActiveTool";
|
|
@@ -9,7 +9,9 @@ export declare const newEmbeddableElement: (opts: {
|
|
|
9
9
|
type: "embeddable";
|
|
10
10
|
validated: ExcalidrawEmbeddableElement["validated"];
|
|
11
11
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawEmbeddableElement>;
|
|
12
|
-
export declare const newFrameElement: (opts:
|
|
12
|
+
export declare const newFrameElement: (opts: {
|
|
13
|
+
name?: string;
|
|
14
|
+
} & ElementConstructorOpts) => NonDeleted<ExcalidrawFrameElement>;
|
|
13
15
|
export declare const newTextElement: (opts: {
|
|
14
16
|
text: string;
|
|
15
17
|
fontSize?: number;
|
|
@@ -16,7 +16,7 @@ export declare const isBindingElement: (element?: ExcalidrawElement | null, incl
|
|
|
16
16
|
export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
|
|
17
17
|
export declare const isBindableElement: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawBindableElement;
|
|
18
18
|
export declare const isTextBindableContainer: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawTextContainer;
|
|
19
|
-
export declare const isExcalidrawElement: (element: any) =>
|
|
19
|
+
export declare const isExcalidrawElement: (element: any) => element is ExcalidrawElement;
|
|
20
20
|
export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is MarkNonNullable<ExcalidrawBindableElement, "boundElements">;
|
|
21
21
|
export declare const isBoundToContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextElementWithContainer;
|
|
22
22
|
export declare const isUsingAdaptiveRadius: (type: string) => boolean;
|
package/types/errors.d.ts
CHANGED
|
@@ -5,4 +5,9 @@ export declare class CanvasError extends Error {
|
|
|
5
5
|
export declare class AbortError extends DOMException {
|
|
6
6
|
constructor(message?: string);
|
|
7
7
|
}
|
|
8
|
+
type ImageSceneDataErrorCode = "IMAGE_NOT_CONTAINS_SCENE_DATA" | "IMAGE_SCENE_DATA_ERROR";
|
|
9
|
+
export declare class ImageSceneDataError extends Error {
|
|
10
|
+
code: ImageSceneDataErrorCode;
|
|
11
|
+
constructor(message?: string, code?: ImageSceneDataErrorCode);
|
|
12
|
+
}
|
|
8
13
|
export {};
|
package/types/frame.d.ts
CHANGED
|
@@ -18,7 +18,17 @@ export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDelet
|
|
|
18
18
|
* Returns a map of frameId to frame elements. Includes empty frames.
|
|
19
19
|
*/
|
|
20
20
|
export declare const groupByFrames: (elements: readonly ExcalidrawElement[]) => Map<string, ExcalidrawElement[]>;
|
|
21
|
-
export declare const
|
|
21
|
+
export declare const getFrameChildren: (allElements: ExcalidrawElementsIncludingDeleted, frameId: string) => ExcalidrawElement[];
|
|
22
|
+
export declare const getFrameElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawFrameElement[];
|
|
23
|
+
/**
|
|
24
|
+
* Returns ExcalidrawFrameElements and non-frame-children elements.
|
|
25
|
+
*
|
|
26
|
+
* Considers children as root elements if they point to a frame parent
|
|
27
|
+
* non-existing in the elements set.
|
|
28
|
+
*
|
|
29
|
+
* Considers non-frame bound elements (container or arrow labels) as root.
|
|
30
|
+
*/
|
|
31
|
+
export declare const getRootElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawElement[];
|
|
22
32
|
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
|
23
33
|
export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
24
34
|
export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) => ExcalidrawFrameElement | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ExcalidrawLib: {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export =
|
|
2
|
-
export =
|
|
1
|
+
export = __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__;
|
|
2
|
+
export = __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "../../css/app.scss";
|
|
3
3
|
import "../../css/styles.scss";
|
|
4
|
-
import {
|
|
4
|
+
import { ExcalidrawProps } from "../../types";
|
|
5
5
|
import Footer from "../../components/footer/FooterCenter";
|
|
6
6
|
import MainMenu from "../../components/main-menu/MainMenu";
|
|
7
7
|
import WelcomeScreen from "../../components/welcome-screen/WelcomeScreen";
|
|
8
8
|
import LiveCollaborationTrigger from "../../components/live-collaboration/LiveCollaborationTrigger";
|
|
9
|
-
|
|
10
|
-
export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
|
|
9
|
+
export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawProps) => JSX.Element>;
|
|
11
10
|
export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
|
|
12
11
|
export { defaultLang, useI18n, languages } from "../../i18n";
|
|
13
12
|
export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "../../data/restore";
|
|
@@ -27,4 +26,5 @@ export { LiveCollaborationTrigger };
|
|
|
27
26
|
export { DefaultSidebar } from "../../components/DefaultSidebar";
|
|
28
27
|
export { normalizeLink } from "../../data/url";
|
|
29
28
|
export { convertToExcalidrawElements } from "../../data/transform";
|
|
29
|
+
export { getCommonBounds } from "../../element/bounds";
|
|
30
30
|
export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "../withinBounds";
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
mode: string;
|
|
3
|
+
devtool: boolean;
|
|
4
|
+
entry: {
|
|
5
|
+
"excalidraw.development": string;
|
|
6
|
+
};
|
|
7
|
+
output: {
|
|
8
|
+
path: string;
|
|
9
|
+
library: string;
|
|
10
|
+
libraryTarget: string;
|
|
11
|
+
filename: string;
|
|
12
|
+
chunkFilename: string;
|
|
13
|
+
assetModuleFilename: string;
|
|
14
|
+
publicPath: string;
|
|
15
|
+
};
|
|
16
|
+
resolve: {
|
|
17
|
+
extensions: string[];
|
|
18
|
+
};
|
|
19
|
+
module: {
|
|
20
|
+
rules: ({
|
|
21
|
+
test: RegExp;
|
|
22
|
+
exclude: RegExp;
|
|
23
|
+
use: (string | {
|
|
24
|
+
loader: string;
|
|
25
|
+
} | {
|
|
26
|
+
loader: string;
|
|
27
|
+
options: {
|
|
28
|
+
postcssOptions: {
|
|
29
|
+
plugins: (import("postcss").Plugin & import("autoprefixer").ExportedAPI)[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
})[];
|
|
33
|
+
} | {
|
|
34
|
+
test: RegExp;
|
|
35
|
+
resolve: {
|
|
36
|
+
fullySpecified: boolean;
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
test: RegExp;
|
|
40
|
+
exclude: RegExp;
|
|
41
|
+
use: ({
|
|
42
|
+
loader: string;
|
|
43
|
+
} | {
|
|
44
|
+
loader: string;
|
|
45
|
+
options: {
|
|
46
|
+
transpileOnly: boolean;
|
|
47
|
+
configFile: string;
|
|
48
|
+
};
|
|
49
|
+
})[];
|
|
50
|
+
} | {
|
|
51
|
+
test: RegExp;
|
|
52
|
+
type: string;
|
|
53
|
+
})[];
|
|
54
|
+
};
|
|
55
|
+
optimization: {
|
|
56
|
+
splitChunks: {
|
|
57
|
+
chunks: string;
|
|
58
|
+
cacheGroups: {
|
|
59
|
+
vendors: {
|
|
60
|
+
test: RegExp;
|
|
61
|
+
name: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
plugins: (import("webpack").EvalSourceMapDevToolPlugin | import("webpack").DefinePlugin)[];
|
|
67
|
+
externals: {
|
|
68
|
+
react: {
|
|
69
|
+
root: string;
|
|
70
|
+
commonjs2: string;
|
|
71
|
+
commonjs: string;
|
|
72
|
+
amd: string;
|
|
73
|
+
};
|
|
74
|
+
"react-dom": {
|
|
75
|
+
root: string;
|
|
76
|
+
commonjs2: string;
|
|
77
|
+
commonjs: string;
|
|
78
|
+
amd: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
} | {
|
|
82
|
+
mode: string;
|
|
83
|
+
entry: {
|
|
84
|
+
"excalidraw.production.min": string;
|
|
85
|
+
};
|
|
86
|
+
output: {
|
|
87
|
+
path: string;
|
|
88
|
+
library: string;
|
|
89
|
+
libraryTarget: string;
|
|
90
|
+
filename: string;
|
|
91
|
+
chunkFilename: string;
|
|
92
|
+
assetModuleFilename: string;
|
|
93
|
+
publicPath: string;
|
|
94
|
+
};
|
|
95
|
+
resolve: {
|
|
96
|
+
extensions: string[];
|
|
97
|
+
};
|
|
98
|
+
module: {
|
|
99
|
+
rules: ({
|
|
100
|
+
test: RegExp;
|
|
101
|
+
exclude: RegExp;
|
|
102
|
+
use: (string | {
|
|
103
|
+
loader: string;
|
|
104
|
+
} | {
|
|
105
|
+
loader: string;
|
|
106
|
+
options: {
|
|
107
|
+
postcssOptions: {
|
|
108
|
+
plugins: (import("postcss").Plugin & import("autoprefixer").ExportedAPI)[];
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
})[];
|
|
112
|
+
} | {
|
|
113
|
+
test: RegExp;
|
|
114
|
+
resolve: {
|
|
115
|
+
fullySpecified: boolean;
|
|
116
|
+
};
|
|
117
|
+
} | {
|
|
118
|
+
test: RegExp;
|
|
119
|
+
exclude: RegExp;
|
|
120
|
+
use: ({
|
|
121
|
+
loader: string;
|
|
122
|
+
} | {
|
|
123
|
+
loader: string;
|
|
124
|
+
options: {
|
|
125
|
+
transpileOnly: boolean;
|
|
126
|
+
configFile: string;
|
|
127
|
+
};
|
|
128
|
+
} | {
|
|
129
|
+
loader: string;
|
|
130
|
+
options: {
|
|
131
|
+
presets: (string | (string | {
|
|
132
|
+
runtime: string;
|
|
133
|
+
})[])[];
|
|
134
|
+
plugins: string[];
|
|
135
|
+
};
|
|
136
|
+
})[];
|
|
137
|
+
} | {
|
|
138
|
+
test: RegExp;
|
|
139
|
+
type: string;
|
|
140
|
+
})[];
|
|
141
|
+
};
|
|
142
|
+
optimization: {
|
|
143
|
+
minimize: boolean;
|
|
144
|
+
minimizer: import("terser-webpack-plugin")<import("terser").MinifyOptions>[];
|
|
145
|
+
splitChunks: {
|
|
146
|
+
chunks: string;
|
|
147
|
+
cacheGroups: {
|
|
148
|
+
vendors: {
|
|
149
|
+
test: RegExp;
|
|
150
|
+
name: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
plugins: any[];
|
|
156
|
+
externals: {
|
|
157
|
+
react: {
|
|
158
|
+
root: string;
|
|
159
|
+
commonjs2: string;
|
|
160
|
+
commonjs: string;
|
|
161
|
+
amd: string;
|
|
162
|
+
};
|
|
163
|
+
"react-dom": {
|
|
164
|
+
root: string;
|
|
165
|
+
commonjs2: string;
|
|
166
|
+
commonjs: string;
|
|
167
|
+
amd: string;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
export = _exports;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppState, BinaryFiles } from "../types";
|
|
2
|
-
import { ExcalidrawElement, NonDeleted } from "../element/types";
|
|
2
|
+
import { ExcalidrawElement, ExcalidrawFrameElement, NonDeleted } from "../element/types";
|
|
3
3
|
import { MIME_TYPES } from "../constants";
|
|
4
4
|
export { MIME_TYPES };
|
|
5
5
|
type ExportOpts = {
|
|
@@ -7,13 +7,14 @@ type ExportOpts = {
|
|
|
7
7
|
appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
|
|
8
8
|
files: BinaryFiles | null;
|
|
9
9
|
maxWidthOrHeight?: number;
|
|
10
|
+
exportingFrame?: ExcalidrawFrameElement | null;
|
|
10
11
|
getDimensions?: (width: number, height: number) => {
|
|
11
12
|
width: number;
|
|
12
13
|
height: number;
|
|
13
14
|
scale?: number;
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
|
-
export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, exportPadding, }: ExportOpts & {
|
|
17
|
+
export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, exportPadding, exportingFrame, }: ExportOpts & {
|
|
17
18
|
exportPadding?: number | undefined;
|
|
18
19
|
}) => Promise<HTMLCanvasElement>;
|
|
19
20
|
export declare const exportToBlob: (opts: ExportOpts & {
|
|
@@ -21,7 +22,7 @@ export declare const exportToBlob: (opts: ExportOpts & {
|
|
|
21
22
|
quality?: number;
|
|
22
23
|
exportPadding?: number;
|
|
23
24
|
}) => Promise<Blob>;
|
|
24
|
-
export declare const exportToSvg: ({ elements, appState, files, exportPadding, renderEmbeddables, }: Omit<ExportOpts, "getDimensions"> & {
|
|
25
|
+
export declare const exportToSvg: ({ elements, appState, files, exportPadding, renderEmbeddables, exportingFrame, }: Omit<ExportOpts, "getDimensions"> & {
|
|
25
26
|
exportPadding?: number | undefined;
|
|
26
27
|
renderEmbeddables?: boolean | undefined;
|
|
27
28
|
}) => Promise<SVGSVGElement>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NonDeletedExcalidrawElement } from "../element/types";
|
|
1
|
+
import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { Bounds } from "../element/bounds";
|
|
3
3
|
type Element = NonDeletedExcalidrawElement;
|
|
4
4
|
type Elements = readonly NonDeletedExcalidrawElement[];
|
|
@@ -6,7 +6,7 @@ export declare const isElementInsideBBox: (element: Element, bbox: Bounds, eithe
|
|
|
6
6
|
export declare const elementPartiallyOverlapsWithOrContainsBBox: (element: Element, bbox: Bounds) => boolean;
|
|
7
7
|
export declare const elementsOverlappingBBox: ({ elements, bounds, type, errorMargin, }: {
|
|
8
8
|
elements: Elements;
|
|
9
|
-
bounds: Bounds;
|
|
9
|
+
bounds: Bounds | ExcalidrawElement;
|
|
10
10
|
/** safety offset. Defaults to 0. */
|
|
11
11
|
errorMargin?: number | undefined;
|
|
12
12
|
/**
|
|
@@ -18,7 +18,11 @@ export declare const DEFAULT_LINK_SIZE = 14;
|
|
|
18
18
|
export declare const elementWithCanvasCache: WeakMap<ExcalidrawElement, ExcalidrawElementWithCanvas>;
|
|
19
19
|
export declare const renderSelectionElement: (element: NonDeletedExcalidrawElement, context: CanvasRenderingContext2D, appState: InteractiveCanvasAppState) => void;
|
|
20
20
|
export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
|
|
21
|
-
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number,
|
|
21
|
+
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, renderConfig: {
|
|
22
|
+
exportWithDarkMode: boolean;
|
|
23
|
+
renderEmbeddables: boolean;
|
|
24
|
+
frameRendering: AppState["frameRendering"];
|
|
25
|
+
}) => void;
|
|
22
26
|
export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
|
|
23
27
|
export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
|
|
24
28
|
export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RoughSVG } from "roughjs/bin/svg";
|
|
2
|
-
import { BinaryFiles } from "../types";
|
|
2
|
+
import { BinaryFiles, AppState } from "../types";
|
|
3
3
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
4
4
|
import { InteractiveSceneRenderConfig, StaticSceneRenderConfig } from "../scene/types";
|
|
5
5
|
import "canvas-roundrect-polyfill";
|
|
@@ -22,10 +22,10 @@ export declare const renderInteractiveScene: <U extends ({ canvas, elements, vis
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const renderStaticScene: (renderConfig: StaticSceneRenderConfig, throttle?: boolean) => void;
|
|
24
24
|
export declare const cancelRender: () => void;
|
|
25
|
-
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode,
|
|
25
|
+
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, renderEmbeddables, frameRendering, }: {
|
|
26
26
|
offsetX?: number | undefined;
|
|
27
27
|
offsetY?: number | undefined;
|
|
28
|
-
exportWithDarkMode
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
exportWithDarkMode: boolean;
|
|
29
|
+
renderEmbeddables: boolean;
|
|
30
|
+
frameRendering: AppState["frameRendering"];
|
|
31
31
|
}) => void;
|
package/types/scene/Scene.d.ts
CHANGED
|
@@ -9,7 +9,12 @@ export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
|
|
|
9
9
|
declare class Scene {
|
|
10
10
|
private static sceneMapByElement;
|
|
11
11
|
private static sceneMapById;
|
|
12
|
-
static mapElementToScene(elementKey: ElementKey, scene: Scene
|
|
12
|
+
static mapElementToScene(elementKey: ElementKey, scene: Scene,
|
|
13
|
+
/**
|
|
14
|
+
* needed because of frame exporting hack.
|
|
15
|
+
* elementId:Scene mapping will be removed completely, soon.
|
|
16
|
+
*/
|
|
17
|
+
mapElementIds?: boolean): void;
|
|
13
18
|
static getScene(elementKey: ElementKey): Scene | null;
|
|
14
19
|
private callbacks;
|
|
15
20
|
private nonDeletedElements;
|
|
@@ -50,7 +55,7 @@ declare class Scene {
|
|
|
50
55
|
* @returns whether a change was made
|
|
51
56
|
*/
|
|
52
57
|
mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
|
|
53
|
-
replaceAllElements(nextElements: readonly ExcalidrawElement[]): void;
|
|
58
|
+
replaceAllElements(nextElements: readonly ExcalidrawElement[], mapElementIds?: boolean): void;
|
|
54
59
|
informMutation(): void;
|
|
55
60
|
addCallback(cb: SceneStateCallback): SceneStateCallbackRemover;
|
|
56
61
|
destroy(): void;
|
package/types/scene/export.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
1
|
+
import { ExcalidrawFrameElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, BinaryFiles } from "../types";
|
|
3
|
-
|
|
4
|
-
export declare const SVG_EXPORT_TAG = "<!-- svg-source:excalidraw -->";
|
|
5
|
-
export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, }: {
|
|
3
|
+
export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, exportingFrame, }: {
|
|
6
4
|
exportBackground: boolean;
|
|
7
5
|
exportPadding?: number | undefined;
|
|
8
6
|
viewBackgroundColor: string;
|
|
7
|
+
exportingFrame?: ExcalidrawFrameElement | null | undefined;
|
|
9
8
|
}, createCanvas?: (width: number, height: number) => {
|
|
10
9
|
canvas: HTMLCanvasElement;
|
|
11
10
|
scale: number;
|
|
@@ -17,9 +16,9 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
17
16
|
viewBackgroundColor: string;
|
|
18
17
|
exportWithDarkMode?: boolean;
|
|
19
18
|
exportEmbedScene?: boolean;
|
|
20
|
-
|
|
19
|
+
frameRendering?: AppState["frameRendering"];
|
|
21
20
|
}, files: BinaryFiles | null, opts?: {
|
|
22
|
-
serializeAsJSON?: () => string;
|
|
23
21
|
renderEmbeddables?: boolean;
|
|
22
|
+
exportingFrame?: ExcalidrawFrameElement | null;
|
|
24
23
|
}) => Promise<SVGSVGElement>;
|
|
25
24
|
export declare const getExportSize: (elements: readonly NonDeletedExcalidrawElement[], exportPadding: number, scale: number) => [number, number];
|
package/types/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { LinearElementEditor } from "./element/linearElementEditor";
|
|
|
5
5
|
import { SuggestedBinding } from "./element/binding";
|
|
6
6
|
import { ImportedDataState } from "./data/types";
|
|
7
7
|
import type App from "./components/App";
|
|
8
|
-
import type {
|
|
8
|
+
import type { throttleRAF } from "./utils";
|
|
9
9
|
import { Spreadsheet } from "./charts";
|
|
10
10
|
import { Language } from "./i18n";
|
|
11
11
|
import { ClipboardData } from "./clipboard";
|
|
@@ -16,7 +16,7 @@ import type { FileSystemHandle } from "./data/filesystem";
|
|
|
16
16
|
import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
|
17
17
|
import { ContextMenuItems } from "./components/ContextMenu";
|
|
18
18
|
import { SnapLine } from "./snapping";
|
|
19
|
-
import { Merge,
|
|
19
|
+
import { Merge, ValueOf } from "./utility-types";
|
|
20
20
|
export type Point = Readonly<RoughPoint>;
|
|
21
21
|
export type Collaborator = {
|
|
22
22
|
pointer?: CollaboratorPointer;
|
|
@@ -283,17 +283,13 @@ export type LibraryItem = {
|
|
|
283
283
|
export type LibraryItems = readonly LibraryItem[];
|
|
284
284
|
export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
|
|
285
285
|
export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>) | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>;
|
|
286
|
-
export type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
|
|
287
|
-
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
288
|
-
ready?: false;
|
|
289
|
-
};
|
|
290
286
|
export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
|
|
291
287
|
libraryItems?: Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>;
|
|
292
288
|
}>;
|
|
293
289
|
export interface ExcalidrawProps {
|
|
294
290
|
onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
295
291
|
initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
|
|
296
|
-
|
|
292
|
+
excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
|
|
297
293
|
isCollaborating?: boolean;
|
|
298
294
|
onPointerUpdate?: (payload: {
|
|
299
295
|
pointer: {
|
|
@@ -346,7 +342,7 @@ export type ExportOpts = {
|
|
|
346
342
|
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => void;
|
|
347
343
|
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
|
|
348
344
|
};
|
|
349
|
-
type CanvasActions = Partial<{
|
|
345
|
+
export type CanvasActions = Partial<{
|
|
350
346
|
changeViewBackgroundColor: boolean;
|
|
351
347
|
clearCanvas: boolean;
|
|
352
348
|
export: false | ExportOpts;
|
|
@@ -355,9 +351,12 @@ type CanvasActions = Partial<{
|
|
|
355
351
|
toggleTheme: boolean | null;
|
|
356
352
|
saveAsImage: boolean;
|
|
357
353
|
}>;
|
|
358
|
-
type UIOptions = Partial<{
|
|
354
|
+
export type UIOptions = Partial<{
|
|
359
355
|
dockedSidebarBreakpoint: number;
|
|
360
356
|
canvasActions: CanvasActions;
|
|
357
|
+
tools: {
|
|
358
|
+
image: boolean;
|
|
359
|
+
};
|
|
361
360
|
/** @deprecated does nothing. Will be removed in 0.15 */
|
|
362
361
|
welcomeScreen?: boolean;
|
|
363
362
|
}>;
|
|
@@ -395,7 +394,6 @@ export type AppClassProperties = {
|
|
|
395
394
|
lastViewportPosition: App["lastViewportPosition"];
|
|
396
395
|
scrollToContent: App["scrollToContent"];
|
|
397
396
|
addFiles: App["addFiles"];
|
|
398
|
-
setSelection: App["setSelection"];
|
|
399
397
|
addElementsFromPasteOrLibrary: App["addElementsFromPasteOrLibrary"];
|
|
400
398
|
togglePenMode: App["togglePenMode"];
|
|
401
399
|
setActiveTool: App["setActiveTool"];
|
|
@@ -476,8 +474,6 @@ export type ExcalidrawImperativeAPI = {
|
|
|
476
474
|
refresh: InstanceType<typeof App>["refresh"];
|
|
477
475
|
setToast: InstanceType<typeof App>["setToast"];
|
|
478
476
|
addFiles: (data: BinaryFileData[]) => void;
|
|
479
|
-
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
480
|
-
ready: true;
|
|
481
477
|
id: string;
|
|
482
478
|
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
483
479
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
@@ -494,11 +490,15 @@ export type ExcalidrawImperativeAPI = {
|
|
|
494
490
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
495
491
|
};
|
|
496
492
|
export type Device = Readonly<{
|
|
497
|
-
|
|
498
|
-
|
|
493
|
+
viewport: {
|
|
494
|
+
isMobile: boolean;
|
|
495
|
+
isLandscape: boolean;
|
|
496
|
+
};
|
|
497
|
+
editor: {
|
|
498
|
+
isMobile: boolean;
|
|
499
|
+
canFitSidebar: boolean;
|
|
500
|
+
};
|
|
499
501
|
isTouchScreen: boolean;
|
|
500
|
-
canDeviceFitSidebar: boolean;
|
|
501
|
-
isLandscape: boolean;
|
|
502
502
|
}>;
|
|
503
503
|
type FrameNameBounds = {
|
|
504
504
|
x: number;
|
package/types/utils.d.ts
CHANGED
|
@@ -187,7 +187,11 @@ export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E
|
|
|
187
187
|
checkForDefaultPrevented?: boolean | undefined;
|
|
188
188
|
}) => (event: E) => void;
|
|
189
189
|
export declare const isOnlyExportingSingleFrame: (elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
|
190
|
-
|
|
190
|
+
/**
|
|
191
|
+
* supply `null` as message if non-never value is valid, you just need to
|
|
192
|
+
* typecheck against it
|
|
193
|
+
*/
|
|
194
|
+
export declare const assertNever: (value: never, message: string | null, softAssert?: boolean) => never;
|
|
191
195
|
/**
|
|
192
196
|
* Memoizes on values of `opts` object (strict equality).
|
|
193
197
|
*/
|
|
@@ -195,3 +199,6 @@ export declare const memoize: <T extends Record<string, any>, R extends unknown>
|
|
|
195
199
|
clear: () => void;
|
|
196
200
|
};
|
|
197
201
|
export declare const isRenderThrottlingEnabled: () => boolean;
|
|
202
|
+
/** Checks if value is inside given collection. Useful for type-safety. */
|
|
203
|
+
export declare const isMemberOf: <T extends string>(collection: Set<T> | Record<T, any> | Map<T, any> | readonly T[], value: string) => value is T;
|
|
204
|
+
export declare const cloneJSON: <T>(obj: T) => T;
|
|
File without changes
|
|
File without changes
|