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