@excalidraw/math 0.18.0-1118751 → 0.18.0-1440f2d
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/types/common/src/constants.d.ts +4 -0
- package/dist/types/common/src/utils.d.ts +12 -1
- package/dist/types/element/src/align.d.ts +4 -1
- package/dist/types/element/src/binding.d.ts +70 -0
- package/dist/types/element/src/bounds.d.ts +10 -2
- package/dist/types/element/src/collision.d.ts +13 -0
- package/dist/types/element/src/cropElement.d.ts +36 -4
- package/dist/types/element/src/delta.d.ts +7 -1
- package/dist/types/element/src/distribute.d.ts +4 -1
- package/dist/types/element/src/dragElements.d.ts +8 -3
- package/dist/types/element/src/elbowArrow.d.ts +5 -0
- package/dist/types/element/src/embeddable.d.ts +2 -1
- package/dist/types/element/src/flowchart.d.ts +1 -7
- package/dist/types/element/src/frame.d.ts +19 -1
- package/dist/types/element/src/groups.d.ts +1 -6
- package/dist/types/element/src/image.d.ts +5 -2
- package/dist/types/element/src/index.d.ts +2 -0
- package/dist/types/element/src/linearElementEditor.d.ts +4 -1
- package/dist/types/element/src/listMarker.d.ts +39 -0
- package/dist/types/element/src/newElement.d.ts +17 -1
- package/dist/types/element/src/renderElement.d.ts +10 -0
- package/dist/types/element/src/renderEnvironment.d.ts +66 -0
- package/dist/types/element/src/resizeElements.d.ts +15 -5
- package/dist/types/element/src/selection.d.ts +1 -7
- package/dist/types/element/src/shape.d.ts +2 -0
- package/dist/types/element/src/stickyNote.d.ts +8 -0
- package/dist/types/element/src/textElement.d.ts +10 -2
- package/dist/types/element/src/textMeasurements.d.ts +15 -11
- package/dist/types/element/src/textWrapping.d.ts +3 -2
- package/dist/types/element/src/transform.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +30 -3
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +56 -214
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +76 -16
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +20 -2
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -564
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +14 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +20 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +27 -9
- package/dist/types/excalidraw/actions/actionFrame.d.ts +71 -528
- package/dist/types/excalidraw/actions/actionGroup.d.ts +22 -4
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionLink.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionMenu.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionProperties.d.ts +20 -2
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +11 -2
- package/dist/types/excalidraw/actions/actionStyles.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +198 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +10 -1
- package/dist/types/excalidraw/actions/index.d.ts +3 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/appState.d.ts +9 -7
- package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -1
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +6 -5
- package/dist/types/excalidraw/charts/charts.line.d.ts +2 -1
- package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -1
- package/dist/types/excalidraw/charts/index.d.ts +2 -1
- package/dist/types/excalidraw/components/Actions.d.ts +9 -2
- package/dist/types/excalidraw/components/App.arrowText.d.ts +5 -39
- package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
- package/dist/types/excalidraw/components/App.d.ts +79 -264
- package/dist/types/excalidraw/components/App.duplicate.d.ts +52 -2
- package/dist/types/excalidraw/components/App.host.d.ts +102 -0
- package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +8 -0
- package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
- package/dist/types/excalidraw/components/App.selectionTool.d.ts +93 -0
- package/dist/types/excalidraw/components/App.text.d.ts +146 -0
- package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +64 -4
- package/dist/types/excalidraw/components/App.wheel.d.ts +6 -2
- package/dist/types/excalidraw/components/App.wrap.d.ts +31 -0
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -1
- package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
- package/dist/types/excalidraw/components/Minimap/Minimap.d.ts +15 -0
- package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
- package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
- package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
- package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
- package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +4 -1
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +14 -1
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +16 -0
- package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +1 -1
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +0 -1
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +13 -2
- package/dist/types/excalidraw/components/icons.d.ts +1 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -0
- package/dist/types/excalidraw/data/blob.d.ts +34 -16
- package/dist/types/excalidraw/data/index.d.ts +3 -3
- package/dist/types/excalidraw/data/json.d.ts +17 -8
- package/dist/types/excalidraw/fonts/Fonts.d.ts +9 -6
- package/dist/types/excalidraw/history.d.ts +10 -4
- package/dist/types/excalidraw/mermaid.d.ts +7 -0
- package/dist/types/excalidraw/reactUtils.d.ts +1 -1
- package/dist/types/excalidraw/renderer/animation.d.ts +11 -4
- package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +1 -1
- package/dist/types/excalidraw/scene/export.d.ts +343 -20
- package/dist/types/excalidraw/scene/types.d.ts +23 -1
- package/dist/types/excalidraw/types.d.ts +83 -14
- package/dist/types/excalidraw/viewport.d.ts +23 -1
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -1
- package/dist/types/utils/src/index.d.ts +3 -1
- package/package.json +2 -2
- package/dist/types/utils/src/export.d.ts +0 -36
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
|
|
3
3
|
import { LinearElementEditor, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type { ArrowEndpoint, TransformHandleDirection } from "@excalidraw/element";
|
|
4
|
+
import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
|
|
5
|
+
import type { RenderEnvironment, TransformHandleDirection } from "@excalidraw/element";
|
|
7
6
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
8
7
|
import { ActionManager } from "../actions/manager";
|
|
9
8
|
import { History } from "../history";
|
|
@@ -16,19 +15,27 @@ import { isOverScrollBars } from "../scene/scrollbars";
|
|
|
16
15
|
import { LassoTrail } from "../lasso";
|
|
17
16
|
import { EraserTrail } from "../eraser";
|
|
18
17
|
import { AppArrowText } from "./App.arrowText";
|
|
18
|
+
import { AppClipboard } from "./App.clipboard";
|
|
19
|
+
import { AppText } from "./App.text";
|
|
20
|
+
import { AppTextTool } from "./App.textTool";
|
|
19
21
|
import { AppBucketFill } from "./App.bucketFill";
|
|
20
22
|
import { AppToolDrag } from "./App.toolDrag";
|
|
21
23
|
import { AppCursor } from "./App.cursor";
|
|
22
24
|
import { AppDrawShape } from "./App.drawshape";
|
|
23
25
|
import { AppDuplicate } from "./App.duplicate";
|
|
24
26
|
import { AppFlowchart } from "./App.flowchart";
|
|
27
|
+
import { AppModifiers } from "./App.modifiers";
|
|
25
28
|
import { AppPan } from "./App.pan";
|
|
26
29
|
import { AppViewport } from "./App.viewport";
|
|
27
30
|
import { AppWheel } from "./App.wheel";
|
|
31
|
+
import { AppSelection } from "./App.selection";
|
|
32
|
+
import { AppSelectionTool } from "./App.selectionTool";
|
|
33
|
+
import { AppWrap } from "./App.wrap";
|
|
34
|
+
import { AppHost } from "./App.host";
|
|
28
35
|
import { CursorHints } from "./CursorHint";
|
|
29
36
|
import { type OnStateChange } from "./AppStateObserver";
|
|
30
37
|
import type { ExportedElements } from "../data";
|
|
31
|
-
import type { AppClassProperties, AppProps, AppState, ElementRenderOverrides, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, KeyboardModifiersObject, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, UIConfig } from "../types";
|
|
38
|
+
import type { AppClassProperties, AppProps, AppState, ElementRenderOverrides, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, PointerDownState, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, KeyboardModifiersObject, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, UIConfig } from "../types";
|
|
32
39
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
33
40
|
import type { ActionResult } from "../actions/types";
|
|
34
41
|
declare const editorLifecycleEventBehavior: {
|
|
@@ -87,8 +94,17 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
87
94
|
editorInterface: EditorInterface;
|
|
88
95
|
private stylesPanelMode;
|
|
89
96
|
private excalidrawContainerRef;
|
|
97
|
+
private zenModeTransitionTimer;
|
|
90
98
|
get ownerDocument(): Document;
|
|
91
99
|
get ownerWindow(): Window & typeof globalThis;
|
|
100
|
+
/**
|
|
101
|
+
* Everything binding this editor to the document/window it renders into
|
|
102
|
+
* (render environment, hyperlink tooltip ownership). Delegated to so the
|
|
103
|
+
* cross-document ownership rules live in one place.
|
|
104
|
+
*/
|
|
105
|
+
host: AppHost;
|
|
106
|
+
/** @see AppHost.renderEnvironment */
|
|
107
|
+
get renderEnvironment(): RenderEnvironment;
|
|
92
108
|
scene: Scene;
|
|
93
109
|
fonts: Fonts;
|
|
94
110
|
renderer: Renderer;
|
|
@@ -132,10 +148,15 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
132
148
|
cursor: AppCursor;
|
|
133
149
|
arrowText: AppArrowText;
|
|
134
150
|
pan: AppPan;
|
|
151
|
+
textTool: AppTextTool;
|
|
152
|
+
clipboard: AppClipboard;
|
|
153
|
+
text: AppText;
|
|
135
154
|
viewport: AppViewport;
|
|
136
155
|
wheel: AppWheel;
|
|
156
|
+
selection: AppSelection;
|
|
157
|
+
selectionTool: AppSelectionTool;
|
|
158
|
+
wrap: AppWrap;
|
|
137
159
|
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
138
|
-
private textWysiwygSubmitHandler;
|
|
139
160
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
140
161
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
141
162
|
/**
|
|
@@ -154,11 +175,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
154
175
|
y: number;
|
|
155
176
|
} | null;
|
|
156
177
|
private lastCompletedCanvasClicks;
|
|
157
|
-
/** previous frame pointer coords */
|
|
158
|
-
previousPointerMoveCoords: {
|
|
159
|
-
x: number;
|
|
160
|
-
y: number;
|
|
161
|
-
} | null;
|
|
162
178
|
drawShape: AppDrawShape;
|
|
163
179
|
laserTrails: LaserTrails;
|
|
164
180
|
eraserTrail: EraserTrail;
|
|
@@ -201,7 +217,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
201
217
|
element: NonDeleted<ExcalidrawElement> | null;
|
|
202
218
|
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
203
219
|
wasAddedToSelection: boolean;
|
|
220
|
+
cycleTarget: NonDeleted<ExcalidrawElement> | null;
|
|
204
221
|
hasBeenDuplicated: boolean;
|
|
222
|
+
advancedListMarkers: readonly import("@excalidraw/element").ListMarkerAdvance[];
|
|
223
|
+
editedTextId: import("@excalidraw/element/types").ExcalidrawTextElement["id"] | null;
|
|
205
224
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
206
225
|
arrowLabel: boolean;
|
|
207
226
|
};
|
|
@@ -216,6 +235,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
216
235
|
x: number;
|
|
217
236
|
y: number;
|
|
218
237
|
};
|
|
238
|
+
lastOffset: {
|
|
239
|
+
x: number;
|
|
240
|
+
y: number;
|
|
241
|
+
};
|
|
219
242
|
blockDragging: boolean;
|
|
220
243
|
};
|
|
221
244
|
eventListeners: {
|
|
@@ -264,7 +287,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
264
287
|
element: NonDeleted<ExcalidrawElement> | null;
|
|
265
288
|
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
266
289
|
wasAddedToSelection: boolean;
|
|
290
|
+
cycleTarget: NonDeleted<ExcalidrawElement> | null;
|
|
267
291
|
hasBeenDuplicated: boolean;
|
|
292
|
+
advancedListMarkers: readonly import("@excalidraw/element").ListMarkerAdvance[];
|
|
293
|
+
editedTextId: import("@excalidraw/element/types").ExcalidrawTextElement["id"] | null;
|
|
268
294
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
269
295
|
arrowLabel: boolean;
|
|
270
296
|
};
|
|
@@ -279,6 +305,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
279
305
|
x: number;
|
|
280
306
|
y: number;
|
|
281
307
|
};
|
|
308
|
+
lastOffset: {
|
|
309
|
+
x: number;
|
|
310
|
+
y: number;
|
|
311
|
+
};
|
|
282
312
|
blockDragging: boolean;
|
|
283
313
|
};
|
|
284
314
|
eventListeners: {
|
|
@@ -297,6 +327,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
297
327
|
}>]>;
|
|
298
328
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
299
329
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
330
|
+
modifiers: AppModifiers;
|
|
300
331
|
api: ExcalidrawImperativeAPI;
|
|
301
332
|
private elementRenderOverrides;
|
|
302
333
|
/** offsets of `elementRenderOverrides`; keeps its identity while they don't change */
|
|
@@ -387,7 +418,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
387
418
|
* If disabled, returns null.
|
|
388
419
|
*/
|
|
389
420
|
getEffectiveGridSize: () => NullableGridSize;
|
|
390
|
-
private getTextCreationGridPoint;
|
|
391
421
|
private getHTMLIFrameElement;
|
|
392
422
|
/**
|
|
393
423
|
* AI-generated iframe elements aren't interactive while their generation
|
|
@@ -434,6 +464,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
434
464
|
private onBlur;
|
|
435
465
|
private onUnload;
|
|
436
466
|
private disableEvent;
|
|
467
|
+
private isFileDropEnabled;
|
|
468
|
+
private onDragOver;
|
|
437
469
|
private handleNavigationModeKeyDown;
|
|
438
470
|
/**
|
|
439
471
|
* PageUp/PageDown scroll the canvas by a page — vertically, or
|
|
@@ -478,16 +510,20 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
478
510
|
private onFullscreenChange;
|
|
479
511
|
private removeEventListeners;
|
|
480
512
|
private addEventListeners;
|
|
513
|
+
getSnapshotBeforeUpdate(prevProps: AppProps, prevState: AppState): null;
|
|
514
|
+
/**
|
|
515
|
+
* Flags the container while toggling zen mode so that UI chrome
|
|
516
|
+
* (backgrounds etc.) animates only then, and hover transitions stay
|
|
517
|
+
* instant. A data attribute so that React doesn't reset it on re-render.
|
|
518
|
+
*/
|
|
519
|
+
private markZenModeTransition;
|
|
520
|
+
private unmarkZenModeTransition;
|
|
481
521
|
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
|
|
482
522
|
private renderInteractiveSceneCallback;
|
|
483
523
|
private onScroll;
|
|
484
|
-
private onCut;
|
|
485
|
-
private onCopy;
|
|
486
524
|
private static resetTapTwice;
|
|
487
525
|
private onTouchStart;
|
|
488
526
|
private onTouchEnd;
|
|
489
|
-
private insertClipboardContent;
|
|
490
|
-
pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
|
|
491
527
|
addElementsFromPasteOrLibrary: (opts: {
|
|
492
528
|
elements: readonly ExcalidrawElement[];
|
|
493
529
|
files: BinaryFiles | null;
|
|
@@ -499,8 +535,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
499
535
|
fit?: SetViewportOptions["fit"];
|
|
500
536
|
preserveFrameChildrenOrder?: boolean;
|
|
501
537
|
}) => void;
|
|
502
|
-
private addElementsFromMixedContentPaste;
|
|
503
|
-
private addTextFromPaste;
|
|
504
538
|
setAppState: React.Component<any, AppState>["setState"];
|
|
505
539
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
506
540
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
@@ -512,9 +546,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
512
546
|
* imperative API emitter */
|
|
513
547
|
emitUserFollowIntent: (payload: OnUserFollowedPayload) => void;
|
|
514
548
|
/** emits an UNFOLLOW intent if currently following someone — use on
|
|
515
|
-
*
|
|
549
|
+
* viewport changes that take the view over from the followed user (user
|
|
550
|
+
* pans and zooms, `setViewport` navigation) */
|
|
516
551
|
requestUnfollow: () => void;
|
|
517
552
|
setToast: (toast: AppState["toast"]) => void;
|
|
553
|
+
private showSceneReplacedToast;
|
|
518
554
|
restoreFileFromShare: () => Promise<void>;
|
|
519
555
|
/**
|
|
520
556
|
* adds supplied files to existing files in the appState.
|
|
@@ -590,13 +626,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
590
626
|
private onGestureStart;
|
|
591
627
|
private onGestureChange;
|
|
592
628
|
private onGestureEnd;
|
|
593
|
-
private handleTextWysiwyg;
|
|
594
|
-
private deselectElements;
|
|
595
|
-
private getSelectedTextElement;
|
|
596
|
-
private getSelectedTextEditingContainerAtPosition;
|
|
597
|
-
getTextElementAtPosition(x: number, y: number): NonDeleted<ExcalidrawTextElement> | null;
|
|
598
|
-
private isHittingTextAutoResizeHandle;
|
|
599
|
-
private handleTextAutoResizeHandlePointerDown;
|
|
600
629
|
getElementAtPosition(x: number, y: number, opts?: ({
|
|
601
630
|
includeBoundTextElement?: boolean;
|
|
602
631
|
includeLockedElements?: boolean;
|
|
@@ -609,230 +638,22 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
609
638
|
includeBoundTextElement?: boolean;
|
|
610
639
|
includeLockedElements?: boolean;
|
|
611
640
|
}): NonDeleted<ExcalidrawElement>[];
|
|
641
|
+
/**
|
|
642
|
+
* Whether the element's frame clips it away at the position — hitting a
|
|
643
|
+
* frame's element from outside the frame is not considered a hit.
|
|
644
|
+
*/
|
|
645
|
+
isClippedByFrameAt(x: number, y: number, element: ExcalidrawElement): boolean;
|
|
612
646
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
613
647
|
hitElement(x: number, y: number, element: NonDeletedExcalidrawElement, considerBoundingBox?: boolean): boolean;
|
|
614
|
-
getTextBindableContainerAtPosition(x: number, y: number): (Readonly<{
|
|
615
|
-
id: string;
|
|
616
|
-
x: number;
|
|
617
|
-
y: number;
|
|
618
|
-
strokeColor: string;
|
|
619
|
-
backgroundColor: string;
|
|
620
|
-
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
621
|
-
strokeWidth: number;
|
|
622
|
-
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
623
|
-
roundness: null | {
|
|
624
|
-
type: import("@excalidraw/element/types").RoundnessType;
|
|
625
|
-
value?: number;
|
|
626
|
-
};
|
|
627
|
-
roughness: number;
|
|
628
|
-
opacity: number;
|
|
629
|
-
width: number;
|
|
630
|
-
height: number;
|
|
631
|
-
angle: Radians;
|
|
632
|
-
seed: number;
|
|
633
|
-
version: number;
|
|
634
|
-
versionNonce: number;
|
|
635
|
-
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
636
|
-
isDeleted: boolean;
|
|
637
|
-
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
638
|
-
frameId: string | null;
|
|
639
|
-
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
640
|
-
updated: number;
|
|
641
|
-
created: number | null;
|
|
642
|
-
link: string | null;
|
|
643
|
-
locked: boolean;
|
|
644
|
-
customData?: Record<string, any>;
|
|
645
|
-
}> & {
|
|
646
|
-
type: "rectangle";
|
|
647
|
-
} & {
|
|
648
|
-
isDeleted: false;
|
|
649
|
-
}) | (Readonly<{
|
|
650
|
-
id: string;
|
|
651
|
-
x: number;
|
|
652
|
-
y: number;
|
|
653
|
-
strokeColor: string;
|
|
654
|
-
backgroundColor: string;
|
|
655
|
-
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
656
|
-
strokeWidth: number;
|
|
657
|
-
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
658
|
-
roundness: null | {
|
|
659
|
-
type: import("@excalidraw/element/types").RoundnessType;
|
|
660
|
-
value?: number;
|
|
661
|
-
};
|
|
662
|
-
roughness: number;
|
|
663
|
-
opacity: number;
|
|
664
|
-
width: number;
|
|
665
|
-
height: number;
|
|
666
|
-
angle: Radians;
|
|
667
|
-
seed: number;
|
|
668
|
-
version: number;
|
|
669
|
-
versionNonce: number;
|
|
670
|
-
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
671
|
-
isDeleted: boolean;
|
|
672
|
-
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
673
|
-
frameId: string | null;
|
|
674
|
-
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
675
|
-
updated: number;
|
|
676
|
-
created: number | null;
|
|
677
|
-
link: string | null;
|
|
678
|
-
locked: boolean;
|
|
679
|
-
customData?: Record<string, any>;
|
|
680
|
-
}> & Readonly<{
|
|
681
|
-
type: "stickynote";
|
|
682
|
-
baseHeight: number;
|
|
683
|
-
}> & {
|
|
684
|
-
isDeleted: false;
|
|
685
|
-
}) | (Readonly<{
|
|
686
|
-
id: string;
|
|
687
|
-
x: number;
|
|
688
|
-
y: number;
|
|
689
|
-
strokeColor: string;
|
|
690
|
-
backgroundColor: string;
|
|
691
|
-
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
692
|
-
strokeWidth: number;
|
|
693
|
-
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
694
|
-
roundness: null | {
|
|
695
|
-
type: import("@excalidraw/element/types").RoundnessType;
|
|
696
|
-
value?: number;
|
|
697
|
-
};
|
|
698
|
-
roughness: number;
|
|
699
|
-
opacity: number;
|
|
700
|
-
width: number;
|
|
701
|
-
height: number;
|
|
702
|
-
angle: Radians;
|
|
703
|
-
seed: number;
|
|
704
|
-
version: number;
|
|
705
|
-
versionNonce: number;
|
|
706
|
-
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
707
|
-
isDeleted: boolean;
|
|
708
|
-
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
709
|
-
frameId: string | null;
|
|
710
|
-
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
711
|
-
updated: number;
|
|
712
|
-
created: number | null;
|
|
713
|
-
link: string | null;
|
|
714
|
-
locked: boolean;
|
|
715
|
-
customData?: Record<string, any>;
|
|
716
|
-
}> & {
|
|
717
|
-
type: "diamond";
|
|
718
|
-
} & {
|
|
719
|
-
isDeleted: false;
|
|
720
|
-
}) | (Readonly<{
|
|
721
|
-
id: string;
|
|
722
|
-
x: number;
|
|
723
|
-
y: number;
|
|
724
|
-
strokeColor: string;
|
|
725
|
-
backgroundColor: string;
|
|
726
|
-
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
727
|
-
strokeWidth: number;
|
|
728
|
-
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
729
|
-
roundness: null | {
|
|
730
|
-
type: import("@excalidraw/element/types").RoundnessType;
|
|
731
|
-
value?: number;
|
|
732
|
-
};
|
|
733
|
-
roughness: number;
|
|
734
|
-
opacity: number;
|
|
735
|
-
width: number;
|
|
736
|
-
height: number;
|
|
737
|
-
angle: Radians;
|
|
738
|
-
seed: number;
|
|
739
|
-
version: number;
|
|
740
|
-
versionNonce: number;
|
|
741
|
-
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
742
|
-
isDeleted: boolean;
|
|
743
|
-
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
744
|
-
frameId: string | null;
|
|
745
|
-
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
746
|
-
updated: number;
|
|
747
|
-
created: number | null;
|
|
748
|
-
link: string | null;
|
|
749
|
-
locked: boolean;
|
|
750
|
-
customData?: Record<string, any>;
|
|
751
|
-
}> & {
|
|
752
|
-
type: "ellipse";
|
|
753
|
-
} & {
|
|
754
|
-
isDeleted: false;
|
|
755
|
-
}) | (Readonly<{
|
|
756
|
-
id: string;
|
|
757
|
-
x: number;
|
|
758
|
-
y: number;
|
|
759
|
-
strokeColor: string;
|
|
760
|
-
backgroundColor: string;
|
|
761
|
-
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
762
|
-
strokeWidth: number;
|
|
763
|
-
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
764
|
-
roundness: null | {
|
|
765
|
-
type: import("@excalidraw/element/types").RoundnessType;
|
|
766
|
-
value?: number;
|
|
767
|
-
};
|
|
768
|
-
roughness: number;
|
|
769
|
-
opacity: number;
|
|
770
|
-
width: number;
|
|
771
|
-
height: number;
|
|
772
|
-
angle: Radians;
|
|
773
|
-
seed: number;
|
|
774
|
-
version: number;
|
|
775
|
-
versionNonce: number;
|
|
776
|
-
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
777
|
-
isDeleted: boolean;
|
|
778
|
-
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
779
|
-
frameId: string | null;
|
|
780
|
-
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
781
|
-
updated: number;
|
|
782
|
-
created: number | null;
|
|
783
|
-
link: string | null;
|
|
784
|
-
locked: boolean;
|
|
785
|
-
customData?: Record<string, any>;
|
|
786
|
-
}> & Readonly<{
|
|
787
|
-
type: "line" | "arrow";
|
|
788
|
-
points: readonly LocalPoint[];
|
|
789
|
-
startBinding: import("@excalidraw/element/types").FixedPointBinding | null;
|
|
790
|
-
endBinding: import("@excalidraw/element/types").FixedPointBinding | null;
|
|
791
|
-
startArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
792
|
-
endArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
793
|
-
}> & Readonly<{
|
|
794
|
-
type: "arrow";
|
|
795
|
-
elbowed: boolean;
|
|
796
|
-
}> & {
|
|
797
|
-
isDeleted: false;
|
|
798
|
-
}) | null;
|
|
799
|
-
/**
|
|
800
|
-
* Whether a text element's content is still being authored.
|
|
801
|
-
*
|
|
802
|
-
* Creating a text reverts the tool to selection during pointerdown, so the
|
|
803
|
-
* pointerup that follows looks like an ordinary canvas click and would
|
|
804
|
-
* capture the still-empty element as a history entry of its own. Undo would
|
|
805
|
-
* then rewind only the typing, restoring an invisible, zero-content element
|
|
806
|
-
* (and, for an endpoint label, leaving the arrow bound to it) rather than
|
|
807
|
-
* removing it. The editor's own submit captures the finished text instead,
|
|
808
|
-
* so the whole create-and-type lands in a single entry.
|
|
809
|
-
*/
|
|
810
|
-
private isEditingTextContent;
|
|
811
|
-
startTextEditing: ({ sceneX, sceneY, insertAtParentCenter, container, autoEdit, initialCaretSceneCoords, arrowEndpoint, }: {
|
|
812
|
-
/** X position to insert text at */
|
|
813
|
-
sceneX: number;
|
|
814
|
-
/** Y position to insert text at */
|
|
815
|
-
sceneY: number;
|
|
816
|
-
/** whether to attempt to insert at element center if applicable */
|
|
817
|
-
insertAtParentCenter?: boolean;
|
|
818
|
-
container?: ExcalidrawTextContainer | null;
|
|
819
|
-
autoEdit?: boolean;
|
|
820
|
-
initialCaretSceneCoords?: {
|
|
821
|
-
x: number;
|
|
822
|
-
y: number;
|
|
823
|
-
};
|
|
824
|
-
/**
|
|
825
|
-
* creates the text as a label for this arrow endpoint: the binding then
|
|
826
|
-
* dictates the text's position and alignment, overriding (sceneX, sceneY)
|
|
827
|
-
*/
|
|
828
|
-
arrowEndpoint?: ArrowEndpoint | null;
|
|
829
|
-
}) => void;
|
|
830
648
|
private startImageCropping;
|
|
831
|
-
|
|
649
|
+
finishImageCropping: () => void;
|
|
832
650
|
private shouldHandleBrowserCanvasDoubleClick;
|
|
833
651
|
private handleCanvasDoubleClick;
|
|
834
652
|
private handleCanvasClick;
|
|
835
|
-
|
|
653
|
+
getElementLinkAtPosition: (scenePointer: Readonly<{
|
|
654
|
+
x: number;
|
|
655
|
+
y: number;
|
|
656
|
+
}>, hitElementMightBeLocked: NonDeletedExcalidrawElement | null) => NonDeletedExcalidrawElement | undefined;
|
|
836
657
|
private handleElementLinkClick;
|
|
837
658
|
/**
|
|
838
659
|
* Applies (or clears) the element-link hover affordances — pointer cursor
|
|
@@ -872,7 +693,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
872
693
|
excludeElementIds?: AppState["selectedElementIds"];
|
|
873
694
|
currentFrameId?: ExcalidrawElement["frameId"];
|
|
874
695
|
}) => NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
875
|
-
|
|
696
|
+
updateFrameToHighlight: (frameToHighlight: AppState["frameToHighlight"]) => void;
|
|
876
697
|
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
877
698
|
insertNewElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
878
699
|
insertNewElement: (element: ExcalidrawElement) => void;
|
|
@@ -885,6 +706,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
885
706
|
*/
|
|
886
707
|
handleHoverSelectedLinearElement(linearElementEditor: LinearElementEditor, scenePointerX: number, scenePointerY: number): void;
|
|
887
708
|
private handleCanvasPointerDown;
|
|
709
|
+
/**
|
|
710
|
+
* The browser took the pointer over (scroll, pinch, palm rejection): no
|
|
711
|
+
* pointerup will follow, so the gesture is torn down here and now — the
|
|
712
|
+
* same cleanup a lost pointerup gets at the next press, only not left
|
|
713
|
+
* lying in wait for it, where its replay would tangle with that press.
|
|
714
|
+
*/
|
|
715
|
+
private handleCanvasPointerCancel;
|
|
888
716
|
private handleCanvasPointerUp;
|
|
889
717
|
private maybeOpenContextMenuAfterPointerDownOnTouchDevices;
|
|
890
718
|
private resetContextMenuTimer;
|
|
@@ -902,14 +730,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
902
730
|
private updateMultiTouchGesture;
|
|
903
731
|
private initialPointerDownState;
|
|
904
732
|
private handleDraggingScrollBar;
|
|
905
|
-
private clearSelectionIfNotUsingSelection;
|
|
906
|
-
/**
|
|
907
|
-
* @returns whether the pointer event has been completely handled
|
|
908
|
-
*/
|
|
909
|
-
private handleSelectionOnPointerDown;
|
|
910
|
-
private isASelectedElement;
|
|
911
|
-
private isHittingCommonBoundingBoxOfSelectedElements;
|
|
912
|
-
private handleTextOnPointerDown;
|
|
913
733
|
private handleFreeDrawElementOnPointerDown;
|
|
914
734
|
insertIframeElement: ({ sceneX, sceneY, width, height, }: {
|
|
915
735
|
sceneX: number;
|
|
@@ -956,11 +776,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
956
776
|
/** generally you should use `addNewImagesToImageCache()` directly if you need
|
|
957
777
|
* to render new images. This is just a failsafe */
|
|
958
778
|
private scheduleImageRefresh;
|
|
959
|
-
private clearSelection;
|
|
960
779
|
private handleInteractiveCanvasRef;
|
|
961
|
-
|
|
780
|
+
insertImages: (imageFiles: File[], sceneX: number, sceneY: number) => Promise<void>;
|
|
962
781
|
private handleAppOnDrop;
|
|
963
|
-
|
|
782
|
+
/** @returns true if the file replaced the scene */
|
|
783
|
+
loadFileToCanvas: (file: File, fileHandle: FileSystemFileHandle | null, insertPosition?: {
|
|
784
|
+
clientX: number;
|
|
785
|
+
clientY: number;
|
|
786
|
+
}) => Promise<true | undefined>;
|
|
964
787
|
private handleCanvasContextMenu;
|
|
965
788
|
/** opens the context menu for the element under the pointer, or the canvas */
|
|
966
789
|
openContextMenu: (pointer: {
|
|
@@ -969,16 +792,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
969
792
|
button?: number;
|
|
970
793
|
pointerType?: string;
|
|
971
794
|
}) => void;
|
|
972
|
-
|
|
973
|
-
private maybeHandleCrop;
|
|
974
|
-
private maybeHandleResize;
|
|
795
|
+
maybeDragNewGenericElement: (pointerDownState: PointerDownState, event: MouseEvent | KeyboardEvent, informMutation?: boolean) => void;
|
|
975
796
|
private getContextMenuItems;
|
|
976
|
-
getTextWysiwygSnappedToCenterPosition(x: number, y: number, appState: AppState, container?: ExcalidrawTextContainer | null): {
|
|
977
|
-
viewportX: number;
|
|
978
|
-
viewportY: number;
|
|
979
|
-
elementCenterX: number;
|
|
980
|
-
elementCenterY: number;
|
|
981
|
-
} | undefined;
|
|
982
797
|
savePointer: (x: number, y: number, button: "up" | "down") => void;
|
|
983
798
|
resetShouldCacheIgnoreZoomDebounced: {
|
|
984
799
|
(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { duplicateElements } from "@excalidraw/element";
|
|
2
|
-
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
+
import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
3
3
|
import type { PointerDownState } from "../types";
|
|
4
4
|
import type App from "./App";
|
|
5
5
|
type Duplication = Pick<ReturnType<typeof duplicateElements>, "duplicatedElements" | "duplicateElementsMap" | "origElementsMap" | "origIdToDuplicateId" | "duplicateIdToOrigId">;
|
|
@@ -11,7 +11,11 @@ type Duplication = Pick<ReturnType<typeof duplicateElements>, "duplicatedElement
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class AppDuplicate {
|
|
13
13
|
private app;
|
|
14
|
-
|
|
14
|
+
private dependencies;
|
|
15
|
+
constructor(app: App, dependencies: {
|
|
16
|
+
/** pointers currently down */
|
|
17
|
+
getPointerCount: () => number;
|
|
18
|
+
});
|
|
15
19
|
/**
|
|
16
20
|
* Hands the duplication over to the host's `props.onDuplicate` (if any),
|
|
17
21
|
* and reconciles what it returned with the duplicates.
|
|
@@ -24,6 +28,52 @@ export declare class AppDuplicate {
|
|
|
24
28
|
elements: ExcalidrawElement[];
|
|
25
29
|
duplicatedElements: import("@excalidraw/element/types").NonDeletedExcalidrawElement[];
|
|
26
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Runs `update` once what's pending is committed, capturing what it changes
|
|
33
|
+
* (if it returns `true`) as a separate undo step.
|
|
34
|
+
*/
|
|
35
|
+
private afterCommit;
|
|
36
|
+
/**
|
|
37
|
+
* Advances the list markers of the duplicated texts (`1.` -> `2.`) once
|
|
38
|
+
* the duplication is committed, as a separate undo step, so that undo
|
|
39
|
+
* reverts the markers first.
|
|
40
|
+
*/
|
|
41
|
+
advanceListMarkers: (duplicatedElements: readonly ExcalidrawElement[]) => void;
|
|
42
|
+
/**
|
|
43
|
+
* The text whose editing an alt-press on it ended, while the press is
|
|
44
|
+
* handed over to the canvas (see `handOverTextEditorPress()`).
|
|
45
|
+
*/
|
|
46
|
+
handedOverTextId: ExcalidrawTextElement["id"] | null;
|
|
47
|
+
/**
|
|
48
|
+
* An alt-press on the text being edited, once it ended the editing, is
|
|
49
|
+
* handed over to the canvas, for the text to be alt-dragged (duplicated) as
|
|
50
|
+
* on the canvas — its duplicate is then edited on drop.
|
|
51
|
+
*/
|
|
52
|
+
handOverTextEditorPress: (event: PointerEvent, textElementId: ExcalidrawTextElement["id"]) => void;
|
|
53
|
+
/**
|
|
54
|
+
* The pointer down a handed-over press is replayed as (see
|
|
55
|
+
* `handOverTextEditorPress()`) moves what was edited — the text, or its
|
|
56
|
+
* container — and nothing beneath the editor, which reaches past the text:
|
|
57
|
+
* no resize handle, nor an arrow's point, midpoint or label.
|
|
58
|
+
*
|
|
59
|
+
* @returns `false` if the pointer down isn't a handed-over press
|
|
60
|
+
*/
|
|
61
|
+
hitEditedElement: (pointerDownState: PointerDownState) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* On alt-drag drop: the list markers advanced along with the drag go back,
|
|
64
|
+
* for the drag to be committed as is, and forth again once it is, as
|
|
65
|
+
* a separate undo step (before the browser gets to paint either).
|
|
66
|
+
*
|
|
67
|
+
* A duplicate is then edited (once the drop is committed): a single list
|
|
68
|
+
* item with text after its marker, with that text selected (`1. |foo|`),
|
|
69
|
+
* as it's likely to differ from the original's — or else the duplicate of
|
|
70
|
+
* the text the drag ended the editing of, with all of it selected.
|
|
71
|
+
*/
|
|
72
|
+
commitDraggedDuplicates: ({ hit }: PointerDownState, { editText, }: {
|
|
73
|
+
/** `false` if the drag didn't end with a genuine pointerup */
|
|
74
|
+
editText: boolean;
|
|
75
|
+
}) => void;
|
|
76
|
+
private editDuplicatedText;
|
|
27
77
|
/**
|
|
28
78
|
* Duplicates elements so that they end up centered at the scene coords
|
|
29
79
|
* (and in the frame at that point, if any). Doesn't update the scene.
|