@zsviczian/excalidraw 0.16.1-obsidian-7 → 0.17.0-obsidian-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/excalidraw.development.js +124 -80
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +1 -1
- package/main.js +7 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +27 -6
- package/types/actions/actionBoundText.d.ts +18 -4
- package/types/actions/actionCanvas.d.ts +118 -27
- package/types/actions/actionClipboard.d.ts +362 -18
- package/types/actions/actionDeleteSelected.d.ts +27 -6
- package/types/actions/actionElementLock.d.ts +18 -4
- package/types/actions/actionExport.d.ts +81 -18
- package/types/actions/actionFinalize.d.ts +18 -4
- package/types/actions/actionFrame.d.ts +27 -6
- package/types/actions/actionGroup.d.ts +21 -7
- package/types/actions/actionLinearEditor.d.ts +9 -2
- package/types/actions/actionMenu.d.ts +26 -19
- package/types/actions/actionProperties.d.ts +117 -26
- package/types/actions/actionSelectAll.d.ts +9 -2
- package/types/actions/actionStyles.d.ts +9 -2
- package/types/actions/actionToggleGridMode.d.ts +9 -2
- package/types/actions/actionToggleObjectsSnapMode.d.ts +9 -2
- package/types/actions/actionToggleStats.d.ts +9 -2
- package/types/actions/actionToggleViewMode.d.ts +9 -2
- package/types/actions/actionToggleZenMode.d.ts +9 -2
- package/types/actions/actionZindex.d.ts +2 -2
- 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 +20 -12
- 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/MermaidToExcalidraw.d.ts +1 -1
- package/types/components/MobileMenu.d.ts +4 -3
- package/types/components/Modal.d.ts +3 -1
- package/types/constants.d.ts +7 -1
- package/types/data/index.d.ts +10 -2
- package/types/data/transform.d.ts +7 -3
- package/types/element/Hyperlink.d.ts +10 -3
- package/types/element/bounds.d.ts +11 -5
- package/types/element/embeddable.d.ts +10 -3
- package/types/element/linearElementEditor.d.ts +11 -3
- package/types/element/newElement.d.ts +3 -1
- package/types/element/resizeTest.d.ts +2 -1
- package/types/element/transformHandles.d.ts +2 -1
- package/types/element/typeChecks.d.ts +1 -1
- package/types/element/types.d.ts +1 -0
- package/types/errors.d.ts +5 -0
- package/types/frame.d.ts +12 -1
- package/types/hooks/useCreatePortalContainer.d.ts +6 -4
- package/types/math.d.ts +1 -0
- package/types/packages/bbox.d.ts +11 -0
- package/types/packages/excalidraw/index.d.ts +4 -3
- package/types/packages/excalidraw/webpack.preact.config.d.ts +170 -0
- package/types/packages/utils.d.ts +6 -3
- package/types/packages/withinBounds.d.ts +19 -0
- package/types/renderer/renderElement.d.ts +6 -1
- package/types/renderer/renderScene.d.ts +10 -5
- package/types/scene/Scene.d.ts +7 -2
- package/types/scene/export.d.ts +6 -6
- package/types/types.d.ts +29 -18
- package/types/utils.d.ts +8 -1
- package/types/zindex.d.ts +4 -4
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
mode: string;
|
|
3
|
+
entry: {
|
|
4
|
+
"excalidraw.development": string;
|
|
5
|
+
};
|
|
6
|
+
output: {
|
|
7
|
+
path: string;
|
|
8
|
+
library: string;
|
|
9
|
+
libraryTarget: string;
|
|
10
|
+
filename: string;
|
|
11
|
+
chunkFilename: string;
|
|
12
|
+
assetModuleFilename: string;
|
|
13
|
+
publicPath: string;
|
|
14
|
+
};
|
|
15
|
+
resolve: {
|
|
16
|
+
extensions: string[];
|
|
17
|
+
};
|
|
18
|
+
module: {
|
|
19
|
+
rules: ({
|
|
20
|
+
test: RegExp;
|
|
21
|
+
exclude: RegExp;
|
|
22
|
+
use: (string | {
|
|
23
|
+
loader: string;
|
|
24
|
+
} | {
|
|
25
|
+
loader: string;
|
|
26
|
+
options: {
|
|
27
|
+
postcssOptions: {
|
|
28
|
+
plugins: (import("postcss").Plugin & import("autoprefixer").ExportedAPI)[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
})[];
|
|
32
|
+
} | {
|
|
33
|
+
test: RegExp;
|
|
34
|
+
resolve: {
|
|
35
|
+
fullySpecified: boolean;
|
|
36
|
+
};
|
|
37
|
+
} | {
|
|
38
|
+
test: RegExp;
|
|
39
|
+
exclude: RegExp;
|
|
40
|
+
use: ({
|
|
41
|
+
loader: string;
|
|
42
|
+
} | {
|
|
43
|
+
loader: string;
|
|
44
|
+
options: {
|
|
45
|
+
transpileOnly: boolean;
|
|
46
|
+
configFile: string;
|
|
47
|
+
};
|
|
48
|
+
})[];
|
|
49
|
+
} | {
|
|
50
|
+
test: RegExp;
|
|
51
|
+
type: string;
|
|
52
|
+
})[];
|
|
53
|
+
};
|
|
54
|
+
optimization: {
|
|
55
|
+
splitChunks: {
|
|
56
|
+
chunks: string;
|
|
57
|
+
cacheGroups: {
|
|
58
|
+
vendors: {
|
|
59
|
+
test: RegExp;
|
|
60
|
+
name: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
plugins: any[];
|
|
66
|
+
externals: {
|
|
67
|
+
react: {
|
|
68
|
+
root: string;
|
|
69
|
+
commonjs2: string;
|
|
70
|
+
commonjs: string;
|
|
71
|
+
amd: string;
|
|
72
|
+
};
|
|
73
|
+
"react-dom": {
|
|
74
|
+
root: string;
|
|
75
|
+
commonjs2: string;
|
|
76
|
+
commonjs: string;
|
|
77
|
+
amd: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
} | {
|
|
81
|
+
mode: string;
|
|
82
|
+
entry: {
|
|
83
|
+
"excalidraw.production.min": string;
|
|
84
|
+
};
|
|
85
|
+
output: {
|
|
86
|
+
path: string;
|
|
87
|
+
library: string;
|
|
88
|
+
libraryTarget: string;
|
|
89
|
+
filename: string;
|
|
90
|
+
chunkFilename: string;
|
|
91
|
+
assetModuleFilename: string;
|
|
92
|
+
publicPath: string;
|
|
93
|
+
};
|
|
94
|
+
resolve: {
|
|
95
|
+
extensions: string[];
|
|
96
|
+
};
|
|
97
|
+
module: {
|
|
98
|
+
rules: ({
|
|
99
|
+
test: RegExp;
|
|
100
|
+
exclude: RegExp;
|
|
101
|
+
use: (string | {
|
|
102
|
+
loader: string;
|
|
103
|
+
} | {
|
|
104
|
+
loader: string;
|
|
105
|
+
options: {
|
|
106
|
+
postcssOptions: {
|
|
107
|
+
plugins: (import("postcss").Plugin & import("autoprefixer").ExportedAPI)[];
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
})[];
|
|
111
|
+
} | {
|
|
112
|
+
test: RegExp;
|
|
113
|
+
resolve: {
|
|
114
|
+
fullySpecified: boolean;
|
|
115
|
+
};
|
|
116
|
+
} | {
|
|
117
|
+
test: RegExp;
|
|
118
|
+
exclude: RegExp;
|
|
119
|
+
use: ({
|
|
120
|
+
loader: string;
|
|
121
|
+
} | {
|
|
122
|
+
loader: string;
|
|
123
|
+
options: {
|
|
124
|
+
transpileOnly: boolean;
|
|
125
|
+
configFile: string;
|
|
126
|
+
};
|
|
127
|
+
} | {
|
|
128
|
+
loader: string;
|
|
129
|
+
options: {
|
|
130
|
+
presets: (string | (string | {
|
|
131
|
+
runtime: string;
|
|
132
|
+
})[])[];
|
|
133
|
+
plugins: string[];
|
|
134
|
+
};
|
|
135
|
+
})[];
|
|
136
|
+
} | {
|
|
137
|
+
test: RegExp;
|
|
138
|
+
type: string;
|
|
139
|
+
})[];
|
|
140
|
+
};
|
|
141
|
+
optimization: {
|
|
142
|
+
minimize: boolean;
|
|
143
|
+
minimizer: import("terser-webpack-plugin")<import("terser").MinifyOptions>[];
|
|
144
|
+
splitChunks: {
|
|
145
|
+
chunks: string;
|
|
146
|
+
cacheGroups: {
|
|
147
|
+
vendors: {
|
|
148
|
+
test: RegExp;
|
|
149
|
+
name: string;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
plugins: any[];
|
|
155
|
+
externals: {
|
|
156
|
+
react: {
|
|
157
|
+
root: string;
|
|
158
|
+
commonjs2: string;
|
|
159
|
+
commonjs: string;
|
|
160
|
+
amd: string;
|
|
161
|
+
};
|
|
162
|
+
"react-dom": {
|
|
163
|
+
root: string;
|
|
164
|
+
commonjs2: string;
|
|
165
|
+
commonjs: string;
|
|
166
|
+
amd: string;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
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>;
|
|
@@ -30,6 +31,8 @@ export declare const exportToClipboard: (opts: ExportOpts & {
|
|
|
30
31
|
quality?: number;
|
|
31
32
|
type: "png" | "svg" | "json";
|
|
32
33
|
}) => Promise<void>;
|
|
34
|
+
export * from "./bbox";
|
|
35
|
+
export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "./withinBounds";
|
|
33
36
|
export { serializeAsJSON, serializeLibraryAsJSON } from "../data/json";
|
|
34
37
|
export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "../data/blob";
|
|
35
38
|
export { getFreeDrawSvgPath } from "../renderer/renderElement";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
+
import { Bounds } from "../element/bounds";
|
|
3
|
+
type Element = NonDeletedExcalidrawElement;
|
|
4
|
+
type Elements = readonly NonDeletedExcalidrawElement[];
|
|
5
|
+
export declare const isElementInsideBBox: (element: Element, bbox: Bounds, eitherDirection?: boolean) => boolean;
|
|
6
|
+
export declare const elementPartiallyOverlapsWithOrContainsBBox: (element: Element, bbox: Bounds) => boolean;
|
|
7
|
+
export declare const elementsOverlappingBBox: ({ elements, bounds, type, errorMargin, }: {
|
|
8
|
+
elements: Elements;
|
|
9
|
+
bounds: Bounds | ExcalidrawElement;
|
|
10
|
+
/** safety offset. Defaults to 0. */
|
|
11
|
+
errorMargin?: number | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* - overlap: elements overlapping or inside bounds
|
|
14
|
+
* - contain: elements inside bounds or bounds inside elements
|
|
15
|
+
* - inside: elements inside bounds
|
|
16
|
+
**/
|
|
17
|
+
type: "overlap" | "contain" | "inside";
|
|
18
|
+
}) => NonDeletedExcalidrawElement[];
|
|
19
|
+
export {};
|
|
@@ -18,7 +18,12 @@ 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
|
+
frameColor?: AppState["frameColor"];
|
|
26
|
+
}) => void;
|
|
22
27
|
export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
|
|
23
28
|
export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
|
|
24
29
|
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,15 @@ 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, frameColor, }: {
|
|
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
|
+
frameColor?: {
|
|
32
|
+
stroke: string;
|
|
33
|
+
fill: string;
|
|
34
|
+
nameColor: string;
|
|
35
|
+
} | undefined;
|
|
31
36
|
}) => 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,10 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
17
16
|
viewBackgroundColor: string;
|
|
18
17
|
exportWithDarkMode?: boolean;
|
|
19
18
|
exportEmbedScene?: boolean;
|
|
20
|
-
|
|
19
|
+
frameRendering?: AppState["frameRendering"];
|
|
20
|
+
frameColor?: AppState["frameColor"];
|
|
21
21
|
}, files: BinaryFiles | null, opts?: {
|
|
22
|
-
serializeAsJSON?: () => string;
|
|
23
22
|
renderEmbeddables?: boolean;
|
|
23
|
+
exportingFrame?: ExcalidrawFrameElement | null;
|
|
24
24
|
}) => Promise<SVGSVGElement>;
|
|
25
25
|
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
|
import { ColorPaletteCustom } from "./colors";
|
|
21
21
|
export type Point = Readonly<RoughPoint>;
|
|
22
22
|
export type Collaborator = {
|
|
@@ -94,6 +94,7 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
94
94
|
frameRendering: AppState["frameRendering"];
|
|
95
95
|
linkOpacity: AppState["linkOpacity"];
|
|
96
96
|
gridColor: AppState["gridColor"];
|
|
97
|
+
frameColor: AppState["frameColor"];
|
|
97
98
|
}>;
|
|
98
99
|
export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
99
100
|
activeEmbeddable: AppState["activeEmbeddable"];
|
|
@@ -185,7 +186,7 @@ export type AppState = {
|
|
|
185
186
|
name: SidebarName;
|
|
186
187
|
tab?: SidebarTabName;
|
|
187
188
|
} | null;
|
|
188
|
-
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
189
|
+
openDialog: "imageExport" | "help" | "jsonExport" | "mermaid" | null;
|
|
189
190
|
/**
|
|
190
191
|
* Reflects user preference for whether the default sidebar should be docked.
|
|
191
192
|
*
|
|
@@ -261,7 +262,14 @@ export type AppState = {
|
|
|
261
262
|
Regular: string;
|
|
262
263
|
MajorGridFrequency?: number;
|
|
263
264
|
};
|
|
264
|
-
dynamicStyle:
|
|
265
|
+
dynamicStyle: {
|
|
266
|
+
[x: string]: string;
|
|
267
|
+
};
|
|
268
|
+
frameColor: {
|
|
269
|
+
stroke: string;
|
|
270
|
+
fill: string;
|
|
271
|
+
nameColor: string;
|
|
272
|
+
};
|
|
265
273
|
invertBindingBehaviour: boolean;
|
|
266
274
|
selectedLinearElement: LinearElementEditor | null;
|
|
267
275
|
snapLines: readonly SnapLine[];
|
|
@@ -312,17 +320,13 @@ export type LibraryItem = {
|
|
|
312
320
|
export type LibraryItems = readonly LibraryItem[];
|
|
313
321
|
export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
|
|
314
322
|
export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>) | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>;
|
|
315
|
-
export type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
|
|
316
|
-
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
317
|
-
ready?: false;
|
|
318
|
-
};
|
|
319
323
|
export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
|
|
320
324
|
libraryItems?: Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>;
|
|
321
325
|
}>;
|
|
322
326
|
export interface ExcalidrawProps {
|
|
323
327
|
onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
324
328
|
initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
|
|
325
|
-
|
|
329
|
+
excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
|
|
326
330
|
isCollaborating?: boolean;
|
|
327
331
|
onPointerUpdate?: (payload: {
|
|
328
332
|
pointer: {
|
|
@@ -368,6 +372,7 @@ export interface ExcalidrawProps {
|
|
|
368
372
|
renderWebview?: boolean;
|
|
369
373
|
renderEmbeddableMenu?: (appState: AppState) => JSX.Element | null;
|
|
370
374
|
renderMermaid?: boolean;
|
|
375
|
+
onContextMenu?: (element: readonly NonDeletedExcalidrawElement[], appState: AppState, onClose: (callback?: () => void) => void) => JSX.Element | null;
|
|
371
376
|
}
|
|
372
377
|
export type SceneData = {
|
|
373
378
|
elements?: ImportedDataState["elements"];
|
|
@@ -385,7 +390,7 @@ export type ExportOpts = {
|
|
|
385
390
|
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => void;
|
|
386
391
|
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
|
|
387
392
|
};
|
|
388
|
-
type CanvasActions = Partial<{
|
|
393
|
+
export type CanvasActions = Partial<{
|
|
389
394
|
changeViewBackgroundColor: boolean;
|
|
390
395
|
clearCanvas: boolean;
|
|
391
396
|
export: false | ExportOpts;
|
|
@@ -394,9 +399,12 @@ type CanvasActions = Partial<{
|
|
|
394
399
|
toggleTheme: boolean | null;
|
|
395
400
|
saveAsImage: boolean;
|
|
396
401
|
}>;
|
|
397
|
-
type UIOptions = Partial<{
|
|
402
|
+
export type UIOptions = Partial<{
|
|
398
403
|
dockedSidebarBreakpoint: number;
|
|
399
404
|
canvasActions: CanvasActions;
|
|
405
|
+
tools: {
|
|
406
|
+
image: boolean;
|
|
407
|
+
};
|
|
400
408
|
/** @deprecated does nothing. Will be removed in 0.15 */
|
|
401
409
|
welcomeScreen?: boolean;
|
|
402
410
|
}>;
|
|
@@ -434,10 +442,11 @@ export type AppClassProperties = {
|
|
|
434
442
|
lastViewportPosition: App["lastViewportPosition"];
|
|
435
443
|
scrollToContent: App["scrollToContent"];
|
|
436
444
|
addFiles: App["addFiles"];
|
|
437
|
-
setSelection: App["setSelection"];
|
|
438
445
|
addElementsFromPasteOrLibrary: App["addElementsFromPasteOrLibrary"];
|
|
446
|
+
setSelection: App["setSelection"];
|
|
439
447
|
togglePenMode: App["togglePenMode"];
|
|
440
448
|
setActiveTool: App["setActiveTool"];
|
|
449
|
+
setOpenDialog: App["setOpenDialog"];
|
|
441
450
|
};
|
|
442
451
|
export type PointerDownState = Readonly<{
|
|
443
452
|
origin: Readonly<{
|
|
@@ -517,8 +526,6 @@ export type ExcalidrawImperativeAPI = {
|
|
|
517
526
|
setToast: InstanceType<typeof App>["setToast"];
|
|
518
527
|
addFiles: (data: BinaryFileData[]) => void;
|
|
519
528
|
updateContainerSize: InstanceType<typeof App>["updateContainerSize"];
|
|
520
|
-
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
521
|
-
ready: true;
|
|
522
529
|
id: string;
|
|
523
530
|
setLocalFont: (showOnPanel: boolean) => void;
|
|
524
531
|
selectElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
@@ -543,11 +550,15 @@ export type ExcalidrawImperativeAPI = {
|
|
|
543
550
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
544
551
|
};
|
|
545
552
|
export type Device = Readonly<{
|
|
546
|
-
|
|
547
|
-
|
|
553
|
+
viewport: {
|
|
554
|
+
isMobile: boolean;
|
|
555
|
+
isLandscape: boolean;
|
|
556
|
+
};
|
|
557
|
+
editor: {
|
|
558
|
+
isMobile: boolean;
|
|
559
|
+
canFitSidebar: boolean;
|
|
560
|
+
};
|
|
548
561
|
isTouchScreen: boolean;
|
|
549
|
-
canDeviceFitSidebar: boolean;
|
|
550
|
-
isLandscape: boolean;
|
|
551
562
|
}>;
|
|
552
563
|
type FrameNameBounds = {
|
|
553
564
|
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;
|
package/types/zindex.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./element/types";
|
|
2
2
|
import { AppState } from "./types";
|
|
3
|
-
export declare const moveOneLeft: (
|
|
4
|
-
export declare const moveOneRight: (
|
|
5
|
-
export declare const moveAllLeft: (
|
|
6
|
-
export declare const moveAllRight: (
|
|
3
|
+
export declare const moveOneLeft: (allElements: readonly ExcalidrawElement[], appState: AppState) => ExcalidrawElement[];
|
|
4
|
+
export declare const moveOneRight: (allElements: readonly ExcalidrawElement[], appState: AppState) => ExcalidrawElement[];
|
|
5
|
+
export declare const moveAllLeft: (allElements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[] | ExcalidrawElement[];
|
|
6
|
+
export declare const moveAllRight: (allElements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[] | ExcalidrawElement[];
|