@excalidraw/element 0.18.0-063e025 → 0.18.0-1118751
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 +13047 -9808
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +19 -19
- package/dist/types/common/src/colors.d.ts +22 -0
- package/dist/types/common/src/constants.d.ts +54 -0
- package/dist/types/common/src/keys.d.ts +4 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utils.d.ts +1 -1
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
- package/dist/types/element/src/arrows/focus.d.ts +5 -2
- package/dist/types/element/src/binding.d.ts +15 -8
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +8 -5
- package/dist/types/element/src/comparisons.d.ts +7 -5
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/delta.d.ts +23 -1
- package/dist/types/element/src/dragElements.d.ts +27 -0
- package/dist/types/element/src/duplicate.d.ts +60 -0
- package/dist/types/element/src/flowchart.d.ts +10 -6
- package/dist/types/element/src/frame.d.ts +2 -2
- package/dist/types/element/src/groups.d.ts +1 -1
- package/dist/types/element/src/index.d.ts +4 -0
- package/dist/types/element/src/linearElementEditor.d.ts +17 -0
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +37 -2
- package/dist/types/element/src/renderElement.d.ts +21 -4
- package/dist/types/element/src/selection.d.ts +1 -1
- package/dist/types/element/src/shape.d.ts +27 -1
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/stickyNote.d.ts +183 -0
- package/dist/types/element/src/textElement.d.ts +7 -3
- package/dist/types/element/src/transform.d.ts +25 -6
- package/dist/types/element/src/typeChecks.d.ts +3 -2
- package/dist/types/element/src/types.d.ts +35 -6
- package/dist/types/element/src/utils.d.ts +15 -4
- package/dist/types/element/src/zindex.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +48 -9
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +32 -6
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +173 -576
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +32 -6
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +50 -10
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +13 -3
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +32 -6
- package/dist/types/excalidraw/actions/actionExport.d.ts +34 -8
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +99 -185
- package/dist/types/excalidraw/actions/actionGroup.d.ts +33 -7
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +68 -4
- package/dist/types/excalidraw/actions/actionLink.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionMenu.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionProperties.d.ts +45 -12
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionStyles.d.ts +17 -4
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +17 -4
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +16 -3
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +1 -2
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +5 -1
- package/dist/types/excalidraw/appState.d.ts +26 -5
- package/dist/types/excalidraw/components/Actions.d.ts +16 -10
- package/dist/types/excalidraw/components/App.arrowText.d.ts +104 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +468 -99
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.duplicate.d.ts +51 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +54 -0
- package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +8 -2
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +5 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
- package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
- package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
- package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +1 -3
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +151 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
- package/dist/types/excalidraw/components/UserList.d.ts +3 -2
- package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/icons.d.ts +5 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -1
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/data/blob.d.ts +36 -10
- package/dist/types/excalidraw/data/json.d.ts +18 -5
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/dist/types/excalidraw/scene/Renderer.d.ts +64 -2
- package/dist/types/excalidraw/scene/index.d.ts +1 -1
- package/dist/types/excalidraw/scene/types.d.ts +6 -1
- package/dist/types/excalidraw/types.d.ts +341 -21
- package/dist/types/excalidraw/viewport.d.ts +31 -66
- package/dist/types/laser-pointer/src/state.d.ts +1 -0
- package/dist/types/math/src/curve.d.ts +19 -12
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/dist/types/math/src/segment.d.ts +6 -0
- package/dist/types/utils/src/export.d.ts +1 -0
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +4 -4
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -173
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
- package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
- package/dist/types/excalidraw/components/shapes.d.ts +0 -270
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
|
|
3
|
-
import { LinearElementEditor,
|
|
4
|
-
import type {
|
|
3
|
+
import { LinearElementEditor, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
|
|
4
|
+
import type { LocalPoint, Radians } from "@excalidraw/math";
|
|
5
|
+
import type { ExcalidrawElement, ExcalidrawTextElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawTextContainer, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
|
|
6
|
+
import type { ArrowEndpoint, TransformHandleDirection } from "@excalidraw/element";
|
|
5
7
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
6
8
|
import { ActionManager } from "../actions/manager";
|
|
7
9
|
import { History } from "../history";
|
|
@@ -13,10 +15,20 @@ import { LaserTrails } from "../laserTrails";
|
|
|
13
15
|
import { isOverScrollBars } from "../scene/scrollbars";
|
|
14
16
|
import { LassoTrail } from "../lasso";
|
|
15
17
|
import { EraserTrail } from "../eraser";
|
|
18
|
+
import { AppArrowText } from "./App.arrowText";
|
|
19
|
+
import { AppBucketFill } from "./App.bucketFill";
|
|
20
|
+
import { AppToolDrag } from "./App.toolDrag";
|
|
21
|
+
import { AppCursor } from "./App.cursor";
|
|
22
|
+
import { AppDrawShape } from "./App.drawshape";
|
|
23
|
+
import { AppDuplicate } from "./App.duplicate";
|
|
24
|
+
import { AppFlowchart } from "./App.flowchart";
|
|
25
|
+
import { AppPan } from "./App.pan";
|
|
26
|
+
import { AppViewport } from "./App.viewport";
|
|
27
|
+
import { AppWheel } from "./App.wheel";
|
|
16
28
|
import { CursorHints } from "./CursorHint";
|
|
17
29
|
import { type OnStateChange } from "./AppStateObserver";
|
|
18
30
|
import type { ExportedElements } from "../data";
|
|
19
|
-
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize,
|
|
31
|
+
import type { AppClassProperties, AppProps, AppState, ElementRenderOverrides, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, KeyboardModifiersObject, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, UIConfig } from "../types";
|
|
20
32
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
21
33
|
import type { ActionResult } from "../actions/types";
|
|
22
34
|
declare const editorLifecycleEventBehavior: {
|
|
@@ -74,13 +86,9 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
74
86
|
actionManager: ActionManager;
|
|
75
87
|
editorInterface: EditorInterface;
|
|
76
88
|
private stylesPanelMode;
|
|
77
|
-
/**
|
|
78
|
-
* Last-measured footprints of named viewport UI surfaces
|
|
79
|
-
* (`data-viewport-ui-name`), so `getViewportOffsets` can reserve space
|
|
80
|
-
* for them while they're hidden.
|
|
81
|
-
*/
|
|
82
|
-
private viewportUILastMeasured;
|
|
83
89
|
private excalidrawContainerRef;
|
|
90
|
+
get ownerDocument(): Document;
|
|
91
|
+
get ownerWindow(): Window & typeof globalThis;
|
|
84
92
|
scene: Scene;
|
|
85
93
|
fonts: Fonts;
|
|
86
94
|
renderer: Renderer;
|
|
@@ -92,7 +100,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
92
100
|
library: AppClassProperties["library"];
|
|
93
101
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
94
102
|
id: string;
|
|
95
|
-
|
|
103
|
+
store: Store;
|
|
96
104
|
private history;
|
|
97
105
|
excalidrawContainerValue: {
|
|
98
106
|
container: HTMLDivElement | null;
|
|
@@ -117,11 +125,26 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
117
125
|
onEvent: AppEventBus<ExcalidrawImperativeAPIEventMap, typeof editorLifecycleEventBehavior>["on"];
|
|
118
126
|
private appStateObserver;
|
|
119
127
|
onStateChange: OnStateChange;
|
|
120
|
-
|
|
121
|
-
|
|
128
|
+
bucketFill: AppBucketFill;
|
|
129
|
+
duplicate: AppDuplicate;
|
|
130
|
+
toolDrag: AppToolDrag;
|
|
131
|
+
flowchart: AppFlowchart;
|
|
132
|
+
cursor: AppCursor;
|
|
133
|
+
arrowText: AppArrowText;
|
|
134
|
+
pan: AppPan;
|
|
135
|
+
viewport: AppViewport;
|
|
136
|
+
wheel: AppWheel;
|
|
122
137
|
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
138
|
+
private textWysiwygSubmitHandler;
|
|
123
139
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
124
140
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
141
|
+
/**
|
|
142
|
+
* the handle of the resize in progress while `state.isResizing` — for UI
|
|
143
|
+
* that words itself by handle (a sticky note's corners resize
|
|
144
|
+
* proportionally, its edges freely); not app state, so it costs no
|
|
145
|
+
* re-render of its own
|
|
146
|
+
*/
|
|
147
|
+
activeResizeHandle: TransformHandleDirection | null;
|
|
125
148
|
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
126
149
|
lastPointerUpIsDoubleClick: boolean;
|
|
127
150
|
lastPointerMoveEvent: PointerEvent | null;
|
|
@@ -131,18 +154,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
131
154
|
y: number;
|
|
132
155
|
} | null;
|
|
133
156
|
private lastCompletedCanvasClicks;
|
|
134
|
-
/** arrowheads removed via endpoint double-click toggle, so a subsequent
|
|
135
|
-
* toggle can restore the original arrowhead (keyed by `elementId:side`) */
|
|
136
|
-
private removedArrowheads;
|
|
137
157
|
/** previous frame pointer coords */
|
|
138
158
|
previousPointerMoveCoords: {
|
|
139
159
|
x: number;
|
|
140
160
|
y: number;
|
|
141
161
|
} | null;
|
|
142
|
-
|
|
143
|
-
x: number;
|
|
144
|
-
y: number;
|
|
145
|
-
};
|
|
162
|
+
drawShape: AppDrawShape;
|
|
146
163
|
laserTrails: LaserTrails;
|
|
147
164
|
eraserTrail: EraserTrail;
|
|
148
165
|
lassoTrail: LassoTrail;
|
|
@@ -186,6 +203,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
186
203
|
wasAddedToSelection: boolean;
|
|
187
204
|
hasBeenDuplicated: boolean;
|
|
188
205
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
206
|
+
arrowLabel: boolean;
|
|
189
207
|
};
|
|
190
208
|
withCmdOrCtrl: boolean;
|
|
191
209
|
drag: {
|
|
@@ -248,6 +266,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
248
266
|
wasAddedToSelection: boolean;
|
|
249
267
|
hasBeenDuplicated: boolean;
|
|
250
268
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
269
|
+
arrowLabel: boolean;
|
|
251
270
|
};
|
|
252
271
|
withCmdOrCtrl: boolean;
|
|
253
272
|
drag: {
|
|
@@ -279,8 +298,83 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
279
298
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
280
299
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
281
300
|
api: ExcalidrawImperativeAPI;
|
|
301
|
+
private elementRenderOverrides;
|
|
302
|
+
/** offsets of `elementRenderOverrides`; keeps its identity while they don't change */
|
|
303
|
+
private elementRenderOffsets;
|
|
304
|
+
private renderOverridesUpdatePending;
|
|
305
|
+
private getRenderOverrideConfig;
|
|
306
|
+
private getElementRenderState;
|
|
282
307
|
private createExcalidrawAPI;
|
|
283
308
|
constructor(props: AppProps);
|
|
309
|
+
/**
|
|
310
|
+
* Whether the editor accepts user input (pointer, keyboard, wheel, touch,
|
|
311
|
+
* clipboard, drag&drop). When `false`, the editor is fully inert for the
|
|
312
|
+
* user, but remains controllable through the imperative API.
|
|
313
|
+
*
|
|
314
|
+
* All user-input entry points must consult this getter (directly or by
|
|
315
|
+
* not being attached/rendered at all).
|
|
316
|
+
*/
|
|
317
|
+
isInteractionEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Whether element links render their link icon and are clickable.
|
|
320
|
+
* True when fully interactive, or when `interaction: { enabled: { links:
|
|
321
|
+
* true } }`
|
|
322
|
+
* (in which case clicking anywhere on a linked element opens the link,
|
|
323
|
+
* same as in view mode).
|
|
324
|
+
*/
|
|
325
|
+
isLinksEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Whether canvas navigation — panning & zooming, view-mode style — is
|
|
328
|
+
* enabled. True when fully interactive, or when `interaction: { enabled:
|
|
329
|
+
* { navigation: true } }`. Respects `appState.scrollConstraints`.
|
|
330
|
+
*/
|
|
331
|
+
isNavigationEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Whether embeddable & iframe elements are interactive (hover & click to
|
|
334
|
+
* activate, view-mode style). True when fully interactive, or when
|
|
335
|
+
* allowed via `interaction.enabled.embeds` / `.interactiveContent`.
|
|
336
|
+
*/
|
|
337
|
+
isEmbedsEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Whether the browser's own zoom (ctrl/cmd + wheel, pinch, keyboard
|
|
340
|
+
* shortcuts) stays available over the non-interactive editor.
|
|
341
|
+
* Prevented by default.
|
|
342
|
+
*/
|
|
343
|
+
isBrowserZoomEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
344
|
+
/**
|
|
345
|
+
* Whether the tool can be activated & driven by user input. False when
|
|
346
|
+
* disabled via `UIOptions.tools`, or when the editor is non-interactive
|
|
347
|
+
* and the tool isn't kept user-driven via `interaction.enabled.tools`.
|
|
348
|
+
*
|
|
349
|
+
* (Once UI tool availability is split from input availability — e.g.
|
|
350
|
+
* `props.ui.tools` vs `interaction.disabled.tools` — the UI axis moves
|
|
351
|
+
* out into its own predicate.)
|
|
352
|
+
*
|
|
353
|
+
* We purposely widen the `tool` type so this helper can be called with
|
|
354
|
+
* any tool without having to type check it.
|
|
355
|
+
*/
|
|
356
|
+
isToolSupported: <T extends ToolType | "custom">(tool: T, props?: Pick<AppProps, "interaction" | "UIOptions">) => boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Whether the active tool is locked in place — via the tool lock
|
|
359
|
+
* (padlock / Q) or by being host-forced (`props.activeTool`). A locked
|
|
360
|
+
* tool doesn't revert to the selection tool after use, and elements drawn
|
|
361
|
+
* with it aren't selected. Forcing deliberately does not mutate
|
|
362
|
+
* `activeTool.locked`, which is the user's persisted padlock preference.
|
|
363
|
+
*/
|
|
364
|
+
isToolLocked(): boolean;
|
|
365
|
+
/**
|
|
366
|
+
* Whether the active tool captures the primary pointer instead of the
|
|
367
|
+
* view-mode drag-to-pan — the laser and host-implemented custom tools do;
|
|
368
|
+
* while non-interactive, any tool allowed via
|
|
369
|
+
* `interaction.enabled.tools` does. (Editing tools capture the pointer
|
|
370
|
+
* trivially since view mode implies they're not active; this predicate only
|
|
371
|
+
* matters where view-mode gates apply.)
|
|
372
|
+
*/
|
|
373
|
+
isActiveToolPointerCapturing(): boolean;
|
|
374
|
+
/** Whether Excalidraw's full default UI is rendered. */
|
|
375
|
+
isDefaultUIEnabled(props?: Pick<AppProps, "ui">): boolean;
|
|
376
|
+
/** Whether an individual default UI control is rendered. */
|
|
377
|
+
isUIControlEnabled(control: keyof UIConfig["enabled"], props?: Pick<AppProps, "ui">): boolean;
|
|
284
378
|
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
285
379
|
private onWindowMessage;
|
|
286
380
|
private handleSkipBindMode;
|
|
@@ -295,6 +389,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
295
389
|
getEffectiveGridSize: () => NullableGridSize;
|
|
296
390
|
private getTextCreationGridPoint;
|
|
297
391
|
private getHTMLIFrameElement;
|
|
392
|
+
/**
|
|
393
|
+
* AI-generated iframe elements aren't interactive while their generation
|
|
394
|
+
* is still in progress (the partial content is render-only).
|
|
395
|
+
*/
|
|
396
|
+
private isIframeLikeInteractive;
|
|
298
397
|
private handleIframeLikeElementHover;
|
|
299
398
|
/** @returns true if iframe-like element click handled */
|
|
300
399
|
private handleIframeLikeCenterClick;
|
|
@@ -331,9 +430,33 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
331
430
|
private openEyeDropper;
|
|
332
431
|
dismissLinearEditor: () => void;
|
|
333
432
|
syncActionResult: (actionResult: ActionResult) => void;
|
|
433
|
+
scheduleCapture: () => void;
|
|
334
434
|
private onBlur;
|
|
335
435
|
private onUnload;
|
|
336
436
|
private disableEvent;
|
|
437
|
+
private handleNavigationModeKeyDown;
|
|
438
|
+
/**
|
|
439
|
+
* PageUp/PageDown scroll the canvas by a page — vertically, or
|
|
440
|
+
* horizontally with shift. Respects `appState.scrollConstraints`
|
|
441
|
+
* (via `viewport.translate`).
|
|
442
|
+
*/
|
|
443
|
+
private maybeHandlePageScrollKeyDown;
|
|
444
|
+
private preventBrowserZoomKeyDown;
|
|
445
|
+
/** Ends active input sessions before switching to a view-mode/non-interactive
|
|
446
|
+
* mode. */
|
|
447
|
+
private terminateActiveInteraction;
|
|
448
|
+
private handleInteractionStateChange;
|
|
449
|
+
/** whether the two values reference the same tool (incl. custom subtype) */
|
|
450
|
+
private isSameForcedTool;
|
|
451
|
+
/**
|
|
452
|
+
* Keeps `state.activeTool` synced to the host-controlled
|
|
453
|
+
* `props.activeTool`. `setActiveTool` refuses non-matching activations
|
|
454
|
+
* while forced (user input, API); this backstop covers the writers that
|
|
455
|
+
* bypass the funnel (`actionFinalize`/`actionDeselect`, `restore()` on
|
|
456
|
+
* scene load, ...) and re-applies the tool once it becomes activatable
|
|
457
|
+
* (e.g. `interaction` config changes).
|
|
458
|
+
*/
|
|
459
|
+
private handleForcedToolChange;
|
|
337
460
|
private resetHistory;
|
|
338
461
|
private resetStore;
|
|
339
462
|
/**
|
|
@@ -383,46 +506,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
383
506
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
384
507
|
updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
385
508
|
togglePenMode: (force: boolean | null) => void;
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
*
|
|
389
|
-
*/
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
*
|
|
393
|
-
|
|
394
|
-
*/
|
|
395
|
-
value: number) => void;
|
|
396
|
-
/**
|
|
397
|
-
* Navigates the viewport to a target and, optionally, locks pan/zoom to it.
|
|
398
|
-
* The resolved target box drives both the navigation (pan + zoom per
|
|
399
|
-
* `fit`) and the lock: the operations chain — the viewport animates onto
|
|
400
|
-
* the target, then the lock is installed against the settled viewport.
|
|
401
|
-
*
|
|
402
|
-
* Passing `null` clears any active lock without navigating.
|
|
403
|
-
*/
|
|
404
|
-
/**
|
|
405
|
-
* Resolves user-supplied viewport offsets ({@link ViewportOffsets}) into
|
|
406
|
-
* concrete per-side pixel values: static sides are used as-is, and when
|
|
407
|
-
* `ui` is set, the remaining sides are derived from the currently
|
|
408
|
-
* rendered editor UI (via `getViewportOffsets`).
|
|
409
|
-
*
|
|
410
|
-
* Must be called at the time the offsets are applied (not e.g. cached at
|
|
411
|
-
* props-definition time), so the UI-derived values reflect the actual
|
|
412
|
-
* rendered UI.
|
|
413
|
-
*/
|
|
414
|
-
private resolveViewportOffsets;
|
|
415
|
-
setViewport: (opts: SetViewportOptions | null) => void;
|
|
416
|
-
private maybeUnfollowRemoteUser;
|
|
417
|
-
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
418
|
-
private translateCanvas;
|
|
419
|
-
/** clamps scroll/zoom back into `appState.scrollConstraints` (no-op when
|
|
420
|
-
* unconstrained). Runs as a queued update, so it sees the preceding change.
|
|
421
|
-
* `overscroll` (screen px) relaxes the bounds for rubberbanding. */
|
|
422
|
-
private constrainViewportToScrollConstraints;
|
|
423
|
-
/** animates an overscrolled viewport back inside the constraint box */
|
|
424
|
-
private snapBackToScrollConstraints;
|
|
425
|
-
private snapBackToScrollConstraintsDebounced;
|
|
509
|
+
revealIfHidden: (elements: NonDeletedExcalidrawElement[]) => void;
|
|
510
|
+
/** emits a follow/unfollow intent to the host (which owns the
|
|
511
|
+
* `userToFollow` state) via both the `onUserFollow` prop and the
|
|
512
|
+
* imperative API emitter */
|
|
513
|
+
emitUserFollowIntent: (payload: OnUserFollowedPayload) => void;
|
|
514
|
+
/** emits an UNFOLLOW intent if currently following someone — use on
|
|
515
|
+
* user-initiated viewport changes which should break follow mode */
|
|
516
|
+
requestUnfollow: () => void;
|
|
426
517
|
setToast: (toast: AppState["toast"]) => void;
|
|
427
518
|
restoreFileFromShare: () => Promise<void>;
|
|
428
519
|
/**
|
|
@@ -448,9 +539,15 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
448
539
|
*/
|
|
449
540
|
captureUpdate?: SceneData["captureUpdate"];
|
|
450
541
|
}) => void;
|
|
542
|
+
/**
|
|
543
|
+
* see {@link ExcalidrawImperativeAPI.setElementRenderOverrides} for details
|
|
544
|
+
*/
|
|
545
|
+
setElementRenderOverrides: (overrides: ElementRenderOverrides | null) => void;
|
|
451
546
|
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
|
|
452
547
|
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
453
|
-
|
|
548
|
+
triggerRender: (
|
|
549
|
+
/** force always re-renders canvas even if no change */
|
|
550
|
+
force?: boolean) => void;
|
|
454
551
|
/**
|
|
455
552
|
* @returns whether the menu was toggled on or off
|
|
456
553
|
*/
|
|
@@ -460,20 +557,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
460
557
|
force?: boolean;
|
|
461
558
|
}) => boolean;
|
|
462
559
|
private updateCurrentCursorPosition;
|
|
463
|
-
/**
|
|
464
|
-
* top/right/bottom/left override the final offsets for those sides.
|
|
465
|
-
*
|
|
466
|
-
* Default side offsets are measured from the currently rendered UI
|
|
467
|
-
* surfaces marked with the `data-viewport-ui` attribute (see
|
|
468
|
-
* {@link ViewportUIDock}), plus padding.
|
|
469
|
-
*
|
|
470
|
-
* See {@link ViewportOffsetsOptions} for the individual options
|
|
471
|
-
* (padding, per-side overrides, reserving space for hidden surfaces).
|
|
472
|
-
*/
|
|
473
|
-
getViewportOffsets: (opts?: ViewportOffsetsOptions) => Offsets;
|
|
474
560
|
private onKeyDown;
|
|
475
561
|
private onKeyUp;
|
|
476
|
-
private isToolSupported;
|
|
477
562
|
setActiveTool: (tool: ({
|
|
478
563
|
type: ToolType;
|
|
479
564
|
} | {
|
|
@@ -482,10 +567,18 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
482
567
|
}) & {
|
|
483
568
|
locked?: boolean;
|
|
484
569
|
fromSelection?: boolean;
|
|
485
|
-
},
|
|
570
|
+
}, opts?: {
|
|
571
|
+
keepSelection?: boolean;
|
|
572
|
+
/**
|
|
573
|
+
* When `true`, re-activating an already-active toggle tool (see
|
|
574
|
+
* `TOGGLE_TOOLS`) switches back to the previously active tool.
|
|
575
|
+
* Activation is idempotent by default; toggle tools always record the
|
|
576
|
+
* previously active tool regardless (so ESC and the next `toggle`
|
|
577
|
+
* activation can switch back to it).
|
|
578
|
+
*/
|
|
579
|
+
toggle?: boolean;
|
|
580
|
+
}) => void;
|
|
486
581
|
setOpenDialog: (dialogType: AppState["openDialog"]) => void;
|
|
487
|
-
private setCursor;
|
|
488
|
-
private resetCursor;
|
|
489
582
|
/**
|
|
490
583
|
* returns whether user is making a gesture with >= 2 fingers (points)
|
|
491
584
|
* on o touch screen (not on a trackpad). Currently only relates to Darwin
|
|
@@ -501,40 +594,295 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
501
594
|
private deselectElements;
|
|
502
595
|
private getSelectedTextElement;
|
|
503
596
|
private getSelectedTextEditingContainerAtPosition;
|
|
504
|
-
|
|
597
|
+
getTextElementAtPosition(x: number, y: number): NonDeleted<ExcalidrawTextElement> | null;
|
|
505
598
|
private isHittingTextAutoResizeHandle;
|
|
506
599
|
private handleTextAutoResizeHandlePointerDown;
|
|
507
|
-
|
|
508
|
-
|
|
600
|
+
getElementAtPosition(x: number, y: number, opts?: ({
|
|
601
|
+
includeBoundTextElement?: boolean;
|
|
602
|
+
includeLockedElements?: boolean;
|
|
603
|
+
} | {
|
|
604
|
+
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
605
|
+
}) & {
|
|
606
|
+
preferSelected?: boolean;
|
|
607
|
+
}): NonDeleted<ExcalidrawElement> | null;
|
|
608
|
+
getElementsAtPosition(x: number, y: number, opts?: {
|
|
609
|
+
includeBoundTextElement?: boolean;
|
|
610
|
+
includeLockedElements?: boolean;
|
|
611
|
+
}): NonDeleted<ExcalidrawElement>[];
|
|
509
612
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
613
|
+
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;
|
|
513
830
|
private startImageCropping;
|
|
514
831
|
private finishImageCropping;
|
|
515
832
|
private shouldHandleBrowserCanvasDoubleClick;
|
|
516
|
-
/**
|
|
517
|
-
* Toggles the arrowhead at the given endpoint between no arrowhead and the
|
|
518
|
-
* arrowhead it had before the last toggle (falling back to the current
|
|
519
|
-
* default arrowhead).
|
|
520
|
-
*/
|
|
521
|
-
private toggleArrowheadAtEndpoint;
|
|
522
833
|
private handleCanvasDoubleClick;
|
|
523
834
|
private handleCanvasClick;
|
|
524
835
|
private getElementLinkAtPosition;
|
|
525
836
|
private handleElementLinkClick;
|
|
837
|
+
/**
|
|
838
|
+
* Applies (or clears) the element-link hover affordances — pointer cursor
|
|
839
|
+
* and tooltip — based on the current `hitLinkElement`. Returns whether a
|
|
840
|
+
* link is being hovered.
|
|
841
|
+
*/
|
|
842
|
+
private applyElementLinkHoverAffordance;
|
|
843
|
+
/**
|
|
844
|
+
* On touchscreens (where no hover precedes the tap) re-derives
|
|
845
|
+
* `hitLinkElement`, then opens the hit element link, if any.
|
|
846
|
+
* Returns whether a link click was handled.
|
|
847
|
+
*/
|
|
848
|
+
private maybeHandleElementLinkClick;
|
|
849
|
+
/**
|
|
850
|
+
* Restricted pointer handling for the non-interactive editor with links
|
|
851
|
+
* and/or embeds allowed (`interaction.enabled.links` / `.embeds` /
|
|
852
|
+
* `.interactiveContent`) — runs only the element-link & embed concerns
|
|
853
|
+
* (shared with the full pointer handlers above) so they behave like in
|
|
854
|
+
* view mode without the rest of the canvas pointer machinery.
|
|
855
|
+
*/
|
|
856
|
+
private handleInteractiveContentPointerMove;
|
|
857
|
+
private handleInteractiveContentPointerUp;
|
|
526
858
|
/**
|
|
527
859
|
* finds candidate frame under cursor (when dragging frame children/elements
|
|
528
860
|
* inside frames)
|
|
529
861
|
*/
|
|
530
|
-
|
|
862
|
+
getTopLayerFrameAtSceneCoords: (
|
|
863
|
+
/**
|
|
864
|
+
* should be already grid aligned (basically should be what the call site
|
|
865
|
+
* sets the element's coords to, if applicable)
|
|
866
|
+
*/
|
|
867
|
+
sceneCoords: {
|
|
868
|
+
x: number;
|
|
869
|
+
y: number;
|
|
870
|
+
}, opts?: {
|
|
871
|
+
/** to exclude selected elements when dragging, etc. */
|
|
872
|
+
excludeElementIds?: AppState["selectedElementIds"];
|
|
873
|
+
currentFrameId?: ExcalidrawElement["frameId"];
|
|
874
|
+
}) => NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
531
875
|
private updateFrameToHighlight;
|
|
532
876
|
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
533
|
-
|
|
534
|
-
|
|
877
|
+
insertNewElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
878
|
+
insertNewElement: (element: ExcalidrawElement) => void;
|
|
535
879
|
private handleCanvasPointerMove;
|
|
536
880
|
private handleEraser;
|
|
537
881
|
private handleTouchMove;
|
|
882
|
+
/**
|
|
883
|
+
* Applies the hover affordances of a selected linear element: the cursor,
|
|
884
|
+
* plus the hovered-handle state that renders them highlighted.
|
|
885
|
+
*/
|
|
538
886
|
handleHoverSelectedLinearElement(linearElementEditor: LinearElementEditor, scenePointerX: number, scenePointerY: number): void;
|
|
539
887
|
private handleCanvasPointerDown;
|
|
540
888
|
private handleCanvasPointerUp;
|
|
@@ -546,8 +894,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
546
894
|
* pointerup handlers manually
|
|
547
895
|
*/
|
|
548
896
|
private maybeCleanupAfterMissingPointerUp;
|
|
549
|
-
handleCanvasPanUsingWheelOrSpaceDrag: (event: React.PointerEvent<HTMLElement> | MouseEvent) => boolean;
|
|
550
897
|
private updateGestureOnPointerDown;
|
|
898
|
+
/**
|
|
899
|
+
* Tracks the pointer within the ongoing multi-touch gesture and applies
|
|
900
|
+
* the two-finger pinch zoom/pan, if any.
|
|
901
|
+
*/
|
|
902
|
+
private updateMultiTouchGesture;
|
|
551
903
|
private initialPointerDownState;
|
|
552
904
|
private handleDraggingScrollBar;
|
|
553
905
|
private clearSelectionIfNotUsingSelection;
|
|
@@ -572,12 +924,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
572
924
|
}) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
|
|
573
925
|
private newImagePlaceholder;
|
|
574
926
|
private handleLinearElementOnPointerDown;
|
|
575
|
-
|
|
576
|
-
|
|
927
|
+
getCurrentItemRoundness(elementType: "selection" | "rectangle" | "stickynote" | "diamond" | "ellipse" | "iframe" | "embeddable"): {
|
|
928
|
+
type: 2 | 3;
|
|
929
|
+
} | null;
|
|
930
|
+
getCurrentItemStrokeWidth(elementType: ExcalidrawElement["type"]): number;
|
|
577
931
|
private createGenericElementOnPointerDown;
|
|
578
932
|
private createFrameElementOnPointerDown;
|
|
579
|
-
|
|
580
|
-
|
|
933
|
+
maybeCacheReferenceSnapPoints(event: KeyboardModifiersObject, selectedElements: readonly NonDeletedExcalidrawElement[], recomputeAnyways?: boolean): void;
|
|
934
|
+
maybeCacheVisibleGaps(event: KeyboardModifiersObject, selectedElements: readonly NonDeletedExcalidrawElement[], recomputeAnyways?: boolean): void;
|
|
581
935
|
private onKeyDownFromPointerDownHandler;
|
|
582
936
|
private onKeyUpFromPointerDownHandler;
|
|
583
937
|
private onPointerMoveFromPointerDownHandler;
|
|
@@ -608,14 +962,29 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
608
962
|
private handleAppOnDrop;
|
|
609
963
|
loadFileToCanvas: (file: File, fileHandle: FileSystemFileHandle | null) => Promise<void>;
|
|
610
964
|
private handleCanvasContextMenu;
|
|
965
|
+
/** opens the context menu for the element under the pointer, or the canvas */
|
|
966
|
+
openContextMenu: (pointer: {
|
|
967
|
+
clientX: number;
|
|
968
|
+
clientY: number;
|
|
969
|
+
button?: number;
|
|
970
|
+
pointerType?: string;
|
|
971
|
+
}) => void;
|
|
611
972
|
private maybeDragNewGenericElement;
|
|
612
973
|
private maybeHandleCrop;
|
|
613
974
|
private maybeHandleResize;
|
|
614
975
|
private getContextMenuItems;
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
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
|
+
savePointer: (x: number, y: number, button: "up" | "down") => void;
|
|
983
|
+
resetShouldCacheIgnoreZoomDebounced: {
|
|
984
|
+
(): void;
|
|
985
|
+
flush(): void;
|
|
986
|
+
cancel(): void;
|
|
987
|
+
};
|
|
619
988
|
private updateDOMRect;
|
|
620
989
|
refresh: () => void;
|
|
621
990
|
private getCanvasOffsets;
|