@zsviczian/excalidraw 0.17.6-3 → 0.17.6-5
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 +1439 -1307
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/styles.development.css +3 -3
- package/package.json +1 -1
- package/types/excalidraw/actions/actionAddToLibrary.d.ts +6 -0
- package/types/excalidraw/actions/actionBoundText.d.ts +4 -0
- package/types/excalidraw/actions/actionCanvas.d.ts +28 -0
- package/types/excalidraw/actions/actionClipboard.d.ts +12 -0
- package/types/excalidraw/actions/actionCropEditor.d.ts +216 -0
- package/types/excalidraw/actions/actionDeleteSelected.d.ts +6 -0
- package/types/excalidraw/actions/actionElementLock.d.ts +4 -0
- package/types/excalidraw/actions/actionExport.d.ts +18 -0
- package/types/excalidraw/actions/actionFinalize.d.ts +4 -0
- package/types/excalidraw/actions/actionFrame.d.ts +8 -0
- package/types/excalidraw/actions/actionGroup.d.ts +4 -0
- package/types/excalidraw/actions/actionLinearEditor.d.ts +2 -0
- package/types/excalidraw/actions/actionLink.d.ts +2 -0
- package/types/excalidraw/actions/actionMenu.d.ts +6 -0
- package/types/excalidraw/actions/actionNavigate.d.ts +4 -0
- package/types/excalidraw/actions/actionProperties.d.ts +30 -0
- package/types/excalidraw/actions/actionSelectAll.d.ts +2 -0
- package/types/excalidraw/actions/actionStyles.d.ts +2 -0
- package/types/excalidraw/actions/actionToggleGridMode.d.ts +2 -0
- package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +2 -0
- package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +4 -0
- package/types/excalidraw/actions/actionToggleStats.d.ts +2 -0
- package/types/excalidraw/actions/actionToggleViewMode.d.ts +2 -0
- package/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -0
- package/types/excalidraw/actions/index.d.ts +1 -0
- package/types/excalidraw/actions/types.d.ts +1 -1
- package/types/excalidraw/change.d.ts +2 -2
- package/types/excalidraw/components/App.d.ts +10 -3
- package/types/excalidraw/components/icons.d.ts +1 -0
- package/types/excalidraw/element/cropElement.d.ts +14 -0
- package/types/excalidraw/element/embeddable.d.ts +2 -0
- package/types/excalidraw/element/newElement.d.ts +1 -0
- package/types/excalidraw/element/transformHandles.d.ts +1 -1
- package/types/excalidraw/element/types.d.ts +10 -0
- package/types/excalidraw/fonts/Cascadia/index.d.ts +2 -0
- package/types/excalidraw/fonts/ComicShanns/index.d.ts +2 -0
- package/types/excalidraw/fonts/Emoji/index.d.ts +2 -0
- package/types/excalidraw/fonts/ExcalidrawFontFace.d.ts +2 -8
- package/types/excalidraw/fonts/Excalifont/index.d.ts +2 -0
- package/types/excalidraw/fonts/FontMetadata.d.ts +37 -0
- package/types/excalidraw/fonts/Fonts.d.ts +85 -0
- package/types/excalidraw/fonts/Helvetica/index.d.ts +2 -0
- package/types/excalidraw/fonts/Liberation/index.d.ts +2 -0
- package/types/excalidraw/fonts/Lilita/index.d.ts +2 -0
- package/types/excalidraw/fonts/Nunito/index.d.ts +2 -0
- package/types/excalidraw/fonts/Virgil/index.d.ts +2 -0
- package/types/excalidraw/fonts/Xiaolai/index.d.ts +8 -0
- package/types/excalidraw/fonts/index.d.ts +1 -87
- package/types/excalidraw/index.d.ts +1 -1
- package/types/excalidraw/keys.d.ts +107 -0
- package/types/excalidraw/obsidianUtils.d.ts +1 -1
- package/types/excalidraw/scene/comparisons.d.ts +1 -0
- package/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +45 -0
- package/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +13 -0
- package/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +2 -0
- package/types/excalidraw/subset/subset-main.d.ts +12 -0
- package/types/excalidraw/subset/subset-shared.chunk.d.ts +32 -0
- package/types/excalidraw/subset/subset-worker.chunk.d.ts +15 -0
- package/types/excalidraw/subset/woff2/woff2-bindings.d.ts +31 -0
- package/types/excalidraw/subset/woff2/woff2-loader.d.ts +14 -0
- package/types/excalidraw/subset/woff2/woff2-wasm.d.ts +2 -0
- package/types/excalidraw/types.d.ts +7 -0
- package/types/math/utils.d.ts +1 -0
- package/types/math/vector.d.ts +4 -0
|
@@ -190,6 +190,8 @@ export declare const actionLink: {
|
|
|
190
190
|
objectsSnapModeEnabled: boolean;
|
|
191
191
|
userToFollow: import("../types").UserToFollow | null;
|
|
192
192
|
followedBy: Set<import("../types").SocketId>;
|
|
193
|
+
isCropping: boolean;
|
|
194
|
+
croppingElementId: string | null;
|
|
193
195
|
searchMatches: readonly {
|
|
194
196
|
id: string;
|
|
195
197
|
focus: boolean;
|
|
@@ -191,6 +191,8 @@ export declare const actionToggleCanvasMenu: {
|
|
|
191
191
|
objectsSnapModeEnabled: boolean;
|
|
192
192
|
userToFollow: import("../types").UserToFollow | null;
|
|
193
193
|
followedBy: Set<import("../types").SocketId>;
|
|
194
|
+
isCropping: boolean;
|
|
195
|
+
croppingElementId: string | null;
|
|
194
196
|
searchMatches: readonly {
|
|
195
197
|
id: string;
|
|
196
198
|
focus: boolean;
|
|
@@ -401,6 +403,8 @@ export declare const actionToggleEditMenu: {
|
|
|
401
403
|
objectsSnapModeEnabled: boolean;
|
|
402
404
|
userToFollow: import("../types").UserToFollow | null;
|
|
403
405
|
followedBy: Set<import("../types").SocketId>;
|
|
406
|
+
isCropping: boolean;
|
|
407
|
+
croppingElementId: string | null;
|
|
404
408
|
searchMatches: readonly {
|
|
405
409
|
id: string;
|
|
406
410
|
focus: boolean;
|
|
@@ -609,6 +613,8 @@ export declare const actionShortcuts: {
|
|
|
609
613
|
objectsSnapModeEnabled: boolean;
|
|
610
614
|
userToFollow: import("../types").UserToFollow | null;
|
|
611
615
|
followedBy: Set<import("../types").SocketId>;
|
|
616
|
+
isCropping: boolean;
|
|
617
|
+
croppingElementId: string | null;
|
|
612
618
|
searchMatches: readonly {
|
|
613
619
|
id: string;
|
|
614
620
|
focus: boolean;
|
|
@@ -193,6 +193,8 @@ export declare const actionGoToCollaborator: {
|
|
|
193
193
|
} | null;
|
|
194
194
|
objectsSnapModeEnabled: boolean;
|
|
195
195
|
followedBy: Set<import("../types").SocketId>;
|
|
196
|
+
isCropping: boolean;
|
|
197
|
+
croppingElementId: string | null;
|
|
196
198
|
searchMatches: readonly {
|
|
197
199
|
id: string;
|
|
198
200
|
focus: boolean;
|
|
@@ -395,6 +397,8 @@ export declare const actionGoToCollaborator: {
|
|
|
395
397
|
} | null;
|
|
396
398
|
objectsSnapModeEnabled: boolean;
|
|
397
399
|
followedBy: Set<import("../types").SocketId>;
|
|
400
|
+
isCropping: boolean;
|
|
401
|
+
croppingElementId: string | null;
|
|
398
402
|
searchMatches: readonly {
|
|
399
403
|
id: string;
|
|
400
404
|
focus: boolean;
|
|
@@ -213,6 +213,8 @@ export declare const actionChangeFillStyle: {
|
|
|
213
213
|
objectsSnapModeEnabled: boolean;
|
|
214
214
|
userToFollow: import("../types").UserToFollow | null;
|
|
215
215
|
followedBy: Set<import("../types").SocketId>;
|
|
216
|
+
isCropping: boolean;
|
|
217
|
+
croppingElementId: string | null;
|
|
216
218
|
searchMatches: readonly {
|
|
217
219
|
id: string;
|
|
218
220
|
focus: boolean;
|
|
@@ -422,6 +424,8 @@ export declare const actionChangeStrokeWidth: {
|
|
|
422
424
|
objectsSnapModeEnabled: boolean;
|
|
423
425
|
userToFollow: import("../types").UserToFollow | null;
|
|
424
426
|
followedBy: Set<import("../types").SocketId>;
|
|
427
|
+
isCropping: boolean;
|
|
428
|
+
croppingElementId: string | null;
|
|
425
429
|
searchMatches: readonly {
|
|
426
430
|
id: string;
|
|
427
431
|
focus: boolean;
|
|
@@ -631,6 +635,8 @@ export declare const actionChangeSloppiness: {
|
|
|
631
635
|
objectsSnapModeEnabled: boolean;
|
|
632
636
|
userToFollow: import("../types").UserToFollow | null;
|
|
633
637
|
followedBy: Set<import("../types").SocketId>;
|
|
638
|
+
isCropping: boolean;
|
|
639
|
+
croppingElementId: string | null;
|
|
634
640
|
searchMatches: readonly {
|
|
635
641
|
id: string;
|
|
636
642
|
focus: boolean;
|
|
@@ -840,6 +846,8 @@ export declare const actionChangeStrokeStyle: {
|
|
|
840
846
|
objectsSnapModeEnabled: boolean;
|
|
841
847
|
userToFollow: import("../types").UserToFollow | null;
|
|
842
848
|
followedBy: Set<import("../types").SocketId>;
|
|
849
|
+
isCropping: boolean;
|
|
850
|
+
croppingElementId: string | null;
|
|
843
851
|
searchMatches: readonly {
|
|
844
852
|
id: string;
|
|
845
853
|
focus: boolean;
|
|
@@ -1049,6 +1057,8 @@ export declare const actionChangeOpacity: {
|
|
|
1049
1057
|
objectsSnapModeEnabled: boolean;
|
|
1050
1058
|
userToFollow: import("../types").UserToFollow | null;
|
|
1051
1059
|
followedBy: Set<import("../types").SocketId>;
|
|
1060
|
+
isCropping: boolean;
|
|
1061
|
+
croppingElementId: string | null;
|
|
1052
1062
|
searchMatches: readonly {
|
|
1053
1063
|
id: string;
|
|
1054
1064
|
focus: boolean;
|
|
@@ -1259,6 +1269,8 @@ export declare const actionChangeFontSize: {
|
|
|
1259
1269
|
objectsSnapModeEnabled: boolean;
|
|
1260
1270
|
userToFollow: import("../types").UserToFollow | null;
|
|
1261
1271
|
followedBy: Set<import("../types").SocketId>;
|
|
1272
|
+
isCropping: boolean;
|
|
1273
|
+
croppingElementId: string | null;
|
|
1262
1274
|
searchMatches: readonly {
|
|
1263
1275
|
id: string;
|
|
1264
1276
|
focus: boolean;
|
|
@@ -1469,6 +1481,8 @@ export declare const actionDecreaseFontSize: {
|
|
|
1469
1481
|
objectsSnapModeEnabled: boolean;
|
|
1470
1482
|
userToFollow: import("../types").UserToFollow | null;
|
|
1471
1483
|
followedBy: Set<import("../types").SocketId>;
|
|
1484
|
+
isCropping: boolean;
|
|
1485
|
+
croppingElementId: string | null;
|
|
1472
1486
|
searchMatches: readonly {
|
|
1473
1487
|
id: string;
|
|
1474
1488
|
focus: boolean;
|
|
@@ -1679,6 +1693,8 @@ export declare const actionIncreaseFontSize: {
|
|
|
1679
1693
|
objectsSnapModeEnabled: boolean;
|
|
1680
1694
|
userToFollow: import("../types").UserToFollow | null;
|
|
1681
1695
|
followedBy: Set<import("../types").SocketId>;
|
|
1696
|
+
isCropping: boolean;
|
|
1697
|
+
croppingElementId: string | null;
|
|
1682
1698
|
searchMatches: readonly {
|
|
1683
1699
|
id: string;
|
|
1684
1700
|
focus: boolean;
|
|
@@ -1887,6 +1903,8 @@ export declare const actionChangeFontFamily: {
|
|
|
1887
1903
|
objectsSnapModeEnabled: boolean;
|
|
1888
1904
|
userToFollow: import("../types").UserToFollow | null;
|
|
1889
1905
|
followedBy: Set<import("../types").SocketId>;
|
|
1906
|
+
isCropping: boolean;
|
|
1907
|
+
croppingElementId: string | null;
|
|
1890
1908
|
searchMatches: readonly {
|
|
1891
1909
|
id: string;
|
|
1892
1910
|
focus: boolean;
|
|
@@ -2087,6 +2105,8 @@ export declare const actionChangeFontFamily: {
|
|
|
2087
2105
|
objectsSnapModeEnabled: boolean;
|
|
2088
2106
|
userToFollow: import("../types").UserToFollow | null;
|
|
2089
2107
|
followedBy: Set<import("../types").SocketId>;
|
|
2108
|
+
isCropping: boolean;
|
|
2109
|
+
croppingElementId: string | null;
|
|
2090
2110
|
searchMatches: readonly {
|
|
2091
2111
|
id: string;
|
|
2092
2112
|
focus: boolean;
|
|
@@ -2296,6 +2316,8 @@ export declare const actionChangeTextAlign: {
|
|
|
2296
2316
|
objectsSnapModeEnabled: boolean;
|
|
2297
2317
|
userToFollow: import("../types").UserToFollow | null;
|
|
2298
2318
|
followedBy: Set<import("../types").SocketId>;
|
|
2319
|
+
isCropping: boolean;
|
|
2320
|
+
croppingElementId: string | null;
|
|
2299
2321
|
searchMatches: readonly {
|
|
2300
2322
|
id: string;
|
|
2301
2323
|
focus: boolean;
|
|
@@ -2507,6 +2529,8 @@ export declare const actionChangeVerticalAlign: {
|
|
|
2507
2529
|
objectsSnapModeEnabled: boolean;
|
|
2508
2530
|
userToFollow: import("../types").UserToFollow | null;
|
|
2509
2531
|
followedBy: Set<import("../types").SocketId>;
|
|
2532
|
+
isCropping: boolean;
|
|
2533
|
+
croppingElementId: string | null;
|
|
2510
2534
|
searchMatches: readonly {
|
|
2511
2535
|
id: string;
|
|
2512
2536
|
focus: boolean;
|
|
@@ -2716,6 +2740,8 @@ export declare const actionChangeRoundness: {
|
|
|
2716
2740
|
objectsSnapModeEnabled: boolean;
|
|
2717
2741
|
userToFollow: import("../types").UserToFollow | null;
|
|
2718
2742
|
followedBy: Set<import("../types").SocketId>;
|
|
2743
|
+
isCropping: boolean;
|
|
2744
|
+
croppingElementId: string | null;
|
|
2719
2745
|
searchMatches: readonly {
|
|
2720
2746
|
id: string;
|
|
2721
2747
|
focus: boolean;
|
|
@@ -2928,6 +2954,8 @@ export declare const actionChangeArrowhead: {
|
|
|
2928
2954
|
objectsSnapModeEnabled: boolean;
|
|
2929
2955
|
userToFollow: import("../types").UserToFollow | null;
|
|
2930
2956
|
followedBy: Set<import("../types").SocketId>;
|
|
2957
|
+
isCropping: boolean;
|
|
2958
|
+
croppingElementId: string | null;
|
|
2931
2959
|
searchMatches: readonly {
|
|
2932
2960
|
id: string;
|
|
2933
2961
|
focus: boolean;
|
|
@@ -3137,6 +3165,8 @@ export declare const actionChangeArrowType: {
|
|
|
3137
3165
|
objectsSnapModeEnabled: boolean;
|
|
3138
3166
|
userToFollow: import("../types").UserToFollow | null;
|
|
3139
3167
|
followedBy: Set<import("../types").SocketId>;
|
|
3168
|
+
isCropping: boolean;
|
|
3169
|
+
croppingElementId: string | null;
|
|
3140
3170
|
searchMatches: readonly {
|
|
3141
3171
|
id: string;
|
|
3142
3172
|
focus: boolean;
|
|
@@ -195,6 +195,8 @@ export declare const actionSelectAll: {
|
|
|
195
195
|
objectsSnapModeEnabled: boolean;
|
|
196
196
|
userToFollow: import("../types").UserToFollow | null;
|
|
197
197
|
followedBy: Set<import("../types").SocketId>;
|
|
198
|
+
isCropping: boolean;
|
|
199
|
+
croppingElementId: string | null;
|
|
198
200
|
searchMatches: readonly {
|
|
199
201
|
id: string;
|
|
200
202
|
focus: boolean;
|
|
@@ -191,6 +191,8 @@ export declare const actionCopyStyles: {
|
|
|
191
191
|
objectsSnapModeEnabled: boolean;
|
|
192
192
|
userToFollow: import("../types").UserToFollow | null;
|
|
193
193
|
followedBy: Set<import("../types").SocketId>;
|
|
194
|
+
isCropping: boolean;
|
|
195
|
+
croppingElementId: string | null;
|
|
194
196
|
searchMatches: readonly {
|
|
195
197
|
id: string;
|
|
196
198
|
focus: boolean;
|
|
@@ -196,6 +196,8 @@ export declare const actionToggleGridMode: {
|
|
|
196
196
|
} | null;
|
|
197
197
|
userToFollow: import("../types").UserToFollow | null;
|
|
198
198
|
followedBy: Set<import("../types").SocketId>;
|
|
199
|
+
isCropping: boolean;
|
|
200
|
+
croppingElementId: string | null;
|
|
199
201
|
searchMatches: readonly {
|
|
200
202
|
id: string;
|
|
201
203
|
focus: boolean;
|
|
@@ -194,6 +194,8 @@ export declare const actionToggleObjectsSnapMode: {
|
|
|
194
194
|
} | null;
|
|
195
195
|
userToFollow: import("../types").UserToFollow | null;
|
|
196
196
|
followedBy: Set<import("../types").SocketId>;
|
|
197
|
+
isCropping: boolean;
|
|
198
|
+
croppingElementId: string | null;
|
|
197
199
|
searchMatches: readonly {
|
|
198
200
|
id: string;
|
|
199
201
|
focus: boolean;
|
|
@@ -194,6 +194,8 @@ export declare const actionToggleSearchMenu: {
|
|
|
194
194
|
objectsSnapModeEnabled: boolean;
|
|
195
195
|
userToFollow: import("../types").UserToFollow | null;
|
|
196
196
|
followedBy: Set<import("../types").SocketId>;
|
|
197
|
+
isCropping: boolean;
|
|
198
|
+
croppingElementId: string | null;
|
|
197
199
|
searchMatches: readonly {
|
|
198
200
|
id: string;
|
|
199
201
|
focus: boolean;
|
|
@@ -386,6 +388,8 @@ export declare const actionToggleSearchMenu: {
|
|
|
386
388
|
objectsSnapModeEnabled: boolean;
|
|
387
389
|
userToFollow: import("../types").UserToFollow | null;
|
|
388
390
|
followedBy: Set<import("../types").SocketId>;
|
|
391
|
+
isCropping: boolean;
|
|
392
|
+
croppingElementId: string | null;
|
|
389
393
|
searchMatches: readonly {
|
|
390
394
|
id: string;
|
|
391
395
|
focus: boolean;
|
|
@@ -195,6 +195,8 @@ export declare const actionToggleStats: {
|
|
|
195
195
|
objectsSnapModeEnabled: boolean;
|
|
196
196
|
userToFollow: import("../types").UserToFollow | null;
|
|
197
197
|
followedBy: Set<import("../types").SocketId>;
|
|
198
|
+
isCropping: boolean;
|
|
199
|
+
croppingElementId: string | null;
|
|
198
200
|
searchMatches: readonly {
|
|
199
201
|
id: string;
|
|
200
202
|
focus: boolean;
|
|
@@ -195,6 +195,8 @@ export declare const actionToggleViewMode: {
|
|
|
195
195
|
objectsSnapModeEnabled: boolean;
|
|
196
196
|
userToFollow: import("../types").UserToFollow | null;
|
|
197
197
|
followedBy: Set<import("../types").SocketId>;
|
|
198
|
+
isCropping: boolean;
|
|
199
|
+
croppingElementId: string | null;
|
|
198
200
|
searchMatches: readonly {
|
|
199
201
|
id: string;
|
|
200
202
|
focus: boolean;
|
|
@@ -195,6 +195,8 @@ export declare const actionToggleZenMode: {
|
|
|
195
195
|
objectsSnapModeEnabled: boolean;
|
|
196
196
|
userToFollow: import("../types").UserToFollow | null;
|
|
197
197
|
followedBy: Set<import("../types").SocketId>;
|
|
198
|
+
isCropping: boolean;
|
|
199
|
+
croppingElementId: string | null;
|
|
198
200
|
searchMatches: readonly {
|
|
199
201
|
id: string;
|
|
200
202
|
focus: boolean;
|
|
@@ -24,3 +24,4 @@ export { actionLink } from "./actionLink";
|
|
|
24
24
|
export { actionToggleElementLock } from "./actionElementLock";
|
|
25
25
|
export { actionToggleLinearEditor } from "./actionLinearEditor";
|
|
26
26
|
export { actionToggleSearchMenu } from "./actionToggleSearchMenu";
|
|
27
|
+
export { actionToggleCropEditor } from "./actionCropEditor";
|
|
@@ -14,7 +14,7 @@ export type ActionResult = {
|
|
|
14
14
|
type ActionFn = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
15
15
|
export type UpdaterFn = (res: ActionResult) => void;
|
|
16
16
|
export type ActionFilterFn = (action: Action) => void;
|
|
17
|
-
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "toggleLaserPointerTool" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu";
|
|
17
|
+
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "toggleLaserPointerTool" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "cropEditor";
|
|
18
18
|
export type PanelComponentProps = {
|
|
19
19
|
elements: readonly ExcalidrawElement[];
|
|
20
20
|
appState: AppState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementUpdate } from "./element/mutateElement";
|
|
2
|
-
import type { OrderedExcalidrawElement, SceneElementsMap } from "./element/types";
|
|
2
|
+
import type { ExcalidrawElement, Ordered, OrderedExcalidrawElement, SceneElementsMap } from "./element/types";
|
|
3
3
|
import type { AppState, ObservedAppState } from "./types";
|
|
4
4
|
import type { ValueOf } from "./utility-types";
|
|
5
5
|
/**
|
|
@@ -116,7 +116,7 @@ export declare class AppStateChange implements Change<AppState> {
|
|
|
116
116
|
private static stripElementsProps;
|
|
117
117
|
private static stripStandaloneProps;
|
|
118
118
|
}
|
|
119
|
-
type ElementPartial = Omit<ElementUpdate<
|
|
119
|
+
type ElementPartial<T extends ExcalidrawElement = ExcalidrawElement> = Omit<ElementUpdate<Ordered<T>>, "seed">;
|
|
120
120
|
/**
|
|
121
121
|
* Elements change is a low level primitive to capture a change between two sets of elements.
|
|
122
122
|
* It does so by encapsulating forward and backward `Delta`s, allowing to time-travel in both directions.
|
|
@@ -5,7 +5,7 @@ import type { ActionResult } from "../actions/types";
|
|
|
5
5
|
import { type EXPORT_IMAGE_TYPES } from "../constants";
|
|
6
6
|
import type { ExportedElements } from "../data";
|
|
7
7
|
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
8
|
-
import type { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "../element/types";
|
|
8
|
+
import type { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, InitializedExcalidrawImageElement, ExcalidrawImageElement, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "../element/types";
|
|
9
9
|
import { History } from "../history";
|
|
10
10
|
import Scene from "../scene/Scene";
|
|
11
11
|
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
|
|
@@ -86,6 +86,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
86
86
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
87
87
|
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
88
88
|
lastPointerMoveEvent: PointerEvent | null;
|
|
89
|
+
lastPointerMoveCoords: {
|
|
90
|
+
x: number;
|
|
91
|
+
y: number;
|
|
92
|
+
} | null;
|
|
89
93
|
lastViewportPosition: {
|
|
90
94
|
x: number;
|
|
91
95
|
y: number;
|
|
@@ -426,6 +430,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
426
430
|
private getTextBindableContainerAtPosition;
|
|
427
431
|
private startTextEditing;
|
|
428
432
|
private debounceDoubleClickTimestamp;
|
|
433
|
+
private startImageCropping;
|
|
434
|
+
private finishImageCropping;
|
|
429
435
|
private handleCanvasDoubleClick;
|
|
430
436
|
private getElementLinkAtPosition;
|
|
431
437
|
private redirectToLink;
|
|
@@ -486,10 +492,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
486
492
|
/**
|
|
487
493
|
* inserts image into elements array and rerenders
|
|
488
494
|
*/
|
|
489
|
-
|
|
495
|
+
insertImageElement: (imageElement: ExcalidrawImageElement, imageFile: File, showCursorImagePreview?: boolean) => Promise<NonDeleted<InitializedExcalidrawImageElement> | null | undefined>;
|
|
490
496
|
private setImagePreviewCursor;
|
|
491
497
|
private onImageAction;
|
|
492
|
-
|
|
498
|
+
initializeImageDimensions: (imageElement: ExcalidrawImageElement, forceNaturalSize?: boolean) => void;
|
|
493
499
|
/** updates image cache, refreshing updated elements and/or setting status
|
|
494
500
|
to error for images that fail during <img> element creation */
|
|
495
501
|
private updateImageCache;
|
|
@@ -508,6 +514,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
508
514
|
loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
|
|
509
515
|
private handleCanvasContextMenu;
|
|
510
516
|
private maybeDragNewGenericElement;
|
|
517
|
+
private maybeHandleCrop;
|
|
511
518
|
private maybeHandleResize;
|
|
512
519
|
private getContextMenuItems;
|
|
513
520
|
private handleWheel;
|
|
@@ -209,4 +209,5 @@ export declare const roundArrowIcon: JSX.Element;
|
|
|
209
209
|
export declare const collapseDownIcon: JSX.Element;
|
|
210
210
|
export declare const collapseUpIcon: JSX.Element;
|
|
211
211
|
export declare const upIcon: JSX.Element;
|
|
212
|
+
export declare const cropIcon: JSX.Element;
|
|
212
213
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TransformHandleType } from "./transformHandles";
|
|
2
|
+
import type { ElementsMap, ExcalidrawImageElement, ImageCrop } from "./types";
|
|
3
|
+
export declare const cropElement: (element: ExcalidrawImageElement, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
crop: ImageCrop | null;
|
|
9
|
+
};
|
|
10
|
+
export declare const getUncroppedImageElement: (element: ExcalidrawImageElement, elementsMap: ElementsMap) => ExcalidrawImageElement;
|
|
11
|
+
export declare const getUncroppedWidthAndHeight: (element: ExcalidrawImageElement) => {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
@@ -200,6 +200,8 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
200
200
|
objectsSnapModeEnabled: boolean;
|
|
201
201
|
userToFollow: import("../types").UserToFollow | null;
|
|
202
202
|
followedBy: Set<import("../types").SocketId>;
|
|
203
|
+
isCropping: boolean;
|
|
204
|
+
croppingElementId: string | null;
|
|
203
205
|
searchMatches: readonly {
|
|
204
206
|
id: string;
|
|
205
207
|
focus: boolean;
|
|
@@ -58,6 +58,7 @@ export declare const newImageElement: (opts: {
|
|
|
58
58
|
status?: ExcalidrawImageElement["status"];
|
|
59
59
|
fileId?: ExcalidrawImageElement["fileId"];
|
|
60
60
|
scale?: ExcalidrawImageElement["scale"];
|
|
61
|
+
crop?: ExcalidrawImageElement["crop"];
|
|
61
62
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
|
|
62
63
|
/**
|
|
63
64
|
* Clones ExcalidrawElement data structure. Does not regenerate id, nonce, or
|
|
@@ -40,7 +40,7 @@ export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [
|
|
|
40
40
|
sw?: boolean | undefined;
|
|
41
41
|
se?: boolean | undefined;
|
|
42
42
|
rotation?: boolean | undefined;
|
|
43
|
-
}, margin?: number) => TransformHandles;
|
|
43
|
+
}, margin?: number, spacing?: number) => TransformHandles;
|
|
44
44
|
export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, elementsMap: ElementsMap, pointerType?: PointerType, omitSides?: {
|
|
45
45
|
e?: boolean | undefined;
|
|
46
46
|
s?: boolean | undefined;
|
|
@@ -120,6 +120,14 @@ export type IframeData = ({
|
|
|
120
120
|
type: "document";
|
|
121
121
|
srcdoc: (theme: Theme) => string;
|
|
122
122
|
}));
|
|
123
|
+
export type ImageCrop = {
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
width: number;
|
|
127
|
+
height: number;
|
|
128
|
+
naturalWidth: number;
|
|
129
|
+
naturalHeight: number;
|
|
130
|
+
};
|
|
123
131
|
export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
|
124
132
|
type: "image";
|
|
125
133
|
fileId: FileId | null;
|
|
@@ -127,6 +135,8 @@ export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
|
|
127
135
|
status: "pending" | "saved" | "error";
|
|
128
136
|
/** X and Y scale factors <-1, 1>, used for image axis flipping */
|
|
129
137
|
scale: [number, number];
|
|
138
|
+
/** whether an element is cropped */
|
|
139
|
+
crop: ImageCrop | null;
|
|
130
140
|
}>;
|
|
131
141
|
export type InitializedExcalidrawImageElement = MarkNonNullable<ExcalidrawImageElement, "fileId">;
|
|
132
142
|
export type ExcalidrawFrameElement = _ExcalidrawElementBase & {
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
type DataURL = string;
|
|
2
|
-
export
|
|
3
|
-
urls: URL[] | DataURL[];
|
|
4
|
-
fontFace: FontFace;
|
|
5
|
-
toCSS(characters: string, codePoints: Array<number>): Promise<string> | undefined;
|
|
6
|
-
getContentLegacy(): Promise<string>;
|
|
7
|
-
}
|
|
8
|
-
export declare class ExcalidrawFontFace implements IExcalidrawFontFace {
|
|
2
|
+
export declare class ExcalidrawFontFace {
|
|
9
3
|
readonly urls: URL[] | DataURL[];
|
|
10
4
|
readonly fontFace: FontFace;
|
|
11
5
|
private static readonly UNPKG_FALLBACK_URL;
|
|
@@ -15,7 +9,7 @@ export declare class ExcalidrawFontFace implements IExcalidrawFontFace {
|
|
|
15
9
|
*
|
|
16
10
|
* Retrieves `undefined` otherwise.
|
|
17
11
|
*/
|
|
18
|
-
toCSS(characters: string
|
|
12
|
+
toCSS(characters: string): Promise<string> | undefined;
|
|
19
13
|
/**
|
|
20
14
|
* Tries to fetch woff2 content, based on the registered urls (from first to last, treated as fallbacks).
|
|
21
15
|
*
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encapsulates font metrics with additional font metadata.
|
|
3
|
+
* */
|
|
4
|
+
export interface FontMetadata {
|
|
5
|
+
/** for head & hhea metrics read the woff2 with https://fontdrop.info/ */
|
|
6
|
+
metrics: {
|
|
7
|
+
/** head.unitsPerEm metric */
|
|
8
|
+
unitsPerEm: 1000 | 1024 | 2048;
|
|
9
|
+
/** hhea.ascender metric */
|
|
10
|
+
ascender: number;
|
|
11
|
+
/** hhea.descender metric */
|
|
12
|
+
descender: number;
|
|
13
|
+
/** harcoded unitless line-height, https://github.com/excalidraw/excalidraw/pull/6360#issuecomment-1477635971 */
|
|
14
|
+
lineHeight: number;
|
|
15
|
+
};
|
|
16
|
+
/** element to be displayed as an icon */
|
|
17
|
+
icon?: JSX.Element;
|
|
18
|
+
/** flag to indicate a deprecated font */
|
|
19
|
+
deprecated?: true;
|
|
20
|
+
/** flag to indicate a server-side only font */
|
|
21
|
+
serverSide?: true;
|
|
22
|
+
/** flag to indiccate a local-only font */
|
|
23
|
+
local?: true;
|
|
24
|
+
/** flag to indicate a fallback font */
|
|
25
|
+
fallback?: true;
|
|
26
|
+
}
|
|
27
|
+
export declare const FONT_METADATA: Record<number, FontMetadata>;
|
|
28
|
+
/** Unicode ranges defined by google fonts */
|
|
29
|
+
export declare const GOOGLE_FONTS_RANGES: {
|
|
30
|
+
LATIN: string;
|
|
31
|
+
LATIN_EXT: string;
|
|
32
|
+
CYRILIC_EXT: string;
|
|
33
|
+
CYRILIC: string;
|
|
34
|
+
VIETNAMESE: string;
|
|
35
|
+
};
|
|
36
|
+
/** local protocol to skip the local font from registering or inlining */
|
|
37
|
+
export declare const LOCAL_FONT_PROTOCOL = "local:";
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ExcalidrawFontFace } from "./ExcalidrawFontFace";
|
|
2
|
+
import { type FontMetadata } from "./FontMetadata";
|
|
3
|
+
import type { ExcalidrawElement, ExcalidrawTextElement, FontFamilyValues } from "../element/types";
|
|
4
|
+
import type Scene from "../scene/Scene";
|
|
5
|
+
export declare class Fonts {
|
|
6
|
+
static readonly loadedFontsCache: Set<string>;
|
|
7
|
+
private static _registered;
|
|
8
|
+
private static _initialized;
|
|
9
|
+
static get registered(): Map<number, {
|
|
10
|
+
metadata: FontMetadata;
|
|
11
|
+
fontFaces: ExcalidrawFontFace[];
|
|
12
|
+
}>;
|
|
13
|
+
get registered(): Map<number, {
|
|
14
|
+
metadata: FontMetadata;
|
|
15
|
+
fontFaces: ExcalidrawFontFace[];
|
|
16
|
+
}>;
|
|
17
|
+
private readonly scene;
|
|
18
|
+
constructor(scene: Scene);
|
|
19
|
+
/**
|
|
20
|
+
* if we load a (new) font, it's likely that text elements using it have
|
|
21
|
+
* already been rendered using a fallback font. Thus, we want invalidate
|
|
22
|
+
* their shapes and rerender. See #637.
|
|
23
|
+
*
|
|
24
|
+
* Invalidates text elements and rerenders scene, provided that at least one
|
|
25
|
+
* of the supplied fontFaces has not already been processed.
|
|
26
|
+
*/
|
|
27
|
+
onLoaded: (fontFaces: readonly FontFace[]) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Load font faces for a given scene and trigger scene update.
|
|
30
|
+
*/
|
|
31
|
+
loadSceneFonts: () => Promise<FontFace[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Load all registered font faces.
|
|
34
|
+
*/
|
|
35
|
+
static loadAllFonts: () => Promise<FontFace[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Load font faces for passed elements - use when the scene is unavailable (i.e. export).
|
|
38
|
+
*/
|
|
39
|
+
static loadElementsFonts: (elements: readonly ExcalidrawElement[]) => Promise<FontFace[]>;
|
|
40
|
+
static loadFontFaces(fontFamilies: Array<ExcalidrawTextElement["fontFamily"]>): Promise<FontFace[]>;
|
|
41
|
+
/**
|
|
42
|
+
* WARN: should be called just once on init, even across multiple instances.
|
|
43
|
+
*/
|
|
44
|
+
private static init;
|
|
45
|
+
/**
|
|
46
|
+
* Register a new font.
|
|
47
|
+
*
|
|
48
|
+
* @param family font family
|
|
49
|
+
* @param metadata font metadata
|
|
50
|
+
* @param fontFacesDecriptors font faces descriptors
|
|
51
|
+
*/
|
|
52
|
+
static register(//zsviczian made public
|
|
53
|
+
this: Fonts | {
|
|
54
|
+
registered: Map<number, {
|
|
55
|
+
metadata: FontMetadata;
|
|
56
|
+
fontFaces: ExcalidrawFontFace[];
|
|
57
|
+
}>;
|
|
58
|
+
}, family: string, metadata: FontMetadata, ...fontFacesDecriptors: ExcalidrawFontFaceDescriptor[]): Map<number, {
|
|
59
|
+
metadata: FontMetadata;
|
|
60
|
+
fontFaces: ExcalidrawFontFace[];
|
|
61
|
+
}> | Map<number, {
|
|
62
|
+
metadata: FontMetadata;
|
|
63
|
+
fontFaces: ExcalidrawFontFace[];
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Gets all the font families for the given scene.
|
|
67
|
+
*/
|
|
68
|
+
getSceneFamilies: () => number[];
|
|
69
|
+
private static getAllFamilies;
|
|
70
|
+
static getElementsFamilies(elements: ReadonlyArray<ExcalidrawElement>): Array<ExcalidrawTextElement["fontFamily"]>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Calculates vertical offset for a text with alphabetic baseline.
|
|
74
|
+
*/
|
|
75
|
+
export declare const getVerticalOffset: (fontFamily: ExcalidrawTextElement["fontFamily"], fontSize: ExcalidrawTextElement["fontSize"], lineHeightPx: number) => number;
|
|
76
|
+
/**
|
|
77
|
+
* Gets line height forr a selected family.
|
|
78
|
+
*/
|
|
79
|
+
export declare const getLineHeight: (fontFamily: FontFamilyValues) => number & {
|
|
80
|
+
_brand: "unitlessLineHeight";
|
|
81
|
+
};
|
|
82
|
+
export interface ExcalidrawFontFaceDescriptor {
|
|
83
|
+
uri: string;
|
|
84
|
+
descriptors?: FontFaceDescriptors;
|
|
85
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
|
|
2
|
+
/**
|
|
3
|
+
* The original font was modified with the following changes:
|
|
4
|
+
* - removed non-CJK codepoints
|
|
5
|
+
* - reduced any Hangul side-bearings to 40%
|
|
6
|
+
* - centered in width of inproperly centered CJK codepoints
|
|
7
|
+
*/
|
|
8
|
+
export declare const XiaolaiFontFaces: ExcalidrawFontFaceDescriptor[];
|