@zsviczian/excalidraw 0.16.1-obsidian-4 → 0.16.1-obsidian-6
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 +173 -118
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionCanvas.d.ts +6 -6
- package/types/actions/actionClipboard.d.ts +1 -3
- package/types/actions/actionDeleteSelected.d.ts +1 -3
- package/types/actions/actionExport.d.ts +11 -13
- package/types/actions/actionProperties.d.ts +2 -2
- package/types/appState.d.ts +1 -1
- package/types/clipboard.d.ts +5 -5
- package/types/components/Actions.d.ts +2 -6
- package/types/components/App.d.ts +151 -3
- package/types/components/LayerUI.d.ts +1 -5
- package/types/components/MobileMenu.d.ts +1 -5
- package/types/constants.d.ts +10 -0
- package/types/cursor.d.ts +5 -0
- package/types/data/blob.d.ts +2 -1
- package/types/element/mutateElement.d.ts +1 -1
- package/types/emitter.d.ts +20 -0
- package/types/frame.d.ts +5 -0
- package/types/scene/comparisons.d.ts +0 -1
- package/types/scene/index.d.ts +1 -1
- package/types/types.d.ts +5 -0
- package/types/utils.d.ts +3 -5
package/package.json
CHANGED
|
@@ -56,12 +56,6 @@ export declare const actionClearCanvas: {
|
|
|
56
56
|
pinnedScripts: string[] | undefined;
|
|
57
57
|
customPens: any[] | undefined;
|
|
58
58
|
name: string;
|
|
59
|
-
toast: {
|
|
60
|
-
message: string;
|
|
61
|
-
closable?: boolean | undefined;
|
|
62
|
-
duration?: number | undefined;
|
|
63
|
-
} | null;
|
|
64
|
-
collaborators: Map<string, import("../types").Collaborator>;
|
|
65
59
|
contextMenu: {
|
|
66
60
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
67
61
|
top: number;
|
|
@@ -134,6 +128,11 @@ export declare const actionClearCanvas: {
|
|
|
134
128
|
};
|
|
135
129
|
selectedElementsAreBeingDragged: boolean;
|
|
136
130
|
shouldCacheIgnoreZoom: boolean;
|
|
131
|
+
toast: {
|
|
132
|
+
message: string;
|
|
133
|
+
closable?: boolean | undefined;
|
|
134
|
+
duration?: number | undefined;
|
|
135
|
+
} | null;
|
|
137
136
|
zenModeEnabled: boolean;
|
|
138
137
|
previousGridSize: number | null;
|
|
139
138
|
viewModeEnabled: boolean;
|
|
@@ -142,6 +141,7 @@ export declare const actionClearCanvas: {
|
|
|
142
141
|
};
|
|
143
142
|
editingGroupId: string | null;
|
|
144
143
|
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
144
|
+
collaborators: Map<string, import("../types").Collaborator>;
|
|
145
145
|
currentChartType: import("../element/types").ChartType;
|
|
146
146
|
pendingImageElementId: string | null;
|
|
147
147
|
showHyperlinkPopup: false | "editor" | "info";
|
|
@@ -367,6 +367,7 @@ export declare const actionCut: {
|
|
|
367
367
|
multiElement: null;
|
|
368
368
|
activeEmbeddable: null;
|
|
369
369
|
selectedElementIds: {};
|
|
370
|
+
selectedGroupIds: {};
|
|
370
371
|
contextMenu: {
|
|
371
372
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
372
373
|
top: number;
|
|
@@ -446,9 +447,6 @@ export declare const actionCut: {
|
|
|
446
447
|
gridSize: number | null;
|
|
447
448
|
previousGridSize: number | null;
|
|
448
449
|
viewModeEnabled: boolean;
|
|
449
|
-
selectedGroupIds: {
|
|
450
|
-
[groupId: string]: boolean;
|
|
451
|
-
};
|
|
452
450
|
editingGroupId: string | null;
|
|
453
451
|
width: number;
|
|
454
452
|
height: number;
|
|
@@ -343,6 +343,7 @@ export declare const actionDeleteSelected: {
|
|
|
343
343
|
multiElement: null;
|
|
344
344
|
activeEmbeddable: null;
|
|
345
345
|
selectedElementIds: {};
|
|
346
|
+
selectedGroupIds: {};
|
|
346
347
|
contextMenu: {
|
|
347
348
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
348
349
|
top: number;
|
|
@@ -422,9 +423,6 @@ export declare const actionDeleteSelected: {
|
|
|
422
423
|
gridSize: number | null;
|
|
423
424
|
previousGridSize: number | null;
|
|
424
425
|
viewModeEnabled: boolean;
|
|
425
|
-
selectedGroupIds: {
|
|
426
|
-
[groupId: string]: boolean;
|
|
427
|
-
};
|
|
428
426
|
editingGroupId: string | null;
|
|
429
427
|
width: number;
|
|
430
428
|
height: number;
|
|
@@ -802,7 +802,11 @@ export declare const actionSaveFileToDisk: {
|
|
|
802
802
|
perform: (elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, value: any, app: import("../types").AppClassProperties) => Promise<{
|
|
803
803
|
commitToHistory: false;
|
|
804
804
|
appState: {
|
|
805
|
+
openDialog: null;
|
|
805
806
|
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
807
|
+
toast: {
|
|
808
|
+
message: string;
|
|
809
|
+
};
|
|
806
810
|
contextMenu: {
|
|
807
811
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
808
812
|
top: number;
|
|
@@ -873,7 +877,6 @@ export declare const actionSaveFileToDisk: {
|
|
|
873
877
|
name: string;
|
|
874
878
|
tab?: string | undefined;
|
|
875
879
|
} | null;
|
|
876
|
-
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
877
880
|
defaultSidebarDockedPreference: boolean;
|
|
878
881
|
lastPointerDownWith: import("../element/types").PointerType;
|
|
879
882
|
selectedElementIds: Readonly<{
|
|
@@ -884,11 +887,6 @@ export declare const actionSaveFileToDisk: {
|
|
|
884
887
|
};
|
|
885
888
|
selectedElementsAreBeingDragged: boolean;
|
|
886
889
|
shouldCacheIgnoreZoom: boolean;
|
|
887
|
-
toast: {
|
|
888
|
-
message: string;
|
|
889
|
-
closable?: boolean | undefined;
|
|
890
|
-
duration?: number | undefined;
|
|
891
|
-
} | null;
|
|
892
890
|
zenModeEnabled: boolean;
|
|
893
891
|
theme: Theme;
|
|
894
892
|
gridSize: number | null;
|
|
@@ -970,13 +968,6 @@ export declare const actionLoadScene: {
|
|
|
970
968
|
locked: boolean;
|
|
971
969
|
} & import("../types").ActiveTool;
|
|
972
970
|
name: string;
|
|
973
|
-
toast: {
|
|
974
|
-
message: string;
|
|
975
|
-
closable?: boolean | undefined;
|
|
976
|
-
duration?: number | undefined;
|
|
977
|
-
} | null;
|
|
978
|
-
collaborators: Map<string, import("../types").Collaborator>;
|
|
979
|
-
penMode: boolean;
|
|
980
971
|
contextMenu: {
|
|
981
972
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
982
973
|
top: number;
|
|
@@ -1007,6 +998,7 @@ export declare const actionLoadScene: {
|
|
|
1007
998
|
elementsToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | null;
|
|
1008
999
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
1009
1000
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
1001
|
+
penMode: boolean;
|
|
1010
1002
|
penDetected: boolean;
|
|
1011
1003
|
exportBackground: boolean;
|
|
1012
1004
|
exportEmbedScene: boolean;
|
|
@@ -1052,6 +1044,11 @@ export declare const actionLoadScene: {
|
|
|
1052
1044
|
};
|
|
1053
1045
|
selectedElementsAreBeingDragged: boolean;
|
|
1054
1046
|
shouldCacheIgnoreZoom: boolean;
|
|
1047
|
+
toast: {
|
|
1048
|
+
message: string;
|
|
1049
|
+
closable?: boolean | undefined;
|
|
1050
|
+
duration?: number | undefined;
|
|
1051
|
+
} | null;
|
|
1055
1052
|
zenModeEnabled: boolean;
|
|
1056
1053
|
theme: Theme;
|
|
1057
1054
|
gridSize: number | null;
|
|
@@ -1062,6 +1059,7 @@ export declare const actionLoadScene: {
|
|
|
1062
1059
|
};
|
|
1063
1060
|
editingGroupId: string | null;
|
|
1064
1061
|
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
1062
|
+
collaborators: Map<string, import("../types").Collaborator>;
|
|
1065
1063
|
showStats: boolean;
|
|
1066
1064
|
currentChartType: import("../element/types").ChartType;
|
|
1067
1065
|
pasteDialog: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AppState } from "../../src/types";
|
|
1
|
+
import { AppState, Primitive } from "../../src/types";
|
|
2
2
|
import { Arrowhead, ExcalidrawElement, ExcalidrawLinearElement } from "../element/types";
|
|
3
3
|
export declare const changeProperty: (elements: readonly ExcalidrawElement[], appState: AppState, callback: (element: ExcalidrawElement) => ExcalidrawElement, includeBoundText?: boolean) => ExcalidrawElement[];
|
|
4
|
-
export declare const getFormValue: <T>(elements: readonly ExcalidrawElement[], appState: AppState, getAttribute: (element: ExcalidrawElement) => T, defaultValue: T) => T;
|
|
4
|
+
export declare const getFormValue: <T extends Primitive>(elements: readonly ExcalidrawElement[], appState: AppState, getAttribute: (element: ExcalidrawElement) => T, isRelevantElement: true | ((element: ExcalidrawElement) => boolean), defaultValue: T | ((isSomeElementSelected: boolean) => T)) => T;
|
|
5
5
|
export declare const actionChangeStrokeColor: {
|
|
6
6
|
name: "changeStrokeColor";
|
|
7
7
|
trackEvent: false;
|
package/types/appState.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
6
6
|
locked: boolean;
|
|
7
7
|
} & import("./types").ActiveTool) | undefined;
|
|
8
8
|
name?: string | undefined;
|
|
9
|
-
penMode?: boolean | undefined;
|
|
10
9
|
showWelcomeScreen?: boolean | undefined;
|
|
10
|
+
penMode?: boolean | undefined;
|
|
11
11
|
penDetected?: boolean | undefined;
|
|
12
12
|
exportBackground?: boolean | undefined;
|
|
13
13
|
exportEmbedScene?: boolean | undefined;
|
package/types/clipboard.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
2
|
import { BinaryFiles } from "./types";
|
|
3
3
|
import { Spreadsheet } from "./charts";
|
|
4
|
+
export type PastedMixedContent = {
|
|
5
|
+
type: "text" | "imageUrl";
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
4
8
|
export interface ClipboardData {
|
|
5
9
|
spreadsheet?: Spreadsheet;
|
|
6
10
|
elements?: readonly ExcalidrawElement[];
|
|
7
11
|
files?: BinaryFiles;
|
|
8
12
|
text?: string;
|
|
13
|
+
mixedContent?: PastedMixedContent;
|
|
9
14
|
errorMessage?: string;
|
|
10
15
|
programmaticAPI?: boolean;
|
|
11
16
|
}
|
|
@@ -13,11 +18,6 @@ export declare const probablySupportsClipboardReadText: boolean;
|
|
|
13
18
|
export declare const probablySupportsClipboardWriteText: boolean;
|
|
14
19
|
export declare const probablySupportsClipboardBlob: boolean;
|
|
15
20
|
export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null) => Promise<string | undefined>;
|
|
16
|
-
/**
|
|
17
|
-
* Retrieves content from system clipboard (either from ClipboardEvent or
|
|
18
|
-
* via async clipboard API if supported)
|
|
19
|
-
*/
|
|
20
|
-
export declare const getSystemClipboard: (event: ClipboardEvent | null) => Promise<string>;
|
|
21
21
|
/**
|
|
22
22
|
* Attempts to parse clipboard. Prefers system clipboard.
|
|
23
23
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActionManager } from "../actions/manager";
|
|
2
|
-
import { ExcalidrawElement
|
|
2
|
+
import { ExcalidrawElement } from "../element/types";
|
|
3
3
|
import { AppClassProperties, UIAppState, Zoom } from "../types";
|
|
4
4
|
import "./Actions.scss";
|
|
5
5
|
export declare const SelectedShapeActions: ({ appState, elements, renderAction, }: {
|
|
@@ -7,12 +7,8 @@ export declare const SelectedShapeActions: ({ appState, elements, renderAction,
|
|
|
7
7
|
elements: readonly ExcalidrawElement[];
|
|
8
8
|
renderAction: ActionManager["renderAction"];
|
|
9
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare const ShapesSwitcher: ({
|
|
11
|
-
interactiveCanvas: HTMLCanvasElement | null;
|
|
10
|
+
export declare const ShapesSwitcher: ({ activeTool, appState, app, }: {
|
|
12
11
|
activeTool: UIAppState["activeTool"];
|
|
13
|
-
onImageAction: (data: {
|
|
14
|
-
pointerType: PointerType | null;
|
|
15
|
-
}) => void;
|
|
16
12
|
appState: UIAppState;
|
|
17
13
|
app: AppClassProperties;
|
|
18
14
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,13 +3,14 @@ import { RoughCanvas } from "roughjs/bin/canvas";
|
|
|
3
3
|
import { ActionManager } from "../actions/manager";
|
|
4
4
|
import { EXPORT_IMAGE_TYPES } from "../constants";
|
|
5
5
|
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
6
|
-
import { ExcalidrawElement, ExcalidrawLinearElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
6
|
+
import { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, NonDeletedExcalidrawElement } from "../element/types";
|
|
7
7
|
import History from "../history";
|
|
8
8
|
import Scene from "../scene/Scene";
|
|
9
9
|
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType } from "../types";
|
|
10
10
|
import { FileSystemHandle } from "../data/filesystem";
|
|
11
11
|
import { Renderer } from "../scene/Renderer";
|
|
12
12
|
import { LaserPathManager } from "./LaserTool/LaserPathManager";
|
|
13
|
+
import { Emitter } from "../emitter";
|
|
13
14
|
export declare let showFourthFont: boolean;
|
|
14
15
|
export declare const ExcalidrawContainerContext: React.Context<{
|
|
15
16
|
container: HTMLDivElement | null;
|
|
@@ -64,6 +65,147 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
64
65
|
};
|
|
65
66
|
allowMobileMode: boolean;
|
|
66
67
|
laserPathManager: LaserPathManager;
|
|
68
|
+
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
|
|
69
|
+
onPointerDownEmitter: Emitter<[activeTool: {
|
|
70
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
71
|
+
locked: boolean;
|
|
72
|
+
} & import("../types").ActiveTool, pointerDownState: Readonly<{
|
|
73
|
+
origin: Readonly<{
|
|
74
|
+
x: number;
|
|
75
|
+
y: number;
|
|
76
|
+
}>;
|
|
77
|
+
originInGrid: Readonly<{
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
}>;
|
|
81
|
+
scrollbars: {
|
|
82
|
+
isOverEither: boolean;
|
|
83
|
+
isOverHorizontal: boolean;
|
|
84
|
+
isOverVertical: boolean;
|
|
85
|
+
};
|
|
86
|
+
lastCoords: {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
};
|
|
90
|
+
originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
|
|
91
|
+
resize: {
|
|
92
|
+
handleType: import("../element/transformHandles").MaybeTransformHandleType;
|
|
93
|
+
isResizing: boolean;
|
|
94
|
+
offset: {
|
|
95
|
+
x: number;
|
|
96
|
+
y: number;
|
|
97
|
+
};
|
|
98
|
+
arrowDirection: "end" | "origin";
|
|
99
|
+
center: {
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
hit: {
|
|
105
|
+
element: NonDeleted<ExcalidrawElement> | null;
|
|
106
|
+
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
107
|
+
wasAddedToSelection: boolean;
|
|
108
|
+
hasBeenDuplicated: boolean;
|
|
109
|
+
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
110
|
+
};
|
|
111
|
+
withCmdOrCtrl: boolean;
|
|
112
|
+
drag: {
|
|
113
|
+
hasOccurred: boolean;
|
|
114
|
+
offset: {
|
|
115
|
+
x: number;
|
|
116
|
+
y: number;
|
|
117
|
+
} | null;
|
|
118
|
+
};
|
|
119
|
+
eventListeners: {
|
|
120
|
+
onMove: {
|
|
121
|
+
(...args: any[]): void;
|
|
122
|
+
flush(): void;
|
|
123
|
+
cancel(): void;
|
|
124
|
+
} | null;
|
|
125
|
+
onUp: ((event: PointerEvent) => void) | null;
|
|
126
|
+
onKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
127
|
+
onKeyUp: ((event: KeyboardEvent) => void) | null;
|
|
128
|
+
};
|
|
129
|
+
boxSelection: {
|
|
130
|
+
hasOccurred: boolean;
|
|
131
|
+
};
|
|
132
|
+
elementIdsToErase: {
|
|
133
|
+
[key: string]: {
|
|
134
|
+
opacity: number;
|
|
135
|
+
erase: boolean;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
}>, event: React.PointerEvent<HTMLElement>]>;
|
|
139
|
+
onPointerUpEmitter: Emitter<[activeTool: {
|
|
140
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
141
|
+
locked: boolean;
|
|
142
|
+
} & import("../types").ActiveTool, pointerDownState: Readonly<{
|
|
143
|
+
origin: Readonly<{
|
|
144
|
+
x: number;
|
|
145
|
+
y: number;
|
|
146
|
+
}>;
|
|
147
|
+
originInGrid: Readonly<{
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
}>;
|
|
151
|
+
scrollbars: {
|
|
152
|
+
isOverEither: boolean;
|
|
153
|
+
isOverHorizontal: boolean;
|
|
154
|
+
isOverVertical: boolean;
|
|
155
|
+
};
|
|
156
|
+
lastCoords: {
|
|
157
|
+
x: number;
|
|
158
|
+
y: number;
|
|
159
|
+
};
|
|
160
|
+
originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
|
|
161
|
+
resize: {
|
|
162
|
+
handleType: import("../element/transformHandles").MaybeTransformHandleType;
|
|
163
|
+
isResizing: boolean;
|
|
164
|
+
offset: {
|
|
165
|
+
x: number;
|
|
166
|
+
y: number;
|
|
167
|
+
};
|
|
168
|
+
arrowDirection: "end" | "origin";
|
|
169
|
+
center: {
|
|
170
|
+
x: number;
|
|
171
|
+
y: number;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
hit: {
|
|
175
|
+
element: NonDeleted<ExcalidrawElement> | null;
|
|
176
|
+
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
177
|
+
wasAddedToSelection: boolean;
|
|
178
|
+
hasBeenDuplicated: boolean;
|
|
179
|
+
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
180
|
+
};
|
|
181
|
+
withCmdOrCtrl: boolean;
|
|
182
|
+
drag: {
|
|
183
|
+
hasOccurred: boolean;
|
|
184
|
+
offset: {
|
|
185
|
+
x: number;
|
|
186
|
+
y: number;
|
|
187
|
+
} | null;
|
|
188
|
+
};
|
|
189
|
+
eventListeners: {
|
|
190
|
+
onMove: {
|
|
191
|
+
(...args: any[]): void;
|
|
192
|
+
flush(): void;
|
|
193
|
+
cancel(): void;
|
|
194
|
+
} | null;
|
|
195
|
+
onUp: ((event: PointerEvent) => void) | null;
|
|
196
|
+
onKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
197
|
+
onKeyUp: ((event: KeyboardEvent) => void) | null;
|
|
198
|
+
};
|
|
199
|
+
boxSelection: {
|
|
200
|
+
hasOccurred: boolean;
|
|
201
|
+
};
|
|
202
|
+
elementIdsToErase: {
|
|
203
|
+
[key: string]: {
|
|
204
|
+
opacity: number;
|
|
205
|
+
erase: boolean;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
}>, event: PointerEvent]>;
|
|
67
209
|
constructor(props: AppProps);
|
|
68
210
|
private onWindowMessage;
|
|
69
211
|
private updateEmbeddableRef;
|
|
@@ -120,6 +262,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
120
262
|
retainSeed?: boolean;
|
|
121
263
|
fitToContent?: boolean;
|
|
122
264
|
}) => void;
|
|
265
|
+
private addElementsFromMixedContentPaste;
|
|
123
266
|
private addTextFromPaste;
|
|
124
267
|
setAppState: React.Component<any, AppState>["setState"];
|
|
125
268
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
@@ -192,11 +335,16 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
192
335
|
private onKeyDown;
|
|
193
336
|
private onWheel;
|
|
194
337
|
private onKeyUp;
|
|
195
|
-
setActiveTool: (tool: {
|
|
196
|
-
type: ToolType
|
|
338
|
+
setActiveTool: (tool: (({
|
|
339
|
+
type: Exclude<ToolType, "image">;
|
|
197
340
|
} | {
|
|
341
|
+
type: Extract<ToolType, "image">;
|
|
342
|
+
insertOnCanvasDirectly?: boolean;
|
|
343
|
+
}) | {
|
|
198
344
|
type: "custom";
|
|
199
345
|
customType: string;
|
|
346
|
+
}) & {
|
|
347
|
+
locked?: boolean;
|
|
200
348
|
}) => void;
|
|
201
349
|
private setCursor;
|
|
202
350
|
private resetCursor;
|
|
@@ -10,7 +10,6 @@ interface LayerUIProps {
|
|
|
10
10
|
appState: UIAppState;
|
|
11
11
|
files: BinaryFiles;
|
|
12
12
|
canvas: HTMLCanvasElement;
|
|
13
|
-
interactiveCanvas: HTMLCanvasElement | null;
|
|
14
13
|
setAppState: React.Component<any, AppState>["setState"];
|
|
15
14
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
16
15
|
onLockToggle: () => void;
|
|
@@ -21,14 +20,11 @@ interface LayerUIProps {
|
|
|
21
20
|
renderTopRightUI?: ExcalidrawProps["renderTopRightUI"];
|
|
22
21
|
renderCustomStats?: ExcalidrawProps["renderCustomStats"];
|
|
23
22
|
UIOptions: AppProps["UIOptions"];
|
|
24
|
-
onImageAction: (data: {
|
|
25
|
-
insertOnCanvasDirectly: boolean;
|
|
26
|
-
}) => void;
|
|
27
23
|
onExportImage: AppClassProperties["onExportImage"];
|
|
28
24
|
renderWelcomeScreen: boolean;
|
|
29
25
|
children?: React.ReactNode;
|
|
30
26
|
app: AppClassProperties;
|
|
31
27
|
isCollaborating: boolean;
|
|
32
28
|
}
|
|
33
|
-
declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas,
|
|
29
|
+
declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onExportImage, renderWelcomeScreen, children, app, isCollaborating, }: LayerUIProps) => import("react/jsx-runtime").JSX.Element>;
|
|
34
30
|
export default _default;
|
|
@@ -12,10 +12,6 @@ type MobileMenuProps = {
|
|
|
12
12
|
onLockToggle: () => void;
|
|
13
13
|
onHandToolToggle: () => void;
|
|
14
14
|
onPenModeToggle: () => void;
|
|
15
|
-
interactiveCanvas: HTMLCanvasElement | null;
|
|
16
|
-
onImageAction: (data: {
|
|
17
|
-
insertOnCanvasDirectly: boolean;
|
|
18
|
-
}) => void;
|
|
19
15
|
renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
20
16
|
renderCustomStats?: ExcalidrawProps["renderCustomStats"];
|
|
21
17
|
renderSidebars: () => JSX.Element | null;
|
|
@@ -23,5 +19,5 @@ type MobileMenuProps = {
|
|
|
23
19
|
renderWelcomeScreen: boolean;
|
|
24
20
|
app: AppClassProperties;
|
|
25
21
|
};
|
|
26
|
-
export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle,
|
|
22
|
+
export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, app, }: MobileMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
23
|
export {};
|
package/types/constants.d.ts
CHANGED
|
@@ -217,6 +217,16 @@ export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
|
|
|
217
217
|
export declare const COLOR_NAMES: {
|
|
218
218
|
[key: string]: string;
|
|
219
219
|
};
|
|
220
|
+
export declare const ROUGHNESS: {
|
|
221
|
+
readonly architect: 0;
|
|
222
|
+
readonly artist: 1;
|
|
223
|
+
readonly cartoonist: 2;
|
|
224
|
+
};
|
|
225
|
+
export declare const STROKE_WIDTH: {
|
|
226
|
+
readonly thin: 1;
|
|
227
|
+
readonly bold: 2;
|
|
228
|
+
readonly extraBold: 4;
|
|
229
|
+
};
|
|
220
230
|
export declare const DEFAULT_ELEMENT_PROPS: {
|
|
221
231
|
strokeColor: ExcalidrawElement["strokeColor"];
|
|
222
232
|
backgroundColor: ExcalidrawElement["backgroundColor"];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AppState } from "./types";
|
|
2
|
+
export declare const resetCursor: (interactiveCanvas: HTMLCanvasElement | null) => void;
|
|
3
|
+
export declare const setCursor: (interactiveCanvas: HTMLCanvasElement | null, cursor: string) => void;
|
|
4
|
+
export declare const setEraserCursor: (interactiveCanvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
|
|
5
|
+
export declare const setCursorForShape: (interactiveCanvas: HTMLCanvasElement | null, appState: Pick<AppState, "activeTool" | "theme">) => void;
|
package/types/data/blob.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const loadSceneOrLibraryFromBlob: (blob: Blob | File, localAppSta
|
|
|
21
21
|
export declare const loadFromBlob: (blob: Blob, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null, fileHandle?: FileSystemHandle | null) => Promise<import("./restore").RestoredDataState>;
|
|
22
22
|
export declare const parseLibraryJSON: (json: string, defaultStatus?: LibraryItem["status"]) => LibraryItem[];
|
|
23
23
|
export declare const loadLibraryFromBlob: (blob: Blob, defaultStatus?: LibraryItem["status"]) => Promise<LibraryItem[]>;
|
|
24
|
-
export declare const canvasToBlob: (canvas: HTMLCanvasElement) => Promise<Blob>;
|
|
24
|
+
export declare const canvasToBlob: (canvas: HTMLCanvasElement | Promise<HTMLCanvasElement>) => Promise<Blob>;
|
|
25
25
|
/** generates SHA-1 digest from supplied file (if not supported, falls back
|
|
26
26
|
to a 40-char base64 random id) */
|
|
27
27
|
export declare const generateIdFromFile: (file: File) => Promise<FileId>;
|
|
@@ -35,6 +35,7 @@ export declare const resizeImageFile: (file: File, opts: {
|
|
|
35
35
|
export declare const SVGStringToFile: (SVGString: string, filename?: string) => File & {
|
|
36
36
|
type: typeof MIME_TYPES.svg;
|
|
37
37
|
};
|
|
38
|
+
export declare const ImageURLToFile: (imageUrl: string, filename?: string) => Promise<File | undefined>;
|
|
38
39
|
export declare const getFileFromEvent: (event: React.DragEvent<HTMLDivElement>) => Promise<{
|
|
39
40
|
file: File | null;
|
|
40
41
|
fileHandle: FileSystemHandle | null;
|
|
@@ -8,5 +8,5 @@ export declare const newElementWith: <TElement extends ExcalidrawElement>(elemen
|
|
|
8
8
|
*
|
|
9
9
|
* NOTE: does not trigger re-render.
|
|
10
10
|
*/
|
|
11
|
-
export declare const bumpVersion:
|
|
11
|
+
export declare const bumpVersion: <T extends Mutable<ExcalidrawElement>>(element: T, version?: ExcalidrawElement["version"]) => T;
|
|
12
12
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type Subscriber<T extends any[]> = (...payload: T) => void;
|
|
2
|
+
export declare class Emitter<T extends any[] = []> {
|
|
3
|
+
subscribers: Subscriber<T>[];
|
|
4
|
+
value: T | undefined;
|
|
5
|
+
private updateOnChangeOnly;
|
|
6
|
+
constructor(opts?: {
|
|
7
|
+
initialState?: T;
|
|
8
|
+
updateOnChangeOnly?: boolean;
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* Attaches subscriber
|
|
12
|
+
*
|
|
13
|
+
* @returns unsubscribe function
|
|
14
|
+
*/
|
|
15
|
+
on(...handlers: Subscriber<T>[] | Subscriber<T>[][]): () => void;
|
|
16
|
+
off(...handlers: Subscriber<T>[] | Subscriber<T>[][]): void;
|
|
17
|
+
trigger(...payload: T): any[];
|
|
18
|
+
destroy(): void;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
package/types/frame.d.ts
CHANGED
|
@@ -21,6 +21,11 @@ export declare const getFrameElements: (allElements: ExcalidrawElementsIncluding
|
|
|
21
21
|
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
|
22
22
|
export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
23
23
|
export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) => ExcalidrawFrameElement | null;
|
|
24
|
+
/**
|
|
25
|
+
* Retains (or repairs for target frame) the ordering invriant where children
|
|
26
|
+
* elements come right before the parent frame:
|
|
27
|
+
* [el, el, child, child, frame, el]
|
|
28
|
+
*/
|
|
24
29
|
export declare const addElementsToFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToAdd: NonDeletedExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
25
30
|
export declare const removeElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToRemove: NonDeletedExcalidrawElement[], appState: AppState) => ExcalidrawElement[];
|
|
26
31
|
export declare const removeAllElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
|
@@ -4,7 +4,6 @@ export declare const hasStrokeColor: (type: string) => boolean;
|
|
|
4
4
|
export declare const hasStrokeWidth: (type: string) => boolean;
|
|
5
5
|
export declare const hasStrokeStyle: (type: string) => boolean;
|
|
6
6
|
export declare const canChangeRoundness: (type: string) => boolean;
|
|
7
|
-
export declare const hasText: (type: string) => boolean;
|
|
8
7
|
export declare const canHaveArrowheads: (type: string) => boolean;
|
|
9
8
|
export declare const getElementAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement | null;
|
|
10
9
|
export declare const getElementsAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement[];
|
package/types/scene/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { isOverScrollBars } from "./scrollbars";
|
|
2
2
|
export { isSomeElementSelected, getElementsWithinSelection, getCommonAttributeOfSelectedElements, getSelectedElements, getTargetElements, } from "./selection";
|
|
3
3
|
export { calculateScrollCenter } from "./scroll";
|
|
4
|
-
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, getElementAtPosition,
|
|
4
|
+
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, getElementAtPosition, getElementsAtPosition, } from "./comparisons";
|
|
5
5
|
export { getNormalizedZoom } from "./zoom";
|
package/types/types.d.ts
CHANGED
|
@@ -498,6 +498,7 @@ export type PointerDownState = Readonly<{
|
|
|
498
498
|
};
|
|
499
499
|
};
|
|
500
500
|
}>;
|
|
501
|
+
type UnsubscribeCallback = () => void;
|
|
501
502
|
export type ExcalidrawImperativeAPI = {
|
|
502
503
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
503
504
|
updateLibrary: InstanceType<typeof Library>["updateLibrary"];
|
|
@@ -537,6 +538,9 @@ export type ExcalidrawImperativeAPI = {
|
|
|
537
538
|
* used in conjunction with view mode (props.viewModeEnabled).
|
|
538
539
|
*/
|
|
539
540
|
updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
|
|
541
|
+
onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
|
|
542
|
+
onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
|
|
543
|
+
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
540
544
|
};
|
|
541
545
|
export type Device = Readonly<{
|
|
542
546
|
isSmScreen: boolean;
|
|
@@ -565,4 +569,5 @@ export type KeyboardModifiersObject = {
|
|
|
565
569
|
altKey: boolean;
|
|
566
570
|
metaKey: boolean;
|
|
567
571
|
};
|
|
572
|
+
export type Primitive = number | string | boolean | bigint | symbol | null | undefined;
|
|
568
573
|
export {};
|
package/types/utils.d.ts
CHANGED
|
@@ -79,18 +79,16 @@ export declare const chunk: <T extends unknown>(array: readonly T[], size: numbe
|
|
|
79
79
|
export declare const selectNode: (node: Element) => void;
|
|
80
80
|
export declare const removeSelection: () => void;
|
|
81
81
|
export declare const distance: (x: number, y: number) => number;
|
|
82
|
-
export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: ({
|
|
82
|
+
export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: (({
|
|
83
83
|
type: ToolType;
|
|
84
84
|
} | {
|
|
85
85
|
type: "custom";
|
|
86
86
|
customType: string;
|
|
87
|
+
}) & {
|
|
88
|
+
locked?: boolean;
|
|
87
89
|
}) & {
|
|
88
90
|
lastActiveToolBeforeEraser?: ActiveTool | null;
|
|
89
91
|
}) => AppState["activeTool"];
|
|
90
|
-
export declare const resetCursor: (interactiveCanvas: HTMLCanvasElement | null) => void;
|
|
91
|
-
export declare const setCursor: (interactiveCanvas: HTMLCanvasElement | null, cursor: string) => void;
|
|
92
|
-
export declare const setEraserCursor: (interactiveCanvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
|
|
93
|
-
export declare const setCursorForShape: (interactiveCanvas: HTMLCanvasElement | null, appState: Pick<AppState, "activeTool" | "theme">) => void;
|
|
94
92
|
export declare const isFullScreen: () => boolean;
|
|
95
93
|
export declare const allowFullScreen: () => Promise<void>;
|
|
96
94
|
export declare const exitFullScreen: () => Promise<void>;
|