@zsviczian/excalidraw 0.10.0-obsidian-45 → 0.10.0-obsidian-49
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 +67 -67
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +9 -7
- package/types/actions/actionAddToLibrary.d.ts +21 -0
- package/types/actions/actionCanvas.d.ts +57 -1
- package/types/actions/actionClipboard.d.ts +35 -0
- package/types/actions/actionDeleteSelected.d.ts +21 -0
- package/types/actions/actionExport.d.ts +63 -0
- package/types/actions/actionFinalize.d.ts +15 -1
- package/types/actions/actionMenu.d.ts +21 -0
- package/types/actions/actionProperties.d.ts +84 -0
- package/types/actions/actionStyles.d.ts +7 -0
- package/types/actions/actionToggleGridMode.d.ts +7 -0
- package/types/actions/actionToggleStats.d.ts +7 -0
- package/types/actions/actionToggleViewMode.d.ts +7 -0
- package/types/actions/actionToggleZenMode.d.ts +7 -0
- package/types/components/App.d.ts +1 -0
- package/types/components/ButtonIconSelect.d.ts +1 -0
- package/types/components/ColorPicker.d.ts +6 -1
- package/types/constants.d.ts +4 -4
- package/types/element/Hyperlink.d.ts +8 -1
- package/types/element/linearElementEditor.d.ts +7 -0
- package/types/keys.d.ts +1 -0
- package/types/renderer/renderElement.d.ts +11 -1
- package/types/types.d.ts +10 -3
- package/types/utils.d.ts +14 -0
|
@@ -102,6 +102,13 @@ export declare const actionChangeFillStyle: {
|
|
|
102
102
|
};
|
|
103
103
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
104
104
|
showHyperlinkPopup: false | "info" | "editor";
|
|
105
|
+
linkOpacity: number;
|
|
106
|
+
trayModeEnabled: boolean;
|
|
107
|
+
colorPalette: {
|
|
108
|
+
canvasBackground?: string[] | undefined;
|
|
109
|
+
elementBackground?: string[] | undefined;
|
|
110
|
+
elementStroke?: string[] | undefined;
|
|
111
|
+
};
|
|
105
112
|
};
|
|
106
113
|
commitToHistory: true;
|
|
107
114
|
};
|
|
@@ -196,6 +203,13 @@ export declare const actionChangeStrokeWidth: {
|
|
|
196
203
|
};
|
|
197
204
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
198
205
|
showHyperlinkPopup: false | "info" | "editor";
|
|
206
|
+
linkOpacity: number;
|
|
207
|
+
trayModeEnabled: boolean;
|
|
208
|
+
colorPalette: {
|
|
209
|
+
canvasBackground?: string[] | undefined;
|
|
210
|
+
elementBackground?: string[] | undefined;
|
|
211
|
+
elementStroke?: string[] | undefined;
|
|
212
|
+
};
|
|
199
213
|
};
|
|
200
214
|
commitToHistory: true;
|
|
201
215
|
};
|
|
@@ -290,6 +304,13 @@ export declare const actionChangeSloppiness: {
|
|
|
290
304
|
};
|
|
291
305
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
292
306
|
showHyperlinkPopup: false | "info" | "editor";
|
|
307
|
+
linkOpacity: number;
|
|
308
|
+
trayModeEnabled: boolean;
|
|
309
|
+
colorPalette: {
|
|
310
|
+
canvasBackground?: string[] | undefined;
|
|
311
|
+
elementBackground?: string[] | undefined;
|
|
312
|
+
elementStroke?: string[] | undefined;
|
|
313
|
+
};
|
|
293
314
|
};
|
|
294
315
|
commitToHistory: true;
|
|
295
316
|
};
|
|
@@ -384,6 +405,13 @@ export declare const actionChangeStrokeStyle: {
|
|
|
384
405
|
};
|
|
385
406
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
386
407
|
showHyperlinkPopup: false | "info" | "editor";
|
|
408
|
+
linkOpacity: number;
|
|
409
|
+
trayModeEnabled: boolean;
|
|
410
|
+
colorPalette: {
|
|
411
|
+
canvasBackground?: string[] | undefined;
|
|
412
|
+
elementBackground?: string[] | undefined;
|
|
413
|
+
elementStroke?: string[] | undefined;
|
|
414
|
+
};
|
|
387
415
|
};
|
|
388
416
|
commitToHistory: true;
|
|
389
417
|
};
|
|
@@ -478,6 +506,13 @@ export declare const actionChangeOpacity: {
|
|
|
478
506
|
};
|
|
479
507
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
480
508
|
showHyperlinkPopup: false | "info" | "editor";
|
|
509
|
+
linkOpacity: number;
|
|
510
|
+
trayModeEnabled: boolean;
|
|
511
|
+
colorPalette: {
|
|
512
|
+
canvasBackground?: string[] | undefined;
|
|
513
|
+
elementBackground?: string[] | undefined;
|
|
514
|
+
elementStroke?: string[] | undefined;
|
|
515
|
+
};
|
|
481
516
|
};
|
|
482
517
|
commitToHistory: true;
|
|
483
518
|
};
|
|
@@ -572,6 +607,13 @@ export declare const actionChangeFontSize: {
|
|
|
572
607
|
};
|
|
573
608
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
574
609
|
showHyperlinkPopup: false | "info" | "editor";
|
|
610
|
+
linkOpacity: number;
|
|
611
|
+
trayModeEnabled: boolean;
|
|
612
|
+
colorPalette: {
|
|
613
|
+
canvasBackground?: string[] | undefined;
|
|
614
|
+
elementBackground?: string[] | undefined;
|
|
615
|
+
elementStroke?: string[] | undefined;
|
|
616
|
+
};
|
|
575
617
|
};
|
|
576
618
|
commitToHistory: boolean;
|
|
577
619
|
};
|
|
@@ -666,6 +708,13 @@ export declare const actionDecreaseFontSize: {
|
|
|
666
708
|
};
|
|
667
709
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
668
710
|
showHyperlinkPopup: false | "info" | "editor";
|
|
711
|
+
linkOpacity: number;
|
|
712
|
+
trayModeEnabled: boolean;
|
|
713
|
+
colorPalette: {
|
|
714
|
+
canvasBackground?: string[] | undefined;
|
|
715
|
+
elementBackground?: string[] | undefined;
|
|
716
|
+
elementStroke?: string[] | undefined;
|
|
717
|
+
};
|
|
669
718
|
};
|
|
670
719
|
commitToHistory: boolean;
|
|
671
720
|
};
|
|
@@ -760,6 +809,13 @@ export declare const actionIncreaseFontSize: {
|
|
|
760
809
|
};
|
|
761
810
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
762
811
|
showHyperlinkPopup: false | "info" | "editor";
|
|
812
|
+
linkOpacity: number;
|
|
813
|
+
trayModeEnabled: boolean;
|
|
814
|
+
colorPalette: {
|
|
815
|
+
canvasBackground?: string[] | undefined;
|
|
816
|
+
elementBackground?: string[] | undefined;
|
|
817
|
+
elementStroke?: string[] | undefined;
|
|
818
|
+
};
|
|
763
819
|
};
|
|
764
820
|
commitToHistory: boolean;
|
|
765
821
|
};
|
|
@@ -854,6 +910,13 @@ export declare const actionChangeFontFamily: {
|
|
|
854
910
|
};
|
|
855
911
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
856
912
|
showHyperlinkPopup: false | "info" | "editor";
|
|
913
|
+
linkOpacity: number;
|
|
914
|
+
trayModeEnabled: boolean;
|
|
915
|
+
colorPalette: {
|
|
916
|
+
canvasBackground?: string[] | undefined;
|
|
917
|
+
elementBackground?: string[] | undefined;
|
|
918
|
+
elementStroke?: string[] | undefined;
|
|
919
|
+
};
|
|
857
920
|
};
|
|
858
921
|
commitToHistory: true;
|
|
859
922
|
};
|
|
@@ -948,6 +1011,13 @@ export declare const actionChangeTextAlign: {
|
|
|
948
1011
|
};
|
|
949
1012
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
950
1013
|
showHyperlinkPopup: false | "info" | "editor";
|
|
1014
|
+
linkOpacity: number;
|
|
1015
|
+
trayModeEnabled: boolean;
|
|
1016
|
+
colorPalette: {
|
|
1017
|
+
canvasBackground?: string[] | undefined;
|
|
1018
|
+
elementBackground?: string[] | undefined;
|
|
1019
|
+
elementStroke?: string[] | undefined;
|
|
1020
|
+
};
|
|
951
1021
|
};
|
|
952
1022
|
commitToHistory: true;
|
|
953
1023
|
};
|
|
@@ -1042,6 +1112,13 @@ export declare const actionChangeSharpness: {
|
|
|
1042
1112
|
};
|
|
1043
1113
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
1044
1114
|
showHyperlinkPopup: false | "info" | "editor";
|
|
1115
|
+
linkOpacity: number;
|
|
1116
|
+
trayModeEnabled: boolean;
|
|
1117
|
+
colorPalette: {
|
|
1118
|
+
canvasBackground?: string[] | undefined;
|
|
1119
|
+
elementBackground?: string[] | undefined;
|
|
1120
|
+
elementStroke?: string[] | undefined;
|
|
1121
|
+
};
|
|
1045
1122
|
};
|
|
1046
1123
|
commitToHistory: true;
|
|
1047
1124
|
};
|
|
@@ -1139,6 +1216,13 @@ export declare const actionChangeArrowhead: {
|
|
|
1139
1216
|
};
|
|
1140
1217
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
1141
1218
|
showHyperlinkPopup: false | "info" | "editor";
|
|
1219
|
+
linkOpacity: number;
|
|
1220
|
+
trayModeEnabled: boolean;
|
|
1221
|
+
colorPalette: {
|
|
1222
|
+
canvasBackground?: string[] | undefined;
|
|
1223
|
+
elementBackground?: string[] | undefined;
|
|
1224
|
+
elementStroke?: string[] | undefined;
|
|
1225
|
+
};
|
|
1142
1226
|
};
|
|
1143
1227
|
commitToHistory: true;
|
|
1144
1228
|
};
|
|
@@ -86,6 +86,13 @@ export declare const actionCopyStyles: {
|
|
|
86
86
|
};
|
|
87
87
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
88
88
|
showHyperlinkPopup: false | "info" | "editor";
|
|
89
|
+
linkOpacity: number;
|
|
90
|
+
trayModeEnabled: boolean;
|
|
91
|
+
colorPalette: {
|
|
92
|
+
canvasBackground?: string[] | undefined;
|
|
93
|
+
elementBackground?: string[] | undefined;
|
|
94
|
+
elementStroke?: string[] | undefined;
|
|
95
|
+
};
|
|
89
96
|
};
|
|
90
97
|
commitToHistory: false;
|
|
91
98
|
};
|
|
@@ -86,6 +86,13 @@ export declare const actionToggleGridMode: {
|
|
|
86
86
|
};
|
|
87
87
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
88
88
|
showHyperlinkPopup: false | "info" | "editor";
|
|
89
|
+
linkOpacity: number;
|
|
90
|
+
trayModeEnabled: boolean;
|
|
91
|
+
colorPalette: {
|
|
92
|
+
canvasBackground?: string[] | undefined;
|
|
93
|
+
elementBackground?: string[] | undefined;
|
|
94
|
+
elementStroke?: string[] | undefined;
|
|
95
|
+
};
|
|
89
96
|
};
|
|
90
97
|
commitToHistory: false;
|
|
91
98
|
};
|
|
@@ -85,6 +85,13 @@ export declare const actionToggleStats: {
|
|
|
85
85
|
};
|
|
86
86
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
87
87
|
showHyperlinkPopup: false | "info" | "editor";
|
|
88
|
+
linkOpacity: number;
|
|
89
|
+
trayModeEnabled: boolean;
|
|
90
|
+
colorPalette: {
|
|
91
|
+
canvasBackground?: string[] | undefined;
|
|
92
|
+
elementBackground?: string[] | undefined;
|
|
93
|
+
elementStroke?: string[] | undefined;
|
|
94
|
+
};
|
|
88
95
|
};
|
|
89
96
|
commitToHistory: false;
|
|
90
97
|
};
|
|
@@ -85,6 +85,13 @@ export declare const actionToggleViewMode: {
|
|
|
85
85
|
};
|
|
86
86
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
87
87
|
showHyperlinkPopup: false | "info" | "editor";
|
|
88
|
+
linkOpacity: number;
|
|
89
|
+
trayModeEnabled: boolean;
|
|
90
|
+
colorPalette: {
|
|
91
|
+
canvasBackground?: string[] | undefined;
|
|
92
|
+
elementBackground?: string[] | undefined;
|
|
93
|
+
elementStroke?: string[] | undefined;
|
|
94
|
+
};
|
|
88
95
|
};
|
|
89
96
|
commitToHistory: false;
|
|
90
97
|
};
|
|
@@ -85,6 +85,13 @@ export declare const actionToggleZenMode: {
|
|
|
85
85
|
};
|
|
86
86
|
pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
|
|
87
87
|
showHyperlinkPopup: false | "info" | "editor";
|
|
88
|
+
linkOpacity: number;
|
|
89
|
+
trayModeEnabled: boolean;
|
|
90
|
+
colorPalette: {
|
|
91
|
+
canvasBackground?: string[] | undefined;
|
|
92
|
+
elementBackground?: string[] | undefined;
|
|
93
|
+
elementStroke?: string[] | undefined;
|
|
94
|
+
};
|
|
88
95
|
};
|
|
89
96
|
commitToHistory: false;
|
|
90
97
|
};
|
|
@@ -116,6 +116,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
116
116
|
private handleCanvasPointerMove;
|
|
117
117
|
private handleTouchMove;
|
|
118
118
|
private handleCanvasPointerDown;
|
|
119
|
+
private handleCanvasPointerUp;
|
|
119
120
|
private maybeOpenContextMenuAfterPointerDownOnTouchDevices;
|
|
120
121
|
private maybeCleanupAfterMissingPointerUp;
|
|
121
122
|
private handleCanvasPanUsingWheelOrSpaceDrag;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./ColorPicker.scss";
|
|
3
|
-
export declare const ColorPicker: ({ type, color, onChange, label, isActive, setActive, }: {
|
|
3
|
+
export declare const ColorPicker: ({ type, color, onChange, label, isActive, setActive, colorPalette, }: {
|
|
4
4
|
type: "canvasBackground" | "elementBackground" | "elementStroke";
|
|
5
5
|
color: string | null;
|
|
6
6
|
onChange: (color: string) => void;
|
|
7
7
|
label: string;
|
|
8
8
|
isActive: boolean;
|
|
9
9
|
setActive: (active: boolean) => void;
|
|
10
|
+
colorPalette: {
|
|
11
|
+
canvasBackground?: string[];
|
|
12
|
+
elementBackground?: string[];
|
|
13
|
+
elementStroke?: string[];
|
|
14
|
+
};
|
|
10
15
|
}) => JSX.Element;
|
package/types/constants.d.ts
CHANGED
|
@@ -17,10 +17,10 @@ export declare const CURSOR_TYPE: {
|
|
|
17
17
|
AUTO: string;
|
|
18
18
|
};
|
|
19
19
|
export declare const POINTER_BUTTON: {
|
|
20
|
-
MAIN:
|
|
21
|
-
WHEEL:
|
|
22
|
-
SECONDARY:
|
|
23
|
-
TOUCH:
|
|
20
|
+
readonly MAIN: 0;
|
|
21
|
+
readonly WHEEL: 1;
|
|
22
|
+
readonly SECONDARY: 2;
|
|
23
|
+
readonly TOUCH: -1;
|
|
24
24
|
};
|
|
25
25
|
export declare enum EVENT {
|
|
26
26
|
COPY = "copy",
|
|
@@ -99,6 +99,13 @@ export declare const actionLink: {
|
|
|
99
99
|
data: import("../charts").Spreadsheet;
|
|
100
100
|
};
|
|
101
101
|
pendingImageElement: import("./types").NonDeleted<import("./types").ExcalidrawImageElement> | null;
|
|
102
|
+
linkOpacity: number;
|
|
103
|
+
trayModeEnabled: boolean;
|
|
104
|
+
colorPalette: {
|
|
105
|
+
canvasBackground?: string[] | undefined;
|
|
106
|
+
elementBackground?: string[] | undefined;
|
|
107
|
+
elementStroke?: string[] | undefined;
|
|
108
|
+
};
|
|
102
109
|
};
|
|
103
110
|
commitToHistory: true;
|
|
104
111
|
};
|
|
@@ -111,7 +118,7 @@ export declare const actionLink: {
|
|
|
111
118
|
};
|
|
112
119
|
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.edit" | "labels.link.create";
|
|
113
120
|
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: AppState) => [x: number, y: number, width: number, height: number];
|
|
114
|
-
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number]) => boolean;
|
|
121
|
+
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number], isMobile: boolean) => boolean;
|
|
115
122
|
export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState) => void;
|
|
116
123
|
export declare const hideHyperlinkToolip: () => void;
|
|
117
124
|
export declare const shouldHideLinkPopup: (element: NonDeletedExcalidrawElement, appState: AppState, [clientX, clientY]: readonly [number, number]) => Boolean;
|
|
@@ -167,6 +167,13 @@ export declare class LinearElementEditor {
|
|
|
167
167
|
};
|
|
168
168
|
pendingImageElement: NonDeleted<import("./types").ExcalidrawImageElement> | null;
|
|
169
169
|
showHyperlinkPopup: false | "info" | "editor";
|
|
170
|
+
linkOpacity: number;
|
|
171
|
+
trayModeEnabled: boolean;
|
|
172
|
+
colorPalette: {
|
|
173
|
+
canvasBackground?: string[] | undefined;
|
|
174
|
+
elementBackground?: string[] | undefined;
|
|
175
|
+
elementStroke?: string[] | undefined;
|
|
176
|
+
};
|
|
170
177
|
};
|
|
171
178
|
};
|
|
172
179
|
static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
|
package/types/keys.d.ts
CHANGED
|
@@ -13,7 +13,16 @@ export interface ExcalidrawElementWithCanvas {
|
|
|
13
13
|
canvasOffsetY: number;
|
|
14
14
|
}
|
|
15
15
|
export declare const DEFAULT_LINK_SIZE = 14;
|
|
16
|
-
|
|
16
|
+
declare type ElementShape = Drawable | Drawable[] | null;
|
|
17
|
+
declare type ElementShapes = {
|
|
18
|
+
freedraw: Drawable | null;
|
|
19
|
+
arrow: Drawable[];
|
|
20
|
+
line: Drawable[];
|
|
21
|
+
text: null;
|
|
22
|
+
image: null;
|
|
23
|
+
};
|
|
24
|
+
export declare const getShapeForElement: <T extends ExcalidrawElement>(element: T) => T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : Drawable | null | undefined;
|
|
25
|
+
export declare const setShapeForElement: <T extends ExcalidrawElement>(element: T, shape: T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable) => WeakMap<ExcalidrawElement, ElementShape>;
|
|
17
26
|
export declare const invalidateShapeForElement: (element: ExcalidrawElement) => boolean;
|
|
18
27
|
export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
|
|
19
28
|
export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: RenderConfig) => void;
|
|
@@ -22,3 +31,4 @@ export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
|
|
|
22
31
|
export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
|
|
23
32
|
export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
|
|
24
33
|
export declare function getFreeDrawSvgPath(element: ExcalidrawFreeDrawElement): string;
|
|
34
|
+
export {};
|
package/types/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { LinearElementEditor } from "./element/linearElementEditor";
|
|
|
6
6
|
import { SuggestedBinding } from "./element/binding";
|
|
7
7
|
import { ImportedDataState } from "./data/types";
|
|
8
8
|
import type App from "./components/App";
|
|
9
|
-
import type { ResolvablePromise } from "./utils";
|
|
9
|
+
import type { ResolvablePromise, throttleRAF } from "./utils";
|
|
10
10
|
import { Spreadsheet } from "./charts";
|
|
11
11
|
import { Language } from "./i18n";
|
|
12
12
|
import { ClipboardData } from "./clipboard";
|
|
@@ -126,6 +126,13 @@ export declare type AppState = {
|
|
|
126
126
|
/** imageElement waiting to be placed on canvas */
|
|
127
127
|
pendingImageElement: NonDeleted<ExcalidrawImageElement> | null;
|
|
128
128
|
showHyperlinkPopup: false | "info" | "editor";
|
|
129
|
+
linkOpacity: number;
|
|
130
|
+
trayModeEnabled: boolean;
|
|
131
|
+
colorPalette: {
|
|
132
|
+
canvasBackground?: string[];
|
|
133
|
+
elementBackground?: string[];
|
|
134
|
+
elementStroke?: string[];
|
|
135
|
+
};
|
|
129
136
|
};
|
|
130
137
|
export declare type NormalizedZoomValue = number & {
|
|
131
138
|
_brand: "normalizedZoom";
|
|
@@ -205,7 +212,7 @@ export interface ExcalidrawProps {
|
|
|
205
212
|
generateIdForFile?: (file: File) => string | Promise<string>;
|
|
206
213
|
onThemeChange?: (newTheme: string) => void;
|
|
207
214
|
onLinkOpen?: (element: NonDeletedExcalidrawElement, event: CustomEvent<{
|
|
208
|
-
nativeEvent: MouseEvent
|
|
215
|
+
nativeEvent: MouseEvent | React.PointerEvent<HTMLCanvasElement>;
|
|
209
216
|
}>) => void;
|
|
210
217
|
onLinkHover?: (element: NonDeletedExcalidrawElement, event: React.PointerEvent<HTMLCanvasElement>) => void;
|
|
211
218
|
}
|
|
@@ -306,7 +313,7 @@ export declare type PointerDownState = Readonly<{
|
|
|
306
313
|
} | null;
|
|
307
314
|
};
|
|
308
315
|
eventListeners: {
|
|
309
|
-
onMove: null |
|
|
316
|
+
onMove: null | ReturnType<typeof throttleRAF>;
|
|
310
317
|
onUp: null | ((event: PointerEvent) => void);
|
|
311
318
|
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
312
319
|
onKeyUp: null | ((event: KeyboardEvent) => void);
|
package/types/utils.d.ts
CHANGED
|
@@ -20,6 +20,11 @@ export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeo
|
|
|
20
20
|
flush(): void;
|
|
21
21
|
cancel(): void;
|
|
22
22
|
};
|
|
23
|
+
export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void) => {
|
|
24
|
+
(...args: T): void;
|
|
25
|
+
flush(): void;
|
|
26
|
+
cancel(): void;
|
|
27
|
+
};
|
|
23
28
|
export declare const chunk: <T extends unknown>(array: readonly T[], size: number) => T[][];
|
|
24
29
|
export declare const selectNode: (node: Element) => void;
|
|
25
30
|
export declare const removeSelection: () => void;
|
|
@@ -83,6 +88,15 @@ export declare const resolvablePromise: <T>() => ResolvablePromise<T>;
|
|
|
83
88
|
* @param func handler taking at most single parameter (event).
|
|
84
89
|
*/
|
|
85
90
|
export declare const withBatchedUpdates: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) => TFunction;
|
|
91
|
+
/**
|
|
92
|
+
* barches React state updates and throttles the calls to a single call per
|
|
93
|
+
* animation frame
|
|
94
|
+
*/
|
|
95
|
+
export declare const withBatchedUpdatesThrottled: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) => {
|
|
96
|
+
(...args: Parameters<TFunction>): void;
|
|
97
|
+
flush(): void;
|
|
98
|
+
cancel(): void;
|
|
99
|
+
};
|
|
86
100
|
export declare const nFormatter: (num: number, digits: number) => string;
|
|
87
101
|
export declare const getVersion: () => string;
|
|
88
102
|
export declare const supportsEmoji: () => boolean;
|