@excalidraw/excalidraw 0.18.0-298812e → 0.18.0-3085f4a
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/chunk-5EDE7GFX.js +5677 -0
- package/dist/dev/chunk-5EDE7GFX.js.map +7 -0
- package/dist/dev/chunk-CP5DND7P.js +7 -0
- package/dist/dev/chunk-CP5DND7P.js.map +7 -0
- package/dist/dev/{chunk-JCUIYZXF.js → chunk-QF5FRM6O.js} +6 -2
- package/dist/dev/chunk-QF5FRM6O.js.map +7 -0
- package/dist/dev/data/{image-CB4ZYE3A.js → image-7AP4KED2.js} +3 -3
- package/dist/dev/index.css +51 -20
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +7101 -4376
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{en-ZDTPSZNL.js → en-SMAPCEOQ.js} +2 -2
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/chunk-A66AFZZU.js +7 -0
- package/dist/prod/{chunk-GCFVWREF.js → chunk-I4UNSFV6.js} +4 -4
- package/dist/prod/chunk-YHEOD47Q.js +4 -0
- package/dist/prod/data/image-G3CCQ4CB.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +25 -18
- package/dist/prod/locales/{en-MHZ26NAR.js → en-TYY6KWIJ.js} +1 -1
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/constants.d.ts +21 -3
- package/dist/types/common/src/utils.d.ts +3 -5
- package/dist/types/element/src/Scene.d.ts +7 -3
- package/dist/types/element/src/align.d.ts +2 -1
- package/dist/types/element/src/binding.d.ts +10 -7
- package/dist/types/element/src/bounds.d.ts +11 -3
- package/dist/types/element/src/collision.d.ts +18 -12
- package/dist/types/element/src/cropElement.d.ts +1 -1
- package/dist/types/element/src/delta.d.ts +41 -9
- package/dist/types/element/src/distance.d.ts +2 -2
- package/dist/types/element/src/distribute.d.ts +2 -1
- package/dist/types/element/src/fractionalIndex.d.ts +8 -2
- package/dist/types/element/src/frame.d.ts +2 -2
- package/dist/types/element/src/groups.d.ts +1 -0
- package/dist/types/element/src/index.d.ts +1 -3
- package/dist/types/element/src/linearElementEditor.d.ts +14 -23
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +2 -1
- package/dist/types/element/src/resizeElements.d.ts +1 -0
- package/dist/types/element/src/selection.d.ts +1 -1
- package/dist/types/element/src/shape.d.ts +42 -0
- package/dist/types/element/src/sizeHelpers.d.ts +2 -1
- package/dist/types/element/src/store.d.ts +19 -9
- package/dist/types/element/src/transformHandles.d.ts +4 -4
- package/dist/types/element/src/typeChecks.d.ts +15 -1
- package/dist/types/element/src/types.d.ts +8 -3
- package/dist/types/element/src/utils.d.ts +16 -6
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +21 -15
- package/dist/types/excalidraw/actions/actionAlign.d.ts +8 -8
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +14 -10
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +195 -155
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +50 -36
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +7 -5
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +27 -20
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -4
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +29 -26
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +7 -5
- package/dist/types/excalidraw/actions/actionExport.d.ts +147 -129
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +65 -20
- package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionFrame.d.ts +78 -70
- package/dist/types/excalidraw/actions/actionGroup.d.ts +20 -16
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +533 -7
- package/dist/types/excalidraw/actions/actionLink.d.ts +8 -6
- package/dist/types/excalidraw/actions/actionMenu.d.ts +22 -16
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +14 -10
- package/dist/types/excalidraw/actions/actionProperties.d.ts +119 -81
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +10 -8
- package/dist/types/excalidraw/actions/actionStyles.d.ts +11 -9
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +9 -7
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +9 -7
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +8 -6
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +9 -7
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +9 -7
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +9 -7
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
- package/dist/types/excalidraw/actions/types.d.ts +2 -1
- package/dist/types/excalidraw/appState.d.ts +29 -20
- package/dist/types/excalidraw/components/Actions.d.ts +0 -4
- package/dist/types/excalidraw/components/App.d.ts +19 -16
- package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -0
- package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
- package/dist/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +11 -1
- package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +1 -0
- package/dist/types/excalidraw/components/icons.d.ts +2 -0
- package/dist/types/excalidraw/components/shapes.d.ts +129 -1
- package/dist/types/excalidraw/data/blob.d.ts +1 -1
- package/dist/types/excalidraw/data/reconcile.d.ts +1 -0
- package/dist/types/excalidraw/data/restore.d.ts +6 -1
- package/dist/types/excalidraw/eraser/index.d.ts +0 -2
- package/dist/types/excalidraw/history.d.ts +21 -5
- package/dist/types/excalidraw/index.d.ts +2 -1
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -1
- package/dist/types/excalidraw/renderer/helpers.d.ts +4 -4
- package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
- package/dist/types/excalidraw/scene/Renderer.d.ts +0 -1
- package/dist/types/excalidraw/types.d.ts +17 -8
- package/dist/types/math/src/angle.d.ts +2 -0
- package/dist/types/math/src/constants.d.ts +3 -0
- package/dist/types/math/src/curve.d.ts +32 -0
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/point.d.ts +1 -1
- package/dist/types/math/src/rectangle.d.ts +2 -0
- package/dist/types/math/src/vector.d.ts +4 -2
- package/history.ts +107 -44
- package/package.json +13 -10
- package/dist/dev/chunk-JCUIYZXF.js.map +0 -7
- package/dist/dev/chunk-RQWTCZLD.js +0 -7
- package/dist/dev/chunk-RQWTCZLD.js.map +0 -7
- package/dist/dev/chunk-ZPGIVNNG.js +0 -23482
- package/dist/dev/chunk-ZPGIVNNG.js.map +0 -7
- package/dist/prod/chunk-7TMLMBQX.js +0 -7
- package/dist/prod/chunk-WFJFO6F4.js +0 -33
- package/dist/prod/data/image-XJI4SWH2.js +0 -1
- package/dist/types/element/src/Shape.d.ts +0 -17
- package/dist/types/element/src/ShapeCache.d.ts +0 -25
- package/dist/types/element/src/shapes.d.ts +0 -23
- package/dist/types/excalidraw/components/ButtonSelect.d.ts +0 -9
- package/dist/types/excalidraw/visualdebug.d.ts +0 -41
- package/dist/types/utils/src/collision.d.ts +0 -8
- /package/dist/dev/data/{image-CB4ZYE3A.js.map → image-7AP4KED2.js.map} +0 -0
- /package/dist/dev/locales/{en-ZDTPSZNL.js.map → en-SMAPCEOQ.js.map} +0 -0
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
|
|
3
|
-
import { LinearElementEditor } from "@excalidraw/element";
|
|
4
|
-
import {
|
|
5
|
-
import { Scene } from "@excalidraw/element";
|
|
6
|
-
import { Store } from "@excalidraw/element";
|
|
7
|
-
import type { ElementUpdate } from "@excalidraw/element";
|
|
8
|
-
import type { ExcalidrawElement, NonDeleted, InitializedExcalidrawImageElement, ExcalidrawImageElement, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "@excalidraw/element/types";
|
|
3
|
+
import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
|
|
4
|
+
import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
|
|
9
5
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
10
6
|
import { ActionManager } from "../actions/manager";
|
|
11
7
|
import { AnimationFrameHandler } from "../animation-frame-handler";
|
|
@@ -82,6 +78,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
82
78
|
/** embeds that have been inserted to DOM (as a perf optim, we don't want to
|
|
83
79
|
* insert to DOM before user initially scrolls to them) */
|
|
84
80
|
private initializedEmbeds;
|
|
81
|
+
private handleToastClose;
|
|
85
82
|
private elementsPendingErasure;
|
|
86
83
|
flowChartCreator: FlowChartCreator;
|
|
87
84
|
private flowChartNavigator;
|
|
@@ -156,6 +153,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
156
153
|
x: number;
|
|
157
154
|
y: number;
|
|
158
155
|
};
|
|
156
|
+
blockDragging: boolean;
|
|
159
157
|
};
|
|
160
158
|
eventListeners: {
|
|
161
159
|
onMove: {
|
|
@@ -225,6 +223,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
225
223
|
x: number;
|
|
226
224
|
y: number;
|
|
227
225
|
};
|
|
226
|
+
blockDragging: boolean;
|
|
228
227
|
};
|
|
229
228
|
eventListeners: {
|
|
230
229
|
onMove: {
|
|
@@ -246,6 +245,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
246
245
|
}>]>;
|
|
247
246
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
248
247
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
248
|
+
defaultSelectionTool: "selection" | "lasso";
|
|
249
249
|
constructor(props: AppProps);
|
|
250
250
|
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
251
251
|
private onWindowMessage;
|
|
@@ -300,6 +300,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
300
300
|
*/
|
|
301
301
|
private resetScene;
|
|
302
302
|
private initializeScene;
|
|
303
|
+
private isMobileOrTablet;
|
|
303
304
|
private isMobileBreakpoint;
|
|
304
305
|
private refreshViewportBreakpoints;
|
|
305
306
|
private refreshEditorBreakpoints;
|
|
@@ -400,6 +401,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
400
401
|
*/
|
|
401
402
|
captureUpdate?: SceneData["captureUpdate"];
|
|
402
403
|
}) => void;
|
|
404
|
+
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
|
|
403
405
|
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
404
406
|
private triggerRender;
|
|
405
407
|
/**
|
|
@@ -415,12 +417,9 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
415
417
|
private onKeyDown;
|
|
416
418
|
private onKeyUp;
|
|
417
419
|
private isToolSupported;
|
|
418
|
-
setActiveTool: (tool: (
|
|
419
|
-
type:
|
|
420
|
+
setActiveTool: (tool: ({
|
|
421
|
+
type: ToolType;
|
|
420
422
|
} | {
|
|
421
|
-
type: Extract<ToolType, "image">;
|
|
422
|
-
insertOnCanvasDirectly?: boolean;
|
|
423
|
-
}) | {
|
|
424
423
|
type: "custom";
|
|
425
424
|
customType: string;
|
|
426
425
|
}) & {
|
|
@@ -446,7 +445,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
446
445
|
private getTextElementAtPosition;
|
|
447
446
|
private getElementAtPosition;
|
|
448
447
|
private getElementsAtPosition;
|
|
449
|
-
getElementHitThreshold(): number;
|
|
448
|
+
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
450
449
|
private hitElement;
|
|
451
450
|
private getTextBindableContainerAtPosition;
|
|
452
451
|
private startTextEditing;
|
|
@@ -509,13 +508,18 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
509
508
|
private restoreReadyToEraseElements;
|
|
510
509
|
private eraseElements;
|
|
511
510
|
private initializeImage;
|
|
511
|
+
/**
|
|
512
|
+
* use during async image initialization,
|
|
513
|
+
* when the placeholder image could have been modified in the meantime,
|
|
514
|
+
* and when you don't want to loose those modifications
|
|
515
|
+
*/
|
|
516
|
+
private getLatestInitializedImageElement;
|
|
512
517
|
/**
|
|
513
518
|
* inserts image into elements array and rerenders
|
|
514
519
|
*/
|
|
515
|
-
insertImageElement
|
|
516
|
-
private setImagePreviewCursor;
|
|
520
|
+
private insertImageElement;
|
|
517
521
|
private onImageAction;
|
|
518
|
-
|
|
522
|
+
private getImageNaturalDimensions;
|
|
519
523
|
/** updates image cache, refreshing updated elements and/or setting status
|
|
520
524
|
to error for images that fail during <img> element creation */
|
|
521
525
|
private updateImageCache;
|
|
@@ -526,7 +530,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
526
530
|
private scheduleImageRefresh;
|
|
527
531
|
private updateBindingEnabledOnPointerMove;
|
|
528
532
|
private maybeSuggestBindingAtCursor;
|
|
529
|
-
private maybeSuggestBindingsForLinearElementAtCoords;
|
|
530
533
|
private clearSelection;
|
|
531
534
|
private handleInteractiveCanvasRef;
|
|
532
535
|
private handleAppOnDrop;
|
|
@@ -10,6 +10,7 @@ interface ButtonIconProps {
|
|
|
10
10
|
/** include standalone style (could interfere with parent styles) */
|
|
11
11
|
standalone?: boolean;
|
|
12
12
|
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
13
|
+
style?: React.CSSProperties;
|
|
13
14
|
}
|
|
14
15
|
export declare const ButtonIcon: import("react").ForwardRefExoticComponent<ButtonIconProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
15
16
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
import type { Scene } from "@excalidraw/element";
|
|
4
|
+
import { useApp, useExcalidrawSetAppState } from "../App";
|
|
4
5
|
import "./DragInput.scss";
|
|
5
6
|
import type { StatsInputProperty } from "./utils";
|
|
6
7
|
import type { AppState } from "../../types";
|
|
@@ -16,6 +17,14 @@ export type DragInputCallbackType<P extends StatsInputProperty, E = ExcalidrawEl
|
|
|
16
17
|
property: P;
|
|
17
18
|
originalAppState: AppState;
|
|
18
19
|
setInputValue: (value: number) => void;
|
|
20
|
+
app: ReturnType<typeof useApp>;
|
|
21
|
+
setAppState: ReturnType<typeof useExcalidrawSetAppState>;
|
|
22
|
+
}) => void;
|
|
23
|
+
export type DragFinishedCallbackType<E = ExcalidrawElement> = (props: {
|
|
24
|
+
app: ReturnType<typeof useApp>;
|
|
25
|
+
setAppState: ReturnType<typeof useExcalidrawSetAppState>;
|
|
26
|
+
originalElements: readonly E[] | null;
|
|
27
|
+
originalAppState: AppState;
|
|
19
28
|
}) => void;
|
|
20
29
|
interface StatsDragInputProps<T extends StatsInputProperty, E = ExcalidrawElement> {
|
|
21
30
|
label: string | React.ReactNode;
|
|
@@ -30,6 +39,7 @@ interface StatsDragInputProps<T extends StatsInputProperty, E = ExcalidrawElemen
|
|
|
30
39
|
appState: AppState;
|
|
31
40
|
/** how many px you need to drag to get 1 unit change */
|
|
32
41
|
sensitivity?: number;
|
|
42
|
+
dragFinishedCallback?: DragFinishedCallbackType;
|
|
33
43
|
}
|
|
34
|
-
declare const StatsDragInput: <T extends StatsInputProperty, E extends ExcalidrawElement = ExcalidrawElement>({ label, icon, dragInputCallback, value, elements, editable, shouldKeepAspectRatio, property, scene, appState, sensitivity, }: StatsDragInputProps<T, E>) => import("react/jsx-runtime").JSX.Element | null;
|
|
44
|
+
declare const StatsDragInput: <T extends StatsInputProperty, E extends ExcalidrawElement = ExcalidrawElement>({ label, icon, dragInputCallback, value, elements, editable, shouldKeepAspectRatio, property, scene, appState, sensitivity, dragFinishedCallback, }: StatsDragInputProps<T, E>) => import("react/jsx-runtime").JSX.Element | null;
|
|
35
45
|
export default StatsDragInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./UnlockPopup.scss";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
import type { AppState } from "../types";
|
|
4
|
+
declare const UnlockPopup: ({ app, activeLockedId, }: {
|
|
5
|
+
app: App;
|
|
6
|
+
activeLockedId: NonNullable<AppState["activeLockedId"]>;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export default UnlockPopup;
|
|
@@ -2,6 +2,7 @@ import type { GlobalPoint, Radians } from "@excalidraw/math";
|
|
|
2
2
|
import type { Bounds } from "@excalidraw/element";
|
|
3
3
|
import type { ElementsMap, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
4
4
|
import type { AppState, UIAppState } from "../../types";
|
|
5
|
+
export declare const DEFAULT_LINK_SIZE = 12;
|
|
5
6
|
export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
|
|
6
7
|
export declare const ELEMENT_LINK_IMG: HTMLImageElement;
|
|
7
8
|
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: Radians, appState: Pick<UIAppState, "zoom">) => Bounds;
|
|
@@ -12,8 +12,10 @@ export declare const LibraryIcon: import("react/jsx-runtime").JSX.Element;
|
|
|
12
12
|
export declare const PlusIcon: import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export declare const DotsIcon: import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export declare const PinIcon: import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const polygonIcon: import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export declare const UnlockedIcon: import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export declare const LockedIcon: import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const LockedIconFilled: import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export declare const WelcomeScreenMenuArrow: import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
export declare const WelcomeScreenHelpArrow: import("react/jsx-runtime").JSX.Element;
|
|
19
21
|
export declare const WelcomeScreenTopToolbarArrow: import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AppClassProperties } from "../types";
|
|
1
2
|
export declare const SHAPES: readonly [{
|
|
2
3
|
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
readonly value: "selection";
|
|
@@ -59,4 +60,131 @@ export declare const SHAPES: readonly [{
|
|
|
59
60
|
readonly numericKey: "0";
|
|
60
61
|
readonly fillable: false;
|
|
61
62
|
}];
|
|
62
|
-
export declare const
|
|
63
|
+
export declare const getToolbarTools: (app: AppClassProperties) => readonly [{
|
|
64
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
readonly value: "selection";
|
|
66
|
+
readonly key: "v";
|
|
67
|
+
readonly numericKey: "1";
|
|
68
|
+
readonly fillable: true;
|
|
69
|
+
}, {
|
|
70
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
readonly value: "rectangle";
|
|
72
|
+
readonly key: "r";
|
|
73
|
+
readonly numericKey: "2";
|
|
74
|
+
readonly fillable: true;
|
|
75
|
+
}, {
|
|
76
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
readonly value: "diamond";
|
|
78
|
+
readonly key: "d";
|
|
79
|
+
readonly numericKey: "3";
|
|
80
|
+
readonly fillable: true;
|
|
81
|
+
}, {
|
|
82
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
readonly value: "ellipse";
|
|
84
|
+
readonly key: "o";
|
|
85
|
+
readonly numericKey: "4";
|
|
86
|
+
readonly fillable: true;
|
|
87
|
+
}, {
|
|
88
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
89
|
+
readonly value: "arrow";
|
|
90
|
+
readonly key: "a";
|
|
91
|
+
readonly numericKey: "5";
|
|
92
|
+
readonly fillable: true;
|
|
93
|
+
}, {
|
|
94
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
readonly value: "line";
|
|
96
|
+
readonly key: "l";
|
|
97
|
+
readonly numericKey: "6";
|
|
98
|
+
readonly fillable: true;
|
|
99
|
+
}, {
|
|
100
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
101
|
+
readonly value: "freedraw";
|
|
102
|
+
readonly key: readonly ["p", "x"];
|
|
103
|
+
readonly numericKey: "7";
|
|
104
|
+
readonly fillable: false;
|
|
105
|
+
}, {
|
|
106
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
107
|
+
readonly value: "text";
|
|
108
|
+
readonly key: "t";
|
|
109
|
+
readonly numericKey: "8";
|
|
110
|
+
readonly fillable: false;
|
|
111
|
+
}, {
|
|
112
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
113
|
+
readonly value: "image";
|
|
114
|
+
readonly key: null;
|
|
115
|
+
readonly numericKey: "9";
|
|
116
|
+
readonly fillable: false;
|
|
117
|
+
}, {
|
|
118
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
119
|
+
readonly value: "eraser";
|
|
120
|
+
readonly key: "e";
|
|
121
|
+
readonly numericKey: "0";
|
|
122
|
+
readonly fillable: false;
|
|
123
|
+
}] | readonly [{
|
|
124
|
+
readonly value: "lasso";
|
|
125
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
126
|
+
readonly key: "v";
|
|
127
|
+
readonly numericKey: "1";
|
|
128
|
+
readonly fillable: true;
|
|
129
|
+
}, ...({
|
|
130
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
131
|
+
readonly value: "selection";
|
|
132
|
+
readonly key: "v";
|
|
133
|
+
readonly numericKey: "1";
|
|
134
|
+
readonly fillable: true;
|
|
135
|
+
} | {
|
|
136
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
137
|
+
readonly value: "rectangle";
|
|
138
|
+
readonly key: "r";
|
|
139
|
+
readonly numericKey: "2";
|
|
140
|
+
readonly fillable: true;
|
|
141
|
+
} | {
|
|
142
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
143
|
+
readonly value: "diamond";
|
|
144
|
+
readonly key: "d";
|
|
145
|
+
readonly numericKey: "3";
|
|
146
|
+
readonly fillable: true;
|
|
147
|
+
} | {
|
|
148
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
149
|
+
readonly value: "ellipse";
|
|
150
|
+
readonly key: "o";
|
|
151
|
+
readonly numericKey: "4";
|
|
152
|
+
readonly fillable: true;
|
|
153
|
+
} | {
|
|
154
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
155
|
+
readonly value: "arrow";
|
|
156
|
+
readonly key: "a";
|
|
157
|
+
readonly numericKey: "5";
|
|
158
|
+
readonly fillable: true;
|
|
159
|
+
} | {
|
|
160
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
161
|
+
readonly value: "line";
|
|
162
|
+
readonly key: "l";
|
|
163
|
+
readonly numericKey: "6";
|
|
164
|
+
readonly fillable: true;
|
|
165
|
+
} | {
|
|
166
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
167
|
+
readonly value: "freedraw";
|
|
168
|
+
readonly key: readonly ["p", "x"];
|
|
169
|
+
readonly numericKey: "7";
|
|
170
|
+
readonly fillable: false;
|
|
171
|
+
} | {
|
|
172
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
173
|
+
readonly value: "text";
|
|
174
|
+
readonly key: "t";
|
|
175
|
+
readonly numericKey: "8";
|
|
176
|
+
readonly fillable: false;
|
|
177
|
+
} | {
|
|
178
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
179
|
+
readonly value: "image";
|
|
180
|
+
readonly key: null;
|
|
181
|
+
readonly numericKey: "9";
|
|
182
|
+
readonly fillable: false;
|
|
183
|
+
} | {
|
|
184
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
185
|
+
readonly value: "eraser";
|
|
186
|
+
readonly key: "e";
|
|
187
|
+
readonly numericKey: "0";
|
|
188
|
+
readonly fillable: false;
|
|
189
|
+
})[]];
|
|
190
|
+
export declare const findShapeByKey: (key: string, app: AppClassProperties) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "lasso" | "eraser" | null;
|
|
@@ -6,7 +6,7 @@ import type { FileSystemHandle } from "./filesystem";
|
|
|
6
6
|
import type { ImportedLibraryData } from "./types";
|
|
7
7
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
8
8
|
export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
|
|
9
|
-
export declare const isImageFileHandleType: (type: string | null) => type is "
|
|
9
|
+
export declare const isImageFileHandleType: (type: string | null) => type is "png" | "svg";
|
|
10
10
|
export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boolean;
|
|
11
11
|
export declare const isSupportedImageFileType: (type: string | null | undefined) => boolean;
|
|
12
12
|
export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
|
|
@@ -3,4 +3,5 @@ import type { MakeBrand } from "@excalidraw/common/utility-types";
|
|
|
3
3
|
import type { AppState } from "../types";
|
|
4
4
|
export type ReconciledExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"ReconciledElement">;
|
|
5
5
|
export type RemoteExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"RemoteExcalidrawElement">;
|
|
6
|
+
export declare const shouldDiscardRemoteElement: (localAppState: AppState, local: OrderedExcalidrawElement | undefined, remote: RemoteExcalidrawElement) => boolean;
|
|
6
7
|
export declare const reconcileElements: (localElements: readonly OrderedExcalidrawElement[], remoteElements: readonly RemoteExcalidrawElement[], localAppState: AppState) => ReconciledExcalidrawElement[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExcalidrawElement, OrderedExcalidrawElement } from "@excalidraw/element/types";
|
|
1
|
+
import type { ExcalidrawArrowElement, ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawSelectionElement, ExcalidrawTextElement, OrderedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
2
|
import type { AppState, BinaryFiles, LibraryItem } from "../types";
|
|
3
3
|
import type { ImportedDataState } from "./types";
|
|
4
4
|
type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
@@ -8,14 +8,19 @@ export type RestoredDataState = {
|
|
|
8
8
|
appState: RestoredAppState;
|
|
9
9
|
files: BinaryFiles;
|
|
10
10
|
};
|
|
11
|
+
export declare const restoreElement: (element: Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, opts?: {
|
|
12
|
+
deleteInvisibleElements?: boolean;
|
|
13
|
+
}) => ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | ExcalidrawArrowElement | null;
|
|
11
14
|
export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, opts?: {
|
|
12
15
|
refreshDimensions?: boolean;
|
|
13
16
|
repairBindings?: boolean;
|
|
17
|
+
deleteInvisibleElements?: boolean;
|
|
14
18
|
} | undefined) => OrderedExcalidrawElement[];
|
|
15
19
|
export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
|
|
16
20
|
export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined, elementsConfig?: {
|
|
17
21
|
refreshDimensions?: boolean;
|
|
18
22
|
repairBindings?: boolean;
|
|
23
|
+
deleteInvisibleElements?: boolean;
|
|
19
24
|
}) => RestoredDataState;
|
|
20
25
|
export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
|
|
21
26
|
export {};
|
|
@@ -4,8 +4,6 @@ import type App from "../components/App";
|
|
|
4
4
|
export declare class EraserTrail extends AnimatedTrail {
|
|
5
5
|
private elementsToErase;
|
|
6
6
|
private groupsToErase;
|
|
7
|
-
private segmentsCache;
|
|
8
|
-
private geometricShapesCache;
|
|
9
7
|
constructor(animationFrameHandler: AnimationFrameHandler, app: App);
|
|
10
8
|
startPath(x: number, y: number): void;
|
|
11
9
|
addPointToPath(x: number, y: number, restore?: boolean): string[];
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import { Emitter } from "@excalidraw/common";
|
|
2
|
-
import { StoreDelta
|
|
2
|
+
import { StoreDelta } from "@excalidraw/element";
|
|
3
|
+
import type { StoreSnapshot, Store } from "@excalidraw/element";
|
|
3
4
|
import type { SceneElementsMap } from "@excalidraw/element/types";
|
|
4
5
|
import type { AppState } from "./types";
|
|
5
|
-
declare class
|
|
6
|
+
export declare class HistoryDelta extends StoreDelta {
|
|
7
|
+
/**
|
|
8
|
+
* Apply the delta to the passed elements and appState, does not modify the snapshot.
|
|
9
|
+
*/
|
|
10
|
+
applyTo(elements: SceneElementsMap, appState: AppState, snapshot: StoreSnapshot): [SceneElementsMap, AppState, boolean];
|
|
11
|
+
/**
|
|
12
|
+
* Overriding once to avoid type casting everywhere.
|
|
13
|
+
*/
|
|
14
|
+
static calculate(prevSnapshot: StoreSnapshot, nextSnapshot: StoreSnapshot): HistoryDelta;
|
|
15
|
+
/**
|
|
16
|
+
* Overriding once to avoid type casting everywhere.
|
|
17
|
+
*/
|
|
18
|
+
static inverse(delta: StoreDelta): HistoryDelta;
|
|
19
|
+
/**
|
|
20
|
+
* Overriding once to avoid type casting everywhere.
|
|
21
|
+
*/
|
|
22
|
+
static applyLatestChanges(delta: StoreDelta, prevElements: SceneElementsMap, nextElements: SceneElementsMap, modifierOptions?: "deleted" | "inserted"): HistoryDelta;
|
|
6
23
|
}
|
|
7
24
|
export declare class HistoryChangedEvent {
|
|
8
25
|
readonly isUndoStackEmpty: boolean;
|
|
@@ -12,8 +29,8 @@ export declare class HistoryChangedEvent {
|
|
|
12
29
|
export declare class History {
|
|
13
30
|
private readonly store;
|
|
14
31
|
readonly onHistoryChangedEmitter: Emitter<[HistoryChangedEvent]>;
|
|
15
|
-
readonly undoStack:
|
|
16
|
-
readonly redoStack:
|
|
32
|
+
readonly undoStack: HistoryDelta[];
|
|
33
|
+
readonly redoStack: HistoryDelta[];
|
|
17
34
|
get isUndoStackEmpty(): boolean;
|
|
18
35
|
get isRedoStackEmpty(): boolean;
|
|
19
36
|
constructor(store: Store);
|
|
@@ -29,4 +46,3 @@ export declare class History {
|
|
|
29
46
|
private static pop;
|
|
30
47
|
private static push;
|
|
31
48
|
}
|
|
32
|
-
export {};
|
|
@@ -12,7 +12,7 @@ export { getSceneVersion, hashElementsVersion, hashString, getNonDeletedElements
|
|
|
12
12
|
export { getTextFromElements } from "@excalidraw/element";
|
|
13
13
|
export { isInvisiblySmallElement } from "@excalidraw/element";
|
|
14
14
|
export { defaultLang, useI18n, languages } from "./i18n";
|
|
15
|
-
export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "./data/restore";
|
|
15
|
+
export { restore, restoreAppState, restoreElement, restoreElements, restoreLibraryItems, } from "./data/restore";
|
|
16
16
|
export { reconcileElements } from "./data/reconcile";
|
|
17
17
|
export { exportToCanvas, exportToBlob, exportToSvg, exportToClipboard, } from "@excalidraw/utils/export";
|
|
18
18
|
export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
|
|
@@ -29,6 +29,7 @@ export { Sidebar } from "./components/Sidebar/Sidebar";
|
|
|
29
29
|
export { Button } from "./components/Button";
|
|
30
30
|
export { Footer };
|
|
31
31
|
export { MainMenu };
|
|
32
|
+
export { Ellipsify } from "./components/Ellipsify";
|
|
32
33
|
export { useDevice } from "./components/App";
|
|
33
34
|
export { WelcomeScreen };
|
|
34
35
|
export { LiveCollaborationTrigger };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ElementsSegmentsMap, GlobalPoint } from "@excalidraw/math/types";
|
|
2
|
-
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
+
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
export declare const getLassoSelectedElementIds: (input: {
|
|
4
4
|
lassoPath: GlobalPoint[];
|
|
5
5
|
elements: readonly ExcalidrawElement[];
|
|
6
|
+
elementsMap: ElementsMap;
|
|
6
7
|
elementsSegments: ElementsSegmentsMap;
|
|
7
8
|
intersectedElements: Set<ExcalidrawElement["id"]>;
|
|
8
9
|
enclosedElements: Set<ExcalidrawElement["id"]>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "@excalidraw/element/types";
|
|
1
|
+
import type { ElementsMap, ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "@excalidraw/element/types";
|
|
2
2
|
import type { StaticCanvasRenderConfig } from "../scene/types";
|
|
3
3
|
import type { AppState, StaticCanvasAppState } from "../types";
|
|
4
|
-
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke?: boolean) => void;
|
|
4
|
+
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
|
|
5
5
|
export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
|
|
6
6
|
export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
|
|
7
7
|
canvas: HTMLCanvasElement;
|
|
@@ -12,7 +12,7 @@ export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normali
|
|
|
12
12
|
isExporting?: boolean | undefined;
|
|
13
13
|
viewBackgroundColor?: string | null | undefined;
|
|
14
14
|
}) => CanvasRenderingContext2D;
|
|
15
|
-
export declare const drawHighlightForRectWithRotation: (context: CanvasRenderingContext2D, element: ExcalidrawRectanguloidElement, padding: number) => void;
|
|
15
|
+
export declare const drawHighlightForRectWithRotation: (context: CanvasRenderingContext2D, element: ExcalidrawRectanguloidElement, elementsMap: ElementsMap, padding: number) => void;
|
|
16
16
|
export declare const strokeEllipseWithRotation: (context: CanvasRenderingContext2D, width: number, height: number, cx: number, cy: number, angle: number) => void;
|
|
17
17
|
export declare const strokeRectWithRotation: (context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, cx: number, cy: number, angle: number, fill?: boolean, radius?: number) => void;
|
|
18
|
-
export declare const drawHighlightForDiamondWithRotation: (context: CanvasRenderingContext2D, padding: number, element: ExcalidrawDiamondElement) => void;
|
|
18
|
+
export declare const drawHighlightForDiamondWithRotation: (context: CanvasRenderingContext2D, padding: number, element: ExcalidrawDiamondElement, elementsMap: ElementsMap) => void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ExcalidrawFrameLikeElement } from "@excalidraw/element/types";
|
|
2
|
+
import type { StaticCanvasRenderConfig, StaticSceneRenderConfig } from "../scene/types";
|
|
3
|
+
import type { StaticCanvasAppState } from "../types";
|
|
4
|
+
export declare const frameClip: (frame: ExcalidrawFrameLikeElement, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
|
|
2
5
|
/** throttled to animation framerate */
|
|
3
6
|
export declare const renderStaticSceneThrottled: {
|
|
4
7
|
(config: StaticSceneRenderConfig): void;
|
|
@@ -16,7 +16,6 @@ export declare class Renderer {
|
|
|
16
16
|
/** note: first render of newElement will always bust the cache
|
|
17
17
|
* (we'd have to prefilter elements outside of this function) */
|
|
18
18
|
newElementId: ExcalidrawElement["id"] | undefined;
|
|
19
|
-
pendingImageElementId: AppState["pendingImageElementId"];
|
|
20
19
|
sceneNonce: ReturnType<InstanceType<typeof Scene>["getSceneNonce"]>;
|
|
21
20
|
}) => {
|
|
22
21
|
elementsMap: Map<string, NonDeletedExcalidrawElement> & import("@excalidraw/common/utility-types").MakeBrand<"NonDeletedElementsMap"> & import("@excalidraw/common/utility-types").MakeBrand<"RenderableElementsMap">;
|
|
@@ -2,7 +2,7 @@ import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES } from "@
|
|
|
2
2
|
import type { SuggestedBinding } from "@excalidraw/element";
|
|
3
3
|
import type { LinearElementEditor } from "@excalidraw/element";
|
|
4
4
|
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
5
|
-
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId,
|
|
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";
|
|
6
6
|
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
|
|
7
7
|
import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
|
|
8
8
|
import type { Action } from "./actions/types";
|
|
@@ -113,7 +113,6 @@ type _CommonCanvasAppState = {
|
|
|
113
113
|
offsetLeft: AppState["offsetLeft"];
|
|
114
114
|
offsetTop: AppState["offsetTop"];
|
|
115
115
|
theme: AppState["theme"];
|
|
116
|
-
pendingImageElementId: AppState["pendingImageElementId"];
|
|
117
116
|
};
|
|
118
117
|
export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
119
118
|
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
@@ -130,7 +129,6 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
130
129
|
}>;
|
|
131
130
|
export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
132
131
|
activeEmbeddable: AppState["activeEmbeddable"];
|
|
133
|
-
editingLinearElement: AppState["editingLinearElement"];
|
|
134
132
|
selectionElement: AppState["selectionElement"];
|
|
135
133
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
136
134
|
selectedLinearElement: AppState["selectedLinearElement"];
|
|
@@ -146,6 +144,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
146
144
|
isCropping: AppState["isCropping"];
|
|
147
145
|
croppingElementId: AppState["croppingElementId"];
|
|
148
146
|
searchMatches: AppState["searchMatches"];
|
|
147
|
+
activeLockedId: AppState["activeLockedId"];
|
|
149
148
|
}>;
|
|
150
149
|
export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
|
|
151
150
|
export type ObservedStandaloneAppState = {
|
|
@@ -156,9 +155,13 @@ export type ObservedElementsAppState = {
|
|
|
156
155
|
editingGroupId: AppState["editingGroupId"];
|
|
157
156
|
selectedElementIds: AppState["selectedElementIds"];
|
|
158
157
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
selectedLinearElement: {
|
|
159
|
+
elementId: LinearElementEditor["elementId"];
|
|
160
|
+
isEditing: boolean;
|
|
161
|
+
} | null;
|
|
161
162
|
croppingElementId: AppState["croppingElementId"];
|
|
163
|
+
lockedMultiSelections: AppState["lockedMultiSelections"];
|
|
164
|
+
activeLockedId: AppState["activeLockedId"];
|
|
162
165
|
};
|
|
163
166
|
export interface AppState {
|
|
164
167
|
contextMenu: {
|
|
@@ -209,7 +212,6 @@ export interface AppState {
|
|
|
209
212
|
* set when a new text is created or when an existing text is being edited
|
|
210
213
|
*/
|
|
211
214
|
editingTextElement: NonDeletedExcalidrawElement | null;
|
|
212
|
-
editingLinearElement: LinearElementEditor | null;
|
|
213
215
|
activeTool: {
|
|
214
216
|
/**
|
|
215
217
|
* indicates a previous tool we should revert back to if we deselect the
|
|
@@ -324,8 +326,6 @@ export interface AppState {
|
|
|
324
326
|
shown: true;
|
|
325
327
|
data: Spreadsheet;
|
|
326
328
|
};
|
|
327
|
-
/** imageElement waiting to be placed on canvas */
|
|
328
|
-
pendingImageElementId: ExcalidrawImageElement["id"] | null;
|
|
329
329
|
showHyperlinkPopup: false | "info" | "editor";
|
|
330
330
|
selectedLinearElement: LinearElementEditor | null;
|
|
331
331
|
snapLines: readonly SnapLine[];
|
|
@@ -346,6 +346,11 @@ export interface AppState {
|
|
|
346
346
|
focusedId: ExcalidrawElement["id"] | null;
|
|
347
347
|
matches: readonly SearchMatch[];
|
|
348
348
|
}> | null;
|
|
349
|
+
/** the locked element/group that's active and shows unlock popup */
|
|
350
|
+
activeLockedId: string | null;
|
|
351
|
+
lockedMultiSelections: {
|
|
352
|
+
[groupId: string]: true;
|
|
353
|
+
};
|
|
349
354
|
}
|
|
350
355
|
export type SearchMatch = {
|
|
351
356
|
id: string;
|
|
@@ -552,6 +557,7 @@ export type AppClassProperties = {
|
|
|
552
557
|
excalidrawContainerValue: App["excalidrawContainerValue"];
|
|
553
558
|
onPointerUpEmitter: App["onPointerUpEmitter"];
|
|
554
559
|
updateEditorAtom: App["updateEditorAtom"];
|
|
560
|
+
defaultSelectionTool: "selection" | "lasso";
|
|
555
561
|
};
|
|
556
562
|
export type PointerDownState = Readonly<{
|
|
557
563
|
origin: Readonly<{
|
|
@@ -599,6 +605,7 @@ export type PointerDownState = Readonly<{
|
|
|
599
605
|
x: number;
|
|
600
606
|
y: number;
|
|
601
607
|
};
|
|
608
|
+
blockDragging: boolean;
|
|
602
609
|
};
|
|
603
610
|
eventListeners: {
|
|
604
611
|
onMove: null | ReturnType<typeof throttleRAF>;
|
|
@@ -613,10 +620,12 @@ export type PointerDownState = Readonly<{
|
|
|
613
620
|
export type UnsubscribeCallback = () => void;
|
|
614
621
|
export interface ExcalidrawImperativeAPI {
|
|
615
622
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
623
|
+
applyDeltas: InstanceType<typeof App>["applyDeltas"];
|
|
616
624
|
mutateElement: InstanceType<typeof App>["mutateElement"];
|
|
617
625
|
updateLibrary: InstanceType<typeof Library>["updateLibrary"];
|
|
618
626
|
resetScene: InstanceType<typeof App>["resetScene"];
|
|
619
627
|
getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
|
|
628
|
+
getSceneElementsMapIncludingDeleted: InstanceType<typeof App>["getSceneElementsMapIncludingDeleted"];
|
|
620
629
|
history: {
|
|
621
630
|
clear: InstanceType<typeof App>["resetHistory"];
|
|
622
631
|
};
|
|
@@ -15,3 +15,5 @@ export declare function radiansToDegrees(degrees: Radians): Degrees;
|
|
|
15
15
|
* @returns TRUE if the provided angle is a right angle
|
|
16
16
|
*/
|
|
17
17
|
export declare function isRightAngleRads(rads: Radians): boolean;
|
|
18
|
+
export declare function radiansBetweenAngles(a: Radians, min: Radians, max: Radians): boolean;
|
|
19
|
+
export declare function radiansDifference(a: Radians, b: Radians): Radians;
|