@nextcloud/excalidraw-common 0.18.0-8fb6b24 → 0.18.0-nc.2
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 +204 -85
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/index.js +3 -3
- package/dist/types/common/src/colors.d.ts +23 -1
- package/dist/types/common/src/constants.d.ts +66 -7
- 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 +6 -43
- package/dist/types/element/src/Scene.d.ts +16 -5
- package/dist/types/element/src/align.d.ts +2 -2
- 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 +28 -13
- package/dist/types/element/src/bounds.d.ts +24 -7
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +14 -5
- package/dist/types/element/src/comparisons.d.ts +8 -5
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/cropElement.d.ts +36 -4
- package/dist/types/element/src/delta.d.ts +23 -1
- package/dist/types/element/src/distribute.d.ts +2 -2
- package/dist/types/element/src/dragElements.d.ts +27 -0
- package/dist/types/element/src/duplicate.d.ts +64 -3
- package/dist/types/element/src/embeddable.d.ts +2 -2
- package/dist/types/element/src/flowchart.d.ts +11 -7
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +11 -10
- package/dist/types/element/src/groups.d.ts +10 -15
- package/dist/types/element/src/image.d.ts +6 -0
- package/dist/types/element/src/index.d.ts +6 -1
- package/dist/types/element/src/linearElementEditor.d.ts +27 -10
- package/dist/types/element/src/listMarker.d.ts +34 -0
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +53 -3
- package/dist/types/element/src/renderElement.d.ts +22 -7
- package/dist/types/element/src/resizeElements.d.ts +8 -1
- package/dist/types/element/src/selection.d.ts +6 -12
- 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 +20 -9
- package/dist/types/element/src/transform.d.ts +26 -7
- package/dist/types/element/src/typeChecks.d.ts +29 -27
- package/dist/types/element/src/types.d.ts +43 -7
- package/dist/types/element/src/utils.d.ts +15 -4
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +87 -18
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +74 -203
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +266 -941
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +58 -12
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +29 -6
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -518
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +29 -6
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +59 -13
- package/dist/types/excalidraw/actions/actionExport.d.ts +64 -18
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +114 -651
- package/dist/types/excalidraw/actions/actionGroup.d.ts +73 -27
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +84 -9
- package/dist/types/excalidraw/actions/actionLink.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionMenu.d.ts +29 -6
- package/dist/types/excalidraw/actions/actionProperties.d.ts +96 -34
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +34 -11
- package/dist/types/excalidraw/actions/actionStyles.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +33 -11
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +33 -11
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleShowHints.d.ts} +45 -19
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +31 -8
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +30 -7
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +3 -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 +8 -4
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +34 -10
- package/dist/types/excalidraw/components/Actions.d.ts +17 -12
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +324 -111
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +62 -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.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +113 -0
- package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
- package/dist/types/excalidraw/components/App.wrap.d.ts +31 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
- 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/colorPickerUtils.d.ts +1 -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/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
- package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
- 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/Island.d.ts +7 -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/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +3 -1
- package/dist/types/excalidraw/components/LibraryMenuItems.d.ts +3 -1
- 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/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/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- 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/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
- 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/Tooltip.d.ts +15 -1
- 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 +3 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
- package/dist/types/excalidraw/components/icons.d.ts +7 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +10 -4
- 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 +70 -24
- package/dist/types/excalidraw/data/index.d.ts +4 -4
- package/dist/types/excalidraw/data/json.d.ts +41 -18
- package/dist/types/excalidraw/data/library.d.ts +1 -1
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/animation.d.ts +5 -1
- package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +2 -4
- package/dist/types/excalidraw/scene/Renderer.d.ts +489 -20
- package/dist/types/excalidraw/scene/export.d.ts +3 -3
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +7 -4
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/types.d.ts +574 -29
- package/dist/types/excalidraw/viewport.d.ts +302 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +13 -3
- package/dist/types/fractional-indexing/src/index.d.ts +29 -0
- package/dist/types/laser-pointer/src/index.d.ts +2 -0
- package/dist/types/laser-pointer/src/math.d.ts +16 -0
- package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
- package/dist/types/laser-pointer/src/state.d.ts +36 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +23 -13
- 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/point.d.ts +1 -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 +4 -3
- package/dist/types/utils/src/index.d.ts +1 -2
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +1 -1
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- 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 -263
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -1,21 +1,40 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@nextcloud/excalidraw-common";
|
|
3
|
-
import { LinearElementEditor,
|
|
3
|
+
import { LinearElementEditor, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@nextcloud/excalidraw-element";
|
|
4
4
|
import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@nextcloud/excalidraw-element/types";
|
|
5
|
+
import type { TransformHandleDirection } from "@nextcloud/excalidraw-element";
|
|
5
6
|
import type { Mutable } from "@nextcloud/excalidraw-common/utility-types";
|
|
6
7
|
import { ActionManager } from "../actions/manager";
|
|
7
|
-
import { AnimationFrameHandler } from "../animation-frame-handler";
|
|
8
8
|
import { History } from "../history";
|
|
9
9
|
import { Fonts } from "../fonts";
|
|
10
10
|
import { type WritableAtom } from "../editor-jotai";
|
|
11
11
|
import { Renderer } from "../scene/Renderer";
|
|
12
|
-
import {
|
|
12
|
+
import { type SetViewportOptions } from "../viewport";
|
|
13
|
+
import { LaserTrails } from "../laserTrails";
|
|
13
14
|
import { isOverScrollBars } from "../scene/scrollbars";
|
|
14
15
|
import { LassoTrail } from "../lasso";
|
|
15
16
|
import { EraserTrail } from "../eraser";
|
|
17
|
+
import { AppArrowText } from "./App.arrowText";
|
|
18
|
+
import { AppClipboard } from "./App.clipboard";
|
|
19
|
+
import { AppText } from "./App.text";
|
|
20
|
+
import { AppTextTool } from "./App.textTool";
|
|
21
|
+
import { AppBucketFill } from "./App.bucketFill";
|
|
22
|
+
import { AppToolDrag } from "./App.toolDrag";
|
|
23
|
+
import { AppCursor } from "./App.cursor";
|
|
24
|
+
import { AppDrawShape } from "./App.drawshape";
|
|
25
|
+
import { AppDuplicate } from "./App.duplicate";
|
|
26
|
+
import { AppFlowchart } from "./App.flowchart";
|
|
27
|
+
import { AppModifiers } from "./App.modifiers";
|
|
28
|
+
import { AppPan } from "./App.pan";
|
|
29
|
+
import { AppViewport } from "./App.viewport";
|
|
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 { CursorHints } from "./CursorHint";
|
|
16
35
|
import { type OnStateChange } from "./AppStateObserver";
|
|
17
36
|
import type { ExportedElements } from "../data";
|
|
18
|
-
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize,
|
|
37
|
+
import type { AppClassProperties, AppProps, AppState, ElementRenderOverrides, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, PointerDownState, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, KeyboardModifiersObject, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, UIConfig } from "../types";
|
|
19
38
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
20
39
|
import type { ActionResult } from "../actions/types";
|
|
21
40
|
declare const editorLifecycleEventBehavior: {
|
|
@@ -74,15 +93,21 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
74
93
|
editorInterface: EditorInterface;
|
|
75
94
|
private stylesPanelMode;
|
|
76
95
|
private excalidrawContainerRef;
|
|
96
|
+
private zenModeTransitionTimer;
|
|
97
|
+
get ownerDocument(): Document;
|
|
98
|
+
get ownerWindow(): Window & typeof globalThis;
|
|
77
99
|
scene: Scene;
|
|
78
100
|
fonts: Fonts;
|
|
79
101
|
renderer: Renderer;
|
|
80
102
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
103
|
+
/** whether the last render had any renderable elements (excludes e.g. the
|
|
104
|
+
* in-progress `newElement` and the edited text element) */
|
|
105
|
+
private hasRenderableElements;
|
|
81
106
|
private resizeObserver;
|
|
82
107
|
library: AppClassProperties["library"];
|
|
83
108
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
84
109
|
id: string;
|
|
85
|
-
|
|
110
|
+
store: Store;
|
|
86
111
|
private history;
|
|
87
112
|
excalidrawContainerValue: {
|
|
88
113
|
container: HTMLDivElement | null;
|
|
@@ -107,11 +132,31 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
107
132
|
onEvent: AppEventBus<ExcalidrawImperativeAPIEventMap, typeof editorLifecycleEventBehavior>["on"];
|
|
108
133
|
private appStateObserver;
|
|
109
134
|
onStateChange: OnStateChange;
|
|
110
|
-
|
|
111
|
-
|
|
135
|
+
bucketFill: AppBucketFill;
|
|
136
|
+
duplicate: AppDuplicate;
|
|
137
|
+
toolDrag: AppToolDrag;
|
|
138
|
+
flowchart: AppFlowchart;
|
|
139
|
+
cursor: AppCursor;
|
|
140
|
+
arrowText: AppArrowText;
|
|
141
|
+
pan: AppPan;
|
|
142
|
+
textTool: AppTextTool;
|
|
143
|
+
clipboard: AppClipboard;
|
|
144
|
+
text: AppText;
|
|
145
|
+
viewport: AppViewport;
|
|
146
|
+
wheel: AppWheel;
|
|
147
|
+
selection: AppSelection;
|
|
148
|
+
selectionTool: AppSelectionTool;
|
|
149
|
+
wrap: AppWrap;
|
|
112
150
|
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
113
151
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
114
152
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
153
|
+
/**
|
|
154
|
+
* the handle of the resize in progress while `state.isResizing` — for UI
|
|
155
|
+
* that words itself by handle (a sticky note's corners resize
|
|
156
|
+
* proportionally, its edges freely); not app state, so it costs no
|
|
157
|
+
* re-render of its own
|
|
158
|
+
*/
|
|
159
|
+
activeResizeHandle: TransformHandleDirection | null;
|
|
115
160
|
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
116
161
|
lastPointerUpIsDoubleClick: boolean;
|
|
117
162
|
lastPointerMoveEvent: PointerEvent | null;
|
|
@@ -121,19 +166,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
121
166
|
y: number;
|
|
122
167
|
} | null;
|
|
123
168
|
private lastCompletedCanvasClicks;
|
|
124
|
-
|
|
125
|
-
previousPointerMoveCoords: {
|
|
126
|
-
x: number;
|
|
127
|
-
y: number;
|
|
128
|
-
} | null;
|
|
129
|
-
lastViewportPosition: {
|
|
130
|
-
x: number;
|
|
131
|
-
y: number;
|
|
132
|
-
};
|
|
133
|
-
animationFrameHandler: AnimationFrameHandler;
|
|
169
|
+
drawShape: AppDrawShape;
|
|
134
170
|
laserTrails: LaserTrails;
|
|
135
171
|
eraserTrail: EraserTrail;
|
|
136
172
|
lassoTrail: LassoTrail;
|
|
173
|
+
cursorHints: CursorHints;
|
|
137
174
|
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
|
|
138
175
|
onPointerDownEmitter: Emitter<[activeTool: {
|
|
139
176
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -171,8 +208,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
171
208
|
element: NonDeleted<ExcalidrawElement> | null;
|
|
172
209
|
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
173
210
|
wasAddedToSelection: boolean;
|
|
211
|
+
cycleTarget: NonDeleted<ExcalidrawElement> | null;
|
|
174
212
|
hasBeenDuplicated: boolean;
|
|
213
|
+
advancedListMarkers: readonly import("@nextcloud/excalidraw-element").ListMarkerAdvance[];
|
|
214
|
+
editedTextId: import("@nextcloud/excalidraw-element/types").ExcalidrawTextElement["id"] | null;
|
|
175
215
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
216
|
+
arrowLabel: boolean;
|
|
176
217
|
};
|
|
177
218
|
withCmdOrCtrl: boolean;
|
|
178
219
|
drag: {
|
|
@@ -185,6 +226,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
185
226
|
x: number;
|
|
186
227
|
y: number;
|
|
187
228
|
};
|
|
229
|
+
lastOffset: {
|
|
230
|
+
x: number;
|
|
231
|
+
y: number;
|
|
232
|
+
};
|
|
188
233
|
blockDragging: boolean;
|
|
189
234
|
};
|
|
190
235
|
eventListeners: {
|
|
@@ -233,8 +278,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
233
278
|
element: NonDeleted<ExcalidrawElement> | null;
|
|
234
279
|
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
235
280
|
wasAddedToSelection: boolean;
|
|
281
|
+
cycleTarget: NonDeleted<ExcalidrawElement> | null;
|
|
236
282
|
hasBeenDuplicated: boolean;
|
|
283
|
+
advancedListMarkers: readonly import("@nextcloud/excalidraw-element").ListMarkerAdvance[];
|
|
284
|
+
editedTextId: import("@nextcloud/excalidraw-element/types").ExcalidrawTextElement["id"] | null;
|
|
237
285
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
286
|
+
arrowLabel: boolean;
|
|
238
287
|
};
|
|
239
288
|
withCmdOrCtrl: boolean;
|
|
240
289
|
drag: {
|
|
@@ -247,6 +296,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
247
296
|
x: number;
|
|
248
297
|
y: number;
|
|
249
298
|
};
|
|
299
|
+
lastOffset: {
|
|
300
|
+
x: number;
|
|
301
|
+
y: number;
|
|
302
|
+
};
|
|
250
303
|
blockDragging: boolean;
|
|
251
304
|
};
|
|
252
305
|
eventListeners: {
|
|
@@ -265,9 +318,85 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
265
318
|
}>]>;
|
|
266
319
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
267
320
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
321
|
+
modifiers: AppModifiers;
|
|
268
322
|
api: ExcalidrawImperativeAPI;
|
|
323
|
+
private elementRenderOverrides;
|
|
324
|
+
/** offsets of `elementRenderOverrides`; keeps its identity while they don't change */
|
|
325
|
+
private elementRenderOffsets;
|
|
326
|
+
private renderOverridesUpdatePending;
|
|
327
|
+
private getRenderOverrideConfig;
|
|
328
|
+
private getElementRenderState;
|
|
269
329
|
private createExcalidrawAPI;
|
|
270
330
|
constructor(props: AppProps);
|
|
331
|
+
/**
|
|
332
|
+
* Whether the editor accepts user input (pointer, keyboard, wheel, touch,
|
|
333
|
+
* clipboard, drag&drop). When `false`, the editor is fully inert for the
|
|
334
|
+
* user, but remains controllable through the imperative API.
|
|
335
|
+
*
|
|
336
|
+
* All user-input entry points must consult this getter (directly or by
|
|
337
|
+
* not being attached/rendered at all).
|
|
338
|
+
*/
|
|
339
|
+
isInteractionEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
340
|
+
/**
|
|
341
|
+
* Whether element links render their link icon and are clickable.
|
|
342
|
+
* True when fully interactive, or when `interaction: { enabled: { links:
|
|
343
|
+
* true } }`
|
|
344
|
+
* (in which case clicking anywhere on a linked element opens the link,
|
|
345
|
+
* same as in view mode).
|
|
346
|
+
*/
|
|
347
|
+
isLinksEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
348
|
+
/**
|
|
349
|
+
* Whether canvas navigation — panning & zooming, view-mode style — is
|
|
350
|
+
* enabled. True when fully interactive, or when `interaction: { enabled:
|
|
351
|
+
* { navigation: true } }`. Respects `appState.scrollConstraints`.
|
|
352
|
+
*/
|
|
353
|
+
isNavigationEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
354
|
+
/**
|
|
355
|
+
* Whether embeddable & iframe elements are interactive (hover & click to
|
|
356
|
+
* activate, view-mode style). True when fully interactive, or when
|
|
357
|
+
* allowed via `interaction.enabled.embeds` / `.interactiveContent`.
|
|
358
|
+
*/
|
|
359
|
+
isEmbedsEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
360
|
+
/**
|
|
361
|
+
* Whether the browser's own zoom (ctrl/cmd + wheel, pinch, keyboard
|
|
362
|
+
* shortcuts) stays available over the non-interactive editor.
|
|
363
|
+
* Prevented by default.
|
|
364
|
+
*/
|
|
365
|
+
isBrowserZoomEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
366
|
+
/**
|
|
367
|
+
* Whether the tool can be activated & driven by user input. False when
|
|
368
|
+
* disabled via `UIOptions.tools`, or when the editor is non-interactive
|
|
369
|
+
* and the tool isn't kept user-driven via `interaction.enabled.tools`.
|
|
370
|
+
*
|
|
371
|
+
* (Once UI tool availability is split from input availability — e.g.
|
|
372
|
+
* `props.ui.tools` vs `interaction.disabled.tools` — the UI axis moves
|
|
373
|
+
* out into its own predicate.)
|
|
374
|
+
*
|
|
375
|
+
* We purposely widen the `tool` type so this helper can be called with
|
|
376
|
+
* any tool without having to type check it.
|
|
377
|
+
*/
|
|
378
|
+
isToolSupported: <T extends ToolType | "custom">(tool: T, props?: Pick<AppProps, "interaction" | "UIOptions">) => boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Whether the active tool is locked in place — via the tool lock
|
|
381
|
+
* (padlock / Q) or by being host-forced (`props.activeTool`). A locked
|
|
382
|
+
* tool doesn't revert to the selection tool after use, and elements drawn
|
|
383
|
+
* with it aren't selected. Forcing deliberately does not mutate
|
|
384
|
+
* `activeTool.locked`, which is the user's persisted padlock preference.
|
|
385
|
+
*/
|
|
386
|
+
isToolLocked(): boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Whether the active tool captures the primary pointer instead of the
|
|
389
|
+
* view-mode drag-to-pan — the laser and host-implemented custom tools do;
|
|
390
|
+
* while non-interactive, any tool allowed via
|
|
391
|
+
* `interaction.enabled.tools` does. (Editing tools capture the pointer
|
|
392
|
+
* trivially since view mode implies they're not active; this predicate only
|
|
393
|
+
* matters where view-mode gates apply.)
|
|
394
|
+
*/
|
|
395
|
+
isActiveToolPointerCapturing(): boolean;
|
|
396
|
+
/** Whether Excalidraw's full default UI is rendered. */
|
|
397
|
+
isDefaultUIEnabled(props?: Pick<AppProps, "ui">): boolean;
|
|
398
|
+
/** Whether an individual default UI control is rendered. */
|
|
399
|
+
isUIControlEnabled(control: keyof UIConfig["enabled"], props?: Pick<AppProps, "ui">): boolean;
|
|
271
400
|
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
272
401
|
private onWindowMessage;
|
|
273
402
|
private handleSkipBindMode;
|
|
@@ -280,8 +409,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
280
409
|
* If disabled, returns null.
|
|
281
410
|
*/
|
|
282
411
|
getEffectiveGridSize: () => NullableGridSize;
|
|
283
|
-
private getTextCreationGridPoint;
|
|
284
412
|
private getHTMLIFrameElement;
|
|
413
|
+
/**
|
|
414
|
+
* AI-generated iframe elements aren't interactive while their generation
|
|
415
|
+
* is still in progress (the partial content is render-only).
|
|
416
|
+
*/
|
|
417
|
+
private isIframeLikeInteractive;
|
|
285
418
|
private handleIframeLikeElementHover;
|
|
286
419
|
/** @returns true if iframe-like element click handled */
|
|
287
420
|
private handleIframeLikeCenterClick;
|
|
@@ -302,7 +435,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
302
435
|
getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
303
436
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
304
437
|
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
|
|
305
|
-
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
438
|
+
exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
306
439
|
}) => Promise<void>;
|
|
307
440
|
private magicGenerations;
|
|
308
441
|
private updateMagicGeneration;
|
|
@@ -318,9 +451,35 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
318
451
|
private openEyeDropper;
|
|
319
452
|
dismissLinearEditor: () => void;
|
|
320
453
|
syncActionResult: (actionResult: ActionResult) => void;
|
|
454
|
+
scheduleCapture: () => void;
|
|
321
455
|
private onBlur;
|
|
322
456
|
private onUnload;
|
|
323
457
|
private disableEvent;
|
|
458
|
+
private isFileDropEnabled;
|
|
459
|
+
private onDragOver;
|
|
460
|
+
private handleNavigationModeKeyDown;
|
|
461
|
+
/**
|
|
462
|
+
* PageUp/PageDown scroll the canvas by a page — vertically, or
|
|
463
|
+
* horizontally with shift. Respects `appState.scrollConstraints`
|
|
464
|
+
* (via `viewport.translate`).
|
|
465
|
+
*/
|
|
466
|
+
private maybeHandlePageScrollKeyDown;
|
|
467
|
+
private preventBrowserZoomKeyDown;
|
|
468
|
+
/** Ends active input sessions before switching to a view-mode/non-interactive
|
|
469
|
+
* mode. */
|
|
470
|
+
private terminateActiveInteraction;
|
|
471
|
+
private handleInteractionStateChange;
|
|
472
|
+
/** whether the two values reference the same tool (incl. custom subtype) */
|
|
473
|
+
private isSameForcedTool;
|
|
474
|
+
/**
|
|
475
|
+
* Keeps `state.activeTool` synced to the host-controlled
|
|
476
|
+
* `props.activeTool`. `setActiveTool` refuses non-matching activations
|
|
477
|
+
* while forced (user input, API); this backstop covers the writers that
|
|
478
|
+
* bypass the funnel (`actionFinalize`/`actionDeselect`, `restore()` on
|
|
479
|
+
* scene load, ...) and re-applies the tool once it becomes activatable
|
|
480
|
+
* (e.g. `interaction` config changes).
|
|
481
|
+
*/
|
|
482
|
+
private handleForcedToolChange;
|
|
324
483
|
private resetHistory;
|
|
325
484
|
private resetStore;
|
|
326
485
|
/**
|
|
@@ -342,16 +501,20 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
342
501
|
private onFullscreenChange;
|
|
343
502
|
private removeEventListeners;
|
|
344
503
|
private addEventListeners;
|
|
504
|
+
getSnapshotBeforeUpdate(prevProps: AppProps, prevState: AppState): null;
|
|
505
|
+
/**
|
|
506
|
+
* Flags the container while toggling zen mode so that UI chrome
|
|
507
|
+
* (backgrounds etc.) animates only then, and hover transitions stay
|
|
508
|
+
* instant. A data attribute so that React doesn't reset it on re-render.
|
|
509
|
+
*/
|
|
510
|
+
private markZenModeTransition;
|
|
511
|
+
private unmarkZenModeTransition;
|
|
345
512
|
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
|
|
346
513
|
private renderInteractiveSceneCallback;
|
|
347
514
|
private onScroll;
|
|
348
|
-
private onCut;
|
|
349
|
-
private onCopy;
|
|
350
515
|
private static resetTapTwice;
|
|
351
516
|
private onTouchStart;
|
|
352
517
|
private onTouchEnd;
|
|
353
|
-
private insertClipboardContent;
|
|
354
|
-
pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
|
|
355
518
|
addElementsFromPasteOrLibrary: (opts: {
|
|
356
519
|
elements: readonly ExcalidrawElement[];
|
|
357
520
|
files: BinaryFiles | null;
|
|
@@ -360,57 +523,25 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
360
523
|
clientY: number;
|
|
361
524
|
} | "cursor" | "center";
|
|
362
525
|
retainSeed?: boolean;
|
|
363
|
-
|
|
526
|
+
fit?: SetViewportOptions["fit"];
|
|
527
|
+
preserveFrameChildrenOrder?: boolean;
|
|
364
528
|
}) => void;
|
|
365
|
-
private addElementsFromMixedContentPaste;
|
|
366
|
-
private addTextFromPaste;
|
|
367
529
|
setAppState: React.Component<any, AppState>["setState"];
|
|
368
530
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
369
531
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
370
532
|
updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
371
533
|
togglePenMode: (force: boolean | null) => void;
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
*
|
|
375
|
-
*/
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
|
|
381
|
-
value: number) => void;
|
|
382
|
-
private cancelInProgressAnimation;
|
|
383
|
-
scrollToContent: (
|
|
384
|
-
/**
|
|
385
|
-
* target to scroll to
|
|
386
|
-
*
|
|
387
|
-
* - string - id of element or group, or url containing elementLink
|
|
388
|
-
* - ExcalidrawElement | ExcalidrawElement[] - element(s) objects
|
|
389
|
-
*/
|
|
390
|
-
target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
|
|
391
|
-
fitToContent?: boolean;
|
|
392
|
-
fitToViewport?: never;
|
|
393
|
-
viewportZoomFactor?: number;
|
|
394
|
-
animate?: boolean;
|
|
395
|
-
duration?: number;
|
|
396
|
-
} | {
|
|
397
|
-
fitToContent?: never;
|
|
398
|
-
fitToViewport?: boolean;
|
|
399
|
-
/** when fitToViewport=true, how much screen should the content cover,
|
|
400
|
-
* between 0.1 (10%) and 1 (100%)
|
|
401
|
-
*/
|
|
402
|
-
viewportZoomFactor?: number;
|
|
403
|
-
animate?: boolean;
|
|
404
|
-
duration?: number;
|
|
405
|
-
}) & {
|
|
406
|
-
minZoom?: number;
|
|
407
|
-
maxZoom?: number;
|
|
408
|
-
canvasOffsets?: Offsets;
|
|
409
|
-
}) => void;
|
|
410
|
-
private maybeUnfollowRemoteUser;
|
|
411
|
-
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
412
|
-
private translateCanvas;
|
|
534
|
+
revealIfHidden: (elements: NonDeletedExcalidrawElement[]) => void;
|
|
535
|
+
/** emits a follow/unfollow intent to the host (which owns the
|
|
536
|
+
* `userToFollow` state) via both the `onUserFollow` prop and the
|
|
537
|
+
* imperative API emitter */
|
|
538
|
+
emitUserFollowIntent: (payload: OnUserFollowedPayload) => void;
|
|
539
|
+
/** emits an UNFOLLOW intent if currently following someone — use on
|
|
540
|
+
* viewport changes that take the view over from the followed user (user
|
|
541
|
+
* pans and zooms, `setViewport` navigation) */
|
|
542
|
+
requestUnfollow: () => void;
|
|
413
543
|
setToast: (toast: AppState["toast"]) => void;
|
|
544
|
+
private showSceneReplacedToast;
|
|
414
545
|
restoreFileFromShare: () => Promise<void>;
|
|
415
546
|
/**
|
|
416
547
|
* adds supplied files to existing files in the appState.
|
|
@@ -429,15 +560,21 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
429
560
|
* - `CaptureUpdateAction.NEVER`: Updates never make it to undo/redo stack. Use for remote updates or scene initialization.
|
|
430
561
|
* - `CaptureUpdateAction.EVENTUALLY`: Updates will be eventually be captured as part of a future increment.
|
|
431
562
|
*
|
|
432
|
-
* Check [API docs](https://docs.excalidraw.com/docs/@
|
|
563
|
+
* Check [API docs](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/api/props/excalidraw-api#captureUpdate) for more details.
|
|
433
564
|
*
|
|
434
565
|
* @default CaptureUpdateAction.EVENTUALLY
|
|
435
566
|
*/
|
|
436
567
|
captureUpdate?: SceneData["captureUpdate"];
|
|
437
568
|
}) => void;
|
|
569
|
+
/**
|
|
570
|
+
* see {@link ExcalidrawImperativeAPI.setElementRenderOverrides} for details
|
|
571
|
+
*/
|
|
572
|
+
setElementRenderOverrides: (overrides: ElementRenderOverrides | null) => void;
|
|
438
573
|
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
|
|
439
574
|
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
440
|
-
|
|
575
|
+
triggerRender: (
|
|
576
|
+
/** force always re-renders canvas even if no change */
|
|
577
|
+
force?: boolean) => void;
|
|
441
578
|
/**
|
|
442
579
|
* @returns whether the menu was toggled on or off
|
|
443
580
|
*/
|
|
@@ -447,10 +584,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
447
584
|
force?: boolean;
|
|
448
585
|
}) => boolean;
|
|
449
586
|
private updateCurrentCursorPosition;
|
|
450
|
-
getEditorUIOffsets: () => Offsets;
|
|
451
587
|
private onKeyDown;
|
|
452
588
|
private onKeyUp;
|
|
453
|
-
private isToolSupported;
|
|
454
589
|
setActiveTool: (tool: ({
|
|
455
590
|
type: ToolType;
|
|
456
591
|
} | {
|
|
@@ -459,10 +594,18 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
459
594
|
}) & {
|
|
460
595
|
locked?: boolean;
|
|
461
596
|
fromSelection?: boolean;
|
|
462
|
-
},
|
|
597
|
+
}, opts?: {
|
|
598
|
+
keepSelection?: boolean;
|
|
599
|
+
/**
|
|
600
|
+
* When `true`, re-activating an already-active toggle tool (see
|
|
601
|
+
* `TOGGLE_TOOLS`) switches back to the previously active tool.
|
|
602
|
+
* Activation is idempotent by default; toggle tools always record the
|
|
603
|
+
* previously active tool regardless (so ESC and the next `toggle`
|
|
604
|
+
* activation can switch back to it).
|
|
605
|
+
*/
|
|
606
|
+
toggle?: boolean;
|
|
607
|
+
}) => void;
|
|
463
608
|
setOpenDialog: (dialogType: AppState["openDialog"]) => void;
|
|
464
|
-
private setCursor;
|
|
465
|
-
private resetCursor;
|
|
466
609
|
/**
|
|
467
610
|
* returns whether user is making a gesture with >= 2 fingers (points)
|
|
468
611
|
* on o touch screen (not on a trackpad). Currently only relates to Darwin
|
|
@@ -474,32 +617,93 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
474
617
|
private onGestureStart;
|
|
475
618
|
private onGestureChange;
|
|
476
619
|
private onGestureEnd;
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
620
|
+
getElementAtPosition(x: number, y: number, opts?: ({
|
|
621
|
+
includeBoundTextElement?: boolean;
|
|
622
|
+
includeLockedElements?: boolean;
|
|
623
|
+
} | {
|
|
624
|
+
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
625
|
+
}) & {
|
|
626
|
+
preferSelected?: boolean;
|
|
627
|
+
}): NonDeleted<ExcalidrawElement> | null;
|
|
628
|
+
getElementsAtPosition(x: number, y: number, opts?: {
|
|
629
|
+
includeBoundTextElement?: boolean;
|
|
630
|
+
includeLockedElements?: boolean;
|
|
631
|
+
}): NonDeleted<ExcalidrawElement>[];
|
|
632
|
+
/**
|
|
633
|
+
* Whether the element's frame clips it away at the position — hitting a
|
|
634
|
+
* frame's element from outside the frame is not considered a hit.
|
|
635
|
+
*/
|
|
636
|
+
isClippedByFrameAt(x: number, y: number, element: ExcalidrawElement): boolean;
|
|
486
637
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
487
|
-
|
|
488
|
-
private getTextBindableContainerAtPosition;
|
|
489
|
-
private startTextEditing;
|
|
638
|
+
hitElement(x: number, y: number, element: NonDeletedExcalidrawElement, considerBoundingBox?: boolean): boolean;
|
|
490
639
|
private startImageCropping;
|
|
491
|
-
|
|
640
|
+
finishImageCropping: () => void;
|
|
492
641
|
private shouldHandleBrowserCanvasDoubleClick;
|
|
493
642
|
private handleCanvasDoubleClick;
|
|
494
643
|
private handleCanvasClick;
|
|
495
|
-
|
|
644
|
+
getElementLinkAtPosition: (scenePointer: Readonly<{
|
|
645
|
+
x: number;
|
|
646
|
+
y: number;
|
|
647
|
+
}>, hitElementMightBeLocked: NonDeletedExcalidrawElement | null) => NonDeletedExcalidrawElement | undefined;
|
|
496
648
|
private handleElementLinkClick;
|
|
497
|
-
|
|
649
|
+
/**
|
|
650
|
+
* Applies (or clears) the element-link hover affordances — pointer cursor
|
|
651
|
+
* and tooltip — based on the current `hitLinkElement`. Returns whether a
|
|
652
|
+
* link is being hovered.
|
|
653
|
+
*/
|
|
654
|
+
private applyElementLinkHoverAffordance;
|
|
655
|
+
/**
|
|
656
|
+
* On touchscreens (where no hover precedes the tap) re-derives
|
|
657
|
+
* `hitLinkElement`, then opens the hit element link, if any.
|
|
658
|
+
* Returns whether a link click was handled.
|
|
659
|
+
*/
|
|
660
|
+
private maybeHandleElementLinkClick;
|
|
661
|
+
/**
|
|
662
|
+
* Restricted pointer handling for the non-interactive editor with links
|
|
663
|
+
* and/or embeds allowed (`interaction.enabled.links` / `.embeds` /
|
|
664
|
+
* `.interactiveContent`) — runs only the element-link & embed concerns
|
|
665
|
+
* (shared with the full pointer handlers above) so they behave like in
|
|
666
|
+
* view mode without the rest of the canvas pointer machinery.
|
|
667
|
+
*/
|
|
668
|
+
private handleInteractiveContentPointerMove;
|
|
669
|
+
private handleInteractiveContentPointerUp;
|
|
670
|
+
/**
|
|
671
|
+
* finds candidate frame under cursor (when dragging frame children/elements
|
|
672
|
+
* inside frames)
|
|
673
|
+
*/
|
|
674
|
+
getTopLayerFrameAtSceneCoords: (
|
|
675
|
+
/**
|
|
676
|
+
* should be already grid aligned (basically should be what the call site
|
|
677
|
+
* sets the element's coords to, if applicable)
|
|
678
|
+
*/
|
|
679
|
+
sceneCoords: {
|
|
680
|
+
x: number;
|
|
681
|
+
y: number;
|
|
682
|
+
}, opts?: {
|
|
683
|
+
/** to exclude selected elements when dragging, etc. */
|
|
684
|
+
excludeElementIds?: AppState["selectedElementIds"];
|
|
685
|
+
currentFrameId?: ExcalidrawElement["frameId"];
|
|
686
|
+
}) => NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
687
|
+
updateFrameToHighlight: (frameToHighlight: AppState["frameToHighlight"]) => void;
|
|
688
|
+
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
689
|
+
insertNewElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
690
|
+
insertNewElement: (element: ExcalidrawElement) => void;
|
|
498
691
|
private handleCanvasPointerMove;
|
|
499
692
|
private handleEraser;
|
|
500
693
|
private handleTouchMove;
|
|
694
|
+
/**
|
|
695
|
+
* Applies the hover affordances of a selected linear element: the cursor,
|
|
696
|
+
* plus the hovered-handle state that renders them highlighted.
|
|
697
|
+
*/
|
|
501
698
|
handleHoverSelectedLinearElement(linearElementEditor: LinearElementEditor, scenePointerX: number, scenePointerY: number): void;
|
|
502
699
|
private handleCanvasPointerDown;
|
|
700
|
+
/**
|
|
701
|
+
* The browser took the pointer over (scroll, pinch, palm rejection): no
|
|
702
|
+
* pointerup will follow, so the gesture is torn down here and now — the
|
|
703
|
+
* same cleanup a lost pointerup gets at the next press, only not left
|
|
704
|
+
* lying in wait for it, where its replay would tangle with that press.
|
|
705
|
+
*/
|
|
706
|
+
private handleCanvasPointerCancel;
|
|
503
707
|
private handleCanvasPointerUp;
|
|
504
708
|
private maybeOpenContextMenuAfterPointerDownOnTouchDevices;
|
|
505
709
|
private resetContextMenuTimer;
|
|
@@ -509,18 +713,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
509
713
|
* pointerup handlers manually
|
|
510
714
|
*/
|
|
511
715
|
private maybeCleanupAfterMissingPointerUp;
|
|
512
|
-
handleCanvasPanUsingWheelOrSpaceDrag: (event: React.PointerEvent<HTMLElement> | MouseEvent) => boolean;
|
|
513
716
|
private updateGestureOnPointerDown;
|
|
514
|
-
private initialPointerDownState;
|
|
515
|
-
private handleDraggingScrollBar;
|
|
516
|
-
private clearSelectionIfNotUsingSelection;
|
|
517
717
|
/**
|
|
518
|
-
*
|
|
718
|
+
* Tracks the pointer within the ongoing multi-touch gesture and applies
|
|
719
|
+
* the two-finger pinch zoom/pan, if any.
|
|
519
720
|
*/
|
|
520
|
-
private
|
|
521
|
-
private
|
|
522
|
-
private
|
|
523
|
-
private handleTextOnPointerDown;
|
|
721
|
+
private updateMultiTouchGesture;
|
|
722
|
+
private initialPointerDownState;
|
|
723
|
+
private handleDraggingScrollBar;
|
|
524
724
|
private handleFreeDrawElementOnPointerDown;
|
|
525
725
|
insertIframeElement: ({ sceneX, sceneY, width, height, }: {
|
|
526
726
|
sceneX: number;
|
|
@@ -535,11 +735,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
535
735
|
}) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
|
|
536
736
|
private newImagePlaceholder;
|
|
537
737
|
private handleLinearElementOnPointerDown;
|
|
538
|
-
|
|
738
|
+
getCurrentItemRoundness(elementType: "selection" | "rectangle" | "stickynote" | "diamond" | "ellipse" | "iframe" | "embeddable"): {
|
|
739
|
+
type: 2 | 3;
|
|
740
|
+
} | null;
|
|
741
|
+
getCurrentItemStrokeWidth(elementType: ExcalidrawElement["type"]): number;
|
|
539
742
|
private createGenericElementOnPointerDown;
|
|
540
743
|
private createFrameElementOnPointerDown;
|
|
541
|
-
|
|
542
|
-
|
|
744
|
+
maybeCacheReferenceSnapPoints(event: KeyboardModifiersObject, selectedElements: readonly NonDeletedExcalidrawElement[], recomputeAnyways?: boolean): void;
|
|
745
|
+
maybeCacheVisibleGaps(event: KeyboardModifiersObject, selectedElements: readonly NonDeletedExcalidrawElement[], recomputeAnyways?: boolean): void;
|
|
543
746
|
private onKeyDownFromPointerDownHandler;
|
|
544
747
|
private onKeyUpFromPointerDownHandler;
|
|
545
748
|
private onPointerMoveFromPointerDownHandler;
|
|
@@ -564,20 +767,30 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
564
767
|
/** generally you should use `addNewImagesToImageCache()` directly if you need
|
|
565
768
|
* to render new images. This is just a failsafe */
|
|
566
769
|
private scheduleImageRefresh;
|
|
567
|
-
private clearSelection;
|
|
568
770
|
private handleInteractiveCanvasRef;
|
|
569
|
-
|
|
771
|
+
insertImages: (imageFiles: File[], sceneX: number, sceneY: number) => Promise<void>;
|
|
570
772
|
private handleAppOnDrop;
|
|
571
|
-
|
|
773
|
+
/** @returns true if the file replaced the scene */
|
|
774
|
+
loadFileToCanvas: (file: File, fileHandle: FileSystemFileHandle | null, insertPosition?: {
|
|
775
|
+
clientX: number;
|
|
776
|
+
clientY: number;
|
|
777
|
+
}) => Promise<true | undefined>;
|
|
572
778
|
private handleCanvasContextMenu;
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
779
|
+
/** opens the context menu for the element under the pointer, or the canvas */
|
|
780
|
+
openContextMenu: (pointer: {
|
|
781
|
+
clientX: number;
|
|
782
|
+
clientY: number;
|
|
783
|
+
button?: number;
|
|
784
|
+
pointerType?: string;
|
|
785
|
+
}) => void;
|
|
786
|
+
maybeDragNewGenericElement: (pointerDownState: PointerDownState, event: MouseEvent | KeyboardEvent, informMutation?: boolean) => void;
|
|
576
787
|
private getContextMenuItems;
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
788
|
+
savePointer: (x: number, y: number, button: "up" | "down") => void;
|
|
789
|
+
resetShouldCacheIgnoreZoomDebounced: {
|
|
790
|
+
(): void;
|
|
791
|
+
flush(): void;
|
|
792
|
+
cancel(): void;
|
|
793
|
+
};
|
|
581
794
|
private updateDOMRect;
|
|
582
795
|
refresh: () => void;
|
|
583
796
|
private getCanvasOffsets;
|