@excalidraw/common 0.18.0-508de2f3a → 0.18.0-51ad895
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/dev/index.js +327 -46
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/index.js +3 -3
- package/dist/types/common/src/constants.d.ts +20 -15
- package/dist/types/common/src/editorInterface.d.ts +34 -0
- package/dist/types/common/src/index.d.ts +2 -0
- package/dist/types/common/src/utils.d.ts +9 -3
- package/dist/types/common/src/visualdebug.d.ts +41 -0
- package/dist/types/element/src/binding.d.ts +55 -43
- package/dist/types/element/src/bounds.d.ts +1 -1
- package/dist/types/element/src/collision.d.ts +6 -2
- package/dist/types/element/src/delta.d.ts +4 -5
- package/dist/types/element/src/index.d.ts +1 -3
- package/dist/types/element/src/linearElementEditor.d.ts +15 -18
- package/dist/types/element/src/mutateElement.d.ts +0 -1
- package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/dist/types/element/src/renderElement.d.ts +5 -2
- package/dist/types/element/src/resizeTest.d.ts +5 -4
- package/dist/types/element/src/store.d.ts +5 -0
- package/dist/types/element/src/textElement.d.ts +1 -1
- package/dist/types/element/src/transformHandles.d.ts +5 -4
- package/dist/types/element/src/typeChecks.d.ts +2 -3
- package/dist/types/element/src/types.d.ts +7 -11
- package/dist/types/element/src/utils.d.ts +2 -1
- package/dist/types/element/src/zindex.d.ts +7 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +34 -13
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +25 -11
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +153 -262
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +46 -773
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +12 -5
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +42 -23
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +11 -6
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +23 -9
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +12 -5
- package/dist/types/excalidraw/actions/actionExport.d.ts +68 -943
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +10 -393
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionFrame.d.ts +50 -24
- package/dist/types/excalidraw/actions/actionGroup.d.ts +24 -10
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +22 -19
- package/dist/types/excalidraw/actions/actionLink.d.ts +9 -2
- package/dist/types/excalidraw/actions/actionMenu.d.ts +10 -371
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +21 -359
- package/dist/types/excalidraw/actions/actionProperties.d.ts +87 -2403
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +12 -5
- package/dist/types/excalidraw/actions/actionStyles.d.ts +13 -6
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +11 -4
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +11 -4
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +10 -5
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +11 -4
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +11 -4
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +12 -5
- package/dist/types/excalidraw/actions/actionZindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/index.d.ts +2 -2
- package/dist/types/excalidraw/actions/manager.d.ts +1 -1
- package/dist/types/excalidraw/actions/register.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +4 -4
- package/dist/types/excalidraw/appState.d.ts +9 -4
- package/dist/types/excalidraw/clipboard.d.ts +64 -1
- package/dist/types/excalidraw/components/Actions.d.ts +21 -4
- package/dist/types/excalidraw/components/App.d.ts +36 -27
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -2
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
- package/dist/types/excalidraw/components/FilledButton.d.ts +1 -1
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
- package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
- package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
- package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +11 -0
- package/dist/types/excalidraw/components/Popover.d.ts +2 -1
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/TextField.d.ts +1 -0
- package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +6 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
- package/dist/types/excalidraw/components/icons.d.ts +10 -0
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +13 -1
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
- package/dist/types/excalidraw/components/shapes.d.ts +129 -1
- package/dist/types/excalidraw/data/blob.d.ts +3 -7
- package/dist/types/excalidraw/data/restore.d.ts +3 -3
- package/dist/types/excalidraw/data/types.d.ts +4 -1
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +3 -1
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
- package/dist/types/excalidraw/index.d.ts +2 -3
- package/dist/types/excalidraw/renderer/animation.d.ts +12 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +2 -6
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +5 -13
- package/dist/types/excalidraw/scene/types.d.ts +15 -3
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/types.d.ts +32 -21
- package/dist/types/math/src/segment.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES } from "@excalidraw/common";
|
|
2
|
-
import type { ApplyToOptions, SuggestedBinding } from "@excalidraw/element";
|
|
1
|
+
import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, EditorInterface } from "@excalidraw/common";
|
|
3
2
|
import type { LinearElementEditor } from "@excalidraw/element";
|
|
4
3
|
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
5
|
-
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
|
|
4
|
+
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode } from "@excalidraw/element/types";
|
|
6
5
|
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
|
|
7
6
|
import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
|
|
8
7
|
import type { Action } from "./actions/types";
|
|
@@ -125,6 +124,7 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
125
124
|
frameRendering: AppState["frameRendering"];
|
|
126
125
|
currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
|
|
127
126
|
hoveredElementIds: AppState["hoveredElementIds"];
|
|
127
|
+
suggestedBinding: AppState["suggestedBinding"];
|
|
128
128
|
croppingElementId: AppState["croppingElementId"];
|
|
129
129
|
}>;
|
|
130
130
|
export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
@@ -133,8 +133,9 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
133
133
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
134
134
|
selectedLinearElement: AppState["selectedLinearElement"];
|
|
135
135
|
multiElement: AppState["multiElement"];
|
|
136
|
+
newElement: AppState["newElement"];
|
|
136
137
|
isBindingEnabled: AppState["isBindingEnabled"];
|
|
137
|
-
|
|
138
|
+
suggestedBinding: AppState["suggestedBinding"];
|
|
138
139
|
isRotating: AppState["isRotating"];
|
|
139
140
|
elementsToHighlight: AppState["elementsToHighlight"];
|
|
140
141
|
collaborators: AppState["collaborators"];
|
|
@@ -145,6 +146,10 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
145
146
|
croppingElementId: AppState["croppingElementId"];
|
|
146
147
|
searchMatches: AppState["searchMatches"];
|
|
147
148
|
activeLockedId: AppState["activeLockedId"];
|
|
149
|
+
hoveredElementIds: AppState["hoveredElementIds"];
|
|
150
|
+
frameRendering: AppState["frameRendering"];
|
|
151
|
+
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
152
|
+
exportScale: AppState["exportScale"];
|
|
148
153
|
}>;
|
|
149
154
|
export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
|
|
150
155
|
export type ObservedStandaloneAppState = {
|
|
@@ -198,7 +203,7 @@ export interface AppState {
|
|
|
198
203
|
selectionElement: NonDeletedExcalidrawElement | null;
|
|
199
204
|
isBindingEnabled: boolean;
|
|
200
205
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
201
|
-
|
|
206
|
+
suggestedBinding: NonDeleted<ExcalidrawBindableElement> | null;
|
|
202
207
|
frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
203
208
|
frameRendering: {
|
|
204
209
|
enabled: boolean;
|
|
@@ -221,6 +226,10 @@ export interface AppState {
|
|
|
221
226
|
locked: boolean;
|
|
222
227
|
fromSelection: boolean;
|
|
223
228
|
} & ActiveTool;
|
|
229
|
+
preferredSelectionTool: {
|
|
230
|
+
type: "selection" | "lasso";
|
|
231
|
+
initialized: boolean;
|
|
232
|
+
};
|
|
224
233
|
penMode: boolean;
|
|
225
234
|
penDetected: boolean;
|
|
226
235
|
exportBackground: boolean;
|
|
@@ -251,8 +260,8 @@ export interface AppState {
|
|
|
251
260
|
isResizing: boolean;
|
|
252
261
|
isRotating: boolean;
|
|
253
262
|
zoom: Zoom;
|
|
254
|
-
openMenu: "canvas" |
|
|
255
|
-
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | null;
|
|
263
|
+
openMenu: "canvas" | null;
|
|
264
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
256
265
|
openSidebar: {
|
|
257
266
|
name: SidebarName;
|
|
258
267
|
tab?: SidebarTabName;
|
|
@@ -264,6 +273,8 @@ export interface AppState {
|
|
|
264
273
|
tab: "text-to-diagram" | "mermaid";
|
|
265
274
|
} | {
|
|
266
275
|
name: "commandPalette";
|
|
276
|
+
} | {
|
|
277
|
+
name: "settings";
|
|
267
278
|
} | {
|
|
268
279
|
name: "elementLinkSelector";
|
|
269
280
|
sourceElementId: ExcalidrawElement["id"];
|
|
@@ -351,6 +362,7 @@ export interface AppState {
|
|
|
351
362
|
lockedMultiSelections: {
|
|
352
363
|
[groupId: string]: true;
|
|
353
364
|
};
|
|
365
|
+
bindMode: BindMode;
|
|
354
366
|
}
|
|
355
367
|
export type SearchMatch = {
|
|
356
368
|
id: string;
|
|
@@ -363,7 +375,7 @@ export type SearchMatch = {
|
|
|
363
375
|
showOnCanvas: boolean;
|
|
364
376
|
}[];
|
|
365
377
|
};
|
|
366
|
-
export type UIAppState = Omit<AppState, "
|
|
378
|
+
export type UIAppState = Omit<AppState, "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
|
|
367
379
|
export type NormalizedZoomValue = number & {
|
|
368
380
|
_brand: "normalizedZoom";
|
|
369
381
|
};
|
|
@@ -441,6 +453,7 @@ export interface ExcalidrawProps {
|
|
|
441
453
|
onDuplicate?: (nextElements: readonly ExcalidrawElement[],
|
|
442
454
|
/** excludes the duplicated elements */
|
|
443
455
|
prevElements: readonly ExcalidrawElement[]) => ExcalidrawElement[] | void;
|
|
456
|
+
renderTopLeftUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
444
457
|
renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
445
458
|
langCode?: Language["code"];
|
|
446
459
|
viewModeEnabled?: boolean;
|
|
@@ -478,7 +491,6 @@ export type SceneData = {
|
|
|
478
491
|
collaborators?: Map<SocketId, Collaborator>;
|
|
479
492
|
captureUpdate?: CaptureUpdateActionType;
|
|
480
493
|
};
|
|
481
|
-
export type ApplyDeltasOptions = Omit<ApplyToOptions, "skipRedraw">;
|
|
482
494
|
export type ExportOpts = {
|
|
483
495
|
saveFileToDisk?: boolean;
|
|
484
496
|
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles) => void;
|
|
@@ -499,6 +511,12 @@ export type UIOptions = Partial<{
|
|
|
499
511
|
tools: {
|
|
500
512
|
image: boolean;
|
|
501
513
|
};
|
|
514
|
+
/**
|
|
515
|
+
* Optionally control the editor form factor and desktop UI mode from the host app.
|
|
516
|
+
* If not provided, we will take care of it internally.
|
|
517
|
+
*/
|
|
518
|
+
formFactor?: EditorInterface["formFactor"];
|
|
519
|
+
desktopUIMode?: EditorInterface["desktopUIMode"];
|
|
502
520
|
/** @deprecated does nothing. Will be removed in 0.15 */
|
|
503
521
|
welcomeScreen?: boolean;
|
|
504
522
|
}>;
|
|
@@ -529,7 +547,7 @@ export type AppClassProperties = {
|
|
|
529
547
|
mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
530
548
|
}>;
|
|
531
549
|
files: BinaryFiles;
|
|
532
|
-
|
|
550
|
+
editorInterface: App["editorInterface"];
|
|
533
551
|
scene: App["scene"];
|
|
534
552
|
syncActionResult: App["syncActionResult"];
|
|
535
553
|
fonts: App["fonts"];
|
|
@@ -558,6 +576,8 @@ export type AppClassProperties = {
|
|
|
558
576
|
excalidrawContainerValue: App["excalidrawContainerValue"];
|
|
559
577
|
onPointerUpEmitter: App["onPointerUpEmitter"];
|
|
560
578
|
updateEditorAtom: App["updateEditorAtom"];
|
|
579
|
+
onPointerDownEmitter: App["onPointerDownEmitter"];
|
|
580
|
+
bindModeHandler: App["bindModeHandler"];
|
|
561
581
|
};
|
|
562
582
|
export type PointerDownState = Readonly<{
|
|
563
583
|
origin: Readonly<{
|
|
@@ -605,6 +625,7 @@ export type PointerDownState = Readonly<{
|
|
|
605
625
|
x: number;
|
|
606
626
|
y: number;
|
|
607
627
|
};
|
|
628
|
+
blockDragging: boolean;
|
|
608
629
|
};
|
|
609
630
|
eventListeners: {
|
|
610
631
|
onMove: null | ReturnType<typeof throttleRAF>;
|
|
@@ -642,6 +663,7 @@ export interface ExcalidrawImperativeAPI {
|
|
|
642
663
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
643
664
|
resetCursor: InstanceType<typeof App>["resetCursor"];
|
|
644
665
|
toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
|
|
666
|
+
getEditorInterface: () => EditorInterface;
|
|
645
667
|
/**
|
|
646
668
|
* Disables rendering of frames (including element clipping), but currently
|
|
647
669
|
* the frames are still interactive in edit mode. As such, this API should be
|
|
@@ -655,17 +677,6 @@ export interface ExcalidrawImperativeAPI {
|
|
|
655
677
|
onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
|
|
656
678
|
onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
|
|
657
679
|
}
|
|
658
|
-
export type Device = Readonly<{
|
|
659
|
-
viewport: {
|
|
660
|
-
isMobile: boolean;
|
|
661
|
-
isLandscape: boolean;
|
|
662
|
-
};
|
|
663
|
-
editor: {
|
|
664
|
-
isMobile: boolean;
|
|
665
|
-
canFitSidebar: boolean;
|
|
666
|
-
};
|
|
667
|
-
isTouchScreen: boolean;
|
|
668
|
-
}>;
|
|
669
680
|
export type FrameNameBounds = {
|
|
670
681
|
x: number;
|
|
671
682
|
y: number;
|
|
@@ -37,3 +37,4 @@ export declare const distanceToLineSegment: <Point extends GlobalPoint | LocalPo
|
|
|
37
37
|
* @returns
|
|
38
38
|
*/
|
|
39
39
|
export declare function lineSegmentIntersectionPoints<Point extends GlobalPoint | LocalPoint>(l: LineSegment<Point>, s: LineSegment<Point>, threshold?: number): Point | null;
|
|
40
|
+
export declare function lineSegmentsDistance<Point extends GlobalPoint | LocalPoint>(s1: LineSegment<Point>, s2: LineSegment<Point>): number;
|